From b8469a4cd0b19db40088620ce3c835894ee80517 Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> Date: Tue, 20 Sep 2022 13:01:05 +0530 Subject: [PATCH] style: lint fix all files Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> --- public/resources/L.TileLayer.NoGap.js | 412 +- public/resources/leaflet.js | 7269 ++- public/resources/maplibre-gl-compat.js | 40538 +++++++++++++++- .../maplibre-gl-inspect-compat.min.js | 1656 +- public/resources/maplibre-gl-inspect.min.js | 1599 +- public/resources/maplibre-gl.js | 36172 +++++++++++++- 6 files changed, 87387 insertions(+), 259 deletions(-) diff --git a/public/resources/L.TileLayer.NoGap.js b/public/resources/L.TileLayer.NoGap.js index 40545a2..530b5a5 100644 --- a/public/resources/L.TileLayer.NoGap.js +++ b/public/resources/L.TileLayer.NoGap.js @@ -1,243 +1,249 @@ // @class TileLayer L.TileLayer.mergeOptions({ - // @option keepBuffer - // The amount of tiles outside the visible map area to be kept in the stitched - // `TileLayer`. + // @option keepBuffer + // The amount of tiles outside the visible map area to be kept in the stitched + // `TileLayer`. - // @option dumpToCanvas: Boolean = true - // Whether to dump loaded tiles to a `` to prevent some rendering - // artifacts. (Disabled by default in IE) - dumpToCanvas: L.Browser.canvas && !L.Browser.ie, + // @option dumpToCanvas: Boolean = true + // Whether to dump loaded tiles to a `` to prevent some rendering + // artifacts. (Disabled by default in IE) + dumpToCanvas: L.Browser.canvas && !L.Browser.ie, }); L.TileLayer.include({ - _onUpdateLevel: function(z, zoom) { - if (this.options.dumpToCanvas) { - this._levels[z].canvas.style.zIndex = - this.options.maxZoom - Math.abs(zoom - z); - } - }, + _onUpdateLevel: function (z, zoom) { + if (this.options.dumpToCanvas) { + this._levels[z].canvas.style.zIndex = + this.options.maxZoom - Math.abs(zoom - z); + } + }, - _onRemoveLevel: function(z) { - if (this.options.dumpToCanvas) { - L.DomUtil.remove(this._levels[z].canvas); - } - }, + _onRemoveLevel: function (z) { + if (this.options.dumpToCanvas) { + L.DomUtil.remove(this._levels[z].canvas); + } + }, - _onCreateLevel: function(level) { - if (this.options.dumpToCanvas) { - level.canvas = L.DomUtil.create( - "canvas", - "leaflet-tile-container leaflet-zoom-animated", - this._container - ); - level.ctx = level.canvas.getContext("2d"); - this._resetCanvasSize(level); - } - }, + _onCreateLevel: function (level) { + if (this.options.dumpToCanvas) { + level.canvas = L.DomUtil.create( + 'canvas', + 'leaflet-tile-container leaflet-zoom-animated', + this._container, + ); + level.ctx = level.canvas.getContext('2d'); + this._resetCanvasSize(level); + } + }, - _removeTile: function(key) { - if (this.options.dumpToCanvas) { - var tile = this._tiles[key]; - var level = this._levels[tile.coords.z]; - var tileSize = this.getTileSize(); + _removeTile: function (key) { + if (this.options.dumpToCanvas) { + var tile = this._tiles[key]; + var level = this._levels[tile.coords.z]; + var tileSize = this.getTileSize(); - if (level) { - // Where in the canvas should this tile go? - var offset = L.point(tile.coords.x, tile.coords.y) - .subtract(level.canvasRange.min) - .scaleBy(this.getTileSize()); + if (level) { + // Where in the canvas should this tile go? + var offset = L.point(tile.coords.x, tile.coords.y) + .subtract(level.canvasRange.min) + .scaleBy(this.getTileSize()); - level.ctx.clearRect(offset.x, offset.y, tileSize.x, tileSize.y); - } - } + level.ctx.clearRect(offset.x, offset.y, tileSize.x, tileSize.y); + } + } - L.GridLayer.prototype._removeTile.call(this, key); - }, + L.GridLayer.prototype._removeTile.call(this, key); + }, - _resetCanvasSize: function(level) { - var buff = this.options.keepBuffer, - pixelBounds = this._getTiledPixelBounds(this._map.getCenter()), - tileRange = this._pxBoundsToTileRange(pixelBounds), - tileSize = this.getTileSize(); + _resetCanvasSize: function (level) { + var buff = this.options.keepBuffer, + pixelBounds = this._getTiledPixelBounds(this._map.getCenter()), + tileRange = this._pxBoundsToTileRange(pixelBounds), + tileSize = this.getTileSize(); - tileRange.min = tileRange.min.subtract([buff, buff]); // This adds the no-prune buffer - tileRange.max = tileRange.max.add([buff + 1, buff + 1]); + tileRange.min = tileRange.min.subtract([buff, buff]); // This adds the no-prune buffer + tileRange.max = tileRange.max.add([buff + 1, buff + 1]); - var pixelRange = L.bounds( - tileRange.min.scaleBy(tileSize), - tileRange.max.add([1, 1]).scaleBy(tileSize) // This prevents an off-by-one when checking if tiles are inside - ), - mustRepositionCanvas = false, - neededSize = pixelRange.max.subtract(pixelRange.min); + var pixelRange = L.bounds( + tileRange.min.scaleBy(tileSize), + tileRange.max.add([1, 1]).scaleBy(tileSize), // This prevents an off-by-one when checking if tiles are inside + ), + mustRepositionCanvas = false, + neededSize = pixelRange.max.subtract(pixelRange.min); - // Resize the canvas, if needed, and only to make it bigger. - if ( - neededSize.x > level.canvas.width || - neededSize.y > level.canvas.height - ) { - // Resizing canvases erases the currently drawn content, I'm afraid. - // To keep it, dump the pixels to another canvas, then display it on - // top. This could be done with getImageData/putImageData, but that - // would break for tainted canvases (in non-CORS tilesets) - var oldSize = { x: level.canvas.width, y: level.canvas.height }; - // console.info('Resizing canvas from ', oldSize, 'to ', neededSize); + // Resize the canvas, if needed, and only to make it bigger. + if ( + neededSize.x > level.canvas.width || + neededSize.y > level.canvas.height + ) { + // Resizing canvases erases the currently drawn content, I'm afraid. + // To keep it, dump the pixels to another canvas, then display it on + // top. This could be done with getImageData/putImageData, but that + // would break for tainted canvases (in non-CORS tilesets) + var oldSize = { x: level.canvas.width, y: level.canvas.height }; + // console.info('Resizing canvas from ', oldSize, 'to ', neededSize); - var tmpCanvas = L.DomUtil.create("canvas"); - tmpCanvas.style.width = (tmpCanvas.width = oldSize.x) + "px"; - tmpCanvas.style.height = (tmpCanvas.height = oldSize.y) + "px"; - tmpCanvas.getContext("2d").drawImage(level.canvas, 0, 0); - // var data = level.ctx.getImageData(0, 0, oldSize.x, oldSize.y); + var tmpCanvas = L.DomUtil.create('canvas'); + tmpCanvas.style.width = (tmpCanvas.width = oldSize.x) + 'px'; + tmpCanvas.style.height = (tmpCanvas.height = oldSize.y) + 'px'; + tmpCanvas.getContext('2d').drawImage(level.canvas, 0, 0); + // var data = level.ctx.getImageData(0, 0, oldSize.x, oldSize.y); - level.canvas.style.width = (level.canvas.width = neededSize.x) + "px"; - level.canvas.style.height = (level.canvas.height = neededSize.y) + "px"; - level.ctx.drawImage(tmpCanvas, 0, 0); - // level.ctx.putImageData(data, 0, 0, 0, 0, oldSize.x, oldSize.y); - } + level.canvas.style.width = (level.canvas.width = neededSize.x) + 'px'; + level.canvas.style.height = (level.canvas.height = neededSize.y) + 'px'; + level.ctx.drawImage(tmpCanvas, 0, 0); + // level.ctx.putImageData(data, 0, 0, 0, 0, oldSize.x, oldSize.y); + } - // Translate the canvas contents if it's moved around - if (level.canvasRange) { - var offset = level.canvasRange.min - .subtract(tileRange.min) - .scaleBy(this.getTileSize()); + // Translate the canvas contents if it's moved around + if (level.canvasRange) { + var offset = level.canvasRange.min + .subtract(tileRange.min) + .scaleBy(this.getTileSize()); - // console.info('Offsetting by ', offset); + // console.info('Offsetting by ', offset); - if (!L.Browser.safari) { - // By default, canvases copy things "on top of" existing pixels, but we want - // this to *replace* the existing pixels when doing a drawImage() call. - // This will also clear the sides, so no clearRect() calls are needed to make room - // for the new tiles. - level.ctx.globalCompositeOperation = "copy"; - level.ctx.drawImage(level.canvas, offset.x, offset.y); - level.ctx.globalCompositeOperation = "source-over"; - } else { - // Safari clears the canvas when copying from itself :-( - if (!this._tmpCanvas) { - var t = (this._tmpCanvas = L.DomUtil.create("canvas")); - t.width = level.canvas.width; - t.height = level.canvas.height; - this._tmpContext = t.getContext("2d"); - } - this._tmpContext.clearRect( - 0, - 0, - level.canvas.width, - level.canvas.height - ); - this._tmpContext.drawImage(level.canvas, 0, 0); - level.ctx.clearRect(0, 0, level.canvas.width, level.canvas.height); - level.ctx.drawImage(this._tmpCanvas, offset.x, offset.y); - } + if (!L.Browser.safari) { + // By default, canvases copy things "on top of" existing pixels, but we want + // this to *replace* the existing pixels when doing a drawImage() call. + // This will also clear the sides, so no clearRect() calls are needed to make room + // for the new tiles. + level.ctx.globalCompositeOperation = 'copy'; + level.ctx.drawImage(level.canvas, offset.x, offset.y); + level.ctx.globalCompositeOperation = 'source-over'; + } else { + // Safari clears the canvas when copying from itself :-( + if (!this._tmpCanvas) { + var t = (this._tmpCanvas = L.DomUtil.create('canvas')); + t.width = level.canvas.width; + t.height = level.canvas.height; + this._tmpContext = t.getContext('2d'); + } + this._tmpContext.clearRect( + 0, + 0, + level.canvas.width, + level.canvas.height, + ); + this._tmpContext.drawImage(level.canvas, 0, 0); + level.ctx.clearRect(0, 0, level.canvas.width, level.canvas.height); + level.ctx.drawImage(this._tmpCanvas, offset.x, offset.y); + } - mustRepositionCanvas = true; // Wait until new props are set - } + mustRepositionCanvas = true; // Wait until new props are set + } - level.canvasRange = tileRange; - level.canvasPxRange = pixelRange; - level.canvasOrigin = pixelRange.min; + level.canvasRange = tileRange; + level.canvasPxRange = pixelRange; + level.canvasOrigin = pixelRange.min; - // console.log('Canvas tile range: ', level, tileRange.min, tileRange.max ); - // console.log('Canvas pixel range: ', pixelRange.min, pixelRange.max ); - // console.log('Level origin: ', level.origin ); + // console.log('Canvas tile range: ', level, tileRange.min, tileRange.max ); + // console.log('Canvas pixel range: ', pixelRange.min, pixelRange.max ); + // console.log('Level origin: ', level.origin ); - if (mustRepositionCanvas) { - this._setCanvasZoomTransform( - level, - this._map.getCenter(), - this._map.getZoom() - ); - } - }, + if (mustRepositionCanvas) { + this._setCanvasZoomTransform( + level, + this._map.getCenter(), + this._map.getZoom(), + ); + } + }, - /// set transform/position of canvas, in addition to the transform/position of the individual tile container - _setZoomTransform: function(level, center, zoom) { - L.GridLayer.prototype._setZoomTransform.call(this, level, center, zoom); - if (this.options.dumpToCanvas) { - this._setCanvasZoomTransform(level, center, zoom); - } - }, + /// set transform/position of canvas, in addition to the transform/position of the individual tile container + _setZoomTransform: function (level, center, zoom) { + L.GridLayer.prototype._setZoomTransform.call(this, level, center, zoom); + if (this.options.dumpToCanvas) { + this._setCanvasZoomTransform(level, center, zoom); + } + }, - // This will get called twice: - // * From _setZoomTransform - // * When the canvas has shifted due to a new tile being loaded - _setCanvasZoomTransform: function(level, center, zoom) { - // console.log('_setCanvasZoomTransform', level, center, zoom); - if (!level.canvasOrigin) { - return; - } - var scale = this._map.getZoomScale(zoom, level.zoom), - translate = level.canvasOrigin - .multiplyBy(scale) - .subtract(this._map._getNewPixelOrigin(center, zoom)) - .round(); + // This will get called twice: + // * From _setZoomTransform + // * When the canvas has shifted due to a new tile being loaded + _setCanvasZoomTransform: function (level, center, zoom) { + // console.log('_setCanvasZoomTransform', level, center, zoom); + if (!level.canvasOrigin) { + return; + } + var scale = this._map.getZoomScale(zoom, level.zoom), + translate = level.canvasOrigin + .multiplyBy(scale) + .subtract(this._map._getNewPixelOrigin(center, zoom)) + .round(); - if (L.Browser.any3d) { - L.DomUtil.setTransform(level.canvas, translate, scale); - } else { - L.DomUtil.setPosition(level.canvas, translate); - } - }, + if (L.Browser.any3d) { + L.DomUtil.setTransform(level.canvas, translate, scale); + } else { + L.DomUtil.setPosition(level.canvas, translate); + } + }, - _onOpaqueTile: function(tile) { - if (!this.options.dumpToCanvas) { - return; - } + _onOpaqueTile: function (tile) { + if (!this.options.dumpToCanvas) { + return; + } - // Guard against an NS_ERROR_NOT_AVAILABLE (or similar) exception - // when a non-image-tile has been loaded (e.g. a WMS error). - // Checking for tile.el.complete is not enough, as it has been - // already marked as loaded and ready somehow. - try { - this.dumpPixels(tile.coords, tile.el); - } catch (ex) { - return this.fire("tileerror", { - error: "Could not copy tile pixels: " + ex, - tile: tile, - coods: tile.coords, - }); - } + // Guard against an NS_ERROR_NOT_AVAILABLE (or similar) exception + // when a non-image-tile has been loaded (e.g. a WMS error). + // Checking for tile.el.complete is not enough, as it has been + // already marked as loaded and ready somehow. + try { + this.dumpPixels(tile.coords, tile.el); + } catch (ex) { + return this.fire('tileerror', { + error: 'Could not copy tile pixels: ' + ex, + tile: tile, + coods: tile.coords, + }); + } - // If dumping the pixels was successful, then hide the tile. - // Do not remove the tile itself, as it is needed to check if the whole - // level (and its canvas) should be removed (via level.el.children.length) - tile.el.style.display = "none"; - }, + // If dumping the pixels was successful, then hide the tile. + // Do not remove the tile itself, as it is needed to check if the whole + // level (and its canvas) should be removed (via level.el.children.length) + tile.el.style.display = 'none'; + }, - // @section Extension methods - // @uninheritable + // @section Extension methods + // @uninheritable - // @method dumpPixels(coords: Object, imageSource: CanvasImageSource): this - // Dumps pixels from the given `CanvasImageSource` into the layer, into - // the space for the tile represented by the `coords` tile coordinates (an object - // like `{x: Number, y: Number, z: Number}`; the image source must have the - // same size as the `tileSize` option for the layer. Has no effect if `dumpToCanvas` - // is `false`. - dumpPixels: function(coords, imageSource) { - var level = this._levels[coords.z], - tileSize = this.getTileSize(); + // @method dumpPixels(coords: Object, imageSource: CanvasImageSource): this + // Dumps pixels from the given `CanvasImageSource` into the layer, into + // the space for the tile represented by the `coords` tile coordinates (an object + // like `{x: Number, y: Number, z: Number}`; the image source must have the + // same size as the `tileSize` option for the layer. Has no effect if `dumpToCanvas` + // is `false`. + dumpPixels: function (coords, imageSource) { + var level = this._levels[coords.z], + tileSize = this.getTileSize(); - if (!level.canvasRange || !this.options.dumpToCanvas) { - return; - } + if (!level.canvasRange || !this.options.dumpToCanvas) { + return; + } - // Check if the tile is inside the currently visible map bounds - // There is a possible race condition when tiles are loaded after they - // have been panned outside of the map. - if (!level.canvasRange.contains(coords)) { - this._resetCanvasSize(level); - } + // Check if the tile is inside the currently visible map bounds + // There is a possible race condition when tiles are loaded after they + // have been panned outside of the map. + if (!level.canvasRange.contains(coords)) { + this._resetCanvasSize(level); + } - // Where in the canvas should this tile go? - var offset = L.point(coords.x, coords.y) - .subtract(level.canvasRange.min) - .scaleBy(this.getTileSize()); + // Where in the canvas should this tile go? + var offset = L.point(coords.x, coords.y) + .subtract(level.canvasRange.min) + .scaleBy(this.getTileSize()); - level.ctx.drawImage(imageSource, offset.x, offset.y, tileSize.x, tileSize.y); + level.ctx.drawImage( + imageSource, + offset.x, + offset.y, + tileSize.x, + tileSize.y, + ); - // TODO: Clear the pixels of other levels' canvases where they overlap - // this newly dumped tile. - return this; - }, + // TODO: Clear the pixels of other levels' canvases where they overlap + // this newly dumped tile. + return this; + }, }); diff --git a/public/resources/leaflet.js b/public/resources/leaflet.js index a98a411..98a34b5 100644 --- a/public/resources/leaflet.js +++ b/public/resources/leaflet.js @@ -2,5 +2,7270 @@ * Leaflet 1.8.0, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).leaflet={})}(this,function(t){"use strict";function l(t){for(var i,e,n=1,o=arguments.length;n=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=f(t);var i=this.min,e=this.max,n=t.min,t=t.max,o=t.x>=i.x&&n.x<=e.x,t=t.y>=i.y&&n.y<=e.y;return o&&t},overlaps:function(t){t=f(t);var i=this.min,e=this.max,n=t.min,t=t.max,o=t.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=g(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>=i.lat&&n.lat<=e.lat,t=t.lng>=i.lng&&n.lng<=e.lng;return o&&t},overlaps:function(t){t=g(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>i.lat&&n.lati.lng&&n.lng","http://www.w3.org/2000/svg"===(Wt.firstChild&&Wt.firstChild.namespaceURI));function y(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var P={ie:pt,ielt9:mt,edge:n,webkit:ft,android:gt,android23:vt,androidStock:yt,opera:xt,chrome:wt,gecko:Pt,safari:bt,phantom:Lt,opera12:o,win:Tt,ie3d:zt,webkit3d:Mt,gecko3d:_t,any3d:Ct,mobile:Zt,mobileWebkit:St,mobileWebkit3d:kt,msPointer:Et,pointer:Bt,touch:It,touchNative:At,mobileOpera:Ot,mobileGecko:Rt,retina:Nt,passiveEvents:Dt,canvas:jt,svg:Ht,vml:!Ht&&function(){try{var t=document.createElement("div"),i=(t.innerHTML='',t.firstChild);return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}(),inlineSvg:Wt},Ft=P.msPointer?"MSPointerDown":"pointerdown",Ut=P.msPointer?"MSPointerMove":"pointermove",Vt=P.msPointer?"MSPointerUp":"pointerup",qt=P.msPointer?"MSPointerCancel":"pointercancel",Gt={touchstart:Ft,touchmove:Ut,touchend:Vt,touchcancel:qt},Kt={touchstart:function(t,i){i.MSPOINTER_TYPE_TOUCH&&i.pointerType===i.MSPOINTER_TYPE_TOUCH&&B(i);ii(t,i)},touchmove:ii,touchend:ii,touchcancel:ii},Yt={},Xt=!1;function Jt(t,i,e){return"touchstart"!==i||Xt||(document.addEventListener(Ft,$t,!0),document.addEventListener(Ut,Qt,!0),document.addEventListener(Vt,ti,!0),document.addEventListener(qt,ti,!0),Xt=!0),Kt[i]?(e=Kt[i].bind(this,e),t.addEventListener(Gt[i],e,!1),e):(console.warn("wrong event specified:",i),L.Util.falseFn)}function $t(t){Yt[t.pointerId]=t}function Qt(t){Yt[t.pointerId]&&(Yt[t.pointerId]=t)}function ti(t){delete Yt[t.pointerId]}function ii(t,i){if(i.pointerType!==(i.MSPOINTER_TYPE_MOUSE||"mouse")){for(var e in i.touches=[],Yt)i.touches.push(Yt[e]);i.changedTouches=[i],t(i)}}var ei=200;function ni(t,e){t.addEventListener("dblclick",e);var n,o=0;function i(t){var i;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||((i=Date.now())-o<=ei?2===++n&&e(function(t){var i,e,n={};for(e in t)i=t[e],n[e]=i&&i.bind?i.bind(t):i;return(t=n).type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}(t)):n=1,o=i)}return t.addEventListener("click",i),{dblclick:e,simDblclick:i}}var oi,si,ri,ai,hi,li,ui=wi(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ci=wi(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),di="webkitTransition"===ci||"OTransition"===ci?ci+"End":"transitionend";function _i(t){return"string"==typeof t?document.getElementById(t):t}function pi(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];return"auto"===(e=e&&"auto"!==e||!document.defaultView?e:(t=document.defaultView.getComputedStyle(t,null))?t[i]:null)?null:e}function b(t,i,e){t=document.createElement(t);return t.className=i||"",e&&e.appendChild(t),t}function T(t){var i=t.parentNode;i&&i.removeChild(t)}function mi(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function fi(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function gi(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function vi(t,i){if(void 0!==t.classList)return t.classList.contains(i);t=xi(t);return 0this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),t=this._limitCenter(e,this._zoom,g(t));return e.equals(t)||this.panTo(t,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=_((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=_(i.paddingBottomRight||i.padding||[0,0]),o=this.project(this.getCenter()),t=this.project(t),s=this.getPixelBounds(),e=f([s.min.add(e),s.max.subtract(n)]),s=e.getSize();return e.contains(t)||(this._enforcingBounds=!0,n=t.subtract(e.getCenter()),e=e.extend(t).getSize().subtract(s),o.x+=n.x<0?-e.x:e.x,o.y+=n.y<0?-e.y:e.y,this.panTo(this.unproject(o),i),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=l({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize(),e=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),n=i.divideBy(2).round(),o=e.divideBy(2).round(),n=n.subtract(o);return n.x||n.y?(t.animate&&t.pan?this.panBy(n):(t.pan&&this._rawPanBy(n),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(a(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:e})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=l({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=a(this._handleGeolocationResponse,this),e=a(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,e,t):navigator.geolocation.getCurrentPosition(i,e,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i;this._container._leaflet_id&&(i=t.code,t=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var i,e,n=new v(t.coords.latitude,t.coords.longitude),o=n.toBounds(2*t.coords.accuracy),s=this._locateOptions,r=(s.setView&&(i=this.getBoundsZoom(o),this.setView(n,s.maxZoom?Math.min(i,s.maxZoom):i)),{latlng:n,bounds:o,timestamp:t.timestamp});for(e in t.coords)"number"==typeof t.coords[e]&&(r[e]=t.coords[e]);this.fire("locationfound",r)}},addHandler:function(t,i){if(!i)return this;i=this[t]=new i(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),T(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(r(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)T(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){i=b("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new s(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=g(t),e=_(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),t=t.getSouthEast(),e=this.getSize().subtract(e),t=f(this.project(t,n),this.project(r,n)).getSize(),r=P.any3d?this.options.zoomSnap:1,a=e.x/t.x,e=e.y/t.y,t=i?Math.max(a,e):Math.min(a,e),n=this.getScaleZoom(t,n);return r&&(n=Math.round(n/(r/100))*(r/100),n=i?Math.ceil(n/r)*r:Math.floor(n/r)*r),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new p(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){t=this._getTopLeftPoint(t,i);return new m(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs,t=(i=void 0===i?this._zoom:i,e.zoom(t*e.scale(i)));return isNaN(t)?1/0:t},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(w(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(_(t),i)},layerPointToLatLng:function(t){t=_(t).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(t){return this.project(w(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(w(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(g(t))},distance:function(t,i){return this.options.crs.distance(w(t),w(i))},containerPointToLayerPoint:function(t){return _(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return _(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){t=this.containerPointToLayerPoint(_(t));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(w(t)))},mouseEventToContainerPoint:function(t){return Ni(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){t=this._container=_i(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");S(t,"scroll",this._onScroll,this),this._containerId=h(t)},_initLayout:function(){var t=this._container,i=(this._fadeAnimated=this.options.fadeAnimation&&P.any3d,z(t,"leaflet-container"+(P.touch?" leaflet-touch":"")+(P.retina?" leaflet-retina":"")+(P.ielt9?" leaflet-oldie":"")+(P.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),pi(t,"position"));"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Z(this._mapPane,new p(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(z(t.markerPane,"leaflet-zoom-hide"),z(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){Z(this._mapPane,new p(0,0));var e=!this._loaded,n=(this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset"),this._zoom!==i);this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e,n){void 0===i&&(i=this._zoom);var o=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?e&&e.pinch&&this.fire("zoom",e):((o||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return r(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Z(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var i=t?E:S;i((this._targets[h(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),P.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){r(this._resizeRequest),this._resizeRequest=x(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[h(s)])&&("click"===i||"preclick"===i)&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Hi(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n=n.length||r||o||!this.listens(i,!0)?n:[this]},_isClickDisabled:function(t){for(;t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var i,e=t.target||t.srcElement;!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e)||("mousedown"===(i=t.type)&&zi(e),this._fireDOMEvent(t,i))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){"click"===t.type&&((a=l({},t)).type="preclick",this._fireDOMEvent(a,a.type,e));var n=this._findEventTargets(t,i);if(e){for(var o=[],s=0;sthis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),n=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(n))&&(x(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,z(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&M(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Fi(t){return new I(t)}var Ui,I=it.extend({options:{position:"topright"},initialize:function(t){c(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),t=t._controlCorners[e];return z(i,"leaflet-control"),-1!==e.indexOf("bottom")?t.insertBefore(i,t.firstChild):t.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(T(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",i=document.createElement("div");return i.innerHTML=t,i.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer),n=(t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+h(this),n),this._layerControlInputs.push(i),i.layerId=h(t.layer),S(i,"click",this._onInputClick,this),document.createElement("span")),o=(n.innerHTML=" "+t.name,document.createElement("span"));return e.appendChild(o),o.appendChild(i),o.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;si.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this}})),qi=I.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=b("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){e=b("a",e,n);return e.innerHTML=t,e.href="#",e.title=i,e.setAttribute("role","button"),e.setAttribute("aria-label",i),Oi(e),S(e,"click",Ri),S(e,"click",o,this),S(e,"click",this._refocusOnMap,this),e},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";M(this._zoomInButton,i),M(this._zoomOutButton,i),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(z(this._zoomOutButton,i),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(z(this._zoomInButton,i),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Gi=(A.mergeOptions({zoomControl:!0}),A.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new qi,this.addControl(this.zoomControl))}),I.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=b("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=b("div",i,e)),t.imperial&&(this._iScale=b("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,t=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(t)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t);this._updateScale(this._mScale,i<1e3?i+" m":i/1e3+" km",i/t)},_updateImperial:function(t){var i,e,t=3.2808399*t;5280'+(P.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){c(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=b("div","leaflet-control-attribution"),Oi(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,i=[];for(t in this._attributions)this._attributions[t]&&i.push(t);var e=[];this.options.prefix&&e.push(this.options.prefix),i.length&&e.push(i.join(", ")),this._container.innerHTML=e.join(' ')}}}),n=(A.mergeOptions({attributionControl:!0}),A.addInitHook(function(){this.options.attributionControl&&(new Ki).addTo(this)}),I.Layers=Vi,I.Zoom=qi,I.Scale=Gi,I.Attribution=Ki,Fi.layers=function(t,i,e){return new Vi(t,i,e)},Fi.zoom=function(t){return new qi(t)},Fi.scale=function(t){return new Gi(t)},Fi.attribution=function(t){return new Ki(t)},it.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}})),ft=(n.addTo=function(t,i){return t.addHandler(i,this),this},{Events:i}),Yi=P.touch?"touchstart mousedown":"mousedown",Xi=et.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){c(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(S(this._dragStartTarget,Yi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Xi._dragging===this&&this.finishDrag(!0),E(this._dragStartTarget,Yi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var i,e;this._enabled&&(this._moved=!1,vi(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Xi._dragging===this&&this.finishDrag():Xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Xi._dragging=this)._preventOutline&&zi(this._element),Li(),ri(),this._moving||(this.fire("down"),e=t.touches?t.touches[0]:t,i=Ci(this._element),this._startPoint=new p(e.clientX,e.clientY),this._startPos=bi(this._element),this._parentScale=Zi(i),e="mousedown"===t.type,S(document,e?"mousemove":"touchmove",this._onMove,this),S(document,e?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var i;this._enabled&&(t.touches&&1i&&(e.push(t[n]),o=n);oi.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function ee(t,i,e,n){var o=i.x,i=i.y,s=e.x-o,r=e.y-i,a=s*s+r*r;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(l=!l);return l||fe.prototype._containsPoint.call(this,t,!0)}});var ve=he.extend({initialize:function(t,i){c(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=d(t)?t:t.features;if(o){for(i=0,e=o.length;ir.x&&(a=n.x+h-r.x+s.x),n.x-a-o.x<(h=0)&&(a=n.x-o.x),n.y+e+s.y>r.y&&(h=n.y+e-r.y+s.y),n.y-h-o.y<0&&(h=n.y-o.y),(a||h)&&i.fire("autopanstart").panBy([a,h],{animate:t&&"moveend"===t.type}))},_getAnchor:function(){return _(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),Ee=(A.mergeOptions({closePopupOnClick:!0}),A.include({openPopup:function(t,i,e){return this._initOverlay(ke,t,i,e).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),o.include({bindPopup:function(t,i){return this._popup=this._initOverlay(ke,this._popup,t,i),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&this._popup._prepareOpen(t)&&this._popup.openOn(this._map),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i;this._popup&&this._map&&(Ri(t),i=t.layer||t.target,this._popup._source!==i||i instanceof _e?(this._popup._source=i,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),O.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){O.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){O.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=O.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=b("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i,e=this._map,n=this._container,o=e.latLngToContainerPoint(e.getCenter()),e=e.layerPointToContainerPoint(t),s=this.options.direction,r=n.offsetWidth,a=n.offsetHeight,h=_(this.options.offset),l=this._getAnchor(),e="top"===s?(i=r/2,a):"bottom"===s?(i=r/2,0):(i="center"===s?r/2:"right"===s?0:"left"===s?r:e.xthis.options.maxZoom||nthis.options.maxZoom||void 0!==this.options.minZoom&&oe.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;i=this._tileCoordsToBounds(t);return g(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),e=n.add(e);return[i.unproject(n,t.z),i.unproject(e,t.z)]},_tileCoordsToBounds:function(t){t=this._tileCoordsToNwSe(t),t=new s(t[0],t[1]);return t=this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var t=t.split(":"),i=new p(+t[0],+t[1]);return i.z=+t[2],i},_removeTile:function(t){var i=this._tiles[t];i&&(T(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){z(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=u,t.onmousemove=u,P.ielt9&&this.options.opacity<1&&C(t,this.options.opacity)},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&x(a(this._tileReady,this,t,null,o)),Z(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(C(e.el,0),r(this._fadeFrame),this._fadeFrame=x(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(z(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),P.ielt9||!this._map._fadeAnimated?x(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new p(this._wrapX?H(t.x,this._wrapX):t.x,this._wrapY?H(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new m(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var Ie=Ae.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,i){this._url=t,(i=c(this,i)).detectRetina&&P.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Mt={_initContainer:function(){this._container=b("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ne.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=He("shape");z(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=He("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;T(i),t.removeInteractiveTarget(i),delete this._layers[h(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i=i||(t._stroke=He("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=d(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e=e||(t._fill=He("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){fi(t._container)},_bringToBack:function(t){gi(t._container)}},We=P.vml?He:ct,Fe=Ne.extend({_initContainer:function(){this._container=We("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=We("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){T(this._container),E(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,i,e;this._map._animatingZoom&&this._bounds||(Ne.prototype._update.call(this),i=(t=this._bounds).getSize(),e=this._container,this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),Z(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update"))},_initPath:function(t){var i=t._path=We("path");t.options.className&&z(i,t.options.className),t.options.interactive&&z(i,"leaflet-interactive"),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){T(t._path),t.removeInteractiveTarget(t._path),delete this._layers[h(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,t=t.options;i&&(t.stroke?(i.setAttribute("stroke",t.color),i.setAttribute("stroke-opacity",t.opacity),i.setAttribute("stroke-width",t.weight),i.setAttribute("stroke-linecap",t.lineCap),i.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?i.setAttribute("stroke-dasharray",t.dashArray):i.removeAttribute("stroke-dasharray"),t.dashOffset?i.setAttribute("stroke-dashoffset",t.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),t.fill?(i.setAttribute("fill",t.fillColor||t.color),i.setAttribute("fill-opacity",t.fillOpacity),i.setAttribute("fill-rule",t.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,dt(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",i=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,i)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){fi(t._path)},_bringToBack:function(t){gi(t._path)}});function Ue(t){return P.svg||P.vml?new Fe(t):null}P.vml&&Fe.include(Mt),A.include({getRenderer:function(t){t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer());return this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&je(t)||Ue(t)}});var Ve=ge.extend({initialize:function(t,i){ge.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=g(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Fe.create=We,Fe.pointsToPath=dt,ve.geometryToLayer=ye,ve.coordsToLatLng=we,ve.coordsToLatLngs=Pe,ve.latLngToCoords=be,ve.latLngsToCoords=Le,ve.getFeature=Te,ve.asFeature=ze,A.mergeOptions({boxZoom:!0});var _t=n.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){S(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){E(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){T(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ri(),Li(),this._startPoint=this._map.mouseEventToContainerPoint(t),S(document,{contextmenu:Ri,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=b("div","leaflet-zoom-box",this._container),z(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var t=new m(this._point,this._startPoint),i=t.getSize();Z(this._box,t.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(T(this._box),M(this._container,"leaflet-crosshair")),ai(),Ti(),E(document,{contextmenu:Ri,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0),t=new s(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ct=(A.addInitHook("addHandler","boxZoom",_t),A.mergeOptions({doubleClickZoom:!0}),n.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,e=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(e):i.setZoomAround(t.containerPoint,e)}})),Zt=(A.addInitHook("addHandler","doubleClickZoom",Ct),A.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),n.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),z(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){M(this._map._container,"leaflet-grab"),M(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,i=this._map;i._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=g(this._map.options.maxBounds),this._offsetLimit=f(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,i.fire("movestart").fire("dragstart"),i.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var i,e;this._map.options.inertia&&(i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(e),this._times.push(i),this._prunePositions(i)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,n=(n+i+e)%t-i-e,t=Math.abs(o+e)i.getMaxZoom()&&1= this.min.x && + e.x <= this.max.x && + i.y >= this.min.y && + e.y <= this.max.y + ); + }, + intersects: function (t) { + t = f(t); + var i = this.min, + e = this.max, + n = t.min, + t = t.max, + o = t.x >= i.x && n.x <= e.x, + t = t.y >= i.y && n.y <= e.y; + return o && t; + }, + overlaps: function (t) { + t = f(t); + var i = this.min, + e = this.max, + n = t.min, + t = t.max, + o = t.x > i.x && n.x < e.x, + t = t.y > i.y && n.y < e.y; + return o && t; + }, + isValid: function () { + return !(!this.min || !this.max); + }, + }), + (s.prototype = { + extend: function (t) { + var i, + e, + n = this._southWest, + o = this._northEast; + if (t instanceof v) e = i = t; + else { + if (!(t instanceof s)) return t ? this.extend(w(t) || g(t)) : this; + if (((i = t._southWest), (e = t._northEast), !i || !e)) return this; + } + return ( + n || o + ? ((n.lat = Math.min(i.lat, n.lat)), + (n.lng = Math.min(i.lng, n.lng)), + (o.lat = Math.max(e.lat, o.lat)), + (o.lng = Math.max(e.lng, o.lng))) + : ((this._southWest = new v(i.lat, i.lng)), + (this._northEast = new v(e.lat, e.lng))), + this + ); + }, + pad: function (t) { + var i = this._southWest, + e = this._northEast, + n = Math.abs(i.lat - e.lat) * t, + t = Math.abs(i.lng - e.lng) * t; + return new s(new v(i.lat - n, i.lng - t), new v(e.lat + n, e.lng + t)); + }, + getCenter: function () { + return new v( + (this._southWest.lat + this._northEast.lat) / 2, + (this._southWest.lng + this._northEast.lng) / 2, + ); + }, + getSouthWest: function () { + return this._southWest; + }, + getNorthEast: function () { + return this._northEast; + }, + getNorthWest: function () { + return new v(this.getNorth(), this.getWest()); + }, + getSouthEast: function () { + return new v(this.getSouth(), this.getEast()); + }, + getWest: function () { + return this._southWest.lng; + }, + getSouth: function () { + return this._southWest.lat; + }, + getEast: function () { + return this._northEast.lng; + }, + getNorth: function () { + return this._northEast.lat; + }, + contains: function (t) { + t = ('number' == typeof t[0] || t instanceof v || 'lat' in t ? w : g)( + t, + ); + var i, + e, + n = this._southWest, + o = this._northEast; + return ( + t instanceof s + ? ((i = t.getSouthWest()), (e = t.getNorthEast())) + : (i = e = t), + i.lat >= n.lat && e.lat <= o.lat && i.lng >= n.lng && e.lng <= o.lng + ); + }, + intersects: function (t) { + t = g(t); + var i = this._southWest, + e = this._northEast, + n = t.getSouthWest(), + t = t.getNorthEast(), + o = t.lat >= i.lat && n.lat <= e.lat, + t = t.lng >= i.lng && n.lng <= e.lng; + return o && t; + }, + overlaps: function (t) { + t = g(t); + var i = this._southWest, + e = this._northEast, + n = t.getSouthWest(), + t = t.getNorthEast(), + o = t.lat > i.lat && n.lat < e.lat, + t = t.lng > i.lng && n.lng < e.lng; + return o && t; + }, + toBBoxString: function () { + return [ + this.getWest(), + this.getSouth(), + this.getEast(), + this.getNorth(), + ].join(','); + }, + equals: function (t, i) { + return ( + !!t && + ((t = g(t)), + this._southWest.equals(t.getSouthWest(), i) && + this._northEast.equals(t.getNorthEast(), i)) + ); + }, + isValid: function () { + return !(!this._southWest || !this._northEast); + }, + }); + var ot = { + latLngToPoint: function (t, i) { + (t = this.projection.project(t)), (i = this.scale(i)); + return this.transformation._transform(t, i); + }, + pointToLatLng: function (t, i) { + (i = this.scale(i)), (t = this.transformation.untransform(t, i)); + return this.projection.unproject(t); + }, + project: function (t) { + return this.projection.project(t); + }, + unproject: function (t) { + return this.projection.unproject(t); + }, + scale: function (t) { + return 256 * Math.pow(2, t); + }, + zoom: function (t) { + return Math.log(t / 256) / Math.LN2; + }, + getProjectedBounds: function (t) { + if (this.infinite) return null; + var i = this.projection.bounds, + t = this.scale(t); + return new m( + this.transformation.transform(i.min, t), + this.transformation.transform(i.max, t), + ); + }, + infinite: !(v.prototype = { + equals: function (t, i) { + return ( + !!t && + ((t = w(t)), + Math.max(Math.abs(this.lat - t.lat), Math.abs(this.lng - t.lng)) <= + (void 0 === i ? 1e-9 : i)) + ); + }, + toString: function (t) { + return 'LatLng(' + e(this.lat, t) + ', ' + e(this.lng, t) + ')'; + }, + distanceTo: function (t) { + return st.distance(this, w(t)); + }, + wrap: function () { + return st.wrapLatLng(this); + }, + toBounds: function (t) { + var t = (180 * t) / 40075017, + i = t / Math.cos((Math.PI / 180) * this.lat); + return g([this.lat - t, this.lng - i], [this.lat + t, this.lng + i]); + }, + clone: function () { + return new v(this.lat, this.lng, this.alt); + }, + }), + wrapLatLng: function (t) { + var i = this.wrapLng ? H(t.lng, this.wrapLng, !0) : t.lng; + return new v( + this.wrapLat ? H(t.lat, this.wrapLat, !0) : t.lat, + i, + t.alt, + ); + }, + wrapLatLngBounds: function (t) { + var i = t.getCenter(), + e = this.wrapLatLng(i), + n = i.lat - e.lat, + i = i.lng - e.lng; + if (0 == n && 0 == i) return t; + (e = t.getSouthWest()), (t = t.getNorthEast()); + return new s(new v(e.lat - n, e.lng - i), new v(t.lat - n, t.lng - i)); + }, + }, + st = l({}, ot, { + wrapLng: [-180, 180], + R: 6371e3, + distance: function (t, i) { + var e = Math.PI / 180, + n = t.lat * e, + o = i.lat * e, + s = Math.sin(((i.lat - t.lat) * e) / 2), + i = Math.sin(((i.lng - t.lng) * e) / 2), + t = s * s + Math.cos(n) * Math.cos(o) * i * i, + e = 2 * Math.atan2(Math.sqrt(t), Math.sqrt(1 - t)); + return this.R * e; + }, + }), + rt = 6378137, + rt = { + R: rt, + MAX_LATITUDE: 85.0511287798, + project: function (t) { + var i = Math.PI / 180, + e = this.MAX_LATITUDE, + e = Math.max(Math.min(e, t.lat), -e), + e = Math.sin(e * i); + return new p( + this.R * t.lng * i, + (this.R * Math.log((1 + e) / (1 - e))) / 2, + ); + }, + unproject: function (t) { + var i = 180 / Math.PI; + return new v( + (2 * Math.atan(Math.exp(t.y / this.R)) - Math.PI / 2) * i, + (t.x * i) / this.R, + ); + }, + bounds: new m([-(rt = rt * Math.PI), -rt], [rt, rt]), + }; + function at(t, i, e, n) { + if (d(t)) + return ( + (this._a = t[0]), + (this._b = t[1]), + (this._c = t[2]), + void (this._d = t[3]) + ); + (this._a = t), (this._b = i), (this._c = e), (this._d = n); + } + function ht(t, i, e, n) { + return new at(t, i, e, n); + } + at.prototype = { + transform: function (t, i) { + return this._transform(t.clone(), i); + }, + _transform: function (t, i) { + return ( + (t.x = (i = i || 1) * (this._a * t.x + this._b)), + (t.y = i * (this._c * t.y + this._d)), + t + ); + }, + untransform: function (t, i) { + return new p( + (t.x / (i = i || 1) - this._b) / this._a, + (t.y / i - this._d) / this._c, + ); + }, + }; + var lt = l({}, st, { + code: 'EPSG:3857', + projection: rt, + transformation: ht((lt = 0.5 / (Math.PI * rt.R)), 0.5, -lt, 0.5), + }), + ut = l({}, lt, { code: 'EPSG:900913' }); + function ct(t) { + return document.createElementNS('http://www.w3.org/2000/svg', t); + } + function dt(t, i) { + for (var e, n, o, s, r = '', a = 0, h = t.length; a < h; a++) { + for (e = 0, n = (o = t[a]).length; e < n; e++) + r += (e ? 'L' : 'M') + (s = o[e]).x + ' ' + s.y; + r += i ? (P.svg ? 'z' : 'x') : ''; + } + return r || 'M0 0'; + } + var _t = document.documentElement.style, + pt = 'ActiveXObject' in window, + mt = pt && !document.addEventListener, + n = 'msLaunchUri' in navigator && !('documentMode' in document), + ft = y('webkit'), + gt = y('android'), + vt = y('android 2') || y('android 3'), + yt = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10), + yt = gt && y('Google') && yt < 537 && !('AudioNode' in window), + xt = !!window.opera, + wt = !n && y('chrome'), + Pt = y('gecko') && !ft && !xt && !pt, + bt = !wt && y('safari'), + Lt = y('phantom'), + o = 'OTransition' in _t, + Tt = 0 === navigator.platform.indexOf('Win'), + zt = pt && 'transition' in _t, + Mt = + 'WebKitCSSMatrix' in window && + 'm11' in new window.WebKitCSSMatrix() && + !vt, + _t = 'MozPerspective' in _t, + Ct = !window.L_DISABLE_3D && (zt || Mt || _t) && !o && !Lt, + Zt = 'undefined' != typeof orientation || y('mobile'), + St = Zt && ft, + kt = Zt && Mt, + Et = !window.PointerEvent && window.MSPointerEvent, + Bt = !(!window.PointerEvent && !Et), + At = 'ontouchstart' in window || !!window.TouchEvent, + It = !window.L_NO_TOUCH && (At || Bt), + Ot = Zt && xt, + Rt = Zt && Pt, + Nt = + 1 < + (window.devicePixelRatio || + window.screen.deviceXDPI / window.screen.logicalXDPI), + Dt = (function () { + var t = !1; + try { + var i = Object.defineProperty({}, 'passive', { + get: function () { + t = !0; + }, + }); + window.addEventListener('testPassiveEventSupport', u, i), + window.removeEventListener('testPassiveEventSupport', u, i); + } catch (t) {} + return t; + })(), + jt = !!document.createElement('canvas').getContext, + Ht = !(!document.createElementNS || !ct('svg').createSVGRect), + Wt = + !!Ht && + (((Wt = document.createElement('div')).innerHTML = ''), + 'http://www.w3.org/2000/svg' === + (Wt.firstChild && Wt.firstChild.namespaceURI)); + function y(t) { + return 0 <= navigator.userAgent.toLowerCase().indexOf(t); + } + var P = { + ie: pt, + ielt9: mt, + edge: n, + webkit: ft, + android: gt, + android23: vt, + androidStock: yt, + opera: xt, + chrome: wt, + gecko: Pt, + safari: bt, + phantom: Lt, + opera12: o, + win: Tt, + ie3d: zt, + webkit3d: Mt, + gecko3d: _t, + any3d: Ct, + mobile: Zt, + mobileWebkit: St, + mobileWebkit3d: kt, + msPointer: Et, + pointer: Bt, + touch: It, + touchNative: At, + mobileOpera: Ot, + mobileGecko: Rt, + retina: Nt, + passiveEvents: Dt, + canvas: jt, + svg: Ht, + vml: + !Ht && + (function () { + try { + var t = document.createElement('div'), + i = ((t.innerHTML = ''), t.firstChild); + return ( + (i.style.behavior = 'url(#default#VML)'), + i && 'object' == typeof i.adj + ); + } catch (t) { + return !1; + } + })(), + inlineSvg: Wt, + }, + Ft = P.msPointer ? 'MSPointerDown' : 'pointerdown', + Ut = P.msPointer ? 'MSPointerMove' : 'pointermove', + Vt = P.msPointer ? 'MSPointerUp' : 'pointerup', + qt = P.msPointer ? 'MSPointerCancel' : 'pointercancel', + Gt = { touchstart: Ft, touchmove: Ut, touchend: Vt, touchcancel: qt }, + Kt = { + touchstart: function (t, i) { + i.MSPOINTER_TYPE_TOUCH && + i.pointerType === i.MSPOINTER_TYPE_TOUCH && + B(i); + ii(t, i); + }, + touchmove: ii, + touchend: ii, + touchcancel: ii, + }, + Yt = {}, + Xt = !1; + function Jt(t, i, e) { + return ( + 'touchstart' !== i || + Xt || + (document.addEventListener(Ft, $t, !0), + document.addEventListener(Ut, Qt, !0), + document.addEventListener(Vt, ti, !0), + document.addEventListener(qt, ti, !0), + (Xt = !0)), + Kt[i] + ? ((e = Kt[i].bind(this, e)), t.addEventListener(Gt[i], e, !1), e) + : (console.warn('wrong event specified:', i), L.Util.falseFn) + ); + } + function $t(t) { + Yt[t.pointerId] = t; + } + function Qt(t) { + Yt[t.pointerId] && (Yt[t.pointerId] = t); + } + function ti(t) { + delete Yt[t.pointerId]; + } + function ii(t, i) { + if (i.pointerType !== (i.MSPOINTER_TYPE_MOUSE || 'mouse')) { + for (var e in ((i.touches = []), Yt)) i.touches.push(Yt[e]); + (i.changedTouches = [i]), t(i); + } + } + var ei = 200; + function ni(t, e) { + t.addEventListener('dblclick', e); + var n, + o = 0; + function i(t) { + var i; + 1 !== t.detail + ? (n = t.detail) + : 'mouse' === t.pointerType || + (t.sourceCapabilities && !t.sourceCapabilities.firesTouchEvents) || + ((i = Date.now()) - o <= ei + ? 2 === ++n && + e( + (function (t) { + var i, + e, + n = {}; + for (e in t) (i = t[e]), (n[e] = i && i.bind ? i.bind(t) : i); + return ( + ((t = n).type = 'dblclick'), + (n.detail = 2), + (n.isTrusted = !1), + (n._simulated = !0), + n + ); + })(t), + ) + : (n = 1), + (o = i)); + } + return t.addEventListener('click', i), { dblclick: e, simDblclick: i }; + } + var oi, + si, + ri, + ai, + hi, + li, + ui = wi([ + 'transform', + 'webkitTransform', + 'OTransform', + 'MozTransform', + 'msTransform', + ]), + ci = wi([ + 'webkitTransition', + 'transition', + 'OTransition', + 'MozTransition', + 'msTransition', + ]), + di = + 'webkitTransition' === ci || 'OTransition' === ci + ? ci + 'End' + : 'transitionend'; + function _i(t) { + return 'string' == typeof t ? document.getElementById(t) : t; + } + function pi(t, i) { + var e = t.style[i] || (t.currentStyle && t.currentStyle[i]); + return 'auto' === + (e = + (e && 'auto' !== e) || !document.defaultView + ? e + : (t = document.defaultView.getComputedStyle(t, null)) + ? t[i] + : null) + ? null + : e; + } + function b(t, i, e) { + t = document.createElement(t); + return (t.className = i || ''), e && e.appendChild(t), t; + } + function T(t) { + var i = t.parentNode; + i && i.removeChild(t); + } + function mi(t) { + for (; t.firstChild; ) t.removeChild(t.firstChild); + } + function fi(t) { + var i = t.parentNode; + i && i.lastChild !== t && i.appendChild(t); + } + function gi(t) { + var i = t.parentNode; + i && i.firstChild !== t && i.insertBefore(t, i.firstChild); + } + function vi(t, i) { + if (void 0 !== t.classList) return t.classList.contains(i); + t = xi(t); + return 0 < t.length && new RegExp('(^|\\s)' + i + '(\\s|$)').test(t); + } + function z(t, i) { + var e; + if (void 0 !== t.classList) + for (var n = F(i), o = 0, s = n.length; o < s; o++) t.classList.add(n[o]); + else vi(t, i) || yi(t, ((e = xi(t)) ? e + ' ' : '') + i); + } + function M(t, i) { + void 0 !== t.classList + ? t.classList.remove(i) + : yi(t, W((' ' + xi(t) + ' ').replace(' ' + i + ' ', ' '))); + } + function yi(t, i) { + void 0 === t.className.baseVal + ? (t.className = i) + : (t.className.baseVal = i); + } + function xi(t) { + return void 0 === + (t = t.correspondingElement ? t.correspondingElement : t).className + .baseVal + ? t.className + : t.className.baseVal; + } + function C(t, i) { + if ('opacity' in t.style) t.style.opacity = i; + else if ('filter' in t.style) { + var e = !1, + n = 'DXImageTransform.Microsoft.Alpha'; + try { + e = t.filters.item(n); + } catch (t) { + if (1 === i) return; + } + (i = Math.round(100 * i)), + e + ? ((e.Enabled = 100 !== i), (e.Opacity = i)) + : (t.style.filter += ' progid:' + n + '(opacity=' + i + ')'); + } + } + function wi(t) { + for (var i = document.documentElement.style, e = 0; e < t.length; e++) + if (t[e] in i) return t[e]; + return !1; + } + function Pi(t, i, e) { + i = i || new p(0, 0); + t.style[ui] = + (P.ie3d + ? 'translate(' + i.x + 'px,' + i.y + 'px)' + : 'translate3d(' + i.x + 'px,' + i.y + 'px,0)') + + (e ? ' scale(' + e + ')' : ''); + } + function Z(t, i) { + (t._leaflet_pos = i), + P.any3d + ? Pi(t, i) + : ((t.style.left = i.x + 'px'), (t.style.top = i.y + 'px')); + } + function bi(t) { + return t._leaflet_pos || new p(0, 0); + } + function Li() { + S(window, 'dragstart', B); + } + function Ti() { + E(window, 'dragstart', B); + } + function zi(t) { + for (; -1 === t.tabIndex; ) t = t.parentNode; + t.style && + (Mi(), + (li = (hi = t).style.outline), + (t.style.outline = 'none'), + S(window, 'keydown', Mi)); + } + function Mi() { + hi && + ((hi.style.outline = li), (li = hi = void 0), E(window, 'keydown', Mi)); + } + function Ci(t) { + for ( + ; + !( + ((t = t.parentNode).offsetWidth && t.offsetHeight) || + t === document.body + ); + + ); + return t; + } + function Zi(t) { + var i = t.getBoundingClientRect(); + return { + x: i.width / t.offsetWidth || 1, + y: i.height / t.offsetHeight || 1, + boundingClientRect: i, + }; + } + ai = + 'onselectstart' in document + ? ((ri = function () { + S(window, 'selectstart', B); + }), + function () { + E(window, 'selectstart', B); + }) + : ((si = wi([ + 'userSelect', + 'WebkitUserSelect', + 'OUserSelect', + 'MozUserSelect', + 'msUserSelect', + ])), + (ri = function () { + var t; + si && + ((t = document.documentElement.style), + (oi = t[si]), + (t[si] = 'none')); + }), + function () { + si && ((document.documentElement.style[si] = oi), (oi = void 0)); + }); + pt = { + __proto__: null, + TRANSFORM: ui, + TRANSITION: ci, + TRANSITION_END: di, + get: _i, + getStyle: pi, + create: b, + remove: T, + empty: mi, + toFront: fi, + toBack: gi, + hasClass: vi, + addClass: z, + removeClass: M, + setClass: yi, + getClass: xi, + setOpacity: C, + testProp: wi, + setTransform: Pi, + setPosition: Z, + getPosition: bi, + get disableTextSelection() { + return ri; + }, + get enableTextSelection() { + return ai; + }, + disableImageDrag: Li, + enableImageDrag: Ti, + preventOutline: zi, + restoreOutline: Mi, + getSizedParentNode: Ci, + getScale: Zi, + }; + function S(t, i, e, n) { + if (i && 'object' == typeof i) for (var o in i) Ei(t, o, i[o], e); + else for (var s = 0, r = (i = F(i)).length; s < r; s++) Ei(t, i[s], e, n); + return this; + } + var k = '_leaflet_events'; + function E(t, i, e, n) { + if (1 === arguments.length) Si(t), delete t[k]; + else if (i && 'object' == typeof i) for (var o in i) Bi(t, o, i[o], e); + else if (((i = F(i)), 2 === arguments.length)) + Si(t, function (t) { + return -1 !== G(i, t); + }); + else for (var s = 0, r = i.length; s < r; s++) Bi(t, i[s], e, n); + return this; + } + function Si(t, i) { + for (var e in t[k]) { + var n = e.split(/\d/)[0]; + (i && !i(n)) || Bi(t, n, null, null, e); + } + } + var ki = { + mouseenter: 'mouseover', + mouseleave: 'mouseout', + wheel: !('onwheel' in window) && 'mousewheel', + }; + function Ei(i, t, e, n) { + var o, + s, + r = t + h(e) + (n ? '_' + h(n) : ''); + (i[k] && i[k][r]) || + ((s = o = + function (t) { + return e.call(n || i, t || window.event); + }), + !P.touchNative && P.pointer && 0 === t.indexOf('touch') + ? (o = Jt(i, t, o)) + : P.touch && 'dblclick' === t + ? (o = ni(i, o)) + : 'addEventListener' in i + ? 'touchstart' === t || + 'touchmove' === t || + 'wheel' === t || + 'mousewheel' === t + ? i.addEventListener( + ki[t] || t, + o, + !!P.passiveEvents && { passive: !1 }, + ) + : 'mouseenter' === t || 'mouseleave' === t + ? i.addEventListener( + ki[t], + (o = function (t) { + (t = t || window.event), Hi(i, t) && s(t); + }), + !1, + ) + : i.addEventListener(t, s, !1) + : i.attachEvent('on' + t, o), + (i[k] = i[k] || {}), + (i[k][r] = o)); + } + function Bi(t, i, e, n, o) { + o = o || i + h(e) + (n ? '_' + h(n) : ''); + var s, + r, + e = t[k] && t[k][o]; + e && + (!P.touchNative && P.pointer && 0 === i.indexOf('touch') + ? ((n = t), + (r = e), + Gt[(s = i)] + ? n.removeEventListener(Gt[s], r, !1) + : console.warn('wrong event specified:', s)) + : P.touch && 'dblclick' === i + ? ((n = e), + (r = t).removeEventListener('dblclick', n.dblclick), + r.removeEventListener('click', n.simDblclick)) + : 'removeEventListener' in t + ? t.removeEventListener(ki[i] || i, e, !1) + : t.detachEvent('on' + i, e), + (t[k][o] = null)); + } + function Ai(t) { + return ( + t.stopPropagation + ? t.stopPropagation() + : t.originalEvent + ? (t.originalEvent._stopped = !0) + : (t.cancelBubble = !0), + this + ); + } + function Ii(t) { + return Ei(t, 'wheel', Ai), this; + } + function Oi(t) { + return ( + S(t, 'mousedown touchstart dblclick contextmenu', Ai), + (t._leaflet_disable_click = !0), + this + ); + } + function B(t) { + return t.preventDefault ? t.preventDefault() : (t.returnValue = !1), this; + } + function Ri(t) { + return B(t), Ai(t), this; + } + function Ni(t, i) { + if (!i) return new p(t.clientX, t.clientY); + var e = Zi(i), + n = e.boundingClientRect; + return new p( + (t.clientX - n.left) / e.x - i.clientLeft, + (t.clientY - n.top) / e.y - i.clientTop, + ); + } + var Di = + P.win && P.chrome + ? 2 * window.devicePixelRatio + : P.gecko + ? window.devicePixelRatio + : 1; + function ji(t) { + return P.edge + ? t.wheelDeltaY / 2 + : t.deltaY && 0 === t.deltaMode + ? -t.deltaY / Di + : t.deltaY && 1 === t.deltaMode + ? 20 * -t.deltaY + : t.deltaY && 2 === t.deltaMode + ? 60 * -t.deltaY + : t.deltaX || t.deltaZ + ? 0 + : t.wheelDelta + ? (t.wheelDeltaY || t.wheelDelta) / 2 + : t.detail && Math.abs(t.detail) < 32765 + ? 20 * -t.detail + : t.detail + ? (t.detail / -32765) * 60 + : 0; + } + function Hi(t, i) { + var e = i.relatedTarget; + if (!e) return !0; + try { + for (; e && e !== t; ) e = e.parentNode; + } catch (t) { + return !1; + } + return e !== t; + } + var mt = { + __proto__: null, + on: S, + off: E, + stopPropagation: Ai, + disableScrollPropagation: Ii, + disableClickPropagation: Oi, + preventDefault: B, + stop: Ri, + getMousePosition: Ni, + getWheelDelta: ji, + isExternalTarget: Hi, + addListener: S, + removeListener: E, + }, + Wi = et.extend({ + run: function (t, i, e, n) { + this.stop(), + (this._el = t), + (this._inProgress = !0), + (this._duration = e || 0.25), + (this._easeOutPower = 1 / Math.max(n || 0.5, 0.2)), + (this._startPos = bi(t)), + (this._offset = i.subtract(this._startPos)), + (this._startTime = +new Date()), + this.fire('start'), + this._animate(); + }, + stop: function () { + this._inProgress && (this._step(!0), this._complete()); + }, + _animate: function () { + (this._animId = x(this._animate, this)), this._step(); + }, + _step: function (t) { + var i = +new Date() - this._startTime, + e = 1e3 * this._duration; + i < e + ? this._runFrame(this._easeOut(i / e), t) + : (this._runFrame(1), this._complete()); + }, + _runFrame: function (t, i) { + t = this._startPos.add(this._offset.multiplyBy(t)); + i && t._round(), Z(this._el, t), this.fire('step'); + }, + _complete: function () { + r(this._animId), (this._inProgress = !1), this.fire('end'); + }, + _easeOut: function (t) { + return 1 - Math.pow(1 - t, this._easeOutPower); + }, + }), + A = et.extend({ + options: { + crs: lt, + center: void 0, + zoom: void 0, + minZoom: void 0, + maxZoom: void 0, + layers: [], + maxBounds: void 0, + renderer: void 0, + zoomAnimation: !0, + zoomAnimationThreshold: 4, + fadeAnimation: !0, + markerZoomAnimation: !0, + transform3DLimit: 8388608, + zoomSnap: 1, + zoomDelta: 1, + trackResize: !0, + }, + initialize: function (t, i) { + (i = c(this, i)), + (this._handlers = []), + (this._layers = {}), + (this._zoomBoundLayers = {}), + (this._sizeChanged = !0), + this._initContainer(t), + this._initLayout(), + (this._onResize = a(this._onResize, this)), + this._initEvents(), + i.maxBounds && this.setMaxBounds(i.maxBounds), + void 0 !== i.zoom && (this._zoom = this._limitZoom(i.zoom)), + i.center && + void 0 !== i.zoom && + this.setView(w(i.center), i.zoom, { reset: !0 }), + this.callInitHooks(), + (this._zoomAnimated = + ci && P.any3d && !P.mobileOpera && this.options.zoomAnimation), + this._zoomAnimated && + (this._createAnimProxy(), + S(this._proxy, di, this._catchTransitionEnd, this)), + this._addLayers(this.options.layers); + }, + setView: function (t, i, e) { + if ( + ((i = void 0 === i ? this._zoom : this._limitZoom(i)), + (t = this._limitCenter(w(t), i, this.options.maxBounds)), + (e = e || {}), + this._stop(), + this._loaded && !e.reset && !0 !== e) && + (void 0 !== e.animate && + ((e.zoom = l({ animate: e.animate }, e.zoom)), + (e.pan = l({ animate: e.animate, duration: e.duration }, e.pan))), + this._zoom !== i + ? this._tryAnimatedZoom && this._tryAnimatedZoom(t, i, e.zoom) + : this._tryAnimatedPan(t, e.pan)) + ) + return clearTimeout(this._sizeTimer), this; + return this._resetView(t, i), this; + }, + setZoom: function (t, i) { + return this._loaded + ? this.setView(this.getCenter(), t, { zoom: i }) + : ((this._zoom = t), this); + }, + zoomIn: function (t, i) { + return ( + (t = t || (P.any3d ? this.options.zoomDelta : 1)), + this.setZoom(this._zoom + t, i) + ); + }, + zoomOut: function (t, i) { + return ( + (t = t || (P.any3d ? this.options.zoomDelta : 1)), + this.setZoom(this._zoom - t, i) + ); + }, + setZoomAround: function (t, i, e) { + var n = this.getZoomScale(i), + o = this.getSize().divideBy(2), + t = (t instanceof p ? t : this.latLngToContainerPoint(t)) + .subtract(o) + .multiplyBy(1 - 1 / n), + n = this.containerPointToLatLng(o.add(t)); + return this.setView(n, i, { zoom: e }); + }, + _getBoundsCenterZoom: function (t, i) { + (i = i || {}), (t = t.getBounds ? t.getBounds() : g(t)); + var e = _(i.paddingTopLeft || i.padding || [0, 0]), + n = _(i.paddingBottomRight || i.padding || [0, 0]), + o = this.getBoundsZoom(t, !1, e.add(n)); + if ( + (o = 'number' == typeof i.maxZoom ? Math.min(i.maxZoom, o) : o) === + 1 / 0 + ) + return { center: t.getCenter(), zoom: o }; + (i = n.subtract(e).divideBy(2)), + (n = this.project(t.getSouthWest(), o)), + (e = this.project(t.getNorthEast(), o)); + return { + center: this.unproject(n.add(e).divideBy(2).add(i), o), + zoom: o, + }; + }, + fitBounds: function (t, i) { + if (!(t = g(t)).isValid()) throw new Error('Bounds are not valid.'); + t = this._getBoundsCenterZoom(t, i); + return this.setView(t.center, t.zoom, i); + }, + fitWorld: function (t) { + return this.fitBounds( + [ + [-90, -180], + [90, 180], + ], + t, + ); + }, + panTo: function (t, i) { + return this.setView(t, this._zoom, { pan: i }); + }, + panBy: function (t, i) { + return ( + (i = i || {}), + (t = _(t).round()).x || t.y + ? (!0 === i.animate || this.getSize().contains(t) + ? (this._panAnim || + ((this._panAnim = new Wi()), + this._panAnim.on( + { + step: this._onPanTransitionStep, + end: this._onPanTransitionEnd, + }, + this, + )), + i.noMoveStart || this.fire('movestart'), + !1 !== i.animate + ? (z(this._mapPane, 'leaflet-pan-anim'), + (e = this._getMapPanePos().subtract(t).round()), + this._panAnim.run( + this._mapPane, + e, + i.duration || 0.25, + i.easeLinearity, + )) + : (this._rawPanBy(t), this.fire('move').fire('moveend'))) + : this._resetView( + this.unproject(this.project(this.getCenter()).add(t)), + this.getZoom(), + ), + this) + : this.fire('moveend') + ); + var e; + }, + flyTo: function (n, o, t) { + if (!1 === (t = t || {}).animate || !P.any3d) + return this.setView(n, o, t); + this._stop(); + var s = this.project(this.getCenter()), + r = this.project(n), + i = this.getSize(), + a = this._zoom, + h = ((n = w(n)), (o = void 0 === o ? a : o), Math.max(i.x, i.y)), + e = h * this.getZoomScale(a, o), + l = r.distanceTo(s) || 1, + u = 1.42, + c = u * u; + function d(t) { + (t = + (e * e - h * h + (t ? -1 : 1) * c * c * l * l) / + (2 * (t ? e : h) * c * l)), + (t = Math.sqrt(t * t + 1) - t); + return t < 1e-9 ? -18 : Math.log(t); + } + function _(t) { + return (Math.exp(t) - Math.exp(-t)) / 2; + } + function p(t) { + return (Math.exp(t) + Math.exp(-t)) / 2; + } + var m = d(0); + function f(t) { + return (h * (p(m) * (_((t = m + u * t)) / p(t)) - _(m))) / c; + } + var g = Date.now(), + v = (d(1) - m) / u, + y = t.duration ? 1e3 * t.duration : 1e3 * v * 0.8; + return ( + this._moveStart(!0, t.noMoveStart), + function t() { + var i = (Date.now() - g) / y, + e = (1 - Math.pow(1 - i, 1.5)) * v; + i <= 1 + ? ((this._flyToFrame = x(t, this)), + this._move( + this.unproject(s.add(r.subtract(s).multiplyBy(f(e) / l)), a), + this.getScaleZoom( + h / ((i = e), h * (p(m) / p(m + u * i))), + a, + ), + { flyTo: !0 }, + )) + : this._move(n, o)._moveEnd(!0); + }.call(this), + this + ); + }, + flyToBounds: function (t, i) { + t = this._getBoundsCenterZoom(t, i); + return this.flyTo(t.center, t.zoom, i); + }, + setMaxBounds: function (t) { + return (t = g(t)).isValid() + ? (this.options.maxBounds && + this.off('moveend', this._panInsideMaxBounds), + (this.options.maxBounds = t), + this._loaded && this._panInsideMaxBounds(), + this.on('moveend', this._panInsideMaxBounds)) + : ((this.options.maxBounds = null), + this.off('moveend', this._panInsideMaxBounds)); + }, + setMinZoom: function (t) { + var i = this.options.minZoom; + return ( + (this.options.minZoom = t), + this._loaded && + i !== t && + (this.fire('zoomlevelschange'), this.getZoom() < this.options.minZoom) + ? this.setZoom(t) + : this + ); + }, + setMaxZoom: function (t) { + var i = this.options.maxZoom; + return ( + (this.options.maxZoom = t), + this._loaded && + i !== t && + (this.fire('zoomlevelschange'), this.getZoom() > this.options.maxZoom) + ? this.setZoom(t) + : this + ); + }, + panInsideBounds: function (t, i) { + this._enforcingBounds = !0; + var e = this.getCenter(), + t = this._limitCenter(e, this._zoom, g(t)); + return ( + e.equals(t) || this.panTo(t, i), (this._enforcingBounds = !1), this + ); + }, + panInside: function (t, i) { + var e = _((i = i || {}).paddingTopLeft || i.padding || [0, 0]), + n = _(i.paddingBottomRight || i.padding || [0, 0]), + o = this.project(this.getCenter()), + t = this.project(t), + s = this.getPixelBounds(), + e = f([s.min.add(e), s.max.subtract(n)]), + s = e.getSize(); + return ( + e.contains(t) || + ((this._enforcingBounds = !0), + (n = t.subtract(e.getCenter())), + (e = e.extend(t).getSize().subtract(s)), + (o.x += n.x < 0 ? -e.x : e.x), + (o.y += n.y < 0 ? -e.y : e.y), + this.panTo(this.unproject(o), i), + (this._enforcingBounds = !1)), + this + ); + }, + invalidateSize: function (t) { + if (!this._loaded) return this; + t = l({ animate: !1, pan: !0 }, !0 === t ? { animate: !0 } : t); + var i = this.getSize(), + e = + ((this._sizeChanged = !0), + (this._lastCenter = null), + this.getSize()), + n = i.divideBy(2).round(), + o = e.divideBy(2).round(), + n = n.subtract(o); + return n.x || n.y + ? (t.animate && t.pan + ? this.panBy(n) + : (t.pan && this._rawPanBy(n), + this.fire('move'), + t.debounceMoveend + ? (clearTimeout(this._sizeTimer), + (this._sizeTimer = setTimeout( + a(this.fire, this, 'moveend'), + 200, + ))) + : this.fire('moveend')), + this.fire('resize', { oldSize: i, newSize: e })) + : this; + }, + stop: function () { + return ( + this.setZoom(this._limitZoom(this._zoom)), + this.options.zoomSnap || this.fire('viewreset'), + this._stop() + ); + }, + locate: function (t) { + if ( + ((t = this._locateOptions = l({ timeout: 1e4, watch: !1 }, t)), + !('geolocation' in navigator)) + ) + return ( + this._handleGeolocationError({ + code: 0, + message: 'Geolocation not supported.', + }), + this + ); + var i = a(this._handleGeolocationResponse, this), + e = a(this._handleGeolocationError, this); + return ( + t.watch + ? (this._locationWatchId = navigator.geolocation.watchPosition( + i, + e, + t, + )) + : navigator.geolocation.getCurrentPosition(i, e, t), + this + ); + }, + stopLocate: function () { + return ( + navigator.geolocation && + navigator.geolocation.clearWatch && + navigator.geolocation.clearWatch(this._locationWatchId), + this._locateOptions && (this._locateOptions.setView = !1), + this + ); + }, + _handleGeolocationError: function (t) { + var i; + this._container._leaflet_id && + ((i = t.code), + (t = + t.message || + (1 === i + ? 'permission denied' + : 2 === i + ? 'position unavailable' + : 'timeout')), + this._locateOptions.setView && !this._loaded && this.fitWorld(), + this.fire('locationerror', { + code: i, + message: 'Geolocation error: ' + t + '.', + })); + }, + _handleGeolocationResponse: function (t) { + if (this._container._leaflet_id) { + var i, + e, + n = new v(t.coords.latitude, t.coords.longitude), + o = n.toBounds(2 * t.coords.accuracy), + s = this._locateOptions, + r = + (s.setView && + ((i = this.getBoundsZoom(o)), + this.setView(n, s.maxZoom ? Math.min(i, s.maxZoom) : i)), + { latlng: n, bounds: o, timestamp: t.timestamp }); + for (e in t.coords) + 'number' == typeof t.coords[e] && (r[e] = t.coords[e]); + this.fire('locationfound', r); + } + }, + addHandler: function (t, i) { + if (!i) return this; + i = this[t] = new i(this); + return this._handlers.push(i), this.options[t] && i.enable(), this; + }, + remove: function () { + if ( + (this._initEvents(!0), + this.options.maxBounds && + this.off('moveend', this._panInsideMaxBounds), + this._containerId !== this._container._leaflet_id) + ) + throw new Error('Map container is being reused by another instance'); + try { + delete this._container._leaflet_id, delete this._containerId; + } catch (t) { + (this._container._leaflet_id = void 0), (this._containerId = void 0); + } + for (var t in (void 0 !== this._locationWatchId && this.stopLocate(), + this._stop(), + T(this._mapPane), + this._clearControlPos && this._clearControlPos(), + this._resizeRequest && + (r(this._resizeRequest), (this._resizeRequest = null)), + this._clearHandlers(), + this._loaded && this.fire('unload'), + this._layers)) + this._layers[t].remove(); + for (t in this._panes) T(this._panes[t]); + return ( + (this._layers = []), + (this._panes = []), + delete this._mapPane, + delete this._renderer, + this + ); + }, + createPane: function (t, i) { + i = b( + 'div', + 'leaflet-pane' + + (t ? ' leaflet-' + t.replace('Pane', '') + '-pane' : ''), + i || this._mapPane, + ); + return t && (this._panes[t] = i), i; + }, + getCenter: function () { + return ( + this._checkIfLoaded(), + this._lastCenter && !this._moved() + ? this._lastCenter + : this.layerPointToLatLng(this._getCenterLayerPoint()) + ); + }, + getZoom: function () { + return this._zoom; + }, + getBounds: function () { + var t = this.getPixelBounds(); + return new s( + this.unproject(t.getBottomLeft()), + this.unproject(t.getTopRight()), + ); + }, + getMinZoom: function () { + return void 0 === this.options.minZoom + ? this._layersMinZoom || 0 + : this.options.minZoom; + }, + getMaxZoom: function () { + return void 0 === this.options.maxZoom + ? void 0 === this._layersMaxZoom + ? 1 / 0 + : this._layersMaxZoom + : this.options.maxZoom; + }, + getBoundsZoom: function (t, i, e) { + (t = g(t)), (e = _(e || [0, 0])); + var n = this.getZoom() || 0, + o = this.getMinZoom(), + s = this.getMaxZoom(), + r = t.getNorthWest(), + t = t.getSouthEast(), + e = this.getSize().subtract(e), + t = f(this.project(t, n), this.project(r, n)).getSize(), + r = P.any3d ? this.options.zoomSnap : 1, + a = e.x / t.x, + e = e.y / t.y, + t = i ? Math.max(a, e) : Math.min(a, e), + n = this.getScaleZoom(t, n); + return ( + r && + ((n = Math.round(n / (r / 100)) * (r / 100)), + (n = i ? Math.ceil(n / r) * r : Math.floor(n / r) * r)), + Math.max(o, Math.min(s, n)) + ); + }, + getSize: function () { + return ( + (this._size && !this._sizeChanged) || + ((this._size = new p( + this._container.clientWidth || 0, + this._container.clientHeight || 0, + )), + (this._sizeChanged = !1)), + this._size.clone() + ); + }, + getPixelBounds: function (t, i) { + t = this._getTopLeftPoint(t, i); + return new m(t, t.add(this.getSize())); + }, + getPixelOrigin: function () { + return this._checkIfLoaded(), this._pixelOrigin; + }, + getPixelWorldBounds: function (t) { + return this.options.crs.getProjectedBounds( + void 0 === t ? this.getZoom() : t, + ); + }, + getPane: function (t) { + return 'string' == typeof t ? this._panes[t] : t; + }, + getPanes: function () { + return this._panes; + }, + getContainer: function () { + return this._container; + }, + getZoomScale: function (t, i) { + var e = this.options.crs; + return (i = void 0 === i ? this._zoom : i), e.scale(t) / e.scale(i); + }, + getScaleZoom: function (t, i) { + var e = this.options.crs, + t = ((i = void 0 === i ? this._zoom : i), e.zoom(t * e.scale(i))); + return isNaN(t) ? 1 / 0 : t; + }, + project: function (t, i) { + return ( + (i = void 0 === i ? this._zoom : i), + this.options.crs.latLngToPoint(w(t), i) + ); + }, + unproject: function (t, i) { + return ( + (i = void 0 === i ? this._zoom : i), + this.options.crs.pointToLatLng(_(t), i) + ); + }, + layerPointToLatLng: function (t) { + t = _(t).add(this.getPixelOrigin()); + return this.unproject(t); + }, + latLngToLayerPoint: function (t) { + return this.project(w(t))._round()._subtract(this.getPixelOrigin()); + }, + wrapLatLng: function (t) { + return this.options.crs.wrapLatLng(w(t)); + }, + wrapLatLngBounds: function (t) { + return this.options.crs.wrapLatLngBounds(g(t)); + }, + distance: function (t, i) { + return this.options.crs.distance(w(t), w(i)); + }, + containerPointToLayerPoint: function (t) { + return _(t).subtract(this._getMapPanePos()); + }, + layerPointToContainerPoint: function (t) { + return _(t).add(this._getMapPanePos()); + }, + containerPointToLatLng: function (t) { + t = this.containerPointToLayerPoint(_(t)); + return this.layerPointToLatLng(t); + }, + latLngToContainerPoint: function (t) { + return this.layerPointToContainerPoint(this.latLngToLayerPoint(w(t))); + }, + mouseEventToContainerPoint: function (t) { + return Ni(t, this._container); + }, + mouseEventToLayerPoint: function (t) { + return this.containerPointToLayerPoint( + this.mouseEventToContainerPoint(t), + ); + }, + mouseEventToLatLng: function (t) { + return this.layerPointToLatLng(this.mouseEventToLayerPoint(t)); + }, + _initContainer: function (t) { + t = this._container = _i(t); + if (!t) throw new Error('Map container not found.'); + if (t._leaflet_id) + throw new Error('Map container is already initialized.'); + S(t, 'scroll', this._onScroll, this), (this._containerId = h(t)); + }, + _initLayout: function () { + var t = this._container, + i = + ((this._fadeAnimated = this.options.fadeAnimation && P.any3d), + z( + t, + 'leaflet-container' + + (P.touch ? ' leaflet-touch' : '') + + (P.retina ? ' leaflet-retina' : '') + + (P.ielt9 ? ' leaflet-oldie' : '') + + (P.safari ? ' leaflet-safari' : '') + + (this._fadeAnimated ? ' leaflet-fade-anim' : ''), + ), + pi(t, 'position')); + 'absolute' !== i && + 'relative' !== i && + 'fixed' !== i && + (t.style.position = 'relative'), + this._initPanes(), + this._initControlPos && this._initControlPos(); + }, + _initPanes: function () { + var t = (this._panes = {}); + (this._paneRenderers = {}), + (this._mapPane = this.createPane('mapPane', this._container)), + Z(this._mapPane, new p(0, 0)), + this.createPane('tilePane'), + this.createPane('overlayPane'), + this.createPane('shadowPane'), + this.createPane('markerPane'), + this.createPane('tooltipPane'), + this.createPane('popupPane'), + this.options.markerZoomAnimation || + (z(t.markerPane, 'leaflet-zoom-hide'), + z(t.shadowPane, 'leaflet-zoom-hide')); + }, + _resetView: function (t, i) { + Z(this._mapPane, new p(0, 0)); + var e = !this._loaded, + n = + ((this._loaded = !0), + (i = this._limitZoom(i)), + this.fire('viewprereset'), + this._zoom !== i); + this._moveStart(n, !1)._move(t, i)._moveEnd(n), + this.fire('viewreset'), + e && this.fire('load'); + }, + _moveStart: function (t, i) { + return t && this.fire('zoomstart'), i || this.fire('movestart'), this; + }, + _move: function (t, i, e, n) { + void 0 === i && (i = this._zoom); + var o = this._zoom !== i; + return ( + (this._zoom = i), + (this._lastCenter = t), + (this._pixelOrigin = this._getNewPixelOrigin(t)), + n + ? e && e.pinch && this.fire('zoom', e) + : ((o || (e && e.pinch)) && this.fire('zoom', e), + this.fire('move', e)), + this + ); + }, + _moveEnd: function (t) { + return t && this.fire('zoomend'), this.fire('moveend'); + }, + _stop: function () { + return r(this._flyToFrame), this._panAnim && this._panAnim.stop(), this; + }, + _rawPanBy: function (t) { + Z(this._mapPane, this._getMapPanePos().subtract(t)); + }, + _getZoomSpan: function () { + return this.getMaxZoom() - this.getMinZoom(); + }, + _panInsideMaxBounds: function () { + this._enforcingBounds || this.panInsideBounds(this.options.maxBounds); + }, + _checkIfLoaded: function () { + if (!this._loaded) throw new Error('Set map center and zoom first.'); + }, + _initEvents: function (t) { + this._targets = {}; + var i = t ? E : S; + i( + (this._targets[h(this._container)] = this)._container, + 'click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup', + this._handleDOMEvent, + this, + ), + this.options.trackResize && i(window, 'resize', this._onResize, this), + P.any3d && + this.options.transform3DLimit && + (t ? this.off : this.on).call(this, 'moveend', this._onMoveEnd); + }, + _onResize: function () { + r(this._resizeRequest), + (this._resizeRequest = x(function () { + this.invalidateSize({ debounceMoveend: !0 }); + }, this)); + }, + _onScroll: function () { + (this._container.scrollTop = 0), (this._container.scrollLeft = 0); + }, + _onMoveEnd: function () { + var t = this._getMapPanePos(); + Math.max(Math.abs(t.x), Math.abs(t.y)) >= + this.options.transform3DLimit && + this._resetView(this.getCenter(), this.getZoom()); + }, + _findEventTargets: function (t, i) { + for ( + var e, + n = [], + o = 'mouseout' === i || 'mouseover' === i, + s = t.target || t.srcElement, + r = !1; + s; + + ) { + if ( + (e = this._targets[h(s)]) && + ('click' === i || 'preclick' === i) && + this._draggableMoved(e) + ) { + r = !0; + break; + } + if (e && e.listens(i, !0)) { + if (o && !Hi(s, t)) break; + if ((n.push(e), o)) break; + } + if (s === this._container) break; + s = s.parentNode; + } + return (n = n.length || r || o || !this.listens(i, !0) ? n : [this]); + }, + _isClickDisabled: function (t) { + for (; t !== this._container; ) { + if (t._leaflet_disable_click) return !0; + t = t.parentNode; + } + }, + _handleDOMEvent: function (t) { + var i, + e = t.target || t.srcElement; + !this._loaded || + e._leaflet_disable_events || + ('click' === t.type && this._isClickDisabled(e)) || + ('mousedown' === (i = t.type) && zi(e), this._fireDOMEvent(t, i)); + }, + _mouseEvents: [ + 'click', + 'dblclick', + 'mouseover', + 'mouseout', + 'contextmenu', + ], + _fireDOMEvent: function (t, i, e) { + 'click' === t.type && + (((a = l({}, t)).type = 'preclick'), + this._fireDOMEvent(a, a.type, e)); + var n = this._findEventTargets(t, i); + if (e) { + for (var o = [], s = 0; s < e.length; s++) + e[s].listens(i, !0) && o.push(e[s]); + n = o.concat(n); + } + if (n.length) { + 'contextmenu' === i && B(t); + var r, + a = n[0], + h = { originalEvent: t }; + for ( + 'keypress' !== t.type && + 'keydown' !== t.type && + 'keyup' !== t.type && + ((r = a.getLatLng && (!a._radius || a._radius <= 10)), + (h.containerPoint = r + ? this.latLngToContainerPoint(a.getLatLng()) + : this.mouseEventToContainerPoint(t)), + (h.layerPoint = this.containerPointToLayerPoint( + h.containerPoint, + )), + (h.latlng = r + ? a.getLatLng() + : this.layerPointToLatLng(h.layerPoint))), + s = 0; + s < n.length; + s++ + ) + if ( + (n[s].fire(i, h, !0), + h.originalEvent._stopped || + (!1 === n[s].options.bubblingMouseEvents && + -1 !== G(this._mouseEvents, i))) + ) + return; + } + }, + _draggableMoved: function (t) { + return ( + ((t = t.dragging && t.dragging.enabled() ? t : this).dragging && + t.dragging.moved()) || + (this.boxZoom && this.boxZoom.moved()) + ); + }, + _clearHandlers: function () { + for (var t = 0, i = this._handlers.length; t < i; t++) + this._handlers[t].disable(); + }, + whenReady: function (t, i) { + return ( + this._loaded + ? t.call(i || this, { target: this }) + : this.on('load', t, i), + this + ); + }, + _getMapPanePos: function () { + return bi(this._mapPane) || new p(0, 0); + }, + _moved: function () { + var t = this._getMapPanePos(); + return t && !t.equals([0, 0]); + }, + _getTopLeftPoint: function (t, i) { + return ( + t && void 0 !== i + ? this._getNewPixelOrigin(t, i) + : this.getPixelOrigin() + ).subtract(this._getMapPanePos()); + }, + _getNewPixelOrigin: function (t, i) { + var e = this.getSize()._divideBy(2); + return this.project(t, i) + ._subtract(e) + ._add(this._getMapPanePos()) + ._round(); + }, + _latLngToNewLayerPoint: function (t, i, e) { + e = this._getNewPixelOrigin(e, i); + return this.project(t, i)._subtract(e); + }, + _latLngBoundsToNewLayerBounds: function (t, i, e) { + e = this._getNewPixelOrigin(e, i); + return f([ + this.project(t.getSouthWest(), i)._subtract(e), + this.project(t.getNorthWest(), i)._subtract(e), + this.project(t.getSouthEast(), i)._subtract(e), + this.project(t.getNorthEast(), i)._subtract(e), + ]); + }, + _getCenterLayerPoint: function () { + return this.containerPointToLayerPoint(this.getSize()._divideBy(2)); + }, + _getCenterOffset: function (t) { + return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint()); + }, + _limitCenter: function (t, i, e) { + if (!e) return t; + var n = this.project(t, i), + o = this.getSize().divideBy(2), + o = new m(n.subtract(o), n.add(o)), + o = this._getBoundsOffset(o, e, i); + return o.round().equals([0, 0]) ? t : this.unproject(n.add(o), i); + }, + _limitOffset: function (t, i) { + if (!i) return t; + var e = this.getPixelBounds(), + e = new m(e.min.add(t), e.max.add(t)); + return t.add(this._getBoundsOffset(e, i)); + }, + _getBoundsOffset: function (t, i, e) { + (i = f( + this.project(i.getNorthEast(), e), + this.project(i.getSouthWest(), e), + )), + (e = i.min.subtract(t.min)), + (i = i.max.subtract(t.max)); + return new p(this._rebound(e.x, -i.x), this._rebound(e.y, -i.y)); + }, + _rebound: function (t, i) { + return 0 < t + i + ? Math.round(t - i) / 2 + : Math.max(0, Math.ceil(t)) - Math.max(0, Math.floor(i)); + }, + _limitZoom: function (t) { + var i = this.getMinZoom(), + e = this.getMaxZoom(), + n = P.any3d ? this.options.zoomSnap : 1; + return n && (t = Math.round(t / n) * n), Math.max(i, Math.min(e, t)); + }, + _onPanTransitionStep: function () { + this.fire('move'); + }, + _onPanTransitionEnd: function () { + M(this._mapPane, 'leaflet-pan-anim'), this.fire('moveend'); + }, + _tryAnimatedPan: function (t, i) { + t = this._getCenterOffset(t)._trunc(); + return ( + !(!0 !== (i && i.animate) && !this.getSize().contains(t)) && + (this.panBy(t, i), !0) + ); + }, + _createAnimProxy: function () { + var t = (this._proxy = b('div', 'leaflet-proxy leaflet-zoom-animated')); + this._panes.mapPane.appendChild(t), + this.on( + 'zoomanim', + function (t) { + var i = ui, + e = this._proxy.style[i]; + Pi( + this._proxy, + this.project(t.center, t.zoom), + this.getZoomScale(t.zoom, 1), + ), + e === this._proxy.style[i] && + this._animatingZoom && + this._onZoomTransitionEnd(); + }, + this, + ), + this.on('load moveend', this._animMoveEnd, this), + this._on('unload', this._destroyAnimProxy, this); + }, + _destroyAnimProxy: function () { + T(this._proxy), + this.off('load moveend', this._animMoveEnd, this), + delete this._proxy; + }, + _animMoveEnd: function () { + var t = this.getCenter(), + i = this.getZoom(); + Pi(this._proxy, this.project(t, i), this.getZoomScale(i, 1)); + }, + _catchTransitionEnd: function (t) { + this._animatingZoom && + 0 <= t.propertyName.indexOf('transform') && + this._onZoomTransitionEnd(); + }, + _nothingToAnimate: function () { + return !this._container.getElementsByClassName('leaflet-zoom-animated') + .length; + }, + _tryAnimatedZoom: function (t, i, e) { + if (this._animatingZoom) return !0; + if ( + ((e = e || {}), + !this._zoomAnimated || + !1 === e.animate || + this._nothingToAnimate() || + Math.abs(i - this._zoom) > this.options.zoomAnimationThreshold) + ) + return !1; + var n = this.getZoomScale(i), + n = this._getCenterOffset(t)._divideBy(1 - 1 / n); + return ( + !(!0 !== e.animate && !this.getSize().contains(n)) && + (x(function () { + this._moveStart(!0, !1)._animateZoom(t, i, !0); + }, this), + !0) + ); + }, + _animateZoom: function (t, i, e, n) { + this._mapPane && + (e && + ((this._animatingZoom = !0), + (this._animateToCenter = t), + (this._animateToZoom = i), + z(this._mapPane, 'leaflet-zoom-anim')), + this.fire('zoomanim', { center: t, zoom: i, noUpdate: n }), + this._tempFireZoomEvent || + (this._tempFireZoomEvent = this._zoom !== this._animateToZoom), + this._move(this._animateToCenter, this._animateToZoom, void 0, !0), + setTimeout(a(this._onZoomTransitionEnd, this), 250)); + }, + _onZoomTransitionEnd: function () { + this._animatingZoom && + (this._mapPane && M(this._mapPane, 'leaflet-zoom-anim'), + (this._animatingZoom = !1), + this._move(this._animateToCenter, this._animateToZoom, void 0, !0), + this._tempFireZoomEvent && this.fire('zoom'), + delete this._tempFireZoomEvent, + this.fire('move'), + this._moveEnd(!0)); + }, + }); + function Fi(t) { + return new I(t); + } + var Ui, + I = it.extend({ + options: { position: 'topright' }, + initialize: function (t) { + c(this, t); + }, + getPosition: function () { + return this.options.position; + }, + setPosition: function (t) { + var i = this._map; + return ( + i && i.removeControl(this), + (this.options.position = t), + i && i.addControl(this), + this + ); + }, + getContainer: function () { + return this._container; + }, + addTo: function (t) { + this.remove(), (this._map = t); + var i = (this._container = this.onAdd(t)), + e = this.getPosition(), + t = t._controlCorners[e]; + return ( + z(i, 'leaflet-control'), + -1 !== e.indexOf('bottom') + ? t.insertBefore(i, t.firstChild) + : t.appendChild(i), + this._map.on('unload', this.remove, this), + this + ); + }, + remove: function () { + return ( + this._map && + (T(this._container), + this.onRemove && this.onRemove(this._map), + this._map.off('unload', this.remove, this), + (this._map = null)), + this + ); + }, + _refocusOnMap: function (t) { + this._map && + t && + 0 < t.screenX && + 0 < t.screenY && + this._map.getContainer().focus(); + }, + }), + Vi = + (A.include({ + addControl: function (t) { + return t.addTo(this), this; + }, + removeControl: function (t) { + return t.remove(), this; + }, + _initControlPos: function () { + var e = (this._controlCorners = {}), + n = 'leaflet-', + o = (this._controlContainer = b( + 'div', + n + 'control-container', + this._container, + )); + function t(t, i) { + e[t + i] = b('div', n + t + ' ' + n + i, o); + } + t('top', 'left'), + t('top', 'right'), + t('bottom', 'left'), + t('bottom', 'right'); + }, + _clearControlPos: function () { + for (var t in this._controlCorners) T(this._controlCorners[t]); + T(this._controlContainer), + delete this._controlCorners, + delete this._controlContainer; + }, + }), + I.extend({ + options: { + collapsed: !0, + position: 'topright', + autoZIndex: !0, + hideSingleBase: !1, + sortLayers: !1, + sortFunction: function (t, i, e, n) { + return e < n ? -1 : n < e ? 1 : 0; + }, + }, + initialize: function (t, i, e) { + for (var n in (c(this, e), + (this._layerControlInputs = []), + (this._layers = []), + (this._lastZIndex = 0), + (this._handlingClick = !1), + t)) + this._addLayer(t[n], n); + for (n in i) this._addLayer(i[n], n, !0); + }, + onAdd: function (t) { + this._initLayout(), + this._update(), + (this._map = t).on('zoomend', this._checkDisabledLayers, this); + for (var i = 0; i < this._layers.length; i++) + this._layers[i].layer.on('add remove', this._onLayerChange, this); + return this._container; + }, + addTo: function (t) { + return I.prototype.addTo.call(this, t), this._expandIfNotCollapsed(); + }, + onRemove: function () { + this._map.off('zoomend', this._checkDisabledLayers, this); + for (var t = 0; t < this._layers.length; t++) + this._layers[t].layer.off('add remove', this._onLayerChange, this); + }, + addBaseLayer: function (t, i) { + return this._addLayer(t, i), this._map ? this._update() : this; + }, + addOverlay: function (t, i) { + return this._addLayer(t, i, !0), this._map ? this._update() : this; + }, + removeLayer: function (t) { + t.off('add remove', this._onLayerChange, this); + t = this._getLayer(h(t)); + return ( + t && this._layers.splice(this._layers.indexOf(t), 1), + this._map ? this._update() : this + ); + }, + expand: function () { + z(this._container, 'leaflet-control-layers-expanded'), + (this._section.style.height = null); + var t = this._map.getSize().y - (this._container.offsetTop + 50); + return ( + t < this._section.clientHeight + ? (z(this._section, 'leaflet-control-layers-scrollbar'), + (this._section.style.height = t + 'px')) + : M(this._section, 'leaflet-control-layers-scrollbar'), + this._checkDisabledLayers(), + this + ); + }, + collapse: function () { + return M(this._container, 'leaflet-control-layers-expanded'), this; + }, + _initLayout: function () { + var t = 'leaflet-control-layers', + i = (this._container = b('div', t)), + e = this.options.collapsed, + n = + (i.setAttribute('aria-haspopup', !0), + Oi(i), + Ii(i), + (this._section = b('section', t + '-list'))), + o = + (e && + (this._map.on('click', this.collapse, this), + S( + i, + { + mouseenter: function () { + S(n, 'click', B), + this.expand(), + setTimeout(function () { + E(n, 'click', B); + }); + }, + mouseleave: this.collapse, + }, + this, + )), + (this._layersLink = b('a', t + '-toggle', i))); + (o.href = '#'), + (o.title = 'Layers'), + o.setAttribute('role', 'button'), + S(o, 'click', B), + S(o, 'focus', this.expand, this), + e || this.expand(), + (this._baseLayersList = b('div', t + '-base', n)), + (this._separator = b('div', t + '-separator', n)), + (this._overlaysList = b('div', t + '-overlays', n)), + i.appendChild(n); + }, + _getLayer: function (t) { + for (var i = 0; i < this._layers.length; i++) + if (this._layers[i] && h(this._layers[i].layer) === t) + return this._layers[i]; + }, + _addLayer: function (t, i, e) { + this._map && t.on('add remove', this._onLayerChange, this), + this._layers.push({ layer: t, name: i, overlay: e }), + this.options.sortLayers && + this._layers.sort( + a(function (t, i) { + return this.options.sortFunction( + t.layer, + i.layer, + t.name, + i.name, + ); + }, this), + ), + this.options.autoZIndex && + t.setZIndex && + (this._lastZIndex++, t.setZIndex(this._lastZIndex)), + this._expandIfNotCollapsed(); + }, + _update: function () { + if (!this._container) return this; + mi(this._baseLayersList), + mi(this._overlaysList), + (this._layerControlInputs = []); + for (var t, i, e, n = 0, o = 0; o < this._layers.length; o++) + (e = this._layers[o]), + this._addItem(e), + (i = i || e.overlay), + (t = t || !e.overlay), + (n += e.overlay ? 0 : 1); + return ( + this.options.hideSingleBase && + (this._baseLayersList.style.display = (t = t && 1 < n) + ? '' + : 'none'), + (this._separator.style.display = i && t ? '' : 'none'), + this + ); + }, + _onLayerChange: function (t) { + this._handlingClick || this._update(); + var i = this._getLayer(h(t.target)), + t = i.overlay + ? 'add' === t.type + ? 'overlayadd' + : 'overlayremove' + : 'add' === t.type + ? 'baselayerchange' + : null; + t && this._map.fire(t, i); + }, + _createRadioElement: function (t, i) { + (t = + ''), + (i = document.createElement('div')); + return (i.innerHTML = t), i.firstChild; + }, + _addItem: function (t) { + var i, + e = document.createElement('label'), + n = this._map.hasLayer(t.layer), + n = + (t.overlay + ? (((i = document.createElement('input')).type = 'checkbox'), + (i.className = 'leaflet-control-layers-selector'), + (i.defaultChecked = n)) + : (i = this._createRadioElement( + 'leaflet-base-layers_' + h(this), + n, + )), + this._layerControlInputs.push(i), + (i.layerId = h(t.layer)), + S(i, 'click', this._onInputClick, this), + document.createElement('span')), + o = ((n.innerHTML = ' ' + t.name), document.createElement('span')); + return ( + e.appendChild(o), + o.appendChild(i), + o.appendChild(n), + (t.overlay ? this._overlaysList : this._baseLayersList).appendChild( + e, + ), + this._checkDisabledLayers(), + e + ); + }, + _onInputClick: function () { + var t, + i, + e = this._layerControlInputs, + n = [], + o = []; + this._handlingClick = !0; + for (var s = e.length - 1; 0 <= s; s--) + (t = e[s]), + (i = this._getLayer(t.layerId).layer), + t.checked ? n.push(i) : t.checked || o.push(i); + for (s = 0; s < o.length; s++) + this._map.hasLayer(o[s]) && this._map.removeLayer(o[s]); + for (s = 0; s < n.length; s++) + this._map.hasLayer(n[s]) || this._map.addLayer(n[s]); + (this._handlingClick = !1), this._refocusOnMap(); + }, + _checkDisabledLayers: function () { + for ( + var t, + i, + e = this._layerControlInputs, + n = this._map.getZoom(), + o = e.length - 1; + 0 <= o; + o-- + ) + (t = e[o]), + (i = this._getLayer(t.layerId).layer), + (t.disabled = + (void 0 !== i.options.minZoom && n < i.options.minZoom) || + (void 0 !== i.options.maxZoom && n > i.options.maxZoom)); + }, + _expandIfNotCollapsed: function () { + return this._map && !this.options.collapsed && this.expand(), this; + }, + })), + qi = I.extend({ + options: { + position: 'topleft', + zoomInText: '', + zoomInTitle: 'Zoom in', + zoomOutText: '', + zoomOutTitle: 'Zoom out', + }, + onAdd: function (t) { + var i = 'leaflet-control-zoom', + e = b('div', i + ' leaflet-bar'), + n = this.options; + return ( + (this._zoomInButton = this._createButton( + n.zoomInText, + n.zoomInTitle, + i + '-in', + e, + this._zoomIn, + )), + (this._zoomOutButton = this._createButton( + n.zoomOutText, + n.zoomOutTitle, + i + '-out', + e, + this._zoomOut, + )), + this._updateDisabled(), + t.on('zoomend zoomlevelschange', this._updateDisabled, this), + e + ); + }, + onRemove: function (t) { + t.off('zoomend zoomlevelschange', this._updateDisabled, this); + }, + disable: function () { + return (this._disabled = !0), this._updateDisabled(), this; + }, + enable: function () { + return (this._disabled = !1), this._updateDisabled(), this; + }, + _zoomIn: function (t) { + !this._disabled && + this._map._zoom < this._map.getMaxZoom() && + this._map.zoomIn(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1)); + }, + _zoomOut: function (t) { + !this._disabled && + this._map._zoom > this._map.getMinZoom() && + this._map.zoomOut(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1)); + }, + _createButton: function (t, i, e, n, o) { + e = b('a', e, n); + return ( + (e.innerHTML = t), + (e.href = '#'), + (e.title = i), + e.setAttribute('role', 'button'), + e.setAttribute('aria-label', i), + Oi(e), + S(e, 'click', Ri), + S(e, 'click', o, this), + S(e, 'click', this._refocusOnMap, this), + e + ); + }, + _updateDisabled: function () { + var t = this._map, + i = 'leaflet-disabled'; + M(this._zoomInButton, i), + M(this._zoomOutButton, i), + this._zoomInButton.setAttribute('aria-disabled', 'false'), + this._zoomOutButton.setAttribute('aria-disabled', 'false'), + (!this._disabled && t._zoom !== t.getMinZoom()) || + (z(this._zoomOutButton, i), + this._zoomOutButton.setAttribute('aria-disabled', 'true')), + (!this._disabled && t._zoom !== t.getMaxZoom()) || + (z(this._zoomInButton, i), + this._zoomInButton.setAttribute('aria-disabled', 'true')); + }, + }), + Gi = + (A.mergeOptions({ zoomControl: !0 }), + A.addInitHook(function () { + this.options.zoomControl && + ((this.zoomControl = new qi()), this.addControl(this.zoomControl)); + }), + I.extend({ + options: { + position: 'bottomleft', + maxWidth: 100, + metric: !0, + imperial: !0, + }, + onAdd: function (t) { + var i = 'leaflet-control-scale', + e = b('div', i), + n = this.options; + return ( + this._addScales(n, i + '-line', e), + t.on(n.updateWhenIdle ? 'moveend' : 'move', this._update, this), + t.whenReady(this._update, this), + e + ); + }, + onRemove: function (t) { + t.off( + this.options.updateWhenIdle ? 'moveend' : 'move', + this._update, + this, + ); + }, + _addScales: function (t, i, e) { + t.metric && (this._mScale = b('div', i, e)), + t.imperial && (this._iScale = b('div', i, e)); + }, + _update: function () { + var t = this._map, + i = t.getSize().y / 2, + t = t.distance( + t.containerPointToLatLng([0, i]), + t.containerPointToLatLng([this.options.maxWidth, i]), + ); + this._updateScales(t); + }, + _updateScales: function (t) { + this.options.metric && t && this._updateMetric(t), + this.options.imperial && t && this._updateImperial(t); + }, + _updateMetric: function (t) { + var i = this._getRoundNum(t); + this._updateScale( + this._mScale, + i < 1e3 ? i + ' m' : i / 1e3 + ' km', + i / t, + ); + }, + _updateImperial: function (t) { + var i, + e, + t = 3.2808399 * t; + 5280 < t + ? ((e = this._getRoundNum((i = t / 5280))), + this._updateScale(this._iScale, e + ' mi', e / i)) + : ((e = this._getRoundNum(t)), + this._updateScale(this._iScale, e + ' ft', e / t)); + }, + _updateScale: function (t, i, e) { + (t.style.width = Math.round(this.options.maxWidth * e) + 'px'), + (t.innerHTML = i); + }, + _getRoundNum: function (t) { + var i = Math.pow(10, (Math.floor(t) + '').length - 1), + t = t / i; + return ( + i * (t = 10 <= t ? 10 : 5 <= t ? 5 : 3 <= t ? 3 : 2 <= t ? 2 : 1) + ); + }, + })), + Ki = I.extend({ + options: { + position: 'bottomright', + prefix: + '' + + (P.inlineSvg + ? ' ' + : '') + + 'Leaflet', + }, + initialize: function (t) { + c(this, t), (this._attributions = {}); + }, + onAdd: function (t) { + for (var i in (((t.attributionControl = this)._container = b( + 'div', + 'leaflet-control-attribution', + )), + Oi(this._container), + t._layers)) + t._layers[i].getAttribution && + this.addAttribution(t._layers[i].getAttribution()); + return ( + this._update(), + t.on('layeradd', this._addAttribution, this), + this._container + ); + }, + onRemove: function (t) { + t.off('layeradd', this._addAttribution, this); + }, + _addAttribution: function (t) { + t.layer.getAttribution && + (this.addAttribution(t.layer.getAttribution()), + t.layer.once( + 'remove', + function () { + this.removeAttribution(t.layer.getAttribution()); + }, + this, + )); + }, + setPrefix: function (t) { + return (this.options.prefix = t), this._update(), this; + }, + addAttribution: function (t) { + return ( + t && + (this._attributions[t] || (this._attributions[t] = 0), + this._attributions[t]++, + this._update()), + this + ); + }, + removeAttribution: function (t) { + return ( + t && + this._attributions[t] && + (this._attributions[t]--, this._update()), + this + ); + }, + _update: function () { + if (this._map) { + var t, + i = []; + for (t in this._attributions) this._attributions[t] && i.push(t); + var e = []; + this.options.prefix && e.push(this.options.prefix), + i.length && e.push(i.join(', ')), + (this._container.innerHTML = e.join( + ' ', + )); + } + }, + }), + n = + (A.mergeOptions({ attributionControl: !0 }), + A.addInitHook(function () { + this.options.attributionControl && new Ki().addTo(this); + }), + (I.Layers = Vi), + (I.Zoom = qi), + (I.Scale = Gi), + (I.Attribution = Ki), + (Fi.layers = function (t, i, e) { + return new Vi(t, i, e); + }), + (Fi.zoom = function (t) { + return new qi(t); + }), + (Fi.scale = function (t) { + return new Gi(t); + }), + (Fi.attribution = function (t) { + return new Ki(t); + }), + it.extend({ + initialize: function (t) { + this._map = t; + }, + enable: function () { + return this._enabled || ((this._enabled = !0), this.addHooks()), this; + }, + disable: function () { + return ( + this._enabled && ((this._enabled = !1), this.removeHooks()), this + ); + }, + enabled: function () { + return !!this._enabled; + }, + })), + ft = + ((n.addTo = function (t, i) { + return t.addHandler(i, this), this; + }), + { Events: i }), + Yi = P.touch ? 'touchstart mousedown' : 'mousedown', + Xi = et.extend({ + options: { clickTolerance: 3 }, + initialize: function (t, i, e, n) { + c(this, n), + (this._element = t), + (this._dragStartTarget = i || t), + (this._preventOutline = e); + }, + enable: function () { + this._enabled || + (S(this._dragStartTarget, Yi, this._onDown, this), + (this._enabled = !0)); + }, + disable: function () { + this._enabled && + (Xi._dragging === this && this.finishDrag(!0), + E(this._dragStartTarget, Yi, this._onDown, this), + (this._enabled = !1), + (this._moved = !1)); + }, + _onDown: function (t) { + var i, e; + this._enabled && + ((this._moved = !1), + vi(this._element, 'leaflet-zoom-anim') || + (t.touches && 1 !== t.touches.length + ? Xi._dragging === this && this.finishDrag() + : Xi._dragging || + t.shiftKey || + (1 !== t.which && 1 !== t.button && !t.touches) || + ((Xi._dragging = this)._preventOutline && zi(this._element), + Li(), + ri(), + this._moving || + (this.fire('down'), + (e = t.touches ? t.touches[0] : t), + (i = Ci(this._element)), + (this._startPoint = new p(e.clientX, e.clientY)), + (this._startPos = bi(this._element)), + (this._parentScale = Zi(i)), + (e = 'mousedown' === t.type), + S( + document, + e ? 'mousemove' : 'touchmove', + this._onMove, + this, + ), + S( + document, + e ? 'mouseup' : 'touchend touchcancel', + this._onUp, + this, + ))))); + }, + _onMove: function (t) { + var i; + this._enabled && + (t.touches && 1 < t.touches.length + ? (this._moved = !0) + : (!(i = new p( + (i = + t.touches && 1 === t.touches.length + ? t.touches[0] + : t).clientX, + i.clientY, + )._subtract(this._startPoint)).x && + !i.y) || + Math.abs(i.x) + Math.abs(i.y) < this.options.clickTolerance || + ((i.x /= this._parentScale.x), + (i.y /= this._parentScale.y), + B(t), + this._moved || + (this.fire('dragstart'), + (this._moved = !0), + z(document.body, 'leaflet-dragging'), + (this._lastTarget = t.target || t.srcElement), + window.SVGElementInstance && + this._lastTarget instanceof window.SVGElementInstance && + (this._lastTarget = this._lastTarget.correspondingUseElement), + z(this._lastTarget, 'leaflet-drag-target')), + (this._newPos = this._startPos.add(i)), + (this._moving = !0), + (this._lastEvent = t), + this._updatePosition())); + }, + _updatePosition: function () { + var t = { originalEvent: this._lastEvent }; + this.fire('predrag', t), + Z(this._element, this._newPos), + this.fire('drag', t); + }, + _onUp: function () { + this._enabled && this.finishDrag(); + }, + finishDrag: function (t) { + M(document.body, 'leaflet-dragging'), + this._lastTarget && + (M(this._lastTarget, 'leaflet-drag-target'), + (this._lastTarget = null)), + E(document, 'mousemove touchmove', this._onMove, this), + E(document, 'mouseup touchend touchcancel', this._onUp, this), + Ti(), + ai(), + this._moved && + this._moving && + this.fire('dragend', { + noInertia: t, + distance: this._newPos.distanceTo(this._startPos), + }), + (this._moving = !1), + (Xi._dragging = !1); + }, + }); + function Ji(t, i) { + if (!i || !t.length) return t.slice(); + i *= i; + return (t = (function (t, i) { + var e = t.length, + n = new (typeof Uint8Array != void 0 + '' ? Uint8Array : Array)(e); + (n[0] = n[e - 1] = 1), + (function t(i, e, n, o, s) { + var r, + a, + h, + l = 0; + for (a = o + 1; a <= s - 1; a++) + (h = ee(i[a], i[o], i[s], !0)), l < h && ((r = a), (l = h)); + n < l && ((e[r] = 1), t(i, e, n, o, r), t(i, e, n, r, s)); + })(t, n, i, 0, e - 1); + var o, + s = []; + for (o = 0; o < e; o++) n[o] && s.push(t[o]); + return s; + })( + (t = (function (t, i) { + for (var e = [t[0]], n = 1, o = 0, s = t.length; n < s; n++) + (function (t, i) { + var e = i.x - t.x, + i = i.y - t.y; + return e * e + i * i; + })(t[n], t[o]) > i && (e.push(t[n]), (o = n)); + o < s - 1 && e.push(t[s - 1]); + return e; + })(t, i)), + i, + )); + } + function $i(t, i, e) { + return Math.sqrt(ee(t, i, e, !0)); + } + function Qi(t, i, e, n, o) { + var s, + r, + a, + h = n ? Ui : ie(t, e), + l = ie(i, e); + for (Ui = l; ; ) { + if (!(h | l)) return [t, i]; + if (h & l) return !1; + (a = ie((r = te(t, i, (s = h || l), e, o)), e)), + s === h ? ((t = r), (h = a)) : ((i = r), (l = a)); + } + } + function te(t, i, e, n, o) { + var s, + r, + a = i.x - t.x, + i = i.y - t.y, + h = n.min, + n = n.max; + return ( + 8 & e + ? ((s = t.x + (a * (n.y - t.y)) / i), (r = n.y)) + : 4 & e + ? ((s = t.x + (a * (h.y - t.y)) / i), (r = h.y)) + : 2 & e + ? ((s = n.x), (r = t.y + (i * (n.x - t.x)) / a)) + : 1 & e && ((s = h.x), (r = t.y + (i * (h.x - t.x)) / a)), + new p(s, r, o) + ); + } + function ie(t, i) { + var e = 0; + return ( + t.x < i.min.x ? (e |= 1) : t.x > i.max.x && (e |= 2), + t.y < i.min.y ? (e |= 4) : t.y > i.max.y && (e |= 8), + e + ); + } + function ee(t, i, e, n) { + var o = i.x, + i = i.y, + s = e.x - o, + r = e.y - i, + a = s * s + r * r; + return ( + 0 < a && + (1 < (a = ((t.x - o) * s + (t.y - i) * r) / a) + ? ((o = e.x), (i = e.y)) + : 0 < a && ((o += s * a), (i += r * a))), + (s = t.x - o), + (r = t.y - i), + n ? s * s + r * r : new p(o, i) + ); + } + function ne(t) { + return !d(t[0]) || ('object' != typeof t[0][0] && void 0 !== t[0][0]); + } + function oe(t) { + return ( + console.warn( + 'Deprecated use of _flat, please use L.LineUtil.isFlat instead.', + ), + ne(t) + ); + } + gt = { + __proto__: null, + simplify: Ji, + pointToSegmentDistance: $i, + closestPointOnSegment: function (t, i, e) { + return ee(t, i, e); + }, + clipSegment: Qi, + _getEdgeIntersection: te, + _getBitCode: ie, + _sqClosestPointOnSegment: ee, + isFlat: ne, + _flat: oe, + }; + function se(t, i, e) { + for ( + var n, o, s, r, a, h, l, u = [1, 4, 2, 8], c = 0, d = t.length; + c < d; + c++ + ) + t[c]._code = ie(t[c], i); + for (s = 0; s < 4; s++) { + for (h = u[s], n = [], c = 0, o = (d = t.length) - 1; c < d; o = c++) + (r = t[c]), + (a = t[o]), + r._code & h + ? a._code & h || + (((l = te(a, r, h, i, e))._code = ie(l, i)), n.push(l)) + : (a._code & h && + (((l = te(a, r, h, i, e))._code = ie(l, i)), n.push(l)), + n.push(r)); + t = n; + } + return t; + } + var vt = { __proto__: null, clipPolygon: se }, + yt = { + project: function (t) { + return new p(t.lng, t.lat); + }, + unproject: function (t) { + return new v(t.y, t.x); + }, + bounds: new m([-180, -90], [180, 90]), + }, + xt = { + R: 6378137, + R_MINOR: 6356752.314245179, + bounds: new m( + [-20037508.34279, -15496570.73972], + [20037508.34279, 18764656.23138], + ), + project: function (t) { + var i = Math.PI / 180, + e = this.R, + n = t.lat * i, + o = this.R_MINOR / e, + o = Math.sqrt(1 - o * o), + s = o * Math.sin(n), + s = + Math.tan(Math.PI / 4 - n / 2) / Math.pow((1 - s) / (1 + s), o / 2), + n = -e * Math.log(Math.max(s, 1e-10)); + return new p(t.lng * i * e, n); + }, + unproject: function (t) { + for ( + var i, + e = 180 / Math.PI, + n = this.R, + o = this.R_MINOR / n, + s = Math.sqrt(1 - o * o), + r = Math.exp(-t.y / n), + a = Math.PI / 2 - 2 * Math.atan(r), + h = 0, + l = 0.1; + h < 15 && 1e-7 < Math.abs(l); + h++ + ) + (i = s * Math.sin(a)), + (i = Math.pow((1 - i) / (1 + i), s / 2)), + (a += l = Math.PI / 2 - 2 * Math.atan(r * i) - a); + return new v(a * e, (t.x * e) / n); + }, + }, + wt = { __proto__: null, LonLat: yt, Mercator: xt, SphericalMercator: rt }, + bt = l({}, st, { + code: 'EPSG:3395', + projection: xt, + transformation: ht((Pt = 0.5 / (Math.PI * xt.R)), 0.5, -Pt, 0.5), + }), + re = l({}, st, { + code: 'EPSG:4326', + projection: yt, + transformation: ht(1 / 180, 1, -1 / 180, 0.5), + }), + Lt = l({}, ot, { + projection: yt, + transformation: ht(1, 0, -1, 0), + scale: function (t) { + return Math.pow(2, t); + }, + zoom: function (t) { + return Math.log(t) / Math.LN2; + }, + distance: function (t, i) { + var e = i.lng - t.lng, + i = i.lat - t.lat; + return Math.sqrt(e * e + i * i); + }, + infinite: !0, + }), + o = + ((ot.Earth = st), + (ot.EPSG3395 = bt), + (ot.EPSG3857 = lt), + (ot.EPSG900913 = ut), + (ot.EPSG4326 = re), + (ot.Simple = Lt), + et.extend({ + options: { + pane: 'overlayPane', + attribution: null, + bubblingMouseEvents: !0, + }, + addTo: function (t) { + return t.addLayer(this), this; + }, + remove: function () { + return this.removeFrom(this._map || this._mapToAdd); + }, + removeFrom: function (t) { + return t && t.removeLayer(this), this; + }, + getPane: function (t) { + return this._map.getPane( + t ? this.options[t] || t : this.options.pane, + ); + }, + addInteractiveTarget: function (t) { + return (this._map._targets[h(t)] = this); + }, + removeInteractiveTarget: function (t) { + return delete this._map._targets[h(t)], this; + }, + getAttribution: function () { + return this.options.attribution; + }, + _layerAdd: function (t) { + var i, + e = t.target; + e.hasLayer(this) && + ((this._map = e), + (this._zoomAnimated = e._zoomAnimated), + this.getEvents && + ((i = this.getEvents()), + e.on(i, this), + this.once( + 'remove', + function () { + e.off(i, this); + }, + this, + )), + this.onAdd(e), + this.fire('add'), + e.fire('layeradd', { layer: this })); + }, + })), + ae = + (A.include({ + addLayer: function (t) { + if (!t._layerAdd) + throw new Error('The provided object is not a Layer.'); + var i = h(t); + return ( + this._layers[i] || + (((this._layers[i] = t)._mapToAdd = this), + t.beforeAdd && t.beforeAdd(this), + this.whenReady(t._layerAdd, t)), + this + ); + }, + removeLayer: function (t) { + var i = h(t); + return ( + this._layers[i] && + (this._loaded && t.onRemove(this), + delete this._layers[i], + this._loaded && + (this.fire('layerremove', { layer: t }), t.fire('remove')), + (t._map = t._mapToAdd = null)), + this + ); + }, + hasLayer: function (t) { + return h(t) in this._layers; + }, + eachLayer: function (t, i) { + for (var e in this._layers) t.call(i, this._layers[e]); + return this; + }, + _addLayers: function (t) { + for ( + var i = 0, e = (t = t ? (d(t) ? t : [t]) : []).length; + i < e; + i++ + ) + this.addLayer(t[i]); + }, + _addZoomLimit: function (t) { + (isNaN(t.options.maxZoom) && isNaN(t.options.minZoom)) || + ((this._zoomBoundLayers[h(t)] = t), this._updateZoomLevels()); + }, + _removeZoomLimit: function (t) { + t = h(t); + this._zoomBoundLayers[t] && + (delete this._zoomBoundLayers[t], this._updateZoomLevels()); + }, + _updateZoomLevels: function () { + var t, + i = 1 / 0, + e = -1 / 0, + n = this._getZoomSpan(); + for (t in this._zoomBoundLayers) + var o = this._zoomBoundLayers[t].options, + i = void 0 === o.minZoom ? i : Math.min(i, o.minZoom), + e = void 0 === o.maxZoom ? e : Math.max(e, o.maxZoom); + (this._layersMaxZoom = e === -1 / 0 ? void 0 : e), + (this._layersMinZoom = i === 1 / 0 ? void 0 : i), + n !== this._getZoomSpan() && this.fire('zoomlevelschange'), + void 0 === this.options.maxZoom && + this._layersMaxZoom && + this.getZoom() > this._layersMaxZoom && + this.setZoom(this._layersMaxZoom), + void 0 === this.options.minZoom && + this._layersMinZoom && + this.getZoom() < this._layersMinZoom && + this.setZoom(this._layersMinZoom); + }, + }), + o.extend({ + initialize: function (t, i) { + var e, n; + if ((c(this, i), (this._layers = {}), t)) + for (e = 0, n = t.length; e < n; e++) this.addLayer(t[e]); + }, + addLayer: function (t) { + var i = this.getLayerId(t); + return ( + (this._layers[i] = t), this._map && this._map.addLayer(t), this + ); + }, + removeLayer: function (t) { + t = t in this._layers ? t : this.getLayerId(t); + return ( + this._map && + this._layers[t] && + this._map.removeLayer(this._layers[t]), + delete this._layers[t], + this + ); + }, + hasLayer: function (t) { + return ( + ('number' == typeof t ? t : this.getLayerId(t)) in this._layers + ); + }, + clearLayers: function () { + return this.eachLayer(this.removeLayer, this); + }, + invoke: function (t) { + var i, + e, + n = Array.prototype.slice.call(arguments, 1); + for (i in this._layers) (e = this._layers[i])[t] && e[t].apply(e, n); + return this; + }, + onAdd: function (t) { + this.eachLayer(t.addLayer, t); + }, + onRemove: function (t) { + this.eachLayer(t.removeLayer, t); + }, + eachLayer: function (t, i) { + for (var e in this._layers) t.call(i, this._layers[e]); + return this; + }, + getLayer: function (t) { + return this._layers[t]; + }, + getLayers: function () { + var t = []; + return this.eachLayer(t.push, t), t; + }, + setZIndex: function (t) { + return this.invoke('setZIndex', t); + }, + getLayerId: h, + })), + he = ae.extend({ + addLayer: function (t) { + return this.hasLayer(t) + ? this + : (t.addEventParent(this), + ae.prototype.addLayer.call(this, t), + this.fire('layeradd', { layer: t })); + }, + removeLayer: function (t) { + return this.hasLayer(t) + ? ((t = t in this._layers ? this._layers[t] : t).removeEventParent( + this, + ), + ae.prototype.removeLayer.call(this, t), + this.fire('layerremove', { layer: t })) + : this; + }, + setStyle: function (t) { + return this.invoke('setStyle', t); + }, + bringToFront: function () { + return this.invoke('bringToFront'); + }, + bringToBack: function () { + return this.invoke('bringToBack'); + }, + getBounds: function () { + var t, + i = new s(); + for (t in this._layers) { + var e = this._layers[t]; + i.extend(e.getBounds ? e.getBounds() : e.getLatLng()); + } + return i; + }, + }), + le = it.extend({ + options: { popupAnchor: [0, 0], tooltipAnchor: [0, 0], crossOrigin: !1 }, + initialize: function (t) { + c(this, t); + }, + createIcon: function (t) { + return this._createIcon('icon', t); + }, + createShadow: function (t) { + return this._createIcon('shadow', t); + }, + _createIcon: function (t, i) { + var e = this._getIconUrl(t); + if (!e) { + if ('icon' === t) + throw new Error('iconUrl not set in Icon options (see the docs).'); + return null; + } + e = this._createImg(e, i && 'IMG' === i.tagName ? i : null); + return ( + this._setIconStyles(e, t), + (!this.options.crossOrigin && '' !== this.options.crossOrigin) || + (e.crossOrigin = + !0 === this.options.crossOrigin ? '' : this.options.crossOrigin), + e + ); + }, + _setIconStyles: function (t, i) { + var e = this.options, + n = e[i + 'Size'], + n = _((n = 'number' == typeof n ? [n, n] : n)), + o = _( + ('shadow' === i && e.shadowAnchor) || + e.iconAnchor || + (n && n.divideBy(2, !0)), + ); + (t.className = 'leaflet-marker-' + i + ' ' + (e.className || '')), + o && + ((t.style.marginLeft = -o.x + 'px'), + (t.style.marginTop = -o.y + 'px')), + n && ((t.style.width = n.x + 'px'), (t.style.height = n.y + 'px')); + }, + _createImg: function (t, i) { + return ((i = i || document.createElement('img')).src = t), i; + }, + _getIconUrl: function (t) { + return ( + (P.retina && this.options[t + 'RetinaUrl']) || this.options[t + 'Url'] + ); + }, + }); + var ue = le.extend({ + options: { + iconUrl: 'marker-icon.png', + iconRetinaUrl: 'marker-icon-2x.png', + shadowUrl: 'marker-shadow.png', + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + tooltipAnchor: [16, -28], + shadowSize: [41, 41], + }, + _getIconUrl: function (t) { + return ( + 'string' != typeof ue.imagePath && + (ue.imagePath = this._detectIconPath()), + (this.options.imagePath || ue.imagePath) + + le.prototype._getIconUrl.call(this, t) + ); + }, + _stripUrl: function (t) { + function i(t, i, e) { + return (i = i.exec(t)) && i[e]; + } + return ( + (t = i(t, /^url\((['"])?(.+)\1\)$/, 2)) && + i(t, /^(.*)marker-icon\.png$/, 1) + ); + }, + _detectIconPath: function () { + var t = b('div', 'leaflet-default-icon-path', document.body), + i = pi(t, 'background-image') || pi(t, 'backgroundImage'); + if ((document.body.removeChild(t), (i = this._stripUrl(i)))) return i; + t = document.querySelector('link[href$="leaflet.css"]'); + return t + ? t.href.substring(0, t.href.length - 'leaflet.css'.length - 1) + : ''; + }, + }), + ce = n.extend({ + initialize: function (t) { + this._marker = t; + }, + addHooks: function () { + var t = this._marker._icon; + this._draggable || (this._draggable = new Xi(t, t, !0)), + this._draggable + .on( + { + dragstart: this._onDragStart, + predrag: this._onPreDrag, + drag: this._onDrag, + dragend: this._onDragEnd, + }, + this, + ) + .enable(), + z(t, 'leaflet-marker-draggable'); + }, + removeHooks: function () { + this._draggable + .off( + { + dragstart: this._onDragStart, + predrag: this._onPreDrag, + drag: this._onDrag, + dragend: this._onDragEnd, + }, + this, + ) + .disable(), + this._marker._icon && + M(this._marker._icon, 'leaflet-marker-draggable'); + }, + moved: function () { + return this._draggable && this._draggable._moved; + }, + _adjustPan: function (t) { + var i = this._marker, + e = i._map, + n = this._marker.options.autoPanSpeed, + o = this._marker.options.autoPanPadding, + s = bi(i._icon), + r = e.getPixelBounds(), + a = e.getPixelOrigin(), + a = f(r.min._subtract(a).add(o), r.max._subtract(a).subtract(o)); + a.contains(s) || + ((o = _( + (Math.max(a.max.x, s.x) - a.max.x) / (r.max.x - a.max.x) - + (Math.min(a.min.x, s.x) - a.min.x) / (r.min.x - a.min.x), + (Math.max(a.max.y, s.y) - a.max.y) / (r.max.y - a.max.y) - + (Math.min(a.min.y, s.y) - a.min.y) / (r.min.y - a.min.y), + ).multiplyBy(n)), + e.panBy(o, { animate: !1 }), + this._draggable._newPos._add(o), + this._draggable._startPos._add(o), + Z(i._icon, this._draggable._newPos), + this._onDrag(t), + (this._panRequest = x(this._adjustPan.bind(this, t)))); + }, + _onDragStart: function () { + (this._oldLatLng = this._marker.getLatLng()), + this._marker.closePopup && this._marker.closePopup(), + this._marker.fire('movestart').fire('dragstart'); + }, + _onPreDrag: function (t) { + this._marker.options.autoPan && + (r(this._panRequest), + (this._panRequest = x(this._adjustPan.bind(this, t)))); + }, + _onDrag: function (t) { + var i = this._marker, + e = i._shadow, + n = bi(i._icon), + o = i._map.layerPointToLatLng(n); + e && Z(e, n), + (i._latlng = o), + (t.latlng = o), + (t.oldLatLng = this._oldLatLng), + i.fire('move', t).fire('drag', t); + }, + _onDragEnd: function (t) { + r(this._panRequest), + delete this._oldLatLng, + this._marker.fire('moveend').fire('dragend', t); + }, + }), + de = o.extend({ + options: { + icon: new ue(), + interactive: !0, + keyboard: !0, + title: '', + alt: 'Marker', + zIndexOffset: 0, + opacity: 1, + riseOnHover: !1, + riseOffset: 250, + pane: 'markerPane', + shadowPane: 'shadowPane', + bubblingMouseEvents: !1, + autoPanOnFocus: !0, + draggable: !1, + autoPan: !1, + autoPanPadding: [50, 50], + autoPanSpeed: 10, + }, + initialize: function (t, i) { + c(this, i), (this._latlng = w(t)); + }, + onAdd: function (t) { + (this._zoomAnimated = + this._zoomAnimated && t.options.markerZoomAnimation), + this._zoomAnimated && t.on('zoomanim', this._animateZoom, this), + this._initIcon(), + this.update(); + }, + onRemove: function (t) { + this.dragging && + this.dragging.enabled() && + ((this.options.draggable = !0), this.dragging.removeHooks()), + delete this.dragging, + this._zoomAnimated && t.off('zoomanim', this._animateZoom, this), + this._removeIcon(), + this._removeShadow(); + }, + getEvents: function () { + return { zoom: this.update, viewreset: this.update }; + }, + getLatLng: function () { + return this._latlng; + }, + setLatLng: function (t) { + var i = this._latlng; + return ( + (this._latlng = w(t)), + this.update(), + this.fire('move', { oldLatLng: i, latlng: this._latlng }) + ); + }, + setZIndexOffset: function (t) { + return (this.options.zIndexOffset = t), this.update(); + }, + getIcon: function () { + return this.options.icon; + }, + setIcon: function (t) { + return ( + (this.options.icon = t), + this._map && (this._initIcon(), this.update()), + this._popup && this.bindPopup(this._popup, this._popup.options), + this + ); + }, + getElement: function () { + return this._icon; + }, + update: function () { + var t; + return ( + this._icon && + this._map && + ((t = this._map.latLngToLayerPoint(this._latlng).round()), + this._setPos(t)), + this + ); + }, + _initIcon: function () { + var t = this.options, + i = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide'), + e = t.icon.createIcon(this._icon), + n = !1, + e = + (e !== this._icon && + (this._icon && this._removeIcon(), + (n = !0), + t.title && (e.title = t.title), + 'IMG' === e.tagName && (e.alt = t.alt || '')), + z(e, i), + t.keyboard && + ((e.tabIndex = '0'), e.setAttribute('role', 'button')), + (this._icon = e), + t.riseOnHover && + this.on({ + mouseover: this._bringToFront, + mouseout: this._resetZIndex, + }), + this.options.autoPanOnFocus && + S(e, 'focus', this._panOnFocus, this), + t.icon.createShadow(this._shadow)), + o = !1; + e !== this._shadow && (this._removeShadow(), (o = !0)), + e && (z(e, i), (e.alt = '')), + (this._shadow = e), + t.opacity < 1 && this._updateOpacity(), + n && this.getPane().appendChild(this._icon), + this._initInteraction(), + e && o && this.getPane(t.shadowPane).appendChild(this._shadow); + }, + _removeIcon: function () { + this.options.riseOnHover && + this.off({ + mouseover: this._bringToFront, + mouseout: this._resetZIndex, + }), + this.options.autoPanOnFocus && + E(this._icon, 'focus', this._panOnFocus, this), + T(this._icon), + this.removeInteractiveTarget(this._icon), + (this._icon = null); + }, + _removeShadow: function () { + this._shadow && T(this._shadow), (this._shadow = null); + }, + _setPos: function (t) { + this._icon && Z(this._icon, t), + this._shadow && Z(this._shadow, t), + (this._zIndex = t.y + this.options.zIndexOffset), + this._resetZIndex(); + }, + _updateZIndex: function (t) { + this._icon && (this._icon.style.zIndex = this._zIndex + t); + }, + _animateZoom: function (t) { + t = this._map + ._latLngToNewLayerPoint(this._latlng, t.zoom, t.center) + .round(); + this._setPos(t); + }, + _initInteraction: function () { + var t; + this.options.interactive && + (z(this._icon, 'leaflet-interactive'), + this.addInteractiveTarget(this._icon), + ce && + ((t = this.options.draggable), + this.dragging && + ((t = this.dragging.enabled()), this.dragging.disable()), + (this.dragging = new ce(this)), + t && this.dragging.enable())); + }, + setOpacity: function (t) { + return ( + (this.options.opacity = t), this._map && this._updateOpacity(), this + ); + }, + _updateOpacity: function () { + var t = this.options.opacity; + this._icon && C(this._icon, t), this._shadow && C(this._shadow, t); + }, + _bringToFront: function () { + this._updateZIndex(this.options.riseOffset); + }, + _resetZIndex: function () { + this._updateZIndex(0); + }, + _panOnFocus: function () { + var t, + i, + e = this._map; + e && + ((t = (i = this.options.icon.options).iconSize + ? _(i.iconSize) + : _(0, 0)), + (i = i.iconAnchor ? _(i.iconAnchor) : _(0, 0)), + e.panInside(this._latlng, { + paddingTopLeft: i, + paddingBottomRight: t.subtract(i), + })); + }, + _getPopupAnchor: function () { + return this.options.icon.options.popupAnchor; + }, + _getTooltipAnchor: function () { + return this.options.icon.options.tooltipAnchor; + }, + }); + var _e = o.extend({ + options: { + stroke: !0, + color: '#3388ff', + weight: 3, + opacity: 1, + lineCap: 'round', + lineJoin: 'round', + dashArray: null, + dashOffset: null, + fill: !1, + fillColor: null, + fillOpacity: 0.2, + fillRule: 'evenodd', + interactive: !0, + bubblingMouseEvents: !0, + }, + beforeAdd: function (t) { + this._renderer = t.getRenderer(this); + }, + onAdd: function () { + this._renderer._initPath(this), + this._reset(), + this._renderer._addPath(this); + }, + onRemove: function () { + this._renderer._removePath(this); + }, + redraw: function () { + return this._map && this._renderer._updatePath(this), this; + }, + setStyle: function (t) { + return ( + c(this, t), + this._renderer && + (this._renderer._updateStyle(this), + this.options.stroke && + t && + Object.prototype.hasOwnProperty.call(t, 'weight') && + this._updateBounds()), + this + ); + }, + bringToFront: function () { + return this._renderer && this._renderer._bringToFront(this), this; + }, + bringToBack: function () { + return this._renderer && this._renderer._bringToBack(this), this; + }, + getElement: function () { + return this._path; + }, + _reset: function () { + this._project(), this._update(); + }, + _clickTolerance: function () { + return ( + (this.options.stroke ? this.options.weight / 2 : 0) + + (this._renderer.options.tolerance || 0) + ); + }, + }), + pe = _e.extend({ + options: { fill: !0, radius: 10 }, + initialize: function (t, i) { + c(this, i), (this._latlng = w(t)), (this._radius = this.options.radius); + }, + setLatLng: function (t) { + var i = this._latlng; + return ( + (this._latlng = w(t)), + this.redraw(), + this.fire('move', { oldLatLng: i, latlng: this._latlng }) + ); + }, + getLatLng: function () { + return this._latlng; + }, + setRadius: function (t) { + return (this.options.radius = this._radius = t), this.redraw(); + }, + getRadius: function () { + return this._radius; + }, + setStyle: function (t) { + var i = (t && t.radius) || this._radius; + return _e.prototype.setStyle.call(this, t), this.setRadius(i), this; + }, + _project: function () { + (this._point = this._map.latLngToLayerPoint(this._latlng)), + this._updateBounds(); + }, + _updateBounds: function () { + var t = this._radius, + i = this._radiusY || t, + e = this._clickTolerance(), + t = [t + e, i + e]; + this._pxBounds = new m(this._point.subtract(t), this._point.add(t)); + }, + _update: function () { + this._map && this._updatePath(); + }, + _updatePath: function () { + this._renderer._updateCircle(this); + }, + _empty: function () { + return ( + this._radius && !this._renderer._bounds.intersects(this._pxBounds) + ); + }, + _containsPoint: function (t) { + return ( + t.distanceTo(this._point) <= this._radius + this._clickTolerance() + ); + }, + }); + var me = pe.extend({ + initialize: function (t, i, e) { + if ( + (c(this, (i = 'number' == typeof i ? l({}, e, { radius: i }) : i)), + (this._latlng = w(t)), + isNaN(this.options.radius)) + ) + throw new Error('Circle radius cannot be NaN'); + this._mRadius = this.options.radius; + }, + setRadius: function (t) { + return (this._mRadius = t), this.redraw(); + }, + getRadius: function () { + return this._mRadius; + }, + getBounds: function () { + var t = [this._radius, this._radiusY || this._radius]; + return new s( + this._map.layerPointToLatLng(this._point.subtract(t)), + this._map.layerPointToLatLng(this._point.add(t)), + ); + }, + setStyle: _e.prototype.setStyle, + _project: function () { + var t, + i, + e, + n, + o, + s = this._latlng.lng, + r = this._latlng.lat, + a = this._map, + h = a.options.crs; + h.distance === st.distance + ? ((n = Math.PI / 180), + (o = this._mRadius / st.R / n), + (t = a.project([r + o, s])), + (i = a.project([r - o, s])), + (i = t.add(i).divideBy(2)), + (e = a.unproject(i).lat), + (n = + Math.acos( + (Math.cos(o * n) - Math.sin(r * n) * Math.sin(e * n)) / + (Math.cos(r * n) * Math.cos(e * n)), + ) / n), + (!isNaN(n) && 0 !== n) || (n = o / Math.cos((Math.PI / 180) * r)), + (this._point = i.subtract(a.getPixelOrigin())), + (this._radius = isNaN(n) ? 0 : i.x - a.project([e, s - n]).x), + (this._radiusY = i.y - t.y)) + : ((o = h.unproject( + h.project(this._latlng).subtract([this._mRadius, 0]), + )), + (this._point = a.latLngToLayerPoint(this._latlng)), + (this._radius = this._point.x - a.latLngToLayerPoint(o).x)), + this._updateBounds(); + }, + }); + var fe = _e.extend({ + options: { smoothFactor: 1, noClip: !1 }, + initialize: function (t, i) { + c(this, i), this._setLatLngs(t); + }, + getLatLngs: function () { + return this._latlngs; + }, + setLatLngs: function (t) { + return this._setLatLngs(t), this.redraw(); + }, + isEmpty: function () { + return !this._latlngs.length; + }, + closestLayerPoint: function (t) { + for ( + var i = 1 / 0, e = null, n = ee, o = 0, s = this._parts.length; + o < s; + o++ + ) + for (var r = this._parts[o], a = 1, h = r.length; a < h; a++) { + var l, + u, + c = n(t, (l = r[a - 1]), (u = r[a]), !0); + c < i && ((i = c), (e = n(t, l, u))); + } + return e && (e.distance = Math.sqrt(i)), e; + }, + getCenter: function () { + if (!this._map) + throw new Error('Must add layer to map before using getCenter()'); + var t, + i, + e, + n, + o, + s, + r = this._rings[0], + a = r.length; + if (!a) return null; + for (i = t = 0; t < a - 1; t++) i += r[t].distanceTo(r[t + 1]) / 2; + if (0 === i) return this._map.layerPointToLatLng(r[0]); + for (e = t = 0; t < a - 1; t++) + if (((n = r[t]), (o = r[t + 1]), i < (e += s = n.distanceTo(o)))) + return this._map.layerPointToLatLng([ + o.x - (s = (e - i) / s) * (o.x - n.x), + o.y - s * (o.y - n.y), + ]); + }, + getBounds: function () { + return this._bounds; + }, + addLatLng: function (t, i) { + return ( + (i = i || this._defaultShape()), + (t = w(t)), + i.push(t), + this._bounds.extend(t), + this.redraw() + ); + }, + _setLatLngs: function (t) { + (this._bounds = new s()), (this._latlngs = this._convertLatLngs(t)); + }, + _defaultShape: function () { + return ne(this._latlngs) ? this._latlngs : this._latlngs[0]; + }, + _convertLatLngs: function (t) { + for (var i = [], e = ne(t), n = 0, o = t.length; n < o; n++) + e + ? ((i[n] = w(t[n])), this._bounds.extend(i[n])) + : (i[n] = this._convertLatLngs(t[n])); + return i; + }, + _project: function () { + var t = new m(); + (this._rings = []), + this._projectLatlngs(this._latlngs, this._rings, t), + this._bounds.isValid() && + t.isValid() && + ((this._rawPxBounds = t), this._updateBounds()); + }, + _updateBounds: function () { + var t = this._clickTolerance(), + t = new p(t, t); + this._rawPxBounds && + (this._pxBounds = new m([ + this._rawPxBounds.min.subtract(t), + this._rawPxBounds.max.add(t), + ])); + }, + _projectLatlngs: function (t, i, e) { + var n, + o, + s = t[0] instanceof v, + r = t.length; + if (s) { + for (o = [], n = 0; n < r; n++) + (o[n] = this._map.latLngToLayerPoint(t[n])), e.extend(o[n]); + i.push(o); + } else for (n = 0; n < r; n++) this._projectLatlngs(t[n], i, e); + }, + _clipPoints: function () { + var t = this._renderer._bounds; + if (((this._parts = []), this._pxBounds && this._pxBounds.intersects(t))) + if (this.options.noClip) this._parts = this._rings; + else + for ( + var i, + e, + n, + o, + s = this._parts, + r = 0, + a = 0, + h = this._rings.length; + r < h; + r++ + ) + for (i = 0, e = (o = this._rings[r]).length; i < e - 1; i++) + (n = Qi(o[i], o[i + 1], t, i, !0)) && + ((s[a] = s[a] || []), + s[a].push(n[0]), + (n[1] === o[i + 1] && i !== e - 2) || (s[a].push(n[1]), a++)); + }, + _simplifyPoints: function () { + for ( + var t = this._parts, i = this.options.smoothFactor, e = 0, n = t.length; + e < n; + e++ + ) + t[e] = Ji(t[e], i); + }, + _update: function () { + this._map && + (this._clipPoints(), this._simplifyPoints(), this._updatePath()); + }, + _updatePath: function () { + this._renderer._updatePoly(this); + }, + _containsPoint: function (t, i) { + var e, + n, + o, + s, + r, + a, + h = this._clickTolerance(); + if (!this._pxBounds || !this._pxBounds.contains(t)) return !1; + for (e = 0, s = this._parts.length; e < s; e++) + for (n = 0, o = (r = (a = this._parts[e]).length) - 1; n < r; o = n++) + if ((i || 0 !== n) && $i(t, a[o], a[n]) <= h) return !0; + return !1; + }, + }); + fe._flat = oe; + var ge = fe.extend({ + options: { fill: !0 }, + isEmpty: function () { + return !this._latlngs.length || !this._latlngs[0].length; + }, + getCenter: function () { + if (!this._map) + throw new Error('Must add layer to map before using getCenter()'); + var t, + i, + e, + n, + o, + s, + r, + a, + h, + l = this._rings[0], + u = l.length; + if (!u) return null; + for (t = s = r = a = 0, i = u - 1; t < u; i = t++) + (e = l[t]), + (n = l[i]), + (o = e.y * n.x - n.y * e.x), + (r += (e.x + n.x) * o), + (a += (e.y + n.y) * o), + (s += 3 * o); + return ( + (h = 0 === s ? l[0] : [r / s, a / s]), this._map.layerPointToLatLng(h) + ); + }, + _convertLatLngs: function (t) { + var t = fe.prototype._convertLatLngs.call(this, t), + i = t.length; + return 2 <= i && t[0] instanceof v && t[0].equals(t[i - 1]) && t.pop(), t; + }, + _setLatLngs: function (t) { + fe.prototype._setLatLngs.call(this, t), + ne(this._latlngs) && (this._latlngs = [this._latlngs]); + }, + _defaultShape: function () { + return (ne(this._latlngs[0]) ? this._latlngs : this._latlngs[0])[0]; + }, + _clipPoints: function () { + var t = this._renderer._bounds, + i = this.options.weight, + i = new p(i, i), + t = new m(t.min.subtract(i), t.max.add(i)); + if (((this._parts = []), this._pxBounds && this._pxBounds.intersects(t))) + if (this.options.noClip) this._parts = this._rings; + else + for (var e, n = 0, o = this._rings.length; n < o; n++) + (e = se(this._rings[n], t, !0)).length && this._parts.push(e); + }, + _updatePath: function () { + this._renderer._updatePoly(this, !0); + }, + _containsPoint: function (t) { + var i, + e, + n, + o, + s, + r, + a, + h, + l = !1; + if (!this._pxBounds || !this._pxBounds.contains(t)) return !1; + for (o = 0, a = this._parts.length; o < a; o++) + for (s = 0, r = (h = (i = this._parts[o]).length) - 1; s < h; r = s++) + (e = i[s]), + (n = i[r]), + e.y > t.y != n.y > t.y && + t.x < ((n.x - e.x) * (t.y - e.y)) / (n.y - e.y) + e.x && + (l = !l); + return l || fe.prototype._containsPoint.call(this, t, !0); + }, + }); + var ve = he.extend({ + initialize: function (t, i) { + c(this, i), (this._layers = {}), t && this.addData(t); + }, + addData: function (t) { + var i, + e, + n, + o = d(t) ? t : t.features; + if (o) { + for (i = 0, e = o.length; i < e; i++) + ((n = o[i]).geometries || + n.geometry || + n.features || + n.coordinates) && + this.addData(n); + return this; + } + var s = this.options; + if (s.filter && !s.filter(t)) return this; + var r = ye(t, s); + return r + ? ((r.feature = ze(t)), + (r.defaultOptions = r.options), + this.resetStyle(r), + s.onEachFeature && s.onEachFeature(t, r), + this.addLayer(r)) + : this; + }, + resetStyle: function (t) { + return void 0 === t + ? this.eachLayer(this.resetStyle, this) + : ((t.options = l({}, t.defaultOptions)), + this._setLayerStyle(t, this.options.style), + this); + }, + setStyle: function (i) { + return this.eachLayer(function (t) { + this._setLayerStyle(t, i); + }, this); + }, + _setLayerStyle: function (t, i) { + t.setStyle && + ('function' == typeof i && (i = i(t.feature)), t.setStyle(i)); + }, + }); + function ye(t, i) { + var e, + n, + o, + s, + r = 'Feature' === t.type ? t.geometry : t, + a = r ? r.coordinates : null, + h = [], + l = i && i.pointToLayer, + u = (i && i.coordsToLatLng) || we; + if (!a && !r) return null; + switch (r.type) { + case 'Point': + return xe(l, t, (e = u(a)), i); + case 'MultiPoint': + for (o = 0, s = a.length; o < s; o++) + (e = u(a[o])), h.push(xe(l, t, e, i)); + return new he(h); + case 'LineString': + case 'MultiLineString': + return (n = Pe(a, 'LineString' === r.type ? 0 : 1, u)), new fe(n, i); + case 'Polygon': + case 'MultiPolygon': + return (n = Pe(a, 'Polygon' === r.type ? 1 : 2, u)), new ge(n, i); + case 'GeometryCollection': + for (o = 0, s = r.geometries.length; o < s; o++) { + var c = ye( + { + geometry: r.geometries[o], + type: 'Feature', + properties: t.properties, + }, + i, + ); + c && h.push(c); + } + return new he(h); + default: + throw new Error('Invalid GeoJSON object.'); + } + } + function xe(t, i, e, n) { + return t ? t(i, e) : new de(e, n && n.markersInheritOptions && n); + } + function we(t) { + return new v(t[1], t[0], t[2]); + } + function Pe(t, i, e) { + for (var n, o = [], s = 0, r = t.length; s < r; s++) + (n = i ? Pe(t[s], i - 1, e) : (e || we)(t[s])), o.push(n); + return o; + } + function be(t, i) { + return void 0 !== (t = w(t)).alt + ? [e(t.lng, i), e(t.lat, i), e(t.alt, i)] + : [e(t.lng, i), e(t.lat, i)]; + } + function Le(t, i, e, n) { + for (var o = [], s = 0, r = t.length; s < r; s++) + o.push(i ? Le(t[s], i - 1, e, n) : be(t[s], n)); + return !i && e && o.push(o[0]), o; + } + function Te(t, i) { + return t.feature ? l({}, t.feature, { geometry: i }) : ze(i); + } + function ze(t) { + return 'Feature' === t.type || 'FeatureCollection' === t.type + ? t + : { type: 'Feature', properties: {}, geometry: t }; + } + Tt = { + toGeoJSON: function (t) { + return Te(this, { type: 'Point', coordinates: be(this.getLatLng(), t) }); + }, + }; + function Me(t, i) { + return new ve(t, i); + } + de.include(Tt), + me.include(Tt), + pe.include(Tt), + fe.include({ + toGeoJSON: function (t) { + var i = !ne(this._latlngs); + return Te(this, { + type: (i ? 'Multi' : '') + 'LineString', + coordinates: Le(this._latlngs, i ? 1 : 0, !1, t), + }); + }, + }), + ge.include({ + toGeoJSON: function (t) { + var i = !ne(this._latlngs), + e = i && !ne(this._latlngs[0]), + t = Le(this._latlngs, e ? 2 : i ? 1 : 0, !0, t); + return Te(this, { + type: (e ? 'Multi' : '') + 'Polygon', + coordinates: (t = i ? t : [t]), + }); + }, + }), + ae.include({ + toMultiPoint: function (i) { + var e = []; + return ( + this.eachLayer(function (t) { + e.push(t.toGeoJSON(i).geometry.coordinates); + }), + Te(this, { type: 'MultiPoint', coordinates: e }) + ); + }, + toGeoJSON: function (i) { + var t = + this.feature && this.feature.geometry && this.feature.geometry.type; + if ('MultiPoint' === t) return this.toMultiPoint(i); + var e = 'GeometryCollection' === t, + n = []; + return ( + this.eachLayer(function (t) { + t.toGeoJSON && + ((t = t.toGeoJSON(i)), + e + ? n.push(t.geometry) + : 'FeatureCollection' === (t = ze(t)).type + ? n.push.apply(n, t.features) + : n.push(t)); + }), + e + ? Te(this, { geometries: n, type: 'GeometryCollection' }) + : { type: 'FeatureCollection', features: n } + ); + }, + }); + var zt = Me, + Ce = o.extend({ + options: { + opacity: 1, + alt: '', + interactive: !1, + crossOrigin: !1, + errorOverlayUrl: '', + zIndex: 1, + className: '', + }, + initialize: function (t, i, e) { + (this._url = t), (this._bounds = g(i)), c(this, e); + }, + onAdd: function () { + this._image || + (this._initImage(), + this.options.opacity < 1 && this._updateOpacity()), + this.options.interactive && + (z(this._image, 'leaflet-interactive'), + this.addInteractiveTarget(this._image)), + this.getPane().appendChild(this._image), + this._reset(); + }, + onRemove: function () { + T(this._image), + this.options.interactive && this.removeInteractiveTarget(this._image); + }, + setOpacity: function (t) { + return ( + (this.options.opacity = t), this._image && this._updateOpacity(), this + ); + }, + setStyle: function (t) { + return t.opacity && this.setOpacity(t.opacity), this; + }, + bringToFront: function () { + return this._map && fi(this._image), this; + }, + bringToBack: function () { + return this._map && gi(this._image), this; + }, + setUrl: function (t) { + return (this._url = t), this._image && (this._image.src = t), this; + }, + setBounds: function (t) { + return (this._bounds = g(t)), this._map && this._reset(), this; + }, + getEvents: function () { + var t = { zoom: this._reset, viewreset: this._reset }; + return this._zoomAnimated && (t.zoomanim = this._animateZoom), t; + }, + setZIndex: function (t) { + return (this.options.zIndex = t), this._updateZIndex(), this; + }, + getBounds: function () { + return this._bounds; + }, + getElement: function () { + return this._image; + }, + _initImage: function () { + var t = 'IMG' === this._url.tagName, + i = (this._image = t ? this._url : b('img')); + z(i, 'leaflet-image-layer'), + this._zoomAnimated && z(i, 'leaflet-zoom-animated'), + this.options.className && z(i, this.options.className), + (i.onselectstart = u), + (i.onmousemove = u), + (i.onload = a(this.fire, this, 'load')), + (i.onerror = a(this._overlayOnError, this, 'error')), + (!this.options.crossOrigin && '' !== this.options.crossOrigin) || + (i.crossOrigin = + !0 === this.options.crossOrigin ? '' : this.options.crossOrigin), + this.options.zIndex && this._updateZIndex(), + t + ? (this._url = i.src) + : ((i.src = this._url), (i.alt = this.options.alt)); + }, + _animateZoom: function (t) { + var i = this._map.getZoomScale(t.zoom), + t = this._map._latLngBoundsToNewLayerBounds( + this._bounds, + t.zoom, + t.center, + ).min; + Pi(this._image, t, i); + }, + _reset: function () { + var t = this._image, + i = new m( + this._map.latLngToLayerPoint(this._bounds.getNorthWest()), + this._map.latLngToLayerPoint(this._bounds.getSouthEast()), + ), + e = i.getSize(); + Z(t, i.min), + (t.style.width = e.x + 'px'), + (t.style.height = e.y + 'px'); + }, + _updateOpacity: function () { + C(this._image, this.options.opacity); + }, + _updateZIndex: function () { + this._image && + void 0 !== this.options.zIndex && + null !== this.options.zIndex && + (this._image.style.zIndex = this.options.zIndex); + }, + _overlayOnError: function () { + this.fire('error'); + var t = this.options.errorOverlayUrl; + t && this._url !== t && ((this._url = t), (this._image.src = t)); + }, + getCenter: function () { + return this._bounds.getCenter(); + }, + }), + Ze = Ce.extend({ + options: { + autoplay: !0, + loop: !0, + keepAspectRatio: !0, + muted: !1, + playsInline: !0, + }, + _initImage: function () { + var t = 'VIDEO' === this._url.tagName, + i = (this._image = t ? this._url : b('video')); + if ( + (z(i, 'leaflet-image-layer'), + this._zoomAnimated && z(i, 'leaflet-zoom-animated'), + this.options.className && z(i, this.options.className), + (i.onselectstart = u), + (i.onmousemove = u), + (i.onloadeddata = a(this.fire, this, 'load')), + t) + ) { + for ( + var e = i.getElementsByTagName('source'), n = [], o = 0; + o < e.length; + o++ + ) + n.push(e[o].src); + this._url = 0 < e.length ? n : [i.src]; + } else { + d(this._url) || (this._url = [this._url]), + !this.options.keepAspectRatio && + Object.prototype.hasOwnProperty.call(i.style, 'objectFit') && + (i.style.objectFit = 'fill'), + (i.autoplay = !!this.options.autoplay), + (i.loop = !!this.options.loop), + (i.muted = !!this.options.muted), + (i.playsInline = !!this.options.playsInline); + for (var s = 0; s < this._url.length; s++) { + var r = b('source'); + (r.src = this._url[s]), i.appendChild(r); + } + } + }, + }); + var Se = Ce.extend({ + _initImage: function () { + var t = (this._image = this._url); + z(t, 'leaflet-image-layer'), + this._zoomAnimated && z(t, 'leaflet-zoom-animated'), + this.options.className && z(t, this.options.className), + (t.onselectstart = u), + (t.onmousemove = u); + }, + }); + var O = o.extend({ + options: { interactive: !1, offset: [0, 0], className: '', pane: void 0 }, + initialize: function (t, i) { + c(this, t), (this._source = i); + }, + openOn: function (t) { + return ( + (t = arguments.length ? t : this._source._map).hasLayer(this) || + t.addLayer(this), + this + ); + }, + close: function () { + return this._map && this._map.removeLayer(this), this; + }, + toggle: function (t) { + return ( + this._map + ? this.close() + : (arguments.length ? (this._source = t) : (t = this._source), + this._prepareOpen(), + this.openOn(t._map)), + this + ); + }, + onAdd: function (t) { + (this._zoomAnimated = t._zoomAnimated), + this._container || this._initLayout(), + t._fadeAnimated && C(this._container, 0), + clearTimeout(this._removeTimeout), + this.getPane().appendChild(this._container), + this.update(), + t._fadeAnimated && C(this._container, 1), + this.bringToFront(), + this.options.interactive && + (z(this._container, 'leaflet-interactive'), + this.addInteractiveTarget(this._container)); + }, + onRemove: function (t) { + t._fadeAnimated + ? (C(this._container, 0), + (this._removeTimeout = setTimeout( + a(T, void 0, this._container), + 200, + ))) + : T(this._container), + this.options.interactive && + (M(this._container, 'leaflet-interactive'), + this.removeInteractiveTarget(this._container)); + }, + getLatLng: function () { + return this._latlng; + }, + setLatLng: function (t) { + return ( + (this._latlng = w(t)), + this._map && (this._updatePosition(), this._adjustPan()), + this + ); + }, + getContent: function () { + return this._content; + }, + setContent: function (t) { + return (this._content = t), this.update(), this; + }, + getElement: function () { + return this._container; + }, + update: function () { + this._map && + ((this._container.style.visibility = 'hidden'), + this._updateContent(), + this._updateLayout(), + this._updatePosition(), + (this._container.style.visibility = ''), + this._adjustPan()); + }, + getEvents: function () { + var t = { zoom: this._updatePosition, viewreset: this._updatePosition }; + return this._zoomAnimated && (t.zoomanim = this._animateZoom), t; + }, + isOpen: function () { + return !!this._map && this._map.hasLayer(this); + }, + bringToFront: function () { + return this._map && fi(this._container), this; + }, + bringToBack: function () { + return this._map && gi(this._container), this; + }, + _prepareOpen: function (t) { + if (!(e = this._source)._map) return !1; + if (e instanceof he) { + var i, + e = null, + n = this._source._layers; + for (i in n) + if (n[i]._map) { + e = n[i]; + break; + } + if (!e) return !1; + this._source = e; + } + if (!t) + if (e.getCenter) t = e.getCenter(); + else if (e.getLatLng) t = e.getLatLng(); + else { + if (!e.getBounds) + throw new Error('Unable to get source layer LatLng.'); + t = e.getBounds().getCenter(); + } + return this.setLatLng(t), this._map && this.update(), !0; + }, + _updateContent: function () { + if (this._content) { + var t = this._contentNode, + i = + 'function' == typeof this._content + ? this._content(this._source || this) + : this._content; + if ('string' == typeof i) t.innerHTML = i; + else { + for (; t.hasChildNodes(); ) t.removeChild(t.firstChild); + t.appendChild(i); + } + this.fire('contentupdate'); + } + }, + _updatePosition: function () { + var t, i, e; + this._map && + ((i = this._map.latLngToLayerPoint(this._latlng)), + (t = _(this.options.offset)), + (e = this._getAnchor()), + this._zoomAnimated + ? Z(this._container, i.add(e)) + : (t = t.add(i).add(e)), + (i = this._containerBottom = -t.y), + (e = this._containerLeft = + -Math.round(this._containerWidth / 2) + t.x), + (this._container.style.bottom = i + 'px'), + (this._container.style.left = e + 'px')); + }, + _getAnchor: function () { + return [0, 0]; + }, + }), + ke = + (A.include({ + _initOverlay: function (t, i, e, n) { + var o = i; + return ( + o instanceof t || (o = new t(n).setContent(i)), + e && o.setLatLng(e), + o + ); + }, + }), + o.include({ + _initOverlay: function (t, i, e, n) { + var o = e; + return ( + o instanceof t + ? (c(o, n), (o._source = this)) + : (o = i && !n ? i : new t(n, this)).setContent(e), + o + ); + }, + }), + O.extend({ + options: { + pane: 'popupPane', + offset: [0, 7], + maxWidth: 300, + minWidth: 50, + maxHeight: null, + autoPan: !0, + autoPanPaddingTopLeft: null, + autoPanPaddingBottomRight: null, + autoPanPadding: [5, 5], + keepInView: !1, + closeButton: !0, + autoClose: !0, + closeOnEscapeKey: !0, + className: '', + }, + openOn: function (t) { + return ( + !(t = arguments.length ? t : this._source._map).hasLayer(this) && + t._popup && + t._popup.options.autoClose && + t.removeLayer(t._popup), + (t._popup = this), + O.prototype.openOn.call(this, t) + ); + }, + onAdd: function (t) { + O.prototype.onAdd.call(this, t), + t.fire('popupopen', { popup: this }), + this._source && + (this._source.fire('popupopen', { popup: this }, !0), + this._source instanceof _e || this._source.on('preclick', Ai)); + }, + onRemove: function (t) { + O.prototype.onRemove.call(this, t), + t.fire('popupclose', { popup: this }), + this._source && + (this._source.fire('popupclose', { popup: this }, !0), + this._source instanceof _e || this._source.off('preclick', Ai)); + }, + getEvents: function () { + var t = O.prototype.getEvents.call(this); + return ( + (void 0 !== this.options.closeOnClick + ? this.options.closeOnClick + : this._map.options.closePopupOnClick) && + (t.preclick = this.close), + this.options.keepInView && (t.moveend = this._adjustPan), + t + ); + }, + _initLayout: function () { + var t = 'leaflet-popup', + i = (this._container = b( + 'div', + t + + ' ' + + (this.options.className || '') + + ' leaflet-zoom-animated', + )), + e = (this._wrapper = b('div', t + '-content-wrapper', i)); + (this._contentNode = b('div', t + '-content', e)), + Oi(i), + Ii(this._contentNode), + S(i, 'contextmenu', Ai), + (this._tipContainer = b('div', t + '-tip-container', i)), + (this._tip = b('div', t + '-tip', this._tipContainer)), + this.options.closeButton && + ((e = this._closeButton = + b('a', t + '-close-button', i)).setAttribute('role', 'button'), + e.setAttribute('aria-label', 'Close popup'), + (e.href = '#close'), + (e.innerHTML = ''), + S(e, 'click', this.close, this)); + }, + _updateLayout: function () { + var t = this._contentNode, + i = t.style, + e = ((i.width = ''), (i.whiteSpace = 'nowrap'), t.offsetWidth), + e = Math.min(e, this.options.maxWidth), + e = + ((e = Math.max(e, this.options.minWidth)), + (i.width = e + 1 + 'px'), + (i.whiteSpace = ''), + (i.height = ''), + t.offsetHeight), + n = this.options.maxHeight, + o = 'leaflet-popup-scrolled'; + n && n < e ? ((i.height = n + 'px'), z(t, o)) : M(t, o), + (this._containerWidth = this._container.offsetWidth); + }, + _animateZoom: function (t) { + var t = this._map._latLngToNewLayerPoint( + this._latlng, + t.zoom, + t.center, + ), + i = this._getAnchor(); + Z(this._container, t.add(i)); + }, + _adjustPan: function (t) { + var i, e, n, o, s, r, a, h; + this.options.autoPan && + (this._map._panAnim && this._map._panAnim.stop(), + (i = this._map), + (e = parseInt(pi(this._container, 'marginBottom'), 10) || 0), + (e = this._container.offsetHeight + e), + (h = this._containerWidth), + (n = new p(this._containerLeft, -e - this._containerBottom))._add( + bi(this._container), + ), + (n = i.layerPointToContainerPoint(n)), + (s = _(this.options.autoPanPadding)), + (o = _(this.options.autoPanPaddingTopLeft || s)), + (s = _(this.options.autoPanPaddingBottomRight || s)), + (r = i.getSize()), + (a = 0), + n.x + h + s.x > r.x && (a = n.x + h - r.x + s.x), + n.x - a - o.x < (h = 0) && (a = n.x - o.x), + n.y + e + s.y > r.y && (h = n.y + e - r.y + s.y), + n.y - h - o.y < 0 && (h = n.y - o.y), + (a || h) && + i + .fire('autopanstart') + .panBy([a, h], { animate: t && 'moveend' === t.type })); + }, + _getAnchor: function () { + return _( + this._source && this._source._getPopupAnchor + ? this._source._getPopupAnchor() + : [0, 0], + ); + }, + })), + Ee = + (A.mergeOptions({ closePopupOnClick: !0 }), + A.include({ + openPopup: function (t, i, e) { + return this._initOverlay(ke, t, i, e).openOn(this), this; + }, + closePopup: function (t) { + return (t = arguments.length ? t : this._popup) && t.close(), this; + }, + }), + o.include({ + bindPopup: function (t, i) { + return ( + (this._popup = this._initOverlay(ke, this._popup, t, i)), + this._popupHandlersAdded || + (this.on({ + click: this._openPopup, + keypress: this._onKeyPress, + remove: this.closePopup, + move: this._movePopup, + }), + (this._popupHandlersAdded = !0)), + this + ); + }, + unbindPopup: function () { + return ( + this._popup && + (this.off({ + click: this._openPopup, + keypress: this._onKeyPress, + remove: this.closePopup, + move: this._movePopup, + }), + (this._popupHandlersAdded = !1), + (this._popup = null)), + this + ); + }, + openPopup: function (t) { + return ( + this._popup && + this._popup._prepareOpen(t) && + this._popup.openOn(this._map), + this + ); + }, + closePopup: function () { + return this._popup && this._popup.close(), this; + }, + togglePopup: function () { + return this._popup && this._popup.toggle(this), this; + }, + isPopupOpen: function () { + return !!this._popup && this._popup.isOpen(); + }, + setPopupContent: function (t) { + return this._popup && this._popup.setContent(t), this; + }, + getPopup: function () { + return this._popup; + }, + _openPopup: function (t) { + var i; + this._popup && + this._map && + (Ri(t), + (i = t.layer || t.target), + this._popup._source !== i || i instanceof _e + ? ((this._popup._source = i), this.openPopup(t.latlng)) + : this._map.hasLayer(this._popup) + ? this.closePopup() + : this.openPopup(t.latlng)); + }, + _movePopup: function (t) { + this._popup.setLatLng(t.latlng); + }, + _onKeyPress: function (t) { + 13 === t.originalEvent.keyCode && this._openPopup(t); + }, + }), + O.extend({ + options: { + pane: 'tooltipPane', + offset: [0, 0], + direction: 'auto', + permanent: !1, + sticky: !1, + opacity: 0.9, + }, + onAdd: function (t) { + O.prototype.onAdd.call(this, t), + this.setOpacity(this.options.opacity), + t.fire('tooltipopen', { tooltip: this }), + this._source && + (this.addEventParent(this._source), + this._source.fire('tooltipopen', { tooltip: this }, !0)); + }, + onRemove: function (t) { + O.prototype.onRemove.call(this, t), + t.fire('tooltipclose', { tooltip: this }), + this._source && + (this.removeEventParent(this._source), + this._source.fire('tooltipclose', { tooltip: this }, !0)); + }, + getEvents: function () { + var t = O.prototype.getEvents.call(this); + return this.options.permanent || (t.preclick = this.close), t; + }, + _initLayout: function () { + var t = + 'leaflet-tooltip ' + + (this.options.className || '') + + ' leaflet-zoom-' + + (this._zoomAnimated ? 'animated' : 'hide'); + this._contentNode = this._container = b('div', t); + }, + _updateLayout: function () {}, + _adjustPan: function () {}, + _setPosition: function (t) { + var i, + e = this._map, + n = this._container, + o = e.latLngToContainerPoint(e.getCenter()), + e = e.layerPointToContainerPoint(t), + s = this.options.direction, + r = n.offsetWidth, + a = n.offsetHeight, + h = _(this.options.offset), + l = this._getAnchor(), + e = + 'top' === s + ? ((i = r / 2), a) + : 'bottom' === s + ? ((i = r / 2), 0) + : ((i = + 'center' === s + ? r / 2 + : 'right' === s + ? 0 + : 'left' === s + ? r + : e.x < o.x + ? ((s = 'right'), 0) + : ((s = 'left'), r + 2 * (h.x + l.x))), + a / 2); + (t = t.subtract(_(i, e, !0)).add(h).add(l)), + M(n, 'leaflet-tooltip-right'), + M(n, 'leaflet-tooltip-left'), + M(n, 'leaflet-tooltip-top'), + M(n, 'leaflet-tooltip-bottom'), + z(n, 'leaflet-tooltip-' + s), + Z(n, t); + }, + _updatePosition: function () { + var t = this._map.latLngToLayerPoint(this._latlng); + this._setPosition(t); + }, + setOpacity: function (t) { + (this.options.opacity = t), this._container && C(this._container, t); + }, + _animateZoom: function (t) { + t = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center); + this._setPosition(t); + }, + _getAnchor: function () { + return _( + this._source && + this._source._getTooltipAnchor && + !this.options.sticky + ? this._source._getTooltipAnchor() + : [0, 0], + ); + }, + })), + Be = + (A.include({ + openTooltip: function (t, i, e) { + return this._initOverlay(Ee, t, i, e).openOn(this), this; + }, + closeTooltip: function (t) { + return t.close(), this; + }, + }), + o.include({ + bindTooltip: function (t, i) { + return ( + this._tooltip && this.isTooltipOpen() && this.unbindTooltip(), + (this._tooltip = this._initOverlay(Ee, this._tooltip, t, i)), + this._initTooltipInteractions(), + this._tooltip.options.permanent && + this._map && + this._map.hasLayer(this) && + this.openTooltip(), + this + ); + }, + unbindTooltip: function () { + return ( + this._tooltip && + (this._initTooltipInteractions(!0), + this.closeTooltip(), + (this._tooltip = null)), + this + ); + }, + _initTooltipInteractions: function (t) { + var i, e; + (!t && this._tooltipHandlersAdded) || + ((i = t ? 'off' : 'on'), + (e = { remove: this.closeTooltip, move: this._moveTooltip }), + this._tooltip.options.permanent + ? (e.add = this._openTooltip) + : ((e.mouseover = this._openTooltip), + (e.mouseout = this.closeTooltip), + (e.click = this._openTooltip)), + this._tooltip.options.sticky && (e.mousemove = this._moveTooltip), + this[i](e), + (this._tooltipHandlersAdded = !t)); + }, + openTooltip: function (t) { + return ( + this._tooltip && + this._tooltip._prepareOpen(t) && + this._tooltip.openOn(this._map), + this + ); + }, + closeTooltip: function () { + if (this._tooltip) return this._tooltip.close(); + }, + toggleTooltip: function () { + return this._tooltip && this._tooltip.toggle(this), this; + }, + isTooltipOpen: function () { + return this._tooltip.isOpen(); + }, + setTooltipContent: function (t) { + return this._tooltip && this._tooltip.setContent(t), this; + }, + getTooltip: function () { + return this._tooltip; + }, + _openTooltip: function (t) { + !this._tooltip || + !this._map || + (this._map.dragging && this._map.dragging.moving()) || + ((this._tooltip._source = t.layer || t.target), + this.openTooltip(this._tooltip.options.sticky ? t.latlng : void 0)); + }, + _moveTooltip: function (t) { + var i = t.latlng; + this._tooltip.options.sticky && + t.originalEvent && + ((t = this._map.mouseEventToContainerPoint(t.originalEvent)), + (t = this._map.containerPointToLayerPoint(t)), + (i = this._map.layerPointToLatLng(t))), + this._tooltip.setLatLng(i); + }, + }), + le.extend({ + options: { + iconSize: [12, 12], + html: !1, + bgPos: null, + className: 'leaflet-div-icon', + }, + createIcon: function (t) { + var t = t && 'DIV' === t.tagName ? t : document.createElement('div'), + i = this.options; + return ( + i.html instanceof Element + ? (mi(t), t.appendChild(i.html)) + : (t.innerHTML = !1 !== i.html ? i.html : ''), + i.bgPos && + ((i = _(i.bgPos)), + (t.style.backgroundPosition = -i.x + 'px ' + -i.y + 'px')), + this._setIconStyles(t, 'icon'), + t + ); + }, + createShadow: function () { + return null; + }, + })); + le.Default = ue; + var Ae = o.extend({ + options: { + tileSize: 256, + opacity: 1, + updateWhenIdle: P.mobile, + updateWhenZooming: !0, + updateInterval: 200, + zIndex: 1, + bounds: null, + minZoom: 0, + maxZoom: void 0, + maxNativeZoom: void 0, + minNativeZoom: void 0, + noWrap: !1, + pane: 'tilePane', + className: '', + keepBuffer: 2, + }, + initialize: function (t) { + c(this, t); + }, + onAdd: function () { + this._initContainer(), + (this._levels = {}), + (this._tiles = {}), + this._resetView(); + }, + beforeAdd: function (t) { + t._addZoomLimit(this); + }, + onRemove: function (t) { + this._removeAllTiles(), + T(this._container), + t._removeZoomLimit(this), + (this._container = null), + (this._tileZoom = void 0); + }, + bringToFront: function () { + return ( + this._map && (fi(this._container), this._setAutoZIndex(Math.max)), this + ); + }, + bringToBack: function () { + return ( + this._map && (gi(this._container), this._setAutoZIndex(Math.min)), this + ); + }, + getContainer: function () { + return this._container; + }, + setOpacity: function (t) { + return (this.options.opacity = t), this._updateOpacity(), this; + }, + setZIndex: function (t) { + return (this.options.zIndex = t), this._updateZIndex(), this; + }, + isLoading: function () { + return this._loading; + }, + redraw: function () { + var t; + return ( + this._map && + (this._removeAllTiles(), + (t = this._clampZoom(this._map.getZoom())) !== this._tileZoom && + ((this._tileZoom = t), this._updateLevels()), + this._update()), + this + ); + }, + getEvents: function () { + var t = { + viewprereset: this._invalidateAll, + viewreset: this._resetView, + zoom: this._resetView, + moveend: this._onMoveEnd, + }; + return ( + this.options.updateWhenIdle || + (this._onMove || + (this._onMove = j( + this._onMoveEnd, + this.options.updateInterval, + this, + )), + (t.move = this._onMove)), + this._zoomAnimated && (t.zoomanim = this._animateZoom), + t + ); + }, + createTile: function () { + return document.createElement('div'); + }, + getTileSize: function () { + var t = this.options.tileSize; + return t instanceof p ? t : new p(t, t); + }, + _updateZIndex: function () { + this._container && + void 0 !== this.options.zIndex && + null !== this.options.zIndex && + (this._container.style.zIndex = this.options.zIndex); + }, + _setAutoZIndex: function (t) { + for ( + var i, + e = this.getPane().children, + n = -t(-1 / 0, 1 / 0), + o = 0, + s = e.length; + o < s; + o++ + ) + (i = e[o].style.zIndex), + e[o] !== this._container && i && (n = t(n, +i)); + isFinite(n) && + ((this.options.zIndex = n + t(-1, 1)), this._updateZIndex()); + }, + _updateOpacity: function () { + if (this._map && !P.ielt9) { + C(this._container, this.options.opacity); + var t, + i = +new Date(), + e = !1, + n = !1; + for (t in this._tiles) { + var o, + s = this._tiles[t]; + s.current && + s.loaded && + ((o = Math.min(1, (i - s.loaded) / 200)), + C(s.el, o), + o < 1 + ? (e = !0) + : (s.active ? (n = !0) : this._onOpaqueTile(s), (s.active = !0))); + } + n && !this._noPrune && this._pruneTiles(), + e && + (r(this._fadeFrame), + (this._fadeFrame = x(this._updateOpacity, this))); + } + }, + _onOpaqueTile: u, + _initContainer: function () { + this._container || + ((this._container = b( + 'div', + 'leaflet-layer ' + (this.options.className || ''), + )), + this._updateZIndex(), + this.options.opacity < 1 && this._updateOpacity(), + this.getPane().appendChild(this._container)); + }, + _updateLevels: function () { + var t = this._tileZoom, + i = this.options.maxZoom; + if (void 0 !== t) { + for (var e in this._levels) + (e = Number(e)), + this._levels[e].el.children.length || e === t + ? ((this._levels[e].el.style.zIndex = i - Math.abs(t - e)), + this._onUpdateLevel(e)) + : (T(this._levels[e].el), + this._removeTilesAtZoom(e), + this._onRemoveLevel(e), + delete this._levels[e]); + var n = this._levels[t], + o = this._map; + return ( + n || + (((n = this._levels[t] = {}).el = b( + 'div', + 'leaflet-tile-container leaflet-zoom-animated', + this._container, + )), + (n.el.style.zIndex = i), + (n.origin = o.project(o.unproject(o.getPixelOrigin()), t).round()), + (n.zoom = t), + this._setZoomTransform(n, o.getCenter(), o.getZoom()), + u(n.el.offsetWidth), + this._onCreateLevel(n)), + (this._level = n) + ); + } + }, + _onUpdateLevel: u, + _onRemoveLevel: u, + _onCreateLevel: u, + _pruneTiles: function () { + if (this._map) { + var t, + i, + e, + n = this._map.getZoom(); + if (n > this.options.maxZoom || n < this.options.minZoom) + this._removeAllTiles(); + else { + for (t in this._tiles) (e = this._tiles[t]).retain = e.current; + for (t in this._tiles) + (e = this._tiles[t]).current && + !e.active && + ((i = e.coords), + this._retainParent(i.x, i.y, i.z, i.z - 5) || + this._retainChildren(i.x, i.y, i.z, i.z + 2)); + for (t in this._tiles) this._tiles[t].retain || this._removeTile(t); + } + } + }, + _removeTilesAtZoom: function (t) { + for (var i in this._tiles) + this._tiles[i].coords.z === t && this._removeTile(i); + }, + _removeAllTiles: function () { + for (var t in this._tiles) this._removeTile(t); + }, + _invalidateAll: function () { + for (var t in this._levels) + T(this._levels[t].el), + this._onRemoveLevel(Number(t)), + delete this._levels[t]; + this._removeAllTiles(), (this._tileZoom = void 0); + }, + _retainParent: function (t, i, e, n) { + var t = Math.floor(t / 2), + i = Math.floor(i / 2), + e = e - 1, + o = new p(+t, +i), + o = ((o.z = e), this._tileCoordsToKey(o)), + o = this._tiles[o]; + return o && o.active + ? (o.retain = !0) + : (o && o.loaded && (o.retain = !0), + n < e && this._retainParent(t, i, e, n)); + }, + _retainChildren: function (t, i, e, n) { + for (var o = 2 * t; o < 2 * t + 2; o++) + for (var s = 2 * i; s < 2 * i + 2; s++) { + var r = new p(o, s), + r = ((r.z = e + 1), this._tileCoordsToKey(r)), + r = this._tiles[r]; + r && r.active + ? (r.retain = !0) + : (r && r.loaded && (r.retain = !0), + e + 1 < n && this._retainChildren(o, s, e + 1, n)); + } + }, + _resetView: function (t) { + t = t && (t.pinch || t.flyTo); + this._setView(this._map.getCenter(), this._map.getZoom(), t, t); + }, + _animateZoom: function (t) { + this._setView(t.center, t.zoom, !0, t.noUpdate); + }, + _clampZoom: function (t) { + var i = this.options; + return void 0 !== i.minNativeZoom && t < i.minNativeZoom + ? i.minNativeZoom + : void 0 !== i.maxNativeZoom && i.maxNativeZoom < t + ? i.maxNativeZoom + : t; + }, + _setView: function (t, i, e, n) { + var o = Math.round(i), + o = + (void 0 !== this.options.maxZoom && o > this.options.maxZoom) || + (void 0 !== this.options.minZoom && o < this.options.minZoom) + ? void 0 + : this._clampZoom(o), + s = this.options.updateWhenZooming && o !== this._tileZoom; + (n && !s) || + ((this._tileZoom = o), + this._abortLoading && this._abortLoading(), + this._updateLevels(), + this._resetGrid(), + void 0 !== o && this._update(t), + e || this._pruneTiles(), + (this._noPrune = !!e)), + this._setZoomTransforms(t, i); + }, + _setZoomTransforms: function (t, i) { + for (var e in this._levels) this._setZoomTransform(this._levels[e], t, i); + }, + _setZoomTransform: function (t, i, e) { + var n = this._map.getZoomScale(e, t.zoom), + i = t.origin + .multiplyBy(n) + .subtract(this._map._getNewPixelOrigin(i, e)) + .round(); + P.any3d ? Pi(t.el, i, n) : Z(t.el, i); + }, + _resetGrid: function () { + var t = this._map, + i = t.options.crs, + e = (this._tileSize = this.getTileSize()), + n = this._tileZoom, + o = this._map.getPixelWorldBounds(this._tileZoom); + o && (this._globalTileRange = this._pxBoundsToTileRange(o)), + (this._wrapX = i.wrapLng && + !this.options.noWrap && [ + Math.floor(t.project([0, i.wrapLng[0]], n).x / e.x), + Math.ceil(t.project([0, i.wrapLng[1]], n).x / e.y), + ]), + (this._wrapY = i.wrapLat && + !this.options.noWrap && [ + Math.floor(t.project([i.wrapLat[0], 0], n).y / e.x), + Math.ceil(t.project([i.wrapLat[1], 0], n).y / e.y), + ]); + }, + _onMoveEnd: function () { + this._map && !this._map._animatingZoom && this._update(); + }, + _getTiledPixelBounds: function (t) { + var i = this._map, + e = i._animatingZoom + ? Math.max(i._animateToZoom, i.getZoom()) + : i.getZoom(), + e = i.getZoomScale(e, this._tileZoom), + t = i.project(t, this._tileZoom).floor(), + i = i.getSize().divideBy(2 * e); + return new m(t.subtract(i), t.add(i)); + }, + _update: function (t) { + var i = this._map; + if (i) { + var e = this._clampZoom(i.getZoom()); + if ((void 0 === t && (t = i.getCenter()), void 0 !== this._tileZoom)) { + var n, + i = this._getTiledPixelBounds(t), + o = this._pxBoundsToTileRange(i), + s = o.getCenter(), + r = [], + i = this.options.keepBuffer, + a = new m( + o.getBottomLeft().subtract([i, -i]), + o.getTopRight().add([i, -i]), + ); + if ( + !( + isFinite(o.min.x) && + isFinite(o.min.y) && + isFinite(o.max.x) && + isFinite(o.max.y) + ) + ) + throw new Error('Attempted to load an infinite number of tiles'); + for (n in this._tiles) { + var h = this._tiles[n].coords; + (h.z === this._tileZoom && a.contains(new p(h.x, h.y))) || + (this._tiles[n].current = !1); + } + if (1 < Math.abs(e - this._tileZoom)) this._setView(t, e); + else { + for (var l = o.min.y; l <= o.max.y; l++) + for (var u = o.min.x; u <= o.max.x; u++) { + var c, + d = new p(u, l); + (d.z = this._tileZoom), + this._isValidTile(d) && + ((c = this._tiles[this._tileCoordsToKey(d)]) + ? (c.current = !0) + : r.push(d)); + } + if ( + (r.sort(function (t, i) { + return t.distanceTo(s) - i.distanceTo(s); + }), + 0 !== r.length) + ) { + this._loading || ((this._loading = !0), this.fire('loading')); + for ( + var _ = document.createDocumentFragment(), u = 0; + u < r.length; + u++ + ) + this._addTile(r[u], _); + this._level.el.appendChild(_); + } + } + } + } + }, + _isValidTile: function (t) { + var i = this._map.options.crs; + if (!i.infinite) { + var e = this._globalTileRange; + if ( + (!i.wrapLng && (t.x < e.min.x || t.x > e.max.x)) || + (!i.wrapLat && (t.y < e.min.y || t.y > e.max.y)) + ) + return !1; + } + if (!this.options.bounds) return !0; + i = this._tileCoordsToBounds(t); + return g(this.options.bounds).overlaps(i); + }, + _keyToBounds: function (t) { + return this._tileCoordsToBounds(this._keyToTileCoords(t)); + }, + _tileCoordsToNwSe: function (t) { + var i = this._map, + e = this.getTileSize(), + n = t.scaleBy(e), + e = n.add(e); + return [i.unproject(n, t.z), i.unproject(e, t.z)]; + }, + _tileCoordsToBounds: function (t) { + (t = this._tileCoordsToNwSe(t)), (t = new s(t[0], t[1])); + return (t = this.options.noWrap ? t : this._map.wrapLatLngBounds(t)); + }, + _tileCoordsToKey: function (t) { + return t.x + ':' + t.y + ':' + t.z; + }, + _keyToTileCoords: function (t) { + var t = t.split(':'), + i = new p(+t[0], +t[1]); + return (i.z = +t[2]), i; + }, + _removeTile: function (t) { + var i = this._tiles[t]; + i && + (T(i.el), + delete this._tiles[t], + this.fire('tileunload', { + tile: i.el, + coords: this._keyToTileCoords(t), + })); + }, + _initTile: function (t) { + z(t, 'leaflet-tile'); + var i = this.getTileSize(); + (t.style.width = i.x + 'px'), + (t.style.height = i.y + 'px'), + (t.onselectstart = u), + (t.onmousemove = u), + P.ielt9 && this.options.opacity < 1 && C(t, this.options.opacity); + }, + _addTile: function (t, i) { + var e = this._getTilePos(t), + n = this._tileCoordsToKey(t), + o = this.createTile(this._wrapCoords(t), a(this._tileReady, this, t)); + this._initTile(o), + this.createTile.length < 2 && x(a(this._tileReady, this, t, null, o)), + Z(o, e), + (this._tiles[n] = { el: o, coords: t, current: !0 }), + i.appendChild(o), + this.fire('tileloadstart', { tile: o, coords: t }); + }, + _tileReady: function (t, i, e) { + i && this.fire('tileerror', { error: i, tile: e, coords: t }); + var n = this._tileCoordsToKey(t); + (e = this._tiles[n]) && + ((e.loaded = +new Date()), + this._map._fadeAnimated + ? (C(e.el, 0), + r(this._fadeFrame), + (this._fadeFrame = x(this._updateOpacity, this))) + : ((e.active = !0), this._pruneTiles()), + i || + (z(e.el, 'leaflet-tile-loaded'), + this.fire('tileload', { tile: e.el, coords: t })), + this._noTilesToLoad() && + ((this._loading = !1), + this.fire('load'), + P.ielt9 || !this._map._fadeAnimated + ? x(this._pruneTiles, this) + : setTimeout(a(this._pruneTiles, this), 250))); + }, + _getTilePos: function (t) { + return t.scaleBy(this.getTileSize()).subtract(this._level.origin); + }, + _wrapCoords: function (t) { + var i = new p( + this._wrapX ? H(t.x, this._wrapX) : t.x, + this._wrapY ? H(t.y, this._wrapY) : t.y, + ); + return (i.z = t.z), i; + }, + _pxBoundsToTileRange: function (t) { + var i = this.getTileSize(); + return new m( + t.min.unscaleBy(i).floor(), + t.max.unscaleBy(i).ceil().subtract([1, 1]), + ); + }, + _noTilesToLoad: function () { + for (var t in this._tiles) if (!this._tiles[t].loaded) return !1; + return !0; + }, + }); + var Ie = Ae.extend({ + options: { + minZoom: 0, + maxZoom: 18, + subdomains: 'abc', + errorTileUrl: '', + zoomOffset: 0, + tms: !1, + zoomReverse: !1, + detectRetina: !1, + crossOrigin: !1, + referrerPolicy: !1, + }, + initialize: function (t, i) { + (this._url = t), + (i = c(this, i)).detectRetina && + P.retina && + 0 < i.maxZoom && + ((i.tileSize = Math.floor(i.tileSize / 2)), + i.zoomReverse + ? (i.zoomOffset--, i.minZoom++) + : (i.zoomOffset++, i.maxZoom--), + (i.minZoom = Math.max(0, i.minZoom))), + 'string' == typeof i.subdomains && + (i.subdomains = i.subdomains.split('')), + this.on('tileunload', this._onTileRemove); + }, + setUrl: function (t, i) { + return ( + this._url === t && void 0 === i && (i = !0), + (this._url = t), + i || this.redraw(), + this + ); + }, + createTile: function (t, i) { + var e = document.createElement('img'); + return ( + S(e, 'load', a(this._tileOnLoad, this, i, e)), + S(e, 'error', a(this._tileOnError, this, i, e)), + (!this.options.crossOrigin && '' !== this.options.crossOrigin) || + (e.crossOrigin = + !0 === this.options.crossOrigin ? '' : this.options.crossOrigin), + 'string' == typeof this.options.referrerPolicy && + (e.referrerPolicy = this.options.referrerPolicy), + (e.alt = ''), + e.setAttribute('role', 'presentation'), + (e.src = this.getTileUrl(t)), + e + ); + }, + getTileUrl: function (t) { + var i = { + r: P.retina ? '@2x' : '', + s: this._getSubdomain(t), + x: t.x, + y: t.y, + z: this._getZoomForUrl(), + }; + return ( + this._map && + !this._map.options.crs.infinite && + ((t = this._globalTileRange.max.y - t.y), + this.options.tms && (i.y = t), + (i['-y'] = t)), + q(this._url, l(i, this.options)) + ); + }, + _tileOnLoad: function (t, i) { + P.ielt9 ? setTimeout(a(t, this, null, i), 0) : t(null, i); + }, + _tileOnError: function (t, i, e) { + var n = this.options.errorTileUrl; + n && i.getAttribute('src') !== n && (i.src = n), t(e, i); + }, + _onTileRemove: function (t) { + t.tile.onload = null; + }, + _getZoomForUrl: function () { + var t = this._tileZoom, + i = this.options.maxZoom; + return ( + (t = this.options.zoomReverse ? i - t : t) + this.options.zoomOffset + ); + }, + _getSubdomain: function (t) { + t = Math.abs(t.x + t.y) % this.options.subdomains.length; + return this.options.subdomains[t]; + }, + _abortLoading: function () { + var t, i, e; + for (t in this._tiles) + this._tiles[t].coords.z !== this._tileZoom && + (((e = this._tiles[t].el).onload = u), + (e.onerror = u), + e.complete || + ((e.src = K), + (i = this._tiles[t].coords), + T(e), + delete this._tiles[t], + this.fire('tileabort', { tile: e, coords: i }))); + }, + _removeTile: function (t) { + var i = this._tiles[t]; + if (i) + return ( + i.el.setAttribute('src', K), Ae.prototype._removeTile.call(this, t) + ); + }, + _tileReady: function (t, i, e) { + if (this._map && (!e || e.getAttribute('src') !== K)) + return Ae.prototype._tileReady.call(this, t, i, e); + }, + }); + function Oe(t, i) { + return new Ie(t, i); + } + var Re = Ie.extend({ + defaultWmsParams: { + service: 'WMS', + request: 'GetMap', + layers: '', + styles: '', + format: 'image/jpeg', + transparent: !1, + version: '1.1.1', + }, + options: { crs: null, uppercase: !1 }, + initialize: function (t, i) { + this._url = t; + var e, + n = l({}, this.defaultWmsParams); + for (e in i) e in this.options || (n[e] = i[e]); + var t = (i = c(this, i)).detectRetina && P.retina ? 2 : 1, + o = this.getTileSize(); + (n.width = o.x * t), (n.height = o.y * t), (this.wmsParams = n); + }, + onAdd: function (t) { + (this._crs = this.options.crs || t.options.crs), + (this._wmsVersion = parseFloat(this.wmsParams.version)); + var i = 1.3 <= this._wmsVersion ? 'crs' : 'srs'; + (this.wmsParams[i] = this._crs.code), Ie.prototype.onAdd.call(this, t); + }, + getTileUrl: function (t) { + var i = this._tileCoordsToNwSe(t), + e = this._crs, + e = f(e.project(i[0]), e.project(i[1])), + i = e.min, + e = e.max, + i = ( + 1.3 <= this._wmsVersion && this._crs === re + ? [i.y, i.x, e.y, e.x] + : [i.x, i.y, e.x, e.y] + ).join(','), + e = Ie.prototype.getTileUrl.call(this, t); + return ( + e + + U(this.wmsParams, e, this.options.uppercase) + + (this.options.uppercase ? '&BBOX=' : '&bbox=') + + i + ); + }, + setParams: function (t, i) { + return l(this.wmsParams, t), i || this.redraw(), this; + }, + }); + (Ie.WMS = Re), + (Oe.wms = function (t, i) { + return new Re(t, i); + }); + var Ne = o.extend({ + options: { padding: 0.1 }, + initialize: function (t) { + c(this, t), h(this), (this._layers = this._layers || {}); + }, + onAdd: function () { + this._container || + (this._initContainer(), + this._zoomAnimated && z(this._container, 'leaflet-zoom-animated')), + this.getPane().appendChild(this._container), + this._update(), + this.on('update', this._updatePaths, this); + }, + onRemove: function () { + this.off('update', this._updatePaths, this), this._destroyContainer(); + }, + getEvents: function () { + var t = { + viewreset: this._reset, + zoom: this._onZoom, + moveend: this._update, + zoomend: this._onZoomEnd, + }; + return this._zoomAnimated && (t.zoomanim = this._onAnimZoom), t; + }, + _onAnimZoom: function (t) { + this._updateTransform(t.center, t.zoom); + }, + _onZoom: function () { + this._updateTransform(this._map.getCenter(), this._map.getZoom()); + }, + _updateTransform: function (t, i) { + var e = this._map.getZoomScale(i, this._zoom), + n = this._map.getSize().multiplyBy(0.5 + this.options.padding), + o = this._map.project(this._center, i), + n = n + .multiplyBy(-e) + .add(o) + .subtract(this._map._getNewPixelOrigin(t, i)); + P.any3d ? Pi(this._container, n, e) : Z(this._container, n); + }, + _reset: function () { + for (var t in (this._update(), + this._updateTransform(this._center, this._zoom), + this._layers)) + this._layers[t]._reset(); + }, + _onZoomEnd: function () { + for (var t in this._layers) this._layers[t]._project(); + }, + _updatePaths: function () { + for (var t in this._layers) this._layers[t]._update(); + }, + _update: function () { + var t = this.options.padding, + i = this._map.getSize(), + e = this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round(); + (this._bounds = new m(e, e.add(i.multiplyBy(1 + 2 * t)).round())), + (this._center = this._map.getCenter()), + (this._zoom = this._map.getZoom()); + }, + }), + De = Ne.extend({ + options: { tolerance: 0 }, + getEvents: function () { + var t = Ne.prototype.getEvents.call(this); + return (t.viewprereset = this._onViewPreReset), t; + }, + _onViewPreReset: function () { + this._postponeUpdatePaths = !0; + }, + onAdd: function () { + Ne.prototype.onAdd.call(this), this._draw(); + }, + _initContainer: function () { + var t = (this._container = document.createElement('canvas')); + S(t, 'mousemove', this._onMouseMove, this), + S( + t, + 'click dblclick mousedown mouseup contextmenu', + this._onClick, + this, + ), + S(t, 'mouseout', this._handleMouseOut, this), + (t._leaflet_disable_events = !0), + (this._ctx = t.getContext('2d')); + }, + _destroyContainer: function () { + r(this._redrawRequest), + delete this._ctx, + T(this._container), + E(this._container), + delete this._container; + }, + _updatePaths: function () { + if (!this._postponeUpdatePaths) { + for (var t in ((this._redrawBounds = null), this._layers)) + this._layers[t]._update(); + this._redraw(); + } + }, + _update: function () { + var t, i, e, n; + (this._map._animatingZoom && this._bounds) || + (Ne.prototype._update.call(this), + (t = this._bounds), + (i = this._container), + (e = t.getSize()), + (n = P.retina ? 2 : 1), + Z(i, t.min), + (i.width = n * e.x), + (i.height = n * e.y), + (i.style.width = e.x + 'px'), + (i.style.height = e.y + 'px'), + P.retina && this._ctx.scale(2, 2), + this._ctx.translate(-t.min.x, -t.min.y), + this.fire('update')); + }, + _reset: function () { + Ne.prototype._reset.call(this), + this._postponeUpdatePaths && + ((this._postponeUpdatePaths = !1), this._updatePaths()); + }, + _initPath: function (t) { + this._updateDashArray(t); + t = (this._layers[h(t)] = t)._order = { + layer: t, + prev: this._drawLast, + next: null, + }; + this._drawLast && (this._drawLast.next = t), + (this._drawLast = t), + (this._drawFirst = this._drawFirst || this._drawLast); + }, + _addPath: function (t) { + this._requestRedraw(t); + }, + _removePath: function (t) { + var i = t._order, + e = i.next, + i = i.prev; + e ? (e.prev = i) : (this._drawLast = i), + i ? (i.next = e) : (this._drawFirst = e), + delete t._order, + delete this._layers[h(t)], + this._requestRedraw(t); + }, + _updatePath: function (t) { + this._extendRedrawBounds(t), + t._project(), + t._update(), + this._requestRedraw(t); + }, + _updateStyle: function (t) { + this._updateDashArray(t), this._requestRedraw(t); + }, + _updateDashArray: function (t) { + if ('string' == typeof t.options.dashArray) { + for ( + var i, e = t.options.dashArray.split(/[, ]+/), n = [], o = 0; + o < e.length; + o++ + ) { + if (((i = Number(e[o])), isNaN(i))) return; + n.push(i); + } + t.options._dashArray = n; + } else t.options._dashArray = t.options.dashArray; + }, + _requestRedraw: function (t) { + this._map && + (this._extendRedrawBounds(t), + (this._redrawRequest = this._redrawRequest || x(this._redraw, this))); + }, + _extendRedrawBounds: function (t) { + var i; + t._pxBounds && + ((i = (t.options.weight || 0) + 1), + (this._redrawBounds = this._redrawBounds || new m()), + this._redrawBounds.extend(t._pxBounds.min.subtract([i, i])), + this._redrawBounds.extend(t._pxBounds.max.add([i, i]))); + }, + _redraw: function () { + (this._redrawRequest = null), + this._redrawBounds && + (this._redrawBounds.min._floor(), this._redrawBounds.max._ceil()), + this._clear(), + this._draw(), + (this._redrawBounds = null); + }, + _clear: function () { + var t, + i = this._redrawBounds; + i + ? ((t = i.getSize()), this._ctx.clearRect(i.min.x, i.min.y, t.x, t.y)) + : (this._ctx.save(), + this._ctx.setTransform(1, 0, 0, 1, 0, 0), + this._ctx.clearRect( + 0, + 0, + this._container.width, + this._container.height, + ), + this._ctx.restore()); + }, + _draw: function () { + var t, + i, + e = this._redrawBounds; + this._ctx.save(), + e && + ((i = e.getSize()), + this._ctx.beginPath(), + this._ctx.rect(e.min.x, e.min.y, i.x, i.y), + this._ctx.clip()), + (this._drawing = !0); + for (var n = this._drawFirst; n; n = n.next) + (t = n.layer), + (!e || (t._pxBounds && t._pxBounds.intersects(e))) && + t._updatePath(); + (this._drawing = !1), this._ctx.restore(); + }, + _updatePoly: function (t, i) { + if (this._drawing) { + var e, + n, + o, + s, + r = t._parts, + a = r.length, + h = this._ctx; + if (a) { + for (h.beginPath(), e = 0; e < a; e++) { + for (n = 0, o = r[e].length; n < o; n++) + (s = r[e][n]), h[n ? 'lineTo' : 'moveTo'](s.x, s.y); + i && h.closePath(); + } + this._fillStroke(h, t); + } + } + }, + _updateCircle: function (t) { + var i, e, n, o; + this._drawing && + !t._empty() && + ((i = t._point), + (e = this._ctx), + (n = Math.max(Math.round(t._radius), 1)), + 1 != (o = (Math.max(Math.round(t._radiusY), 1) || n) / n) && + (e.save(), e.scale(1, o)), + e.beginPath(), + e.arc(i.x, i.y / o, n, 0, 2 * Math.PI, !1), + 1 != o && e.restore(), + this._fillStroke(e, t)); + }, + _fillStroke: function (t, i) { + var e = i.options; + e.fill && + ((t.globalAlpha = e.fillOpacity), + (t.fillStyle = e.fillColor || e.color), + t.fill(e.fillRule || 'evenodd')), + e.stroke && + 0 !== e.weight && + (t.setLineDash && + t.setLineDash((i.options && i.options._dashArray) || []), + (t.globalAlpha = e.opacity), + (t.lineWidth = e.weight), + (t.strokeStyle = e.color), + (t.lineCap = e.lineCap), + (t.lineJoin = e.lineJoin), + t.stroke()); + }, + _onClick: function (t) { + for ( + var i, + e, + n = this._map.mouseEventToLayerPoint(t), + o = this._drawFirst; + o; + o = o.next + ) + (i = o.layer).options.interactive && + i._containsPoint(n) && + ((('click' === t.type || 'preclick' === t.type) && + this._map._draggableMoved(i)) || + (e = i)); + this._fireEvent(!!e && [e], t); + }, + _onMouseMove: function (t) { + var i; + !this._map || + this._map.dragging.moving() || + this._map._animatingZoom || + ((i = this._map.mouseEventToLayerPoint(t)), + this._handleMouseHover(t, i)); + }, + _handleMouseOut: function (t) { + var i = this._hoveredLayer; + i && + (M(this._container, 'leaflet-interactive'), + this._fireEvent([i], t, 'mouseout'), + (this._hoveredLayer = null), + (this._mouseHoverThrottled = !1)); + }, + _handleMouseHover: function (t, i) { + if (!this._mouseHoverThrottled) { + for (var e, n, o = this._drawFirst; o; o = o.next) + (e = o.layer).options.interactive && e._containsPoint(i) && (n = e); + n !== this._hoveredLayer && + (this._handleMouseOut(t), + n && + (z(this._container, 'leaflet-interactive'), + this._fireEvent([n], t, 'mouseover'), + (this._hoveredLayer = n))), + this._fireEvent(!!this._hoveredLayer && [this._hoveredLayer], t), + (this._mouseHoverThrottled = !0), + setTimeout( + a(function () { + this._mouseHoverThrottled = !1; + }, this), + 32, + ); + } + }, + _fireEvent: function (t, i, e) { + this._map._fireDOMEvent(i, e || i.type, t); + }, + _bringToFront: function (t) { + var i, + e, + n = t._order; + n && + ((i = n.next), + (e = n.prev), + i && + ((i.prev = e) ? (e.next = i) : i && (this._drawFirst = i), + (n.prev = this._drawLast), + ((this._drawLast.next = n).next = null), + (this._drawLast = n), + this._requestRedraw(t))); + }, + _bringToBack: function (t) { + var i, + e, + n = t._order; + n && + ((i = n.next), + (e = n.prev) && + ((e.next = i) ? (i.prev = e) : e && (this._drawLast = e), + (n.prev = null), + (n.next = this._drawFirst), + (this._drawFirst.prev = n), + (this._drawFirst = n), + this._requestRedraw(t))); + }, + }); + function je(t) { + return P.canvas ? new De(t) : null; + } + var He = (function () { + try { + return ( + document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml'), + function (t) { + return document.createElement(''); + } + ); + } catch (t) {} + return function (t) { + return document.createElement( + '<' + t + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">', + ); + }; + })(), + Mt = { + _initContainer: function () { + this._container = b('div', 'leaflet-vml-container'); + }, + _update: function () { + this._map._animatingZoom || + (Ne.prototype._update.call(this), this.fire('update')); + }, + _initPath: function (t) { + var i = (t._container = He('shape')); + z(i, 'leaflet-vml-shape ' + (this.options.className || '')), + (i.coordsize = '1 1'), + (t._path = He('path')), + i.appendChild(t._path), + this._updateStyle(t), + (this._layers[h(t)] = t); + }, + _addPath: function (t) { + var i = t._container; + this._container.appendChild(i), + t.options.interactive && t.addInteractiveTarget(i); + }, + _removePath: function (t) { + var i = t._container; + T(i), t.removeInteractiveTarget(i), delete this._layers[h(t)]; + }, + _updateStyle: function (t) { + var i = t._stroke, + e = t._fill, + n = t.options, + o = t._container; + (o.stroked = !!n.stroke), + (o.filled = !!n.fill), + n.stroke + ? ((i = i || (t._stroke = He('stroke'))), + o.appendChild(i), + (i.weight = n.weight + 'px'), + (i.color = n.color), + (i.opacity = n.opacity), + n.dashArray + ? (i.dashStyle = d(n.dashArray) + ? n.dashArray.join(' ') + : n.dashArray.replace(/( *, *)/g, ' ')) + : (i.dashStyle = ''), + (i.endcap = n.lineCap.replace('butt', 'flat')), + (i.joinstyle = n.lineJoin)) + : i && (o.removeChild(i), (t._stroke = null)), + n.fill + ? ((e = e || (t._fill = He('fill'))), + o.appendChild(e), + (e.color = n.fillColor || n.color), + (e.opacity = n.fillOpacity)) + : e && (o.removeChild(e), (t._fill = null)); + }, + _updateCircle: function (t) { + var i = t._point.round(), + e = Math.round(t._radius), + n = Math.round(t._radiusY || e); + this._setPath( + t, + t._empty() + ? 'M0 0' + : 'AL ' + i.x + ',' + i.y + ' ' + e + ',' + n + ' 0,23592600', + ); + }, + _setPath: function (t, i) { + t._path.v = i; + }, + _bringToFront: function (t) { + fi(t._container); + }, + _bringToBack: function (t) { + gi(t._container); + }, + }, + We = P.vml ? He : ct, + Fe = Ne.extend({ + _initContainer: function () { + (this._container = We('svg')), + this._container.setAttribute('pointer-events', 'none'), + (this._rootGroup = We('g')), + this._container.appendChild(this._rootGroup); + }, + _destroyContainer: function () { + T(this._container), + E(this._container), + delete this._container, + delete this._rootGroup, + delete this._svgSize; + }, + _update: function () { + var t, i, e; + (this._map._animatingZoom && this._bounds) || + (Ne.prototype._update.call(this), + (i = (t = this._bounds).getSize()), + (e = this._container), + (this._svgSize && this._svgSize.equals(i)) || + ((this._svgSize = i), + e.setAttribute('width', i.x), + e.setAttribute('height', i.y)), + Z(e, t.min), + e.setAttribute('viewBox', [t.min.x, t.min.y, i.x, i.y].join(' ')), + this.fire('update')); + }, + _initPath: function (t) { + var i = (t._path = We('path')); + t.options.className && z(i, t.options.className), + t.options.interactive && z(i, 'leaflet-interactive'), + this._updateStyle(t), + (this._layers[h(t)] = t); + }, + _addPath: function (t) { + this._rootGroup || this._initContainer(), + this._rootGroup.appendChild(t._path), + t.addInteractiveTarget(t._path); + }, + _removePath: function (t) { + T(t._path), + t.removeInteractiveTarget(t._path), + delete this._layers[h(t)]; + }, + _updatePath: function (t) { + t._project(), t._update(); + }, + _updateStyle: function (t) { + var i = t._path, + t = t.options; + i && + (t.stroke + ? (i.setAttribute('stroke', t.color), + i.setAttribute('stroke-opacity', t.opacity), + i.setAttribute('stroke-width', t.weight), + i.setAttribute('stroke-linecap', t.lineCap), + i.setAttribute('stroke-linejoin', t.lineJoin), + t.dashArray + ? i.setAttribute('stroke-dasharray', t.dashArray) + : i.removeAttribute('stroke-dasharray'), + t.dashOffset + ? i.setAttribute('stroke-dashoffset', t.dashOffset) + : i.removeAttribute('stroke-dashoffset')) + : i.setAttribute('stroke', 'none'), + t.fill + ? (i.setAttribute('fill', t.fillColor || t.color), + i.setAttribute('fill-opacity', t.fillOpacity), + i.setAttribute('fill-rule', t.fillRule || 'evenodd')) + : i.setAttribute('fill', 'none')); + }, + _updatePoly: function (t, i) { + this._setPath(t, dt(t._parts, i)); + }, + _updateCircle: function (t) { + var i = t._point, + e = Math.max(Math.round(t._radius), 1), + n = + 'a' + + e + + ',' + + (Math.max(Math.round(t._radiusY), 1) || e) + + ' 0 1,0 ', + i = t._empty() + ? 'M0 0' + : 'M' + + (i.x - e) + + ',' + + i.y + + n + + 2 * e + + ',0 ' + + n + + 2 * -e + + ',0 '; + this._setPath(t, i); + }, + _setPath: function (t, i) { + t._path.setAttribute('d', i); + }, + _bringToFront: function (t) { + fi(t._path); + }, + _bringToBack: function (t) { + gi(t._path); + }, + }); + function Ue(t) { + return P.svg || P.vml ? new Fe(t) : null; + } + P.vml && Fe.include(Mt), + A.include({ + getRenderer: function (t) { + t = + (t = + t.options.renderer || + this._getPaneRenderer(t.options.pane) || + this.options.renderer || + this._renderer) || (this._renderer = this._createRenderer()); + return this.hasLayer(t) || this.addLayer(t), t; + }, + _getPaneRenderer: function (t) { + if ('overlayPane' === t || void 0 === t) return !1; + var i = this._paneRenderers[t]; + return ( + void 0 === i && + ((i = this._createRenderer({ pane: t })), + (this._paneRenderers[t] = i)), + i + ); + }, + _createRenderer: function (t) { + return (this.options.preferCanvas && je(t)) || Ue(t); + }, + }); + var Ve = ge.extend({ + initialize: function (t, i) { + ge.prototype.initialize.call(this, this._boundsToLatLngs(t), i); + }, + setBounds: function (t) { + return this.setLatLngs(this._boundsToLatLngs(t)); + }, + _boundsToLatLngs: function (t) { + return [ + (t = g(t)).getSouthWest(), + t.getNorthWest(), + t.getNorthEast(), + t.getSouthEast(), + ]; + }, + }); + (Fe.create = We), + (Fe.pointsToPath = dt), + (ve.geometryToLayer = ye), + (ve.coordsToLatLng = we), + (ve.coordsToLatLngs = Pe), + (ve.latLngToCoords = be), + (ve.latLngsToCoords = Le), + (ve.getFeature = Te), + (ve.asFeature = ze), + A.mergeOptions({ boxZoom: !0 }); + var _t = n.extend({ + initialize: function (t) { + (this._map = t), + (this._container = t._container), + (this._pane = t._panes.overlayPane), + (this._resetStateTimeout = 0), + t.on('unload', this._destroy, this); + }, + addHooks: function () { + S(this._container, 'mousedown', this._onMouseDown, this); + }, + removeHooks: function () { + E(this._container, 'mousedown', this._onMouseDown, this); + }, + moved: function () { + return this._moved; + }, + _destroy: function () { + T(this._pane), delete this._pane; + }, + _resetState: function () { + (this._resetStateTimeout = 0), (this._moved = !1); + }, + _clearDeferredResetState: function () { + 0 !== this._resetStateTimeout && + (clearTimeout(this._resetStateTimeout), + (this._resetStateTimeout = 0)); + }, + _onMouseDown: function (t) { + if (!t.shiftKey || (1 !== t.which && 1 !== t.button)) return !1; + this._clearDeferredResetState(), + this._resetState(), + ri(), + Li(), + (this._startPoint = this._map.mouseEventToContainerPoint(t)), + S( + document, + { + contextmenu: Ri, + mousemove: this._onMouseMove, + mouseup: this._onMouseUp, + keydown: this._onKeyDown, + }, + this, + ); + }, + _onMouseMove: function (t) { + this._moved || + ((this._moved = !0), + (this._box = b('div', 'leaflet-zoom-box', this._container)), + z(this._container, 'leaflet-crosshair'), + this._map.fire('boxzoomstart')), + (this._point = this._map.mouseEventToContainerPoint(t)); + var t = new m(this._point, this._startPoint), + i = t.getSize(); + Z(this._box, t.min), + (this._box.style.width = i.x + 'px'), + (this._box.style.height = i.y + 'px'); + }, + _finish: function () { + this._moved && (T(this._box), M(this._container, 'leaflet-crosshair')), + ai(), + Ti(), + E( + document, + { + contextmenu: Ri, + mousemove: this._onMouseMove, + mouseup: this._onMouseUp, + keydown: this._onKeyDown, + }, + this, + ); + }, + _onMouseUp: function (t) { + (1 !== t.which && 1 !== t.button) || + (this._finish(), + this._moved && + (this._clearDeferredResetState(), + (this._resetStateTimeout = setTimeout( + a(this._resetState, this), + 0, + )), + (t = new s( + this._map.containerPointToLatLng(this._startPoint), + this._map.containerPointToLatLng(this._point), + )), + this._map.fitBounds(t).fire('boxzoomend', { boxZoomBounds: t }))); + }, + _onKeyDown: function (t) { + 27 === t.keyCode && + (this._finish(), this._clearDeferredResetState(), this._resetState()); + }, + }), + Ct = + (A.addInitHook('addHandler', 'boxZoom', _t), + A.mergeOptions({ doubleClickZoom: !0 }), + n.extend({ + addHooks: function () { + this._map.on('dblclick', this._onDoubleClick, this); + }, + removeHooks: function () { + this._map.off('dblclick', this._onDoubleClick, this); + }, + _onDoubleClick: function (t) { + var i = this._map, + e = i.getZoom(), + n = i.options.zoomDelta, + e = t.originalEvent.shiftKey ? e - n : e + n; + 'center' === i.options.doubleClickZoom + ? i.setZoom(e) + : i.setZoomAround(t.containerPoint, e); + }, + })), + Zt = + (A.addInitHook('addHandler', 'doubleClickZoom', Ct), + A.mergeOptions({ + dragging: !0, + inertia: !0, + inertiaDeceleration: 3400, + inertiaMaxSpeed: 1 / 0, + easeLinearity: 0.2, + worldCopyJump: !1, + maxBoundsViscosity: 0, + }), + n.extend({ + addHooks: function () { + var t; + this._draggable || + ((t = this._map), + (this._draggable = new Xi(t._mapPane, t._container)), + this._draggable.on( + { + dragstart: this._onDragStart, + drag: this._onDrag, + dragend: this._onDragEnd, + }, + this, + ), + this._draggable.on('predrag', this._onPreDragLimit, this), + t.options.worldCopyJump && + (this._draggable.on('predrag', this._onPreDragWrap, this), + t.on('zoomend', this._onZoomEnd, this), + t.whenReady(this._onZoomEnd, this))), + z(this._map._container, 'leaflet-grab leaflet-touch-drag'), + this._draggable.enable(), + (this._positions = []), + (this._times = []); + }, + removeHooks: function () { + M(this._map._container, 'leaflet-grab'), + M(this._map._container, 'leaflet-touch-drag'), + this._draggable.disable(); + }, + moved: function () { + return this._draggable && this._draggable._moved; + }, + moving: function () { + return this._draggable && this._draggable._moving; + }, + _onDragStart: function () { + var t, + i = this._map; + i._stop(), + this._map.options.maxBounds && this._map.options.maxBoundsViscosity + ? ((t = g(this._map.options.maxBounds)), + (this._offsetLimit = f( + this._map + .latLngToContainerPoint(t.getNorthWest()) + .multiplyBy(-1), + this._map + .latLngToContainerPoint(t.getSouthEast()) + .multiplyBy(-1) + .add(this._map.getSize()), + )), + (this._viscosity = Math.min( + 1, + Math.max(0, this._map.options.maxBoundsViscosity), + ))) + : (this._offsetLimit = null), + i.fire('movestart').fire('dragstart'), + i.options.inertia && ((this._positions = []), (this._times = [])); + }, + _onDrag: function (t) { + var i, e; + this._map.options.inertia && + ((i = this._lastTime = +new Date()), + (e = this._lastPos = + this._draggable._absPos || this._draggable._newPos), + this._positions.push(e), + this._times.push(i), + this._prunePositions(i)), + this._map.fire('move', t).fire('drag', t); + }, + _prunePositions: function (t) { + for (; 1 < this._positions.length && 50 < t - this._times[0]; ) + this._positions.shift(), this._times.shift(); + }, + _onZoomEnd: function () { + var t = this._map.getSize().divideBy(2), + i = this._map.latLngToLayerPoint([0, 0]); + (this._initialWorldOffset = i.subtract(t).x), + (this._worldWidth = this._map.getPixelWorldBounds().getSize().x); + }, + _viscousLimit: function (t, i) { + return t - (t - i) * this._viscosity; + }, + _onPreDragLimit: function () { + var t, i; + this._viscosity && + this._offsetLimit && + ((t = this._draggable._newPos.subtract(this._draggable._startPos)), + (i = this._offsetLimit), + t.x < i.min.x && (t.x = this._viscousLimit(t.x, i.min.x)), + t.y < i.min.y && (t.y = this._viscousLimit(t.y, i.min.y)), + t.x > i.max.x && (t.x = this._viscousLimit(t.x, i.max.x)), + t.y > i.max.y && (t.y = this._viscousLimit(t.y, i.max.y)), + (this._draggable._newPos = this._draggable._startPos.add(t))); + }, + _onPreDragWrap: function () { + var t = this._worldWidth, + i = Math.round(t / 2), + e = this._initialWorldOffset, + n = this._draggable._newPos.x, + o = ((n - i + e) % t) + i - e, + n = ((n + i + e) % t) - i - e, + t = Math.abs(o + e) < Math.abs(n + e) ? o : n; + (this._draggable._absPos = this._draggable._newPos.clone()), + (this._draggable._newPos.x = t); + }, + _onDragEnd: function (t) { + var i, + e, + n, + o, + s = this._map, + r = s.options, + a = !r.inertia || t.noInertia || this._times.length < 2; + s.fire('dragend', t), + a + ? s.fire('moveend') + : (this._prunePositions(+new Date()), + (t = this._lastPos.subtract(this._positions[0])), + (a = (this._lastTime - this._times[0]) / 1e3), + (i = r.easeLinearity), + (a = (t = t.multiplyBy(i / a)).distanceTo([0, 0])), + (e = Math.min(r.inertiaMaxSpeed, a)), + (t = t.multiplyBy(e / a)), + (n = e / (r.inertiaDeceleration * i)), + (o = t.multiplyBy(-n / 2).round()).x || o.y + ? ((o = s._limitOffset(o, s.options.maxBounds)), + x(function () { + s.panBy(o, { + duration: n, + easeLinearity: i, + noMoveStart: !0, + animate: !0, + }); + })) + : s.fire('moveend')); + }, + })), + St = + (A.addInitHook('addHandler', 'dragging', Zt), + A.mergeOptions({ keyboard: !0, keyboardPanDelta: 80 }), + n.extend({ + keyCodes: { + left: [37], + right: [39], + down: [40], + up: [38], + zoomIn: [187, 107, 61, 171], + zoomOut: [189, 109, 54, 173], + }, + initialize: function (t) { + (this._map = t), + this._setPanDelta(t.options.keyboardPanDelta), + this._setZoomDelta(t.options.zoomDelta); + }, + addHooks: function () { + var t = this._map._container; + t.tabIndex <= 0 && (t.tabIndex = '0'), + S( + t, + { + focus: this._onFocus, + blur: this._onBlur, + mousedown: this._onMouseDown, + }, + this, + ), + this._map.on( + { focus: this._addHooks, blur: this._removeHooks }, + this, + ); + }, + removeHooks: function () { + this._removeHooks(), + E( + this._map._container, + { + focus: this._onFocus, + blur: this._onBlur, + mousedown: this._onMouseDown, + }, + this, + ), + this._map.off( + { focus: this._addHooks, blur: this._removeHooks }, + this, + ); + }, + _onMouseDown: function () { + var t, i, e; + this._focused || + ((e = document.body), + (t = document.documentElement), + (i = e.scrollTop || t.scrollTop), + (e = e.scrollLeft || t.scrollLeft), + this._map._container.focus(), + window.scrollTo(e, i)); + }, + _onFocus: function () { + (this._focused = !0), this._map.fire('focus'); + }, + _onBlur: function () { + (this._focused = !1), this._map.fire('blur'); + }, + _setPanDelta: function (t) { + for ( + var i = (this._panKeys = {}), + e = this.keyCodes, + n = 0, + o = e.left.length; + n < o; + n++ + ) + i[e.left[n]] = [-1 * t, 0]; + for (n = 0, o = e.right.length; n < o; n++) i[e.right[n]] = [t, 0]; + for (n = 0, o = e.down.length; n < o; n++) i[e.down[n]] = [0, t]; + for (n = 0, o = e.up.length; n < o; n++) i[e.up[n]] = [0, -1 * t]; + }, + _setZoomDelta: function (t) { + for ( + var i = (this._zoomKeys = {}), + e = this.keyCodes, + n = 0, + o = e.zoomIn.length; + n < o; + n++ + ) + i[e.zoomIn[n]] = t; + for (n = 0, o = e.zoomOut.length; n < o; n++) i[e.zoomOut[n]] = -t; + }, + _addHooks: function () { + S(document, 'keydown', this._onKeyDown, this); + }, + _removeHooks: function () { + E(document, 'keydown', this._onKeyDown, this); + }, + _onKeyDown: function (t) { + if (!(t.altKey || t.ctrlKey || t.metaKey)) { + var i, + e = t.keyCode, + n = this._map; + if (e in this._panKeys) + (n._panAnim && n._panAnim._inProgress) || + ((i = this._panKeys[e]), + t.shiftKey && (i = _(i).multiplyBy(3)), + n.panBy(i), + n.options.maxBounds && n.panInsideBounds(n.options.maxBounds)); + else if (e in this._zoomKeys) + n.setZoom(n.getZoom() + (t.shiftKey ? 3 : 1) * this._zoomKeys[e]); + else { + if (27 !== e || !n._popup || !n._popup.options.closeOnEscapeKey) + return; + n.closePopup(); + } + Ri(t); + } + }, + })), + kt = + (A.addInitHook('addHandler', 'keyboard', St), + A.mergeOptions({ + scrollWheelZoom: !0, + wheelDebounceTime: 40, + wheelPxPerZoomLevel: 60, + }), + n.extend({ + addHooks: function () { + S(this._map._container, 'wheel', this._onWheelScroll, this), + (this._delta = 0); + }, + removeHooks: function () { + E(this._map._container, 'wheel', this._onWheelScroll, this); + }, + _onWheelScroll: function (t) { + var i = ji(t), + e = this._map.options.wheelDebounceTime, + i = + ((this._delta += i), + (this._lastMousePos = this._map.mouseEventToContainerPoint(t)), + this._startTime || (this._startTime = +new Date()), + Math.max(e - (+new Date() - this._startTime), 0)); + clearTimeout(this._timer), + (this._timer = setTimeout(a(this._performZoom, this), i)), + Ri(t); + }, + _performZoom: function () { + var t = this._map, + i = t.getZoom(), + e = this._map.options.zoomSnap || 0, + n = + (t._stop(), + this._delta / (4 * this._map.options.wheelPxPerZoomLevel)), + n = (4 * Math.log(2 / (1 + Math.exp(-Math.abs(n))))) / Math.LN2, + e = e ? Math.ceil(n / e) * e : n, + n = t._limitZoom(i + (0 < this._delta ? e : -e)) - i; + (this._delta = 0), + (this._startTime = null), + n && + ('center' === t.options.scrollWheelZoom + ? t.setZoom(i + n) + : t.setZoomAround(this._lastMousePos, i + n)); + }, + })), + Et = + (A.addInitHook('addHandler', 'scrollWheelZoom', kt), + A.mergeOptions({ + tapHold: P.touchNative && P.safari && P.mobile, + tapTolerance: 15, + }), + n.extend({ + addHooks: function () { + S(this._map._container, 'touchstart', this._onDown, this); + }, + removeHooks: function () { + E(this._map._container, 'touchstart', this._onDown, this); + }, + _onDown: function (t) { + var i; + clearTimeout(this._holdTimeout), + 1 === t.touches.length && + ((i = t.touches[0]), + (this._startPos = this._newPos = new p(i.clientX, i.clientY)), + (this._holdTimeout = setTimeout( + a(function () { + this._cancel(), + this._isTapValid() && + (S(document, 'touchend', B), + S( + document, + 'touchend touchcancel', + this._cancelClickPrevent, + ), + this._simulateEvent('contextmenu', i)); + }, this), + 600, + )), + S( + document, + 'touchend touchcancel contextmenu', + this._cancel, + this, + ), + S(document, 'touchmove', this._onMove, this)); + }, + _cancelClickPrevent: function t() { + E(document, 'touchend', B), E(document, 'touchend touchcancel', t); + }, + _cancel: function () { + clearTimeout(this._holdTimeout), + E(document, 'touchend touchcancel contextmenu', this._cancel, this), + E(document, 'touchmove', this._onMove, this); + }, + _onMove: function (t) { + t = t.touches[0]; + this._newPos = new p(t.clientX, t.clientY); + }, + _isTapValid: function () { + return ( + this._newPos.distanceTo(this._startPos) <= + this._map.options.tapTolerance + ); + }, + _simulateEvent: function (t, i) { + t = new MouseEvent(t, { + bubbles: !0, + cancelable: !0, + view: window, + screenX: i.screenX, + screenY: i.screenY, + clientX: i.clientX, + clientY: i.clientY, + }); + (t._simulated = !0), i.target.dispatchEvent(t); + }, + })), + Bt = + (A.addInitHook('addHandler', 'tapHold', Et), + A.mergeOptions({ touchZoom: P.touch, bounceAtZoomLimits: !0 }), + n.extend({ + addHooks: function () { + z(this._map._container, 'leaflet-touch-zoom'), + S(this._map._container, 'touchstart', this._onTouchStart, this); + }, + removeHooks: function () { + M(this._map._container, 'leaflet-touch-zoom'), + E(this._map._container, 'touchstart', this._onTouchStart, this); + }, + _onTouchStart: function (t) { + var i, + e, + n = this._map; + !t.touches || + 2 !== t.touches.length || + n._animatingZoom || + this._zooming || + ((i = n.mouseEventToContainerPoint(t.touches[0])), + (e = n.mouseEventToContainerPoint(t.touches[1])), + (this._centerPoint = n.getSize()._divideBy(2)), + (this._startLatLng = n.containerPointToLatLng(this._centerPoint)), + 'center' !== n.options.touchZoom && + (this._pinchStartLatLng = n.containerPointToLatLng( + i.add(e)._divideBy(2), + )), + (this._startDist = i.distanceTo(e)), + (this._startZoom = n.getZoom()), + (this._moved = !1), + (this._zooming = !0), + n._stop(), + S(document, 'touchmove', this._onTouchMove, this), + S(document, 'touchend touchcancel', this._onTouchEnd, this), + B(t)); + }, + _onTouchMove: function (t) { + if (t.touches && 2 === t.touches.length && this._zooming) { + var i = this._map, + e = i.mouseEventToContainerPoint(t.touches[0]), + n = i.mouseEventToContainerPoint(t.touches[1]), + o = e.distanceTo(n) / this._startDist; + if ( + ((this._zoom = i.getScaleZoom(o, this._startZoom)), + !i.options.bounceAtZoomLimits && + ((this._zoom < i.getMinZoom() && o < 1) || + (this._zoom > i.getMaxZoom() && 1 < o)) && + (this._zoom = i._limitZoom(this._zoom)), + 'center' === i.options.touchZoom) + ) { + if (((this._center = this._startLatLng), 1 == o)) return; + } else { + e = e._add(n)._divideBy(2)._subtract(this._centerPoint); + if (1 == o && 0 === e.x && 0 === e.y) return; + this._center = i.unproject( + i.project(this._pinchStartLatLng, this._zoom).subtract(e), + this._zoom, + ); + } + this._moved || (i._moveStart(!0, !1), (this._moved = !0)), + r(this._animRequest); + n = a(i._move, i, this._center, this._zoom, { + pinch: !0, + round: !1, + }); + (this._animRequest = x(n, this, !0)), B(t); + } + }, + _onTouchEnd: function () { + this._moved && this._zooming + ? ((this._zooming = !1), + r(this._animRequest), + E(document, 'touchmove', this._onTouchMove, this), + E(document, 'touchend touchcancel', this._onTouchEnd, this), + this._map.options.zoomAnimation + ? this._map._animateZoom( + this._center, + this._map._limitZoom(this._zoom), + !0, + this._map.options.zoomSnap, + ) + : this._map._resetView( + this._center, + this._map._limitZoom(this._zoom), + )) + : (this._zooming = !1); + }, + })), + qe = + (A.addInitHook('addHandler', 'touchZoom', Bt), + (A.BoxZoom = _t), + (A.DoubleClickZoom = Ct), + (A.Drag = Zt), + (A.Keyboard = St), + (A.ScrollWheelZoom = kt), + (A.TapHold = Et), + (A.TouchZoom = Bt), + (t.Bounds = m), + (t.Browser = P), + (t.CRS = ot), + (t.Canvas = De), + (t.Circle = me), + (t.CircleMarker = pe), + (t.Class = it), + (t.Control = I), + (t.DivIcon = Be), + (t.DivOverlay = O), + (t.DomEvent = mt), + (t.DomUtil = pt), + (t.Draggable = Xi), + (t.Evented = et), + (t.FeatureGroup = he), + (t.GeoJSON = ve), + (t.GridLayer = Ae), + (t.Handler = n), + (t.Icon = le), + (t.ImageOverlay = Ce), + (t.LatLng = v), + (t.LatLngBounds = s), + (t.Layer = o), + (t.LayerGroup = ae), + (t.LineUtil = gt), + (t.Map = A), + (t.Marker = de), + (t.Mixin = ft), + (t.Path = _e), + (t.Point = p), + (t.PolyUtil = vt), + (t.Polygon = ge), + (t.Polyline = fe), + (t.Popup = ke), + (t.PosAnimation = Wi), + (t.Projection = wt), + (t.Rectangle = Ve), + (t.Renderer = Ne), + (t.SVG = Fe), + (t.SVGOverlay = Se), + (t.TileLayer = Ie), + (t.Tooltip = Ee), + (t.Transformation = at), + (t.Util = tt), + (t.VideoOverlay = Ze), + (t.bind = a), + (t.bounds = f), + (t.canvas = je), + (t.circle = function (t, i, e) { + return new me(t, i, e); + }), + (t.circleMarker = function (t, i) { + return new pe(t, i); + }), + (t.control = Fi), + (t.divIcon = function (t) { + return new Be(t); + }), + (t.extend = l), + (t.featureGroup = function (t, i) { + return new he(t, i); + }), + (t.geoJSON = Me), + (t.geoJson = zt), + (t.gridLayer = function (t) { + return new Ae(t); + }), + (t.icon = function (t) { + return new le(t); + }), + (t.imageOverlay = function (t, i, e) { + return new Ce(t, i, e); + }), + (t.latLng = w), + (t.latLngBounds = g), + (t.layerGroup = function (t, i) { + return new ae(t, i); + }), + (t.map = function (t, i) { + return new A(t, i); + }), + (t.marker = function (t, i) { + return new de(t, i); + }), + (t.point = _), + (t.polygon = function (t, i) { + return new ge(t, i); + }), + (t.polyline = function (t, i) { + return new fe(t, i); + }), + (t.popup = function (t, i) { + return new ke(t, i); + }), + (t.rectangle = function (t, i) { + return new Ve(t, i); + }), + (t.setOptions = c), + (t.stamp = h), + (t.svg = Ue), + (t.svgOverlay = function (t, i, e) { + return new Se(t, i, e); + }), + (t.tileLayer = Oe), + (t.tooltip = function (t, i) { + return new Ee(t, i); + }), + (t.transformation = ht), + (t.version = '1.8.0'), + (t.videoOverlay = function (t, i, e) { + return new Ze(t, i, e); + }), + window.L); + (t.noConflict = function () { + return (window.L = qe), this; + }), + (window.L = t); +}); +//# sourceMappingURL=leaflet.js.map diff --git a/public/resources/maplibre-gl-compat.js b/public/resources/maplibre-gl-compat.js index bb2d72a..93ae055 100644 --- a/public/resources/maplibre-gl-compat.js +++ b/public/resources/maplibre-gl-compat.js @@ -1,45 +1,40531 @@ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/LICENSE.txt */ /* https://github.com/acalcutt/maplibre-gl-js/tree/2.x_ie_compat */ (function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : -typeof define === 'function' && define.amd ? define(factory) : -(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory()); -})(this, (function () { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' + ? (module.exports = factory()) + : typeof define === 'function' && define.amd + ? define(factory) + : ((global = + typeof globalThis !== 'undefined' ? globalThis : global || self), + (global.maplibregl = factory())); +})(this, function () { + 'use strict'; -/* eslint-disable */ + /* eslint-disable */ -var shared, worker, maplibregl; -// define gets called three times: one for each chunk. we rely on the order -// they're imported to know which is which -function define(_, chunk) { + var shared, worker, maplibregl; + // define gets called three times: one for each chunk. we rely on the order + // they're imported to know which is which + function define(_, chunk) { if (!shared) { - shared = chunk; + shared = chunk; } else if (!worker) { - worker = chunk; + worker = chunk; } else { - var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' + var workerBundleString = + 'var sharedChunk = {}; (' + + shared + + ')(sharedChunk); (' + + worker + + ')(sharedChunk);'; - var sharedChunk = {}; - shared(sharedChunk); - maplibregl = chunk(sharedChunk); - if (typeof window !== 'undefined') { - maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); - } + var sharedChunk = {}; + shared(sharedChunk); + maplibregl = chunk(sharedChunk); + if (typeof window !== 'undefined') { + maplibregl.workerUrl = window.URL.createObjectURL( + new Blob([workerBundleString], { type: 'text/javascript' }), + ); + } } -} + } + define(['exports'], function (t) { + 'use strict'; + var e = r; + function r(t, e, r, n) { + (this.cx = 3 * t), + (this.bx = 3 * (r - t) - this.cx), + (this.ax = 1 - this.cx - this.bx), + (this.cy = 3 * e), + (this.by = 3 * (n - e) - this.cy), + (this.ay = 1 - this.cy - this.by), + (this.p1x = t), + (this.p1y = e), + (this.p2x = r), + (this.p2y = n); + } + function n(t, r, n, i) { + var a = new e(t, r, n, i); + return function (t) { + return a.solve(t); + }; + } + r.prototype = { + sampleCurveX: function (t) { + return ((this.ax * t + this.bx) * t + this.cx) * t; + }, + sampleCurveY: function (t) { + return ((this.ay * t + this.by) * t + this.cy) * t; + }, + sampleCurveDerivativeX: function (t) { + return (3 * this.ax * t + 2 * this.bx) * t + this.cx; + }, + solveCurveX: function (t, e) { + if ((void 0 === e && (e = 1e-6), t < 0)) return 0; + if (t > 1) return 1; + for (var r = t, n = 0; n < 8; n++) { + var i = this.sampleCurveX(r) - t; + if (Math.abs(i) < e) return r; + var a = this.sampleCurveDerivativeX(r); + if (Math.abs(a) < 1e-6) break; + r -= i / a; + } + var o = 0, + s = 1; + for ( + r = t, n = 0; + n < 20 && ((i = this.sampleCurveX(r)), !(Math.abs(i - t) < e)); + n++ + ) + t > i ? (o = r) : (s = r), (r = 0.5 * (s - o) + o); + return r; + }, + solve: function (t, e) { + return this.sampleCurveY(this.solveCurveX(t, e)); + }, + }; + var i = n(0.25, 0.1, 0.25, 1); + function a(t, e, r) { + return Math.min(r, Math.max(e, t)); + } + function o(t, e, r) { + var n = r - e, + i = ((((t - e) % n) + n) % n) + e; + return i === e ? r : i; + } + function s(t) { + for (var e = [], r = arguments.length - 1; r-- > 0; ) + e[r] = arguments[r + 1]; + for (var n = 0, i = e; n < i.length; n += 1) { + var a = i[n]; + for (var o in a) t[o] = a[o]; + } + return t; + } + var u = 1; + function l(t, e) { + t.forEach(function (t) { + e[t] && (e[t] = e[t].bind(e)); + }); + } + function p(t, e) { + return -1 !== t.indexOf(e, t.length - e.length); + } + function c(t, e, r) { + var n = {}; + for (var i in t) n[i] = e.call(r || this, t[i], i, t); + return n; + } + function h(t, e, r) { + var n = {}; + for (var i in t) e.call(r || this, t[i], i, t) && (n[i] = t[i]); + return n; + } + function f(t) { + return Array.isArray(t) + ? t.map(f) + : 'object' == typeof t && t + ? c(t, f) + : t; + } + var y = {}; + function d(t) { + y[t] || ('undefined' != typeof console && console.warn(t), (y[t] = !0)); + } + function m(t, e, r) { + return (r.y - t.y) * (e.x - t.x) > (e.y - t.y) * (r.x - t.x); + } + function v(t) { + for ( + var e = 0, r = 0, n = t.length, i = n - 1, a = void 0, o = void 0; + r < n; + i = r++ + ) + e += ((o = t[i]).x - (a = t[r]).x) * (a.y + o.y); + return e; + } + function g() { + return ( + 'undefined' != typeof WorkerGlobalScope && + 'undefined' != typeof self && + self instanceof WorkerGlobalScope + ); + } + function x(t) { + var e = {}; + if ( + (t.replace( + /(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, + function (t, r, n, i) { + var a = n || i; + return (e[r] = !a || a.toLowerCase()), ''; + }, + ), + e['max-age']) + ) { + var r = parseInt(e['max-age'], 10); + isNaN(r) ? delete e['max-age'] : (e['max-age'] = r); + } + return e; + } + var b = null; + function w(t) { + if (null == b) { + var e = t.navigator ? t.navigator.userAgent : null; + b = + !!t.safari || + !( + !e || + !( + /\b(iPad|iPhone|iPod)\b/.test(e) || + (e.match('Safari') && !e.match('Chrome')) + ) + ); + } + return b; + } + function _(t) { + return 'undefined' != typeof ImageBitmap && t instanceof ImageBitmap; + } + var A, + k, + S = { + now: + 'undefined' != typeof performance && performance && performance.now + ? performance.now.bind(performance) + : Date.now.bind(Date), + frame: function (t) { + var e = requestAnimationFrame(t); + return { + cancel: function () { + return cancelAnimationFrame(e); + }, + }; + }, + getImageData: function (t, e) { + void 0 === e && (e = 0); + var r = window.document.createElement('canvas'), + n = r.getContext('2d'); + if (!n) throw new Error('failed to create canvas 2d context'); + return ( + (r.width = t.width), + (r.height = t.height), + n.drawImage(t, 0, 0, t.width, t.height), + n.getImageData(-e, -e, t.width + 2 * e, t.height + 2 * e) + ); + }, + resolveURL: function (t) { + return A || (A = document.createElement('a')), (A.href = t), A.href; + }, + hardwareConcurrency: + ('undefined' != typeof navigator && navigator.hardwareConcurrency) || + 4, + get prefersReducedMotion() { + return ( + !!matchMedia && + (null == k && (k = matchMedia('(prefers-reduced-motion: reduce)')), + k.matches) + ); + }, + }, + I = M; + function M(t, e) { + (this.x = t), (this.y = e); + } + function z(t) { + var e = this.constructor; + return this.then( + function (r) { + return e.resolve(t()).then(function () { + return r; + }); + }, + function (r) { + return e.resolve(t()).then(function () { + return e.reject(r); + }); + }, + ); + } + function P(t) { + return new this(function (e, r) { + if (!t || void 0 === t.length) + return r( + new TypeError( + typeof t + + ' ' + + t + + ' is not iterable(cannot read property Symbol(Symbol.iterator))', + ), + ); + var n = Array.prototype.slice.call(t); + if (0 === n.length) return e([]); + var i = n.length; + function a(t, r) { + if (r && ('object' == typeof r || 'function' == typeof r)) { + var o = r.then; + if ('function' == typeof o) + return void o.call( + r, + function (e) { + a(t, e); + }, + function (r) { + (n[t] = { status: 'rejected', reason: r }), 0 == --i && e(n); + }, + ); + } + (n[t] = { status: 'fulfilled', value: r }), 0 == --i && e(n); + } + for (var o = 0; o < n.length; o++) a(o, n[o]); + }); + } + (M.prototype = { + clone: function () { + return new M(this.x, this.y); + }, + add: function (t) { + return this.clone()._add(t); + }, + sub: function (t) { + return this.clone()._sub(t); + }, + multByPoint: function (t) { + return this.clone()._multByPoint(t); + }, + divByPoint: function (t) { + return this.clone()._divByPoint(t); + }, + mult: function (t) { + return this.clone()._mult(t); + }, + div: function (t) { + return this.clone()._div(t); + }, + rotate: function (t) { + return this.clone()._rotate(t); + }, + rotateAround: function (t, e) { + return this.clone()._rotateAround(t, e); + }, + matMult: function (t) { + return this.clone()._matMult(t); + }, + unit: function () { + return this.clone()._unit(); + }, + perp: function () { + return this.clone()._perp(); + }, + round: function () { + return this.clone()._round(); + }, + mag: function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }, + equals: function (t) { + return this.x === t.x && this.y === t.y; + }, + dist: function (t) { + return Math.sqrt(this.distSqr(t)); + }, + distSqr: function (t) { + var e = t.x - this.x, + r = t.y - this.y; + return e * e + r * r; + }, + angle: function () { + return Math.atan2(this.y, this.x); + }, + angleTo: function (t) { + return Math.atan2(this.y - t.y, this.x - t.x); + }, + angleWith: function (t) { + return this.angleWithSep(t.x, t.y); + }, + angleWithSep: function (t, e) { + return Math.atan2(this.x * e - this.y * t, this.x * t + this.y * e); + }, + _matMult: function (t) { + var e = t[2] * this.x + t[3] * this.y; + return (this.x = t[0] * this.x + t[1] * this.y), (this.y = e), this; + }, + _add: function (t) { + return (this.x += t.x), (this.y += t.y), this; + }, + _sub: function (t) { + return (this.x -= t.x), (this.y -= t.y), this; + }, + _mult: function (t) { + return (this.x *= t), (this.y *= t), this; + }, + _div: function (t) { + return (this.x /= t), (this.y /= t), this; + }, + _multByPoint: function (t) { + return (this.x *= t.x), (this.y *= t.y), this; + }, + _divByPoint: function (t) { + return (this.x /= t.x), (this.y /= t.y), this; + }, + _unit: function () { + return this._div(this.mag()), this; + }, + _perp: function () { + var t = this.y; + return (this.y = this.x), (this.x = -t), this; + }, + _rotate: function (t) { + var e = Math.cos(t), + r = Math.sin(t), + n = r * this.x + e * this.y; + return (this.x = e * this.x - r * this.y), (this.y = n), this; + }, + _rotateAround: function (t, e) { + var r = Math.cos(t), + n = Math.sin(t), + i = e.y + n * (this.x - e.x) + r * (this.y - e.y); + return ( + (this.x = e.x + r * (this.x - e.x) - n * (this.y - e.y)), + (this.y = i), + this + ); + }, + _round: function () { + return ( + (this.x = Math.round(this.x)), (this.y = Math.round(this.y)), this + ); + }, + }), + (M.convert = function (t) { + return t instanceof M ? t : Array.isArray(t) ? new M(t[0], t[1]) : t; + }); + var B = setTimeout, + C = 'undefined' != typeof setImmediate ? setImmediate : null; + function E(t) { + return Boolean(t && void 0 !== t.length); + } + function V() {} + function T(t) { + if (!(this instanceof T)) + throw new TypeError('Promises must be constructed via new'); + if ('function' != typeof t) throw new TypeError('not a function'); + (this._state = 0), + (this._handled = !1), + (this._value = void 0), + (this._deferreds = []), + R(t, this); + } + function F(t, e) { + for (; 3 === t._state; ) t = t._value; + 0 !== t._state + ? ((t._handled = !0), + T._immediateFn(function () { + var r = 1 === t._state ? e.onFulfilled : e.onRejected; + if (null !== r) { + var n; + try { + n = r(t._value); + } catch (t) { + return void L(e.promise, t); + } + O(e.promise, n); + } else (1 === t._state ? O : L)(e.promise, t._value); + })) + : t._deferreds.push(e); + } + function O(t, e) { + try { + if (e === t) + throw new TypeError('A promise cannot be resolved with itself.'); + if (e && ('object' == typeof e || 'function' == typeof e)) { + var r = e.then; + if (e instanceof T) return (t._state = 3), (t._value = e), void D(t); + if ('function' == typeof r) + return void R( + ((n = r), + (i = e), + function () { + n.apply(i, arguments); + }), + t, + ); + } + (t._state = 1), (t._value = e), D(t); + } catch (e) { + L(t, e); + } + var n, i; + } + function L(t, e) { + (t._state = 2), (t._value = e), D(t); + } + function D(t) { + 2 === t._state && + 0 === t._deferreds.length && + T._immediateFn(function () { + t._handled || T._unhandledRejectionFn(t._value); + }); + for (var e = 0, r = t._deferreds.length; e < r; e++) + F(t, t._deferreds[e]); + t._deferreds = null; + } + function j(t, e, r) { + (this.onFulfilled = 'function' == typeof t ? t : null), + (this.onRejected = 'function' == typeof e ? e : null), + (this.promise = r); + } + function R(t, e) { + var r = !1; + try { + t( + function (t) { + r || ((r = !0), O(e, t)); + }, + function (t) { + r || ((r = !0), L(e, t)); + }, + ); + } catch (t) { + if (r) return; + (r = !0), L(e, t); + } + } + (T.prototype.catch = function (t) { + return this.then(null, t); + }), + (T.prototype.then = function (t, e) { + var r = new this.constructor(V); + return F(this, new j(t, e, r)), r; + }), + (T.prototype.finally = z), + (T.all = function (t) { + return new T(function (e, r) { + if (!E(t)) return r(new TypeError('Promise.all accepts an array')); + var n = Array.prototype.slice.call(t); + if (0 === n.length) return e([]); + var i = n.length; + function a(t, o) { + try { + if (o && ('object' == typeof o || 'function' == typeof o)) { + var s = o.then; + if ('function' == typeof s) + return void s.call( + o, + function (e) { + a(t, e); + }, + r, + ); + } + (n[t] = o), 0 == --i && e(n); + } catch (t) { + r(t); + } + } + for (var o = 0; o < n.length; o++) a(o, n[o]); + }); + }), + (T.allSettled = P), + (T.resolve = function (t) { + return t && 'object' == typeof t && t.constructor === T + ? t + : new T(function (e) { + e(t); + }); + }), + (T.reject = function (t) { + return new T(function (e, r) { + r(t); + }); + }), + (T.race = function (t) { + return new T(function (e, r) { + if (!E(t)) return r(new TypeError('Promise.race accepts an array')); + for (var n = 0, i = t.length; n < i; n++) T.resolve(t[n]).then(e, r); + }); + }), + (T._immediateFn = + ('function' == typeof C && + function (t) { + C(t); + }) || + function (t) { + B(t, 0); + }), + (T._unhandledRejectionFn = function (t) { + 'undefined' != typeof console && + console && + console.warn('Possible Unhandled Promise Rejection:', t); + }); + var U, + q = (function () { + if ('undefined' != typeof self) return self; + if ('undefined' != typeof window) return window; + if ('undefined' != typeof global) return global; + throw new Error('unable to locate global object'); + })(); + 'function' != typeof q.Promise + ? (q.Promise = T) + : (q.Promise.prototype.finally || (q.Promise.prototype.finally = z), + q.Promise.allSettled || (q.Promise.allSettled = P)), + self.fetch || + (self.fetch = function (t, e) { + return ( + (e = e || {}), + new Promise(function (r, n) { + var i = new XMLHttpRequest(), + a = [], + o = [], + s = {}, + u = function () { + return { + ok: 2 == ((i.status / 100) | 0), + statusText: i.statusText, + status: i.status, + url: i.responseURL, + text: function () { + return Promise.resolve(i.responseText); + }, + json: function () { + return Promise.resolve(i.responseText).then(JSON.parse); + }, + blob: function () { + return Promise.resolve(new Blob([i.response])); + }, + clone: u, + headers: { + keys: function () { + return a; + }, + entries: function () { + return o; + }, + get: function (t) { + return s[t.toLowerCase()]; + }, + has: function (t) { + return t.toLowerCase() in s; + }, + }, + }; + }; + for (var l in (i.open(e.method || 'get', t, !0), + (i.onload = function () { + i + .getAllResponseHeaders() + .replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (t, e, r) { + a.push((e = e.toLowerCase())), + o.push([e, r]), + (s[e] = s[e] ? s[e] + ',' + r : r); + }), + r(u()); + }), + (i.onerror = n), + (i.withCredentials = 'include' == e.credentials), + e.headers)) + i.setRequestHeader(l, e.headers[l]); + i.send(e.body || null); + }) + ); + }), + (U = function () { + function t(t, e) { + if (!(t instanceof e)) + throw new TypeError('Cannot call a class as a function'); + } + function e(t, e) { + for (var r = 0; r < e.length; r++) { + var n = e[r]; + (n.enumerable = n.enumerable || !1), + (n.configurable = !0), + 'value' in n && (n.writable = !0), + Object.defineProperty(t, n.key, n); + } + } + function r(t, r, n) { + return r && e(t.prototype, r), n && e(t, n), t; + } + function n(t) { + return ( + (n = Object.setPrototypeOf + ? Object.getPrototypeOf + : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }), + n(t) + ); + } + function i(t, e) { + return ( + (i = + Object.setPrototypeOf || + function (t, e) { + return (t.__proto__ = e), t; + }), + i(t, e) + ); + } + function a(t) { + if (void 0 === t) + throw new ReferenceError( + "this hasn't been initialised - super() hasn't been called", + ); + return t; + } + function o(t, e) { + return !e || ('object' != typeof e && 'function' != typeof e) + ? a(t) + : e; + } + function s(t, e, r) { + return ( + (s = + 'undefined' != typeof Reflect && Reflect.get + ? Reflect.get + : function (t, e, r) { + var i = (function (t, e) { + for ( + ; + !Object.prototype.hasOwnProperty.call(t, e) && + null !== (t = n(t)); -define(["exports"],(function(t){"use strict";var e=r;function r(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}function n(t,r,n,i){var a=new e(t,r,n,i);return function(t){return a.solve(t)}}r.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?o=r:s=r,r=.5*(s-o)+o;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var i=n(.25,.1,.25,1);function a(t,e,r){return Math.min(r,Math.max(e,t))}function o(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function s(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n(e.y-t.y)*(r.x-t.x)}function v(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r;}return e}var b=null;function w(t){if(null==b){var e=t.navigator?t.navigator.userAgent:null;b=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")));}return b}function _(t){return "undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}var A,k,S={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame:function(t){var e=requestAnimationFrame(t);return {cancel:function(){return cancelAnimationFrame(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=window.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return A||(A=document.createElement("a")),A.href=t,A.href},hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==k&&(k=matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}},I=M;function M(t,e){this.x=t,this.y=e;}function z(t){var e=this.constructor;return this.then((function(r){return e.resolve(t()).then((function(){return r}))}),(function(r){return e.resolve(t()).then((function(){return e.reject(r)}))}))}function P(t){return new this((function(e,r){if(!t||void 0===t.length)return r(new TypeError(typeof t+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(t);if(0===n.length)return e([]);var i=n.length;function a(t,r){if(r&&("object"==typeof r||"function"==typeof r)){var o=r.then;if("function"==typeof o)return void o.call(r,(function(e){a(t,e);}),(function(r){n[t]={status:"rejected",reason:r},0==--i&&e(n);}))}n[t]={status:"fulfilled",value:r},0==--i&&e(n);}for(var o=0;o=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"));}else {var i=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new it(r.status,r.statusText,t.url,i));}},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},pt=function(t,e){return lt(s(t,{type:"arrayBuffer"}),e)},ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";st=[],ut=0;var ht=function(t,e){if(Q.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),ut>=K.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0;}};return st.push(r),r}ut++;var n=!1,i=function(){if(!n)for(n=!0,ut--;st.length&&ut0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},vt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var gt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},xt=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);};function bt(t){var e=t.value;return e?[new xt(t.key,e,"constants have been deprecated as of v8")]:[]}function wt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var jt=[It,Mt,zt,Pt,Bt,Tt,Ct,Lt(Et),Ft,Ot];function Rt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Rt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=jt;r255?255:t}function Gt(t){return Kt("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Jt(t){return (e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e;}function Xt(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{Nt={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in Zt)return Zt[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf("("),i=r.indexOf(")");if(-1!==n&&i+1===r.length){var a=r.substr(0,n),o=r.substr(n+1,i-(n+1)).split(","),s=1;switch(a){case"rgba":if(4!==o.length)return null;s=Jt(o.pop());case"rgb":return 3!==o.length?null:[Gt(o[0]),Gt(o[1]),Gt(o[2]),s];case"hsla":if(4!==o.length)return null;s=Jt(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=Jt(o[1]),p=Jt(o[2]),c=p<=.5?p*(l+1):p+l-p*l,h=2*p-c;return [Kt(255*Xt(h,c,u+1/3)),Kt(255*Xt(h,c,u)),Kt(255*Xt(h,c,u-1/3)),s];default:return null}}return null};}catch(t){}var Yt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n;};Yt.parse=function(t){if(t){if(t instanceof Yt)return t;if("string"==typeof t){var e=Nt(t);if(e)return new Yt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Yt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return "rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},Yt.prototype.toArray=function(){var t=this,e=t.a;return 0===e?[0,0,0,0]:[255*t.r/e,255*t.g/e,255*t.b/e,e]},Yt.black=new Yt(0,0,0,1),Yt.white=new Yt(1,1,1,1),Yt.transparent=new Yt(0,0,0,0),Yt.red=new Yt(1,0,0,1);var Ht=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});};Ht.prototype.compare=function(t,e){return this.collator.compare(t,e)},Ht.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var Wt=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;},$t=function(t){this.sections=t;};$t.fromString=function(t){return new $t([new Wt(t,null,null,null,null)])},$t.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},$t.factory=function(t){return t instanceof $t?t:$t.fromString(t)},$t.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")};var Qt=function(t){this.values=t.slice();};Qt.parse=function(t){if(t instanceof Qt)return t;if("number"==typeof t)return new Qt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(var e=0,r=t;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function re(t){if(null===t)return !0;if("string"==typeof t)return !0;if("boolean"==typeof t)return !0;if("number"==typeof t)return !0;if(t instanceof Yt)return !0;if(t instanceof Ht)return !0;if(t instanceof $t)return !0;if(t instanceof Qt)return !0;if(t instanceof te)return !0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in se)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=se[s],n++;}else a=Et;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++;}r=Lt(a,o);}else {if(!se[i])throw new Error("Types doesn't contain name = "+i);r=se[i];}for(var u=[];n4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ee(e[0],e[1],e[2],e[3])))return new Yt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new oe(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}if("padding"===this.type.kind){for(var o,s=0,u=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ge(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*de),Math.round(n*i*de)]}function xe(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function be(t,e){for(var r,n,i,a,o,s,u,l=!1,p=0,c=e.length;p0&&s<0||o<0&&s>0}function Ae(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===a&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a;}me(e,t);}function Pe(t,e,r,n){for(var i=Math.pow(2,n.z)*de,a=[n.x*de,n.y*de],o=[],s=0,u=t;s=0)return !1;var r=!0;return t.eachChild((function(t){r&&!Te(t,e)&&(r=!1);})),r}Ce.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(re(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new oe("Input is not a number.");a=o-1;}return 0}Oe.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},Oe.prototype._parse=function(t,e){function r(t,e,r){return "assert"===r?new ue(e,[t]):"coerce"===r?new pe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var a=i.parse(t,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("padding"!==o.kind||"value"!==s.kind&&"number"!==s.kind&&"array"!==s.kind){if(this.checkSubtype(o,s))return null}else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"assert");}if(!(a instanceof ae)&&"resolvedImage"!==a.type.kind&&Le(a)){var u=new he;try{a=new ae(a.type,a.evaluate(u));}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Oe.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Oe(this.registry,n,e||null,i,this.errors)},Oe.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return "["+t+"]"})).join("");this.errors.push(new kt(n,t));},Oe.prototype.checkSubtype=function(t,e){var r=Rt(t,e);return r&&this.error(r),r};var je=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var p=e.parse(s,l,i);if(!p)return null;i=i||p.type,n.push([o,p]);}return new je(i,r,n)},je.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[De(e,n)].evaluate(t)},je.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e.008856451679035631?Math.pow(t,1/3):t/Ge+Ze}function He(t){return t>Ke?t*t*t:Ge*(t-Ze)}function We(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $e(t){return (t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qe(t){var e=$e(t.r),r=$e(t.g),n=$e(t.b),i=Ye((.4124564*e+.3575761*r+.1804375*n)/qe),a=Ye((.2126729*e+.7151522*r+.072175*n)/1);return {l:116*a-16,a:500*(i-a),b:200*(a-Ye((.0193339*e+.119192*r+.9503041*n)/Ne)),alpha:t.a}}function tr(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*He(e),r=qe*He(r),n=Ne*He(n),new Yt(We(3.2404542*r-1.5371385*e-.4985314*n),We(-.969266*r+1.8760108*e+.041556*n),We(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function er(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var rr={forward:Qe,reverse:tr,interpolate:function(t,e,r){return {l:Re(t.l,e.l,r),a:Re(t.a,e.a,r),b:Re(t.b,e.b,r),alpha:Re(t.alpha,e.alpha,r)}}},nr={forward:function(t){var e=Qe(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*Xe;return {h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*Je,r=t.c;return tr({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return {h:er(t.h,e.h,r),c:Re(t.c,e.c,r),l:Re(t.l,e.l,r),alpha:Re(t.alpha,e.alpha,r)}}},ir=Object.freeze({__proto__:null,lab:rr,hcl:nr}),ar=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var a=0,o=i;a1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s};}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Mt)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=Bt:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var p=0;p=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var d=e.parse(h,y,l);if(!d)return null;l=l||d.type,u.push([c,d]);}return "number"===l.kind||"color"===l.kind||"padding"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new ar(l,r,n,i,u):e.error("Type "+Dt(l)+" is not interpolatable.")},ar.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var a=De(e,n),o=ar.interpolationFactor(this.interpolation,n,e[a],e[a+1]),s=r[a].evaluate(t),u=r[a+1].evaluate(t);return "interpolate"===this.operator?Ue[this.type.kind.toLowerCase()](s,u,o):"interpolate-hcl"===this.operator?nr.reverse(nr.interpolate(nr.forward(s),nr.forward(u),o)):rr.reverse(rr.interpolate(rr.forward(s),rr.forward(u),o))},ar.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new oe("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new oe("Array index must be an integer, but found "+e+" instead.");return r[e]},lr.prototype.eachChild=function(t){t(this.index),t(this.input);},lr.prototype.outputDefined=function(){return !1};var pr=function(t,e){this.type=Pt,this.needle=t,this.haystack=e;};pr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Et),n=e.parse(t[2],2,Et);return r&&n?Ut(r.type,[Pt,zt,Mt,It,Et])?new pr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Dt(r.type)+" instead"):null},pr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!qt(e,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found "+Dt(ne(e))+" instead.");if(!qt(r,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found "+Dt(ne(r))+" instead.");return r.indexOf(e)>=0},pr.prototype.eachChild=function(t){t(this.needle),t(this.haystack);},pr.prototype.outputDefined=function(){return !0};var cr=function(t,e,r){this.type=Mt,this.needle=t,this.haystack=e,this.fromIndex=r;};cr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Et),n=e.parse(t[2],2,Et);if(!r||!n)return null;if(!Ut(r.type,[Pt,zt,Mt,It,Et]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Dt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Mt);return i?new cr(r,n,i):null}return new cr(r,n)},cr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!qt(e,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found "+Dt(ne(e))+" instead.");if(!qt(r,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found "+Dt(ne(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},cr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);},cr.prototype.outputDefined=function(){return !1};var hr=function(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a;};hr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},a=[],o=2;oNumber.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,ne(h)))return null}else r=ne(h);if(void 0!==i[String(h)])return l.error("Branch labels must be unique.");i[String(h)]=a.length;}var f=e.parse(u,o,n);if(!f)return null;n=n||f.type,a.push(f);}var y=e.parse(t[1],1,Et);if(!y)return null;var d=e.parse(t[t.length-1],t.length-1,n);return d?"value"!==y.type.kind&&e.concat(1).checkSubtype(r,y.type)?null:new hr(r,n,y,i,a,d):null},hr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return (ne(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},hr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);},hr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()};var fr=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r;};fr.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var n=[],i=1;i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Et),n=e.parse(t[2],2,Mt);if(!r||!n)return null;if(!Ut(r.type,[Lt(Et),zt,Et]))return e.error("Expected first argument to be of type array or string, but found "+Dt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Mt);return i?new yr(r.type,r,n,i):null}return new yr(r.type,r,n)},yr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!qt(e,["string","array"]))throw new oe("Expected first argument to be of type array or string, but found "+Dt(ne(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},yr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);},yr.prototype.outputDefined=function(){return !1};var gr=vr("==",(function(t,e,r){return e===r}),mr),xr=vr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !mr(0,e,r,n)})),br=vr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),_r=vr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ar=vr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),kr=function(t,e,r,n,i){this.type=zt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;};kr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Mt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,zt)))return null;var a=null;if(n.currency&&!(a=e.parse(n.currency,1,zt)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Mt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Mt))?null:new kr(r,i,a,o,s)},kr.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},kr.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);},kr.prototype.outputDefined=function(){return !1};var Sr=function(t){this.type=Tt,this.sections=t;};Sr.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,a=1;a<=t.length-1;++a){var o=t[a];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Mt)))return null;var u=null;if(o["text-font"]&&!(u=e.parse(o["text-font"],1,Lt(zt))))return null;var l=null;if(o["text-color"]&&!(l=e.parse(o["text-color"],1,Bt)))return null;var p=n[n.length-1];p.scale=s,p.font=u,p.textColor=l;}else {var c=e.parse(t[a],1,Et);if(!c)return null;var h=c.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:c,scale:null,font:null,textColor:null});}}return new Sr(n)},Sr.prototype.evaluate=function(t){return new $t(this.sections.map((function(e){var r=e.content.evaluate(t);return ne(r)===Ot?new Wt("",r,null,null,null):new Wt(ie(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},Sr.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},Ir.prototype.eachChild=function(t){t(this.input);},Ir.prototype.outputDefined=function(){return !1};var Mr=function(t){this.type=Mt,this.input=t;};Mr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Dt(r.type)+" instead."):new Mr(r):null},Mr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new oe("Expected value to be of type string or array, but found "+Dt(ne(e))+" instead.")},Mr.prototype.eachChild=function(t){t(this.input);},Mr.prototype.outputDefined=function(){return !1};var zr={"==":gr,"!=":xr,">":wr,"<":br,">=":Ar,"<=":_r,array:ue,at:lr,boolean:ue,case:fr,coalesce:sr,collator:ye,format:Sr,image:Ir,in:pr,"index-of":cr,interpolate:ar,"interpolate-hcl":ar,"interpolate-lab":ar,length:Mr,let:ur,literal:ae,match:hr,number:ue,"number-format":kr,object:ue,slice:yr,step:je,string:ue,"to-boolean":pe,"to-color":pe,"to-number":pe,"to-string":pe,var:Fe,within:Ce};function Pr(t,e){var r=e[0],n=e[1],i=e[2],a=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var o=a?a.evaluate(t):1,s=ee(r,n,i,o);if(s)throw new oe(s);return new Yt(r/255*o,n/255*o,i/255*o,o)}function Br(t,e){return t in e}function Cr(t,e){var r=e[t];return void 0===r?null:r}function Er(t){return {type:t}}function Vr(t){return {result:"success",value:t}}function Tr(t){return {result:"error",value:t}}function Fr(t){return "data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Or(t){return !!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Lr(t){return !!t.expression&&t.expression.interpolated}function Dr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function jr(t){return "object"==typeof t&&null!==t&&!Array.isArray(t)}function Rr(t){return t}function Ur(t,e){var r,n,i,a="color"===e.type,o=t.stops&&"object"==typeof t.stops[0][0],s=o||!(o||void 0!==t.property),u=t.type||(Lr(e)?"exponential":"interval");if(a||"padding"===e.type){var l=a?Yt.parse:Qt.parse;(t=wt({},t)).stops&&(t.stops=t.stops.map((function(t){return [t[0],l(t[1])]}))),t.default=l(t.default?t.default:e.default);}if(t.colorSpace&&"rgb"!==t.colorSpace&&!ir[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);if("exponential"===u)r=Kr;else if("interval"===u)r=Zr;else if("categorical"===u){r=Nr,n=Object.create(null);for(var p=0,c=t.stops;p=t.stops[n-1][0])return t.stops[n-1][1];var i=De(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Kr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Dr(r))return qr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var a=De(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],u=t.stops[a+1][1],l=Ue[e.type]||Rr;if(t.colorSpace&&"rgb"!==t.colorSpace){var p=ir[t.colorSpace];l=function(t,e){return p.reverse(p.interpolate(p.forward(t),p.forward(e),o))};}return "function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return l(r,n,o)}}:l(s,u,o)}function Gr(t,e,r){switch(e.type){case"color":r=Yt.parse(r);break;case"formatted":r=$t.fromString(r.toString());break;case"resolvedImage":r=te.fromString(r.toString());break;case"padding":r=Qt.parse(r);break;default:Dr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0);}return qr(r,t.default,e.default)}fe.register(zr,{error:[{kind:"error"},[zt],function(t,e){throw new oe(e[0].evaluate(t))}],typeof:[zt,[Et],function(t,e){return Dt(ne(e[0].evaluate(t)))}],"to-rgba":[Lt(Mt,4),[Bt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Bt,[Mt,Mt,Mt],Pr],rgba:[Bt,[Mt,Mt,Mt,Mt],Pr],has:{type:Pt,overloads:[[[zt],function(t,e){return Br(e[0].evaluate(t),t.properties())}],[[zt,Ct],function(t,e){var r=e[1];return Br(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Et,overloads:[[[zt],function(t,e){return Cr(e[0].evaluate(t),t.properties())}],[[zt,Ct],function(t,e){var r=e[1];return Cr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Et,[zt],function(t,e){return Cr(e[0].evaluate(t),t.featureState||{})}],properties:[Ct,[],function(t){return t.properties()}],"geometry-type":[zt,[],function(t){return t.geometryType()}],id:[Et,[],function(t){return t.id()}],zoom:[Mt,[],function(t){return t.globals.zoom}],"heatmap-density":[Mt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Mt,[],function(t){return t.globals.lineProgress||0}],accumulated:[Et,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Mt,Er(Mt),function(t,e){for(var r=0,n=0,i=e;n":[Pt,[zt,Et],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[Pt,[Et],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Pt,[zt,Et],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[Pt,[Et],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Pt,[zt,Et],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[Pt,[Et],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Pt,[Et],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Pt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Pt,[Lt(zt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Pt,[Lt(Et)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Pt,[zt,Lt(Et)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Pt,[zt,Lt(Et)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Pt,overloads:[[[Pt,Pt],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Er(Pt),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in zr}function Yr(t,e){var r=new Oe(zr,[],e?function(t){var e={color:Bt,string:zt,number:Mt,enum:zt,boolean:Pt,formatted:Tt,padding:Ft,resolvedImage:Ot};return "array"===t.type?Lt(e[t.value]||Et,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Vr(new Jr(n,e)):Tr(r.errors)}Jr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)},Jr.prototype.evaluate=function(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new oe("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Hr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ve(e.expression);};Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Hr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)};var Wr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ve(e.expression),this.interpolationType=n;};function $r(t,e){var r=Yr(t,e);if("error"===r.result)return r;var n=r.value.expression,i=Ee(n);if(!i&&!Fr(e))return Tr([new kt("","data expressions not supported")]);var a=Te(n,["zoom"]);if(!a&&!Or(e))return Tr([new kt("","zoom expressions not supported")]);var o=tn(n);return o||a?o instanceof kt?Tr([o]):o instanceof ar&&!Lr(e)?Tr([new kt("",'"interpolate" expressions cannot be used with this property')]):Vr(o?new Wr(i?"camera":"composite",r.value,o.labels,o instanceof ar?o.interpolation:void 0):new Hr(i?"constant":"source",r.value)):Tr([new kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Wr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Wr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)},Wr.prototype.interpolationFactor=function(t,e,r){return this.interpolationType?ar.interpolationFactor(this.interpolationType,t,e,r):0};var Qr=function(t,e){this._parameters=t,this._specification=e,wt(this,Ur(this._parameters,this._specification));};function tn(t){var e=null;if(t instanceof ur)e=tn(t.result);else if(t instanceof sr)for(var r=0,n=t.args;rn.maximum?[new xt(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function an(t){var e,r,n,i=t.valueSpec,a=_t(t.value.type),o={},s="categorical"!==a&&void 0===t.value.property,u=!s,l="array"===Dr(t.value.stops)&&"array"===Dr(t.value.stops[0])&&"object"===Dr(t.value.stops[0][0]),p=en({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===a)return [new xt(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(rn({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===Dr(r)&&0===r.length&&e.push(new xt(t.key,r,"array must have at least one stop")),e},default:function(t){return Bn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return "identity"===a&&s&&p.push(new xt(t.key,t.value,'missing required property "property"')),"identity"===a||t.value.stops||p.push(new xt(t.key,t.value,'missing required property "stops"')),"exponential"===a&&t.valueSpec.expression&&!Lr(t.valueSpec)&&p.push(new xt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!Fr(t.valueSpec)?p.push(new xt(t.key,t.value,"property functions not supported")):s&&!Or(t.valueSpec)&&p.push(new xt(t.key,t.value,"zoom functions not supported"))),"categorical"!==a&&!l||void 0!==t.value.property||p.push(new xt(t.key,t.value,'"property" property is required')),p;function c(t){var e=[],a=t.value,s=t.key;if("array"!==Dr(a))return [new xt(s,a,"array expected, "+Dr(a)+" found")];if(2!==a.length)return [new xt(s,a,"array length 2 expected, length "+a.length+" found")];if(l){if("object"!==Dr(a[0]))return [new xt(s,a,"object expected, "+Dr(a[0])+" found")];if(void 0===a[0].zoom)return [new xt(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return [new xt(s,a,"object stop key must have value")];if(n&&n>_t(a[0].zoom))return [new xt(s,a[0].zoom,"stop zoom values must appear in ascending order")];_t(a[0].zoom)!==n&&(n=_t(a[0].zoom),r=void 0,o={}),e=e.concat(en({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:nn,value:h}}));}else e=e.concat(h({key:s+"[0]",value:a[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},a));return Xr(At(a[1]))?e.concat([new xt(s+"[1]",a[1],"expressions are not allowed in function stops.")]):e.concat(Bn({key:s+"[1]",value:a[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=Dr(t.value),u=_t(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return [new xt(t.key,l,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return [new xt(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var p="number expected, "+s+" found";return Fr(i)&&void 0===a&&(p+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new xt(t.key,l,p)]}return "categorical"!==a||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==a&&"number"===s&&void 0!==r&&u=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return !1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function hn(t){if(!Array.isArray(t))return !1;if("within"===t[0])return !0;for(var e=1;e"===r||"<="===r||">="===r?yn(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(fn))):"all"===r?["all"].concat(t.slice(1).map(fn)):"none"===r?["all"].concat(t.slice(1).map(fn).map(vn)):"in"===r?dn(t[1],t.slice(2)):"!in"===r?vn(dn(t[1],t.slice(2))):"has"===r?mn(t[1]):"!has"===r?vn(mn(t[1])):"within"!==r||t}function yn(t,e,r){switch(t){case"$type":return ["filter-type-"+r,e];case"$id":return ["filter-id-"+r,e];default:return ["filter-"+r,t,e]}}function dn(t,e){if(0===e.length)return !1;switch(t){case"$type":return ["filter-type-in",["literal",e]];case"$id":return ["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(cn)]]:["filter-in-small",t,["literal",e]]}}function mn(t){switch(t){case"$type":return !0;case"$id":return ["filter-has-id"];default:return ["filter-has",t]}}function vn(t){return ["!",t]}function gn(t){return un(At(t.value))?on(wt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xn(t)}function xn(t){var e=t.value,r=t.key;if("array"!==Dr(e))return [new xt(r,e,"array expected, "+Dr(e)+" found")];var n,i=t.styleSpec,a=[];if(e.length<1)return [new xt(r,e,"filter array must have at least 1 element")];switch(a=a.concat(sn({key:r+"[0]",value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),_t(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===_t(e[1])&&a.push(new xt(r,e,'"$type" cannot be use with operator "'+e[0]+'"'));case"==":case"!=":3!==e.length&&a.push(new xt(r,e,'filter array for operator "'+e[0]+'" must have 3 elements'));case"in":case"!in":e.length>=2&&"string"!==(n=Dr(e[1]))&&a.push(new xt(r+"[1]",e[1],"string expected, "+n+" found"));for(var o=2;o4)return [new xt(e,r,"padding requires 1 to 4 values; "+r.length+" values found")];for(var n={type:"number"},i=[],a=0;a=p[f+0]&&n>=p[f+1])?(o[h]=!0,a.push(l[h])):o[h]=!1;}}},Rn.prototype._forEachCell=function(t,e,r,n,i,a,o,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),p=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=u;h<=p;h++)for(var f=l;f<=c;f++){var y=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,y,a,o,s))return}},Rn.prototype._convertFromCellCoord=function(t){return (t-this.padding)/this.scale},Rn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Rn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var p=t[l];u[l]=Un[s].shallow.indexOf(l)>=0?p:Kn(p,e);}t instanceof Error&&(u.message=t.message);}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==s&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof t)}function Gn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Zn(t)||_(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Gn);if("object"==typeof t){var e=t.$name||"Object";if(!Un[e])throw new Error("can't deserialize unregistered class "+e);var r=Un[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,a=Object.keys(t);i=0?s:Gn(s);}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Jn=function(){this.first=!0;};Jn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Yn(t){for(var e=0,r=t;e=65097&&t<=65103)||Xn["CJK Compatibility Ideographs"](t)||Xn["CJK Compatibility"](t)||Xn["CJK Radicals Supplement"](t)||Xn["CJK Strokes"](t)||!(!Xn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Xn["CJK Unified Ideographs Extension A"](t)||Xn["CJK Unified Ideographs"](t)||Xn["Enclosed CJK Letters and Months"](t)||Xn["Hangul Compatibility Jamo"](t)||Xn["Hangul Jamo Extended-A"](t)||Xn["Hangul Jamo Extended-B"](t)||Xn["Hangul Jamo"](t)||Xn["Hangul Syllables"](t)||Xn.Hiragana(t)||Xn["Ideographic Description Characters"](t)||Xn.Kanbun(t)||Xn["Kangxi Radicals"](t)||Xn["Katakana Phonetic Extensions"](t)||Xn.Katakana(t)&&12540!==t||!(!Xn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Xn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Xn["Unified Canadian Aboriginal Syllabics"](t)||Xn["Unified Canadian Aboriginal Syllabics Extended"](t)||Xn["Vertical Forms"](t)||Xn["Yijing Hexagram Symbols"](t)||Xn["Yi Syllables"](t)||Xn["Yi Radicals"](t))))}function Wn(t){return !(Hn(t)||function(t){return !!(Xn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Xn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Xn["Letterlike Symbols"](t)||Xn["Number Forms"](t)||Xn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Xn["Control Pictures"](t)&&9251!==t||Xn["Optical Character Recognition"](t)||Xn["Enclosed Alphanumerics"](t)||Xn["Geometric Shapes"](t)||Xn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xn["CJK Symbols and Punctuation"](t)||Xn.Katakana(t)||Xn["Private Use Area"](t)||Xn["CJK Compatibility Forms"](t)||Xn["Small Form Variants"](t)||Xn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function $n(t){return t>=1424&&t<=2303||Xn["Arabic Presentation Forms-A"](t)||Xn["Arabic Presentation Forms-B"](t)}function Qn(t,e){return !(!e&&$n(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Xn.Khmer(t))}function ti(t){for(var e=0,r=t;e-1&&(ai="error"),ii&&ii(t);};function ui(){li.fire(new dt("pluginStateChange",{pluginStatus:ai,pluginURL:oi}));}var li=new vt,pi=function(){return ai},ci=function(){if(ai!==ei||!oi)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ai=ri,ui(),oi&&pt({url:oi},(function(t){t?si(t):(ai=ni,ui());}));},hi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return ai===ni||null!=hi.applyArabicShaping},isLoading:function(){return ai===ri},setState:function(t){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");ai=t.pluginStatus,oi=t.pluginURL;},isParsed:function(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=hi.applyArabicShaping&&null!=hi.processBidirectionalText&&null!=hi.processStyledBidirectionalText},getPluginURL:function(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return oi}},fi=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Jn,this.transition={});};fi.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var yi=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(jr(t))return new Qr(t,e);if(Xr(t)){var r=$r(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return "color"===e.type&&"string"==typeof t?n=Yt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(n=Qt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification);};yi.prototype.isDataDriven=function(){return "source"===this.expression.kind||"composite"===this.expression.kind},yi.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var di=function(t){this.property=t,this.value=new yi(t,void 0);};di.prototype.transitioned=function(t,e){return new vi(this.property,this.value,e,s({},t.transition,this.transition),t.now)},di.prototype.untransitioned=function(){return new vi(this.property,this.value,null,{},0)};var mi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);};mi.prototype.getValue=function(t){return f(this._values[t].value.value)},mi.prototype.setValue=function(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new di(this._values[t].property)),this._values[t].value=new yi(this._values[t].property,null===e?void 0:f(e));},mi.prototype.getTransition=function(t){return f(this._values[t].transition)},mi.prototype.setTransition=function(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new di(this._values[t].property)),this._values[t].transition=f(e)||void 0;},mi.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return i};var gi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);};gi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new wi(this._properties),i=0,a=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(Ai),Si=function(t){this.specification=t;};Si.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new fi(Math.floor(e.zoom-1),e)),t.expression.evaluate(new fi(Math.floor(e.zoom),e)),t.expression.evaluate(new fi(Math.floor(e.zoom+1),e)),e)}},Si.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},Si.prototype.interpolate=function(t){return t};var Ii=function(t){this.specification=t;};Ii.prototype.possiblyEvaluate=function(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)},Ii.prototype.interpolate=function(){return !1};var Mi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new yi(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new di(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}};qn("DataDrivenProperty",Ai),qn("DataConstantProperty",_i),qn("CrossFadedDataDrivenProperty",ki),qn("CrossFadedProperty",Si),qn("ColorRampProperty",Ii);var zi="-transition",Pi=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return !0},needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new xi(r.layout)),r.paint)){for(var n in this._transitionablePaint=new mi(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new wi(r.paint);}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return "visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(Dn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);},e.prototype.getPaintProperty=function(t){return p(t,zi)?this._transitionablePaint.getTransition(t.slice(0,-zi.length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Ln,"layers."+this.id+".paint."+t,t,e,r))return !1;if(p(t,zi))return this._transitionablePaint.setTransition(t.slice(0,-zi.length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return !1},e.prototype.isHidden=function(t){return !!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),h(t,(function(t,e){return !(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&jn(this,t.call(Fn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:gt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return !1},e.prototype.isTileClipped=function(){return !1},e.prototype.hasOffscreenPass=function(){return !1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof bi&&Fr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return !0}return !1},e}(vt),Bi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ci=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;},Ei=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0);};function Vi(t,e){void 0===e&&(e=1);var r=0,n=0;return {members:t.map((function(t){var i=Bi[t.type].BYTES_PER_ELEMENT,a=r=Ti(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:a}})),size:Ti(r,Math.max(n,e)),alignment:e}}function Ti(t,e){return Math.ceil(t/e)*e}Ei.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ei.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ei.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());},Ei.prototype.clear=function(){this.length=0;},Ei.prototype.resize=function(t){this.reserve(t),this.length=t;},Ei.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}},Ei.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Fi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(Ei);Fi.prototype.bytesPerElement=4,qn("StructArrayLayout2i4",Fi);var Oi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t},e}(Ei);Oi.prototype.bytesPerElement=8,qn("StructArrayLayout4i8",Oi);var Li=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(Ei);Li.prototype.bytesPerElement=12,qn("StructArrayLayout2i4i12",Li);var Di=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=4*t,u=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=a,this.uint8[u+7]=o,t},e}(Ei);Di.prototype.bytesPerElement=8,qn("StructArrayLayout2i4ub8",Di);var ji=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(Ei);ji.prototype.bytesPerElement=8,qn("StructArrayLayout2f8",ji);var Ri=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,a,o,s,u,l)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p){var c=10*t;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=n,this.uint16[c+3]=i,this.uint16[c+4]=a,this.uint16[c+5]=o,this.uint16[c+6]=s,this.uint16[c+7]=u,this.uint16[c+8]=l,this.uint16[c+9]=p,t},e}(Ei);Ri.prototype.bytesPerElement=20,qn("StructArrayLayout10ui20",Ri);var Ui=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,a,o,s,u,l,p,c)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=u,this.int16[f+8]=l,this.int16[f+9]=p,this.int16[f+10]=c,this.int16[f+11]=h,t},e}(Ei);Ui.prototype.bytesPerElement=24,qn("StructArrayLayout4i4ui4i24",Ui);var qi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(Ei);qi.prototype.bytesPerElement=12,qn("StructArrayLayout3f12",qi);var Ni=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ei);Ni.prototype.bytesPerElement=4,qn("StructArrayLayout1ul4",Ni);var Zi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,a,o,s,u)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l){var p=10*t,c=5*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.int16[p+4]=a,this.int16[p+5]=o,this.uint32[c+3]=s,this.uint16[p+8]=u,this.uint16[p+9]=l,t},e}(Ei);Zi.prototype.bytesPerElement=20,qn("StructArrayLayout6i1ul2ui20",Zi);var Ki=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(Ei);Ki.prototype.bytesPerElement=12,qn("StructArrayLayout2i2i2i12",Ki);var Gi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,a){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=i,this.int16[s+7]=a,t},e}(Ei);Gi.prototype.bytesPerElement=16,qn("StructArrayLayout2f1f2i16",Gi);var Ji=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t},e}(Ei);Ji.prototype.bytesPerElement=12,qn("StructArrayLayout2ub2f12",Ji);var Xi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(Ei);Xi.prototype.bytesPerElement=6,qn("StructArrayLayout3ui6",Xi);var Yi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m){var v=this.length;return this.resize(v+1),this.emplace(v,t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v){var g=24*t,x=12*t,b=48*t;return this.int16[g+0]=e,this.int16[g+1]=r,this.uint16[g+2]=n,this.uint16[g+3]=i,this.uint32[x+2]=a,this.uint32[x+3]=o,this.uint32[x+4]=s,this.uint16[g+10]=u,this.uint16[g+11]=l,this.uint16[g+12]=p,this.float32[x+7]=c,this.float32[x+8]=h,this.uint8[b+36]=f,this.uint8[b+37]=y,this.uint8[b+38]=d,this.uint32[x+10]=m,this.int16[g+22]=v,t},e}(Ei);Yi.prototype.bytesPerElement=48,qn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Yi);var Hi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,k,S,I,M){var z=this.length;return this.resize(z+1),this.emplace(z,t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,k,S,I,M)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m,v,g,x,b,w,_,A,k,S,I,M,z){var P=34*t,B=17*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=a,this.int16[P+5]=o,this.int16[P+6]=s,this.int16[P+7]=u,this.uint16[P+8]=l,this.uint16[P+9]=p,this.uint16[P+10]=c,this.uint16[P+11]=h,this.uint16[P+12]=f,this.uint16[P+13]=y,this.uint16[P+14]=d,this.uint16[P+15]=m,this.uint16[P+16]=v,this.uint16[P+17]=g,this.uint16[P+18]=x,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=A,this.uint32[B+12]=k,this.float32[B+13]=S,this.float32[B+14]=I,this.float32[B+15]=M,this.float32[B+16]=z,t},e}(Ei);Hi.prototype.bytesPerElement=68,qn("StructArrayLayout8i15ui1ul4f68",Hi);var Wi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ei);Wi.prototype.bytesPerElement=4,qn("StructArrayLayout1f4",Wi);var $i=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(Ei);$i.prototype.bytesPerElement=6,qn("StructArrayLayout3i6",$i);var Qi=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(Ei);Qi.prototype.bytesPerElement=8,qn("StructArrayLayout1ul2ui8",Qi);var ta=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(Ei);ta.prototype.bytesPerElement=4,qn("StructArrayLayout2ui4",ta);var ea=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ei);ea.prototype.bytesPerElement=2,qn("StructArrayLayout1ui2",ea);var ra=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t},e}(Ei);ra.prototype.bytesPerElement=16,qn("StructArrayLayout4f16",ra);var na=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new I(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Ci);na.prototype.size=20;var ia=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new na(this,t)},e}(Zi);qn("CollisionBoxArray",ia);var aa=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t;},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t;},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t;},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(Ci);aa.prototype.size=48;var oa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new aa(this,t)},e}(Yi);qn("PlacedSymbolArray",oa);var sa=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t;},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(Ci);sa.prototype.size=68;var ua=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new sa(this,t)},e}(Hi);qn("SymbolInstanceArray",ua);var la=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Wi);qn("GlyphOffsetArray",la);var pa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}($i);qn("SymbolLineVertexArray",pa);var ca=function(t){function e(){t.apply(this,arguments);}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(Ci);ca.prototype.size=8;var ha=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ca(this,t)},e}(Qi);qn("FeatureIndexArray",ha);var fa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Fi),ya=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Oi),da=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Fi),ma=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Fi),va=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Li),ga=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Di),xa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(ji),ba=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ri),wa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ui),_a=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(qi),Aa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ni),ka=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ki),Sa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Gi),Ia=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ji),Ma=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Xi),za=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Xi),Pa=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(ta),Ba=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(ea),Ca=Vi([{name:"a_pos",components:2,type:"Int16"}],4).members,Ea=function(t){void 0===t&&(t=[]),this.segments=t;};function Va(t,e){return 256*(t=a(Math.floor(t),0,255))+a(Math.floor(e),0,255)}Ea.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>Ea.MAX_VERTEX_ARRAY_LENGTH&&d("Max vertices per segment is "+Ea.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>Ea.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},Ea.prototype.get=function(){return this.segments},Ea.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(l+2))<<16;case 2:u^=(255&t.charCodeAt(l+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(l)))*o+(((u>>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var La={exports:{}};La.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var Da=Oa.exports,ja=La.exports;Fa.exports=Da,Fa.exports.murmur3=Da,Fa.exports.murmur2=ja;var Ra=function(){this.ids=[],this.positions=[],this.indexed=!1;};function Ua(t){var e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Fa.exports(String(t))}function qa(t,e,r,n){for(;r>1],a=r-1,o=n+1;;){do{a++;}while(t[a]i);if(a>=o)break;Na(t,a,o),Na(e,3*a,3*o),Na(e,3*a+1,3*o+1),Na(e,3*a+2,3*o+2);}o-r>1;this.ids[i]>=e?n=i:r=i+1;}for(var a=[];this.ids[r]===e;)a.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return a},Ra.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return qa(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}},Ra.deserialize=function(t){var e=new Ra;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e},qn("FeaturePositionMap",Ra);var Za=function(t,e){this.gl=t.gl,this.location=e;},Ka=function(t){function e(e,r){t.call(this,e,r),this.current=0;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t));},e}(Za),Ga=function(t){function e(e,r){t.call(this,e,r),this.current=0;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t));},e}(Za),Ja=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0];}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]));},e}(Za),Xa=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0];}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]));},e}(Za),Ya=function(t){function e(e,r){t.call(this,e,r),this.current=[0,0,0,0];}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]));},e}(Za),Ha=function(t){function e(e,r){t.call(this,e,r),this.current=Yt.transparent;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a));},e}(Za),Wa=new Float32Array(16),$a=function(t){function e(e,r){t.call(this,e,r),this.current=Wa;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(Za);function Qa(t){return [Va(255*t.r,255*t.g),Va(255*t.b,255*t.a)]}var to=function(t,e,r){this.value=t,this.uniformNames=e.map((function(t){return "u_"+t})),this.type=r;};to.prototype.setUniform=function(t,e,r){t.set(r.constantOr(this.value));},to.prototype.getBinding=function(t,e,r){return "color"===this.type?new Ha(t,e):new Ga(t,e)};var eo=function(t,e){this.uniformNames=e.map((function(t){return "u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1;};eo.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr;},eo.prototype.setUniform=function(t,e,r,n){var i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i);},eo.prototype.getBinding=function(t,e,r){return "u_pattern"===r.substr(0,9)?new Ya(t,e):new Ga(t,e)};var ro=function(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return {name:"a_"+t,type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new n;};ro.prototype.populatePaintArray=function(t,e,r,n,i){var a=this.paintVertexArray.length,o=this.expression.evaluate(new fi(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(a,t,o);},ro.prototype.updatePaintArray=function(t,e,r,n){var i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i);},ro.prototype._setPaintValue=function(t,e,r){if("color"===this.type)for(var n=Qa(r),i=t;is.x+1||ls.y+1)&&d("Geometry exceeds allowed extent, reduce your vector tile buffer size");}return r}function fo(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?ho(t):[]}}function yo(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}var mo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new da,this.indexArray=new za,this.segments=new Ea,this.programConfigurations=new oo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};function vo(t,e){for(var r=0;r1){if(wo(t,e))return !0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function So(t,e){for(var r,n,i,a=!1,o=0;oe.y!=(i=r[u]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function Io(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r);}return r}function Mo(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return !1;var a=m(t,e,r[0]);return a!==m(t,e,r[1])||a!==m(t,e,r[2])||a!==m(t,e,r[3])}function zo(t,e,r){var n=e.paint.get(t).value;return "constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Po(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Bo(t,e,r,n,i){if(!e[0]&&!e[1])return t;var a=I.convert(e)._mult(i);"viewport"===r&&a._rotate(-n);for(var o=[],s=0;s=lo||p<0||p>=lo)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=c.vertexLength;yo(this.layoutVertexArray,l,p,-1,-1),yo(this.layoutVertexArray,l,p,1,-1),yo(this.layoutVertexArray,l,p,1,1),yo(this.layoutVertexArray,l,p,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),c.vertexLength+=4,c.primitiveLength+=2;}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);},qn("CircleBucket",mo,{omit:["layers"]});var Co=new Mi({"circle-sort-key":new Ai(gt.layout_circle["circle-sort-key"])}),Eo={paint:new Mi({"circle-radius":new Ai(gt.paint_circle["circle-radius"]),"circle-color":new Ai(gt.paint_circle["circle-color"]),"circle-blur":new Ai(gt.paint_circle["circle-blur"]),"circle-opacity":new Ai(gt.paint_circle["circle-opacity"]),"circle-translate":new _i(gt.paint_circle["circle-translate"]),"circle-translate-anchor":new _i(gt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new _i(gt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new _i(gt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ai(gt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ai(gt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ai(gt.paint_circle["circle-stroke-opacity"])}),layout:Co},Vo=1e-6,To="undefined"!=typeof Float32Array?Float32Array:Array;function Fo(){var t=new To(9);return To!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Oo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lo(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],l=e[6],p=e[7],c=e[8],h=e[9],f=e[10],y=e[11],d=e[12],m=e[13],v=e[14],g=e[15],x=r[0],b=r[1],w=r[2],_=r[3];return t[0]=x*n+b*s+w*c+_*d,t[1]=x*i+b*u+w*h+_*m,t[2]=x*a+b*l+w*f+_*v,t[3]=x*o+b*p+w*y+_*g,t[4]=(x=r[4])*n+(b=r[5])*s+(w=r[6])*c+(_=r[7])*d,t[5]=x*i+b*u+w*h+_*m,t[6]=x*a+b*l+w*f+_*v,t[7]=x*o+b*p+w*y+_*g,t[8]=(x=r[8])*n+(b=r[9])*s+(w=r[10])*c+(_=r[11])*d,t[9]=x*i+b*u+w*h+_*m,t[10]=x*a+b*l+w*f+_*v,t[11]=x*o+b*p+w*y+_*g,t[12]=(x=r[12])*n+(b=r[13])*s+(w=r[14])*c+(_=r[15])*d,t[13]=x*i+b*u+w*h+_*m,t[14]=x*a+b*l+w*f+_*v,t[15]=x*o+b*p+w*y+_*g,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var Do,jo=Lo;function Ro(){var t=new To(3);return To!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Uo(t,e,r){var n=new To(3);return n[0]=t,n[1]=e,n[2]=r,n}function qo(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}function No(){var t=new To(4);return To!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Ro(),Do=new To(4),To!=Float32Array&&(Do[0]=0,Do[1]=0,Do[2]=0,Do[3]=0),Ro(),Uo(1,0,0),Uo(0,1,0),No(),No(),Fo(),function(){var t;t=new To(2),To!=Float32Array&&(t[0]=0,t[1]=0);}();var Zo=function(t){function e(e){t.call(this,e,Eo);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new mo(t)},e.prototype.queryRadius=function(t){var e=t;return zo("circle-radius",this,e)+zo("circle-stroke-width",this,e)+Po(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o,s){for(var u=Bo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),l=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),p="map"===this.paint.get("circle-pitch-alignment"),c=p?u:function(t,e){return t.map((function(t){return Ko(t,e)}))}(u,s),h=p?l*o:l,f=0,y=n;ft.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");var o=t.data,s=e.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(var u=0;u80*r){n=a=t[0],i=o=t[1];for(var y=r;ya&&(a=s),u>o&&(o=u);l=0!==(l=Math.max(a-n,o-i))?32767/l:0;}return us(h,f,r,n,i,l,0),f}function os(t,e,r,n,i){var a,o;if(i===Bs(t,e,r,n)>0)for(a=e;a=e;a-=n)o=Ms(a,t[a],t[a+1],o);return o&&ws(o,o.next)&&(zs(o),o=o.next),o}function ss(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ws(n,n.next)&&0!==bs(n.prev,n,n.next))n=n.next;else {if(zs(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function us(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=ms(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,u,l=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n;}a.nextZ=null,l*=2;}while(o>1)}(i);}(t,n,i,a);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?ps(t,n,i,a):ls(t))e.push(s.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),zs(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?us(t=cs(ss(t),e,r),e,r,n,i,a,2):2===o&&hs(t,e,r,n,i,a):us(ss(t),e,r,n,i,a,1);break}}}function ls(t){var e=t.prev,r=t,n=t.next;if(bs(e,r,n)>=0)return !1;for(var i=e.x,a=r.x,o=n.x,s=e.y,u=r.y,l=n.y,p=ia?i>o?i:o:a>o?a:o,f=s>u?s>l?s:l:u>l?u:l,y=n.next;y!==e;){if(y.x>=p&&y.x<=h&&y.y>=c&&y.y<=f&&gs(i,s,a,u,o,l,y.x,y.y)&&bs(y.prev,y,y.next)>=0)return !1;y=y.next;}return !0}function ps(t,e,r,n){var i=t.prev,a=t,o=t.next;if(bs(i,a,o)>=0)return !1;for(var s=i.x,u=a.x,l=o.x,p=i.y,c=a.y,h=o.y,f=su?s>l?s:l:u>l?u:l,m=p>c?p>h?p:h:c>h?c:h,v=ms(f,y,e,r,n),g=ms(d,m,e,r,n),x=t.prevZ,b=t.nextZ;x&&x.z>=v&&b&&b.z<=g;){if(x.x>=f&&x.x<=d&&x.y>=y&&x.y<=m&&x!==i&&x!==o&&gs(s,p,u,c,l,h,x.x,x.y)&&bs(x.prev,x,x.next)>=0)return !1;if(x=x.prevZ,b.x>=f&&b.x<=d&&b.y>=y&&b.y<=m&&b!==i&&b!==o&&gs(s,p,u,c,l,h,b.x,b.y)&&bs(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;x&&x.z>=v;){if(x.x>=f&&x.x<=d&&x.y>=y&&x.y<=m&&x!==i&&x!==o&&gs(s,p,u,c,l,h,x.x,x.y)&&bs(x.prev,x,x.next)>=0)return !1;x=x.prevZ;}for(;b&&b.z<=g;){if(b.x>=f&&b.x<=d&&b.y>=y&&b.y<=m&&b!==i&&b!==o&&gs(s,p,u,c,l,h,b.x,b.y)&&bs(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function cs(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!ws(i,a)&&_s(i,n,n.next,a)&&Ss(i,a)&&Ss(a,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(a.i/r|0),zs(n),zs(n.next),n=t=a),n=n.next;}while(n!==t);return ss(n)}function hs(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&xs(o,s)){var u=Is(o,s);return o=ss(o,o.next),u=ss(u,u.next),us(o,e,r,n,i,a,0),void us(u,e,r,n,i,a,0)}s=s.next;}o=o.next;}while(o!==t)}function fs(t,e){return t.x-e.x}function ys(t,e){var r=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o&&(o=s,r=n.x=n.x&&n.x>=p&&i!==n.x&&gs(ar.x||n.x===r.x&&ds(r,n)))&&(r=n,h=u)),n=n.next;}while(n!==l);return r}(t,e);if(!r)return e;var n=Is(r,t);return ss(n,n.next),ss(r,r.next)}function ds(t,e){return bs(t.prev,t,e.prev)<0&&bs(e.next,t,t.next)<0}function ms(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vs(t){var e=t,r=t;do{(e.x=(t-o)*(a-s)&&(t-o)*(n-s)>=(r-o)*(e-s)&&(r-o)*(a-s)>=(i-o)*(n-s)}function xs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&_s(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(Ss(t,e)&&Ss(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(bs(t.prev,t,e.prev)||bs(t,e.prev,e))||ws(t,e)&&bs(t.prev,t,t.next)>0&&bs(e.prev,e,e.next)>0)}function bs(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ws(t,e){return t.x===e.x&&t.y===e.y}function _s(t,e,r,n){var i=ks(bs(t,e,r)),a=ks(bs(t,e,n)),o=ks(bs(r,n,t)),s=ks(bs(r,n,e));return i!==a&&o!==s||!(0!==i||!As(t,r,e))||!(0!==a||!As(t,n,e))||!(0!==o||!As(r,t,n))||!(0!==s||!As(r,e,n))}function As(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ks(t){return t>0?1:t<0?-1:0}function Ss(t,e){return bs(t.prev,t,t.next)<0?bs(t,e,t.next)>=0&&bs(t,t.prev,e)>=0:bs(t,e,t.prev)<0||bs(t,t.next,e)<0}function Is(t,e){var r=new Ps(t.i,t.x,t.y),n=new Ps(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function Ms(t,e,r,n){var i=new Ps(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function zs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function Ps(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function Bs(t,e,r,n){for(var i=0,a=e,o=r-n;ar;){if(n-r>600){var a=n-r+1,o=e-r+1,s=Math.log(a),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(a-u)/a)*(o-a/2<0?-1:1);Es(t,e,Math.max(r,Math.floor(e-o*u/a+l)),Math.min(n,Math.floor(e+(a-o)*u/a+l)),i);}var p=t[e],c=r,h=n;for(Vs(t,r,e),i(t[n],p)>0&&Vs(t,r,n);c0;)h--;}0===i(t[r],p)?Vs(t,r,h):Vs(t,++h,n),h<=e&&(r=h+1),e<=h&&(n=h-1);}}function Vs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function Ts(t,e){return te?1:0}function Fs(t,e){var r=t.length;if(r<=1)return [t];for(var n,i,a=[],o=0;o1)for(var u=0;u0&&r.holes.push(n+=t[i-1].length);}return r};var js=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ma,this.indexArray=new za,this.indexArray2=new Pa,this.programConfigurations=new oo(t.layers,t.zoom),this.segments=new Ea,this.segments2=new Ea,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};js.prototype.populate=function(t,e,r){this.hasPattern=Ls("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),a=[],o=0,s=t;o>3;}if(i--,1===n||2===n)a+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new Js(a,o));else {if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone());}}return e&&s.push(e),s},Ys.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,u=1/0,l=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())l&&(l=a);else if(7!==r)throw new Error("unknown command "+r)}return [o,u,s,l]},Ys.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=Ys.types[this.type];function p(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}tu.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new $s(this._pbf,e,this.extent,this._keys,this._values)};var ru=Qs;function nu(t,e,r){if(3===t){var n=new ru(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}Gs.VectorTile=function(t,e){this.layers=t.readFields(nu,{},e);},Gs.VectorTileFeature=Xs,Gs.VectorTileLayer=Qs;var iu=Gs.VectorTileFeature.types,au=Math.pow(2,13);function ou(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*au)+o,i*au*2,a*au*2,Math.round(s));}var su=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new va,this.centroidVertexArray=new fa,this.indexArray=new za,this.programConfigurations=new oo(t.layers,t.zoom),this.segments=new Ea,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}));};function uu(t,e){return t.x===e.x&&(t.x<0||t.x>lo)||t.y===e.y&&(t.y<0||t.y>lo)}su.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=Ls("fill-extrusion",this.layers,e);for(var n=0,i=t;nlo}))||V.every((function(t){return t.y<0}))||V.every((function(t){return t.y>lo}))))for(var m=0,v=0;v=1){var x=d[v-1];if(!uu(g,x)){h.vertexLength+4>Ea.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var b=g.sub(x)._perp()._unit(),w=x.dist(g);m+w>32768&&(m=0),ou(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,0,m),ou(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,1,m),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,ou(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,0,m+=w),ou(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,1,m),a.x+=2*x.x,a.y+=2*x.y,a.vertexCount+=2;var _=h.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),h.vertexLength+=4,h.primitiveLength+=2;}}}}if(h.vertexLength+l>Ea.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===iu[t.type]){for(var A=[],k=[],S=h.vertexLength,I=0,M=u;I=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;l0;if(A&&v>l){var S=p.dist(c);if(S>2*d){var I=p.sub(p.sub(c)._mult(d/S)._round());this.updateDistance(c,I),this.addCurrentVertex(I,f,0,0,m),c=I;}}var M=c&&h,z=M?r:s?"butt":n;if(M&&"round"===z&&(wi&&(z="bevel"),"bevel"===z&&(w>2&&(z="flipbevel"),w100)g=y.mult(-1);else {var P=w*f.add(y).mag()/f.sub(y).mag();g._perp()._mult(P*(k?-1:1));}this.addCurrentVertex(p,g,0,0,m),this.addCurrentVertex(p,g.mult(-1),0,0,m);}else if("bevel"===z||"fakeround"===z){var B=-Math.sqrt(w*w-1),C=k?B:0,E=k?0:B;if(c&&this.addCurrentVertex(p,f,C,E,m),"fakeround"===z)for(var V=Math.round(180*_/Math.PI/20),T=1;T2*d){var R=p.add(h.sub(p)._mult(d/j)._round());this.updateDistance(p,R),this.addCurrentVertex(R,y,0,0,m),p=R;}}}}},gu.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,o,s,a,!0,-n,i),this.distance>vu/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a));},gu.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=.5*(this.lineClips?this.scaledDistance*(vu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),i?this.e2=u:this.e1=u;},gu.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;},gu.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance();},qn("LineBucket",gu,{omit:["layers","patternFeatures"]});var xu=new Mi({"line-cap":new _i(gt.layout_line["line-cap"]),"line-join":new Ai(gt.layout_line["line-join"]),"line-miter-limit":new _i(gt.layout_line["line-miter-limit"]),"line-round-limit":new _i(gt.layout_line["line-round-limit"]),"line-sort-key":new Ai(gt.layout_line["line-sort-key"])}),bu={paint:new Mi({"line-opacity":new Ai(gt.paint_line["line-opacity"]),"line-color":new Ai(gt.paint_line["line-color"]),"line-translate":new _i(gt.paint_line["line-translate"]),"line-translate-anchor":new _i(gt.paint_line["line-translate-anchor"]),"line-width":new Ai(gt.paint_line["line-width"]),"line-gap-width":new Ai(gt.paint_line["line-gap-width"]),"line-offset":new Ai(gt.paint_line["line-offset"]),"line-blur":new Ai(gt.paint_line["line-blur"]),"line-dasharray":new Si(gt.paint_line["line-dasharray"]),"line-pattern":new ki(gt.paint_line["line-pattern"]),"line-gradient":new Ii(gt.paint_line["line-gradient"])}),layout:xu},wu=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new fi(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=s({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(Ai),_u=new wu(bu.paint.properties["line-width"].specification);_u.useIntegerZoom=!0;var Au=function(t){function e(e){t.call(this,e,bu),this.gradientVersion=0;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof je,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER);},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=_u.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e);},e.prototype.createBucket=function(t){return new gu(t)},e.prototype.queryRadius=function(t){var e=t,r=ku(zo("line-width",this,e),zo("line-gap-width",this,e)),n=zo("line-offset",this,e);return r/2+Math.abs(n)+Po(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o){var s=Bo(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,o),u=o/2*ku(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(n=function(t,e){for(var r=[],n=0;n=3)for(var a=0;a0?e+2*t:t}var Su=Vi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Iu=Vi([{name:"a_projected_pos",components:3,type:"Float32"}],4);Vi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Mu=Vi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Vi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var zu=Vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Pu=Vi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Bu(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return "uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),hi.applyArabicShaping&&(t=hi.applyArabicShaping(t)),t}(t.text,e,r);})),t}Vi([{name:"triangle",components:3,type:"Uint16"}]),Vi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Vi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Vi([{type:"Float32",name:"offsetX"}]),Vi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Cu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Eu=24,Vu=Ou,Tu=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,p=-7,c=r?i-1:0,h=r?-1:1,f=t[e+c];for(c+=h,a=f&(1<<-p)-1,f>>=-p,p+=s;p>0;a=256*a+t[e+c],c+=h,p-=8);for(o=a&(1<<-p)-1,a>>=-p,p+=n;p>0;o=256*o+t[e+c],c+=h,p-=8);if(0===a)a=1-l;else {if(a===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=l;}return (f?-1:1)*o*Math.pow(2,a-n)},Fu=function(t,e,r,n,i,a){var o,s,u,l=8*a-i-1,p=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=p?(s=0,o=p):o+c>=1?(s=(e*u-1)*Math.pow(2,i),o+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&s,f+=y,s/=256,i-=8);for(o=o<0;t[r+f]=255&o,f+=y,o/=256,l-=8);t[r+f-y]|=128*d;};function Ou(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}Ou.Varint=0,Ou.Fixed64=1,Ou.Bytes=2,Ou.Fixed32=5;var Lu=4294967296,Du=1/Lu,ju="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ru(t){return t.type===Ou.Bytes?t.readVarint()+t.pos:t.pos+1}function Uu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function qu(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function Nu(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function tl(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function el(t,e,r){1===t&&r.readMessage(rl,e);}function rl(t,e,r){if(3===t){var n=r.readMessage(nl,{}),i=n.width,a=n.height,o=n.left,s=n.top,u=n.advance;e.push({id:n.id,bitmap:new Wo({width:i+6,height:a+6},n.bitmap),metrics:{width:i,height:a,left:o,top:s,advance:u}});}}function nl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}function il(t){for(var e=0,r=0,n=0,i=t;n=0;h--){var f=o[h];if(!(c.w>f.w||c.h>f.h)){if(c.x=f.x,c.y=f.y,u=Math.max(u,c.y+c.h),s=Math.max(s,c.x+c.w),c.w===f.w&&c.h===f.h){var y=o.pop();h>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=$u(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=tl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=$u(this.buf,this.pos)+$u(this.buf,this.pos+4)*Lu;return this.pos+=8,t},readSFixed64:function(){var t=$u(this.buf,this.pos)+tl(this.buf,this.pos+4)*Lu;return this.pos+=8,t},readFloat:function(){var t=Tu(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Tu(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return Uu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return Uu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return Uu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return Uu(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return Uu(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return Uu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ju?function(t,e,r){return ju.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:u>223?3:u>191?2:1;if(i+p>r)break;1===p?u<128&&(l=u):2===p?128==(192&(a=t[i+1]))&&(l=(31&u)<<6|63&a)<=127&&(l=null):3===p?(o=t[i+2],128==(192&(a=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&a)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===p&&(o=t[i+2],s=t[i+3],128==(192&(a=t[i+1]))&&128==(192&o)&&128==(192&s)&&((l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,p=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=p;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ou.Bytes)return t.push(this.readVarint(e));var r=Ru(this);for(t=t||[];this.pos127;);else if(e===Ou.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ou.Fixed32)this.pos+=4;else {if(e!==Ou.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&qu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),Fu(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),Fu(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&qu(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,Ou.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Nu,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Zu,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ju,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ku,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Gu,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Xu,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Yu,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Hu,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Wu,e);},writeBytesField:function(t,e){this.writeTag(t,Ou.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,Ou.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,Ou.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,Ou.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,Ou.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,Ou.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,Ou.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,Ou.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,Ou.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,Ou.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var al=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n;},ol={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};ol.tl.get=function(){return [this.paddedRect.x+1,this.paddedRect.y+1]},ol.br.get=function(){return [this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},ol.tlbr.get=function(){return this.tl.concat(this.br)},ol.displaySize.get=function(){return [(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(al.prototype,ol);var sl,ul=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=il(i),o=new $o({width:a.w||1,height:a.h||1});for(var s in t){var u=t[s],l=r[s].paddedRect;$o.copy(u.data,o,{x:0,y:0},{x:l.x+1,y:l.y+1},u.data);}for(var p in e){var c=e[p],h=n[p].paddedRect,f=h.x+1,y=h.y+1,d=c.data.width,m=c.data.height;$o.copy(c.data,o,{x:0,y:0},{x:f,y:y},c.data),$o.copy(c.data,o,{x:0,y:m-1},{x:f,y:y-1},{width:d,height:1}),$o.copy(c.data,o,{x:0,y:0},{x:f,y:y+m},{width:d,height:1}),$o.copy(c.data,o,{x:d-1,y:0},{x:f-1,y:y},{width:1,height:m}),$o.copy(c.data,o,{x:0,y:0},{x:f+d,y:y},{width:1,height:m});}this.image=o,this.iconPositions=r,this.patternPositions=n;};ul.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new al(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}},ul.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e);},ul.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]});}},qn("ImagePosition",al),qn("ImageAtlas",ul),t.WritingMode=void 0,(sl=t.WritingMode||(t.WritingMode={}))[sl.none=0]="none",sl[sl.horizontal=1]="horizontal",sl[sl.vertical=2]="vertical",sl[sl.horizontalOnly=3]="horizontalOnly";var ll=-17,pl=function(){this.scale=1,this.fontStack="",this.imageName=null;};pl.forText=function(t,e){var r=new pl;return r.scale=t||1,r.fontStack=e,r},pl.forImage=function(t){var e=new pl;return e.imageName=t,e};var cl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;};function hl(e,r,n,i,a,o,s,u,l,p,c,h,f,y,d,m){var v,g=cl.fromFeature(e,a);h===t.WritingMode.vertical&&g.verticalizePunctuation();var x=hi.processBidirectionalText,b=hi.processStyledBidirectionalText;if(x&&1===g.sections.length){v=[];for(var w=0,_=x(g.toString(),bl(g,p,o,r,i,y,d));w<_.length;w+=1){var A=_[w],k=new cl;k.text=A,k.sections=g.sections;for(var S=0;S0&&j>I&&(I=j);}else {var R=n[z.fontStack],U=R&&R[B];if(U&&U.rect)V=U.rect,E=U.metrics;else {var q=r[z.fontStack],N=q&&q[B];if(!N)continue;E=N.metrics;}C=(_-z.scale)*Eu;}O?(e.verticalizable=!0,S.push({glyph:B,imageName:T,x:f,y:y+C,vertical:O,scale:z.scale,fontStack:z.fontStack,sectionIndex:P,metrics:E,rect:V}),f+=F*z.scale+p):(S.push({glyph:B,imageName:T,x:f,y:y+C,vertical:O,scale:z.scale,fontStack:z.fontStack,sectionIndex:P,metrics:E,rect:V}),f+=E.advance*z.scale+p);}0!==S.length&&(d=Math.max(f-p,d),_l(S,0,S.length-1,v,I)),f=0;var Z=o*_+I;k.lineOffset=Math.max(I,A),y+=Z,m=Math.max(Z,m),++g;}else y+=o,++g;}var K,G=y-ll,J=wl(s),X=J.horizontalAlign,Y=J.verticalAlign;((function(t,e,r,n,i,a,o,s,u){var l,p=(e-r)*i;l=a!==o?-s*n-ll:(-n*u+.5)*o;for(var c=0,h=t;c=0&&n>=t&&fl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r);},cl.prototype.substring=function(t,e){var r=new cl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},cl.prototype.toString=function(){return this.text},cl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},cl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(pl.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var fl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},yl={};function dl(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*Eu/a+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function ml(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,c=0,h=0;h-r/2;){if(--o<0)return !1;s-=t[o].dist(a),a=t[o];}s+=t[o].dist(t[o+1]),o++;for(var u=[],l=0;sn;)l-=u.shift().angleDelta;if(l>i)return !1;o++,s+=p.dist(c);}return !0}function zl(t){for(var e=0,r=0;rl){var y=(l-u)/f,d=Re(c.x,h.x,y),m=Re(c.y,h.y,y),v=new Il(d,m,h.angleTo(c),p);return v._round(),!o||Ml(t,v,s,o,e)?v:void 0}u+=f;}}function El(t,e,r,n,i,a,o,s,u){var l=Pl(n,a,o),p=Bl(n,i),c=p*o,h=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-c=0&&b=0&&w=0&&h+l<=p){var _=new Il(b,w,g,y);_._round(),n&&!Ml(t,_,a,n,i)||f.push(_);}}c+=v;}return s||f.length||o||(f=Vl(t,c/2,r,n,i,a,o,!0,u)),f}function Tl(t,e,r,n,i){for(var a=[],o=0;o=n&&c.x>=n||(p.x>=n?p=new I(n,p.y+(n-p.x)/(c.x-p.x)*(c.y-p.y))._round():c.x>=n&&(c=new I(n,p.y+(n-p.x)/(c.x-p.x)*(c.y-p.y))._round()),p.y>=i&&c.y>=i||(p.y>=i?p=new I(p.x+(i-p.y)/(c.y-p.y)*(c.x-p.x),i)._round():c.y>=i&&(c=new I(p.x+(i-p.y)/(c.y-p.y)*(c.x-p.x),i)._round()),u&&p.equals(u[u.length-1])||a.push(u=[p]),u.push(c)))));}return a}function Fl(t,e,r,n){var i=[],a=t.image,o=a.pixelRatio,s=a.paddedRect.w-2,u=a.paddedRect.h-2,l=t.right-t.left,p=t.bottom-t.top,c=a.stretchX||[[0,s]],h=a.stretchY||[[0,u]],f=function(t,e){return t+e[1]-e[0]},y=c.reduce(f,0),d=h.reduce(f,0),m=s-y,v=u-d,g=0,x=y,b=0,w=d,_=0,A=m,k=0,S=v;if(a.content&&n){var M=a.content;g=Ol(c,0,M[0]),b=Ol(h,0,M[1]),x=Ol(c,M[0],M[2]),w=Ol(h,M[1],M[3]),_=M[0]-g,k=M[1]-b,A=M[2]-M[0]-x,S=M[3]-M[1]-w;}var z=function(n,i,s,u){var c=Dl(n.stretch-g,x,l,t.left),h=jl(n.fixed-_,A,n.stretch,y),f=Dl(i.stretch-b,w,p,t.top),m=jl(i.fixed-k,S,i.stretch,d),v=Dl(s.stretch-g,x,l,t.left),M=jl(s.fixed-_,A,s.stretch,y),z=Dl(u.stretch-b,w,p,t.top),P=jl(u.fixed-k,S,u.stretch,d),B=new I(c,f),C=new I(v,f),E=new I(v,z),V=new I(c,z),T=new I(h/o,m/o),F=new I(M/o,P/o),O=e*Math.PI/180;if(O){var L=Math.sin(O),D=Math.cos(O),j=[D,-L,L,D];B._matMult(j),C._matMult(j),V._matMult(j),E._matMult(j);}var R=n.stretch+n.fixed,U=i.stretch+i.fixed;return {tl:B,tr:C,bl:V,br:E,tex:{x:a.paddedRect.x+1+R,y:a.paddedRect.y+1+U,w:s.stretch+s.fixed-R,h:u.stretch+u.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:T,pixelOffsetBR:F,minFontScaleX:A/o/l,minFontScaleY:S/o/p,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var P=Ll(c,m,y),B=Ll(h,v,d),C=0;C0&&(f=Math.max(10,f),this.circleDiameter=f);}else {var y=a.top*o-s[0],d=a.bottom*o+s[2],m=a.left*o-s[3],v=a.right*o+s[1],g=a.collisionPadding;if(g&&(m-=g[0]*o,y-=g[1]*o,v+=g[2]*o,d+=g[3]*o),l){var x=new I(m,y),b=new I(v,y),w=new I(m,d),_=new I(v,d),A=l*Math.PI/180;x._rotate(A),b._rotate(A),w._rotate(A),_._rotate(A),m=Math.min(x.x,b.x,w.x,_.x),v=Math.max(x.x,b.x,w.x,_.x),y=Math.min(x.y,b.y,w.y,_.y),d=Math.max(x.y,b.y,w.y,_.y);}t.emplaceBack(e.x,e.y,m,y,v,d,r,n,i);}this.boxEndIndex=t.length;},Ul=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=ql),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r);};function ql(t,e){return te?1:0}function Nl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,i=1/0,a=-1/0,o=-1/0,s=t[0],u=0;ua)&&(a=l.x),(!u||l.y>o)&&(o=l.y);}var p=Math.min(a-n,o-i),c=p/2,h=new Ul([],Zl);if(0===p)return new I(n,i);for(var f=n;fd.d||!d.d)&&(d=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,m)),v.max-d.d<=e||(h.push(new Kl(v.p.x-(c=v.h/2),v.p.y-c,c,t)),h.push(new Kl(v.p.x+c,v.p.y-c,c,t)),h.push(new Kl(v.p.x-c,v.p.y+c,c,t)),h.push(new Kl(v.p.x+c,v.p.y+c,c,t)),m+=4);}return r&&(console.log("num probes: "+m),console.log("best distance: "+d.d)),d.p}function Zl(t,e){return e.max-t.max}function Kl(t,e,r,n){this.p=new I(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=p.y>t.y&&t.x<(p.x-l.x)*(t.y-l.y)/(p.y-l.y)+l.x&&(r=!r),n=Math.min(n,ko(t,l,p));}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}Ul.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1);},Ul.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Ul.prototype.peek=function(){return this.data[0]},Ul.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i;}e[t]=n;},Ul.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a;}e[t]=i;};var Gl=Number.POSITIVE_INFINITY;function Jl(t,e){return e[1]!==Gl?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r;}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7;}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e;}return [r,n]}(t,e[0])}function Xl(t){switch(t){case"right":case"top-right":case"bottom-right":return "right";case"left":case"top-left":case"bottom-left":return "left"}return "center"}var Yl=32640;function Hl(t,e,r,n,i,a,o,s,u,l,p,c,h,f,y){var m=function(t,e,r,n,i,a,o,s){for(var u=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,l=[],p=0,c=e.positionedLines;pYl&&d(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===v.kind&&((g=[kl*f.compositeTextSizes[0].evaluate(o,{},y),kl*f.compositeTextSizes[1].evaluate(o,{},y)])[0]>Yl||g[1]>Yl)&&d(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,m,g,s,a,o,l,e,u.lineStartIndex,u.lineLength,h,y);for(var x=0,b=p;x=0;o--)if(n.dist(a[o])0)&&("constant"!==o.value.kind||o.value.value.length>0),p="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,c=a.get("symbol-sort-key");if(this.features=[],l||p){for(var h=r.iconDependencies,f=r.glyphDependencies,y=r.availableImages,d=new fi(this.zoom),m=0,v=e;m=0;for(var V=0,T=S.sections;V=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u0},op.prototype.hasIconData=function(){return this.icon.segments.get().length>0},op.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},op.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},op.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},op.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t);})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}},qn("SymbolBucket",op,{omit:["layers","collisionBoxArray","features","compareText"]}),op.MAX_GLYPHS=65535,op.addDynamicAttributes=rp;var sp=new Mi({"symbol-placement":new _i(gt.layout_symbol["symbol-placement"]),"symbol-spacing":new _i(gt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _i(gt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ai(gt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _i(gt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new _i(gt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new _i(gt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new _i(gt.layout_symbol["icon-ignore-placement"]),"icon-optional":new _i(gt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _i(gt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ai(gt.layout_symbol["icon-size"]),"icon-text-fit":new _i(gt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _i(gt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ai(gt.layout_symbol["icon-image"]),"icon-rotate":new Ai(gt.layout_symbol["icon-rotate"]),"icon-padding":new Ai(gt.layout_symbol["icon-padding"]),"icon-keep-upright":new _i(gt.layout_symbol["icon-keep-upright"]),"icon-offset":new Ai(gt.layout_symbol["icon-offset"]),"icon-anchor":new Ai(gt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _i(gt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _i(gt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _i(gt.layout_symbol["text-rotation-alignment"]),"text-field":new Ai(gt.layout_symbol["text-field"]),"text-font":new Ai(gt.layout_symbol["text-font"]),"text-size":new Ai(gt.layout_symbol["text-size"]),"text-max-width":new Ai(gt.layout_symbol["text-max-width"]),"text-line-height":new _i(gt.layout_symbol["text-line-height"]),"text-letter-spacing":new Ai(gt.layout_symbol["text-letter-spacing"]),"text-justify":new Ai(gt.layout_symbol["text-justify"]),"text-radial-offset":new Ai(gt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _i(gt.layout_symbol["text-variable-anchor"]),"text-anchor":new Ai(gt.layout_symbol["text-anchor"]),"text-max-angle":new _i(gt.layout_symbol["text-max-angle"]),"text-writing-mode":new _i(gt.layout_symbol["text-writing-mode"]),"text-rotate":new Ai(gt.layout_symbol["text-rotate"]),"text-padding":new _i(gt.layout_symbol["text-padding"]),"text-keep-upright":new _i(gt.layout_symbol["text-keep-upright"]),"text-transform":new Ai(gt.layout_symbol["text-transform"]),"text-offset":new Ai(gt.layout_symbol["text-offset"]),"text-allow-overlap":new _i(gt.layout_symbol["text-allow-overlap"]),"text-overlap":new _i(gt.layout_symbol["text-overlap"]),"text-ignore-placement":new _i(gt.layout_symbol["text-ignore-placement"]),"text-optional":new _i(gt.layout_symbol["text-optional"])}),up={paint:new Mi({"icon-opacity":new Ai(gt.paint_symbol["icon-opacity"]),"icon-color":new Ai(gt.paint_symbol["icon-color"]),"icon-halo-color":new Ai(gt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ai(gt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ai(gt.paint_symbol["icon-halo-blur"]),"icon-translate":new _i(gt.paint_symbol["icon-translate"]),"icon-translate-anchor":new _i(gt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ai(gt.paint_symbol["text-opacity"]),"text-color":new Ai(gt.paint_symbol["text-color"],{runtimeType:Bt,getOverride:function(t){return t.textColor},hasOverride:function(t){return !!t.textColor}}),"text-halo-color":new Ai(gt.paint_symbol["text-halo-color"]),"text-halo-width":new Ai(gt.paint_symbol["text-halo-width"]),"text-halo-blur":new Ai(gt.paint_symbol["text-halo-blur"]),"text-translate":new _i(gt.paint_symbol["text-translate"]),"text-translate-anchor":new _i(gt.paint_symbol["text-translate-anchor"])}),layout:sp},lp=function(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:It,this.defaultValue=t;};lp.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},lp.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);},lp.prototype.outputDefined=function(){return !1},lp.prototype.serialize=function(){return null},qn("FormatSectionOverride",lp,{omit:["defaultValue"]});var pp=function(t){function e(e){t.call(this,e,up);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId});}}},xp.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n();}else g()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e);},xp.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e);}},xp.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Gn(e.error)):n(null,Gn(e.data)));}else {var i=!1,a=w(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Kn(e):null,data:Kn(n,a)},a);}:function(t){i=!0;},s=null,u=Gn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,o);else if(this.parent.getWorkerSource){var l=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,l[0],u.source)[l[1]](u,o);}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel);}},xp.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1);};var bp=6371008.8,wp=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};wp.prototype.wrap=function(){return new wp(o(this.lng,-180,180),this.lat)},wp.prototype.toArray=function(){return [this.lng,this.lat]},wp.prototype.toString=function(){return "LngLat("+this.lng+", "+this.lat+")"},wp.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return bp*Math.acos(Math.min(i,1))},wp.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new _p(new wp(this.lng-r,this.lat-e),new wp(this.lng+r,this.lat+e))},wp.convert=function(t){if(t instanceof wp)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new wp(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new wp(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var _p=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]));};_p.prototype.setNorthEast=function(t){return this._ne=t instanceof wp?new wp(t.lng,t.lat):wp.convert(t),this},_p.prototype.setSouthWest=function(t){return this._sw=t instanceof wp?new wp(t.lng,t.lat):wp.convert(t),this},_p.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof wp)e=t,r=t;else {if(!(t instanceof _p))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(_p.convert(t)):this.extend(wp.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new wp(e.lng,e.lat),this._ne=new wp(r.lng,r.lat)),this},_p.prototype.getCenter=function(){return new wp((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},_p.prototype.getSouthWest=function(){return this._sw},_p.prototype.getNorthEast=function(){return this._ne},_p.prototype.getNorthWest=function(){return new wp(this.getWest(),this.getNorth())},_p.prototype.getSouthEast=function(){return new wp(this.getEast(),this.getSouth())},_p.prototype.getWest=function(){return this._sw.lng},_p.prototype.getSouth=function(){return this._sw.lat},_p.prototype.getEast=function(){return this._ne.lng},_p.prototype.getNorth=function(){return this._ne.lat},_p.prototype.toArray=function(){return [this._sw.toArray(),this._ne.toArray()]},_p.prototype.toString=function(){return "LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},_p.prototype.isEmpty=function(){return !(this._sw&&this._ne)},_p.prototype.contains=function(t){var e=wp.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},_p.convert=function(t){return t instanceof _p?t:t?new _p(t):t};var Ap=2*Math.PI*bp;function kp(t){return Ap*Math.cos(t*Math.PI/180)}function Sp(t){return (180+t)/360}function Ip(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Mp(t,e){return t/kp(e)}function zp(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Pp=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r;};function Bp(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}Pp.fromLngLat=function(t,e){void 0===e&&(e=0);var r=wp.convert(t);return new Pp(Sp(r.lng),Ip(r.lat),Mp(e,r.lat))},Pp.prototype.toLngLat=function(){return new wp(360*this.x-180,zp(this.y))},Pp.prototype.toAltitude=function(){return this.z*kp(zp(this.y))},Pp.prototype.meterInMercatorCoordinateUnits=function(){return 1/Ap*(t=zp(this.y),1/Math.cos(t*Math.PI/180));var t;};var Cp=function(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error("x="+e+", y="+r+", z="+t+" outside of bounds. 0<=x<"+Math.pow(2,t)+", 0<=y<"+Math.pow(2,t)+" 0<=z<=25 ");this.z=t,this.x=e,this.y=r,this.key=Tp(0,t,t,e,r);};Cp.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Cp.prototype.url=function(t,e,r){var n,i,a,o,s,u=(i=this.y,a=this.z,o=Bp(256*(n=this.x),256*(i=Math.pow(2,a)-i-1),a),s=Bp(256*(n+1),256*(i+1),a),o[0]+","+o[1]+","+s[0]+","+s[1]),l=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<1?"@2x":"").replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,u)},Cp.prototype.isChildOf=function(t){var e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e},Cp.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new I((t.x*e-this.x)*lo,(t.y*e-this.y)*lo)},Cp.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Ep=function(t,e){this.wrap=t,this.canonical=e,this.key=Tp(t,e.z,e.z,e.x,e.y);},Vp=function(t,e,r,n,i){if(t= z; overscaledZ = "+t+"; z = "+r);this.overscaledZ=t,this.wrap=e,this.canonical=new Cp(r,+n,+i),this.key=Tp(e,t,r,n,i);};function Tp(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);var a=1<this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = "+t+"; overscaledZ = "+this.overscaledZ);var e=this.canonical.z-t;return t>this.canonical.z?new Vp(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vp(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Vp.prototype.calculateScaledKey=function(t,e){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = "+t+"; overscaledZ = "+this.overscaledZ);var r=this.canonical.z-t;return t>this.canonical.z?Tp(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Tp(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Vp.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return !1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Vp.prototype.children=function(t){if(this.overscaledZ>=t)return [new Vp(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new Vp(e,this.wrap,e,r,n),new Vp(e,this.wrap,e,r+1,n),new Vp(e,this.wrap,e,r,n+1),new Vp(e,this.wrap,e,r+1,n+1)]},Vp.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=s),s=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return (e+1)*this.stride+(t+1)},Fp.prototype._unpackMapbox=function(t,e,r){return (256*t*256+256*e+r)/10-1e4},Fp.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Fp.prototype.getPixels=function(){return new $o({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Fp.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:a=o-1;break;case 1:o=a+1;}for(var s=-e*this.dim,u=-r*this.dim,l=a;l=this._numberToString.length)throw new Error("Out of bounds. Index requested n="+t+" can't be >= this._numberToString.length "+this._numberToString.length);return this._numberToString[t]};var Lp=function(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i;},Dp={geometry:{configurable:!0}};Dp.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},Dp.geometry.set=function(t){this._geometry=t;},Lp.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(Lp.prototype,Dp);var jp,Rp=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Rn(lo,16,0),this.grid3D=new Rn(lo,16,0),this.featureIndexArray=new ha,this.promoteId=e;};function Up(t,e,r,n,i){return c(t,(function(t,a){var o=e instanceof wi?e.get(a):null;return o&&o.evaluate?o.evaluate(r,n,i):o}))}function qp(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,a=0,o=t;a=0&&p[3]>=0&&s.insert(o,p[0],p[1],p[2],p[3]);}},Rp.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Gs.VectorTile(new Vu(this.rawTileData)).layers,this.sourceLayerCoder=new Op(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Rp.prototype.query=function(t,e,r,n){var i=this;this.loadVTLayers();for(var a=t.params||{},o=lo/t.tileSize/t.scale,s=pn(a.filter),u=t.queryGeometry,l=t.queryPadding*o,p=qp(u),c=this.grid.query(p.minX-l,p.minY-l,p.maxX+l,p.maxY+l),h=qp(t.cameraQueryGeometry),f=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,(function(e,r,n,i){return function(t,e,r,n,i){for(var a=0,o=t;a=s.x&&i>=s.y)return !0}var u=[new I(e,r),new I(e,i),new I(n,i),new I(n,r)];if(t.length>2)for(var l=0,p=u;l=0)return !0;return !1}(a,h)){var f=this.sourceLayerCoder.decode(r),y=this.vtLayers[f].feature(n);if(i.needGeometry){var d=fo(y,!0);if(!i.filter(new fi(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!i.filter(new fi(this.tileID.overscaledZ),y))return;for(var m=this.getId(y,f),v=0;vGp})).reduce((function(t,e){return t+(e-Gp)/Gp}),0);return {loadTime:e,fullLoadTime:r,fps:i,percentDroppedFrames:a/(n+a)*100}}},Xp=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start);};Xp.prototype.finish=function(){performance.mark(this._marks.end);var t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t},t.AJAXError=it,t.ARRAY_TYPE=To,t.Actor=xp,t.AlphaImage=Wo,t.CanonicalTileID=Cp,t.CollisionBoxArray=ia,t.CollisionCircleLayoutArray=Sa,t.Color=Yt,t.DEMData=Fp,t.DataConstantProperty=_i,t.DictionaryCoder=Op,t.EXTENT=lo,t.ErrorEvent=mt,t.EvaluationParameters=fi,t.Event=dt,t.Evented=vt,t.FeatureIndex=Rp,t.FillBucket=js,t.FillExtrusionBucket=su,t.GeoJSONFeature=Lp,t.ImageAtlas=ul,t.ImagePosition=al,t.LineBucket=gu,t.LineStripIndexArray=Ba,t.LngLat=wp,t.LngLatBounds=_p,t.MercatorCoordinate=Pp,t.ONE_EM=Eu,t.OverscaledTileID=Vp,t.PerformanceUtils=Jp,t.PosArray=fa,t.Properties=Mi,t.QuadTriangleArray=Ma,t.RGBAImage=$o,t.RasterBoundsArray=ya,t.RequestPerformance=Xp,t.ResourceType=nt,t.SegmentVector=Ea,t.SymbolBucket=op,t.Transitionable=mi,t.TriangleIndexArray=za,t.Uniform1f=Ga,t.Uniform1i=Ka,t.Uniform2f=Ja,t.Uniform3f=Xa,t.Uniform4f=Ya,t.UniformColor=Ha,t.UniformMatrix4f=$a,t.UnwrappedTileID=Ep,t.ValidationError=xt,t.ZoomHistory=Jn,t.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},t.addDynamicAttributes=rp,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),a=null;t.forEach((function(t,o){e(t,(function(t,e){t&&(a=t),i[o]=e,0==--n&&r(a,i);}));}));},t.bezier=n,t.bindAll=l,t.cacheEntryPossiblyAdded=function(t){++$>X&&(t.getActor().send("enforceCacheSizeLimit",J),$=0);},t.clamp=a,t.clearTileCache=function(t){var e=caches.delete(G);t&&e.catch(t).then((function(){return t()}));},t.clipLine=Tl,t.clone=function(t){var e=new To(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=f,t.clone$2=function(t){var e=new To(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Pu,t.config=K,t.copy=function(t,e){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},t.create=function(){var t=new To(16);return To!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=Fo,t.createExpression=Yr,t.createFilter=pn,t.createLayout=Vi,t.createStyleLayer=function(t){return "custom"===t.type?new mp(t):new vp[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],u=r[2];return t[0]=i*u-a*s,t[1]=a*o-n*u,t[2]=n*s-i*o,t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=i,t.emitValidationErrors=jn,t.endsWith=p,t.enforceCacheSizeLimit=function(t){Y(),N&&N.then((function(e){e.keys().then((function(r){for(var n=0;n0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=Re,t.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),u=1/(n-i),l=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(o+a)*l,t[15]=1,t},t.parseCacheControl=x,t.parseGlyphPbf=function(t){return new Vu(t).readFields(el,[])},t.pbf=Vu,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=lo/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;var r=e.bucket.layers[0].layout,n=e.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new fi(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new fi(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new fi(18))};if("composite"===e.bucket.textSizeData.kind){var a=e.bucket.textSizeData,o=a.maxZoom;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new fi(a.minZoom),e.canonical),n["text-size"].possiblyEvaluate(new fi(o),e.canonical)];}if("composite"===e.bucket.iconSizeData.kind){var s=e.bucket.iconSizeData,u=s.maxZoom;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new fi(s.minZoom),e.canonical),n["icon-size"].possiblyEvaluate(new fi(u),e.canonical)];}for(var l=r.get("text-line-height")*Eu,p="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),c=r.get("text-keep-upright"),h=r.get("text-size"),f=function(){var n=m[y],a=r.get("text-font").evaluate(n,{},e.canonical).join(","),o=h.evaluate(n,{},e.canonical),s=i.layoutTextSize.evaluate(n,{},e.canonical),u=i.layoutIconSize.evaluate(n,{},e.canonical),f={horizontal:{},vertical:void 0},v=n.text,g=[0,0];if(v){var x=v.toString(),b=r.get("text-letter-spacing").evaluate(n,{},e.canonical)*Eu,w=function(t){for(var e=0,r=t;e=lo||h.y<0||h.y>=lo||function(e,r,n,i,a,o,s,u,l,p,c,h,f,y,m,v,g,x,b,w,_,A,k,S,I){var M,z,P,B,C,E=e.addToLineVertexArray(r,n),V=0,T=0,F=0,O=0,L=-1,D=-1,j={},R=Fa.exports(""),U=0,q=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")?(U=(M=u.layout.get("text-offset").evaluate(_,{},S).map((function(t){return t*Eu})))[0],q=M[1]):(U=u.layout.get("text-radial-offset").evaluate(_,{},S)*Eu,q=Gl),e.allowVerticalPlacement&&i.vertical){var N=u.layout.get("text-rotate").evaluate(_,{},S)+90;B=new Rl(l,r,p,c,h,i.vertical,f,y,m,N),s&&(C=new Rl(l,r,p,c,h,s,g,x,m,N));}if(a){var Z=u.layout.get("icon-rotate").evaluate(_,{}),K="none"!==u.layout.get("icon-text-fit"),G=Fl(a,Z,k,K),J=s?Fl(s,Z,k,K):void 0;P=new Rl(l,r,p,c,h,a,g,x,!1,Z),V=4*G.length;var X=e.iconSizeData,Y=null;"source"===X.kind?(Y=[kl*u.layout.get("icon-size").evaluate(_,{})])[0]>Yl&&d(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===X.kind&&((Y=[kl*A.compositeIconSizes[0].evaluate(_,{},S),kl*A.compositeIconSizes[1].evaluate(_,{},S)])[0]>Yl||Y[1]>Yl)&&d(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),e.addSymbols(e.icon,G,Y,w,b,_,t.WritingMode.none,r,E.lineStartIndex,E.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,J&&(T=4*J.length,e.addSymbols(e.icon,J,Y,w,b,_,t.WritingMode.vertical,r,E.lineStartIndex,E.lineLength,-1,S),D=e.icon.placedSymbolArray.length-1);}for(var H=Object.keys(i.horizontal),W=0,$=H;W<$.length;W+=1){var Q=$[W],tt=i.horizontal[Q];if(!z){R=Fa.exports(tt.text);var et=u.layout.get("text-rotate").evaluate(_,{},S);z=new Rl(l,r,p,c,h,tt,f,y,m,et);}var rt=1===tt.positionedLines.length;if(F+=Hl(e,r,tt,o,u,m,_,v,E,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,rt?H:[Q],j,L,A,S),rt)break}i.vertical&&(O+=Hl(e,r,i.vertical,o,u,m,_,v,E,t.WritingMode.vertical,["vertical"],j,D,A,S));var nt=z?z.boxStartIndex:e.collisionBoxArray.length,it=z?z.boxEndIndex:e.collisionBoxArray.length,at=B?B.boxStartIndex:e.collisionBoxArray.length,ot=B?B.boxEndIndex:e.collisionBoxArray.length,st=P?P.boxStartIndex:e.collisionBoxArray.length,ut=P?P.boxEndIndex:e.collisionBoxArray.length,lt=C?C.boxStartIndex:e.collisionBoxArray.length,pt=C?C.boxEndIndex:e.collisionBoxArray.length,ct=-1,ht=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};ct=ht(z,ct),ct=ht(B,ct),ct=ht(P,ct);var ft=(ct=ht(C,ct))>-1?1:0;ft&&(ct*=I/Eu),e.glyphOffsetArray.length>=op.MAX_GLYPHS&&d("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==_.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,_.sortKey),e.symbolInstances.emplaceBack(r.x,r.y,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical||-1,L,D,R,nt,it,at,ot,st,ut,lt,pt,p,F,O,V,T,ft,0,f,U,q,ct);}(e,h,u,n,i,a,f,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,x,[A,A,A,A],I,l,w,k,M,m,r,o,p,c,s);};if("line"===z)for(var E=0,V=Tl(r.geometry,0,0,lo,lo);E1){var U=Cl(R,S,n.vertical||v,i,24,b);U&&C(R,U);}}else if("Polygon"===r.type)for(var q=0,N=Fs(r.geometry,0);q= 200 && r.status < 300) || 0 === r.status) && + null !== r.response + ) { + var n = r.response; + if ('json' === t.type) + try { + n = JSON.parse(r.response); + } catch (t) { + return e(t); + } + e( + null, + n, + r.getResponseHeader('Cache-Control'), + r.getResponseHeader('Expires'), + ); + } else { + var i = new Blob([r.response], { + type: r.getResponseHeader('Content-Type'), + }); + e(new it(r.status, r.statusText, t.url, i)); + } + }), + r.send(t.body), + { + cancel: function () { + return r.abort(); + }, + } + ); + })(t, e); + }, + pt = function (t, e) { + return lt(s(t, { type: 'arrayBuffer' }), e); + }, + ct = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII='; + (st = []), (ut = 0); + var ht = function (t, e) { + if ( + (Q.supported && + (t.headers || (t.headers = {}), + (t.headers.accept = 'image/webp,*/*')), + ut >= K.MAX_PARALLEL_IMAGE_REQUESTS) + ) { + var r = { + requestParameters: t, + callback: e, + cancelled: !1, + cancel: function () { + this.cancelled = !0; + }, + }; + return st.push(r), r; + } + ut++; + var n = !1, + i = function () { + if (!n) + for ( + n = !0, ut--; + st.length && ut < K.MAX_PARALLEL_IMAGE_REQUESTS; -define(["./shared"],(function(e){"use strict";function t(e){var r=typeof e;if("number"===r||"boolean"===r||"string"===r||null==e)return JSON.stringify(e);if(Array.isArray(e)){for(var i="[",o=0,n=e;o=Math.abs(a)?r-l+a:a-l+r,r=l;}r+i>=0!=!!t&&e.reverse();}var f=e.vectorTile.VectorTileFeature.prototype.toGeoJSON,g=function(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));};g.prototype.loadGeometry=function(){if(1===this._feature.type){for(var t=[],r=0,i=this._feature.geometry;r>31}function D(e,t){for(var r=e.loadGeometry(),i=e.type,o=0,n=0,s=r.length,a=0;a>1;O(e,t,s,i,o,n%2),z(e,t,r,i,s-1,n+1),z(e,t,r,s+1,o,n+1);}}function O(e,t,r,i,o,n){for(;o>i;){if(o-i>600){var s=o-i+1,a=r-i+1,l=Math.log(s),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(s-u)/s)*(a-s/2<0?-1:1);O(e,t,r,Math.max(i,Math.floor(r-a*u/s+h)),Math.min(o,Math.floor(r+(s-a)*u/s+h)),n);}var c=t[2*r+n],p=i,f=o;for(E(e,t,i,r),t[2*o+n]>c&&E(e,t,i,o);pc;)f--;}t[2*i+n]===c?E(e,t,i,f):E(e,t,++f,o),f<=r&&(i=f+1),r<=f&&(o=f-1);}}function E(e,t,r,i){F(e,r,i),F(t,2*r,2*i),F(t,2*r+1,2*i+1);}function F(e,t,r){var i=e[t];e[t]=e[r],e[r]=i;}function N(e,t,r,i){var o=e-r,n=t-i;return o*o+n*n}v.exports=b,v.exports.fromVectorTileJs=b,v.exports.fromGeojsonVt=function(e,t){t=t||{};var r={};for(var i in e)r[i]=new I(e[i].features,t),r[i].name=i,r[i].version=t.version,r[i].extent=t.extent;return b({layers:r})},v.exports.GeoJSONWrapper=I;var A=function(e){return e[0]},B=function(e){return e[1]},J=function(e,t,r,i,o){void 0===t&&(t=A),void 0===r&&(r=B),void 0===i&&(i=64),void 0===o&&(o=Float64Array),this.nodeSize=i,this.points=e;for(var n=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new n(e.length),a=this.coords=new o(2*e.length),l=0;l=r&&a<=o&&l>=i&&l<=n&&h.push(e[g]);else {var d=Math.floor((f+p)/2);l=t[2*d+1],(a=t[2*d])>=r&&a<=o&&l>=i&&l<=n&&h.push(e[d]);var v=(c+1)%2;(0===c?r<=a:i<=l)&&(u.push(f),u.push(d-1),u.push(v)),(0===c?o>=a:n>=l)&&(u.push(d+1),u.push(p),u.push(v));}}return h}(this.ids,this.coords,e,t,r,i,this.nodeSize)},J.prototype.within=function(e,t,r){return function(e,t,r,i,o,n){for(var s=[0,e.length-1,0],a=[],l=o*o;s.length;){var u=s.pop(),h=s.pop(),c=s.pop();if(h-c<=n)for(var p=c;p<=h;p++)N(t[2*p],t[2*p+1],r,i)<=l&&a.push(e[p]);else {var f=Math.floor((c+h)/2),g=t[2*f],d=t[2*f+1];N(g,d,r,i)<=l&&a.push(e[f]);var v=(u+1)%2;(0===u?r-o<=g:i-o<=d)&&(s.push(c),s.push(f-1),s.push(v)),(0===u?r+o>=g:i+o>=d)&&(s.push(f+1),s.push(h),s.push(v));}}return a}(this.ids,this.coords,e,t,r,this.nodeSize)};var Z,G={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},Y=Math.fround||(Z=new Float32Array(1),function(e){return Z[0]=+e,Z[0]}),j=function(e){this.options=H(Object.create(G),e),this.trees=new Array(this.options.maxZoom+1);};function V(e,t,r,i,o){return {x:Y(e),y:Y(t),zoom:1/0,id:r,parentId:-1,numPoints:i,properties:o}}function X(e,t){var r=e.geometry.coordinates,i=r[1];return {x:Y(q(r[0])),y:Y(U(i)),zoom:1/0,index:t,parentId:-1}}function R(e){return {type:"Feature",id:e.id,properties:W(e),geometry:{type:"Point",coordinates:[(i=e.x,360*(i-.5)),(t=e.y,r=(180-360*t)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var t,r,i;}function W(e){var t=e.numPoints,r=t>=1e4?Math.round(t/1e3)+"k":t>=1e3?Math.round(t/100)/10+"k":t;return H(H({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:r})}function q(e){return e/360+.5}function U(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function H(e,t){for(var r in t)e[r]=t[r];return e}function K(e){return e.x}function Q(e){return e.y}function $(e,t,r,i){for(var o,n=i,s=r-t>>1,a=r-t,l=e[t],u=e[t+1],h=e[r],c=e[r+1],p=t+3;pn)o=p,n=f;else if(f===n){var g=Math.abs(p-s);gi&&(o-t>3&&$(e,t,o,i),e[o+2]=n,r-o>3&&$(e,o,r,i));}function ee(e,t,r,i,o,n){var s=o-r,a=n-i;if(0!==s||0!==a){var l=((e-r)*s+(t-i)*a)/(s*s+a*a);l>1?(r=o,i=n):l>0&&(r+=s*l,i+=a*l);}return (s=e-r)*s+(a=t-i)*a}function te(e,t,r,i){var o={id:void 0===e?null:e,type:t,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,r=e.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)re(e,t);else if("Polygon"===r||"MultiLineString"===r)for(var i=0;i0&&(s+=i?(o*u-l*n)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-n,2))),o=l,n=u;}var h=t.length-3;t[2]=1,$(t,0,h,r),t[h+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size;}function se(e,t,r,i){for(var o=0;o1?1:r}function ue(e,t,r,i,o,n,s,a){if(i/=t,n>=(r/=t)&&s=i)return null;for(var l=[],u=0;u=r&&g=i)){var d=[];if("Point"===p||"MultiPoint"===p)he(c,d,r,i,o);else if("LineString"===p)ce(c,d,r,i,o,!1,a.lineMetrics);else if("MultiLineString"===p)fe(c,d,r,i,o,!1);else if("Polygon"===p)fe(c,d,r,i,o,!0);else if("MultiPolygon"===p)for(var v=0;v=r&&s<=i&&(t.push(e[n]),t.push(e[n+1]),t.push(e[n+2]));}}function ce(e,t,r,i,o,n,s){for(var a,l,u=pe(e),h=0===o?de:ve,c=e.start,p=0;pr&&(l=h(u,f,g,v,m,r),s&&(u.start=c+a*l)):y>i?x=r&&(l=h(u,f,g,v,m,r),w=!0),x>i&&y<=i&&(l=h(u,f,g,v,m,i),w=!0),!n&&w&&(s&&(u.end=c+a*l),t.push(u),u=pe(e)),s&&(c+=a);}var S=e.length-3;f=e[S],g=e[S+1],d=e[S+2],(y=0===o?f:g)>=r&&y<=i&&ge(u,f,g,d),S=u.length-3,n&&S>=3&&(u[S]!==u[0]||u[S+1]!==u[1])&&ge(u,u[0],u[1],u[2]),u.length&&t.push(u);}function pe(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function fe(e,t,r,i,o,n){for(var s=0;ss.maxX&&(s.maxX=h),c>s.maxY&&(s.maxY=c);}return s}function Me(e,t,r,i){var o=t.geometry,n=t.type,s=[];if("Point"===n||"MultiPoint"===n)for(var a=0;a0&&t.size<(o?s:i))r.numPoints+=t.length/3;else {for(var a=[],l=0;ls)&&(r.numSimplified++,a.push(t[l]),a.push(t[l+1])),r.numPoints++;o&&function(e,t){for(var r=0,i=0,o=e.length,n=o-2;i0===t)for(i=0,o=e.length;i24)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 i=function(e,t){var r=[];if("FeatureCollection"===e.type)for(var i=0;i=i;u--){var h=+Date.now();a=this._cluster(a,u),this.trees[u]=new J(a,K,Q,n,Float32Array),r&&console.log("z%d: %d clusters in %dms",u,a.length,+Date.now()-h);}return r&&console.timeEnd("total time"),this},j.prototype.getClusters=function(e,t){var r=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=180===e[2]?180:((e[2]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,o=180;else if(r>o){var s=this.getClusters([r,i,180,n],t),a=this.getClusters([-180,i,o,n],t);return s.concat(a)}for(var l=this.trees[this._limitZoom(t)],u=[],h=0,c=l.range(q(r),U(n),q(o),U(i));ht&&(p+=d.numPoints||1);}if(p>c&&p>=n){for(var v=l.x*c,m=l.y*c,y=o&&c>1?this._map(l,!0):null,x=(a<<5)+(t+1)+this.points.length,w=0,S=h;w1)for(var b=0,k=h;b>5},j.prototype._getOriginZoom=function(e){return (e-this.points.length)%32},j.prototype._map=function(e,t){if(e.numPoints)return t?H({},e.properties):e.properties;var r=this.points[e.index].properties,i=this.options.map(r);return t&&i===r?H({},i):i},be.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},be.prototype.splitTile=function(e,t,r,i,o,n,s){for(var a=[e,t,r,i],l=this.options,u=l.debug;a.length;){i=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();var h=1<1&&console.time("creation"),p=this.tiles[c]=Se(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++;}if(p.source=e,o){if(t===l.maxZoom||t===o)continue;var g=1<1&&console.time("clipping");var d,v,m,y,x,w,S=.5*l.buffer/l.extent,M=.5-S,I=.5+S,b=1+S;d=v=m=y=null,x=ue(e,h,r-S,r+I,0,p.minX,p.maxX,l),w=ue(e,h,r+M,r+b,0,p.minX,p.maxX,l),e=null,x&&(d=ue(x,h,i-S,i+I,1,p.minY,p.maxY,l),v=ue(x,h,i+M,i+b,1,p.minY,p.maxY,l),x=null),w&&(m=ue(w,h,i-S,i+I,1,p.minY,p.maxY,l),y=ue(w,h,i+M,i+b,1,p.minY,p.maxY,l),w=null),u>1&&console.timeEnd("clipping"),a.push(d||[],t+1,2*r,2*i),a.push(v||[],t+1,2*r,2*i+1),a.push(m||[],t+1,2*r+1,2*i),a.push(y||[],t+1,2*r+1,2*i+1);}}},be.prototype.getTile=function(e,t,r){var i=this.options,o=i.extent,n=i.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l,u=e,h=t,c=r;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[ke(u,h,c)];return l&&l.source?(n>1&&console.log("found parent tile z%d-%d-%d",u,h,c),n>1&&console.time("drilling down"),this.splitTile(l.source,u,h,c,e,t,r),n>1&&console.timeEnd("drilling down"),this.tiles[a]?xe(this.tiles[a],o):null):null};var Te=function(t){function r(e,r,i,o){t.call(this,e,r,i,Pe),o&&(this.loadGeoJSON=o);}return t&&(r.__proto__=t),(r.prototype=Object.create(t&&t.prototype)).constructor=r,r.prototype.loadData=function(t,r){var i,o=this;null===(i=this._pendingRequest)||void 0===i||i.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});var n=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=r,this._pendingRequest=this.loadGeoJSON(t,(function(i,s){if(delete o._pendingCallback,delete o._pendingRequest,i||!s)return r(i);if("object"!=typeof s)return r(new Error("Input data given to '"+t.source+"' is not a valid GeoJSON object."));h(s,!0);try{if(t.filter){var a=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===a.result)throw new Error(a.value.map((function(e){return e.key+": "+e.message})).join(", "));var l=s.features.filter((function(e){return a.value.evaluate({zoom:0},e)}));s={type:"FeatureCollection",features:l};}o._geoJSONIndex=t.cluster?new j(function(t){var r=t.superclusterOptions,i=t.clusterProperties;if(!i||!r)return r;for(var o={},n={},s={accumulated:null,zoom:0},a={properties:null},l=Object.keys(i),u=0,h=l;u 0) || + (this._oneTimeListeners && + this._oneTimeListeners[t] && + this._oneTimeListeners[t].length > 0) || + (this._eventedParent && this._eventedParent.listens(t)) + ); + }), + (vt.prototype.setEventedParent = function (t, e) { + return (this._eventedParent = t), (this._eventedParentData = e), this; + }); + var gt = { + $version: 8, + $root: { + version: { required: !0, type: 'enum', values: [8] }, + name: { type: 'string' }, + metadata: { type: '*' }, + center: { type: 'array', value: 'number' }, + zoom: { type: 'number' }, + bearing: { + type: 'number', + default: 0, + period: 360, + units: 'degrees', + }, + pitch: { type: 'number', default: 0, units: 'degrees' }, + light: { type: 'light' }, + terrain: { type: 'terrain' }, + sources: { required: !0, type: 'sources' }, + sprite: { type: 'string' }, + glyphs: { type: 'string' }, + transition: { type: 'transition' }, + layers: { required: !0, type: 'array', value: 'layer' }, + }, + sources: { '*': { type: 'source' } }, + source: [ + 'source_vector', + 'source_raster', + 'source_raster_dem', + 'source_geojson', + 'source_video', + 'source_image', + ], + source_vector: { + type: { required: !0, type: 'enum', values: { vector: {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + scheme: { + type: 'enum', + values: { xyz: {}, tms: {} }, + default: 'xyz', + }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + attribution: { type: 'string' }, + promoteId: { type: 'promoteId' }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_raster: { + type: { required: !0, type: 'enum', values: { raster: {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + tileSize: { type: 'number', default: 512, units: 'pixels' }, + scheme: { + type: 'enum', + values: { xyz: {}, tms: {} }, + default: 'xyz', + }, + attribution: { type: 'string' }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_raster_dem: { + type: { required: !0, type: 'enum', values: { 'raster-dem': {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + tileSize: { type: 'number', default: 512, units: 'pixels' }, + attribution: { type: 'string' }, + encoding: { + type: 'enum', + values: { terrarium: {}, mapbox: {} }, + default: 'mapbox', + }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_geojson: { + type: { required: !0, type: 'enum', values: { geojson: {} } }, + data: { type: '*' }, + maxzoom: { type: 'number', default: 18 }, + attribution: { type: 'string' }, + buffer: { type: 'number', default: 128, maximum: 512, minimum: 0 }, + filter: { type: '*' }, + tolerance: { type: 'number', default: 0.375 }, + cluster: { type: 'boolean', default: !1 }, + clusterRadius: { type: 'number', default: 50, minimum: 0 }, + clusterMaxZoom: { type: 'number' }, + clusterMinPoints: { type: 'number' }, + clusterProperties: { type: '*' }, + lineMetrics: { type: 'boolean', default: !1 }, + generateId: { type: 'boolean', default: !1 }, + promoteId: { type: 'promoteId' }, + }, + source_video: { + type: { required: !0, type: 'enum', values: { video: {} } }, + urls: { required: !0, type: 'array', value: 'string' }, + coordinates: { + required: !0, + type: 'array', + length: 4, + value: { type: 'array', length: 2, value: 'number' }, + }, + }, + source_image: { + type: { required: !0, type: 'enum', values: { image: {} } }, + url: { required: !0, type: 'string' }, + coordinates: { + required: !0, + type: 'array', + length: 4, + value: { type: 'array', length: 2, value: 'number' }, + }, + }, + layer: { + id: { type: 'string', required: !0 }, + type: { + type: 'enum', + values: { + fill: {}, + line: {}, + symbol: {}, + circle: {}, + heatmap: {}, + 'fill-extrusion': {}, + raster: {}, + hillshade: {}, + background: {}, + }, + required: !0, + }, + metadata: { type: '*' }, + source: { type: 'string' }, + 'source-layer': { type: 'string' }, + minzoom: { type: 'number', minimum: 0, maximum: 24 }, + maxzoom: { type: 'number', minimum: 0, maximum: 24 }, + filter: { type: 'filter' }, + layout: { type: 'layout' }, + paint: { type: 'paint' }, + }, + layout: [ + 'layout_fill', + 'layout_line', + 'layout_circle', + 'layout_heatmap', + 'layout_fill-extrusion', + 'layout_symbol', + 'layout_raster', + 'layout_hillshade', + 'layout_background', + ], + layout_background: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_fill: { + 'fill-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_circle: { + 'circle-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_heatmap: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + 'layout_fill-extrusion': { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_line: { + 'line-cap': { + type: 'enum', + values: { butt: {}, round: {}, square: {} }, + default: 'butt', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-join': { + type: 'enum', + values: { bevel: {}, round: {}, miter: {} }, + default: 'miter', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'line-miter-limit': { + type: 'number', + default: 2, + requires: [{ 'line-join': 'miter' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-round-limit': { + type: 'number', + default: 1.05, + requires: [{ 'line-join': 'round' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_symbol: { + 'symbol-placement': { + type: 'enum', + values: { point: {}, line: {}, 'line-center': {} }, + default: 'point', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-spacing': { + type: 'number', + default: 250, + minimum: 1, + units: 'pixels', + requires: [{ 'symbol-placement': 'line' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-avoid-edges': { + type: 'boolean', + default: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'symbol-z-order': { + type: 'enum', + values: { auto: {}, 'viewport-y': {}, source: {} }, + default: 'auto', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-allow-overlap': { + type: 'boolean', + default: !1, + requires: ['icon-image', { '!': 'icon-overlap' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-overlap': { + type: 'enum', + values: { never: {}, always: {}, cooperative: {} }, + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-ignore-placement': { + type: 'boolean', + default: !1, + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-optional': { + type: 'boolean', + default: !1, + requires: ['icon-image', 'text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-rotation-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-size': { + type: 'number', + default: 1, + minimum: 0, + units: 'factor of the original icon size', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-text-fit': { + type: 'enum', + values: { none: {}, width: {}, height: {}, both: {} }, + default: 'none', + requires: ['icon-image', 'text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-text-fit-padding': { + type: 'array', + value: 'number', + length: 4, + default: [0, 0, 0, 0], + units: 'pixels', + requires: [ + 'icon-image', + 'text-field', + { 'icon-text-fit': ['both', 'width', 'height'] }, + ], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-image': { + type: 'resolvedImage', + tokens: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-rotate': { + type: 'number', + default: 0, + period: 360, + units: 'degrees', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-padding': { + type: 'padding', + default: [2], + units: 'pixels', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-keep-upright': { + type: 'boolean', + default: !1, + requires: [ + 'icon-image', + { 'icon-rotation-alignment': 'map' }, + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-offset': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-anchor': { + type: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + default: 'center', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-rotation-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, 'viewport-glyph': {}, auto: {} }, + default: 'auto', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-field': { + type: 'formatted', + default: '', + tokens: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-font': { + type: 'array', + value: 'string', + default: ['Open Sans Regular', 'Arial Unicode MS Regular'], + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-size': { + type: 'number', + default: 16, + minimum: 0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-max-width': { + type: 'number', + default: 10, + minimum: 0, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-line-height': { + type: 'number', + default: 1.2, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-letter-spacing': { + type: 'number', + default: 0, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-justify': { + type: 'enum', + values: { auto: {}, left: {}, center: {}, right: {} }, + default: 'center', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-radial-offset': { + type: 'number', + units: 'ems', + default: 0, + requires: ['text-field'], + 'property-type': 'data-driven', + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + }, + 'text-variable-anchor': { + type: 'array', + value: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + requires: ['text-field', { 'symbol-placement': ['point'] }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-anchor': { + type: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + default: 'center', + requires: ['text-field', { '!': 'text-variable-anchor' }], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-max-angle': { + type: 'number', + default: 45, + units: 'degrees', + requires: [ + 'text-field', + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-writing-mode': { + type: 'array', + value: 'enum', + values: { horizontal: {}, vertical: {} }, + requires: ['text-field', { 'symbol-placement': ['point'] }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-rotate': { + type: 'number', + default: 0, + period: 360, + units: 'degrees', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-padding': { + type: 'number', + default: 2, + minimum: 0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-keep-upright': { + type: 'boolean', + default: !0, + requires: [ + 'text-field', + { 'text-rotation-alignment': 'map' }, + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-transform': { + type: 'enum', + values: { none: {}, uppercase: {}, lowercase: {} }, + default: 'none', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-offset': { + type: 'array', + value: 'number', + units: 'ems', + length: 2, + default: [0, 0], + requires: ['text-field', { '!': 'text-radial-offset' }], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-allow-overlap': { + type: 'boolean', + default: !1, + requires: ['text-field', { '!': 'text-overlap' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-overlap': { + type: 'enum', + values: { never: {}, always: {}, cooperative: {} }, + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-ignore-placement': { + type: 'boolean', + default: !1, + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-optional': { + type: 'boolean', + default: !1, + requires: ['text-field', 'icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_raster: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_hillshade: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + filter: { type: 'array', value: '*' }, + filter_operator: { + type: 'enum', + values: { + '==': {}, + '!=': {}, + '>': {}, + '>=': {}, + '<': {}, + '<=': {}, + in: {}, + '!in': {}, + all: {}, + any: {}, + none: {}, + has: {}, + '!has': {}, + within: {}, + }, + }, + geometry_type: { + type: 'enum', + values: { Point: {}, LineString: {}, Polygon: {} }, + }, + function: { + expression: { type: 'expression' }, + stops: { type: 'array', value: 'function_stop' }, + base: { type: 'number', default: 1, minimum: 0 }, + property: { type: 'string', default: '$zoom' }, + type: { + type: 'enum', + values: { + identity: {}, + exponential: {}, + interval: {}, + categorical: {}, + }, + default: 'exponential', + }, + colorSpace: { + type: 'enum', + values: { rgb: {}, lab: {}, hcl: {} }, + default: 'rgb', + }, + default: { type: '*', required: !1 }, + }, + function_stop: { + type: 'array', + minimum: 0, + maximum: 24, + value: ['number', 'color'], + length: 2, + }, + expression: { type: 'array', value: '*', minimum: 1 }, + light: { + anchor: { + type: 'enum', + default: 'viewport', + values: { map: {}, viewport: {} }, + 'property-type': 'data-constant', + transition: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + }, + position: { + type: 'array', + default: [1.15, 210, 30], + length: 3, + value: 'number', + 'property-type': 'data-constant', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + }, + color: { + type: 'color', + 'property-type': 'data-constant', + default: '#ffffff', + expression: { interpolated: !0, parameters: ['zoom'] }, + transition: !0, + }, + intensity: { + type: 'number', + 'property-type': 'data-constant', + default: 0.5, + minimum: 0, + maximum: 1, + expression: { interpolated: !0, parameters: ['zoom'] }, + transition: !0, + }, + }, + terrain: { + source: { type: 'string', required: !0 }, + exaggeration: { type: 'number', minimum: 0, default: 1 }, + elevationOffset: { type: 'number', default: 450 }, + }, + paint: [ + 'paint_fill', + 'paint_line', + 'paint_circle', + 'paint_heatmap', + 'paint_fill-extrusion', + 'paint_symbol', + 'paint_raster', + 'paint_hillshade', + 'paint_background', + ], + paint_fill: { + 'fill-antialias': { + type: 'boolean', + default: !0, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'fill-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-outline-color': { + type: 'color', + transition: !0, + requires: [{ '!': 'fill-pattern' }, { 'fill-antialias': !0 }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['fill-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + }, + 'paint_fill-extrusion': { + 'fill-extrusion-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'fill-extrusion-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['fill-extrusion-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + 'fill-extrusion-height': { + type: 'number', + default: 0, + minimum: 0, + units: 'meters', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-base': { + type: 'number', + default: 0, + minimum: 0, + units: 'meters', + transition: !0, + requires: ['fill-extrusion-height'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-vertical-gradient': { + type: 'boolean', + default: !0, + transition: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_line: { + 'line-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'line-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['line-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-width': { + type: 'number', + default: 1, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-gap-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-offset': { + type: 'number', + default: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-dasharray': { + type: 'array', + value: 'number', + minimum: 0, + transition: !0, + units: 'line widths', + requires: [{ '!': 'line-pattern' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'cross-faded', + }, + 'line-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + 'line-gradient': { + type: 'color', + transition: !1, + requires: [ + { '!': 'line-dasharray' }, + { '!': 'line-pattern' }, + { source: 'geojson', has: { lineMetrics: !0 } }, + ], + expression: { interpolated: !0, parameters: ['line-progress'] }, + 'property-type': 'color-ramp', + }, + }, + paint_circle: { + 'circle-radius': { + type: 'number', + default: 5, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-blur': { + type: 'number', + default: 0, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['circle-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-pitch-scale': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'viewport', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-stroke-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-stroke-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-stroke-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + }, + paint_heatmap: { + 'heatmap-radius': { + type: 'number', + default: 30, + minimum: 1, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'heatmap-weight': { + type: 'number', + default: 1, + minimum: 0, + transition: !1, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'heatmap-intensity': { + type: 'number', + default: 1, + minimum: 0, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'heatmap-color': { + type: 'color', + default: [ + 'interpolate', + ['linear'], + ['heatmap-density'], + 0, + 'rgba(0, 0, 255, 0)', + 0.1, + 'royalblue', + 0.3, + 'cyan', + 0.5, + 'lime', + 0.7, + 'yellow', + 1, + 'red', + ], + transition: !1, + expression: { interpolated: !0, parameters: ['heatmap-density'] }, + 'property-type': 'color-ramp', + }, + 'heatmap-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_symbol: { + 'icon-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-color': { + type: 'color', + default: 'rgba(0, 0, 0, 0)', + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['icon-image', 'icon-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-color': { + type: 'color', + default: '#000000', + transition: !0, + overridable: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-color': { + type: 'color', + default: 'rgba(0, 0, 0, 0)', + transition: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['text-field', 'text-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_raster: { + 'raster-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-hue-rotate': { + type: 'number', + default: 0, + period: 360, + transition: !0, + units: 'degrees', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-brightness-min': { + type: 'number', + default: 0, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-brightness-max': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-saturation': { + type: 'number', + default: 0, + minimum: -1, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-contrast': { + type: 'number', + default: 0, + minimum: -1, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-resampling': { + type: 'enum', + values: { linear: {}, nearest: {} }, + default: 'linear', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-fade-duration': { + type: 'number', + default: 300, + minimum: 0, + transition: !1, + units: 'milliseconds', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_hillshade: { + 'hillshade-illumination-direction': { + type: 'number', + default: 335, + minimum: 0, + maximum: 359, + transition: !1, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-illumination-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'viewport', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-exaggeration': { + type: 'number', + default: 0.5, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-shadow-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-highlight-color': { + type: 'color', + default: '#FFFFFF', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-accent-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_background: { + 'background-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'background-pattern' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'background-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'cross-faded', + }, + 'background-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + transition: { + duration: { + type: 'number', + default: 300, + minimum: 0, + units: 'milliseconds', + }, + delay: { + type: 'number', + default: 0, + minimum: 0, + units: 'milliseconds', + }, + }, + 'property-type': { + 'data-driven': { type: 'property-type' }, + 'cross-faded': { type: 'property-type' }, + 'cross-faded-data-driven': { type: 'property-type' }, + 'color-ramp': { type: 'property-type' }, + 'data-constant': { type: 'property-type' }, + constant: { type: 'property-type' }, + }, + promoteId: { '*': { type: 'string' } }, + }, + xt = function (t, e, r, n) { + (this.message = (t ? t + ': ' : '') + r), + n && (this.identifier = n), + null != e && e.__line__ && (this.line = e.__line__); + }; + function bt(t) { + var e = t.value; + return e + ? [new xt(t.key, e, 'constants have been deprecated as of v8')] + : []; + } + function wt(t) { + for (var e = [], r = arguments.length - 1; r-- > 0; ) + e[r] = arguments[r + 1]; + for (var n = 0, i = e; n < i.length; n += 1) { + var a = i[n]; + for (var o in a) t[o] = a[o]; + } + return t; + } + function _t(t) { + return t instanceof Number || t instanceof String || t instanceof Boolean + ? t.valueOf() + : t; + } + function At(t) { + if (Array.isArray(t)) return t.map(At); + if ( + t instanceof Object && + !(t instanceof Number || t instanceof String || t instanceof Boolean) + ) { + var e = {}; + for (var r in t) e[r] = At(t[r]); + return e; + } + return _t(t); + } + var kt = (function (t) { + function e(e, r) { + t.call(this, r), (this.message = r), (this.key = e); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Error), + St = function (t, e) { + void 0 === e && (e = []), (this.parent = t), (this.bindings = {}); + for (var r = 0, n = e; r < n.length; r += 1) { + var i = n[r]; + this.bindings[i[0]] = i[1]; + } + }; + (St.prototype.concat = function (t) { + return new St(this, t); + }), + (St.prototype.get = function (t) { + if (this.bindings[t]) return this.bindings[t]; + if (this.parent) return this.parent.get(t); + throw new Error(t + ' not found in scope.'); + }), + (St.prototype.has = function (t) { + return !!this.bindings[t] || (!!this.parent && this.parent.has(t)); + }); + var It = { kind: 'null' }, + Mt = { kind: 'number' }, + zt = { kind: 'string' }, + Pt = { kind: 'boolean' }, + Bt = { kind: 'color' }, + Ct = { kind: 'object' }, + Et = { kind: 'value' }, + Vt = { kind: 'collator' }, + Tt = { kind: 'formatted' }, + Ft = { kind: 'padding' }, + Ot = { kind: 'resolvedImage' }; + function Lt(t, e) { + return { kind: 'array', itemType: t, N: e }; + } + function Dt(t) { + if ('array' === t.kind) { + var e = Dt(t.itemType); + return 'number' == typeof t.N + ? 'array<' + e + ', ' + t.N + '>' + : 'value' === t.itemType.kind + ? 'array' + : 'array<' + e + '>'; + } + return t.kind; + } + var jt = [It, Mt, zt, Pt, Bt, Tt, Ct, Lt(Et), Ft, Ot]; + function Rt(t, e) { + if ('error' === e.kind) return null; + if ('array' === t.kind) { + if ( + 'array' === e.kind && + ((0 === e.N && 'value' === e.itemType.kind) || + !Rt(t.itemType, e.itemType)) && + ('number' != typeof t.N || t.N === e.N) + ) + return null; + } else { + if (t.kind === e.kind) return null; + if ('value' === t.kind) + for (var r = 0, n = jt; r < n.length; r += 1) + if (!Rt(n[r], e)) return null; + } + return 'Expected ' + Dt(t) + ' but found ' + Dt(e) + ' instead.'; + } + function Ut(t, e) { + return e.some(function (e) { + return e.kind === t.kind; + }); + } + function qt(t, e) { + return e.some(function (e) { + return 'null' === e + ? null === t + : 'array' === e + ? Array.isArray(t) + : 'object' === e + ? t && !Array.isArray(t) && 'object' == typeof t + : e === typeof t; + }); + } + var Nt, + Zt = { + 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 Kt(t) { + return (t = Math.round(t)) < 0 ? 0 : t > 255 ? 255 : t; + } + function Gt(t) { + return Kt( + '%' === t[t.length - 1] ? (parseFloat(t) / 100) * 255 : parseInt(t), + ); + } + function Jt(t) { + return (e = + '%' === t[t.length - 1] ? parseFloat(t) / 100 : parseFloat(t)) < 0 + ? 0 + : e > 1 + ? 1 + : e; + var e; + } + function Xt(t, e, r) { + return ( + r < 0 ? (r += 1) : r > 1 && (r -= 1), + 6 * r < 1 + ? t + (e - t) * r * 6 + : 2 * r < 1 + ? e + : 3 * r < 2 + ? t + (e - t) * (2 / 3 - r) * 6 + : t + ); + } + try { + Nt = {}.parseCSSColor = function (t) { + var e, + r = t.replace(/ /g, '').toLowerCase(); + if (r in Zt) return Zt[r].slice(); + if ('#' === r[0]) + return 4 === r.length + ? (e = parseInt(r.substr(1), 16)) >= 0 && e <= 4095 + ? [ + ((3840 & e) >> 4) | ((3840 & e) >> 8), + (240 & e) | ((240 & e) >> 4), + (15 & e) | ((15 & e) << 4), + 1, + ] + : null + : 7 === r.length && + (e = parseInt(r.substr(1), 16)) >= 0 && + e <= 16777215 + ? [(16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 1] + : null; + var n = r.indexOf('('), + i = r.indexOf(')'); + if (-1 !== n && i + 1 === r.length) { + var a = r.substr(0, n), + o = r.substr(n + 1, i - (n + 1)).split(','), + s = 1; + switch (a) { + case 'rgba': + if (4 !== o.length) return null; + s = Jt(o.pop()); + case 'rgb': + return 3 !== o.length ? null : [Gt(o[0]), Gt(o[1]), Gt(o[2]), s]; + case 'hsla': + if (4 !== o.length) return null; + s = Jt(o.pop()); + case 'hsl': + if (3 !== o.length) return null; + var u = (((parseFloat(o[0]) % 360) + 360) % 360) / 360, + l = Jt(o[1]), + p = Jt(o[2]), + c = p <= 0.5 ? p * (l + 1) : p + l - p * l, + h = 2 * p - c; + return [ + Kt(255 * Xt(h, c, u + 1 / 3)), + Kt(255 * Xt(h, c, u)), + Kt(255 * Xt(h, c, u - 1 / 3)), + s, + ]; + default: + return null; + } + } + return null; + }; + } catch (t) {} + var Yt = function (t, e, r, n) { + void 0 === n && (n = 1), + (this.r = t), + (this.g = e), + (this.b = r), + (this.a = n); + }; + (Yt.parse = function (t) { + if (t) { + if (t instanceof Yt) return t; + if ('string' == typeof t) { + var e = Nt(t); + if (e) + return new Yt( + (e[0] / 255) * e[3], + (e[1] / 255) * e[3], + (e[2] / 255) * e[3], + e[3], + ); + } + } + }), + (Yt.prototype.toString = function () { + var t = this.toArray(), + e = t[1], + r = t[2], + n = t[3]; + return ( + 'rgba(' + + Math.round(t[0]) + + ',' + + Math.round(e) + + ',' + + Math.round(r) + + ',' + + n + + ')' + ); + }), + (Yt.prototype.toArray = function () { + var t = this, + e = t.a; + return 0 === e + ? [0, 0, 0, 0] + : [(255 * t.r) / e, (255 * t.g) / e, (255 * t.b) / e, e]; + }), + (Yt.black = new Yt(0, 0, 0, 1)), + (Yt.white = new Yt(1, 1, 1, 1)), + (Yt.transparent = new Yt(0, 0, 0, 0)), + (Yt.red = new Yt(1, 0, 0, 1)); + var Ht = function (t, e, r) { + (this.sensitivity = t ? (e ? 'variant' : 'case') : e ? 'accent' : 'base'), + (this.locale = r), + (this.collator = new Intl.Collator(this.locale ? this.locale : [], { + sensitivity: this.sensitivity, + usage: 'search', + })); + }; + (Ht.prototype.compare = function (t, e) { + return this.collator.compare(t, e); + }), + (Ht.prototype.resolvedLocale = function () { + return new Intl.Collator( + this.locale ? this.locale : [], + ).resolvedOptions().locale; + }); + var Wt = function (t, e, r, n, i) { + (this.text = t), + (this.image = e), + (this.scale = r), + (this.fontStack = n), + (this.textColor = i); + }, + $t = function (t) { + this.sections = t; + }; + ($t.fromString = function (t) { + return new $t([new Wt(t, null, null, null, null)]); + }), + ($t.prototype.isEmpty = function () { + return ( + 0 === this.sections.length || + !this.sections.some(function (t) { + return ( + 0 !== t.text.length || (t.image && 0 !== t.image.name.length) + ); + }) + ); + }), + ($t.factory = function (t) { + return t instanceof $t ? t : $t.fromString(t); + }), + ($t.prototype.toString = function () { + return 0 === this.sections.length + ? '' + : this.sections + .map(function (t) { + return t.text; + }) + .join(''); + }); + var Qt = function (t) { + this.values = t.slice(); + }; + (Qt.parse = function (t) { + if (t instanceof Qt) return t; + if ('number' == typeof t) return new Qt([t, t, t, t]); + if (Array.isArray(t) && !(t.length < 1 || t.length > 4)) { + for (var e = 0, r = t; e < r.length; e += 1) + if ('number' != typeof r[e]) return; + switch (t.length) { + case 1: + t = [t[0], t[0], t[0], t[0]]; + break; + case 2: + t = [t[0], t[1], t[0], t[1]]; + break; + case 3: + t = [t[0], t[1], t[2], t[1]]; + } + return new Qt(t); + } + }), + (Qt.prototype.toString = function () { + return JSON.stringify(this.values); + }); + var te = function (t) { + (this.name = t.name), (this.available = t.available); + }; + function ee(t, e, r, n) { + return 'number' == typeof t && + t >= 0 && + t <= 255 && + 'number' == typeof e && + e >= 0 && + e <= 255 && + 'number' == typeof r && + r >= 0 && + r <= 255 + ? void 0 === n || ('number' == typeof n && n >= 0 && n <= 1) + ? null + : 'Invalid rgba value [' + + [t, e, r, n].join(', ') + + "]: 'a' must be between 0 and 1." + : 'Invalid rgba value [' + + ('number' == typeof n ? [t, e, r, n] : [t, e, r]).join(', ') + + "]: 'r', 'g', and 'b' must be between 0 and 255."; + } + function re(t) { + if (null === t) return !0; + if ('string' == typeof t) return !0; + if ('boolean' == typeof t) return !0; + if ('number' == typeof t) return !0; + if (t instanceof Yt) return !0; + if (t instanceof Ht) return !0; + if (t instanceof $t) return !0; + if (t instanceof Qt) return !0; + if (t instanceof te) return !0; + if (Array.isArray(t)) { + for (var e = 0, r = t; e < r.length; e += 1) if (!re(r[e])) return !1; + return !0; + } + if ('object' == typeof t) { + for (var n in t) if (!re(t[n])) return !1; + return !0; + } + return !1; + } + function ne(t) { + if (null === t) return It; + if ('string' == typeof t) return zt; + if ('boolean' == typeof t) return Pt; + if ('number' == typeof t) return Mt; + if (t instanceof Yt) return Bt; + if (t instanceof Ht) return Vt; + if (t instanceof $t) return Tt; + if (t instanceof Qt) return Ft; + if (t instanceof te) return Ot; + if (Array.isArray(t)) { + for (var e, r = t.length, n = 0, i = t; n < i.length; n += 1) { + var a = ne(i[n]); + if (e) { + if (e === a) continue; + e = Et; + break; + } + e = a; + } + return Lt(e || Et, r); + } + return Ct; + } + function ie(t) { + var e = typeof t; + return null === t + ? '' + : 'string' === e || 'number' === e || 'boolean' === e + ? String(t) + : t instanceof Yt || + t instanceof $t || + t instanceof Qt || + t instanceof te + ? t.toString() + : JSON.stringify(t); + } + (te.prototype.toString = function () { + return this.name; + }), + (te.fromString = function (t) { + return t ? new te({ name: t, available: !1 }) : null; + }); + var ae = function (t, e) { + (this.type = t), (this.value = e); + }; + (ae.parse = function (t, e) { + if (2 !== t.length) + return e.error( + "'literal' expression requires exactly one argument, but found " + + (t.length - 1) + + ' instead.', + ); + if (!re(t[1])) return e.error('invalid value'); + var r = t[1], + n = ne(r), + i = e.expectedType; + return ( + 'array' !== n.kind || + 0 !== n.N || + !i || + 'array' !== i.kind || + ('number' == typeof i.N && 0 !== i.N) || + (n = i), + new ae(n, r) + ); + }), + (ae.prototype.evaluate = function () { + return this.value; + }), + (ae.prototype.eachChild = function () {}), + (ae.prototype.outputDefined = function () { + return !0; + }); + var oe = function (t) { + (this.name = 'ExpressionEvaluationError'), (this.message = t); + }; + oe.prototype.toJSON = function () { + return this.message; + }; + var se = { string: zt, number: Mt, boolean: Pt, object: Ct }, + ue = function (t, e) { + (this.type = t), (this.args = e); + }; + (ue.parse = function (t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + var r, + n = 1, + i = t[0]; + if ('array' === i) { + var a, o; + if (t.length > 2) { + var s = t[1]; + if ('string' != typeof s || !(s in se) || 'object' === s) + return e.error( + 'The item type argument of "array" must be one of string, number, boolean', + 1, + ); + (a = se[s]), n++; + } else a = Et; + if (t.length > 3) { + if ( + null !== t[2] && + ('number' != typeof t[2] || t[2] < 0 || t[2] !== Math.floor(t[2])) + ) + return e.error( + 'The length argument to "array" must be a positive integer literal', + 2, + ); + (o = t[2]), n++; + } + r = Lt(a, o); + } else { + if (!se[i]) throw new Error("Types doesn't contain name = " + i); + r = se[i]; + } + for (var u = []; n < t.length; n++) { + var l = e.parse(t[n], n, Et); + if (!l) return null; + u.push(l); + } + return new ue(r, u); + }), + (ue.prototype.evaluate = function (t) { + for (var e = 0; e < this.args.length; e++) { + var r = this.args[e].evaluate(t); + if (!Rt(this.type, ne(r))) return r; + if (e === this.args.length - 1) + throw new oe( + 'Expected value to be of type ' + + Dt(this.type) + + ', but found ' + + Dt(ne(r)) + + ' instead.', + ); + } + throw new Error(); + }), + (ue.prototype.eachChild = function (t) { + this.args.forEach(t); + }), + (ue.prototype.outputDefined = function () { + return this.args.every(function (t) { + return t.outputDefined(); + }); + }); + var le = { + 'to-boolean': Pt, + 'to-color': Bt, + 'to-number': Mt, + 'to-string': zt, + }, + pe = function (t, e) { + (this.type = t), (this.args = e); + }; + (pe.parse = function (t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + var r = t[0]; + if (!le[r]) + throw new Error( + "Can't parse " + r + ' as it is not part of the known types', + ); + if (('to-boolean' === r || 'to-string' === r) && 2 !== t.length) + return e.error('Expected one argument.'); + for (var n = le[r], i = [], a = 1; a < t.length; a++) { + var o = e.parse(t[a], a, Et); + if (!o) return null; + i.push(o); + } + return new pe(n, i); + }), + (pe.prototype.evaluate = function (t) { + if ('boolean' === this.type.kind) + return Boolean(this.args[0].evaluate(t)); + if ('color' === this.type.kind) { + for (var e, r, n = 0, i = this.args; n < i.length; n += 1) { + if (((r = null), (e = i[n].evaluate(t)) instanceof Yt)) return e; + if ('string' == typeof e) { + var a = t.parseColor(e); + if (a) return a; + } else if ( + Array.isArray(e) && + !(r = + e.length < 3 || e.length > 4 + ? 'Invalid rbga value ' + + JSON.stringify(e) + + ': expected an array containing either three or four numeric values.' + : ee(e[0], e[1], e[2], e[3])) + ) + return new Yt(e[0] / 255, e[1] / 255, e[2] / 255, e[3]); + } + throw new oe( + r || + "Could not parse color from value '" + + ('string' == typeof e ? e : JSON.stringify(e)) + + "'", + ); + } + if ('padding' === this.type.kind) { + for (var o, s = 0, u = this.args; s < u.length; s += 1) { + o = u[s].evaluate(t); + var l = Qt.parse(o); + if (l) return l; + } + throw new oe( + "Could not parse padding from value '" + + ('string' == typeof o ? o : JSON.stringify(o)) + + "'", + ); + } + if ('number' === this.type.kind) { + for (var p = null, c = 0, h = this.args; c < h.length; c += 1) { + if (null === (p = h[c].evaluate(t))) return 0; + var f = Number(p); + if (!isNaN(f)) return f; + } + throw new oe( + 'Could not convert ' + JSON.stringify(p) + ' to number.', + ); + } + return 'formatted' === this.type.kind + ? $t.fromString(ie(this.args[0].evaluate(t))) + : 'resolvedImage' === this.type.kind + ? te.fromString(ie(this.args[0].evaluate(t))) + : ie(this.args[0].evaluate(t)); + }), + (pe.prototype.eachChild = function (t) { + this.args.forEach(t); + }), + (pe.prototype.outputDefined = function () { + return this.args.every(function (t) { + return t.outputDefined(); + }); + }); + var ce = ['Unknown', 'Point', 'LineString', 'Polygon'], + he = function () { + (this.globals = null), + (this.feature = null), + (this.featureState = null), + (this.formattedSection = null), + (this._parseColorCache = {}), + (this.availableImages = null), + (this.canonical = null); + }; + (he.prototype.id = function () { + return this.feature && 'id' in this.feature ? this.feature.id : null; + }), + (he.prototype.geometryType = function () { + return this.feature + ? 'number' == typeof this.feature.type + ? ce[this.feature.type] + : this.feature.type + : null; + }), + (he.prototype.geometry = function () { + return this.feature && 'geometry' in this.feature + ? this.feature.geometry + : null; + }), + (he.prototype.canonicalID = function () { + return this.canonical; + }), + (he.prototype.properties = function () { + return (this.feature && this.feature.properties) || {}; + }), + (he.prototype.parseColor = function (t) { + var e = this._parseColorCache[t]; + return e || (e = this._parseColorCache[t] = Yt.parse(t)), e; + }); + var fe = function (t, e, r, n) { + (this.name = t), (this.type = e), (this._evaluate = r), (this.args = n); + }; + (fe.prototype.evaluate = function (t) { + return this._evaluate(t, this.args); + }), + (fe.prototype.eachChild = function (t) { + this.args.forEach(t); + }), + (fe.prototype.outputDefined = function () { + return !1; + }), + (fe.parse = function (t, e) { + var r, + n = t[0], + i = fe.definitions[n]; + if (!i) + return e.error( + 'Unknown expression "' + + n + + '". If you wanted a literal array, use ["literal", [...]].', + 0, + ); + for ( + var a = Array.isArray(i) ? i[0] : i.type, + o = Array.isArray(i) ? [[i[1], i[2]]] : i.overloads, + s = o.filter(function (e) { + var r = e[0]; + return !Array.isArray(r) || r.length === t.length - 1; + }), + u = null, + l = 0, + p = s; + l < p.length; + l += 1 + ) { + var c = p[l], + h = c[0], + f = c[1]; + u = new Oe(e.registry, e.path, null, e.scope); + for (var y = [], d = !1, m = 1; m < t.length; m++) { + var v = t[m], + g = Array.isArray(h) ? h[m - 1] : h.type, + x = u.parse(v, 1 + y.length, g); + if (!x) { + d = !0; + break; + } + y.push(x); + } + if (!d) + if (Array.isArray(h) && h.length !== y.length) + u.error( + 'Expected ' + + h.length + + ' arguments, but found ' + + y.length + + ' instead.', + ); + else { + for (var b = 0; b < y.length; b++) { + var w = Array.isArray(h) ? h[b] : h.type, + _ = y[b]; + u.concat(b + 1).checkSubtype(w, _.type); + } + if (0 === u.errors.length) return new fe(n, a, f, y); + } + } + if (1 === s.length) (r = e.errors).push.apply(r, u.errors); + else { + for ( + var A = (s.length ? s : o) + .map(function (t) { + var e; + return ( + (e = t[0]), + Array.isArray(e) + ? '(' + e.map(Dt).join(', ') + ')' + : '(' + Dt(e.type) + '...)' + ); + }) + .join(' | '), + k = [], + S = 1; + S < t.length; + S++ + ) { + var I = e.parse(t[S], 1 + k.length); + if (!I) return null; + k.push(Dt(I.type)); + } + e.error( + 'Expected arguments of type ' + + A + + ', but found (' + + k.join(', ') + + ') instead.', + ); + } + return null; + }), + (fe.register = function (t, e) { + for (var r in ((fe.definitions = e), e)) t[r] = fe; + }); + var ye = function (t, e, r) { + (this.type = Vt), + (this.locale = r), + (this.caseSensitive = t), + (this.diacriticSensitive = e); + }; + (ye.parse = function (t, e) { + if (2 !== t.length) return e.error('Expected one argument.'); + var r = t[1]; + if ('object' != typeof r || Array.isArray(r)) + return e.error('Collator options argument must be an object.'); + var n = e.parse( + void 0 !== r['case-sensitive'] && r['case-sensitive'], + 1, + Pt, + ); + if (!n) return null; + var i = e.parse( + void 0 !== r['diacritic-sensitive'] && r['diacritic-sensitive'], + 1, + Pt, + ); + if (!i) return null; + var a = null; + return r.locale && !(a = e.parse(r.locale, 1, zt)) + ? null + : new ye(n, i, a); + }), + (ye.prototype.evaluate = function (t) { + return new Ht( + this.caseSensitive.evaluate(t), + this.diacriticSensitive.evaluate(t), + this.locale ? this.locale.evaluate(t) : null, + ); + }), + (ye.prototype.eachChild = function (t) { + t(this.caseSensitive), + t(this.diacriticSensitive), + this.locale && t(this.locale); + }), + (ye.prototype.outputDefined = function () { + return !1; + }); + var de = 8192; + function me(t, e) { + (t[0] = Math.min(t[0], e[0])), + (t[1] = Math.min(t[1], e[1])), + (t[2] = Math.max(t[2], e[0])), + (t[3] = Math.max(t[3], e[1])); + } + function ve(t, e) { + return !(t[0] <= e[0] || t[2] >= e[2] || t[1] <= e[1] || t[3] >= e[3]); + } + function ge(t, e) { + var r = (180 + t[0]) / 360, + n = + (180 - + (180 / Math.PI) * + Math.log(Math.tan(Math.PI / 4 + (t[1] * Math.PI) / 360))) / + 360, + i = Math.pow(2, e.z); + return [Math.round(r * i * de), Math.round(n * i * de)]; + } + function xe(t, e, r) { + return ( + e[1] > t[1] != r[1] > t[1] && + t[0] < ((r[0] - e[0]) * (t[1] - e[1])) / (r[1] - e[1]) + e[0] + ); + } + function be(t, e) { + for (var r, n, i, a, o, s, u, l = !1, p = 0, c = e.length; p < c; p++) + for (var h = e[p], f = 0, y = h.length; f < y - 1; f++) { + if ( + (a = (r = t)[0] - (n = h[f])[0]) * (u = r[1] - (i = h[f + 1])[1]) - + (s = r[0] - i[0]) * (o = r[1] - n[1]) == + 0 && + a * s <= 0 && + o * u <= 0 + ) + return !1; + xe(t, h[f], h[f + 1]) && (l = !l); + } + return l; + } + function we(t, e) { + for (var r = 0; r < e.length; r++) if (be(t, e[r])) return !0; + return !1; + } + function _e(t, e, r, n) { + var i = n[0] - r[0], + a = n[1] - r[1], + o = (t[0] - r[0]) * a - i * (t[1] - r[1]), + s = (e[0] - r[0]) * a - i * (e[1] - r[1]); + return (o > 0 && s < 0) || (o < 0 && s > 0); + } + function Ae(t, e, r) { + for (var n = 0, i = r; n < i.length; n += 1) + for (var a = i[n], o = 0; o < a.length - 1; ++o) + if ( + 0 != + (c = [(p = a[o + 1])[0] - (l = a[o])[0], p[1] - l[1]])[0] * + (h = [(u = e)[0] - (s = t)[0], u[1] - s[1]])[1] - + c[1] * h[0] && + _e(s, u, l, p) && + _e(l, p, s, u) + ) + return !0; + var s, u, l, p, c, h; + return !1; + } + function ke(t, e) { + for (var r = 0; r < t.length; ++r) if (!be(t[r], e)) return !1; + for (var n = 0; n < t.length - 1; ++n) + if (Ae(t[n], t[n + 1], e)) return !1; + return !0; + } + function Se(t, e) { + for (var r = 0; r < e.length; r++) if (ke(t, e[r])) return !0; + return !1; + } + function Ie(t, e, r) { + for (var n = [], i = 0; i < t.length; i++) { + for (var a = [], o = 0; o < t[i].length; o++) { + var s = ge(t[i][o], r); + me(e, s), a.push(s); + } + n.push(a); + } + return n; + } + function Me(t, e, r) { + for (var n = [], i = 0; i < t.length; i++) { + var a = Ie(t[i], e, r); + n.push(a); + } + return n; + } + function ze(t, e, r, n) { + if (t[0] < r[0] || t[0] > r[2]) { + var i = 0.5 * n, + a = t[0] - r[0] > i ? -n : r[0] - t[0] > i ? n : 0; + 0 === a && (a = t[0] - r[2] > i ? -n : r[2] - t[0] > i ? n : 0), + (t[0] += a); + } + me(e, t); + } + function Pe(t, e, r, n) { + for ( + var i = Math.pow(2, n.z) * de, + a = [n.x * de, n.y * de], + o = [], + s = 0, + u = t; + s < u.length; + s += 1 + ) + for (var l = 0, p = u[s]; l < p.length; l += 1) { + var c = p[l], + h = [c.x + a[0], c.y + a[1]]; + ze(h, e, r, i), o.push(h); + } + return o; + } + function Be(t, e, r, n) { + for ( + var i, + a = Math.pow(2, n.z) * de, + o = [n.x * de, n.y * de], + s = [], + u = 0, + l = t; + u < l.length; + u += 1 + ) { + for (var p = [], c = 0, h = l[u]; c < h.length; c += 1) { + var f = h[c], + y = [f.x + o[0], f.y + o[1]]; + me(e, y), p.push(y); + } + s.push(p); + } + if (e[2] - e[0] <= a / 2) { + ((i = e)[0] = i[1] = 1 / 0), (i[2] = i[3] = -1 / 0); + for (var d = 0, m = s; d < m.length; d += 1) + for (var v = 0, g = m[d]; v < g.length; v += 1) ze(g[v], e, r, a); + } + return s; + } + var Ce = function (t, e) { + (this.type = Pt), (this.geojson = t), (this.geometries = e); + }; + function Ee(t) { + if (t instanceof fe) { + if ('get' === t.name && 1 === t.args.length) return !1; + if ('feature-state' === t.name) return !1; + if ('has' === t.name && 1 === t.args.length) return !1; + if ( + 'properties' === t.name || + 'geometry-type' === t.name || + 'id' === t.name + ) + return !1; + if (/^filter-/.test(t.name)) return !1; + } + if (t instanceof Ce) return !1; + var e = !0; + return ( + t.eachChild(function (t) { + e && !Ee(t) && (e = !1); + }), + e + ); + } + function Ve(t) { + if (t instanceof fe && 'feature-state' === t.name) return !1; + var e = !0; + return ( + t.eachChild(function (t) { + e && !Ve(t) && (e = !1); + }), + e + ); + } + function Te(t, e) { + if (t instanceof fe && e.indexOf(t.name) >= 0) return !1; + var r = !0; + return ( + t.eachChild(function (t) { + r && !Te(t, e) && (r = !1); + }), + r + ); + } + (Ce.parse = function (t, e) { + if (2 !== t.length) + return e.error( + "'within' expression requires exactly one argument, but found " + + (t.length - 1) + + ' instead.', + ); + if (re(t[1])) { + var r = t[1]; + if ('FeatureCollection' === r.type) + for (var n = 0; n < r.features.length; ++n) { + var i = r.features[n].geometry.type; + if ('Polygon' === i || 'MultiPolygon' === i) + return new Ce(r, r.features[n].geometry); + } + else if ('Feature' === r.type) { + var a = r.geometry.type; + if ('Polygon' === a || 'MultiPolygon' === a) + return new Ce(r, r.geometry); + } else if ('Polygon' === r.type || 'MultiPolygon' === r.type) + return new Ce(r, r); + } + return e.error( + "'within' expression requires valid geojson object that contains polygon geometry type.", + ); + }), + (Ce.prototype.evaluate = function (t) { + if (null != t.geometry() && null != t.canonicalID()) { + if ('Point' === t.geometryType()) + return (function (t, e) { + var r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + i = t.canonicalID(); + if ('Polygon' === e.type) { + var a = Ie(e.coordinates, n, i), + o = Pe(t.geometry(), r, n, i); + if (!ve(r, n)) return !1; + for (var s = 0, u = o; s < u.length; s += 1) + if (!be(u[s], a)) return !1; + } + if ('MultiPolygon' === e.type) { + var l = Me(e.coordinates, n, i), + p = Pe(t.geometry(), r, n, i); + if (!ve(r, n)) return !1; + for (var c = 0, h = p; c < h.length; c += 1) + if (!we(h[c], l)) return !1; + } + return !0; + })(t, this.geometries); + if ('LineString' === t.geometryType()) + return (function (t, e) { + var r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + i = t.canonicalID(); + if ('Polygon' === e.type) { + var a = Ie(e.coordinates, n, i), + o = Be(t.geometry(), r, n, i); + if (!ve(r, n)) return !1; + for (var s = 0, u = o; s < u.length; s += 1) + if (!ke(u[s], a)) return !1; + } + if ('MultiPolygon' === e.type) { + var l = Me(e.coordinates, n, i), + p = Be(t.geometry(), r, n, i); + if (!ve(r, n)) return !1; + for (var c = 0, h = p; c < h.length; c += 1) + if (!Se(h[c], l)) return !1; + } + return !0; + })(t, this.geometries); + } + return !1; + }), + (Ce.prototype.eachChild = function () {}), + (Ce.prototype.outputDefined = function () { + return !0; + }); + var Fe = function (t, e) { + (this.type = e.type), (this.name = t), (this.boundExpression = e); + }; + (Fe.parse = function (t, e) { + if (2 !== t.length || 'string' != typeof t[1]) + return e.error( + "'var' expression requires exactly one string literal argument.", + ); + var r = t[1]; + return e.scope.has(r) + ? new Fe(r, e.scope.get(r)) + : e.error( + 'Unknown variable "' + + r + + '". Make sure "' + + r + + '" has been bound in an enclosing "let" expression before using it.', + 1, + ); + }), + (Fe.prototype.evaluate = function (t) { + return this.boundExpression.evaluate(t); + }), + (Fe.prototype.eachChild = function () {}), + (Fe.prototype.outputDefined = function () { + return !1; + }); + var Oe = function (t, e, r, n, i) { + void 0 === e && (e = []), + void 0 === n && (n = new St()), + void 0 === i && (i = []), + (this.registry = t), + (this.path = e), + (this.key = e + .map(function (t) { + return '[' + t + ']'; + }) + .join('')), + (this.scope = n), + (this.errors = i), + (this.expectedType = r); + }; + function Le(t) { + if (t instanceof Fe) return Le(t.boundExpression); + if (t instanceof fe && 'error' === t.name) return !1; + if (t instanceof ye) return !1; + if (t instanceof Ce) return !1; + var e = t instanceof pe || t instanceof ue, + r = !0; + return ( + t.eachChild(function (t) { + r = e ? r && Le(t) : r && t instanceof ae; + }), + !!r && + Ee(t) && + Te(t, [ + 'zoom', + 'heatmap-density', + 'line-progress', + 'accumulated', + 'is-supported-script', + ]) + ); + } + function De(t, e) { + for (var r, n = t.length - 1, i = 0, a = n, o = 0; i <= a; ) + if ((r = t[(o = Math.floor((i + a) / 2))]) <= e) { + if (o === n || e < t[o + 1]) return o; + i = o + 1; + } else { + if (!(r > e)) throw new oe('Input is not a number.'); + a = o - 1; + } + return 0; + } + (Oe.prototype.parse = function (t, e, r, n, i) { + return ( + void 0 === i && (i = {}), + e ? this.concat(e, r, n)._parse(t, i) : this._parse(t, i) + ); + }), + (Oe.prototype._parse = function (t, e) { + function r(t, e, r) { + return 'assert' === r + ? new ue(e, [t]) + : 'coerce' === r + ? new pe(e, [t]) + : t; + } + if ( + ((null !== t && + 'string' != typeof t && + 'boolean' != typeof t && + 'number' != typeof t) || + (t = ['literal', t]), + Array.isArray(t)) + ) { + if (0 === t.length) + return this.error( + 'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].', + ); + var n = t[0]; + if ('string' != typeof n) + return ( + this.error( + 'Expression name must be a string, but found ' + + typeof n + + ' instead. If you wanted a literal array, use ["literal", [...]].', + 0, + ), + null + ); + var i = this.registry[n]; + if (i) { + var a = i.parse(t, 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 ( + 'padding' !== o.kind || + ('value' !== s.kind && + 'number' !== s.kind && + 'array' !== s.kind) + ) { + if (this.checkSubtype(o, s)) return null; + } else a = r(a, o, e.typeAnnotation || 'coerce'); + else a = r(a, o, e.typeAnnotation || 'coerce'); + else a = r(a, o, e.typeAnnotation || 'assert'); + } + if ( + !(a instanceof ae) && + 'resolvedImage' !== a.type.kind && + Le(a) + ) { + var u = new he(); + try { + a = new ae(a.type, a.evaluate(u)); + } catch (t) { + return this.error(t.message), null; + } + } + return a; + } + return this.error( + 'Unknown expression "' + + n + + '". If you wanted a literal array, use ["literal", [...]].', + 0, + ); + } + return this.error( + void 0 === t + ? "'undefined' value invalid. Use null instead." + : 'object' == typeof t + ? 'Bare objects invalid. Use ["literal", {...}] instead.' + : 'Expected an array, but found ' + typeof t + ' instead.', + ); + }), + (Oe.prototype.concat = function (t, e, r) { + var n = 'number' == typeof t ? this.path.concat(t) : this.path, + i = r ? this.scope.concat(r) : this.scope; + return new Oe(this.registry, n, e || null, i, this.errors); + }), + (Oe.prototype.error = function (t) { + for (var e = [], r = arguments.length - 1; r-- > 0; ) + e[r] = arguments[r + 1]; + var n = + '' + + this.key + + e + .map(function (t) { + return '[' + t + ']'; + }) + .join(''); + this.errors.push(new kt(n, t)); + }), + (Oe.prototype.checkSubtype = function (t, e) { + var r = Rt(t, e); + return r && this.error(r), r; + }); + var je = function (t, e, r) { + (this.type = t), + (this.input = e), + (this.labels = []), + (this.outputs = []); + for (var n = 0, i = r; n < i.length; n += 1) { + var a = i[n], + o = a[1]; + this.labels.push(a[0]), this.outputs.push(o); + } + }; + function Re(t, e, r) { + return t * (1 - r) + e * r; + } + (je.parse = function (t, e) { + if (t.length - 1 < 4) + return e.error( + 'Expected at least 4 arguments, but found only ' + + (t.length - 1) + + '.', + ); + if ((t.length - 1) % 2 != 0) + return e.error('Expected an even number of arguments.'); + var r = e.parse(t[1], 1, Mt); + if (!r) return null; + var n = [], + i = null; + e.expectedType && 'value' !== e.expectedType.kind && (i = e.expectedType); + for (var a = 1; a < t.length; a += 2) { + var o = 1 === a ? -1 / 0 : t[a], + s = t[a + 1], + u = a, + l = a + 1; + if ('number' != typeof o) + return e.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] >= o) + return e.error( + 'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', + u, + ); + var p = e.parse(s, l, i); + if (!p) return null; + (i = i || p.type), n.push([o, p]); + } + return new je(i, r, n); + }), + (je.prototype.evaluate = function (t) { + var e = this.labels, + r = this.outputs; + if (1 === e.length) return r[0].evaluate(t); + var n = this.input.evaluate(t); + if (n <= e[0]) return r[0].evaluate(t); + var i = e.length; + return n >= e[i - 1] ? r[i - 1].evaluate(t) : r[De(e, n)].evaluate(t); + }), + (je.prototype.eachChild = function (t) { + t(this.input); + for (var e = 0, r = this.outputs; e < r.length; e += 1) t(r[e]); + }), + (je.prototype.outputDefined = function () { + return this.outputs.every(function (t) { + return t.outputDefined(); + }); + }); + var Ue = Object.freeze({ + __proto__: null, + number: Re, + color: function (t, e, r) { + return new Yt( + Re(t.r, e.r, r), + Re(t.g, e.g, r), + Re(t.b, e.b, r), + Re(t.a, e.a, r), + ); + }, + array: function (t, e, r) { + return t.map(function (t, n) { + return Re(t, e[n], r); + }); + }, + padding: function (t, e, r) { + var n = t.values, + i = e.values; + return new Qt([ + Re(n[0], i[0], r), + Re(n[1], i[1], r), + Re(n[2], i[2], r), + Re(n[3], i[3], r), + ]); + }, + }), + qe = 0.95047, + Ne = 1.08883, + Ze = 4 / 29, + Ke = 6 / 29, + Ge = 3 * Ke * Ke, + Je = Math.PI / 180, + Xe = 180 / Math.PI; + function Ye(t) { + return t > 0.008856451679035631 ? Math.pow(t, 1 / 3) : t / Ge + Ze; + } + function He(t) { + return t > Ke ? t * t * t : Ge * (t - Ze); + } + function We(t) { + return ( + 255 * + (t <= 0.0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055) + ); + } + function $e(t) { + return (t /= 255) <= 0.04045 + ? t / 12.92 + : Math.pow((t + 0.055) / 1.055, 2.4); + } + function Qe(t) { + var e = $e(t.r), + r = $e(t.g), + n = $e(t.b), + i = Ye((0.4124564 * e + 0.3575761 * r + 0.1804375 * n) / qe), + a = Ye((0.2126729 * e + 0.7151522 * r + 0.072175 * n) / 1); + return { + l: 116 * a - 16, + a: 500 * (i - a), + b: 200 * (a - Ye((0.0193339 * e + 0.119192 * r + 0.9503041 * n) / Ne)), + alpha: t.a, + }; + } + function tr(t) { + var e = (t.l + 16) / 116, + r = isNaN(t.a) ? e : e + t.a / 500, + n = isNaN(t.b) ? e : e - t.b / 200; + return ( + (e = 1 * He(e)), + (r = qe * He(r)), + (n = Ne * He(n)), + new Yt( + We(3.2404542 * r - 1.5371385 * e - 0.4985314 * n), + We(-0.969266 * r + 1.8760108 * e + 0.041556 * n), + We(0.0556434 * r - 0.2040259 * e + 1.0572252 * n), + t.alpha, + ) + ); + } + function er(t, e, r) { + var n = e - t; + return t + r * (n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n); + } + var rr = { + forward: Qe, + reverse: tr, + interpolate: function (t, e, r) { + return { + l: Re(t.l, e.l, r), + a: Re(t.a, e.a, r), + b: Re(t.b, e.b, r), + alpha: Re(t.alpha, e.alpha, r), + }; + }, + }, + nr = { + forward: function (t) { + var e = Qe(t), + r = e.l, + n = e.a, + i = e.b, + a = Math.atan2(i, n) * Xe; + return { + h: a < 0 ? a + 360 : a, + c: Math.sqrt(n * n + i * i), + l: r, + alpha: t.a, + }; + }, + reverse: function (t) { + var e = t.h * Je, + r = t.c; + return tr({ + l: t.l, + a: Math.cos(e) * r, + b: Math.sin(e) * r, + alpha: t.alpha, + }); + }, + interpolate: function (t, e, r) { + return { + h: er(t.h, e.h, r), + c: Re(t.c, e.c, r), + l: Re(t.l, e.l, r), + alpha: Re(t.alpha, e.alpha, r), + }; + }, + }, + ir = Object.freeze({ __proto__: null, lab: rr, hcl: nr }), + ar = function (t, e, r, n, i) { + (this.type = t), + (this.operator = e), + (this.interpolation = r), + (this.input = n), + (this.labels = []), + (this.outputs = []); + for (var a = 0, o = i; a < o.length; a += 1) { + var s = o[a], + u = s[1]; + this.labels.push(s[0]), this.outputs.push(u); + } + }; + function or(t, e, r, n) { + var i = n - r, + a = t - r; + return 0 === i + ? 0 + : 1 === e + ? a / i + : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1); + } + (ar.interpolationFactor = function (t, r, n, i) { + var a = 0; + if ('exponential' === t.name) a = or(r, t.base, n, i); + else if ('linear' === t.name) a = or(r, 1, n, i); + else if ('cubic-bezier' === t.name) { + var o = t.controlPoints; + a = new e(o[0], o[1], o[2], o[3]).solve(or(r, 1, n, i)); + } + return a; + }), + (ar.parse = function (t, e) { + var r = t[0], + n = t[1], + i = t[2], + a = t.slice(3); + if (!Array.isArray(n) || 0 === n.length) + return e.error('Expected an interpolation type expression.', 1); + if ('linear' === n[0]) n = { name: 'linear' }; + else if ('exponential' === n[0]) { + var o = n[1]; + if ('number' != typeof o) + return e.error( + 'Exponential interpolation requires a numeric base.', + 1, + 1, + ); + n = { name: 'exponential', base: o }; + } else { + if ('cubic-bezier' !== n[0]) + return e.error('Unknown interpolation type ' + String(n[0]), 1, 0); + var s = n.slice(1); + if ( + 4 !== s.length || + s.some(function (t) { + return 'number' != typeof t || t < 0 || t > 1; + }) + ) + return e.error( + 'Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', + 1, + ); + n = { name: 'cubic-bezier', controlPoints: s }; + } + if (t.length - 1 < 4) + return e.error( + 'Expected at least 4 arguments, but found only ' + + (t.length - 1) + + '.', + ); + if ((t.length - 1) % 2 != 0) + return e.error('Expected an even number of arguments.'); + if (!(i = e.parse(i, 2, Mt))) return null; + var u = [], + l = null; + 'interpolate-hcl' === r || 'interpolate-lab' === r + ? (l = Bt) + : e.expectedType && + 'value' !== e.expectedType.kind && + (l = e.expectedType); + for (var p = 0; p < a.length; p += 2) { + var c = a[p], + h = a[p + 1], + f = p + 3, + y = p + 4; + if ('number' != typeof c) + return e.error( + 'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', + f, + ); + if (u.length && u[u.length - 1][0] >= c) + return e.error( + 'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', + f, + ); + var d = e.parse(h, y, l); + if (!d) return null; + (l = l || d.type), u.push([c, d]); + } + return 'number' === l.kind || + 'color' === l.kind || + 'padding' === l.kind || + ('array' === l.kind && + 'number' === l.itemType.kind && + 'number' == typeof l.N) + ? new ar(l, r, n, i, u) + : e.error('Type ' + Dt(l) + ' is not interpolatable.'); + }), + (ar.prototype.evaluate = function (t) { + var e = this.labels, + r = this.outputs; + if (1 === e.length) return r[0].evaluate(t); + var n = this.input.evaluate(t); + if (n <= e[0]) return r[0].evaluate(t); + var i = e.length; + if (n >= e[i - 1]) return r[i - 1].evaluate(t); + var a = De(e, n), + o = ar.interpolationFactor(this.interpolation, n, e[a], e[a + 1]), + s = r[a].evaluate(t), + u = r[a + 1].evaluate(t); + return 'interpolate' === this.operator + ? Ue[this.type.kind.toLowerCase()](s, u, o) + : 'interpolate-hcl' === this.operator + ? nr.reverse(nr.interpolate(nr.forward(s), nr.forward(u), o)) + : rr.reverse(rr.interpolate(rr.forward(s), rr.forward(u), o)); + }), + (ar.prototype.eachChild = function (t) { + t(this.input); + for (var e = 0, r = this.outputs; e < r.length; e += 1) t(r[e]); + }), + (ar.prototype.outputDefined = function () { + return this.outputs.every(function (t) { + return t.outputDefined(); + }); + }); + var sr = function (t, e) { + (this.type = t), (this.args = e); + }; + (sr.parse = function (t, e) { + if (t.length < 2) return e.error('Expectected at least one argument.'); + var r = null, + n = e.expectedType; + n && 'value' !== n.kind && (r = n); + for (var i = [], a = 0, o = t.slice(1); a < o.length; a += 1) { + var s = e.parse(o[a], 1 + i.length, r, void 0, { + typeAnnotation: 'omit', + }); + if (!s) return null; + (r = r || s.type), i.push(s); + } + if (!r) throw new Error('No output type'); + var u = + n && + i.some(function (t) { + return Rt(n, t.type); + }); + return new sr(u ? Et : r, i); + }), + (sr.prototype.evaluate = function (t) { + for ( + var e, r = null, n = 0, i = 0, a = this.args; + i < a.length && + (n++, + (r = a[i].evaluate(t)) && + r instanceof te && + !r.available && + (e || (e = r.name), (r = null), n === this.args.length && (r = e)), + null === r); + i += 1 + ); + return r; + }), + (sr.prototype.eachChild = function (t) { + this.args.forEach(t); + }), + (sr.prototype.outputDefined = function () { + return this.args.every(function (t) { + return t.outputDefined(); + }); + }); + var ur = function (t, e) { + (this.type = e.type), (this.bindings = [].concat(t)), (this.result = e); + }; + (ur.prototype.evaluate = function (t) { + return this.result.evaluate(t); + }), + (ur.prototype.eachChild = function (t) { + for (var e = 0, r = this.bindings; e < r.length; e += 1) t(r[e][1]); + t(this.result); + }), + (ur.parse = function (t, e) { + if (t.length < 4) + return e.error( + 'Expected at least 3 arguments, but found ' + + (t.length - 1) + + ' instead.', + ); + for (var r = [], n = 1; n < t.length - 1; n += 2) { + var i = t[n]; + if ('string' != typeof i) + return e.error( + 'Expected string, but found ' + typeof i + ' instead.', + n, + ); + if (/[^a-zA-Z0-9_]/.test(i)) + return e.error( + "Variable names must contain only alphanumeric characters or '_'.", + n, + ); + var a = e.parse(t[n + 1], n + 1); + if (!a) return null; + r.push([i, a]); + } + var o = e.parse(t[t.length - 1], t.length - 1, e.expectedType, r); + return o ? new ur(r, o) : null; + }), + (ur.prototype.outputDefined = function () { + return this.result.outputDefined(); + }); + var lr = function (t, e, r) { + (this.type = t), (this.index = e), (this.input = r); + }; + (lr.parse = function (t, e) { + if (3 !== t.length) + return e.error( + 'Expected 2 arguments, but found ' + (t.length - 1) + ' instead.', + ); + var r = e.parse(t[1], 1, Mt), + n = e.parse(t[2], 2, Lt(e.expectedType || Et)); + return r && n ? new lr(n.type.itemType, r, n) : null; + }), + (lr.prototype.evaluate = function (t) { + var e = this.index.evaluate(t), + r = this.input.evaluate(t); + if (e < 0) throw new oe('Array index out of bounds: ' + e + ' < 0.'); + if (e >= r.length) + throw new oe( + 'Array index out of bounds: ' + e + ' > ' + (r.length - 1) + '.', + ); + if (e !== Math.floor(e)) + throw new oe( + 'Array index must be an integer, but found ' + e + ' instead.', + ); + return r[e]; + }), + (lr.prototype.eachChild = function (t) { + t(this.index), t(this.input); + }), + (lr.prototype.outputDefined = function () { + return !1; + }); + var pr = function (t, e) { + (this.type = Pt), (this.needle = t), (this.haystack = e); + }; + (pr.parse = function (t, e) { + if (3 !== t.length) + return e.error( + 'Expected 2 arguments, but found ' + (t.length - 1) + ' instead.', + ); + var r = e.parse(t[1], 1, Et), + n = e.parse(t[2], 2, Et); + return r && n + ? Ut(r.type, [Pt, zt, Mt, It, Et]) + ? new pr(r, n) + : e.error( + 'Expected first argument to be of type boolean, string, number or null, but found ' + + Dt(r.type) + + ' instead', + ) + : null; + }), + (pr.prototype.evaluate = function (t) { + var e = this.needle.evaluate(t), + r = this.haystack.evaluate(t); + if (!r) return !1; + if (!qt(e, ['boolean', 'string', 'number', 'null'])) + throw new oe( + 'Expected first argument to be of type boolean, string, number or null, but found ' + + Dt(ne(e)) + + ' instead.', + ); + if (!qt(r, ['string', 'array'])) + throw new oe( + 'Expected second argument to be of type array or string, but found ' + + Dt(ne(r)) + + ' instead.', + ); + return r.indexOf(e) >= 0; + }), + (pr.prototype.eachChild = function (t) { + t(this.needle), t(this.haystack); + }), + (pr.prototype.outputDefined = function () { + return !0; + }); + var cr = function (t, e, r) { + (this.type = Mt), + (this.needle = t), + (this.haystack = e), + (this.fromIndex = r); + }; + (cr.parse = function (t, e) { + if (t.length <= 2 || t.length >= 5) + return e.error( + 'Expected 3 or 4 arguments, but found ' + + (t.length - 1) + + ' instead.', + ); + var r = e.parse(t[1], 1, Et), + n = e.parse(t[2], 2, Et); + if (!r || !n) return null; + if (!Ut(r.type, [Pt, zt, Mt, It, Et])) + return e.error( + 'Expected first argument to be of type boolean, string, number or null, but found ' + + Dt(r.type) + + ' instead', + ); + if (4 === t.length) { + var i = e.parse(t[3], 3, Mt); + return i ? new cr(r, n, i) : null; + } + return new cr(r, n); + }), + (cr.prototype.evaluate = function (t) { + var e = this.needle.evaluate(t), + r = this.haystack.evaluate(t); + if (!qt(e, ['boolean', 'string', 'number', 'null'])) + throw new oe( + 'Expected first argument to be of type boolean, string, number or null, but found ' + + Dt(ne(e)) + + ' instead.', + ); + if (!qt(r, ['string', 'array'])) + throw new oe( + 'Expected second argument to be of type array or string, but found ' + + Dt(ne(r)) + + ' instead.', + ); + if (this.fromIndex) { + var n = this.fromIndex.evaluate(t); + return r.indexOf(e, n); + } + return r.indexOf(e); + }), + (cr.prototype.eachChild = function (t) { + t(this.needle), t(this.haystack), this.fromIndex && t(this.fromIndex); + }), + (cr.prototype.outputDefined = function () { + return !1; + }); + var hr = function (t, e, r, n, i, a) { + (this.inputType = t), + (this.type = e), + (this.input = r), + (this.cases = n), + (this.outputs = i), + (this.otherwise = a); + }; + (hr.parse = function (t, e) { + if (t.length < 5) + return e.error( + 'Expected at least 4 arguments, but found only ' + + (t.length - 1) + + '.', + ); + if (t.length % 2 != 1) + return e.error('Expected an even number of arguments.'); + var r, n; + e.expectedType && 'value' !== e.expectedType.kind && (n = e.expectedType); + for (var i = {}, a = [], o = 2; o < t.length - 1; o += 2) { + var s = t[o], + u = t[o + 1]; + Array.isArray(s) || (s = [s]); + var l = e.concat(o); + if (0 === s.length) + return l.error('Expected at least one branch label.'); + for (var p = 0, c = s; p < c.length; p += 1) { + var h = c[p]; + if ('number' != typeof h && 'string' != typeof h) + return l.error('Branch labels must be numbers or strings.'); + if ('number' == typeof h && Math.abs(h) > Number.MAX_SAFE_INTEGER) + return l.error( + 'Branch labels must be integers no larger than ' + + Number.MAX_SAFE_INTEGER + + '.', + ); + if ('number' == typeof h && Math.floor(h) !== h) + return l.error('Numeric branch labels must be integer values.'); + if (r) { + if (l.checkSubtype(r, ne(h))) return null; + } else r = ne(h); + if (void 0 !== i[String(h)]) + return l.error('Branch labels must be unique.'); + i[String(h)] = a.length; + } + var f = e.parse(u, o, n); + if (!f) return null; + (n = n || f.type), a.push(f); + } + var y = e.parse(t[1], 1, Et); + if (!y) return null; + var d = e.parse(t[t.length - 1], t.length - 1, n); + return d + ? 'value' !== y.type.kind && e.concat(1).checkSubtype(r, y.type) + ? null + : new hr(r, n, y, i, a, d) + : null; + }), + (hr.prototype.evaluate = function (t) { + var e = this.input.evaluate(t); + return ( + (ne(e) === this.inputType && this.outputs[this.cases[e]]) || + this.otherwise + ).evaluate(t); + }), + (hr.prototype.eachChild = function (t) { + t(this.input), this.outputs.forEach(t), t(this.otherwise); + }), + (hr.prototype.outputDefined = function () { + return ( + this.outputs.every(function (t) { + return t.outputDefined(); + }) && this.otherwise.outputDefined() + ); + }); + var fr = function (t, e, r) { + (this.type = t), (this.branches = e), (this.otherwise = r); + }; + (fr.parse = function (t, e) { + if (t.length < 4) + return e.error( + 'Expected at least 3 arguments, but found only ' + + (t.length - 1) + + '.', + ); + if (t.length % 2 != 0) + return e.error('Expected an odd number of arguments.'); + var r; + e.expectedType && 'value' !== e.expectedType.kind && (r = e.expectedType); + for (var n = [], i = 1; i < t.length - 1; i += 2) { + var a = e.parse(t[i], i, Pt); + if (!a) return null; + var o = e.parse(t[i + 1], i + 1, r); + if (!o) return null; + n.push([a, o]), (r = r || o.type); + } + var s = e.parse(t[t.length - 1], t.length - 1, r); + if (!s) return null; + if (!r) throw new Error("Can't infer output type"); + return new fr(r, n, s); + }), + (fr.prototype.evaluate = function (t) { + for (var e = 0, r = this.branches; e < r.length; e += 1) { + var n = r[e], + i = n[1]; + if (n[0].evaluate(t)) return i.evaluate(t); + } + return this.otherwise.evaluate(t); + }), + (fr.prototype.eachChild = function (t) { + for (var e = 0, r = this.branches; e < r.length; e += 1) { + var n = r[e], + i = n[1]; + t(n[0]), t(i); + } + t(this.otherwise); + }), + (fr.prototype.outputDefined = function () { + return ( + this.branches.every(function (t) { + return t[1].outputDefined(); + }) && this.otherwise.outputDefined() + ); + }); + var yr = function (t, e, r, n) { + (this.type = t), + (this.input = e), + (this.beginIndex = r), + (this.endIndex = n); + }; + function dr(t, e) { + return '==' === t || '!=' === t + ? 'boolean' === e.kind || + 'string' === e.kind || + 'number' === e.kind || + 'null' === e.kind || + 'value' === e.kind + : 'string' === e.kind || 'number' === e.kind || 'value' === e.kind; + } + function mr(t, e, r, n) { + return 0 === n.compare(e, r); + } + function vr(t, e, r) { + var n = '==' !== t && '!=' !== t; + return (function () { + function i(t, e, r) { + (this.type = Pt), + (this.lhs = t), + (this.rhs = e), + (this.collator = r), + (this.hasUntypedArgument = + 'value' === t.type.kind || 'value' === e.type.kind); + } + return ( + (i.parse = function (t, e) { + if (3 !== t.length && 4 !== t.length) + return e.error('Expected two or three arguments.'); + var r = t[0], + a = e.parse(t[1], 1, Et); + if (!a) return null; + if (!dr(r, a.type)) + return e + .concat(1) + .error( + '"' + + r + + '" comparisons are not supported for type \'' + + Dt(a.type) + + "'.", + ); + var o = e.parse(t[2], 2, Et); + if (!o) return null; + if (!dr(r, o.type)) + return e + .concat(2) + .error( + '"' + + r + + '" comparisons are not supported for type \'' + + Dt(o.type) + + "'.", + ); + if ( + a.type.kind !== o.type.kind && + 'value' !== a.type.kind && + 'value' !== o.type.kind + ) + return e.error( + "Cannot compare types '" + + Dt(a.type) + + "' and '" + + Dt(o.type) + + "'.", + ); + n && + ('value' === a.type.kind && 'value' !== o.type.kind + ? (a = new ue(o.type, [a])) + : 'value' !== a.type.kind && + 'value' === o.type.kind && + (o = new ue(a.type, [o]))); + var s = null; + if (4 === t.length) { + if ( + 'string' !== a.type.kind && + 'string' !== o.type.kind && + 'value' !== a.type.kind && + 'value' !== o.type.kind + ) + return e.error( + 'Cannot use collator to compare non-string types.', + ); + if (!(s = e.parse(t[3], 3, Vt))) return null; + } + return new i(a, o, s); + }), + (i.prototype.evaluate = function (i) { + var a = this.lhs.evaluate(i), + o = this.rhs.evaluate(i); + if (n && this.hasUntypedArgument) { + var s = ne(a), + u = ne(o); + if ( + s.kind !== u.kind || + ('string' !== s.kind && 'number' !== s.kind) + ) + throw new oe( + 'Expected arguments for "' + + t + + '" to be (string, string) or (number, number), but found (' + + s.kind + + ', ' + + u.kind + + ') instead.', + ); + } + if (this.collator && !n && this.hasUntypedArgument) { + var l = ne(a), + p = ne(o); + if ('string' !== l.kind || 'string' !== p.kind) return e(i, a, o); + } + return this.collator + ? r(i, a, o, this.collator.evaluate(i)) + : e(i, a, o); + }), + (i.prototype.eachChild = function (t) { + t(this.lhs), t(this.rhs), this.collator && t(this.collator); + }), + (i.prototype.outputDefined = function () { + return !0; + }), + i + ); + })(); + } + (yr.parse = function (t, e) { + if (t.length <= 2 || t.length >= 5) + return e.error( + 'Expected 3 or 4 arguments, but found ' + + (t.length - 1) + + ' instead.', + ); + var r = e.parse(t[1], 1, Et), + n = e.parse(t[2], 2, Mt); + if (!r || !n) return null; + if (!Ut(r.type, [Lt(Et), zt, Et])) + return e.error( + 'Expected first argument to be of type array or string, but found ' + + Dt(r.type) + + ' instead', + ); + if (4 === t.length) { + var i = e.parse(t[3], 3, Mt); + return i ? new yr(r.type, r, n, i) : null; + } + return new yr(r.type, r, n); + }), + (yr.prototype.evaluate = function (t) { + var e = this.input.evaluate(t), + r = this.beginIndex.evaluate(t); + if (!qt(e, ['string', 'array'])) + throw new oe( + 'Expected first argument to be of type array or string, but found ' + + Dt(ne(e)) + + ' instead.', + ); + if (this.endIndex) { + var n = this.endIndex.evaluate(t); + return e.slice(r, n); + } + return e.slice(r); + }), + (yr.prototype.eachChild = function (t) { + t(this.input), t(this.beginIndex), this.endIndex && t(this.endIndex); + }), + (yr.prototype.outputDefined = function () { + return !1; + }); + var gr = vr( + '==', + function (t, e, r) { + return e === r; + }, + mr, + ), + xr = vr( + '!=', + function (t, e, r) { + return e !== r; + }, + function (t, e, r, n) { + return !mr(0, e, r, n); + }, + ), + br = vr( + '<', + function (t, e, r) { + return e < r; + }, + function (t, e, r, n) { + return n.compare(e, r) < 0; + }, + ), + wr = vr( + '>', + function (t, e, r) { + return e > r; + }, + function (t, e, r, n) { + return n.compare(e, r) > 0; + }, + ), + _r = vr( + '<=', + function (t, e, r) { + return e <= r; + }, + function (t, e, r, n) { + return n.compare(e, r) <= 0; + }, + ), + Ar = vr( + '>=', + function (t, e, r) { + return e >= r; + }, + function (t, e, r, n) { + return n.compare(e, r) >= 0; + }, + ), + kr = function (t, e, r, n, i) { + (this.type = zt), + (this.number = t), + (this.locale = e), + (this.currency = r), + (this.minFractionDigits = n), + (this.maxFractionDigits = i); + }; + (kr.parse = function (t, e) { + if (3 !== t.length) return e.error('Expected two arguments.'); + var r = e.parse(t[1], 1, Mt); + if (!r) return null; + var n = t[2]; + if ('object' != typeof n || Array.isArray(n)) + return e.error('NumberFormat options argument must be an object.'); + var i = null; + if (n.locale && !(i = e.parse(n.locale, 1, zt))) return null; + var a = null; + if (n.currency && !(a = e.parse(n.currency, 1, zt))) return null; + var o = null; + if ( + n['min-fraction-digits'] && + !(o = e.parse(n['min-fraction-digits'], 1, Mt)) + ) + return null; + var s = null; + return n['max-fraction-digits'] && + !(s = e.parse(n['max-fraction-digits'], 1, Mt)) + ? null + : new kr(r, i, a, o, s); + }), + (kr.prototype.evaluate = function (t) { + return new Intl.NumberFormat( + this.locale ? this.locale.evaluate(t) : [], + { + style: this.currency ? 'currency' : 'decimal', + currency: this.currency ? this.currency.evaluate(t) : void 0, + minimumFractionDigits: this.minFractionDigits + ? this.minFractionDigits.evaluate(t) + : void 0, + maximumFractionDigits: this.maxFractionDigits + ? this.maxFractionDigits.evaluate(t) + : void 0, + }, + ).format(this.number.evaluate(t)); + }), + (kr.prototype.eachChild = function (t) { + t(this.number), + this.locale && t(this.locale), + this.currency && t(this.currency), + this.minFractionDigits && t(this.minFractionDigits), + this.maxFractionDigits && t(this.maxFractionDigits); + }), + (kr.prototype.outputDefined = function () { + return !1; + }); + var Sr = function (t) { + (this.type = Tt), (this.sections = t); + }; + (Sr.parse = function (t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + var r = t[1]; + if (!Array.isArray(r) && 'object' == typeof r) + return e.error('First argument must be an image or text section.'); + for (var n = [], i = !1, a = 1; a <= t.length - 1; ++a) { + var o = t[a]; + if (i && 'object' == typeof o && !Array.isArray(o)) { + i = !1; + var s = null; + if (o['font-scale'] && !(s = e.parse(o['font-scale'], 1, Mt))) + return null; + var u = null; + if (o['text-font'] && !(u = e.parse(o['text-font'], 1, Lt(zt)))) + return null; + var l = null; + if (o['text-color'] && !(l = e.parse(o['text-color'], 1, Bt))) + return null; + var p = n[n.length - 1]; + (p.scale = s), (p.font = u), (p.textColor = l); + } else { + var c = e.parse(t[a], 1, Et); + if (!c) return null; + var h = c.type.kind; + if ( + 'string' !== h && + 'value' !== h && + 'null' !== h && + 'resolvedImage' !== h + ) + return e.error( + "Formatted text type must be 'string', 'value', 'image' or 'null'.", + ); + (i = !0), + n.push({ content: c, scale: null, font: null, textColor: null }); + } + } + return new Sr(n); + }), + (Sr.prototype.evaluate = function (t) { + return new $t( + this.sections.map(function (e) { + var r = e.content.evaluate(t); + return ne(r) === Ot + ? new Wt('', r, null, null, null) + : new Wt( + ie(r), + null, + e.scale ? e.scale.evaluate(t) : null, + e.font ? e.font.evaluate(t).join(',') : null, + e.textColor ? e.textColor.evaluate(t) : null, + ); + }), + ); + }), + (Sr.prototype.eachChild = function (t) { + for (var e = 0, r = this.sections; e < r.length; e += 1) { + var n = r[e]; + t(n.content), + n.scale && t(n.scale), + n.font && t(n.font), + n.textColor && t(n.textColor); + } + }), + (Sr.prototype.outputDefined = function () { + return !1; + }); + var Ir = function (t) { + (this.type = Ot), (this.input = t); + }; + (Ir.parse = function (t, e) { + if (2 !== t.length) return e.error('Expected two arguments.'); + var r = e.parse(t[1], 1, zt); + return r ? new Ir(r) : e.error('No image name provided.'); + }), + (Ir.prototype.evaluate = function (t) { + var e = this.input.evaluate(t), + r = te.fromString(e); + return ( + r && + t.availableImages && + (r.available = t.availableImages.indexOf(e) > -1), + r + ); + }), + (Ir.prototype.eachChild = function (t) { + t(this.input); + }), + (Ir.prototype.outputDefined = function () { + return !1; + }); + var Mr = function (t) { + (this.type = Mt), (this.input = t); + }; + (Mr.parse = function (t, e) { + if (2 !== t.length) + return e.error( + 'Expected 1 argument, but found ' + (t.length - 1) + ' instead.', + ); + var r = e.parse(t[1], 1); + return r + ? 'array' !== r.type.kind && + 'string' !== r.type.kind && + 'value' !== r.type.kind + ? e.error( + 'Expected argument of type string or array, but found ' + + Dt(r.type) + + ' instead.', + ) + : new Mr(r) + : null; + }), + (Mr.prototype.evaluate = function (t) { + var e = this.input.evaluate(t); + if ('string' == typeof e) return e.length; + if (Array.isArray(e)) return e.length; + throw new oe( + 'Expected value to be of type string or array, but found ' + + Dt(ne(e)) + + ' instead.', + ); + }), + (Mr.prototype.eachChild = function (t) { + t(this.input); + }), + (Mr.prototype.outputDefined = function () { + return !1; + }); + var zr = { + '==': gr, + '!=': xr, + '>': wr, + '<': br, + '>=': Ar, + '<=': _r, + array: ue, + at: lr, + boolean: ue, + case: fr, + coalesce: sr, + collator: ye, + format: Sr, + image: Ir, + in: pr, + 'index-of': cr, + interpolate: ar, + 'interpolate-hcl': ar, + 'interpolate-lab': ar, + length: Mr, + let: ur, + literal: ae, + match: hr, + number: ue, + 'number-format': kr, + object: ue, + slice: yr, + step: je, + string: ue, + 'to-boolean': pe, + 'to-color': pe, + 'to-number': pe, + 'to-string': pe, + var: Fe, + within: Ce, + }; + function Pr(t, e) { + var r = e[0], + n = e[1], + i = e[2], + a = e[3]; + (r = r.evaluate(t)), (n = n.evaluate(t)), (i = i.evaluate(t)); + var o = a ? a.evaluate(t) : 1, + s = ee(r, n, i, o); + if (s) throw new oe(s); + return new Yt((r / 255) * o, (n / 255) * o, (i / 255) * o, o); + } + function Br(t, e) { + return t in e; + } + function Cr(t, e) { + var r = e[t]; + return void 0 === r ? null : r; + } + function Er(t) { + return { type: t }; + } + function Vr(t) { + return { result: 'success', value: t }; + } + function Tr(t) { + return { result: 'error', value: t }; + } + function Fr(t) { + return ( + 'data-driven' === t['property-type'] || + 'cross-faded-data-driven' === t['property-type'] + ); + } + function Or(t) { + return !!t.expression && t.expression.parameters.indexOf('zoom') > -1; + } + function Lr(t) { + return !!t.expression && t.expression.interpolated; + } + function Dr(t) { + return t instanceof Number + ? 'number' + : t instanceof String + ? 'string' + : t instanceof Boolean + ? 'boolean' + : Array.isArray(t) + ? 'array' + : null === t + ? 'null' + : typeof t; + } + function jr(t) { + return 'object' == typeof t && null !== t && !Array.isArray(t); + } + function Rr(t) { + return t; + } + function Ur(t, e) { + var r, + n, + i, + a = 'color' === e.type, + o = t.stops && 'object' == typeof t.stops[0][0], + s = o || !(o || void 0 !== t.property), + u = t.type || (Lr(e) ? 'exponential' : 'interval'); + if (a || 'padding' === e.type) { + var l = a ? Yt.parse : Qt.parse; + (t = wt({}, t)).stops && + (t.stops = t.stops.map(function (t) { + return [t[0], l(t[1])]; + })), + (t.default = l(t.default ? t.default : e.default)); + } + if (t.colorSpace && 'rgb' !== t.colorSpace && !ir[t.colorSpace]) + throw new Error('Unknown color space: ' + t.colorSpace); + if ('exponential' === u) r = Kr; + else if ('interval' === u) r = Zr; + else if ('categorical' === u) { + (r = Nr), (n = Object.create(null)); + for (var p = 0, c = t.stops; p < c.length; p += 1) { + var h = c[p]; + n[h[0]] = h[1]; + } + i = typeof t.stops[0][0]; + } else { + if ('identity' !== u) + throw new Error('Unknown function type "' + u + '"'); + r = Gr; + } + if (o) { + for (var f = {}, y = [], d = 0; d < t.stops.length; d++) { + var m = t.stops[d], + v = m[0].zoom; + void 0 === f[v] && + ((f[v] = { + zoom: v, + type: t.type, + property: t.property, + default: t.default, + stops: [], + }), + y.push(v)), + f[v].stops.push([m[0].value, m[1]]); + } + for (var g = [], x = 0, b = y; x < b.length; x += 1) { + var w = b[x]; + g.push([f[w].zoom, Ur(f[w], e)]); + } + var _ = { name: 'linear' }; + return { + kind: 'composite', + interpolationType: _, + interpolationFactor: ar.interpolationFactor.bind(void 0, _), + zoomStops: g.map(function (t) { + return t[0]; + }), + evaluate: function (r, n) { + var i = r.zoom; + return Kr({ stops: g, base: t.base }, e, i).evaluate(i, n); + }, + }; + } + if (s) { + var A = + 'exponential' === u + ? { name: 'exponential', base: void 0 !== t.base ? t.base : 1 } + : null; + return { + kind: 'camera', + interpolationType: A, + interpolationFactor: ar.interpolationFactor.bind(void 0, A), + zoomStops: t.stops.map(function (t) { + return t[0]; + }), + evaluate: function (a) { + return r(t, e, a.zoom, n, i); + }, + }; + } + return { + kind: 'source', + evaluate: function (a, o) { + var s = o && o.properties ? o.properties[t.property] : void 0; + return void 0 === s ? qr(t.default, e.default) : r(t, e, s, n, i); + }, + }; + } + function qr(t, e, r) { + return void 0 !== t ? t : void 0 !== e ? e : void 0 !== r ? r : void 0; + } + function Nr(t, e, r, n, i) { + return qr(typeof r === i ? n[r] : void 0, t.default, e.default); + } + function Zr(t, e, r) { + if ('number' !== Dr(r)) return qr(t.default, e.default); + var n = t.stops.length; + if (1 === n) return t.stops[0][1]; + if (r <= t.stops[0][0]) return t.stops[0][1]; + if (r >= t.stops[n - 1][0]) return t.stops[n - 1][1]; + var i = De( + t.stops.map(function (t) { + return t[0]; + }), + r, + ); + return t.stops[i][1]; + } + function Kr(t, e, r) { + var n = void 0 !== t.base ? t.base : 1; + if ('number' !== Dr(r)) return qr(t.default, e.default); + var i = t.stops.length; + if (1 === i) return t.stops[0][1]; + if (r <= t.stops[0][0]) return t.stops[0][1]; + if (r >= t.stops[i - 1][0]) return t.stops[i - 1][1]; + var a = De( + t.stops.map(function (t) { + return t[0]; + }), + r, + ), + o = (function (t, e, r, n) { + var i = n - r, + a = t - r; + return 0 === i + ? 0 + : 1 === e + ? a / i + : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1); + })(r, n, t.stops[a][0], t.stops[a + 1][0]), + s = t.stops[a][1], + u = t.stops[a + 1][1], + l = Ue[e.type] || Rr; + if (t.colorSpace && 'rgb' !== t.colorSpace) { + var p = ir[t.colorSpace]; + l = function (t, e) { + return p.reverse(p.interpolate(p.forward(t), p.forward(e), o)); + }; + } + return 'function' == typeof s.evaluate + ? { + evaluate: function () { + for (var t = [], e = arguments.length; e--; ) t[e] = arguments[e]; + var r = s.evaluate.apply(void 0, t), + n = u.evaluate.apply(void 0, t); + if (void 0 !== r && void 0 !== n) return l(r, n, o); + }, + } + : l(s, u, o); + } + function Gr(t, e, r) { + switch (e.type) { + case 'color': + r = Yt.parse(r); + break; + case 'formatted': + r = $t.fromString(r.toString()); + break; + case 'resolvedImage': + r = te.fromString(r.toString()); + break; + case 'padding': + r = Qt.parse(r); + break; + default: + Dr(r) === e.type || + ('enum' === e.type && e.values[r]) || + (r = void 0); + } + return qr(r, t.default, e.default); + } + fe.register(zr, { + error: [ + { kind: 'error' }, + [zt], + function (t, e) { + throw new oe(e[0].evaluate(t)); + }, + ], + typeof: [ + zt, + [Et], + function (t, e) { + return Dt(ne(e[0].evaluate(t))); + }, + ], + 'to-rgba': [ + Lt(Mt, 4), + [Bt], + function (t, e) { + return e[0].evaluate(t).toArray(); + }, + ], + rgb: [Bt, [Mt, Mt, Mt], Pr], + rgba: [Bt, [Mt, Mt, Mt, Mt], Pr], + has: { + type: Pt, + overloads: [ + [ + [zt], + function (t, e) { + return Br(e[0].evaluate(t), t.properties()); + }, + ], + [ + [zt, Ct], + function (t, e) { + var r = e[1]; + return Br(e[0].evaluate(t), r.evaluate(t)); + }, + ], + ], + }, + get: { + type: Et, + overloads: [ + [ + [zt], + function (t, e) { + return Cr(e[0].evaluate(t), t.properties()); + }, + ], + [ + [zt, Ct], + function (t, e) { + var r = e[1]; + return Cr(e[0].evaluate(t), r.evaluate(t)); + }, + ], + ], + }, + 'feature-state': [ + Et, + [zt], + function (t, e) { + return Cr(e[0].evaluate(t), t.featureState || {}); + }, + ], + properties: [ + Ct, + [], + function (t) { + return t.properties(); + }, + ], + 'geometry-type': [ + zt, + [], + function (t) { + return t.geometryType(); + }, + ], + id: [ + Et, + [], + function (t) { + return t.id(); + }, + ], + zoom: [ + Mt, + [], + function (t) { + return t.globals.zoom; + }, + ], + 'heatmap-density': [ + Mt, + [], + function (t) { + return t.globals.heatmapDensity || 0; + }, + ], + 'line-progress': [ + Mt, + [], + function (t) { + return t.globals.lineProgress || 0; + }, + ], + accumulated: [ + Et, + [], + function (t) { + return void 0 === t.globals.accumulated + ? null + : t.globals.accumulated; + }, + ], + '+': [ + Mt, + Er(Mt), + function (t, e) { + for (var r = 0, n = 0, i = e; n < i.length; n += 1) + r += i[n].evaluate(t); + return r; + }, + ], + '*': [ + Mt, + Er(Mt), + function (t, e) { + for (var r = 1, n = 0, i = e; n < i.length; n += 1) + r *= i[n].evaluate(t); + return r; + }, + ], + '-': { + type: Mt, + overloads: [ + [ + [Mt, Mt], + function (t, e) { + var r = e[1]; + return e[0].evaluate(t) - r.evaluate(t); + }, + ], + [ + [Mt], + function (t, e) { + return -e[0].evaluate(t); + }, + ], + ], + }, + '/': [ + Mt, + [Mt, Mt], + function (t, e) { + var r = e[1]; + return e[0].evaluate(t) / r.evaluate(t); + }, + ], + '%': [ + Mt, + [Mt, Mt], + function (t, e) { + var r = e[1]; + return e[0].evaluate(t) % r.evaluate(t); + }, + ], + ln2: [ + Mt, + [], + function () { + return Math.LN2; + }, + ], + pi: [ + Mt, + [], + function () { + return Math.PI; + }, + ], + e: [ + Mt, + [], + function () { + return Math.E; + }, + ], + '^': [ + Mt, + [Mt, Mt], + function (t, e) { + var r = e[1]; + return Math.pow(e[0].evaluate(t), r.evaluate(t)); + }, + ], + sqrt: [ + Mt, + [Mt], + function (t, e) { + return Math.sqrt(e[0].evaluate(t)); + }, + ], + log10: [ + Mt, + [Mt], + function (t, e) { + return Math.log(e[0].evaluate(t)) / Math.LN10; + }, + ], + ln: [ + Mt, + [Mt], + function (t, e) { + return Math.log(e[0].evaluate(t)); + }, + ], + log2: [ + Mt, + [Mt], + function (t, e) { + return Math.log(e[0].evaluate(t)) / Math.LN2; + }, + ], + sin: [ + Mt, + [Mt], + function (t, e) { + return Math.sin(e[0].evaluate(t)); + }, + ], + cos: [ + Mt, + [Mt], + function (t, e) { + return Math.cos(e[0].evaluate(t)); + }, + ], + tan: [ + Mt, + [Mt], + function (t, e) { + return Math.tan(e[0].evaluate(t)); + }, + ], + asin: [ + Mt, + [Mt], + function (t, e) { + return Math.asin(e[0].evaluate(t)); + }, + ], + acos: [ + Mt, + [Mt], + function (t, e) { + return Math.acos(e[0].evaluate(t)); + }, + ], + atan: [ + Mt, + [Mt], + function (t, e) { + return Math.atan(e[0].evaluate(t)); + }, + ], + min: [ + Mt, + Er(Mt), + function (t, e) { + return Math.min.apply( + Math, + e.map(function (e) { + return e.evaluate(t); + }), + ); + }, + ], + max: [ + Mt, + Er(Mt), + function (t, e) { + return Math.max.apply( + Math, + e.map(function (e) { + return e.evaluate(t); + }), + ); + }, + ], + abs: [ + Mt, + [Mt], + function (t, e) { + return Math.abs(e[0].evaluate(t)); + }, + ], + round: [ + Mt, + [Mt], + function (t, e) { + var r = e[0].evaluate(t); + return r < 0 ? -Math.round(-r) : Math.round(r); + }, + ], + floor: [ + Mt, + [Mt], + function (t, e) { + return Math.floor(e[0].evaluate(t)); + }, + ], + ceil: [ + Mt, + [Mt], + function (t, e) { + return Math.ceil(e[0].evaluate(t)); + }, + ], + 'filter-==': [ + Pt, + [zt, Et], + function (t, e) { + var r = e[0], + n = e[1]; + return t.properties()[r.value] === n.value; + }, + ], + 'filter-id-==': [ + Pt, + [Et], + function (t, e) { + var r = e[0]; + return t.id() === r.value; + }, + ], + 'filter-type-==': [ + Pt, + [zt], + function (t, e) { + var r = e[0]; + return t.geometryType() === r.value; + }, + ], + 'filter-<': [ + Pt, + [zt, Et], + function (t, e) { + var r = e[0], + n = e[1], + i = t.properties()[r.value], + a = n.value; + return typeof i == typeof a && i < a; + }, + ], + 'filter-id-<': [ + Pt, + [Et], + function (t, e) { + var r = e[0], + n = t.id(), + i = r.value; + return typeof n == typeof i && n < i; + }, + ], + 'filter->': [ + Pt, + [zt, Et], + function (t, e) { + var r = e[0], + n = e[1], + i = t.properties()[r.value], + a = n.value; + return typeof i == typeof a && i > a; + }, + ], + 'filter-id->': [ + Pt, + [Et], + function (t, e) { + var r = e[0], + n = t.id(), + i = r.value; + return typeof n == typeof i && n > i; + }, + ], + 'filter-<=': [ + Pt, + [zt, Et], + function (t, e) { + var r = e[0], + n = e[1], + i = t.properties()[r.value], + a = n.value; + return typeof i == typeof a && i <= a; + }, + ], + 'filter-id-<=': [ + Pt, + [Et], + function (t, e) { + var r = e[0], + n = t.id(), + i = r.value; + return typeof n == typeof i && n <= i; + }, + ], + 'filter->=': [ + Pt, + [zt, Et], + function (t, e) { + var r = e[0], + n = e[1], + i = t.properties()[r.value], + a = n.value; + return typeof i == typeof a && i >= a; + }, + ], + 'filter-id->=': [ + Pt, + [Et], + function (t, e) { + var r = e[0], + n = t.id(), + i = r.value; + return typeof n == typeof i && n >= i; + }, + ], + 'filter-has': [ + Pt, + [Et], + function (t, e) { + return e[0].value in t.properties(); + }, + ], + 'filter-has-id': [ + Pt, + [], + function (t) { + return null !== t.id() && void 0 !== t.id(); + }, + ], + 'filter-type-in': [ + Pt, + [Lt(zt)], + function (t, e) { + return e[0].value.indexOf(t.geometryType()) >= 0; + }, + ], + 'filter-id-in': [ + Pt, + [Lt(Et)], + function (t, e) { + return e[0].value.indexOf(t.id()) >= 0; + }, + ], + 'filter-in-small': [ + Pt, + [zt, Lt(Et)], + function (t, e) { + var r = e[0]; + return e[1].value.indexOf(t.properties()[r.value]) >= 0; + }, + ], + 'filter-in-large': [ + Pt, + [zt, Lt(Et)], + function (t, e) { + var r = e[0], + n = e[1]; + return (function (t, e, r, n) { + for (; r <= n; ) { + var i = (r + n) >> 1; + if (e[i] === t) return !0; + e[i] > t ? (n = i - 1) : (r = i + 1); + } + return !1; + })(t.properties()[r.value], n.value, 0, n.value.length - 1); + }, + ], + all: { + type: Pt, + overloads: [ + [ + [Pt, Pt], + function (t, e) { + var r = e[1]; + return e[0].evaluate(t) && r.evaluate(t); + }, + ], + [ + Er(Pt), + function (t, e) { + for (var r = 0, n = e; r < n.length; r += 1) + if (!n[r].evaluate(t)) return !1; + return !0; + }, + ], + ], + }, + any: { + type: Pt, + overloads: [ + [ + [Pt, Pt], + function (t, e) { + var r = e[1]; + return e[0].evaluate(t) || r.evaluate(t); + }, + ], + [ + Er(Pt), + function (t, e) { + for (var r = 0, n = e; r < n.length; r += 1) + if (n[r].evaluate(t)) return !0; + return !1; + }, + ], + ], + }, + '!': [ + Pt, + [Pt], + function (t, e) { + return !e[0].evaluate(t); + }, + ], + 'is-supported-script': [ + Pt, + [zt], + function (t, e) { + var r = t.globals && t.globals.isSupportedScript; + return !r || r(e[0].evaluate(t)); + }, + ], + upcase: [ + zt, + [zt], + function (t, e) { + return e[0].evaluate(t).toUpperCase(); + }, + ], + downcase: [ + zt, + [zt], + function (t, e) { + return e[0].evaluate(t).toLowerCase(); + }, + ], + concat: [ + zt, + Er(Et), + function (t, e) { + return e + .map(function (e) { + return ie(e.evaluate(t)); + }) + .join(''); + }, + ], + 'resolved-locale': [ + zt, + [Vt], + function (t, e) { + return e[0].evaluate(t).resolvedLocale(); + }, + ], + }); + var Jr = function (t, e) { + (this.expression = t), + (this._warningHistory = {}), + (this._evaluator = new he()), + (this._defaultValue = e + ? (function (t) { + return 'color' === t.type && jr(t.default) + ? new Yt(0, 0, 0, 0) + : 'color' === t.type + ? Yt.parse(t.default) || null + : 'padding' === t.type + ? Qt.parse(t.default) || null + : void 0 === t.default + ? null + : t.default; + })(e) + : null), + (this._enumValues = e && 'enum' === e.type ? e.values : null); + }; + function Xr(t) { + return ( + Array.isArray(t) && + t.length > 0 && + 'string' == typeof t[0] && + t[0] in zr + ); + } + function Yr(t, e) { + var r = new Oe( + zr, + [], + e + ? (function (t) { + var e = { + color: Bt, + string: zt, + number: Mt, + enum: zt, + boolean: Pt, + formatted: Tt, + padding: Ft, + resolvedImage: Ot, + }; + return 'array' === t.type + ? Lt(e[t.value] || Et, t.length) + : e[t.type]; + })(e) + : void 0, + ), + n = r.parse( + t, + void 0, + void 0, + void 0, + e && 'string' === e.type ? { typeAnnotation: 'coerce' } : void 0, + ); + return n ? Vr(new Jr(n, e)) : Tr(r.errors); + } + (Jr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i, a) { + return ( + (this._evaluator.globals = t), + (this._evaluator.feature = e), + (this._evaluator.featureState = r), + (this._evaluator.canonical = n), + (this._evaluator.availableImages = i || null), + (this._evaluator.formattedSection = a), + this.expression.evaluate(this._evaluator) + ); + }), + (Jr.prototype.evaluate = function (t, e, r, n, i, a) { + (this._evaluator.globals = t), + (this._evaluator.feature = e || null), + (this._evaluator.featureState = r || null), + (this._evaluator.canonical = n), + (this._evaluator.availableImages = i || null), + (this._evaluator.formattedSection = a || null); + try { + var o = this.expression.evaluate(this._evaluator); + if (null == o || ('number' == typeof o && o != o)) + return this._defaultValue; + if (this._enumValues && !(o in this._enumValues)) + throw new oe( + 'Expected value to be one of ' + + Object.keys(this._enumValues) + .map(function (t) { + return JSON.stringify(t); + }) + .join(', ') + + ', but found ' + + JSON.stringify(o) + + ' instead.', + ); + return o; + } catch (t) { + return ( + this._warningHistory[t.message] || + ((this._warningHistory[t.message] = !0), + 'undefined' != typeof console && console.warn(t.message)), + this._defaultValue + ); + } + }); + var Hr = function (t, e) { + (this.kind = t), + (this._styleExpression = e), + (this.isStateDependent = 'constant' !== t && !Ve(e.expression)); + }; + (Hr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i, a) { + return this._styleExpression.evaluateWithoutErrorHandling( + t, + e, + r, + n, + i, + a, + ); + }), + (Hr.prototype.evaluate = function (t, e, r, n, i, a) { + return this._styleExpression.evaluate(t, e, r, n, i, a); + }); + var Wr = function (t, e, r, n) { + (this.kind = t), + (this.zoomStops = r), + (this._styleExpression = e), + (this.isStateDependent = 'camera' !== t && !Ve(e.expression)), + (this.interpolationType = n); + }; + function $r(t, e) { + var r = Yr(t, e); + if ('error' === r.result) return r; + var n = r.value.expression, + i = Ee(n); + if (!i && !Fr(e)) + return Tr([new kt('', 'data expressions not supported')]); + var a = Te(n, ['zoom']); + if (!a && !Or(e)) + return Tr([new kt('', 'zoom expressions not supported')]); + var o = tn(n); + return o || a + ? o instanceof kt + ? Tr([o]) + : o instanceof ar && !Lr(e) + ? Tr([ + new kt( + '', + '"interpolate" expressions cannot be used with this property', + ), + ]) + : Vr( + o + ? new Wr( + i ? 'camera' : 'composite', + r.value, + o.labels, + o instanceof ar ? o.interpolation : void 0, + ) + : new Hr(i ? 'constant' : 'source', r.value), + ) + : Tr([ + new kt( + '', + '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.', + ), + ]); + } + (Wr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i, a) { + return this._styleExpression.evaluateWithoutErrorHandling( + t, + e, + r, + n, + i, + a, + ); + }), + (Wr.prototype.evaluate = function (t, e, r, n, i, a) { + return this._styleExpression.evaluate(t, e, r, n, i, a); + }), + (Wr.prototype.interpolationFactor = function (t, e, r) { + return this.interpolationType + ? ar.interpolationFactor(this.interpolationType, t, e, r) + : 0; + }); + var Qr = function (t, e) { + (this._parameters = t), + (this._specification = e), + wt(this, Ur(this._parameters, this._specification)); + }; + function tn(t) { + var e = null; + if (t instanceof ur) e = tn(t.result); + else if (t instanceof sr) + for (var r = 0, n = t.args; r < n.length && !(e = tn(n[r])); r += 1); + else + (t instanceof je || t instanceof ar) && + t.input instanceof fe && + 'zoom' === t.input.name && + (e = t); + return ( + e instanceof kt || + t.eachChild(function (t) { + var r = tn(t); + r instanceof kt + ? (e = r) + : !e && r + ? (e = new kt( + '', + '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.', + )) + : e && + r && + e !== r && + (e = new kt( + '', + 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.', + )); + }), + e + ); + } + function en(t) { + var e = t.key, + r = t.value, + n = t.valueSpec || {}, + i = t.objectElementValidators || {}, + a = t.style, + o = t.styleSpec, + s = [], + u = Dr(r); + if ('object' !== u) + return [new xt(e, r, 'object expected, ' + u + ' found')]; + for (var l in r) { + var p = l.split('.')[0], + c = n[p] || n['*'], + h = void 0; + if (i[p]) h = i[p]; + else if (n[p]) h = Bn; + else if (i['*']) h = i['*']; + else { + if (!n['*']) { + s.push(new xt(e, r[l], 'unknown property "' + l + '"')); + continue; + } + h = Bn; + } + s = s.concat( + h( + { + key: (e ? e + '.' : e) + l, + value: r[l], + valueSpec: c, + style: a, + styleSpec: o, + object: r, + objectKey: l, + }, + r, + ), + ); + } + for (var f in n) + i[f] || + (n[f].required && + void 0 === n[f].default && + void 0 === r[f] && + s.push(new xt(e, r, 'missing required property "' + f + '"'))); + return s; + } + function rn(t) { + var e = t.value, + r = t.valueSpec, + n = t.style, + i = t.styleSpec, + a = t.key, + o = t.arrayElementValidator || Bn; + if ('array' !== Dr(e)) + return [new xt(a, e, 'array expected, ' + Dr(e) + ' found')]; + if (r.length && e.length !== r.length) + return [ + new xt( + a, + e, + 'array length ' + + r.length + + ' expected, length ' + + e.length + + ' found', + ), + ]; + if (r['min-length'] && e.length < r['min-length']) + return [ + new xt( + a, + e, + 'array length at least ' + + r['min-length'] + + ' expected, length ' + + e.length + + ' found', + ), + ]; + var s = { type: r.value, values: r.values }; + i.$version < 7 && (s.function = r.function), + 'object' === Dr(r.value) && (s = r.value); + for (var u = [], l = 0; l < e.length; l++) + u = u.concat( + o({ + array: e, + arrayIndex: l, + value: e[l], + valueSpec: s, + style: n, + styleSpec: i, + key: a + '[' + l + ']', + }), + ); + return u; + } + function nn(t) { + var e = t.key, + r = t.value, + n = t.valueSpec, + i = Dr(r); + return ( + 'number' === i && r != r && (i = 'NaN'), + 'number' !== i + ? [new xt(e, r, 'number expected, ' + i + ' found')] + : 'minimum' in n && r < n.minimum + ? [new xt(e, r, r + ' is less than the minimum value ' + n.minimum)] + : 'maximum' in n && r > n.maximum + ? [ + new xt( + e, + r, + r + ' is greater than the maximum value ' + n.maximum, + ), + ] + : [] + ); + } + function an(t) { + var e, + r, + n, + i = t.valueSpec, + a = _t(t.value.type), + o = {}, + s = 'categorical' !== a && void 0 === t.value.property, + u = !s, + l = + 'array' === Dr(t.value.stops) && + 'array' === Dr(t.value.stops[0]) && + 'object' === Dr(t.value.stops[0][0]), + p = en({ + key: t.key, + value: t.value, + valueSpec: t.styleSpec.function, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + stops: function (t) { + if ('identity' === a) + return [ + new xt( + t.key, + t.value, + 'identity function may not have a "stops" property', + ), + ]; + var e = [], + r = t.value; + return ( + (e = e.concat( + rn({ + key: t.key, + value: r, + valueSpec: t.valueSpec, + style: t.style, + styleSpec: t.styleSpec, + arrayElementValidator: c, + }), + )), + 'array' === Dr(r) && + 0 === r.length && + e.push(new xt(t.key, r, 'array must have at least one stop')), + e + ); + }, + default: function (t) { + return Bn({ + key: t.key, + value: t.value, + valueSpec: i, + style: t.style, + styleSpec: t.styleSpec, + }); + }, + }, + }); + return ( + 'identity' === a && + s && + p.push( + new xt(t.key, t.value, 'missing required property "property"'), + ), + 'identity' === a || + t.value.stops || + p.push(new xt(t.key, t.value, 'missing required property "stops"')), + 'exponential' === a && + t.valueSpec.expression && + !Lr(t.valueSpec) && + p.push(new xt(t.key, t.value, 'exponential functions not supported')), + t.styleSpec.$version >= 8 && + (u && !Fr(t.valueSpec) + ? p.push(new xt(t.key, t.value, 'property functions not supported')) + : s && + !Or(t.valueSpec) && + p.push(new xt(t.key, t.value, 'zoom functions not supported'))), + ('categorical' !== a && !l) || + void 0 !== t.value.property || + p.push(new xt(t.key, t.value, '"property" property is required')), + p + ); + function c(t) { + var e = [], + a = t.value, + s = t.key; + if ('array' !== Dr(a)) + return [new xt(s, a, 'array expected, ' + Dr(a) + ' found')]; + if (2 !== a.length) + return [ + new xt( + s, + a, + 'array length 2 expected, length ' + a.length + ' found', + ), + ]; + if (l) { + if ('object' !== Dr(a[0])) + return [new xt(s, a, 'object expected, ' + Dr(a[0]) + ' found')]; + if (void 0 === a[0].zoom) + return [new xt(s, a, 'object stop key must have zoom')]; + if (void 0 === a[0].value) + return [new xt(s, a, 'object stop key must have value')]; + if (n && n > _t(a[0].zoom)) + return [ + new xt( + s, + a[0].zoom, + 'stop zoom values must appear in ascending order', + ), + ]; + _t(a[0].zoom) !== n && ((n = _t(a[0].zoom)), (r = void 0), (o = {})), + (e = e.concat( + en({ + key: s + '[0]', + value: a[0], + valueSpec: { zoom: {} }, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { zoom: nn, value: h }, + }), + )); + } else e = e.concat(h({ key: s + '[0]', value: a[0], valueSpec: {}, style: t.style, styleSpec: t.styleSpec }, a)); + return Xr(At(a[1])) + ? e.concat([ + new xt( + s + '[1]', + a[1], + 'expressions are not allowed in function stops.', + ), + ]) + : e.concat( + Bn({ + key: s + '[1]', + value: a[1], + valueSpec: i, + style: t.style, + styleSpec: t.styleSpec, + }), + ); + } + function h(t, n) { + var s = Dr(t.value), + u = _t(t.value), + l = null !== t.value ? t.value : n; + if (e) { + if (s !== e) + return [ + new xt( + t.key, + l, + s + + ' stop domain type must match previous stop domain type ' + + e, + ), + ]; + } else e = s; + if ('number' !== s && 'string' !== s && 'boolean' !== s) + return [ + new xt( + t.key, + l, + 'stop domain value must be a number, string, or boolean', + ), + ]; + if ('number' !== s && 'categorical' !== a) { + var p = 'number expected, ' + s + ' found'; + return ( + Fr(i) && + void 0 === a && + (p += + '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), + [new xt(t.key, l, p)] + ); + } + return 'categorical' !== a || + 'number' !== s || + (isFinite(u) && Math.floor(u) === u) + ? 'categorical' !== a && 'number' === s && void 0 !== r && u < r + ? [ + new xt( + t.key, + l, + 'stop domain values must appear in ascending order', + ), + ] + : ((r = u), + 'categorical' === a && u in o + ? [new xt(t.key, l, 'stop domain values must be unique')] + : ((o[u] = !0), [])) + : [new xt(t.key, l, 'integer expected, found ' + u)]; + } + } + function on(t) { + var e = ('property' === t.expressionContext ? $r : Yr)( + At(t.value), + t.valueSpec, + ); + if ('error' === e.result) + return e.value.map(function (e) { + return new xt('' + t.key + e.key, t.value, e.message); + }); + var r = e.value.expression || e.value._styleExpression.expression; + if ( + 'property' === t.expressionContext && + 'text-font' === t.propertyKey && + !r.outputDefined() + ) + return [ + new xt( + t.key, + t.value, + 'Invalid data expression for "' + + t.propertyKey + + '". Output values must be contained as literals within the expression.', + ), + ]; + if ( + 'property' === t.expressionContext && + 'layout' === t.propertyType && + !Ve(r) + ) + return [ + new xt( + t.key, + t.value, + '"feature-state" data expressions are not supported with layout properties.', + ), + ]; + if ('filter' === t.expressionContext && !Ve(r)) + return [ + new xt( + t.key, + t.value, + '"feature-state" data expressions are not supported with filters.', + ), + ]; + if (t.expressionContext && 0 === t.expressionContext.indexOf('cluster')) { + if (!Te(r, ['zoom', 'feature-state'])) + return [ + new xt( + t.key, + t.value, + '"zoom" and "feature-state" expressions are not supported with cluster properties.', + ), + ]; + if ('cluster-initial' === t.expressionContext && !Ee(r)) + return [ + new xt( + t.key, + t.value, + 'Feature data expressions are not supported with initial expression part of cluster properties.', + ), + ]; + } + return []; + } + function sn(t) { + var e = t.key, + r = t.value, + n = t.valueSpec, + i = []; + return ( + Array.isArray(n.values) + ? -1 === n.values.indexOf(_t(r)) && + i.push( + new xt( + e, + r, + 'expected one of [' + + n.values.join(', ') + + '], ' + + JSON.stringify(r) + + ' found', + ), + ) + : -1 === Object.keys(n.values).indexOf(_t(r)) && + i.push( + new xt( + e, + r, + 'expected one of [' + + Object.keys(n.values).join(', ') + + '], ' + + JSON.stringify(r) + + ' found', + ), + ), + i + ); + } + function un(t) { + if (!0 === t || !1 === t) return !0; + if (!Array.isArray(t) || 0 === t.length) return !1; + switch (t[0]) { + case 'has': + return t.length >= 2 && '$id' !== t[1] && '$type' !== t[1]; + case 'in': + return ( + t.length >= 3 && ('string' != typeof t[1] || Array.isArray(t[2])) + ); + case '!in': + case '!has': + case 'none': + return !1; + case '==': + case '!=': + case '>': + case '>=': + case '<': + case '<=': + return 3 !== t.length || Array.isArray(t[1]) || Array.isArray(t[2]); + case 'any': + case 'all': + for (var e = 0, r = t.slice(1); e < r.length; e += 1) { + var n = r[e]; + if (!un(n) && 'boolean' != typeof n) return !1; + } + return !0; + default: + return !0; + } + } + (Qr.deserialize = function (t) { + return new Qr(t._parameters, t._specification); + }), + (Qr.serialize = function (t) { + return { _parameters: t._parameters, _specification: t._specification }; + }); + var ln = { + type: 'boolean', + default: !1, + transition: !1, + 'property-type': 'data-driven', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + }; + function pn(t) { + if (null == t) + return { + filter: function () { + return !0; + }, + needGeometry: !1, + }; + un(t) || (t = fn(t)); + var e = Yr(t, ln); + if ('error' === e.result) + throw new Error( + e.value + .map(function (t) { + return t.key + ': ' + t.message; + }) + .join(', '), + ); + return { + filter: function (t, r, n) { + return e.value.evaluate(t, r, {}, n); + }, + needGeometry: hn(t), + }; + } + function cn(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function hn(t) { + if (!Array.isArray(t)) return !1; + if ('within' === t[0]) return !0; + for (var e = 1; e < t.length; e++) if (hn(t[e])) return !0; + return !1; + } + function fn(t) { + if (!t) return !0; + var e, + r = t[0]; + return t.length <= 1 + ? 'any' !== r + : '==' === r + ? yn(t[1], t[2], '==') + : '!=' === r + ? vn(yn(t[1], t[2], '==')) + : '<' === r || '>' === r || '<=' === r || '>=' === r + ? yn(t[1], t[2], r) + : 'any' === r + ? ((e = t.slice(1)), ['any'].concat(e.map(fn))) + : 'all' === r + ? ['all'].concat(t.slice(1).map(fn)) + : 'none' === r + ? ['all'].concat(t.slice(1).map(fn).map(vn)) + : 'in' === r + ? dn(t[1], t.slice(2)) + : '!in' === r + ? vn(dn(t[1], t.slice(2))) + : 'has' === r + ? mn(t[1]) + : '!has' === r + ? vn(mn(t[1])) + : 'within' !== r || t; + } + function yn(t, e, r) { + switch (t) { + case '$type': + return ['filter-type-' + r, e]; + case '$id': + return ['filter-id-' + r, e]; + default: + return ['filter-' + r, t, e]; + } + } + function dn(t, e) { + if (0 === e.length) return !1; + switch (t) { + case '$type': + return ['filter-type-in', ['literal', e]]; + case '$id': + return ['filter-id-in', ['literal', e]]; + default: + return e.length > 200 && + !e.some(function (t) { + return typeof t != typeof e[0]; + }) + ? ['filter-in-large', t, ['literal', e.sort(cn)]] + : ['filter-in-small', t, ['literal', e]]; + } + } + function mn(t) { + switch (t) { + case '$type': + return !0; + case '$id': + return ['filter-has-id']; + default: + return ['filter-has', t]; + } + } + function vn(t) { + return ['!', t]; + } + function gn(t) { + return un(At(t.value)) + ? on( + wt({}, t, { + expressionContext: 'filter', + valueSpec: { value: 'boolean' }, + }), + ) + : xn(t); + } + function xn(t) { + var e = t.value, + r = t.key; + if ('array' !== Dr(e)) + return [new xt(r, e, 'array expected, ' + Dr(e) + ' found')]; + var n, + i = t.styleSpec, + a = []; + if (e.length < 1) + return [new xt(r, e, 'filter array must have at least 1 element')]; + switch ( + ((a = a.concat( + sn({ + key: r + '[0]', + value: e[0], + valueSpec: i.filter_operator, + style: t.style, + styleSpec: t.styleSpec, + }), + )), + _t(e[0])) + ) { + case '<': + case '<=': + case '>': + case '>=': + e.length >= 2 && + '$type' === _t(e[1]) && + a.push( + new xt( + r, + e, + '"$type" cannot be use with operator "' + e[0] + '"', + ), + ); + case '==': + case '!=': + 3 !== e.length && + a.push( + new xt( + r, + e, + 'filter array for operator "' + e[0] + '" must have 3 elements', + ), + ); + case 'in': + case '!in': + e.length >= 2 && + 'string' !== (n = Dr(e[1])) && + a.push(new xt(r + '[1]', e[1], 'string expected, ' + n + ' found')); + for (var o = 2; o < e.length; o++) + (n = Dr(e[o])), + '$type' === _t(e[1]) + ? (a = a.concat( + sn({ + key: r + '[' + o + ']', + value: e[o], + valueSpec: i.geometry_type, + style: t.style, + styleSpec: t.styleSpec, + }), + )) + : 'string' !== n && + 'number' !== n && + 'boolean' !== n && + a.push( + new xt( + r + '[' + o + ']', + e[o], + 'string, number, or boolean expected, ' + n + ' found', + ), + ); + break; + case 'any': + case 'all': + case 'none': + for (var s = 1; s < e.length; s++) + a = a.concat( + xn({ + key: r + '[' + s + ']', + value: e[s], + style: t.style, + styleSpec: t.styleSpec, + }), + ); + break; + case 'has': + case '!has': + (n = Dr(e[1])), + 2 !== e.length + ? a.push( + new xt( + r, + e, + 'filter array for "' + + e[0] + + '" operator must have 2 elements', + ), + ) + : 'string' !== n && + a.push( + new xt(r + '[1]', e[1], 'string expected, ' + n + ' found'), + ); + break; + case 'within': + (n = Dr(e[1])), + 2 !== e.length + ? a.push( + new xt( + r, + e, + 'filter array for "' + + e[0] + + '" operator must have 2 elements', + ), + ) + : 'object' !== n && + a.push( + new xt(r + '[1]', e[1], 'object expected, ' + n + ' found'), + ); + } + return a; + } + function bn(t, e) { + var r = t.key, + n = t.style, + i = t.styleSpec, + a = t.value, + o = t.objectKey, + s = i[e + '_' + t.layerType]; + if (!s) return []; + var u = o.match(/^(.*)-transition$/); + if ('paint' === e && u && s[u[1]] && s[u[1]].transition) + return Bn({ + key: r, + value: a, + valueSpec: i.transition, + style: n, + styleSpec: i, + }); + var l, + p = t.valueSpec || s[o]; + if (!p) return [new xt(r, a, 'unknown property "' + o + '"')]; + if ( + 'string' === Dr(a) && + Fr(p) && + !p.tokens && + (l = /^{([^}]+)}$/.exec(a)) + ) + return [ + new xt( + r, + a, + '"' + + o + + '" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ' + + JSON.stringify(l[1]) + + ' }`.', + ), + ]; + var c = []; + return ( + 'symbol' === t.layerType && + ('text-field' === o && + n && + !n.glyphs && + c.push( + new xt( + r, + a, + 'use of "text-field" requires a style "glyphs" property', + ), + ), + 'text-font' === o && + jr(At(a)) && + 'identity' === _t(a.type) && + c.push( + new xt(r, a, '"text-font" does not support identity functions'), + )), + c.concat( + Bn({ + key: t.key, + value: a, + valueSpec: p, + style: n, + styleSpec: i, + expressionContext: 'property', + propertyType: e, + propertyKey: o, + }), + ) + ); + } + function wn(t) { + return bn(t, 'paint'); + } + function _n(t) { + return bn(t, 'layout'); + } + function An(t) { + var e = [], + r = t.value, + n = t.key, + i = t.style, + a = t.styleSpec; + r.type || + r.ref || + e.push(new xt(n, r, 'either "type" or "ref" is required')); + var o, + s = _t(r.type), + u = _t(r.ref); + if (r.id) + for (var l = _t(r.id), p = 0; p < t.arrayIndex; p++) { + var c = i.layers[p]; + _t(c.id) === l && + e.push( + new xt( + n, + r.id, + 'duplicate layer id "' + + r.id + + '", previously used at line ' + + c.id.__line__, + ), + ); + } + if ('ref' in r) + ['type', 'source', 'source-layer', 'filter', 'layout'].forEach( + function (t) { + t in r && + e.push( + new xt(n, r[t], '"' + t + '" is prohibited for ref layers'), + ); + }, + ), + i.layers.forEach(function (t) { + _t(t.id) === u && (o = t); + }), + o + ? o.ref + ? e.push( + new xt(n, r.ref, 'ref cannot reference another ref layer'), + ) + : (s = _t(o.type)) + : e.push(new xt(n, r.ref, 'ref layer "' + u + '" not found')); + else if ('background' !== s) + if (r.source) { + var h = i.sources && i.sources[r.source], + f = h && _t(h.type); + h + ? 'vector' === f && 'raster' === s + ? e.push( + new xt( + n, + r.source, + 'layer "' + r.id + '" requires a raster source', + ), + ) + : 'raster' === f && 'raster' !== s + ? e.push( + new xt( + n, + r.source, + 'layer "' + r.id + '" requires a vector source', + ), + ) + : 'vector' !== f || r['source-layer'] + ? 'raster-dem' === f && 'hillshade' !== s + ? e.push( + new xt( + n, + r.source, + "raster-dem source can only be used with layer type 'hillshade'.", + ), + ) + : 'line' !== s || + !r.paint || + !r.paint['line-gradient'] || + ('geojson' === f && h.lineMetrics) || + e.push( + new xt( + n, + r, + 'layer "' + + r.id + + '" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.', + ), + ) + : e.push( + new xt( + n, + r, + 'layer "' + r.id + '" must specify a "source-layer"', + ), + ) + : e.push( + new xt(n, r.source, 'source "' + r.source + '" not found'), + ); + } else e.push(new xt(n, r, 'missing required property "source"')); + return ( + (e = e.concat( + en({ + key: n, + value: r, + valueSpec: a.layer, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': function () { + return []; + }, + type: function () { + return Bn({ + key: n + '.type', + value: r.type, + valueSpec: a.layer.type, + style: t.style, + styleSpec: t.styleSpec, + object: r, + objectKey: 'type', + }); + }, + filter: gn, + layout: function (t) { + return en({ + layer: r, + key: t.key, + value: t.value, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': function (t) { + return _n(wt({ layerType: s }, t)); + }, + }, + }); + }, + paint: function (t) { + return en({ + layer: r, + key: t.key, + value: t.value, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': function (t) { + return wn(wt({ layerType: s }, t)); + }, + }, + }); + }, + }, + }), + )), + e + ); + } + function kn(t) { + var e = t.value, + r = t.key, + n = Dr(e); + return 'string' !== n + ? [new xt(r, e, 'string expected, ' + n + ' found')] + : []; + } + var Sn = { + promoteId: function (t) { + var e = t.key, + r = t.value; + if ('string' === Dr(r)) return kn({ key: e, value: r }); + var n = []; + for (var i in r) n.push.apply(n, kn({ key: e + '.' + i, value: r[i] })); + return n; + }, + }; + function In(t) { + var e = t.value, + r = t.key, + n = t.styleSpec, + i = t.style; + if (!e.type) return [new xt(r, e, '"type" is required')]; + var a, + o = _t(e.type); + switch (o) { + case 'vector': + case 'raster': + case 'raster-dem': + return en({ + key: r, + value: e, + valueSpec: n['source_' + o.replace('-', '_')], + style: t.style, + styleSpec: n, + objectElementValidators: Sn, + }); + case 'geojson': + if ( + ((a = en({ + key: r, + value: e, + valueSpec: n.source_geojson, + style: i, + styleSpec: n, + objectElementValidators: Sn, + })), + e.cluster) + ) + for (var s in e.clusterProperties) { + var u = e.clusterProperties[s], + l = u[0], + p = 'string' == typeof l ? [l, ['accumulated'], ['get', s]] : l; + a.push.apply( + a, + on({ + key: r + '.' + s + '.map', + value: u[1], + expressionContext: 'cluster-map', + }), + ), + a.push.apply( + a, + on({ + key: r + '.' + s + '.reduce', + value: p, + expressionContext: 'cluster-reduce', + }), + ); + } + return a; + case 'video': + return en({ + key: r, + value: e, + valueSpec: n.source_video, + style: i, + styleSpec: n, + }); + case 'image': + return en({ + key: r, + value: e, + valueSpec: n.source_image, + style: i, + styleSpec: n, + }); + case 'canvas': + return [ + new xt( + r, + null, + 'Please use runtime APIs to add canvas sources, rather than including them in stylesheets.', + 'source.canvas', + ), + ]; + default: + return sn({ + key: r + '.type', + value: e.type, + valueSpec: { + values: [ + 'vector', + 'raster', + 'raster-dem', + 'geojson', + 'video', + 'image', + ], + }, + style: i, + styleSpec: n, + }); + } + } + function Mn(t) { + var e = t.value, + r = t.styleSpec, + n = r.light, + i = t.style, + a = [], + o = Dr(e); + if (void 0 === e) return a; + if ('object' !== o) + return a.concat([ + new xt('light', e, 'object expected, ' + o + ' found'), + ]); + for (var s in e) { + var u = s.match(/^(.*)-transition$/); + a = a.concat( + u && n[u[1]] && n[u[1]].transition + ? Bn({ + key: s, + value: e[s], + valueSpec: r.transition, + style: i, + styleSpec: r, + }) + : n[s] + ? Bn({ + key: s, + value: e[s], + valueSpec: n[s], + style: i, + styleSpec: r, + }) + : [new xt(s, e[s], 'unknown property "' + s + '"')], + ); + } + return a; + } + function zn(t) { + var e = t.value, + r = t.styleSpec, + n = r.terrain, + i = t.style, + a = [], + o = Dr(e); + if (void 0 === e) return a; + if ('object' !== o) + return a.concat([ + new xt('terrain', e, 'object expected, ' + o + ' found'), + ]); + for (var s in e) + a = a.concat( + n[s] + ? Bn({ + key: s, + value: e[s], + valueSpec: n[s], + style: i, + styleSpec: r, + }) + : [new xt(s, e[s], 'unknown property "' + s + '"')], + ); + return a; + } + var Pn = { + '*': function () { + return []; + }, + array: rn, + boolean: function (t) { + var e = t.value, + r = t.key, + n = Dr(e); + return 'boolean' !== n + ? [new xt(r, e, 'boolean expected, ' + n + ' found')] + : []; + }, + number: nn, + color: function (t) { + var e = t.key, + r = t.value, + n = Dr(r); + return 'string' !== n + ? [new xt(e, r, 'color expected, ' + n + ' found')] + : null === Nt(r) + ? [new xt(e, r, 'color expected, "' + r + '" found')] + : []; + }, + constants: bt, + enum: sn, + filter: gn, + function: an, + layer: An, + object: en, + source: In, + light: Mn, + terrain: zn, + string: kn, + formatted: function (t) { + return 0 === kn(t).length ? [] : on(t); + }, + resolvedImage: function (t) { + return 0 === kn(t).length ? [] : on(t); + }, + padding: function (t) { + var e = t.key, + r = t.value; + if ('array' === Dr(r)) { + if (r.length < 1 || r.length > 4) + return [ + new xt( + e, + r, + 'padding requires 1 to 4 values; ' + r.length + ' values found', + ), + ]; + for (var n = { type: 'number' }, i = [], a = 0; a < r.length; a++) + i = i.concat( + Bn({ key: e + '[' + a + ']', value: r[a], valueSpec: n }), + ); + return i; + } + return nn({ key: e, value: r, valueSpec: {} }); + }, + }; + function Bn(t) { + var e = t.value, + r = t.valueSpec, + n = t.styleSpec; + return r.expression && jr(_t(e)) + ? an(t) + : r.expression && Xr(At(e)) + ? on(t) + : r.type && Pn[r.type] + ? Pn[r.type](t) + : en(wt({}, t, { valueSpec: r.type ? n[r.type] : r })); + } + function Cn(t) { + var e = t.value, + r = t.key, + n = kn(t); + return ( + n.length || + (-1 === e.indexOf('{fontstack}') && + n.push( + new xt(r, e, '"glyphs" url must include a "{fontstack}" token'), + ), + -1 === e.indexOf('{range}') && + n.push( + new xt(r, e, '"glyphs" url must include a "{range}" token'), + )), + n + ); + } + function En(t, e) { + void 0 === e && (e = gt); + var r = []; + return ( + (r = r.concat( + Bn({ + key: '', + value: t, + valueSpec: e.$root, + styleSpec: e, + style: t, + objectElementValidators: { + glyphs: Cn, + '*': function () { + return []; + }, + }, + }), + )), + t.constants && + (r = r.concat( + bt({ + key: 'constants', + value: t.constants, + style: t, + styleSpec: e, + }), + )), + Vn(r) + ); + } + function Vn(t) { + return [].concat(t).sort(function (t, e) { + return t.line - e.line; + }); + } + function Tn(t) { + return function () { + for (var e = [], r = arguments.length; r--; ) e[r] = arguments[r]; + return Vn(t.apply(this, e)); + }; + } + (En.source = Tn(In)), + (En.light = Tn(Mn)), + (En.terrain = Tn(zn)), + (En.layer = Tn(An)), + (En.filter = Tn(gn)), + (En.paintProperty = Tn(wn)), + (En.layoutProperty = Tn(_n)); + var Fn = En, + On = Fn.light, + Ln = Fn.paintProperty, + Dn = Fn.layoutProperty; + function jn(t, e) { + var r = !1; + if (e && e.length) + for (var n = 0, i = e; n < i.length; n += 1) + t.fire(new mt(new Error(i[n].message))), (r = !0); + return r; + } + var Rn = function (t, e, r) { + var n = (this.cells = []); + if (t instanceof ArrayBuffer) { + this.arrayBuffer = t; + var i = new Int32Array(this.arrayBuffer); + (t = i[0]), (this.d = (e = i[1]) + 2 * (r = i[2])); + for (var a = 0; a < this.d * this.d; a++) { + var o = i[3 + a], + s = i[3 + a + 1]; + n.push(o === s ? null : i.subarray(o, s)); + } + var u = i[3 + n.length + 1]; + (this.keys = i.subarray(i[3 + n.length], u)), + (this.bboxes = i.subarray(u)), + (this.insert = this._insertReadonly); + } else { + this.d = e + 2 * r; + for (var l = 0; l < this.d * this.d; l++) n.push([]); + (this.keys = []), (this.bboxes = []); + } + (this.n = e), + (this.extent = t), + (this.padding = r), + (this.scale = e / t), + (this.uid = 0); + var p = (r / e) * t; + (this.min = -p), (this.max = t + p); + }; + (Rn.prototype.insert = function (t, e, r, n, i) { + this._forEachCell( + e, + r, + n, + i, + this._insertCell, + this.uid++, + void 0, + void 0, + ), + this.keys.push(t), + this.bboxes.push(e), + this.bboxes.push(r), + this.bboxes.push(n), + this.bboxes.push(i); + }), + (Rn.prototype._insertReadonly = function () { + throw new Error( + 'Cannot insert into a GridIndex created from an ArrayBuffer.', + ); + }), + (Rn.prototype._insertCell = function (t, e, r, n, i, a) { + this.cells[i].push(a); + }), + (Rn.prototype.query = function (t, e, r, n, i) { + var a = this.min, + o = this.max; + if (t <= a && e <= a && o <= r && o <= n && !i) + return Array.prototype.slice.call(this.keys); + var s = []; + return this._forEachCell(t, e, r, n, this._queryCell, s, {}, i), s; + }), + (Rn.prototype._queryCell = function (t, e, r, n, i, a, o, s) { + var u = this.cells[i]; + if (null !== u) + for (var l = this.keys, p = this.bboxes, c = 0; c < u.length; c++) { + var h = u[c]; + if (void 0 === o[h]) { + var f = 4 * h; + ( + s + ? s(p[f + 0], p[f + 1], p[f + 2], p[f + 3]) + : t <= p[f + 2] && + e <= p[f + 3] && + r >= p[f + 0] && + n >= p[f + 1] + ) + ? ((o[h] = !0), a.push(l[h])) + : (o[h] = !1); + } + } + }), + (Rn.prototype._forEachCell = function (t, e, r, n, i, a, o, s) { + for ( + var u = this._convertToCellCoord(t), + l = this._convertToCellCoord(e), + p = this._convertToCellCoord(r), + c = this._convertToCellCoord(n), + h = u; + h <= p; + h++ + ) + for (var f = l; f <= c; f++) { + var y = this.d * f + h; + if ( + (!s || + s( + this._convertFromCellCoord(h), + this._convertFromCellCoord(f), + this._convertFromCellCoord(h + 1), + this._convertFromCellCoord(f + 1), + )) && + i.call(this, t, e, r, n, y, a, o, s) + ) + return; + } + }), + (Rn.prototype._convertFromCellCoord = function (t) { + return (t - this.padding) / this.scale; + }), + (Rn.prototype._convertToCellCoord = function (t) { + return Math.max( + 0, + Math.min(this.d - 1, Math.floor(t * this.scale) + this.padding), + ); + }), + (Rn.prototype.toArrayBuffer = function () { + if (this.arrayBuffer) return this.arrayBuffer; + for ( + var t = this.cells, e = 3 + this.cells.length + 1 + 1, r = 0, n = 0; + n < this.cells.length; + n++ + ) + r += this.cells[n].length; + var i = new Int32Array(e + r + this.keys.length + this.bboxes.length); + (i[0] = this.extent), (i[1] = this.n), (i[2] = this.padding); + for (var a = e, o = 0; o < t.length; o++) { + var s = t[o]; + (i[3 + o] = a), i.set(s, a), (a += s.length); + } + return ( + (i[3 + t.length] = a), + i.set(this.keys, a), + (i[3 + t.length + 1] = a += this.keys.length), + i.set(this.bboxes, a), + (a += this.bboxes.length), + i.buffer + ); + }), + (Rn.serialize = function (t, e) { + var r = t.toArrayBuffer(); + return e && e.push(r), { buffer: r }; + }), + (Rn.deserialize = function (t) { + return new Rn(t.buffer); + }); + var Un = {}; + function qn(t, e, r) { + if ((void 0 === r && (r = {}), Un[t])) + throw new Error(t + ' is already registered.'); + Object.defineProperty(e, '_classRegistryKey', { + value: t, + writeable: !1, + }), + (Un[t] = { klass: e, omit: r.omit || [], shallow: r.shallow || [] }); + } + for (var Nn in (qn('Object', Object), + qn('TransferableGridIndex', Rn), + qn('Color', Yt), + qn('Error', Error), + qn('AJAXError', it), + qn('ResolvedImage', te), + qn('StylePropertyFunction', Qr), + qn('StyleExpression', Jr, { omit: ['_evaluator'] }), + qn('ZoomDependentExpression', Wr), + qn('ZoomConstantExpression', Hr), + qn('CompoundExpression', fe, { omit: ['_evaluate'] }), + zr)) + zr[Nn]._classRegistryKey || qn('Expression_' + Nn, zr[Nn]); + function Zn(t) { + return ( + t && + 'undefined' != typeof ArrayBuffer && + (t instanceof ArrayBuffer || + (t.constructor && 'ArrayBuffer' === t.constructor.name)) + ); + } + function Kn(t, e) { + if ( + null == t || + 'boolean' == typeof t || + 'number' == typeof t || + 'string' == typeof t || + t instanceof Boolean || + t instanceof Number || + t instanceof String || + t instanceof Date || + t instanceof RegExp || + t instanceof Blob + ) + return t; + if (Zn(t)) return e && e.push(t), t; + if (_(t)) return e && e.push(t), t; + if (ArrayBuffer.isView(t)) { + var r = t; + return e && e.push(r.buffer), r; + } + if (t instanceof ImageData) return e && e.push(t.data.buffer), t; + if (Array.isArray(t)) { + for (var n = [], i = 0, a = t; i < a.length; i += 1) + n.push(Kn(a[i], e)); + return n; + } + if ('object' == typeof t) { + var o = t.constructor, + s = o._classRegistryKey; + if (!s) throw new Error("can't serialize object of unregistered class"); + if (!Un[s]) throw new Error(s + ' is not registered.'); + var u = o.serialize ? o.serialize(t, e) : {}; + if (o.serialize) { + if (e && u === e[e.length - 1]) + throw new Error( + "statically serialized object won't survive transfer of $name property", + ); + } else { + for (var l in t) + if (t.hasOwnProperty(l) && !(Un[s].omit.indexOf(l) >= 0)) { + var p = t[l]; + u[l] = Un[s].shallow.indexOf(l) >= 0 ? p : Kn(p, e); + } + t instanceof Error && (u.message = t.message); + } + if (u.$name) + throw new Error( + '$name property is reserved for worker serialization logic.', + ); + return 'Object' !== s && (u.$name = s), u; + } + throw new Error("can't serialize object of type " + typeof t); + } + function Gn(t) { + if ( + null == t || + 'boolean' == typeof t || + 'number' == typeof t || + 'string' == typeof t || + t instanceof Boolean || + t instanceof Number || + t instanceof String || + t instanceof Date || + t instanceof RegExp || + t instanceof Blob || + Zn(t) || + _(t) || + ArrayBuffer.isView(t) || + t instanceof ImageData + ) + return t; + if (Array.isArray(t)) return t.map(Gn); + if ('object' == typeof t) { + var e = t.$name || 'Object'; + if (!Un[e]) + throw new Error("can't deserialize unregistered class " + e); + var r = Un[e].klass; + if (!r) throw new Error("can't deserialize unregistered class " + e); + if (r.deserialize) return r.deserialize(t); + for ( + var n = Object.create(r.prototype), i = 0, a = Object.keys(t); + i < a.length; + i += 1 + ) { + var o = a[i]; + if ('$name' !== o) { + var s = t[o]; + n[o] = Un[e].shallow.indexOf(o) >= 0 ? s : Gn(s); + } + } + return n; + } + throw new Error("can't deserialize object of type " + typeof t); + } + var Jn = function () { + this.first = !0; + }; + Jn.prototype.update = function (t, e) { + var r = Math.floor(t); + return this.first + ? ((this.first = !1), + (this.lastIntegerZoom = r), + (this.lastIntegerZoomTime = 0), + (this.lastZoom = t), + (this.lastFloorZoom = r), + !0) + : (this.lastFloorZoom > r + ? ((this.lastIntegerZoom = r + 1), (this.lastIntegerZoomTime = e)) + : this.lastFloorZoom < r && + ((this.lastIntegerZoom = r), (this.lastIntegerZoomTime = e)), + t !== this.lastZoom && + ((this.lastZoom = t), (this.lastFloorZoom = r), !0)); + }; + var Xn = { + 'Latin-1 Supplement': function (t) { + return t >= 128 && t <= 255; + }, + Arabic: function (t) { + return t >= 1536 && t <= 1791; + }, + 'Arabic Supplement': function (t) { + return t >= 1872 && t <= 1919; + }, + 'Arabic Extended-A': function (t) { + return t >= 2208 && t <= 2303; + }, + 'Hangul Jamo': function (t) { + return t >= 4352 && t <= 4607; + }, + 'Unified Canadian Aboriginal Syllabics': function (t) { + return t >= 5120 && t <= 5759; + }, + Khmer: function (t) { + return t >= 6016 && t <= 6143; + }, + 'Unified Canadian Aboriginal Syllabics Extended': function (t) { + return t >= 6320 && t <= 6399; + }, + 'General Punctuation': function (t) { + return t >= 8192 && t <= 8303; + }, + 'Letterlike Symbols': function (t) { + return t >= 8448 && t <= 8527; + }, + 'Number Forms': function (t) { + return t >= 8528 && t <= 8591; + }, + 'Miscellaneous Technical': function (t) { + return t >= 8960 && t <= 9215; + }, + 'Control Pictures': function (t) { + return t >= 9216 && t <= 9279; + }, + 'Optical Character Recognition': function (t) { + return t >= 9280 && t <= 9311; + }, + 'Enclosed Alphanumerics': function (t) { + return t >= 9312 && t <= 9471; + }, + 'Geometric Shapes': function (t) { + return t >= 9632 && t <= 9727; + }, + 'Miscellaneous Symbols': function (t) { + return t >= 9728 && t <= 9983; + }, + 'Miscellaneous Symbols and Arrows': function (t) { + return t >= 11008 && t <= 11263; + }, + 'CJK Radicals Supplement': function (t) { + return t >= 11904 && t <= 12031; + }, + 'Kangxi Radicals': function (t) { + return t >= 12032 && t <= 12255; + }, + 'Ideographic Description Characters': function (t) { + return t >= 12272 && t <= 12287; + }, + 'CJK Symbols and Punctuation': function (t) { + return t >= 12288 && t <= 12351; + }, + Hiragana: function (t) { + return t >= 12352 && t <= 12447; + }, + Katakana: function (t) { + return t >= 12448 && t <= 12543; + }, + Bopomofo: function (t) { + return t >= 12544 && t <= 12591; + }, + 'Hangul Compatibility Jamo': function (t) { + return t >= 12592 && t <= 12687; + }, + Kanbun: function (t) { + return t >= 12688 && t <= 12703; + }, + 'Bopomofo Extended': function (t) { + return t >= 12704 && t <= 12735; + }, + 'CJK Strokes': function (t) { + return t >= 12736 && t <= 12783; + }, + 'Katakana Phonetic Extensions': function (t) { + return t >= 12784 && t <= 12799; + }, + 'Enclosed CJK Letters and Months': function (t) { + return t >= 12800 && t <= 13055; + }, + 'CJK Compatibility': function (t) { + return t >= 13056 && t <= 13311; + }, + 'CJK Unified Ideographs Extension A': function (t) { + return t >= 13312 && t <= 19903; + }, + 'Yijing Hexagram Symbols': function (t) { + return t >= 19904 && t <= 19967; + }, + 'CJK Unified Ideographs': function (t) { + return t >= 19968 && t <= 40959; + }, + 'Yi Syllables': function (t) { + return t >= 40960 && t <= 42127; + }, + 'Yi Radicals': function (t) { + return t >= 42128 && t <= 42191; + }, + 'Hangul Jamo Extended-A': function (t) { + return t >= 43360 && t <= 43391; + }, + 'Hangul Syllables': function (t) { + return t >= 44032 && t <= 55215; + }, + 'Hangul Jamo Extended-B': function (t) { + return t >= 55216 && t <= 55295; + }, + 'Private Use Area': function (t) { + return t >= 57344 && t <= 63743; + }, + 'CJK Compatibility Ideographs': function (t) { + return t >= 63744 && t <= 64255; + }, + 'Arabic Presentation Forms-A': function (t) { + return t >= 64336 && t <= 65023; + }, + 'Vertical Forms': function (t) { + return t >= 65040 && t <= 65055; + }, + 'CJK Compatibility Forms': function (t) { + return t >= 65072 && t <= 65103; + }, + 'Small Form Variants': function (t) { + return t >= 65104 && t <= 65135; + }, + 'Arabic Presentation Forms-B': function (t) { + return t >= 65136 && t <= 65279; + }, + 'Halfwidth and Fullwidth Forms': function (t) { + return t >= 65280 && t <= 65519; + }, + }; + function Yn(t) { + for (var e = 0, r = t; e < r.length; e += 1) + if (Hn(r[e].charCodeAt(0))) return !0; + return !1; + } + function Hn(t) { + return !( + 746 !== t && + 747 !== t && + (t < 4352 || + !( + Xn['Bopomofo Extended'](t) || + Xn.Bopomofo(t) || + (Xn['CJK Compatibility Forms'](t) && !(t >= 65097 && t <= 65103)) || + Xn['CJK Compatibility Ideographs'](t) || + Xn['CJK Compatibility'](t) || + Xn['CJK Radicals Supplement'](t) || + Xn['CJK Strokes'](t) || + !( + !Xn['CJK Symbols and Punctuation'](t) || + (t >= 12296 && t <= 12305) || + (t >= 12308 && t <= 12319) || + 12336 === t + ) || + Xn['CJK Unified Ideographs Extension A'](t) || + Xn['CJK Unified Ideographs'](t) || + Xn['Enclosed CJK Letters and Months'](t) || + Xn['Hangul Compatibility Jamo'](t) || + Xn['Hangul Jamo Extended-A'](t) || + Xn['Hangul Jamo Extended-B'](t) || + Xn['Hangul Jamo'](t) || + Xn['Hangul Syllables'](t) || + Xn.Hiragana(t) || + Xn['Ideographic Description Characters'](t) || + Xn.Kanbun(t) || + Xn['Kangxi Radicals'](t) || + Xn['Katakana Phonetic Extensions'](t) || + (Xn.Katakana(t) && 12540 !== t) || + !( + !Xn['Halfwidth and Fullwidth Forms'](t) || + 65288 === t || + 65289 === t || + 65293 === t || + (t >= 65306 && t <= 65310) || + 65339 === t || + 65341 === t || + 65343 === t || + (t >= 65371 && t <= 65503) || + 65507 === t || + (t >= 65512 && t <= 65519) + ) || + !( + !Xn['Small Form Variants'](t) || + (t >= 65112 && t <= 65118) || + (t >= 65123 && t <= 65126) + ) || + Xn['Unified Canadian Aboriginal Syllabics'](t) || + Xn['Unified Canadian Aboriginal Syllabics Extended'](t) || + Xn['Vertical Forms'](t) || + Xn['Yijing Hexagram Symbols'](t) || + Xn['Yi Syllables'](t) || + Xn['Yi Radicals'](t) + )) + ); + } + function Wn(t) { + return !( + Hn(t) || + (function (t) { + return !!( + (Xn['Latin-1 Supplement'](t) && + (167 === t || + 169 === t || + 174 === t || + 177 === t || + 188 === t || + 189 === t || + 190 === t || + 215 === t || + 247 === t)) || + (Xn['General Punctuation'](t) && + (8214 === t || + 8224 === t || + 8225 === t || + 8240 === t || + 8241 === t || + 8251 === t || + 8252 === t || + 8258 === t || + 8263 === t || + 8264 === t || + 8265 === t || + 8273 === t)) || + Xn['Letterlike Symbols'](t) || + Xn['Number Forms'](t) || + (Xn['Miscellaneous Technical'](t) && + ((t >= 8960 && t <= 8967) || + (t >= 8972 && t <= 8991) || + (t >= 8996 && t <= 9e3) || + 9003 === t || + (t >= 9085 && t <= 9114) || + (t >= 9150 && t <= 9165) || + 9167 === t || + (t >= 9169 && t <= 9179) || + (t >= 9186 && t <= 9215))) || + (Xn['Control Pictures'](t) && 9251 !== t) || + Xn['Optical Character Recognition'](t) || + Xn['Enclosed Alphanumerics'](t) || + Xn['Geometric Shapes'](t) || + (Xn['Miscellaneous Symbols'](t) && !(t >= 9754 && t <= 9759)) || + (Xn['Miscellaneous Symbols and Arrows'](t) && + ((t >= 11026 && t <= 11055) || + (t >= 11088 && t <= 11097) || + (t >= 11192 && t <= 11243))) || + Xn['CJK Symbols and Punctuation'](t) || + Xn.Katakana(t) || + Xn['Private Use Area'](t) || + Xn['CJK Compatibility Forms'](t) || + Xn['Small Form Variants'](t) || + Xn['Halfwidth and Fullwidth Forms'](t) || + 8734 === t || + 8756 === t || + 8757 === t || + (t >= 9984 && t <= 10087) || + (t >= 10102 && t <= 10131) || + 65532 === t || + 65533 === t + ); + })(t) + ); + } + function $n(t) { + return ( + (t >= 1424 && t <= 2303) || + Xn['Arabic Presentation Forms-A'](t) || + Xn['Arabic Presentation Forms-B'](t) + ); + } + function Qn(t, e) { + return !( + (!e && $n(t)) || + (t >= 2304 && t <= 3583) || + (t >= 3840 && t <= 4255) || + Xn.Khmer(t) + ); + } + function ti(t) { + for (var e = 0, r = t; e < r.length; e += 1) + if ($n(r[e].charCodeAt(0))) return !0; + return !1; + } + var ei = 'deferred', + ri = 'loading', + ni = 'loaded', + ii = null, + ai = 'unavailable', + oi = null, + si = function (t) { + t && + 'string' == typeof t && + t.indexOf('NetworkError') > -1 && + (ai = 'error'), + ii && ii(t); + }; + function ui() { + li.fire(new dt('pluginStateChange', { pluginStatus: ai, pluginURL: oi })); + } + var li = new vt(), + pi = function () { + return ai; + }, + ci = function () { + if (ai !== ei || !oi) + throw new Error( + 'rtl-text-plugin cannot be downloaded unless a pluginURL is specified', + ); + (ai = ri), + ui(), + oi && + pt({ url: oi }, function (t) { + t ? si(t) : ((ai = ni), ui()); + }); + }, + hi = { + applyArabicShaping: null, + processBidirectionalText: null, + processStyledBidirectionalText: null, + isLoaded: function () { + return ai === ni || null != hi.applyArabicShaping; + }, + isLoading: function () { + return ai === ri; + }, + setState: function (t) { + if (!g()) + throw new Error( + 'Cannot set the state of the rtl-text-plugin when not in the web-worker context', + ); + (ai = t.pluginStatus), (oi = t.pluginURL); + }, + isParsed: function () { + if (!g()) + throw new Error( + 'rtl-text-plugin is only parsed on the worker-threads', + ); + return ( + null != hi.applyArabicShaping && + null != hi.processBidirectionalText && + null != hi.processStyledBidirectionalText + ); + }, + getPluginURL: function () { + if (!g()) + throw new Error( + 'rtl-text-plugin url can only be queried from the worker threads', + ); + return oi; + }, + }, + fi = function (t, e) { + (this.zoom = t), + e + ? ((this.now = e.now), + (this.fadeDuration = e.fadeDuration), + (this.zoomHistory = e.zoomHistory), + (this.transition = e.transition)) + : ((this.now = 0), + (this.fadeDuration = 0), + (this.zoomHistory = new Jn()), + (this.transition = {})); + }; + (fi.prototype.isSupportedScript = function (t) { + return (function (t, e) { + for (var r = 0, n = t; r < n.length; r += 1) + if (!Qn(n[r].charCodeAt(0), e)) return !1; + return !0; + })(t, hi.isLoaded()); + }), + (fi.prototype.crossFadingFactor = function () { + return 0 === this.fadeDuration + ? 1 + : Math.min( + (this.now - this.zoomHistory.lastIntegerZoomTime) / + this.fadeDuration, + 1, + ); + }), + (fi.prototype.getCrossfadeParameters = function () { + var t = this.zoom, + e = t - Math.floor(t), + r = this.crossFadingFactor(); + return t > this.zoomHistory.lastIntegerZoom + ? { fromScale: 2, toScale: 1, t: e + (1 - e) * r } + : { fromScale: 0.5, toScale: 1, t: 1 - (1 - r) * e }; + }); + var yi = function (t, e) { + (this.property = t), + (this.value = e), + (this.expression = (function (t, e) { + if (jr(t)) return new Qr(t, e); + if (Xr(t)) { + var r = $r(t, e); + if ('error' === r.result) + throw new Error( + r.value + .map(function (t) { + return t.key + ': ' + t.message; + }) + .join(', '), + ); + return r.value; + } + var n = t; + return ( + 'color' === e.type && 'string' == typeof t + ? (n = Yt.parse(t)) + : 'padding' !== e.type || + ('number' != typeof t && !Array.isArray(t)) || + (n = Qt.parse(t)), + { + kind: 'constant', + evaluate: function () { + return n; + }, + } + ); + })(void 0 === e ? t.specification.default : e, t.specification)); + }; + (yi.prototype.isDataDriven = function () { + return ( + 'source' === this.expression.kind || + 'composite' === this.expression.kind + ); + }), + (yi.prototype.possiblyEvaluate = function (t, e, r) { + return this.property.possiblyEvaluate(this, t, e, r); + }); + var di = function (t) { + (this.property = t), (this.value = new yi(t, void 0)); + }; + (di.prototype.transitioned = function (t, e) { + return new vi( + this.property, + this.value, + e, + s({}, t.transition, this.transition), + t.now, + ); + }), + (di.prototype.untransitioned = function () { + return new vi(this.property, this.value, null, {}, 0); + }); + var mi = function (t) { + (this._properties = t), + (this._values = Object.create(t.defaultTransitionablePropertyValues)); + }; + (mi.prototype.getValue = function (t) { + return f(this._values[t].value.value); + }), + (mi.prototype.setValue = function (t, e) { + Object.prototype.hasOwnProperty.call(this._values, t) || + (this._values[t] = new di(this._values[t].property)), + (this._values[t].value = new yi( + this._values[t].property, + null === e ? void 0 : f(e), + )); + }), + (mi.prototype.getTransition = function (t) { + return f(this._values[t].transition); + }), + (mi.prototype.setTransition = function (t, e) { + Object.prototype.hasOwnProperty.call(this._values, t) || + (this._values[t] = new di(this._values[t].property)), + (this._values[t].transition = f(e) || void 0); + }), + (mi.prototype.serialize = function () { + for ( + var t = {}, e = 0, r = Object.keys(this._values); + e < r.length; + e += 1 + ) { + var n = r[e], + i = this.getValue(n); + void 0 !== i && (t[n] = i); + var a = this.getTransition(n); + void 0 !== a && (t[n + '-transition'] = a); + } + return t; + }), + (mi.prototype.transitioned = function (t, e) { + for ( + var r = new gi(this._properties), + n = 0, + i = Object.keys(this._values); + n < i.length; + n += 1 + ) { + var a = i[n]; + r._values[a] = this._values[a].transitioned(t, e._values[a]); + } + return r; + }), + (mi.prototype.untransitioned = function () { + for ( + var t = new gi(this._properties), + e = 0, + r = Object.keys(this._values); + e < r.length; + e += 1 + ) { + var n = r[e]; + t._values[n] = this._values[n].untransitioned(); + } + return t; + }); + var vi = function (t, e, r, n, i) { + (this.property = t), + (this.value = e), + (this.begin = i + n.delay || 0), + (this.end = this.begin + n.duration || 0), + t.specification.transition && + (n.delay || n.duration) && + (this.prior = r); + }; + vi.prototype.possiblyEvaluate = function (t, e, r) { + var n = t.now || 0, + i = this.value.possiblyEvaluate(t, e, r), + a = this.prior; + if (a) { + if (n > this.end) return (this.prior = null), i; + if (this.value.isDataDriven()) return (this.prior = null), i; + if (n < this.begin) return a.possiblyEvaluate(t, e, r); + var o = (n - this.begin) / (this.end - this.begin); + return this.property.interpolate( + a.possiblyEvaluate(t, e, r), + i, + (function (t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + var e = t * t, + r = e * t; + return 4 * (t < 0.5 ? r : 3 * (t - e) + r - 0.75); + })(o), + ); + } + return i; + }; + var gi = function (t) { + (this._properties = t), + (this._values = Object.create(t.defaultTransitioningPropertyValues)); + }; + (gi.prototype.possiblyEvaluate = function (t, e, r) { + for ( + var n = new wi(this._properties), i = 0, a = Object.keys(this._values); + i < a.length; + i += 1 + ) { + var o = a[i]; + n._values[o] = this._values[o].possiblyEvaluate(t, e, r); + } + return n; + }), + (gi.prototype.hasTransition = function () { + for (var t = 0, e = Object.keys(this._values); t < e.length; t += 1) + if (this._values[e[t]].prior) return !0; + return !1; + }); + var xi = function (t) { + (this._properties = t), + (this._values = Object.create(t.defaultPropertyValues)); + }; + (xi.prototype.getValue = function (t) { + return f(this._values[t].value); + }), + (xi.prototype.setValue = function (t, e) { + this._values[t] = new yi( + this._values[t].property, + null === e ? void 0 : f(e), + ); + }), + (xi.prototype.serialize = function () { + for ( + var t = {}, e = 0, r = Object.keys(this._values); + e < r.length; + e += 1 + ) { + var n = r[e], + i = this.getValue(n); + void 0 !== i && (t[n] = i); + } + return t; + }), + (xi.prototype.possiblyEvaluate = function (t, e, r) { + for ( + var n = new wi(this._properties), + i = 0, + a = Object.keys(this._values); + i < a.length; + i += 1 + ) { + var o = a[i]; + n._values[o] = this._values[o].possiblyEvaluate(t, e, r); + } + return n; + }); + var bi = function (t, e, r) { + (this.property = t), (this.value = e), (this.parameters = r); + }; + (bi.prototype.isConstant = function () { + return 'constant' === this.value.kind; + }), + (bi.prototype.constantOr = function (t) { + return 'constant' === this.value.kind ? this.value.value : t; + }), + (bi.prototype.evaluate = function (t, e, r, n) { + return this.property.evaluate(this.value, this.parameters, t, e, r, n); + }); + var wi = function (t) { + (this._properties = t), + (this._values = Object.create(t.defaultPossiblyEvaluatedValues)); + }; + wi.prototype.get = function (t) { + return this._values[t]; + }; + var _i = function (t) { + this.specification = t; + }; + (_i.prototype.possiblyEvaluate = function (t, e) { + if (t.isDataDriven()) throw new Error('Value should not be data driven'); + return t.expression.evaluate(e); + }), + (_i.prototype.interpolate = function (t, e, r) { + var n = Ue[this.specification.type]; + return n ? n(t, e, r) : t; + }); + var Ai = function (t, e) { + (this.specification = t), (this.overrides = e); + }; + (Ai.prototype.possiblyEvaluate = function (t, e, r, n) { + return new bi( + this, + 'constant' === t.expression.kind || 'camera' === t.expression.kind + ? { + kind: 'constant', + value: t.expression.evaluate(e, null, {}, r, n), + } + : t.expression, + e, + ); + }), + (Ai.prototype.interpolate = function (t, e, r) { + if ('constant' !== t.value.kind || 'constant' !== e.value.kind) + return t; + if (void 0 === t.value.value || void 0 === e.value.value) + return new bi( + this, + { kind: 'constant', value: void 0 }, + t.parameters, + ); + var n = Ue[this.specification.type]; + return n + ? new bi( + this, + { kind: 'constant', value: n(t.value.value, e.value.value, r) }, + t.parameters, + ) + : t; + }), + (Ai.prototype.evaluate = function (t, e, r, n, i, a) { + return 'constant' === t.kind ? t.value : t.evaluate(e, r, n, i, a); + }); + var ki = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.possiblyEvaluate = function (t, e, r, n) { + if (void 0 === t.value) + return new bi(this, { kind: 'constant', value: void 0 }, e); + if ('constant' === t.expression.kind) { + var i = t.expression.evaluate(e, null, {}, r, n), + a = + 'resolvedImage' === t.property.specification.type && + 'string' != typeof i + ? i.name + : i, + o = this._calculate(a, a, a, e); + return new bi(this, { kind: 'constant', value: o }, e); + } + if ('camera' === t.expression.kind) { + var s = this._calculate( + t.expression.evaluate({ zoom: e.zoom - 1 }), + t.expression.evaluate({ zoom: e.zoom }), + t.expression.evaluate({ zoom: e.zoom + 1 }), + e, + ); + return new bi(this, { kind: 'constant', value: s }, e); + } + return new bi(this, t.expression, e); + }), + (e.prototype.evaluate = function (t, e, r, n, i, a) { + if ('source' === t.kind) { + var o = t.evaluate(e, r, n, i, a); + return this._calculate(o, o, o, e); + } + return 'composite' === t.kind + ? this._calculate( + t.evaluate({ zoom: Math.floor(e.zoom) - 1 }, r, n), + t.evaluate({ zoom: Math.floor(e.zoom) }, r, n), + t.evaluate({ zoom: Math.floor(e.zoom) + 1 }, r, n), + e, + ) + : t.value; + }), + (e.prototype._calculate = function (t, e, r, n) { + return n.zoom > n.zoomHistory.lastIntegerZoom + ? { from: t, to: e } + : { from: r, to: e }; + }), + (e.prototype.interpolate = function (t) { + return t; + }), + e + ); + })(Ai), + Si = function (t) { + this.specification = t; + }; + (Si.prototype.possiblyEvaluate = function (t, e, r, n) { + if (void 0 !== t.value) { + if ('constant' === t.expression.kind) { + var i = t.expression.evaluate(e, null, {}, r, n); + return this._calculate(i, i, i, e); + } + return this._calculate( + t.expression.evaluate(new fi(Math.floor(e.zoom - 1), e)), + t.expression.evaluate(new fi(Math.floor(e.zoom), e)), + t.expression.evaluate(new fi(Math.floor(e.zoom + 1), e)), + e, + ); + } + }), + (Si.prototype._calculate = function (t, e, r, n) { + return n.zoom > n.zoomHistory.lastIntegerZoom + ? { from: t, to: e } + : { from: r, to: e }; + }), + (Si.prototype.interpolate = function (t) { + return t; + }); + var Ii = function (t) { + this.specification = t; + }; + (Ii.prototype.possiblyEvaluate = function (t, e, r, n) { + return !!t.expression.evaluate(e, null, {}, r, n); + }), + (Ii.prototype.interpolate = function () { + return !1; + }); + var Mi = function (t) { + for (var e in ((this.properties = t), + (this.defaultPropertyValues = {}), + (this.defaultTransitionablePropertyValues = {}), + (this.defaultTransitioningPropertyValues = {}), + (this.defaultPossiblyEvaluatedValues = {}), + (this.overridableProperties = []), + t)) { + var r = t[e]; + r.specification.overridable && this.overridableProperties.push(e); + var n = (this.defaultPropertyValues[e] = new yi(r, void 0)), + i = (this.defaultTransitionablePropertyValues[e] = new di(r)); + (this.defaultTransitioningPropertyValues[e] = i.untransitioned()), + (this.defaultPossiblyEvaluatedValues[e] = n.possiblyEvaluate({})); + } + }; + qn('DataDrivenProperty', Ai), + qn('DataConstantProperty', _i), + qn('CrossFadedDataDrivenProperty', ki), + qn('CrossFadedProperty', Si), + qn('ColorRampProperty', Ii); + var zi = '-transition', + Pi = (function (t) { + function e(e, r) { + if ( + (t.call(this), + (this.id = e.id), + (this.type = e.type), + (this._featureFilter = { + filter: function () { + return !0; + }, + needGeometry: !1, + }), + 'custom' !== e.type && + ((this.metadata = e.metadata), + (this.minzoom = e.minzoom), + (this.maxzoom = e.maxzoom), + 'background' !== e.type && + ((this.source = e.source), + (this.sourceLayer = e['source-layer']), + (this.filter = e.filter)), + r.layout && (this._unevaluatedLayout = new xi(r.layout)), + r.paint)) + ) { + for (var n in ((this._transitionablePaint = new mi(r.paint)), + e.paint)) + this.setPaintProperty(n, e.paint[n], { validate: !1 }); + for (var i in e.layout) + this.setLayoutProperty(i, e.layout[i], { validate: !1 }); + (this._transitioningPaint = + this._transitionablePaint.untransitioned()), + (this.paint = new wi(r.paint)); + } + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getCrossfadeParameters = function () { + return this._crossfadeParameters; + }), + (e.prototype.getLayoutProperty = function (t) { + return 'visibility' === t + ? this.visibility + : this._unevaluatedLayout.getValue(t); + }), + (e.prototype.setLayoutProperty = function (t, e, r) { + void 0 === r && (r = {}), + (null != e && + this._validate( + Dn, + 'layers.' + this.id + '.layout.' + t, + t, + e, + r, + )) || + ('visibility' !== t + ? this._unevaluatedLayout.setValue(t, e) + : (this.visibility = e)); + }), + (e.prototype.getPaintProperty = function (t) { + return p(t, zi) + ? this._transitionablePaint.getTransition(t.slice(0, -zi.length)) + : this._transitionablePaint.getValue(t); + }), + (e.prototype.setPaintProperty = function (t, e, r) { + if ( + (void 0 === r && (r = {}), + null != e && + this._validate( + Ln, + 'layers.' + this.id + '.paint.' + t, + t, + e, + r, + )) + ) + return !1; + if (p(t, zi)) + return ( + this._transitionablePaint.setTransition( + t.slice(0, -zi.length), + e || void 0, + ), + !1 + ); + var n = this._transitionablePaint._values[t], + i = + 'cross-faded-data-driven' === + n.property.specification['property-type'], + a = n.value.isDataDriven(), + o = n.value; + this._transitionablePaint.setValue(t, e), + this._handleSpecialPaintPropertyUpdate(t); + var s = this._transitionablePaint._values[t].value; + return ( + s.isDataDriven() || + a || + i || + this._handleOverridablePaintPropertyUpdate(t, o, s) + ); + }), + (e.prototype._handleSpecialPaintPropertyUpdate = function (t) {}), + (e.prototype._handleOverridablePaintPropertyUpdate = function ( + t, + e, + r, + ) { + return !1; + }), + (e.prototype.isHidden = function (t) { + return ( + !!(this.minzoom && t < this.minzoom) || + !!(this.maxzoom && t >= this.maxzoom) || + 'none' === this.visibility + ); + }), + (e.prototype.updateTransitions = function (t) { + this._transitioningPaint = this._transitionablePaint.transitioned( + t, + this._transitioningPaint, + ); + }), + (e.prototype.hasTransition = function () { + return this._transitioningPaint.hasTransition(); + }), + (e.prototype.recalculate = function (t, e) { + t.getCrossfadeParameters && + (this._crossfadeParameters = t.getCrossfadeParameters()), + this._unevaluatedLayout && + (this.layout = this._unevaluatedLayout.possiblyEvaluate( + t, + void 0, + e, + )), + (this.paint = this._transitioningPaint.possiblyEvaluate( + t, + void 0, + e, + )); + }), + (e.prototype.serialize = function () { + var t = { + id: this.id, + type: this.type, + source: this.source, + 'source-layer': this.sourceLayer, + metadata: this.metadata, + minzoom: this.minzoom, + maxzoom: this.maxzoom, + filter: this.filter, + layout: + this._unevaluatedLayout && this._unevaluatedLayout.serialize(), + paint: + this._transitionablePaint && + this._transitionablePaint.serialize(), + }; + return ( + this.visibility && + ((t.layout = t.layout || {}), + (t.layout.visibility = this.visibility)), + h(t, function (t, e) { + return !( + void 0 === t || + ('layout' === e && !Object.keys(t).length) || + ('paint' === e && !Object.keys(t).length) + ); + }) + ); + }), + (e.prototype._validate = function (t, e, r, n, i) { + return ( + void 0 === i && (i = {}), + (!i || !1 !== i.validate) && + jn( + this, + t.call(Fn, { + key: e, + layerType: this.type, + objectKey: r, + value: n, + styleSpec: gt, + style: { glyphs: !0, sprite: !0 }, + }), + ) + ); + }), + (e.prototype.is3D = function () { + return !1; + }), + (e.prototype.isTileClipped = function () { + return !1; + }), + (e.prototype.hasOffscreenPass = function () { + return !1; + }), + (e.prototype.resize = function () {}), + (e.prototype.isStateDependent = function () { + for (var t in this.paint._values) { + var e = this.paint.get(t); + if ( + e instanceof bi && + Fr(e.property.specification) && + ('source' === e.value.kind || 'composite' === e.value.kind) && + e.value.isStateDependent + ) + return !0; + } + return !1; + }), + e + ); + })(vt), + Bi = { + Int8: Int8Array, + Uint8: Uint8Array, + Int16: Int16Array, + Uint16: Uint16Array, + Int32: Int32Array, + Uint32: Uint32Array, + Float32: Float32Array, + }, + Ci = function (t, e) { + (this._structArray = t), + (this._pos1 = e * this.size), + (this._pos2 = this._pos1 / 2), + (this._pos4 = this._pos1 / 4), + (this._pos8 = this._pos1 / 8); + }, + Ei = function () { + (this.isTransferred = !1), (this.capacity = -1), this.resize(0); + }; + function Vi(t, e) { + void 0 === e && (e = 1); + var r = 0, + n = 0; + return { + members: t.map(function (t) { + var i = Bi[t.type].BYTES_PER_ELEMENT, + a = (r = Ti(r, Math.max(e, i))), + o = t.components || 1; + return ( + (n = Math.max(n, i)), + (r += i * o), + { name: t.name, type: t.type, components: o, offset: a } + ); + }), + size: Ti(r, Math.max(n, e)), + alignment: e, + }; + } + function Ti(t, e) { + return Math.ceil(t / e) * e; + } + (Ei.serialize = function (t, e) { + return ( + t._trim(), + e && ((t.isTransferred = !0), e.push(t.arrayBuffer)), + { length: t.length, arrayBuffer: t.arrayBuffer } + ); + }), + (Ei.deserialize = function (t) { + var e = Object.create(this.prototype); + return ( + (e.arrayBuffer = t.arrayBuffer), + (e.length = t.length), + (e.capacity = t.arrayBuffer.byteLength / e.bytesPerElement), + e._refreshViews(), + e + ); + }), + (Ei.prototype._trim = function () { + this.length !== this.capacity && + ((this.capacity = this.length), + (this.arrayBuffer = this.arrayBuffer.slice( + 0, + this.length * this.bytesPerElement, + )), + this._refreshViews()); + }), + (Ei.prototype.clear = function () { + this.length = 0; + }), + (Ei.prototype.resize = function (t) { + this.reserve(t), (this.length = t); + }), + (Ei.prototype.reserve = function (t) { + if (t > this.capacity) { + (this.capacity = Math.max(t, Math.floor(5 * this.capacity), 128)), + (this.arrayBuffer = new ArrayBuffer( + this.capacity * this.bytesPerElement, + )); + var e = this.uint8; + this._refreshViews(), e && this.uint8.set(e); + } + }), + (Ei.prototype._refreshViews = function () { + throw new Error( + '_refreshViews() must be implemented by each concrete StructArray layout', + ); + }); + var Fi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e) { + var r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + }), + (e.prototype.emplace = function (t, e, r) { + var n = 2 * t; + return (this.int16[n + 0] = e), (this.int16[n + 1] = r), t; + }), + e + ); + })(Ei); + (Fi.prototype.bytesPerElement = 4), qn('StructArrayLayout2i4', Fi); + var Oi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n) { + var i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + }), + (e.prototype.emplace = function (t, e, r, n, i) { + var a = 4 * t; + return ( + (this.int16[a + 0] = e), + (this.int16[a + 1] = r), + (this.int16[a + 2] = n), + (this.int16[a + 3] = i), + t + ); + }), + e + ); + })(Ei); + (Oi.prototype.bytesPerElement = 8), qn('StructArrayLayout4i8', Oi); + var Li = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i, a) { + var o = this.length; + return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a); + }), + (e.prototype.emplace = function (t, e, r, n, i, a, o) { + var s = 6 * t; + return ( + (this.int16[s + 0] = e), + (this.int16[s + 1] = r), + (this.int16[s + 2] = n), + (this.int16[s + 3] = i), + (this.int16[s + 4] = a), + (this.int16[s + 5] = o), + t + ); + }), + e + ); + })(Ei); + (Li.prototype.bytesPerElement = 12), qn('StructArrayLayout2i4i12', Li); + var Di = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i, a) { + var o = this.length; + return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a); + }), + (e.prototype.emplace = function (t, e, r, n, i, a, o) { + var s = 4 * t, + u = 8 * t; + return ( + (this.int16[s + 0] = e), + (this.int16[s + 1] = r), + (this.uint8[u + 4] = n), + (this.uint8[u + 5] = i), + (this.uint8[u + 6] = a), + (this.uint8[u + 7] = o), + t + ); + }), + e + ); + })(Ei); + (Di.prototype.bytesPerElement = 8), qn('StructArrayLayout2i4ub8', Di); + var ji = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e) { + var r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + }), + (e.prototype.emplace = function (t, e, r) { + var n = 2 * t; + return (this.float32[n + 0] = e), (this.float32[n + 1] = r), t; + }), + e + ); + })(Ei); + (ji.prototype.bytesPerElement = 8), qn('StructArrayLayout2f8', ji); + var Ri = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u, l) { + var p = this.length; + return ( + this.resize(p + 1), this.emplace(p, t, e, r, n, i, a, o, s, u, l) + ); + }), + (e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l, p) { + var c = 10 * t; + return ( + (this.uint16[c + 0] = e), + (this.uint16[c + 1] = r), + (this.uint16[c + 2] = n), + (this.uint16[c + 3] = i), + (this.uint16[c + 4] = a), + (this.uint16[c + 5] = o), + (this.uint16[c + 6] = s), + (this.uint16[c + 7] = u), + (this.uint16[c + 8] = l), + (this.uint16[c + 9] = p), + t + ); + }), + e + ); + })(Ei); + (Ri.prototype.bytesPerElement = 20), qn('StructArrayLayout10ui20', Ri); + var Ui = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + ) { + var h = this.length; + return ( + this.resize(h + 1), + this.emplace(h, t, e, r, n, i, a, o, s, u, l, p, c) + ); + }), + (e.prototype.emplace = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + ) { + var f = 12 * t; + return ( + (this.int16[f + 0] = e), + (this.int16[f + 1] = r), + (this.int16[f + 2] = n), + (this.int16[f + 3] = i), + (this.uint16[f + 4] = a), + (this.uint16[f + 5] = o), + (this.uint16[f + 6] = s), + (this.uint16[f + 7] = u), + (this.int16[f + 8] = l), + (this.int16[f + 9] = p), + (this.int16[f + 10] = c), + (this.int16[f + 11] = h), + t + ); + }), + e + ); + })(Ei); + (Ui.prototype.bytesPerElement = 24), qn('StructArrayLayout4i4ui4i24', Ui); + var qi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r) { + var n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + }), + (e.prototype.emplace = function (t, e, r, n) { + var i = 3 * t; + return ( + (this.float32[i + 0] = e), + (this.float32[i + 1] = r), + (this.float32[i + 2] = n), + t + ); + }), + e + ); + })(Ei); + (qi.prototype.bytesPerElement = 12), qn('StructArrayLayout3f12', qi); + var Ni = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t) { + var e = this.length; + return this.resize(e + 1), this.emplace(e, t); + }), + (e.prototype.emplace = function (t, e) { + return (this.uint32[1 * t + 0] = e), t; + }), + e + ); + })(Ei); + (Ni.prototype.bytesPerElement = 4), qn('StructArrayLayout1ul4', Ni); + var Zi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u) { + var l = this.length; + return this.resize(l + 1), this.emplace(l, t, e, r, n, i, a, o, s, u); + }), + (e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l) { + var p = 10 * t, + c = 5 * t; + return ( + (this.int16[p + 0] = e), + (this.int16[p + 1] = r), + (this.int16[p + 2] = n), + (this.int16[p + 3] = i), + (this.int16[p + 4] = a), + (this.int16[p + 5] = o), + (this.uint32[c + 3] = s), + (this.uint16[p + 8] = u), + (this.uint16[p + 9] = l), + t + ); + }), + e + ); + })(Ei); + (Zi.prototype.bytesPerElement = 20), qn('StructArrayLayout6i1ul2ui20', Zi); + var Ki = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i, a) { + var o = this.length; + return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a); + }), + (e.prototype.emplace = function (t, e, r, n, i, a, o) { + var s = 6 * t; + return ( + (this.int16[s + 0] = e), + (this.int16[s + 1] = r), + (this.int16[s + 2] = n), + (this.int16[s + 3] = i), + (this.int16[s + 4] = a), + (this.int16[s + 5] = o), + t + ); + }), + e + ); + })(Ei); + (Ki.prototype.bytesPerElement = 12), qn('StructArrayLayout2i2i2i12', Ki); + var Gi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n, i) { + var a = this.length; + return this.resize(a + 1), this.emplace(a, t, e, r, n, i); + }), + (e.prototype.emplace = function (t, e, r, n, i, a) { + var o = 4 * t, + s = 8 * t; + return ( + (this.float32[o + 0] = e), + (this.float32[o + 1] = r), + (this.float32[o + 2] = n), + (this.int16[s + 6] = i), + (this.int16[s + 7] = a), + t + ); + }), + e + ); + })(Ei); + (Gi.prototype.bytesPerElement = 16), qn('StructArrayLayout2f1f2i16', Gi); + var Ji = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n) { + var i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + }), + (e.prototype.emplace = function (t, e, r, n, i) { + var a = 12 * t, + o = 3 * t; + return ( + (this.uint8[a + 0] = e), + (this.uint8[a + 1] = r), + (this.float32[o + 1] = n), + (this.float32[o + 2] = i), + t + ); + }), + e + ); + })(Ei); + (Ji.prototype.bytesPerElement = 12), qn('StructArrayLayout2ub2f12', Ji); + var Xi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r) { + var n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + }), + (e.prototype.emplace = function (t, e, r, n) { + var i = 3 * t; + return ( + (this.uint16[i + 0] = e), + (this.uint16[i + 1] = r), + (this.uint16[i + 2] = n), + t + ); + }), + e + ); + })(Ei); + (Xi.prototype.bytesPerElement = 6), qn('StructArrayLayout3ui6', Xi); + var Yi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d, + m, + ) { + var v = this.length; + return ( + this.resize(v + 1), + this.emplace(v, t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m) + ); + }), + (e.prototype.emplace = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d, + m, + v, + ) { + var g = 24 * t, + x = 12 * t, + b = 48 * t; + return ( + (this.int16[g + 0] = e), + (this.int16[g + 1] = r), + (this.uint16[g + 2] = n), + (this.uint16[g + 3] = i), + (this.uint32[x + 2] = a), + (this.uint32[x + 3] = o), + (this.uint32[x + 4] = s), + (this.uint16[g + 10] = u), + (this.uint16[g + 11] = l), + (this.uint16[g + 12] = p), + (this.float32[x + 7] = c), + (this.float32[x + 8] = h), + (this.uint8[b + 36] = f), + (this.uint8[b + 37] = y), + (this.uint8[b + 38] = d), + (this.uint32[x + 10] = m), + (this.int16[g + 22] = v), + t + ); + }), + e + ); + })(Ei); + (Yi.prototype.bytesPerElement = 48), + qn('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', Yi); + var Hi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d, + m, + v, + g, + x, + b, + w, + _, + A, + k, + S, + I, + M, + ) { + var z = this.length; + return ( + this.resize(z + 1), + this.emplace( + z, + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d, + m, + v, + g, + x, + b, + w, + _, + A, + k, + S, + I, + M, + ) + ); + }), + (e.prototype.emplace = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d, + m, + v, + g, + x, + b, + w, + _, + A, + k, + S, + I, + M, + z, + ) { + var P = 34 * t, + B = 17 * t; + return ( + (this.int16[P + 0] = e), + (this.int16[P + 1] = r), + (this.int16[P + 2] = n), + (this.int16[P + 3] = i), + (this.int16[P + 4] = a), + (this.int16[P + 5] = o), + (this.int16[P + 6] = s), + (this.int16[P + 7] = u), + (this.uint16[P + 8] = l), + (this.uint16[P + 9] = p), + (this.uint16[P + 10] = c), + (this.uint16[P + 11] = h), + (this.uint16[P + 12] = f), + (this.uint16[P + 13] = y), + (this.uint16[P + 14] = d), + (this.uint16[P + 15] = m), + (this.uint16[P + 16] = v), + (this.uint16[P + 17] = g), + (this.uint16[P + 18] = x), + (this.uint16[P + 19] = b), + (this.uint16[P + 20] = w), + (this.uint16[P + 21] = _), + (this.uint16[P + 22] = A), + (this.uint32[B + 12] = k), + (this.float32[B + 13] = S), + (this.float32[B + 14] = I), + (this.float32[B + 15] = M), + (this.float32[B + 16] = z), + t + ); + }), + e + ); + })(Ei); + (Hi.prototype.bytesPerElement = 68), + qn('StructArrayLayout8i15ui1ul4f68', Hi); + var Wi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t) { + var e = this.length; + return this.resize(e + 1), this.emplace(e, t); + }), + (e.prototype.emplace = function (t, e) { + return (this.float32[1 * t + 0] = e), t; + }), + e + ); + })(Ei); + (Wi.prototype.bytesPerElement = 4), qn('StructArrayLayout1f4', Wi); + var $i = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r) { + var n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + }), + (e.prototype.emplace = function (t, e, r, n) { + var i = 3 * t; + return ( + (this.int16[i + 0] = e), + (this.int16[i + 1] = r), + (this.int16[i + 2] = n), + t + ); + }), + e + ); + })(Ei); + ($i.prototype.bytesPerElement = 6), qn('StructArrayLayout3i6', $i); + var Qi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r) { + var n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + }), + (e.prototype.emplace = function (t, e, r, n) { + var i = 4 * t; + return ( + (this.uint32[2 * t + 0] = e), + (this.uint16[i + 2] = r), + (this.uint16[i + 3] = n), + t + ); + }), + e + ); + })(Ei); + (Qi.prototype.bytesPerElement = 8), qn('StructArrayLayout1ul2ui8', Qi); + var ta = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e) { + var r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + }), + (e.prototype.emplace = function (t, e, r) { + var n = 2 * t; + return (this.uint16[n + 0] = e), (this.uint16[n + 1] = r), t; + }), + e + ); + })(Ei); + (ta.prototype.bytesPerElement = 4), qn('StructArrayLayout2ui4', ta); + var ea = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t) { + var e = this.length; + return this.resize(e + 1), this.emplace(e, t); + }), + (e.prototype.emplace = function (t, e) { + return (this.uint16[1 * t + 0] = e), t; + }), + e + ); + })(Ei); + (ea.prototype.bytesPerElement = 2), qn('StructArrayLayout1ui2', ea); + var ra = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._refreshViews = function () { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + }), + (e.prototype.emplaceBack = function (t, e, r, n) { + var i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + }), + (e.prototype.emplace = function (t, e, r, n, i) { + var a = 4 * t; + return ( + (this.float32[a + 0] = e), + (this.float32[a + 1] = r), + (this.float32[a + 2] = n), + (this.float32[a + 3] = i), + t + ); + }), + e + ); + })(Ei); + (ra.prototype.bytesPerElement = 16), qn('StructArrayLayout4f16', ra); + var na = (function (t) { + function e() { + t.apply(this, arguments); + } + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e); + var r = { + anchorPointX: { configurable: !0 }, + anchorPointY: { configurable: !0 }, + x1: { configurable: !0 }, + y1: { configurable: !0 }, + x2: { configurable: !0 }, + y2: { configurable: !0 }, + featureIndex: { configurable: !0 }, + sourceLayerIndex: { configurable: !0 }, + bucketIndex: { configurable: !0 }, + anchorPoint: { configurable: !0 }, + }; + return ( + (r.anchorPointX.get = function () { + return this._structArray.int16[this._pos2 + 0]; + }), + (r.anchorPointY.get = function () { + return this._structArray.int16[this._pos2 + 1]; + }), + (r.x1.get = function () { + return this._structArray.int16[this._pos2 + 2]; + }), + (r.y1.get = function () { + return this._structArray.int16[this._pos2 + 3]; + }), + (r.x2.get = function () { + return this._structArray.int16[this._pos2 + 4]; + }), + (r.y2.get = function () { + return this._structArray.int16[this._pos2 + 5]; + }), + (r.featureIndex.get = function () { + return this._structArray.uint32[this._pos4 + 3]; + }), + (r.sourceLayerIndex.get = function () { + return this._structArray.uint16[this._pos2 + 8]; + }), + (r.bucketIndex.get = function () { + return this._structArray.uint16[this._pos2 + 9]; + }), + (r.anchorPoint.get = function () { + return new I(this.anchorPointX, this.anchorPointY); + }), + Object.defineProperties(e.prototype, r), + e + ); + })(Ci); + na.prototype.size = 20; + var ia = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.get = function (t) { + return new na(this, t); + }), + e + ); + })(Zi); + qn('CollisionBoxArray', ia); + var aa = (function (t) { + function e() { + t.apply(this, arguments); + } + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e); + var r = { + anchorX: { configurable: !0 }, + anchorY: { configurable: !0 }, + glyphStartIndex: { configurable: !0 }, + numGlyphs: { configurable: !0 }, + vertexStartIndex: { configurable: !0 }, + lineStartIndex: { configurable: !0 }, + lineLength: { configurable: !0 }, + segment: { configurable: !0 }, + lowerSize: { configurable: !0 }, + upperSize: { configurable: !0 }, + lineOffsetX: { configurable: !0 }, + lineOffsetY: { configurable: !0 }, + writingMode: { configurable: !0 }, + placedOrientation: { configurable: !0 }, + hidden: { configurable: !0 }, + crossTileID: { configurable: !0 }, + associatedIconIndex: { configurable: !0 }, + }; + return ( + (r.anchorX.get = function () { + return this._structArray.int16[this._pos2 + 0]; + }), + (r.anchorY.get = function () { + return this._structArray.int16[this._pos2 + 1]; + }), + (r.glyphStartIndex.get = function () { + return this._structArray.uint16[this._pos2 + 2]; + }), + (r.numGlyphs.get = function () { + return this._structArray.uint16[this._pos2 + 3]; + }), + (r.vertexStartIndex.get = function () { + return this._structArray.uint32[this._pos4 + 2]; + }), + (r.lineStartIndex.get = function () { + return this._structArray.uint32[this._pos4 + 3]; + }), + (r.lineLength.get = function () { + return this._structArray.uint32[this._pos4 + 4]; + }), + (r.segment.get = function () { + return this._structArray.uint16[this._pos2 + 10]; + }), + (r.lowerSize.get = function () { + return this._structArray.uint16[this._pos2 + 11]; + }), + (r.upperSize.get = function () { + return this._structArray.uint16[this._pos2 + 12]; + }), + (r.lineOffsetX.get = function () { + return this._structArray.float32[this._pos4 + 7]; + }), + (r.lineOffsetY.get = function () { + return this._structArray.float32[this._pos4 + 8]; + }), + (r.writingMode.get = function () { + return this._structArray.uint8[this._pos1 + 36]; + }), + (r.placedOrientation.get = function () { + return this._structArray.uint8[this._pos1 + 37]; + }), + (r.placedOrientation.set = function (t) { + this._structArray.uint8[this._pos1 + 37] = t; + }), + (r.hidden.get = function () { + return this._structArray.uint8[this._pos1 + 38]; + }), + (r.hidden.set = function (t) { + this._structArray.uint8[this._pos1 + 38] = t; + }), + (r.crossTileID.get = function () { + return this._structArray.uint32[this._pos4 + 10]; + }), + (r.crossTileID.set = function (t) { + this._structArray.uint32[this._pos4 + 10] = t; + }), + (r.associatedIconIndex.get = function () { + return this._structArray.int16[this._pos2 + 22]; + }), + Object.defineProperties(e.prototype, r), + e + ); + })(Ci); + aa.prototype.size = 48; + var oa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.get = function (t) { + return new aa(this, t); + }), + e + ); + })(Yi); + qn('PlacedSymbolArray', oa); + var sa = (function (t) { + function e() { + t.apply(this, arguments); + } + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e); + var r = { + anchorX: { configurable: !0 }, + anchorY: { configurable: !0 }, + rightJustifiedTextSymbolIndex: { configurable: !0 }, + centerJustifiedTextSymbolIndex: { configurable: !0 }, + leftJustifiedTextSymbolIndex: { configurable: !0 }, + verticalPlacedTextSymbolIndex: { configurable: !0 }, + placedIconSymbolIndex: { configurable: !0 }, + verticalPlacedIconSymbolIndex: { configurable: !0 }, + key: { configurable: !0 }, + textBoxStartIndex: { configurable: !0 }, + textBoxEndIndex: { configurable: !0 }, + verticalTextBoxStartIndex: { configurable: !0 }, + verticalTextBoxEndIndex: { configurable: !0 }, + iconBoxStartIndex: { configurable: !0 }, + iconBoxEndIndex: { configurable: !0 }, + verticalIconBoxStartIndex: { configurable: !0 }, + verticalIconBoxEndIndex: { configurable: !0 }, + featureIndex: { configurable: !0 }, + numHorizontalGlyphVertices: { configurable: !0 }, + numVerticalGlyphVertices: { configurable: !0 }, + numIconVertices: { configurable: !0 }, + numVerticalIconVertices: { configurable: !0 }, + useRuntimeCollisionCircles: { configurable: !0 }, + crossTileID: { configurable: !0 }, + textBoxScale: { configurable: !0 }, + textOffset0: { configurable: !0 }, + textOffset1: { configurable: !0 }, + collisionCircleDiameter: { configurable: !0 }, + }; + return ( + (r.anchorX.get = function () { + return this._structArray.int16[this._pos2 + 0]; + }), + (r.anchorY.get = function () { + return this._structArray.int16[this._pos2 + 1]; + }), + (r.rightJustifiedTextSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 2]; + }), + (r.centerJustifiedTextSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 3]; + }), + (r.leftJustifiedTextSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 4]; + }), + (r.verticalPlacedTextSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 5]; + }), + (r.placedIconSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 6]; + }), + (r.verticalPlacedIconSymbolIndex.get = function () { + return this._structArray.int16[this._pos2 + 7]; + }), + (r.key.get = function () { + return this._structArray.uint16[this._pos2 + 8]; + }), + (r.textBoxStartIndex.get = function () { + return this._structArray.uint16[this._pos2 + 9]; + }), + (r.textBoxEndIndex.get = function () { + return this._structArray.uint16[this._pos2 + 10]; + }), + (r.verticalTextBoxStartIndex.get = function () { + return this._structArray.uint16[this._pos2 + 11]; + }), + (r.verticalTextBoxEndIndex.get = function () { + return this._structArray.uint16[this._pos2 + 12]; + }), + (r.iconBoxStartIndex.get = function () { + return this._structArray.uint16[this._pos2 + 13]; + }), + (r.iconBoxEndIndex.get = function () { + return this._structArray.uint16[this._pos2 + 14]; + }), + (r.verticalIconBoxStartIndex.get = function () { + return this._structArray.uint16[this._pos2 + 15]; + }), + (r.verticalIconBoxEndIndex.get = function () { + return this._structArray.uint16[this._pos2 + 16]; + }), + (r.featureIndex.get = function () { + return this._structArray.uint16[this._pos2 + 17]; + }), + (r.numHorizontalGlyphVertices.get = function () { + return this._structArray.uint16[this._pos2 + 18]; + }), + (r.numVerticalGlyphVertices.get = function () { + return this._structArray.uint16[this._pos2 + 19]; + }), + (r.numIconVertices.get = function () { + return this._structArray.uint16[this._pos2 + 20]; + }), + (r.numVerticalIconVertices.get = function () { + return this._structArray.uint16[this._pos2 + 21]; + }), + (r.useRuntimeCollisionCircles.get = function () { + return this._structArray.uint16[this._pos2 + 22]; + }), + (r.crossTileID.get = function () { + return this._structArray.uint32[this._pos4 + 12]; + }), + (r.crossTileID.set = function (t) { + this._structArray.uint32[this._pos4 + 12] = t; + }), + (r.textBoxScale.get = function () { + return this._structArray.float32[this._pos4 + 13]; + }), + (r.textOffset0.get = function () { + return this._structArray.float32[this._pos4 + 14]; + }), + (r.textOffset1.get = function () { + return this._structArray.float32[this._pos4 + 15]; + }), + (r.collisionCircleDiameter.get = function () { + return this._structArray.float32[this._pos4 + 16]; + }), + Object.defineProperties(e.prototype, r), + e + ); + })(Ci); + sa.prototype.size = 68; + var ua = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.get = function (t) { + return new sa(this, t); + }), + e + ); + })(Hi); + qn('SymbolInstanceArray', ua); + var la = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getoffsetX = function (t) { + return this.float32[1 * t + 0]; + }), + e + ); + })(Wi); + qn('GlyphOffsetArray', la); + var pa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getx = function (t) { + return this.int16[3 * t + 0]; + }), + (e.prototype.gety = function (t) { + return this.int16[3 * t + 1]; + }), + (e.prototype.gettileUnitDistanceFromAnchor = function (t) { + return this.int16[3 * t + 2]; + }), + e + ); + })($i); + qn('SymbolLineVertexArray', pa); + var ca = (function (t) { + function e() { + t.apply(this, arguments); + } + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e); + var r = { + featureIndex: { configurable: !0 }, + sourceLayerIndex: { configurable: !0 }, + bucketIndex: { configurable: !0 }, + }; + return ( + (r.featureIndex.get = function () { + return this._structArray.uint32[this._pos4 + 0]; + }), + (r.sourceLayerIndex.get = function () { + return this._structArray.uint16[this._pos2 + 2]; + }), + (r.bucketIndex.get = function () { + return this._structArray.uint16[this._pos2 + 3]; + }), + Object.defineProperties(e.prototype, r), + e + ); + })(Ci); + ca.prototype.size = 8; + var ha = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.get = function (t) { + return new ca(this, t); + }), + e + ); + })(Qi); + qn('FeatureIndexArray', ha); + var fa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Fi), + ya = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Oi), + da = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Fi), + ma = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Fi), + va = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Li), + ga = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Di), + xa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(ji), + ba = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Ri), + wa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Ui), + _a = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(qi), + Aa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Ni), + ka = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Ki), + Sa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Gi), + Ia = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Ji), + Ma = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Xi), + za = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Xi), + Pa = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(ta), + Ba = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(ea), + Ca = Vi([{ name: 'a_pos', components: 2, type: 'Int16' }], 4).members, + Ea = function (t) { + void 0 === t && (t = []), (this.segments = t); + }; + function Va(t, e) { + return 256 * (t = a(Math.floor(t), 0, 255)) + a(Math.floor(e), 0, 255); + } + (Ea.prototype.prepareSegment = function (t, e, r, n) { + var i = this.segments[this.segments.length - 1]; + return ( + t > Ea.MAX_VERTEX_ARRAY_LENGTH && + d( + 'Max vertices per segment is ' + + Ea.MAX_VERTEX_ARRAY_LENGTH + + ': bucket requested ' + + t, + ), + (!i || + i.vertexLength + t > Ea.MAX_VERTEX_ARRAY_LENGTH || + i.sortKey !== n) && + ((i = { + vertexOffset: e.length, + primitiveOffset: r.length, + vertexLength: 0, + primitiveLength: 0, + }), + void 0 !== n && (i.sortKey = n), + this.segments.push(i)), + i + ); + }), + (Ea.prototype.get = function () { + return this.segments; + }), + (Ea.prototype.destroy = function () { + for (var t = 0, e = this.segments; t < e.length; t += 1) { + var r = e[t]; + for (var n in r.vaos) r.vaos[n].destroy(); + } + }), + (Ea.simpleSegment = function (t, e, r, n) { + return new Ea([ + { + vertexOffset: t, + primitiveOffset: e, + vertexLength: r, + primitiveLength: n, + vaos: {}, + sortKey: 0, + }, + ]); + }), + (Ea.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1), + qn('SegmentVector', Ea); + var Ta = Vi([ + { name: 'a_pattern_from', components: 4, type: 'Uint16' }, + { name: 'a_pattern_to', components: 4, type: 'Uint16' }, + { name: 'a_pixel_ratio_from', components: 1, type: 'Uint16' }, + { name: 'a_pixel_ratio_to', components: 1, type: 'Uint16' }, + ]), + Fa = { exports: {} }, + Oa = { exports: {} }; + Oa.exports = function (t, e) { + var r, n, i, a, o, s, u, l; + for ( + n = t.length - (r = 3 & t.length), + i = e, + o = 3432918353, + s = 461845907, + l = 0; + l < n; -define(["./shared"],(function(t){"use strict";var e=i;function i(t){return !function(t){return "undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return !1;var t,e,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{e=new Worker(r),t=!0;}catch(e){t=!1;}return e&&e.terminate(),URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return !1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===r[e=t&&t.failIfMajorPerformanceCaveat]&&(r[e]=function(t){var e,r=function(t){var e=document.createElement("canvas"),r=Object.create(i.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}(t);if(!r)return !1;try{e=r.createShader(r.VERTEX_SHADER);}catch(t){return !1}return !(!e||r.isContextLost())&&(r.shaderSource(e,"void main() {}"),r.compileShader(e),!0===r.getShaderParameter(e,r.COMPILE_STATUS))}(e)),r[e]?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 e;}(t)}var r={};function o(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(var i=0;i-1);a[++l]=s,n[l]=c,n[l+1]=u;}for(var d=0,_=0;d0?C*C:0,y[I]=C<0?C*C:0;}}}d(x,0,0,c,h,c,this.f,this.v,this.z),d(y,v,v,s,l,c,this.f,this.v,this.z);for(var S=0;S65535)e(new Error("glyphs > 65535 not supported"));else if(a.ranges[s])e(null,{stack:i,id:o,glyph:n});else {var l=a.requests[s];l||(l=a.requests[s]=[],f.loadGlyphRange(i,s,r.url,r.requestManager,(function(t,e){if(e){for(var i in e)r._doesCharSupportLocalGlyph(+i)||(a.glyphs[+i]=e[+i]);a.ranges[s]=!0;}for(var o=0,n=l;o1&&(s=t[++n]);var c=Math.abs(l-s.left),h=Math.abs(l-s.right),u=Math.min(c,h),p=void 0,d=o/i*(r+1);if(s.isDash){var _=r-Math.abs(d);p=Math.sqrt(u*u+_*_);}else p=r-Math.sqrt(u*u+d*d);this.data[a+l]=Math.max(0,Math.min(255,p+128));}},x.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1));}var o=t[0],a=t[t.length-1];o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);for(var n=this.width*this.nextRow,s=0,l=t[s],c=0;c1&&(l=t[++s]);var h=Math.abs(c-l.left),u=Math.abs(c-l.right),p=Math.min(h,u);this.data[n+c]=Math.max(0,Math.min(255,(l.isDash?p:-p)+128));}},x.prototype.addDash=function(e,i){var r=i?7:0,o=2*r+1;if(this.nextRow+o>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var a=0,n=0;n=r&&e.x=o&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,n,i.y-1).key]={backfilled:!1}),i.y+10&&t.extend(n,{resourceTiming:a}),i.fire(new t.Event("data",n));}}}));},i.prototype.loaded=function(){return 0===this._pendingLoads},i.prototype.loadTile=function(t,e){var i=this,r=t.actor?"reloadTile":"loadTile";t.actor=this.actor;var o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(r,o,(function(o,a){return delete t.request,t.unloadVectorData(),t.aborted?e(null):o?e(o):(t.loadVectorData(a,i.map.painter,"reloadTile"===r),e(null))}));},i.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0;},i.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id});},i.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id});},i.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},i.prototype.hasTransition=function(){return !1},i}(t.Evented),z=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),P=function(e){function i(t,i,r,o){e.call(this),this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=i;}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(e,i){var r=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(o,a){r._loaded=!0,o?r.fire(new t.ErrorEvent(o)):a&&(r.image=a,e&&(r.coordinates=e),i&&i(),r._finishLoading());}));},i.prototype.loaded=function(){return this._loaded},i.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null;})),this):this},i.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})));},i.prototype.onAdd=function(t){this.map=t,this.load();},i.prototype.setCoordinates=function(e){var i=this;this.coordinates=e;var r=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var i=1/0,r=1/0,o=-1/0,a=-1/0,n=0,s=e;ni.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+i.start(0)+" and "+i.end(0)+"-second mark."))):this.video.currentTime=e;}},i.prototype.getVideo=function(){return this.video},i.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));},i.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,i=e.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new l(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this.tiles){var o=this.tiles[r];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture);}}},i.prototype.serialize=function(){return {type:"video",urls:this.urls,coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this.video&&!this.video.paused},i}(P),A=function(e){function i(i,r,o,a){e.call(this,i,r,o,a),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some((function(t){return !Array.isArray(t)||2!==t.length||t.some((function(t){return "number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+i,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate;}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play();},i.prototype.onRemove=function(){this.pause();},i.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context,r=i.gl;for(var o in this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l(i,this.canvas,r.RGBA,{premultiply:!0}),this.tiles){var a=this.tiles[o];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture);}}},i.prototype.serialize=function(){return {type:"canvas",coordinates:this.coordinates}},i.prototype.hasTransition=function(){return this._playing},i.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];to)a=!1;else if(i)if(this.expirationTimethis.max){var n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n);}return this},F.prototype.has=function(t){return t.wrapped().key in this.data},F.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},F.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},F.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},F.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},F.prototype.remove=function(t,e){if(!this.has(t))return this;var i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),o=this.data[i][r];return this.data[i].splice(r,1),o.timeout&&clearTimeout(o.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this},F.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e);}return this},F.prototype.filter=function(t){var e=[];for(var i in this.data)for(var r=0,o=this.data[i];r1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)));}},i.prototype.getTile=function(t){return this.getTileByID(t.key)},i.prototype.getTileByID=function(t){return this._tiles[t]},i.prototype._retainLoadedChildren=function(t,e,i,r){for(var o in this._tiles){var a=this._tiles[o];if(!(r[o]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>i)){for(var n=a.tileID;a&&a.tileID.overscaledZ>e+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(n=s);}for(var l=n;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){r[n.key]=n;break}}}},i.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(var r=t.overscaledZ-1;r>=e;r--){var o=t.scaledTo(r),a=this._getLoadedTile(o);if(a)return a}},i.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},i.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*5),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(o);},i.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var i={};for(var r in this._tiles){var o=this._tiles[r];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+e),i[o.tileID.key]=o;}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var n in this._tiles)this._setTileReloadTimer(n,this._tiles[n]);}},i.prototype.update=function(e,r){var o=this;if(this.transform=e,this.terrain=r,this._sourceLoaded&&!this._paused){var a;this.updateCacheSize(e),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 t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(a=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r}),this._source.hasTile&&(a=a.filter((function(t){return o._source.hasTile(t)})))):a=[];var n=e.coveringZoomLevel(this._source),s=Math.max(n-i.maxOverzooming,this._source.minzoom),l=Math.max(n+i.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){for(var c={},h=0,u=a;hthis._source.minzoom){var d=p.scaledTo(p.canonical.z-1);c[d.key]=d;var _=p.scaledTo(Math.max(this._source.minzoom,Math.min(p.canonical.z,5)));c[_.key]=_;}}a=a.concat(Object.values(c));}var f=this._updateRetainedTiles(a,n);if(j(this._source.type)){for(var m={},g={},v=0,y=Object.keys(f);vthis._source.maxzoom){var m=_.children(this._source.maxzoom)[0],g=this.getTile(m);if(g&&g.hasData()){r[m.key]=m;continue}}else {var v=_.children(this._source.maxzoom);if(r[v[0].key]&&r[v[1].key]&&r[v[2].key]&&r[v[3].key])continue}for(var y=f.wasRequested(),x=_.overscaledZ-1;x>=a;--x){var b=_.scaledTo(x);if(o[b.key])break;if(o[b.key]=!0,!(f=this.getTile(b))&&y&&(f=this._addTile(b)),f&&(r[b.key]=b,y=f.wasRequested(),f.hasData()))break}}}return r},i.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],i=void 0,r=this._tiles[t].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);var o=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(o))break;r=o;}for(var a=0,n=e;a0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));},i.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset();},i.prototype.tilesIn=function(e,i,r){var o=this,a=[],n=this.transform;if(!n)return a;for(var s=r?n.getCameraQueryGeometry(e):e,l=e.map((function(t){return n.pointCoordinate(t,o.terrain)})),c=s.map((function(t){return n.pointCoordinate(t,o.terrain)})),h=this.getIds(),u=1/0,p=1/0,d=-1/0,_=-1/0,f=0,m=c;f=0&&g[1].y+m>=0){var v=l.map((function(t){return s.getTilePoint(t)})),y=c.map((function(t){return s.getTilePoint(t)}));a.push({tile:r,tileID:s,queryGeometry:v,cameraQueryGeometry:y,scale:f});}}},y=0;y=t.exported.now())return !0}return !1},i.prototype.setFeatureState=function(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i);},i.prototype.removeFeatureState=function(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i);},i.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},i.prototype.setDependencies=function(t,e,i){var r=this._tiles[t];r&&r.setDependencies(e,i);},i.prototype.reloadTilesForDependencies=function(t,e){for(var i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((function(i){return !i.hasDependency(t,e)}));},i}(t.Evented);function G(t,e){var i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function j(t){return "raster"===t||"image"===t||"video"===t}N.maxOverzooming=10,N.maxUnderzooming=3;var Z="mapboxgl_preloaded_worker_pool",V=function(){this.active={};};V.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(o-n)/s:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))};var nt=function(t,e,i){var r=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(var a=0;a=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function pt(t,e,i,r,o,a,n,s,l,c,h,u,p){var d=s.glyphStartIndex+s.numGlyphs,_=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,m=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(d-1),v=mt(t*m,i,r,o,a,n,s.segment,_,f,l,c,h,u,p);if(!v)return null;var y=mt(t*g,i,r,o,a,n,s.segment,_,f,l,c,h,u,p);return y?{first:v,last:y}:null}function dt(e,i,r,o){return e===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*o?{useVertical:!0}:(e===t.WritingMode.vertical?i.yr.x)?{needsFlipping:!0}:null}function _t(e,i,r,o,a,n,s,l,c,h,u,p,d,_,f,m){var g,v=i/24,y=e.lineOffsetX*v,x=e.lineOffsetY*v;if(e.numGlyphs>1){var b=e.glyphStartIndex+e.numGlyphs,w=e.lineStartIndex,T=e.lineStartIndex+e.lineLength,E=pt(v,l,y,x,r,u,p,e,c,n,d,f,m);if(!E)return {notEnoughRoom:!0};var I=ct(E.first.point,s,m).point,C=ct(E.last.point,s,m).point;if(o&&!r){var S=dt(e.writingMode,I,C,_);if(S)return S}g=[E.first];for(var D=e.glyphStartIndex+1;D0?A.point:ft(p,M,z,1,a,m),L=dt(e.writingMode,z,R,_);if(L)return L}var k=mt(v*l.getoffsetX(e.glyphStartIndex),y,x,r,u,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,n,d,f,m);if(!k)return {notEnoughRoom:!0};g=[k];}for(var B=0,O=g;B0?1:-1,g=0;o&&(m*=-1,g=Math.PI),m<0&&(g+=Math.PI);for(var v=m>0?l+s:l+s+1,y=a,x=a,b=0,w=0,T=Math.abs(f),E=[];b+w<=T;){if((v+=m)=c)return null;if(x=y,E.push(y),void 0===(y=p[v])){var I=new t.pointGeometry(h.getx(v),h.gety(v)),C=ct(I,u,_);if(C.signedDistanceFromCamera>0)y=p[v]=C.point;else {var S=v-m;y=ft(0===b?n:new t.pointGeometry(h.getx(S),h.gety(S)),I,x,T-b+1,u,_);}}b+=w,w=x.dist(y);}var D=(T-b)/w,z=y.sub(x),P=z.mult(D)._add(x);P._add(z._unit()._perp()._mult(r*m));var M=g+Math.atan2(y.y-x.y,y.x-x.x);return E.push(P),{point:P,angle:d?M:0,path:E}}nt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},nt.prototype.insert=function(t,e,i,r,o){this._forEachCell(e,i,r,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(o);},nt.prototype.insertCircle=function(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r);},nt.prototype._insertBoxCell=function(t,e,i,r,o,a){this.boxCells[o].push(a);},nt.prototype._insertCircleCell=function(t,e,i,r,o,a){this.circleCells[o].push(a);},nt.prototype._query=function(t,e,i,r,o,a,n){if(i<0||t>this.width||r<0||e>this.height)return [];var s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(o)return [{key:null,x1:t,y1:e,x2:i,y2:r}];for(var l=0;l0},nt.prototype.hitTestCircle=function(t,e,i,r,o){var a=t-i,n=t+i,s=e-i,l=e+i;if(n<0||a>this.width||l<0||s>this.height)return !1;var c=[];return this._forEachCell(a,s,n,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},o),c.length>0},nt.prototype._queryCell=function(t,e,i,r,o,a,n,s){var l=n.seenUids,c=n.hitTest,h=n.overlapMode,u=this.boxCells[o];if(null!==u)for(var p=this.bboxes,d=0,_=u;d<_.length;d+=1){var f=_[d];if(!l.box[f]){l.box[f]=!0;var m=4*f,g=this.boxKeys[f];if(t<=p[m+2]&&e<=p[m+3]&&i>=p[m+0]&&r>=p[m+1]&&(!s||s(g))&&(!c||!at(h,g.overlapMode))&&(a.push({key:g,x1:p[m],y1:p[m+1],x2:p[m+2],y2:p[m+3]}),c))return !0}}var v=this.circleCells[o];if(null!==v)for(var y=this.circles,x=0,b=v;xn*n+s*s},nt.prototype._circleAndRectCollide=function(t,e,i,r,o,a,n){var s=(a-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return !1;var c=(n-o)/2,h=Math.abs(e-(o+c));if(h>c+i)return !1;if(l<=s||h<=c)return !0;var u=l-s,p=h-c;return u*u+p*p<=i*i};var gt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function vt(t,e){for(var i=0;i=1;A--)M.push(z.path[A]);for(var R=1;R0){for(var O=M[0].clone(),F=M[0].clone(),U=1;U=C.x&&F.x<=S.x&&O.y>=C.y&&F.y<=S.y?[M]:F.xS.x||F.yS.y?[]:t.clipLine([M],C.x,C.y,S.x,S.y);}for(var N=0,G=B;N=this.screenRightBoundary||rthis.screenBottomBoundary},bt.prototype.isInsideGrid=function(t,e,i,r){return i>=0&&t=0&&e0){var y;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(y=this.prevPlacement.variableOffsets[u.crossTileID].anchor),0===u.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[u.crossTileID]={textOffset:m,width:i,height:r,anchor:t,textBoxScale:o,prevAnchor:y},this.markUsedJustification(p,t,u,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,u),this.placedOrientations[u.crossTileID]=d),{shift:g,placedGlyphBoxes:v}}},Mt.prototype.placeLayerBucketPart=function(e,i,r){var o=this,a=e.parameters,n=a.bucket,s=a.layout,l=a.posMatrix,c=a.textLabelPlaneMatrix,h=a.labelToScreenMatrix,u=a.textPixelRatio,p=a.holdingForFade,d=a.collisionBoxArray,_=a.partiallyEvaluatedTextSize,f=a.collisionGroup,m=s.get("text-optional"),g=s.get("icon-optional"),v=t.getOverlapMode(s,"text-overlap","text-allow-overlap"),y="always"===v,x=t.getOverlapMode(s,"icon-overlap","icon-allow-overlap"),b="always"===x,w="map"===s.get("text-rotation-alignment"),T="map"===s.get("text-pitch-alignment"),E="none"!==s.get("icon-text-fit"),I="viewport-y"===s.get("symbol-z-order"),C=y&&(b||!n.hasIconData()||g),S=b&&(y||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);var D=function(e,a){if(!i[e.crossTileID])if(p)o.placements[e.crossTileID]=new It(!1,!1,!1);else {var d,b=!1,I=!1,D=!0,z=null,P={box:null,offscreen:null},M={box:null,offscreen:null},A=null,R=null,L=0,k=0,B=0;a.textFeatureIndex?L=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),a.verticalTextFeatureIndex&&(k=a.verticalTextFeatureIndex);for(var O=o.retainedQueryData[n.bucketInstanceId].tileID,F=o.terrain?function(t,e){return o.terrain.getElevation(O,t,e)}:null,U=0,N=["textBox","verticalTextBox","iconBox","verticalIconBox"];U0&&a.verticalTextBox)for(var o=0,s=n.writingModes;o0&&(q=q.filter((function(t){return t!==X.anchor}))).unshift(X.anchor);}var W=function(t,i,r){for(var a=t.x2-t.x1,s=t.y2-t.y1,c=e.textBoxScale,h=E&&"never"===x?i:null,p={box:[],offscreen:!1},d="never"!==v?2*q.length:q.length,_=0;_=q.length?v:"never",e,n,r,h,F);if(m&&(p=m.placedGlyphBoxes)&&p.box&&p.box.length){b=!0,z=m.shift;break}}return p};V((function(){return W(j,a.iconBox,t.WritingMode.horizontal)}),(function(){var i=a.verticalTextBox;return n.allowVerticalPlacement&&!(P&&P.box&&P.box.length)&&e.numVerticalGlyphVertices>0&&i?W(i,a.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),P&&(b=P.box,D=P.offscreen);var H=Z(P&&P.box);if(!b&&o.prevPlacement){var K=o.prevPlacement.variableOffsets[e.crossTileID];K&&(o.variableOffsets[e.crossTileID]=K,o.markUsedJustification(n,K.anchor,e,H));}}else {var Y=function(t,i){var r=o.collisionIndex.placeCollisionBox(t,v,u,l,f.predicate,F);return r&&r.box&&r.box.length&&(o.markUsedOrientation(n,i,e),o.placedOrientations[e.crossTileID]=i),r};V((function(){return Y(j,t.WritingMode.horizontal)}),(function(){var i=a.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?Y(i,t.WritingMode.vertical):{box:null,offscreen:null}})),Z(P&&P.box&&P.box.length);}}if(b=(d=P)&&d.box&&d.box.length>0,D=d&&d.offscreen,e.useRuntimeCollisionCircles){var J=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Q=t.evaluateSizeForFeature(n.textSizeData,_,J),$=s.get("text-padding");(A=o.collisionIndex.placeCollisionCircles(v,J,n.lineVertexArray,n.glyphOffsetArray,Q,l,c,h,r,T,f.predicate,e.collisionCircleDiameter,$,F)).circles.length&&A.collisionDetected&&!r&&t.warnOnce("Collisions detected, but collision boxes are not shown"),b=y||A.circles.length>0&&!A.collisionDetected,D=D&&A.offscreen;}if(a.iconFeatureIndex&&(B=a.iconFeatureIndex),a.iconBox){var tt=function(t){var e=E&&z?Pt(t,z.x,z.y,w,T,o.transform.angle):t;return o.collisionIndex.placeCollisionBox(e,x,u,l,f.predicate,F)};I=M&&M.box&&M.box.length&&a.verticalIconBox?(R=tt(a.verticalIconBox)).box.length>0:(R=tt(a.iconBox)).box.length>0,D=D&&R.offscreen;}var et=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,it=g||0===e.numIconVertices;if(et||it?it?et||(I=I&&b):b=I&&b:I=b=I&&b,b&&d&&d.box&&o.collisionIndex.insertCollisionBox(d.box,v,s.get("text-ignore-placement"),n.bucketInstanceId,M&&M.box&&k?k:L,f.ID),I&&R&&o.collisionIndex.insertCollisionBox(R.box,x,s.get("icon-ignore-placement"),n.bucketInstanceId,B,f.ID),A&&(b&&o.collisionIndex.insertCollisionCircles(A.circles,v,s.get("text-ignore-placement"),n.bucketInstanceId,L,f.ID),r)){var rt=n.bucketInstanceId,ot=o.collisionCircleArrays[rt];void 0===ot&&(ot=o.collisionCircleArrays[rt]=new Ct);for(var at=0;at=0;--P){var M=z[P];D(n.symbolInstances.get(M),n.collisionArrays[M]);}}else for(var A=e.symbolInstanceStart;A=0&&(e.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:r.crossTileID);}},Mt.prototype.markUsedOrientation=function(e,i,r){for(var o=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,a=i===t.WritingMode.vertical?i:0,n=0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];n0,v=o.placedOrientations[a.crossTileID],y=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Nt(m.text);_(e.text,s,y?Gt:b),_(e.text,l,x?Gt:b);var w=m.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||y?1:0);})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var T=o.variableOffsets[a.crossTileID];T&&o.markUsedJustification(e,T.anchor,a,v);var E=o.placedOrientations[a.crossTileID];E&&(o.markUsedJustification(e,"left",a,E),o.markUsedOrientation(e,E,a));}if(g){var I=Nt(m.icon),C=!(p&&a.verticalPlacedIconSymbolIndex&&y);a.placedIconSymbolIndex>=0&&(_(e.icon,a.numIconVertices,C?I:Gt),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=m.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(_(e.icon,a.numVerticalIconVertices,C?Gt:I),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden());}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[r];if(S){var D=new t.pointGeometry(0,0);if(S.textBox||S.verticalTextBox){var z=!0;if(c){var P=o.variableOffsets[f];P?(D=zt(P.anchor,P.width,P.height,P.textOffset,P.textBoxScale),h&&D._rotate(u?o.transform.angle:-o.transform.angle)):z=!1;}S.textBox&&At(e.textCollisionBox.collisionVertexArray,m.text.placed,!z||y,D.x,D.y),S.verticalTextBox&&At(e.textCollisionBox.collisionVertexArray,m.text.placed,!z||x,D.x,D.y);}var M=Boolean(!x&&S.verticalIconBox);S.iconBox&&At(e.iconCollisionBox.collisionVertexArray,m.icon.placed,M,p?D.x:0,p?D.y:0),S.verticalIconBox&&At(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!M,p?D.x:0,p?D.y:0);}}},m=0;mt},Mt.prototype.setStale=function(){this.stale=!0;};var Rt=Math.pow(2,25),Lt=Math.pow(2,24),kt=Math.pow(2,17),Bt=Math.pow(2,16),Ot=Math.pow(2,9),Ft=Math.pow(2,8),Ut=Math.pow(2,1);function Nt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Rt+e*Lt+i*kt+e*Bt+i*Ot+e*Ft+i*Ut+e}var Gt=0,jt=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];};jt.prototype.continuePlacement=function(t,e,i,r,o){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=i[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new jt(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,n))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;},Zt.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Vt=512/t.EXTENT/2,qt=function(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(var r=0;rt.overscaledZ)for(var s in n){var l=n[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,o);}else {var c=n[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,o);}}for(var h=0;h>c<>c<>c;t.ortho(l.posMatrix,0,p,0,p,0,1),t.translate(l.posMatrix,l.posMatrix,[-h*p,-u*p,0]),i[a]=l;}else if(e.canonical.isChildOf(n.canonical)){var d=e.clone();d.posMatrix=new Float64Array(16);var _=e.canonical.z-n.canonical.z,f=e.canonical.x-(e.canonical.x>>_<<_),m=e.canonical.y-(e.canonical.y>>_<<_),g=t.EXTENT>>_;t.ortho(d.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(d.posMatrix,d.posMatrix,[f*g,m*g,0]),t.scale(d.posMatrix,d.posMatrix,[1/Math.pow(2,_),1/Math.pow(2,_),0]),i[a]=d;}}return i},i.prototype.getSourceTile=function(t,e){var i=this.sourceCache._source,r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r=i.minzoom&&(!o||!o.dem);)o=this.sourceCache.getTileByID(t.scaledTo(r--).key);return o},i.prototype.tilesAfterTime=function(t){return void 0===t&&(t=Date.now()),Object.values(this._tiles).filter((function(e){return e.timeLoaded>=t}))},i}(t.Evented),Jt=function(t,e,i){this.style=t,this.sourceCache=new Yt(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.elevationOffset="number"==typeof i.elevationOffset?i.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache();};Jt.prototype.getDEMElevation=function(e,i,r,o){if(void 0===o&&(o=t.EXTENT),!(i>=0&&i=0&&re.canonical.z&&(e.canonical.z>=s?c=e.canonical.z-s:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));var h=e.canonical.x-(e.canonical.x>>c<>c<>8<<4|r>>8,i[o+3]=0;var n=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),s=new l(e,n,e.gl.RGBA,{premultiply:!1});return s.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=s,s},Jt.prototype.pointCoordinate=function(e){var i=new Uint8Array(4),r=this.style.map.painter,o=r.context,a=o.gl;o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(e.x,r.height/devicePixelRatio-e.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),o.bindFramebuffer.set(null);var n=i[0]+(i[2]>>4<<8),s=i[1]+((15&i[2])<<8),l=this.coordsIndex[255-i[3]],c=l&&this.sourceCache.getTileByID(l);if(!c)return null;var h=this._coordsTextureSize,u=(1<1?"@2x":"",c=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),(function(t,e){c=null,s||(s=t,a=e,u());})),h=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),(function(t,e){h=null,s||(s=t,n=e,u());}));function u(){if(s)o(s);else if(a&&n){var e=t.exported.getImageData(n),i={};for(var r in a){var l=a[r],c=l.width,h=l.height,u=l.x,p=l.y,d=l.sdf,_=l.pixelRatio,f=l.stretchX,m=l.stretchY,g=l.content,v=new t.RGBAImage({width:c,height:h});t.RGBAImage.copy(e,v,{x:u,y:p},{x:0,y:0},{width:c,height:h}),i[r]={data:v,pixelRatio:_,sdf:d,stretchX:f,stretchY:m,content:g};}o(null,i);}}return {cancel:function(){c&&(c.cancel(),c=null),h&&(h.cancel(),h=null);}}}(e,this.map._requestManager,this.map.getPixelRatio(),(function(e,r){if(i._spriteRequest=null,e)i.fire(new t.ErrorEvent(e));else if(r)for(var o in r)i.imageManager.addImage(o,r[o]);i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.fire(new t.Event("data",{dataType:"style"}));}));},i.prototype._validateLayer=function(e){var i=this.sourceCaches[e.source];if(i){var r=e.sourceLayer;if(r){var o=i.getSource();("geojson"===o.type||o.vectorLayerIds&&-1===o.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+r+'" does not exist on source "'+o.id+'" as specified by style layer "'+e.id+'".')));}}},i.prototype.loaded=function(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()},i.prototype._serializeLayers=function(t){for(var e=[],i=0,r=t;i0)throw new Error("Unimplemented: "+a.map((function(t){return t.command})).join(", ")+".");return r.forEach((function(t){"setTransition"!==t.command&&i[t.command].apply(i,t.args);})),this.stylesheet=e,!0},i.prototype.addImage=function(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error('An image named "'+e+'" already exists.')));this.imageManager.addImage(e,i),this._afterImageUpdated(e);},i.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e);},i.prototype.getImage=function(t){return this.imageManager.getImage(t)},i.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error('An image named "'+e+'" does not exist.')));this.imageManager.removeImage(e),this._afterImageUpdated(e);},i.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));},i.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},i.prototype.addSource=function(e,i,r){var o=this;if(void 0===r&&(r={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error('Source "'+e+'" already exists.');if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(i).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,r))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var a=this.sourceCaches[e]=new N(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,(function(){return {isSourceLoaded:o.loaded(),source:a.serialize(),sourceId:e}})),a.onAdd(this.map),this._changed=!0;}},i.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+i+'" is using it.')));var r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0;},i.prototype.setGeoJSONSourceData=function(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID="+t);var i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error("geojsonSource.type is "+i.type+", which is !== 'geojson");i.setData(e),this._changed=!0;},i.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},i.prototype.addLayer=function(e,i,r){void 0===r&&(r={}),this._checkLoaded();var o=e.id;if(this.getLayer(o))this.fire(new t.ErrorEvent(new Error('Layer "'+o+'" already exists on this map.')));else {var a;if("custom"===e.type){if(Qt(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e);}else {if("object"==typeof e.source&&(this.addSource(o,e.source),e=t.clone$1(e),e=t.extend(e,{source:o})),this._validate(t.validateStyle.layer,"layers."+o,e,{arrayIndex:-1},r))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}}),this._serializedLayers[a.id]=a.serialize();}var n=i?this._order.indexOf(i):this._order.length;if(i&&-1===n)this.fire(new t.ErrorEvent(new Error('Cannot add layer "'+o+'" before non-existing layer "'+i+'".')));else {if(this._order.splice(n,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&"custom"!==a.type){var s=this._removedLayers[o];delete this._removedLayers[o],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause());}this._updateLayer(a),a.onAdd&&a.onAdd(this.map);}}},i.prototype.moveLayer=function(e,i){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==i){var r=this._order.indexOf(e);this._order.splice(r,1);var o=i?this._order.indexOf(i):this._order.length;i&&-1===o?this.fire(new t.ErrorEvent(new Error('Cannot move layer "'+e+'" before non-existing layer "'+i+'".'))):(this._order.splice(o,0,e),this._layerOrderChanged=!0);}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")));},i.prototype.removeLayer=function(e){this._checkLoaded();var i=this._layers[e];if(i){i.setEventedParent(null);var r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map);}else this.fire(new t.ErrorEvent(new Error('Cannot remove non-existing layer "'+e+'".')));},i.prototype.getLayer=function(t){return this._layers[t]},i.prototype.hasLayer=function(t){return t in this._layers},i.prototype.setLayerZoomRange=function(e,i,r){this._checkLoaded();var o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===r||(null!=i&&(o.minzoom=i),null!=r&&(o.maxzoom=r),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error('Cannot set the zoom range of non-existing layer "'+e+'".')));},i.prototype.setFilter=function(e,i,r){void 0===r&&(r={}),this._checkLoaded();var a=this.getLayer(e);if(a){if(!o(a.filter,i))return null==i?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(t.validateStyle.filter,"layers."+a.id+".filter",i,null,r)||(a.filter=t.clone$1(i),this._updateLayer(a)))}else this.fire(new t.ErrorEvent(new Error('Cannot filter non-existing layer "'+e+'".')));},i.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},i.prototype.setLayoutProperty=function(e,i,r,a){void 0===a&&(a={}),this._checkLoaded();var n=this.getLayer(e);n?o(n.getLayoutProperty(i),r)||(n.setLayoutProperty(i,r,a),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error('Cannot style non-existing layer "'+e+'".')));},i.prototype.getLayoutProperty=function(e,i){var r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error('Cannot get style of non-existing layer "'+e+'".')));},i.prototype.setPaintProperty=function(e,i,r,a){void 0===a&&(a={}),this._checkLoaded();var n=this.getLayer(e);n?o(n.getPaintProperty(i),r)||(n.setPaintProperty(i,r,a)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error('Cannot style non-existing layer "'+e+'".')));},i.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},i.prototype.setFeatureState=function(e,i){this._checkLoaded();var r=e.source,o=e.sourceLayer,a=this.sourceCaches[r];if(void 0!==a){var n=a.getSource().type;"geojson"===n&&o?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==n||o?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")));},i.prototype.removeFeatureState=function(e,i){this._checkLoaded();var r=e.source,o=this.sourceCaches[r];if(void 0!==o){var a=o.getSource().type,n="vector"===a?e.sourceLayer:void 0;"vector"!==a||n?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(n,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")));},i.prototype.getFeatureState=function(e){this._checkLoaded();var i=e.source,r=e.sourceLayer,o=this.sourceCaches[i];if(void 0!==o){if("vector"!==o.getSource().type||r)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.getFeatureState(r,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")));},i.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},i.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},i.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0;},i.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,i=function(t){return "fill-extrusion"===e._layers[t].type},r={},o=[],a=this._order.length-1;a>=0;a--){var n=this._order[a];if(i(n)){r[n]=a;for(var s=0,l=t;s=0;d--){var _=this._order[d];if(i(_))for(var f=o.length-1;f>=0;f--){var m=o[f].feature;if(r[m.layer.id] 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:ae("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ae("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ae("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(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;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(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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ae("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:ae("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:ae("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ae("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ae("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:ae("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:ae("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ae("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ae("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ae("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ae("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\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;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ae("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ae("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"),linePattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:ae("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ae("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:ae("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ae("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:ae("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",re),terrainDepth:ae("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",re),terrainCoords:ae("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",re)};function ae(t,e){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=a?a.concat(o):o,s={};return {fragmentSource:t=t.replace(i,(function(t,e,i,r,o){return s[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+i+" "+r+" "+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n"})),vertexSource:e=e.replace(i,(function(t,e,i,r,o){var a="float"===r?"vec2":"vec4",n=o.match(/color/)?"color":a;return s[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+i+" "+a+" a_"+o+";\nvarying "+i+" "+r+" "+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"vec4"===n?"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = a_"+o+";\n#else\n "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = unpack_mix_"+n+"(a_"+o+", u_"+o+"_t);\n#else\n "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float u_"+o+"_t;\nattribute "+i+" "+a+" a_"+o+";\n#else\nuniform "+i+" "+r+" u_"+o+";\n#endif\n":"vec4"===n?"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+i+" "+r+" "+o+" = a_"+o+";\n#else\n "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+i+" "+r+" "+o+" = unpack_mix_"+n+"(a_"+o+", u_"+o+"_t);\n#else\n "+i+" "+r+" "+o+" = u_"+o+";\n#endif\n"})),staticAttributes:r,staticUniforms:n}}var ne=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;};function se(t){for(var e=[],i=0;i>16,s>>16],u_pixel_coord_lower:[65535&n,65535&s]}}le.prototype.draw=function(t,e,i,r,o,a,n,s,l,c,h,u,p,d,_,f,m,g){var v=t.gl;if(!this.failedToCreate){if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(o),t.setCullFace(a),s)for(var y in t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture),this.terrainUniforms)this.terrainUniforms[y].set(s[y]);for(var x in this.fixedUniforms)this.fixedUniforms[x].set(n[x]);_&&_.setUniforms(t,this.binderUniforms,p,{zoom:d});var b=0;switch(e){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1;}for(var w=0,T=u.get();w0?1-1/(1.001-n):-n),u_contrast_factor:(a=o.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:ze(o.paint.get("raster-hue-rotate"))};var a,n;};function ze(t){t*=Math.PI/180;var e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}var Pe=function(t,e,i,r,o,a,n,s,l,c){var h=o.transform;return {u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:n,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},Me=function(e,i,r,o,a,n,s,l,c,h,u){var p=a.transform;return t.extend(Pe(e,i,r,o,a,n,s,l,c,h),{u_gamma_scale:o?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+u})},Ae=function(t,e,i){return {u_matrix:t,u_opacity:e,u_color:i}},Re=function(e,i,r,o,a,n){return t.extend(function(t,e,i,r){var o=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),n=i.imageManager.getPixelSize(),s=n.width,l=n.height,c=Math.pow(2,r.tileID.overscaledZ),h=r.tileSize*Math.pow(2,i.transform.tileZoom)/c,u=h*(r.tileID.canonical.x+r.tileID.wrap*c),p=h*r.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/wt(r,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,p>>16],u_pixel_coord_lower:[65535&u,65535&p]}}(o,n,r,a),{u_matrix:e,u_opacity:i})},Le={fillExtrusion:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fillExtrusionPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}},fill:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},fillPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},fillOutline:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}},fillOutlinePattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},circle:function(e,i){return {u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},collisionBox:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}},collisionCircle:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}},debug:function(e,i){return {u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}},clippingMask:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmap:function(e,i){return {u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},heatmapTexture:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}},hillshade:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}},hillshadePrepare:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}},line:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}},lineGradient:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}},linePattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}},lineSDF:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}},raster:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}},symbolIcon:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}},symbolSDF:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},symbolTextAndIcon:function(e,i){return {u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}},background:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}},backgroundPattern:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}},terrain:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture)}},terrainDepth:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}},terrainCoords:function(e,i){return {u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id)}}},ke=function(t,e,i){this.context=t;var r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;};ke.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer);},ke.prototype.updateData=function(t){var e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);},ke.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);};var Be={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Oe=function(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;var o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;};Oe.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer);},Oe.prototype.updateData=function(t){if(t.length!==this.length)throw new Error("Length of new data is "+t.length+", which doesn't match current length of "+this.length);var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);},Oe.prototype.enableAttributes=function(t,e){for(var i=0;i0){var b=t.create(),w=v;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),u.push({circleArray:x,circleOffset:d,transform:w,invTransform:b,coord:f}),d=p+=x.length/4;}y&&h.draw(l,c.LINES,wi.disabled,Ei.disabled,e.colorModeForRenderPass(),Ci.disabled,ge(v,e.transform,m),e.style.terrain&&e.style.terrain.getTerrainData(f),r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,e.transform.zoom,null,null,y.collisionVertexBuffer);}}if(s&&u.length){var T=e.useProgram("collisionCircle"),E=new t.CollisionCircleLayoutArray;E.resize(4*p),E._trim();for(var I=0,C=0,S=u;C0){var l=t.exported.now(),c=(l-e.timeAdded)/s,h=i?(l-i.timeAdded)/s:-1,u=r.getSource(),p=a.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),_=d&&e.refreshedUponExpiration?1:t.clamp(d?c:1-h,0,1);return e.refreshedUponExpiration&&c>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-_}:{opacity:_,mix:0}}return {opacity:1,mix:0}}var Oi=new t.Color(1,0,0,1),Fi=new t.Color(0,1,0,1),Ui=new t.Color(0,0,1,1),Ni=new t.Color(1,0,1,1),Gi=new t.Color(0,1,1,1);function ji(t,e,i,r){Vi(t,0,e+i/2,t.transform.width,i,r);}function Zi(t,e,i,r){Vi(t,e-i/2,0,i,t.transform.height,r);}function Vi(t,e,i,r,o,a){var n=t.context,s=n.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,o*t.pixelRatio),n.clear({color:a}),s.disable(s.SCISSOR_TEST);}function qi(e,i,r){var o=e.context,a=o.gl,n=r.posMatrix,s=e.useProgram("debug"),l=wi.disabled,c=Ei.disabled,h=e.colorModeForRenderPass(),u="$debug",p=e.style.terrain&&e.style.terrain.getTerrainData(r);o.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE);var d=i.getTileByID(r.key).latestRawTileData,_=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,m=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=" => "+r.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var i=t.debugOverlayCanvas,r=t.context.gl,o=t.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(e,5,5),o.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE);}(e,g+" "+_+"kB"),s.draw(o,a.TRIANGLES,l,c,xi.alphaBlended,Ci.disabled,ye(n,t.Color.transparent,m),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(o,a.LINE_STRIP,l,c,h,Ci.disabled,ye(n,t.Color.red),p,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);}function Xi(t,e,i){var r=t.context,o=r.gl,a=t.colorModeForRenderPass(),n=new wi(o.LEQUAL,wi.ReadWrite,t.depthRangeFor3D),s=t.useProgram("terrain"),l=e.getTerrainMesh(),c=e.getTerrainData(i.tileID);r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]),r.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e.getRTTFramebuffer().colorAttachment.get());var h=t.transform.calculatePosMatrix(i.tileID.toUnwrapped());s.draw(r,o.TRIANGLES,n,Ei.disabled,a,Ci.backCCW,{u_matrix:h,u_texture:0},c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments);}function Wi(t,e,i,r){var o=t.context,a=i.tileSize*e.qualityFactor;i.textures[r]||(i.textures[r]=t.getTileTexture(a)||new l(o,{width:a,height:a,data:null},o.gl.RGBA),i.textures[r].bind(o.gl.LINEAR,o.gl.CLAMP_TO_EDGE),0===r&&e.sourceCache.renderHistory.unshift(i.tileID.key));var n=e.getRTTFramebuffer();n.colorAttachment.set(i.textures[r].texture),o.bindFramebuffer.set(n.framebuffer),o.viewport.set([0,0,a,a]);}var Hi=function(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init();};Hi.prototype._init=function(){var t=this,e=this.painter.style,i=e.terrain;for(var r in e.sourceCaches){this._coordsDescendingInv[r]={};for(var o=0,a=e.sourceCaches[r].getVisibleCoordinates();o=0&&(f[g.associatedIconIndex]={shiftedAnchor:E,angle:I});}else vt(g.numGlyphs,d);}if(h){_.clear();for(var S=e.icon.placedSymbolArray,D=0;D256&&this.clearStencil(),i.setColorMode(xi.disabled),i.setDepthMode(wi.disabled);var o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var a=0,n=e;a256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Ei({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},Yi.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Ei({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},Yi.prototype.stencilConfigForOverlap=function(t){var e,i=this.context.gl,r=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),o=r[r.length-1].overscaledZ,a=r[0].overscaledZ-o+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var n={},s=0;s=0;this.currentLayer--){var w=this.style._layers[o[this.currentLayer]],T=a[w.source],E=u[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,T,w,E);}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},Yi.prototype.isPatternMissing=function(t){if(!t)return !1;if(!t.from||!t.to)return !0;var e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i},Yi.prototype.useProgram=function(t,e){this.cache=this.cache||{};var i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new le(this.context,t,oe[t],e,Le[t],this._showOverdrawInspector,this.style.terrain)),this.cache[i]},Yi.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();},Yi.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);},Yi.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));},Yi.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy();};var Ji=function(t,e){this.points=t,this.planes=e;};Ji.fromInvProjectionMatrix=function(e,i,r){var o=Math.pow(2,r),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){var a=1/(r=t.transformMat4([],r,e))[3]/i*o;return t.mul$1(r,r,[a,a,1/r[3],a])})),n=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var i=t.sub([],a[e[0]],a[e[1]]),r=t.sub([],a[e[2]],a[e[1]]),o=t.normalize([],t.cross([],i,r)),n=-t.dot(o,a[e[1]]);return o.concat(n)}));return new Ji(a,n)};var Qi=function(e,i){this.min=e,this.max=i,this.center=t.scale$1([],t.add([],this.min,this.max),.5);};Qi.prototype.quadrant=function(e){for(var i=[e%2==0,e<2],r=t.clone$2(this.min),o=t.clone$2(this.max),a=0;a=0&&n++;if(0===n)return 0;n!==i.length&&(r=!1);}if(r)return 2;for(var l=0;l<3;l++){for(var c=Number.MAX_VALUE,h=-Number.MAX_VALUE,u=0;uthis.max[l]-this.min[l])return 0}return 1};var $i=function(t,e,i,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r;};$i.prototype.interpolate=function(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,r)),this},$i.prototype.getCenter=function(e,i){var r=t.clamp((this.left+e-this.right)/2,0,e),o=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(r,o)},$i.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},$i.prototype.clone=function(){return new $i(this.top,this.bottom,this.left,this.right)},$i.prototype.toJSON=function(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var tr=function(e,i,r,o,a){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===a||!!a,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==o?60:o,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $i,this._posMatrixCache={},this._alignedPosMatrixCache={};},er={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},elevation:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};tr.prototype.clone=function(){var t=new tr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},er.minZoom.get=function(){return this._minZoom},er.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));},er.maxZoom.get=function(){return this._maxZoom},er.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));},er.minPitch.get=function(){return this._minPitch},er.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t));},er.maxPitch.get=function(){return this._maxPitch},er.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t));},er.renderWorldCopies.get=function(){return this._renderWorldCopies},er.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;},er.worldSize.get=function(){return this.tileSize*this.scale},er.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},er.size.get=function(){return new t.pointGeometry(this.width,this.height)},er.bearing.get=function(){return -this.angle/Math.PI*180},er.bearing.set=function(e){var i,r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=(i=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i),function(t,e,i){var r=e[0],o=e[1],a=e[2],n=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=r*l+a*s,t[1]=o*l+n*s,t[2]=r*-s+a*l,t[3]=o*-s+n*l;}(this.rotationMatrix,this.rotationMatrix,this.angle));},er.pitch.get=function(){return this._pitch/Math.PI*180},er.pitch.set=function(e){var i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());},er.fov.get=function(){return this._fov/Math.PI*180},er.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());},er.zoom.get=function(){return this._zoom},er.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices());},er.center.get=function(){return this._center},er.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());},er.elevation.get=function(){return this._elevation},er.elevation.set=function(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices());},er.padding.get=function(){return this._edgeInsets.toJSON()},er.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());},er.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},tr.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},tr.prototype.interpolatePadding=function(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();},tr.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},tr.prototype.getVisibleUnwrappedCoordinates=function(e){var i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var r=this.pointCoordinate(new t.pointGeometry(0,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,0)),a=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),n=this.pointCoordinate(new t.pointGeometry(0,this.height)),s=Math.floor(Math.min(r.x,o.x,a.x,n.x)),l=Math.floor(Math.max(r.x,o.x,a.x,n.x)),c=s-1;c<=l+1;c++)0!==c&&i.push(new t.UnwrappedTileID(c,e));return i},tr.prototype.coveringTiles=function(e){var i,r,o=this.coveringZoomLevel(e),a=o;if(void 0!==e.minzoom&&oe.maxzoom&&(o=e.maxzoom);var n=this.pointCoordinate(this.getCameraPoint()),s=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,o),c=[l*n.x,l*n.y,0],h=[l*s.x,l*s.y,0],u=Ji.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o),p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=o);var d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,_=function(t){return {aabb:new Qi([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},f=[],m=[],g=o,v=e.reparseOverscaled?a:o;if(this._renderWorldCopies)for(var y=1;y<=3;y++)f.push(_(-y)),f.push(_(y));for(f.push(_(0));f.length>0;){var x=f.pop(),b=x.x,w=x.y,T=x.fullyVisible;if(!T){var E=x.aabb.intersects(u);if(0===E)continue;T=2===E;}var I=e.terrain?c:h,C=x.aabb.distanceX(I),S=x.aabb.distanceY(I),D=Math.max(Math.abs(C),Math.abs(S));if(x.zoom===g||D>d+(1<=p){var z=g-x.zoom,P=c[0]-.5-(b<>1),k=x.zoom+1,B=x.aabb.quadrant(A);if(e.terrain){var O=new t.OverscaledTileID(k,x.wrap,k,R,L),F=e.terrain.getMinMaxElevation(O),U=null!==(i=F.minElevation)&&void 0!==i?i:this.elevation,N=null!==(r=F.maxElevation)&&void 0!==r?r:this.elevation;B=new Qi([B.min[0],B.min[1],U],[B.max[0],B.max[1],N]);}f.push({aabb:B,zoom:k,x:R,y:L,wrap:x.wrap,fullyVisible:T});}}return m.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},tr.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();},er.unmodified.get=function(){return this._unmodified},tr.prototype.zoomScale=function(t){return Math.pow(2,t)},tr.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},tr.prototype.project=function(e){var i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)},tr.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},er.point.get=function(){return this.project(this.center)},tr.prototype.updateElevation=function(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0);},tr.prototype.getElevation=function(e,i){var r=t.MercatorCoordinate.fromLngLat(e),o=(1<n&&(o=n-m);}if(this.lngRange){var g=(s+l)/2,v=t.wrap(d.x,g-this.worldSize/2,g+this.worldSize/2),y=c.x/2;v-yl&&(r=l-y);}void 0===r&&void 0===o||(this.center=this.unproject(new t.pointGeometry(void 0!==r?r:d.x,void 0!==o?o:d.y)).wrap()),this._unmodified=h,this._constraining=!1;}},tr.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset,i=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;var o=t.identity(new Float64Array(16));t.scale(o,o,[this.width/2,-this.height/2,1]),t.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=t.identity(new Float64Array(16)),t.scale(o,o,[1,-1,1]),t.translate(o,o,[-1,-1,0]),t.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);var a=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),s=Math.sin(n)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-a-n,.01,Math.PI-.01)),l=this.getHorizon(),c=2*Math.atan(l/this.cameraToCenterDistance)*(.5+e.y/(2*l)),h=Math.sin(c)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-a-c,.01,Math.PI-.01)),u=Math.cos(Math.PI/2-this._pitch)*s+this.cameraToSeaLevelDistance,p=Math.cos(Math.PI/2-this._pitch)*h+this.cameraToSeaLevelDistance,d=1.01*Math.min(u,p),_=this.height/50;o=new Float64Array(16),t.perspective(o,this._fov,this.width/this.height,_,d),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,t.scale(o,o,[1,-1,1]),t.translate(o,o,[0,0,-this.cameraToCenterDistance]),t.rotateX(o,o,this._pitch),t.rotateZ(o,o,this.angle),t.translate(o,o,[-i,-r,0]),this.mercatorMatrix=t.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),t.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,o),t.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=t.invert([],o),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,o);var f=this.width%2/2,m=this.height%2/2,g=Math.cos(this.angle),v=Math.sin(this.angle),y=i-Math.round(i)+g*f+v*m,x=r-Math.round(r)+g*m+v*f,b=new Float64Array(o);if(t.translate(b,b,[y>.5?y-1:y,x>.5?x-1:x,0]),this.alignedProjMatrix=b,!(o=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={};}},tr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.pointGeometry(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance},tr.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))},tr.prototype.getCameraQueryGeometry=function(e){var i=this.getCameraPoint();if(1===e.length)return [e[0],i];for(var r=i.x,o=i.y,a=i.x,n=i.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1},ir.prototype._updateHashUnthrottled=function(){var t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t);}catch(t){}};var rr={linearity:.3,easing:t.bezier(0,0,.3,1)},or=t.extend({deceleration:2500,maxSpeed:1400},rr),ar=t.extend({deceleration:20,maxSpeed:1400},rr),nr=t.extend({deceleration:1e3,maxSpeed:360},rr),sr=t.extend({deceleration:1e3,maxSpeed:90},rr),lr=function(t){this._map=t,this.clear();};function cr(t,e){(!t.duration||t.duration0&&i-e[0].time>160;)e.shift();},lr.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0},r=0,o=this._inertiaBuffer;r=this._clickTolerance||this._map.fire(new ur(t.type,this._map,t));},_r.prototype.dblclick=function(t){return this._firePreventable(new ur(t.type,this._map,t))},_r.prototype.mouseover=function(t){this._map.fire(new ur(t.type,this._map,t));},_r.prototype.mouseout=function(t){this._map.fire(new ur(t.type,this._map,t));},_r.prototype.touchstart=function(t){return this._firePreventable(new pr(t.type,this._map,t))},_r.prototype.touchmove=function(t){this._map.fire(new pr(t.type,this._map,t));},_r.prototype.touchend=function(t){this._map.fire(new pr(t.type,this._map,t));},_r.prototype.touchcancel=function(t){this._map.fire(new pr(t.type,this._map,t));},_r.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return {}},_r.prototype.isEnabled=function(){return !0},_r.prototype.isActive=function(){return !1},_r.prototype.enable=function(){},_r.prototype.disable=function(){};var fr=function(t){this._map=t;};fr.prototype.reset=function(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent;},fr.prototype.mousemove=function(t){this._map.fire(new ur(t.type,this._map,t));},fr.prototype.mousedown=function(){this._delayContextMenu=!0,this._ignoreContextMenu=!1;},fr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ur("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);},fr.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new ur(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault();},fr.prototype.isEnabled=function(){return !0},fr.prototype.isActive=function(){return !1},fr.prototype.enable=function(){},fr.prototype.disable=function(){};var mr=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;};function gr(t,e){if(t.length!==e.length)throw new Error("The number of touches and points are not equal - touches "+t.length+", points "+e.length);for(var i={},r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){for(var i=new t.pointGeometry(0,0),r=0,o=e;r30)&&(this.aborted=!0);}}},vr.prototype.touchend=function(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}};var yr=function(t){this.singleTap=new vr(t),this.numTaps=t.numTaps,this.reset();};yr.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();},yr.prototype.touchstart=function(t,e,i){this.singleTap.touchstart(t,e,i);},yr.prototype.touchmove=function(t,e,i){this.singleTap.touchmove(t,e,i);},yr.prototype.touchend=function(t,e,i){var r=this.singleTap.touchend(t,e,i);if(r){var o=t.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(r)<30;if(o&&a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}};var xr=function(){this._zoomIn=new yr({numTouches:1,numTaps:2}),this._zoomOut=new yr({numTouches:2,numTaps:1}),this.reset();};xr.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();},xr.prototype.touchstart=function(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);},xr.prototype.touchmove=function(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);},xr.prototype.touchend=function(t,e,i){var r=this,o=this._zoomIn.touchend(t,e,i),a=this._zoomOut.touchend(t,e,i);return o?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(o)},{originalEvent:t})}}):a?(this._active=!0,t.preventDefault(),setTimeout((function(){return r.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}}):void 0},xr.prototype.touchcancel=function(){this.reset();},xr.prototype.enable=function(){this._enabled=!0;},xr.prototype.disable=function(){this._enabled=!1,this.reset();},xr.prototype.isEnabled=function(){return this._enabled},xr.prototype.isActive=function(){return this._active};var br={0:1,2:2},wr=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1;};wr.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton;},wr.prototype._correctButton=function(t,e){return !1},wr.prototype._move=function(t,e){return {}},wr.prototype.mousedown=function(t,e){if(!this._lastPoint){var i=a.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i);}},wr.prototype.mousemoveWindow=function(t,e){var i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){var i=br[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)0&&(this._active=!0);var o=gr(r,i),a=new t.pointGeometry(0,0),n=new t.pointGeometry(0,0),s=0;for(var l in o){var c=o[l],h=this._touches[l];h&&(a._add(c),n._add(c.sub(h)),s++,o[l]=c);}if(this._touches=o,!(sMath.abs(t.x)}var Lr=function(t){function e(e){t.call(this),this._map=e;}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints;},e.prototype.touchstart=function(e,i,r){t.prototype.touchstart.call(this,e,i,r),this._currentTouchCount=r.length;},e.prototype._start=function(t){this._lastPoints=t,Rr(t[0].sub(t[1]))&&(this._valid=!1);},e.prototype._move=function(t,e,i){if(!(this._map._cooperativeGestures&&this._currentTouchCount<3)){var r=t[0].sub(this._lastPoints[0]),o=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,o,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+o.y)/2*-.5}}},e.prototype.gestureBeginsVertically=function(t,e,i){if(void 0!==this._valid)return this._valid;var r=t.mag()>=2,o=e.mag()>=2;if(r||o){if(!r||!o)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var a=t.y>0==e.y>0;return Rr(t)&&Rr(e)&&a}},e}(Sr),kr={panStep:100,bearingStep:15,pitchStep:10},Br=function(){var t=kr;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1;};function Or(t){return t*(2-t)}Br.prototype.reset=function(){this._active=!1;},Br.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var i=0,r=0,o=0,a=0,n=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),n=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(r=0,o=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Or,zoom:i?Math.round(l)+i*(t.shiftKey?2:1):l,bearing:s.getBearing()+r*e._bearingStep,pitch:s.getPitch()+o*e._pitchStep,offset:[-a*e._panStep,-n*e._panStep],center:s.getCenter()},{originalEvent:t});}}}},Br.prototype.enable=function(){this._enabled=!0;},Br.prototype.disable=function(){this._enabled=!1,this.reset();},Br.prototype.isEnabled=function(){return this._enabled},Br.prototype.isActive=function(){return this._active},Br.prototype.disableRotation=function(){this._rotationDisabled=!0;},Br.prototype.enableRotation=function(){this._rotationDisabled=!1;};var Fr=4.000244140625,Ur=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this);};Ur.prototype.setZoomRate=function(t){this._defaultZoomRate=t;},Ur.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t;},Ur.prototype.isEnabled=function(){return !!this._enabled},Ur.prototype.isActive=function(){return !!this._active||void 0!==this._finishTimeout},Ur.prototype.isZooming=function(){return !!this._zooming},Ur.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around);},Ur.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},Ur.prototype.wheel=function(e){if(this.isEnabled()){if(this._map._cooperativeGestures){if(!this._map._metaPress)return;e.preventDefault();}var i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=t.exported.now(),o=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Fr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault();}},Ur.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t);},Ur.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var i=a.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}},Ur.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform;if(0!==this._delta){var r="wheel"===this._type&&Math.abs(this._delta)>Fr?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==o&&(o=1/o);var a="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(a*o))),"wheel"===this._type&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}var n,s="number"==typeof this._targetZoom?this._targetZoom:i.zoom,l=this._startZoom,c=this._easing,h=!1;if("wheel"===this._type&&l&&c){var u=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),p=c(u);n=t.number(l,s,p),u<1?this._frameId||(this._frameId=!0):h=!0;}else n=s,h=!0;return this._active=!0,h&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!h,zoomDelta:n-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},Ur.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var r=this._prevEase,o=(t.exported.now()-r.start)/r.duration,a=r.easing(o+.01)-r.easing(o),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);i=t.bezier(n,s,.25,1);}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i},Ur.prototype.reset=function(){this._active=!1;};var Nr=function(t,e){this._clickZoom=t,this._tapZoom=e;};Nr.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable();},Nr.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable();},Nr.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Nr.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var Gr=function(){this.reset();};Gr.prototype.reset=function(){this._active=!1;},Gr.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t});}}},Gr.prototype.enable=function(){this._enabled=!0;},Gr.prototype.disable=function(){this._enabled=!1,this.reset();},Gr.prototype.isEnabled=function(){return this._enabled},Gr.prototype.isActive=function(){return this._active};var jr=function(){this._tap=new yr({numTouches:1,numTaps:1}),this.reset();};jr.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset();},jr.prototype.touchstart=function(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i));},jr.prototype.touchmove=function(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var r=e[0],o=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(t,e,i);},jr.prototype.touchend=function(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp);},jr.prototype.touchcancel=function(){this.reset();},jr.prototype.enable=function(){this._enabled=!0;},jr.prototype.disable=function(){this._enabled=!1,this.reset();},jr.prototype.isEnabled=function(){return this._enabled},jr.prototype.isActive=function(){return this._active};var Zr=function(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;};Zr.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");},Zr.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");},Zr.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},Zr.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var Vr=function(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;};Vr.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable();},Vr.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable();},Vr.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},Vr.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var qr=function(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0;};qr.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");},qr.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");},qr.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},qr.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},qr.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable();},qr.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();};var Xr=function(t){return t.zoom||t.drag||t.pitch||t.rotate},Wr=function(t){function e(){t.apply(this,arguments);}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function Hr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var Kr=function(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new lr(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);var r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(var o=0,n=this._listeners;oa?Math.min(2,b):Math.max(.5,b),w=Math.pow(m,1-e),T=o.unproject(y.add(x.mult(e*w)).mult(f));o.setLocationAtPoint(o.renderWorldCopies?T.wrap():T,_);}r._fireMoveEvents(i);}),(function(t){r._afterEase(i,t);}),e),this},i.prototype._prepareEase=function(e,i,r){void 0===r&&(r={}),this._moving=!0,this.fire(new t.Event("freezeElevation",{freeze:!0})),i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e));},i.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e));},i.prototype._afterEase=function(e,i){if(!this._easeId||!i||this._easeId!==i){delete this._easeId,this.fire(new t.Event("freezeElevation",{freeze:!1}));var r=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),o&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e));}},i.prototype.flyTo=function(e,i){var r=this;if(!e.essential&&t.exported.prefersReducedMotion){var o=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,n=this.getZoom(),s=this.getBearing(),l=this.getPitch(),c=this.getPadding(),h="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):n,u="bearing"in e?this._normalizeBearing(e.bearing,s):s,p="pitch"in e?+e.pitch:l,d="padding"in e?e.padding:a.padding,_=a.zoomScale(h-n),f=t.pointGeometry.convert(e.offset),m=a.centerPoint.add(f),g=a.pointLocation(m),v=t.LngLat.convert(e.center||g);this._normalizeCenter(v);var y=a.project(g),x=a.project(v).sub(y),b=e.curve,w=Math.max(a.width,a.height),T=w/_,E=x.mag();if("minZoom"in e){var I=t.clamp(Math.min(e.minZoom,n,h),a.minZoom,a.maxZoom),C=w/a.zoomScale(I-n);b=Math.sqrt(C/E*2);}var S=b*b;function D(t){var e=(T*T-w*w+(t?-1:1)*S*S*E*E)/(2*(t?T:w)*S*E);return Math.log(Math.sqrt(e*e+1)-e)}function z(t){return (Math.exp(t)-Math.exp(-t))/2}function P(t){return (Math.exp(t)+Math.exp(-t))/2}var M=D(0),A=function(t){return P(M)/P(M+b*t)},R=function(t){return w*((P(M)*(z(e=M+b*t)/P(e))-z(M))/S)/E;var e;},L=(D(1)-M)/b;if(Math.abs(E)<1e-6||!isFinite(L)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,i);var k=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==u,this._pitching=p!==l,this._padding=!a.isPaddingEqual(d),this._prepareEase(i,!1),this._ease((function(e){var o=e*L,_=1/A(o);a.zoom=1===e?h:n+a.scaleZoom(_),r._rotating&&(a.bearing=t.number(s,u,e)),r._pitching&&(a.pitch=t.number(l,p,e)),r._padding&&(a.interpolatePadding(c,d,e),m=a.centerPoint.add(f));var g=1===e?v:a.unproject(y.add(x.mult(R(o))).mult(_));a.setLocationAtPoint(a.renderWorldCopies?g.wrap():g,m),r._fireMoveEvents(i);}),(function(){return r._afterEase(i)}),e),this},i.prototype.isEasing=function(){return !!this._easeFrameId},i.prototype.stop=function(){return this._stop()},i.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,e);}if(!t){var r=this.handlers;r&&r.stop(!1);}return this},i.prototype._ease=function(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));},i.prototype._renderFrameCallback=function(){var e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();},i.prototype._normalizeBearing=function(e,i){e=t.wrap(e,-180,180);var r=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0;}},i}(t.Evented),Jr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this);};Jr.prototype.getDefaultPosition=function(){return "bottom-right"},Jr.prototype.onAdd=function(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=a.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=a.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container},Jr.prototype.onRemove=function(){a.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0;},Jr.prototype._setElementTitle=function(t,e){var i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i);},Jr.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")));},Jr.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions();},Jr.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((function(t){return "string"!=typeof t?"":t}))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id;}var i=this._map.style.sourceCaches;for(var r in i){var o=i[r];if(o.used||o.usedForTerrain){var a=o.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution);}}(t=t.filter((function(t){return String(t).trim()}))).sort((function(t,e){return t.length-e.length}));var n=(t=t.filter((function(e,i){for(var r=i+1;r=0)return !1;return !0}))).join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null);}},Jr.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"));},Jr.prototype._updateCompactMinimize=function(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show");};var Qr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateCompact"],this);};Qr.prototype.getDefaultPosition=function(){return "bottom-left"},Qr.prototype.onAdd=function(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=a.create("div","maplibregl-ctrl mapboxgl-ctrl");var e=a.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Qr.prototype.onRemove=function(){a.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0;},Qr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact");}};var $r=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;};$r.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},$r.prototype.remove=function(t){for(var e=this._currentlyRunning,i=0,r=e?this._queue.concat(e):this._queue;ie.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");var a=new tr(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(i.call(this,a,{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new $r,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},to,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(r=e.pixelRatio)&&void 0!==r?r:devicePixelRatio,this._requestManager=new n(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else {if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container;}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return o._update(!1)})),this.on("moveend",(function(){return o._update(!1)})),this.on("zoom",(function(){return o._update(!0)})),this.on("terrain",(function(){o.painter.terrainFacilitator.dirty=!0,o._update(!0);})),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Kr(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new ir("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Jr({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new Qr,e.logoPosition),this.on("style.load",(function(){o.transform.unmodified&&o.jumpTo(o.style.stylesheet);})),this.on("data",(function(e){o._update("style"===e.dataType),o.fire(new t.Event(e.dataType+"data",e));})),this.on("dataloading",(function(e){o.fire(new t.Event(e.dataType+"dataloading",e));})),this.on("dataabort",(function(e){o.fire(new t.Event("sourcedataabort",e));}));}i&&(r.__proto__=i),(r.prototype=Object.create(i&&i.prototype)).constructor=r;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return r.prototype._getMapId=function(){return this._mapId},r.prototype.addControl=function(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=e.onAdd(this);this._controls.push(e);var o=this._controlPositions[i];return -1!==i.indexOf("bottom")?o.insertBefore(r,o.firstChild):o.appendChild(r),this},r.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this},r.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},r.prototype.calculateCameraOptionsFromTo=function(t,e,r,o){return null==o&&this.style.terrain&&(o=this.transform.getElevation(r,this.style.terrain)),i.prototype.calculateCameraOptionsFromTo.call(this,t,e,r,o)},r.prototype.resize=function(e){var i=this._containerDimensions(),r=i[0],o=i[1];this._resizeCanvas(r,o,this.getPixelRatio()),this.transform.resize(r,o),this.painter.resize(r,o,this.getPixelRatio());var a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this},r.prototype.getPixelRatio=function(){return this._pixelRatio},r.prototype.setPixelRatio=function(t){var e=this._containerDimensions(),i=e[0],r=e[1];this._pixelRatio=t,this._resizeCanvas(i,r,t),this.painter.resize(i,r,t);},r.prototype.getBounds=function(){return this.transform.getBounds()},r.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},r.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},r.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},r.prototype.getMaxZoom=function(){return this.transform.maxZoom},r.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()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;throw new Error("maxPitch must be greater than the current minPitch")},r.prototype.getMaxPitch=function(){return this.transform.maxPitch},r.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},r.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},r.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.style.terrain)},r.prototype.unproject=function(e){return this.transform.pointLocation(t.pointGeometry.convert(e),this.style&&this.style.terrain)},r.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},r.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},r.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},r.prototype._createDelegatedListener=function(t,e,i){var r,o=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return {layer:e,listener:i,delegates:{mousemove:function(r){var n=o.getLayer(e)?o.queryRenderedFeatures(r.point,{layers:[e]}):[];n.length?a||(a=!0,i.call(o,new ur(t,o,r.originalEvent,{features:n}))):a=!1;},mouseout:function(){a=!1;}}}}if("mouseleave"===t||"mouseout"===t){var n=!1;return {layer:e,listener:i,delegates:{mousemove:function(r){(o.getLayer(e)?o.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(o,new ur(t,o,r.originalEvent)));},mouseout:function(e){n&&(n=!1,i.call(o,new ur(t,o,e.originalEvent)));}}}}return {layer:e,listener:i,delegates:(r={},r[t]=function(t){var r=o.getLayer(e)?o.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,i.call(o,t),delete t.features);},r)}},r.prototype.on=function(t,e,r){if(void 0===r)return i.prototype.on.call(this,t,e);var o=this._createDelegatedListener(t,e,r);for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o),o.delegates)this.on(a,o.delegates[a]);return this},r.prototype.once=function(t,e,r){if(void 0===r)return i.prototype.once.call(this,t,e);var o=this._createDelegatedListener(t,e,r);for(var a in o.delegates)this.once(a,o.delegates[a]);return this},r.prototype.off=function(t,e,r){var o=this;return void 0===r?i.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(i){for(var a=i[t],n=0;n\n
'+("boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map")+"
\n ",document.addEventListener("keydown",(function(e){e.key===i&&(t._metaPress=!0);})),document.addEventListener("keyup",(function(e){e.key===i&&(t._metaPress=!1);})),this._canvasContainer.addEventListener("wheel",(function(e){t._onCooperativeGesture(e,t._metaPress,1);}),!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan");},r.prototype._resizeCanvas=function(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=t+"px",this._canvas.style.height=e+"px";},r.prototype._setupPainter=function(){var i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);r?(this.painter=new Yi(r,this.transform),t.exported$1.testSupport(r)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")));},r.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}));},r.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}));},r.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},r.prototype._onCooperativeGesture=function(t,e,i){var r=this;return !e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((function(){r._cooperativeGesturesScreen.classList.remove("maplibregl-show");}),100)),!1},r.prototype.loaded=function(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},r.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},r.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},r.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t);},r.prototype._render=function(e){var i,r=this,o=0,a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,i),o=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),!this._removed){var n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,l=t.exported.now();this.style.zoomHistory.update(s,l);var c=new t.EvaluationParameters(s,{now:l,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),h=c.crossFadingFactor();1===h&&h===this._crossFadingFactor||(n=!0,this._crossFadingFactor=h),this.style.update(c);}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var u=t.exported.now()-o;a.endQueryEXT(a.TIME_ELAPSED_EXT,i),setTimeout((function(){var e=a.getQueryObjectEXT(i,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(i),r.fire(new t.Event("gpu-timing-frame",{cpuTime:u,gpuTime:e}));}),50);}if(this.listens("gpu-timing-layer")){var p=this.painter.collectGpuTimers();setTimeout((function(){var e=r.painter.queryGpuTimers(p);r.fire(new t.Event("gpu-timing-layer",{layerTimes:e}));}),50);}var d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}},r.prototype.redraw=function(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this},r.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,i=this._controls;e180;){var s=r.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=r.width&&s.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360;}return e}ao.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),a.disableDrag();},ao.prototype.move=function(t,e){var i=this.map,r=this.mouseRotate.mousemoveWindow(t,e);if(r&&r.bearingDelta&&i.setBearing(i.getBearing()+r.bearingDelta),this.mousePitch){var o=this.mousePitch.mousemoveWindow(t,e);o&&o.pitchDelta&&i.setPitch(i.getPitch()+o.pitchDelta);}},ao.prototype.off=function(){var t=this.element;a.removeEventListener(t,"mousedown",this.mousedown),a.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(t,"touchmove",this.touchmove),a.removeEventListener(t,"touchend",this.touchend),a.removeEventListener(t,"touchcancel",this.reset),this.offTemp();},ao.prototype.offTemp=function(){a.enableDrag(),a.removeEventListener(window,"mousemove",this.mousemove),a.removeEventListener(window,"mouseup",this.mouseup);},ao.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),a.mousePos(this.element,e)),a.addEventListener(window,"mousemove",this.mousemove),a.addEventListener(window,"mouseup",this.mouseup);},ao.prototype.mousemove=function(t){this.move(t,a.mousePos(this.element,t));},ao.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp();},ao.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos));},ao.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=a.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos));},ao.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)20*i?"0.2":"1.0",e._opacityTimeout=null;}),100));}},i.prototype.getOffset=function(){return this._offset},i.prototype.setOffset=function(e){return this._offset=t.pointGeometry.convert(e),this._update(),this},i.prototype._onMove=function(e){if(!this._isDragging){var i=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=i;}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")));},i.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive";},i.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp));},i.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},i.prototype.isDraggable=function(){return this._draggable},i.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},i.prototype.getRotation=function(){return this._rotation},i.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},i.prototype.getRotationAlignment=function(){return this._rotationAlignment},i.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},i.prototype.getPitchAlignment=function(){return this._pitchAlignment},i}(t.Evented),uo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},po=0,_o=!1,fo=function(e){function i(i){e.call(this),this.options=t.extend({},uo,i),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this);}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.onAdd=function(t){var e;return this._map=t,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==co?e(co):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((function(t){e(co="denied"!==t.state);})):(co=!!window.navigator.geolocation,e(co)),this._container},i.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,po=0,_o=!1;},i.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())},i.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState "+this._watchState)}},i.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState "+this._watchState)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish();}},i.prototype._updateCamera=function(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,o=this._map.getBearing(),a=t.extend({bearing:o},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),a,{geolocateSource:!0});},i.prototype._updateMarker=function(e){if(e){var i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();},i.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),r=e.distanceTo(i),o=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=o+"px",this._circleElement.style.height=o+"px";},i.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();},i.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===e.code&&_o)return;this._setErrorState();}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish();}},i.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;},i.prototype._setupUI=function(e){var i=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=a.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),a.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.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.title=r,this._geolocateButton.setAttribute("aria-label",r);}else {var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ho(this._dotElement),this._circleElement=a.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ho({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==i._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(i._watchState="BACKGROUND",i._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),i._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),i.fire(new t.Event("trackuserlocationend")));}));},i.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":po--,_o=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState "+this._watchState)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState "+this._watchState)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++po>1?(e={maximumAge:6e5,timeout:0},_o=!0):(e=this.options.positionOptions,_o=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0},i.prototype._clearWatch=function(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null);},i}(t.Evented),mo={maxWidth:100,unit:"metric"},go=function(e){this.options=t.extend({},mo,e),t.bindAll(["_onMove","setUnit"],this);};function vo(t,e,i){var r=i&&i.maxWidth||100,o=t._container.clientHeight/2,a=t.unproject([0,o]),n=t.unproject([r,o]),s=a.distanceTo(n);if(i&&"imperial"===i.unit){var l=3.2808*s;l>5280?yo(e,r,l/5280,t._getUIString("ScaleControl.Miles")):yo(e,r,l,t._getUIString("ScaleControl.Feet"));}else i&&"nautical"===i.unit?yo(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?yo(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers")):yo(e,r,s,t._getUIString("ScaleControl.Meters"));}function yo(t,e,i,r){var o,a,n,s=(o=i,(a=Math.pow(10,(""+Math.floor(o)).length-1))*(n=(n=o/a)>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(n)));t.style.width=e*(s/i)+"px",t.innerHTML=s+" "+r;}go.prototype.getDefaultPosition=function(){return "bottom-left"},go.prototype._onMove=function(){vo(this._map,this._container,this.options);},go.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},go.prototype.onRemove=function(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0;},go.prototype.setUnit=function(t){this.options.unit=t,vo(this._map,this._container,this.options);};var xo=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange");};xo.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=a.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},xo.prototype.onRemove=function(){a.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon);},xo.prototype._checkFullscreenSupport=function(){return !!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)},xo.prototype._setupUI=function(){var t=this._fullscreenButton=a.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);a.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon);},xo.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t;},xo.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},xo.prototype._isFullscreen=function(){return this._fullscreen},xo.prototype._changeIcon=function(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle());},xo.prototype._onClickFullscreen=function(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen();};var bo=function(e){this.options=e,t.bindAll(["_toggleTerrain","_updateTerrainIcon"],this);};bo.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=a.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),a.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container},bo.prototype.onRemove=function(){a.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0;},bo.prototype._toggleTerrain=function(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon();},bo.prototype._updateTerrainIcon=function(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"));};var wo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},To=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Eo=function(e){function i(i){e.call(this),this.options=t.extend(Object.create(wo),i),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this);}return e&&(i.__proto__=e),(i.prototype=Object.create(e&&e.prototype)).constructor=i,i.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},i.prototype.isOpen=function(){return !!this._map},i.prototype.remove=function(){return this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this},i.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this},i.prototype.getElement=function(){return this._container},i.prototype.setText=function(t){return this.setDOMContent(document.createTextNode(t))},i.prototype.setHTML=function(t){var e,i=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=t;e=r.firstChild;)i.appendChild(e);return this.setDOMContent(i)},i.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},i.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},i.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=a.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},i.prototype.addClassName=function(t){this._container&&this._container.classList.add(t);},i.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t);},i.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},i.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},i.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=a.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose));},i.prototype._onMouseUp=function(t){this._update(t.point);},i.prototype._onMouseMove=function(t){this._update(t.point);},i.prototype._onDrag=function(t){this._update(t.point);},i.prototype._update=function(t){var e=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=a.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return e._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=no(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||t)){var i=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat),r=this.options.anchor,o=Io(this.options.offset);if(!r){var n,s=this._container.offsetWidth,l=this._container.offsetHeight;n=i.y+o.bottom.ythis._map.transform.height-l?["bottom"]:[],i.xthis._map.transform.width-s/2&&n.push("right"),r=0===n.length?"bottom":n.join("-");}var c=i.add(o[r]).round();a.setTransform(this._container,so[r]+" translate("+c.x+"px,"+c.y+"px)"),lo(this._container,r,"popup");}},i.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(To);t&&t.focus();}},i.prototype._onClose=function(){this.remove();},i}(t.Evented);function Io(e){if(e){if("number"==typeof e){var i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return {center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-left":new t.pointGeometry(i,i),"top-right":new t.pointGeometry(-i,i),bottom:new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(i,-i),"bottom-right":new t.pointGeometry(-i,-i),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){var r=t.pointGeometry.convert(e);return {center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return {center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0])}}return Io(new t.pointGeometry(0,0))}var Co={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:io,NavigationControl:oo,GeolocateControl:fo,AttributionControl:Jr,LogoControl:Qr,ScaleControl:go,FullscreenControl:xo,TerrainControl:bo,Popup:Eo,Marker:ho,Style:ie,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:A,GeoJSONSource:D,ImageSource:P,RasterDEMTileSource:S,RasterTileSource:C,VectorTileSource:I,VideoSource:M,prewarm:function(){W().acquire(Z);},clearPrewarmedResources:function(){var t=q;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Z),q=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 version(){return "2.4.0"},get workerCount(){return V.workerCount},set workerCount(t){V.workerCount=t;},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e;},clearStorage:function(e){t.clearTileCache(e);},workerUrl:"",addProtocol:function(e,i){t.config.REGISTERED_PROTOCOLS[e]=i;},removeProtocol:function(e){delete t.config.REGISTERED_PROTOCOLS[e];}};return function(e){for(var i=[],r=arguments.length-1;r-- >0;)i[r]=arguments[r+1];t.extend.apply(void 0,[e].concat(i));}(Co,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),Co})); + ) + (u = + (255 & t.charCodeAt(l)) | + ((255 & t.charCodeAt(++l)) << 8) | + ((255 & t.charCodeAt(++l)) << 16) | + ((255 & t.charCodeAt(++l)) << 24)), + ++l, + (i = + 27492 + + (65535 & + (a = + (5 * + (65535 & + (i = + ((i ^= u = + ((65535 & + (u = + ((u = + ((65535 & u) * o + + ((((u >>> 16) * o) & 65535) << 16)) & + 4294967295) << + 15) | + (u >>> 17))) * + s + + ((((u >>> 16) * s) & 65535) << 16)) & + 4294967295) << + 13) | + (i >>> 19))) + + (((5 * (i >>> 16)) & 65535) << 16)) & + 4294967295)) + + (((58964 + (a >>> 16)) & 65535) << 16)); + switch (((u = 0), r)) { + case 3: + u ^= (255 & t.charCodeAt(l + 2)) << 16; + case 2: + u ^= (255 & t.charCodeAt(l + 1)) << 8; + case 1: + i ^= u = + ((65535 & + (u = + ((u = + ((65535 & (u ^= 255 & t.charCodeAt(l))) * o + + ((((u >>> 16) * o) & 65535) << 16)) & + 4294967295) << + 15) | + (u >>> 17))) * + s + + ((((u >>> 16) * s) & 65535) << 16)) & + 4294967295; + } + return ( + (i ^= t.length), + (i = + (2246822507 * (65535 & (i ^= i >>> 16)) + + (((2246822507 * (i >>> 16)) & 65535) << 16)) & + 4294967295), + (i = + (3266489909 * (65535 & (i ^= i >>> 13)) + + (((3266489909 * (i >>> 16)) & 65535) << 16)) & + 4294967295), + (i ^= i >>> 16) >>> 0 + ); + }; + var La = { exports: {} }; + La.exports = function (t, e) { + for (var r, n = t.length, i = e ^ n, a = 0; n >= 4; ) + (r = + 1540483477 * + (65535 & + (r = + (255 & t.charCodeAt(a)) | + ((255 & t.charCodeAt(++a)) << 8) | + ((255 & t.charCodeAt(++a)) << 16) | + ((255 & t.charCodeAt(++a)) << 24))) + + (((1540483477 * (r >>> 16)) & 65535) << 16)), + (i = + (1540483477 * (65535 & i) + + (((1540483477 * (i >>> 16)) & 65535) << 16)) ^ + (r = + 1540483477 * (65535 & (r ^= r >>> 24)) + + (((1540483477 * (r >>> 16)) & 65535) << 16))), + (n -= 4), + ++a; + switch (n) { + case 3: + i ^= (255 & t.charCodeAt(a + 2)) << 16; + case 2: + i ^= (255 & t.charCodeAt(a + 1)) << 8; + case 1: + i = + 1540483477 * (65535 & (i ^= 255 & t.charCodeAt(a))) + + (((1540483477 * (i >>> 16)) & 65535) << 16); + } + return ( + (i = + 1540483477 * (65535 & (i ^= i >>> 13)) + + (((1540483477 * (i >>> 16)) & 65535) << 16)), + (i ^= i >>> 15) >>> 0 + ); + }; + var Da = Oa.exports, + ja = La.exports; + (Fa.exports = Da), (Fa.exports.murmur3 = Da), (Fa.exports.murmur2 = ja); + var Ra = function () { + (this.ids = []), (this.positions = []), (this.indexed = !1); + }; + function Ua(t) { + var e = +t; + return !isNaN(e) && e <= Number.MAX_SAFE_INTEGER + ? e + : Fa.exports(String(t)); + } + function qa(t, e, r, n) { + for (; r < n; ) { + for (var i = t[(r + n) >> 1], a = r - 1, o = n + 1; ; ) { + do { + a++; + } while (t[a] < i); + do { + o--; + } while (t[o] > i); + if (a >= o) break; + Na(t, a, o), + Na(e, 3 * a, 3 * o), + Na(e, 3 * a + 1, 3 * o + 1), + Na(e, 3 * a + 2, 3 * o + 2); + } + o - r < n - o + ? (qa(t, e, r, o), (r = o + 1)) + : (qa(t, e, o + 1, n), (n = o)); + } + } + function Na(t, e, r) { + var n = t[e]; + (t[e] = t[r]), (t[r] = n); + } + (Ra.prototype.add = function (t, e, r, n) { + this.ids.push(Ua(t)), this.positions.push(e, r, n); + }), + (Ra.prototype.getPositions = function (t) { + if (!this.indexed) + throw new Error( + 'Trying to get index, but feature positions are not indexed', + ); + for (var e = Ua(t), r = 0, n = this.ids.length - 1; r < n; ) { + var i = (r + n) >> 1; + this.ids[i] >= e ? (n = i) : (r = i + 1); + } + for (var a = []; this.ids[r] === e; ) + a.push({ + index: this.positions[3 * r], + start: this.positions[3 * r + 1], + end: this.positions[3 * r + 2], + }), + r++; + return a; + }), + (Ra.serialize = function (t, e) { + var r = new Float64Array(t.ids), + n = new Uint32Array(t.positions); + return ( + qa(r, n, 0, r.length - 1), + e && e.push(r.buffer, n.buffer), + { ids: r, positions: n } + ); + }), + (Ra.deserialize = function (t) { + var e = new Ra(); + return ( + (e.ids = t.ids), (e.positions = t.positions), (e.indexed = !0), e + ); + }), + qn('FeaturePositionMap', Ra); + var Za = function (t, e) { + (this.gl = t.gl), (this.location = e); + }, + Ka = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = 0); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + this.current !== t && + ((this.current = t), this.gl.uniform1i(this.location, t)); + }), + e + ); + })(Za), + Ga = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = 0); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + this.current !== t && + ((this.current = t), this.gl.uniform1f(this.location, t)); + }), + e + ); + })(Za), + Ja = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = [0, 0]); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + (t[0] === this.current[0] && t[1] === this.current[1]) || + ((this.current = t), + this.gl.uniform2f(this.location, t[0], t[1])); + }), + e + ); + })(Za), + Xa = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = [0, 0, 0]); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + (t[0] === this.current[0] && + t[1] === this.current[1] && + t[2] === this.current[2]) || + ((this.current = t), + this.gl.uniform3f(this.location, t[0], t[1], t[2])); + }), + e + ); + })(Za), + Ya = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = [0, 0, 0, 0]); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + (t[0] === this.current[0] && + t[1] === this.current[1] && + t[2] === this.current[2] && + t[3] === this.current[3]) || + ((this.current = t), + this.gl.uniform4f(this.location, t[0], t[1], t[2], t[3])); + }), + e + ); + })(Za), + Ha = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = Yt.transparent); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + (t.r === this.current.r && + t.g === this.current.g && + t.b === this.current.b && + t.a === this.current.a) || + ((this.current = t), + this.gl.uniform4f(this.location, t.r, t.g, t.b, t.a)); + }), + e + ); + })(Za), + Wa = new Float32Array(16), + $a = (function (t) { + function e(e, r) { + t.call(this, e, r), (this.current = Wa); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + if (t[12] !== this.current[12] || t[0] !== this.current[0]) + return ( + (this.current = t), + void this.gl.uniformMatrix4fv(this.location, !1, t) + ); + for (var e = 1; e < 16; e++) + if (t[e] !== this.current[e]) { + (this.current = t), + this.gl.uniformMatrix4fv(this.location, !1, t); + break; + } + }), + e + ); + })(Za); + function Qa(t) { + return [Va(255 * t.r, 255 * t.g), Va(255 * t.b, 255 * t.a)]; + } + var to = function (t, e, r) { + (this.value = t), + (this.uniformNames = e.map(function (t) { + return 'u_' + t; + })), + (this.type = r); + }; + (to.prototype.setUniform = function (t, e, r) { + t.set(r.constantOr(this.value)); + }), + (to.prototype.getBinding = function (t, e, r) { + return 'color' === this.type ? new Ha(t, e) : new Ga(t, e); + }); + var eo = function (t, e) { + (this.uniformNames = e.map(function (t) { + return 'u_' + t; + })), + (this.patternFrom = null), + (this.patternTo = null), + (this.pixelRatioFrom = 1), + (this.pixelRatioTo = 1); + }; + (eo.prototype.setConstantPatternPositions = function (t, e) { + (this.pixelRatioFrom = e.pixelRatio), + (this.pixelRatioTo = t.pixelRatio), + (this.patternFrom = e.tlbr), + (this.patternTo = t.tlbr); + }), + (eo.prototype.setUniform = function (t, e, r, n) { + var i = + 'u_pattern_to' === n + ? this.patternTo + : 'u_pattern_from' === n + ? this.patternFrom + : 'u_pixel_ratio_to' === n + ? this.pixelRatioTo + : 'u_pixel_ratio_from' === n + ? this.pixelRatioFrom + : null; + i && t.set(i); + }), + (eo.prototype.getBinding = function (t, e, r) { + return 'u_pattern' === r.substr(0, 9) ? new Ya(t, e) : new Ga(t, e); + }); + var ro = function (t, e, r, n) { + (this.expression = t), + (this.type = r), + (this.maxValue = 0), + (this.paintVertexAttributes = e.map(function (t) { + return { + name: 'a_' + t, + type: 'Float32', + components: 'color' === r ? 2 : 1, + offset: 0, + }; + })), + (this.paintVertexArray = new n()); + }; + (ro.prototype.populatePaintArray = function (t, e, r, n, i) { + var a = this.paintVertexArray.length, + o = this.expression.evaluate(new fi(0), e, {}, n, [], i); + this.paintVertexArray.resize(t), this._setPaintValue(a, t, o); + }), + (ro.prototype.updatePaintArray = function (t, e, r, n) { + var i = this.expression.evaluate({ zoom: 0 }, r, n); + this._setPaintValue(t, e, i); + }), + (ro.prototype._setPaintValue = function (t, e, r) { + if ('color' === this.type) + for (var n = Qa(r), i = t; i < e; i++) + this.paintVertexArray.emplace(i, n[0], n[1]); + else { + for (var a = t; a < e; a++) this.paintVertexArray.emplace(a, r); + this.maxValue = Math.max(this.maxValue, Math.abs(r)); + } + }), + (ro.prototype.upload = function (t) { + this.paintVertexArray && + this.paintVertexArray.arrayBuffer && + (this.paintVertexBuffer && this.paintVertexBuffer.buffer + ? this.paintVertexBuffer.updateData(this.paintVertexArray) + : (this.paintVertexBuffer = t.createVertexBuffer( + this.paintVertexArray, + this.paintVertexAttributes, + this.expression.isStateDependent, + ))); + }), + (ro.prototype.destroy = function () { + this.paintVertexBuffer && this.paintVertexBuffer.destroy(); + }); + var no = function (t, e, r, n, i, a) { + (this.expression = t), + (this.uniformNames = e.map(function (t) { + return 'u_' + t + '_t'; + })), + (this.type = r), + (this.useIntegerZoom = n), + (this.zoom = i), + (this.maxValue = 0), + (this.paintVertexAttributes = e.map(function (t) { + return { + name: 'a_' + t, + type: 'Float32', + components: 'color' === r ? 4 : 2, + offset: 0, + }; + })), + (this.paintVertexArray = new a()); + }; + (no.prototype.populatePaintArray = function (t, e, r, n, i) { + var a = this.expression.evaluate(new fi(this.zoom), e, {}, n, [], i), + o = this.expression.evaluate(new fi(this.zoom + 1), e, {}, n, [], i), + s = this.paintVertexArray.length; + this.paintVertexArray.resize(t), this._setPaintValue(s, t, a, o); + }), + (no.prototype.updatePaintArray = function (t, e, r, n) { + var i = this.expression.evaluate({ zoom: this.zoom }, r, n), + a = this.expression.evaluate({ zoom: this.zoom + 1 }, r, n); + this._setPaintValue(t, e, i, a); + }), + (no.prototype._setPaintValue = function (t, e, r, n) { + if ('color' === this.type) + for (var i = Qa(r), a = Qa(n), o = t; o < e; o++) + this.paintVertexArray.emplace(o, i[0], i[1], a[0], a[1]); + else { + for (var s = t; s < e; s++) this.paintVertexArray.emplace(s, r, n); + this.maxValue = Math.max(this.maxValue, Math.abs(r), Math.abs(n)); + } + }), + (no.prototype.upload = function (t) { + this.paintVertexArray && + this.paintVertexArray.arrayBuffer && + (this.paintVertexBuffer && this.paintVertexBuffer.buffer + ? this.paintVertexBuffer.updateData(this.paintVertexArray) + : (this.paintVertexBuffer = t.createVertexBuffer( + this.paintVertexArray, + this.paintVertexAttributes, + this.expression.isStateDependent, + ))); + }), + (no.prototype.destroy = function () { + this.paintVertexBuffer && this.paintVertexBuffer.destroy(); + }), + (no.prototype.setUniform = function (t, e) { + var r = this.useIntegerZoom ? Math.floor(e.zoom) : e.zoom, + n = a( + this.expression.interpolationFactor(r, this.zoom, this.zoom + 1), + 0, + 1, + ); + t.set(n); + }), + (no.prototype.getBinding = function (t, e, r) { + return new Ga(t, e); + }); + var io = function (t, e, r, n, i, a) { + (this.expression = t), + (this.type = e), + (this.useIntegerZoom = r), + (this.zoom = n), + (this.layerId = a), + (this.zoomInPaintVertexArray = new i()), + (this.zoomOutPaintVertexArray = new i()); + }; + (io.prototype.populatePaintArray = function (t, e, r) { + var n = this.zoomInPaintVertexArray.length; + this.zoomInPaintVertexArray.resize(t), + this.zoomOutPaintVertexArray.resize(t), + this._setPaintValues(n, t, e.patterns && e.patterns[this.layerId], r); + }), + (io.prototype.updatePaintArray = function (t, e, r, n, i) { + this._setPaintValues(t, e, r.patterns && r.patterns[this.layerId], i); + }), + (io.prototype._setPaintValues = function (t, e, r, n) { + if (n && r) { + var i = n[r.min], + a = n[r.mid], + o = n[r.max]; + if (i && a && o) + for (var s = t; s < e; s++) + this.zoomInPaintVertexArray.emplace( + s, + a.tl[0], + a.tl[1], + a.br[0], + a.br[1], + i.tl[0], + i.tl[1], + i.br[0], + i.br[1], + a.pixelRatio, + i.pixelRatio, + ), + this.zoomOutPaintVertexArray.emplace( + s, + a.tl[0], + a.tl[1], + a.br[0], + a.br[1], + o.tl[0], + o.tl[1], + o.br[0], + o.br[1], + a.pixelRatio, + o.pixelRatio, + ); + } + }), + (io.prototype.upload = function (t) { + this.zoomInPaintVertexArray && + this.zoomInPaintVertexArray.arrayBuffer && + this.zoomOutPaintVertexArray && + this.zoomOutPaintVertexArray.arrayBuffer && + ((this.zoomInPaintVertexBuffer = t.createVertexBuffer( + this.zoomInPaintVertexArray, + Ta.members, + this.expression.isStateDependent, + )), + (this.zoomOutPaintVertexBuffer = t.createVertexBuffer( + this.zoomOutPaintVertexArray, + Ta.members, + this.expression.isStateDependent, + ))); + }), + (io.prototype.destroy = function () { + this.zoomOutPaintVertexBuffer && + this.zoomOutPaintVertexBuffer.destroy(), + this.zoomInPaintVertexBuffer && + this.zoomInPaintVertexBuffer.destroy(); + }); + var ao = function (t, e, r) { + (this.binders = {}), (this._buffers = []); + var n = []; + for (var i in t.paint._values) + if (r(i)) { + var a = t.paint.get(i); + if (a instanceof bi && Fr(a.property.specification)) { + var o = so(i, t.type), + s = a.value, + u = a.property.specification.type, + l = a.property.useIntegerZoom, + p = a.property.specification['property-type'], + c = 'cross-faded' === p || 'cross-faded-data-driven' === p; + if ('constant' === s.kind) + (this.binders[i] = c + ? new eo(s.value, o) + : new to(s.value, o, u)), + n.push('/u_' + i); + else if ('source' === s.kind || c) { + var h = uo(i, u, 'source'); + (this.binders[i] = c + ? new io(s, u, l, e, h, t.id) + : new ro(s, o, u, h)), + n.push('/a_' + i); + } else { + var f = uo(i, u, 'composite'); + (this.binders[i] = new no(s, o, u, l, e, f)), n.push('/z_' + i); + } + } + } + this.cacheKey = n.sort().join(''); + }; + (ao.prototype.getMaxValue = function (t) { + var e = this.binders[t]; + return e instanceof ro || e instanceof no ? e.maxValue : 0; + }), + (ao.prototype.populatePaintArrays = function (t, e, r, n, i) { + for (var a in this.binders) { + var o = this.binders[a]; + (o instanceof ro || o instanceof no || o instanceof io) && + o.populatePaintArray(t, e, r, n, i); + } + }), + (ao.prototype.setConstantPatternPositions = function (t, e) { + for (var r in this.binders) { + var n = this.binders[r]; + n instanceof eo && n.setConstantPatternPositions(t, e); + } + }), + (ao.prototype.updatePaintArrays = function (t, e, r, n, i) { + var a = !1; + for (var o in t) + for (var s = 0, u = e.getPositions(o); s < u.length; s += 1) { + var l = u[s], + p = r.feature(l.index); + for (var c in this.binders) { + var h = this.binders[c]; + if ( + (h instanceof ro || h instanceof no || h instanceof io) && + !0 === h.expression.isStateDependent + ) { + var f = n.paint.get(c); + (h.expression = f.value), + h.updatePaintArray(l.start, l.end, p, t[o], i), + (a = !0); + } + } + } + return a; + }), + (ao.prototype.defines = function () { + var t = []; + for (var e in this.binders) { + var r = this.binders[e]; + (r instanceof to || r instanceof eo) && + t.push.apply( + t, + r.uniformNames.map(function (t) { + return '#define HAS_UNIFORM_' + t; + }), + ); + } + return t; + }), + (ao.prototype.getBinderAttributes = function () { + var t = []; + for (var e in this.binders) { + var r = this.binders[e]; + if (r instanceof ro || r instanceof no) + for (var n = 0; n < r.paintVertexAttributes.length; n++) + t.push(r.paintVertexAttributes[n].name); + else if (r instanceof io) + for (var i = 0; i < Ta.members.length; i++) + t.push(Ta.members[i].name); + } + return t; + }), + (ao.prototype.getBinderUniforms = function () { + var t = []; + for (var e in this.binders) { + var r = this.binders[e]; + if (r instanceof to || r instanceof eo || r instanceof no) + for (var n = 0, i = r.uniformNames; n < i.length; n += 1) + t.push(i[n]); + } + return t; + }), + (ao.prototype.getPaintVertexBuffers = function () { + return this._buffers; + }), + (ao.prototype.getUniforms = function (t, e) { + var r = []; + for (var n in this.binders) { + var i = this.binders[n]; + if (i instanceof to || i instanceof eo || i instanceof no) + for (var a = 0, o = i.uniformNames; a < o.length; a += 1) { + var s = o[a]; + if (e[s]) { + var u = i.getBinding(t, e[s], s); + r.push({ name: s, property: n, binding: u }); + } + } + } + return r; + }), + (ao.prototype.setUniforms = function (t, e, r, n) { + for (var i = 0, a = e; i < a.length; i += 1) { + var o = a[i], + s = o.name, + u = o.property; + this.binders[u].setUniform(o.binding, n, r.get(u), s); + } + }), + (ao.prototype.updatePaintBuffers = function (t) { + for (var e in ((this._buffers = []), this.binders)) { + var r = this.binders[e]; + if (t && r instanceof io) { + var n = + 2 === t.fromScale + ? r.zoomInPaintVertexBuffer + : r.zoomOutPaintVertexBuffer; + n && this._buffers.push(n); + } else + (r instanceof ro || r instanceof no) && + r.paintVertexBuffer && + this._buffers.push(r.paintVertexBuffer); + } + }), + (ao.prototype.upload = function (t) { + for (var e in this.binders) { + var r = this.binders[e]; + (r instanceof ro || r instanceof no || r instanceof io) && + r.upload(t); + } + this.updatePaintBuffers(); + }), + (ao.prototype.destroy = function () { + for (var t in this.binders) { + var e = this.binders[t]; + (e instanceof ro || e instanceof no || e instanceof io) && + e.destroy(); + } + }); + var oo = function (t, e, r) { + void 0 === r && + (r = function () { + return !0; + }), + (this.programConfigurations = {}); + for (var n = 0, i = t; n < i.length; n += 1) { + var a = i[n]; + this.programConfigurations[a.id] = new ao(a, e, r); + } + (this.needsUpload = !1), + (this._featureMap = new Ra()), + (this._bufferOffset = 0); + }; + function so(t, e) { + return ( + { + 'text-opacity': ['opacity'], + 'icon-opacity': ['opacity'], + 'text-color': ['fill_color'], + 'icon-color': ['fill_color'], + 'text-halo-color': ['halo_color'], + 'icon-halo-color': ['halo_color'], + 'text-halo-blur': ['halo_blur'], + 'icon-halo-blur': ['halo_blur'], + 'text-halo-width': ['halo_width'], + 'icon-halo-width': ['halo_width'], + 'line-gap-width': ['gapwidth'], + 'line-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + 'fill-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + 'fill-extrusion-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + }[t] || [t.replace(e + '-', '').replace(/-/g, '_')] + ); + } + function uo(t, e, r) { + var n = { + color: { source: ji, composite: ra }, + number: { source: Wi, composite: ji }, + }, + i = (function (t) { + return { + 'line-pattern': { source: ba, composite: ba }, + 'fill-pattern': { source: ba, composite: ba }, + 'fill-extrusion-pattern': { source: ba, composite: ba }, + }[t]; + })(t); + return (i && i[r]) || n[e][r]; + } + (oo.prototype.populatePaintArrays = function (t, e, r, n, i, a) { + for (var o in this.programConfigurations) + this.programConfigurations[o].populatePaintArrays(t, e, n, i, a); + void 0 !== e.id && this._featureMap.add(e.id, r, this._bufferOffset, t), + (this._bufferOffset = t), + (this.needsUpload = !0); + }), + (oo.prototype.updatePaintArrays = function (t, e, r, n) { + for (var i = 0, a = r; i < a.length; i += 1) { + var o = a[i]; + this.needsUpload = + this.programConfigurations[o.id].updatePaintArrays( + t, + this._featureMap, + e, + o, + n, + ) || this.needsUpload; + } + }), + (oo.prototype.get = function (t) { + return this.programConfigurations[t]; + }), + (oo.prototype.upload = function (t) { + if (this.needsUpload) { + for (var e in this.programConfigurations) + this.programConfigurations[e].upload(t); + this.needsUpload = !1; + } + }), + (oo.prototype.destroy = function () { + for (var t in this.programConfigurations) + this.programConfigurations[t].destroy(); + }), + qn('ConstantBinder', to), + qn('CrossFadedConstantBinder', eo), + qn('SourceExpressionBinder', ro), + qn('CrossFadedCompositeBinder', io), + qn('CompositeExpressionBinder', no), + qn('ProgramConfiguration', ao, { omit: ['_buffers'] }), + qn('ProgramConfigurationSet', oo); + var lo = 8192, + po = Math.pow(2, 14) - 1, + co = -po - 1; + function ho(t) { + for ( + var e = lo / t.extent, r = t.loadGeometry(), n = 0; + n < r.length; + n++ + ) + for (var i = r[n], o = 0; o < i.length; o++) { + var s = i[o], + u = Math.round(s.x * e), + l = Math.round(s.y * e); + (s.x = a(u, co, po)), + (s.y = a(l, co, po)), + (u < s.x || u > s.x + 1 || l < s.y || l > s.y + 1) && + d( + 'Geometry exceeds allowed extent, reduce your vector tile buffer size', + ); + } + return r; + } + function fo(t, e) { + return { + type: t.type, + id: t.id, + properties: t.properties, + geometry: e ? ho(t) : [], + }; + } + function yo(t, e, r, n, i) { + t.emplaceBack(2 * e + (n + 1) / 2, 2 * r + (i + 1) / 2); + } + var mo = function (t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map(function (t) { + return t.id; + })), + (this.index = t.index), + (this.hasPattern = !1), + (this.layoutVertexArray = new da()), + (this.indexArray = new za()), + (this.segments = new Ea()), + (this.programConfigurations = new oo(t.layers, t.zoom)), + (this.stateDependentLayerIds = this.layers + .filter(function (t) { + return t.isStateDependent(); + }) + .map(function (t) { + return t.id; + })); + }; + function vo(t, e) { + for (var r = 0; r < t.length; r++) if (Io(e, t[r])) return !0; + for (var n = 0; n < e.length; n++) if (Io(t, e[n])) return !0; + return !!wo(t, e); + } + function go(t, e, r) { + return !!Io(t, e) || !!Ao(e, t, r); + } + function xo(t, e) { + if (1 === t.length) return So(e, t[0]); + for (var r = 0; r < e.length; r++) + for (var n = e[r], i = 0; i < n.length; i++) if (Io(t, n[i])) return !0; + for (var a = 0; a < t.length; a++) if (So(e, t[a])) return !0; + for (var o = 0; o < e.length; o++) if (wo(t, e[o])) return !0; + return !1; + } + function bo(t, e, r) { + if (t.length > 1) { + if (wo(t, e)) return !0; + for (var n = 0; n < e.length; n++) if (Ao(e[n], t, r)) return !0; + } + for (var i = 0; i < t.length; i++) if (Ao(t[i], e, r)) return !0; + return !1; + } + function wo(t, e) { + if (0 === t.length || 0 === e.length) return !1; + for (var r = 0; r < t.length - 1; r++) + for (var n = t[r], i = t[r + 1], a = 0; a < e.length - 1; a++) + if (_o(n, i, e[a], e[a + 1])) return !0; + return !1; + } + function _o(t, e, r, n) { + return m(t, r, n) !== m(e, r, n) && m(t, e, r) !== m(t, e, n); + } + function Ao(t, e, r) { + var n = r * r; + if (1 === e.length) return t.distSqr(e[0]) < n; + for (var i = 1; i < e.length; i++) + if (ko(t, e[i - 1], e[i]) < n) return !0; + return !1; + } + function ko(t, e, r) { + var n = e.distSqr(r); + if (0 === n) return t.distSqr(e); + var i = ((t.x - e.x) * (r.x - e.x) + (t.y - e.y) * (r.y - e.y)) / n; + return t.distSqr(i < 0 ? e : i > 1 ? r : r.sub(e)._mult(i)._add(e)); + } + function So(t, e) { + for (var r, n, i, a = !1, o = 0; o < t.length; o++) + for (var s = 0, u = (r = t[o]).length - 1; s < r.length; u = s++) + (n = r[s]).y > e.y != (i = r[u]).y > e.y && + e.x < ((i.x - n.x) * (e.y - n.y)) / (i.y - n.y) + n.x && + (a = !a); + return a; + } + function Io(t, e) { + for (var r = !1, n = 0, i = t.length - 1; n < t.length; i = n++) { + var a = t[n], + o = t[i]; + a.y > e.y != o.y > e.y && + e.x < ((o.x - a.x) * (e.y - a.y)) / (o.y - a.y) + a.x && + (r = !r); + } + return r; + } + function Mo(t, e, r) { + var n = r[0], + i = r[2]; + if ( + (t.x < n.x && e.x < n.x) || + (t.x > i.x && e.x > i.x) || + (t.y < n.y && e.y < n.y) || + (t.y > i.y && e.y > i.y) + ) + return !1; + var a = m(t, e, r[0]); + return a !== m(t, e, r[1]) || a !== m(t, e, r[2]) || a !== m(t, e, r[3]); + } + function zo(t, e, r) { + var n = e.paint.get(t).value; + return 'constant' === n.kind + ? n.value + : r.programConfigurations.get(e.id).getMaxValue(t); + } + function Po(t) { + return Math.sqrt(t[0] * t[0] + t[1] * t[1]); + } + function Bo(t, e, r, n, i) { + if (!e[0] && !e[1]) return t; + var a = I.convert(e)._mult(i); + 'viewport' === r && a._rotate(-n); + for (var o = [], s = 0; s < t.length; s++) o.push(t[s].sub(a)); + return o; + } + (mo.prototype.populate = function (t, e, r) { + var n = this.layers[0], + i = [], + a = null, + o = !1; + 'circle' === n.type && + (o = !(a = n.layout.get('circle-sort-key')).isConstant()); + for (var s = 0, u = t; s < u.length; s += 1) { + var l = u[s], + p = l.feature, + c = l.id, + h = l.index, + f = l.sourceLayerIndex, + y = this.layers[0]._featureFilter.needGeometry, + d = fo(p, y); + if (this.layers[0]._featureFilter.filter(new fi(this.zoom), d, r)) { + var m = o ? a.evaluate(d, {}, r) : void 0, + v = { + id: c, + properties: p.properties, + type: p.type, + sourceLayerIndex: f, + index: h, + geometry: y ? d.geometry : ho(p), + patterns: {}, + sortKey: m, + }; + i.push(v); + } + } + o && + i.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + for (var g = 0, x = i; g < x.length; g += 1) { + var b = x[g], + w = b.geometry, + _ = b.index, + A = b.sourceLayerIndex, + k = t[_].feature; + this.addFeature(b, w, _, r), + e.featureIndex.insert(k, w, _, A, this.index); + } + }), + (mo.prototype.update = function (t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + }), + (mo.prototype.isEmpty = function () { + return 0 === this.layoutVertexArray.length; + }), + (mo.prototype.uploadPending = function () { + return !this.uploaded || this.programConfigurations.needsUpload; + }), + (mo.prototype.upload = function (t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + Ca, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + }), + (mo.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy()); + }), + (mo.prototype.addFeature = function (t, e, r, n) { + for (var i = 0, a = e; i < a.length; i += 1) + for (var o = 0, s = a[i]; o < s.length; o += 1) { + var u = s[o], + l = u.x, + p = u.y; + if (!(l < 0 || l >= lo || p < 0 || p >= lo)) { + var c = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + t.sortKey, + ), + h = c.vertexLength; + yo(this.layoutVertexArray, l, p, -1, -1), + yo(this.layoutVertexArray, l, p, 1, -1), + yo(this.layoutVertexArray, l, p, 1, 1), + yo(this.layoutVertexArray, l, p, -1, 1), + this.indexArray.emplaceBack(h, h + 1, h + 2), + this.indexArray.emplaceBack(h, h + 3, h + 2), + (c.vertexLength += 4), + (c.primitiveLength += 2); + } + } + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + {}, + n, + ); + }), + qn('CircleBucket', mo, { omit: ['layers'] }); + var Co = new Mi({ + 'circle-sort-key': new Ai(gt.layout_circle['circle-sort-key']), + }), + Eo = { + paint: new Mi({ + 'circle-radius': new Ai(gt.paint_circle['circle-radius']), + 'circle-color': new Ai(gt.paint_circle['circle-color']), + 'circle-blur': new Ai(gt.paint_circle['circle-blur']), + 'circle-opacity': new Ai(gt.paint_circle['circle-opacity']), + 'circle-translate': new _i(gt.paint_circle['circle-translate']), + 'circle-translate-anchor': new _i( + gt.paint_circle['circle-translate-anchor'], + ), + 'circle-pitch-scale': new _i(gt.paint_circle['circle-pitch-scale']), + 'circle-pitch-alignment': new _i( + gt.paint_circle['circle-pitch-alignment'], + ), + 'circle-stroke-width': new Ai(gt.paint_circle['circle-stroke-width']), + 'circle-stroke-color': new Ai(gt.paint_circle['circle-stroke-color']), + 'circle-stroke-opacity': new Ai( + gt.paint_circle['circle-stroke-opacity'], + ), + }), + layout: Co, + }, + Vo = 1e-6, + To = 'undefined' != typeof Float32Array ? Float32Array : Array; + function Fo() { + var t = new To(9); + return ( + To != Float32Array && + ((t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[5] = 0), + (t[6] = 0), + (t[7] = 0)), + (t[0] = 1), + (t[4] = 1), + (t[8] = 1), + t + ); + } + function Oo(t) { + return ( + (t[0] = 1), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = 1), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = 1), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0), + (t[15] = 1), + t + ); + } + function Lo(t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + o = e[3], + s = e[4], + u = e[5], + l = e[6], + p = e[7], + c = e[8], + h = e[9], + f = e[10], + y = e[11], + d = e[12], + m = e[13], + v = e[14], + g = e[15], + x = r[0], + b = r[1], + w = r[2], + _ = r[3]; + return ( + (t[0] = x * n + b * s + w * c + _ * d), + (t[1] = x * i + b * u + w * h + _ * m), + (t[2] = x * a + b * l + w * f + _ * v), + (t[3] = x * o + b * p + w * y + _ * g), + (t[4] = + (x = r[4]) * n + (b = r[5]) * s + (w = r[6]) * c + (_ = r[7]) * d), + (t[5] = x * i + b * u + w * h + _ * m), + (t[6] = x * a + b * l + w * f + _ * v), + (t[7] = x * o + b * p + w * y + _ * g), + (t[8] = + (x = r[8]) * n + (b = r[9]) * s + (w = r[10]) * c + (_ = r[11]) * d), + (t[9] = x * i + b * u + w * h + _ * m), + (t[10] = x * a + b * l + w * f + _ * v), + (t[11] = x * o + b * p + w * y + _ * g), + (t[12] = + (x = r[12]) * n + + (b = r[13]) * s + + (w = r[14]) * c + + (_ = r[15]) * d), + (t[13] = x * i + b * u + w * h + _ * m), + (t[14] = x * a + b * l + w * f + _ * v), + (t[15] = x * o + b * p + w * y + _ * g), + t + ); + } + Math.hypot || + (Math.hypot = function () { + for (var t = arguments, e = 0, r = arguments.length; r--; ) + e += t[r] * t[r]; + return Math.sqrt(e); + }); + var Do, + jo = Lo; + function Ro() { + var t = new To(3); + return To != Float32Array && ((t[0] = 0), (t[1] = 0), (t[2] = 0)), t; + } + function Uo(t, e, r) { + var n = new To(3); + return (n[0] = t), (n[1] = e), (n[2] = r), n; + } + function qo(t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + o = e[3]; + return ( + (t[0] = r[0] * n + r[4] * i + r[8] * a + r[12] * o), + (t[1] = r[1] * n + r[5] * i + r[9] * a + r[13] * o), + (t[2] = r[2] * n + r[6] * i + r[10] * a + r[14] * o), + (t[3] = r[3] * n + r[7] * i + r[11] * a + r[15] * o), + t + ); + } + function No() { + var t = new To(4); + return ( + To != Float32Array && ((t[0] = 0), (t[1] = 0), (t[2] = 0)), + (t[3] = 1), + t + ); + } + Ro(), + (Do = new To(4)), + To != Float32Array && + ((Do[0] = 0), (Do[1] = 0), (Do[2] = 0), (Do[3] = 0)), + Ro(), + Uo(1, 0, 0), + Uo(0, 1, 0), + No(), + No(), + Fo(), + (function () { + var t; + (t = new To(2)), To != Float32Array && ((t[0] = 0), (t[1] = 0)); + })(); + var Zo = (function (t) { + function e(e) { + t.call(this, e, Eo); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.createBucket = function (t) { + return new mo(t); + }), + (e.prototype.queryRadius = function (t) { + var e = t; + return ( + zo('circle-radius', this, e) + + zo('circle-stroke-width', this, e) + + Po(this.paint.get('circle-translate')) + ); + }), + (e.prototype.queryIntersectsFeature = function ( + t, + e, + r, + n, + i, + a, + o, + s, + ) { + for ( + var u = Bo( + t, + this.paint.get('circle-translate'), + this.paint.get('circle-translate-anchor'), + a.angle, + o, + ), + l = + this.paint.get('circle-radius').evaluate(e, r) + + this.paint.get('circle-stroke-width').evaluate(e, r), + p = 'map' === this.paint.get('circle-pitch-alignment'), + c = p + ? u + : (function (t, e) { + return t.map(function (t) { + return Ko(t, e); + }); + })(u, s), + h = p ? l * o : l, + f = 0, + y = n; + f < y.length; + f += 1 + ) + for (var d = 0, m = y[f]; d < m.length; d += 1) { + var v = m[d], + g = p ? v : Ko(v, s), + x = h, + b = qo([], [v.x, v.y, 0, 1], s); + if ( + ('viewport' === this.paint.get('circle-pitch-scale') && + 'map' === this.paint.get('circle-pitch-alignment') + ? (x *= b[3] / a.cameraToCenterDistance) + : 'map' === this.paint.get('circle-pitch-scale') && + 'viewport' === this.paint.get('circle-pitch-alignment') && + (x *= a.cameraToCenterDistance / b[3]), + go(c, g, x)) + ) + return !0; + } + return !1; + }), + e + ); + })(Pi); + function Ko(t, e) { + var r = qo([], [t.x, t.y, 0, 1], e); + return new I(r[0] / r[3], r[1] / r[3]); + } + var Go = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(mo); + qn('HeatmapBucket', Go, { omit: ['layers'] }); + var Jo = { + paint: new Mi({ + 'heatmap-radius': new Ai(gt.paint_heatmap['heatmap-radius']), + 'heatmap-weight': new Ai(gt.paint_heatmap['heatmap-weight']), + 'heatmap-intensity': new _i(gt.paint_heatmap['heatmap-intensity']), + 'heatmap-color': new Ii(gt.paint_heatmap['heatmap-color']), + 'heatmap-opacity': new _i(gt.paint_heatmap['heatmap-opacity']), + }), + }; + function Xo(t, e, r, n) { + var i = e.width, + a = e.height; + if (n) { + if (n instanceof Uint8ClampedArray) n = new Uint8Array(n.buffer); + else if (n.length !== i * a * r) + throw new RangeError( + 'mismatched image size. expected: ' + + n.length + + ' but got: ' + + i * a * r, + ); + } else n = new Uint8Array(i * a * r); + return (t.width = i), (t.height = a), (t.data = n), t; + } + function Yo(t, e, r) { + var n = e.width, + i = e.height; + if (n !== t.width || i !== t.height) { + var a = Xo({}, { width: n, height: i }, r); + Ho( + t, + a, + { x: 0, y: 0 }, + { x: 0, y: 0 }, + { width: Math.min(t.width, n), height: Math.min(t.height, i) }, + r, + ), + (t.width = n), + (t.height = i), + (t.data = a.data); + } + } + function Ho(t, e, r, n, i, a) { + if (0 === i.width || 0 === i.height) return e; + if ( + i.width > t.width || + i.height > t.height || + r.x > t.width - i.width || + r.y > t.height - i.height + ) + throw new RangeError('out of range source coordinates for image copy'); + if ( + i.width > e.width || + i.height > e.height || + n.x > e.width - i.width || + n.y > e.height - i.height + ) + throw new RangeError( + 'out of range destination coordinates for image copy', + ); + var o = t.data, + s = e.data; + if (o === s) + throw new Error('srcData equals dstData, so image is already copied'); + for (var u = 0; u < i.height; u++) + for ( + var l = ((r.y + u) * t.width + r.x) * a, + p = ((n.y + u) * e.width + n.x) * a, + c = 0; + c < i.width * a; + c++ + ) + s[p + c] = o[l + c]; + return e; + } + var Wo = function (t, e) { + Xo(this, t, 1, e); + }; + (Wo.prototype.resize = function (t) { + Yo(this, t, 1); + }), + (Wo.prototype.clone = function () { + return new Wo( + { width: this.width, height: this.height }, + new Uint8Array(this.data), + ); + }), + (Wo.copy = function (t, e, r, n, i) { + Ho(t, e, r, n, i, 1); + }); + var $o = function (t, e) { + Xo(this, t, 4, e); + }; + function Qo(t) { + var e = {}, + r = t.resolution || 256, + n = t.clips ? t.clips.length : 1, + i = t.image || new $o({ width: r, height: n }); + if ((Math.log(r) / Math.LN2) % 1 != 0) + throw new Error('width is not a power of 2 - ' + r); + var a = function (r, n, a) { + e[t.evaluationKey] = a; + var o = t.expression.evaluate(e); + (i.data[r + n + 0] = Math.floor((255 * o.r) / o.a)), + (i.data[r + n + 1] = Math.floor((255 * o.g) / o.a)), + (i.data[r + n + 2] = Math.floor((255 * o.b) / o.a)), + (i.data[r + n + 3] = Math.floor(255 * o.a)); + }; + if (t.clips) + for (var o = 0, s = 0; o < n; ++o, s += 4 * r) + for (var u = 0, l = 0; u < r; u++, l += 4) { + var p = u / (r - 1), + c = t.clips[o]; + a(s, l, c.start * (1 - p) + c.end * p); + } + else for (var h = 0, f = 0; h < r; h++, f += 4) a(0, f, h / (r - 1)); + return i; + } + ($o.prototype.resize = function (t) { + Yo(this, t, 4); + }), + ($o.prototype.replace = function (t, e) { + e + ? this.data.set(t) + : (this.data = + t instanceof Uint8ClampedArray ? new Uint8Array(t.buffer) : t); + }), + ($o.prototype.clone = function () { + return new $o( + { width: this.width, height: this.height }, + new Uint8Array(this.data), + ); + }), + ($o.copy = function (t, e, r, n, i) { + Ho(t, e, r, n, i, 4); + }), + qn('AlphaImage', Wo), + qn('RGBAImage', $o); + var ts = (function (t) { + function e(e) { + t.call(this, e, Jo), this._updateColorRamp(); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.createBucket = function (t) { + return new Go(t); + }), + (e.prototype._handleSpecialPaintPropertyUpdate = function (t) { + 'heatmap-color' === t && this._updateColorRamp(); + }), + (e.prototype._updateColorRamp = function () { + (this.colorRamp = Qo({ + expression: + this._transitionablePaint._values['heatmap-color'].value + .expression, + evaluationKey: 'heatmapDensity', + image: this.colorRamp, + })), + (this.colorRampTexture = null); + }), + (e.prototype.resize = function () { + this.heatmapFbo && + (this.heatmapFbo.destroy(), (this.heatmapFbo = null)); + }), + (e.prototype.queryRadius = function () { + return 0; + }), + (e.prototype.queryIntersectsFeature = function () { + return !1; + }), + (e.prototype.hasOffscreenPass = function () { + return ( + 0 !== this.paint.get('heatmap-opacity') && + 'none' !== this.visibility + ); + }), + e + ); + })(Pi), + es = { + paint: new Mi({ + 'hillshade-illumination-direction': new _i( + gt.paint_hillshade['hillshade-illumination-direction'], + ), + 'hillshade-illumination-anchor': new _i( + gt.paint_hillshade['hillshade-illumination-anchor'], + ), + 'hillshade-exaggeration': new _i( + gt.paint_hillshade['hillshade-exaggeration'], + ), + 'hillshade-shadow-color': new _i( + gt.paint_hillshade['hillshade-shadow-color'], + ), + 'hillshade-highlight-color': new _i( + gt.paint_hillshade['hillshade-highlight-color'], + ), + 'hillshade-accent-color': new _i( + gt.paint_hillshade['hillshade-accent-color'], + ), + }), + }, + rs = (function (t) { + function e(e) { + t.call(this, e, es); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.hasOffscreenPass = function () { + return ( + 0 !== this.paint.get('hillshade-exaggeration') && + 'none' !== this.visibility + ); + }), + e + ); + })(Pi), + ns = Vi([{ name: 'a_pos', components: 2, type: 'Int16' }], 4).members, + is = { exports: {} }; + function as(t, e, r) { + r = r || 2; + var n, + i, + a, + o, + s, + u, + l, + p = e && e.length, + c = p ? e[0] * r : t.length, + h = os(t, 0, c, r, !0), + f = []; + if (!h || h.next === h.prev) return f; + if ( + (p && + (h = (function (t, e, r, n) { + var i, + a, + o, + s = []; + for (i = 0, a = e.length; i < a; i++) + (o = os( + t, + e[i] * n, + i < a - 1 ? e[i + 1] * n : t.length, + n, + !1, + )) === o.next && (o.steiner = !0), + s.push(vs(o)); + for (s.sort(fs), i = 0; i < s.length; i++) r = ys(s[i], r); + return r; + })(t, e, h, r)), + t.length > 80 * r) + ) { + (n = a = t[0]), (i = o = t[1]); + for (var y = r; y < c; y += r) + (s = t[y]) < n && (n = s), + (u = t[y + 1]) < i && (i = u), + s > a && (a = s), + u > o && (o = u); + l = 0 !== (l = Math.max(a - n, o - i)) ? 32767 / l : 0; + } + return us(h, f, r, n, i, l, 0), f; + } + function os(t, e, r, n, i) { + var a, o; + if (i === Bs(t, e, r, n) > 0) + for (a = e; a < r; a += n) o = Ms(a, t[a], t[a + 1], o); + else for (a = r - n; a >= e; a -= n) o = Ms(a, t[a], t[a + 1], o); + return o && ws(o, o.next) && (zs(o), (o = o.next)), o; + } + function ss(t, e) { + if (!t) return t; + e || (e = t); + var r, + n = t; + do { + if ( + ((r = !1), + n.steiner || (!ws(n, n.next) && 0 !== bs(n.prev, n, n.next))) + ) + n = n.next; + else { + if ((zs(n), (n = e = n.prev) === n.next)) break; + r = !0; + } + } while (r || n !== e); + return e; + } + function us(t, e, r, n, i, a, o) { + if (t) { + !o && + a && + (function (t, e, r, n) { + var i = t; + do { + 0 === i.z && (i.z = ms(i.x, i.y, e, r, n)), + (i.prevZ = i.prev), + (i.nextZ = i.next), + (i = i.next); + } while (i !== t); + (i.prevZ.nextZ = null), + (i.prevZ = null), + (function (t) { + var e, + r, + n, + i, + a, + o, + s, + u, + l = 1; + do { + for (r = t, t = null, a = null, o = 0; r; ) { + for ( + o++, n = r, s = 0, e = 0; + e < l && (s++, (n = n.nextZ)); + e++ + ); + for (u = l; s > 0 || (u > 0 && n); ) + 0 !== s && (0 === u || !n || r.z <= n.z) + ? ((i = r), (r = r.nextZ), s--) + : ((i = n), (n = n.nextZ), u--), + a ? (a.nextZ = i) : (t = i), + (i.prevZ = a), + (a = i); + r = n; + } + (a.nextZ = null), (l *= 2); + } while (o > 1); + })(i); + })(t, n, i, a); + for (var s, u, l = t; t.prev !== t.next; ) + if (((s = t.prev), (u = t.next), a ? ps(t, n, i, a) : ls(t))) + e.push((s.i / r) | 0), + e.push((t.i / r) | 0), + e.push((u.i / r) | 0), + zs(t), + (t = u.next), + (l = u.next); + else if ((t = u) === l) { + o + ? 1 === o + ? us((t = cs(ss(t), e, r)), e, r, n, i, a, 2) + : 2 === o && hs(t, e, r, n, i, a) + : us(ss(t), e, r, n, i, a, 1); + break; + } + } + } + function ls(t) { + var e = t.prev, + r = t, + n = t.next; + if (bs(e, r, n) >= 0) return !1; + for ( + var i = e.x, + a = r.x, + o = n.x, + s = e.y, + u = r.y, + l = n.y, + p = i < a ? (i < o ? i : o) : a < o ? a : o, + c = s < u ? (s < l ? s : l) : u < l ? u : l, + h = i > a ? (i > o ? i : o) : a > o ? a : o, + f = s > u ? (s > l ? s : l) : u > l ? u : l, + y = n.next; + y !== e; -// + ) { + if ( + y.x >= p && + y.x <= h && + y.y >= c && + y.y <= f && + gs(i, s, a, u, o, l, y.x, y.y) && + bs(y.prev, y, y.next) >= 0 + ) + return !1; + y = y.next; + } + return !0; + } + function ps(t, e, r, n) { + var i = t.prev, + a = t, + o = t.next; + if (bs(i, a, o) >= 0) return !1; + for ( + var s = i.x, + u = a.x, + l = o.x, + p = i.y, + c = a.y, + h = o.y, + f = s < u ? (s < l ? s : l) : u < l ? u : l, + y = p < c ? (p < h ? p : h) : c < h ? c : h, + d = s > u ? (s > l ? s : l) : u > l ? u : l, + m = p > c ? (p > h ? p : h) : c > h ? c : h, + v = ms(f, y, e, r, n), + g = ms(d, m, e, r, n), + x = t.prevZ, + b = t.nextZ; + x && x.z >= v && b && b.z <= g; -var maplibregl$1 = maplibregl; + ) { + if ( + x.x >= f && + x.x <= d && + x.y >= y && + x.y <= m && + x !== i && + x !== o && + gs(s, p, u, c, l, h, x.x, x.y) && + bs(x.prev, x, x.next) >= 0 + ) + return !1; + if ( + ((x = x.prevZ), + b.x >= f && + b.x <= d && + b.y >= y && + b.y <= m && + b !== i && + b !== o && + gs(s, p, u, c, l, h, b.x, b.y) && + bs(b.prev, b, b.next) >= 0) + ) + return !1; + b = b.nextZ; + } + for (; x && x.z >= v; ) { + if ( + x.x >= f && + x.x <= d && + x.y >= y && + x.y <= m && + x !== i && + x !== o && + gs(s, p, u, c, l, h, x.x, x.y) && + bs(x.prev, x, x.next) >= 0 + ) + return !1; + x = x.prevZ; + } + for (; b && b.z <= g; ) { + if ( + b.x >= f && + b.x <= d && + b.y >= y && + b.y <= m && + b !== i && + b !== o && + gs(s, p, u, c, l, h, b.x, b.y) && + bs(b.prev, b, b.next) >= 0 + ) + return !1; + b = b.nextZ; + } + return !0; + } + function cs(t, e, r) { + var n = t; + do { + var i = n.prev, + a = n.next.next; + !ws(i, a) && + _s(i, n, n.next, a) && + Ss(i, a) && + Ss(a, i) && + (e.push((i.i / r) | 0), + e.push((n.i / r) | 0), + e.push((a.i / r) | 0), + zs(n), + zs(n.next), + (n = t = a)), + (n = n.next); + } while (n !== t); + return ss(n); + } + function hs(t, e, r, n, i, a) { + var o = t; + do { + for (var s = o.next.next; s !== o.prev; ) { + if (o.i !== s.i && xs(o, s)) { + var u = Is(o, s); + return ( + (o = ss(o, o.next)), + (u = ss(u, u.next)), + us(o, e, r, n, i, a, 0), + void us(u, e, r, n, i, a, 0) + ); + } + s = s.next; + } + o = o.next; + } while (o !== t); + } + function fs(t, e) { + return t.x - e.x; + } + function ys(t, e) { + var r = (function (t, e) { + var r, + n = e, + i = t.x, + a = t.y, + o = -1 / 0; + do { + if (a <= n.y && a >= n.next.y && n.next.y !== n.y) { + var s = n.x + ((a - n.y) * (n.next.x - n.x)) / (n.next.y - n.y); + if ( + s <= i && + s > o && + ((o = s), (r = n.x < n.next.x ? n : n.next), s === i) + ) + return r; + } + n = n.next; + } while (n !== e); + if (!r) return null; + var u, + l = r, + p = r.x, + c = r.y, + h = 1 / 0; + n = r; + do { + i >= n.x && + n.x >= p && + i !== n.x && + gs(a < c ? i : o, a, p, c, a < c ? o : i, a, n.x, n.y) && + ((u = Math.abs(a - n.y) / (i - n.x)), + Ss(n, t) && + (u < h || + (u === h && (n.x > r.x || (n.x === r.x && ds(r, n))))) && + ((r = n), (h = u))), + (n = n.next); + } while (n !== l); + return r; + })(t, e); + if (!r) return e; + var n = Is(r, t); + return ss(n, n.next), ss(r, r.next); + } + function ds(t, e) { + return bs(t.prev, t, e.prev) < 0 && bs(e.next, t, t.next) < 0; + } + function ms(t, e, r, n, i) { + return ( + (t = + 1431655765 & + ((t = + 858993459 & + ((t = + 252645135 & + ((t = 16711935 & ((t = ((t - r) * i) | 0) | (t << 8))) | + (t << 4))) | + (t << 2))) | + (t << 1))) | + ((e = + 1431655765 & + ((e = + 858993459 & + ((e = + 252645135 & + ((e = 16711935 & ((e = ((e - n) * i) | 0) | (e << 8))) | + (e << 4))) | + (e << 2))) | + (e << 1))) << + 1) + ); + } + function vs(t) { + var e = t, + r = t; + do { + (e.x < r.x || (e.x === r.x && e.y < r.y)) && (r = e), (e = e.next); + } while (e !== t); + return r; + } + function gs(t, e, r, n, i, a, o, s) { + return ( + (i - o) * (e - s) >= (t - o) * (a - s) && + (t - o) * (n - s) >= (r - o) * (e - s) && + (r - o) * (a - s) >= (i - o) * (n - s) + ); + } + function xs(t, e) { + return ( + t.next.i !== e.i && + t.prev.i !== e.i && + !(function (t, e) { + var r = t; + do { + if ( + r.i !== t.i && + r.next.i !== t.i && + r.i !== e.i && + r.next.i !== e.i && + _s(r, r.next, t, e) + ) + return !0; + r = r.next; + } while (r !== t); + return !1; + })(t, e) && + ((Ss(t, e) && + Ss(e, t) && + (function (t, e) { + var r = t, + n = !1, + i = (t.x + e.x) / 2, + a = (t.y + e.y) / 2; + do { + r.y > a != r.next.y > a && + r.next.y !== r.y && + i < ((r.next.x - r.x) * (a - r.y)) / (r.next.y - r.y) + r.x && + (n = !n), + (r = r.next); + } while (r !== t); + return n; + })(t, e) && + (bs(t.prev, t, e.prev) || bs(t, e.prev, e))) || + (ws(t, e) && bs(t.prev, t, t.next) > 0 && bs(e.prev, e, e.next) > 0)) + ); + } + function bs(t, e, r) { + return (e.y - t.y) * (r.x - e.x) - (e.x - t.x) * (r.y - e.y); + } + function ws(t, e) { + return t.x === e.x && t.y === e.y; + } + function _s(t, e, r, n) { + var i = ks(bs(t, e, r)), + a = ks(bs(t, e, n)), + o = ks(bs(r, n, t)), + s = ks(bs(r, n, e)); + return ( + (i !== a && o !== s) || + !(0 !== i || !As(t, r, e)) || + !(0 !== a || !As(t, n, e)) || + !(0 !== o || !As(r, t, n)) || + !(0 !== s || !As(r, e, n)) + ); + } + function As(t, e, r) { + return ( + e.x <= Math.max(t.x, r.x) && + e.x >= Math.min(t.x, r.x) && + e.y <= Math.max(t.y, r.y) && + e.y >= Math.min(t.y, r.y) + ); + } + function ks(t) { + return t > 0 ? 1 : t < 0 ? -1 : 0; + } + function Ss(t, e) { + return bs(t.prev, t, t.next) < 0 + ? bs(t, e, t.next) >= 0 && bs(t, t.prev, e) >= 0 + : bs(t, e, t.prev) < 0 || bs(t, t.next, e) < 0; + } + function Is(t, e) { + var r = new Ps(t.i, t.x, t.y), + n = new Ps(e.i, e.x, e.y), + i = t.next, + a = e.prev; + return ( + (t.next = e), + (e.prev = t), + (r.next = i), + (i.prev = r), + (n.next = r), + (r.prev = n), + (a.next = n), + (n.prev = a), + n + ); + } + function Ms(t, e, r, n) { + var i = new Ps(t, e, r); + return ( + n + ? ((i.next = n.next), (i.prev = n), (n.next.prev = i), (n.next = i)) + : ((i.prev = i), (i.next = i)), + i + ); + } + function zs(t) { + (t.next.prev = t.prev), + (t.prev.next = t.next), + t.prevZ && (t.prevZ.nextZ = t.nextZ), + t.nextZ && (t.nextZ.prevZ = t.prevZ); + } + function Ps(t, e, r) { + (this.i = t), + (this.x = e), + (this.y = r), + (this.prev = null), + (this.next = null), + (this.z = 0), + (this.prevZ = null), + (this.nextZ = null), + (this.steiner = !1); + } + function Bs(t, e, r, n) { + for (var i = 0, a = e, o = r - n; a < r; a += n) + (i += (t[o] - t[a]) * (t[a + 1] + t[o + 1])), (o = a); + return i; + } + function Cs(t, e, r, n, i) { + Es(t, e, r || 0, n || t.length - 1, i || Ts); + } + function Es(t, e, r, n, i) { + for (; n > r; ) { + if (n - r > 600) { + var a = n - r + 1, + o = e - r + 1, + s = Math.log(a), + u = 0.5 * Math.exp((2 * s) / 3), + l = + 0.5 * Math.sqrt((s * u * (a - u)) / a) * (o - a / 2 < 0 ? -1 : 1); + Es( + t, + e, + Math.max(r, Math.floor(e - (o * u) / a + l)), + Math.min(n, Math.floor(e + ((a - o) * u) / a + l)), + i, + ); + } + var p = t[e], + c = r, + h = n; + for (Vs(t, r, e), i(t[n], p) > 0 && Vs(t, r, n); c < h; ) { + for (Vs(t, c, h), c++, h--; i(t[c], p) < 0; ) c++; + for (; i(t[h], p) > 0; ) h--; + } + 0 === i(t[r], p) ? Vs(t, r, h) : Vs(t, ++h, n), + h <= e && (r = h + 1), + e <= h && (n = h - 1); + } + } + function Vs(t, e, r) { + var n = t[e]; + (t[e] = t[r]), (t[r] = n); + } + function Ts(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function Fs(t, e) { + var r = t.length; + if (r <= 1) return [t]; + for (var n, i, a = [], o = 0; o < r; o++) { + var s = v(t[o]); + 0 !== s && + ((t[o].area = Math.abs(s)), + void 0 === i && (i = s < 0), + i === s < 0 ? (n && a.push(n), (n = [t[o]])) : n.push(t[o])); + } + if ((n && a.push(n), e > 1)) + for (var u = 0; u < a.length; u++) + a[u].length <= e || + (Cs(a[u], e, 1, a[u].length - 1, Os), (a[u] = a[u].slice(0, e))); + return a; + } + function Os(t, e) { + return e.area - t.area; + } + function Ls(t, e, r) { + for ( + var n = r.patternDependencies, i = !1, a = 0, o = e; + a < o.length; + a += 1 + ) { + var s = o[a].paint.get(t + '-pattern'); + s.isConstant() || (i = !0); + var u = s.constantOr(null); + u && ((i = !0), (n[u.to] = !0), (n[u.from] = !0)); + } + return i; + } + function Ds(t, e, r, n, i) { + for (var a = i.patternDependencies, o = 0, s = e; o < s.length; o += 1) { + var u = s[o], + l = u.paint.get(t + '-pattern').value; + if ('constant' !== l.kind) { + var p = l.evaluate({ zoom: n - 1 }, r, {}, i.availableImages), + c = l.evaluate({ zoom: n }, r, {}, i.availableImages), + h = l.evaluate({ zoom: n + 1 }, r, {}, i.availableImages); + (c = c && c.name ? c.name : c), + (h = h && h.name ? h.name : h), + (a[(p = p && p.name ? p.name : p)] = !0), + (a[c] = !0), + (a[h] = !0), + (r.patterns[u.id] = { min: p, mid: c, max: h }); + } + } + return r; + } + (is.exports = as), + (is.exports.default = as), + (as.deviation = function (t, e, r, n) { + var i = e && e.length, + a = Math.abs(Bs(t, 0, i ? e[0] * r : t.length, r)); + if (i) + for (var o = 0, s = e.length; o < s; o++) + a -= Math.abs( + Bs(t, e[o] * r, o < s - 1 ? e[o + 1] * r : t.length, r), + ); + var u = 0; + for (o = 0; o < n.length; o += 3) { + var l = n[o] * r, + p = n[o + 1] * r, + c = n[o + 2] * r; + u += Math.abs( + (t[l] - t[c]) * (t[p + 1] - t[l + 1]) - + (t[l] - t[p]) * (t[c + 1] - t[l + 1]), + ); + } + return 0 === a && 0 === u ? 0 : Math.abs((u - a) / a); + }), + (as.flatten = function (t) { + for ( + var e = t[0][0].length, + r = { vertices: [], holes: [], dimensions: e }, + n = 0, + i = 0; + i < t.length; + i++ + ) { + for (var a = 0; a < t[i].length; a++) + for (var o = 0; o < e; o++) r.vertices.push(t[i][a][o]); + i > 0 && r.holes.push((n += t[i - 1].length)); + } + return r; + }); + var js = function (t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map(function (t) { + return t.id; + })), + (this.index = t.index), + (this.hasPattern = !1), + (this.patternFeatures = []), + (this.layoutVertexArray = new ma()), + (this.indexArray = new za()), + (this.indexArray2 = new Pa()), + (this.programConfigurations = new oo(t.layers, t.zoom)), + (this.segments = new Ea()), + (this.segments2 = new Ea()), + (this.stateDependentLayerIds = this.layers + .filter(function (t) { + return t.isStateDependent(); + }) + .map(function (t) { + return t.id; + })); + }; + (js.prototype.populate = function (t, e, r) { + this.hasPattern = Ls('fill', this.layers, e); + for ( + var n = this.layers[0].layout.get('fill-sort-key'), + i = !n.isConstant(), + a = [], + o = 0, + s = t; + o < s.length; + o += 1 + ) { + var u = s[o], + l = u.feature, + p = u.id, + c = u.index, + h = u.sourceLayerIndex, + f = this.layers[0]._featureFilter.needGeometry, + y = fo(l, f); + if (this.layers[0]._featureFilter.filter(new fi(this.zoom), y, r)) { + var d = i ? n.evaluate(y, {}, r, e.availableImages) : void 0, + m = { + id: p, + properties: l.properties, + type: l.type, + sourceLayerIndex: h, + index: c, + geometry: f ? y.geometry : ho(l), + patterns: {}, + sortKey: d, + }; + a.push(m); + } + } + i && + a.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + for (var v = 0, g = a; v < g.length; v += 1) { + var x = g[v], + b = x.geometry, + w = x.index, + _ = x.sourceLayerIndex; + if (this.hasPattern) { + var A = Ds('fill', this.layers, x, this.zoom, e); + this.patternFeatures.push(A); + } else this.addFeature(x, b, w, r, {}); + e.featureIndex.insert(t[w].feature, b, w, _, this.index); + } + }), + (js.prototype.update = function (t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + }), + (js.prototype.addFeatures = function (t, e, r) { + for (var n = 0, i = this.patternFeatures; n < i.length; n += 1) { + var a = i[n]; + this.addFeature(a, a.geometry, a.index, e, r); + } + }), + (js.prototype.isEmpty = function () { + return 0 === this.layoutVertexArray.length; + }), + (js.prototype.uploadPending = function () { + return !this.uploaded || this.programConfigurations.needsUpload; + }), + (js.prototype.upload = function (t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + ns, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray)), + (this.indexBuffer2 = t.createIndexBuffer(this.indexArray2))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + }), + (js.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.indexBuffer2.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.segments2.destroy()); + }), + (js.prototype.addFeature = function (t, e, r, n, i) { + for (var a = 0, o = Fs(e, 500); a < o.length; a += 1) { + for (var s = o[a], u = 0, l = 0, p = s; l < p.length; l += 1) + u += p[l].length; + for ( + var c = this.segments.prepareSegment( + u, + this.layoutVertexArray, + this.indexArray, + ), + h = c.vertexLength, + f = [], + y = [], + d = 0, + m = s; + d < m.length; + d += 1 + ) { + var v = m[d]; + if (0 !== v.length) { + v !== s[0] && y.push(f.length / 2); + var g = this.segments2.prepareSegment( + v.length, + this.layoutVertexArray, + this.indexArray2, + ), + x = g.vertexLength; + this.layoutVertexArray.emplaceBack(v[0].x, v[0].y), + this.indexArray2.emplaceBack(x + v.length - 1, x), + f.push(v[0].x), + f.push(v[0].y); + for (var b = 1; b < v.length; b++) + this.layoutVertexArray.emplaceBack(v[b].x, v[b].y), + this.indexArray2.emplaceBack(x + b - 1, x + b), + f.push(v[b].x), + f.push(v[b].y); + (g.vertexLength += v.length), (g.primitiveLength += v.length); + } + } + for (var w = is.exports(f, y), _ = 0; _ < w.length; _ += 3) + this.indexArray.emplaceBack(h + w[_], h + w[_ + 1], h + w[_ + 2]); + (c.vertexLength += u), (c.primitiveLength += w.length / 3); + } + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + }), + qn('FillBucket', js, { omit: ['layers', 'patternFeatures'] }); + var Rs = new Mi({ + 'fill-sort-key': new Ai(gt.layout_fill['fill-sort-key']), + }), + Us = { + paint: new Mi({ + 'fill-antialias': new _i(gt.paint_fill['fill-antialias']), + 'fill-opacity': new Ai(gt.paint_fill['fill-opacity']), + 'fill-color': new Ai(gt.paint_fill['fill-color']), + 'fill-outline-color': new Ai(gt.paint_fill['fill-outline-color']), + 'fill-translate': new _i(gt.paint_fill['fill-translate']), + 'fill-translate-anchor': new _i( + gt.paint_fill['fill-translate-anchor'], + ), + 'fill-pattern': new ki(gt.paint_fill['fill-pattern']), + }), + layout: Rs, + }, + qs = (function (t) { + function e(e) { + t.call(this, e, Us); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.recalculate = function (e, r) { + t.prototype.recalculate.call(this, e, r); + var n = this.paint._values['fill-outline-color']; + 'constant' === n.value.kind && + void 0 === n.value.value && + (this.paint._values['fill-outline-color'] = + this.paint._values['fill-color']); + }), + (e.prototype.createBucket = function (t) { + return new js(t); + }), + (e.prototype.queryRadius = function () { + return Po(this.paint.get('fill-translate')); + }), + (e.prototype.queryIntersectsFeature = function (t, e, r, n, i, a, o) { + return xo( + Bo( + t, + this.paint.get('fill-translate'), + this.paint.get('fill-translate-anchor'), + a.angle, + o, + ), + n, + ); + }), + (e.prototype.isTileClipped = function () { + return !0; + }), + e + ); + })(Pi), + Ns = Vi( + [ + { name: 'a_pos', components: 2, type: 'Int16' }, + { name: 'a_normal_ed', components: 4, type: 'Int16' }, + ], + 4, + ), + Zs = Vi([{ name: 'a_centroid', components: 2, type: 'Int16' }], 4), + Ks = Ns.members, + Gs = {}, + Js = I, + Xs = Ys; + function Ys(t, e, r, n, i) { + (this.properties = {}), + (this.extent = r), + (this.type = 0), + (this._pbf = t), + (this._geometry = -1), + (this._keys = n), + (this._values = i), + t.readFields(Hs, this, e); + } + function Hs(t, e, r) { + 1 == t + ? (e.id = r.readVarint()) + : 2 == t + ? (function (t, e) { + for (var r = t.readVarint() + t.pos; t.pos < r; ) { + var n = e._keys[t.readVarint()], + i = e._values[t.readVarint()]; + e.properties[n] = i; + } + })(r, e) + : 3 == t + ? (e.type = r.readVarint()) + : 4 == t && (e._geometry = r.pos); + } + function Ws(t) { + for (var e, r, n = 0, i = 0, a = t.length, o = a - 1; i < a; o = i++) + n += ((r = t[o]).x - (e = t[i]).x) * (e.y + r.y); + return n; + } + (Ys.types = ['Unknown', 'Point', 'LineString', 'Polygon']), + (Ys.prototype.loadGeometry = function () { + var t = this._pbf; + t.pos = this._geometry; + for ( + var e, r = t.readVarint() + t.pos, n = 1, i = 0, a = 0, o = 0, s = []; + t.pos < r; -return maplibregl$1; + ) { + if (i <= 0) { + var u = t.readVarint(); + (n = 7 & u), (i = u >> 3); + } + if ((i--, 1 === n || 2 === n)) + (a += t.readSVarint()), + (o += t.readSVarint()), + 1 === n && (e && s.push(e), (e = [])), + e.push(new Js(a, o)); + else { + if (7 !== n) throw new Error('unknown command ' + n); + e && e.push(e[0].clone()); + } + } + return e && s.push(e), s; + }), + (Ys.prototype.bbox = function () { + var t = this._pbf; + t.pos = this._geometry; + for ( + var e = t.readVarint() + t.pos, + r = 1, + n = 0, + i = 0, + a = 0, + o = 1 / 0, + s = -1 / 0, + u = 1 / 0, + l = -1 / 0; + t.pos < e; -})); + ) { + if (n <= 0) { + var p = t.readVarint(); + (r = 7 & p), (n = p >> 3); + } + if ((n--, 1 === r || 2 === r)) + (i += t.readSVarint()) < o && (o = i), + i > s && (s = i), + (a += t.readSVarint()) < u && (u = a), + a > l && (l = a); + else if (7 !== r) throw new Error('unknown command ' + r); + } + return [o, u, s, l]; + }), + (Ys.prototype.toGeoJSON = function (t, e, r) { + var n, + i, + a = this.extent * Math.pow(2, r), + o = this.extent * t, + s = this.extent * e, + u = this.loadGeometry(), + l = Ys.types[this.type]; + function p(t) { + for (var e = 0; e < t.length; e++) { + var r = t[e]; + t[e] = [ + (360 * (r.x + o)) / a - 180, + (360 / Math.PI) * + Math.atan( + Math.exp(((180 - (360 * (r.y + s)) / a) * Math.PI) / 180), + ) - + 90, + ]; + } + } + switch (this.type) { + case 1: + var c = []; + for (n = 0; n < u.length; n++) c[n] = u[n][0]; + p((u = c)); + break; + case 2: + for (n = 0; n < u.length; n++) p(u[n]); + break; + case 3: + for ( + u = (function (t) { + var e = t.length; + if (e <= 1) return [t]; + for (var r, n, i = [], a = 0; a < e; a++) { + var o = Ws(t[a]); + 0 !== o && + (void 0 === n && (n = o < 0), + n === o < 0 + ? (r && i.push(r), (r = [t[a]])) + : r.push(t[a])); + } + return r && i.push(r), i; + })(u), + n = 0; + n < u.length; + n++ + ) + for (i = 0; i < u[n].length; i++) p(u[n][i]); + } + 1 === u.length ? (u = u[0]) : (l = 'Multi' + l); + var h = { + type: 'Feature', + geometry: { type: l, coordinates: u }, + properties: this.properties, + }; + return 'id' in this && (h.id = this.id), h; + }); + var $s = Xs, + Qs = tu; + function tu(t, e) { + (this.version = 1), + (this.name = null), + (this.extent = 4096), + (this.length = 0), + (this._pbf = t), + (this._keys = []), + (this._values = []), + (this._features = []), + t.readFields(eu, this, e), + (this.length = this._features.length); + } + function eu(t, e, r) { + 15 === t + ? (e.version = r.readVarint()) + : 1 === t + ? (e.name = r.readString()) + : 5 === t + ? (e.extent = r.readVarint()) + : 2 === t + ? e._features.push(r.pos) + : 3 === t + ? e._keys.push(r.readString()) + : 4 === t && + e._values.push( + (function (t) { + for (var e = null, r = t.readVarint() + t.pos; t.pos < r; ) { + var n = t.readVarint() >> 3; + e = + 1 === n + ? t.readString() + : 2 === n + ? t.readFloat() + : 3 === n + ? t.readDouble() + : 4 === n + ? t.readVarint64() + : 5 === n + ? t.readVarint() + : 6 === n + ? t.readSVarint() + : 7 === n + ? t.readBoolean() + : null; + } + return e; + })(r), + ); + } + tu.prototype.feature = function (t) { + if (t < 0 || t >= this._features.length) + throw new Error('feature index out of bounds'); + this._pbf.pos = this._features[t]; + var e = this._pbf.readVarint() + this._pbf.pos; + return new $s(this._pbf, e, this.extent, this._keys, this._values); + }; + var ru = Qs; + function nu(t, e, r) { + if (3 === t) { + var n = new ru(r, r.readVarint() + r.pos); + n.length && (e[n.name] = n); + } + } + (Gs.VectorTile = function (t, e) { + this.layers = t.readFields(nu, {}, e); + }), + (Gs.VectorTileFeature = Xs), + (Gs.VectorTileLayer = Qs); + var iu = Gs.VectorTileFeature.types, + au = Math.pow(2, 13); + function ou(t, e, r, n, i, a, o, s) { + t.emplaceBack( + e, + r, + 2 * Math.floor(n * au) + o, + i * au * 2, + a * au * 2, + Math.round(s), + ); + } + var su = function (t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map(function (t) { + return t.id; + })), + (this.index = t.index), + (this.hasPattern = !1), + (this.layoutVertexArray = new va()), + (this.centroidVertexArray = new fa()), + (this.indexArray = new za()), + (this.programConfigurations = new oo(t.layers, t.zoom)), + (this.segments = new Ea()), + (this.stateDependentLayerIds = this.layers + .filter(function (t) { + return t.isStateDependent(); + }) + .map(function (t) { + return t.id; + })); + }; + function uu(t, e) { + return ( + (t.x === e.x && (t.x < 0 || t.x > lo)) || + (t.y === e.y && (t.y < 0 || t.y > lo)) + ); + } + (su.prototype.populate = function (t, e, r) { + (this.features = []), + (this.hasPattern = Ls('fill-extrusion', this.layers, e)); + for (var n = 0, i = t; n < i.length; n += 1) { + var a = i[n], + o = a.feature, + s = a.id, + u = a.index, + l = a.sourceLayerIndex, + p = this.layers[0]._featureFilter.needGeometry, + c = fo(o, p); + if (this.layers[0]._featureFilter.filter(new fi(this.zoom), c, r)) { + var h = { + id: s, + sourceLayerIndex: l, + index: u, + geometry: p ? c.geometry : ho(o), + properties: o.properties, + type: o.type, + patterns: {}, + }; + this.hasPattern + ? this.features.push( + Ds('fill-extrusion', this.layers, h, this.zoom, e), + ) + : this.addFeature(h, h.geometry, u, r, {}), + e.featureIndex.insert(o, h.geometry, u, l, this.index, !0); + } + } + }), + (su.prototype.addFeatures = function (t, e, r) { + for (var n = 0, i = this.features; n < i.length; n += 1) { + var a = i[n]; + this.addFeature(a, a.geometry, a.index, e, r); + } + }), + (su.prototype.update = function (t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + }), + (su.prototype.isEmpty = function () { + return ( + 0 === this.layoutVertexArray.length && + 0 === this.centroidVertexArray.length + ); + }), + (su.prototype.uploadPending = function () { + return !this.uploaded || this.programConfigurations.needsUpload; + }), + (su.prototype.upload = function (t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + Ks, + )), + (this.centroidVertexBuffer = t.createVertexBuffer( + this.centroidVertexArray, + Zs.members, + !0, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + }), + (su.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.centroidVertexBuffer.destroy()); + }), + (su.prototype.addFeature = function (t, e, r, n, i) { + for ( + var a = { x: 0, y: 0, vertexCount: 0 }, o = 0, s = Fs(e, 500); + o < s.length; + o += 1 + ) { + for (var u = s[o], l = 0, p = 0, c = u; p < c.length; p += 1) + l += c[p].length; + for ( + var h = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + ), + f = 0, + y = u; + f < y.length; + f += 1 + ) { + var d = y[f]; + if ( + 0 !== d.length && + !( + (V = d).every(function (t) { + return t.x < 0; + }) || + V.every(function (t) { + return t.x > lo; + }) || + V.every(function (t) { + return t.y < 0; + }) || + V.every(function (t) { + return t.y > lo; + }) + ) + ) + for (var m = 0, v = 0; v < d.length; v++) { + var g = d[v]; + if (v >= 1) { + var x = d[v - 1]; + if (!uu(g, x)) { + h.vertexLength + 4 > Ea.MAX_VERTEX_ARRAY_LENGTH && + (h = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + )); + var b = g.sub(x)._perp()._unit(), + w = x.dist(g); + m + w > 32768 && (m = 0), + ou(this.layoutVertexArray, g.x, g.y, b.x, b.y, 0, 0, m), + ou(this.layoutVertexArray, g.x, g.y, b.x, b.y, 0, 1, m), + (a.x += 2 * g.x), + (a.y += 2 * g.y), + (a.vertexCount += 2), + ou( + this.layoutVertexArray, + x.x, + x.y, + b.x, + b.y, + 0, + 0, + (m += w), + ), + ou(this.layoutVertexArray, x.x, x.y, b.x, b.y, 0, 1, m), + (a.x += 2 * x.x), + (a.y += 2 * x.y), + (a.vertexCount += 2); + var _ = h.vertexLength; + this.indexArray.emplaceBack(_, _ + 2, _ + 1), + this.indexArray.emplaceBack(_ + 1, _ + 2, _ + 3), + (h.vertexLength += 4), + (h.primitiveLength += 2); + } + } + } + } + if ( + (h.vertexLength + l > Ea.MAX_VERTEX_ARRAY_LENGTH && + (h = this.segments.prepareSegment( + l, + this.layoutVertexArray, + this.indexArray, + )), + 'Polygon' === iu[t.type]) + ) { + for ( + var A = [], k = [], S = h.vertexLength, I = 0, M = u; + I < M.length; + I += 1 + ) { + var z = M[I]; + if (0 !== z.length) { + z !== u[0] && k.push(A.length / 2); + for (var P = 0; P < z.length; P++) { + var B = z[P]; + ou(this.layoutVertexArray, B.x, B.y, 0, 0, 1, 1, 0), + (a.x += B.x), + (a.y += B.y), + (a.vertexCount += 1), + A.push(B.x), + A.push(B.y); + } + } + } + for (var C = is.exports(A, k), E = 0; E < C.length; E += 3) + this.indexArray.emplaceBack(S + C[E], S + C[E + 2], S + C[E + 1]); + (h.primitiveLength += C.length / 3), (h.vertexLength += l); + } + } + for (var V, T = 0; T < a.vertexCount; T++) + this.centroidVertexArray.emplaceBack( + Math.floor(a.x / a.vertexCount), + Math.floor(a.y / a.vertexCount), + ); + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + }), + qn('FillExtrusionBucket', su, { omit: ['layers', 'features'] }); + var lu = { + paint: new Mi({ + 'fill-extrusion-opacity': new _i( + gt['paint_fill-extrusion']['fill-extrusion-opacity'], + ), + 'fill-extrusion-color': new Ai( + gt['paint_fill-extrusion']['fill-extrusion-color'], + ), + 'fill-extrusion-translate': new _i( + gt['paint_fill-extrusion']['fill-extrusion-translate'], + ), + 'fill-extrusion-translate-anchor': new _i( + gt['paint_fill-extrusion']['fill-extrusion-translate-anchor'], + ), + 'fill-extrusion-pattern': new ki( + gt['paint_fill-extrusion']['fill-extrusion-pattern'], + ), + 'fill-extrusion-height': new Ai( + gt['paint_fill-extrusion']['fill-extrusion-height'], + ), + 'fill-extrusion-base': new Ai( + gt['paint_fill-extrusion']['fill-extrusion-base'], + ), + 'fill-extrusion-vertical-gradient': new _i( + gt['paint_fill-extrusion']['fill-extrusion-vertical-gradient'], + ), + }), + }, + pu = (function (t) { + function e(e) { + t.call(this, e, lu); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.createBucket = function (t) { + return new su(t); + }), + (e.prototype.queryRadius = function () { + return Po(this.paint.get('fill-extrusion-translate')); + }), + (e.prototype.is3D = function () { + return !0; + }), + (e.prototype.queryIntersectsFeature = function ( + t, + e, + r, + n, + i, + a, + o, + s, + ) { + var u = Bo( + t, + this.paint.get('fill-extrusion-translate'), + this.paint.get('fill-extrusion-translate-anchor'), + a.angle, + o, + ), + l = this.paint.get('fill-extrusion-height').evaluate(e, r), + p = this.paint.get('fill-extrusion-base').evaluate(e, r), + c = (function (t, e, r, n) { + for (var i = [], a = 0, o = t; a < o.length; a += 1) { + var s = o[a], + u = [s.x, s.y, 0, 1]; + qo(u, u, e), i.push(new I(u[0] / u[3], u[1] / u[3])); + } + return i; + })(u, s), + h = (function (t, e, r, n) { + for ( + var i = [], + a = [], + o = n[8] * e, + s = n[9] * e, + u = n[10] * e, + l = n[11] * e, + p = n[8] * r, + c = n[9] * r, + h = n[10] * r, + f = n[11] * r, + y = 0, + d = t; + y < d.length; + y += 1 + ) { + for ( + var m = [], v = [], g = 0, x = d[y]; + g < x.length; + g += 1 + ) { + var b = x[g], + w = b.x, + _ = b.y, + A = n[0] * w + n[4] * _ + n[12], + k = n[1] * w + n[5] * _ + n[13], + S = n[2] * w + n[6] * _ + n[14], + M = n[3] * w + n[7] * _ + n[15], + z = S + u, + P = M + l, + B = A + p, + C = k + c, + E = S + h, + V = M + f, + T = new I((A + o) / P, (k + s) / P); + (T.z = z / P), m.push(T); + var F = new I(B / V, C / V); + (F.z = E / V), v.push(F); + } + i.push(m), a.push(v); + } + return [i, a]; + })(n, p, l, s); + return (function (t, e, r) { + var n = 1 / 0; + xo(r, e) && (n = hu(r, e[0])); + for (var i = 0; i < e.length; i++) + for (var a = e[i], o = t[i], s = 0; s < a.length - 1; s++) { + var u = a[s], + l = [u, a[s + 1], o[s + 1], o[s], u]; + vo(r, l) && (n = Math.min(n, hu(r, l))); + } + return n !== 1 / 0 && n; + })(h[0], h[1], c); + }), + e + ); + })(Pi); + function cu(t, e) { + return t.x * e.x + t.y * e.y; + } + function hu(t, e) { + if (1 === t.length) { + for (var r, n = 0, i = e[n++]; !r || i.equals(r); ) + if (!(r = e[n++])) return 1 / 0; + for (; n < e.length; n++) { + var a = e[n], + o = t[0], + s = r.sub(i), + u = a.sub(i), + l = o.sub(i), + p = cu(s, s), + c = cu(s, u), + h = cu(u, u), + f = cu(l, s), + y = cu(l, u), + d = p * h - c * c, + m = (h * f - c * y) / d, + v = (p * y - c * f) / d, + g = i.z * (1 - m - v) + r.z * m + a.z * v; + if (isFinite(g)) return g; + } + return 1 / 0; + } + for (var x = 1 / 0, b = 0, w = e; b < w.length; b += 1) + x = Math.min(x, w[b].z); + return x; + } + var fu = Vi( + [ + { name: 'a_pos_normal', components: 2, type: 'Int16' }, + { name: 'a_data', components: 4, type: 'Uint8' }, + ], + 4, + ).members, + yu = Vi([ + { name: 'a_uv_x', components: 1, type: 'Float32' }, + { name: 'a_split_index', components: 1, type: 'Float32' }, + ]).members, + du = Gs.VectorTileFeature.types, + mu = Math.cos((Math.PI / 180) * 37.5), + vu = Math.pow(2, 14) / 0.5, + gu = function (t) { + var e = this; + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map(function (t) { + return t.id; + })), + (this.index = t.index), + (this.hasPattern = !1), + (this.patternFeatures = []), + (this.lineClipsArray = []), + (this.gradients = {}), + this.layers.forEach(function (t) { + e.gradients[t.id] = {}; + }), + (this.layoutVertexArray = new ga()), + (this.layoutVertexArray2 = new xa()), + (this.indexArray = new za()), + (this.programConfigurations = new oo(t.layers, t.zoom)), + (this.segments = new Ea()), + (this.maxLineLength = 0), + (this.stateDependentLayerIds = this.layers + .filter(function (t) { + return t.isStateDependent(); + }) + .map(function (t) { + return t.id; + })); + }; + (gu.prototype.populate = function (t, e, r) { + this.hasPattern = Ls('line', this.layers, e); + for ( + var n = this.layers[0].layout.get('line-sort-key'), + i = !n.isConstant(), + a = [], + o = 0, + s = t; + o < s.length; + o += 1 + ) { + var u = s[o], + l = u.feature, + p = u.id, + c = u.index, + h = u.sourceLayerIndex, + f = this.layers[0]._featureFilter.needGeometry, + y = fo(l, f); + if (this.layers[0]._featureFilter.filter(new fi(this.zoom), y, r)) { + var d = i ? n.evaluate(y, {}, r) : void 0, + m = { + id: p, + properties: l.properties, + type: l.type, + sourceLayerIndex: h, + index: c, + geometry: f ? y.geometry : ho(l), + patterns: {}, + sortKey: d, + }; + a.push(m); + } + } + i && + a.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + for (var v = 0, g = a; v < g.length; v += 1) { + var x = g[v], + b = x.geometry, + w = x.index, + _ = x.sourceLayerIndex; + if (this.hasPattern) { + var A = Ds('line', this.layers, x, this.zoom, e); + this.patternFeatures.push(A); + } else this.addFeature(x, b, w, r, {}); + e.featureIndex.insert(t[w].feature, b, w, _, this.index); + } + }), + (gu.prototype.update = function (t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + }), + (gu.prototype.addFeatures = function (t, e, r) { + for (var n = 0, i = this.patternFeatures; n < i.length; n += 1) { + var a = i[n]; + this.addFeature(a, a.geometry, a.index, e, r); + } + }), + (gu.prototype.isEmpty = function () { + return 0 === this.layoutVertexArray.length; + }), + (gu.prototype.uploadPending = function () { + return !this.uploaded || this.programConfigurations.needsUpload; + }), + (gu.prototype.upload = function (t) { + this.uploaded || + (0 !== this.layoutVertexArray2.length && + (this.layoutVertexBuffer2 = t.createVertexBuffer( + this.layoutVertexArray2, + yu, + )), + (this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + fu, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + }), + (gu.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy()); + }), + (gu.prototype.lineFeatureClips = function (t) { + if ( + t.properties && + Object.prototype.hasOwnProperty.call( + t.properties, + 'mapbox_clip_start', + ) && + Object.prototype.hasOwnProperty.call(t.properties, 'mapbox_clip_end') + ) + return { + start: +t.properties.mapbox_clip_start, + end: +t.properties.mapbox_clip_end, + }; + }), + (gu.prototype.addFeature = function (t, e, r, n, i) { + var a = this.layers[0].layout, + o = a.get('line-join').evaluate(t, {}), + s = a.get('line-cap'), + u = a.get('line-miter-limit'), + l = a.get('line-round-limit'); + this.lineClips = this.lineFeatureClips(t); + for (var p = 0, c = e; p < c.length; p += 1) + this.addLine(c[p], t, o, s, u, l); + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + }), + (gu.prototype.addLine = function (t, e, r, n, i, a) { + if ( + ((this.distance = 0), + (this.scaledDistance = 0), + (this.totalDistance = 0), + this.lineClips) + ) { + this.lineClipsArray.push(this.lineClips); + for (var o = 0; o < t.length - 1; o++) + this.totalDistance += t[o].dist(t[o + 1]); + this.updateScaledDistance(), + (this.maxLineLength = Math.max( + this.maxLineLength, + this.totalDistance, + )); + } + for ( + var s = 'Polygon' === du[e.type], u = t.length; + u >= 2 && t[u - 1].equals(t[u - 2]); + + ) + u--; + for (var l = 0; l < u - 1 && t[l].equals(t[l + 1]); ) l++; + if (!(u < (s ? 3 : 2))) { + 'bevel' === r && (i = 1.05); + var p, + c, + h, + f, + y, + d = this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0, + m = this.segments.prepareSegment( + 10 * u, + this.layoutVertexArray, + this.indexArray, + ); + (this.e1 = this.e2 = -1), + s && + (y = t[l] + .sub((p = t[u - 2])) + ._unit() + ._perp()); + for (var v = l; v < u; v++) + if ( + !(h = v === u - 1 ? (s ? t[l + 1] : void 0) : t[v + 1]) || + !t[v].equals(h) + ) { + y && (f = y), + p && (c = p), + (p = t[v]), + (y = h ? h.sub(p)._unit()._perp() : f); + var g = (f = f || y).add(y); + (0 === g.x && 0 === g.y) || g._unit(); + var x = f.x * y.x + f.y * y.y, + b = g.x * y.x + g.y * y.y, + w = 0 !== b ? 1 / b : 1 / 0, + _ = 2 * Math.sqrt(2 - 2 * b), + A = b < mu && c && h, + k = f.x * y.y - f.y * y.x > 0; + if (A && v > l) { + var S = p.dist(c); + if (S > 2 * d) { + var I = p.sub( + p + .sub(c) + ._mult(d / S) + ._round(), + ); + this.updateDistance(c, I), + this.addCurrentVertex(I, f, 0, 0, m), + (c = I); + } + } + var M = c && h, + z = M ? r : s ? 'butt' : n; + if ( + (M && + 'round' === z && + (w < a ? (z = 'miter') : w <= 2 && (z = 'fakeround')), + 'miter' === z && w > i && (z = 'bevel'), + 'bevel' === z && + (w > 2 && (z = 'flipbevel'), w < i && (z = 'miter')), + c && this.updateDistance(c, p), + 'miter' === z) + ) + g._mult(w), this.addCurrentVertex(p, g, 0, 0, m); + else if ('flipbevel' === z) { + if (w > 100) g = y.mult(-1); + else { + var P = (w * f.add(y).mag()) / f.sub(y).mag(); + g._perp()._mult(P * (k ? -1 : 1)); + } + this.addCurrentVertex(p, g, 0, 0, m), + this.addCurrentVertex(p, g.mult(-1), 0, 0, m); + } else if ('bevel' === z || 'fakeround' === z) { + var B = -Math.sqrt(w * w - 1), + C = k ? B : 0, + E = k ? 0 : B; + if ( + (c && this.addCurrentVertex(p, f, C, E, m), 'fakeround' === z) + ) + for ( + var V = Math.round((180 * _) / Math.PI / 20), T = 1; + T < V; + T++ + ) { + var F = T / V; + if (0.5 !== F) { + var O = F - 0.5; + F += + F * + O * + (F - 1) * + ((1.0904 + x * (x * (3.55645 - 1.43519 * x) - 3.2452)) * + O * + O + + (0.848013 + x * (0.215638 * x - 1.06021))); + } + var L = y + .sub(f) + ._mult(F) + ._add(f) + ._unit() + ._mult(k ? -1 : 1); + this.addHalfVertex(p, L.x, L.y, !1, k, 0, m); + } + h && this.addCurrentVertex(p, y, -C, -E, m); + } else if ('butt' === z) this.addCurrentVertex(p, g, 0, 0, m); + else if ('square' === z) { + var D = c ? 1 : -1; + this.addCurrentVertex(p, g, D, D, m); + } else + 'round' === z && + (c && + (this.addCurrentVertex(p, f, 0, 0, m), + this.addCurrentVertex(p, f, 1, 1, m, !0)), + h && + (this.addCurrentVertex(p, y, -1, -1, m, !0), + this.addCurrentVertex(p, y, 0, 0, m))); + if (A && v < u - 1) { + var j = p.dist(h); + if (j > 2 * d) { + var R = p.add( + h + .sub(p) + ._mult(d / j) + ._round(), + ); + this.updateDistance(p, R), + this.addCurrentVertex(R, y, 0, 0, m), + (p = R); + } + } + } + } + }), + (gu.prototype.addCurrentVertex = function (t, e, r, n, i, a) { + void 0 === a && (a = !1); + var o = e.y * n - e.x, + s = -e.y - e.x * n; + this.addHalfVertex(t, e.x + e.y * r, e.y - e.x * r, a, !1, r, i), + this.addHalfVertex(t, o, s, a, !0, -n, i), + this.distance > vu / 2 && + 0 === this.totalDistance && + ((this.distance = 0), this.addCurrentVertex(t, e, r, n, i, a)); + }), + (gu.prototype.addHalfVertex = function (t, e, r, n, i, a, o) { + var s = + 0.5 * + (this.lineClips + ? this.scaledDistance * (vu - 1) + : this.scaledDistance); + this.layoutVertexArray.emplaceBack( + (t.x << 1) + (n ? 1 : 0), + (t.y << 1) + (i ? 1 : 0), + Math.round(63 * e) + 128, + Math.round(63 * r) + 128, + (1 + (0 === a ? 0 : a < 0 ? -1 : 1)) | ((63 & s) << 2), + s >> 6, + ), + this.lineClips && + this.layoutVertexArray2.emplaceBack( + (this.scaledDistance - this.lineClips.start) / + (this.lineClips.end - this.lineClips.start), + this.lineClipsArray.length, + ); + var u = o.vertexLength++; + this.e1 >= 0 && + this.e2 >= 0 && + (this.indexArray.emplaceBack(this.e1, this.e2, u), + o.primitiveLength++), + i ? (this.e2 = u) : (this.e1 = u); + }), + (gu.prototype.updateScaledDistance = function () { + this.scaledDistance = this.lineClips + ? this.lineClips.start + + ((this.lineClips.end - this.lineClips.start) * this.distance) / + this.totalDistance + : this.distance; + }), + (gu.prototype.updateDistance = function (t, e) { + (this.distance += t.dist(e)), this.updateScaledDistance(); + }), + qn('LineBucket', gu, { omit: ['layers', 'patternFeatures'] }); + var xu = new Mi({ + 'line-cap': new _i(gt.layout_line['line-cap']), + 'line-join': new Ai(gt.layout_line['line-join']), + 'line-miter-limit': new _i(gt.layout_line['line-miter-limit']), + 'line-round-limit': new _i(gt.layout_line['line-round-limit']), + 'line-sort-key': new Ai(gt.layout_line['line-sort-key']), + }), + bu = { + paint: new Mi({ + 'line-opacity': new Ai(gt.paint_line['line-opacity']), + 'line-color': new Ai(gt.paint_line['line-color']), + 'line-translate': new _i(gt.paint_line['line-translate']), + 'line-translate-anchor': new _i( + gt.paint_line['line-translate-anchor'], + ), + 'line-width': new Ai(gt.paint_line['line-width']), + 'line-gap-width': new Ai(gt.paint_line['line-gap-width']), + 'line-offset': new Ai(gt.paint_line['line-offset']), + 'line-blur': new Ai(gt.paint_line['line-blur']), + 'line-dasharray': new Si(gt.paint_line['line-dasharray']), + 'line-pattern': new ki(gt.paint_line['line-pattern']), + 'line-gradient': new Ii(gt.paint_line['line-gradient']), + }), + layout: xu, + }, + wu = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.possiblyEvaluate = function (e, r) { + return ( + (r = new fi(Math.floor(r.zoom), { + now: r.now, + fadeDuration: r.fadeDuration, + zoomHistory: r.zoomHistory, + transition: r.transition, + })), + t.prototype.possiblyEvaluate.call(this, e, r) + ); + }), + (e.prototype.evaluate = function (e, r, n, i) { + return ( + (r = s({}, r, { zoom: Math.floor(r.zoom) })), + t.prototype.evaluate.call(this, e, r, n, i) + ); + }), + e + ); + })(Ai), + _u = new wu(bu.paint.properties['line-width'].specification); + _u.useIntegerZoom = !0; + var Au = (function (t) { + function e(e) { + t.call(this, e, bu), (this.gradientVersion = 0); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._handleSpecialPaintPropertyUpdate = function (t) { + 'line-gradient' === t && + ((this.stepInterpolant = + this._transitionablePaint._values['line-gradient'].value + .expression._styleExpression.expression instanceof je), + (this.gradientVersion = + (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER)); + }), + (e.prototype.gradientExpression = function () { + return this._transitionablePaint._values['line-gradient'].value + .expression; + }), + (e.prototype.recalculate = function (e, r) { + t.prototype.recalculate.call(this, e, r), + (this.paint._values['line-floorwidth'] = _u.possiblyEvaluate( + this._transitioningPaint._values['line-width'].value, + e, + )); + }), + (e.prototype.createBucket = function (t) { + return new gu(t); + }), + (e.prototype.queryRadius = function (t) { + var e = t, + r = ku(zo('line-width', this, e), zo('line-gap-width', this, e)), + n = zo('line-offset', this, e); + return r / 2 + Math.abs(n) + Po(this.paint.get('line-translate')); + }), + (e.prototype.queryIntersectsFeature = function (t, e, r, n, i, a, o) { + var s = Bo( + t, + this.paint.get('line-translate'), + this.paint.get('line-translate-anchor'), + a.angle, + o, + ), + u = + (o / 2) * + ku( + this.paint.get('line-width').evaluate(e, r), + this.paint.get('line-gap-width').evaluate(e, r), + ), + l = this.paint.get('line-offset').evaluate(e, r); + return ( + l && + (n = (function (t, e) { + for (var r = [], n = 0; n < t.length; n++) { + for (var i = t[n], a = [], o = 0; o < i.length; o++) { + var s = i[o - 1], + u = i[o], + l = i[o + 1], + p = 0 === o ? new I(0, 0) : u.sub(s)._unit()._perp(), + c = + o === i.length - 1 + ? new I(0, 0) + : l.sub(u)._unit()._perp(), + h = p._add(c)._unit(), + f = h.x * c.x + h.y * c.y; + 0 !== f && h._mult(1 / f), a.push(h._mult(e)._add(u)); + } + r.push(a); + } + return r; + })(n, l * o)), + (function (t, e, r) { + for (var n = 0; n < e.length; n++) { + var i = e[n]; + if (t.length >= 3) + for (var a = 0; a < i.length; a++) if (Io(t, i[a])) return !0; + if (bo(t, i, r)) return !0; + } + return !1; + })(s, n, u) + ); + }), + (e.prototype.isTileClipped = function () { + return !0; + }), + e + ); + })(Pi); + function ku(t, e) { + return e > 0 ? e + 2 * t : t; + } + var Su = Vi( + [ + { name: 'a_pos_offset', components: 4, type: 'Int16' }, + { name: 'a_data', components: 4, type: 'Uint16' }, + { name: 'a_pixeloffset', components: 4, type: 'Int16' }, + ], + 4, + ), + Iu = Vi([{ name: 'a_projected_pos', components: 3, type: 'Float32' }], 4); + Vi([{ name: 'a_fade_opacity', components: 1, type: 'Uint32' }], 4); + var Mu = Vi([ + { name: 'a_placed', components: 2, type: 'Uint8' }, + { name: 'a_shift', components: 2, type: 'Float32' }, + ]); + Vi([ + { type: 'Int16', name: 'anchorPointX' }, + { type: 'Int16', name: 'anchorPointY' }, + { type: 'Int16', name: 'x1' }, + { type: 'Int16', name: 'y1' }, + { type: 'Int16', name: 'x2' }, + { type: 'Int16', name: 'y2' }, + { type: 'Uint32', name: 'featureIndex' }, + { type: 'Uint16', name: 'sourceLayerIndex' }, + { type: 'Uint16', name: 'bucketIndex' }, + ]); + var zu = Vi( + [ + { name: 'a_pos', components: 2, type: 'Int16' }, + { name: 'a_anchor_pos', components: 2, type: 'Int16' }, + { name: 'a_extrude', components: 2, type: 'Int16' }, + ], + 4, + ), + Pu = Vi( + [ + { name: 'a_pos', components: 2, type: 'Float32' }, + { name: 'a_radius', components: 1, type: 'Float32' }, + { name: 'a_flags', components: 2, type: 'Int16' }, + ], + 4, + ); + function Bu(t, e, r) { + return ( + t.sections.forEach(function (t) { + t.text = (function (t, e, r) { + var n = e.layout.get('text-transform').evaluate(r, {}); + return ( + 'uppercase' === n + ? (t = t.toLocaleUpperCase()) + : 'lowercase' === n && (t = t.toLocaleLowerCase()), + hi.applyArabicShaping && (t = hi.applyArabicShaping(t)), + t + ); + })(t.text, e, r); + }), + t + ); + } + Vi([{ name: 'triangle', components: 3, type: 'Uint16' }]), + Vi([ + { type: 'Int16', name: 'anchorX' }, + { type: 'Int16', name: 'anchorY' }, + { type: 'Uint16', name: 'glyphStartIndex' }, + { type: 'Uint16', name: 'numGlyphs' }, + { type: 'Uint32', name: 'vertexStartIndex' }, + { type: 'Uint32', name: 'lineStartIndex' }, + { type: 'Uint32', name: 'lineLength' }, + { type: 'Uint16', name: 'segment' }, + { type: 'Uint16', name: 'lowerSize' }, + { type: 'Uint16', name: 'upperSize' }, + { type: 'Float32', name: 'lineOffsetX' }, + { type: 'Float32', name: 'lineOffsetY' }, + { type: 'Uint8', name: 'writingMode' }, + { type: 'Uint8', name: 'placedOrientation' }, + { type: 'Uint8', name: 'hidden' }, + { type: 'Uint32', name: 'crossTileID' }, + { type: 'Int16', name: 'associatedIconIndex' }, + ]), + Vi([ + { type: 'Int16', name: 'anchorX' }, + { type: 'Int16', name: 'anchorY' }, + { type: 'Int16', name: 'rightJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'centerJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'leftJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'verticalPlacedTextSymbolIndex' }, + { type: 'Int16', name: 'placedIconSymbolIndex' }, + { type: 'Int16', name: 'verticalPlacedIconSymbolIndex' }, + { type: 'Uint16', name: 'key' }, + { type: 'Uint16', name: 'textBoxStartIndex' }, + { type: 'Uint16', name: 'textBoxEndIndex' }, + { type: 'Uint16', name: 'verticalTextBoxStartIndex' }, + { type: 'Uint16', name: 'verticalTextBoxEndIndex' }, + { type: 'Uint16', name: 'iconBoxStartIndex' }, + { type: 'Uint16', name: 'iconBoxEndIndex' }, + { type: 'Uint16', name: 'verticalIconBoxStartIndex' }, + { type: 'Uint16', name: 'verticalIconBoxEndIndex' }, + { type: 'Uint16', name: 'featureIndex' }, + { type: 'Uint16', name: 'numHorizontalGlyphVertices' }, + { type: 'Uint16', name: 'numVerticalGlyphVertices' }, + { type: 'Uint16', name: 'numIconVertices' }, + { type: 'Uint16', name: 'numVerticalIconVertices' }, + { type: 'Uint16', name: 'useRuntimeCollisionCircles' }, + { type: 'Uint32', name: 'crossTileID' }, + { type: 'Float32', name: 'textBoxScale' }, + { type: 'Float32', components: 2, name: 'textOffset' }, + { type: 'Float32', name: 'collisionCircleDiameter' }, + ]), + Vi([{ type: 'Float32', name: 'offsetX' }]), + Vi([ + { type: 'Int16', name: 'x' }, + { type: 'Int16', name: 'y' }, + { type: 'Int16', name: 'tileUnitDistanceFromAnchor' }, + ]); + var Cu = { + '!': '︕', + '#': '#', + $: '$', + '%': '%', + '&': '&', + '(': '︵', + ')': '︶', + '*': '*', + '+': '+', + ',': '︐', + '-': '︲', + '.': '・', + '/': '/', + ':': '︓', + ';': '︔', + '<': '︿', + '=': '=', + '>': '﹀', + '?': '︖', + '@': '@', + '[': '﹇', + '\\': '\', + ']': '﹈', + '^': '^', + _: '︳', + '`': '`', + '{': '︷', + '|': '―', + '}': '︸', + '~': '~', + '¢': '¢', + '£': '£', + '¥': '¥', + '¦': '¦', + '¬': '¬', + '¯': ' ̄', + '–': '︲', + '—': '︱', + '‘': '﹃', + '’': '﹄', + '“': '﹁', + '”': '﹂', + '…': '︙', + '‧': '・', + '₩': '₩', + '、': '︑', + '。': '︒', + '〈': '︿', + '〉': '﹀', + '《': '︽', + '》': '︾', + '「': '﹁', + '」': '﹂', + '『': '﹃', + '』': '﹄', + '【': '︻', + '】': '︼', + '〔': '︹', + '〕': '︺', + '〖': '︗', + '〗': '︘', + '!': '︕', + '(': '︵', + ')': '︶', + ',': '︐', + '-': '︲', + '.': '・', + ':': '︓', + ';': '︔', + '<': '︿', + '>': '﹀', + '?': '︖', + '[': '﹇', + ']': '﹈', + '_': '︳', + '{': '︷', + '|': '―', + '}': '︸', + '⦅': '︵', + '⦆': '︶', + '。': '︒', + '「': '﹁', + '」': '﹂', + }, + Eu = 24, + Vu = Ou, + Tu = function (t, e, r, n, i) { + var a, + o, + s = 8 * i - n - 1, + u = (1 << s) - 1, + l = u >> 1, + p = -7, + c = r ? i - 1 : 0, + h = r ? -1 : 1, + f = t[e + c]; + for ( + c += h, a = f & ((1 << -p) - 1), f >>= -p, p += s; + p > 0; + a = 256 * a + t[e + c], c += h, p -= 8 + ); + for ( + o = a & ((1 << -p) - 1), a >>= -p, p += n; + p > 0; + o = 256 * o + t[e + c], c += h, p -= 8 + ); + if (0 === a) a = 1 - l; + else { + if (a === u) return o ? NaN : (1 / 0) * (f ? -1 : 1); + (o += Math.pow(2, n)), (a -= l); + } + return (f ? -1 : 1) * o * Math.pow(2, a - n); + }, + Fu = function (t, e, r, n, i, a) { + var o, + s, + u, + l = 8 * a - i - 1, + p = (1 << l) - 1, + c = p >> 1, + h = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + f = n ? 0 : a - 1, + y = n ? 1 : -1, + d = e < 0 || (0 === e && 1 / e < 0) ? 1 : 0; + for ( + e = Math.abs(e), + isNaN(e) || e === 1 / 0 + ? ((s = isNaN(e) ? 1 : 0), (o = p)) + : ((o = Math.floor(Math.log(e) / Math.LN2)), + e * (u = Math.pow(2, -o)) < 1 && (o--, (u *= 2)), + (e += o + c >= 1 ? h / u : h * Math.pow(2, 1 - c)) * u >= 2 && + (o++, (u /= 2)), + o + c >= p + ? ((s = 0), (o = p)) + : o + c >= 1 + ? ((s = (e * u - 1) * Math.pow(2, i)), (o += c)) + : ((s = e * Math.pow(2, c - 1) * Math.pow(2, i)), (o = 0))); + i >= 8; + t[r + f] = 255 & s, f += y, s /= 256, i -= 8 + ); + for ( + o = (o << i) | s, l += i; + l > 0; + t[r + f] = 255 & o, f += y, o /= 256, l -= 8 + ); + t[r + f - y] |= 128 * d; + }; + function Ou(t) { + (this.buf = + ArrayBuffer.isView && ArrayBuffer.isView(t) + ? t + : new Uint8Array(t || 0)), + (this.pos = 0), + (this.type = 0), + (this.length = this.buf.length); + } + (Ou.Varint = 0), (Ou.Fixed64 = 1), (Ou.Bytes = 2), (Ou.Fixed32 = 5); + var Lu = 4294967296, + Du = 1 / Lu, + ju = 'undefined' == typeof TextDecoder ? null : new TextDecoder('utf8'); + function Ru(t) { + return t.type === Ou.Bytes ? t.readVarint() + t.pos : t.pos + 1; + } + function Uu(t, e, r) { + return r + ? 4294967296 * e + (t >>> 0) + : 4294967296 * (e >>> 0) + (t >>> 0); + } + function qu(t, e, r) { + var n = + e <= 16383 + ? 1 + : e <= 2097151 + ? 2 + : e <= 268435455 + ? 3 + : Math.floor(Math.log(e) / (7 * Math.LN2)); + r.realloc(n); + for (var i = r.pos - 1; i >= t; i--) r.buf[i + n] = r.buf[i]; + } + function Nu(t, e) { + for (var r = 0; r < t.length; r++) e.writeVarint(t[r]); + } + function Zu(t, e) { + for (var r = 0; r < t.length; r++) e.writeSVarint(t[r]); + } + function Ku(t, e) { + for (var r = 0; r < t.length; r++) e.writeFloat(t[r]); + } + function Gu(t, e) { + for (var r = 0; r < t.length; r++) e.writeDouble(t[r]); + } + function Ju(t, e) { + for (var r = 0; r < t.length; r++) e.writeBoolean(t[r]); + } + function Xu(t, e) { + for (var r = 0; r < t.length; r++) e.writeFixed32(t[r]); + } + function Yu(t, e) { + for (var r = 0; r < t.length; r++) e.writeSFixed32(t[r]); + } + function Hu(t, e) { + for (var r = 0; r < t.length; r++) e.writeFixed64(t[r]); + } + function Wu(t, e) { + for (var r = 0; r < t.length; r++) e.writeSFixed64(t[r]); + } + function $u(t, e) { + return (t[e] | (t[e + 1] << 8) | (t[e + 2] << 16)) + 16777216 * t[e + 3]; + } + function Qu(t, e, r) { + (t[r] = e), + (t[r + 1] = e >>> 8), + (t[r + 2] = e >>> 16), + (t[r + 3] = e >>> 24); + } + function tl(t, e) { + return (t[e] | (t[e + 1] << 8) | (t[e + 2] << 16)) + (t[e + 3] << 24); + } + function el(t, e, r) { + 1 === t && r.readMessage(rl, e); + } + function rl(t, e, r) { + if (3 === t) { + var n = r.readMessage(nl, {}), + i = n.width, + a = n.height, + o = n.left, + s = n.top, + u = n.advance; + e.push({ + id: n.id, + bitmap: new Wo({ width: i + 6, height: a + 6 }, n.bitmap), + metrics: { width: i, height: a, left: o, top: s, advance: u }, + }); + } + } + function nl(t, e, r) { + 1 === t + ? (e.id = r.readVarint()) + : 2 === t + ? (e.bitmap = r.readBytes()) + : 3 === t + ? (e.width = r.readVarint()) + : 4 === t + ? (e.height = r.readVarint()) + : 5 === t + ? (e.left = r.readSVarint()) + : 6 === t + ? (e.top = r.readSVarint()) + : 7 === t && (e.advance = r.readVarint()); + } + function il(t) { + for (var e = 0, r = 0, n = 0, i = t; n < i.length; n += 1) { + var a = i[n]; + (e += a.w * a.h), (r = Math.max(r, a.w)); + } + t.sort(function (t, e) { + return e.h - t.h; + }); + for ( + var o = [ + { + x: 0, + y: 0, + w: Math.max(Math.ceil(Math.sqrt(e / 0.95)), r), + h: 1 / 0, + }, + ], + s = 0, + u = 0, + l = 0, + p = t; + l < p.length; + l += 1 + ) + for (var c = p[l], h = o.length - 1; h >= 0; h--) { + var f = o[h]; + if (!(c.w > f.w || c.h > f.h)) { + if ( + ((c.x = f.x), + (c.y = f.y), + (u = Math.max(u, c.y + c.h)), + (s = Math.max(s, c.x + c.w)), + c.w === f.w && c.h === f.h) + ) { + var y = o.pop(); + h < o.length && (o[h] = y); + } else + c.h === f.h + ? ((f.x += c.w), (f.w -= c.w)) + : c.w === f.w + ? ((f.y += c.h), (f.h -= c.h)) + : (o.push({ x: f.x + c.w, y: f.y, w: f.w - c.w, h: c.h }), + (f.y += c.h), + (f.h -= c.h)); + break; + } + } + return { w: s, h: u, fill: e / (s * u) || 0 }; + } + Ou.prototype = { + destroy: function () { + this.buf = null; + }, + readFields: function (t, e, r) { + for (r = r || this.length; this.pos < r; ) { + var n = this.readVarint(), + i = n >> 3, + a = this.pos; + (this.type = 7 & n), t(i, e, this), this.pos === a && this.skip(n); + } + return e; + }, + readMessage: function (t, e) { + return this.readFields(t, e, this.readVarint() + this.pos); + }, + readFixed32: function () { + var t = $u(this.buf, this.pos); + return (this.pos += 4), t; + }, + readSFixed32: function () { + var t = tl(this.buf, this.pos); + return (this.pos += 4), t; + }, + readFixed64: function () { + var t = $u(this.buf, this.pos) + $u(this.buf, this.pos + 4) * Lu; + return (this.pos += 8), t; + }, + readSFixed64: function () { + var t = $u(this.buf, this.pos) + tl(this.buf, this.pos + 4) * Lu; + return (this.pos += 8), t; + }, + readFloat: function () { + var t = Tu(this.buf, this.pos, !0, 23, 4); + return (this.pos += 4), t; + }, + readDouble: function () { + var t = Tu(this.buf, this.pos, !0, 52, 8); + return (this.pos += 8), t; + }, + readVarint: function (t) { + var e, + r, + n = this.buf; + return ( + (e = 127 & (r = n[this.pos++])), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 7), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 14), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 21), + r < 128 + ? e + : (function (t, e, r) { + var n, + i, + a = r.buf; + if (((n = (112 & (i = a[r.pos++])) >> 4), i < 128)) + return Uu(t, n, e); + if (((n |= (127 & (i = a[r.pos++])) << 3), i < 128)) + return Uu(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 10), i < 128) + ) + return Uu(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 17), i < 128) + ) + return Uu(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 24), i < 128) + ) + return Uu(t, n, e); + if (((n |= (1 & (i = a[r.pos++])) << 31), i < 128)) + return Uu(t, n, e); + throw new Error( + 'Expected varint not more than 10 bytes', + ); + })((e |= (15 & (r = n[this.pos])) << 28), t, this)))) + ); + }, + readVarint64: function () { + return this.readVarint(!0); + }, + readSVarint: function () { + var t = this.readVarint(); + return t % 2 == 1 ? (t + 1) / -2 : t / 2; + }, + readBoolean: function () { + return Boolean(this.readVarint()); + }, + readString: function () { + var t = this.readVarint() + this.pos, + e = this.pos; + return ( + (this.pos = t), + t - e >= 12 && ju + ? (function (t, e, r) { + return ju.decode(t.subarray(e, r)); + })(this.buf, e, t) + : (function (t, e, r) { + for (var n = '', i = e; i < r; ) { + var a, + o, + s, + u = t[i], + l = null, + p = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1; + if (i + p > r) break; + 1 === p + ? u < 128 && (l = u) + : 2 === p + ? 128 == (192 & (a = t[i + 1])) && + (l = ((31 & u) << 6) | (63 & a)) <= 127 && + (l = null) + : 3 === p + ? ((o = t[i + 2]), + 128 == (192 & (a = t[i + 1])) && + 128 == (192 & o) && + ((l = ((15 & u) << 12) | ((63 & a) << 6) | (63 & o)) <= + 2047 || + (l >= 55296 && l <= 57343)) && + (l = null)) + : 4 === p && + ((o = t[i + 2]), + (s = t[i + 3]), + 128 == (192 & (a = t[i + 1])) && + 128 == (192 & o) && + 128 == (192 & s) && + ((l = + ((15 & u) << 18) | + ((63 & a) << 12) | + ((63 & o) << 6) | + (63 & s)) <= 65535 || + l >= 1114112) && + (l = null)), + null === l + ? ((l = 65533), (p = 1)) + : l > 65535 && + ((l -= 65536), + (n += String.fromCharCode(((l >>> 10) & 1023) | 55296)), + (l = 56320 | (1023 & l))), + (n += String.fromCharCode(l)), + (i += p); + } + return n; + })(this.buf, e, t) + ); + }, + readBytes: function () { + var t = this.readVarint() + this.pos, + e = this.buf.subarray(this.pos, t); + return (this.pos = t), e; + }, + readPackedVarint: function (t, e) { + if (this.type !== Ou.Bytes) return t.push(this.readVarint(e)); + var r = Ru(this); + for (t = t || []; this.pos < r; ) t.push(this.readVarint(e)); + return t; + }, + readPackedSVarint: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readSVarint()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readSVarint()); + return t; + }, + readPackedBoolean: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readBoolean()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readBoolean()); + return t; + }, + readPackedFloat: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readFloat()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readFloat()); + return t; + }, + readPackedDouble: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readDouble()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readDouble()); + return t; + }, + readPackedFixed32: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readFixed32()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readFixed32()); + return t; + }, + readPackedSFixed32: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readSFixed32()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readSFixed32()); + return t; + }, + readPackedFixed64: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readFixed64()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readFixed64()); + return t; + }, + readPackedSFixed64: function (t) { + if (this.type !== Ou.Bytes) return t.push(this.readSFixed64()); + var e = Ru(this); + for (t = t || []; this.pos < e; ) t.push(this.readSFixed64()); + return t; + }, + skip: function (t) { + var e = 7 & t; + if (e === Ou.Varint) for (; this.buf[this.pos++] > 127; ); + else if (e === Ou.Bytes) this.pos = this.readVarint() + this.pos; + else if (e === Ou.Fixed32) this.pos += 4; + else { + if (e !== Ou.Fixed64) throw new Error('Unimplemented type: ' + e); + this.pos += 8; + } + }, + writeTag: function (t, e) { + this.writeVarint((t << 3) | e); + }, + realloc: function (t) { + for (var e = this.length || 16; e < this.pos + t; ) e *= 2; + if (e !== this.length) { + var r = new Uint8Array(e); + r.set(this.buf), (this.buf = r), (this.length = e); + } + }, + finish: function () { + return ( + (this.length = this.pos), + (this.pos = 0), + this.buf.subarray(0, this.length) + ); + }, + writeFixed32: function (t) { + this.realloc(4), Qu(this.buf, t, this.pos), (this.pos += 4); + }, + writeSFixed32: function (t) { + this.realloc(4), Qu(this.buf, t, this.pos), (this.pos += 4); + }, + writeFixed64: function (t) { + this.realloc(8), + Qu(this.buf, -1 & t, this.pos), + Qu(this.buf, Math.floor(t * Du), this.pos + 4), + (this.pos += 8); + }, + writeSFixed64: function (t) { + this.realloc(8), + Qu(this.buf, -1 & t, this.pos), + Qu(this.buf, Math.floor(t * Du), this.pos + 4), + (this.pos += 8); + }, + writeVarint: function (t) { + (t = +t || 0) > 268435455 || t < 0 + ? (function (t, e) { + var r, n; + if ( + (t >= 0 + ? ((r = t % 4294967296 | 0), (n = (t / 4294967296) | 0)) + : ((n = ~(-t / 4294967296)), + 4294967295 ^ (r = ~(-t % 4294967296)) + ? (r = (r + 1) | 0) + : ((r = 0), (n = (n + 1) | 0))), + t >= 0x10000000000000000 || t < -0x10000000000000000) + ) + throw new Error("Given varint doesn't fit into 10 bytes"); + e.realloc(10), + (function (t, e, r) { + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (r.buf[r.pos] = 127 & (t >>>= 7)); + })(r, 0, e), + (function (t, e) { + var r = (7 & t) << 4; + (e.buf[e.pos++] |= r | ((t >>>= 3) ? 128 : 0)), + t && + ((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = + (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = + (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && (e.buf[e.pos++] = 127 & t))))); + })(n, e); + })(t, this) + : (this.realloc(4), + (this.buf[this.pos++] = (127 & t) | (t > 127 ? 128 : 0)), + t <= 127 || + ((this.buf[this.pos++] = + (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)), + t <= 127 || + ((this.buf[this.pos++] = + (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)), + t <= 127 || (this.buf[this.pos++] = (t >>> 7) & 127)))); + }, + writeSVarint: function (t) { + this.writeVarint(t < 0 ? 2 * -t - 1 : 2 * t); + }, + writeBoolean: function (t) { + this.writeVarint(Boolean(t)); + }, + writeString: function (t) { + (t = String(t)), this.realloc(4 * t.length), this.pos++; + var e = this.pos; + this.pos = (function (t, e, r) { + for (var n, i, a = 0; a < e.length; a++) { + if ((n = e.charCodeAt(a)) > 55295 && n < 57344) { + if (!i) { + n > 56319 || a + 1 === e.length + ? ((t[r++] = 239), (t[r++] = 191), (t[r++] = 189)) + : (i = n); + continue; + } + if (n < 56320) { + (t[r++] = 239), (t[r++] = 191), (t[r++] = 189), (i = n); + continue; + } + (n = ((i - 55296) << 10) | (n - 56320) | 65536), (i = null); + } else + i && ((t[r++] = 239), (t[r++] = 191), (t[r++] = 189), (i = null)); + n < 128 + ? (t[r++] = n) + : (n < 2048 + ? (t[r++] = (n >> 6) | 192) + : (n < 65536 + ? (t[r++] = (n >> 12) | 224) + : ((t[r++] = (n >> 18) | 240), + (t[r++] = ((n >> 12) & 63) | 128)), + (t[r++] = ((n >> 6) & 63) | 128)), + (t[r++] = (63 & n) | 128)); + } + return r; + })(this.buf, t, this.pos); + var r = this.pos - e; + r >= 128 && qu(e, r, this), + (this.pos = e - 1), + this.writeVarint(r), + (this.pos += r); + }, + writeFloat: function (t) { + this.realloc(4), Fu(this.buf, t, this.pos, !0, 23, 4), (this.pos += 4); + }, + writeDouble: function (t) { + this.realloc(8), Fu(this.buf, t, this.pos, !0, 52, 8), (this.pos += 8); + }, + writeBytes: function (t) { + var e = t.length; + this.writeVarint(e), this.realloc(e); + for (var r = 0; r < e; r++) this.buf[this.pos++] = t[r]; + }, + writeRawMessage: function (t, e) { + this.pos++; + var r = this.pos; + t(e, this); + var n = this.pos - r; + n >= 128 && qu(r, n, this), + (this.pos = r - 1), + this.writeVarint(n), + (this.pos += n); + }, + writeMessage: function (t, e, r) { + this.writeTag(t, Ou.Bytes), this.writeRawMessage(e, r); + }, + writePackedVarint: function (t, e) { + e.length && this.writeMessage(t, Nu, e); + }, + writePackedSVarint: function (t, e) { + e.length && this.writeMessage(t, Zu, e); + }, + writePackedBoolean: function (t, e) { + e.length && this.writeMessage(t, Ju, e); + }, + writePackedFloat: function (t, e) { + e.length && this.writeMessage(t, Ku, e); + }, + writePackedDouble: function (t, e) { + e.length && this.writeMessage(t, Gu, e); + }, + writePackedFixed32: function (t, e) { + e.length && this.writeMessage(t, Xu, e); + }, + writePackedSFixed32: function (t, e) { + e.length && this.writeMessage(t, Yu, e); + }, + writePackedFixed64: function (t, e) { + e.length && this.writeMessage(t, Hu, e); + }, + writePackedSFixed64: function (t, e) { + e.length && this.writeMessage(t, Wu, e); + }, + writeBytesField: function (t, e) { + this.writeTag(t, Ou.Bytes), this.writeBytes(e); + }, + writeFixed32Field: function (t, e) { + this.writeTag(t, Ou.Fixed32), this.writeFixed32(e); + }, + writeSFixed32Field: function (t, e) { + this.writeTag(t, Ou.Fixed32), this.writeSFixed32(e); + }, + writeFixed64Field: function (t, e) { + this.writeTag(t, Ou.Fixed64), this.writeFixed64(e); + }, + writeSFixed64Field: function (t, e) { + this.writeTag(t, Ou.Fixed64), this.writeSFixed64(e); + }, + writeVarintField: function (t, e) { + this.writeTag(t, Ou.Varint), this.writeVarint(e); + }, + writeSVarintField: function (t, e) { + this.writeTag(t, Ou.Varint), this.writeSVarint(e); + }, + writeStringField: function (t, e) { + this.writeTag(t, Ou.Bytes), this.writeString(e); + }, + writeFloatField: function (t, e) { + this.writeTag(t, Ou.Fixed32), this.writeFloat(e); + }, + writeDoubleField: function (t, e) { + this.writeTag(t, Ou.Fixed64), this.writeDouble(e); + }, + writeBooleanField: function (t, e) { + this.writeVarintField(t, Boolean(e)); + }, + }; + var al = function (t, e) { + var r = e.pixelRatio, + n = e.version, + i = e.stretchX, + a = e.stretchY, + o = e.content; + (this.paddedRect = t), + (this.pixelRatio = r), + (this.stretchX = i), + (this.stretchY = a), + (this.content = o), + (this.version = n); + }, + ol = { + tl: { configurable: !0 }, + br: { configurable: !0 }, + tlbr: { configurable: !0 }, + displaySize: { configurable: !0 }, + }; + (ol.tl.get = function () { + return [this.paddedRect.x + 1, this.paddedRect.y + 1]; + }), + (ol.br.get = function () { + return [ + this.paddedRect.x + this.paddedRect.w - 1, + this.paddedRect.y + this.paddedRect.h - 1, + ]; + }), + (ol.tlbr.get = function () { + return this.tl.concat(this.br); + }), + (ol.displaySize.get = function () { + return [ + (this.paddedRect.w - 2) / this.pixelRatio, + (this.paddedRect.h - 2) / this.pixelRatio, + ]; + }), + Object.defineProperties(al.prototype, ol); + var sl, + ul = function (t, e) { + var r = {}, + n = {}; + this.haveRenderCallbacks = []; + var i = []; + this.addImages(t, r, i), this.addImages(e, n, i); + var a = il(i), + o = new $o({ width: a.w || 1, height: a.h || 1 }); + for (var s in t) { + var u = t[s], + l = r[s].paddedRect; + $o.copy( + u.data, + o, + { x: 0, y: 0 }, + { x: l.x + 1, y: l.y + 1 }, + u.data, + ); + } + for (var p in e) { + var c = e[p], + h = n[p].paddedRect, + f = h.x + 1, + y = h.y + 1, + d = c.data.width, + m = c.data.height; + $o.copy(c.data, o, { x: 0, y: 0 }, { x: f, y: y }, c.data), + $o.copy( + c.data, + o, + { x: 0, y: m - 1 }, + { x: f, y: y - 1 }, + { width: d, height: 1 }, + ), + $o.copy( + c.data, + o, + { x: 0, y: 0 }, + { x: f, y: y + m }, + { width: d, height: 1 }, + ), + $o.copy( + c.data, + o, + { x: d - 1, y: 0 }, + { x: f - 1, y: y }, + { width: 1, height: m }, + ), + $o.copy( + c.data, + o, + { x: 0, y: 0 }, + { x: f + d, y: y }, + { width: 1, height: m }, + ); + } + (this.image = o), (this.iconPositions = r), (this.patternPositions = n); + }; + (ul.prototype.addImages = function (t, e, r) { + for (var n in t) { + var i = t[n], + a = { x: 0, y: 0, w: i.data.width + 2, h: i.data.height + 2 }; + r.push(a), + (e[n] = new al(a, i)), + i.hasRenderCallback && this.haveRenderCallbacks.push(n); + } + }), + (ul.prototype.patchUpdatedImages = function (t, e) { + for (var r in (t.dispatchRenderCallbacks(this.haveRenderCallbacks), + t.updatedImages)) + this.patchUpdatedImage(this.iconPositions[r], t.getImage(r), e), + this.patchUpdatedImage(this.patternPositions[r], t.getImage(r), e); + }), + (ul.prototype.patchUpdatedImage = function (t, e, r) { + if (t && e && t.version !== e.version) { + t.version = e.version; + var n = t.tl; + r.update(e.data, void 0, { x: n[0], y: n[1] }); + } + }), + qn('ImagePosition', al), + qn('ImageAtlas', ul), + (t.WritingMode = void 0), + ((sl = t.WritingMode || (t.WritingMode = {}))[(sl.none = 0)] = 'none'), + (sl[(sl.horizontal = 1)] = 'horizontal'), + (sl[(sl.vertical = 2)] = 'vertical'), + (sl[(sl.horizontalOnly = 3)] = 'horizontalOnly'); + var ll = -17, + pl = function () { + (this.scale = 1), (this.fontStack = ''), (this.imageName = null); + }; + (pl.forText = function (t, e) { + var r = new pl(); + return (r.scale = t || 1), (r.fontStack = e), r; + }), + (pl.forImage = function (t) { + var e = new pl(); + return (e.imageName = t), e; + }); + var cl = function () { + (this.text = ''), + (this.sectionIndex = []), + (this.sections = []), + (this.imageSectionID = null); + }; + function hl(e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m) { + var v, + g = cl.fromFeature(e, a); + h === t.WritingMode.vertical && g.verticalizePunctuation(); + var x = hi.processBidirectionalText, + b = hi.processStyledBidirectionalText; + if (x && 1 === g.sections.length) { + v = []; + for ( + var w = 0, _ = x(g.toString(), bl(g, p, o, r, i, y, d)); + w < _.length; + w += 1 + ) { + var A = _[w], + k = new cl(); + (k.text = A), (k.sections = g.sections); + for (var S = 0; S < A.length; S++) k.sectionIndex.push(0); + v.push(k); + } + } else if (b) { + v = []; + for ( + var I = 0, M = b(g.text, g.sectionIndex, bl(g, p, o, r, i, y, d)); + I < M.length; + I += 1 + ) { + var z = M[I], + P = new cl(); + (P.text = z[0]), + (P.sectionIndex = z[1]), + (P.sections = g.sections), + v.push(P); + } + } else + v = (function (t, e) { + for ( + var r = [], n = t.text, i = 0, a = 0, o = e; + a < o.length; + a += 1 + ) { + var s = o[a]; + r.push(t.substring(i, s)), (i = s); + } + return i < n.length && r.push(t.substring(i, n.length)), r; + })(g, bl(g, p, o, r, i, y, d)); + var B = [], + C = { + positionedLines: B, + text: g.toString(), + top: c[1], + bottom: c[1], + left: c[0], + right: c[0], + writingMode: h, + iconsInText: !1, + verticalizable: !1, + }; + return ( + (function (e, r, n, i, a, o, s, u, l, p, c, h) { + for ( + var f = 0, + y = ll, + d = 0, + m = 0, + v = 'right' === u ? 1 : 'left' === u ? 0 : 0.5, + g = 0, + x = 0, + b = a; + x < b.length; + x += 1 + ) { + var w = b[x]; + w.trim(); + var _ = w.getMaxScale(), + A = (_ - 1) * Eu, + k = { positionedGlyphs: [], lineOffset: 0 }; + e.positionedLines[g] = k; + var S = k.positionedGlyphs, + I = 0; + if (w.length()) { + for (var M = 0; M < w.length(); M++) { + var z = w.getSection(M), + P = w.getSectionIndex(M), + B = w.getCharCode(M), + C = 0, + E = null, + V = null, + T = null, + F = Eu, + O = !( + l === t.WritingMode.horizontal || + (!c && !Hn(B)) || + (c && + (fl[B] || + ((K = B), + Xn.Arabic(K) || + Xn['Arabic Supplement'](K) || + Xn['Arabic Extended-A'](K) || + Xn['Arabic Presentation Forms-A'](K) || + Xn['Arabic Presentation Forms-B'](K)))) + ); + if (z.imageName) { + var L = i[z.imageName]; + if (!L) continue; + (T = z.imageName), + (e.iconsInText = e.iconsInText || !0), + (V = L.paddedRect); + var D = L.displaySize; + (z.scale = (z.scale * Eu) / h), + (C = A + (Eu - D[1] * z.scale)), + (F = (E = { + width: D[0], + height: D[1], + left: 1, + top: -3, + advance: O ? D[1] : D[0], + }).advance); + var j = O ? D[0] * z.scale - Eu * _ : D[1] * z.scale - Eu * _; + j > 0 && j > I && (I = j); + } else { + var R = n[z.fontStack], + U = R && R[B]; + if (U && U.rect) (V = U.rect), (E = U.metrics); + else { + var q = r[z.fontStack], + N = q && q[B]; + if (!N) continue; + E = N.metrics; + } + C = (_ - z.scale) * Eu; + } + O + ? ((e.verticalizable = !0), + S.push({ + glyph: B, + imageName: T, + x: f, + y: y + C, + vertical: O, + scale: z.scale, + fontStack: z.fontStack, + sectionIndex: P, + metrics: E, + rect: V, + }), + (f += F * z.scale + p)) + : (S.push({ + glyph: B, + imageName: T, + x: f, + y: y + C, + vertical: O, + scale: z.scale, + fontStack: z.fontStack, + sectionIndex: P, + metrics: E, + rect: V, + }), + (f += E.advance * z.scale + p)); + } + 0 !== S.length && + ((d = Math.max(f - p, d)), _l(S, 0, S.length - 1, v, I)), + (f = 0); + var Z = o * _ + I; + (k.lineOffset = Math.max(I, A)), + (y += Z), + (m = Math.max(Z, m)), + ++g; + } else (y += o), ++g; + } + var K, + G = y - ll, + J = wl(s), + X = J.horizontalAlign, + Y = J.verticalAlign; + (function (t, e, r, n, i, a, o, s, u) { + var l, + p = (e - r) * i; + l = a !== o ? -s * n - ll : (-n * u + 0.5) * o; + for (var c = 0, h = t; c < h.length; c += 1) + for (var f = 0, y = h[c].positionedGlyphs; f < y.length; f += 1) { + var d = y[f]; + (d.x += p), (d.y += l); + } + })(e.positionedLines, v, X, Y, d, m, o, G, a.length), + (e.top += -Y * G), + (e.bottom = e.top + G), + (e.left += -X * d), + (e.right = e.left + d); + })(C, r, n, i, v, s, u, l, h, p, f, m), + !(function (t) { + for (var e = 0, r = t; e < r.length; e += 1) + if (0 !== r[e].positionedGlyphs.length) return !1; + return !0; + })(B) && C + ); + } + (cl.fromFeature = function (t, e) { + for (var r = new cl(), n = 0; n < t.sections.length; n++) { + var i = t.sections[n]; + i.image ? r.addImageSection(i) : r.addTextSection(i, e); + } + return r; + }), + (cl.prototype.length = function () { + return this.text.length; + }), + (cl.prototype.getSection = function (t) { + return this.sections[this.sectionIndex[t]]; + }), + (cl.prototype.getSectionIndex = function (t) { + return this.sectionIndex[t]; + }), + (cl.prototype.getCharCode = function (t) { + return this.text.charCodeAt(t); + }), + (cl.prototype.verticalizePunctuation = function () { + this.text = (function (t) { + for (var e = '', r = 0; r < t.length; r++) { + var n = t.charCodeAt(r + 1) || null, + i = t.charCodeAt(r - 1) || null; + e += + (n && Wn(n) && !Cu[t[r + 1]]) || + (i && Wn(i) && !Cu[t[r - 1]]) || + !Cu[t[r]] + ? t[r] + : Cu[t[r]]; + } + return e; + })(this.text); + }), + (cl.prototype.trim = function () { + for ( + var t = 0, e = 0; + e < this.text.length && fl[this.text.charCodeAt(e)]; + e++ + ) + t++; + for ( + var r = this.text.length, n = this.text.length - 1; + n >= 0 && n >= t && fl[this.text.charCodeAt(n)]; + n-- + ) + r--; + (this.text = this.text.substring(t, r)), + (this.sectionIndex = this.sectionIndex.slice(t, r)); + }), + (cl.prototype.substring = function (t, e) { + var r = new cl(); + return ( + (r.text = this.text.substring(t, e)), + (r.sectionIndex = this.sectionIndex.slice(t, e)), + (r.sections = this.sections), + r + ); + }), + (cl.prototype.toString = function () { + return this.text; + }), + (cl.prototype.getMaxScale = function () { + var t = this; + return this.sectionIndex.reduce(function (e, r) { + return Math.max(e, t.sections[r].scale); + }, 0); + }), + (cl.prototype.addTextSection = function (t, e) { + (this.text += t.text), + this.sections.push(pl.forText(t.scale, t.fontStack || e)); + for (var r = this.sections.length - 1, n = 0; n < t.text.length; ++n) + this.sectionIndex.push(r); + }), + (cl.prototype.addImageSection = function (t) { + var e = t.image ? t.image.name : ''; + if (0 !== e.length) { + var r = this.getNextImageSectionCharCode(); + r + ? ((this.text += String.fromCharCode(r)), + this.sections.push(pl.forImage(e)), + this.sectionIndex.push(this.sections.length - 1)) + : d('Reached maximum number of images 6401'); + } else d("Can't add FormattedSection with an empty image."); + }), + (cl.prototype.getNextImageSectionCharCode = function () { + return this.imageSectionID + ? this.imageSectionID >= 63743 + ? null + : ++this.imageSectionID + : ((this.imageSectionID = 57344), this.imageSectionID); + }); + var fl = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, + yl = {}; + function dl(t, e, r, n, i, a) { + if (e.imageName) { + var o = n[e.imageName]; + return o ? (o.displaySize[0] * e.scale * Eu) / a + i : 0; + } + var s = r[e.fontStack], + u = s && s[t]; + return u ? u.metrics.advance * e.scale + i : 0; + } + function ml(t, e, r, n) { + var i = Math.pow(t - e, 2); + return n ? (t < e ? i / 2 : 2 * i) : i + Math.abs(r) * r; + } + function vl(t, e, r) { + var n = 0; + return ( + 10 === t && (n -= 1e4), + r && (n += 150), + (40 !== t && 65288 !== t) || (n += 50), + (41 !== e && 65289 !== e) || (n += 50), + n + ); + } + function gl(t, e, r, n, i, a) { + for ( + var o = null, s = ml(e, r, i, a), u = 0, l = n; + u < l.length; + u += 1 + ) { + var p = l[u], + c = ml(e - p.x, r, i, a) + p.badness; + c <= s && ((o = p), (s = c)); + } + return { index: t, x: e, priorBreak: o, badness: s }; + } + function xl(t) { + return t ? xl(t.priorBreak).concat(t.index) : []; + } + function bl(t, e, r, n, i, a, o) { + if ('point' !== a) return []; + if (!t) return []; + for ( + var s, + u = [], + l = (function (t, e, r, n, i, a) { + for (var o = 0, s = 0; s < t.length(); s++) { + var u = t.getSection(s); + o += dl(t.getCharCode(s), u, n, i, e, a); + } + return o / Math.max(1, Math.ceil(o / r)); + })(t, e, r, n, i, o), + p = t.text.indexOf('​') >= 0, + c = 0, + h = 0; + h < t.length(); + h++ + ) { + var f = t.getSection(h), + y = t.getCharCode(h); + if ((fl[y] || (c += dl(y, f, n, i, e, o)), h < t.length() - 1)) { + var d = !( + (s = y) < 11904 || + !( + Xn['Bopomofo Extended'](s) || + Xn.Bopomofo(s) || + Xn['CJK Compatibility Forms'](s) || + Xn['CJK Compatibility Ideographs'](s) || + Xn['CJK Compatibility'](s) || + Xn['CJK Radicals Supplement'](s) || + Xn['CJK Strokes'](s) || + Xn['CJK Symbols and Punctuation'](s) || + Xn['CJK Unified Ideographs Extension A'](s) || + Xn['CJK Unified Ideographs'](s) || + Xn['Enclosed CJK Letters and Months'](s) || + Xn['Halfwidth and Fullwidth Forms'](s) || + Xn.Hiragana(s) || + Xn['Ideographic Description Characters'](s) || + Xn['Kangxi Radicals'](s) || + Xn['Katakana Phonetic Extensions'](s) || + Xn.Katakana(s) || + Xn['Vertical Forms'](s) || + Xn['Yi Radicals'](s) || + Xn['Yi Syllables'](s) + ) + ); + (yl[y] || d || f.imageName) && + u.push(gl(h + 1, c, l, u, vl(y, t.getCharCode(h + 1), d && p), !1)); + } + } + return xl(gl(t.length(), c, l, u, 0, !0)); + } + function wl(t) { + var e = 0.5, + r = 0.5; + switch (t) { + case 'right': + case 'top-right': + case 'bottom-right': + e = 1; + break; + case 'left': + case 'top-left': + case 'bottom-left': + e = 0; + } + switch (t) { + case 'bottom': + case 'bottom-right': + case 'bottom-left': + r = 1; + break; + case 'top': + case 'top-right': + case 'top-left': + r = 0; + } + return { horizontalAlign: e, verticalAlign: r }; + } + function _l(t, e, r, n, i) { + if (n || i) + for ( + var a = t[r], o = (t[r].x + a.metrics.advance * a.scale) * n, s = e; + s <= r; + s++ + ) + (t[s].x -= o), (t[s].y += i); + } + function Al(t, e, r, n, i, a) { + var o, + s = t.image; + if (s.content) { + var u = s.content, + l = s.pixelRatio || 1; + o = [ + u[0] / l, + u[1] / l, + s.displaySize[0] - u[2] / l, + s.displaySize[1] - u[3] / l, + ]; + } + var p, + c, + h, + f, + y = e.left * a, + d = e.right * a; + 'width' === r || 'both' === r + ? ((f = i[0] + y - n[3]), (c = i[0] + d + n[1])) + : (c = (f = i[0] + (y + d - s.displaySize[0]) / 2) + s.displaySize[0]); + var m = e.top * a, + v = e.bottom * a; + return ( + 'height' === r || 'both' === r + ? ((p = i[1] + m - n[0]), (h = i[1] + v + n[2])) + : (h = + (p = i[1] + (m + v - s.displaySize[1]) / 2) + s.displaySize[1]), + { image: s, top: p, right: c, bottom: h, left: f, collisionPadding: o } + ); + } + (yl[10] = !0), + (yl[32] = !0), + (yl[38] = !0), + (yl[40] = !0), + (yl[41] = !0), + (yl[43] = !0), + (yl[45] = !0), + (yl[47] = !0), + (yl[173] = !0), + (yl[183] = !0), + (yl[8203] = !0), + (yl[8208] = !0), + (yl[8211] = !0), + (yl[8231] = !0); + var kl = 128; + function Sl(t, e) { + var r = e.expression; + if ('constant' === r.kind) + return { kind: 'constant', layoutSize: r.evaluate(new fi(t + 1)) }; + if ('source' === r.kind) return { kind: 'source' }; + for ( + var n = r.zoomStops, i = r.interpolationType, a = 0; + a < n.length && n[a] <= t; + + ) + a++; + for (var o = (a = Math.max(0, a - 1)); o < n.length && n[o] < t + 1; ) + o++; + o = Math.min(n.length - 1, o); + var s = n[a], + u = n[o]; + return 'composite' === r.kind + ? { kind: 'composite', minZoom: s, maxZoom: u, interpolationType: i } + : { + kind: 'camera', + minZoom: s, + maxZoom: u, + minSize: r.evaluate(new fi(s)), + maxSize: r.evaluate(new fi(u)), + interpolationType: i, + }; + } + var Il = (function (t) { + function e(e, r, n, i) { + t.call(this, e, r), + (this.angle = n), + void 0 !== i && (this.segment = i); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.clone = function () { + return new e(this.x, this.y, this.angle, this.segment); + }), + e + ); + })(I); + function Ml(t, e, r, n, i) { + if (void 0 === e.segment) return !0; + for (var a = e, o = e.segment + 1, s = 0; s > -r / 2; ) { + if (--o < 0) return !1; + (s -= t[o].dist(a)), (a = t[o]); + } + (s += t[o].dist(t[o + 1])), o++; + for (var u = [], l = 0; s < r / 2; ) { + var p = t[o], + c = t[o + 1]; + if (!c) return !1; + var h = t[o - 1].angleTo(p) - p.angleTo(c); + for ( + h = Math.abs(((h + 3 * Math.PI) % (2 * Math.PI)) - Math.PI), + u.push({ distance: s, angleDelta: h }), + l += h; + s - u[0].distance > n; + + ) + l -= u.shift().angleDelta; + if (l > i) return !1; + o++, (s += p.dist(c)); + } + return !0; + } + function zl(t) { + for (var e = 0, r = 0; r < t.length - 1; r++) e += t[r].dist(t[r + 1]); + return e; + } + function Pl(t, e, r) { + return t ? 0.6 * e * r : 0; + } + function Bl(t, e) { + return Math.max(t ? t.right - t.left : 0, e ? e.right - e.left : 0); + } + function Cl(t, e, r, n, i, a) { + for ( + var o = Pl(r, i, a), s = Bl(r, n) * a, u = 0, l = zl(t) / 2, p = 0; + p < t.length - 1; + p++ + ) { + var c = t[p], + h = t[p + 1], + f = c.dist(h); + if (u + f > l) { + var y = (l - u) / f, + d = Re(c.x, h.x, y), + m = Re(c.y, h.y, y), + v = new Il(d, m, h.angleTo(c), p); + return v._round(), !o || Ml(t, v, s, o, e) ? v : void 0; + } + u += f; + } + } + function El(t, e, r, n, i, a, o, s, u) { + var l = Pl(n, a, o), + p = Bl(n, i), + c = p * o, + h = 0 === t[0].x || t[0].x === u || 0 === t[0].y || t[0].y === u; + return ( + e - c < e / 4 && (e = c + e / 4), + Vl( + t, + h ? ((e / 2) * s) % e : ((p / 2 + 2 * a) * o * s) % e, + e, + l, + r, + c, + h, + !1, + u, + ) + ); + } + function Vl(t, e, r, n, i, a, o, s, u) { + for ( + var l = a / 2, p = zl(t), c = 0, h = e - r, f = [], y = 0; + y < t.length - 1; + y++ + ) { + for ( + var d = t[y], m = t[y + 1], v = d.dist(m), g = m.angleTo(d); + h + r < c + v; + + ) { + var x = ((h += r) - c) / v, + b = Re(d.x, m.x, x), + w = Re(d.y, m.y, x); + if (b >= 0 && b < u && w >= 0 && w < u && h - l >= 0 && h + l <= p) { + var _ = new Il(b, w, g, y); + _._round(), (n && !Ml(t, _, a, n, i)) || f.push(_); + } + } + c += v; + } + return s || f.length || o || (f = Vl(t, c / 2, r, n, i, a, o, !0, u)), f; + } + function Tl(t, e, r, n, i) { + for (var a = [], o = 0; o < t.length; o++) + for (var s = t[o], u = void 0, l = 0; l < s.length - 1; l++) { + var p = s[l], + c = s[l + 1]; + (p.x < e && c.x < e) || + (p.x < e + ? (p = new I( + e, + p.y + ((e - p.x) / (c.x - p.x)) * (c.y - p.y), + )._round()) + : c.x < e && + (c = new I( + e, + p.y + ((e - p.x) / (c.x - p.x)) * (c.y - p.y), + )._round()), + (p.y < r && c.y < r) || + (p.y < r + ? (p = new I( + p.x + ((r - p.y) / (c.y - p.y)) * (c.x - p.x), + r, + )._round()) + : c.y < r && + (c = new I( + p.x + ((r - p.y) / (c.y - p.y)) * (c.x - p.x), + r, + )._round()), + (p.x >= n && c.x >= n) || + (p.x >= n + ? (p = new I( + n, + p.y + ((n - p.x) / (c.x - p.x)) * (c.y - p.y), + )._round()) + : c.x >= n && + (c = new I( + n, + p.y + ((n - p.x) / (c.x - p.x)) * (c.y - p.y), + )._round()), + (p.y >= i && c.y >= i) || + (p.y >= i + ? (p = new I( + p.x + ((i - p.y) / (c.y - p.y)) * (c.x - p.x), + i, + )._round()) + : c.y >= i && + (c = new I( + p.x + ((i - p.y) / (c.y - p.y)) * (c.x - p.x), + i, + )._round()), + (u && p.equals(u[u.length - 1])) || a.push((u = [p])), + u.push(c))))); + } + return a; + } + function Fl(t, e, r, n) { + var i = [], + a = t.image, + o = a.pixelRatio, + s = a.paddedRect.w - 2, + u = a.paddedRect.h - 2, + l = t.right - t.left, + p = t.bottom - t.top, + c = a.stretchX || [[0, s]], + h = a.stretchY || [[0, u]], + f = function (t, e) { + return t + e[1] - e[0]; + }, + y = c.reduce(f, 0), + d = h.reduce(f, 0), + m = s - y, + v = u - d, + g = 0, + x = y, + b = 0, + w = d, + _ = 0, + A = m, + k = 0, + S = v; + if (a.content && n) { + var M = a.content; + (g = Ol(c, 0, M[0])), + (b = Ol(h, 0, M[1])), + (x = Ol(c, M[0], M[2])), + (w = Ol(h, M[1], M[3])), + (_ = M[0] - g), + (k = M[1] - b), + (A = M[2] - M[0] - x), + (S = M[3] - M[1] - w); + } + var z = function (n, i, s, u) { + var c = Dl(n.stretch - g, x, l, t.left), + h = jl(n.fixed - _, A, n.stretch, y), + f = Dl(i.stretch - b, w, p, t.top), + m = jl(i.fixed - k, S, i.stretch, d), + v = Dl(s.stretch - g, x, l, t.left), + M = jl(s.fixed - _, A, s.stretch, y), + z = Dl(u.stretch - b, w, p, t.top), + P = jl(u.fixed - k, S, u.stretch, d), + B = new I(c, f), + C = new I(v, f), + E = new I(v, z), + V = new I(c, z), + T = new I(h / o, m / o), + F = new I(M / o, P / o), + O = (e * Math.PI) / 180; + if (O) { + var L = Math.sin(O), + D = Math.cos(O), + j = [D, -L, L, D]; + B._matMult(j), C._matMult(j), V._matMult(j), E._matMult(j); + } + var R = n.stretch + n.fixed, + U = i.stretch + i.fixed; + return { + tl: B, + tr: C, + bl: V, + br: E, + tex: { + x: a.paddedRect.x + 1 + R, + y: a.paddedRect.y + 1 + U, + w: s.stretch + s.fixed - R, + h: u.stretch + u.fixed - U, + }, + writingMode: void 0, + glyphOffset: [0, 0], + sectionIndex: 0, + pixelOffsetTL: T, + pixelOffsetBR: F, + minFontScaleX: A / o / l, + minFontScaleY: S / o / p, + isSDF: r, + }; + }; + if (n && (a.stretchX || a.stretchY)) + for (var P = Ll(c, m, y), B = Ll(h, v, d), C = 0; C < P.length - 1; C++) + for (var E = P[C], V = P[C + 1], T = 0; T < B.length - 1; T++) + i.push(z(E, B[T], V, B[T + 1])); + else + i.push( + z( + { fixed: 0, stretch: -1 }, + { fixed: 0, stretch: -1 }, + { fixed: 0, stretch: s + 1 }, + { fixed: 0, stretch: u + 1 }, + ), + ); + return i; + } + function Ol(t, e, r) { + for (var n = 0, i = 0, a = t; i < a.length; i += 1) { + var o = a[i]; + n += Math.max(e, Math.min(r, o[1])) - Math.max(e, Math.min(r, o[0])); + } + return n; + } + function Ll(t, e, r) { + for ( + var n = [{ fixed: -1, stretch: 0 }], i = 0, a = t; + i < a.length; + i += 1 + ) { + var o = a[i], + s = o[0], + u = o[1], + l = n[n.length - 1]; + n.push({ fixed: s - l.stretch, stretch: l.stretch }), + n.push({ fixed: s - l.stretch, stretch: l.stretch + (u - s) }); + } + return n.push({ fixed: e + 1, stretch: r }), n; + } + function Dl(t, e, r, n) { + return (t / e) * r + n; + } + function jl(t, e, r, n) { + return t - (e * r) / n; + } + qn('Anchor', Il); + var Rl = function (t, e, r, n, i, a, o, s, u, l) { + if (((this.boxStartIndex = t.length), u)) { + var p = a.top, + c = a.bottom, + h = a.collisionPadding; + h && ((p -= h[1]), (c += h[3])); + var f = c - p; + f > 0 && ((f = Math.max(10, f)), (this.circleDiameter = f)); + } else { + var y = a.top * o - s[0], + d = a.bottom * o + s[2], + m = a.left * o - s[3], + v = a.right * o + s[1], + g = a.collisionPadding; + if ( + (g && + ((m -= g[0] * o), + (y -= g[1] * o), + (v += g[2] * o), + (d += g[3] * o)), + l) + ) { + var x = new I(m, y), + b = new I(v, y), + w = new I(m, d), + _ = new I(v, d), + A = (l * Math.PI) / 180; + x._rotate(A), + b._rotate(A), + w._rotate(A), + _._rotate(A), + (m = Math.min(x.x, b.x, w.x, _.x)), + (v = Math.max(x.x, b.x, w.x, _.x)), + (y = Math.min(x.y, b.y, w.y, _.y)), + (d = Math.max(x.y, b.y, w.y, _.y)); + } + t.emplaceBack(e.x, e.y, m, y, v, d, r, n, i); + } + this.boxEndIndex = t.length; + }, + Ul = function (t, e) { + if ( + (void 0 === t && (t = []), + void 0 === e && (e = ql), + (this.data = t), + (this.length = this.data.length), + (this.compare = e), + this.length > 0) + ) + for (var r = (this.length >> 1) - 1; r >= 0; r--) this._down(r); + }; + function ql(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function Nl(t, e, r) { + void 0 === e && (e = 1), void 0 === r && (r = !1); + for ( + var n = 1 / 0, i = 1 / 0, a = -1 / 0, o = -1 / 0, s = t[0], u = 0; + u < s.length; + u++ + ) { + var l = s[u]; + (!u || l.x < n) && (n = l.x), + (!u || l.y < i) && (i = l.y), + (!u || l.x > a) && (a = l.x), + (!u || l.y > o) && (o = l.y); + } + var p = Math.min(a - n, o - i), + c = p / 2, + h = new Ul([], Zl); + if (0 === p) return new I(n, i); + for (var f = n; f < a; f += p) + for (var y = i; y < o; y += p) h.push(new Kl(f + c, y + c, c, t)); + for ( + var d = (function (t) { + for ( + var e = 0, r = 0, n = 0, i = t[0], a = 0, o = i.length, s = o - 1; + a < o; + s = a++ + ) { + var u = i[a], + l = i[s], + p = u.x * l.y - l.x * u.y; + (r += (u.x + l.x) * p), (n += (u.y + l.y) * p), (e += 3 * p); + } + return new Kl(r / e, n / e, 0, t); + })(t), + m = h.length; + h.length; + + ) { + var v = h.pop(); + (v.d > d.d || !d.d) && + ((d = v), + r && + console.log( + 'found best %d after %d probes', + Math.round(1e4 * v.d) / 1e4, + m, + )), + v.max - d.d <= e || + (h.push(new Kl(v.p.x - (c = v.h / 2), v.p.y - c, c, t)), + h.push(new Kl(v.p.x + c, v.p.y - c, c, t)), + h.push(new Kl(v.p.x - c, v.p.y + c, c, t)), + h.push(new Kl(v.p.x + c, v.p.y + c, c, t)), + (m += 4)); + } + return ( + r && + (console.log('num probes: ' + m), + console.log('best distance: ' + d.d)), + d.p + ); + } + function Zl(t, e) { + return e.max - t.max; + } + function Kl(t, e, r, n) { + (this.p = new I(t, e)), + (this.h = r), + (this.d = (function (t, e) { + for (var r = !1, n = 1 / 0, i = 0; i < e.length; i++) + for (var a = e[i], o = 0, s = a.length, u = s - 1; o < s; u = o++) { + var l = a[o], + p = a[u]; + l.y > t.y != p.y > t.y && + t.x < ((p.x - l.x) * (t.y - l.y)) / (p.y - l.y) + l.x && + (r = !r), + (n = Math.min(n, ko(t, l, p))); + } + return (r ? 1 : -1) * Math.sqrt(n); + })(this.p, n)), + (this.max = this.d + this.h * Math.SQRT2); + } + (Ul.prototype.push = function (t) { + this.data.push(t), this.length++, this._up(this.length - 1); + }), + (Ul.prototype.pop = function () { + if (0 !== this.length) { + var t = this.data[0], + e = this.data.pop(); + return ( + this.length--, + this.length > 0 && ((this.data[0] = e), this._down(0)), + t + ); + } + }), + (Ul.prototype.peek = function () { + return this.data[0]; + }), + (Ul.prototype._up = function (t) { + for (var e = this.data, r = this.compare, n = e[t]; t > 0; ) { + var i = (t - 1) >> 1, + a = e[i]; + if (r(n, a) >= 0) break; + (e[t] = a), (t = i); + } + e[t] = n; + }), + (Ul.prototype._down = function (t) { + for ( + var e = this.data, r = this.compare, n = this.length >> 1, i = e[t]; + t < n; + + ) { + var a = 1 + (t << 1), + o = e[a], + s = a + 1; + if ( + (s < this.length && r(e[s], o) < 0 && ((a = s), (o = e[s])), + r(o, i) >= 0) + ) + break; + (e[t] = o), (t = a); + } + e[t] = i; + }); + var Gl = Number.POSITIVE_INFINITY; + function Jl(t, e) { + return e[1] !== Gl + ? (function (t, e, r) { + var n = 0, + i = 0; + switch (((e = Math.abs(e)), (r = Math.abs(r)), t)) { + case 'top-right': + case 'top-left': + case 'top': + i = r - 7; + break; + case 'bottom-right': + case 'bottom-left': + case 'bottom': + i = 7 - r; + } + switch (t) { + case 'top-right': + case 'bottom-right': + case 'right': + n = -e; + break; + case 'top-left': + case 'bottom-left': + case 'left': + n = e; + } + return [n, i]; + })(t, e[0], e[1]) + : (function (t, e) { + var r = 0, + n = 0; + e < 0 && (e = 0); + var i = e / Math.sqrt(2); + switch (t) { + case 'top-right': + case 'top-left': + n = i - 7; + break; + case 'bottom-right': + case 'bottom-left': + n = 7 - i; + break; + case 'bottom': + n = 7 - e; + break; + case 'top': + n = e - 7; + } + switch (t) { + case 'top-right': + case 'bottom-right': + r = -i; + break; + case 'top-left': + case 'bottom-left': + r = i; + break; + case 'left': + r = e; + break; + case 'right': + r = -e; + } + return [r, n]; + })(t, e[0]); + } + function Xl(t) { + switch (t) { + case 'right': + case 'top-right': + case 'bottom-right': + return 'right'; + case 'left': + case 'top-left': + case 'bottom-left': + return 'left'; + } + return 'center'; + } + var Yl = 32640; + function Hl(t, e, r, n, i, a, o, s, u, l, p, c, h, f, y) { + var m = (function (t, e, r, n, i, a, o, s) { + for ( + var u = + (n.layout.get('text-rotate').evaluate(a, {}) * Math.PI) / 180, + l = [], + p = 0, + c = e.positionedLines; + p < c.length; + p += 1 + ) + for ( + var h = c[p], f = 0, y = h.positionedGlyphs; + f < y.length; + f += 1 + ) { + var d = y[f]; + if (d.rect) { + var m = d.rect || {}, + v = 4, + g = !0, + x = 1, + b = 0, + w = (i || s) && d.vertical, + _ = (d.metrics.advance * d.scale) / 2; + if ( + (s && + e.verticalizable && + (b = + h.lineOffset / 2 - + (d.imageName + ? -(Eu - d.metrics.width * d.scale) / 2 + : (d.scale - 1) * Eu)), + d.imageName) + ) { + var A = o[d.imageName]; + (g = A.sdf), (v = 1 / (x = A.pixelRatio)); + } + var k = i ? [d.x + _, d.y] : [0, 0], + S = i ? [0, 0] : [d.x + _ + r[0], d.y + r[1] - b], + M = [0, 0]; + w && ((M = S), (S = [0, 0])); + var z = (d.metrics.left - v) * d.scale - _ + S[0], + P = (-d.metrics.top - v) * d.scale + S[1], + B = z + (m.w * d.scale) / x, + C = P + (m.h * d.scale) / x, + E = new I(z, P), + V = new I(B, P), + T = new I(z, C), + F = new I(B, C); + if (w) { + var O = new I(-_, _ - ll), + L = -Math.PI / 2, + D = 12 - _, + j = new I(22 - D, -(d.imageName ? D : 0)), + R = new (Function.prototype.bind.apply( + I, + [null].concat(M), + ))(); + E._rotateAround(L, O)._add(j)._add(R), + V._rotateAround(L, O)._add(j)._add(R), + T._rotateAround(L, O)._add(j)._add(R), + F._rotateAround(L, O)._add(j)._add(R); + } + if (u) { + var U = Math.sin(u), + q = Math.cos(u), + N = [q, -U, U, q]; + E._matMult(N), V._matMult(N), T._matMult(N), F._matMult(N); + } + var Z = new I(0, 0), + K = new I(0, 0); + l.push({ + tl: E, + tr: V, + bl: T, + br: F, + tex: m, + writingMode: e.writingMode, + glyphOffset: k, + sectionIndex: d.sectionIndex, + isSDF: g, + pixelOffsetTL: Z, + pixelOffsetBR: K, + minFontScaleX: 0, + minFontScaleY: 0, + }); + } + } + return l; + })(0, r, s, i, a, o, n, t.allowVerticalPlacement), + v = t.textSizeData, + g = null; + 'source' === v.kind + ? (g = [kl * i.layout.get('text-size').evaluate(o, {})])[0] > Yl && + d( + t.layerIds[0] + + ': Value for "text-size" is >= 255. Reduce your "text-size".', + ) + : 'composite' === v.kind && + ((g = [ + kl * f.compositeTextSizes[0].evaluate(o, {}, y), + kl * f.compositeTextSizes[1].evaluate(o, {}, y), + ])[0] > Yl || + g[1] > Yl) && + d( + t.layerIds[0] + + ': Value for "text-size" is >= 255. Reduce your "text-size".', + ), + t.addSymbols( + t.text, + m, + g, + s, + a, + o, + l, + e, + u.lineStartIndex, + u.lineLength, + h, + y, + ); + for (var x = 0, b = p; x < b.length; x += 1) + c[b[x]] = t.text.placedSymbolArray.length - 1; + return 4 * m.length; + } + function Wl(t) { + for (var e in t) return t[e]; + return null; + } + function $l(t, e, r, n) { + var i = t.compareText; + if (e in i) { + for (var a = i[e], o = a.length - 1; o >= 0; o--) + if (n.dist(a[o]) < r) return !0; + } else i[e] = []; + return i[e].push(n), !1; + } + var Ql = Gs.VectorTileFeature.types, + tp = [ + { name: 'a_fade_opacity', components: 1, type: 'Uint8', offset: 0 }, + ]; + function ep(t, e, r, n, i, a, o, s, u, l, p, c, h) { + var f = s ? Math.min(Yl, Math.round(s[0])) : 0, + y = s ? Math.min(Yl, Math.round(s[1])) : 0; + t.emplaceBack( + e, + r, + Math.round(32 * n), + Math.round(32 * i), + a, + o, + (f << 1) + (u ? 1 : 0), + y, + 16 * l, + 16 * p, + 256 * c, + 256 * h, + ); + } + function rp(t, e, r) { + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r); + } + function np(t) { + for (var e = 0, r = t.sections; e < r.length; e += 1) + if (ti(r[e].text)) return !0; + return !1; + } + var ip = function (t) { + (this.layoutVertexArray = new wa()), + (this.indexArray = new za()), + (this.programConfigurations = t), + (this.segments = new Ea()), + (this.dynamicLayoutVertexArray = new _a()), + (this.opacityVertexArray = new Aa()), + (this.placedSymbolArray = new oa()); + }; + (ip.prototype.isEmpty = function () { + return ( + 0 === this.layoutVertexArray.length && + 0 === this.indexArray.length && + 0 === this.dynamicLayoutVertexArray.length && + 0 === this.opacityVertexArray.length + ); + }), + (ip.prototype.upload = function (t, e, r, n) { + this.isEmpty() || + (r && + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + Su.members, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray, e)), + (this.dynamicLayoutVertexBuffer = t.createVertexBuffer( + this.dynamicLayoutVertexArray, + Iu.members, + !0, + )), + (this.opacityVertexBuffer = t.createVertexBuffer( + this.opacityVertexArray, + tp, + !0, + )), + (this.opacityVertexBuffer.itemSize = 1)), + (r || n) && this.programConfigurations.upload(t)); + }), + (ip.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.dynamicLayoutVertexBuffer.destroy(), + this.opacityVertexBuffer.destroy()); + }), + qn('SymbolBuffers', ip); + var ap = function (t, e, r) { + (this.layoutVertexArray = new t()), + (this.layoutAttributes = e), + (this.indexArray = new r()), + (this.segments = new Ea()), + (this.collisionVertexArray = new Ia()); + }; + (ap.prototype.upload = function (t) { + (this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + this.layoutAttributes, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray)), + (this.collisionVertexBuffer = t.createVertexBuffer( + this.collisionVertexArray, + Mu.members, + !0, + )); + }), + (ap.prototype.destroy = function () { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.segments.destroy(), + this.collisionVertexBuffer.destroy()); + }), + qn('CollisionBuffers', ap); + var op = function (e) { + (this.collisionBoxArray = e.collisionBoxArray), + (this.zoom = e.zoom), + (this.overscaling = e.overscaling), + (this.layers = e.layers), + (this.layerIds = this.layers.map(function (t) { + return t.id; + })), + (this.index = e.index), + (this.pixelRatio = e.pixelRatio), + (this.sourceLayerIndex = e.sourceLayerIndex), + (this.hasPattern = !1), + (this.hasRTLText = !1), + (this.sortKeyRanges = []), + (this.collisionCircleArray = []), + (this.placementInvProjMatrix = Oo([])), + (this.placementViewportMatrix = Oo([])); + var r = this.layers[0]._unevaluatedLayout._values; + (this.textSizeData = Sl(this.zoom, r['text-size'])), + (this.iconSizeData = Sl(this.zoom, r['icon-size'])); + var n = this.layers[0].layout, + i = n.get('symbol-sort-key'), + a = n.get('symbol-z-order'); + (this.canOverlap = + 'never' !== cp(n, 'text-overlap', 'text-allow-overlap') || + 'never' !== cp(n, 'icon-overlap', 'icon-allow-overlap') || + n.get('text-ignore-placement') || + n.get('icon-ignore-placement')), + (this.sortFeaturesByKey = 'viewport-y' !== a && !i.isConstant()), + (this.sortFeaturesByY = + ('viewport-y' === a || ('auto' === a && !this.sortFeaturesByKey)) && + this.canOverlap), + 'point' === n.get('symbol-placement') && + (this.writingModes = n.get('text-writing-mode').map(function (e) { + return t.WritingMode[e]; + })), + (this.stateDependentLayerIds = this.layers + .filter(function (t) { + return t.isStateDependent(); + }) + .map(function (t) { + return t.id; + })), + (this.sourceID = e.sourceID); + }; + (op.prototype.createArrays = function () { + (this.text = new ip( + new oo(this.layers, this.zoom, function (t) { + return /^text/.test(t); + }), + )), + (this.icon = new ip( + new oo(this.layers, this.zoom, function (t) { + return /^icon/.test(t); + }), + )), + (this.glyphOffsetArray = new la()), + (this.lineVertexArray = new pa()), + (this.symbolInstances = new ua()); + }), + (op.prototype.calculateGlyphDependencies = function (t, e, r, n, i) { + for (var a = 0; a < t.length; a++) + if (((e[t.charCodeAt(a)] = !0), (r || n) && i)) { + var o = Cu[t.charAt(a)]; + o && (e[o.charCodeAt(0)] = !0); + } + }), + (op.prototype.populate = function (e, r, n) { + var i = this.layers[0], + a = i.layout, + o = a.get('text-font'), + s = a.get('text-field'), + u = a.get('icon-image'), + l = + ('constant' !== s.value.kind || + (s.value.value instanceof $t && !s.value.value.isEmpty()) || + s.value.value.toString().length > 0) && + ('constant' !== o.value.kind || o.value.value.length > 0), + p = + 'constant' !== u.value.kind || + !!u.value.value || + Object.keys(u.parameters).length > 0, + c = a.get('symbol-sort-key'); + if (((this.features = []), l || p)) { + for ( + var h = r.iconDependencies, + f = r.glyphDependencies, + y = r.availableImages, + d = new fi(this.zoom), + m = 0, + v = e; + m < v.length; + m += 1 + ) { + var g = v[m], + x = g.feature, + b = g.id, + w = g.index, + _ = g.sourceLayerIndex, + A = i._featureFilter.needGeometry, + k = fo(x, A); + if (i._featureFilter.filter(d, k, n)) { + A || (k.geometry = ho(x)); + var S = void 0; + if (l) { + var I = i.getValueAndResolveTokens('text-field', k, n, y), + M = $t.factory(I); + np(M) && (this.hasRTLText = !0), + (!this.hasRTLText || + 'unavailable' === pi() || + (this.hasRTLText && hi.isParsed())) && + (S = Bu(M, i, k)); + } + var z = void 0; + if (p) { + var P = i.getValueAndResolveTokens('icon-image', k, n, y); + z = P instanceof te ? P : te.fromString(P); + } + if (S || z) { + var B = this.sortFeaturesByKey ? c.evaluate(k, {}, n) : void 0; + if ( + (this.features.push({ + id: b, + text: S, + icon: z, + index: w, + sourceLayerIndex: _, + geometry: k.geometry, + properties: x.properties, + type: Ql[x.type], + sortKey: B, + }), + z && (h[z.name] = !0), + S) + ) { + var C = o.evaluate(k, {}, n).join(','), + E = + 'viewport' !== a.get('text-rotation-alignment') && + 'point' !== a.get('symbol-placement'); + this.allowVerticalPlacement = + this.writingModes && + this.writingModes.indexOf(t.WritingMode.vertical) >= 0; + for (var V = 0, T = S.sections; V < T.length; V += 1) { + var F = T[V]; + if (F.image) h[F.image.name] = !0; + else { + var O = Yn(S.toString()), + L = F.fontStack || C, + D = (f[L] = f[L] || {}); + this.calculateGlyphDependencies( + F.text, + D, + E, + this.allowVerticalPlacement, + O, + ); + } + } + } + } + } + } + 'line' === a.get('symbol-placement') && + (this.features = (function (t) { + var e = {}, + r = {}, + n = [], + i = 0; + function a(e) { + n.push(t[e]), i++; + } + function o(t, e, i) { + var a = r[t]; + return ( + delete r[t], + (r[e] = a), + n[a].geometry[0].pop(), + (n[a].geometry[0] = n[a].geometry[0].concat(i[0])), + a + ); + } + function s(t, r, i) { + var a = e[r]; + return ( + delete e[r], + (e[t] = a), + n[a].geometry[0].shift(), + (n[a].geometry[0] = i[0].concat(n[a].geometry[0])), + a + ); + } + function u(t, e, r) { + var n = r ? e[0][e[0].length - 1] : e[0][0]; + return t + ':' + n.x + ':' + n.y; + } + for (var l = 0; l < t.length; l++) { + var p = t[l], + c = p.geometry, + h = p.text ? p.text.toString() : null; + if (h) { + var f = u(h, c), + y = u(h, c, !0); + if (f in r && y in e && r[f] !== e[y]) { + var d = s(f, y, c), + m = o(f, y, n[d].geometry); + delete e[f], + delete r[y], + (r[u(h, n[m].geometry, !0)] = m), + (n[d].geometry = null); + } else + f in r + ? o(f, y, c) + : y in e + ? s(f, y, c) + : (a(l), (e[f] = i - 1), (r[y] = i - 1)); + } else a(l); + } + return n.filter(function (t) { + return t.geometry; + }); + })(this.features)), + this.sortFeaturesByKey && + this.features.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + } + }), + (op.prototype.update = function (t, e, r) { + this.stateDependentLayers.length && + (this.text.programConfigurations.updatePaintArrays( + t, + e, + this.layers, + r, + ), + this.icon.programConfigurations.updatePaintArrays( + t, + e, + this.layers, + r, + )); + }), + (op.prototype.isEmpty = function () { + return 0 === this.symbolInstances.length && !this.hasRTLText; + }), + (op.prototype.uploadPending = function () { + return ( + !this.uploaded || + this.text.programConfigurations.needsUpload || + this.icon.programConfigurations.needsUpload + ); + }), + (op.prototype.upload = function (t) { + !this.uploaded && + this.hasDebugData() && + (this.textCollisionBox.upload(t), this.iconCollisionBox.upload(t)), + this.text.upload( + t, + this.sortFeaturesByY, + !this.uploaded, + this.text.programConfigurations.needsUpload, + ), + this.icon.upload( + t, + this.sortFeaturesByY, + !this.uploaded, + this.icon.programConfigurations.needsUpload, + ), + (this.uploaded = !0); + }), + (op.prototype.destroyDebugData = function () { + this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(); + }), + (op.prototype.destroy = function () { + this.text.destroy(), + this.icon.destroy(), + this.hasDebugData() && this.destroyDebugData(); + }), + (op.prototype.addToLineVertexArray = function (t, e) { + var r = this.lineVertexArray.length; + if (void 0 !== t.segment) { + for ( + var n = t.dist(e[t.segment + 1]), + i = t.dist(e[t.segment]), + a = {}, + o = t.segment + 1; + o < e.length; + o++ + ) + (a[o] = { x: e[o].x, y: e[o].y, tileUnitDistanceFromAnchor: n }), + o < e.length - 1 && (n += e[o + 1].dist(e[o])); + for (var s = t.segment || 0; s >= 0; s--) + (a[s] = { x: e[s].x, y: e[s].y, tileUnitDistanceFromAnchor: i }), + s > 0 && (i += e[s - 1].dist(e[s])); + for (var u = 0; u < e.length; u++) { + var l = a[u]; + this.lineVertexArray.emplaceBack( + l.x, + l.y, + l.tileUnitDistanceFromAnchor, + ); + } + } + return { + lineStartIndex: r, + lineLength: this.lineVertexArray.length - r, + }; + }), + (op.prototype.addSymbols = function (e, r, n, i, a, o, s, u, l, p, c, h) { + for ( + var f = e.indexArray, + y = e.layoutVertexArray, + d = e.segments.prepareSegment( + 4 * r.length, + y, + f, + this.canOverlap ? o.sortKey : void 0, + ), + m = this.glyphOffsetArray.length, + v = d.vertexLength, + g = + this.allowVerticalPlacement && s === t.WritingMode.vertical + ? Math.PI / 2 + : 0, + x = o.text && o.text.sections, + b = 0; + b < r.length; + b++ + ) { + var w = r[b], + _ = w.tl, + A = w.tr, + k = w.bl, + S = w.br, + I = w.tex, + M = w.pixelOffsetTL, + z = w.pixelOffsetBR, + P = w.minFontScaleX, + B = w.minFontScaleY, + C = w.glyphOffset, + E = w.isSDF, + V = w.sectionIndex, + T = d.vertexLength, + F = C[1]; + ep(y, u.x, u.y, _.x, F + _.y, I.x, I.y, n, E, M.x, M.y, P, B), + ep(y, u.x, u.y, A.x, F + A.y, I.x + I.w, I.y, n, E, z.x, M.y, P, B), + ep(y, u.x, u.y, k.x, F + k.y, I.x, I.y + I.h, n, E, M.x, z.y, P, B), + ep( + y, + u.x, + u.y, + S.x, + F + S.y, + I.x + I.w, + I.y + I.h, + n, + E, + z.x, + z.y, + P, + B, + ), + rp(e.dynamicLayoutVertexArray, u, g), + f.emplaceBack(T, T + 1, T + 2), + f.emplaceBack(T + 1, T + 2, T + 3), + (d.vertexLength += 4), + (d.primitiveLength += 2), + this.glyphOffsetArray.emplaceBack(C[0]), + (b !== r.length - 1 && V === r[b + 1].sectionIndex) || + e.programConfigurations.populatePaintArrays( + y.length, + o, + o.index, + {}, + h, + x && x[V], + ); + } + e.placedSymbolArray.emplaceBack( + u.x, + u.y, + m, + this.glyphOffsetArray.length - m, + v, + l, + p, + u.segment, + n ? n[0] : 0, + n ? n[1] : 0, + i[0], + i[1], + s, + 0, + !1, + 0, + c, + ); + }), + (op.prototype._addCollisionDebugVertex = function (t, e, r, n, i, a) { + return ( + e.emplaceBack(0, 0), + t.emplaceBack(r.x, r.y, n, i, Math.round(a.x), Math.round(a.y)) + ); + }), + (op.prototype.addCollisionDebugVertices = function (t, e, r, n, i, a, o) { + var s = i.segments.prepareSegment(4, i.layoutVertexArray, i.indexArray), + u = s.vertexLength, + l = i.layoutVertexArray, + p = i.collisionVertexArray, + c = o.anchorX, + h = o.anchorY; + this._addCollisionDebugVertex(l, p, a, c, h, new I(t, e)), + this._addCollisionDebugVertex(l, p, a, c, h, new I(r, e)), + this._addCollisionDebugVertex(l, p, a, c, h, new I(r, n)), + this._addCollisionDebugVertex(l, p, a, c, h, new I(t, n)), + (s.vertexLength += 4); + var f = i.indexArray; + f.emplaceBack(u, u + 1), + f.emplaceBack(u + 1, u + 2), + f.emplaceBack(u + 2, u + 3), + f.emplaceBack(u + 3, u), + (s.primitiveLength += 4); + }), + (op.prototype.addDebugCollisionBoxes = function (t, e, r, n) { + for (var i = t; i < e; i++) { + var a = this.collisionBoxArray.get(i); + this.addCollisionDebugVertices( + a.x1, + a.y1, + a.x2, + a.y2, + n ? this.textCollisionBox : this.iconCollisionBox, + a.anchorPoint, + r, + ); + } + }), + (op.prototype.generateCollisionDebugBuffers = function () { + this.hasDebugData() && this.destroyDebugData(), + (this.textCollisionBox = new ap(ka, zu.members, Pa)), + (this.iconCollisionBox = new ap(ka, zu.members, Pa)); + for (var t = 0; t < this.symbolInstances.length; t++) { + var e = this.symbolInstances.get(t); + this.addDebugCollisionBoxes( + e.textBoxStartIndex, + e.textBoxEndIndex, + e, + !0, + ), + this.addDebugCollisionBoxes( + e.verticalTextBoxStartIndex, + e.verticalTextBoxEndIndex, + e, + !0, + ), + this.addDebugCollisionBoxes( + e.iconBoxStartIndex, + e.iconBoxEndIndex, + e, + !1, + ), + this.addDebugCollisionBoxes( + e.verticalIconBoxStartIndex, + e.verticalIconBoxEndIndex, + e, + !1, + ); + } + }), + (op.prototype._deserializeCollisionBoxesForSymbol = function ( + t, + e, + r, + n, + i, + a, + o, + s, + u, + ) { + for (var l = {}, p = e; p < r; p++) { + var c = t.get(p); + (l.textBox = { + x1: c.x1, + y1: c.y1, + x2: c.x2, + y2: c.y2, + anchorPointX: c.anchorPointX, + anchorPointY: c.anchorPointY, + }), + (l.textFeatureIndex = c.featureIndex); + break; + } + for (var h = n; h < i; h++) { + var f = t.get(h); + (l.verticalTextBox = { + x1: f.x1, + y1: f.y1, + x2: f.x2, + y2: f.y2, + anchorPointX: f.anchorPointX, + anchorPointY: f.anchorPointY, + }), + (l.verticalTextFeatureIndex = f.featureIndex); + break; + } + for (var y = a; y < o; y++) { + var d = t.get(y); + (l.iconBox = { + x1: d.x1, + y1: d.y1, + x2: d.x2, + y2: d.y2, + anchorPointX: d.anchorPointX, + anchorPointY: d.anchorPointY, + }), + (l.iconFeatureIndex = d.featureIndex); + break; + } + for (var m = s; m < u; m++) { + var v = t.get(m); + (l.verticalIconBox = { + x1: v.x1, + y1: v.y1, + x2: v.x2, + y2: v.y2, + anchorPointX: v.anchorPointX, + anchorPointY: v.anchorPointY, + }), + (l.verticalIconFeatureIndex = v.featureIndex); + break; + } + return l; + }), + (op.prototype.deserializeCollisionBoxes = function (t) { + this.collisionArrays = []; + for (var e = 0; e < this.symbolInstances.length; e++) { + var r = this.symbolInstances.get(e); + this.collisionArrays.push( + this._deserializeCollisionBoxesForSymbol( + t, + r.textBoxStartIndex, + r.textBoxEndIndex, + r.verticalTextBoxStartIndex, + r.verticalTextBoxEndIndex, + r.iconBoxStartIndex, + r.iconBoxEndIndex, + r.verticalIconBoxStartIndex, + r.verticalIconBoxEndIndex, + ), + ); + } + }), + (op.prototype.hasTextData = function () { + return this.text.segments.get().length > 0; + }), + (op.prototype.hasIconData = function () { + return this.icon.segments.get().length > 0; + }), + (op.prototype.hasDebugData = function () { + return this.textCollisionBox && this.iconCollisionBox; + }), + (op.prototype.hasTextCollisionBoxData = function () { + return ( + this.hasDebugData() && this.textCollisionBox.segments.get().length > 0 + ); + }), + (op.prototype.hasIconCollisionBoxData = function () { + return ( + this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0 + ); + }), + (op.prototype.addIndicesForPlacedSymbol = function (t, e) { + for ( + var r = t.placedSymbolArray.get(e), + n = r.vertexStartIndex + 4 * r.numGlyphs, + i = r.vertexStartIndex; + i < n; + i += 4 + ) + t.indexArray.emplaceBack(i, i + 1, i + 2), + t.indexArray.emplaceBack(i + 1, i + 2, i + 3); + }), + (op.prototype.getSortedSymbolIndexes = function (t) { + if (this.sortedAngle === t && void 0 !== this.symbolInstanceIndexes) + return this.symbolInstanceIndexes; + for ( + var e = Math.sin(t), r = Math.cos(t), n = [], i = [], a = [], o = 0; + o < this.symbolInstances.length; + ++o + ) { + a.push(o); + var s = this.symbolInstances.get(o); + n.push(0 | Math.round(e * s.anchorX + r * s.anchorY)), + i.push(s.featureIndex); + } + return ( + a.sort(function (t, e) { + return n[t] - n[e] || i[e] - i[t]; + }), + a + ); + }), + (op.prototype.addToSortKeyRanges = function (t, e) { + var r = this.sortKeyRanges[this.sortKeyRanges.length - 1]; + r && r.sortKey === e + ? (r.symbolInstanceEnd = t + 1) + : this.sortKeyRanges.push({ + sortKey: e, + symbolInstanceStart: t, + symbolInstanceEnd: t + 1, + }); + }), + (op.prototype.sortFeatures = function (t) { + var e = this; + if ( + this.sortFeaturesByY && + this.sortedAngle !== t && + !( + this.text.segments.get().length > 1 || + this.icon.segments.get().length > 1 + ) + ) { + (this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t)), + (this.sortedAngle = t), + this.text.indexArray.clear(), + this.icon.indexArray.clear(), + (this.featureSortOrder = []); + for ( + var r = 0, n = this.symbolInstanceIndexes; + r < n.length; + r += 1 + ) { + var i = this.symbolInstances.get(n[r]); + this.featureSortOrder.push(i.featureIndex), + [ + i.rightJustifiedTextSymbolIndex, + i.centerJustifiedTextSymbolIndex, + i.leftJustifiedTextSymbolIndex, + ].forEach(function (t, r, n) { + t >= 0 && + n.indexOf(t) === r && + e.addIndicesForPlacedSymbol(e.text, t); + }), + i.verticalPlacedTextSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.text, + i.verticalPlacedTextSymbolIndex, + ), + i.placedIconSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.icon, + i.placedIconSymbolIndex, + ), + i.verticalPlacedIconSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.icon, + i.verticalPlacedIconSymbolIndex, + ); + } + this.text.indexBuffer && + this.text.indexBuffer.updateData(this.text.indexArray), + this.icon.indexBuffer && + this.icon.indexBuffer.updateData(this.icon.indexArray); + } + }), + qn('SymbolBucket', op, { + omit: ['layers', 'collisionBoxArray', 'features', 'compareText'], + }), + (op.MAX_GLYPHS = 65535), + (op.addDynamicAttributes = rp); + var sp = new Mi({ + 'symbol-placement': new _i(gt.layout_symbol['symbol-placement']), + 'symbol-spacing': new _i(gt.layout_symbol['symbol-spacing']), + 'symbol-avoid-edges': new _i(gt.layout_symbol['symbol-avoid-edges']), + 'symbol-sort-key': new Ai(gt.layout_symbol['symbol-sort-key']), + 'symbol-z-order': new _i(gt.layout_symbol['symbol-z-order']), + 'icon-allow-overlap': new _i(gt.layout_symbol['icon-allow-overlap']), + 'icon-overlap': new _i(gt.layout_symbol['icon-overlap']), + 'icon-ignore-placement': new _i( + gt.layout_symbol['icon-ignore-placement'], + ), + 'icon-optional': new _i(gt.layout_symbol['icon-optional']), + 'icon-rotation-alignment': new _i( + gt.layout_symbol['icon-rotation-alignment'], + ), + 'icon-size': new Ai(gt.layout_symbol['icon-size']), + 'icon-text-fit': new _i(gt.layout_symbol['icon-text-fit']), + 'icon-text-fit-padding': new _i( + gt.layout_symbol['icon-text-fit-padding'], + ), + 'icon-image': new Ai(gt.layout_symbol['icon-image']), + 'icon-rotate': new Ai(gt.layout_symbol['icon-rotate']), + 'icon-padding': new Ai(gt.layout_symbol['icon-padding']), + 'icon-keep-upright': new _i(gt.layout_symbol['icon-keep-upright']), + 'icon-offset': new Ai(gt.layout_symbol['icon-offset']), + 'icon-anchor': new Ai(gt.layout_symbol['icon-anchor']), + 'icon-pitch-alignment': new _i( + gt.layout_symbol['icon-pitch-alignment'], + ), + 'text-pitch-alignment': new _i( + gt.layout_symbol['text-pitch-alignment'], + ), + 'text-rotation-alignment': new _i( + gt.layout_symbol['text-rotation-alignment'], + ), + 'text-field': new Ai(gt.layout_symbol['text-field']), + 'text-font': new Ai(gt.layout_symbol['text-font']), + 'text-size': new Ai(gt.layout_symbol['text-size']), + 'text-max-width': new Ai(gt.layout_symbol['text-max-width']), + 'text-line-height': new _i(gt.layout_symbol['text-line-height']), + 'text-letter-spacing': new Ai(gt.layout_symbol['text-letter-spacing']), + 'text-justify': new Ai(gt.layout_symbol['text-justify']), + 'text-radial-offset': new Ai(gt.layout_symbol['text-radial-offset']), + 'text-variable-anchor': new _i( + gt.layout_symbol['text-variable-anchor'], + ), + 'text-anchor': new Ai(gt.layout_symbol['text-anchor']), + 'text-max-angle': new _i(gt.layout_symbol['text-max-angle']), + 'text-writing-mode': new _i(gt.layout_symbol['text-writing-mode']), + 'text-rotate': new Ai(gt.layout_symbol['text-rotate']), + 'text-padding': new _i(gt.layout_symbol['text-padding']), + 'text-keep-upright': new _i(gt.layout_symbol['text-keep-upright']), + 'text-transform': new Ai(gt.layout_symbol['text-transform']), + 'text-offset': new Ai(gt.layout_symbol['text-offset']), + 'text-allow-overlap': new _i(gt.layout_symbol['text-allow-overlap']), + 'text-overlap': new _i(gt.layout_symbol['text-overlap']), + 'text-ignore-placement': new _i( + gt.layout_symbol['text-ignore-placement'], + ), + 'text-optional': new _i(gt.layout_symbol['text-optional']), + }), + up = { + paint: new Mi({ + 'icon-opacity': new Ai(gt.paint_symbol['icon-opacity']), + 'icon-color': new Ai(gt.paint_symbol['icon-color']), + 'icon-halo-color': new Ai(gt.paint_symbol['icon-halo-color']), + 'icon-halo-width': new Ai(gt.paint_symbol['icon-halo-width']), + 'icon-halo-blur': new Ai(gt.paint_symbol['icon-halo-blur']), + 'icon-translate': new _i(gt.paint_symbol['icon-translate']), + 'icon-translate-anchor': new _i( + gt.paint_symbol['icon-translate-anchor'], + ), + 'text-opacity': new Ai(gt.paint_symbol['text-opacity']), + 'text-color': new Ai(gt.paint_symbol['text-color'], { + runtimeType: Bt, + getOverride: function (t) { + return t.textColor; + }, + hasOverride: function (t) { + return !!t.textColor; + }, + }), + 'text-halo-color': new Ai(gt.paint_symbol['text-halo-color']), + 'text-halo-width': new Ai(gt.paint_symbol['text-halo-width']), + 'text-halo-blur': new Ai(gt.paint_symbol['text-halo-blur']), + 'text-translate': new _i(gt.paint_symbol['text-translate']), + 'text-translate-anchor': new _i( + gt.paint_symbol['text-translate-anchor'], + ), + }), + layout: sp, + }, + lp = function (t) { + if (void 0 === t.property.overrides) + throw new Error( + 'overrides must be provided to instantiate FormatSectionOverride class', + ); + (this.type = t.property.overrides + ? t.property.overrides.runtimeType + : It), + (this.defaultValue = t); + }; + (lp.prototype.evaluate = function (t) { + if (t.formattedSection) { + var e = this.defaultValue.property.overrides; + if (e && e.hasOverride(t.formattedSection)) + return e.getOverride(t.formattedSection); + } + return t.feature && t.featureState + ? this.defaultValue.evaluate(t.feature, t.featureState) + : this.defaultValue.property.specification.default; + }), + (lp.prototype.eachChild = function (t) { + this.defaultValue.isConstant() || + t(this.defaultValue.value._styleExpression.expression); + }), + (lp.prototype.outputDefined = function () { + return !1; + }), + (lp.prototype.serialize = function () { + return null; + }), + qn('FormatSectionOverride', lp, { omit: ['defaultValue'] }); + var pp = (function (t) { + function e(e) { + t.call(this, e, up); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.recalculate = function (e, r) { + if ( + (t.prototype.recalculate.call(this, e, r), + 'auto' === this.layout.get('icon-rotation-alignment') && + (this.layout._values['icon-rotation-alignment'] = + 'point' !== this.layout.get('symbol-placement') + ? 'map' + : 'viewport'), + 'auto' === this.layout.get('text-rotation-alignment') && + (this.layout._values['text-rotation-alignment'] = + 'point' !== this.layout.get('symbol-placement') + ? 'map' + : 'viewport'), + 'auto' === this.layout.get('text-pitch-alignment') && + (this.layout._values['text-pitch-alignment'] = + 'map' === this.layout.get('text-rotation-alignment') + ? 'map' + : 'viewport'), + 'auto' === this.layout.get('icon-pitch-alignment') && + (this.layout._values['icon-pitch-alignment'] = this.layout.get( + 'icon-rotation-alignment', + )), + 'point' === this.layout.get('symbol-placement')) + ) { + var n = this.layout.get('text-writing-mode'); + if (n) { + for (var i = [], a = 0, o = n; a < o.length; a += 1) { + var s = o[a]; + i.indexOf(s) < 0 && i.push(s); + } + this.layout._values['text-writing-mode'] = i; + } else this.layout._values['text-writing-mode'] = ['horizontal']; + } + this._setPaintOverrides(); + }), + (e.prototype.getValueAndResolveTokens = function (t, e, r, n) { + var i = this.layout.get(t).evaluate(e, {}, r, n), + a = this._unevaluatedLayout._values[t]; + return a.isDataDriven() || Xr(a.value) || !i + ? i + : (function (t, e) { + return e.replace(/{([^{}]+)}/g, function (e, r) { + return r in t ? String(t[r]) : ''; + }); + })(e.properties, i); + }), + (e.prototype.createBucket = function (t) { + return new op(t); + }), + (e.prototype.queryRadius = function () { + return 0; + }), + (e.prototype.queryIntersectsFeature = function () { + throw new Error('Should take a different path in FeatureIndex'); + }), + (e.prototype._setPaintOverrides = function () { + for ( + var t = 0, r = up.paint.overridableProperties; + t < r.length; + t += 1 + ) { + var n = r[t]; + if (e.hasPaintOverride(this.layout, n)) { + var i, + a = this.paint.get(n), + o = new lp(a), + s = new Jr(o, a.property.specification); + (i = + 'constant' === a.value.kind || 'source' === a.value.kind + ? new Hr('source', s) + : new Wr('composite', s, a.value.zoomStops)), + (this.paint._values[n] = new bi(a.property, i, a.parameters)); + } + } + }), + (e.prototype._handleOverridablePaintPropertyUpdate = function ( + t, + r, + n, + ) { + return ( + !(!this.layout || r.isDataDriven() || n.isDataDriven()) && + e.hasPaintOverride(this.layout, t) + ); + }), + (e.hasPaintOverride = function (t, e) { + var r = t.get('text-field'), + n = up.paint.properties[e], + i = !1, + a = function (t) { + for (var e = 0, r = t; e < r.length; e += 1) + if (n.overrides && n.overrides.hasOverride(r[e])) + return void (i = !0); + }; + if ('constant' === r.value.kind && r.value.value instanceof $t) + a(r.value.value.sections); + else if ('source' === r.value.kind) { + var o = function (t) { + i || + (t instanceof ae && ne(t.value) === Tt + ? a(t.value.sections) + : t instanceof Sr + ? a(t.sections) + : t.eachChild(o)); + }, + s = r.value; + s._styleExpression && o(s._styleExpression.expression); + } + return i; + }), + e + ); + })(Pi); + function cp(t, e, r) { + var n = 'never', + i = t.get(e); + return i ? (n = i) : t.get(r) && (n = 'always'), n; + } + var hp = { + paint: new Mi({ + 'background-color': new _i(gt.paint_background['background-color']), + 'background-pattern': new Si( + gt.paint_background['background-pattern'], + ), + 'background-opacity': new _i( + gt.paint_background['background-opacity'], + ), + }), + }, + fp = (function (t) { + function e(e) { + t.call(this, e, hp); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Pi), + yp = { + paint: new Mi({ + 'raster-opacity': new _i(gt.paint_raster['raster-opacity']), + 'raster-hue-rotate': new _i(gt.paint_raster['raster-hue-rotate']), + 'raster-brightness-min': new _i( + gt.paint_raster['raster-brightness-min'], + ), + 'raster-brightness-max': new _i( + gt.paint_raster['raster-brightness-max'], + ), + 'raster-saturation': new _i(gt.paint_raster['raster-saturation']), + 'raster-contrast': new _i(gt.paint_raster['raster-contrast']), + 'raster-resampling': new _i(gt.paint_raster['raster-resampling']), + 'raster-fade-duration': new _i( + gt.paint_raster['raster-fade-duration'], + ), + }), + }, + dp = (function (t) { + function e(e) { + t.call(this, e, yp); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(Pi), + mp = (function (t) { + function e(e) { + var r = this; + t.call(this, e, {}), + (this.onAdd = function (t) { + r.implementation.onAdd && + r.implementation.onAdd(t, t.painter.context.gl); + }), + (this.onRemove = function (t) { + r.implementation.onRemove && + r.implementation.onRemove(t, t.painter.context.gl); + }), + (this.implementation = e); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.is3D = function () { + return '3d' === this.implementation.renderingMode; + }), + (e.prototype.hasOffscreenPass = function () { + return void 0 !== this.implementation.prerender; + }), + (e.prototype.recalculate = function () {}), + (e.prototype.updateTransitions = function () {}), + (e.prototype.hasTransition = function () { + return !1; + }), + (e.prototype.serialize = function () { + throw new Error('Custom layers cannot be serialized'); + }), + e + ); + })(Pi), + vp = { + circle: Zo, + heatmap: ts, + hillshade: rs, + fill: qs, + 'fill-extrusion': pu, + line: Au, + symbol: pp, + background: fp, + raster: dp, + }, + gp = function (t) { + var e = this; + (this._callback = t), + (this._triggered = !1), + 'undefined' != typeof MessageChannel && + ((this._channel = new MessageChannel()), + (this._channel.port2.onmessage = function () { + (e._triggered = !1), e._callback(); + })); + }; + (gp.prototype.trigger = function () { + var t = this; + this._triggered || + ((this._triggered = !0), + this._channel + ? this._channel.port1.postMessage(!0) + : setTimeout(function () { + (t._triggered = !1), t._callback(); + }, 0)); + }), + (gp.prototype.remove = function () { + delete this._channel, (this._callback = function () {}); + }); + var xp = function (t, e, r) { + (this.target = t), + (this.parent = e), + (this.mapId = r), + (this.callbacks = {}), + (this.tasks = {}), + (this.taskQueue = []), + (this.cancelCallbacks = {}), + l(['receive', 'process'], this), + (this.invoker = new gp(this.process)), + this.target.addEventListener('message', this.receive, !1), + (this.globalScope = g() ? t : window); + }; + (xp.prototype.send = function (t, e, r, n, i) { + var a = this; + void 0 === i && (i = !1); + var o = Math.round(1e18 * Math.random()) + .toString(36) + .substring(0, 10); + r && (this.callbacks[o] = r); + var s = w(this.globalScope) ? void 0 : []; + return ( + this.target.postMessage( + { + id: o, + type: t, + hasCallback: !!r, + targetMapId: n, + mustQueue: i, + sourceMapId: this.mapId, + data: Kn(e, s), + }, + s, + ), + { + cancel: function () { + r && delete a.callbacks[o], + a.target.postMessage({ + id: o, + type: '', + targetMapId: n, + sourceMapId: a.mapId, + }); + }, + } + ); + }), + (xp.prototype.receive = function (t) { + var e = t.data, + r = e.id; + if (r && (!e.targetMapId || this.mapId === e.targetMapId)) + if ('' === e.type) { + delete this.tasks[r]; + var n = this.cancelCallbacks[r]; + delete this.cancelCallbacks[r], n && n(); + } else + g() || e.mustQueue + ? ((this.tasks[r] = e), + this.taskQueue.push(r), + this.invoker.trigger()) + : this.processTask(r, e); + }), + (xp.prototype.process = function () { + if (this.taskQueue.length) { + var t = this.taskQueue.shift(), + e = this.tasks[t]; + delete this.tasks[t], + this.taskQueue.length && this.invoker.trigger(), + e && this.processTask(t, e); + } + }), + (xp.prototype.processTask = function (t, e) { + var r = this; + if ('' === e.type) { + var n = this.callbacks[t]; + delete this.callbacks[t], + n && (e.error ? n(Gn(e.error)) : n(null, Gn(e.data))); + } else { + var i = !1, + a = w(this.globalScope) ? void 0 : [], + o = e.hasCallback + ? function (e, n) { + (i = !0), + delete r.cancelCallbacks[t], + r.target.postMessage( + { + id: t, + type: '', + sourceMapId: r.mapId, + error: e ? Kn(e) : null, + data: Kn(n, a), + }, + a, + ); + } + : function (t) { + i = !0; + }, + s = null, + u = Gn(e.data); + if (this.parent[e.type]) s = this.parent[e.type](e.sourceMapId, u, o); + else if (this.parent.getWorkerSource) { + var l = e.type.split('.'); + s = this.parent + .getWorkerSource(e.sourceMapId, l[0], u.source) + [l[1]](u, o); + } else o(new Error('Could not find function ' + e.type)); + !i && s && s.cancel && (this.cancelCallbacks[t] = s.cancel); + } + }), + (xp.prototype.remove = function () { + this.invoker.remove(), + this.target.removeEventListener('message', this.receive, !1); + }); + var bp = 6371008.8, + wp = function (t, e) { + if (isNaN(t) || isNaN(e)) + throw new Error('Invalid LngLat object: (' + t + ', ' + e + ')'); + if (((this.lng = +t), (this.lat = +e), this.lat > 90 || this.lat < -90)) + throw new Error( + 'Invalid LngLat latitude value: must be between -90 and 90', + ); + }; + (wp.prototype.wrap = function () { + return new wp(o(this.lng, -180, 180), this.lat); + }), + (wp.prototype.toArray = function () { + return [this.lng, this.lat]; + }), + (wp.prototype.toString = function () { + return 'LngLat(' + this.lng + ', ' + this.lat + ')'; + }), + (wp.prototype.distanceTo = function (t) { + var e = Math.PI / 180, + r = this.lat * e, + n = t.lat * e, + i = + Math.sin(r) * Math.sin(n) + + Math.cos(r) * Math.cos(n) * Math.cos((t.lng - this.lng) * e); + return bp * Math.acos(Math.min(i, 1)); + }), + (wp.prototype.toBounds = function (t) { + void 0 === t && (t = 0); + var e = (360 * t) / 40075017, + r = e / Math.cos((Math.PI / 180) * this.lat); + return new _p( + new wp(this.lng - r, this.lat - e), + new wp(this.lng + r, this.lat + e), + ); + }), + (wp.convert = function (t) { + if (t instanceof wp) return t; + if (Array.isArray(t) && (2 === t.length || 3 === t.length)) + return new wp(Number(t[0]), Number(t[1])); + if (!Array.isArray(t) && 'object' == typeof t && null !== t) + return new wp(Number('lng' in t ? t.lng : t.lon), Number(t.lat)); + throw new Error( + '`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]', + ); + }); + var _p = function (t, e) { + t && + (e + ? this.setSouthWest(t).setNorthEast(e) + : 4 === t.length + ? this.setSouthWest([t[0], t[1]]).setNorthEast([t[2], t[3]]) + : this.setSouthWest(t[0]).setNorthEast(t[1])); + }; + (_p.prototype.setNorthEast = function (t) { + return ( + (this._ne = t instanceof wp ? new wp(t.lng, t.lat) : wp.convert(t)), + this + ); + }), + (_p.prototype.setSouthWest = function (t) { + return ( + (this._sw = t instanceof wp ? new wp(t.lng, t.lat) : wp.convert(t)), + this + ); + }), + (_p.prototype.extend = function (t) { + var e, + r, + n = this._sw, + i = this._ne; + if (t instanceof wp) (e = t), (r = t); + else { + if (!(t instanceof _p)) + return Array.isArray(t) + ? 4 === t.length || t.every(Array.isArray) + ? this.extend(_p.convert(t)) + : this.extend(wp.convert(t)) + : this; + if (((r = t._ne), !(e = t._sw) || !r)) return this; + } + return ( + n || i + ? ((n.lng = Math.min(e.lng, n.lng)), + (n.lat = Math.min(e.lat, n.lat)), + (i.lng = Math.max(r.lng, i.lng)), + (i.lat = Math.max(r.lat, i.lat))) + : ((this._sw = new wp(e.lng, e.lat)), + (this._ne = new wp(r.lng, r.lat))), + this + ); + }), + (_p.prototype.getCenter = function () { + return new wp( + (this._sw.lng + this._ne.lng) / 2, + (this._sw.lat + this._ne.lat) / 2, + ); + }), + (_p.prototype.getSouthWest = function () { + return this._sw; + }), + (_p.prototype.getNorthEast = function () { + return this._ne; + }), + (_p.prototype.getNorthWest = function () { + return new wp(this.getWest(), this.getNorth()); + }), + (_p.prototype.getSouthEast = function () { + return new wp(this.getEast(), this.getSouth()); + }), + (_p.prototype.getWest = function () { + return this._sw.lng; + }), + (_p.prototype.getSouth = function () { + return this._sw.lat; + }), + (_p.prototype.getEast = function () { + return this._ne.lng; + }), + (_p.prototype.getNorth = function () { + return this._ne.lat; + }), + (_p.prototype.toArray = function () { + return [this._sw.toArray(), this._ne.toArray()]; + }), + (_p.prototype.toString = function () { + return ( + 'LngLatBounds(' + + this._sw.toString() + + ', ' + + this._ne.toString() + + ')' + ); + }), + (_p.prototype.isEmpty = function () { + return !(this._sw && this._ne); + }), + (_p.prototype.contains = function (t) { + var e = wp.convert(t), + r = e.lng, + n = e.lat, + i = this._sw.lng <= r && r <= this._ne.lng; + return ( + this._sw.lng > this._ne.lng && + (i = this._sw.lng >= r && r >= this._ne.lng), + this._sw.lat <= n && n <= this._ne.lat && i + ); + }), + (_p.convert = function (t) { + return t instanceof _p ? t : t ? new _p(t) : t; + }); + var Ap = 2 * Math.PI * bp; + function kp(t) { + return Ap * Math.cos((t * Math.PI) / 180); + } + function Sp(t) { + return (180 + t) / 360; + } + function Ip(t) { + return ( + (180 - + (180 / Math.PI) * + Math.log(Math.tan(Math.PI / 4 + (t * Math.PI) / 360))) / + 360 + ); + } + function Mp(t, e) { + return t / kp(e); + } + function zp(t) { + return ( + (360 / Math.PI) * + Math.atan(Math.exp(((180 - 360 * t) * Math.PI) / 180)) - + 90 + ); + } + var Pp = function (t, e, r) { + void 0 === r && (r = 0), (this.x = +t), (this.y = +e), (this.z = +r); + }; + function Bp(t, e, r) { + var n = (2 * Math.PI * 6378137) / 256 / Math.pow(2, r); + return [ + t * n - (2 * Math.PI * 6378137) / 2, + e * n - (2 * Math.PI * 6378137) / 2, + ]; + } + (Pp.fromLngLat = function (t, e) { + void 0 === e && (e = 0); + var r = wp.convert(t); + return new Pp(Sp(r.lng), Ip(r.lat), Mp(e, r.lat)); + }), + (Pp.prototype.toLngLat = function () { + return new wp(360 * this.x - 180, zp(this.y)); + }), + (Pp.prototype.toAltitude = function () { + return this.z * kp(zp(this.y)); + }), + (Pp.prototype.meterInMercatorCoordinateUnits = function () { + return (1 / Ap) * ((t = zp(this.y)), 1 / Math.cos((t * Math.PI) / 180)); + var t; + }); + var Cp = function (t, e, r) { + if ( + t < 0 || + t > 25 || + r < 0 || + r >= Math.pow(2, t) || + e < 0 || + e >= Math.pow(2, t) + ) + throw new Error( + 'x=' + + e + + ', y=' + + r + + ', z=' + + t + + ' outside of bounds. 0<=x<' + + Math.pow(2, t) + + ', 0<=y<' + + Math.pow(2, t) + + ' 0<=z<=25 ', + ); + (this.z = t), (this.x = e), (this.y = r), (this.key = Tp(0, t, t, e, r)); + }; + (Cp.prototype.equals = function (t) { + return this.z === t.z && this.x === t.x && this.y === t.y; + }), + (Cp.prototype.url = function (t, e, r) { + var n, + i, + a, + o, + s, + u = + ((i = this.y), + (a = this.z), + (o = Bp(256 * (n = this.x), 256 * (i = Math.pow(2, a) - i - 1), a)), + (s = Bp(256 * (n + 1), 256 * (i + 1), a)), + o[0] + ',' + o[1] + ',' + s[0] + ',' + s[1]), + l = (function (t, e, r) { + for (var n, i = '', a = t; a > 0; a--) + i += (e & (n = 1 << (a - 1)) ? 1 : 0) + (r & n ? 2 : 0); + return i; + })(this.z, this.x, this.y); + return t[(this.x + this.y) % t.length] + .replace( + /{prefix}/g, + (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' === r ? Math.pow(2, this.z) - this.y - 1 : this.y), + ) + .replace(/{ratio}/g, e > 1 ? '@2x' : '') + .replace(/{quadkey}/g, l) + .replace(/{bbox-epsg-3857}/g, u); + }), + (Cp.prototype.isChildOf = function (t) { + var e = this.z - t.z; + return e > 0 && t.x === this.x >> e && t.y === this.y >> e; + }), + (Cp.prototype.getTilePoint = function (t) { + var e = Math.pow(2, this.z); + return new I((t.x * e - this.x) * lo, (t.y * e - this.y) * lo); + }), + (Cp.prototype.toString = function () { + return this.z + '/' + this.x + '/' + this.y; + }); + var Ep = function (t, e) { + (this.wrap = t), + (this.canonical = e), + (this.key = Tp(t, e.z, e.z, e.x, e.y)); + }, + Vp = function (t, e, r, n, i) { + if (t < r) + throw new Error( + 'overscaledZ should be >= z; overscaledZ = ' + t + '; z = ' + r, + ); + (this.overscaledZ = t), + (this.wrap = e), + (this.canonical = new Cp(r, +n, +i)), + (this.key = Tp(e, t, r, n, i)); + }; + function Tp(t, e, r, n, i) { + (t *= 2) < 0 && (t = -1 * t - 1); + var a = 1 << r; + return ( + (a * a * t + a * i + n).toString(36) + r.toString(36) + e.toString(36) + ); + } + (Vp.prototype.clone = function () { + return new Vp( + this.overscaledZ, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + }), + (Vp.prototype.equals = function (t) { + return ( + this.overscaledZ === t.overscaledZ && + this.wrap === t.wrap && + this.canonical.equals(t.canonical) + ); + }), + (Vp.prototype.scaledTo = function (t) { + if (t > this.overscaledZ) + throw new Error( + 'targetZ > this.overscaledZ; targetZ = ' + + t + + '; overscaledZ = ' + + this.overscaledZ, + ); + var e = this.canonical.z - t; + return t > this.canonical.z + ? new Vp( + t, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ) + : new Vp( + t, + this.wrap, + t, + this.canonical.x >> e, + this.canonical.y >> e, + ); + }), + (Vp.prototype.calculateScaledKey = function (t, e) { + if (t > this.overscaledZ) + throw new Error( + 'targetZ > this.overscaledZ; targetZ = ' + + t + + '; overscaledZ = ' + + this.overscaledZ, + ); + var r = this.canonical.z - t; + return t > this.canonical.z + ? Tp( + this.wrap * +e, + t, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ) + : Tp( + this.wrap * +e, + t, + t, + this.canonical.x >> r, + this.canonical.y >> r, + ); + }), + (Vp.prototype.isChildOf = function (t) { + if (t.wrap !== this.wrap) return !1; + var e = this.canonical.z - t.canonical.z; + return ( + 0 === t.overscaledZ || + (t.overscaledZ < this.overscaledZ && + t.canonical.x === this.canonical.x >> e && + t.canonical.y === this.canonical.y >> e) + ); + }), + (Vp.prototype.children = function (t) { + if (this.overscaledZ >= t) + return [ + new Vp( + this.overscaledZ + 1, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ), + ]; + var e = this.canonical.z + 1, + r = 2 * this.canonical.x, + n = 2 * this.canonical.y; + return [ + new Vp(e, this.wrap, e, r, n), + new Vp(e, this.wrap, e, r + 1, n), + new Vp(e, this.wrap, e, r, n + 1), + new Vp(e, this.wrap, e, r + 1, n + 1), + ]; + }), + (Vp.prototype.isLessThan = function (t) { + return ( + this.wrap < t.wrap || + (!(this.wrap > t.wrap) && + (this.overscaledZ < t.overscaledZ || + (!(this.overscaledZ > t.overscaledZ) && + (this.canonical.x < t.canonical.x || + (!(this.canonical.x > t.canonical.x) && + this.canonical.y < t.canonical.y))))) + ); + }), + (Vp.prototype.wrapped = function () { + return new Vp( + this.overscaledZ, + 0, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + }), + (Vp.prototype.unwrapTo = function (t) { + return new Vp( + this.overscaledZ, + t, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + }), + (Vp.prototype.overscaleFactor = function () { + return Math.pow(2, this.overscaledZ - this.canonical.z); + }), + (Vp.prototype.toUnwrapped = function () { + return new Ep(this.wrap, this.canonical); + }), + (Vp.prototype.toString = function () { + return ( + this.overscaledZ + '/' + this.canonical.x + '/' + this.canonical.y + ); + }), + (Vp.prototype.getTilePoint = function (t) { + return this.canonical.getTilePoint(new Pp(t.x - this.wrap, t.y)); + }), + qn('CanonicalTileID', Cp), + qn('OverscaledTileID', Vp, { omit: ['posMatrix'] }); + var Fp = function (t, e, r) { + if (((this.uid = t), e.height !== e.width)) + throw new RangeError('DEM tiles must be square'); + if (r && 'mapbox' !== r && 'terrarium' !== r) + d( + '"' + + r + + '" is not a valid encoding type. Valid types include "mapbox" and "terrarium".', + ); + else { + this.stride = e.height; + var n = (this.dim = e.height - 2); + (this.data = new Uint32Array(e.data.buffer)), + (this.encoding = r || 'mapbox'); + for (var i = 0; i < n; i++) + (this.data[this._idx(-1, i)] = this.data[this._idx(0, i)]), + (this.data[this._idx(n, i)] = this.data[this._idx(n - 1, i)]), + (this.data[this._idx(i, -1)] = this.data[this._idx(i, 0)]), + (this.data[this._idx(i, n)] = this.data[this._idx(i, n - 1)]); + (this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)]), + (this.data[this._idx(n, -1)] = this.data[this._idx(n - 1, 0)]), + (this.data[this._idx(-1, n)] = this.data[this._idx(0, n - 1)]), + (this.data[this._idx(n, n)] = this.data[this._idx(n - 1, n - 1)]), + (this.min = Number.MAX_SAFE_INTEGER), + (this.max = Number.MIN_SAFE_INTEGER); + for (var a = 0; a < n; a++) + for (var o = 0; o < n; o++) { + var s = this.get(a, o); + s > this.max && (this.max = s), s < this.min && (this.min = s); + } + } + }; + (Fp.prototype.get = function (t, e) { + var r = new Uint8Array(this.data.buffer), + n = 4 * this._idx(t, e); + return ( + 'terrarium' === this.encoding + ? this._unpackTerrarium + : this._unpackMapbox + )(r[n], r[n + 1], r[n + 2]); + }), + (Fp.prototype.getUnpackVector = function () { + return 'terrarium' === this.encoding + ? [256, 1, 1 / 256, 32768] + : [6553.6, 25.6, 0.1, 1e4]; + }), + (Fp.prototype._idx = function (t, e) { + if (t < -1 || t >= this.dim + 1 || e < -1 || e >= this.dim + 1) + throw new RangeError('out of range source coordinates for DEM data'); + return (e + 1) * this.stride + (t + 1); + }), + (Fp.prototype._unpackMapbox = function (t, e, r) { + return (256 * t * 256 + 256 * e + r) / 10 - 1e4; + }), + (Fp.prototype._unpackTerrarium = function (t, e, r) { + return 256 * t + e + r / 256 - 32768; + }), + (Fp.prototype.getPixels = function () { + return new $o( + { width: this.stride, height: this.stride }, + new Uint8Array(this.data.buffer), + ); + }), + (Fp.prototype.backfillBorder = function (t, e, r) { + if (this.dim !== t.dim) throw new Error('dem dimension mismatch'); + var n = e * this.dim, + i = e * this.dim + this.dim, + a = r * this.dim, + o = r * this.dim + this.dim; + switch (e) { + case -1: + n = i - 1; + break; + case 1: + i = n + 1; + } + switch (r) { + case -1: + a = o - 1; + break; + case 1: + o = a + 1; + } + for (var s = -e * this.dim, u = -r * this.dim, l = a; l < o; l++) + for (var p = n; p < i; p++) + this.data[this._idx(p, l)] = t.data[this._idx(p + s, l + u)]; + }), + qn('DEMData', Fp); + var Op = function (t) { + (this._stringToNumber = {}), (this._numberToString = []); + for (var e = 0; e < t.length; e++) { + var r = t[e]; + (this._stringToNumber[r] = e), (this._numberToString[e] = r); + } + }; + (Op.prototype.encode = function (t) { + return this._stringToNumber[t]; + }), + (Op.prototype.decode = function (t) { + if (t >= this._numberToString.length) + throw new Error( + 'Out of bounds. Index requested n=' + + t + + " can't be >= this._numberToString.length " + + this._numberToString.length, + ); + return this._numberToString[t]; + }); + var Lp = function (t, e, r, n, i) { + (this.type = 'Feature'), + (this._vectorTileFeature = t), + (t._z = e), + (t._x = r), + (t._y = n), + (this.properties = t.properties), + (this.id = i); + }, + Dp = { geometry: { configurable: !0 } }; + (Dp.geometry.get = function () { + return ( + void 0 === this._geometry && + (this._geometry = this._vectorTileFeature.toGeoJSON( + this._vectorTileFeature._x, + this._vectorTileFeature._y, + this._vectorTileFeature._z, + ).geometry), + this._geometry + ); + }), + (Dp.geometry.set = function (t) { + this._geometry = t; + }), + (Lp.prototype.toJSON = function () { + var t = { geometry: this.geometry }; + for (var e in this) + '_geometry' !== e && '_vectorTileFeature' !== e && (t[e] = this[e]); + return t; + }), + Object.defineProperties(Lp.prototype, Dp); + var jp, + Rp = function (t, e) { + (this.tileID = t), + (this.x = t.canonical.x), + (this.y = t.canonical.y), + (this.z = t.canonical.z), + (this.grid = new Rn(lo, 16, 0)), + (this.grid3D = new Rn(lo, 16, 0)), + (this.featureIndexArray = new ha()), + (this.promoteId = e); + }; + function Up(t, e, r, n, i) { + return c(t, function (t, a) { + var o = e instanceof wi ? e.get(a) : null; + return o && o.evaluate ? o.evaluate(r, n, i) : o; + }); + } + function qp(t) { + for ( + var e = 1 / 0, r = 1 / 0, n = -1 / 0, i = -1 / 0, a = 0, o = t; + a < o.length; + a += 1 + ) { + var s = o[a]; + (e = Math.min(e, s.x)), + (r = Math.min(r, s.y)), + (n = Math.max(n, s.x)), + (i = Math.max(i, s.y)); + } + return { minX: e, minY: r, maxX: n, maxY: i }; + } + function Np(t, e) { + return e - t; + } + (Rp.prototype.insert = function (t, e, r, n, i, a) { + var o = this.featureIndexArray.length; + this.featureIndexArray.emplaceBack(r, n, i); + for (var s = a ? this.grid3D : this.grid, u = 0; u < e.length; u++) { + for ( + var l = e[u], p = [1 / 0, 1 / 0, -1 / 0, -1 / 0], c = 0; + c < l.length; + c++ + ) { + var h = l[c]; + (p[0] = Math.min(p[0], h.x)), + (p[1] = Math.min(p[1], h.y)), + (p[2] = Math.max(p[2], h.x)), + (p[3] = Math.max(p[3], h.y)); + } + p[0] < lo && + p[1] < lo && + p[2] >= 0 && + p[3] >= 0 && + s.insert(o, p[0], p[1], p[2], p[3]); + } + }), + (Rp.prototype.loadVTLayers = function () { + return ( + this.vtLayers || + ((this.vtLayers = new Gs.VectorTile( + new Vu(this.rawTileData), + ).layers), + (this.sourceLayerCoder = new Op( + this.vtLayers + ? Object.keys(this.vtLayers).sort() + : ['_geojsonTileLayer'], + ))), + this.vtLayers + ); + }), + (Rp.prototype.query = function (t, e, r, n) { + var i = this; + this.loadVTLayers(); + for ( + var a = t.params || {}, + o = lo / t.tileSize / t.scale, + s = pn(a.filter), + u = t.queryGeometry, + l = t.queryPadding * o, + p = qp(u), + c = this.grid.query(p.minX - l, p.minY - l, p.maxX + l, p.maxY + l), + h = qp(t.cameraQueryGeometry), + f = this.grid3D.query( + h.minX - l, + h.minY - l, + h.maxX + l, + h.maxY + l, + function (e, r, n, i) { + return (function (t, e, r, n, i) { + for (var a = 0, o = t; a < o.length; a += 1) { + var s = o[a]; + if (e <= s.x && r <= s.y && n >= s.x && i >= s.y) return !0; + } + var u = [new I(e, r), new I(e, i), new I(n, i), new I(n, r)]; + if (t.length > 2) + for (var l = 0, p = u; l < p.length; l += 1) + if (Io(t, p[l])) return !0; + for (var c = 0; c < t.length - 1; c++) + if (Mo(t[c], t[c + 1], u)) return !0; + return !1; + })(t.cameraQueryGeometry, e - l, r - l, n + l, i + l); + }, + ), + y = 0, + d = f; + y < d.length; + y += 1 + ) + c.push(d[y]); + c.sort(Np); + for ( + var m, + v = {}, + g = function (l) { + var p = c[l]; + if (p !== m) { + m = p; + var h = i.featureIndexArray.get(p), + f = null; + i.loadMatchingFeature( + v, + h.bucketIndex, + h.sourceLayerIndex, + h.featureIndex, + s, + a.layers, + a.availableImages, + e, + r, + n, + function (e, r, n) { + return ( + f || (f = ho(e)), + r.queryIntersectsFeature( + u, + e, + n, + f, + i.z, + t.transform, + o, + t.pixelPosMatrix, + ) + ); + }, + ); + } + }, + x = 0; + x < c.length; + x++ + ) + g(x); + return v; + }), + (Rp.prototype.loadMatchingFeature = function ( + t, + e, + r, + n, + i, + a, + o, + u, + l, + p, + c, + ) { + var h = this.bucketLayerIDs[e]; + if ( + !a || + (function (t, e) { + for (var r = 0; r < t.length; r++) + if (e.indexOf(t[r]) >= 0) return !0; + return !1; + })(a, h) + ) { + var f = this.sourceLayerCoder.decode(r), + y = this.vtLayers[f].feature(n); + if (i.needGeometry) { + var d = fo(y, !0); + if ( + !i.filter( + new fi(this.tileID.overscaledZ), + d, + this.tileID.canonical, + ) + ) + return; + } else if (!i.filter(new fi(this.tileID.overscaledZ), y)) return; + for (var m = this.getId(y, f), v = 0; v < h.length; v++) { + var g = h[v]; + if (!(a && a.indexOf(g) < 0)) { + var x = u[g]; + if (x) { + var b = {}; + m && + p && + (b = p.getState(x.sourceLayer || '_geojsonTileLayer', m)); + var w = s({}, l[g]); + (w.paint = Up(w.paint, x.paint, y, b, o)), + (w.layout = Up(w.layout, x.layout, y, b, o)); + var _ = !c || c(y, x, b); + if (_) { + var A = new Lp(y, this.z, this.x, this.y, m); + A.layer = w; + var k = t[g]; + void 0 === k && (k = t[g] = []), + k.push({ featureIndex: n, feature: A, intersectionZ: _ }); + } + } + } + } + } + }), + (Rp.prototype.lookupSymbolFeatures = function (t, e, r, n, i, a, o, s) { + var u = {}; + this.loadVTLayers(); + for (var l = pn(i), p = 0, c = t; p < c.length; p += 1) + this.loadMatchingFeature(u, r, n, c[p], l, a, o, s, e); + return u; + }), + (Rp.prototype.hasLayer = function (t) { + for (var e = 0, r = this.bucketLayerIDs; e < r.length; e += 1) + for (var n = 0, i = r[e]; n < i.length; n += 1) + if (t === i[n]) return !0; + return !1; + }), + (Rp.prototype.getId = function (t, e) { + var r = t.id; + return ( + this.promoteId && + 'boolean' == + typeof (r = + t.properties[ + 'string' == typeof this.promoteId + ? this.promoteId + : this.promoteId[e] + ]) && + (r = Number(r)), + r + ); + }), + qn('FeatureIndex', Rp, { omit: ['rawTileData', 'sourceLayerCoder'] }), + (t.PerformanceMarkers = void 0), + ((jp = t.PerformanceMarkers || (t.PerformanceMarkers = {})).create = + 'create'), + (jp.load = 'load'), + (jp.fullLoad = 'fullLoad'); + var Zp = null, + Kp = [], + Gp = 1e3 / 30, + Jp = { + mark: function (t) { + performance.mark(t); + }, + frame: function (t) { + var e = t; + null != Zp && Kp.push(e - Zp), (Zp = e); + }, + clearMetrics: function () { + for (var e in ((Zp = null), + (Kp = []), + performance.clearMeasures('loadTime'), + performance.clearMeasures('fullLoadTime'), + t.PerformanceMarkers)) + performance.clearMarks(t.PerformanceMarkers[e]); + }, + getPerformanceMetrics: function () { + performance.measure( + 'loadTime', + t.PerformanceMarkers.create, + t.PerformanceMarkers.load, + ), + performance.measure( + 'fullLoadTime', + t.PerformanceMarkers.create, + t.PerformanceMarkers.fullLoad, + ); + var e = performance.getEntriesByName('loadTime')[0].duration, + r = performance.getEntriesByName('fullLoadTime')[0].duration, + n = Kp.length, + i = + 1 / + (Kp.reduce(function (t, e) { + return t + e; + }, 0) / + n / + 1e3), + a = Kp.filter(function (t) { + return t > Gp; + }).reduce(function (t, e) { + return t + (e - Gp) / Gp; + }, 0); + return { + loadTime: e, + fullLoadTime: r, + fps: i, + percentDroppedFrames: (a / (n + a)) * 100, + }; + }, + }, + Xp = function (t) { + (this._marks = { + start: [t.url, 'start'].join('#'), + end: [t.url, 'end'].join('#'), + measure: t.url.toString(), + }), + performance.mark(this._marks.start); + }; + (Xp.prototype.finish = function () { + performance.mark(this._marks.end); + var t = performance.getEntriesByName(this._marks.measure); + return ( + 0 === t.length && + (performance.measure( + this._marks.measure, + this._marks.start, + this._marks.end, + ), + (t = performance.getEntriesByName(this._marks.measure)), + performance.clearMarks(this._marks.start), + performance.clearMarks(this._marks.end), + performance.clearMeasures(this._marks.measure)), + t + ); + }), + (t.AJAXError = it), + (t.ARRAY_TYPE = To), + (t.Actor = xp), + (t.AlphaImage = Wo), + (t.CanonicalTileID = Cp), + (t.CollisionBoxArray = ia), + (t.CollisionCircleLayoutArray = Sa), + (t.Color = Yt), + (t.DEMData = Fp), + (t.DataConstantProperty = _i), + (t.DictionaryCoder = Op), + (t.EXTENT = lo), + (t.ErrorEvent = mt), + (t.EvaluationParameters = fi), + (t.Event = dt), + (t.Evented = vt), + (t.FeatureIndex = Rp), + (t.FillBucket = js), + (t.FillExtrusionBucket = su), + (t.GeoJSONFeature = Lp), + (t.ImageAtlas = ul), + (t.ImagePosition = al), + (t.LineBucket = gu), + (t.LineStripIndexArray = Ba), + (t.LngLat = wp), + (t.LngLatBounds = _p), + (t.MercatorCoordinate = Pp), + (t.ONE_EM = Eu), + (t.OverscaledTileID = Vp), + (t.PerformanceUtils = Jp), + (t.PosArray = fa), + (t.Properties = Mi), + (t.QuadTriangleArray = Ma), + (t.RGBAImage = $o), + (t.RasterBoundsArray = ya), + (t.RequestPerformance = Xp), + (t.ResourceType = nt), + (t.SegmentVector = Ea), + (t.SymbolBucket = op), + (t.Transitionable = mi), + (t.TriangleIndexArray = za), + (t.Uniform1f = Ga), + (t.Uniform1i = Ka), + (t.Uniform2f = Ja), + (t.Uniform3f = Xa), + (t.Uniform4f = Ya), + (t.UniformColor = Ha), + (t.UniformMatrix4f = $a), + (t.UnwrappedTileID = Ep), + (t.ValidationError = xt), + (t.ZoomHistory = Jn), + (t.add = function (t, e, r) { + return ( + (t[0] = e[0] + r[0]), (t[1] = e[1] + r[1]), (t[2] = e[2] + r[2]), t + ); + }), + (t.addDynamicAttributes = rp), + (t.asyncAll = function (t, e, r) { + if (!t.length) return r(null, []); + var n = t.length, + i = new Array(t.length), + a = null; + t.forEach(function (t, o) { + e(t, function (t, e) { + t && (a = t), (i[o] = e), 0 == --n && r(a, i); + }); + }); + }), + (t.bezier = n), + (t.bindAll = l), + (t.cacheEntryPossiblyAdded = function (t) { + ++$ > X && (t.getActor().send('enforceCacheSizeLimit', J), ($ = 0)); + }), + (t.clamp = a), + (t.clearTileCache = function (t) { + var e = caches.delete(G); + t && + e.catch(t).then(function () { + return t(); + }); + }), + (t.clipLine = Tl), + (t.clone = function (t) { + var e = new To(16); + return ( + (e[0] = t[0]), + (e[1] = t[1]), + (e[2] = t[2]), + (e[3] = t[3]), + (e[4] = t[4]), + (e[5] = t[5]), + (e[6] = t[6]), + (e[7] = t[7]), + (e[8] = t[8]), + (e[9] = t[9]), + (e[10] = t[10]), + (e[11] = t[11]), + (e[12] = t[12]), + (e[13] = t[13]), + (e[14] = t[14]), + (e[15] = t[15]), + e + ); + }), + (t.clone$1 = f), + (t.clone$2 = function (t) { + var e = new To(3); + return (e[0] = t[0]), (e[1] = t[1]), (e[2] = t[2]), e; + }), + (t.collisionCircleLayout = Pu), + (t.config = K), + (t.copy = function (t, e) { + 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 + ); + }), + (t.create = function () { + var t = new To(16); + return ( + To != Float32Array && + ((t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0)), + (t[0] = 1), + (t[5] = 1), + (t[10] = 1), + (t[15] = 1), + t + ); + }), + (t.create$1 = Fo), + (t.createExpression = Yr), + (t.createFilter = pn), + (t.createLayout = Vi), + (t.createStyleLayer = function (t) { + return 'custom' === t.type ? new mp(t) : new vp[t.type](t); + }), + (t.cross = function (t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + o = r[0], + s = r[1], + u = r[2]; + return ( + (t[0] = i * u - a * s), + (t[1] = a * o - n * u), + (t[2] = n * s - i * o), + t + ); + }), + (t.dot = function (t, e) { + return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]; + }), + (t.dot$1 = function (t, e) { + return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3]; + }), + (t.ease = i), + (t.emitValidationErrors = jn), + (t.endsWith = p), + (t.enforceCacheSizeLimit = function (t) { + Y(), + N && + N.then(function (e) { + e.keys().then(function (r) { + for (var n = 0; n < r.length - t; n++) e.delete(r[n]); + }); + }); + }), + (t.equals = function (t, e) { + var r = t[0], + n = t[1], + i = t[2], + a = t[3], + o = t[4], + s = t[5], + u = t[6], + l = t[7], + p = t[8], + c = t[9], + h = t[10], + f = t[11], + y = t[12], + d = t[13], + m = t[14], + v = t[15], + g = e[0], + x = e[1], + b = e[2], + w = e[3], + _ = e[4], + A = e[5], + k = e[6], + S = e[7], + I = e[8], + M = e[9], + z = e[10], + P = e[11], + B = e[12], + C = e[13], + E = e[14], + V = e[15]; + return ( + Math.abs(r - g) <= Vo * Math.max(1, Math.abs(r), Math.abs(g)) && + Math.abs(n - x) <= Vo * Math.max(1, Math.abs(n), Math.abs(x)) && + Math.abs(i - b) <= Vo * Math.max(1, Math.abs(i), Math.abs(b)) && + Math.abs(a - w) <= Vo * Math.max(1, Math.abs(a), Math.abs(w)) && + Math.abs(o - _) <= Vo * Math.max(1, Math.abs(o), Math.abs(_)) && + Math.abs(s - A) <= Vo * Math.max(1, Math.abs(s), Math.abs(A)) && + Math.abs(u - k) <= Vo * Math.max(1, Math.abs(u), Math.abs(k)) && + Math.abs(l - S) <= Vo * Math.max(1, Math.abs(l), Math.abs(S)) && + Math.abs(p - I) <= Vo * Math.max(1, Math.abs(p), Math.abs(I)) && + Math.abs(c - M) <= Vo * Math.max(1, Math.abs(c), Math.abs(M)) && + Math.abs(h - z) <= Vo * Math.max(1, Math.abs(h), Math.abs(z)) && + Math.abs(f - P) <= Vo * Math.max(1, Math.abs(f), Math.abs(P)) && + Math.abs(y - B) <= Vo * Math.max(1, Math.abs(y), Math.abs(B)) && + Math.abs(d - C) <= Vo * Math.max(1, Math.abs(d), Math.abs(C)) && + Math.abs(m - E) <= Vo * Math.max(1, Math.abs(m), Math.abs(E)) && + Math.abs(v - V) <= Vo * Math.max(1, Math.abs(v), Math.abs(V)) + ); + }), + (t.evaluateSizeForFeature = function (t, e, r) { + var n = e.uSize, + i = r.lowerSize; + return 'source' === t.kind + ? i / kl + : 'composite' === t.kind + ? Re(i / kl, r.upperSize / kl, e.uSizeT) + : n; + }), + (t.evaluateSizeForZoom = function (t, e) { + var r = 0, + n = 0; + if ('constant' === t.kind) n = t.layoutSize; + else if ('source' !== t.kind) { + var i = t.interpolationType, + o = i + ? a(ar.interpolationFactor(i, e, t.minZoom, t.maxZoom), 0, 1) + : 0; + 'camera' === t.kind ? (n = Re(t.minSize, t.maxSize, o)) : (r = o); + } + return { uSizeT: r, uSize: n }; + }), + (t.evaluateVariableOffset = Jl), + (t.evented = li), + (t.exported = S), + (t.exported$1 = Q), + (t.extend = s), + (t.filterObject = h), + (t.fromRotation = function (t, e) { + var r = Math.sin(e), + n = Math.cos(e); + return ( + (t[0] = n), + (t[1] = r), + (t[2] = 0), + (t[3] = -r), + (t[4] = n), + (t[5] = 0), + (t[6] = 0), + (t[7] = 0), + (t[8] = 1), + t + ); + }), + (t.fromScaling = function (t, e) { + return ( + (t[0] = e[0]), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = e[1]), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = e[2]), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0), + (t[15] = 1), + t + ); + }), + (t.getAnchorAlignment = wl), + (t.getAnchorJustification = Xl), + (t.getArrayBuffer = pt), + (t.getImage = ht), + (t.getJSON = function (t, e) { + return lt(s(t, { type: 'json' }), e); + }), + (t.getOverlapMode = cp), + (t.getRTLTextPluginStatus = pi), + (t.getReferrer = at), + (t.getVideo = function (t, e) { + var r, + n, + i = window.document.createElement('video'); + (i.muted = !0), + (i.onloadstart = function () { + e(null, i); + }); + for (var a = 0; a < t.length; a++) { + var o = window.document.createElement('source'); + (r = t[a]), + (n = void 0), + ((n = window.document.createElement('a')).href = r), + (n.protocol !== window.document.location.protocol || + n.host !== window.document.location.host) && + (i.crossOrigin = 'Anonymous'), + (o.src = t[a]), + i.appendChild(o); + } + return { cancel: function () {} }; + }), + (t.identity = Oo), + (t.invert = function (t, e) { + var r = e[0], + n = e[1], + i = e[2], + a = e[3], + o = e[4], + s = e[5], + u = e[6], + l = e[7], + p = e[8], + c = e[9], + h = e[10], + f = e[11], + y = e[12], + d = e[13], + m = e[14], + v = e[15], + g = r * s - n * o, + x = r * u - i * o, + b = r * l - a * o, + w = n * u - i * s, + _ = n * l - a * s, + A = i * l - a * u, + k = p * d - c * y, + S = p * m - h * y, + I = p * v - f * y, + M = c * m - h * d, + z = c * v - f * d, + P = h * v - f * m, + B = g * P - x * z + b * M + w * I - _ * S + A * k; + return B + ? ((t[0] = (s * P - u * z + l * M) * (B = 1 / B)), + (t[1] = (i * z - n * P - a * M) * B), + (t[2] = (d * A - m * _ + v * w) * B), + (t[3] = (h * _ - c * A - f * w) * B), + (t[4] = (u * I - o * P - l * S) * B), + (t[5] = (r * P - i * I + a * S) * B), + (t[6] = (m * b - y * A - v * x) * B), + (t[7] = (p * A - h * b + f * x) * B), + (t[8] = (o * z - s * I + l * k) * B), + (t[9] = (n * I - r * z - a * k) * B), + (t[10] = (y * _ - d * b + v * g) * B), + (t[11] = (c * b - p * _ - f * g) * B), + (t[12] = (s * S - o * M - u * k) * B), + (t[13] = (r * M - n * S + i * k) * B), + (t[14] = (d * x - y * w - m * g) * B), + (t[15] = (p * w - c * x + h * g) * B), + t) + : null; + }), + (t.isImageBitmap = _), + (t.isSafari = w), + (t.isWorker = g), + (t.keysDifference = function (t, e) { + var r = []; + for (var n in t) n in e || r.push(n); + return r; + }), + (t.lazyLoadRTLTextPlugin = function () { + hi.isLoading() || hi.isLoaded() || 'deferred' !== pi() || ci(); + }), + (t.makeRequest = lt), + (t.mapObject = c), + (t.mercatorXfromLng = Sp), + (t.mercatorYfromLat = Ip), + (t.mercatorZfromAltitude = Mp), + (t.mul = jo), + (t.mul$1 = function (t, e, r) { + return ( + (t[0] = e[0] * r[0]), + (t[1] = e[1] * r[1]), + (t[2] = e[2] * r[2]), + (t[3] = e[3] * r[3]), + t + ); + }), + (t.multiply = Lo), + (t.nextPowerOfTwo = function (t) { + return t <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t) / Math.LN2)); + }), + (t.normalize = function (t, e) { + var r = e[0], + n = e[1], + i = e[2], + a = r * r + n * n + i * i; + return ( + a > 0 && (a = 1 / Math.sqrt(a)), + (t[0] = e[0] * a), + (t[1] = e[1] * a), + (t[2] = e[2] * a), + t + ); + }), + (t.number = Re), + (t.ortho = function (t, e, r, n, i, a, o) { + var s = 1 / (e - r), + u = 1 / (n - i), + l = 1 / (a - o); + return ( + (t[0] = -2 * s), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = -2 * u), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = 2 * l), + (t[11] = 0), + (t[12] = (e + r) * s), + (t[13] = (i + n) * u), + (t[14] = (o + a) * l), + (t[15] = 1), + t + ); + }), + (t.parseCacheControl = x), + (t.parseGlyphPbf = function (t) { + return new Vu(t).readFields(el, []); + }), + (t.pbf = Vu), + (t.performSymbolLayout = function (e) { + e.bucket.createArrays(), + (e.bucket.tilePixelRatio = lo / (512 * e.bucket.overscaling)), + (e.bucket.compareText = {}), + (e.bucket.iconsNeedLinear = !1); + var r = e.bucket.layers[0].layout, + n = e.bucket.layers[0]._unevaluatedLayout._values, + i = { + layoutIconSize: n['icon-size'].possiblyEvaluate( + new fi(e.bucket.zoom + 1), + e.canonical, + ), + layoutTextSize: n['text-size'].possiblyEvaluate( + new fi(e.bucket.zoom + 1), + e.canonical, + ), + textMaxSize: n['text-size'].possiblyEvaluate(new fi(18)), + }; + if ('composite' === e.bucket.textSizeData.kind) { + var a = e.bucket.textSizeData, + o = a.maxZoom; + i.compositeTextSizes = [ + n['text-size'].possiblyEvaluate(new fi(a.minZoom), e.canonical), + n['text-size'].possiblyEvaluate(new fi(o), e.canonical), + ]; + } + if ('composite' === e.bucket.iconSizeData.kind) { + var s = e.bucket.iconSizeData, + u = s.maxZoom; + i.compositeIconSizes = [ + n['icon-size'].possiblyEvaluate(new fi(s.minZoom), e.canonical), + n['icon-size'].possiblyEvaluate(new fi(u), e.canonical), + ]; + } + for ( + var l = r.get('text-line-height') * Eu, + p = + 'viewport' !== r.get('text-rotation-alignment') && + 'point' !== r.get('symbol-placement'), + c = r.get('text-keep-upright'), + h = r.get('text-size'), + f = function () { + var n = m[y], + a = r.get('text-font').evaluate(n, {}, e.canonical).join(','), + o = h.evaluate(n, {}, e.canonical), + s = i.layoutTextSize.evaluate(n, {}, e.canonical), + u = i.layoutIconSize.evaluate(n, {}, e.canonical), + f = { horizontal: {}, vertical: void 0 }, + v = n.text, + g = [0, 0]; + if (v) { + var x = v.toString(), + b = + r.get('text-letter-spacing').evaluate(n, {}, e.canonical) * + Eu, + w = (function (t) { + for (var e = 0, r = t; e < r.length; e += 1) + if ( + ((n = r[e].charCodeAt(0)), + Xn.Arabic(n) || + Xn['Arabic Supplement'](n) || + Xn['Arabic Extended-A'](n) || + Xn['Arabic Presentation Forms-A'](n) || + Xn['Arabic Presentation Forms-B'](n)) + ) + return !1; + var n; + return !0; + })(x) + ? b + : 0, + _ = r.get('text-anchor').evaluate(n, {}, e.canonical), + A = r.get('text-variable-anchor'); + if (!A) { + var k = r + .get('text-radial-offset') + .evaluate(n, {}, e.canonical); + g = k + ? Jl(_, [k * Eu, Gl]) + : r + .get('text-offset') + .evaluate(n, {}, e.canonical) + .map(function (t) { + return t * Eu; + }); + } + var S = p + ? 'center' + : r.get('text-justify').evaluate(n, {}, e.canonical), + I = r.get('symbol-placement'), + M = + 'point' === I + ? r.get('text-max-width').evaluate(n, {}, e.canonical) * + Eu + : 0, + z = function () { + e.bucket.allowVerticalPlacement && + Yn(x) && + (f.vertical = hl( + v, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + a, + M, + l, + _, + 'left', + w, + g, + t.WritingMode.vertical, + !0, + I, + s, + o, + )); + }; + if (!p && A) { + for ( + var P = + 'auto' === S + ? A.map(function (t) { + return Xl(t); + }) + : [S], + B = !1, + C = 0; + C < P.length; + C++ + ) { + var E = P[C]; + if (!f.horizontal[E]) + if (B) f.horizontal[E] = f.horizontal[0]; + else { + var V = hl( + v, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + a, + M, + l, + 'center', + E, + w, + g, + t.WritingMode.horizontal, + !1, + I, + s, + o, + ); + V && + ((f.horizontal[E] = V), + (B = 1 === V.positionedLines.length)); + } + } + z(); + } else { + 'auto' === S && (S = Xl(_)); + var T = hl( + v, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + a, + M, + l, + _, + S, + w, + g, + t.WritingMode.horizontal, + !1, + I, + s, + o, + ); + T && (f.horizontal[S] = T), + z(), + Yn(x) && + p && + c && + (f.vertical = hl( + v, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + a, + M, + l, + _, + S, + w, + g, + t.WritingMode.vertical, + !1, + I, + s, + o, + )); + } + } + var F = void 0, + O = !1; + if (n.icon && n.icon.name) { + var L = e.imageMap[n.icon.name]; + L && + ((F = (function (t, e, r) { + var n = wl(r), + i = e[0] - t.displaySize[0] * n.horizontalAlign, + a = e[1] - t.displaySize[1] * n.verticalAlign; + return { + image: t, + top: a, + bottom: a + t.displaySize[1], + left: i, + right: i + t.displaySize[0], + }; + })( + e.imagePositions[n.icon.name], + r.get('icon-offset').evaluate(n, {}, e.canonical), + r.get('icon-anchor').evaluate(n, {}, e.canonical), + )), + (O = !!L.sdf), + void 0 === e.bucket.sdfIcons + ? (e.bucket.sdfIcons = O) + : e.bucket.sdfIcons !== O && + d( + 'Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer', + ), + (L.pixelRatio !== e.bucket.pixelRatio || + 0 !== r.get('icon-rotate').constantOr(1)) && + (e.bucket.iconsNeedLinear = !0)); + } + var D = Wl(f.horizontal) || f.vertical; + (e.bucket.iconsInText = !!D && D.iconsInText), + (D || F) && + (function (e, r, n, i, a, o, s, u, l, p, c) { + var h = o.textMaxSize.evaluate(r, {}); + void 0 === h && (h = s); + var f, + y = e.layers[0].layout, + m = y.get('icon-offset').evaluate(r, {}, c), + v = Wl(n.horizontal), + g = s / 24, + x = e.tilePixelRatio * g, + b = (e.tilePixelRatio * h) / 24, + w = e.tilePixelRatio * u, + _ = e.tilePixelRatio * y.get('symbol-spacing'), + A = y.get('text-padding') * e.tilePixelRatio, + k = (function (t, e, r, n) { + void 0 === n && (n = 1); + var i = t.get('icon-padding').evaluate(e, {}, r), + a = i && i.values; + return [a[0] * n, a[1] * n, a[2] * n, a[3] * n]; + })(y, r, c, e.tilePixelRatio), + S = (y.get('text-max-angle') / 180) * Math.PI, + I = + 'viewport' !== y.get('text-rotation-alignment') && + 'point' !== y.get('symbol-placement'), + M = + 'map' === y.get('icon-rotation-alignment') && + 'point' !== y.get('symbol-placement'), + z = y.get('symbol-placement'), + P = _ / 2, + B = y.get('icon-text-fit'); + i && + 'none' !== B && + (e.allowVerticalPlacement && + n.vertical && + (f = Al( + i, + n.vertical, + B, + y.get('icon-text-fit-padding'), + m, + g, + )), + v && + (i = Al( + i, + v, + B, + y.get('icon-text-fit-padding'), + m, + g, + ))); + var C = function (u, h) { + h.x < 0 || + h.x >= lo || + h.y < 0 || + h.y >= lo || + (function ( + e, + r, + n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + m, + v, + g, + x, + b, + w, + _, + A, + k, + S, + I, + ) { + var M, + z, + P, + B, + C, + E = e.addToLineVertexArray(r, n), + V = 0, + T = 0, + F = 0, + O = 0, + L = -1, + D = -1, + j = {}, + R = Fa.exports(''), + U = 0, + q = 0; + if ( + (void 0 === + u._unevaluatedLayout.getValue('text-radial-offset') + ? ((U = (M = u.layout + .get('text-offset') + .evaluate(_, {}, S) + .map(function (t) { + return t * Eu; + }))[0]), + (q = M[1])) + : ((U = + u.layout + .get('text-radial-offset') + .evaluate(_, {}, S) * Eu), + (q = Gl)), + e.allowVerticalPlacement && i.vertical) + ) { + var N = + u.layout.get('text-rotate').evaluate(_, {}, S) + + 90; + (B = new Rl(l, r, p, c, h, i.vertical, f, y, m, N)), + s && (C = new Rl(l, r, p, c, h, s, g, x, m, N)); + } + if (a) { + var Z = u.layout.get('icon-rotate').evaluate(_, {}), + K = 'none' !== u.layout.get('icon-text-fit'), + G = Fl(a, Z, k, K), + J = s ? Fl(s, Z, k, K) : void 0; + (P = new Rl(l, r, p, c, h, a, g, x, !1, Z)), + (V = 4 * G.length); + var X = e.iconSizeData, + Y = null; + 'source' === X.kind + ? (Y = [ + kl * + u.layout.get('icon-size').evaluate(_, {}), + ])[0] > Yl && + d( + e.layerIds[0] + + ': Value for "icon-size" is >= 255. Reduce your "icon-size".', + ) + : 'composite' === X.kind && + ((Y = [ + kl * + A.compositeIconSizes[0].evaluate(_, {}, S), + kl * + A.compositeIconSizes[1].evaluate(_, {}, S), + ])[0] > Yl || + Y[1] > Yl) && + d( + e.layerIds[0] + + ': Value for "icon-size" is >= 255. Reduce your "icon-size".', + ), + e.addSymbols( + e.icon, + G, + Y, + w, + b, + _, + t.WritingMode.none, + r, + E.lineStartIndex, + E.lineLength, + -1, + S, + ), + (L = e.icon.placedSymbolArray.length - 1), + J && + ((T = 4 * J.length), + e.addSymbols( + e.icon, + J, + Y, + w, + b, + _, + t.WritingMode.vertical, + r, + E.lineStartIndex, + E.lineLength, + -1, + S, + ), + (D = e.icon.placedSymbolArray.length - 1)); + } + for ( + var H = Object.keys(i.horizontal), W = 0, $ = H; + W < $.length; + W += 1 + ) { + var Q = $[W], + tt = i.horizontal[Q]; + if (!z) { + R = Fa.exports(tt.text); + var et = u.layout + .get('text-rotate') + .evaluate(_, {}, S); + z = new Rl(l, r, p, c, h, tt, f, y, m, et); + } + var rt = 1 === tt.positionedLines.length; + if ( + ((F += Hl( + e, + r, + tt, + o, + u, + m, + _, + v, + E, + i.vertical + ? t.WritingMode.horizontal + : t.WritingMode.horizontalOnly, + rt ? H : [Q], + j, + L, + A, + S, + )), + rt) + ) + break; + } + i.vertical && + (O += Hl( + e, + r, + i.vertical, + o, + u, + m, + _, + v, + E, + t.WritingMode.vertical, + ['vertical'], + j, + D, + A, + S, + )); + var nt = z + ? z.boxStartIndex + : e.collisionBoxArray.length, + it = z ? z.boxEndIndex : e.collisionBoxArray.length, + at = B + ? B.boxStartIndex + : e.collisionBoxArray.length, + ot = B ? B.boxEndIndex : e.collisionBoxArray.length, + st = P + ? P.boxStartIndex + : e.collisionBoxArray.length, + ut = P ? P.boxEndIndex : e.collisionBoxArray.length, + lt = C + ? C.boxStartIndex + : e.collisionBoxArray.length, + pt = C ? C.boxEndIndex : e.collisionBoxArray.length, + ct = -1, + ht = function (t, e) { + return t && t.circleDiameter + ? Math.max(t.circleDiameter, e) + : e; + }; + (ct = ht(z, ct)), (ct = ht(B, ct)), (ct = ht(P, ct)); + var ft = (ct = ht(C, ct)) > -1 ? 1 : 0; + ft && (ct *= I / Eu), + e.glyphOffsetArray.length >= op.MAX_GLYPHS && + d( + 'Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907', + ), + void 0 !== _.sortKey && + e.addToSortKeyRanges( + e.symbolInstances.length, + _.sortKey, + ), + e.symbolInstances.emplaceBack( + r.x, + r.y, + j.right >= 0 ? j.right : -1, + j.center >= 0 ? j.center : -1, + j.left >= 0 ? j.left : -1, + j.vertical || -1, + L, + D, + R, + nt, + it, + at, + ot, + st, + ut, + lt, + pt, + p, + F, + O, + V, + T, + ft, + 0, + f, + U, + q, + ct, + ); + })( + e, + h, + u, + n, + i, + a, + f, + e.layers[0], + e.collisionBoxArray, + r.index, + r.sourceLayerIndex, + e.index, + x, + [A, A, A, A], + I, + l, + w, + k, + M, + m, + r, + o, + p, + c, + s, + ); + }; + if ('line' === z) + for ( + var E = 0, V = Tl(r.geometry, 0, 0, lo, lo); + E < V.length; + E += 1 + ) + for ( + var T = V[E], + F = 0, + O = El( + T, + _, + S, + n.vertical || v, + i, + 24, + b, + e.overscaling, + lo, + ); + F < O.length; + F += 1 + ) { + var L = O[F]; + (v && $l(e, v.text, P, L)) || C(T, L); + } + else if ('line-center' === z) + for (var D = 0, j = r.geometry; D < j.length; D += 1) { + var R = j[D]; + if (R.length > 1) { + var U = Cl(R, S, n.vertical || v, i, 24, b); + U && C(R, U); + } + } + else if ('Polygon' === r.type) + for ( + var q = 0, N = Fs(r.geometry, 0); + q < N.length; + q += 1 + ) { + var Z = N[q], + K = Nl(Z, 16); + C(Z[0], new Il(K.x, K.y, 0)); + } + else if ('LineString' === r.type) + for (var G = 0, J = r.geometry; G < J.length; G += 1) { + var X = J[G]; + C(X, new Il(X[0].x, X[0].y, 0)); + } + else if ('Point' === r.type) + for (var Y = 0, H = r.geometry; Y < H.length; Y += 1) + for (var W = 0, $ = H[Y]; W < $.length; W += 1) { + var Q = $[W]; + C([Q], new Il(Q.x, Q.y, 0)); + } + })(e.bucket, n, f, F, e.imageMap, i, s, u, g, O, e.canonical); + }, + y = 0, + m = e.bucket.features; + y < m.length; + y += 1 + ) + f(); + e.showCollisionBoxes && e.bucket.generateCollisionDebugBuffers(); + }), + (t.perspective = function (t, e, r, n, i) { + var a, + o = 1 / Math.tan(e / 2); + return ( + (t[0] = o / r), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = o), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[11] = -1), + (t[12] = 0), + (t[13] = 0), + (t[15] = 0), + null != i && i !== 1 / 0 + ? ((t[10] = (i + n) * (a = 1 / (n - i))), (t[14] = 2 * i * n * a)) + : ((t[10] = -1), (t[14] = -2 * n)), + t + ); + }), + (t.pick = function (t, e) { + for (var r = {}, n = 0; n < e.length; n++) { + var i = e[n]; + i in t && (r[i] = t[i]); + } + return r; + }), + (t.plugin = hi), + (t.pointGeometry = I), + (t.polygonIntersectsPolygon = vo), + (t.potpack = il), + (t.refProperties = [ + 'type', + 'source', + 'source-layer', + 'minzoom', + 'maxzoom', + 'filter', + 'layout', + ]), + (t.register = qn), + (t.registerForPluginStateChange = function (t) { + return ( + t({ pluginStatus: ai, pluginURL: oi }), + li.on('pluginStateChange', t), + t + ); + }), + (t.renderColorRamp = Qo), + (t.rotateX = function (t, e, r) { + var n = Math.sin(r), + i = Math.cos(r), + a = e[4], + o = e[5], + s = e[6], + u = e[7], + l = e[8], + p = e[9], + c = e[10], + h = e[11]; + return ( + e !== t && + ((t[0] = e[0]), + (t[1] = e[1]), + (t[2] = e[2]), + (t[3] = e[3]), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15])), + (t[4] = a * i + l * n), + (t[5] = o * i + p * n), + (t[6] = s * i + c * n), + (t[7] = u * i + h * n), + (t[8] = l * i - a * n), + (t[9] = p * i - o * n), + (t[10] = c * i - s * n), + (t[11] = h * i - u * n), + t + ); + }), + (t.rotateZ = function (t, e, r) { + var n = Math.sin(r), + i = Math.cos(r), + a = e[0], + o = e[1], + s = e[2], + u = e[3], + l = e[4], + p = e[5], + c = e[6], + h = e[7]; + return ( + e !== t && + ((t[8] = e[8]), + (t[9] = e[9]), + (t[10] = e[10]), + (t[11] = e[11]), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15])), + (t[0] = a * i + l * n), + (t[1] = o * i + p * n), + (t[2] = s * i + c * n), + (t[3] = u * i + h * n), + (t[4] = l * i - a * n), + (t[5] = p * i - o * n), + (t[6] = c * i - s * n), + (t[7] = h * i - u * n), + t + ); + }), + (t.scale = function (t, e, r) { + var n = r[0], + i = r[1], + a = r[2]; + return ( + (t[0] = e[0] * n), + (t[1] = e[1] * n), + (t[2] = e[2] * n), + (t[3] = e[3] * n), + (t[4] = e[4] * i), + (t[5] = e[5] * i), + (t[6] = e[6] * i), + (t[7] = e[7] * i), + (t[8] = e[8] * a), + (t[9] = e[9] * a), + (t[10] = e[10] * a), + (t[11] = e[11] * a), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15]), + t + ); + }), + (t.scale$1 = function (t, e, r) { + return (t[0] = e[0] * r), (t[1] = e[1] * r), (t[2] = e[2] * r), t; + }), + (t.setCacheLimits = function (t, e) { + (J = t), (X = e); + }), + (t.setRTLTextPlugin = function (t, e, r) { + if ((void 0 === r && (r = !1), ai === ei || ai === ri || ai === ni)) + throw new Error('setRTLTextPlugin cannot be called multiple times.'); + (oi = S.resolveURL(t)), (ai = ei), (ii = e), ui(), r || ci(); + }), + (t.spec = gt), + (t.sphericalToCartesian = function (t) { + var e = t[0], + r = t[1], + n = t[2]; + return ( + (r += 90), + (r *= Math.PI / 180), + (n *= Math.PI / 180), + { + x: e * Math.cos(r) * Math.sin(n), + y: e * Math.sin(r) * Math.sin(n), + z: e * Math.cos(n), + } + ); + }), + (t.sqrLen = function (t) { + var e = t[0], + r = t[1]; + return e * e + r * r; + }), + (t.sub = function (t, e, r) { + return ( + (t[0] = e[0] - r[0]), (t[1] = e[1] - r[1]), (t[2] = e[2] - r[2]), t + ); + }), + (t.toEvaluationFeature = fo), + (t.transformMat3 = function (t, e, r) { + var n = e[0], + i = e[1], + a = e[2]; + return ( + (t[0] = n * r[0] + i * r[3] + a * r[6]), + (t[1] = n * r[1] + i * r[4] + a * r[7]), + (t[2] = n * r[2] + i * r[5] + a * r[8]), + t + ); + }), + (t.transformMat4 = qo), + (t.transformMat4$1 = function (t, e, r) { + var n = e[0], + i = e[1]; + return ( + (t[0] = r[0] * n + r[4] * i + r[12]), + (t[1] = r[1] * n + r[5] * i + r[13]), + t + ); + }), + (t.translate = function (t, e, r) { + var n, + i, + a, + o, + s, + u, + l, + p, + c, + h, + f, + y, + d = r[0], + m = r[1], + v = r[2]; + return ( + e === t + ? ((t[12] = e[0] * d + e[4] * m + e[8] * v + e[12]), + (t[13] = e[1] * d + e[5] * m + e[9] * v + e[13]), + (t[14] = e[2] * d + e[6] * m + e[10] * v + e[14]), + (t[15] = e[3] * d + e[7] * m + e[11] * v + e[15])) + : ((i = e[1]), + (a = e[2]), + (o = e[3]), + (s = e[4]), + (u = e[5]), + (l = e[6]), + (p = e[7]), + (c = e[8]), + (h = e[9]), + (f = e[10]), + (y = e[11]), + (t[0] = n = e[0]), + (t[1] = i), + (t[2] = a), + (t[3] = o), + (t[4] = s), + (t[5] = u), + (t[6] = l), + (t[7] = p), + (t[8] = c), + (t[9] = h), + (t[10] = f), + (t[11] = y), + (t[12] = n * d + s * m + c * v + e[12]), + (t[13] = i * d + u * m + h * v + e[13]), + (t[14] = a * d + l * m + f * v + e[14]), + (t[15] = o * d + p * m + y * v + e[15])), + t + ); + }), + (t.triggerPluginCompletionEvent = si), + (t.unicodeBlockLookup = Xn), + (t.uniqueId = function () { + return u++; + }), + (t.validateCustomStyleLayer = function (t) { + var e = [], + r = t.id; + return ( + void 0 === r && + e.push({ + message: 'layers.' + r + ': missing required property "id"', + }), + void 0 === t.render && + e.push({ + message: 'layers.' + r + ': missing required method "render"', + }), + t.renderingMode && + '2d' !== t.renderingMode && + '3d' !== t.renderingMode && + e.push({ + message: + 'layers.' + + r + + ': property "renderingMode" must be either "2d" or "3d"', + }), + e + ); + }), + (t.validateLight = On), + (t.validateStyle = Fn), + (t.values = function (t) { + var e = []; + for (var r in t) e.push(t[r]); + return e; + }), + (t.vectorTile = Gs), + (t.warnOnce = d), + (t.wrap = o); + }); + + define(['./shared'], function (e) { + 'use strict'; + function t(e) { + var r = typeof e; + if ('number' === r || 'boolean' === r || 'string' === r || null == e) + return JSON.stringify(e); + if (Array.isArray(e)) { + for (var i = '[', o = 0, n = e; o < n.length; o += 1) + i += t(n[o]) + ','; + return i + ']'; + } + for (var s = Object.keys(e).sort(), a = '{', l = 0; l < s.length; l++) + a += JSON.stringify(s[l]) + ':' + t(e[s[l]]) + ','; + return a + '}'; + } + function r(r) { + for (var i = '', o = 0, n = e.refProperties; o < n.length; o += 1) + i += '/' + t(r[n[o]]); + return i; + } + var i = function (e) { + (this.keyCache = {}), e && this.replace(e); + }; + (i.prototype.replace = function (e) { + (this._layerConfigs = {}), (this._layers = {}), this.update(e, []); + }), + (i.prototype.update = function (t, i) { + for (var o = this, n = 0, s = t; n < s.length; n += 1) { + var a = s[n]; + this._layerConfigs[a.id] = a; + var l = (this._layers[a.id] = e.createStyleLayer(a)); + (l._featureFilter = e.createFilter(l.filter)), + this.keyCache[a.id] && delete this.keyCache[a.id]; + } + for (var u = 0, h = i; u < h.length; u += 1) { + var c = h[u]; + delete this.keyCache[c], + delete this._layerConfigs[c], + delete this._layers[c]; + } + this.familiesBySource = {}; + for ( + var p = (function (e, t) { + for (var i = {}, o = 0; o < e.length; o++) { + var n = (t && t[e[o].id]) || r(e[o]); + t && (t[e[o].id] = n); + var s = i[n]; + s || (s = i[n] = []), s.push(e[o]); + } + var a = []; + for (var l in i) a.push(i[l]); + return a; + })(e.values(this._layerConfigs), this.keyCache), + f = 0, + g = p; + f < g.length; + f += 1 + ) { + var d = g[f].map(function (e) { + return o._layers[e.id]; + }), + v = d[0]; + if ('none' !== v.visibility) { + var m = v.source || '', + y = this.familiesBySource[m]; + y || (y = this.familiesBySource[m] = {}); + var x = v.sourceLayer || '_geojsonTileLayer', + w = y[x]; + w || (w = y[x] = []), w.push(d); + } + } + }); + var o = function (t) { + var r = {}, + i = []; + for (var o in t) { + var n = t[o], + s = (r[o] = {}); + for (var a in n) { + var l = n[+a]; + if (l && 0 !== l.bitmap.width && 0 !== l.bitmap.height) { + var u = { + x: 0, + y: 0, + w: l.bitmap.width + 2, + h: l.bitmap.height + 2, + }; + i.push(u), (s[a] = { rect: u, metrics: l.metrics }); + } + } + } + var h = e.potpack(i), + c = new e.AlphaImage({ width: h.w || 1, height: h.h || 1 }); + for (var p in t) { + var f = t[p]; + for (var g in f) { + var d = f[+g]; + if (d && 0 !== d.bitmap.width && 0 !== d.bitmap.height) { + var v = r[p][g].rect; + e.AlphaImage.copy( + d.bitmap, + c, + { x: 0, y: 0 }, + { x: v.x + 1, y: v.y + 1 }, + d.bitmap, + ); + } + } + } + (this.image = c), (this.positions = r); + }; + e.register('GlyphAtlas', o); + var n = function (t) { + (this.tileID = new e.OverscaledTileID( + t.tileID.overscaledZ, + t.tileID.wrap, + t.tileID.canonical.z, + t.tileID.canonical.x, + t.tileID.canonical.y, + )), + (this.uid = t.uid), + (this.zoom = t.zoom), + (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); + }; + function s(t, r, i) { + for ( + var o = new e.EvaluationParameters(r), n = 0, s = t; + n < s.length; + n += 1 + ) + s[n].recalculate(o, i); + } + function a(t, r) { + var i = e.getArrayBuffer(t.request, function (t, i, o, n) { + t + ? r(t) + : i && + r(null, { + vectorTile: new e.vectorTile.VectorTile(new e.pbf(i)), + rawData: i, + cacheControl: o, + expires: n, + }); + }); + return function () { + i.cancel(), r(); + }; + } + n.prototype.parse = function (t, r, i, n, a) { + var l = this; + (this.status = 'parsing'), + (this.data = t), + (this.collisionBoxArray = new e.CollisionBoxArray()); + var u = new e.DictionaryCoder(Object.keys(t.layers).sort()), + h = new e.FeatureIndex(this.tileID, this.promoteId); + h.bucketLayerIDs = []; + var c, + p, + f, + g, + d = {}, + v = { + featureIndex: h, + iconDependencies: {}, + patternDependencies: {}, + glyphDependencies: {}, + availableImages: i, + }, + m = r.familiesBySource[this.source]; + for (var y in m) { + var x = t.layers[y]; + if (x) { + 1 === x.version && + e.warnOnce( + 'Vector tile source "' + + this.source + + '" layer "' + + y + + '" does not use vector tile spec v2 and therefore may have some rendering errors.', + ); + for (var w = u.encode(y), S = [], M = 0; M < x.length; M++) { + var I = x.feature(M), + b = h.getId(I, y); + S.push({ feature: I, id: b, index: M, sourceLayerIndex: w }); + } + for (var k = 0, P = m[y]; k < P.length; k += 1) { + var T = P[k], + C = T[0]; + C.source !== this.source && + e.warnOnce( + 'layer.source = ' + + C.source + + ' does not equal this.source = ' + + this.source, + ), + (C.minzoom && this.zoom < Math.floor(C.minzoom)) || + (C.maxzoom && this.zoom >= C.maxzoom) || + ('none' !== C.visibility && + (s(T, this.zoom, i), + (d[C.id] = C.createBucket({ + index: h.bucketLayerIDs.length, + layers: T, + zoom: this.zoom, + pixelRatio: this.pixelRatio, + overscaling: this.overscaling, + collisionBoxArray: this.collisionBoxArray, + sourceLayerIndex: w, + sourceID: this.source, + })).populate(S, v, this.tileID.canonical), + h.bucketLayerIDs.push( + T.map(function (e) { + return e.id; + }), + ))); + } + } + } + var _ = e.mapObject(v.glyphDependencies, function (e) { + return Object.keys(e).map(Number); + }); + Object.keys(_).length + ? n.send('getGlyphs', { uid: this.uid, stacks: _ }, function (e, t) { + c || ((c = e), (p = t), z.call(l)); + }) + : (p = {}); + var D = Object.keys(v.iconDependencies); + D.length + ? n.send( + 'getImages', + { + icons: D, + source: this.source, + tileID: this.tileID, + type: 'icons', + }, + function (e, t) { + c || ((c = e), (f = t), z.call(l)); + }, + ) + : (f = {}); + var L = Object.keys(v.patternDependencies); + function z() { + if (c) return a(c); + if (p && f && g) { + var t = new o(p), + r = new e.ImageAtlas(f, g); + for (var n in d) { + var l = d[n]; + l instanceof e.SymbolBucket + ? (s(l.layers, this.zoom, i), + e.performSymbolLayout({ + bucket: l, + glyphMap: p, + glyphPositions: t.positions, + imageMap: f, + imagePositions: r.iconPositions, + showCollisionBoxes: this.showCollisionBoxes, + canonical: this.tileID.canonical, + })) + : l.hasPattern && + (l instanceof e.LineBucket || + l instanceof e.FillBucket || + l instanceof e.FillExtrusionBucket) && + (s(l.layers, this.zoom, i), + l.addFeatures(v, this.tileID.canonical, r.patternPositions)); + } + (this.status = 'done'), + a(null, { + buckets: e.values(d).filter(function (e) { + return !e.isEmpty(); + }), + featureIndex: h, + collisionBoxArray: this.collisionBoxArray, + glyphAtlasImage: t.image, + imageAtlas: r, + glyphMap: this.returnDependencies ? p : null, + iconMap: this.returnDependencies ? f : null, + glyphPositions: this.returnDependencies ? t.positions : null, + }); + } + } + L.length + ? n.send( + 'getImages', + { + icons: L, + source: this.source, + tileID: this.tileID, + type: 'patterns', + }, + function (e, t) { + c || ((c = e), (g = t), z.call(l)); + }, + ) + : (g = {}), + z.call(this); + }; + var l = function (e, t, r, i) { + (this.actor = e), + (this.layerIndex = t), + (this.availableImages = r), + (this.loadVectorData = i || a), + (this.loading = {}), + (this.loaded = {}); + }; + (l.prototype.loadTile = function (t, r) { + var i = this, + o = t.uid; + this.loading || (this.loading = {}); + var s = + !!(t && t.request && t.request.collectResourceTiming) && + new e.RequestPerformance(t.request), + a = (this.loading[o] = new n(t)); + a.abort = this.loadVectorData(t, function (t, n) { + if ((delete i.loading[o], t || !n)) + return (a.status = 'done'), (i.loaded[o] = a), r(t); + var l = n.rawData, + u = {}; + n.expires && (u.expires = n.expires), + n.cacheControl && (u.cacheControl = n.cacheControl); + var h = {}; + if (s) { + var c = s.finish(); + c && (h.resourceTiming = JSON.parse(JSON.stringify(c))); + } + (a.vectorTile = n.vectorTile), + a.parse( + n.vectorTile, + i.layerIndex, + i.availableImages, + i.actor, + function (t, i) { + if (t || !i) return r(t); + r(null, e.extend({ rawTileData: l.slice(0) }, i, u, h)); + }, + ), + (i.loaded = i.loaded || {}), + (i.loaded[o] = a); + }); + }), + (l.prototype.reloadTile = function (e, t) { + var r = this, + i = this.loaded, + o = e.uid, + n = this; + if (i && i[o]) { + var s = i[o]; + s.showCollisionBoxes = e.showCollisionBoxes; + var a = function (e, i) { + var o = s.reloadCallback; + o && + (delete s.reloadCallback, + s.parse( + s.vectorTile, + n.layerIndex, + r.availableImages, + n.actor, + o, + )), + t(e, i); + }; + 'parsing' === s.status + ? (s.reloadCallback = a) + : 'done' === s.status && + (s.vectorTile + ? s.parse( + s.vectorTile, + this.layerIndex, + this.availableImages, + this.actor, + a, + ) + : a()); + } + }), + (l.prototype.abortTile = function (e, t) { + var r = this.loading, + i = e.uid; + r && r[i] && r[i].abort && (r[i].abort(), delete r[i]), t(); + }), + (l.prototype.removeTile = function (e, t) { + var r = this.loaded, + i = e.uid; + r && r[i] && delete r[i], t(); + }); + var u = function () { + this.loaded = {}; + }; + (u.prototype.loadTile = function (t, r) { + var i = t.uid, + o = t.encoding, + n = t.rawImageData, + s = e.isImageBitmap(n) ? this.getImageData(n) : n, + a = new e.DEMData(i, s, o); + (this.loaded = this.loaded || {}), (this.loaded[i] = a), r(null, a); + }), + (u.prototype.getImageData = function (t) { + (this.offscreenCanvas && this.offscreenCanvasContext) || + ((this.offscreenCanvas = new OffscreenCanvas(t.width, t.height)), + (this.offscreenCanvasContext = + this.offscreenCanvas.getContext('2d'))), + (this.offscreenCanvas.width = t.width), + (this.offscreenCanvas.height = t.height), + this.offscreenCanvasContext.drawImage(t, 0, 0, t.width, t.height); + var r = this.offscreenCanvasContext.getImageData( + -1, + -1, + t.width + 2, + t.height + 2, + ); + return ( + this.offscreenCanvasContext.clearRect( + 0, + 0, + this.offscreenCanvas.width, + this.offscreenCanvas.height, + ), + new e.RGBAImage({ width: r.width, height: r.height }, r.data) + ); + }), + (u.prototype.removeTile = function (e) { + var t = this.loaded, + r = e.uid; + t && t[r] && delete t[r]; + }); + var h = function e(t, r) { + var i, + o = t && t.type; + if ('FeatureCollection' === o) + for (i = 0; i < t.features.length; i++) e(t.features[i], r); + else if ('GeometryCollection' === o) + for (i = 0; i < t.geometries.length; i++) e(t.geometries[i], r); + else if ('Feature' === o) e(t.geometry, r); + else if ('Polygon' === o) c(t.coordinates, r); + else if ('MultiPolygon' === o) + for (i = 0; i < t.coordinates.length; i++) c(t.coordinates[i], r); + return t; + }; + function c(e, t) { + if (0 !== e.length) { + p(e[0], t); + for (var r = 1; r < e.length; r++) p(e[r], !t); + } + } + function p(e, t) { + for (var r = 0, i = 0, o = 0, n = e.length, s = n - 1; o < n; s = o++) { + var a = (e[o][0] - e[s][0]) * (e[s][1] + e[o][1]), + l = r + a; + (i += Math.abs(r) >= Math.abs(a) ? r - l + a : a - l + r), (r = l); + } + r + i >= 0 != !!t && e.reverse(); + } + var f = e.vectorTile.VectorTileFeature.prototype.toGeoJSON, + g = function (t) { + (this._feature = t), + (this.extent = e.EXTENT), + (this.type = t.type), + (this.properties = t.tags), + 'id' in t && !isNaN(t.id) && (this.id = parseInt(t.id, 10)); + }; + (g.prototype.loadGeometry = function () { + if (1 === this._feature.type) { + for ( + var t = [], r = 0, i = this._feature.geometry; + r < i.length; + r += 1 + ) { + var o = i[r]; + t.push([new e.pointGeometry(o[0], o[1])]); + } + return t; + } + for ( + var n = [], s = 0, a = this._feature.geometry; + s < a.length; + s += 1 + ) { + for (var l = [], u = 0, h = a[s]; u < h.length; u += 1) { + var c = h[u]; + l.push(new e.pointGeometry(c[0], c[1])); + } + n.push(l); + } + return n; + }), + (g.prototype.toGeoJSON = function (e, t, r) { + return f.call(this, e, t, r); + }); + var d = function (t) { + (this.layers = { _geojsonTileLayer: this }), + (this.name = '_geojsonTileLayer'), + (this.extent = e.EXTENT), + (this.length = t.length), + (this._features = t); + }; + d.prototype.feature = function (e) { + return new g(this._features[e]); + }; + var v = { exports: {} }, + m = e.pointGeometry, + y = e.vectorTile.VectorTileFeature, + x = w; + function w(e, t) { + (this.options = t || {}), (this.features = e), (this.length = e.length); + } + function S(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); + } + (w.prototype.feature = function (e) { + return new S(this.features[e], this.options.extent); + }), + (S.prototype.loadGeometry = function () { + var e = this.rawGeometry; + this.geometry = []; + for (var t = 0; t < e.length; t++) { + for (var r = e[t], i = [], o = 0; o < r.length; o++) + i.push(new m(r[o][0], r[o][1])); + this.geometry.push(i); + } + return this.geometry; + }), + (S.prototype.bbox = function () { + this.geometry || this.loadGeometry(); + for ( + var e = this.geometry, + t = 1 / 0, + r = -1 / 0, + i = 1 / 0, + o = -1 / 0, + n = 0; + n < e.length; + n++ + ) + for (var s = e[n], a = 0; a < s.length; a++) { + var l = s[a]; + (t = Math.min(t, l.x)), + (r = Math.max(r, l.x)), + (i = Math.min(i, l.y)), + (o = Math.max(o, l.y)); + } + return [t, i, r, o]; + }), + (S.prototype.toGeoJSON = y.prototype.toGeoJSON); + var M = e.pbf, + I = x; + function b(e) { + var t = new M(); + return ( + (function (e, t) { + for (var r in e.layers) t.writeMessage(3, k, e.layers[r]); + })(e, t), + t.finish() + ); + } + function k(e, t) { + var r; + t.writeVarintField(15, e.version || 1), + t.writeStringField(1, e.name || ''), + t.writeVarintField(5, e.extent || 4096); + var i = { keys: [], values: [], keycache: {}, valuecache: {} }; + for (r = 0; r < e.length; r++) + (i.feature = e.feature(r)), t.writeMessage(2, P, i); + var o = i.keys; + for (r = 0; r < o.length; r++) t.writeStringField(3, o[r]); + var n = i.values; + for (r = 0; r < n.length; r++) t.writeMessage(4, L, n[r]); + } + function P(e, t) { + var r = e.feature; + void 0 !== r.id && t.writeVarintField(1, r.id), + t.writeMessage(2, T, e), + t.writeVarintField(3, r.type), + t.writeMessage(4, D, r); + } + function T(e, t) { + var r = e.feature, + i = e.keys, + o = e.values, + n = e.keycache, + s = e.valuecache; + for (var a in r.properties) { + var l = r.properties[a], + u = n[a]; + if (null !== l) { + void 0 === u && (i.push(a), (n[a] = u = i.length - 1)), + t.writeVarint(u); + var h = typeof l; + 'string' !== h && + 'boolean' !== h && + 'number' !== h && + (l = JSON.stringify(l)); + var c = h + ':' + l, + p = s[c]; + void 0 === p && (o.push(l), (s[c] = p = o.length - 1)), + t.writeVarint(p); + } + } + } + function C(e, t) { + return (t << 3) + (7 & e); + } + function _(e) { + return (e << 1) ^ (e >> 31); + } + function D(e, t) { + for ( + var r = e.loadGeometry(), i = e.type, o = 0, n = 0, s = r.length, a = 0; + a < s; + a++ + ) { + var l = r[a], + u = 1; + 1 === i && (u = l.length), t.writeVarint(C(1, u)); + for (var h = 3 === i ? l.length - 1 : l.length, c = 0; c < h; c++) { + 1 === c && 1 !== i && t.writeVarint(C(2, h - 1)); + var p = l[c].x - o, + f = l[c].y - n; + t.writeVarint(_(p)), t.writeVarint(_(f)), (o += p), (n += f); + } + 3 === i && t.writeVarint(C(7, 1)); + } + } + function L(e, t) { + var r = typeof e; + 'string' === r + ? t.writeStringField(1, e) + : 'boolean' === r + ? t.writeBooleanField(7, e) + : 'number' === r && + (e % 1 != 0 + ? t.writeDoubleField(3, e) + : e < 0 + ? t.writeSVarintField(6, e) + : t.writeVarintField(5, e)); + } + function z(e, t, r, i, o, n) { + if (!(o - i <= r)) { + var s = (i + o) >> 1; + O(e, t, s, i, o, n % 2), + z(e, t, r, i, s - 1, n + 1), + z(e, t, r, s + 1, o, n + 1); + } + } + function O(e, t, r, i, o, n) { + for (; o > i; ) { + if (o - i > 600) { + var s = o - i + 1, + a = r - i + 1, + l = Math.log(s), + u = 0.5 * Math.exp((2 * l) / 3), + h = + 0.5 * Math.sqrt((l * u * (s - u)) / s) * (a - s / 2 < 0 ? -1 : 1); + O( + e, + t, + r, + Math.max(i, Math.floor(r - (a * u) / s + h)), + Math.min(o, Math.floor(r + ((s - a) * u) / s + h)), + n, + ); + } + var c = t[2 * r + n], + p = i, + f = o; + for (E(e, t, i, r), t[2 * o + n] > c && E(e, t, i, o); p < f; ) { + for (E(e, t, p, f), p++, f--; t[2 * p + n] < c; ) p++; + for (; t[2 * f + n] > c; ) f--; + } + t[2 * i + n] === c ? E(e, t, i, f) : E(e, t, ++f, o), + f <= r && (i = f + 1), + r <= f && (o = f - 1); + } + } + function E(e, t, r, i) { + F(e, r, i), F(t, 2 * r, 2 * i), F(t, 2 * r + 1, 2 * i + 1); + } + function F(e, t, r) { + var i = e[t]; + (e[t] = e[r]), (e[r] = i); + } + function N(e, t, r, i) { + var o = e - r, + n = t - i; + return o * o + n * n; + } + (v.exports = b), + (v.exports.fromVectorTileJs = b), + (v.exports.fromGeojsonVt = function (e, t) { + t = t || {}; + var r = {}; + for (var i in e) + (r[i] = new I(e[i].features, t)), + (r[i].name = i), + (r[i].version = t.version), + (r[i].extent = t.extent); + return b({ layers: r }); + }), + (v.exports.GeoJSONWrapper = I); + var A = function (e) { + return e[0]; + }, + B = function (e) { + return e[1]; + }, + J = function (e, t, r, i, o) { + void 0 === t && (t = A), + void 0 === r && (r = B), + void 0 === i && (i = 64), + void 0 === o && (o = Float64Array), + (this.nodeSize = i), + (this.points = e); + for ( + var n = e.length < 65536 ? Uint16Array : Uint32Array, + s = (this.ids = new n(e.length)), + a = (this.coords = new o(2 * e.length)), + l = 0; + l < e.length; + l++ + ) + (s[l] = l), (a[2 * l] = t(e[l])), (a[2 * l + 1] = r(e[l])); + z(s, a, i, 0, s.length - 1, 0); + }; + (J.prototype.range = function (e, t, r, i) { + return (function (e, t, r, i, o, n, s) { + for (var a, l, u = [0, e.length - 1, 0], h = []; u.length; ) { + var c = u.pop(), + p = u.pop(), + f = u.pop(); + if (p - f <= s) + for (var g = f; g <= p; g++) + (l = t[2 * g + 1]), + (a = t[2 * g]) >= r && + a <= o && + l >= i && + l <= n && + h.push(e[g]); + else { + var d = Math.floor((f + p) / 2); + (l = t[2 * d + 1]), + (a = t[2 * d]) >= r && a <= o && l >= i && l <= n && h.push(e[d]); + var v = (c + 1) % 2; + (0 === c ? r <= a : i <= l) && + (u.push(f), u.push(d - 1), u.push(v)), + (0 === c ? o >= a : n >= l) && + (u.push(d + 1), u.push(p), u.push(v)); + } + } + return h; + })(this.ids, this.coords, e, t, r, i, this.nodeSize); + }), + (J.prototype.within = function (e, t, r) { + return (function (e, t, r, i, o, n) { + for (var s = [0, e.length - 1, 0], a = [], l = o * o; s.length; ) { + var u = s.pop(), + h = s.pop(), + c = s.pop(); + if (h - c <= n) + for (var p = c; p <= h; p++) + N(t[2 * p], t[2 * p + 1], r, i) <= l && a.push(e[p]); + else { + var f = Math.floor((c + h) / 2), + g = t[2 * f], + d = t[2 * f + 1]; + N(g, d, r, i) <= l && a.push(e[f]); + var v = (u + 1) % 2; + (0 === u ? r - o <= g : i - o <= d) && + (s.push(c), s.push(f - 1), s.push(v)), + (0 === u ? r + o >= g : i + o >= d) && + (s.push(f + 1), s.push(h), s.push(v)); + } + } + return a; + })(this.ids, this.coords, e, t, r, this.nodeSize); + }); + var Z, + G = { + minZoom: 0, + maxZoom: 16, + minPoints: 2, + radius: 40, + extent: 512, + nodeSize: 64, + log: !1, + generateId: !1, + reduce: null, + map: function (e) { + return e; + }, + }, + Y = + Math.fround || + ((Z = new Float32Array(1)), + function (e) { + return (Z[0] = +e), Z[0]; + }), + j = function (e) { + (this.options = H(Object.create(G), e)), + (this.trees = new Array(this.options.maxZoom + 1)); + }; + function V(e, t, r, i, o) { + return { + x: Y(e), + y: Y(t), + zoom: 1 / 0, + id: r, + parentId: -1, + numPoints: i, + properties: o, + }; + } + function X(e, t) { + var r = e.geometry.coordinates, + i = r[1]; + return { x: Y(q(r[0])), y: Y(U(i)), zoom: 1 / 0, index: t, parentId: -1 }; + } + function R(e) { + return { + type: 'Feature', + id: e.id, + properties: W(e), + geometry: { + type: 'Point', + coordinates: [ + ((i = e.x), 360 * (i - 0.5)), + ((t = e.y), + (r = ((180 - 360 * t) * Math.PI) / 180), + (360 * Math.atan(Math.exp(r))) / Math.PI - 90), + ], + }, + }; + var t, r, i; + } + function W(e) { + var t = e.numPoints, + r = + t >= 1e4 + ? Math.round(t / 1e3) + 'k' + : t >= 1e3 + ? Math.round(t / 100) / 10 + 'k' + : t; + return H(H({}, e.properties), { + cluster: !0, + cluster_id: e.id, + point_count: t, + point_count_abbreviated: r, + }); + } + function q(e) { + return e / 360 + 0.5; + } + function U(e) { + var t = Math.sin((e * Math.PI) / 180), + r = 0.5 - (0.25 * Math.log((1 + t) / (1 - t))) / Math.PI; + return r < 0 ? 0 : r > 1 ? 1 : r; + } + function H(e, t) { + for (var r in t) e[r] = t[r]; + return e; + } + function K(e) { + return e.x; + } + function Q(e) { + return e.y; + } + function $(e, t, r, i) { + for ( + var o, + n = i, + s = (r - t) >> 1, + a = r - t, + l = e[t], + u = e[t + 1], + h = e[r], + c = e[r + 1], + p = t + 3; + p < r; + p += 3 + ) { + var f = ee(e[p], e[p + 1], l, u, h, c); + if (f > n) (o = p), (n = f); + else if (f === n) { + var g = Math.abs(p - s); + g < a && ((o = p), (a = g)); + } + } + n > i && + (o - t > 3 && $(e, t, o, i), + (e[o + 2] = n), + r - o > 3 && $(e, o, r, i)); + } + function ee(e, t, r, i, o, n) { + var s = o - r, + a = n - i; + if (0 !== s || 0 !== a) { + var l = ((e - r) * s + (t - i) * a) / (s * s + a * a); + l > 1 ? ((r = o), (i = n)) : l > 0 && ((r += s * l), (i += a * l)); + } + return (s = e - r) * s + (a = t - i) * a; + } + function te(e, t, r, i) { + var o = { + id: void 0 === e ? null : e, + type: t, + geometry: r, + tags: i, + minX: 1 / 0, + minY: 1 / 0, + maxX: -1 / 0, + maxY: -1 / 0, + }; + return ( + (function (e) { + var t = e.geometry, + r = e.type; + if ('Point' === r || 'MultiPoint' === r || 'LineString' === r) + re(e, t); + else if ('Polygon' === r || 'MultiLineString' === r) + for (var i = 0; i < t.length; i++) re(e, t[i]); + else if ('MultiPolygon' === r) + for (i = 0; i < t.length; i++) + for (var o = 0; o < t[i].length; o++) re(e, t[i][o]); + })(o), + o + ); + } + function re(e, t) { + for (var r = 0; r < t.length; r += 3) + (e.minX = Math.min(e.minX, t[r])), + (e.minY = Math.min(e.minY, t[r + 1])), + (e.maxX = Math.max(e.maxX, t[r])), + (e.maxY = Math.max(e.maxY, t[r + 1])); + } + function ie(e, t, r, i) { + if (t.geometry) { + var o = t.geometry.coordinates, + n = t.geometry.type, + s = Math.pow(r.tolerance / ((1 << r.maxZoom) * r.extent), 2), + a = [], + l = t.id; + if ( + (r.promoteId + ? (l = t.properties[r.promoteId]) + : r.generateId && (l = i || 0), + 'Point' === n) + ) + oe(o, a); + else if ('MultiPoint' === n) + for (var u = 0; u < o.length; u++) oe(o[u], a); + else if ('LineString' === n) ne(o, a, s, !1); + else if ('MultiLineString' === n) { + if (r.lineMetrics) { + for (u = 0; u < o.length; u++) + ne(o[u], (a = []), s, !1), + e.push(te(l, 'LineString', a, t.properties)); + return; + } + se(o, a, s, !1); + } else if ('Polygon' === n) se(o, a, s, !0); + else { + if ('MultiPolygon' !== n) { + if ('GeometryCollection' === n) { + for (u = 0; u < t.geometry.geometries.length; u++) + ie( + e, + { + id: l, + geometry: t.geometry.geometries[u], + properties: t.properties, + }, + r, + i, + ); + return; + } + throw new Error('Input data is not a valid GeoJSON object.'); + } + for (u = 0; u < o.length; u++) { + var h = []; + se(o[u], h, s, !0), a.push(h); + } + } + e.push(te(l, n, a, t.properties)); + } + } + function oe(e, t) { + t.push(ae(e[0])), t.push(le(e[1])), t.push(0); + } + function ne(e, t, r, i) { + for (var o, n, s = 0, a = 0; a < e.length; a++) { + var l = ae(e[a][0]), + u = le(e[a][1]); + t.push(l), + t.push(u), + t.push(0), + a > 0 && + (s += i + ? (o * u - l * n) / 2 + : Math.sqrt(Math.pow(l - o, 2) + Math.pow(u - n, 2))), + (o = l), + (n = u); + } + var h = t.length - 3; + (t[2] = 1), + $(t, 0, h, r), + (t[h + 2] = 1), + (t.size = Math.abs(s)), + (t.start = 0), + (t.end = t.size); + } + function se(e, t, r, i) { + for (var o = 0; o < e.length; o++) { + var n = []; + ne(e[o], n, r, i), t.push(n); + } + } + function ae(e) { + return e / 360 + 0.5; + } + function le(e) { + var t = Math.sin((e * Math.PI) / 180), + r = 0.5 - (0.25 * Math.log((1 + t) / (1 - t))) / Math.PI; + return r < 0 ? 0 : r > 1 ? 1 : r; + } + function ue(e, t, r, i, o, n, s, a) { + if (((i /= t), n >= (r /= t) && s < i)) return e; + if (s < r || n >= i) return null; + for (var l = [], u = 0; u < e.length; u++) { + var h = e[u], + c = h.geometry, + p = h.type, + f = 0 === o ? h.minX : h.minY, + g = 0 === o ? h.maxX : h.maxY; + if (f >= r && g < i) l.push(h); + else if (!(g < r || f >= i)) { + var d = []; + if ('Point' === p || 'MultiPoint' === p) he(c, d, r, i, o); + else if ('LineString' === p) ce(c, d, r, i, o, !1, a.lineMetrics); + else if ('MultiLineString' === p) fe(c, d, r, i, o, !1); + else if ('Polygon' === p) fe(c, d, r, i, o, !0); + else if ('MultiPolygon' === p) + for (var v = 0; v < c.length; v++) { + var m = []; + fe(c[v], m, r, i, o, !0), m.length && d.push(m); + } + if (d.length) { + if (a.lineMetrics && 'LineString' === p) { + for (v = 0; v < d.length; v++) l.push(te(h.id, p, d[v], h.tags)); + continue; + } + ('LineString' !== p && 'MultiLineString' !== p) || + (1 === d.length + ? ((p = 'LineString'), (d = d[0])) + : (p = 'MultiLineString')), + ('Point' !== p && 'MultiPoint' !== p) || + (p = 3 === d.length ? 'Point' : 'MultiPoint'), + l.push(te(h.id, p, d, h.tags)); + } + } + } + return l.length ? l : null; + } + function he(e, t, r, i, o) { + for (var n = 0; n < e.length; n += 3) { + var s = e[n + o]; + s >= r && s <= i && (t.push(e[n]), t.push(e[n + 1]), t.push(e[n + 2])); + } + } + function ce(e, t, r, i, o, n, s) { + for ( + var a, l, u = pe(e), h = 0 === o ? de : ve, c = e.start, p = 0; + p < e.length - 3; + p += 3 + ) { + var f = e[p], + g = e[p + 1], + d = e[p + 2], + v = e[p + 3], + m = e[p + 4], + y = 0 === o ? f : g, + x = 0 === o ? v : m, + w = !1; + s && (a = Math.sqrt(Math.pow(f - v, 2) + Math.pow(g - m, 2))), + y < r + ? x > r && ((l = h(u, f, g, v, m, r)), s && (u.start = c + a * l)) + : y > i + ? x < i && ((l = h(u, f, g, v, m, i)), s && (u.start = c + a * l)) + : ge(u, f, g, d), + x < r && y >= r && ((l = h(u, f, g, v, m, r)), (w = !0)), + x > i && y <= i && ((l = h(u, f, g, v, m, i)), (w = !0)), + !n && w && (s && (u.end = c + a * l), t.push(u), (u = pe(e))), + s && (c += a); + } + var S = e.length - 3; + (f = e[S]), + (g = e[S + 1]), + (d = e[S + 2]), + (y = 0 === o ? f : g) >= r && y <= i && ge(u, f, g, d), + (S = u.length - 3), + n && + S >= 3 && + (u[S] !== u[0] || u[S + 1] !== u[1]) && + ge(u, u[0], u[1], u[2]), + u.length && t.push(u); + } + function pe(e) { + var t = []; + return (t.size = e.size), (t.start = e.start), (t.end = e.end), t; + } + function fe(e, t, r, i, o, n) { + for (var s = 0; s < e.length; s++) ce(e[s], t, r, i, o, n, !1); + } + function ge(e, t, r, i) { + e.push(t), e.push(r), e.push(i); + } + function de(e, t, r, i, o, n) { + var s = (n - t) / (i - t); + return e.push(n), e.push(r + (o - r) * s), e.push(1), s; + } + function ve(e, t, r, i, o, n) { + var s = (n - r) / (o - r); + return e.push(t + (i - t) * s), e.push(n), e.push(1), s; + } + function me(e, t) { + for (var r = [], i = 0; i < e.length; i++) { + var o, + n = e[i], + s = n.type; + if ('Point' === s || 'MultiPoint' === s || 'LineString' === s) + o = ye(n.geometry, t); + else if ('MultiLineString' === s || 'Polygon' === s) { + o = []; + for (var a = 0; a < n.geometry.length; a++) + o.push(ye(n.geometry[a], t)); + } else if ('MultiPolygon' === s) + for (o = [], a = 0; a < n.geometry.length; a++) { + for (var l = [], u = 0; u < n.geometry[a].length; u++) + l.push(ye(n.geometry[a][u], t)); + o.push(l); + } + r.push(te(n.id, s, o, n.tags)); + } + return r; + } + function ye(e, t) { + var r = []; + (r.size = e.size), + void 0 !== e.start && ((r.start = e.start), (r.end = e.end)); + for (var i = 0; i < e.length; i += 3) + r.push(e[i] + t, e[i + 1], e[i + 2]); + return r; + } + function xe(e, t) { + if (e.transformed) return e; + var r, + i, + o, + n = 1 << e.z, + s = e.x, + a = e.y; + for (r = 0; r < e.features.length; r++) { + var l = e.features[r], + u = l.geometry, + h = l.type; + if (((l.geometry = []), 1 === h)) + for (i = 0; i < u.length; i += 2) + l.geometry.push(we(u[i], u[i + 1], t, n, s, a)); + else + for (i = 0; i < u.length; i++) { + var c = []; + for (o = 0; o < u[i].length; o += 2) + c.push(we(u[i][o], u[i][o + 1], t, n, s, a)); + l.geometry.push(c); + } + } + return (e.transformed = !0), e; + } + function we(e, t, r, i, o, n) { + return [Math.round(r * (e * i - o)), Math.round(r * (t * i - n))]; + } + function Se(e, t, r, i, o) { + for ( + var n = t === o.maxZoom ? 0 : o.tolerance / ((1 << t) * o.extent), + s = { + features: [], + numPoints: 0, + numSimplified: 0, + numFeatures: 0, + source: null, + x: r, + y: i, + z: t, + transformed: !1, + minX: 2, + minY: 1, + maxX: -1, + maxY: 0, + }, + a = 0; + a < e.length; + a++ + ) { + s.numFeatures++, Me(s, e[a], n, o); + var l = e[a].minX, + u = e[a].minY, + h = e[a].maxX, + c = e[a].maxY; + l < s.minX && (s.minX = l), + u < s.minY && (s.minY = u), + h > s.maxX && (s.maxX = h), + c > s.maxY && (s.maxY = c); + } + return s; + } + function Me(e, t, r, i) { + var o = t.geometry, + n = t.type, + s = []; + if ('Point' === n || 'MultiPoint' === n) + for (var a = 0; a < o.length; a += 3) + s.push(o[a]), s.push(o[a + 1]), e.numPoints++, e.numSimplified++; + else if ('LineString' === n) Ie(s, o, e, r, !1, !1); + else if ('MultiLineString' === n || 'Polygon' === n) + for (a = 0; a < o.length; a++) + Ie(s, o[a], e, r, 'Polygon' === n, 0 === a); + else if ('MultiPolygon' === n) + for (var l = 0; l < o.length; l++) { + var u = o[l]; + for (a = 0; a < u.length; a++) Ie(s, u[a], e, r, !0, 0 === a); + } + if (s.length) { + var h = t.tags || null; + if ('LineString' === n && i.lineMetrics) { + for (var c in ((h = {}), t.tags)) h[c] = t.tags[c]; + (h.mapbox_clip_start = o.start / o.size), + (h.mapbox_clip_end = o.end / o.size); + } + var p = { + geometry: s, + type: + 'Polygon' === n || 'MultiPolygon' === n + ? 3 + : 'LineString' === n || 'MultiLineString' === n + ? 2 + : 1, + tags: h, + }; + null !== t.id && (p.id = t.id), e.features.push(p); + } + } + function Ie(e, t, r, i, o, n) { + var s = i * i; + if (i > 0 && t.size < (o ? s : i)) r.numPoints += t.length / 3; + else { + for (var a = [], l = 0; l < t.length; l += 3) + (0 === i || t[l + 2] > s) && + (r.numSimplified++, a.push(t[l]), a.push(t[l + 1])), + r.numPoints++; + o && + (function (e, t) { + for ( + var r = 0, i = 0, o = e.length, n = o - 2; + i < o; + n = i, i += 2 + ) + r += (e[i] - e[n]) * (e[i + 1] + e[n + 1]); + if (r > 0 === t) + for (i = 0, o = e.length; i < o / 2; i += 2) { + var s = e[i], + a = e[i + 1]; + (e[i] = e[o - 2 - i]), + (e[i + 1] = e[o - 1 - i]), + (e[o - 2 - i] = s), + (e[o - 1 - i] = a); + } + })(a, n), + e.push(a); + } + } + function be(e, t) { + var r = (t = this.options = + (function (e, t) { + for (var r in t) e[r] = t[r]; + return e; + })(Object.create(this.options), t)).debug; + if ( + (r && 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 i = (function (e, t) { + var r = []; + if ('FeatureCollection' === e.type) + for (var i = 0; i < e.features.length; i++) + ie(r, e.features[i], t, i); + else ie(r, 'Feature' === e.type ? e : { geometry: e }, t); + return r; + })(e, t); + (this.tiles = {}), + (this.tileCoords = []), + r && + (console.timeEnd('preprocess data'), + console.log( + 'index: maxZoom: %d, maxPoints: %d', + t.indexMaxZoom, + t.indexMaxPoints, + ), + console.time('generate tiles'), + (this.stats = {}), + (this.total = 0)), + (i = (function (e, t) { + var r = t.buffer / t.extent, + i = e, + o = ue(e, 1, -1 - r, r, 0, -1, 2, t), + n = ue(e, 1, 1 - r, 2 + r, 0, -1, 2, t); + return ( + (o || n) && + ((i = ue(e, 1, -r, 1 + r, 0, -1, 2, t) || []), + o && (i = me(o, 1).concat(i)), + n && (i = i.concat(me(n, -1)))), + i + ); + })(i, t)), + i.length && this.splitTile(i, 0, 0, 0), + r && + (i.length && + console.log( + 'features: %d, points: %d', + this.tiles[0].numFeatures, + this.tiles[0].numPoints, + ), + console.timeEnd('generate tiles'), + console.log( + 'tiles generated:', + this.total, + JSON.stringify(this.stats), + )); + } + function ke(e, t, r) { + return 32 * ((1 << e) * r + t) + e; + } + function Pe(e, t) { + var r = e.tileID.canonical; + if (!this._geoJSONIndex) return t(null, null); + var i = this._geoJSONIndex.getTile(r.z, r.x, r.y); + if (!i) return t(null, null); + var o = new d(i.features), + n = v.exports(o); + (0 === n.byteOffset && n.byteLength === n.buffer.byteLength) || + (n = new Uint8Array(n)), + t(null, { vectorTile: o, rawData: n.buffer }); + } + (j.prototype.load = function (e) { + var t = this.options, + r = t.log, + i = t.minZoom, + o = t.maxZoom, + n = t.nodeSize; + r && console.time('total time'); + var s = 'prepare ' + e.length + ' points'; + r && console.time(s), (this.points = e); + for (var a = [], l = 0; l < e.length; l++) + e[l].geometry && a.push(X(e[l], l)); + (this.trees[o + 1] = new J(a, K, Q, n, Float32Array)), + r && console.timeEnd(s); + for (var u = o; u >= i; u--) { + var h = +Date.now(); + (a = this._cluster(a, u)), + (this.trees[u] = new J(a, K, Q, n, Float32Array)), + r && + console.log( + 'z%d: %d clusters in %dms', + u, + a.length, + +Date.now() - h, + ); + } + return r && console.timeEnd('total time'), this; + }), + (j.prototype.getClusters = function (e, t) { + var r = ((((e[0] + 180) % 360) + 360) % 360) - 180, + i = Math.max(-90, Math.min(90, e[1])), + o = 180 === e[2] ? 180 : ((((e[2] + 180) % 360) + 360) % 360) - 180, + n = Math.max(-90, Math.min(90, e[3])); + if (e[2] - e[0] >= 360) (r = -180), (o = 180); + else if (r > o) { + var s = this.getClusters([r, i, 180, n], t), + a = this.getClusters([-180, i, o, n], t); + return s.concat(a); + } + for ( + var l = this.trees[this._limitZoom(t)], + u = [], + h = 0, + c = l.range(q(r), U(n), q(o), U(i)); + h < c.length; + h += 1 + ) { + var p = l.points[c[h]]; + u.push(p.numPoints ? R(p) : this.points[p.index]); + } + return u; + }), + (j.prototype.getChildren = function (e) { + var t = this._getOriginId(e), + r = this._getOriginZoom(e), + i = 'No cluster with the specified id.', + o = this.trees[r]; + if (!o) throw new Error(i); + var n = o.points[t]; + if (!n) throw new Error(i); + for ( + var s = + this.options.radius / (this.options.extent * Math.pow(2, r - 1)), + a = [], + l = 0, + u = o.within(n.x, n.y, s); + l < u.length; + l += 1 + ) { + var h = o.points[u[l]]; + h.parentId === e && a.push(h.numPoints ? R(h) : this.points[h.index]); + } + if (0 === a.length) throw new Error(i); + return a; + }), + (j.prototype.getLeaves = function (e, t, r) { + var i = []; + return this._appendLeaves(i, e, (t = t || 10), (r = r || 0), 0), i; + }), + (j.prototype.getTile = function (e, t, r) { + var i = this.trees[this._limitZoom(e)], + o = Math.pow(2, e), + n = this.options, + s = n.radius / n.extent, + a = (r - s) / o, + l = (r + 1 + s) / o, + u = { features: [] }; + return ( + this._addTileFeatures( + i.range((t - s) / o, a, (t + 1 + s) / o, l), + i.points, + t, + r, + o, + u, + ), + 0 === t && + this._addTileFeatures( + i.range(1 - s / o, a, 1, l), + i.points, + o, + r, + o, + u, + ), + t === o - 1 && + this._addTileFeatures( + i.range(0, a, s / o, l), + i.points, + -1, + r, + o, + u, + ), + u.features.length ? u : null + ); + }), + (j.prototype.getClusterExpansionZoom = function (e) { + for (var t = this._getOriginZoom(e) - 1; t <= this.options.maxZoom; ) { + var r = this.getChildren(e); + if ((t++, 1 !== r.length)) break; + e = r[0].properties.cluster_id; + } + return t; + }), + (j.prototype._appendLeaves = function (e, t, r, i, o) { + for (var n = 0, s = this.getChildren(t); n < s.length; n += 1) { + var a = s[n], + l = a.properties; + if ( + (l && l.cluster + ? o + l.point_count <= i + ? (o += l.point_count) + : (o = this._appendLeaves(e, l.cluster_id, r, i, o)) + : o < i + ? o++ + : e.push(a), + e.length === r) + ) + break; + } + return o; + }), + (j.prototype._addTileFeatures = function (e, t, r, i, o, n) { + for (var s = 0, a = e; s < a.length; s += 1) { + var l = t[a[s]], + u = l.numPoints, + h = void 0, + c = void 0, + p = void 0; + if (u) (h = W(l)), (c = l.x), (p = l.y); + else { + var f = this.points[l.index]; + (h = f.properties), + (c = q(f.geometry.coordinates[0])), + (p = U(f.geometry.coordinates[1])); + } + var g = { + type: 1, + geometry: [ + [ + Math.round(this.options.extent * (c * o - r)), + Math.round(this.options.extent * (p * o - i)), + ], + ], + tags: h, + }, + d = void 0; + u + ? (d = l.id) + : this.options.generateId + ? (d = l.index) + : this.points[l.index].id && (d = this.points[l.index].id), + void 0 !== d && (g.id = d), + n.features.push(g); + } + }), + (j.prototype._limitZoom = function (e) { + return Math.max( + this.options.minZoom, + Math.min(Math.floor(+e), this.options.maxZoom + 1), + ); + }), + (j.prototype._cluster = function (e, t) { + for ( + var r = [], + i = this.options, + o = i.reduce, + n = i.minPoints, + s = i.radius / (i.extent * Math.pow(2, t)), + a = 0; + a < e.length; + a++ + ) { + var l = e[a]; + if (!(l.zoom <= t)) { + l.zoom = t; + for ( + var u = this.trees[t + 1], + h = u.within(l.x, l.y, s), + c = l.numPoints || 1, + p = c, + f = 0, + g = h; + f < g.length; + f += 1 + ) { + var d = u.points[g[f]]; + d.zoom > t && (p += d.numPoints || 1); + } + if (p > c && p >= n) { + for ( + var v = l.x * c, + m = l.y * c, + y = o && c > 1 ? this._map(l, !0) : null, + x = (a << 5) + (t + 1) + this.points.length, + w = 0, + S = h; + w < S.length; + w += 1 + ) { + var M = u.points[S[w]]; + if (!(M.zoom <= t)) { + M.zoom = t; + var I = M.numPoints || 1; + (v += M.x * I), + (m += M.y * I), + (M.parentId = x), + o && (y || (y = this._map(l, !0)), o(y, this._map(M))); + } + } + (l.parentId = x), r.push(V(v / p, m / p, x, p, y)); + } else if ((r.push(l), p > 1)) + for (var b = 0, k = h; b < k.length; b += 1) { + var P = u.points[k[b]]; + P.zoom <= t || ((P.zoom = t), r.push(P)); + } + } + } + return r; + }), + (j.prototype._getOriginId = function (e) { + return (e - this.points.length) >> 5; + }), + (j.prototype._getOriginZoom = function (e) { + return (e - this.points.length) % 32; + }), + (j.prototype._map = function (e, t) { + if (e.numPoints) return t ? H({}, e.properties) : e.properties; + var r = this.points[e.index].properties, + i = this.options.map(r); + return t && i === r ? H({}, i) : i; + }), + (be.prototype.options = { + maxZoom: 14, + indexMaxZoom: 5, + indexMaxPoints: 1e5, + tolerance: 3, + extent: 4096, + buffer: 64, + lineMetrics: !1, + promoteId: null, + generateId: !1, + debug: 0, + }), + (be.prototype.splitTile = function (e, t, r, i, o, n, s) { + for (var a = [e, t, r, i], l = this.options, u = l.debug; a.length; ) { + (i = a.pop()), (r = a.pop()), (t = a.pop()), (e = a.pop()); + var h = 1 << t, + c = ke(t, r, i), + p = this.tiles[c]; + if ( + !p && + (u > 1 && console.time('creation'), + (p = this.tiles[c] = Se(e, t, r, i, l)), + this.tileCoords.push({ z: t, x: r, y: i }), + u) + ) { + u > 1 && + (console.log( + 'tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', + t, + r, + i, + p.numFeatures, + p.numPoints, + p.numSimplified, + ), + console.timeEnd('creation')); + var f = 'z' + t; + (this.stats[f] = (this.stats[f] || 0) + 1), this.total++; + } + if (((p.source = e), o)) { + if (t === l.maxZoom || t === o) continue; + var g = 1 << (o - t); + if (r !== Math.floor(n / g) || i !== Math.floor(s / g)) continue; + } else if (t === l.indexMaxZoom || p.numPoints <= l.indexMaxPoints) + continue; + if (((p.source = null), 0 !== e.length)) { + u > 1 && console.time('clipping'); + var d, + v, + m, + y, + x, + w, + S = (0.5 * l.buffer) / l.extent, + M = 0.5 - S, + I = 0.5 + S, + b = 1 + S; + (d = v = m = y = null), + (x = ue(e, h, r - S, r + I, 0, p.minX, p.maxX, l)), + (w = ue(e, h, r + M, r + b, 0, p.minX, p.maxX, l)), + (e = null), + x && + ((d = ue(x, h, i - S, i + I, 1, p.minY, p.maxY, l)), + (v = ue(x, h, i + M, i + b, 1, p.minY, p.maxY, l)), + (x = null)), + w && + ((m = ue(w, h, i - S, i + I, 1, p.minY, p.maxY, l)), + (y = ue(w, h, i + M, i + b, 1, p.minY, p.maxY, l)), + (w = null)), + u > 1 && console.timeEnd('clipping'), + a.push(d || [], t + 1, 2 * r, 2 * i), + a.push(v || [], t + 1, 2 * r, 2 * i + 1), + a.push(m || [], t + 1, 2 * r + 1, 2 * i), + a.push(y || [], t + 1, 2 * r + 1, 2 * i + 1); + } + } + }), + (be.prototype.getTile = function (e, t, r) { + var i = this.options, + o = i.extent, + n = i.debug; + if (e < 0 || e > 24) return null; + var s = 1 << e, + a = ke(e, (t = ((t % s) + s) % s), r); + if (this.tiles[a]) return xe(this.tiles[a], o); + n > 1 && console.log('drilling down to z%d-%d-%d', e, t, r); + for (var l, u = e, h = t, c = r; !l && u > 0; ) + u--, + (h = Math.floor(h / 2)), + (c = Math.floor(c / 2)), + (l = this.tiles[ke(u, h, c)]); + return l && l.source + ? (n > 1 && console.log('found parent tile z%d-%d-%d', u, h, c), + n > 1 && console.time('drilling down'), + this.splitTile(l.source, u, h, c, e, t, r), + n > 1 && console.timeEnd('drilling down'), + this.tiles[a] ? xe(this.tiles[a], o) : null) + : null; + }); + var Te = (function (t) { + function r(e, r, i, o) { + t.call(this, e, r, i, Pe), o && (this.loadGeoJSON = o); + } + return ( + t && (r.__proto__ = t), + ((r.prototype = Object.create(t && t.prototype)).constructor = r), + (r.prototype.loadData = function (t, r) { + var i, + o = this; + null === (i = this._pendingRequest) || void 0 === i || i.cancel(), + this._pendingCallback && + this._pendingCallback(null, { abandoned: !0 }); + var n = + !!(t && t.request && t.request.collectResourceTiming) && + new e.RequestPerformance(t.request); + (this._pendingCallback = r), + (this._pendingRequest = this.loadGeoJSON(t, function (i, s) { + if ( + (delete o._pendingCallback, delete o._pendingRequest, i || !s) + ) + return r(i); + if ('object' != typeof s) + return r( + new Error( + "Input data given to '" + + t.source + + "' is not a valid GeoJSON object.", + ), + ); + h(s, !0); + try { + if (t.filter) { + var a = e.createExpression(t.filter, { + type: 'boolean', + 'property-type': 'data-driven', + overridable: !1, + transition: !1, + }); + if ('error' === a.result) + throw new Error( + a.value + .map(function (e) { + return e.key + ': ' + e.message; + }) + .join(', '), + ); + var l = s.features.filter(function (e) { + return a.value.evaluate({ zoom: 0 }, e); + }); + s = { type: 'FeatureCollection', features: l }; + } + o._geoJSONIndex = t.cluster + ? new j( + (function (t) { + var r = t.superclusterOptions, + i = t.clusterProperties; + if (!i || !r) return r; + for ( + var o = {}, + n = {}, + s = { accumulated: null, zoom: 0 }, + a = { properties: null }, + l = Object.keys(i), + u = 0, + h = l; + u < h.length; + u += 1 + ) { + var c = h[u], + p = i[c], + f = p[0], + g = e.createExpression(p[1]), + d = e.createExpression( + 'string' == typeof f + ? [f, ['accumulated'], ['get', c]] + : f, + ); + (o[c] = g.value), (n[c] = d.value); + } + return ( + (r.map = function (e) { + a.properties = e; + for ( + var t = {}, r = 0, i = l; + r < i.length; + r += 1 + ) { + var n = i[r]; + t[n] = o[n].evaluate(s, a); + } + return t; + }), + (r.reduce = function (e, t) { + a.properties = t; + for (var r = 0, i = l; r < i.length; r += 1) { + var o = i[r]; + (s.accumulated = e[o]), + (e[o] = n[o].evaluate(s, a)); + } + }), + r + ); + })(t), + ).load(s.features) + : (function (e, t) { + return new be(e, t); + })(s, t.geojsonVtOptions); + } catch (e) { + return r(e); + } + o.loaded = {}; + var u = {}; + if (n) { + var c = n.finish(); + c && + ((u.resourceTiming = {}), + (u.resourceTiming[t.source] = JSON.parse( + JSON.stringify(c), + ))); + } + r(null, u); + })); + }), + (r.prototype.reloadTile = function (e, r) { + var i = this.loaded; + return i && i[e.uid] + ? t.prototype.reloadTile.call(this, e, r) + : this.loadTile(e, r); + }), + (r.prototype.loadGeoJSON = function (t, r) { + if (t.request) return e.getJSON(t.request, r); + if ('string' == typeof t.data) + try { + r(null, JSON.parse(t.data)); + } catch (e) { + r( + new Error( + "Input data given to '" + + t.source + + "' is not a valid GeoJSON object.", + ), + ); + } + else + r( + new Error( + "Input data given to '" + + t.source + + "' is not a valid GeoJSON object.", + ), + ); + return { cancel: function () {} }; + }), + (r.prototype.removeSource = function (e, t) { + this._pendingCallback && + this._pendingCallback(null, { abandoned: !0 }), + t(); + }), + (r.prototype.getClusterExpansionZoom = function (e, t) { + try { + t(null, this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)); + } catch (e) { + t(e); + } + }), + (r.prototype.getClusterChildren = function (e, t) { + try { + t(null, this._geoJSONIndex.getChildren(e.clusterId)); + } catch (e) { + t(e); + } + }), + (r.prototype.getClusterLeaves = function (e, t) { + try { + t( + null, + this._geoJSONIndex.getLeaves(e.clusterId, e.limit, e.offset), + ); + } catch (e) { + t(e); + } + }), + r + ); + })(l), + Ce = function (t) { + var r = this; + (this.self = t), + (this.actor = new e.Actor(t, this)), + (this.layerIndexes = {}), + (this.availableImages = {}), + (this.workerSourceTypes = { vector: l, geojson: Te }), + (this.workerSources = {}), + (this.demWorkerSources = {}), + (this.self.registerWorkerSource = function (e, t) { + if (r.workerSourceTypes[e]) + throw new Error( + 'Worker source with name "' + 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 ( + (Ce.prototype.setReferrer = function (e, t) { + this.referrer = t; + }), + (Ce.prototype.setImages = function (e, t, r) { + for (var i in ((this.availableImages[e] = t), this.workerSources[e])) { + var o = this.workerSources[e][i]; + for (var n in o) o[n].availableImages = t; + } + r(); + }), + (Ce.prototype.setLayers = function (e, t, r) { + this.getLayerIndex(e).replace(t), r(); + }), + (Ce.prototype.updateLayers = function (e, t, r) { + this.getLayerIndex(e).update(t.layers, t.removedIds), r(); + }), + (Ce.prototype.loadTile = function (e, t, r) { + this.getWorkerSource(e, t.type, t.source).loadTile(t, r); + }), + (Ce.prototype.loadDEMTile = function (e, t, r) { + this.getDEMWorkerSource(e, t.source).loadTile(t, r); + }), + (Ce.prototype.reloadTile = function (e, t, r) { + this.getWorkerSource(e, t.type, t.source).reloadTile(t, r); + }), + (Ce.prototype.abortTile = function (e, t, r) { + this.getWorkerSource(e, t.type, t.source).abortTile(t, r); + }), + (Ce.prototype.removeTile = function (e, t, r) { + this.getWorkerSource(e, t.type, t.source).removeTile(t, r); + }), + (Ce.prototype.removeDEMTile = function (e, t) { + this.getDEMWorkerSource(e, t.source).removeTile(t); + }), + (Ce.prototype.removeSource = function (e, t, r) { + if ( + this.workerSources[e] && + this.workerSources[e][t.type] && + this.workerSources[e][t.type][t.source] + ) { + var i = this.workerSources[e][t.type][t.source]; + delete this.workerSources[e][t.type][t.source], + void 0 !== i.removeSource ? i.removeSource(t, r) : r(); + } + }), + (Ce.prototype.loadWorkerSource = function (e, t, r) { + try { + this.self.importScripts(t.url), r(); + } catch (e) { + r(e.toString()); + } + }), + (Ce.prototype.syncRTLPluginState = function (t, r, i) { + try { + e.plugin.setState(r); + var o = e.plugin.getPluginURL(); + if (e.plugin.isLoaded() && !e.plugin.isParsed() && null != o) { + this.self.importScripts(o); + var n = e.plugin.isParsed(); + i( + n + ? void 0 + : new Error( + 'RTL Text Plugin failed to import scripts from ' + o, + ), + n, + ); + } + } catch (e) { + i(e.toString()); + } + }), + (Ce.prototype.getAvailableImages = function (e) { + var t = this.availableImages[e]; + return t || (t = []), t; + }), + (Ce.prototype.getLayerIndex = function (e) { + var t = this.layerIndexes[e]; + return t || (t = this.layerIndexes[e] = new i()), t; + }), + (Ce.prototype.getWorkerSource = function (e, t, r) { + var i = this; + if ( + (this.workerSources[e] || (this.workerSources[e] = {}), + this.workerSources[e][t] || (this.workerSources[e][t] = {}), + !this.workerSources[e][t][r]) + ) { + var o = { + send: function (t, r, o) { + i.actor.send(t, r, o, e); + }, + }; + this.workerSources[e][t][r] = new this.workerSourceTypes[t]( + o, + this.getLayerIndex(e), + this.getAvailableImages(e), + ); + } + return this.workerSources[e][t][r]; + }), + (Ce.prototype.getDEMWorkerSource = function (e, t) { + return ( + this.demWorkerSources[e] || (this.demWorkerSources[e] = {}), + this.demWorkerSources[e][t] || + (this.demWorkerSources[e][t] = new u()), + this.demWorkerSources[e][t] + ); + }), + (Ce.prototype.enforceCacheSizeLimit = function (t, r) { + e.enforceCacheSizeLimit(r); + }), + e.isWorker() && (self.worker = new Ce(self)), + Ce + ); + }); + + define(['./shared'], function (t) { + 'use strict'; + var e = i; + function i(t) { + return !(function (t) { + return 'undefined' == typeof window || 'undefined' == typeof document + ? 'not a browser' + : Array.prototype && + Array.prototype.every && + Array.prototype.filter && + Array.prototype.forEach && + Array.prototype.indexOf && + Array.prototype.lastIndexOf && + Array.prototype.map && + Array.prototype.some && + Array.prototype.reduce && + Array.prototype.reduceRight && + Array.isArray + ? Function.prototype && Function.prototype.bind + ? Object.keys && + Object.create && + Object.getPrototypeOf && + Object.getOwnPropertyNames && + Object.isSealed && + Object.isFrozen && + Object.isExtensible && + Object.getOwnPropertyDescriptor && + Object.defineProperty && + Object.defineProperties && + Object.seal && + Object.freeze && + Object.preventExtensions + ? 'JSON' in window && 'parse' in JSON && 'stringify' in JSON + ? (function () { + if ( + !( + 'Worker' in window && + 'Blob' in window && + 'URL' in window + ) + ) + return !1; + var t, + e, + i = new Blob([''], { type: 'text/javascript' }), + r = URL.createObjectURL(i); + try { + (e = new Worker(r)), (t = !0); + } catch (e) { + t = !1; + } + return e && e.terminate(), URL.revokeObjectURL(r), t; + })() + ? 'Uint8ClampedArray' in window + ? ArrayBuffer.isView + ? (function () { + var t = document.createElement('canvas'); + t.width = t.height = 1; + var e = t.getContext('2d'); + if (!e) return !1; + var i = e.getImageData(0, 0, 1, 1); + return i && i.width === t.width; + })() + ? (void 0 === + r[(e = t && t.failIfMajorPerformanceCaveat)] && + (r[e] = (function (t) { + var e, + r = (function (t) { + var e = document.createElement('canvas'), + r = Object.create(i.webGLContextAttributes); + return ( + (r.failIfMajorPerformanceCaveat = t), + e.getContext('webgl', r) || + e.getContext('experimental-webgl', r) + ); + })(t); + if (!r) return !1; + try { + e = r.createShader(r.VERTEX_SHADER); + } catch (t) { + return !1; + } + return ( + !(!e || r.isContextLost()) && + (r.shaderSource(e, 'void main() {}'), + r.compileShader(e), + !0 === + r.getShaderParameter(e, r.COMPILE_STATUS)) + ); + })(e)), + r[e] + ? 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 e; + })(t); + } + var r = {}; + function o(t, e) { + if (Array.isArray(t)) { + if (!Array.isArray(e) || t.length !== e.length) return !1; + for (var i = 0; i < t.length; i++) if (!o(t[i], e[i])) return !1; + return !0; + } + if ('object' == typeof t && null !== t && null !== e) { + if ('object' != typeof e) return !1; + if (Object.keys(t).length !== Object.keys(e).length) return !1; + for (var r in t) if (!o(t[r], e[r])) return !1; + return !0; + } + return t === e; + } + i.webGLContextAttributes = { + antialias: !1, + alpha: !0, + stencil: !0, + depth: !0, + }; + var a = function () {}; + (a.testProp = function (t) { + if (!a.docStyle) return t[0]; + for (var e = 0; e < t.length; e++) if (t[e] in a.docStyle) return t[e]; + return t[0]; + }), + (a.create = function (t, e, i) { + var r = window.document.createElement(t); + return void 0 !== e && (r.className = e), i && i.appendChild(r), r; + }), + (a.createNS = function (t, e) { + return window.document.createElementNS(t, e); + }), + (a.disableDrag = function () { + a.docStyle && + a.selectProp && + ((a.userSelect = a.docStyle[a.selectProp]), + (a.docStyle[a.selectProp] = 'none')); + }), + (a.enableDrag = function () { + a.docStyle && a.selectProp && (a.docStyle[a.selectProp] = a.userSelect); + }), + (a.setTransform = function (t, e) { + t.style[a.transformProp] = e; + }), + (a.addEventListener = function (t, e, i, r) { + void 0 === r && (r = {}), + t.addEventListener(e, i, 'passive' in r ? r : r.capture); + }), + (a.removeEventListener = function (t, e, i, r) { + void 0 === r && (r = {}), + t.removeEventListener(e, i, 'passive' in r ? r : r.capture); + }), + (a.suppressClickInternal = function (t) { + t.preventDefault(), + t.stopPropagation(), + window.removeEventListener('click', a.suppressClickInternal, !0); + }), + (a.suppressClick = function () { + window.addEventListener('click', a.suppressClickInternal, !0), + window.setTimeout(function () { + window.removeEventListener('click', a.suppressClickInternal, !0); + }, 0); + }), + (a.mousePos = function (e, i) { + var r = e.getBoundingClientRect(); + return new t.pointGeometry( + i.clientX - r.left - e.clientLeft, + i.clientY - r.top - e.clientTop, + ); + }), + (a.touchPos = function (e, i) { + for ( + var r = e.getBoundingClientRect(), o = [], a = 0; + a < i.length; + a++ + ) + o.push( + new t.pointGeometry( + i[a].clientX - r.left - e.clientLeft, + i[a].clientY - r.top - e.clientTop, + ), + ); + return o; + }), + (a.mouseButton = function (t) { + return t.button; + }), + (a.remove = function (t) { + t.parentNode && t.parentNode.removeChild(t); + }), + (a.docStyle = + 'undefined' != typeof window && + window.document && + window.document.documentElement.style), + (a.selectProp = a.testProp([ + 'userSelect', + 'MozUserSelect', + 'WebkitUserSelect', + 'msUserSelect', + ])), + (a.transformProp = a.testProp(['transform', 'WebkitTransform'])); + var n = function (t) { + this._transformRequestFn = t; + }; + (n.prototype.transformRequest = function (t, e) { + return ( + (this._transformRequestFn && this._transformRequestFn(t, e)) || { + url: t, + } + ); + }), + (n.prototype.normalizeSpriteURL = function (t, e, i) { + var r, + o, + a = (function (t) { + var e = t.match(s); + if (!e) throw new Error('Unable to parse URL "' + t + '"'); + return { + protocol: e[1], + authority: e[2], + path: e[3] || '/', + params: e[4] ? e[4].split('&') : [], + }; + })(t); + return ( + (a.path += '' + e + i), + (o = (r = a).params.length ? '?' + r.params.join('&') : ''), + r.protocol + '://' + r.authority + r.path + o + ); + }), + (n.prototype.setTransformRequest = function (t) { + this._transformRequestFn = t; + }); + var s = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/, + l = function (t, e, i, r) { + (this.context = t), + (this.format = i), + (this.texture = t.gl.createTexture()), + this.update(e, r); + }; + function c(t) { + var e = t.userImage; + return ( + !!(e && e.render && e.render()) && + (t.data.replace(new Uint8Array(e.data.buffer)), !0) + ); + } + (l.prototype.update = function (e, i, r) { + var o = e.width, + a = e.height, + n = !((this.size && this.size[0] === o && this.size[1] === a) || r), + s = this.context, + l = s.gl; + if ( + ((this.useMipmap = Boolean(i && i.useMipmap)), + l.bindTexture(l.TEXTURE_2D, this.texture), + s.pixelStoreUnpackFlipY.set(!1), + s.pixelStoreUnpack.set(1), + s.pixelStoreUnpackPremultiplyAlpha.set( + this.format === l.RGBA && (!i || !1 !== i.premultiply), + ), + n) + ) + (this.size = [o, a]), + e instanceof HTMLImageElement || + e instanceof HTMLCanvasElement || + e instanceof HTMLVideoElement || + e instanceof ImageData || + t.isImageBitmap(e) + ? l.texImage2D( + l.TEXTURE_2D, + 0, + this.format, + this.format, + l.UNSIGNED_BYTE, + e, + ) + : l.texImage2D( + l.TEXTURE_2D, + 0, + this.format, + o, + a, + 0, + this.format, + l.UNSIGNED_BYTE, + e.data, + ); + else { + var c = r || { x: 0, y: 0 }, + h = c.x, + u = c.y; + e instanceof HTMLImageElement || + e instanceof HTMLCanvasElement || + e instanceof HTMLVideoElement || + e instanceof ImageData || + t.isImageBitmap(e) + ? l.texSubImage2D(l.TEXTURE_2D, 0, h, u, l.RGBA, l.UNSIGNED_BYTE, e) + : l.texSubImage2D( + l.TEXTURE_2D, + 0, + h, + u, + o, + a, + l.RGBA, + l.UNSIGNED_BYTE, + e.data, + ); + } + this.useMipmap && + this.isSizePowerOfTwo() && + l.generateMipmap(l.TEXTURE_2D); + }), + (l.prototype.bind = function (t, e, i) { + var r = this.context.gl; + r.bindTexture(r.TEXTURE_2D, this.texture), + i !== r.LINEAR_MIPMAP_NEAREST || + this.isSizePowerOfTwo() || + (i = r.LINEAR), + t !== this.filter && + (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, t), + r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, i || t), + (this.filter = t)), + e !== this.wrap && + (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, e), + r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, e), + (this.wrap = e)); + }), + (l.prototype.isSizePowerOfTwo = function () { + return ( + this.size[0] === this.size[1] && + (Math.log(this.size[0]) / Math.LN2) % 1 == 0 + ); + }), + (l.prototype.destroy = function () { + this.context.gl.deleteTexture(this.texture), (this.texture = null); + }); + var h = (function (e) { + function i() { + e.call(this), + (this.images = {}), + (this.updatedImages = {}), + (this.callbackDispatchedThisFrame = {}), + (this.loaded = !1), + (this.requestors = []), + (this.patterns = {}), + (this.atlasImage = new t.RGBAImage({ width: 1, height: 1 })), + (this.dirty = !0); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.isLoaded = function () { + return this.loaded; + }), + (i.prototype.setLoaded = function (t) { + if (this.loaded !== t && ((this.loaded = t), t)) { + for (var e = 0, i = this.requestors; e < i.length; e += 1) { + var r = i[e]; + this._notify(r.ids, r.callback); + } + this.requestors = []; + } + }), + (i.prototype.getImage = function (t) { + return this.images[t]; + }), + (i.prototype.addImage = function (t, e) { + if (this.images[t]) + throw new Error( + 'Image id ' + t + ' already exist, use updateImage instead', + ); + this._validate(t, e) && (this.images[t] = e); + }), + (i.prototype._validate = function (e, i) { + var r = !0; + return ( + this._validateStretch(i.stretchX, i.data && i.data.width) || + (this.fire( + new t.ErrorEvent( + new Error('Image "' + e + '" has invalid "stretchX" value'), + ), + ), + (r = !1)), + this._validateStretch(i.stretchY, i.data && i.data.height) || + (this.fire( + new t.ErrorEvent( + new Error('Image "' + e + '" has invalid "stretchY" value'), + ), + ), + (r = !1)), + this._validateContent(i.content, i) || + (this.fire( + new t.ErrorEvent( + new Error('Image "' + e + '" has invalid "content" value'), + ), + ), + (r = !1)), + r + ); + }), + (i.prototype._validateStretch = function (t, e) { + if (!t) return !0; + for (var i = 0, r = 0, o = t; r < o.length; r += 1) { + var a = o[r]; + if (a[0] < i || a[1] < a[0] || e < a[1]) return !1; + i = a[1]; + } + return !0; + }), + (i.prototype._validateContent = function (t, e) { + return !( + t && + (4 !== t.length || + t[0] < 0 || + e.data.width < t[0] || + t[1] < 0 || + e.data.height < t[1] || + t[2] < 0 || + e.data.width < t[2] || + t[3] < 0 || + e.data.height < t[3] || + t[2] < t[0] || + t[3] < t[1]) + ); + }), + (i.prototype.updateImage = function (t, e) { + var i = this.images[t]; + if ( + i.data.width !== e.data.width || + i.data.height !== e.data.height + ) + throw new Error( + 'size mismatch between old image (' + + i.data.width + + 'x' + + i.data.height + + ') and new image (' + + e.data.width + + 'x' + + e.data.height + + ').', + ); + (e.version = i.version + 1), + (this.images[t] = e), + (this.updatedImages[t] = !0); + }), + (i.prototype.removeImage = function (t) { + var e = this.images[t]; + delete this.images[t], + delete this.patterns[t], + e.userImage && e.userImage.onRemove && e.userImage.onRemove(); + }), + (i.prototype.listImages = function () { + return Object.keys(this.images); + }), + (i.prototype.getImages = function (t, e) { + var i = !0; + if (!this.isLoaded()) + for (var r = 0, o = t; r < o.length; r += 1) + this.images[o[r]] || (i = !1); + this.isLoaded() || i + ? this._notify(t, e) + : this.requestors.push({ ids: t, callback: e }); + }), + (i.prototype._notify = function (e, i) { + for (var r = {}, o = 0, a = e; o < a.length; o += 1) { + var n = a[o]; + this.images[n] || + this.fire(new t.Event('styleimagemissing', { id: n })); + var s = this.images[n]; + s + ? (r[n] = { + data: s.data.clone(), + pixelRatio: s.pixelRatio, + sdf: s.sdf, + version: s.version, + stretchX: s.stretchX, + stretchY: s.stretchY, + content: s.content, + hasRenderCallback: Boolean( + s.userImage && s.userImage.render, + ), + }) + : t.warnOnce( + 'Image "' + + n + + '" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.', + ); + } + i(null, r); + }), + (i.prototype.getPixelSize = function () { + var t = this.atlasImage; + return { width: t.width, height: t.height }; + }), + (i.prototype.getPattern = function (e) { + var i = this.patterns[e], + r = this.getImage(e); + if (!r) return null; + if (i && i.position.version === r.version) return i.position; + if (i) i.position.version = r.version; + else { + var o = { w: r.data.width + 2, h: r.data.height + 2, x: 0, y: 0 }, + a = new t.ImagePosition(o, r); + this.patterns[e] = { bin: o, position: a }; + } + return this._updatePatternAtlas(), this.patterns[e].position; + }), + (i.prototype.bind = function (t) { + var e = t.gl; + this.atlasTexture + ? this.dirty && + (this.atlasTexture.update(this.atlasImage), (this.dirty = !1)) + : (this.atlasTexture = new l(t, this.atlasImage, e.RGBA)), + this.atlasTexture.bind(e.LINEAR, e.CLAMP_TO_EDGE); + }), + (i.prototype._updatePatternAtlas = function () { + var e = []; + for (var i in this.patterns) e.push(this.patterns[i].bin); + var r = t.potpack(e), + o = r.w, + a = r.h, + n = this.atlasImage; + for (var s in (n.resize({ width: o || 1, height: a || 1 }), + this.patterns)) { + var l = this.patterns[s].bin, + c = l.x + 1, + h = l.y + 1, + u = this.images[s].data, + p = u.width, + d = u.height; + t.RGBAImage.copy( + u, + n, + { x: 0, y: 0 }, + { x: c, y: h }, + { width: p, height: d }, + ), + t.RGBAImage.copy( + u, + n, + { x: 0, y: d - 1 }, + { x: c, y: h - 1 }, + { width: p, height: 1 }, + ), + t.RGBAImage.copy( + u, + n, + { x: 0, y: 0 }, + { x: c, y: h + d }, + { width: p, height: 1 }, + ), + t.RGBAImage.copy( + u, + n, + { x: p - 1, y: 0 }, + { x: c - 1, y: h }, + { width: 1, height: d }, + ), + t.RGBAImage.copy( + u, + n, + { x: 0, y: 0 }, + { x: c + p, y: h }, + { width: 1, height: d }, + ); + } + this.dirty = !0; + }), + (i.prototype.beginFrame = function () { + this.callbackDispatchedThisFrame = {}; + }), + (i.prototype.dispatchRenderCallbacks = function (e) { + for (var i = 0, r = e; i < r.length; i += 1) { + var o = r[i]; + if (!this.callbackDispatchedThisFrame[o]) { + this.callbackDispatchedThisFrame[o] = !0; + var a = this.images[o]; + a || t.warnOnce('Image with ID: "' + o + '" was not found'), + c(a) && this.updateImage(o, a); + } + } + }), + i + ); + })(t.Evented), + u = 1e20, + p = function (t) { + void 0 === t && (t = {}); + var e = t.fontSize; + void 0 === e && (e = 24); + var i = t.buffer; + void 0 === i && (i = 3); + var r = t.radius; + void 0 === r && (r = 8); + var o = t.cutoff; + void 0 === o && (o = 0.25); + var a = t.fontFamily; + void 0 === a && (a = 'sans-serif'); + var n = t.fontWeight; + void 0 === n && (n = 'normal'); + var s = t.fontStyle; + void 0 === s && (s = 'normal'), + (this.buffer = i), + (this.cutoff = o), + (this.radius = r); + var l = (this.size = e + 4 * i), + c = this._createCanvas(l), + h = (this.ctx = c.getContext('2d', { willReadFrequently: !0 })); + (h.font = s + ' ' + n + ' ' + e + 'px ' + a), + (h.textBaseline = 'alphabetic'), + (h.textAlign = 'left'), + (h.fillStyle = 'black'), + (this.gridOuter = new Float64Array(l * l)), + (this.gridInner = new Float64Array(l * l)), + (this.f = new Float64Array(l)), + (this.z = new Float64Array(l + 1)), + (this.v = new Uint16Array(l)); + }; + function d(t, e, i, r, o, a, n, s, l) { + for (var c = e; c < e + r; c++) _(t, i * a + c, a, o, n, s, l); + for (var h = i; h < i + o; h++) _(t, h * a + e, 1, r, n, s, l); + } + function _(t, e, i, r, o, a, n) { + (a[0] = 0), (n[0] = -u), (n[1] = u), (o[0] = t[e]); + for (var s = 1, l = 0, c = 0; s < r; s++) { + o[s] = t[e + s * i]; + var h = s * s; + do { + var p = a[l]; + c = (o[s] - o[p] + h - p * p) / (s - p) / 2; + } while (c <= n[l] && --l > -1); + (a[++l] = s), (n[l] = c), (n[l + 1] = u); + } + for (var d = 0, _ = 0; d < r; d++) { + for (; n[_ + 1] < d; ) _++; + var f = a[_], + m = d - f; + t[e + d * i] = o[f] + m * m; + } + } + (p.prototype._createCanvas = function (t) { + var e = document.createElement('canvas'); + return (e.width = e.height = t), e; + }), + (p.prototype.draw = function (t) { + var e = this.ctx.measureText(t), + i = e.width, + r = e.actualBoundingBoxDescent, + o = e.actualBoundingBoxLeft, + a = e.actualBoundingBoxRight, + n = Math.ceil(e.actualBoundingBoxAscent), + s = Math.min(this.size - this.buffer, Math.ceil(a - o)), + l = Math.min(this.size - this.buffer, n + Math.ceil(r)), + c = s + 2 * this.buffer, + h = l + 2 * this.buffer, + p = Math.max(c * h, 0), + _ = new Uint8ClampedArray(p), + f = { + data: _, + width: c, + height: h, + glyphWidth: s, + glyphHeight: l, + glyphTop: n, + glyphLeft: 0, + glyphAdvance: i, + }; + if (0 === s || 0 === l) return f; + var m = this, + g = m.ctx, + v = m.buffer, + y = m.gridInner, + x = m.gridOuter; + g.clearRect(v, v, s, l), g.fillText(t, v, v + n); + var b = g.getImageData(v, v, s, l); + x.fill(u, 0, p), y.fill(0, 0, p); + for (var w = 0; w < l; w++) + for (var T = 0; T < s; T++) { + var E = b.data[4 * (w * s + T) + 3] / 255; + if (0 !== E) { + var I = (w + v) * c + T + v; + if (1 === E) (x[I] = 0), (y[I] = u); + else { + var C = 0.5 - E; + (x[I] = C > 0 ? C * C : 0), (y[I] = C < 0 ? C * C : 0); + } + } + } + d(x, 0, 0, c, h, c, this.f, this.v, this.z), + d(y, v, v, s, l, c, this.f, this.v, this.z); + for (var S = 0; S < p; S++) { + var D = Math.sqrt(x[S]) - Math.sqrt(y[S]); + _[S] = Math.round(255 - 255 * (D / this.radius + this.cutoff)); + } + return f; + }); + var f = function (t, e) { + (this.requestManager = t), + (this.localIdeographFontFamily = e), + (this.entries = {}); + }; + (f.prototype.setURL = function (t) { + this.url = t; + }), + (f.prototype.getGlyphs = function (e, i) { + var r = this, + o = []; + for (var a in e) + for (var n = 0, s = e[a]; n < s.length; n += 1) + o.push({ stack: a, id: s[n] }); + t.asyncAll( + o, + function (t, e) { + var i = t.stack, + o = t.id, + a = r.entries[i]; + a || (a = r.entries[i] = { glyphs: {}, requests: {}, ranges: {} }); + var n = a.glyphs[o]; + if (void 0 === n) { + if ((n = r._tinySDF(a, i, o))) + return ( + (a.glyphs[o] = n), void e(null, { stack: i, id: o, glyph: n }) + ); + var s = Math.floor(o / 256); + if (256 * s > 65535) e(new Error('glyphs > 65535 not supported')); + else if (a.ranges[s]) e(null, { stack: i, id: o, glyph: n }); + else { + var l = a.requests[s]; + l || + ((l = a.requests[s] = []), + f.loadGlyphRange( + i, + s, + r.url, + r.requestManager, + function (t, e) { + if (e) { + for (var i in e) + r._doesCharSupportLocalGlyph(+i) || + (a.glyphs[+i] = e[+i]); + a.ranges[s] = !0; + } + for (var o = 0, n = l; o < n.length; o += 1) + (0, n[o])(t, e); + delete a.requests[s]; + }, + )), + l.push(function (t, r) { + t + ? e(t) + : r && e(null, { stack: i, id: o, glyph: r[o] || null }); + }); + } + } else e(null, { stack: i, id: o, glyph: n }); + }, + function (t, e) { + if (t) i(t); + else if (e) { + for (var r = {}, o = 0, a = e; o < a.length; o += 1) { + var n = a[o], + s = n.stack, + l = n.id, + c = n.glyph; + (r[s] || (r[s] = {}))[l] = c && { + id: c.id, + bitmap: c.bitmap.clone(), + metrics: c.metrics, + }; + } + i(null, r); + } + }, + ); + }), + (f.prototype._doesCharSupportLocalGlyph = function (e) { + return ( + !!this.localIdeographFontFamily && + (t.unicodeBlockLookup['CJK Unified Ideographs'](e) || + t.unicodeBlockLookup['Hangul Syllables'](e) || + t.unicodeBlockLookup.Hiragana(e) || + t.unicodeBlockLookup.Katakana(e)) + ); + }), + (f.prototype._tinySDF = function (e, i, r) { + var o = this.localIdeographFontFamily; + if (o && this._doesCharSupportLocalGlyph(r)) { + var a = e.tinySDF; + if (!a) { + var n = '400'; + /bold/i.test(i) + ? (n = '900') + : /medium/i.test(i) + ? (n = '500') + : /light/i.test(i) && (n = '200'), + (a = e.tinySDF = + new f.TinySDF({ + fontSize: 24, + buffer: 3, + radius: 8, + cutoff: 0.25, + fontFamily: o, + fontWeight: n, + })); + } + var s = a.draw(String.fromCharCode(r)); + return { + id: r, + bitmap: new t.AlphaImage( + { width: s.width || 30, height: s.height || 30 }, + s.data, + ), + metrics: { + width: s.glyphWidth || 24, + height: s.glyphHeight || 24, + left: s.glyphLeft || 0, + top: s.glyphTop - 27 || -8, + advance: s.glyphAdvance || 24, + }, + }; + } + }), + (f.loadGlyphRange = function (e, i, r, o, a) { + var n = 256 * i, + s = n + 255, + l = o.transformRequest( + r.replace('{fontstack}', e).replace('{range}', n + '-' + s), + t.ResourceType.Glyphs, + ); + t.getArrayBuffer(l, function (e, i) { + if (e) a(e); + else if (i) { + for ( + var r = {}, o = 0, n = t.parseGlyphPbf(i); + o < n.length; + o += 1 + ) { + var s = n[o]; + r[s.id] = s; + } + a(null, r); + } + }); + }), + (f.TinySDF = p); + var m = function () { + this.specification = t.spec.light.position; + }; + (m.prototype.possiblyEvaluate = function (e, i) { + return t.sphericalToCartesian(e.expression.evaluate(i)); + }), + (m.prototype.interpolate = function (e, i, r) { + return { + x: t.number(e.x, i.x, r), + y: t.number(e.y, i.y, r), + z: t.number(e.z, i.z, r), + }; + }); + var g = new t.Properties({ + anchor: new t.DataConstantProperty(t.spec.light.anchor), + position: new m(), + color: new t.DataConstantProperty(t.spec.light.color), + intensity: new t.DataConstantProperty(t.spec.light.intensity), + }), + v = '-transition', + y = (function (e) { + function i(i) { + e.call(this), + (this._transitionable = new t.Transitionable(g)), + this.setLight(i), + (this._transitioning = this._transitionable.untransitioned()); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.getLight = function () { + return this._transitionable.serialize(); + }), + (i.prototype.setLight = function (e, i) { + if ( + (void 0 === i && (i = {}), !this._validate(t.validateLight, e, i)) + ) + for (var r in e) { + var o = e[r]; + t.endsWith(r, v) + ? this._transitionable.setTransition(r.slice(0, -v.length), o) + : this._transitionable.setValue(r, o); + } + }), + (i.prototype.updateTransitions = function (t) { + this._transitioning = this._transitionable.transitioned( + t, + this._transitioning, + ); + }), + (i.prototype.hasTransition = function () { + return this._transitioning.hasTransition(); + }), + (i.prototype.recalculate = function (t) { + this.properties = this._transitioning.possiblyEvaluate(t); + }), + (i.prototype._validate = function (e, i, r) { + return ( + (!r || !1 !== r.validate) && + t.emitValidationErrors( + this, + e.call( + t.validateStyle, + t.extend({ + value: i, + style: { glyphs: !0, sprite: !0 }, + styleSpec: t.spec, + }), + ), + ) + ); + }), + i + ); + })(t.Evented), + x = function (t, e) { + (this.width = t), + (this.height = e), + (this.nextRow = 0), + (this.data = new Uint8Array(this.width * this.height)), + (this.dashEntry = {}); + }; + (x.prototype.getDash = function (t, e) { + var i = t.join(',') + String(e); + return ( + this.dashEntry[i] || (this.dashEntry[i] = this.addDash(t, e)), + this.dashEntry[i] + ); + }), + (x.prototype.getDashRanges = function (t, e, i) { + var r = [], + o = t.length % 2 == 1 ? -t[t.length - 1] * i : 0, + a = t[0] * i, + n = !0; + r.push({ left: o, right: a, isDash: n, zeroLength: 0 === t[0] }); + for (var s = t[0], l = 1; l < t.length; l++) { + var c = t[l]; + r.push({ + left: (o = s * i), + right: (a = (s += c) * i), + isDash: (n = !n), + zeroLength: 0 === c, + }); + } + return r; + }), + (x.prototype.addRoundDash = function (t, e, i) { + for (var r = e / 2, o = -i; o <= i; o++) + for ( + var a = this.width * (this.nextRow + i + o), n = 0, s = t[n], l = 0; + l < this.width; + l++ + ) { + l / s.right > 1 && (s = t[++n]); + var c = Math.abs(l - s.left), + h = Math.abs(l - s.right), + u = Math.min(c, h), + p = void 0, + d = (o / i) * (r + 1); + if (s.isDash) { + var _ = r - Math.abs(d); + p = Math.sqrt(u * u + _ * _); + } else p = r - Math.sqrt(u * u + d * d); + this.data[a + l] = Math.max(0, Math.min(255, p + 128)); + } + }), + (x.prototype.addRegularDash = function (t) { + for (var e = t.length - 1; e >= 0; --e) { + var i = t[e], + r = t[e + 1]; + i.zeroLength + ? t.splice(e, 1) + : r && r.isDash === i.isDash && ((r.left = i.left), t.splice(e, 1)); + } + var o = t[0], + a = t[t.length - 1]; + o.isDash === a.isDash && + ((o.left = a.left - this.width), (a.right = o.right + this.width)); + for ( + var n = this.width * this.nextRow, s = 0, l = t[s], c = 0; + c < this.width; + c++ + ) { + c / l.right > 1 && (l = t[++s]); + var h = Math.abs(c - l.left), + u = Math.abs(c - l.right), + p = Math.min(h, u); + this.data[n + c] = Math.max( + 0, + Math.min(255, (l.isDash ? p : -p) + 128), + ); + } + }), + (x.prototype.addDash = function (e, i) { + var r = i ? 7 : 0, + o = 2 * r + 1; + if (this.nextRow + o > this.height) + return t.warnOnce('LineAtlas out of space'), null; + for (var a = 0, n = 0; n < e.length; n++) a += e[n]; + if (0 !== a) { + var s = this.width / a, + l = this.getDashRanges(e, this.width, s); + i ? this.addRoundDash(l, s, r) : this.addRegularDash(l); + } + var c = { + y: (this.nextRow + r + 0.5) / this.height, + height: (2 * r) / this.height, + width: a, + }; + return (this.nextRow += o), (this.dirty = !0), c; + }), + (x.prototype.bind = function (t) { + var e = t.gl; + this.texture + ? (e.bindTexture(e.TEXTURE_2D, this.texture), + this.dirty && + ((this.dirty = !1), + e.texSubImage2D( + e.TEXTURE_2D, + 0, + 0, + 0, + this.width, + this.height, + e.ALPHA, + e.UNSIGNED_BYTE, + this.data, + ))) + : ((this.texture = e.createTexture()), + e.bindTexture(e.TEXTURE_2D, this.texture), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), + e.texImage2D( + e.TEXTURE_2D, + 0, + e.ALPHA, + this.width, + this.height, + 0, + e.ALPHA, + e.UNSIGNED_BYTE, + this.data, + )); + }); + var b = function e(i, r) { + (this.workerPool = i), + (this.actors = []), + (this.currentActor = 0), + (this.id = t.uniqueId()); + for (var o = this.workerPool.acquire(this.id), a = 0; a < o.length; a++) { + var n = new e.Actor(o[a], r, this.id); + (n.name = 'Worker ' + a), this.actors.push(n); + } + if (!this.actors.length) throw new Error('No actors found'); + }; + function w(e, i, r) { + var o = function (i, o) { + if (i) return r(i); + if (o) { + var a = t.pick(t.extend(o, e), [ + 'tiles', + 'minzoom', + 'maxzoom', + 'attribution', + 'bounds', + 'scheme', + 'tileSize', + 'encoding', + ]); + o.vector_layers && + ((a.vectorLayers = o.vector_layers), + (a.vectorLayerIds = a.vectorLayers.map(function (t) { + return t.id; + }))), + r(null, a); + } + }; + return e.url + ? t.getJSON(i.transformRequest(e.url, t.ResourceType.Source), o) + : t.exported.frame(function () { + return o(null, e); + }); + } + (b.prototype.broadcast = function (e, i, r) { + t.asyncAll( + this.actors, + function (t, r) { + t.send(e, i, r); + }, + (r = r || function () {}), + ); + }), + (b.prototype.getActor = function () { + return ( + (this.currentActor = (this.currentActor + 1) % this.actors.length), + this.actors[this.currentActor] + ); + }), + (b.prototype.remove = function () { + this.actors.forEach(function (t) { + t.remove(); + }), + (this.actors = []), + this.workerPool.release(this.id); + }), + (b.Actor = t.Actor); + var T = function (e, i, r) { + (this.bounds = t.LngLatBounds.convert(this.validateBounds(e))), + (this.minzoom = i || 0), + (this.maxzoom = r || 24); + }; + (T.prototype.validateBounds = function (t) { + return Array.isArray(t) && 4 === t.length + ? [ + Math.max(-180, t[0]), + Math.max(-90, t[1]), + Math.min(180, t[2]), + Math.min(90, t[3]), + ] + : [-180, -90, 180, 90]; + }), + (T.prototype.contains = function (e) { + var i = Math.pow(2, e.z), + r = Math.floor(t.mercatorXfromLng(this.bounds.getWest()) * i), + o = Math.floor(t.mercatorYfromLat(this.bounds.getNorth()) * i), + a = Math.ceil(t.mercatorXfromLng(this.bounds.getEast()) * i), + n = Math.ceil(t.mercatorYfromLat(this.bounds.getSouth()) * i); + return e.x >= r && e.x < a && e.y >= o && e.y < n; + }); + var E, + I = (function (e) { + function i(i, r, o, a) { + if ( + (e.call(this), + (this.id = i), + (this.dispatcher = o), + (this.type = 'vector'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.scheme = 'xyz'), + (this.tileSize = 512), + (this.reparseOverscaled = !0), + (this.isTileClipped = !0), + (this._loaded = !1), + t.extend( + this, + t.pick(r, ['url', 'scheme', 'tileSize', 'promoteId']), + ), + (this._options = t.extend({ type: 'vector' }, r)), + (this._collectResourceTiming = r.collectResourceTiming), + 512 !== this.tileSize) + ) + throw new Error('vector tile sources must have a tileSize of 512'); + this.setEventedParent(a); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function () { + var e = this; + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this._tileJSONRequest = w( + this._options, + this.map._requestManager, + function (i, r) { + (e._tileJSONRequest = null), + (e._loaded = !0), + e.map.style.sourceCaches[e.id].clearTiles(), + i + ? e.fire(new t.ErrorEvent(i)) + : r && + (t.extend(e, r), + r.bounds && + (e.tileBounds = new T( + r.bounds, + e.minzoom, + e.maxzoom, + )), + e.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + ), + e.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + )); + }, + )); + }), + (i.prototype.loaded = function () { + return this._loaded; + }), + (i.prototype.hasTile = function (t) { + return !this.tileBounds || this.tileBounds.contains(t.canonical); + }), + (i.prototype.onAdd = function (t) { + (this.map = t), this.load(); + }), + (i.prototype.setSourceProperty = function (t) { + this._tileJSONRequest && this._tileJSONRequest.cancel(), + t(), + this.load(); + }), + (i.prototype.setTiles = function (t) { + var e = this; + return ( + this.setSourceProperty(function () { + e._options.tiles = t; + }), + this + ); + }), + (i.prototype.setUrl = function (t) { + var e = this; + return ( + this.setSourceProperty(function () { + (e.url = t), (e._options.url = t); + }), + this + ); + }), + (i.prototype.onRemove = function () { + this._tileJSONRequest && + (this._tileJSONRequest.cancel(), (this._tileJSONRequest = null)); + }), + (i.prototype.serialize = function () { + return t.extend({}, this._options); + }), + (i.prototype.loadTile = function (e, i) { + var r = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ), + o = { + request: this.map._requestManager.transformRequest( + r, + t.ResourceType.Tile, + ), + uid: e.uid, + tileID: e.tileID, + zoom: e.tileID.overscaledZ, + tileSize: this.tileSize * e.tileID.overscaleFactor(), + type: this.type, + source: this.id, + pixelRatio: this.map.getPixelRatio(), + showCollisionBoxes: this.map.showCollisionBoxes, + promoteId: this.promoteId, + }; + function a(r, o) { + return ( + delete e.request, + e.aborted + ? i(null) + : r && 404 !== r.status + ? i(r) + : (o && + o.resourceTiming && + (e.resourceTiming = o.resourceTiming), + this.map._refreshExpiredTiles && o && e.setExpiryData(o), + e.loadVectorData(o, this.map.painter), + t.cacheEntryPossiblyAdded(this.dispatcher), + i(null), + void ( + e.reloadCallback && + (this.loadTile(e, e.reloadCallback), + (e.reloadCallback = null)) + )) + ); + } + (o.request.collectResourceTiming = this._collectResourceTiming), + e.actor && 'expired' !== e.state + ? 'loading' === e.state + ? (e.reloadCallback = i) + : (e.request = e.actor.send('reloadTile', o, a.bind(this))) + : ((e.actor = this.dispatcher.getActor()), + (e.request = e.actor.send('loadTile', o, a.bind(this)))); + }), + (i.prototype.abortTile = function (t) { + t.request && (t.request.cancel(), delete t.request), + t.actor && + t.actor.send( + 'abortTile', + { uid: t.uid, type: this.type, source: this.id }, + void 0, + ); + }), + (i.prototype.unloadTile = function (t) { + t.unloadVectorData(), + t.actor && + t.actor.send( + 'removeTile', + { uid: t.uid, type: this.type, source: this.id }, + void 0, + ); + }), + (i.prototype.hasTransition = function () { + return !1; + }), + i + ); + })(t.Evented), + C = (function (e) { + function i(i, r, o, a) { + e.call(this), + (this.id = i), + (this.dispatcher = o), + this.setEventedParent(a), + (this.type = 'raster'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.roundZoom = !0), + (this.scheme = 'xyz'), + (this.tileSize = 512), + (this._loaded = !1), + (this._options = t.extend({ type: 'raster' }, r)), + t.extend(this, t.pick(r, ['url', 'scheme', 'tileSize'])); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function () { + var e = this; + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this._tileJSONRequest = w( + this._options, + this.map._requestManager, + function (i, r) { + (e._tileJSONRequest = null), + (e._loaded = !0), + i + ? e.fire(new t.ErrorEvent(i)) + : r && + (t.extend(e, r), + r.bounds && + (e.tileBounds = new T( + r.bounds, + e.minzoom, + e.maxzoom, + )), + e.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + ), + e.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + )); + }, + )); + }), + (i.prototype.loaded = function () { + return this._loaded; + }), + (i.prototype.onAdd = function (t) { + (this.map = t), this.load(); + }), + (i.prototype.onRemove = function () { + this._tileJSONRequest && + (this._tileJSONRequest.cancel(), (this._tileJSONRequest = null)); + }), + (i.prototype.serialize = function () { + return t.extend({}, this._options); + }), + (i.prototype.hasTile = function (t) { + return !this.tileBounds || this.tileBounds.contains(t.canonical); + }), + (i.prototype.loadTile = function (e, i) { + var r = this, + o = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ); + e.request = t.getImage( + this.map._requestManager.transformRequest(o, t.ResourceType.Tile), + function (o, a, n) { + if ((delete e.request, e.aborted)) + (e.state = 'unloaded'), i(null); + else if (o) (e.state = 'errored'), i(o); + else if (a) { + r.map._refreshExpiredTiles && e.setExpiryData(n); + var s = r.map.painter.context, + c = s.gl; + (e.texture = r.map.painter.getTileTexture(a.width)), + e.texture + ? e.texture.update(a, { useMipmap: !0 }) + : ((e.texture = new l(s, a, c.RGBA, { useMipmap: !0 })), + e.texture.bind( + c.LINEAR, + c.CLAMP_TO_EDGE, + c.LINEAR_MIPMAP_NEAREST, + ), + s.extTextureFilterAnisotropic && + c.texParameterf( + c.TEXTURE_2D, + s.extTextureFilterAnisotropic + .TEXTURE_MAX_ANISOTROPY_EXT, + s.extTextureFilterAnisotropicMax, + )), + (e.state = 'loaded'), + t.cacheEntryPossiblyAdded(r.dispatcher), + i(null); + } + }, + ); + }), + (i.prototype.abortTile = function (t, e) { + t.request && (t.request.cancel(), delete t.request), e(); + }), + (i.prototype.unloadTile = function (t, e) { + t.texture && this.map.painter.saveTileTexture(t.texture), e(); + }), + (i.prototype.hasTransition = function () { + return !1; + }), + i + ); + })(t.Evented), + S = (function (e) { + function i(i, r, o, a) { + e.call(this, i, r, o, a), + (this.type = 'raster-dem'), + (this.maxzoom = 22), + (this._options = t.extend({ type: 'raster-dem' }, r)), + (this.encoding = r.encoding || 'mapbox'); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.serialize = function () { + return { + type: 'raster-dem', + url: this.url, + tileSize: this.tileSize, + tiles: this.tiles, + bounds: this.bounds, + encoding: this.encoding, + }; + }), + (i.prototype.loadTile = function (e, i) { + var r = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ); + function o(t, r) { + t && ((e.state = 'errored'), i(t)), + r && + ((e.dem = r), + (e.needsHillshadePrepare = !0), + (e.needsTerrainPrepare = !0), + (e.state = 'loaded'), + i(null)); + } + (e.request = t.getImage( + this.map._requestManager.transformRequest(r, t.ResourceType.Tile), + function (r, a) { + if ((delete e.request, e.aborted)) + (e.state = 'unloaded'), i(null); + else if (r) (e.state = 'errored'), i(r); + else if (a) { + this.map._refreshExpiredTiles && e.setExpiryData(a), + delete a.cacheControl, + delete a.expires; + var n = + t.isImageBitmap(a) && + (null == E && + (E = + 'undefined' != typeof OffscreenCanvas && + new OffscreenCanvas(1, 1).getContext('2d') && + 'function' == typeof createImageBitmap), + E) + ? a + : t.exported.getImageData(a, 1), + s = { + uid: e.uid, + coord: e.tileID, + source: this.id, + rawImageData: n, + encoding: this.encoding, + }; + (e.actor && 'expired' !== e.state) || + ((e.actor = this.dispatcher.getActor()), + e.actor.send('loadDEMTile', s, o.bind(this))); + } + }.bind(this), + )), + (e.neighboringTiles = this._getNeighboringTiles(e.tileID)); + }), + (i.prototype._getNeighboringTiles = function (e) { + var i = e.canonical, + r = Math.pow(2, i.z), + o = (i.x - 1 + r) % r, + a = 0 === i.x ? e.wrap - 1 : e.wrap, + n = (i.x + 1 + r) % r, + s = i.x + 1 === r ? e.wrap + 1 : e.wrap, + l = {}; + return ( + (l[new t.OverscaledTileID(e.overscaledZ, a, i.z, o, i.y).key] = { + backfilled: !1, + }), + (l[new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y).key] = { + backfilled: !1, + }), + i.y > 0 && + ((l[ + new t.OverscaledTileID(e.overscaledZ, a, i.z, o, i.y - 1).key + ] = { backfilled: !1 }), + (l[ + new t.OverscaledTileID( + e.overscaledZ, + e.wrap, + i.z, + i.x, + i.y - 1, + ).key + ] = { backfilled: !1 }), + (l[ + new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y - 1).key + ] = { backfilled: !1 })), + i.y + 1 < r && + ((l[ + new t.OverscaledTileID(e.overscaledZ, a, i.z, o, i.y + 1).key + ] = { backfilled: !1 }), + (l[ + new t.OverscaledTileID( + e.overscaledZ, + e.wrap, + i.z, + i.x, + i.y + 1, + ).key + ] = { backfilled: !1 }), + (l[ + new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y + 1).key + ] = { backfilled: !1 })), + l + ); + }), + (i.prototype.unloadTile = function (t) { + t.demTexture && this.map.painter.saveTileTexture(t.demTexture), + t.fbo && (t.fbo.destroy(), delete t.fbo), + t.dem && delete t.dem, + delete t.neighboringTiles, + (t.state = 'unloaded'), + t.actor && + t.actor.send('removeDEMTile', { uid: t.uid, source: this.id }); + }), + i + ); + })(C), + D = (function (e) { + function i(i, r, o, a) { + e.call(this), + (this.id = i), + (this.type = 'geojson'), + (this.minzoom = 0), + (this.maxzoom = 18), + (this.tileSize = 512), + (this.isTileClipped = !0), + (this.reparseOverscaled = !0), + (this._removed = !1), + (this._pendingLoads = 0), + (this.actor = o.getActor()), + this.setEventedParent(a), + (this._data = r.data), + (this._options = t.extend({}, r)), + (this._collectResourceTiming = r.collectResourceTiming), + void 0 !== r.maxzoom && (this.maxzoom = r.maxzoom), + r.type && (this.type = r.type), + r.attribution && (this.attribution = r.attribution), + (this.promoteId = r.promoteId); + var n = t.EXTENT / this.tileSize; + this.workerOptions = t.extend( + { + source: this.id, + cluster: r.cluster || !1, + geojsonVtOptions: { + buffer: (void 0 !== r.buffer ? r.buffer : 128) * n, + tolerance: (void 0 !== r.tolerance ? r.tolerance : 0.375) * n, + extent: t.EXTENT, + maxZoom: this.maxzoom, + lineMetrics: r.lineMetrics || !1, + generateId: r.generateId || !1, + }, + superclusterOptions: { + maxZoom: + void 0 !== r.clusterMaxZoom + ? r.clusterMaxZoom + : this.maxzoom - 1, + minPoints: Math.max(2, r.clusterMinPoints || 2), + extent: t.EXTENT, + radius: (r.clusterRadius || 50) * n, + log: !1, + generateId: r.generateId || !1, + }, + clusterProperties: r.clusterProperties, + filter: r.filter, + }, + r.workerOptions, + ); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function () { + this._updateWorkerData('metadata'); + }), + (i.prototype.onAdd = function (t) { + (this.map = t), this.load(); + }), + (i.prototype.setData = function (t) { + return (this._data = t), this._updateWorkerData('content'), this; + }), + (i.prototype.getClusterExpansionZoom = function (t, e) { + return ( + this.actor.send( + 'geojson.getClusterExpansionZoom', + { clusterId: t, source: this.id }, + e, + ), + this + ); + }), + (i.prototype.getClusterChildren = function (t, e) { + return ( + this.actor.send( + 'geojson.getClusterChildren', + { clusterId: t, source: this.id }, + e, + ), + this + ); + }), + (i.prototype.getClusterLeaves = function (t, e, i, r) { + return ( + this.actor.send( + 'geojson.getClusterLeaves', + { source: this.id, clusterId: t, limit: e, offset: i }, + r, + ), + this + ); + }), + (i.prototype._updateWorkerData = function (e) { + var i = this, + r = t.extend({}, this.workerOptions), + o = this._data; + 'string' == typeof o + ? ((r.request = this.map._requestManager.transformRequest( + t.exported.resolveURL(o), + t.ResourceType.Source, + )), + (r.request.collectResourceTiming = this._collectResourceTiming)) + : (r.data = JSON.stringify(o)), + this._pendingLoads++, + this.fire(new t.Event('dataloading', { dataType: 'source' })), + this.actor.send(this.type + '.loadData', r, function (r, o) { + if ((i._pendingLoads--, i._removed || (o && o.abandoned))) + i.fire( + new t.Event('dataabort', { + dataType: 'source', + sourceDataType: e, + }), + ); + else { + var a = null; + if ( + (o && + o.resourceTiming && + o.resourceTiming[i.id] && + (a = o.resourceTiming[i.id].slice(0)), + r) + ) + i.fire(new t.ErrorEvent(r)); + else { + var n = { dataType: 'source', sourceDataType: e }; + i._collectResourceTiming && + a && + a.length > 0 && + t.extend(n, { resourceTiming: a }), + i.fire(new t.Event('data', n)); + } + } + }); + }), + (i.prototype.loaded = function () { + return 0 === this._pendingLoads; + }), + (i.prototype.loadTile = function (t, e) { + var i = this, + r = t.actor ? 'reloadTile' : 'loadTile'; + t.actor = this.actor; + var o = { + type: this.type, + uid: t.uid, + tileID: t.tileID, + zoom: t.tileID.overscaledZ, + maxZoom: this.maxzoom, + tileSize: this.tileSize, + source: this.id, + pixelRatio: this.map.getPixelRatio(), + showCollisionBoxes: this.map.showCollisionBoxes, + promoteId: this.promoteId, + }; + t.request = this.actor.send(r, o, function (o, a) { + return ( + delete t.request, + t.unloadVectorData(), + t.aborted + ? e(null) + : o + ? e(o) + : (t.loadVectorData(a, i.map.painter, 'reloadTile' === r), + e(null)) + ); + }); + }), + (i.prototype.abortTile = function (t) { + t.request && (t.request.cancel(), delete t.request), + (t.aborted = !0); + }), + (i.prototype.unloadTile = function (t) { + t.unloadVectorData(), + this.actor.send('removeTile', { + uid: t.uid, + type: this.type, + source: this.id, + }); + }), + (i.prototype.onRemove = function () { + (this._removed = !0), + this.actor.send('removeSource', { + type: this.type, + source: this.id, + }); + }), + (i.prototype.serialize = function () { + return t.extend({}, this._options, { + type: this.type, + data: this._data, + }); + }), + (i.prototype.hasTransition = function () { + return !1; + }), + i + ); + })(t.Evented), + z = t.createLayout([ + { name: 'a_pos', type: 'Int16', components: 2 }, + { name: 'a_texture_pos', type: 'Int16', components: 2 }, + ]), + P = (function (e) { + function i(t, i, r, o) { + e.call(this), + (this.id = t), + (this.dispatcher = r), + (this.coordinates = i.coordinates), + (this.type = 'image'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.tileSize = 512), + (this.tiles = {}), + (this._loaded = !1), + this.setEventedParent(o), + (this.options = i); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function (e, i) { + var r = this; + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this.url = this.options.url), + t.getImage( + this.map._requestManager.transformRequest( + this.url, + t.ResourceType.Image, + ), + function (o, a) { + (r._loaded = !0), + o + ? r.fire(new t.ErrorEvent(o)) + : a && + ((r.image = a), + e && (r.coordinates = e), + i && i(), + r._finishLoading()); + }, + ); + }), + (i.prototype.loaded = function () { + return this._loaded; + }), + (i.prototype.updateImage = function (t) { + var e = this; + return this.image && t.url + ? ((this.options.url = t.url), + this.load(t.coordinates, function () { + e.texture = null; + }), + this) + : this; + }), + (i.prototype._finishLoading = function () { + this.map && + (this.setCoordinates(this.coordinates), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + )); + }), + (i.prototype.onAdd = function (t) { + (this.map = t), this.load(); + }), + (i.prototype.setCoordinates = function (e) { + var i = this; + this.coordinates = e; + var r = e.map(t.MercatorCoordinate.fromLngLat); + (this.tileID = (function (e) { + for ( + var i = 1 / 0, r = 1 / 0, o = -1 / 0, a = -1 / 0, n = 0, s = e; + n < s.length; + n += 1 + ) { + var l = s[n]; + (i = Math.min(i, l.x)), + (r = Math.min(r, l.y)), + (o = Math.max(o, l.x)), + (a = Math.max(a, l.y)); + } + var c = Math.max(o - i, a - r), + h = Math.max(0, Math.floor(-Math.log(c) / Math.LN2)), + u = Math.pow(2, h); + return new t.CanonicalTileID( + h, + Math.floor(((i + o) / 2) * u), + Math.floor(((r + a) / 2) * u), + ); + })(r)), + (this.minzoom = this.maxzoom = this.tileID.z); + var o = r.map(function (t) { + return i.tileID.getTilePoint(t)._round(); + }); + return ( + (this._boundsArray = new t.RasterBoundsArray()), + this._boundsArray.emplaceBack(o[0].x, o[0].y, 0, 0), + this._boundsArray.emplaceBack(o[1].x, o[1].y, t.EXTENT, 0), + this._boundsArray.emplaceBack(o[3].x, o[3].y, 0, t.EXTENT), + this._boundsArray.emplaceBack(o[2].x, o[2].y, t.EXTENT, t.EXTENT), + this.boundsBuffer && + (this.boundsBuffer.destroy(), delete this.boundsBuffer), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + ), + this + ); + }), + (i.prototype.prepare = function () { + if (0 !== Object.keys(this.tiles).length && this.image) { + var e = this.map.painter.context, + i = e.gl; + for (var r in (this.boundsBuffer || + (this.boundsBuffer = e.createVertexBuffer( + this._boundsArray, + z.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment( + 0, + 0, + 4, + 2, + )), + this.texture || + ((this.texture = new l(e, this.image, i.RGBA)), + this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)), + this.tiles)) { + var o = this.tiles[r]; + 'loaded' !== o.state && + ((o.state = 'loaded'), (o.texture = this.texture)); + } + } + }), + (i.prototype.loadTile = function (t, e) { + this.tileID && this.tileID.equals(t.tileID.canonical) + ? ((this.tiles[String(t.tileID.wrap)] = t), + (t.buckets = {}), + e(null)) + : ((t.state = 'errored'), e(null)); + }), + (i.prototype.serialize = function () { + return { + type: 'image', + url: this.options.url, + coordinates: this.coordinates, + }; + }), + (i.prototype.hasTransition = function () { + return !1; + }), + i + ); + })(t.Evented), + M = (function (e) { + function i(t, i, r, o) { + e.call(this, t, i, r, o), + (this.roundZoom = !0), + (this.type = 'video'), + (this.options = i); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function () { + var e = this; + this._loaded = !1; + var i = this.options; + this.urls = []; + for (var r = 0, o = i.urls; r < o.length; r += 1) + this.urls.push( + this.map._requestManager.transformRequest( + o[r], + t.ResourceType.Source, + ).url, + ); + t.getVideo(this.urls, function (i, r) { + (e._loaded = !0), + i + ? e.fire(new t.ErrorEvent(i)) + : r && + ((e.video = r), + (e.video.loop = !0), + e.video.addEventListener('playing', function () { + e.map.triggerRepaint(); + }), + e.map && e.video.play(), + e._finishLoading()); + }); + }), + (i.prototype.pause = function () { + this.video && this.video.pause(); + }), + (i.prototype.play = function () { + this.video && this.video.play(); + }), + (i.prototype.seek = function (e) { + if (this.video) { + var i = this.video.seekable; + e < i.start(0) || e > i.end(0) + ? this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + this.id, + null, + 'Playback for this video can be set only between the ' + + i.start(0) + + ' and ' + + i.end(0) + + '-second mark.', + ), + ), + ) + : (this.video.currentTime = e); + } + }), + (i.prototype.getVideo = function () { + return this.video; + }), + (i.prototype.onAdd = function (t) { + this.map || + ((this.map = t), + this.load(), + this.video && + (this.video.play(), this.setCoordinates(this.coordinates))); + }), + (i.prototype.prepare = function () { + if ( + !( + 0 === Object.keys(this.tiles).length || + this.video.readyState < 2 + ) + ) { + var e = this.map.painter.context, + i = e.gl; + for (var r in (this.boundsBuffer || + (this.boundsBuffer = e.createVertexBuffer( + this._boundsArray, + z.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment( + 0, + 0, + 4, + 2, + )), + this.texture + ? this.video.paused || + (this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE), + i.texSubImage2D( + i.TEXTURE_2D, + 0, + 0, + 0, + i.RGBA, + i.UNSIGNED_BYTE, + this.video, + )) + : ((this.texture = new l(e, this.video, i.RGBA)), + this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)), + this.tiles)) { + var o = this.tiles[r]; + 'loaded' !== o.state && + ((o.state = 'loaded'), (o.texture = this.texture)); + } + } + }), + (i.prototype.serialize = function () { + return { + type: 'video', + urls: this.urls, + coordinates: this.coordinates, + }; + }), + (i.prototype.hasTransition = function () { + return this.video && !this.video.paused; + }), + i + ); + })(P), + A = (function (e) { + function i(i, r, o, a) { + e.call(this, i, r, o, a), + r.coordinates + ? (Array.isArray(r.coordinates) && + 4 === r.coordinates.length && + !r.coordinates.some(function (t) { + return ( + !Array.isArray(t) || + 2 !== t.length || + t.some(function (t) { + return 'number' != typeof t; + }) + ); + })) || + this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + i, + null, + '"coordinates" property must be an array of 4 longitude/latitude array pairs', + ), + ), + ) + : this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + i, + null, + 'missing required property "coordinates"', + ), + ), + ), + r.animate && + 'boolean' != typeof r.animate && + this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + i, + null, + 'optional "animate" property must be a boolean value', + ), + ), + ), + r.canvas + ? 'string' == typeof r.canvas || + r.canvas instanceof HTMLCanvasElement || + this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + i, + null, + '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance', + ), + ), + ) + : this.fire( + new t.ErrorEvent( + new t.ValidationError( + 'sources.' + i, + null, + 'missing required property "canvas"', + ), + ), + ), + (this.options = r), + (this.animate = void 0 === r.animate || r.animate); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.load = function () { + (this._loaded = !0), + this.canvas || + (this.canvas = + this.options.canvas instanceof HTMLCanvasElement + ? this.options.canvas + : document.getElementById(this.options.canvas)), + (this.width = this.canvas.width), + (this.height = this.canvas.height), + this._hasInvalidDimensions() + ? this.fire( + new t.ErrorEvent( + new Error( + 'Canvas dimensions cannot be less than or equal to zero.', + ), + ), + ) + : ((this.play = function () { + (this._playing = !0), this.map.triggerRepaint(); + }), + (this.pause = function () { + this._playing && (this.prepare(), (this._playing = !1)); + }), + this._finishLoading()); + }), + (i.prototype.getCanvas = function () { + return this.canvas; + }), + (i.prototype.onAdd = function (t) { + (this.map = t), + this.load(), + this.canvas && this.animate && this.play(); + }), + (i.prototype.onRemove = function () { + this.pause(); + }), + (i.prototype.prepare = function () { + var e = !1; + if ( + (this.canvas.width !== this.width && + ((this.width = this.canvas.width), (e = !0)), + this.canvas.height !== this.height && + ((this.height = this.canvas.height), (e = !0)), + !this._hasInvalidDimensions() && + 0 !== Object.keys(this.tiles).length) + ) { + var i = this.map.painter.context, + r = i.gl; + for (var o in (this.boundsBuffer || + (this.boundsBuffer = i.createVertexBuffer( + this._boundsArray, + z.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment( + 0, + 0, + 4, + 2, + )), + this.texture + ? (e || this._playing) && + this.texture.update(this.canvas, { premultiply: !0 }) + : (this.texture = new l(i, this.canvas, r.RGBA, { + premultiply: !0, + })), + this.tiles)) { + var a = this.tiles[o]; + 'loaded' !== a.state && + ((a.state = 'loaded'), (a.texture = this.texture)); + } + } + }), + (i.prototype.serialize = function () { + return { type: 'canvas', coordinates: this.coordinates }; + }), + (i.prototype.hasTransition = function () { + return this._playing; + }), + (i.prototype._hasInvalidDimensions = function () { + for ( + var t = 0, e = [this.canvas.width, this.canvas.height]; + t < e.length; + t += 1 + ) { + var i = e[t]; + if (isNaN(i) || i <= 0) return !0; + } + return !1; + }), + i + ); + })(P), + R = { + vector: I, + raster: C, + 'raster-dem': S, + geojson: D, + video: M, + image: P, + canvas: A, + }; + function L(e, i) { + var r = t.create(); + return ( + t.translate(r, r, [1, 1, 0]), + t.scale(r, r, [0.5 * e.width, 0.5 * e.height, 1]), + t.multiply(r, r, e.calculatePosMatrix(i.toUnwrapped())) + ); + } + function k(t, e, i, r, o, a) { + var n = (function (t, e, i) { + if (t) + for (var r = 0, o = t; r < o.length; r += 1) { + var a = e[o[r]]; + if (a && a.source === i && 'fill-extrusion' === a.type) return !0; + } + else + for (var n in e) { + var s = e[n]; + if (s.source === i && 'fill-extrusion' === s.type) return !0; + } + return !1; + })(o && o.layers, e, t.id), + s = a.maxPitchScaleFactor(), + l = t.tilesIn(r, s, n); + l.sort(B); + for (var c = [], h = 0, u = l; h < u.length; h += 1) { + var p = u[h]; + c.push({ + wrappedTileID: p.tileID.wrapped().key, + queryResults: p.tile.queryRenderedFeatures( + e, + i, + t._state, + p.queryGeometry, + p.cameraQueryGeometry, + p.scale, + o, + a, + s, + L(t.transform, p.tileID), + ), + }); + } + var d = (function (t) { + for (var e = {}, i = {}, r = 0, o = t; r < o.length; r += 1) { + var a = o[r], + n = a.queryResults, + s = a.wrappedTileID, + l = (i[s] = i[s] || {}); + for (var c in n) + for ( + var h = n[c], + u = (l[c] = l[c] || {}), + p = (e[c] = e[c] || []), + d = 0, + _ = h; + d < _.length; + d += 1 + ) { + var f = _[d]; + u[f.featureIndex] || ((u[f.featureIndex] = !0), p.push(f)); + } + } + return e; + })(c); + for (var _ in d) + d[_].forEach(function (e) { + var i = e.feature, + r = t.getFeatureState(i.layer['source-layer'], i.id); + (i.source = i.layer.source), + i.layer['source-layer'] && + (i.sourceLayer = i.layer['source-layer']), + (i.state = r); + }); + return d; + } + function B(t, e) { + var i = t.tileID, + r = e.tileID; + return ( + i.overscaledZ - r.overscaledZ || + i.canonical.y - r.canonical.y || + i.wrap - r.wrap || + i.canonical.x - r.canonical.x + ); + } + var O = function (e, i) { + (this.tileID = e), + (this.uid = t.uniqueId()), + (this.uses = 0), + (this.tileSize = i), + (this.buckets = {}), + (this.expirationTime = null), + (this.queryPadding = 0), + (this.hasSymbolBuckets = !1), + (this.hasRTLText = !1), + (this.dependencies = {}), + (this.textures = []), + (this.textureCoords = {}), + (this.expiredRequestCount = 0), + (this.state = 'loading'); + }; + (O.prototype.registerFadeDuration = function (e) { + var i = e + this.timeAdded; + i < t.exported.now() || + (this.fadeEndTime && i < this.fadeEndTime) || + (this.fadeEndTime = i); + }), + (O.prototype.wasRequested = function () { + return ( + 'errored' === this.state || + 'loaded' === this.state || + 'reloading' === this.state + ); + }), + (O.prototype.clearTextures = function (t) { + this.demTexture && t.saveTileTexture(this.demTexture), + this.textures.forEach(function (e) { + return t.saveTileTexture(e); + }), + (this.demTexture = null), + (this.textures = []), + (this.textureCoords = {}); + }), + (O.prototype.loadVectorData = function (e, i, r) { + if ( + (this.hasData() && this.unloadVectorData(), + (this.state = 'loaded'), + e) + ) { + for (var o 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 (t, e) { + var i = {}; + if (!e) return i; + for ( + var r = function () { + var t = a[o], + r = t.layerIds + .map(function (t) { + return e.getLayer(t); + }) + .filter(Boolean); + if (0 !== r.length) { + (t.layers = r), + t.stateDependentLayerIds && + (t.stateDependentLayers = t.stateDependentLayerIds.map( + function (t) { + return r.filter(function (e) { + return e.id === t; + })[0]; + }, + )); + for (var n = 0, s = r; n < s.length; n += 1) i[s[n].id] = t; + } + }, + o = 0, + a = t; + o < a.length; + o += 1 + ) + r(); + return i; + })(e.buckets, i.style)), + (this.hasSymbolBuckets = !1), + this.buckets)) { + var a = this.buckets[o]; + if (a instanceof t.SymbolBucket) { + if (((this.hasSymbolBuckets = !0), !r)) break; + a.justReloaded = !0; + } + } + if (((this.hasRTLText = !1), this.hasSymbolBuckets)) + for (var n in this.buckets) { + var s = this.buckets[n]; + if (s instanceof t.SymbolBucket && s.hasRTLText) { + (this.hasRTLText = !0), t.lazyLoadRTLTextPlugin(); + break; + } + } + for (var l in ((this.queryPadding = 0), this.buckets)) { + var c = this.buckets[l]; + this.queryPadding = Math.max( + this.queryPadding, + i.style.getLayer(l).queryRadius(c), + ); + } + e.imageAtlas && (this.imageAtlas = e.imageAtlas), + e.glyphAtlasImage && (this.glyphAtlasImage = e.glyphAtlasImage); + } else this.collisionBoxArray = new t.CollisionBoxArray(); + }), + (O.prototype.unloadVectorData = function () { + for (var t in this.buckets) this.buckets[t].destroy(); + (this.buckets = {}), + this.imageAtlasTexture && this.imageAtlasTexture.destroy(), + this.imageAtlas && (this.imageAtlas = null), + this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), + (this.latestFeatureIndex = null), + (this.state = 'unloaded'); + }), + (O.prototype.getBucket = function (t) { + return this.buckets[t.id]; + }), + (O.prototype.upload = function (t) { + for (var e in this.buckets) { + var i = this.buckets[e]; + i.uploadPending() && i.upload(t); + } + var r = t.gl; + this.imageAtlas && + !this.imageAtlas.uploaded && + ((this.imageAtlasTexture = new l(t, this.imageAtlas.image, r.RGBA)), + (this.imageAtlas.uploaded = !0)), + this.glyphAtlasImage && + ((this.glyphAtlasTexture = new l(t, this.glyphAtlasImage, r.ALPHA)), + (this.glyphAtlasImage = null)); + }), + (O.prototype.prepare = function (t) { + this.imageAtlas && + this.imageAtlas.patchUpdatedImages(t, this.imageAtlasTexture); + }), + (O.prototype.queryRenderedFeatures = function ( + t, + e, + i, + r, + o, + a, + n, + s, + l, + c, + ) { + return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData + ? this.latestFeatureIndex.query( + { + queryGeometry: r, + cameraQueryGeometry: o, + scale: a, + tileSize: this.tileSize, + pixelPosMatrix: c, + transform: s, + params: n, + queryPadding: this.queryPadding * l, + }, + t, + e, + i, + ) + : {}; + }), + (O.prototype.querySourceFeatures = function (e, i) { + var r = this.latestFeatureIndex; + if (r && r.rawTileData) { + var o = r.loadVTLayers(), + a = i ? i.sourceLayer : '', + n = o._geojsonTileLayer || o[a]; + if (n) + for ( + var s = t.createFilter(i && i.filter), + l = this.tileID.canonical, + c = l.z, + h = l.x, + u = l.y, + p = { z: c, x: h, y: u }, + d = 0; + d < n.length; + d++ + ) { + var _ = n.feature(d); + if (s.needGeometry) { + var f = t.toEvaluationFeature(_, !0); + if ( + !s.filter( + new t.EvaluationParameters(this.tileID.overscaledZ), + f, + this.tileID.canonical, + ) + ) + continue; + } else if ( + !s.filter( + new t.EvaluationParameters(this.tileID.overscaledZ), + _, + ) + ) + continue; + var m = r.getId(_, a), + g = new t.GeoJSONFeature(_, c, h, u, m); + (g.tile = p), e.push(g); + } + } + }), + (O.prototype.hasData = function () { + return ( + 'loaded' === this.state || + 'reloading' === this.state || + 'expired' === this.state + ); + }), + (O.prototype.patternsLoaded = function () { + return ( + this.imageAtlas && + !!Object.keys(this.imageAtlas.patternPositions).length + ); + }), + (O.prototype.setExpiryData = function (e) { + var i = this.expirationTime; + if (e.cacheControl) { + var r = t.parseCacheControl(e.cacheControl); + r['max-age'] && + (this.expirationTime = Date.now() + 1e3 * r['max-age']); + } else + e.expires && (this.expirationTime = new Date(e.expires).getTime()); + if (this.expirationTime) { + var o = Date.now(), + a = !1; + if (this.expirationTime > o) a = !1; + else if (i) + if (this.expirationTime < i) a = !0; + else { + var n = this.expirationTime - i; + n ? (this.expirationTime = o + Math.max(n, 3e4)) : (a = !0); + } + else a = !0; + a + ? (this.expiredRequestCount++, (this.state = 'expired')) + : (this.expiredRequestCount = 0); + } + }), + (O.prototype.getExpiryTimeout = function () { + if (this.expirationTime) + return this.expiredRequestCount + ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) + : Math.min( + this.expirationTime - new Date().getTime(), + Math.pow(2, 31) - 1, + ); + }), + (O.prototype.setFeatureState = function (t, e) { + if ( + this.latestFeatureIndex && + this.latestFeatureIndex.rawTileData && + 0 !== Object.keys(t).length + ) { + var i = this.latestFeatureIndex.loadVTLayers(); + for (var r in this.buckets) + if (e.style.hasLayer(r)) { + var o = this.buckets[r], + a = o.layers[0].sourceLayer || '_geojsonTileLayer', + n = i[a], + s = t[a]; + if (n && s && 0 !== Object.keys(s).length) { + o.update( + s, + n, + (this.imageAtlas && this.imageAtlas.patternPositions) || {}, + ); + var l = e && e.style && e.style.getLayer(r); + l && + (this.queryPadding = Math.max( + this.queryPadding, + l.queryRadius(o), + )); + } + } + } + }), + (O.prototype.holdingForFade = function () { + return void 0 !== this.symbolFadeHoldUntil; + }), + (O.prototype.symbolFadeFinished = function () { + return ( + !this.symbolFadeHoldUntil || + this.symbolFadeHoldUntil < t.exported.now() + ); + }), + (O.prototype.clearFadeHold = function () { + this.symbolFadeHoldUntil = void 0; + }), + (O.prototype.setHoldDuration = function (e) { + this.symbolFadeHoldUntil = t.exported.now() + e; + }), + (O.prototype.setDependencies = function (t, e) { + for (var i = {}, r = 0, o = e; r < o.length; r += 1) i[o[r]] = !0; + this.dependencies[t] = i; + }), + (O.prototype.hasDependency = function (t, e) { + for (var i = 0, r = t; i < r.length; i += 1) { + var o = this.dependencies[r[i]]; + if (o) + for (var a = 0, n = e; a < n.length; a += 1) if (o[n[a]]) return !0; + } + return !1; + }); + var F = function (t, e) { + (this.max = t), (this.onRemove = e), this.reset(); + }; + (F.prototype.reset = function () { + for (var t in this.data) + for (var e = 0, i = this.data[t]; e < i.length; e += 1) { + var r = i[e]; + r.timeout && clearTimeout(r.timeout), this.onRemove(r.value); + } + return (this.data = {}), (this.order = []), this; + }), + (F.prototype.add = function (t, e, i) { + var r = this, + o = t.wrapped().key; + void 0 === this.data[o] && (this.data[o] = []); + var a = { value: e, timeout: void 0 }; + if ( + (void 0 !== i && + (a.timeout = setTimeout(function () { + r.remove(t, a); + }, i)), + this.data[o].push(a), + this.order.push(o), + this.order.length > this.max) + ) { + var n = this._getAndRemoveByKey(this.order[0]); + n && this.onRemove(n); + } + return this; + }), + (F.prototype.has = function (t) { + return t.wrapped().key in this.data; + }), + (F.prototype.getAndRemove = function (t) { + return this.has(t) ? this._getAndRemoveByKey(t.wrapped().key) : null; + }), + (F.prototype._getAndRemoveByKey = function (t) { + var e = this.data[t].shift(); + return ( + e.timeout && clearTimeout(e.timeout), + 0 === this.data[t].length && delete this.data[t], + this.order.splice(this.order.indexOf(t), 1), + e.value + ); + }), + (F.prototype.getByKey = function (t) { + var e = this.data[t]; + return e ? e[0].value : null; + }), + (F.prototype.get = function (t) { + return this.has(t) ? this.data[t.wrapped().key][0].value : null; + }), + (F.prototype.remove = function (t, e) { + if (!this.has(t)) return this; + var i = t.wrapped().key, + r = void 0 === e ? 0 : this.data[i].indexOf(e), + o = this.data[i][r]; + return ( + this.data[i].splice(r, 1), + o.timeout && clearTimeout(o.timeout), + 0 === this.data[i].length && delete this.data[i], + this.onRemove(o.value), + this.order.splice(this.order.indexOf(i), 1), + this + ); + }), + (F.prototype.setMaxSize = function (t) { + for (this.max = t; this.order.length > this.max; ) { + var e = this._getAndRemoveByKey(this.order[0]); + e && this.onRemove(e); + } + return this; + }), + (F.prototype.filter = function (t) { + var e = []; + for (var i in this.data) + for (var r = 0, o = this.data[i]; r < o.length; r += 1) { + var a = o[r]; + t(a.value) || e.push(a); + } + for (var n = 0, s = e; n < s.length; n += 1) { + var l = s[n]; + this.remove(l.value.tileID, l); + } + }); + var U = function () { + (this.state = {}), (this.stateChanges = {}), (this.deletedStates = {}); + }; + (U.prototype.updateState = function (e, i, r) { + var o = String(i); + if ( + ((this.stateChanges[e] = this.stateChanges[e] || {}), + (this.stateChanges[e][o] = this.stateChanges[e][o] || {}), + t.extend(this.stateChanges[e][o], r), + null === this.deletedStates[e]) + ) + for (var a in ((this.deletedStates[e] = {}), this.state[e])) + a !== o && (this.deletedStates[e][a] = null); + else if (this.deletedStates[e] && null === this.deletedStates[e][o]) + for (var n in ((this.deletedStates[e][o] = {}), this.state[e][o])) + r[n] || (this.deletedStates[e][o][n] = null); + else + for (var s in r) + this.deletedStates[e] && + this.deletedStates[e][o] && + null === this.deletedStates[e][o][s] && + delete this.deletedStates[e][o][s]; + }), + (U.prototype.removeFeatureState = function (t, e, i) { + if (null !== this.deletedStates[t]) { + var r = String(e); + if ( + ((this.deletedStates[t] = this.deletedStates[t] || {}), + i && void 0 !== e) + ) + null !== this.deletedStates[t][r] && + ((this.deletedStates[t][r] = this.deletedStates[t][r] || {}), + (this.deletedStates[t][r][i] = null)); + else if (void 0 !== e) + if (this.stateChanges[t] && this.stateChanges[t][r]) + for (i in ((this.deletedStates[t][r] = {}), + this.stateChanges[t][r])) + this.deletedStates[t][r][i] = null; + else this.deletedStates[t][r] = null; + else this.deletedStates[t] = null; + } + }), + (U.prototype.getState = function (e, i) { + var r = String(i), + o = t.extend( + {}, + (this.state[e] || {})[r], + (this.stateChanges[e] || {})[r], + ); + if (null === this.deletedStates[e]) return {}; + if (this.deletedStates[e]) { + var a = this.deletedStates[e][i]; + if (null === a) return {}; + for (var n in a) delete o[n]; + } + return o; + }), + (U.prototype.initializeTileState = function (t, e) { + t.setFeatureState(this.state, e); + }), + (U.prototype.coalesceChanges = function (e, i) { + var r = {}; + for (var o in this.stateChanges) { + this.state[o] = this.state[o] || {}; + var a = {}; + for (var n in this.stateChanges[o]) + this.state[o][n] || (this.state[o][n] = {}), + t.extend(this.state[o][n], this.stateChanges[o][n]), + (a[n] = this.state[o][n]); + r[o] = a; + } + for (var s in this.deletedStates) { + this.state[s] = this.state[s] || {}; + var l = {}; + if (null === this.deletedStates[s]) + for (var c in this.state[s]) (l[c] = {}), (this.state[s][c] = {}); + else + for (var h in this.deletedStates[s]) { + if (null === this.deletedStates[s][h]) this.state[s][h] = {}; + else + for ( + var u = 0, p = Object.keys(this.deletedStates[s][h]); + u < p.length; + u += 1 + ) + delete this.state[s][h][p[u]]; + l[h] = this.state[s][h]; + } + (r[s] = r[s] || {}), t.extend(r[s], l); + } + if ( + ((this.stateChanges = {}), + (this.deletedStates = {}), + 0 !== Object.keys(r).length) + ) + for (var d in e) e[d].setFeatureState(r, i); + }); + var N = (function (e) { + function i(i, r, o) { + var a = this; + e.call(this), + (this.id = i), + (this.dispatcher = o), + this.on('data', function (t) { + 'source' === t.dataType && + 'metadata' === t.sourceDataType && + (a._sourceLoaded = !0), + a._sourceLoaded && + !a._paused && + 'source' === t.dataType && + 'content' === t.sourceDataType && + (a.reload(), a.transform && a.update(a.transform, a.terrain)); + }), + this.on('dataloading', function () { + a._sourceErrored = !1; + }), + this.on('error', function () { + a._sourceErrored = a._source.loaded(); + }), + (this._source = (function (e, i, r, o) { + var a = new R[i.type](e, i, r, o); + if (a.id !== e) + throw new Error( + 'Expected Source id to be ' + e + ' instead of ' + a.id, + ); + return ( + t.bindAll(['load', 'abort', 'unload', 'serialize', 'prepare'], a), + a + ); + })(i, r, o, this)), + (this._tiles = {}), + (this._cache = new F(0, this._unloadTile.bind(this))), + (this._timers = {}), + (this._cacheTimers = {}), + (this._maxTileCacheSize = null), + (this._loadedParentTiles = {}), + (this._coveredTiles = {}), + (this._state = new U()); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.onAdd = function (t) { + (this.map = t), + (this._maxTileCacheSize = t ? t._maxTileCacheSize : null), + this._source && this._source.onAdd && this._source.onAdd(t); + }), + (i.prototype.onRemove = function (t) { + this.clearTiles(), + this._source && this._source.onRemove && this._source.onRemove(t); + }), + (i.prototype.loaded = function () { + if (this._sourceErrored) return !0; + if (!this._sourceLoaded) return !1; + if (!this._source.loaded()) return !1; + for (var t in this._tiles) { + var e = this._tiles[t]; + if ('loaded' !== e.state && 'errored' !== e.state) return !1; + } + return !0; + }), + (i.prototype.getSource = function () { + return this._source; + }), + (i.prototype.pause = function () { + this._paused = !0; + }), + (i.prototype.resume = function () { + if (this._paused) { + var t = this._shouldReloadOnResume; + (this._paused = !1), + (this._shouldReloadOnResume = !1), + t && this.reload(), + this.transform && this.update(this.transform, this.terrain); + } + }), + (i.prototype._loadTile = function (t, e) { + return this._source.loadTile(t, e); + }), + (i.prototype._unloadTile = function (t) { + if (this._source.unloadTile) + return this._source.unloadTile(t, function () {}); + }), + (i.prototype._abortTile = function (e) { + this._source.abortTile && this._source.abortTile(e, function () {}), + this._source.fire( + new t.Event('dataabort', { + tile: e, + coord: e.tileID, + dataType: 'source', + }), + ); + }), + (i.prototype.serialize = function () { + return this._source.serialize(); + }), + (i.prototype.prepare = function (t) { + for (var e in (this._source.prepare && this._source.prepare(), + this._state.coalesceChanges( + this._tiles, + this.map ? this.map.painter : null, + ), + this._tiles)) { + var i = this._tiles[e]; + i.upload(t), i.prepare(this.map.style.imageManager); + } + }), + (i.prototype.getIds = function () { + return t + .values(this._tiles) + .map(function (t) { + return t.tileID; + }) + .sort(G) + .map(function (t) { + return t.key; + }); + }), + (i.prototype.getRenderableIds = function (e) { + var i = this, + r = []; + for (var o in this._tiles) + this._isIdRenderable(o, e) && r.push(this._tiles[o]); + return e + ? r + .sort(function (e, r) { + var o = e.tileID, + a = r.tileID, + n = new t.pointGeometry( + o.canonical.x, + o.canonical.y, + )._rotate(i.transform.angle), + s = new t.pointGeometry( + a.canonical.x, + a.canonical.y, + )._rotate(i.transform.angle); + return ( + o.overscaledZ - a.overscaledZ || s.y - n.y || s.x - n.x + ); + }) + .map(function (t) { + return t.tileID.key; + }) + : r + .map(function (t) { + return t.tileID; + }) + .sort(G) + .map(function (t) { + return t.key; + }); + }), + (i.prototype.hasRenderableParent = function (t) { + var e = this.findLoadedParent(t, 0); + return !!e && this._isIdRenderable(e.tileID.key); + }), + (i.prototype._isIdRenderable = function (t, e) { + return ( + this._tiles[t] && + this._tiles[t].hasData() && + !this._coveredTiles[t] && + (e || !this._tiles[t].holdingForFade()) + ); + }), + (i.prototype.reload = function () { + if (this._paused) this._shouldReloadOnResume = !0; + else + for (var t in (this._cache.reset(), this._tiles)) + 'errored' !== this._tiles[t].state && + this._reloadTile(t, 'reloading'); + }), + (i.prototype._reloadTile = function (t, e) { + var i = this._tiles[t]; + i && + ('loading' !== i.state && (i.state = e), + this._loadTile(i, this._tileLoaded.bind(this, i, t, e))); + }), + (i.prototype._tileLoaded = function (e, i, r, o) { + if (o) + return ( + (e.state = 'errored'), + void (404 !== o.status + ? this._source.fire(new t.ErrorEvent(o, { tile: e })) + : this.update(this.transform, this.terrain)) + ); + (e.timeAdded = t.exported.now()), + 'expired' === r && (e.refreshedUponExpiration = !0), + this._setTileReloadTimer(i, e), + 'raster-dem' === this.getSource().type && + e.dem && + this._backfillDEM(e), + this._state.initializeTileState( + e, + this.map ? this.map.painter : null, + ), + e.aborted || + this._source.fire( + new t.Event('data', { + dataType: 'source', + tile: e, + coord: e.tileID, + }), + ); + }), + (i.prototype._backfillDEM = function (t) { + for (var e = this.getRenderableIds(), i = 0; i < e.length; i++) { + var r = e[i]; + if (t.neighboringTiles && t.neighboringTiles[r]) { + var o = this.getTileByID(r); + a(t, o), a(o, t); + } + } + function a(t, e) { + (t.needsHillshadePrepare = !0), (t.needsTerrainPrepare = !0); + var i = e.tileID.canonical.x - t.tileID.canonical.x, + r = e.tileID.canonical.y - t.tileID.canonical.y, + o = Math.pow(2, t.tileID.canonical.z), + a = e.tileID.key; + (0 === i && 0 === r) || + Math.abs(r) > 1 || + (Math.abs(i) > 1 && + (1 === Math.abs(i + o) + ? (i += o) + : 1 === Math.abs(i - o) && (i -= o)), + e.dem && + t.dem && + (t.dem.backfillBorder(e.dem, i, r), + t.neighboringTiles && + t.neighboringTiles[a] && + (t.neighboringTiles[a].backfilled = !0))); + } + }), + (i.prototype.getTile = function (t) { + return this.getTileByID(t.key); + }), + (i.prototype.getTileByID = function (t) { + return this._tiles[t]; + }), + (i.prototype._retainLoadedChildren = function (t, e, i, r) { + for (var o in this._tiles) { + var a = this._tiles[o]; + if ( + !( + r[o] || + !a.hasData() || + a.tileID.overscaledZ <= e || + a.tileID.overscaledZ > i + ) + ) { + for (var n = a.tileID; a && a.tileID.overscaledZ > e + 1; ) { + var s = a.tileID.scaledTo(a.tileID.overscaledZ - 1); + (a = this._tiles[s.key]) && a.hasData() && (n = s); + } + for (var l = n; l.overscaledZ > e; ) + if (t[(l = l.scaledTo(l.overscaledZ - 1)).key]) { + r[n.key] = n; + break; + } + } + } + }), + (i.prototype.findLoadedParent = function (t, e) { + if (t.key in this._loadedParentTiles) { + var i = this._loadedParentTiles[t.key]; + return i && i.tileID.overscaledZ >= e ? i : null; + } + for (var r = t.overscaledZ - 1; r >= e; r--) { + var o = t.scaledTo(r), + a = this._getLoadedTile(o); + if (a) return a; + } + }), + (i.prototype._getLoadedTile = function (t) { + var e = this._tiles[t.key]; + return e && e.hasData() ? e : this._cache.getByKey(t.wrapped().key); + }), + (i.prototype.updateCacheSize = function (t) { + var e = Math.ceil(t.width / this._source.tileSize) + 1, + i = Math.ceil(t.height / this._source.tileSize) + 1, + r = Math.floor(e * i * 5), + o = + 'number' == typeof this._maxTileCacheSize + ? Math.min(this._maxTileCacheSize, r) + : r; + this._cache.setMaxSize(o); + }), + (i.prototype.handleWrapJump = function (t) { + var e = Math.round( + (t - (void 0 === this._prevLng ? t : this._prevLng)) / 360, + ); + if (((this._prevLng = t), e)) { + var i = {}; + for (var r in this._tiles) { + var o = this._tiles[r]; + (o.tileID = o.tileID.unwrapTo(o.tileID.wrap + e)), + (i[o.tileID.key] = o); + } + for (var a in ((this._tiles = i), this._timers)) + clearTimeout(this._timers[a]), delete this._timers[a]; + for (var n in this._tiles) + this._setTileReloadTimer(n, this._tiles[n]); + } + }), + (i.prototype.update = function (e, r) { + var o = this; + if ( + ((this.transform = e), + (this.terrain = r), + this._sourceLoaded && !this._paused) + ) { + var a; + this.updateCacheSize(e), + 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 t.OverscaledTileID( + e.canonical.z, + e.wrap, + e.canonical.z, + e.canonical.x, + e.canonical.y, + ); + })) + : ((a = e.coveringTiles({ + tileSize: this.usedForTerrain + ? this.tileSize + : this._source.tileSize, + minzoom: this._source.minzoom, + maxzoom: this._source.maxzoom, + roundZoom: !this.usedForTerrain && this._source.roundZoom, + reparseOverscaled: this._source.reparseOverscaled, + terrain: r, + })), + this._source.hasTile && + (a = a.filter(function (t) { + return o._source.hasTile(t); + }))) + : (a = []); + var n = e.coveringZoomLevel(this._source), + s = Math.max(n - i.maxOverzooming, this._source.minzoom), + l = Math.max(n + i.maxUnderzooming, this._source.minzoom); + if (this.usedForTerrain) { + for (var c = {}, h = 0, u = a; h < u.length; h += 1) { + var p = u[h]; + if (p.canonical.z > this._source.minzoom) { + var d = p.scaledTo(p.canonical.z - 1); + c[d.key] = d; + var _ = p.scaledTo( + Math.max(this._source.minzoom, Math.min(p.canonical.z, 5)), + ); + c[_.key] = _; + } + } + a = a.concat(Object.values(c)); + } + var f = this._updateRetainedTiles(a, n); + if (j(this._source.type)) { + for ( + var m = {}, g = {}, v = 0, y = Object.keys(f); + v < y.length; + v += 1 + ) { + var x = y[v], + b = f[x], + w = this._tiles[x]; + if ( + w && + !(w.fadeEndTime && w.fadeEndTime <= t.exported.now()) + ) { + var T = this.findLoadedParent(b, s); + T && (this._addTile(T.tileID), (m[T.tileID.key] = T.tileID)), + (g[x] = b); + } + } + for (var E in (this._retainLoadedChildren(g, n, l, f), m)) + f[E] || ((this._coveredTiles[E] = !0), (f[E] = m[E])); + if (r) { + for (var I = {}, C = {}, S = 0, D = a; S < D.length; S += 1) { + var z = D[S]; + this._tiles[z.key].hasData() + ? (I[z.key] = z) + : (C[z.key] = z); + } + for (var P in C) { + var M = C[P].children(this._source.maxzoom); + this._tiles[M[0].key] && + this._tiles[M[1].key] && + this._tiles[M[2].key] && + this._tiles[M[3].key] && + ((I[M[0].key] = f[M[0].key] = M[0]), + (I[M[1].key] = f[M[1].key] = M[1]), + (I[M[2].key] = f[M[2].key] = M[2]), + (I[M[3].key] = f[M[3].key] = M[3]), + delete C[P]); + } + for (var A in C) { + var R = this.findLoadedParent(C[A], this._source.minzoom); + if (R) + for (var L in ((I[R.tileID.key] = f[R.tileID.key] = + R.tileID), + I)) + I[L].isChildOf(R.tileID) && delete I[L]; + } + for (var k in this._tiles) I[k] || (this._coveredTiles[k] = !0); + } + } + for (var B in f) this._tiles[B].clearFadeHold(); + for ( + var O = 0, F = t.keysDifference(this._tiles, f); + O < F.length; + O += 1 + ) { + var U = F[O], + N = this._tiles[U]; + N.hasSymbolBuckets && !N.holdingForFade() + ? N.setHoldDuration(this.map._fadeDuration) + : (N.hasSymbolBuckets && !N.symbolFadeFinished()) || + this._removeTile(U); + } + this._updateLoadedParentTileCache(); + } + }), + (i.prototype.releaseSymbolFadeTiles = function () { + for (var t in this._tiles) + this._tiles[t].holdingForFade() && this._removeTile(t); + }), + (i.prototype._updateRetainedTiles = function (t, e) { + for ( + var r = {}, + o = {}, + a = Math.max(e - i.maxOverzooming, this._source.minzoom), + n = Math.max(e + i.maxUnderzooming, this._source.minzoom), + s = {}, + l = 0, + c = t; + l < c.length; + l += 1 + ) { + var h = c[l], + u = this._addTile(h); + (r[h.key] = h), + u.hasData() || (e < this._source.maxzoom && (s[h.key] = h)); + } + this._retainLoadedChildren(s, e, n, r); + for (var p = 0, d = t; p < d.length; p += 1) { + var _ = d[p], + f = this._tiles[_.key]; + if (!f.hasData()) { + if (e + 1 > this._source.maxzoom) { + var m = _.children(this._source.maxzoom)[0], + g = this.getTile(m); + if (g && g.hasData()) { + r[m.key] = m; + continue; + } + } else { + var v = _.children(this._source.maxzoom); + if (r[v[0].key] && r[v[1].key] && r[v[2].key] && r[v[3].key]) + continue; + } + for ( + var y = f.wasRequested(), x = _.overscaledZ - 1; + x >= a; + --x + ) { + var b = _.scaledTo(x); + if (o[b.key]) break; + if ( + ((o[b.key] = !0), + !(f = this.getTile(b)) && y && (f = this._addTile(b)), + f && ((r[b.key] = b), (y = f.wasRequested()), f.hasData())) + ) + break; + } + } + } + return r; + }), + (i.prototype._updateLoadedParentTileCache = function () { + for (var t in ((this._loadedParentTiles = {}), this._tiles)) { + for ( + var e = [], i = void 0, r = this._tiles[t].tileID; + r.overscaledZ > 0; + + ) { + if (r.key in this._loadedParentTiles) { + i = this._loadedParentTiles[r.key]; + break; + } + e.push(r.key); + var o = r.scaledTo(r.overscaledZ - 1); + if ((i = this._getLoadedTile(o))) break; + r = o; + } + for (var a = 0, n = e; a < n.length; a += 1) + this._loadedParentTiles[n[a]] = i; + } + }), + (i.prototype._addTile = function (e) { + var i = this._tiles[e.key]; + if (i) return i; + (i = this._cache.getAndRemove(e)) && + (this._setTileReloadTimer(e.key, i), + (i.tileID = e), + this._state.initializeTileState( + i, + this.map ? this.map.painter : null, + ), + this._cacheTimers[e.key] && + (clearTimeout(this._cacheTimers[e.key]), + delete this._cacheTimers[e.key], + this._setTileReloadTimer(e.key, i))); + var r = i; + return ( + i || + ((i = new O(e, this._source.tileSize * e.overscaleFactor())), + this._loadTile( + i, + this._tileLoaded.bind(this, i, e.key, i.state), + )), + i.uses++, + (this._tiles[e.key] = i), + r || + this._source.fire( + new t.Event('dataloading', { + tile: i, + coord: i.tileID, + dataType: 'source', + }), + ), + i + ); + }), + (i.prototype._setTileReloadTimer = function (t, e) { + var i = this; + t in this._timers && + (clearTimeout(this._timers[t]), delete this._timers[t]); + var r = e.getExpiryTimeout(); + r && + (this._timers[t] = setTimeout(function () { + i._reloadTile(t, 'expired'), delete i._timers[t]; + }, r)); + }), + (i.prototype._removeTile = function (t) { + var e = this._tiles[t]; + e && + (e.uses--, + delete this._tiles[t], + this._timers[t] && + (clearTimeout(this._timers[t]), delete this._timers[t]), + e.uses > 0 || + (e.hasData() && 'reloading' !== e.state + ? this._cache.add(e.tileID, e, e.getExpiryTimeout()) + : ((e.aborted = !0), this._abortTile(e), this._unloadTile(e)))); + }), + (i.prototype.clearTiles = function () { + for (var t in ((this._shouldReloadOnResume = !1), + (this._paused = !1), + this._tiles)) + this._removeTile(t); + this._cache.reset(); + }), + (i.prototype.tilesIn = function (e, i, r) { + var o = this, + a = [], + n = this.transform; + if (!n) return a; + for ( + var s = r ? n.getCameraQueryGeometry(e) : e, + l = e.map(function (t) { + return n.pointCoordinate(t, o.terrain); + }), + c = s.map(function (t) { + return n.pointCoordinate(t, o.terrain); + }), + h = this.getIds(), + u = 1 / 0, + p = 1 / 0, + d = -1 / 0, + _ = -1 / 0, + f = 0, + m = c; + f < m.length; + f += 1 + ) { + var g = m[f]; + (u = Math.min(u, g.x)), + (p = Math.min(p, g.y)), + (d = Math.max(d, g.x)), + (_ = Math.max(_, g.y)); + } + for ( + var v = function (e) { + var r = o._tiles[h[e]]; + if (!r.holdingForFade()) { + var s = r.tileID, + f = Math.pow(2, n.zoom - r.tileID.overscaledZ), + m = (i * r.queryPadding * t.EXTENT) / r.tileSize / f, + g = [ + s.getTilePoint(new t.MercatorCoordinate(u, p)), + s.getTilePoint(new t.MercatorCoordinate(d, _)), + ]; + if ( + g[0].x - m < t.EXTENT && + g[0].y - m < t.EXTENT && + g[1].x + m >= 0 && + g[1].y + m >= 0 + ) { + var v = l.map(function (t) { + return s.getTilePoint(t); + }), + y = c.map(function (t) { + return s.getTilePoint(t); + }); + a.push({ + tile: r, + tileID: s, + queryGeometry: v, + cameraQueryGeometry: y, + scale: f, + }); + } + } + }, + y = 0; + y < h.length; + y++ + ) + v(y); + return a; + }), + (i.prototype.getVisibleCoordinates = function (t) { + for ( + var e = this, + i = this.getRenderableIds(t).map(function (t) { + return e._tiles[t].tileID; + }), + r = 0, + o = i; + r < o.length; + r += 1 + ) { + var a = o[r]; + a.posMatrix = this.transform.calculatePosMatrix(a.toUnwrapped()); + } + return i; + }), + (i.prototype.hasTransition = function () { + if (this._source.hasTransition()) return !0; + if (j(this._source.type)) + for (var e in this._tiles) { + var i = this._tiles[e]; + if (void 0 !== i.fadeEndTime && i.fadeEndTime >= t.exported.now()) + return !0; + } + return !1; + }), + (i.prototype.setFeatureState = function (t, e, i) { + this._state.updateState((t = t || '_geojsonTileLayer'), e, i); + }), + (i.prototype.removeFeatureState = function (t, e, i) { + this._state.removeFeatureState((t = t || '_geojsonTileLayer'), e, i); + }), + (i.prototype.getFeatureState = function (t, e) { + return this._state.getState((t = t || '_geojsonTileLayer'), e); + }), + (i.prototype.setDependencies = function (t, e, i) { + var r = this._tiles[t]; + r && r.setDependencies(e, i); + }), + (i.prototype.reloadTilesForDependencies = function (t, e) { + for (var i in this._tiles) + this._tiles[i].hasDependency(t, e) && + this._reloadTile(i, 'reloading'); + this._cache.filter(function (i) { + return !i.hasDependency(t, e); + }); + }), + i + ); + })(t.Evented); + function G(t, e) { + var i = Math.abs(2 * t.wrap) - +(t.wrap < 0), + r = Math.abs(2 * e.wrap) - +(e.wrap < 0); + return ( + t.overscaledZ - e.overscaledZ || + r - i || + e.canonical.y - t.canonical.y || + e.canonical.x - t.canonical.x + ); + } + function j(t) { + return 'raster' === t || 'image' === t || 'video' === t; + } + (N.maxOverzooming = 10), (N.maxUnderzooming = 3); + var Z = 'mapboxgl_preloaded_worker_pool', + V = function () { + this.active = {}; + }; + (V.prototype.acquire = function (t) { + if (!this.workers) + for (this.workers = []; this.workers.length < V.workerCount; ) + this.workers.push(new Worker(Co.workerUrl)); + return (this.active[t] = !0), this.workers.slice(); + }), + (V.prototype.release = function (t) { + delete this.active[t], + 0 === this.numActive() && + (this.workers.forEach(function (t) { + t.terminate(); + }), + (this.workers = null)); + }), + (V.prototype.isPreloaded = function () { + return !!this.active[Z]; + }), + (V.prototype.numActive = function () { + return Object.keys(this.active).length; + }); + var q, + X = Math.floor(t.exported.hardwareConcurrency / 2); + function W() { + return q || (q = new V()), q; + } + function H(e, i) { + var r = {}; + for (var o in e) 'ref' !== o && (r[o] = e[o]); + return ( + t.refProperties.forEach(function (t) { + t in i && (r[t] = i[t]); + }), + r + ); + } + function K(t) { + t = t.slice(); + for (var e = Object.create(null), i = 0; i < t.length; i++) + e[t[i].id] = t[i]; + for (var r = 0; r < t.length; r++) + 'ref' in t[r] && (t[r] = H(t[r], e[t[r].ref])); + return t; + } + V.workerCount = Math.max(Math.min(X, 6), 1); + var Y = { + setStyle: 'setStyle', + addLayer: 'addLayer', + removeLayer: 'removeLayer', + setPaintProperty: 'setPaintProperty', + setLayoutProperty: 'setLayoutProperty', + setFilter: 'setFilter', + addSource: 'addSource', + removeSource: 'removeSource', + setGeoJSONSourceData: 'setGeoJSONSourceData', + setLayerZoomRange: 'setLayerZoomRange', + setLayerProperty: 'setLayerProperty', + setCenter: 'setCenter', + setZoom: 'setZoom', + setBearing: 'setBearing', + setPitch: 'setPitch', + setSprite: 'setSprite', + setGlyphs: 'setGlyphs', + setTransition: 'setTransition', + setLight: 'setLight', + }; + function J(t, e, i) { + i.push({ command: Y.addSource, args: [t, e[t]] }); + } + function Q(t, e, i) { + e.push({ command: Y.removeSource, args: [t] }), (i[t] = !0); + } + function $(t, e, i, r) { + Q(t, i, r), J(t, e, i); + } + function tt(t, e, i) { + var r; + for (r in t[i]) + if ( + Object.prototype.hasOwnProperty.call(t[i], r) && + 'data' !== r && + !o(t[i][r], e[i][r]) + ) + return !1; + for (r in e[i]) + if ( + Object.prototype.hasOwnProperty.call(e[i], r) && + 'data' !== r && + !o(t[i][r], e[i][r]) + ) + return !1; + return !0; + } + function et(t, e, i, r, a, n) { + var s; + for (s in ((e = e || {}), (t = t || {}))) + Object.prototype.hasOwnProperty.call(t, s) && + (o(t[s], e[s]) || i.push({ command: n, args: [r, s, e[s], a] })); + for (s in e) + Object.prototype.hasOwnProperty.call(e, s) && + !Object.prototype.hasOwnProperty.call(t, s) && + (o(t[s], e[s]) || i.push({ command: n, args: [r, s, e[s], a] })); + } + function it(t) { + return t.id; + } + function rt(t, e) { + return (t[e.id] = e), t; + } + var ot = function (t, e) { + this.reset(t, e); + }; + function at(t, e) { + var i = !0; + return 'always' === t || ('never' !== t && 'never' !== e) || (i = !1), i; + } + (ot.prototype.reset = function (t, e) { + (this.points = t || []), (this._distances = [0]); + for (var i = 1; i < this.points.length; i++) + this._distances[i] = + this._distances[i - 1] + this.points[i].dist(this.points[i - 1]); + (this.length = this._distances[this._distances.length - 1]), + (this.padding = Math.min(e || 0, 0.5 * this.length)), + (this.paddedLength = this.length - 2 * this.padding); + }), + (ot.prototype.lerp = function (e) { + if (1 === this.points.length) return this.points[0]; + e = t.clamp(e, 0, 1); + for ( + var i = 1, + r = this._distances[i], + o = e * this.paddedLength + this.padding; + r < o && i < this._distances.length; + + ) + r = this._distances[++i]; + var a = i - 1, + n = this._distances[a], + s = r - n, + l = s > 0 ? (o - n) / s : 0; + return this.points[a].mult(1 - l).add(this.points[i].mult(l)); + }); + var nt = function (t, e, i) { + var r = (this.boxCells = []), + o = (this.circleCells = []); + (this.xCellCount = Math.ceil(t / i)), + (this.yCellCount = Math.ceil(e / i)); + for (var a = 0; a < this.xCellCount * this.yCellCount; a++) + r.push([]), o.push([]); + (this.circleKeys = []), + (this.boxKeys = []), + (this.bboxes = []), + (this.circles = []), + (this.width = t), + (this.height = e), + (this.xScale = this.xCellCount / t), + (this.yScale = this.yCellCount / e), + (this.boxUid = 0), + (this.circleUid = 0); + }; + function st(e, i, r, o, a) { + var n = t.create(); + return ( + i + ? (t.scale(n, n, [1 / a, 1 / a, 1]), r || t.rotateZ(n, n, o.angle)) + : t.multiply(n, o.labelPlaneMatrix, e), + n + ); + } + function lt(e, i, r, o, a) { + if (i) { + var n = t.clone(e); + return t.scale(n, n, [a, a, 1]), r || t.rotateZ(n, n, -o.angle), n; + } + return o.glCoordMatrix; + } + function ct(e, i, r) { + var o; + r + ? ((o = [e.x, e.y, r(e.x, e.y), 1]), t.transformMat4(o, o, i)) + : yt((o = [e.x, e.y, 0, 1]), o, i); + var a = o[3]; + return { + point: new t.pointGeometry(o[0] / a, o[1] / a), + signedDistanceFromCamera: a, + }; + } + function ht(t, e) { + return 0.5 + (t / e) * 0.5; + } + function ut(t, e) { + var i = t[0] / t[3], + r = t[1] / t[3]; + return i >= -e[0] && i <= e[0] && r >= -e[1] && r <= e[1]; + } + function pt(t, e, i, r, o, a, n, s, l, c, h, u, p) { + var d = s.glyphStartIndex + s.numGlyphs, + _ = s.lineStartIndex, + f = s.lineStartIndex + s.lineLength, + m = e.getoffsetX(s.glyphStartIndex), + g = e.getoffsetX(d - 1), + v = mt(t * m, i, r, o, a, n, s.segment, _, f, l, c, h, u, p); + if (!v) return null; + var y = mt(t * g, i, r, o, a, n, s.segment, _, f, l, c, h, u, p); + return y ? { first: v, last: y } : null; + } + function dt(e, i, r, o) { + return e === t.WritingMode.horizontal && + Math.abs(r.y - i.y) > Math.abs(r.x - i.x) * o + ? { useVertical: !0 } + : (e === t.WritingMode.vertical ? i.y < r.y : i.x > r.x) + ? { needsFlipping: !0 } + : null; + } + function _t(e, i, r, o, a, n, s, l, c, h, u, p, d, _, f, m) { + var g, + v = i / 24, + y = e.lineOffsetX * v, + x = e.lineOffsetY * v; + if (e.numGlyphs > 1) { + var b = e.glyphStartIndex + e.numGlyphs, + w = e.lineStartIndex, + T = e.lineStartIndex + e.lineLength, + E = pt(v, l, y, x, r, u, p, e, c, n, d, f, m); + if (!E) return { notEnoughRoom: !0 }; + var I = ct(E.first.point, s, m).point, + C = ct(E.last.point, s, m).point; + if (o && !r) { + var S = dt(e.writingMode, I, C, _); + if (S) return S; + } + g = [E.first]; + for (var D = e.glyphStartIndex + 1; D < b - 1; D++) + g.push( + mt( + v * l.getoffsetX(D), + y, + x, + r, + u, + p, + e.segment, + w, + T, + c, + n, + d, + f, + m, + ), + ); + g.push(E.last); + } else { + if (o && !r) { + var z = ct(p, a, m).point, + P = e.lineStartIndex + e.segment + 1, + M = new t.pointGeometry(c.getx(P), c.gety(P)), + A = ct(M, a, m), + R = A.signedDistanceFromCamera > 0 ? A.point : ft(p, M, z, 1, a, m), + L = dt(e.writingMode, z, R, _); + if (L) return L; + } + var k = mt( + v * l.getoffsetX(e.glyphStartIndex), + y, + x, + r, + u, + p, + e.segment, + e.lineStartIndex, + e.lineStartIndex + e.lineLength, + c, + n, + d, + f, + m, + ); + if (!k) return { notEnoughRoom: !0 }; + g = [k]; + } + for (var B = 0, O = g; B < O.length; B += 1) { + var F = O[B]; + t.addDynamicAttributes(h, F.point, F.angle); + } + return {}; + } + function ft(t, e, i, r, o, a) { + var n = ct(t.add(t.sub(e)._unit()), o, a).point, + s = i.sub(n); + return i.add(s._mult(r / s.mag())); + } + function mt(e, i, r, o, a, n, s, l, c, h, u, p, d, _) { + var f = o ? e - i : e + i, + m = f > 0 ? 1 : -1, + g = 0; + o && ((m *= -1), (g = Math.PI)), m < 0 && (g += Math.PI); + for ( + var v = m > 0 ? l + s : l + s + 1, + y = a, + x = a, + b = 0, + w = 0, + T = Math.abs(f), + E = []; + b + w <= T; + + ) { + if ((v += m) < l || v >= c) return null; + if (((x = y), E.push(y), void 0 === (y = p[v]))) { + var I = new t.pointGeometry(h.getx(v), h.gety(v)), + C = ct(I, u, _); + if (C.signedDistanceFromCamera > 0) y = p[v] = C.point; + else { + var S = v - m; + y = ft( + 0 === b ? n : new t.pointGeometry(h.getx(S), h.gety(S)), + I, + x, + T - b + 1, + u, + _, + ); + } + } + (b += w), (w = x.dist(y)); + } + var D = (T - b) / w, + z = y.sub(x), + P = z.mult(D)._add(x); + P._add( + z + ._unit() + ._perp() + ._mult(r * m), + ); + var M = g + Math.atan2(y.y - x.y, y.x - x.x); + return E.push(P), { point: P, angle: d ? M : 0, path: E }; + } + (nt.prototype.keysLength = function () { + return this.boxKeys.length + this.circleKeys.length; + }), + (nt.prototype.insert = function (t, e, i, r, o) { + this._forEachCell(e, i, r, o, this._insertBoxCell, this.boxUid++), + this.boxKeys.push(t), + this.bboxes.push(e), + this.bboxes.push(i), + this.bboxes.push(r), + this.bboxes.push(o); + }), + (nt.prototype.insertCircle = function (t, e, i, r) { + this._forEachCell( + e - r, + i - r, + e + r, + i + r, + this._insertCircleCell, + this.circleUid++, + ), + this.circleKeys.push(t), + this.circles.push(e), + this.circles.push(i), + this.circles.push(r); + }), + (nt.prototype._insertBoxCell = function (t, e, i, r, o, a) { + this.boxCells[o].push(a); + }), + (nt.prototype._insertCircleCell = function (t, e, i, r, o, a) { + this.circleCells[o].push(a); + }), + (nt.prototype._query = function (t, e, i, r, o, a, n) { + if (i < 0 || t > this.width || r < 0 || e > this.height) return []; + var s = []; + if (t <= 0 && e <= 0 && this.width <= i && this.height <= r) { + if (o) return [{ key: null, x1: t, y1: e, x2: i, y2: r }]; + for (var l = 0; l < this.boxKeys.length; l++) + s.push({ + key: this.boxKeys[l], + x1: this.bboxes[4 * l], + y1: this.bboxes[4 * l + 1], + x2: this.bboxes[4 * l + 2], + y2: this.bboxes[4 * l + 3], + }); + for (var c = 0; c < this.circleKeys.length; c++) { + var h = this.circles[3 * c], + u = this.circles[3 * c + 1], + p = this.circles[3 * c + 2]; + s.push({ + key: this.circleKeys[c], + x1: h - p, + y1: u - p, + x2: h + p, + y2: u + p, + }); + } + } else + this._forEachCell( + t, + e, + i, + r, + this._queryCell, + s, + { hitTest: o, overlapMode: a, seenUids: { box: {}, circle: {} } }, + n, + ); + return s; + }), + (nt.prototype.query = function (t, e, i, r) { + return this._query(t, e, i, r, !1, null); + }), + (nt.prototype.hitTest = function (t, e, i, r, o, a) { + return this._query(t, e, i, r, !0, o, a).length > 0; + }), + (nt.prototype.hitTestCircle = function (t, e, i, r, o) { + var a = t - i, + n = t + i, + s = e - i, + l = e + i; + if (n < 0 || a > this.width || l < 0 || s > this.height) return !1; + var c = []; + return ( + this._forEachCell( + a, + s, + n, + l, + this._queryCellCircle, + c, + { + hitTest: !0, + overlapMode: r, + circle: { x: t, y: e, radius: i }, + seenUids: { box: {}, circle: {} }, + }, + o, + ), + c.length > 0 + ); + }), + (nt.prototype._queryCell = function (t, e, i, r, o, a, n, s) { + var l = n.seenUids, + c = n.hitTest, + h = n.overlapMode, + u = this.boxCells[o]; + if (null !== u) + for (var p = this.bboxes, d = 0, _ = u; d < _.length; d += 1) { + var f = _[d]; + if (!l.box[f]) { + l.box[f] = !0; + var m = 4 * f, + g = this.boxKeys[f]; + if ( + t <= p[m + 2] && + e <= p[m + 3] && + i >= p[m + 0] && + r >= p[m + 1] && + (!s || s(g)) && + (!c || !at(h, g.overlapMode)) && + (a.push({ + key: g, + x1: p[m], + y1: p[m + 1], + x2: p[m + 2], + y2: p[m + 3], + }), + c) + ) + return !0; + } + } + var v = this.circleCells[o]; + if (null !== v) + for (var y = this.circles, x = 0, b = v; x < b.length; x += 1) { + var w = b[x]; + if (!l.circle[w]) { + l.circle[w] = !0; + var T = 3 * w, + E = this.circleKeys[w]; + if ( + this._circleAndRectCollide( + y[T], + y[T + 1], + y[T + 2], + t, + e, + i, + r, + ) && + (!s || s(E)) && + (!c || !at(h, E.overlapMode)) + ) { + var I = y[T], + C = y[T + 1], + S = y[T + 2]; + if ( + (a.push({ + key: E, + x1: I - S, + y1: C - S, + x2: I + S, + y2: C + S, + }), + c) + ) + return !0; + } + } + } + return !1; + }), + (nt.prototype._queryCellCircle = function (t, e, i, r, o, a, n, s) { + var l = n.circle, + c = n.seenUids, + h = n.overlapMode, + u = this.boxCells[o]; + if (null !== u) + for (var p = this.bboxes, d = 0, _ = u; d < _.length; d += 1) { + var f = _[d]; + if (!c.box[f]) { + c.box[f] = !0; + var m = 4 * f, + g = this.boxKeys[f]; + if ( + this._circleAndRectCollide( + l.x, + l.y, + l.radius, + p[m + 0], + p[m + 1], + p[m + 2], + p[m + 3], + ) && + (!s || s(g)) && + !at(h, g.overlapMode) + ) + return a.push(!0), !0; + } + } + var v = this.circleCells[o]; + if (null !== v) + for (var y = this.circles, x = 0, b = v; x < b.length; x += 1) { + var w = b[x]; + if (!c.circle[w]) { + c.circle[w] = !0; + var T = 3 * w, + E = this.circleKeys[w]; + if ( + this._circlesCollide( + y[T], + y[T + 1], + y[T + 2], + l.x, + l.y, + l.radius, + ) && + (!s || s(E)) && + !at(h, E.overlapMode) + ) + return a.push(!0), !0; + } + } + }), + (nt.prototype._forEachCell = function (t, e, i, r, o, a, n, s) { + for ( + var l = this._convertToXCellCoord(t), + c = this._convertToYCellCoord(e), + h = this._convertToXCellCoord(i), + u = this._convertToYCellCoord(r), + p = l; + p <= h; + p++ + ) + for (var d = c; d <= u; d++) + if (o.call(this, t, e, i, r, this.xCellCount * d + p, a, n, s)) + return; + }), + (nt.prototype._convertToXCellCoord = function (t) { + return Math.max( + 0, + Math.min(this.xCellCount - 1, Math.floor(t * this.xScale)), + ); + }), + (nt.prototype._convertToYCellCoord = function (t) { + return Math.max( + 0, + Math.min(this.yCellCount - 1, Math.floor(t * this.yScale)), + ); + }), + (nt.prototype._circlesCollide = function (t, e, i, r, o, a) { + var n = r - t, + s = o - e, + l = i + a; + return l * l > n * n + s * s; + }), + (nt.prototype._circleAndRectCollide = function (t, e, i, r, o, a, n) { + var s = (a - r) / 2, + l = Math.abs(t - (r + s)); + if (l > s + i) return !1; + var c = (n - o) / 2, + h = Math.abs(e - (o + c)); + if (h > c + i) return !1; + if (l <= s || h <= c) return !0; + var u = l - s, + p = h - c; + return u * u + p * p <= i * i; + }); + var gt = new Float32Array([ + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + ]); + function vt(t, e) { + for (var i = 0; i < t; i++) { + var r = e.length; + e.resize(r + 4), e.float32.set(gt, 3 * r); + } + } + function yt(t, e, i) { + var r = e[0], + o = e[1]; + return ( + (t[0] = i[0] * r + i[4] * o + i[12]), + (t[1] = i[1] * r + i[5] * o + i[13]), + (t[3] = i[3] * r + i[7] * o + i[15]), + t + ); + } + var xt = 100, + bt = function (t, e, i) { + void 0 === e && (e = new nt(t.width + 200, t.height + 200, 25)), + void 0 === i && (i = new nt(t.width + 200, t.height + 200, 25)), + (this.transform = t), + (this.grid = e), + (this.ignoredGrid = i), + (this.pitchfactor = Math.cos(t._pitch) * t.cameraToCenterDistance), + (this.screenRightBoundary = t.width + xt), + (this.screenBottomBoundary = t.height + xt), + (this.gridRightBoundary = t.width + 200), + (this.gridBottomBoundary = t.height + 200), + (this.perspectiveRatioCutoff = 0.6); + }; + function wt(e, i, r) { + return ( + i * (t.EXTENT / (e.tileSize * Math.pow(2, r - e.tileID.overscaledZ))) + ); + } + (bt.prototype.placeCollisionBox = function (t, e, i, r, o, a) { + var n = this.projectAndGetPerspectiveRatio( + r, + t.anchorPointX, + t.anchorPointY, + a, + ), + s = i * n.perspectiveRatio, + l = t.x1 * s + n.point.x, + c = t.y1 * s + n.point.y, + h = t.x2 * s + n.point.x, + u = t.y2 * s + n.point.y; + return !this.isInsideGrid(l, c, h, u) || + ('always' !== e && this.grid.hitTest(l, c, h, u, e, o)) || + n.perspectiveRatio < this.perspectiveRatioCutoff + ? { box: [], offscreen: !1 } + : { box: [l, c, h, u], offscreen: this.isOffscreen(l, c, h, u) }; + }), + (bt.prototype.placeCollisionCircles = function ( + e, + i, + r, + o, + a, + n, + s, + l, + c, + h, + u, + p, + d, + _, + ) { + var f = [], + m = new t.pointGeometry(i.anchorX, i.anchorY), + g = ct(m, n, _), + v = ht( + this.transform.cameraToCenterDistance, + g.signedDistanceFromCamera, + ), + y = (h ? a / v : a * v) / t.ONE_EM, + x = ct(m, s, _).point, + b = pt( + y, + o, + i.lineOffsetX * y, + i.lineOffsetY * y, + !1, + x, + m, + i, + r, + s, + {}, + !1, + _, + ), + w = !1, + T = !1, + E = !0; + if (b) { + for ( + var I = 0.5 * p * v + d, + C = new t.pointGeometry(-100, -100), + S = new t.pointGeometry( + this.screenRightBoundary, + this.screenBottomBoundary, + ), + D = new ot(), + z = b.first, + P = b.last, + M = [], + A = z.path.length - 1; + A >= 1; + A-- + ) + M.push(z.path[A]); + for (var R = 1; R < P.path.length; R++) M.push(P.path[R]); + var L = 2.5 * I; + if (l) { + var k = M.map(function (t) { + return ct(t, l, _); + }); + M = k.some(function (t) { + return t.signedDistanceFromCamera <= 0; + }) + ? [] + : k.map(function (t) { + return t.point; + }); + } + var B = []; + if (M.length > 0) { + for ( + var O = M[0].clone(), F = M[0].clone(), U = 1; + U < M.length; + U++ + ) + (O.x = Math.min(O.x, M[U].x)), + (O.y = Math.min(O.y, M[U].y)), + (F.x = Math.max(F.x, M[U].x)), + (F.y = Math.max(F.y, M[U].y)); + B = + O.x >= C.x && F.x <= S.x && O.y >= C.y && F.y <= S.y + ? [M] + : F.x < C.x || O.x > S.x || F.y < C.y || O.y > S.y + ? [] + : t.clipLine([M], C.x, C.y, S.x, S.y); + } + for (var N = 0, G = B; N < G.length; N += 1) { + var j; + D.reset(G[N], 0.25 * I), + (j = D.length <= 0.5 * I ? 1 : Math.ceil(D.paddedLength / L) + 1); + for (var Z = 0; Z < j; Z++) { + var V = Z / Math.max(j - 1, 1), + q = D.lerp(V), + X = q.x + xt, + W = q.y + xt; + f.push(X, W, I, 0); + var H = X - I, + K = W - I, + Y = X + I, + J = W + I; + if ( + ((E = E && this.isOffscreen(H, K, Y, J)), + (T = T || this.isInsideGrid(H, K, Y, J)), + 'always' !== e && + this.grid.hitTestCircle(X, W, I, e, u) && + ((w = !0), !c)) + ) + return { circles: [], offscreen: !1, collisionDetected: w }; + } + } + } + return { + circles: (!c && w) || !T || v < this.perspectiveRatioCutoff ? [] : f, + offscreen: E, + collisionDetected: w, + }; + }), + (bt.prototype.queryRenderedSymbols = function (e) { + if ( + 0 === e.length || + (0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) + ) + return {}; + for ( + var i = [], + r = 1 / 0, + o = 1 / 0, + a = -1 / 0, + n = -1 / 0, + s = 0, + l = e; + s < l.length; + s += 1 + ) { + var c = l[s], + h = new t.pointGeometry(c.x + xt, c.y + xt); + (r = Math.min(r, h.x)), + (o = Math.min(o, h.y)), + (a = Math.max(a, h.x)), + (n = Math.max(n, h.y)), + i.push(h); + } + for ( + var u = {}, + p = {}, + d = 0, + _ = this.grid + .query(r, o, a, n) + .concat(this.ignoredGrid.query(r, o, a, n)); + d < _.length; + d += 1 + ) { + var f = _[d], + m = f.key; + if ( + (void 0 === u[m.bucketInstanceId] && (u[m.bucketInstanceId] = {}), + !u[m.bucketInstanceId][m.featureIndex]) + ) { + var g = [ + new t.pointGeometry(f.x1, f.y1), + new t.pointGeometry(f.x2, f.y1), + new t.pointGeometry(f.x2, f.y2), + new t.pointGeometry(f.x1, f.y2), + ]; + t.polygonIntersectsPolygon(i, g) && + ((u[m.bucketInstanceId][m.featureIndex] = !0), + void 0 === p[m.bucketInstanceId] && (p[m.bucketInstanceId] = []), + p[m.bucketInstanceId].push(m.featureIndex)); + } + } + return p; + }), + (bt.prototype.insertCollisionBox = function (t, e, i, r, o, a) { + (i ? this.ignoredGrid : this.grid).insert( + { + bucketInstanceId: r, + featureIndex: o, + collisionGroupID: a, + overlapMode: e, + }, + t[0], + t[1], + t[2], + t[3], + ); + }), + (bt.prototype.insertCollisionCircles = function (t, e, i, r, o, a) { + for ( + var n = i ? this.ignoredGrid : this.grid, + s = { + bucketInstanceId: r, + featureIndex: o, + collisionGroupID: a, + overlapMode: e, + }, + l = 0; + l < t.length; + l += 4 + ) + n.insertCircle(s, t[l], t[l + 1], t[l + 2]); + }), + (bt.prototype.projectAndGetPerspectiveRatio = function (e, i, r, o) { + var a; + return ( + o + ? ((a = [i, r, o(i, r), 1]), t.transformMat4(a, a, e)) + : yt((a = [i, r, 0, 1]), a, e), + { + point: new t.pointGeometry( + ((a[0] / a[3] + 1) / 2) * this.transform.width + xt, + ((-a[1] / a[3] + 1) / 2) * this.transform.height + xt, + ), + perspectiveRatio: + 0.5 + (this.transform.cameraToCenterDistance / a[3]) * 0.5, + } + ); + }), + (bt.prototype.isOffscreen = function (t, e, i, r) { + return ( + i < xt || + t >= this.screenRightBoundary || + r < xt || + e > this.screenBottomBoundary + ); + }), + (bt.prototype.isInsideGrid = function (t, e, i, r) { + return ( + i >= 0 && + t < this.gridRightBoundary && + r >= 0 && + e < this.gridBottomBoundary + ); + }), + (bt.prototype.getViewportMatrix = function () { + var e = t.identity([]); + return t.translate(e, e, [-100, -100, 0]), e; + }); + var Tt = function (t, e, i, r) { + (this.opacity = t + ? Math.max(0, Math.min(1, t.opacity + (t.placed ? e : -e))) + : r && i + ? 1 + : 0), + (this.placed = i); + }; + Tt.prototype.isHidden = function () { + return 0 === this.opacity && !this.placed; + }; + var Et = function (t, e, i, r, o) { + (this.text = new Tt(t ? t.text : null, e, i, o)), + (this.icon = new Tt(t ? t.icon : null, e, r, o)); + }; + Et.prototype.isHidden = function () { + return this.text.isHidden() && this.icon.isHidden(); + }; + var It = function (t, e, i) { + (this.text = t), (this.icon = e), (this.skipFade = i); + }, + Ct = function () { + (this.invProjMatrix = t.create()), + (this.viewportMatrix = t.create()), + (this.circles = []); + }, + St = function (t, e, i, r, o) { + (this.bucketInstanceId = t), + (this.featureIndex = e), + (this.sourceLayerIndex = i), + (this.bucketIndex = r), + (this.tileID = o); + }, + Dt = function (t) { + (this.crossSourceCollisions = t), + (this.maxGroupID = 0), + (this.collisionGroups = {}); + }; + function zt(e, i, r, o, a) { + var n = t.getAnchorAlignment(e), + s = -(n.horizontalAlign - 0.5) * i, + l = -(n.verticalAlign - 0.5) * r, + c = t.evaluateVariableOffset(e, o); + return new t.pointGeometry(s + c[0] * a, l + c[1] * a); + } + function Pt(e, i, r, o, a, n) { + var s = e.x1, + l = e.x2, + c = e.y1, + h = e.y2, + u = e.anchorPointX, + p = e.anchorPointY, + d = new t.pointGeometry(i, r); + return ( + o && d._rotate(a ? n : -n), + { + x1: s + d.x, + y1: c + d.y, + x2: l + d.x, + y2: h + d.y, + anchorPointX: u, + anchorPointY: p, + } + ); + } + Dt.prototype.get = function (t) { + if (this.crossSourceCollisions) return { ID: 0, predicate: null }; + if (!this.collisionGroups[t]) { + var e = ++this.maxGroupID; + this.collisionGroups[t] = { + ID: e, + predicate: function (t) { + return t.collisionGroupID === e; + }, + }; + } + return this.collisionGroups[t]; + }; + var Mt = function (t, e, i, r, o) { + (this.transform = t.clone()), + (this.terrain = e), + (this.collisionIndex = new bt(this.transform)), + (this.placements = {}), + (this.opacities = {}), + (this.variableOffsets = {}), + (this.stale = !1), + (this.commitTime = 0), + (this.fadeDuration = i), + (this.retainedQueryData = {}), + (this.collisionGroups = new Dt(r)), + (this.collisionCircleArrays = {}), + (this.prevPlacement = o), + o && (o.prevPlacement = void 0), + (this.placedOrientations = {}); + }; + function At(t, e, i, r, o) { + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, r || 0, o || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, r || 0, o || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, r || 0, o || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, r || 0, o || 0); + } + (Mt.prototype.getBucketParts = function (e, i, r, o) { + var a = r.getBucket(i), + n = r.latestFeatureIndex; + if (a && n && i.id === a.layerIds[0]) { + var s = r.collisionBoxArray, + l = a.layers[0].layout, + c = Math.pow(2, this.transform.zoom - r.tileID.overscaledZ), + h = r.tileSize / t.EXTENT, + u = this.transform.calculatePosMatrix(r.tileID.toUnwrapped()), + p = 'map' === l.get('text-pitch-alignment'), + d = 'map' === l.get('text-rotation-alignment'), + _ = wt(r, 1, this.transform.zoom), + f = st(u, p, d, this.transform, _), + m = null; + if (p) { + var g = lt(u, p, d, this.transform, _); + m = t.multiply([], this.transform.labelPlaneMatrix, g); + } + this.retainedQueryData[a.bucketInstanceId] = new St( + a.bucketInstanceId, + n, + a.sourceLayerIndex, + a.index, + r.tileID, + ); + var v = { + bucket: a, + layout: l, + posMatrix: u, + textLabelPlaneMatrix: f, + labelToScreenMatrix: m, + scale: c, + textPixelRatio: h, + holdingForFade: r.holdingForFade(), + collisionBoxArray: s, + partiallyEvaluatedTextSize: t.evaluateSizeForZoom( + a.textSizeData, + this.transform.zoom, + ), + collisionGroup: this.collisionGroups.get(a.sourceID), + }; + if (o) + for (var y = 0, x = a.sortKeyRanges; y < x.length; y += 1) { + var b = x[y]; + e.push({ + sortKey: b.sortKey, + symbolInstanceStart: b.symbolInstanceStart, + symbolInstanceEnd: b.symbolInstanceEnd, + parameters: v, + }); + } + else + e.push({ + symbolInstanceStart: 0, + symbolInstanceEnd: a.symbolInstances.length, + parameters: v, + }); + } + }), + (Mt.prototype.attemptAnchorPlacement = function ( + t, + e, + i, + r, + o, + a, + n, + s, + l, + c, + h, + u, + p, + d, + _, + f, + ) { + var m = [u.textOffset0, u.textOffset1], + g = zt(t, i, r, m, o), + v = this.collisionIndex.placeCollisionBox( + Pt(e, g.x, g.y, a, n, this.transform.angle), + h, + s, + l, + c.predicate, + f, + ); + if ( + (!_ || + 0 !== + this.collisionIndex.placeCollisionBox( + Pt(_, g.x, g.y, a, n, this.transform.angle), + h, + s, + l, + c.predicate, + f, + ).box.length) && + v.box.length > 0 + ) { + var y; + if ( + (this.prevPlacement && + this.prevPlacement.variableOffsets[u.crossTileID] && + this.prevPlacement.placements[u.crossTileID] && + this.prevPlacement.placements[u.crossTileID].text && + (y = this.prevPlacement.variableOffsets[u.crossTileID].anchor), + 0 === u.crossTileID) + ) + throw new Error("symbolInstance.crossTileID can't be 0"); + return ( + (this.variableOffsets[u.crossTileID] = { + textOffset: m, + width: i, + height: r, + anchor: t, + textBoxScale: o, + prevAnchor: y, + }), + this.markUsedJustification(p, t, u, d), + p.allowVerticalPlacement && + (this.markUsedOrientation(p, d, u), + (this.placedOrientations[u.crossTileID] = d)), + { shift: g, placedGlyphBoxes: v } + ); + } + }), + (Mt.prototype.placeLayerBucketPart = function (e, i, r) { + var o = this, + a = e.parameters, + n = a.bucket, + s = a.layout, + l = a.posMatrix, + c = a.textLabelPlaneMatrix, + h = a.labelToScreenMatrix, + u = a.textPixelRatio, + p = a.holdingForFade, + d = a.collisionBoxArray, + _ = a.partiallyEvaluatedTextSize, + f = a.collisionGroup, + m = s.get('text-optional'), + g = s.get('icon-optional'), + v = t.getOverlapMode(s, 'text-overlap', 'text-allow-overlap'), + y = 'always' === v, + x = t.getOverlapMode(s, 'icon-overlap', 'icon-allow-overlap'), + b = 'always' === x, + w = 'map' === s.get('text-rotation-alignment'), + T = 'map' === s.get('text-pitch-alignment'), + E = 'none' !== s.get('icon-text-fit'), + I = 'viewport-y' === s.get('symbol-z-order'), + C = y && (b || !n.hasIconData() || g), + S = b && (y || !n.hasTextData() || m); + !n.collisionArrays && d && n.deserializeCollisionBoxes(d); + var D = function (e, a) { + if (!i[e.crossTileID]) + if (p) o.placements[e.crossTileID] = new It(!1, !1, !1); + else { + var d, + b = !1, + I = !1, + D = !0, + z = null, + P = { box: null, offscreen: null }, + M = { box: null, offscreen: null }, + A = null, + R = null, + L = 0, + k = 0, + B = 0; + a.textFeatureIndex + ? (L = a.textFeatureIndex) + : e.useRuntimeCollisionCircles && (L = e.featureIndex), + a.verticalTextFeatureIndex && (k = a.verticalTextFeatureIndex); + for ( + var O = o.retainedQueryData[n.bucketInstanceId].tileID, + F = o.terrain + ? function (t, e) { + return o.terrain.getElevation(O, t, e); + } + : null, + U = 0, + N = [ + 'textBox', + 'verticalTextBox', + 'iconBox', + 'verticalIconBox', + ]; + U < N.length; + U += 1 + ) { + var G = a[N[U]]; + G && (G.elevation = F ? F(G.anchorPointX, G.anchorPointY) : 0); + } + var j = a.textBox; + if (j) { + var Z = function (i) { + var r = t.WritingMode.horizontal; + if (n.allowVerticalPlacement && !i && o.prevPlacement) { + var a = o.prevPlacement.placedOrientations[e.crossTileID]; + a && + ((o.placedOrientations[e.crossTileID] = a), + o.markUsedOrientation(n, (r = a), e)); + } + return r; + }, + V = function (i, r) { + if ( + n.allowVerticalPlacement && + e.numVerticalGlyphVertices > 0 && + a.verticalTextBox + ) + for ( + var o = 0, s = n.writingModes; + o < s.length && + (s[o] === t.WritingMode.vertical + ? ((P = r()), (M = P)) + : (P = i()), + !(P && P.box && P.box.length)); + o += 1 + ); + else P = i(); + }; + if (s.get('text-variable-anchor')) { + var q = s.get('text-variable-anchor'); + if ( + o.prevPlacement && + o.prevPlacement.variableOffsets[e.crossTileID] + ) { + var X = o.prevPlacement.variableOffsets[e.crossTileID]; + q.indexOf(X.anchor) > 0 && + (q = q.filter(function (t) { + return t !== X.anchor; + })).unshift(X.anchor); + } + var W = function (t, i, r) { + for ( + var a = t.x2 - t.x1, + s = t.y2 - t.y1, + c = e.textBoxScale, + h = E && 'never' === x ? i : null, + p = { box: [], offscreen: !1 }, + d = 'never' !== v ? 2 * q.length : q.length, + _ = 0; + _ < d; + ++_ + ) { + var m = o.attemptAnchorPlacement( + q[_ % q.length], + t, + a, + s, + c, + w, + T, + u, + l, + f, + _ >= q.length ? v : 'never', + e, + n, + r, + h, + F, + ); + if ( + m && + (p = m.placedGlyphBoxes) && + p.box && + p.box.length + ) { + (b = !0), (z = m.shift); + break; + } + } + return p; + }; + V( + function () { + return W(j, a.iconBox, t.WritingMode.horizontal); + }, + function () { + var i = a.verticalTextBox; + return n.allowVerticalPlacement && + !(P && P.box && P.box.length) && + e.numVerticalGlyphVertices > 0 && + i + ? W(i, a.verticalIconBox, t.WritingMode.vertical) + : { box: null, offscreen: null }; + }, + ), + P && ((b = P.box), (D = P.offscreen)); + var H = Z(P && P.box); + if (!b && o.prevPlacement) { + var K = o.prevPlacement.variableOffsets[e.crossTileID]; + K && + ((o.variableOffsets[e.crossTileID] = K), + o.markUsedJustification(n, K.anchor, e, H)); + } + } else { + var Y = function (t, i) { + var r = o.collisionIndex.placeCollisionBox( + t, + v, + u, + l, + f.predicate, + F, + ); + return ( + r && + r.box && + r.box.length && + (o.markUsedOrientation(n, i, e), + (o.placedOrientations[e.crossTileID] = i)), + r + ); + }; + V( + function () { + return Y(j, t.WritingMode.horizontal); + }, + function () { + var i = a.verticalTextBox; + return n.allowVerticalPlacement && + e.numVerticalGlyphVertices > 0 && + i + ? Y(i, t.WritingMode.vertical) + : { box: null, offscreen: null }; + }, + ), + Z(P && P.box && P.box.length); + } + } + if ( + ((b = (d = P) && d.box && d.box.length > 0), + (D = d && d.offscreen), + e.useRuntimeCollisionCircles) + ) { + var J = n.text.placedSymbolArray.get( + e.centerJustifiedTextSymbolIndex, + ), + Q = t.evaluateSizeForFeature(n.textSizeData, _, J), + $ = s.get('text-padding'); + (A = o.collisionIndex.placeCollisionCircles( + v, + J, + n.lineVertexArray, + n.glyphOffsetArray, + Q, + l, + c, + h, + r, + T, + f.predicate, + e.collisionCircleDiameter, + $, + F, + )).circles.length && + A.collisionDetected && + !r && + t.warnOnce( + 'Collisions detected, but collision boxes are not shown', + ), + (b = y || (A.circles.length > 0 && !A.collisionDetected)), + (D = D && A.offscreen); + } + if ((a.iconFeatureIndex && (B = a.iconFeatureIndex), a.iconBox)) { + var tt = function (t) { + var e = E && z ? Pt(t, z.x, z.y, w, T, o.transform.angle) : t; + return o.collisionIndex.placeCollisionBox( + e, + x, + u, + l, + f.predicate, + F, + ); + }; + (I = + M && M.box && M.box.length && a.verticalIconBox + ? (R = tt(a.verticalIconBox)).box.length > 0 + : (R = tt(a.iconBox)).box.length > 0), + (D = D && R.offscreen); + } + var et = + m || + (0 === e.numHorizontalGlyphVertices && + 0 === e.numVerticalGlyphVertices), + it = g || 0 === e.numIconVertices; + if ( + (et || it + ? it + ? et || (I = I && b) + : (b = I && b) + : (I = b = I && b), + b && + d && + d.box && + o.collisionIndex.insertCollisionBox( + d.box, + v, + s.get('text-ignore-placement'), + n.bucketInstanceId, + M && M.box && k ? k : L, + f.ID, + ), + I && + R && + o.collisionIndex.insertCollisionBox( + R.box, + x, + s.get('icon-ignore-placement'), + n.bucketInstanceId, + B, + f.ID, + ), + A && + (b && + o.collisionIndex.insertCollisionCircles( + A.circles, + v, + s.get('text-ignore-placement'), + n.bucketInstanceId, + L, + f.ID, + ), + r)) + ) { + var rt = n.bucketInstanceId, + ot = o.collisionCircleArrays[rt]; + void 0 === ot && (ot = o.collisionCircleArrays[rt] = new Ct()); + for (var at = 0; at < A.circles.length; at += 4) + ot.circles.push(A.circles[at + 0]), + ot.circles.push(A.circles[at + 1]), + ot.circles.push(A.circles[at + 2]), + ot.circles.push(A.collisionDetected ? 1 : 0); + } + if (0 === e.crossTileID) + throw new Error("symbolInstance.crossTileID can't be 0"); + if (0 === n.bucketInstanceId) + throw new Error("bucket.bucketInstanceId can't be 0"); + (o.placements[e.crossTileID] = new It( + b || C, + I || S, + D || n.justReloaded, + )), + (i[e.crossTileID] = !0); + } + }; + if (I) { + if (0 !== e.symbolInstanceStart) + throw new Error('bucket.bucketInstanceId should be 0'); + for ( + var z = n.getSortedSymbolIndexes(this.transform.angle), + P = z.length - 1; + P >= 0; + --P + ) { + var M = z[P]; + D(n.symbolInstances.get(M), n.collisionArrays[M]); + } + } else + for (var A = e.symbolInstanceStart; A < e.symbolInstanceEnd; A++) + D(n.symbolInstances.get(A), n.collisionArrays[A]); + if (r && n.bucketInstanceId in this.collisionCircleArrays) { + var R = this.collisionCircleArrays[n.bucketInstanceId]; + t.invert(R.invProjMatrix, l), + (R.viewportMatrix = this.collisionIndex.getViewportMatrix()); + } + n.justReloaded = !1; + }), + (Mt.prototype.markUsedJustification = function (e, i, r, o) { + var a; + a = + o === t.WritingMode.vertical + ? r.verticalPlacedTextSymbolIndex + : { + left: r.leftJustifiedTextSymbolIndex, + center: r.centerJustifiedTextSymbolIndex, + right: r.rightJustifiedTextSymbolIndex, + }[t.getAnchorJustification(i)]; + for ( + var n = 0, + s = [ + r.leftJustifiedTextSymbolIndex, + r.centerJustifiedTextSymbolIndex, + r.rightJustifiedTextSymbolIndex, + r.verticalPlacedTextSymbolIndex, + ]; + n < s.length; + n += 1 + ) { + var l = s[n]; + l >= 0 && + (e.text.placedSymbolArray.get(l).crossTileID = + a >= 0 && l !== a ? 0 : r.crossTileID); + } + }), + (Mt.prototype.markUsedOrientation = function (e, i, r) { + for ( + var o = + i === t.WritingMode.horizontal || + i === t.WritingMode.horizontalOnly + ? i + : 0, + a = i === t.WritingMode.vertical ? i : 0, + n = 0, + s = [ + r.leftJustifiedTextSymbolIndex, + r.centerJustifiedTextSymbolIndex, + r.rightJustifiedTextSymbolIndex, + ]; + n < s.length; + n += 1 + ) + e.text.placedSymbolArray.get(s[n]).placedOrientation = o; + r.verticalPlacedTextSymbolIndex && + (e.text.placedSymbolArray.get( + r.verticalPlacedTextSymbolIndex, + ).placedOrientation = a); + }), + (Mt.prototype.commit = function (t) { + (this.commitTime = t), + (this.zoomAtLastRecencyCheck = this.transform.zoom); + var e = this.prevPlacement, + i = !1; + this.prevZoomAdjustment = e ? e.zoomAdjustment(this.transform.zoom) : 0; + var r = e ? e.symbolFadeChange(t) : 1, + o = e ? e.opacities : {}, + a = e ? e.variableOffsets : {}, + n = e ? e.placedOrientations : {}; + for (var s in this.placements) { + var l = this.placements[s], + c = o[s]; + c + ? ((this.opacities[s] = new Et(c, r, l.text, l.icon)), + (i = i || l.text !== c.text.placed || l.icon !== c.icon.placed)) + : ((this.opacities[s] = new Et( + null, + r, + l.text, + l.icon, + l.skipFade, + )), + (i = i || l.text || l.icon)); + } + for (var h in o) { + var u = o[h]; + if (!this.opacities[h]) { + var p = new Et(u, r, !1, !1); + p.isHidden() || + ((this.opacities[h] = p), + (i = i || u.text.placed || u.icon.placed)); + } + } + for (var d in a) + this.variableOffsets[d] || + !this.opacities[d] || + this.opacities[d].isHidden() || + (this.variableOffsets[d] = a[d]); + for (var _ in n) + this.placedOrientations[_] || + !this.opacities[_] || + this.opacities[_].isHidden() || + (this.placedOrientations[_] = n[_]); + if (e && void 0 === e.lastPlacementChangeTime) + throw new Error( + 'Last placement time for previous placement is not defined', + ); + i + ? (this.lastPlacementChangeTime = t) + : 'number' != typeof this.lastPlacementChangeTime && + (this.lastPlacementChangeTime = e ? e.lastPlacementChangeTime : t); + }), + (Mt.prototype.updateLayerOpacities = function (t, e) { + for (var i = {}, r = 0, o = e; r < o.length; r += 1) { + var a = o[r], + n = a.getBucket(t); + n && + a.latestFeatureIndex && + t.id === n.layerIds[0] && + this.updateBucketOpacities(n, i, a.collisionBoxArray); + } + }), + (Mt.prototype.updateBucketOpacities = function (e, i, r) { + var o = this; + e.hasTextData() && e.text.opacityVertexArray.clear(), + e.hasIconData() && e.icon.opacityVertexArray.clear(), + e.hasIconCollisionBoxData() && + e.iconCollisionBox.collisionVertexArray.clear(), + e.hasTextCollisionBoxData() && + e.textCollisionBox.collisionVertexArray.clear(); + var a = e.layers[0].layout, + n = new Et(null, 0, !1, !1, !0), + s = a.get('text-allow-overlap'), + l = a.get('icon-allow-overlap'), + c = a.get('text-variable-anchor'), + h = 'map' === a.get('text-rotation-alignment'), + u = 'map' === a.get('text-pitch-alignment'), + p = 'none' !== a.get('icon-text-fit'), + d = new Et( + null, + 0, + s && (l || !e.hasIconData() || a.get('icon-optional')), + l && (s || !e.hasTextData() || a.get('text-optional')), + !0, + ); + !e.collisionArrays && + r && + (e.hasIconCollisionBoxData() || e.hasTextCollisionBoxData()) && + e.deserializeCollisionBoxes(r); + for ( + var _ = function (t, e, i) { + for (var r = 0; r < e / 4; r++) + t.opacityVertexArray.emplaceBack(i); + }, + f = function (r) { + var a = e.symbolInstances.get(r), + s = a.numHorizontalGlyphVertices, + l = a.numVerticalGlyphVertices, + f = a.crossTileID, + m = o.opacities[f]; + i[f] ? (m = n) : m || (o.opacities[f] = m = d), (i[f] = !0); + var g = a.numIconVertices > 0, + v = o.placedOrientations[a.crossTileID], + y = v === t.WritingMode.vertical, + x = + v === t.WritingMode.horizontal || + v === t.WritingMode.horizontalOnly; + if (s > 0 || l > 0) { + var b = Nt(m.text); + _(e.text, s, y ? Gt : b), _(e.text, l, x ? Gt : b); + var w = m.text.isHidden(); + [ + a.rightJustifiedTextSymbolIndex, + a.centerJustifiedTextSymbolIndex, + a.leftJustifiedTextSymbolIndex, + ].forEach(function (t) { + t >= 0 && + (e.text.placedSymbolArray.get(t).hidden = w || y ? 1 : 0); + }), + a.verticalPlacedTextSymbolIndex >= 0 && + (e.text.placedSymbolArray.get( + a.verticalPlacedTextSymbolIndex, + ).hidden = w || x ? 1 : 0); + var T = o.variableOffsets[a.crossTileID]; + T && o.markUsedJustification(e, T.anchor, a, v); + var E = o.placedOrientations[a.crossTileID]; + E && + (o.markUsedJustification(e, 'left', a, E), + o.markUsedOrientation(e, E, a)); + } + if (g) { + var I = Nt(m.icon), + C = !(p && a.verticalPlacedIconSymbolIndex && y); + a.placedIconSymbolIndex >= 0 && + (_(e.icon, a.numIconVertices, C ? I : Gt), + (e.icon.placedSymbolArray.get( + a.placedIconSymbolIndex, + ).hidden = m.icon.isHidden())), + a.verticalPlacedIconSymbolIndex >= 0 && + (_(e.icon, a.numVerticalIconVertices, C ? Gt : I), + (e.icon.placedSymbolArray.get( + a.verticalPlacedIconSymbolIndex, + ).hidden = m.icon.isHidden())); + } + if (e.hasIconCollisionBoxData() || e.hasTextCollisionBoxData()) { + var S = e.collisionArrays[r]; + if (S) { + var D = new t.pointGeometry(0, 0); + if (S.textBox || S.verticalTextBox) { + var z = !0; + if (c) { + var P = o.variableOffsets[f]; + P + ? ((D = zt( + P.anchor, + P.width, + P.height, + P.textOffset, + P.textBoxScale, + )), + h && + D._rotate( + u ? o.transform.angle : -o.transform.angle, + )) + : (z = !1); + } + S.textBox && + At( + e.textCollisionBox.collisionVertexArray, + m.text.placed, + !z || y, + D.x, + D.y, + ), + S.verticalTextBox && + At( + e.textCollisionBox.collisionVertexArray, + m.text.placed, + !z || x, + D.x, + D.y, + ); + } + var M = Boolean(!x && S.verticalIconBox); + S.iconBox && + At( + e.iconCollisionBox.collisionVertexArray, + m.icon.placed, + M, + p ? D.x : 0, + p ? D.y : 0, + ), + S.verticalIconBox && + At( + e.iconCollisionBox.collisionVertexArray, + m.icon.placed, + !M, + p ? D.x : 0, + p ? D.y : 0, + ); + } + } + }, + m = 0; + m < e.symbolInstances.length; + m++ + ) + f(m); + if ( + (e.sortFeatures(this.transform.angle), + this.retainedQueryData[e.bucketInstanceId] && + (this.retainedQueryData[e.bucketInstanceId].featureSortOrder = + e.featureSortOrder), + e.hasTextData() && + e.text.opacityVertexBuffer && + e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray), + e.hasIconData() && + e.icon.opacityVertexBuffer && + e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray), + e.hasIconCollisionBoxData() && + e.iconCollisionBox.collisionVertexBuffer && + e.iconCollisionBox.collisionVertexBuffer.updateData( + e.iconCollisionBox.collisionVertexArray, + ), + e.hasTextCollisionBoxData() && + e.textCollisionBox.collisionVertexBuffer && + e.textCollisionBox.collisionVertexBuffer.updateData( + e.textCollisionBox.collisionVertexArray, + ), + e.text.opacityVertexArray.length !== + e.text.layoutVertexArray.length / 4) + ) + throw new Error( + 'bucket.text.opacityVertexArray.length (= ' + + e.text.opacityVertexArray.length + + ') !== bucket.text.layoutVertexArray.length (= ' + + e.text.layoutVertexArray.length + + ') / 4', + ); + if ( + e.icon.opacityVertexArray.length !== + e.icon.layoutVertexArray.length / 4 + ) + throw new Error( + 'bucket.icon.opacityVertexArray.length (= ' + + e.icon.opacityVertexArray.length + + ') !== bucket.icon.layoutVertexArray.length (= ' + + e.icon.layoutVertexArray.length + + ') / 4', + ); + if (e.bucketInstanceId in this.collisionCircleArrays) { + var g = this.collisionCircleArrays[e.bucketInstanceId]; + (e.placementInvProjMatrix = g.invProjMatrix), + (e.placementViewportMatrix = g.viewportMatrix), + (e.collisionCircleArray = g.circles), + delete this.collisionCircleArrays[e.bucketInstanceId]; + } + }), + (Mt.prototype.symbolFadeChange = function (t) { + return 0 === this.fadeDuration + ? 1 + : (t - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment; + }), + (Mt.prototype.zoomAdjustment = function (t) { + return Math.max(0, (this.transform.zoom - t) / 1.5); + }), + (Mt.prototype.hasTransitions = function (t) { + return ( + this.stale || t - this.lastPlacementChangeTime < this.fadeDuration + ); + }), + (Mt.prototype.stillRecent = function (t, e) { + var i = + this.zoomAtLastRecencyCheck === e ? 1 - this.zoomAdjustment(e) : 1; + return ( + (this.zoomAtLastRecencyCheck = e), + this.commitTime + this.fadeDuration * i > t + ); + }), + (Mt.prototype.setStale = function () { + this.stale = !0; + }); + var Rt = Math.pow(2, 25), + Lt = Math.pow(2, 24), + kt = Math.pow(2, 17), + Bt = Math.pow(2, 16), + Ot = Math.pow(2, 9), + Ft = Math.pow(2, 8), + Ut = Math.pow(2, 1); + function Nt(t) { + if (0 === t.opacity && !t.placed) return 0; + if (1 === t.opacity && t.placed) return 4294967295; + var e = t.placed ? 1 : 0, + i = Math.floor(127 * t.opacity); + return i * Rt + e * Lt + i * kt + e * Bt + i * Ot + e * Ft + i * Ut + e; + } + var Gt = 0, + jt = function (t) { + (this._sortAcrossTiles = + 'viewport-y' !== t.layout.get('symbol-z-order') && + !t.layout.get('symbol-sort-key').isConstant()), + (this._currentTileIndex = 0), + (this._currentPartIndex = 0), + (this._seenCrossTileIDs = {}), + (this._bucketParts = []); + }; + jt.prototype.continuePlacement = function (t, e, i, r, o) { + for (var a = this._bucketParts; this._currentTileIndex < t.length; ) + if ( + (e.getBucketParts( + a, + r, + t[this._currentTileIndex], + this._sortAcrossTiles, + ), + this._currentTileIndex++, + o()) + ) + return !0; + for ( + this._sortAcrossTiles && + ((this._sortAcrossTiles = !1), + a.sort(function (t, e) { + return t.sortKey - e.sortKey; + })); + this._currentPartIndex < a.length; + + ) + if ( + (e.placeLayerBucketPart( + a[this._currentPartIndex], + this._seenCrossTileIDs, + i, + ), + this._currentPartIndex++, + o()) + ) + return !0; + return !1; + }; + var Zt = function (t, e, i, r, o, a, n, s) { + (this.placement = new Mt(t, e, a, n, s)), + (this._currentPlacementIndex = i.length - 1), + (this._forceFullPlacement = r), + (this._showCollisionBoxes = o), + (this._done = !1); + }; + (Zt.prototype.isDone = function () { + return this._done; + }), + (Zt.prototype.continuePlacement = function (e, i, r) { + for ( + var o = this, + a = t.exported.now(), + n = function () { + var e = t.exported.now() - a; + return !o._forceFullPlacement && e > 2; + }; + this._currentPlacementIndex >= 0; + + ) { + var s = i[e[this._currentPlacementIndex]], + l = this.placement.collisionIndex.transform.zoom; + if ( + 'symbol' === s.type && + (!s.minzoom || s.minzoom <= l) && + (!s.maxzoom || s.maxzoom > l) + ) { + if ( + (this._inProgressLayer || (this._inProgressLayer = new jt(s)), + this._inProgressLayer.continuePlacement( + r[s.source], + this.placement, + this._showCollisionBoxes, + s, + n, + )) + ) + return; + delete this._inProgressLayer; + } + this._currentPlacementIndex--; + } + this._done = !0; + }), + (Zt.prototype.commit = function (t) { + return this.placement.commit(t), this.placement; + }); + var Vt = 512 / t.EXTENT / 2, + qt = function (t, e, i) { + (this.tileID = t), + (this.indexedSymbolInstances = {}), + (this.bucketInstanceId = i); + for (var r = 0; r < e.length; r++) { + var o = e.get(r), + a = o.key; + this.indexedSymbolInstances[a] || + (this.indexedSymbolInstances[a] = []), + this.indexedSymbolInstances[a].push({ + crossTileID: o.crossTileID, + coord: this.getScaledCoordinates(o, t), + }); + } + }; + (qt.prototype.getScaledCoordinates = function (e, i) { + var r = Vt / Math.pow(2, i.canonical.z - this.tileID.canonical.z); + return { + x: Math.floor((i.canonical.x * t.EXTENT + e.anchorX) * r), + y: Math.floor((i.canonical.y * t.EXTENT + e.anchorY) * r), + }; + }), + (qt.prototype.findMatches = function (t, e, i) { + for ( + var r = + this.tileID.canonical.z < e.canonical.z + ? 1 + : Math.pow(2, this.tileID.canonical.z - e.canonical.z), + o = 0; + o < t.length; + o++ + ) { + var a = t.get(o); + if (!a.crossTileID) { + var n = this.indexedSymbolInstances[a.key]; + if (n) + for ( + var s = this.getScaledCoordinates(a, e), l = 0, c = n; + l < c.length; + l += 1 + ) { + var h = c[l]; + if ( + Math.abs(h.coord.x - s.x) <= r && + Math.abs(h.coord.y - s.y) <= r && + !i[h.crossTileID] + ) { + (i[h.crossTileID] = !0), (a.crossTileID = h.crossTileID); + break; + } + } + } + } + }); + var Xt = function () { + this.maxCrossTileID = 0; + }; + Xt.prototype.generate = function () { + return ++this.maxCrossTileID; + }; + var Wt = function () { + (this.indexes = {}), (this.usedCrossTileIDs = {}), (this.lng = 0); + }; + (Wt.prototype.handleWrapJump = function (t) { + var e = Math.round((t - this.lng) / 360); + if (0 !== e) + for (var i in this.indexes) { + var r = this.indexes[i], + o = {}; + for (var a in r) { + var n = r[a]; + (n.tileID = n.tileID.unwrapTo(n.tileID.wrap + e)), + (o[n.tileID.key] = n); + } + this.indexes[i] = o; + } + this.lng = t; + }), + (Wt.prototype.addBucket = function (t, e, i) { + if (this.indexes[t.overscaledZ] && this.indexes[t.overscaledZ][t.key]) { + if ( + this.indexes[t.overscaledZ][t.key].bucketInstanceId === + e.bucketInstanceId + ) + return !1; + this.removeBucketCrossTileIDs( + t.overscaledZ, + this.indexes[t.overscaledZ][t.key], + ); + } + for (var r = 0; r < e.symbolInstances.length; r++) + e.symbolInstances.get(r).crossTileID = 0; + this.usedCrossTileIDs[t.overscaledZ] || + (this.usedCrossTileIDs[t.overscaledZ] = {}); + var o = this.usedCrossTileIDs[t.overscaledZ]; + for (var a in this.indexes) { + var n = this.indexes[a]; + if (Number(a) > t.overscaledZ) + for (var s in n) { + var l = n[s]; + l.tileID.isChildOf(t) && l.findMatches(e.symbolInstances, t, o); + } + else { + var c = n[t.scaledTo(Number(a)).key]; + c && c.findMatches(e.symbolInstances, t, o); + } + } + for (var h = 0; h < e.symbolInstances.length; h++) { + var u = e.symbolInstances.get(h); + u.crossTileID || + ((u.crossTileID = i.generate()), (o[u.crossTileID] = !0)); + } + return ( + void 0 === this.indexes[t.overscaledZ] && + (this.indexes[t.overscaledZ] = {}), + (this.indexes[t.overscaledZ][t.key] = new qt( + t, + e.symbolInstances, + e.bucketInstanceId, + )), + !0 + ); + }), + (Wt.prototype.removeBucketCrossTileIDs = function (t, e) { + for (var i in e.indexedSymbolInstances) + for (var r = 0, o = e.indexedSymbolInstances[i]; r < o.length; r += 1) + delete this.usedCrossTileIDs[t][o[r].crossTileID]; + }), + (Wt.prototype.removeStaleBuckets = function (t) { + var e = !1; + for (var i in this.indexes) { + var r = this.indexes[i]; + for (var o in r) + t[r[o].bucketInstanceId] || + (this.removeBucketCrossTileIDs(i, r[o]), delete r[o], (e = !0)); + } + return e; + }); + var Ht = function () { + (this.layerIndexes = {}), + (this.crossTileIDs = new Xt()), + (this.maxBucketInstanceId = 0), + (this.bucketsInCurrentPlacement = {}); + }; + (Ht.prototype.addLayer = function (t, e, i) { + var r = this.layerIndexes[t.id]; + void 0 === r && (r = this.layerIndexes[t.id] = new Wt()); + var o = !1, + a = {}; + r.handleWrapJump(i); + for (var n = 0, s = e; n < s.length; n += 1) { + var l = s[n], + c = l.getBucket(t); + c && + t.id === c.layerIds[0] && + (c.bucketInstanceId || + (c.bucketInstanceId = ++this.maxBucketInstanceId), + r.addBucket(l.tileID, c, this.crossTileIDs) && (o = !0), + (a[c.bucketInstanceId] = !0)); + } + return r.removeStaleBuckets(a) && (o = !0), o; + }), + (Ht.prototype.pruneUnusedLayers = function (t) { + var e = {}; + for (var i in (t.forEach(function (t) { + e[t] = !0; + }), + this.layerIndexes)) + e[i] || delete this.layerIndexes[i]; + }); + var Kt = t.createLayout([{ name: 'a_pos', type: 'Int16', components: 2 }]), + Yt = (function (e) { + function i(t) { + e.call(this), + (this.sourceCache = t), + (this._tiles = {}), + (this._renderableTilesKeys = []), + (this._sourceTileCache = {}), + (this.renderHistory = []), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.tileSize = 512), + (this.deltaZoom = 1), + (this.renderHistorySize = t._cache.max), + (t.usedForTerrain = !0), + (t.tileSize = this.tileSize * Math.pow(2, this.deltaZoom)); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.destruct = function () { + for (var t in ((this.sourceCache.usedForTerrain = !1), + (this.sourceCache.tileSize = null), + this._tiles)) { + var e = this._tiles[t]; + e.textures.forEach(function (t) { + return t.destroy(); + }), + (e.textures = []); + } + }), + (i.prototype.update = function (e, i) { + this.sourceCache.update(e, i), (this._renderableTilesKeys = []); + for ( + var r = 0, + o = e.coveringTiles({ + tileSize: this.tileSize, + minzoom: this.minzoom, + maxzoom: this.maxzoom, + reparseOverscaled: !1, + terrain: i, + }); + r < o.length; + r += 1 + ) { + var a = o[r]; + this._renderableTilesKeys.push(a.key), + this._tiles[a.key] || + ((a.posMatrix = new Float64Array(16)), + t.ortho(a.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + (this._tiles[a.key] = new O(a, this.tileSize))); + } + }), + (i.prototype.removeOutdated = function (t) { + var e = this, + i = {}; + this.renderHistory = this.renderHistory + .filter(function (t, i) { + return e.renderHistory.indexOf(t) === i; + }) + .slice(0, this.renderHistorySize); + for (var r = 0, o = this._renderableTilesKeys; r < o.length; r += 1) + i[o[r]] = !0; + for (var a = 0, n = this.renderHistory; a < n.length; a += 1) + i[n[a]] = !0; + for (var s in this._tiles) + i[s] || (this._tiles[s].clearTextures(t), delete this._tiles[s]); + }), + (i.prototype.getRenderableTiles = function () { + var t = this; + return this._renderableTilesKeys.map(function (e) { + return t.getTileByID(e); + }); + }), + (i.prototype.getTileByID = function (t) { + return this._tiles[t]; + }), + (i.prototype.getTerrainCoords = function (e) { + for ( + var i = {}, r = 0, o = this._renderableTilesKeys; + r < o.length; + r += 1 + ) { + var a = o[r], + n = this._tiles[a].tileID; + if (n.canonical.equals(e.canonical)) { + var s = e.clone(); + (s.posMatrix = new Float64Array(16)), + t.ortho(s.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + (i[a] = s); + } else if (n.canonical.isChildOf(e.canonical)) { + var l = e.clone(); + l.posMatrix = new Float64Array(16); + var c = n.canonical.z - e.canonical.z, + h = n.canonical.x - ((n.canonical.x >> c) << c), + u = n.canonical.y - ((n.canonical.y >> c) << c), + p = t.EXTENT >> c; + t.ortho(l.posMatrix, 0, p, 0, p, 0, 1), + t.translate(l.posMatrix, l.posMatrix, [-h * p, -u * p, 0]), + (i[a] = l); + } else if (e.canonical.isChildOf(n.canonical)) { + var d = e.clone(); + d.posMatrix = new Float64Array(16); + var _ = e.canonical.z - n.canonical.z, + f = e.canonical.x - ((e.canonical.x >> _) << _), + m = e.canonical.y - ((e.canonical.y >> _) << _), + g = t.EXTENT >> _; + t.ortho(d.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + t.translate(d.posMatrix, d.posMatrix, [f * g, m * g, 0]), + t.scale(d.posMatrix, d.posMatrix, [ + 1 / Math.pow(2, _), + 1 / Math.pow(2, _), + 0, + ]), + (i[a] = d); + } + } + return i; + }), + (i.prototype.getSourceTile = function (t, e) { + var i = this.sourceCache._source, + r = t.overscaledZ - this.deltaZoom; + if ((r > i.maxzoom && (r = i.maxzoom), r < i.minzoom)) return null; + this._sourceTileCache[t.key] || + (this._sourceTileCache[t.key] = t.scaledTo(r).key); + var o = this.sourceCache.getTileByID(this._sourceTileCache[t.key]); + if ((!o || !o.dem) && e) + for (; r >= i.minzoom && (!o || !o.dem); ) + o = this.sourceCache.getTileByID(t.scaledTo(r--).key); + return o; + }), + (i.prototype.tilesAfterTime = function (t) { + return ( + void 0 === t && (t = Date.now()), + Object.values(this._tiles).filter(function (e) { + return e.timeLoaded >= t; + }) + ); + }), + i + ); + })(t.Evented), + Jt = function (t, e, i) { + (this.style = t), + (this.sourceCache = new Yt(e)), + (this.options = i), + (this.exaggeration = + 'number' == typeof i.exaggeration ? i.exaggeration : 1), + (this.elevationOffset = + 'number' == typeof i.elevationOffset ? i.elevationOffset : 450), + (this.qualityFactor = 2), + (this.meshSize = 128), + (this._demMatrixCache = {}), + (this.coordsIndex = []), + (this._coordsTextureSize = 1024), + this.clearRerenderCache(); + }; + (Jt.prototype.getDEMElevation = function (e, i, r, o) { + if ( + (void 0 === o && (o = t.EXTENT), !(i >= 0 && i < o && r >= 0 && r < o)) + ) + return this.elevationOffset; + var a = 0, + n = this.getTerrainData(e); + if (n.tile && n.tile.dem) { + var s = t.transformMat4$1( + [], + [(i / o) * t.EXTENT, (r / o) * t.EXTENT], + n.u_terrain_matrix, + ), + l = [s[0] * n.tile.dem.dim, s[1] * n.tile.dem.dim], + c = [Math.floor(l[0]), Math.floor(l[1])], + h = n.tile.dem.get(c[0], c[1]), + u = n.tile.dem.get(c[0], c[1] + 1), + p = n.tile.dem.get(c[0] + 1, c[1]), + d = n.tile.dem.get(c[0] + 1, c[1] + 1); + a = t.number( + t.number(h, u, l[0] - c[0]), + t.number(p, d, l[0] - c[0]), + l[1] - c[1], + ); + } + return a; + }), + (Jt.prototype.rememberForRerender = function (t, e) { + for (var i in this.sourceCache._tiles) { + var r = this.sourceCache._tiles[i]; + (r.tileID.equals(e) || r.tileID.isChildOf(e)) && + (t === this.sourceCache.sourceCache.id && + (r.timeLoaded = Date.now()), + (this._rerender[t] = this._rerender[t] || {}), + (this._rerender[t][r.tileID.key] = !0)); + } + }), + (Jt.prototype.needsRerender = function (t, e) { + return this._rerender[t] && this._rerender[t][e.key]; + }), + (Jt.prototype.clearRerenderCache = function () { + this._rerender = {}; + }), + (Jt.prototype.getElevation = function (e, i, r, o) { + return ( + void 0 === o && (o = t.EXTENT), + (this.getDEMElevation(e, i, r, o) + this.elevationOffset) * + this.exaggeration + ); + }), + (Jt.prototype.getTerrainData = function (e) { + if (!this._emptyDemTexture) { + var i = this.style.map.painter.context, + r = new t.RGBAImage({ width: 1, height: 1 }, new Uint8Array(4)); + (this._emptyDepthTexture = new l(i, r, i.gl.RGBA, { + premultiply: !1, + })), + (this._emptyDemUnpack = [0, 0, 0, 0]), + (this._emptyDemTexture = new l( + i, + new t.RGBAImage({ width: 1, height: 1 }), + i.gl.RGBA, + { premultiply: !1 }, + )), + this._emptyDemTexture.bind(i.gl.NEAREST, i.gl.CLAMP_TO_EDGE), + (this._emptyDemMatrix = t.identity([])); + } + var o = this.sourceCache.getSourceTile(e, !0); + if (o && o.dem && (!o.demTexture || o.needsTerrainPrepare)) { + var a = this.style.map.painter.context; + (o.demTexture = this.style.map.painter.getTileTexture(o.dem.stride)), + o.demTexture + ? o.demTexture.update(o.dem.getPixels(), { premultiply: !1 }) + : (o.demTexture = new l(a, o.dem.getPixels(), a.gl.RGBA, { + premultiply: !1, + })), + o.demTexture.bind(a.gl.NEAREST, a.gl.CLAMP_TO_EDGE), + (o.needsTerrainPrepare = !1); + } + var n = o && o + o.tileID.key + e.key; + if (n && !this._demMatrixCache[n]) { + var s = this.sourceCache.sourceCache._source.maxzoom, + c = e.canonical.z - o.tileID.canonical.z; + e.overscaledZ > e.canonical.z && + (e.canonical.z >= s + ? (c = e.canonical.z - s) + : t.warnOnce( + 'cannot calculate elevation if elevation maxzoom > source.maxzoom', + )); + var h = e.canonical.x - ((e.canonical.x >> c) << c), + u = e.canonical.y - ((e.canonical.y >> c) << c), + p = t.fromScaling(new Float64Array(16), [ + 1 / (t.EXTENT << c), + 1 / (t.EXTENT << c), + 0, + ]); + t.translate(p, p, [h * t.EXTENT, u * t.EXTENT, 0]), + (this._demMatrixCache[e.key] = { matrix: p, coord: e }); + } + return { + u_depth: 2, + u_terrain: 3, + u_terrain_dim: (o && o.dem && o.dem.dim) || 1, + u_terrain_matrix: n + ? this._demMatrixCache[e.key].matrix + : this._emptyDemMatrix, + u_terrain_unpack: + (o && o.dem && o.dem.getUnpackVector()) || this._emptyDemUnpack, + u_terrain_offset: this.elevationOffset, + u_terrain_exaggeration: this.exaggeration, + texture: ((o && o.demTexture) || this._emptyDemTexture).texture, + depthTexture: (this._fboDepthTexture || this._emptyDepthTexture) + .texture, + tile: o, + }; + }), + (Jt.prototype.getRTTFramebuffer = function () { + var t = this.style.map.painter; + if (!this._rttFramebuffer) { + var e = this.sourceCache.tileSize * this.qualityFactor; + (this._rttFramebuffer = t.context.createFramebuffer(e, e, !0)), + this._rttFramebuffer.depthAttachment.set( + t.context.createRenderbuffer( + t.context.gl.DEPTH_COMPONENT16, + e, + e, + ), + ); + } + return this._rttFramebuffer; + }), + (Jt.prototype.getFramebuffer = function (t) { + var e = this.style.map.painter, + i = e.width / devicePixelRatio, + r = e.height / devicePixelRatio; + return ( + !this._fbo || + (this._fbo.width === i && this._fbo.height === r) || + (this._fbo.destroy(), + this._fboCoordsTexture.destroy(), + this._fboDepthTexture.destroy(), + delete this._fbo, + delete this._fboDepthTexture, + delete this._fboCoordsTexture), + this._fboCoordsTexture || + ((this._fboCoordsTexture = new l( + e.context, + { width: i, height: r, data: null }, + e.context.gl.RGBA, + { premultiply: !1 }, + )), + this._fboCoordsTexture.bind( + e.context.gl.NEAREST, + e.context.gl.CLAMP_TO_EDGE, + )), + this._fboDepthTexture || + ((this._fboDepthTexture = new l( + e.context, + { width: i, height: r, data: null }, + e.context.gl.RGBA, + { premultiply: !1 }, + )), + this._fboDepthTexture.bind( + e.context.gl.NEAREST, + e.context.gl.CLAMP_TO_EDGE, + )), + this._fbo || + ((this._fbo = e.context.createFramebuffer(i, r, !0)), + this._fbo.depthAttachment.set( + e.context.createRenderbuffer( + e.context.gl.DEPTH_COMPONENT16, + i, + r, + ), + )), + this._fbo.colorAttachment.set( + 'coords' === t + ? this._fboCoordsTexture.texture + : this._fboDepthTexture.texture, + ), + this._fbo + ); + }), + (Jt.prototype.getCoordsTexture = function () { + var e = this.style.map.painter.context; + if (this._coordsTexture) return this._coordsTexture; + for ( + var i = new Uint8Array( + this._coordsTextureSize * this._coordsTextureSize * 4, + ), + r = 0, + o = 0; + r < this._coordsTextureSize; + r++ + ) + for (var a = 0; a < this._coordsTextureSize; a++, o += 4) + (i[o + 0] = 255 & a), + (i[o + 1] = 255 & r), + (i[o + 2] = ((a >> 8) << 4) | (r >> 8)), + (i[o + 3] = 0); + var n = new t.RGBAImage( + { width: this._coordsTextureSize, height: this._coordsTextureSize }, + new Uint8Array(i.buffer), + ), + s = new l(e, n, e.gl.RGBA, { premultiply: !1 }); + return ( + s.bind(e.gl.NEAREST, e.gl.CLAMP_TO_EDGE), (this._coordsTexture = s), s + ); + }), + (Jt.prototype.pointCoordinate = function (e) { + var i = new Uint8Array(4), + r = this.style.map.painter, + o = r.context, + a = o.gl; + o.bindFramebuffer.set(this.getFramebuffer('coords').framebuffer), + a.readPixels( + e.x, + r.height / devicePixelRatio - e.y - 1, + 1, + 1, + a.RGBA, + a.UNSIGNED_BYTE, + i, + ), + o.bindFramebuffer.set(null); + var n = i[0] + ((i[2] >> 4) << 8), + s = i[1] + ((15 & i[2]) << 8), + l = this.coordsIndex[255 - i[3]], + c = l && this.sourceCache.getTileByID(l); + if (!c) return null; + var h = this._coordsTextureSize, + u = (1 << c.tileID.canonical.z) * h; + return new t.MercatorCoordinate( + (c.tileID.canonical.x * h + n) / u, + (c.tileID.canonical.y * h + s) / u, + this.getElevation(c.tileID, n, s, h), + ); + }), + (Jt.prototype.getTerrainMesh = function () { + if (this._mesh) return this._mesh; + for ( + var e = this.style.map.painter.context, + i = new t.PosArray(), + r = new t.TriangleIndexArray(), + o = this.meshSize, + a = t.EXTENT / o, + n = o * o, + s = 0; + s <= o; + s++ + ) + for (var l = 0; l <= o; l++) i.emplaceBack(l * a, s * a); + for (var c = 0; c < n; c += o + 1) + for (var h = 0; h < o; h++) + r.emplaceBack(h + c, o + h + c + 1, o + h + c + 2), + r.emplaceBack(h + c, o + h + c + 2, h + c + 1); + return ( + (this._mesh = { + indexBuffer: e.createIndexBuffer(r), + vertexBuffer: e.createVertexBuffer(i, Kt.members), + segments: t.SegmentVector.simpleSegment(0, 0, i.length, r.length), + }), + this._mesh + ); + }), + (Jt.prototype.getMinMaxElevation = function (t) { + var e = this.getTerrainData(t).tile, + i = { minElevation: null, maxElevation: null }; + return ( + e && + e.dem && + ((i.minElevation = + (e.dem.min + this.elevationOffset) * this.exaggeration), + (i.maxElevation = + (e.dem.max + this.elevationOffset) * this.exaggeration)), + i + ); + }); + var Qt = function (e, i) { + return t.emitValidationErrors( + e, + i && + i.filter(function (t) { + return 'source.canvas' !== t.identifier; + }), + ); + }, + $t = t.pick(Y, [ + 'addLayer', + 'removeLayer', + 'setPaintProperty', + 'setLayoutProperty', + 'setFilter', + 'addSource', + 'removeSource', + 'setLayerZoomRange', + 'setLight', + 'setTransition', + 'setGeoJSONSourceData', + ]), + te = t.pick(Y, ['setCenter', 'setZoom', 'setBearing', 'setPitch']), + ee = (function () { + var e = {}, + i = t.spec.$version; + for (var r in t.spec.$root) { + var o, + a = t.spec.$root[r]; + if (a.required) + null != (o = 'version' === r ? i : 'array' === a.type ? [] : {}) && + (e[r] = o); + } + return e; + })(), + ie = (function (e) { + function i(r, o) { + var a = this; + void 0 === o && (o = {}), + e.call(this), + (this.map = r), + (this.dispatcher = new b(W(), this)), + (this.imageManager = new h()), + this.imageManager.setEventedParent(this), + (this.glyphManager = new f( + r._requestManager, + o.localIdeographFontFamily, + )), + (this.lineAtlas = new x(256, 512)), + (this.crossTileSymbolIndex = new Ht()), + (this._layers = {}), + (this._serializedLayers = {}), + (this._order = []), + (this.sourceCaches = {}), + (this.zoomHistory = new t.ZoomHistory()), + (this._loaded = !1), + (this._availableImages = []), + this._resetUpdates(), + this.dispatcher.broadcast('setReferrer', t.getReferrer()); + var n = this; + (this._rtlTextPluginCallback = i.registerForPluginStateChange( + function (e) { + n.dispatcher.broadcast( + 'syncRTLPluginState', + { pluginStatus: e.pluginStatus, pluginURL: e.pluginURL }, + function (e, i) { + if ( + (t.triggerPluginCompletionEvent(e), + i && + i.every(function (t) { + return t; + })) + ) + for (var r in n.sourceCaches) n.sourceCaches[r].reload(); + }, + ); + }, + )), + this.on('data', function (t) { + if ('source' === t.dataType && 'metadata' === t.sourceDataType) { + var e = a.sourceCaches[t.sourceId]; + if (e) { + var i = e.getSource(); + if (i && i.vectorLayerIds) + for (var r in a._layers) { + var o = a._layers[r]; + o.source === i.id && a._validateLayer(o); + } + } + } + }); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.loadURL = function (e, i) { + var r = this; + void 0 === i && (i = {}), + this.fire(new t.Event('dataloading', { dataType: 'style' })); + var o = 'boolean' != typeof i.validate || i.validate, + a = this.map._requestManager.transformRequest( + e, + t.ResourceType.Style, + ); + this._request = t.getJSON(a, function (e, i) { + (r._request = null), + e ? r.fire(new t.ErrorEvent(e)) : i && r._load(i, o); + }); + }), + (i.prototype.loadJSON = function (e, i) { + var r = this; + void 0 === i && (i = {}), + this.fire(new t.Event('dataloading', { dataType: 'style' })), + (this._request = t.exported.frame(function () { + (r._request = null), r._load(e, !1 !== i.validate); + })); + }), + (i.prototype.loadEmpty = function () { + this.fire(new t.Event('dataloading', { dataType: 'style' })), + this._load(ee, !1); + }), + (i.prototype._load = function (e, i) { + if (!i || !Qt(this, t.validateStyle(e))) { + for (var r in ((this._loaded = !0), + (this.stylesheet = e), + e.sources)) + this.addSource(r, e.sources[r], { validate: !1 }); + e.sprite + ? this._loadSprite(e.sprite) + : this.imageManager.setLoaded(!0), + this.glyphManager.setURL(e.glyphs); + var o = K(this.stylesheet.layers); + (this._order = o.map(function (t) { + return t.id; + })), + (this._layers = {}), + (this._serializedLayers = {}); + for (var a = 0, n = o; a < n.length; a += 1) { + var s = n[a]; + (s = t.createStyleLayer(s)).setEventedParent(this, { + layer: { id: s.id }, + }), + (this._layers[s.id] = s), + (this._serializedLayers[s.id] = s.serialize()); + } + this.dispatcher.broadcast( + 'setLayers', + this._serializeLayers(this._order), + ), + (this.light = new y(this.stylesheet.light)), + this.setTerrain(this.stylesheet.terrain), + this.fire(new t.Event('data', { dataType: 'style' })), + this.fire(new t.Event('style.load')); + } + }), + (i.prototype._loadSprite = function (e) { + var i = this; + this._spriteRequest = (function (e, i, r, o) { + var a, + n, + s, + l = r > 1 ? '@2x' : '', + c = t.getJSON( + i.transformRequest( + i.normalizeSpriteURL(e, l, '.json'), + t.ResourceType.SpriteJSON, + ), + function (t, e) { + (c = null), s || ((s = t), (a = e), u()); + }, + ), + h = t.getImage( + i.transformRequest( + i.normalizeSpriteURL(e, l, '.png'), + t.ResourceType.SpriteImage, + ), + function (t, e) { + (h = null), s || ((s = t), (n = e), u()); + }, + ); + function u() { + if (s) o(s); + else if (a && n) { + var e = t.exported.getImageData(n), + i = {}; + for (var r in a) { + var l = a[r], + c = l.width, + h = l.height, + u = l.x, + p = l.y, + d = l.sdf, + _ = l.pixelRatio, + f = l.stretchX, + m = l.stretchY, + g = l.content, + v = new t.RGBAImage({ width: c, height: h }); + t.RGBAImage.copy( + e, + v, + { x: u, y: p }, + { x: 0, y: 0 }, + { width: c, height: h }, + ), + (i[r] = { + data: v, + pixelRatio: _, + sdf: d, + stretchX: f, + stretchY: m, + content: g, + }); + } + o(null, i); + } + } + return { + cancel: function () { + c && (c.cancel(), (c = null)), h && (h.cancel(), (h = null)); + }, + }; + })( + e, + this.map._requestManager, + this.map.getPixelRatio(), + function (e, r) { + if (((i._spriteRequest = null), e)) i.fire(new t.ErrorEvent(e)); + else if (r) for (var o in r) i.imageManager.addImage(o, r[o]); + i.imageManager.setLoaded(!0), + (i._availableImages = i.imageManager.listImages()), + i.dispatcher.broadcast('setImages', i._availableImages), + i.fire(new t.Event('data', { dataType: 'style' })); + }, + ); + }), + (i.prototype._validateLayer = function (e) { + var i = this.sourceCaches[e.source]; + if (i) { + var r = e.sourceLayer; + if (r) { + var o = i.getSource(); + ('geojson' === o.type || + (o.vectorLayerIds && -1 === o.vectorLayerIds.indexOf(r))) && + this.fire( + new t.ErrorEvent( + new Error( + 'Source layer "' + + r + + '" does not exist on source "' + + o.id + + '" as specified by style layer "' + + e.id + + '".', + ), + ), + ); + } + } + }), + (i.prototype.loaded = function () { + if (!this._loaded) return !1; + if (Object.keys(this._updatedSources).length) return !1; + for (var t in this.sourceCaches) + if (!this.sourceCaches[t].loaded()) return !1; + return !!this.imageManager.isLoaded(); + }), + (i.prototype._serializeLayers = function (t) { + for (var e = [], i = 0, r = t; i < r.length; i += 1) { + var o = this._layers[r[i]]; + 'custom' !== o.type && e.push(o.serialize()); + } + return e; + }), + (i.prototype.hasTransitions = function () { + if (this.light && this.light.hasTransition()) return !0; + for (var t in this.sourceCaches) + if (this.sourceCaches[t].hasTransition()) return !0; + for (var e in this._layers) + if (this._layers[e].hasTransition()) return !0; + return !1; + }), + (i.prototype._checkLoaded = function () { + if (!this._loaded) throw new Error('Style is not done loading.'); + }), + (i.prototype.update = function (e) { + if (this._loaded) { + var i = this._changed; + if (this._changed) { + var r = Object.keys(this._updatedLayers), + o = Object.keys(this._removedLayers); + for (var a in ((r.length || o.length) && + this._updateWorkerLayers(r, o), + this._updatedSources)) { + var n = this._updatedSources[a]; + if ('reload' === n) this._reloadSource(a); + else { + if ('clear' !== n) throw new Error('Invalid action ' + n); + this._clearSource(a); + } + } + for (var s in (this._updateTilesForChangedImages(), + this._updatedPaintProps)) + this._layers[s].updateTransitions(e); + this.light.updateTransitions(e), this._resetUpdates(); + } + var l = {}; + for (var c in this.sourceCaches) { + var h = this.sourceCaches[c]; + (l[c] = h.used), (h.used = !1); + } + for (var u = 0, p = this._order; u < p.length; u += 1) { + var d = this._layers[p[u]]; + d.recalculate(e, this._availableImages), + !d.isHidden(e.zoom) && + d.source && + (this.sourceCaches[d.source].used = !0); + } + for (var _ in l) { + var f = this.sourceCaches[_]; + l[_] !== f.used && + f.fire( + new t.Event('data', { + sourceDataType: 'visibility', + dataType: 'source', + sourceId: _, + }), + ); + } + this.light.recalculate(e), + (this.z = e.zoom), + i && this.fire(new t.Event('data', { dataType: 'style' })); + } + }), + (i.prototype._updateTilesForChangedImages = function () { + var t = Object.keys(this._changedImages); + if (t.length) { + for (var e in this.sourceCaches) + this.sourceCaches[e].reloadTilesForDependencies( + ['icons', 'patterns'], + t, + ); + this._changedImages = {}; + } + }), + (i.prototype._updateWorkerLayers = function (t, e) { + this.dispatcher.broadcast('updateLayers', { + layers: this._serializeLayers(t), + removedIds: e, + }); + }), + (i.prototype._resetUpdates = function () { + (this._changed = !1), + (this._updatedLayers = {}), + (this._removedLayers = {}), + (this._updatedSources = {}), + (this._updatedPaintProps = {}), + (this._changedImages = {}); + }), + (i.prototype.setTerrain = function (e) { + var i = this; + if ( + (this._checkLoaded(), + this._terrainDataCallback && + this.off('data', this._terrainDataCallback), + this._terrainfreezeElevationCallback && + this.map.off( + 'freezeElevation', + this._terrainfreezeElevationCallback, + ), + e) + ) { + var r = this.sourceCaches[e.source]; + if (!r) + throw new Error( + 'cannot load terrain, because there exists no source with ID: ' + + e.source, + ); + (this.terrain = new Jt(this, r, e)), + this.map.transform.updateElevation(this.terrain), + (this._terrainfreezeElevationCallback = function (t) { + t.freeze + ? (i.map.transform.freezeElevation = !0) + : ((i.map.transform.freezeElevation = !1), + i.map.transform.recalculateZoom(i.terrain)); + }), + (this._terrainDataCallback = function (t) { + t.tile && + (t.sourceId === e.source + ? (i.map.transform.updateElevation(i.terrain), + i.terrain.rememberForRerender( + t.sourceId, + t.tile.tileID, + )) + : 'geojson' === t.source.type && + i.terrain.rememberForRerender( + t.sourceId, + t.tile.tileID, + )); + }), + this.on('data', this._terrainDataCallback), + this.map.on( + 'freezeElevation', + this._terrainfreezeElevationCallback, + ); + } else + this.terrain && this.terrain.sourceCache.destruct(), + (this.terrain = null), + this.map.transform.updateElevation(this.terrain); + this.map.fire(new t.Event('terrain', { terrain: e })); + }), + (i.prototype.setState = function (e) { + var i = this; + if ((this._checkLoaded(), Qt(this, t.validateStyle(e)))) return !1; + (e = t.clone$1(e)).layers = K(e.layers); + var r = (function (t, e) { + if (!t) return [{ command: Y.setStyle, args: [e] }]; + var i = []; + try { + if (!o(t.version, e.version)) + return [{ command: Y.setStyle, args: [e] }]; + o(t.center, e.center) || + i.push({ command: Y.setCenter, args: [e.center] }), + o(t.zoom, e.zoom) || + i.push({ command: Y.setZoom, args: [e.zoom] }), + o(t.bearing, e.bearing) || + i.push({ command: Y.setBearing, args: [e.bearing] }), + o(t.pitch, e.pitch) || + i.push({ command: Y.setPitch, args: [e.pitch] }), + o(t.sprite, e.sprite) || + i.push({ command: Y.setSprite, args: [e.sprite] }), + o(t.glyphs, e.glyphs) || + i.push({ command: Y.setGlyphs, args: [e.glyphs] }), + o(t.transition, e.transition) || + i.push({ command: Y.setTransition, args: [e.transition] }), + o(t.light, e.light) || + i.push({ command: Y.setLight, args: [e.light] }); + var r = {}, + a = []; + !(function (t, e, i, r) { + var a; + for (a in ((e = e || {}), (t = t || {}))) + Object.prototype.hasOwnProperty.call(t, a) && + (Object.prototype.hasOwnProperty.call(e, a) || + Q(a, i, r)); + for (a in e) + Object.prototype.hasOwnProperty.call(e, a) && + (Object.prototype.hasOwnProperty.call(t, a) + ? o(t[a], e[a]) || + ('geojson' === t[a].type && + 'geojson' === e[a].type && + tt(t, e, a) + ? i.push({ + command: Y.setGeoJSONSourceData, + args: [a, e[a].data], + }) + : $(a, e, i, r)) + : J(a, e, i)); + })(t.sources, e.sources, a, r); + var n = []; + t.layers && + t.layers.forEach(function (t) { + r[t.source] + ? i.push({ command: Y.removeLayer, args: [t.id] }) + : n.push(t); + }), + (i = i.concat(a)), + (function (t, e, i) { + e = e || []; + var r, + a, + n, + s, + l, + c, + h, + u = (t = t || []).map(it), + p = e.map(it), + d = t.reduce(rt, {}), + _ = e.reduce(rt, {}), + f = u.slice(), + m = Object.create(null); + for (r = 0, a = 0; r < u.length; r++) + (n = u[r]), + Object.prototype.hasOwnProperty.call(_, n) + ? a++ + : (i.push({ command: Y.removeLayer, args: [n] }), + f.splice(f.indexOf(n, a), 1)); + for (r = 0, a = 0; r < p.length; r++) + f[f.length - 1 - r] !== (n = p[p.length - 1 - r]) && + (Object.prototype.hasOwnProperty.call(d, n) + ? (i.push({ command: Y.removeLayer, args: [n] }), + f.splice(f.lastIndexOf(n, f.length - a), 1)) + : a++, + i.push({ + command: Y.addLayer, + args: [_[n], (c = f[f.length - r])], + }), + f.splice(f.length - r, 0, n), + (m[n] = !0)); + for (r = 0; r < p.length; r++) + if (((s = d[(n = p[r])]), (l = _[n]), !m[n] && !o(s, l))) + if ( + o(s.source, l.source) && + o(s['source-layer'], l['source-layer']) && + o(s.type, l.type) + ) { + for (h in (et( + s.layout, + l.layout, + i, + n, + null, + Y.setLayoutProperty, + ), + et(s.paint, l.paint, i, n, null, Y.setPaintProperty), + o(s.filter, l.filter) || + i.push({ + command: Y.setFilter, + args: [n, l.filter], + }), + (o(s.minzoom, l.minzoom) && + o(s.maxzoom, l.maxzoom)) || + i.push({ + command: Y.setLayerZoomRange, + args: [n, l.minzoom, l.maxzoom], + }), + s)) + Object.prototype.hasOwnProperty.call(s, h) && + 'layout' !== h && + 'paint' !== h && + 'filter' !== h && + 'metadata' !== h && + 'minzoom' !== h && + 'maxzoom' !== h && + (0 === h.indexOf('paint.') + ? et( + s[h], + l[h], + i, + n, + h.slice(6), + Y.setPaintProperty, + ) + : o(s[h], l[h]) || + i.push({ + command: Y.setLayerProperty, + args: [n, h, l[h]], + })); + for (h in l) + Object.prototype.hasOwnProperty.call(l, h) && + !Object.prototype.hasOwnProperty.call(s, h) && + 'layout' !== h && + 'paint' !== h && + 'filter' !== h && + 'metadata' !== h && + 'minzoom' !== h && + 'maxzoom' !== h && + (0 === h.indexOf('paint.') + ? et( + s[h], + l[h], + i, + n, + h.slice(6), + Y.setPaintProperty, + ) + : o(s[h], l[h]) || + i.push({ + command: Y.setLayerProperty, + args: [n, h, l[h]], + })); + } else + i.push({ command: Y.removeLayer, args: [n] }), + (c = f[f.lastIndexOf(n) + 1]), + i.push({ command: Y.addLayer, args: [l, c] }); + })(n, e.layers, i); + } catch (t) { + console.warn('Unable to compute style diff:', t), + (i = [{ command: Y.setStyle, args: [e] }]); + } + return i; + })(this.serialize(), e).filter(function (t) { + return !(t.command in te); + }); + if (0 === r.length) return !1; + var a = r.filter(function (t) { + return !(t.command in $t); + }); + if (a.length > 0) + throw new Error( + 'Unimplemented: ' + + a + .map(function (t) { + return t.command; + }) + .join(', ') + + '.', + ); + return ( + r.forEach(function (t) { + 'setTransition' !== t.command && i[t.command].apply(i, t.args); + }), + (this.stylesheet = e), + !0 + ); + }), + (i.prototype.addImage = function (e, i) { + if (this.getImage(e)) + return this.fire( + new t.ErrorEvent( + new Error('An image named "' + e + '" already exists.'), + ), + ); + this.imageManager.addImage(e, i), this._afterImageUpdated(e); + }), + (i.prototype.updateImage = function (t, e) { + this.imageManager.updateImage(t, e); + }), + (i.prototype.getImage = function (t) { + return this.imageManager.getImage(t); + }), + (i.prototype.removeImage = function (e) { + if (!this.getImage(e)) + return this.fire( + new t.ErrorEvent( + new Error('An image named "' + e + '" does not exist.'), + ), + ); + this.imageManager.removeImage(e), this._afterImageUpdated(e); + }), + (i.prototype._afterImageUpdated = function (e) { + (this._availableImages = this.imageManager.listImages()), + (this._changedImages[e] = !0), + (this._changed = !0), + this.dispatcher.broadcast('setImages', this._availableImages), + this.fire(new t.Event('data', { dataType: 'style' })); + }), + (i.prototype.listImages = function () { + return this._checkLoaded(), this.imageManager.listImages(); + }), + (i.prototype.addSource = function (e, i, r) { + var o = this; + if ( + (void 0 === r && (r = {}), + this._checkLoaded(), + void 0 !== this.sourceCaches[e]) + ) + throw new Error('Source "' + e + '" already exists.'); + if (!i.type) + throw new Error( + 'The type property must be defined, but only the following properties were given: ' + + Object.keys(i).join(', ') + + '.', + ); + if ( + !( + ['vector', 'raster', 'geojson', 'video', 'image'].indexOf( + i.type, + ) >= 0 && + this._validate( + t.validateStyle.source, + 'sources.' + e, + i, + null, + r, + ) + ) + ) { + this.map && + this.map._collectResourceTiming && + (i.collectResourceTiming = !0); + var a = (this.sourceCaches[e] = new N(e, i, this.dispatcher)); + (a.style = this), + a.setEventedParent(this, function () { + return { + isSourceLoaded: o.loaded(), + source: a.serialize(), + sourceId: e, + }; + }), + a.onAdd(this.map), + (this._changed = !0); + } + }), + (i.prototype.removeSource = function (e) { + if ((this._checkLoaded(), void 0 === this.sourceCaches[e])) + throw new Error('There is no source with this ID'); + for (var i in this._layers) + if (this._layers[i].source === e) + return this.fire( + new t.ErrorEvent( + new Error( + 'Source "' + + e + + '" cannot be removed while layer "' + + i + + '" is using it.', + ), + ), + ); + var r = this.sourceCaches[e]; + delete this.sourceCaches[e], + delete this._updatedSources[e], + r.fire( + new t.Event('data', { + sourceDataType: 'metadata', + dataType: 'source', + sourceId: e, + }), + ), + r.setEventedParent(null), + r.onRemove(this.map), + (this._changed = !0); + }), + (i.prototype.setGeoJSONSourceData = function (t, e) { + if ((this._checkLoaded(), void 0 === this.sourceCaches[t])) + throw new Error('There is no source with this ID=' + t); + var i = this.sourceCaches[t].getSource(); + if ('geojson' !== i.type) + throw new Error( + 'geojsonSource.type is ' + i.type + ", which is !== 'geojson", + ); + i.setData(e), (this._changed = !0); + }), + (i.prototype.getSource = function (t) { + return this.sourceCaches[t] && this.sourceCaches[t].getSource(); + }), + (i.prototype.addLayer = function (e, i, r) { + void 0 === r && (r = {}), this._checkLoaded(); + var o = e.id; + if (this.getLayer(o)) + this.fire( + new t.ErrorEvent( + new Error('Layer "' + o + '" already exists on this map.'), + ), + ); + else { + var a; + if ('custom' === e.type) { + if (Qt(this, t.validateCustomStyleLayer(e))) return; + a = t.createStyleLayer(e); + } else { + if ( + ('object' == typeof e.source && + (this.addSource(o, e.source), + (e = t.clone$1(e)), + (e = t.extend(e, { source: o }))), + this._validate( + t.validateStyle.layer, + 'layers.' + o, + e, + { arrayIndex: -1 }, + r, + )) + ) + return; + (a = t.createStyleLayer(e)), + this._validateLayer(a), + a.setEventedParent(this, { layer: { id: o } }), + (this._serializedLayers[a.id] = a.serialize()); + } + var n = i ? this._order.indexOf(i) : this._order.length; + if (i && -1 === n) + this.fire( + new t.ErrorEvent( + new Error( + 'Cannot add layer "' + + o + + '" before non-existing layer "' + + i + + '".', + ), + ), + ); + else { + if ( + (this._order.splice(n, 0, o), + (this._layerOrderChanged = !0), + (this._layers[o] = a), + this._removedLayers[o] && a.source && 'custom' !== a.type) + ) { + var s = this._removedLayers[o]; + delete this._removedLayers[o], + s.type !== a.type + ? (this._updatedSources[a.source] = 'clear') + : ((this._updatedSources[a.source] = 'reload'), + this.sourceCaches[a.source].pause()); + } + this._updateLayer(a), a.onAdd && a.onAdd(this.map); + } + } + }), + (i.prototype.moveLayer = function (e, i) { + if ((this._checkLoaded(), (this._changed = !0), this._layers[e])) { + if (e !== i) { + var r = this._order.indexOf(e); + this._order.splice(r, 1); + var o = i ? this._order.indexOf(i) : this._order.length; + i && -1 === o + ? this.fire( + new t.ErrorEvent( + new Error( + 'Cannot move layer "' + + e + + '" before non-existing layer "' + + i + + '".', + ), + ), + ) + : (this._order.splice(o, 0, e), + (this._layerOrderChanged = !0)); + } + } else + this.fire( + new t.ErrorEvent( + new Error( + "The layer '" + + e + + "' does not exist in the map's style and cannot be moved.", + ), + ), + ); + }), + (i.prototype.removeLayer = function (e) { + this._checkLoaded(); + var i = this._layers[e]; + if (i) { + i.setEventedParent(null); + var r = this._order.indexOf(e); + this._order.splice(r, 1), + (this._layerOrderChanged = !0), + (this._changed = !0), + (this._removedLayers[e] = i), + delete this._layers[e], + delete this._serializedLayers[e], + delete this._updatedLayers[e], + delete this._updatedPaintProps[e], + i.onRemove && i.onRemove(this.map); + } else + this.fire( + new t.ErrorEvent( + new Error('Cannot remove non-existing layer "' + e + '".'), + ), + ); + }), + (i.prototype.getLayer = function (t) { + return this._layers[t]; + }), + (i.prototype.hasLayer = function (t) { + return t in this._layers; + }), + (i.prototype.setLayerZoomRange = function (e, i, r) { + this._checkLoaded(); + var o = this.getLayer(e); + o + ? (o.minzoom === i && o.maxzoom === r) || + (null != i && (o.minzoom = i), + null != r && (o.maxzoom = r), + this._updateLayer(o)) + : this.fire( + new t.ErrorEvent( + new Error( + 'Cannot set the zoom range of non-existing layer "' + + e + + '".', + ), + ), + ); + }), + (i.prototype.setFilter = function (e, i, r) { + void 0 === r && (r = {}), this._checkLoaded(); + var a = this.getLayer(e); + if (a) { + if (!o(a.filter, i)) + return null == i + ? ((a.filter = void 0), void this._updateLayer(a)) + : void ( + this._validate( + t.validateStyle.filter, + 'layers.' + a.id + '.filter', + i, + null, + r, + ) || ((a.filter = t.clone$1(i)), this._updateLayer(a)) + ); + } else + this.fire( + new t.ErrorEvent( + new Error('Cannot filter non-existing layer "' + e + '".'), + ), + ); + }), + (i.prototype.getFilter = function (e) { + return t.clone$1(this.getLayer(e).filter); + }), + (i.prototype.setLayoutProperty = function (e, i, r, a) { + void 0 === a && (a = {}), this._checkLoaded(); + var n = this.getLayer(e); + n + ? o(n.getLayoutProperty(i), r) || + (n.setLayoutProperty(i, r, a), this._updateLayer(n)) + : this.fire( + new t.ErrorEvent( + new Error('Cannot style non-existing layer "' + e + '".'), + ), + ); + }), + (i.prototype.getLayoutProperty = function (e, i) { + var r = this.getLayer(e); + if (r) return r.getLayoutProperty(i); + this.fire( + new t.ErrorEvent( + new Error( + 'Cannot get style of non-existing layer "' + e + '".', + ), + ), + ); + }), + (i.prototype.setPaintProperty = function (e, i, r, a) { + void 0 === a && (a = {}), this._checkLoaded(); + var n = this.getLayer(e); + n + ? o(n.getPaintProperty(i), r) || + (n.setPaintProperty(i, r, a) && this._updateLayer(n), + (this._changed = !0), + (this._updatedPaintProps[e] = !0)) + : this.fire( + new t.ErrorEvent( + new Error('Cannot style non-existing layer "' + e + '".'), + ), + ); + }), + (i.prototype.getPaintProperty = function (t, e) { + return this.getLayer(t).getPaintProperty(e); + }), + (i.prototype.setFeatureState = function (e, i) { + this._checkLoaded(); + var r = e.source, + o = e.sourceLayer, + a = this.sourceCaches[r]; + if (void 0 !== a) { + var n = a.getSource().type; + 'geojson' === n && o + ? this.fire( + new t.ErrorEvent( + new Error( + 'GeoJSON sources cannot have a sourceLayer parameter.', + ), + ), + ) + : 'vector' !== n || o + ? (void 0 === e.id && + this.fire( + new t.ErrorEvent( + new Error('The feature id parameter must be provided.'), + ), + ), + a.setFeatureState(o, e.id, i)) + : this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + } else + this.fire( + new t.ErrorEvent( + new Error( + "The source '" + r + "' does not exist in the map's style.", + ), + ), + ); + }), + (i.prototype.removeFeatureState = function (e, i) { + this._checkLoaded(); + var r = e.source, + o = this.sourceCaches[r]; + if (void 0 !== o) { + var a = o.getSource().type, + n = 'vector' === a ? e.sourceLayer : void 0; + 'vector' !== a || n + ? i && 'string' != typeof e.id && 'number' != typeof e.id + ? this.fire( + new t.ErrorEvent( + new Error( + 'A feature id is required to remove its specific state property.', + ), + ), + ) + : o.removeFeatureState(n, e.id, i) + : this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + } else + this.fire( + new t.ErrorEvent( + new Error( + "The source '" + r + "' does not exist in the map's style.", + ), + ), + ); + }), + (i.prototype.getFeatureState = function (e) { + this._checkLoaded(); + var i = e.source, + r = e.sourceLayer, + o = this.sourceCaches[i]; + if (void 0 !== o) { + if ('vector' !== o.getSource().type || r) + return ( + void 0 === e.id && + this.fire( + new t.ErrorEvent( + new Error('The feature id parameter must be provided.'), + ), + ), + o.getFeatureState(r, e.id) + ); + this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + } else + this.fire( + new t.ErrorEvent( + new Error( + "The source '" + i + "' does not exist in the map's style.", + ), + ), + ); + }), + (i.prototype.getTransition = function () { + return t.extend( + { duration: 300, delay: 0 }, + this.stylesheet && this.stylesheet.transition, + ); + }), + (i.prototype.serialize = function () { + return t.filterObject( + { + version: this.stylesheet.version, + name: this.stylesheet.name, + metadata: this.stylesheet.metadata, + light: this.stylesheet.light, + center: this.stylesheet.center, + zoom: this.stylesheet.zoom, + bearing: this.stylesheet.bearing, + pitch: this.stylesheet.pitch, + sprite: this.stylesheet.sprite, + glyphs: this.stylesheet.glyphs, + transition: this.stylesheet.transition, + sources: t.mapObject(this.sourceCaches, function (t) { + return t.serialize(); + }), + layers: this._serializeLayers(this._order), + }, + function (t) { + return void 0 !== t; + }, + ); + }), + (i.prototype._updateLayer = function (t) { + (this._updatedLayers[t.id] = !0), + t.source && + !this._updatedSources[t.source] && + 'raster' !== this.sourceCaches[t.source].getSource().type && + ((this._updatedSources[t.source] = 'reload'), + this.sourceCaches[t.source].pause()), + (this._changed = !0); + }), + (i.prototype._flattenAndSortRenderedFeatures = function (t) { + for ( + var e = this, + i = function (t) { + return 'fill-extrusion' === e._layers[t].type; + }, + r = {}, + o = [], + a = this._order.length - 1; + a >= 0; + a-- + ) { + var n = this._order[a]; + if (i(n)) { + r[n] = a; + for (var s = 0, l = t; s < l.length; s += 1) { + var c = l[s][n]; + if (c) + for (var h = 0, u = c; h < u.length; h += 1) o.push(u[h]); + } + } + } + o.sort(function (t, e) { + return e.intersectionZ - t.intersectionZ; + }); + for (var p = [], d = this._order.length - 1; d >= 0; d--) { + var _ = this._order[d]; + if (i(_)) + for (var f = o.length - 1; f >= 0; f--) { + var m = o[f].feature; + if (r[m.layer.id] < d) break; + p.push(m), o.pop(); + } + else + for (var g = 0, v = t; g < v.length; g += 1) { + var y = v[g][_]; + if (y) + for (var x = 0, b = y; x < b.length; x += 1) + p.push(b[x].feature); + } + } + return p; + }), + (i.prototype.queryRenderedFeatures = function (e, i, r) { + i && + i.filter && + this._validate( + t.validateStyle.filter, + 'queryRenderedFeatures.filter', + i.filter, + null, + i, + ); + var o = {}; + if (i && i.layers) { + if (!Array.isArray(i.layers)) + return ( + this.fire( + new t.ErrorEvent( + new Error('parameters.layers must be an Array.'), + ), + ), + [] + ); + for (var a = 0, n = i.layers; a < n.length; a += 1) { + var s = n[a], + l = this._layers[s]; + if (!l) + return ( + this.fire( + new t.ErrorEvent( + new Error( + "The layer '" + + s + + "' does not exist in the map's style and cannot be queried for features.", + ), + ), + ), + [] + ); + o[l.source] = !0; + } + } + var c = []; + for (var h in ((i.availableImages = this._availableImages), + this.sourceCaches)) + (i.layers && !o[h]) || + c.push( + k( + this.sourceCaches[h], + this._layers, + this._serializedLayers, + e, + i, + r, + ), + ); + return ( + this.placement && + c.push( + (function (t, e, i, r, o, a, n) { + for ( + var s = {}, + l = a.queryRenderedSymbols(r), + c = [], + h = 0, + u = Object.keys(l).map(Number); + h < u.length; + h += 1 + ) + c.push(n[u[h]]); + c.sort(B); + for ( + var p = function () { + var i = _[d], + r = i.featureIndex.lookupSymbolFeatures( + l[i.bucketInstanceId], + e, + i.bucketIndex, + i.sourceLayerIndex, + o.filter, + o.layers, + o.availableImages, + t, + ); + for (var a in r) { + var n = (s[a] = s[a] || []), + c = r[a]; + c.sort(function (t, e) { + var r = i.featureSortOrder; + if (r) { + var o = r.indexOf(t.featureIndex); + return r.indexOf(e.featureIndex) - o; + } + return e.featureIndex - t.featureIndex; + }); + for (var h = 0, u = c; h < u.length; h += 1) + n.push(u[h]); + } + }, + d = 0, + _ = c; + d < _.length; + d += 1 + ) + p(); + var f = function (e) { + s[e].forEach(function (r) { + var o = r.feature, + a = i[t[e].source].getFeatureState( + o.layer['source-layer'], + o.id, + ); + (o.source = o.layer.source), + o.layer['source-layer'] && + (o.sourceLayer = o.layer['source-layer']), + (o.state = a); + }); + }; + for (var m in s) f(m); + return s; + })( + this._layers, + this._serializedLayers, + this.sourceCaches, + e, + i, + this.placement.collisionIndex, + this.placement.retainedQueryData, + ), + ), + this._flattenAndSortRenderedFeatures(c) + ); + }), + (i.prototype.querySourceFeatures = function (e, i) { + i && + i.filter && + this._validate( + t.validateStyle.filter, + 'querySourceFeatures.filter', + i.filter, + null, + i, + ); + var r = this.sourceCaches[e]; + return r + ? (function (t, e) { + for ( + var i = t.getRenderableIds().map(function (e) { + return t.getTileByID(e); + }), + r = [], + o = {}, + a = 0; + a < i.length; + a++ + ) { + var n = i[a], + s = n.tileID.canonical.key; + o[s] || ((o[s] = !0), n.querySourceFeatures(r, e)); + } + return r; + })(r, i) + : []; + }), + (i.prototype.addSourceType = function (t, e, r) { + return i.getSourceType(t) + ? r(new Error('A source type called "' + t + '" already exists.')) + : (i.setSourceType(t, e), + e.workerSourceURL + ? void this.dispatcher.broadcast( + 'loadWorkerSource', + { name: t, url: e.workerSourceURL }, + r, + ) + : r(null, null)); + }), + (i.prototype.getLight = function () { + return this.light.getLight(); + }), + (i.prototype.setLight = function (e, i) { + void 0 === i && (i = {}), this._checkLoaded(); + var r = this.light.getLight(), + a = !1; + for (var n in e) + if (!o(e[n], r[n])) { + a = !0; + break; + } + if (a) { + var s = { + now: t.exported.now(), + transition: t.extend( + { duration: 300, delay: 0 }, + this.stylesheet.transition, + ), + }; + this.light.setLight(e, i), this.light.updateTransitions(s); + } + }), + (i.prototype._validate = function (e, i, r, o, a) { + return ( + void 0 === a && (a = {}), + (!a || !1 !== a.validate) && + Qt( + this, + e.call( + t.validateStyle, + t.extend( + { + key: i, + style: this.serialize(), + value: r, + styleSpec: t.spec, + }, + o, + ), + ), + ) + ); + }), + (i.prototype._remove = function () { + for (var e in (this._request && + (this._request.cancel(), (this._request = null)), + this._spriteRequest && + (this._spriteRequest.cancel(), (this._spriteRequest = null)), + t.evented.off('pluginStateChange', this._rtlTextPluginCallback), + this._layers)) + this._layers[e].setEventedParent(null); + for (var i in this.sourceCaches) { + var r = this.sourceCaches[i]; + r.setEventedParent(null), r.onRemove(this.map); + } + this.imageManager.setEventedParent(null), + this.setEventedParent(null), + this.dispatcher.remove(); + }), + (i.prototype._clearSource = function (t) { + this.sourceCaches[t].clearTiles(); + }), + (i.prototype._reloadSource = function (t) { + this.sourceCaches[t].resume(), this.sourceCaches[t].reload(); + }), + (i.prototype._updateSources = function (t) { + for (var e in this.sourceCaches) + this.sourceCaches[e].update(t, this.terrain); + }), + (i.prototype._generateCollisionBoxes = function () { + for (var t in this.sourceCaches) this._reloadSource(t); + }), + (i.prototype._updatePlacement = function (e, i, r, o, a) { + void 0 === a && (a = !1); + for ( + var n = !1, s = !1, l = {}, c = 0, h = this._order; + c < h.length; + c += 1 + ) { + var u = this._layers[h[c]]; + if ('symbol' === u.type) { + if (!l[u.source]) { + var p = this.sourceCaches[u.source]; + l[u.source] = p + .getRenderableIds(!0) + .map(function (t) { + return p.getTileByID(t); + }) + .sort(function (t, e) { + return ( + e.tileID.overscaledZ - t.tileID.overscaledZ || + (t.tileID.isLessThan(e.tileID) ? -1 : 1) + ); + }); + } + var d = this.crossTileSymbolIndex.addLayer( + u, + l[u.source], + e.center.lng, + ); + n = n || d; + } + } + if ( + (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), + ((a = a || this._layerOrderChanged || 0 === r) || + !this.pauseablePlacement || + (this.pauseablePlacement.isDone() && + !this.placement.stillRecent(t.exported.now(), e.zoom))) && + ((this.pauseablePlacement = new Zt( + e, + this.terrain, + this._order, + a, + i, + r, + o, + this.placement, + )), + (this._layerOrderChanged = !1)), + this.pauseablePlacement.isDone() + ? this.placement.setStale() + : (this.pauseablePlacement.continuePlacement( + this._order, + this._layers, + l, + ), + this.pauseablePlacement.isDone() && + ((this.placement = this.pauseablePlacement.commit( + t.exported.now(), + )), + (s = !0)), + n && this.pauseablePlacement.placement.setStale()), + s || n) + ) + for (var _ = 0, f = this._order; _ < f.length; _ += 1) { + var m = this._layers[f[_]]; + 'symbol' === m.type && + this.placement.updateLayerOpacities(m, l[m.source]); + } + return ( + !this.pauseablePlacement.isDone() || + this.placement.hasTransitions(t.exported.now()) + ); + }), + (i.prototype._releaseSymbolFadeTiles = function () { + for (var t in this.sourceCaches) + this.sourceCaches[t].releaseSymbolFadeTiles(); + }), + (i.prototype.getImages = function (t, e, i) { + this.imageManager.getImages(e.icons, i), + this._updateTilesForChangedImages(); + var r = this.sourceCaches[e.source]; + r && r.setDependencies(e.tileID.key, e.type, e.icons); + }), + (i.prototype.getGlyphs = function (t, e, i) { + this.glyphManager.getGlyphs(e.stacks, i); + }), + (i.prototype.getResource = function (e, i, r) { + return t.makeRequest(i, r); + }), + i + ); + })(t.Evented); + (ie.getSourceType = function (t) { + return R[t]; + }), + (ie.setSourceType = function (t, e) { + R[t] = e; + }), + (ie.registerForPluginStateChange = t.registerForPluginStateChange); + var re = + 'attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}', + oe = { + prelude: ae( + '#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif', + '#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}', + ), + background: ae( + 'uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}', + ), + backgroundPattern: ae( + 'uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}', + ), + circle: ae( + '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(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;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(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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}', + ), + clippingMask: ae( + '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: ae( + 'uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}', + ), + heatmapTexture: ae( + 'uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}', + ), + collisionBox: ae( + 'varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}', + 'attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}', + ), + collisionCircle: ae( + 'varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}', + 'attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}', + ), + debug: ae( + 'uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}', + 'attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}', + ), + fill: ae( + '#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}', + ), + fillOutline: ae( + 'varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}', + ), + fillOutlinePattern: ae( + 'uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}', + ), + fillPattern: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}', + ), + fillExtrusion: ae( + 'varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}', + ), + fillExtrusionPattern: ae( + 'uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\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;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}', + ), + hillshadePrepare: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}', + ), + hillshade: ae( + 'uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}', + ), + line: ae( + 'uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}', + ), + lineGradient: ae( + 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}', + ), + linePattern: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}', + ), + lineSDF: ae( + 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}', + ), + raster: ae( + 'uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}', + ), + symbolIcon: ae( + 'uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}', + ), + symbolSDF: ae( + '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}', + ), + symbolTextAndIcon: ae( + '#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}', + ), + terrain: ae( + 'uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}', + re, + ), + terrainDepth: ae( + 'varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}', + re, + ), + terrainCoords: ae( + 'precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}', + re, + ), + }; + function ae(t, e) { + var i = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, + r = e.match(/attribute ([\w]+) ([\w]+)/g), + o = t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), + a = e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), + n = a ? a.concat(o) : o, + s = {}; + return { + fragmentSource: (t = t.replace(i, function (t, e, i, r, o) { + return ( + (s[o] = !0), + 'define' === e + ? '\n#ifndef HAS_UNIFORM_u_' + + o + + '\nvarying ' + + i + + ' ' + + r + + ' ' + + o + + ';\n#else\nuniform ' + + i + + ' ' + + r + + ' u_' + + o + + ';\n#endif\n' + : '\n#ifdef HAS_UNIFORM_u_' + + o + + '\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = u_' + + o + + ';\n#endif\n' + ); + })), + vertexSource: (e = e.replace(i, function (t, e, i, r, o) { + var a = 'float' === r ? 'vec2' : 'vec4', + n = o.match(/color/) ? 'color' : a; + return s[o] + ? 'define' === e + ? '\n#ifndef HAS_UNIFORM_u_' + + o + + '\nuniform lowp float u_' + + o + + '_t;\nattribute ' + + i + + ' ' + + a + + ' a_' + + o + + ';\nvarying ' + + i + + ' ' + + r + + ' ' + + o + + ';\n#else\nuniform ' + + i + + ' ' + + r + + ' u_' + + o + + ';\n#endif\n' + : 'vec4' === n + ? '\n#ifndef HAS_UNIFORM_u_' + + o + + '\n ' + + o + + ' = a_' + + o + + ';\n#else\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = u_' + + o + + ';\n#endif\n' + : '\n#ifndef HAS_UNIFORM_u_' + + o + + '\n ' + + o + + ' = unpack_mix_' + + n + + '(a_' + + o + + ', u_' + + o + + '_t);\n#else\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = u_' + + o + + ';\n#endif\n' + : 'define' === e + ? '\n#ifndef HAS_UNIFORM_u_' + + o + + '\nuniform lowp float u_' + + o + + '_t;\nattribute ' + + i + + ' ' + + a + + ' a_' + + o + + ';\n#else\nuniform ' + + i + + ' ' + + r + + ' u_' + + o + + ';\n#endif\n' + : 'vec4' === n + ? '\n#ifndef HAS_UNIFORM_u_' + + o + + '\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = a_' + + o + + ';\n#else\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = u_' + + o + + ';\n#endif\n' + : '\n#ifndef HAS_UNIFORM_u_' + + o + + '\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = unpack_mix_' + + n + + '(a_' + + o + + ', u_' + + o + + '_t);\n#else\n ' + + i + + ' ' + + r + + ' ' + + o + + ' = u_' + + o + + ';\n#endif\n'; + })), + staticAttributes: r, + staticUniforms: n, + }; + } + var ne = function () { + (this.boundProgram = null), + (this.boundLayoutVertexBuffer = null), + (this.boundPaintVertexBuffers = []), + (this.boundIndexBuffer = null), + (this.boundVertexOffset = null), + (this.boundDynamicVertexBuffer = null), + (this.vao = null); + }; + function se(t) { + for (var e = [], i = 0; i < t.length; i++) + if (null !== t[i]) { + var r = t[i].split(' '); + e.push(r.pop()); + } + return e; + } + (ne.prototype.bind = function (t, e, i, r, o, a, n, s, l) { + this.context = t; + for ( + var c = this.boundPaintVertexBuffers.length !== r.length, h = 0; + !c && h < r.length; + h++ + ) + this.boundPaintVertexBuffers[h] !== r[h] && (c = !0); + t.extVertexArrayObject && + this.vao && + this.boundProgram === e && + this.boundLayoutVertexBuffer === i && + !c && + this.boundIndexBuffer === o && + this.boundVertexOffset === a && + this.boundDynamicVertexBuffer === n && + this.boundDynamicVertexBuffer2 === s && + this.boundDynamicVertexBuffer3 === l + ? (t.bindVertexArrayOES.set(this.vao), + n && n.bind(), + o && o.dynamicDraw && o.bind(), + s && s.bind(), + l && l.bind()) + : this.freshBind(e, i, r, o, a, n, s, l); + }), + (ne.prototype.freshBind = function (t, e, i, r, o, a, n, s) { + var l, + c = t.numAttributes, + h = this.context, + u = h.gl; + if (h.extVertexArrayObject) + this.vao && this.destroy(), + (this.vao = h.extVertexArrayObject.createVertexArrayOES()), + h.bindVertexArrayOES.set(this.vao), + (l = 0), + (this.boundProgram = t), + (this.boundLayoutVertexBuffer = e), + (this.boundPaintVertexBuffers = i), + (this.boundIndexBuffer = r), + (this.boundVertexOffset = o), + (this.boundDynamicVertexBuffer = a), + (this.boundDynamicVertexBuffer2 = n), + (this.boundDynamicVertexBuffer3 = s); + else { + l = h.currentNumAttributes || 0; + for (var p = c; p < l; p++) u.disableVertexAttribArray(p); + } + e.enableAttributes(u, t); + for (var d = 0, _ = i; d < _.length; d += 1) + _[d].enableAttributes(u, t); + a && a.enableAttributes(u, t), + n && n.enableAttributes(u, t), + s && s.enableAttributes(u, t), + e.bind(), + e.setVertexAttribPointers(u, t, o); + for (var f = 0, m = i; f < m.length; f += 1) { + var g = m[f]; + g.bind(), g.setVertexAttribPointers(u, t, o); + } + a && (a.bind(), a.setVertexAttribPointers(u, t, o)), + r && r.bind(), + n && (n.bind(), n.setVertexAttribPointers(u, t, o)), + s && (s.bind(), s.setVertexAttribPointers(u, t, o)), + (h.currentNumAttributes = c); + }), + (ne.prototype.destroy = function () { + this.vao && + (this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao), + (this.vao = null)); + }); + var le = function (e, i, r, o, a, n, s) { + var l = e.gl; + this.program = l.createProgram(); + for ( + var c = se(r.staticAttributes), + h = o ? o.getBinderAttributes() : [], + u = c.concat(h), + p = oe.prelude.staticUniforms ? se(oe.prelude.staticUniforms) : [], + d = r.staticUniforms ? se(r.staticUniforms) : [], + _ = o ? o.getBinderUniforms() : [], + f = [], + m = 0, + g = p.concat(d).concat(_); + m < g.length; + m += 1 + ) { + var v = g[m]; + f.indexOf(v) < 0 && f.push(v); + } + var y = o ? o.defines() : []; + n && y.push('#define OVERDRAW_INSPECTOR;'), + s && y.push('#define TERRAIN3D;'); + var x = y.concat(oe.prelude.fragmentSource, r.fragmentSource).join('\n'), + b = y.concat(oe.prelude.vertexSource, r.vertexSource).join('\n'), + w = l.createShader(l.FRAGMENT_SHADER); + if (l.isContextLost()) this.failedToCreate = !0; + else { + l.shaderSource(w, x), + l.compileShader(w), + l.attachShader(this.program, w); + var T = l.createShader(l.VERTEX_SHADER); + if (l.isContextLost()) this.failedToCreate = !0; + else { + l.shaderSource(T, b), + l.compileShader(T), + l.attachShader(this.program, T), + (this.attributes = {}); + var E = {}; + this.numAttributes = u.length; + for (var I = 0; I < this.numAttributes; I++) + u[I] && + (l.bindAttribLocation(this.program, I, u[I]), + (this.attributes[u[I]] = I)); + l.linkProgram(this.program), l.deleteShader(T), l.deleteShader(w); + for (var C = 0; C < f.length; C++) { + var S = f[C]; + if (S && !E[S]) { + var D = l.getUniformLocation(this.program, S); + D && (E[S] = D); + } + } + (this.fixedUniforms = a(e, E)), + (this.terrainUniforms = (function (e, i) { + return { + u_depth: new t.Uniform1i(e, i.u_depth), + u_terrain: new t.Uniform1i(e, i.u_terrain), + u_terrain_dim: new t.Uniform1f(e, i.u_terrain_dim), + u_terrain_matrix: new t.UniformMatrix4f(e, i.u_terrain_matrix), + u_terrain_unpack: new t.Uniform4f(e, i.u_terrain_unpack), + u_terrain_offset: new t.Uniform1f(e, i.u_terrain_offset), + u_terrain_exaggeration: new t.Uniform1f( + e, + i.u_terrain_exaggeration, + ), + }; + })(e, E)), + (this.binderUniforms = o ? o.getUniforms(e, E) : []); + } + } + }; + function ce(t, e, i) { + var r = 1 / wt(i, 1, e.transform.tileZoom), + o = Math.pow(2, i.tileID.overscaledZ), + a = (i.tileSize * Math.pow(2, e.transform.tileZoom)) / o, + n = a * (i.tileID.canonical.x + i.tileID.wrap * o), + s = a * i.tileID.canonical.y; + return { + u_image: 0, + u_texsize: i.imageAtlasTexture.size, + u_scale: [r, t.fromScale, t.toScale], + u_fade: t.t, + u_pixel_coord_upper: [n >> 16, s >> 16], + u_pixel_coord_lower: [65535 & n, 65535 & s], + }; + } + le.prototype.draw = function ( + t, + e, + i, + r, + o, + a, + n, + s, + l, + c, + h, + u, + p, + d, + _, + f, + m, + g, + ) { + var v = t.gl; + if (!this.failedToCreate) { + if ( + (t.program.set(this.program), + t.setDepthMode(i), + t.setStencilMode(r), + t.setColorMode(o), + t.setCullFace(a), + s) + ) + for (var y in (t.activeTexture.set(v.TEXTURE2), + v.bindTexture(v.TEXTURE_2D, s.depthTexture), + t.activeTexture.set(v.TEXTURE3), + v.bindTexture(v.TEXTURE_2D, s.texture), + this.terrainUniforms)) + this.terrainUniforms[y].set(s[y]); + for (var x in this.fixedUniforms) this.fixedUniforms[x].set(n[x]); + _ && _.setUniforms(t, this.binderUniforms, p, { zoom: d }); + var b = 0; + switch (e) { + case v.LINES: + b = 2; + break; + case v.TRIANGLES: + b = 3; + break; + case v.LINE_STRIP: + b = 1; + } + for (var w = 0, T = u.get(); w < T.length; w += 1) { + var E = T[w], + I = E.vaos || (E.vaos = {}); + (I[l] || (I[l] = new ne())).bind( + t, + this, + c, + _ ? _.getPaintVertexBuffers() : [], + h, + E.vertexOffset, + f, + m, + g, + ), + v.drawElements( + e, + E.primitiveLength * b, + v.UNSIGNED_SHORT, + E.primitiveOffset * b * 2, + ); + } + } + }; + var he = function (e, i, r, o) { + var a = i.style.light, + n = a.properties.get('position'), + s = [n.x, n.y, n.z], + l = t.create$1(); + 'viewport' === a.properties.get('anchor') && + t.fromRotation(l, -i.transform.angle), + t.transformMat3(s, s, l); + var c = a.properties.get('color'); + return { + u_matrix: e, + u_lightpos: s, + u_lightintensity: a.properties.get('intensity'), + u_lightcolor: [c.r, c.g, c.b], + u_vertical_gradient: +r, + u_opacity: o, + }; + }, + ue = function (e, i, r, o, a, n, s) { + return t.extend(he(e, i, r, o), ce(n, i, s), { + u_height_factor: -Math.pow(2, a.overscaledZ) / s.tileSize / 8, + }); + }, + pe = function (t) { + return { u_matrix: t }; + }, + de = function (e, i, r, o) { + return t.extend(pe(e), ce(r, i, o)); + }, + _e = function (t, e) { + return { u_matrix: t, u_world: e }; + }, + fe = function (e, i, r, o, a) { + return t.extend(de(e, i, r, o), { u_world: a }); + }, + me = function (t, e, i, r) { + var o, + a, + n = t.transform; + if ('map' === r.paint.get('circle-pitch-alignment')) { + var s = wt(i, 1, n.zoom); + (o = !0), (a = [s, s]); + } else (o = !1), (a = n.pixelsToGLUnits); + return { + u_camera_to_center_distance: n.cameraToCenterDistance, + u_scale_with_map: +('map' === r.paint.get('circle-pitch-scale')), + u_matrix: t.translatePosMatrix( + e.posMatrix, + i, + r.paint.get('circle-translate'), + r.paint.get('circle-translate-anchor'), + ), + u_pitch_with_map: +o, + u_device_pixel_ratio: t.pixelRatio, + u_extrude_scale: a, + }; + }, + ge = function (t, e, i) { + var r = wt(i, 1, e.zoom), + o = Math.pow(2, e.zoom - i.tileID.overscaledZ), + a = i.tileID.overscaleFactor(); + return { + u_matrix: t, + u_camera_to_center_distance: e.cameraToCenterDistance, + u_pixels_to_tile_units: r, + u_extrude_scale: [ + e.pixelsToGLUnits[0] / (r * o), + e.pixelsToGLUnits[1] / (r * o), + ], + u_overscale_factor: a, + }; + }, + ve = function (t, e, i) { + return { + u_matrix: t, + u_inv_matrix: e, + u_camera_to_center_distance: i.cameraToCenterDistance, + u_viewport_size: [i.width, i.height], + }; + }, + ye = function (t, e, i) { + return ( + void 0 === i && (i = 1), + { u_matrix: t, u_color: e, u_overlay: 0, u_overlay_scale: i } + ); + }, + xe = function (t) { + return { u_matrix: t }; + }, + be = function (t, e, i, r) { + return { u_matrix: t, u_extrude_scale: wt(e, 1, i), u_intensity: r }; + }, + we = function (t, e, i, r) { + var o = t.transform; + return { + u_matrix: Se(t, e, i, r), + u_ratio: 1 / wt(e, 1, o.zoom), + u_device_pixel_ratio: t.pixelRatio, + u_units_to_pixels: [ + 1 / o.pixelsToGLUnits[0], + 1 / o.pixelsToGLUnits[1], + ], + }; + }, + Te = function (e, i, r, o, a) { + return t.extend(we(e, i, r, a), { u_image: 0, u_image_height: o }); + }, + Ee = function (t, e, i, r, o) { + var a = t.transform, + n = Ce(e, a); + return { + u_matrix: Se(t, e, i, o), + u_texsize: e.imageAtlasTexture.size, + u_ratio: 1 / wt(e, 1, a.zoom), + u_device_pixel_ratio: t.pixelRatio, + u_image: 0, + u_scale: [n, r.fromScale, r.toScale], + u_fade: r.t, + u_units_to_pixels: [ + 1 / a.pixelsToGLUnits[0], + 1 / a.pixelsToGLUnits[1], + ], + }; + }, + Ie = function (e, i, r, o, a, n) { + var s = e.lineAtlas, + l = Ce(i, e.transform), + c = 'round' === r.layout.get('line-cap'), + h = s.getDash(o.from, c), + u = s.getDash(o.to, c), + p = h.width * a.fromScale, + d = u.width * a.toScale; + return t.extend(we(e, i, r, n), { + u_patternscale_a: [l / p, -h.height / 2], + u_patternscale_b: [l / d, -u.height / 2], + u_sdfgamma: s.width / (256 * Math.min(p, d) * e.pixelRatio) / 2, + u_image: 0, + u_tex_y_a: h.y, + u_tex_y_b: u.y, + u_mix: a.t, + }); + }; + function Ce(t, e) { + return 1 / wt(t, 1, e.tileZoom); + } + function Se(t, e, i, r) { + return t.translatePosMatrix( + r ? r.posMatrix : e.tileID.posMatrix, + e, + i.paint.get('line-translate'), + i.paint.get('line-translate-anchor'), + ); + } + var De = function (t, e, i, r, o) { + return { + u_matrix: t, + u_tl_parent: e, + u_scale_parent: i, + u_buffer_scale: 1, + u_fade_t: r.mix, + u_opacity: r.opacity * o.paint.get('raster-opacity'), + u_image0: 0, + u_image1: 1, + u_brightness_low: o.paint.get('raster-brightness-min'), + u_brightness_high: o.paint.get('raster-brightness-max'), + u_saturation_factor: + ((n = o.paint.get('raster-saturation')), + n > 0 ? 1 - 1 / (1.001 - n) : -n), + u_contrast_factor: + ((a = o.paint.get('raster-contrast')), a > 0 ? 1 / (1 - a) : 1 + a), + u_spin_weights: ze(o.paint.get('raster-hue-rotate')), + }; + var a, n; + }; + function ze(t) { + t *= Math.PI / 180; + var e = Math.sin(t), + i = Math.cos(t); + return [ + (2 * i + 1) / 3, + (-Math.sqrt(3) * e - i + 1) / 3, + (Math.sqrt(3) * e - i + 1) / 3, + ]; + } + var Pe = function (t, e, i, r, o, a, n, s, l, c) { + var h = o.transform; + return { + u_is_size_zoom_constant: +('constant' === t || 'source' === t), + u_is_size_feature_constant: +('constant' === t || 'camera' === t), + u_size_t: e ? e.uSizeT : 0, + u_size: e ? e.uSize : 0, + u_camera_to_center_distance: h.cameraToCenterDistance, + u_pitch: (h.pitch / 360) * 2 * Math.PI, + u_rotate_symbol: +i, + u_aspect_ratio: h.width / h.height, + u_fade_change: o.options.fadeDuration ? o.symbolFadeChange : 1, + u_matrix: a, + u_label_plane_matrix: n, + u_coord_matrix: s, + u_is_text: +l, + u_pitch_with_map: +r, + u_texsize: c, + u_texture: 0, + }; + }, + Me = function (e, i, r, o, a, n, s, l, c, h, u) { + var p = a.transform; + return t.extend(Pe(e, i, r, o, a, n, s, l, c, h), { + u_gamma_scale: o ? Math.cos(p._pitch) * p.cameraToCenterDistance : 1, + u_device_pixel_ratio: a.pixelRatio, + u_is_halo: +u, + }); + }, + Ae = function (t, e, i) { + return { u_matrix: t, u_opacity: e, u_color: i }; + }, + Re = function (e, i, r, o, a, n) { + return t.extend( + (function (t, e, i, r) { + var o = i.imageManager.getPattern(t.from.toString()), + a = i.imageManager.getPattern(t.to.toString()), + n = i.imageManager.getPixelSize(), + s = n.width, + l = n.height, + c = Math.pow(2, r.tileID.overscaledZ), + h = (r.tileSize * Math.pow(2, i.transform.tileZoom)) / c, + u = h * (r.tileID.canonical.x + r.tileID.wrap * c), + p = h * r.tileID.canonical.y; + return { + u_image: 0, + u_pattern_tl_a: o.tl, + u_pattern_br_a: o.br, + u_pattern_tl_b: a.tl, + u_pattern_br_b: a.br, + u_texsize: [s, l], + u_mix: e.t, + u_pattern_size_a: o.displaySize, + u_pattern_size_b: a.displaySize, + u_scale_a: e.fromScale, + u_scale_b: e.toScale, + u_tile_units_to_pixels: 1 / wt(r, 1, i.transform.tileZoom), + u_pixel_coord_upper: [u >> 16, p >> 16], + u_pixel_coord_lower: [65535 & u, 65535 & p], + }; + })(o, n, r, a), + { u_matrix: e, u_opacity: i }, + ); + }, + Le = { + fillExtrusion: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_lightpos: new t.Uniform3f(e, i.u_lightpos), + u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), + u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), + u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }; + }, + fillExtrusionPattern: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_lightpos: new t.Uniform3f(e, i.u_lightpos), + u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), + u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), + u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), + u_height_factor: new t.Uniform1f(e, i.u_height_factor), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }; + }, + fill: function (e, i) { + return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix) }; + }, + fillPattern: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }; + }, + fillOutline: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + }; + }, + fillOutlinePattern: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }; + }, + circle: function (e, i) { + return { + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_scale_with_map: new t.Uniform1i(e, i.u_scale_with_map), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }; + }, + collisionBox: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pixels_to_tile_units: new t.Uniform1f( + e, + i.u_pixels_to_tile_units, + ), + u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), + u_overscale_factor: new t.Uniform1f(e, i.u_overscale_factor), + }; + }, + collisionCircle: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_inv_matrix: new t.UniformMatrix4f(e, i.u_inv_matrix), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_viewport_size: new t.Uniform2f(e, i.u_viewport_size), + }; + }, + debug: function (e, i) { + return { + u_color: new t.UniformColor(e, i.u_color), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_overlay: new t.Uniform1i(e, i.u_overlay), + u_overlay_scale: new t.Uniform1f(e, i.u_overlay_scale), + }; + }, + clippingMask: function (e, i) { + return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix) }; + }, + heatmap: function (e, i) { + return { + u_extrude_scale: new t.Uniform1f(e, i.u_extrude_scale), + u_intensity: new t.Uniform1f(e, i.u_intensity), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }; + }, + heatmapTexture: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + u_image: new t.Uniform1i(e, i.u_image), + u_color_ramp: new t.Uniform1i(e, i.u_color_ramp), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }; + }, + hillshade: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_latrange: new t.Uniform2f(e, i.u_latrange), + u_light: new t.Uniform2f(e, i.u_light), + u_shadow: new t.UniformColor(e, i.u_shadow), + u_highlight: new t.UniformColor(e, i.u_highlight), + u_accent: new t.UniformColor(e, i.u_accent), + }; + }, + hillshadePrepare: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_dimension: new t.Uniform2f(e, i.u_dimension), + u_zoom: new t.Uniform1f(e, i.u_zoom), + u_unpack: new t.Uniform4f(e, i.u_unpack), + }; + }, + line: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + }; + }, + lineGradient: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_image: new t.Uniform1i(e, i.u_image), + u_image_height: new t.Uniform1f(e, i.u_image_height), + }; + }, + linePattern: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_image: new t.Uniform1i(e, i.u_image), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }; + }, + lineSDF: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_patternscale_a: new t.Uniform2f(e, i.u_patternscale_a), + u_patternscale_b: new t.Uniform2f(e, i.u_patternscale_b), + u_sdfgamma: new t.Uniform1f(e, i.u_sdfgamma), + u_image: new t.Uniform1i(e, i.u_image), + u_tex_y_a: new t.Uniform1f(e, i.u_tex_y_a), + u_tex_y_b: new t.Uniform1f(e, i.u_tex_y_b), + u_mix: new t.Uniform1f(e, i.u_mix), + }; + }, + raster: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_tl_parent: new t.Uniform2f(e, i.u_tl_parent), + u_scale_parent: new t.Uniform1f(e, i.u_scale_parent), + u_buffer_scale: new t.Uniform1f(e, i.u_buffer_scale), + u_fade_t: new t.Uniform1f(e, i.u_fade_t), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_image0: new t.Uniform1i(e, i.u_image0), + u_image1: new t.Uniform1i(e, i.u_image1), + u_brightness_low: new t.Uniform1f(e, i.u_brightness_low), + u_brightness_high: new t.Uniform1f(e, i.u_brightness_high), + u_saturation_factor: new t.Uniform1f(e, i.u_saturation_factor), + u_contrast_factor: new t.Uniform1f(e, i.u_contrast_factor), + u_spin_weights: new t.Uniform3f(e, i.u_spin_weights), + }; + }, + symbolIcon: function (e, i) { + return { + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texture: new t.Uniform1i(e, i.u_texture), + }; + }, + symbolSDF: function (e, i) { + return { + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texture: new t.Uniform1i(e, i.u_texture), + u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_is_halo: new t.Uniform1i(e, i.u_is_halo), + }; + }, + symbolTextAndIcon: function (e, i) { + return { + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texsize_icon: new t.Uniform2f(e, i.u_texsize_icon), + u_texture: new t.Uniform1i(e, i.u_texture), + u_texture_icon: new t.Uniform1i(e, i.u_texture_icon), + u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_is_halo: new t.Uniform1i(e, i.u_is_halo), + }; + }, + background: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_color: new t.UniformColor(e, i.u_color), + }; + }, + backgroundPattern: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_image: new t.Uniform1i(e, i.u_image), + u_pattern_tl_a: new t.Uniform2f(e, i.u_pattern_tl_a), + u_pattern_br_a: new t.Uniform2f(e, i.u_pattern_br_a), + u_pattern_tl_b: new t.Uniform2f(e, i.u_pattern_tl_b), + u_pattern_br_b: new t.Uniform2f(e, i.u_pattern_br_b), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_mix: new t.Uniform1f(e, i.u_mix), + u_pattern_size_a: new t.Uniform2f(e, i.u_pattern_size_a), + u_pattern_size_b: new t.Uniform2f(e, i.u_pattern_size_b), + u_scale_a: new t.Uniform1f(e, i.u_scale_a), + u_scale_b: new t.Uniform1f(e, i.u_scale_b), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_tile_units_to_pixels: new t.Uniform1f( + e, + i.u_tile_units_to_pixels, + ), + }; + }, + terrain: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texture: new t.Uniform1i(e, i.u_texture), + }; + }, + terrainDepth: function (e, i) { + return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix) }; + }, + terrainCoords: function (e, i) { + return { + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texture: new t.Uniform1i(e, i.u_texture), + u_terrain_coords_id: new t.Uniform1f(e, i.u_terrain_coords_id), + }; + }, + }, + ke = function (t, e, i) { + this.context = t; + var r = t.gl; + (this.buffer = r.createBuffer()), + (this.dynamicDraw = Boolean(i)), + this.context.unbindVAO(), + t.bindElementBuffer.set(this.buffer), + r.bufferData( + r.ELEMENT_ARRAY_BUFFER, + e.arrayBuffer, + this.dynamicDraw ? r.DYNAMIC_DRAW : r.STATIC_DRAW, + ), + this.dynamicDraw || delete e.arrayBuffer; + }; + (ke.prototype.bind = function () { + this.context.bindElementBuffer.set(this.buffer); + }), + (ke.prototype.updateData = function (t) { + var e = this.context.gl; + if (!this.dynamicDraw) + throw new Error( + 'Attempted to update data while not in dynamic mode.', + ); + this.context.unbindVAO(), + this.bind(), + e.bufferSubData(e.ELEMENT_ARRAY_BUFFER, 0, t.arrayBuffer); + }), + (ke.prototype.destroy = function () { + this.buffer && + (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); + }); + var Be = { + Int8: 'BYTE', + Uint8: 'UNSIGNED_BYTE', + Int16: 'SHORT', + Uint16: 'UNSIGNED_SHORT', + Int32: 'INT', + Uint32: 'UNSIGNED_INT', + Float32: 'FLOAT', + }, + Oe = function (t, e, i, r) { + (this.length = e.length), + (this.attributes = i), + (this.itemSize = e.bytesPerElement), + (this.dynamicDraw = r), + (this.context = t); + var o = t.gl; + (this.buffer = o.createBuffer()), + t.bindVertexBuffer.set(this.buffer), + o.bufferData( + o.ARRAY_BUFFER, + e.arrayBuffer, + this.dynamicDraw ? o.DYNAMIC_DRAW : o.STATIC_DRAW, + ), + this.dynamicDraw || delete e.arrayBuffer; + }; + (Oe.prototype.bind = function () { + this.context.bindVertexBuffer.set(this.buffer); + }), + (Oe.prototype.updateData = function (t) { + if (t.length !== this.length) + throw new Error( + 'Length of new data is ' + + t.length + + ", which doesn't match current length of " + + this.length, + ); + var e = this.context.gl; + this.bind(), e.bufferSubData(e.ARRAY_BUFFER, 0, t.arrayBuffer); + }), + (Oe.prototype.enableAttributes = function (t, e) { + for (var i = 0; i < this.attributes.length; i++) { + var r = e.attributes[this.attributes[i].name]; + void 0 !== r && t.enableVertexAttribArray(r); + } + }), + (Oe.prototype.setVertexAttribPointers = function (t, e, i) { + for (var r = 0; r < this.attributes.length; r++) { + var o = this.attributes[r], + a = e.attributes[o.name]; + void 0 !== a && + t.vertexAttribPointer( + a, + o.components, + t[Be[o.type]], + !1, + this.itemSize, + o.offset + this.itemSize * (i || 0), + ); + } + }), + (Oe.prototype.destroy = function () { + this.buffer && + (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); + }); + var Fe = function (t) { + (this.gl = t.gl), + (this.default = this.getDefault()), + (this.current = this.default), + (this.dirty = !1); + }; + (Fe.prototype.get = function () { + return this.current; + }), + (Fe.prototype.set = function (t) {}), + (Fe.prototype.getDefault = function () { + return this.default; + }), + (Fe.prototype.setDefault = function () { + this.set(this.default); + }); + var Ue = (function (e) { + function i() { + e.apply(this, arguments); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.getDefault = function () { + return t.Color.transparent; + }), + (i.prototype.set = function (t) { + var e = this.current; + (t.r !== e.r || + t.g !== e.g || + t.b !== e.b || + t.a !== e.a || + this.dirty) && + (this.gl.clearColor(t.r, t.g, t.b, t.a), + (this.current = t), + (this.dirty = !1)); + }), + i + ); + })(Fe), + Ne = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return 1; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.clearDepth(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + Ge = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return 0; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.clearStencil(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + je = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return [!0, !0, !0, !0]; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t[0] !== e[0] || + t[1] !== e[1] || + t[2] !== e[2] || + t[3] !== e[3] || + this.dirty) && + (this.gl.colorMask(t[0], t[1], t[2], t[3]), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + Ze = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !0; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.depthMask(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + Ve = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return 255; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.stencilMask(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + qe = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return { func: this.gl.ALWAYS, ref: 0, mask: 255 }; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t.func !== e.func || + t.ref !== e.ref || + t.mask !== e.mask || + this.dirty) && + (this.gl.stencilFunc(t.func, t.ref, t.mask), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + Xe = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + var t = this.gl; + return [t.KEEP, t.KEEP, t.KEEP]; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || t[2] !== e[2] || this.dirty) && + (this.gl.stencilOp(t[0], t[1], t[2]), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + We = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + t ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + He = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return [0, 1]; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && + (this.gl.depthRange(t[0], t[1]), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + Ke = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + t ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + Ye = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return this.gl.LESS; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.depthFunc(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + Je = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + t ? e.enable(e.BLEND) : e.disable(e.BLEND), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + Qe = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + var t = this.gl; + return [t.ONE, t.ZERO]; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && + (this.gl.blendFunc(t[0], t[1]), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + $e = (function (e) { + function i() { + e.apply(this, arguments); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.getDefault = function () { + return t.Color.transparent; + }), + (i.prototype.set = function (t) { + var e = this.current; + (t.r !== e.r || + t.g !== e.g || + t.b !== e.b || + t.a !== e.a || + this.dirty) && + (this.gl.blendColor(t.r, t.g, t.b, t.a), + (this.current = t), + (this.dirty = !1)); + }), + i + ); + })(Fe), + ti = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return this.gl.FUNC_ADD; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.blendEquation(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + ei = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + t ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + ii = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return this.gl.BACK; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.cullFace(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + ri = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return this.gl.CCW; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.frontFace(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + oi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.useProgram(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + ai = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return this.gl.TEXTURE0; + }), + (e.prototype.set = function (t) { + (t !== this.current || this.dirty) && + (this.gl.activeTexture(t), (this.current = t), (this.dirty = !1)); + }), + e + ); + })(Fe), + ni = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + var t = this.gl; + return [0, 0, t.drawingBufferWidth, t.drawingBufferHeight]; + }), + (e.prototype.set = function (t) { + var e = this.current; + (t[0] !== e[0] || + t[1] !== e[1] || + t[2] !== e[2] || + t[3] !== e[3] || + this.dirty) && + (this.gl.viewport(t[0], t[1], t[2], t[3]), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + si = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.bindFramebuffer(e.FRAMEBUFFER, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + li = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.bindRenderbuffer(e.RENDERBUFFER, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + ci = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.bindTexture(e.TEXTURE_2D, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + hi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.bindBuffer(e.ARRAY_BUFFER, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + ui = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + var e = this.gl; + e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t), + (this.current = t), + (this.dirty = !1); + }), + e + ); + })(Fe), + pi = (function (t) { + function e(e) { + t.call(this, e), (this.vao = e.extVertexArrayObject); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + (e.prototype.set = function (t) { + this.vao && + (t !== this.current || this.dirty) && + (this.vao.bindVertexArrayOES(t), + (this.current = t), + (this.dirty = !1)); + }), + e + ); + })(Fe), + di = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return 4; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.pixelStorei(e.UNPACK_ALIGNMENT, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + _i = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + fi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return !1; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + var e = this.gl; + e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(Fe), + mi = (function (t) { + function e(e, i) { + t.call(this, e), (this.context = e), (this.parent = i); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.getDefault = function () { + return null; + }), + e + ); + })(Fe), + gi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.setDirty = function () { + this.dirty = !0; + }), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + this.context.bindFramebuffer.set(this.parent); + var e = this.gl; + e.framebufferTexture2D( + e.FRAMEBUFFER, + e.COLOR_ATTACHMENT0, + e.TEXTURE_2D, + t, + 0, + ), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(mi), + vi = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.set = function (t) { + if (t !== this.current || this.dirty) { + this.context.bindFramebuffer.set(this.parent); + var e = this.gl; + e.framebufferRenderbuffer( + e.FRAMEBUFFER, + e.DEPTH_ATTACHMENT, + e.RENDERBUFFER, + t, + ), + (this.current = t), + (this.dirty = !1); + } + }), + e + ); + })(mi), + yi = function (t, e, i, r) { + (this.context = t), (this.width = e), (this.height = i); + var o = t.gl, + a = (this.framebuffer = o.createFramebuffer()); + if ( + ((this.colorAttachment = new gi(t, a)), + r && (this.depthAttachment = new vi(t, a)), + o.checkFramebufferStatus(o.FRAMEBUFFER) !== o.FRAMEBUFFER_COMPLETE) + ) + throw new Error('Framebuffer is not complete'); + }; + yi.prototype.destroy = function () { + var t = this.context.gl, + e = this.colorAttachment.get(); + if ((e && t.deleteTexture(e), this.depthAttachment)) { + var i = this.depthAttachment.get(); + i && t.deleteRenderbuffer(i); + } + t.deleteFramebuffer(this.framebuffer); + }; + var xi = function (t, e, i) { + (this.blendFunction = t), (this.blendColor = e), (this.mask = i); + }; + (xi.disabled = new xi((xi.Replace = [1, 0]), t.Color.transparent, [ + !1, + !1, + !1, + !1, + ])), + (xi.unblended = new xi(xi.Replace, t.Color.transparent, [ + !0, + !0, + !0, + !0, + ])), + (xi.alphaBlended = new xi([1, 771], t.Color.transparent, [ + !0, + !0, + !0, + !0, + ])); + var bi = function (t) { + (this.gl = t), + (this.extVertexArrayObject = this.gl.getExtension( + 'OES_vertex_array_object', + )), + (this.clearColor = new Ue(this)), + (this.clearDepth = new Ne(this)), + (this.clearStencil = new Ge(this)), + (this.colorMask = new je(this)), + (this.depthMask = new Ze(this)), + (this.stencilMask = new Ve(this)), + (this.stencilFunc = new qe(this)), + (this.stencilOp = new Xe(this)), + (this.stencilTest = new We(this)), + (this.depthRange = new He(this)), + (this.depthTest = new Ke(this)), + (this.depthFunc = new Ye(this)), + (this.blend = new Je(this)), + (this.blendFunc = new Qe(this)), + (this.blendColor = new $e(this)), + (this.blendEquation = new ti(this)), + (this.cullFace = new ei(this)), + (this.cullFaceSide = new ii(this)), + (this.frontFace = new ri(this)), + (this.program = new oi(this)), + (this.activeTexture = new ai(this)), + (this.viewport = new ni(this)), + (this.bindFramebuffer = new si(this)), + (this.bindRenderbuffer = new li(this)), + (this.bindTexture = new ci(this)), + (this.bindVertexBuffer = new hi(this)), + (this.bindElementBuffer = new ui(this)), + (this.bindVertexArrayOES = this.extVertexArrayObject && new pi(this)), + (this.pixelStoreUnpack = new di(this)), + (this.pixelStoreUnpackPremultiplyAlpha = new _i(this)), + (this.pixelStoreUnpackFlipY = new fi(this)), + (this.extTextureFilterAnisotropic = + t.getExtension('EXT_texture_filter_anisotropic') || + t.getExtension('MOZ_EXT_texture_filter_anisotropic') || + t.getExtension('WEBKIT_EXT_texture_filter_anisotropic')), + this.extTextureFilterAnisotropic && + (this.extTextureFilterAnisotropicMax = t.getParameter( + this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT, + )), + (this.extTextureHalfFloat = t.getExtension('OES_texture_half_float')), + this.extTextureHalfFloat && + (t.getExtension('OES_texture_half_float_linear'), + (this.extRenderToTextureHalfFloat = t.getExtension( + 'EXT_color_buffer_half_float', + ))), + (this.extTimerQuery = t.getExtension('EXT_disjoint_timer_query')), + (this.maxTextureSize = t.getParameter(t.MAX_TEXTURE_SIZE)); + }; + (bi.prototype.setDefault = function () { + this.unbindVAO(), + this.clearColor.setDefault(), + this.clearDepth.setDefault(), + this.clearStencil.setDefault(), + this.colorMask.setDefault(), + this.depthMask.setDefault(), + this.stencilMask.setDefault(), + this.stencilFunc.setDefault(), + this.stencilOp.setDefault(), + this.stencilTest.setDefault(), + this.depthRange.setDefault(), + this.depthTest.setDefault(), + this.depthFunc.setDefault(), + this.blend.setDefault(), + this.blendFunc.setDefault(), + this.blendColor.setDefault(), + this.blendEquation.setDefault(), + this.cullFace.setDefault(), + this.cullFaceSide.setDefault(), + this.frontFace.setDefault(), + this.program.setDefault(), + this.activeTexture.setDefault(), + this.bindFramebuffer.setDefault(), + this.pixelStoreUnpack.setDefault(), + this.pixelStoreUnpackPremultiplyAlpha.setDefault(), + this.pixelStoreUnpackFlipY.setDefault(); + }), + (bi.prototype.setDirty = function () { + (this.clearColor.dirty = !0), + (this.clearDepth.dirty = !0), + (this.clearStencil.dirty = !0), + (this.colorMask.dirty = !0), + (this.depthMask.dirty = !0), + (this.stencilMask.dirty = !0), + (this.stencilFunc.dirty = !0), + (this.stencilOp.dirty = !0), + (this.stencilTest.dirty = !0), + (this.depthRange.dirty = !0), + (this.depthTest.dirty = !0), + (this.depthFunc.dirty = !0), + (this.blend.dirty = !0), + (this.blendFunc.dirty = !0), + (this.blendColor.dirty = !0), + (this.blendEquation.dirty = !0), + (this.cullFace.dirty = !0), + (this.cullFaceSide.dirty = !0), + (this.frontFace.dirty = !0), + (this.program.dirty = !0), + (this.activeTexture.dirty = !0), + (this.viewport.dirty = !0), + (this.bindFramebuffer.dirty = !0), + (this.bindRenderbuffer.dirty = !0), + (this.bindTexture.dirty = !0), + (this.bindVertexBuffer.dirty = !0), + (this.bindElementBuffer.dirty = !0), + this.extVertexArrayObject && (this.bindVertexArrayOES.dirty = !0), + (this.pixelStoreUnpack.dirty = !0), + (this.pixelStoreUnpackPremultiplyAlpha.dirty = !0), + (this.pixelStoreUnpackFlipY.dirty = !0); + }), + (bi.prototype.createIndexBuffer = function (t, e) { + return new ke(this, t, e); + }), + (bi.prototype.createVertexBuffer = function (t, e, i) { + return new Oe(this, t, e, i); + }), + (bi.prototype.createRenderbuffer = function (t, e, i) { + var r = this.gl, + o = r.createRenderbuffer(); + return ( + this.bindRenderbuffer.set(o), + r.renderbufferStorage(r.RENDERBUFFER, t, e, i), + this.bindRenderbuffer.set(null), + o + ); + }), + (bi.prototype.createFramebuffer = function (t, e, i) { + return new yi(this, t, e, i); + }), + (bi.prototype.clear = function (t) { + var e = t.color, + i = t.depth, + r = this.gl, + o = 0; + e && + ((o |= r.COLOR_BUFFER_BIT), + this.clearColor.set(e), + this.colorMask.set([!0, !0, !0, !0])), + void 0 !== i && + ((o |= r.DEPTH_BUFFER_BIT), + this.depthRange.set([0, 1]), + this.clearDepth.set(i), + this.depthMask.set(!0)), + r.clear(o); + }), + (bi.prototype.setCullFace = function (t) { + !1 === t.enable + ? this.cullFace.set(!1) + : (this.cullFace.set(!0), + this.cullFaceSide.set(t.mode), + this.frontFace.set(t.frontFace)); + }), + (bi.prototype.setDepthMode = function (t) { + t.func !== this.gl.ALWAYS || t.mask + ? (this.depthTest.set(!0), + this.depthFunc.set(t.func), + this.depthMask.set(t.mask), + this.depthRange.set(t.range)) + : this.depthTest.set(!1); + }), + (bi.prototype.setStencilMode = function (t) { + t.test.func !== this.gl.ALWAYS || t.mask + ? (this.stencilTest.set(!0), + this.stencilMask.set(t.mask), + this.stencilOp.set([t.fail, t.depthFail, t.pass]), + this.stencilFunc.set({ + func: t.test.func, + ref: t.ref, + mask: t.test.mask, + })) + : this.stencilTest.set(!1); + }), + (bi.prototype.setColorMode = function (t) { + o(t.blendFunction, xi.Replace) + ? this.blend.set(!1) + : (this.blend.set(!0), + this.blendFunc.set(t.blendFunction), + this.blendColor.set(t.blendColor)), + this.colorMask.set(t.mask); + }), + (bi.prototype.unbindVAO = function () { + this.extVertexArrayObject && this.bindVertexArrayOES.set(null); + }); + var wi = function (t, e, i) { + (this.func = t), (this.mask = e), (this.range = i); + }; + (wi.ReadOnly = !1), + (wi.ReadWrite = !0), + (wi.disabled = new wi(519, wi.ReadOnly, [0, 1])); + var Ti = 7680, + Ei = function (t, e, i, r, o, a) { + (this.test = t), + (this.ref = e), + (this.mask = i), + (this.fail = r), + (this.depthFail = o), + (this.pass = a); + }; + Ei.disabled = new Ei({ func: 519, mask: 0 }, 0, 0, Ti, Ti, Ti); + var Ii, + Ci = function (t, e, i) { + (this.enable = t), (this.mode = e), (this.frontFace = i); + }; + function Si(e, i, r, o, a, n, s) { + for ( + var l = e.context, + c = l.gl, + h = e.useProgram('collisionBox'), + u = [], + p = 0, + d = 0, + _ = 0; + _ < o.length; + _++ + ) { + var f = o[_], + m = i.getTile(f), + g = m.getBucket(r); + if (g) { + var v = f.posMatrix; + (0 === a[0] && 0 === a[1]) || + (v = e.translatePosMatrix(f.posMatrix, m, a, n)); + var y = s ? g.textCollisionBox : g.iconCollisionBox, + x = g.collisionCircleArray; + if (x.length > 0) { + var b = t.create(), + w = v; + t.mul(b, g.placementInvProjMatrix, e.transform.glCoordMatrix), + t.mul(b, b, g.placementViewportMatrix), + u.push({ + circleArray: x, + circleOffset: d, + transform: w, + invTransform: b, + coord: f, + }), + (d = p += x.length / 4); + } + y && + h.draw( + l, + c.LINES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ci.disabled, + ge(v, e.transform, m), + e.style.terrain && e.style.terrain.getTerrainData(f), + r.id, + y.layoutVertexBuffer, + y.indexBuffer, + y.segments, + null, + e.transform.zoom, + null, + null, + y.collisionVertexBuffer, + ); + } + } + if (s && u.length) { + var T = e.useProgram('collisionCircle'), + E = new t.CollisionCircleLayoutArray(); + E.resize(4 * p), E._trim(); + for (var I = 0, C = 0, S = u; C < S.length; C += 1) + for (var D = S[C], z = 0; z < D.circleArray.length / 4; z++) { + var P = 4 * z, + M = D.circleArray[P + 0], + A = D.circleArray[P + 1], + R = D.circleArray[P + 2], + L = D.circleArray[P + 3]; + E.emplace(I++, M, A, R, L, 0), + E.emplace(I++, M, A, R, L, 1), + E.emplace(I++, M, A, R, L, 2), + E.emplace(I++, M, A, R, L, 3); + } + (!Ii || Ii.length < 2 * p) && + (Ii = (function (e) { + var i = 2 * e, + r = new t.QuadTriangleArray(); + r.resize(i), r._trim(); + for (var o = 0; o < i; o++) { + var a = 6 * o; + (r.uint16[a + 0] = 4 * o + 0), + (r.uint16[a + 1] = 4 * o + 1), + (r.uint16[a + 2] = 4 * o + 2), + (r.uint16[a + 3] = 4 * o + 2), + (r.uint16[a + 4] = 4 * o + 3), + (r.uint16[a + 5] = 4 * o + 0); + } + return r; + })(p)); + for ( + var k = l.createIndexBuffer(Ii, !0), + B = l.createVertexBuffer(E, t.collisionCircleLayout.members, !0), + O = 0, + F = u; + O < F.length; + O += 1 + ) { + var U = F[O], + N = ve(U.transform, U.invTransform, e.transform); + T.draw( + l, + c.TRIANGLES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ci.disabled, + N, + e.style.terrain && e.style.terrain.getTerrainData(U.coord), + r.id, + B, + k, + t.SegmentVector.simpleSegment( + 0, + 2 * U.circleOffset, + U.circleArray.length, + U.circleArray.length / 2, + ), + null, + e.transform.zoom, + null, + null, + null, + ); + } + B.destroy(), k.destroy(); + } + } + (Ci.disabled = new Ci(!1, 1029, 2305)), + (Ci.backCCW = new Ci(!0, 1029, 2305)); + var Di = t.identity(new Float32Array(16)); + function zi(e, i, r, o, a, n) { + var s = t.getAnchorAlignment(e), + l = -(s.horizontalAlign - 0.5) * i, + c = -(s.verticalAlign - 0.5) * r, + h = t.evaluateVariableOffset(e, o); + return new t.pointGeometry((l / a + h[0]) * n, (c / a + h[1]) * n); + } + function Pi(e, i, r, o, a, n, s, l, c, h, u, p) { + for ( + var d = e.context, + _ = d.gl, + f = e.transform, + m = 'map' === l, + g = 'map' === c, + v = 'viewport' !== l && 'point' !== r.layout.get('symbol-placement'), + y = m && !g && !v, + x = !r.layout.get('symbol-sort-key').isConstant(), + b = !1, + w = e.depthModeForSublayer(0, wi.ReadOnly), + T = r.layout.get('text-variable-anchor'), + E = [], + I = function () { + var o = S[C], + l = i.getTile(o), + c = l.getBucket(r); + if (c) { + var u = a ? c.text : c.icon; + if (u && u.segments.get().length) { + var p = u.programConfigurations.get(r.id), + d = a || c.sdfIcons, + w = a ? c.textSizeData : c.iconSizeData, + I = g || 0 !== f.pitch, + D = e.useProgram( + (function (t, e, i) { + return i.iconsInText && e + ? 'symbolTextAndIcon' + : t + ? 'symbolSDF' + : 'symbolIcon'; + })(d, a, c), + p, + ), + z = t.evaluateSizeForZoom(w, f.zoom), + P = e.style.terrain && e.style.terrain.getTerrainData(o), + M = void 0, + A = [0, 0], + R = void 0, + L = void 0, + k = null, + B = void 0; + if (a) + (R = l.glyphAtlasTexture), + (L = _.LINEAR), + (M = l.glyphAtlasTexture.size), + c.iconsInText && + ((A = l.imageAtlasTexture.size), + (k = l.imageAtlasTexture), + (B = + I || + e.options.rotating || + e.options.zooming || + 'composite' === w.kind || + 'camera' === w.kind + ? _.LINEAR + : _.NEAREST)); + else { + var O = + 1 !== r.layout.get('icon-size').constantOr(0) || + c.iconsNeedLinear; + (R = l.imageAtlasTexture), + (L = + d || e.options.rotating || e.options.zooming || O || I + ? _.LINEAR + : _.NEAREST), + (M = l.imageAtlasTexture.size); + } + var F = wt(l, 1, e.transform.zoom), + U = st(o.posMatrix, g, m, e.transform, F), + N = lt(o.posMatrix, g, m, e.transform, F), + G = T && c.hasTextData(), + j = + 'none' !== r.layout.get('icon-text-fit') && + G && + c.hasIconData(); + if (v) { + var Z = e.style.terrain + ? function (t, i) { + return e.style.terrain.getElevation(o, t, i); + } + : null, + V = 'map' === r.layout.get('text-rotation-alignment'); + !(function (e, i, r, o, a, n, s, l, c, h) { + var u = o ? e.textSizeData : e.iconSizeData, + p = t.evaluateSizeForZoom(u, r.transform.zoom), + d = [(256 / r.width) * 2 + 1, (256 / r.height) * 2 + 1], + _ = o + ? e.text.dynamicLayoutVertexArray + : e.icon.dynamicLayoutVertexArray; + _.clear(); + for ( + var f = e.lineVertexArray, + m = o + ? e.text.placedSymbolArray + : e.icon.placedSymbolArray, + g = r.transform.width / r.transform.height, + v = !1, + y = 0; + y < m.length; + y++ + ) { + var x = m.get(y); + if ( + x.hidden || + (x.writingMode === t.WritingMode.vertical && !v) + ) + vt(x.numGlyphs, _); + else { + v = !1; + var b = void 0; + if ( + (h + ? ((b = [ + x.anchorX, + x.anchorY, + h(x.anchorX, x.anchorY), + 1, + ]), + t.transformMat4(b, b, i)) + : yt((b = [x.anchorX, x.anchorY, 0, 1]), b, i), + ut(b, d)) + ) { + var w = ht(r.transform.cameraToCenterDistance, b[3]), + T = t.evaluateSizeForFeature(u, p, x), + E = s ? T / w : T * w, + I = new t.pointGeometry(x.anchorX, x.anchorY), + C = ct(I, a, h).point, + S = {}, + D = _t( + x, + E, + !1, + l, + i, + a, + n, + e.glyphOffsetArray, + f, + _, + C, + I, + S, + g, + c, + h, + ); + (v = D.useVertical), + (D.notEnoughRoom || + v || + (D.needsFlipping && + _t( + x, + E, + !0, + l, + i, + a, + n, + e.glyphOffsetArray, + f, + _, + C, + I, + S, + g, + c, + h, + ).notEnoughRoom)) && + vt(x.numGlyphs, _); + } else vt(x.numGlyphs, _); + } + } + o + ? e.text.dynamicLayoutVertexBuffer.updateData(_) + : e.icon.dynamicLayoutVertexBuffer.updateData(_); + })(c, o.posMatrix, e, a, U, N, g, h, V, Z); + } + var q, + X = e.translatePosMatrix(o.posMatrix, l, n, s), + W = v || (a && T) || j ? Di : U, + H = e.translatePosMatrix(N, l, n, s, !0), + K = + d && + 0 !== + r.paint + .get(a ? 'text-halo-width' : 'icon-halo-width') + .constantOr(1); + q = d + ? c.iconsInText + ? (function (e, i, r, o, a, n, s, l, c, h) { + return t.extend(Me(e, i, r, o, a, n, s, l, !0, c, !0), { + u_texsize_icon: h, + u_texture_icon: 1, + }); + })(w.kind, z, y, g, e, X, W, H, M, A) + : Me(w.kind, z, y, g, e, X, W, H, a, M, !0) + : Pe(w.kind, z, y, g, e, X, W, H, a, M); + var Y = { + program: D, + buffers: u, + uniformValues: q, + atlasTexture: R, + atlasTextureIcon: k, + atlasInterpolation: L, + atlasInterpolationIcon: B, + isSDF: d, + hasHalo: K, + }; + if (x && c.canOverlap) { + b = !0; + for (var J = 0, Q = u.segments.get(); J < Q.length; J += 1) { + var $ = Q[J]; + E.push({ + segments: new t.SegmentVector([$]), + sortKey: $.sortKey, + state: Y, + terrainData: P, + }); + } + } else + E.push({ + segments: u.segments, + sortKey: 0, + state: Y, + terrainData: P, + }); + } + } + }, + C = 0, + S = o; + C < S.length; + C += 1 + ) + I(); + b && + E.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + for (var D = 0, z = E; D < z.length; D += 1) { + var P = z[D], + M = P.state; + if ( + (d.activeTexture.set(_.TEXTURE0), + M.atlasTexture.bind(M.atlasInterpolation, _.CLAMP_TO_EDGE), + M.atlasTextureIcon && + (d.activeTexture.set(_.TEXTURE1), + M.atlasTextureIcon && + M.atlasTextureIcon.bind( + M.atlasInterpolationIcon, + _.CLAMP_TO_EDGE, + )), + M.isSDF) + ) { + var A = M.uniformValues; + M.hasHalo && + ((A.u_is_halo = 1), + Mi( + M.buffers, + P.segments, + r, + e, + M.program, + w, + u, + p, + A, + P.terrainData, + )), + (A.u_is_halo = 0); + } + Mi( + M.buffers, + P.segments, + r, + e, + M.program, + w, + u, + p, + M.uniformValues, + P.terrainData, + ); + } + } + function Mi(t, e, i, r, o, a, n, s, l, c) { + var h = r.context; + o.draw( + h, + h.gl.TRIANGLES, + a, + n, + s, + Ci.disabled, + l, + c, + i.id, + t.layoutVertexBuffer, + t.indexBuffer, + e, + i.paint, + r.transform.zoom, + t.programConfigurations.get(i.id), + t.dynamicLayoutVertexBuffer, + t.opacityVertexBuffer, + ); + } + function Ai(t, e, i, r, o, a, n) { + var s, + l, + c, + h, + u, + p = t.context.gl, + d = i.paint.get('fill-pattern'), + _ = d && d.constantOr(1), + f = i.getCrossfadeParameters(); + n + ? ((l = + _ && !i.getPaintProperty('fill-outline-color') + ? 'fillOutlinePattern' + : 'fillOutline'), + (s = p.LINES)) + : ((l = _ ? 'fillPattern' : 'fill'), (s = p.TRIANGLES)); + for (var m = 0, g = r; m < g.length; m += 1) { + var v = g[m], + y = e.getTile(v); + if (!_ || y.patternsLoaded()) { + var x = y.getBucket(i); + if (x) { + var b = x.programConfigurations.get(i.id), + w = t.useProgram(l, b), + T = t.style.terrain && t.style.terrain.getTerrainData(v); + _ && + (t.context.activeTexture.set(p.TEXTURE0), + y.imageAtlasTexture.bind(p.LINEAR, p.CLAMP_TO_EDGE), + b.updatePaintBuffers(f)); + var E = d.constantOr(null); + if (E && y.imageAtlas) { + var I = y.imageAtlas, + C = I.patternPositions[E.to.toString()], + S = I.patternPositions[E.from.toString()]; + C && S && b.setConstantPatternPositions(C, S); + } + var D = T ? v : null, + z = t.translatePosMatrix( + D ? D.posMatrix : v.posMatrix, + y, + i.paint.get('fill-translate'), + i.paint.get('fill-translate-anchor'), + ); + if (n) { + (h = x.indexBuffer2), (u = x.segments2); + var P = [p.drawingBufferWidth, p.drawingBufferHeight]; + c = + 'fillOutlinePattern' === l && _ ? fe(z, t, f, y, P) : _e(z, P); + } else + (h = x.indexBuffer), + (u = x.segments), + (c = _ ? de(z, t, f, y) : pe(z)); + w.draw( + t.context, + s, + o, + t.stencilModeForClipping(v), + a, + Ci.disabled, + c, + T, + i.id, + x.layoutVertexBuffer, + h, + u, + i.paint, + t.transform.zoom, + b, + ); + } + } + } + } + function Ri(t, e, i, r, o, a, n) { + for ( + var s = t.context, + l = s.gl, + c = i.paint.get('fill-extrusion-pattern'), + h = c.constantOr(1), + u = i.getCrossfadeParameters(), + p = i.paint.get('fill-extrusion-opacity'), + d = 0, + _ = r; + d < _.length; + d += 1 + ) { + var f = _[d], + m = e.getTile(f), + g = m.getBucket(i); + if (g) { + var v = t.style.terrain && t.style.terrain.getTerrainData(f), + y = g.programConfigurations.get(i.id), + x = t.useProgram(h ? 'fillExtrusionPattern' : 'fillExtrusion', y); + h && + (t.context.activeTexture.set(l.TEXTURE0), + m.imageAtlasTexture.bind(l.LINEAR, l.CLAMP_TO_EDGE), + y.updatePaintBuffers(u)); + var b = c.constantOr(null); + if (b && m.imageAtlas) { + var w = m.imageAtlas, + T = w.patternPositions[b.to.toString()], + E = w.patternPositions[b.from.toString()]; + T && E && y.setConstantPatternPositions(T, E); + } + var I = t.translatePosMatrix( + f.posMatrix, + m, + i.paint.get('fill-extrusion-translate'), + i.paint.get('fill-extrusion-translate-anchor'), + ), + C = i.paint.get('fill-extrusion-vertical-gradient'), + S = h ? ue(I, t, C, p, f, u, m) : he(I, t, C, p); + x.draw( + s, + s.gl.TRIANGLES, + o, + a, + n, + Ci.backCCW, + S, + v, + i.id, + g.layoutVertexBuffer, + g.indexBuffer, + g.segments, + i.paint, + t.transform.zoom, + y, + t.style.terrain && g.centroidVertexBuffer, + ); + } + } + } + function Li(e, i, r, o, a, n, s) { + var l = e.context, + c = l.gl, + h = r.fbo; + if (h) { + var u = e.useProgram('hillshade'), + p = e.style.terrain && e.style.terrain.getTerrainData(i); + l.activeTexture.set(c.TEXTURE0), + c.bindTexture(c.TEXTURE_2D, h.colorAttachment.get()), + u.draw( + l, + c.TRIANGLES, + a, + n, + s, + Ci.disabled, + (function (e, i, r, o) { + var a = r.paint.get('hillshade-shadow-color'), + n = r.paint.get('hillshade-highlight-color'), + s = r.paint.get('hillshade-accent-color'), + l = + r.paint.get('hillshade-illumination-direction') * + (Math.PI / 180); + 'viewport' === r.paint.get('hillshade-illumination-anchor') && + (l -= e.transform.angle); + var c, + h, + u, + p = !e.options.moving; + return { + u_matrix: o + ? o.posMatrix + : e.transform.calculatePosMatrix(i.tileID.toUnwrapped(), p), + u_image: 0, + u_latrange: + ((c = i.tileID), + (h = Math.pow(2, c.canonical.z)), + (u = c.canonical.y), + [ + new t.MercatorCoordinate(0, u / h).toLngLat().lat, + new t.MercatorCoordinate(0, (u + 1) / h).toLngLat().lat, + ]), + u_light: [r.paint.get('hillshade-exaggeration'), l], + u_shadow: a, + u_highlight: n, + u_accent: s, + }; + })(e, r, o, p ? i : null), + p, + o.id, + e.rasterBoundsBuffer, + e.quadTriangleIndexBuffer, + e.rasterBoundsSegments, + ); + } + } + function ki(e, i, r, o, a, n) { + var s = e.context, + c = s.gl, + h = i.dem; + if (h && h.data) { + var u = h.dim, + p = h.stride, + d = h.getPixels(); + if ( + (s.activeTexture.set(c.TEXTURE1), + s.pixelStoreUnpackPremultiplyAlpha.set(!1), + (i.demTexture = i.demTexture || e.getTileTexture(p)), + i.demTexture) + ) { + var _ = i.demTexture; + _.update(d, { premultiply: !1 }), _.bind(c.NEAREST, c.CLAMP_TO_EDGE); + } else + (i.demTexture = new l(s, d, c.RGBA, { premultiply: !1 })), + i.demTexture.bind(c.NEAREST, c.CLAMP_TO_EDGE); + s.activeTexture.set(c.TEXTURE0); + var f = i.fbo; + if (!f) { + var m = new l(s, { width: u, height: u, data: null }, c.RGBA); + m.bind(c.LINEAR, c.CLAMP_TO_EDGE), + (f = i.fbo = s.createFramebuffer(u, u, !0)).colorAttachment.set( + m.texture, + ); + } + s.bindFramebuffer.set(f.framebuffer), + s.viewport.set([0, 0, u, u]), + e.useProgram('hillshadePrepare').draw( + s, + c.TRIANGLES, + o, + a, + n, + Ci.disabled, + (function (e, i) { + var r = i.stride, + o = t.create(); + return ( + t.ortho(o, 0, t.EXTENT, -t.EXTENT, 0, 0, 1), + t.translate(o, o, [0, -t.EXTENT, 0]), + { + u_matrix: o, + u_image: 1, + u_dimension: [r, r], + u_zoom: e.overscaledZ, + u_unpack: i.getUnpackVector(), + } + ); + })(i.tileID, h), + null, + r.id, + e.rasterBoundsBuffer, + e.quadTriangleIndexBuffer, + e.rasterBoundsSegments, + ), + (i.needsHillshadePrepare = !1); + } + } + function Bi(e, i, r, o, a, n) { + var s = o.paint.get('raster-fade-duration'); + if (!n && s > 0) { + var l = t.exported.now(), + c = (l - e.timeAdded) / s, + h = i ? (l - i.timeAdded) / s : -1, + u = r.getSource(), + p = a.coveringZoomLevel({ + tileSize: u.tileSize, + roundZoom: u.roundZoom, + }), + d = + !i || + Math.abs(i.tileID.overscaledZ - p) > + Math.abs(e.tileID.overscaledZ - p), + _ = d && e.refreshedUponExpiration ? 1 : t.clamp(d ? c : 1 - h, 0, 1); + return ( + e.refreshedUponExpiration && + c >= 1 && + (e.refreshedUponExpiration = !1), + i ? { opacity: 1, mix: 1 - _ } : { opacity: _, mix: 0 } + ); + } + return { opacity: 1, mix: 0 }; + } + var Oi = new t.Color(1, 0, 0, 1), + Fi = new t.Color(0, 1, 0, 1), + Ui = new t.Color(0, 0, 1, 1), + Ni = new t.Color(1, 0, 1, 1), + Gi = new t.Color(0, 1, 1, 1); + function ji(t, e, i, r) { + Vi(t, 0, e + i / 2, t.transform.width, i, r); + } + function Zi(t, e, i, r) { + Vi(t, e - i / 2, 0, i, t.transform.height, r); + } + function Vi(t, e, i, r, o, a) { + var n = t.context, + s = n.gl; + s.enable(s.SCISSOR_TEST), + s.scissor( + e * t.pixelRatio, + i * t.pixelRatio, + r * t.pixelRatio, + o * t.pixelRatio, + ), + n.clear({ color: a }), + s.disable(s.SCISSOR_TEST); + } + function qi(e, i, r) { + var o = e.context, + a = o.gl, + n = r.posMatrix, + s = e.useProgram('debug'), + l = wi.disabled, + c = Ei.disabled, + h = e.colorModeForRenderPass(), + u = '$debug', + p = e.style.terrain && e.style.terrain.getTerrainData(r); + o.activeTexture.set(a.TEXTURE0), + e.emptyTexture.bind(a.LINEAR, a.CLAMP_TO_EDGE); + var d = i.getTileByID(r.key).latestRawTileData, + _ = Math.floor(((d && d.byteLength) || 0) / 1024), + f = i.getTile(r).tileSize, + m = (512 / Math.min(f, 512)) * (r.overscaledZ / e.transform.zoom) * 0.5, + g = r.canonical.toString(); + r.overscaledZ !== r.canonical.z && (g += ' => ' + r.overscaledZ), + (function (t, e) { + t.initDebugOverlayCanvas(); + var i = t.debugOverlayCanvas, + r = t.context.gl, + o = t.debugOverlayCanvas.getContext('2d'); + o.clearRect(0, 0, i.width, i.height), + (o.shadowColor = 'white'), + (o.shadowBlur = 2), + (o.lineWidth = 1.5), + (o.strokeStyle = 'white'), + (o.textBaseline = 'top'), + (o.font = 'bold 36px Open Sans, sans-serif'), + o.fillText(e, 5, 5), + o.strokeText(e, 5, 5), + t.debugOverlayTexture.update(i), + t.debugOverlayTexture.bind(r.LINEAR, r.CLAMP_TO_EDGE); + })(e, g + ' ' + _ + 'kB'), + s.draw( + o, + a.TRIANGLES, + l, + c, + xi.alphaBlended, + Ci.disabled, + ye(n, t.Color.transparent, m), + null, + u, + e.debugBuffer, + e.quadTriangleIndexBuffer, + e.debugSegments, + ), + s.draw( + o, + a.LINE_STRIP, + l, + c, + h, + Ci.disabled, + ye(n, t.Color.red), + p, + u, + e.debugBuffer, + e.tileBorderIndexBuffer, + e.debugSegments, + ); + } + function Xi(t, e, i) { + var r = t.context, + o = r.gl, + a = t.colorModeForRenderPass(), + n = new wi(o.LEQUAL, wi.ReadWrite, t.depthRangeFor3D), + s = t.useProgram('terrain'), + l = e.getTerrainMesh(), + c = e.getTerrainData(i.tileID); + r.bindFramebuffer.set(null), + r.viewport.set([0, 0, t.width, t.height]), + r.activeTexture.set(o.TEXTURE0), + o.bindTexture( + o.TEXTURE_2D, + e.getRTTFramebuffer().colorAttachment.get(), + ); + var h = t.transform.calculatePosMatrix(i.tileID.toUnwrapped()); + s.draw( + r, + o.TRIANGLES, + n, + Ei.disabled, + a, + Ci.backCCW, + { u_matrix: h, u_texture: 0 }, + c, + 'terrain', + l.vertexBuffer, + l.indexBuffer, + l.segments, + ); + } + function Wi(t, e, i, r) { + var o = t.context, + a = i.tileSize * e.qualityFactor; + i.textures[r] || + ((i.textures[r] = + t.getTileTexture(a) || + new l(o, { width: a, height: a, data: null }, o.gl.RGBA)), + i.textures[r].bind(o.gl.LINEAR, o.gl.CLAMP_TO_EDGE), + 0 === r && e.sourceCache.renderHistory.unshift(i.tileID.key)); + var n = e.getRTTFramebuffer(); + n.colorAttachment.set(i.textures[r].texture), + o.bindFramebuffer.set(n.framebuffer), + o.viewport.set([0, 0, a, a]); + } + var Hi = function (t) { + (this._coordsDescendingInv = {}), + (this._coordsDescendingInvStr = {}), + (this.painter = t), + (this._renderToTexture = { + background: !0, + fill: !0, + line: !0, + raster: !0, + }), + (this._coordsDescendingInv = {}), + (this._coordsDescendingInvStr = {}), + (this._stacks = []), + (this._prevType = null), + (this._rerender = {}), + (this._renderableTiles = + t.style.terrain.sourceCache.getRenderableTiles()), + this._init(); + }; + (Hi.prototype._init = function () { + var t = this, + e = this.painter.style, + i = e.terrain; + for (var r in e.sourceCaches) { + this._coordsDescendingInv[r] = {}; + for ( + var o = 0, a = e.sourceCaches[r].getVisibleCoordinates(); + o < a.length; + o += 1 + ) { + var n = i.sourceCache.getTerrainCoords(a[o]); + for (var s in n) + this._coordsDescendingInv[r][s] || + (this._coordsDescendingInv[r][s] = []), + this._coordsDescendingInv[r][s].push(n[s]); + } + } + for (var l = 0, c = e._order; l < c.length; l += 1) { + var h = e._layers[c[l]], + u = h.source; + if (this._renderToTexture[h.type] && !this._coordsDescendingInvStr[u]) + for (var p in ((this._coordsDescendingInvStr[u] = {}), + this._coordsDescendingInv[u])) + this._coordsDescendingInvStr[u][p] = this._coordsDescendingInv[u][p] + .map(function (t) { + return t.key; + }) + .sort() + .join(); + } + return ( + this._renderableTiles.forEach(function (e) { + for (var r in t._coordsDescendingInvStr) { + var o = t._coordsDescendingInvStr[r][e.tileID.key]; + o && o !== e.textureCoords[r] && e.clearTextures(t.painter), + i.needsRerender(r, e.tileID) && e.clearTextures(t.painter); + } + t._rerender[e.tileID.key] = !e.textures.length; + }), + i.clearRerenderCache(), + i.sourceCache.removeOutdated(this.painter), + this + ); + }), + (Hi.prototype.renderLayer = function (e) { + var i = e.type, + r = this.painter, + o = r.style._order, + a = r.currentLayer, + n = a + 1 === o.length; + if ( + this._renderToTexture[i] && + ((this._prevType && this._renderToTexture[this._prevType]) || + this._stacks.push([]), + (this._prevType = i), + this._stacks[this._stacks.length - 1].push(o[a]), + !n) + ) + return !0; + if ( + this._renderToTexture[this._prevType] || + 'hillshade' === i || + (this._renderToTexture[i] && n) + ) { + this._prevType = i; + for ( + var s = this._stacks.length - 1, + l = this._stacks[s] || [], + c = 0, + h = this._renderableTiles; + c < h.length; + c += 1 + ) { + var u = h[c]; + if ((Wi(r, r.style.terrain, u, s), this._rerender[u.tileID.key])) { + r.context.clear({ color: t.Color.transparent }); + for (var p = 0; p < l.length; p++) { + var d = r.style._layers[l[p]], + _ = d.source + ? this._coordsDescendingInv[d.source][u.tileID.key] + : [u.tileID]; + r._renderTileClippingMasks(d, _), + r.renderLayer(r, r.style.sourceCaches[d.source], d, _), + d.source && + (u.textureCoords[d.source] = + this._coordsDescendingInvStr[d.source][u.tileID.key]); + } + } + Xi(r, r.style.terrain, u); + } + if ('hillshade' === i) { + this._stacks.push([o[a]]); + for (var f = 0, m = this._renderableTiles; f < m.length; f += 1) { + var g = m[f], + v = this._coordsDescendingInv[e.source][g.tileID.key]; + Wi(r, r.style.terrain, g, this._stacks.length - 1), + r.context.clear({ color: t.Color.transparent }), + r._renderTileClippingMasks(e, v), + r.renderLayer(r, r.style.sourceCaches[e.source], e, v), + Xi(r, r.style.terrain, g); + } + return !0; + } + return this._renderToTexture[i]; + } + return !1; + }); + var Ki = { + symbol: function (e, i, r, o, a) { + if ('translucent' === e.renderPass) { + var n = Ei.disabled, + s = e.colorModeForRenderPass(); + r.layout.get('text-variable-anchor') && + (function (e, i, r, o, a, n, s) { + for ( + var l = i.transform, + c = 'map' === a, + h = 'map' === n, + u = function () { + var e = d[p], + a = o.getTile(e), + n = a.getBucket(r); + if (n && n.text && n.text.segments.get().length) { + var u = t.evaluateSizeForZoom(n.textSizeData, l.zoom), + _ = wt(a, 1, i.transform.zoom), + f = st(e.posMatrix, h, c, i.transform, _), + m = + 'none' !== r.layout.get('icon-text-fit') && + n.hasIconData(); + if (u) { + var g = Math.pow(2, l.zoom - a.tileID.overscaledZ); + !(function (e, i, r, o, a, n, s, l, c, h, u) { + var p = e.text.placedSymbolArray, + d = e.text.dynamicLayoutVertexArray, + _ = e.icon.dynamicLayoutVertexArray, + f = {}; + d.clear(); + for (var m = 0; m < p.length; m++) { + var g = p.get(m), + v = + g.hidden || + !g.crossTileID || + (e.allowVerticalPlacement && + !g.placedOrientation) + ? null + : o[g.crossTileID]; + if (v) { + var y = new t.pointGeometry( + g.anchorX, + g.anchorY, + ), + x = ct(y, r ? s : n, u), + b = ht( + a.cameraToCenterDistance, + x.signedDistanceFromCamera, + ), + w = + (t.evaluateSizeForFeature( + e.textSizeData, + c, + g, + ) * + b) / + t.ONE_EM; + r && (w *= e.tilePixelRatio / l); + for ( + var T = zi( + v.anchor, + v.width, + v.height, + v.textOffset, + v.textBoxScale, + w, + ), + E = r + ? ct(y.add(T), n, u).point + : x.point.add(i ? T.rotate(-a.angle) : T), + I = + e.allowVerticalPlacement && + g.placedOrientation === + t.WritingMode.vertical + ? Math.PI / 2 + : 0, + C = 0; + C < g.numGlyphs; + C++ + ) + t.addDynamicAttributes(d, E, I); + h && + g.associatedIconIndex >= 0 && + (f[g.associatedIconIndex] = { + shiftedAnchor: E, + angle: I, + }); + } else vt(g.numGlyphs, d); + } + if (h) { + _.clear(); + for ( + var S = e.icon.placedSymbolArray, D = 0; + D < S.length; + D++ + ) { + var z = S.get(D); + if (z.hidden) vt(z.numGlyphs, _); + else { + var P = f[D]; + if (P) + for (var M = 0; M < z.numGlyphs; M++) + t.addDynamicAttributes( + _, + P.shiftedAnchor, + P.angle, + ); + else vt(z.numGlyphs, _); + } + } + e.icon.dynamicLayoutVertexBuffer.updateData(_); + } + e.text.dynamicLayoutVertexBuffer.updateData(d); + })( + n, + c, + h, + s, + l, + f, + e.posMatrix, + g, + u, + m, + i.style.terrain + ? function (t, r) { + return i.style.terrain.getElevation(e, t, r); + } + : null, + ); + } + } + }, + p = 0, + d = e; + p < d.length; + p += 1 + ) + u(); + })( + o, + e, + r, + i, + r.layout.get('text-rotation-alignment'), + r.layout.get('text-pitch-alignment'), + a, + ), + 0 !== r.paint.get('icon-opacity').constantOr(1) && + Pi( + e, + i, + r, + o, + !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'), + n, + s, + ), + 0 !== r.paint.get('text-opacity').constantOr(1) && + Pi( + e, + i, + r, + o, + !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'), + n, + s, + ), + i.map.showCollisionBoxes && + (Si( + e, + i, + r, + o, + r.paint.get('text-translate'), + r.paint.get('text-translate-anchor'), + !0, + ), + Si( + e, + i, + r, + o, + r.paint.get('icon-translate'), + r.paint.get('icon-translate-anchor'), + !1, + )); + } + }, + circle: function (e, i, r, o) { + if ('translucent' === e.renderPass) { + var a = r.paint.get('circle-opacity'), + n = r.paint.get('circle-stroke-width'), + s = r.paint.get('circle-stroke-opacity'), + l = !r.layout.get('circle-sort-key').isConstant(); + if ( + 0 !== a.constantOr(1) || + (0 !== n.constantOr(1) && 0 !== s.constantOr(1)) + ) { + for ( + var c = e.context, + h = c.gl, + u = e.depthModeForSublayer(0, wi.ReadOnly), + p = Ei.disabled, + d = e.colorModeForRenderPass(), + _ = [], + f = 0; + f < o.length; + f++ + ) { + var m = o[f], + g = i.getTile(m), + v = g.getBucket(r); + if (v) { + var y = v.programConfigurations.get(r.id), + x = e.useProgram('circle', y), + b = v.layoutVertexBuffer, + w = v.indexBuffer, + T = e.style.terrain && e.style.terrain.getTerrainData(m), + E = { + programConfiguration: y, + program: x, + layoutVertexBuffer: b, + indexBuffer: w, + uniformValues: me(e, m, g, r), + terrainData: T, + }; + if (l) + for ( + var I = 0, C = v.segments.get(); + I < C.length; + I += 1 + ) { + var S = C[I]; + _.push({ + segments: new t.SegmentVector([S]), + sortKey: S.sortKey, + state: E, + }); + } + else _.push({ segments: v.segments, sortKey: 0, state: E }); + } + } + l && + _.sort(function (t, e) { + return t.sortKey - e.sortKey; + }); + for (var D = 0, z = _; D < z.length; D += 1) { + var P = z[D], + M = P.state; + M.program.draw( + c, + h.TRIANGLES, + u, + p, + d, + Ci.disabled, + M.uniformValues, + M.terrainData, + r.id, + M.layoutVertexBuffer, + M.indexBuffer, + P.segments, + r.paint, + e.transform.zoom, + M.programConfiguration, + ); + } + } + } + }, + heatmap: function (e, i, r, o) { + if (0 !== r.paint.get('heatmap-opacity')) + if ('offscreen' === e.renderPass) { + var a = e.context, + n = a.gl, + s = Ei.disabled, + c = new xi([n.ONE, n.ONE], t.Color.transparent, [ + !0, + !0, + !0, + !0, + ]); + !(function (t, e, i) { + var r = t.gl; + t.activeTexture.set(r.TEXTURE1), + t.viewport.set([0, 0, e.width / 4, e.height / 4]); + var o = i.heatmapFbo; + if (o) + r.bindTexture(r.TEXTURE_2D, o.colorAttachment.get()), + t.bindFramebuffer.set(o.framebuffer); + else { + var a = r.createTexture(); + r.bindTexture(r.TEXTURE_2D, a), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_WRAP_S, + r.CLAMP_TO_EDGE, + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_WRAP_T, + r.CLAMP_TO_EDGE, + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_MIN_FILTER, + r.LINEAR, + ), + r.texParameteri( + r.TEXTURE_2D, + r.TEXTURE_MAG_FILTER, + r.LINEAR, + ), + (o = i.heatmapFbo = + t.createFramebuffer(e.width / 4, e.height / 4, !1)), + (function (t, e, i, r) { + var o = t.gl; + o.texImage2D( + o.TEXTURE_2D, + 0, + o.RGBA, + e.width / 4, + e.height / 4, + 0, + o.RGBA, + t.extRenderToTextureHalfFloat + ? t.extTextureHalfFloat.HALF_FLOAT_OES + : o.UNSIGNED_BYTE, + null, + ), + r.colorAttachment.set(i); + })(t, e, a, o); + } + })(a, e, r), + a.clear({ color: t.Color.transparent }); + for (var h = 0; h < o.length; h++) { + var u = o[h]; + if (!i.hasRenderableParent(u)) { + var p = i.getTile(u), + d = p.getBucket(r); + if (d) { + var _ = d.programConfigurations.get(r.id); + e.useProgram('heatmap', _).draw( + a, + n.TRIANGLES, + wi.disabled, + s, + c, + Ci.disabled, + be( + u.posMatrix, + p, + e.transform.zoom, + r.paint.get('heatmap-intensity'), + ), + null, + r.id, + d.layoutVertexBuffer, + d.indexBuffer, + d.segments, + r.paint, + e.transform.zoom, + _, + ); + } + } + } + a.viewport.set([0, 0, e.width, e.height]); + } else + 'translucent' === e.renderPass && + (e.context.setColorMode(e.colorModeForRenderPass()), + (function (e, i) { + var r = e.context, + o = r.gl, + a = i.heatmapFbo; + if (a) { + r.activeTexture.set(o.TEXTURE0), + o.bindTexture(o.TEXTURE_2D, a.colorAttachment.get()), + r.activeTexture.set(o.TEXTURE1); + var n = i.colorRampTexture; + n || + (n = i.colorRampTexture = new l(r, i.colorRamp, o.RGBA)), + n.bind(o.LINEAR, o.CLAMP_TO_EDGE), + e.useProgram('heatmapTexture').draw( + r, + o.TRIANGLES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ci.disabled, + (function (e, i, r, o) { + var a = t.create(); + t.ortho(a, 0, e.width, e.height, 0, 0, 1); + var n = e.context.gl; + return { + u_matrix: a, + u_world: [ + n.drawingBufferWidth, + n.drawingBufferHeight, + ], + u_image: 0, + u_color_ramp: 1, + u_opacity: i.paint.get('heatmap-opacity'), + }; + })(e, i), + null, + i.id, + e.viewportBuffer, + e.quadTriangleIndexBuffer, + e.viewportSegments, + i.paint, + e.transform.zoom, + ); + } + })(e, r)); + }, + line: function (e, i, r, o) { + if ('translucent' === e.renderPass) { + var a = r.paint.get('line-opacity'), + n = r.paint.get('line-width'); + if (0 !== a.constantOr(1) && 0 !== n.constantOr(1)) + for ( + var s = e.depthModeForSublayer(0, wi.ReadOnly), + c = e.colorModeForRenderPass(), + h = r.paint.get('line-dasharray'), + u = r.paint.get('line-pattern'), + p = u.constantOr(1), + d = r.paint.get('line-gradient'), + _ = r.getCrossfadeParameters(), + f = p + ? 'linePattern' + : h + ? 'lineSDF' + : d + ? 'lineGradient' + : 'line', + m = e.context, + g = m.gl, + v = !0, + y = 0, + x = o; + y < x.length; + y += 1 + ) { + var b = x[y], + w = i.getTile(b); + if (!p || w.patternsLoaded()) { + var T = w.getBucket(r); + if (T) { + var E = T.programConfigurations.get(r.id), + I = e.context.program.get(), + C = e.useProgram(f, E), + S = v || C.program !== I, + D = e.style.terrain && e.style.terrain.getTerrainData(b), + z = u.constantOr(null); + if (z && w.imageAtlas) { + var P = w.imageAtlas, + M = P.patternPositions[z.to.toString()], + A = P.patternPositions[z.from.toString()]; + M && A && E.setConstantPatternPositions(M, A); + } + var R = D ? b : null, + L = p + ? Ee(e, w, r, _, R) + : h + ? Ie(e, w, r, h, _, R) + : d + ? Te(e, w, r, T.lineClipsArray.length, R) + : we(e, w, r, R); + if (p) + m.activeTexture.set(g.TEXTURE0), + w.imageAtlasTexture.bind(g.LINEAR, g.CLAMP_TO_EDGE), + E.updatePaintBuffers(_); + else if (h && (S || e.lineAtlas.dirty)) + m.activeTexture.set(g.TEXTURE0), e.lineAtlas.bind(m); + else if (d) { + var k = T.gradients[r.id], + B = k.texture; + if (r.gradientVersion !== k.version) { + var O = 256; + if (r.stepInterpolant) { + var F = i.getSource().maxzoom, + U = + b.canonical.z === F + ? Math.ceil( + 1 << (e.transform.maxZoom - b.canonical.z), + ) + : 1; + O = t.clamp( + t.nextPowerOfTwo( + (T.maxLineLength / t.EXTENT) * 1024 * U, + ), + 256, + m.maxTextureSize, + ); + } + (k.gradient = t.renderColorRamp({ + expression: r.gradientExpression(), + evaluationKey: 'lineProgress', + resolution: O, + image: k.gradient || void 0, + clips: T.lineClipsArray, + })), + k.texture + ? k.texture.update(k.gradient) + : (k.texture = new l(m, k.gradient, g.RGBA)), + (k.version = r.gradientVersion), + (B = k.texture); + } + m.activeTexture.set(g.TEXTURE0), + B.bind( + r.stepInterpolant ? g.NEAREST : g.LINEAR, + g.CLAMP_TO_EDGE, + ); + } + C.draw( + m, + g.TRIANGLES, + s, + e.stencilModeForClipping(b), + c, + Ci.disabled, + L, + D, + r.id, + T.layoutVertexBuffer, + T.indexBuffer, + T.segments, + r.paint, + e.transform.zoom, + E, + T.layoutVertexBuffer2, + ), + (v = !1); + } + } + } + } + }, + fill: function (e, i, r, o) { + var a = r.paint.get('fill-color'), + n = r.paint.get('fill-opacity'); + if (0 !== n.constantOr(1)) { + var s = e.colorModeForRenderPass(), + l = r.paint.get('fill-pattern'), + c = + e.opaquePassEnabledForLayer() && + !l.constantOr(1) && + 1 === a.constantOr(t.Color.transparent).a && + 1 === n.constantOr(0) + ? 'opaque' + : 'translucent'; + if (e.renderPass === c) { + var h = e.depthModeForSublayer( + 1, + 'opaque' === e.renderPass ? wi.ReadWrite : wi.ReadOnly, + ); + Ai(e, i, r, o, h, s, !1); + } + if ( + 'translucent' === e.renderPass && + r.paint.get('fill-antialias') + ) { + var u = e.depthModeForSublayer( + r.getPaintProperty('fill-outline-color') ? 2 : 0, + wi.ReadOnly, + ); + Ai(e, i, r, o, u, s, !0); + } + } + }, + 'fill-extrusion': function (t, e, i, r) { + var o = i.paint.get('fill-extrusion-opacity'); + if (0 !== o && 'translucent' === t.renderPass) { + var a = new wi( + t.context.gl.LEQUAL, + wi.ReadWrite, + t.depthRangeFor3D, + ); + if (1 !== o || i.paint.get('fill-extrusion-pattern').constantOr(1)) + Ri(t, e, i, r, a, Ei.disabled, xi.disabled), + Ri( + t, + e, + i, + r, + a, + t.stencilModeFor3D(), + t.colorModeForRenderPass(), + ); + else { + var n = t.colorModeForRenderPass(); + Ri(t, e, i, r, a, Ei.disabled, n); + } + } + }, + hillshade: function (t, e, i, r) { + if ('offscreen' === t.renderPass || 'translucent' === t.renderPass) { + for ( + var o = t.context, + a = t.depthModeForSublayer(0, wi.ReadOnly), + n = t.colorModeForRenderPass(), + s = + 'translucent' === t.renderPass + ? t.stencilConfigForOverlap(r) + : [{}, r], + l = s[0], + c = 0, + h = s[1]; + c < h.length; + c += 1 + ) { + var u = h[c], + p = e.getTile(u); + void 0 !== p.needsHillshadePrepare && + p.needsHillshadePrepare && + 'offscreen' === t.renderPass + ? ki(t, p, i, a, Ei.disabled, n) + : 'translucent' === t.renderPass && + Li(t, u, p, i, a, l[u.overscaledZ], n); + } + o.viewport.set([0, 0, t.width, t.height]); + } + }, + raster: function (t, e, i, r) { + if ( + 'translucent' === t.renderPass && + 0 !== i.paint.get('raster-opacity') && + r.length + ) + for ( + var o = t.context, + a = o.gl, + n = e.getSource(), + s = t.useProgram('raster'), + l = t.colorModeForRenderPass(), + c = n instanceof P ? [{}, r] : t.stencilConfigForOverlap(r), + h = c[0], + u = c[1], + p = u[u.length - 1].overscaledZ, + d = !t.options.moving, + _ = 0, + f = u; + _ < f.length; + _ += 1 + ) { + var m = f[_], + g = t.depthModeForSublayer( + m.overscaledZ - p, + 1 === i.paint.get('raster-opacity') + ? wi.ReadWrite + : wi.ReadOnly, + a.LESS, + ), + v = e.getTile(m); + v.registerFadeDuration(i.paint.get('raster-fade-duration')); + var y = e.findLoadedParent(m, 0), + x = Bi(v, y, e, i, t.transform, t.style.terrain), + b = void 0, + w = void 0, + T = + 'nearest' === i.paint.get('raster-resampling') + ? a.NEAREST + : a.LINEAR; + o.activeTexture.set(a.TEXTURE0), + v.texture.bind(T, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST), + o.activeTexture.set(a.TEXTURE1), + y + ? (y.texture.bind( + T, + a.CLAMP_TO_EDGE, + a.LINEAR_MIPMAP_NEAREST, + ), + (b = Math.pow( + 2, + y.tileID.overscaledZ - v.tileID.overscaledZ, + )), + (w = [ + (v.tileID.canonical.x * b) % 1, + (v.tileID.canonical.y * b) % 1, + ])) + : v.texture.bind(T, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST); + var E = t.style.terrain && t.style.terrain.getTerrainData(m), + I = E ? m : null, + C = I + ? I.posMatrix + : t.transform.calculatePosMatrix(m.toUnwrapped(), d), + S = De(C, w || [0, 0], b || 1, x, i); + n instanceof P + ? s.draw( + o, + a.TRIANGLES, + g, + Ei.disabled, + l, + Ci.disabled, + S, + E, + i.id, + n.boundsBuffer, + t.quadTriangleIndexBuffer, + n.boundsSegments, + ) + : s.draw( + o, + a.TRIANGLES, + g, + h[m.overscaledZ], + l, + Ci.disabled, + S, + E, + i.id, + t.rasterBoundsBuffer, + t.quadTriangleIndexBuffer, + t.rasterBoundsSegments, + ); + } + }, + background: function (t, e, i, r) { + var o = i.paint.get('background-color'), + a = i.paint.get('background-opacity'); + if (0 !== a) { + var n = t.context, + s = n.gl, + l = t.transform, + c = l.tileSize, + h = i.paint.get('background-pattern'); + if (!t.isPatternMissing(h)) { + var u = + !h && 1 === o.a && 1 === a && t.opaquePassEnabledForLayer() + ? 'opaque' + : 'translucent'; + if (t.renderPass === u) { + var p = Ei.disabled, + d = t.depthModeForSublayer( + 0, + 'opaque' === u ? wi.ReadWrite : wi.ReadOnly, + ), + _ = t.colorModeForRenderPass(), + f = t.useProgram(h ? 'backgroundPattern' : 'background'), + m = + r || + l.coveringTiles({ tileSize: c, terrain: t.style.terrain }); + h && + (n.activeTexture.set(s.TEXTURE0), + t.imageManager.bind(t.context)); + for ( + var g = i.getCrossfadeParameters(), v = 0, y = m; + v < y.length; + v += 1 + ) { + var x = y[v], + b = r + ? x.posMatrix + : t.transform.calculatePosMatrix(x.toUnwrapped()), + w = h + ? Re(b, a, t, h, { tileID: x, tileSize: c }, g) + : Ae(b, a, o), + T = t.style.terrain && t.style.terrain.getTerrainData(x); + f.draw( + n, + s.TRIANGLES, + d, + p, + _, + Ci.disabled, + w, + T, + i.id, + t.tileExtentBuffer, + t.quadTriangleIndexBuffer, + t.tileExtentSegments, + ); + } + } + } + } + }, + debug: function (t, e, i) { + for (var r = 0; r < i.length; r++) qi(t, e, i[r]); + }, + custom: function (t, e, i) { + var r = t.context, + o = i.implementation; + if ('offscreen' === t.renderPass) { + var a = o.prerender; + a && + (t.setCustomLayerDefaults(), + r.setColorMode(t.colorModeForRenderPass()), + a.call(o, r.gl, t.transform.customLayerMatrix()), + r.setDirty(), + t.setBaseState()); + } else if ('translucent' === t.renderPass) { + t.setCustomLayerDefaults(), + r.setColorMode(t.colorModeForRenderPass()), + r.setStencilMode(Ei.disabled); + var n = + '3d' === o.renderingMode + ? new wi(t.context.gl.LEQUAL, wi.ReadWrite, t.depthRangeFor3D) + : t.depthModeForSublayer(0, wi.ReadOnly); + r.setDepthMode(n), + o.render(r.gl, t.transform.customLayerMatrix()), + r.setDirty(), + t.setBaseState(), + r.bindFramebuffer.set(null); + } + }, + }, + Yi = function (e, i) { + (this.context = new bi(e)), + (this.transform = i), + (this._tileTextures = {}), + (this.terrainFacilitator = { + dirty: !0, + matrix: t.create(), + renderTime: 0, + }), + this.setup(), + (this.numSublayers = N.maxUnderzooming + N.maxOverzooming + 1), + (this.depthEpsilon = 1 / Math.pow(2, 16)), + (this.crossTileSymbolIndex = new Ht()), + (this.gpuTimers = {}); + }; + (Yi.prototype.resize = function (t, e, i) { + if ( + ((this.width = t * i), + (this.height = e * i), + (this.pixelRatio = i), + this.context.viewport.set([0, 0, this.width, this.height]), + this.style) + ) + for (var r = 0, o = this.style._order; r < o.length; r += 1) + this.style._layers[o[r]].resize(); + }), + (Yi.prototype.setup = function () { + var e = this.context, + i = new t.PosArray(); + i.emplaceBack(0, 0), + i.emplaceBack(t.EXTENT, 0), + i.emplaceBack(0, t.EXTENT), + i.emplaceBack(t.EXTENT, t.EXTENT), + (this.tileExtentBuffer = e.createVertexBuffer(i, Kt.members)), + (this.tileExtentSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)); + var r = new t.PosArray(); + r.emplaceBack(0, 0), + r.emplaceBack(t.EXTENT, 0), + r.emplaceBack(0, t.EXTENT), + r.emplaceBack(t.EXTENT, t.EXTENT), + (this.debugBuffer = e.createVertexBuffer(r, Kt.members)), + (this.debugSegments = t.SegmentVector.simpleSegment(0, 0, 4, 5)); + var o = new t.RasterBoundsArray(); + o.emplaceBack(0, 0, 0, 0), + o.emplaceBack(t.EXTENT, 0, t.EXTENT, 0), + o.emplaceBack(0, t.EXTENT, 0, t.EXTENT), + o.emplaceBack(t.EXTENT, t.EXTENT, t.EXTENT, t.EXTENT), + (this.rasterBoundsBuffer = e.createVertexBuffer(o, z.members)), + (this.rasterBoundsSegments = t.SegmentVector.simpleSegment( + 0, + 0, + 4, + 2, + )); + var a = new t.PosArray(); + a.emplaceBack(0, 0), + a.emplaceBack(1, 0), + a.emplaceBack(0, 1), + a.emplaceBack(1, 1), + (this.viewportBuffer = e.createVertexBuffer(a, Kt.members)), + (this.viewportSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)); + var n = new t.LineStripIndexArray(); + n.emplaceBack(0), + n.emplaceBack(1), + n.emplaceBack(3), + n.emplaceBack(2), + n.emplaceBack(0), + (this.tileBorderIndexBuffer = e.createIndexBuffer(n)); + var s = new t.TriangleIndexArray(); + s.emplaceBack(0, 1, 2), + s.emplaceBack(2, 1, 3), + (this.quadTriangleIndexBuffer = e.createIndexBuffer(s)), + (this.emptyTexture = new l( + e, + { width: 1, height: 1, data: new Uint8Array([0, 0, 0, 0]) }, + e.gl.RGBA, + )); + var c = this.context.gl; + this.stencilClearMode = new Ei( + { func: c.ALWAYS, mask: 0 }, + 0, + 255, + c.ZERO, + c.ZERO, + c.ZERO, + ); + }), + (Yi.prototype.clearStencil = function () { + var e = this.context, + i = e.gl; + (this.nextStencilID = 1), (this.currentStencilSource = void 0); + var r = t.create(); + t.ortho(r, 0, this.width, this.height, 0, 0, 1), + t.scale(r, r, [i.drawingBufferWidth, i.drawingBufferHeight, 0]), + this.useProgram('clippingMask').draw( + e, + i.TRIANGLES, + wi.disabled, + this.stencilClearMode, + xi.disabled, + Ci.disabled, + xe(r), + null, + '$clipping', + this.viewportBuffer, + this.quadTriangleIndexBuffer, + this.viewportSegments, + ); + }), + (Yi.prototype._renderTileClippingMasks = function (t, e) { + if ( + this.currentStencilSource !== t.source && + t.isTileClipped() && + e && + e.length + ) { + this.currentStencilSource = t.source; + var i = this.context, + r = i.gl; + this.nextStencilID + e.length > 256 && this.clearStencil(), + i.setColorMode(xi.disabled), + i.setDepthMode(wi.disabled); + var o = this.useProgram('clippingMask'); + this._tileClippingMaskIDs = {}; + for (var a = 0, n = e; a < n.length; a += 1) { + var s = n[a], + l = (this._tileClippingMaskIDs[s.key] = this.nextStencilID++), + c = this.style.terrain && this.style.terrain.getTerrainData(s); + o.draw( + i, + r.TRIANGLES, + wi.disabled, + new Ei( + { func: r.ALWAYS, mask: 0 }, + l, + 255, + r.KEEP, + r.KEEP, + r.REPLACE, + ), + xi.disabled, + Ci.disabled, + xe(s.posMatrix), + c, + '$clipping', + this.tileExtentBuffer, + this.quadTriangleIndexBuffer, + this.tileExtentSegments, + ); + } + } + }), + (Yi.prototype.stencilModeFor3D = function () { + (this.currentStencilSource = void 0), + this.nextStencilID + 1 > 256 && this.clearStencil(); + var t = this.nextStencilID++, + e = this.context.gl; + return new Ei( + { func: e.NOTEQUAL, mask: 255 }, + t, + 255, + e.KEEP, + e.KEEP, + e.REPLACE, + ); + }), + (Yi.prototype.stencilModeForClipping = function (t) { + var e = this.context.gl; + return new Ei( + { func: e.EQUAL, mask: 255 }, + this._tileClippingMaskIDs[t.key], + 0, + e.KEEP, + e.KEEP, + e.REPLACE, + ); + }), + (Yi.prototype.stencilConfigForOverlap = function (t) { + var e, + i = this.context.gl, + r = t.sort(function (t, e) { + return e.overscaledZ - t.overscaledZ; + }), + o = r[r.length - 1].overscaledZ, + a = r[0].overscaledZ - o + 1; + if (a > 1) { + (this.currentStencilSource = void 0), + this.nextStencilID + a > 256 && this.clearStencil(); + for (var n = {}, s = 0; s < a; s++) + n[s + o] = new Ei( + { func: i.GEQUAL, mask: 255 }, + s + this.nextStencilID, + 255, + i.KEEP, + i.KEEP, + i.REPLACE, + ); + return (this.nextStencilID += a), [n, r]; + } + return [((e = {}), (e[o] = Ei.disabled), e), r]; + }), + (Yi.prototype.colorModeForRenderPass = function () { + var e = this.context.gl; + if (this._showOverdrawInspector) { + var i = 1 / 8; + return new xi([e.CONSTANT_COLOR, e.ONE], new t.Color(i, i, i, 0), [ + !0, + !0, + !0, + !0, + ]); + } + return 'opaque' === this.renderPass ? xi.unblended : xi.alphaBlended; + }), + (Yi.prototype.depthModeForSublayer = function (t, e, i) { + if (!this.opaquePassEnabledForLayer()) return wi.disabled; + var r = + 1 - + ((1 + this.currentLayer) * this.numSublayers + t) * this.depthEpsilon; + return new wi(i || this.context.gl.LEQUAL, e, [r, r]); + }), + (Yi.prototype.opaquePassEnabledForLayer = function () { + return this.currentLayer < this.opaquePassCutoff; + }), + (Yi.prototype.render = function (e, i) { + var r = this; + (this.style = e), + (this.options = i), + (this.lineAtlas = e.lineAtlas), + (this.imageManager = e.imageManager), + (this.glyphManager = e.glyphManager), + (this.symbolFadeChange = e.placement.symbolFadeChange( + t.exported.now(), + )), + this.imageManager.beginFrame(); + var o = this.style._order, + a = this.style.sourceCaches, + n = this.style.terrain && new Hi(this); + for (var s in a) { + var l = a[s]; + l.used && l.prepare(this.context); + } + var c, + h, + u = {}, + p = {}, + d = {}; + for (var _ in a) { + var f = a[_]; + (u[_] = f.getVisibleCoordinates()), + (p[_] = u[_].slice().reverse()), + (d[_] = f.getVisibleCoordinates(!0).reverse()); + } + this.opaquePassCutoff = 1 / 0; + for (var m = 0; m < o.length; m++) + if (this.style._layers[o[m]].is3D()) { + this.opaquePassCutoff = m; + break; + } + if (n) { + this.opaquePassCutoff = 0; + var g = this.style.terrain.sourceCache.tilesAfterTime( + this.terrainFacilitator.renderTime, + ); + (this.terrainFacilitator.dirty || + !t.equals( + this.terrainFacilitator.matrix, + this.transform.projMatrix, + ) || + g.length) && + (t.copy(this.terrainFacilitator.matrix, this.transform.projMatrix), + (this.terrainFacilitator.renderTime = Date.now()), + (this.terrainFacilitator.dirty = !1), + (function (e, i) { + var r = e.context, + o = r.gl, + a = xi.unblended, + n = new wi(o.LEQUAL, wi.ReadWrite, [0, 1]), + s = i.getTerrainMesh(), + l = i.sourceCache.getRenderableTiles(), + c = e.useProgram('terrainDepth'); + r.bindFramebuffer.set(i.getFramebuffer('depth').framebuffer), + r.viewport.set([ + 0, + 0, + e.width / devicePixelRatio, + e.height / devicePixelRatio, + ]), + r.clear({ color: t.Color.transparent, depth: 1 }); + for (var h = 0, u = l; h < u.length; h += 1) { + var p = u[h], + d = i.getTerrainData(p.tileID), + _ = e.transform.calculatePosMatrix(p.tileID.toUnwrapped()); + c.draw( + r, + o.TRIANGLES, + n, + Ei.disabled, + a, + Ci.backCCW, + { u_matrix: _ }, + d, + 'terrain', + s.vertexBuffer, + s.indexBuffer, + s.segments, + ); + } + r.bindFramebuffer.set(null), + r.viewport.set([0, 0, e.width, e.height]); + })(this, this.style.terrain), + (function (e, i) { + var r = e.context, + o = r.gl, + a = xi.unblended, + n = new wi(o.LEQUAL, wi.ReadWrite, [0, 1]), + s = i.getTerrainMesh(), + l = i.getCoordsTexture(), + c = i.sourceCache.getRenderableTiles(), + h = e.useProgram('terrainCoords'); + r.bindFramebuffer.set(i.getFramebuffer('coords').framebuffer), + r.viewport.set([ + 0, + 0, + e.width / devicePixelRatio, + e.height / devicePixelRatio, + ]), + r.clear({ color: t.Color.transparent, depth: 1 }), + (i.coordsIndex = []); + for (var u = 0, p = c; u < p.length; u += 1) { + var d = p[u], + _ = i.getTerrainData(d.tileID); + r.activeTexture.set(o.TEXTURE0), + o.bindTexture(o.TEXTURE_2D, l.texture); + var f = e.transform.calculatePosMatrix(d.tileID.toUnwrapped()); + h.draw( + r, + o.TRIANGLES, + n, + Ei.disabled, + a, + Ci.backCCW, + { + u_matrix: f, + u_terrain_coords_id: (255 - i.coordsIndex.length) / 255, + u_texture: 0, + }, + _, + 'terrain', + s.vertexBuffer, + s.indexBuffer, + s.segments, + ), + i.coordsIndex.push(d.tileID.key); + } + r.bindFramebuffer.set(null), + r.viewport.set([0, 0, e.width, e.height]); + })(this, this.style.terrain)); + } + this.renderPass = 'offscreen'; + for (var v = 0, y = o; v < y.length; v += 1) { + var x = this.style._layers[y[v]]; + if (x.hasOffscreenPass() && !x.isHidden(this.transform.zoom)) { + var b = p[x.source]; + ('custom' === x.type || b.length) && + this.renderLayer(this, a[x.source], x, b); + } + } + if ( + (this.context.bindFramebuffer.set(null), + this.context.clear({ + color: i.showOverdrawInspector + ? t.Color.black + : t.Color.transparent, + depth: 1, + }), + this.clearStencil(), + (this._showOverdrawInspector = i.showOverdrawInspector), + (this.depthRangeFor3D = [ + 0, + 1 - (e._order.length + 2) * this.numSublayers * this.depthEpsilon, + ]), + !n) + ) + for ( + this.renderPass = 'opaque', this.currentLayer = o.length - 1; + this.currentLayer >= 0; + this.currentLayer-- + ) { + var w = this.style._layers[o[this.currentLayer]], + T = a[w.source], + E = u[w.source]; + this._renderTileClippingMasks(w, E), + this.renderLayer(this, T, w, E); + } + for ( + this.renderPass = 'translucent', this.currentLayer = 0; + this.currentLayer < o.length; + this.currentLayer++ + ) { + var I = this.style._layers[o[this.currentLayer]], + C = a[I.source]; + if (!n || !n.renderLayer(I)) { + var S = ('symbol' === I.type ? d : p)[I.source]; + this._renderTileClippingMasks(I, u[I.source]), + this.renderLayer(this, C, I, S); + } + } + this.options.showTileBoundaries && + (t.values(this.style._layers).forEach(function (t) { + t.source && + !t.isHidden(r.transform.zoom) && + (t.source !== (h && h.id) && (h = r.style.sourceCaches[t.source]), + (!c || c.getSource().maxzoom < h.getSource().maxzoom) && (c = h)); + }), + c && Ki.debug(this, c, c.getVisibleCoordinates())), + this.options.showPadding && + (function (t) { + var e = t.transform.padding; + ji(t, t.transform.height - (e.top || 0), 3, Oi), + ji(t, e.bottom || 0, 3, Fi), + Zi(t, e.left || 0, 3, Ui), + Zi(t, t.transform.width - (e.right || 0), 3, Ni); + var i = t.transform.centerPoint; + !(function (t, e, i, r) { + Vi(t, e - 1, i - 10, 2, 20, r), Vi(t, e - 10, i - 1, 20, 2, r); + })(t, i.x, t.transform.height - i.y, Gi); + })(this), + this.context.setDefault(); + }), + (Yi.prototype.renderLayer = function (t, e, i, r) { + i.isHidden(this.transform.zoom) || + (('background' === i.type || + 'custom' === i.type || + (r || []).length) && + ((this.id = i.id), + this.gpuTimingStart(i), + Ki[i.type](t, e, i, r, this.style.placement.variableOffsets), + this.gpuTimingEnd())); + }), + (Yi.prototype.gpuTimingStart = function (t) { + if (this.options.gpuTiming) { + var e = this.context.extTimerQuery, + i = this.gpuTimers[t.id]; + i || + (i = this.gpuTimers[t.id] = + { calls: 0, cpuTime: 0, query: e.createQueryEXT() }), + i.calls++, + e.beginQueryEXT(e.TIME_ELAPSED_EXT, i.query); + } + }), + (Yi.prototype.gpuTimingEnd = function () { + if (this.options.gpuTiming) { + var t = this.context.extTimerQuery; + t.endQueryEXT(t.TIME_ELAPSED_EXT); + } + }), + (Yi.prototype.collectGpuTimers = function () { + var t = this.gpuTimers; + return (this.gpuTimers = {}), t; + }), + (Yi.prototype.queryGpuTimers = function (t) { + var e = {}; + for (var i in t) { + var r = t[i], + o = this.context.extTimerQuery, + a = o.getQueryObjectEXT(r.query, o.QUERY_RESULT_EXT) / 1e6; + o.deleteQueryEXT(r.query), (e[i] = a); + } + return e; + }), + (Yi.prototype.translatePosMatrix = function (e, i, r, o, a) { + if (!r[0] && !r[1]) return e; + var n = a + ? 'map' === o + ? this.transform.angle + : 0 + : 'viewport' === o + ? -this.transform.angle + : 0; + if (n) { + var s = Math.sin(n), + l = Math.cos(n); + r = [r[0] * l - r[1] * s, r[0] * s + r[1] * l]; + } + var c = [ + a ? r[0] : wt(i, r[0], this.transform.zoom), + a ? r[1] : wt(i, r[1], this.transform.zoom), + 0, + ], + h = new Float32Array(16); + return t.translate(h, e, c), h; + }), + (Yi.prototype.saveTileTexture = function (t) { + var e = this._tileTextures[t.size[0]]; + e ? e.push(t) : (this._tileTextures[t.size[0]] = [t]); + }), + (Yi.prototype.getTileTexture = function (t) { + var e = this._tileTextures[t]; + return e && e.length > 0 ? e.pop() : null; + }), + (Yi.prototype.isPatternMissing = function (t) { + if (!t) return !1; + if (!t.from || !t.to) return !0; + var e = this.imageManager.getPattern(t.from.toString()), + i = this.imageManager.getPattern(t.to.toString()); + return !e || !i; + }), + (Yi.prototype.useProgram = function (t, e) { + this.cache = this.cache || {}; + var i = + t + + (e ? e.cacheKey : '') + + (this._showOverdrawInspector ? '/overdraw' : '') + + (this.style.terrain ? '/terrain' : ''); + return ( + this.cache[i] || + (this.cache[i] = new le( + this.context, + t, + oe[t], + e, + Le[t], + this._showOverdrawInspector, + this.style.terrain, + )), + this.cache[i] + ); + }), + (Yi.prototype.setCustomLayerDefaults = function () { + this.context.unbindVAO(), + this.context.cullFace.setDefault(), + this.context.activeTexture.setDefault(), + this.context.pixelStoreUnpack.setDefault(), + this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), + this.context.pixelStoreUnpackFlipY.setDefault(); + }), + (Yi.prototype.setBaseState = function () { + var t = this.context.gl; + this.context.cullFace.set(!1), + this.context.viewport.set([0, 0, this.width, this.height]), + this.context.blendEquation.set(t.FUNC_ADD); + }), + (Yi.prototype.initDebugOverlayCanvas = function () { + null == this.debugOverlayCanvas && + ((this.debugOverlayCanvas = document.createElement('canvas')), + (this.debugOverlayCanvas.width = 512), + (this.debugOverlayCanvas.height = 512), + (this.debugOverlayTexture = new l( + this.context, + this.debugOverlayCanvas, + this.context.gl.RGBA, + ))); + }), + (Yi.prototype.destroy = function () { + this.emptyTexture.destroy(), + this.debugOverlayTexture && this.debugOverlayTexture.destroy(); + }); + var Ji = function (t, e) { + (this.points = t), (this.planes = e); + }; + Ji.fromInvProjectionMatrix = function (e, i, r) { + var o = Math.pow(2, r), + a = [ + [-1, 1, -1, 1], + [1, 1, -1, 1], + [1, -1, -1, 1], + [-1, -1, -1, 1], + [-1, 1, 1, 1], + [1, 1, 1, 1], + [1, -1, 1, 1], + [-1, -1, 1, 1], + ].map(function (r) { + var a = (1 / (r = t.transformMat4([], r, e))[3] / i) * o; + return t.mul$1(r, r, [a, a, 1 / r[3], a]); + }), + n = [ + [0, 1, 2], + [6, 5, 4], + [0, 3, 7], + [2, 1, 5], + [3, 2, 6], + [0, 4, 5], + ].map(function (e) { + var i = t.sub([], a[e[0]], a[e[1]]), + r = t.sub([], a[e[2]], a[e[1]]), + o = t.normalize([], t.cross([], i, r)), + n = -t.dot(o, a[e[1]]); + return o.concat(n); + }); + return new Ji(a, n); + }; + var Qi = function (e, i) { + (this.min = e), + (this.max = i), + (this.center = t.scale$1([], t.add([], this.min, this.max), 0.5)); + }; + (Qi.prototype.quadrant = function (e) { + for ( + var i = [e % 2 == 0, e < 2], + r = t.clone$2(this.min), + o = t.clone$2(this.max), + a = 0; + a < i.length; + a++ + ) + (r[a] = i[a] ? this.min[a] : this.center[a]), + (o[a] = i[a] ? this.center[a] : this.max[a]); + return (o[2] = this.max[2]), new Qi(r, o); + }), + (Qi.prototype.distanceX = function (t) { + return Math.max(Math.min(this.max[0], t[0]), this.min[0]) - t[0]; + }), + (Qi.prototype.distanceY = function (t) { + return Math.max(Math.min(this.max[1], t[1]), this.min[1]) - t[1]; + }), + (Qi.prototype.intersects = function (e) { + for ( + var i = [ + [this.min[0], this.min[1], this.min[2], 1], + [this.max[0], this.min[1], this.min[2], 1], + [this.max[0], this.max[1], this.min[2], 1], + [this.min[0], this.max[1], this.min[2], 1], + [this.min[0], this.min[1], this.max[2], 1], + [this.max[0], this.min[1], this.max[2], 1], + [this.max[0], this.max[1], this.max[2], 1], + [this.min[0], this.max[1], this.max[2], 1], + ], + r = !0, + o = 0; + o < e.planes.length; + o++ + ) { + for (var a = e.planes[o], n = 0, s = 0; s < i.length; s++) + t.dot$1(a, i[s]) >= 0 && n++; + if (0 === n) return 0; + n !== i.length && (r = !1); + } + if (r) return 2; + for (var l = 0; l < 3; l++) { + for ( + var c = Number.MAX_VALUE, h = -Number.MAX_VALUE, u = 0; + u < e.points.length; + u++ + ) { + var p = e.points[u][l] - this.min[l]; + (c = Math.min(c, p)), (h = Math.max(h, p)); + } + if (h < 0 || c > this.max[l] - this.min[l]) return 0; + } + return 1; + }); + var $i = function (t, e, i, r) { + if ( + (void 0 === t && (t = 0), + void 0 === e && (e = 0), + void 0 === i && (i = 0), + void 0 === r && (r = 0), + isNaN(t) || + t < 0 || + isNaN(e) || + e < 0 || + isNaN(i) || + i < 0 || + isNaN(r) || + r < 0) + ) + throw new Error( + 'Invalid value for edge-insets, top, bottom, left and right must all be numbers', + ); + (this.top = t), (this.bottom = e), (this.left = i), (this.right = r); + }; + ($i.prototype.interpolate = function (e, i, r) { + return ( + null != i.top && + null != e.top && + (this.top = t.number(e.top, i.top, r)), + null != i.bottom && + null != e.bottom && + (this.bottom = t.number(e.bottom, i.bottom, r)), + null != i.left && + null != e.left && + (this.left = t.number(e.left, i.left, r)), + null != i.right && + null != e.right && + (this.right = t.number(e.right, i.right, r)), + this + ); + }), + ($i.prototype.getCenter = function (e, i) { + var r = t.clamp((this.left + e - this.right) / 2, 0, e), + o = t.clamp((this.top + i - this.bottom) / 2, 0, i); + return new t.pointGeometry(r, o); + }), + ($i.prototype.equals = function (t) { + return ( + this.top === t.top && + this.bottom === t.bottom && + this.left === t.left && + this.right === t.right + ); + }), + ($i.prototype.clone = function () { + return new $i(this.top, this.bottom, this.left, this.right); + }), + ($i.prototype.toJSON = function () { + return { + top: this.top, + bottom: this.bottom, + left: this.left, + right: this.right, + }; + }); + var tr = function (e, i, r, o, a) { + (this.tileSize = 512), + (this.maxValidLatitude = 85.051129), + (this.freezeElevation = !1), + (this._renderWorldCopies = void 0 === a || !!a), + (this._minZoom = e || 0), + (this._maxZoom = i || 22), + (this._minPitch = null == r ? 0 : r), + (this._maxPitch = null == o ? 60 : o), + this.setMaxBounds(), + (this.width = 0), + (this.height = 0), + (this._center = new t.LngLat(0, 0)), + (this._elevation = 0), + (this.zoom = 0), + (this.angle = 0), + (this._fov = 0.6435011087932844), + (this._pitch = 0), + (this._unmodified = !0), + (this._edgeInsets = new $i()), + (this._posMatrixCache = {}), + (this._alignedPosMatrixCache = {}); + }, + er = { + minZoom: { configurable: !0 }, + maxZoom: { configurable: !0 }, + minPitch: { configurable: !0 }, + maxPitch: { configurable: !0 }, + renderWorldCopies: { configurable: !0 }, + worldSize: { configurable: !0 }, + centerOffset: { configurable: !0 }, + size: { configurable: !0 }, + bearing: { configurable: !0 }, + pitch: { configurable: !0 }, + fov: { configurable: !0 }, + zoom: { configurable: !0 }, + center: { configurable: !0 }, + elevation: { configurable: !0 }, + padding: { configurable: !0 }, + centerPoint: { configurable: !0 }, + unmodified: { configurable: !0 }, + point: { configurable: !0 }, + }; + (tr.prototype.clone = function () { + var t = new tr( + this._minZoom, + this._maxZoom, + this._minPitch, + this.maxPitch, + this._renderWorldCopies, + ); + return ( + (t.tileSize = this.tileSize), + (t.latRange = this.latRange), + (t.width = this.width), + (t.height = this.height), + (t._center = this._center), + (t._elevation = this._elevation), + (t.zoom = this.zoom), + (t.angle = this.angle), + (t._fov = this._fov), + (t._pitch = this._pitch), + (t._unmodified = this._unmodified), + (t._edgeInsets = this._edgeInsets.clone()), + t._calcMatrices(), + t + ); + }), + (er.minZoom.get = function () { + return this._minZoom; + }), + (er.minZoom.set = function (t) { + this._minZoom !== t && + ((this._minZoom = t), (this.zoom = Math.max(this.zoom, t))); + }), + (er.maxZoom.get = function () { + return this._maxZoom; + }), + (er.maxZoom.set = function (t) { + this._maxZoom !== t && + ((this._maxZoom = t), (this.zoom = Math.min(this.zoom, t))); + }), + (er.minPitch.get = function () { + return this._minPitch; + }), + (er.minPitch.set = function (t) { + this._minPitch !== t && + ((this._minPitch = t), (this.pitch = Math.max(this.pitch, t))); + }), + (er.maxPitch.get = function () { + return this._maxPitch; + }), + (er.maxPitch.set = function (t) { + this._maxPitch !== t && + ((this._maxPitch = t), (this.pitch = Math.min(this.pitch, t))); + }), + (er.renderWorldCopies.get = function () { + return this._renderWorldCopies; + }), + (er.renderWorldCopies.set = function (t) { + void 0 === t ? (t = !0) : null === t && (t = !1), + (this._renderWorldCopies = t); + }), + (er.worldSize.get = function () { + return this.tileSize * this.scale; + }), + (er.centerOffset.get = function () { + return this.centerPoint._sub(this.size._div(2)); + }), + (er.size.get = function () { + return new t.pointGeometry(this.width, this.height); + }), + (er.bearing.get = function () { + return (-this.angle / Math.PI) * 180; + }), + (er.bearing.set = function (e) { + var i, + r = (-t.wrap(e, -180, 180) * Math.PI) / 180; + this.angle !== r && + ((this._unmodified = !1), + (this.angle = r), + this._calcMatrices(), + (this.rotationMatrix = + ((i = new t.ARRAY_TYPE(4)), + t.ARRAY_TYPE != Float32Array && ((i[1] = 0), (i[2] = 0)), + (i[0] = 1), + (i[3] = 1), + i)), + (function (t, e, i) { + var r = e[0], + o = e[1], + a = e[2], + n = e[3], + s = Math.sin(i), + l = Math.cos(i); + (t[0] = r * l + a * s), + (t[1] = o * l + n * s), + (t[2] = r * -s + a * l), + (t[3] = o * -s + n * l); + })(this.rotationMatrix, this.rotationMatrix, this.angle)); + }), + (er.pitch.get = function () { + return (this._pitch / Math.PI) * 180; + }), + (er.pitch.set = function (e) { + var i = (t.clamp(e, this.minPitch, this.maxPitch) / 180) * Math.PI; + this._pitch !== i && + ((this._unmodified = !1), (this._pitch = i), this._calcMatrices()); + }), + (er.fov.get = function () { + return (this._fov / Math.PI) * 180; + }), + (er.fov.set = function (t) { + (t = Math.max(0.01, Math.min(60, t))), + this._fov !== t && + ((this._unmodified = !1), + (this._fov = (t / 180) * Math.PI), + this._calcMatrices()); + }), + (er.zoom.get = function () { + return this._zoom; + }), + (er.zoom.set = function (t) { + var e = Math.min(Math.max(t, this.minZoom), this.maxZoom); + this._zoom !== e && + ((this._unmodified = !1), + (this._zoom = e), + (this.scale = this.zoomScale(e)), + (this.tileZoom = Math.floor(e)), + (this.zoomFraction = e - this.tileZoom), + this._constrain(), + this._calcMatrices()); + }), + (er.center.get = function () { + return this._center; + }), + (er.center.set = function (t) { + (t.lat === this._center.lat && t.lng === this._center.lng) || + ((this._unmodified = !1), + (this._center = t), + this._constrain(), + this._calcMatrices()); + }), + (er.elevation.get = function () { + return this._elevation; + }), + (er.elevation.set = function (t) { + t !== this._elevation && + ((this._elevation = t), this._constrain(), this._calcMatrices()); + }), + (er.padding.get = function () { + return this._edgeInsets.toJSON(); + }), + (er.padding.set = function (t) { + this._edgeInsets.equals(t) || + ((this._unmodified = !1), + this._edgeInsets.interpolate(this._edgeInsets, t, 1), + this._calcMatrices()); + }), + (er.centerPoint.get = function () { + return this._edgeInsets.getCenter(this.width, this.height); + }), + (tr.prototype.isPaddingEqual = function (t) { + return this._edgeInsets.equals(t); + }), + (tr.prototype.interpolatePadding = function (t, e, i) { + (this._unmodified = !1), + this._edgeInsets.interpolate(t, e, i), + this._constrain(), + this._calcMatrices(); + }), + (tr.prototype.coveringZoomLevel = function (t) { + var e = (t.roundZoom ? Math.round : Math.floor)( + this.zoom + this.scaleZoom(this.tileSize / t.tileSize), + ); + return Math.max(0, e); + }), + (tr.prototype.getVisibleUnwrappedCoordinates = function (e) { + var i = [new t.UnwrappedTileID(0, e)]; + if (this._renderWorldCopies) + for ( + var r = this.pointCoordinate(new t.pointGeometry(0, 0)), + o = this.pointCoordinate(new t.pointGeometry(this.width, 0)), + a = this.pointCoordinate( + new t.pointGeometry(this.width, this.height), + ), + n = this.pointCoordinate(new t.pointGeometry(0, this.height)), + s = Math.floor(Math.min(r.x, o.x, a.x, n.x)), + l = Math.floor(Math.max(r.x, o.x, a.x, n.x)), + c = s - 1; + c <= l + 1; + c++ + ) + 0 !== c && i.push(new t.UnwrappedTileID(c, e)); + return i; + }), + (tr.prototype.coveringTiles = function (e) { + var i, + r, + o = this.coveringZoomLevel(e), + a = o; + if (void 0 !== e.minzoom && o < e.minzoom) return []; + void 0 !== e.maxzoom && o > e.maxzoom && (o = e.maxzoom); + var n = this.pointCoordinate(this.getCameraPoint()), + s = t.MercatorCoordinate.fromLngLat(this.center), + l = Math.pow(2, o), + c = [l * n.x, l * n.y, 0], + h = [l * s.x, l * s.y, 0], + u = Ji.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, o), + p = e.minzoom || 0; + !e.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (p = o); + var d = e.terrain + ? (2 / Math.min(this.tileSize, e.tileSize)) * this.tileSize + : 3, + _ = function (t) { + return { + aabb: new Qi([t * l, 0, 0], [(t + 1) * l, l, 0]), + zoom: 0, + x: 0, + y: 0, + wrap: t, + fullyVisible: !1, + }; + }, + f = [], + m = [], + g = o, + v = e.reparseOverscaled ? a : o; + if (this._renderWorldCopies) + for (var y = 1; y <= 3; y++) f.push(_(-y)), f.push(_(y)); + for (f.push(_(0)); f.length > 0; ) { + var x = f.pop(), + b = x.x, + w = x.y, + T = x.fullyVisible; + if (!T) { + var E = x.aabb.intersects(u); + if (0 === E) continue; + T = 2 === E; + } + var I = e.terrain ? c : h, + C = x.aabb.distanceX(I), + S = x.aabb.distanceY(I), + D = Math.max(Math.abs(C), Math.abs(S)); + if ( + x.zoom === g || + (D > d + (1 << (g - x.zoom)) - 2 && x.zoom >= p) + ) { + var z = g - x.zoom, + P = c[0] - 0.5 - (b << z), + M = c[1] - 0.5 - (w << z); + m.push({ + tileID: new t.OverscaledTileID( + x.zoom === g ? v : x.zoom, + x.wrap, + x.zoom, + b, + w, + ), + distanceSq: t.sqrLen([h[0] - 0.5 - b, h[1] - 0.5 - w]), + tileDistanceToCamera: Math.sqrt(P * P + M * M), + }); + } else + for (var A = 0; A < 4; A++) { + var R = (b << 1) + (A % 2), + L = (w << 1) + (A >> 1), + k = x.zoom + 1, + B = x.aabb.quadrant(A); + if (e.terrain) { + var O = new t.OverscaledTileID(k, x.wrap, k, R, L), + F = e.terrain.getMinMaxElevation(O), + U = + null !== (i = F.minElevation) && void 0 !== i + ? i + : this.elevation, + N = + null !== (r = F.maxElevation) && void 0 !== r + ? r + : this.elevation; + B = new Qi([B.min[0], B.min[1], U], [B.max[0], B.max[1], N]); + } + f.push({ + aabb: B, + zoom: k, + x: R, + y: L, + wrap: x.wrap, + fullyVisible: T, + }); + } + } + return m + .sort(function (t, e) { + return t.distanceSq - e.distanceSq; + }) + .map(function (t) { + return t.tileID; + }); + }), + (tr.prototype.resize = function (t, e) { + (this.width = t), + (this.height = e), + (this.pixelsToGLUnits = [2 / t, -2 / e]), + this._constrain(), + this._calcMatrices(); + }), + (er.unmodified.get = function () { + return this._unmodified; + }), + (tr.prototype.zoomScale = function (t) { + return Math.pow(2, t); + }), + (tr.prototype.scaleZoom = function (t) { + return Math.log(t) / Math.LN2; + }), + (tr.prototype.project = function (e) { + var i = t.clamp(e.lat, -this.maxValidLatitude, this.maxValidLatitude); + return new t.pointGeometry( + t.mercatorXfromLng(e.lng) * this.worldSize, + t.mercatorYfromLat(i) * this.worldSize, + ); + }), + (tr.prototype.unproject = function (e) { + return new t.MercatorCoordinate( + e.x / this.worldSize, + e.y / this.worldSize, + ).toLngLat(); + }), + (er.point.get = function () { + return this.project(this.center); + }), + (tr.prototype.updateElevation = function (t) { + this.freezeElevation || + (this.elevation = t ? this.getElevation(this._center, t) : 0); + }), + (tr.prototype.getElevation = function (e, i) { + var r = t.MercatorCoordinate.fromLngLat(e), + o = (1 << this.tileZoom) * t.EXTENT, + a = r.x * o, + n = r.y * o, + s = Math.floor(a / t.EXTENT), + l = Math.floor(n / t.EXTENT), + c = new t.OverscaledTileID(this.tileZoom, 0, this.tileZoom, s, l); + return i.getElevation(c, a % t.EXTENT, n % t.EXTENT, t.EXTENT); + }), + (tr.prototype.getCameraPosition = function () { + return { + lngLat: this.pointLocation(this.getCameraPoint()), + altitude: + (Math.cos(this._pitch) * this.cameraToCenterDistance) / + this._pixelPerMeter + + this.elevation, + }; + }), + (tr.prototype.recalculateZoom = function (e) { + var i = this.pointLocation(this.centerPoint, e), + r = this.getElevation(i, e); + if (this.elevation - r) { + var o = this.getCameraPosition(), + a = t.MercatorCoordinate.fromLngLat(o.lngLat, o.altitude), + n = t.MercatorCoordinate.fromLngLat(i, r), + s = a.x - n.x, + l = a.y - n.y, + c = a.z - n.z, + h = Math.sqrt(s * s + l * l + c * c), + u = this.scaleZoom(this.cameraToCenterDistance / h / this.tileSize); + (this._elevation = r), (this._center = i), (this.zoom = u); + } + }), + (tr.prototype.setLocationAtPoint = function (e, i) { + var r = this.pointCoordinate(i), + o = this.pointCoordinate(this.centerPoint), + a = this.locationCoordinate(e), + n = new t.MercatorCoordinate(a.x - (r.x - o.x), a.y - (r.y - o.y)); + (this.center = this.coordinateLocation(n)), + this._renderWorldCopies && (this.center = this.center.wrap()); + }), + (tr.prototype.locationPoint = function (t, e) { + return e + ? this.coordinatePoint( + this.locationCoordinate(t), + this.getElevation(t, e), + this.pixelMatrix3D, + ) + : this.coordinatePoint(this.locationCoordinate(t)); + }), + (tr.prototype.pointLocation = function (t, e) { + return this.coordinateLocation(this.pointCoordinate(t, e)); + }), + (tr.prototype.locationCoordinate = function (e) { + return t.MercatorCoordinate.fromLngLat(e); + }), + (tr.prototype.coordinateLocation = function (t) { + return t && t.toLngLat(); + }), + (tr.prototype.pointCoordinate = function (e, i) { + if (i) { + var r = i.pointCoordinate(e); + if (null != r) return r; + } + var o = [e.x, e.y, 0, 1], + a = [e.x, e.y, 1, 1]; + t.transformMat4(o, o, this.pixelMatrixInverse), + t.transformMat4(a, a, this.pixelMatrixInverse); + var n = o[3], + s = a[3], + l = o[1] / n, + c = a[1] / s, + h = o[2] / n, + u = a[2] / s, + p = h === u ? 0 : (0 - h) / (u - h); + return new t.MercatorCoordinate( + t.number(o[0] / n, a[0] / s, p) / this.worldSize, + t.number(l, c, p) / this.worldSize, + ); + }), + (tr.prototype.coordinatePoint = function (e, i, r) { + void 0 === i && (i = 0), void 0 === r && (r = this.pixelMatrix); + var o = [e.x * this.worldSize, e.y * this.worldSize, i, 1]; + return ( + t.transformMat4(o, o, r), + new t.pointGeometry(o[0] / o[3], o[1] / o[3]) + ); + }), + (tr.prototype.getBounds = function () { + var e = Math.max(0, this.height / 2 - this.getHorizon()); + return new t.LngLatBounds() + .extend(this.pointLocation(new t.pointGeometry(0, e))) + .extend(this.pointLocation(new t.pointGeometry(this.width, e))) + .extend( + this.pointLocation(new t.pointGeometry(this.width, this.height)), + ) + .extend(this.pointLocation(new t.pointGeometry(0, this.height))); + }), + (tr.prototype.getMaxBounds = function () { + return this.latRange && + 2 === this.latRange.length && + this.lngRange && + 2 === this.lngRange.length + ? new t.LngLatBounds( + [this.lngRange[0], this.latRange[0]], + [this.lngRange[1], this.latRange[1]], + ) + : null; + }), + (tr.prototype.getHorizon = function () { + return ( + Math.tan(Math.PI / 2 - this._pitch) * + this.cameraToCenterDistance * + 0.85 + ); + }), + (tr.prototype.setMaxBounds = function (t) { + t + ? ((this.lngRange = [t.getWest(), t.getEast()]), + (this.latRange = [t.getSouth(), t.getNorth()]), + this._constrain()) + : ((this.lngRange = null), + (this.latRange = [-this.maxValidLatitude, this.maxValidLatitude])); + }), + (tr.prototype.calculatePosMatrix = function (e, i) { + void 0 === i && (i = !1); + var r = e.key, + o = i ? this._alignedPosMatrixCache : this._posMatrixCache; + if (o[r]) return o[r]; + var a = e.canonical, + n = this.worldSize / this.zoomScale(a.z), + s = a.x + Math.pow(2, a.z) * e.wrap, + l = t.identity(new Float64Array(16)); + return ( + t.translate(l, l, [s * n, a.y * n, 0]), + t.scale(l, l, [n / t.EXTENT, n / t.EXTENT, 1]), + t.multiply(l, i ? this.alignedProjMatrix : this.projMatrix, l), + (o[r] = new Float32Array(l)), + o[r] + ); + }), + (tr.prototype.customLayerMatrix = function () { + return this.mercatorMatrix.slice(); + }), + (tr.prototype._constrain = function () { + if (this.center && this.width && this.height && !this._constraining) { + this._constraining = !0; + var e, + i, + r, + o, + a = -90, + n = 90, + s = -180, + l = 180, + c = this.size, + h = this._unmodified; + if (this.latRange) { + var u = this.latRange; + (a = t.mercatorYfromLat(u[1]) * this.worldSize), + (e = + (n = t.mercatorYfromLat(u[0]) * this.worldSize) - a < c.y + ? c.y / (n - a) + : 0); + } + if (this.lngRange) { + var p = this.lngRange; + (s = t.wrap( + t.mercatorXfromLng(p[0]) * this.worldSize, + 0, + this.worldSize, + )), + (l = t.wrap( + t.mercatorXfromLng(p[1]) * this.worldSize, + 0, + this.worldSize, + )) < s && (l += this.worldSize), + (i = l - s < c.x ? c.x / (l - s) : 0); + } + var d = this.point, + _ = Math.max(i || 0, e || 0); + if (_) + return ( + (this.center = this.unproject( + new t.pointGeometry( + i ? (l + s) / 2 : d.x, + e ? (n + a) / 2 : d.y, + ), + )), + (this.zoom += this.scaleZoom(_)), + (this._unmodified = h), + void (this._constraining = !1) + ); + if (this.latRange) { + var f = d.y, + m = c.y / 2; + f - m < a && (o = a + m), f + m > n && (o = n - m); + } + if (this.lngRange) { + var g = (s + l) / 2, + v = t.wrap(d.x, g - this.worldSize / 2, g + this.worldSize / 2), + y = c.x / 2; + v - y < s && (r = s + y), v + y > l && (r = l - y); + } + (void 0 === r && void 0 === o) || + (this.center = this.unproject( + new t.pointGeometry( + void 0 !== r ? r : d.x, + void 0 !== o ? o : d.y, + ), + ).wrap()), + (this._unmodified = h), + (this._constraining = !1); + } + }), + (tr.prototype._calcMatrices = function () { + if (this.height) { + var e = this.centerOffset, + i = this.point.x, + r = this.point.y; + (this.cameraToCenterDistance = + (0.5 / Math.tan(this._fov / 2)) * this.height), + (this._pixelPerMeter = + t.mercatorZfromAltitude(1, this.center.lat) * this.worldSize); + var o = t.identity(new Float64Array(16)); + t.scale(o, o, [this.width / 2, -this.height / 2, 1]), + t.translate(o, o, [1, -1, 0]), + (this.labelPlaneMatrix = o), + (o = t.identity(new Float64Array(16))), + t.scale(o, o, [1, -1, 1]), + t.translate(o, o, [-1, -1, 0]), + t.scale(o, o, [2 / this.width, 2 / this.height, 1]), + (this.glCoordMatrix = o), + (this.cameraToSeaLevelDistance = + this.cameraToCenterDistance + + (this._elevation * this._pixelPerMeter) / Math.cos(this._pitch)); + var a = Math.PI / 2 + this._pitch, + n = this._fov * (0.5 + e.y / this.height), + s = + (Math.sin(n) * this.cameraToSeaLevelDistance) / + Math.sin(t.clamp(Math.PI - a - n, 0.01, Math.PI - 0.01)), + l = this.getHorizon(), + c = + 2 * + Math.atan(l / this.cameraToCenterDistance) * + (0.5 + e.y / (2 * l)), + h = + (Math.sin(c) * this.cameraToSeaLevelDistance) / + Math.sin(t.clamp(Math.PI - a - c, 0.01, Math.PI - 0.01)), + u = + Math.cos(Math.PI / 2 - this._pitch) * s + + this.cameraToSeaLevelDistance, + p = + Math.cos(Math.PI / 2 - this._pitch) * h + + this.cameraToSeaLevelDistance, + d = 1.01 * Math.min(u, p), + _ = this.height / 50; + (o = new Float64Array(16)), + t.perspective(o, this._fov, this.width / this.height, _, d), + (o[8] = (2 * -e.x) / this.width), + (o[9] = (2 * e.y) / this.height), + t.scale(o, o, [1, -1, 1]), + t.translate(o, o, [0, 0, -this.cameraToCenterDistance]), + t.rotateX(o, o, this._pitch), + t.rotateZ(o, o, this.angle), + t.translate(o, o, [-i, -r, 0]), + (this.mercatorMatrix = t.scale([], o, [ + this.worldSize, + this.worldSize, + this.worldSize, + ])), + t.scale(o, o, [1, 1, this._pixelPerMeter]), + (this.pixelMatrix = t.multiply( + new Float64Array(16), + this.labelPlaneMatrix, + o, + )), + t.translate(o, o, [0, 0, -this.elevation]), + (this.projMatrix = o), + (this.invProjMatrix = t.invert([], o)), + (this.pixelMatrix3D = t.multiply( + new Float64Array(16), + this.labelPlaneMatrix, + o, + )); + var f = (this.width % 2) / 2, + m = (this.height % 2) / 2, + g = Math.cos(this.angle), + v = Math.sin(this.angle), + y = i - Math.round(i) + g * f + v * m, + x = r - Math.round(r) + g * m + v * f, + b = new Float64Array(o); + if ( + (t.translate(b, b, [y > 0.5 ? y - 1 : y, x > 0.5 ? x - 1 : x, 0]), + (this.alignedProjMatrix = b), + !(o = t.invert(new Float64Array(16), this.pixelMatrix))) + ) + throw new Error('failed to invert matrix'); + (this.pixelMatrixInverse = o), + (this._posMatrixCache = {}), + (this._alignedPosMatrixCache = {}); + } + }), + (tr.prototype.maxPitchScaleFactor = function () { + if (!this.pixelMatrixInverse) return 1; + var e = this.pointCoordinate(new t.pointGeometry(0, 0)), + i = [e.x * this.worldSize, e.y * this.worldSize, 0, 1]; + return ( + t.transformMat4(i, i, this.pixelMatrix)[3] / + this.cameraToCenterDistance + ); + }), + (tr.prototype.getCameraPoint = function () { + var e = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1); + return this.centerPoint.add(new t.pointGeometry(0, e)); + }), + (tr.prototype.getCameraQueryGeometry = function (e) { + var i = this.getCameraPoint(); + if (1 === e.length) return [e[0], i]; + for ( + var r = i.x, o = i.y, a = i.x, n = i.y, s = 0, l = e; + s < l.length; + s += 1 + ) { + var c = l[s]; + (r = Math.min(r, c.x)), + (o = Math.min(o, c.y)), + (a = Math.max(a, c.x)), + (n = Math.max(n, c.y)); + } + return [ + new t.pointGeometry(r, o), + new t.pointGeometry(a, o), + new t.pointGeometry(a, n), + new t.pointGeometry(r, n), + new t.pointGeometry(r, o), + ]; + }), + Object.defineProperties(tr.prototype, er); + var ir = function (e) { + var i, r, o, a; + (this._hashName = e && encodeURIComponent(e)), + t.bindAll(['_getCurrentHash', '_onHashChange', '_updateHash'], this), + (this._updateHash = + ((i = this._updateHashUnthrottled.bind(this)), + (r = !1), + (o = null), + (a = function () { + (o = null), r && (i(), (o = setTimeout(a, 300)), (r = !1)); + }), + function () { + return (r = !0), o || a(), o; + })); + }; + (ir.prototype.addTo = function (t) { + return ( + (this._map = t), + addEventListener('hashchange', this._onHashChange, !1), + this._map.on('moveend', this._updateHash), + this + ); + }), + (ir.prototype.remove = function () { + return ( + removeEventListener('hashchange', this._onHashChange, !1), + this._map.off('moveend', this._updateHash), + clearTimeout(this._updateHash()), + delete this._map, + this + ); + }), + (ir.prototype.getHashString = function (t) { + var e = this._map.getCenter(), + i = Math.round(100 * this._map.getZoom()) / 100, + r = Math.ceil((i * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), + o = Math.pow(10, r), + a = Math.round(e.lng * o) / o, + n = Math.round(e.lat * o) / o, + s = this._map.getBearing(), + l = this._map.getPitch(), + c = ''; + if ( + ((c += t ? '/' + a + '/' + n + '/' + i : i + '/' + n + '/' + a), + (s || l) && (c += '/' + Math.round(10 * s) / 10), + l && (c += '/' + Math.round(l)), + this._hashName) + ) { + var h = this._hashName, + u = !1, + p = window.location.hash + .slice(1) + .split('&') + .map(function (t) { + var e = t.split('=')[0]; + return e === h ? ((u = !0), e + '=' + c) : t; + }) + .filter(function (t) { + return t; + }); + return u || p.push(h + '=' + c), '#' + p.join('&'); + } + return '#' + c; + }), + (ir.prototype._getCurrentHash = function () { + var t, + e = this, + i = window.location.hash.replace('#', ''); + return this._hashName + ? (i + .split('&') + .map(function (t) { + return t.split('='); + }) + .forEach(function (i) { + i[0] === e._hashName && (t = i); + }), + ((t && t[1]) || '').split('/')) + : i.split('/'); + }), + (ir.prototype._onHashChange = function () { + var t = this._getCurrentHash(); + if ( + t.length >= 3 && + !t.some(function (t) { + return isNaN(t); + }) + ) { + var e = + this._map.dragRotate.isEnabled() && + this._map.touchZoomRotate.isEnabled() + ? +(t[3] || 0) + : this._map.getBearing(); + return ( + this._map.jumpTo({ + center: [+t[2], +t[1]], + zoom: +t[0], + bearing: e, + pitch: +(t[4] || 0), + }), + !0 + ); + } + return !1; + }), + (ir.prototype._updateHashUnthrottled = function () { + var t = window.location.href.replace(/(#.+)?$/, this.getHashString()); + try { + window.history.replaceState(window.history.state, null, t); + } catch (t) {} + }); + var rr = { linearity: 0.3, easing: t.bezier(0, 0, 0.3, 1) }, + or = t.extend({ deceleration: 2500, maxSpeed: 1400 }, rr), + ar = t.extend({ deceleration: 20, maxSpeed: 1400 }, rr), + nr = t.extend({ deceleration: 1e3, maxSpeed: 360 }, rr), + sr = t.extend({ deceleration: 1e3, maxSpeed: 90 }, rr), + lr = function (t) { + (this._map = t), this.clear(); + }; + function cr(t, e) { + (!t.duration || t.duration < e.duration) && + ((t.duration = e.duration), (t.easing = e.easing)); + } + function hr(e, i, r) { + var o = r.maxSpeed, + a = r.linearity, + n = r.deceleration, + s = t.clamp((e * a) / (i / 1e3), -o, o), + l = Math.abs(s) / (n * a); + return { easing: r.easing, duration: 1e3 * l, amount: s * (l / 2) }; + } + (lr.prototype.clear = function () { + this._inertiaBuffer = []; + }), + (lr.prototype.record = function (e) { + this._drainInertiaBuffer(), + this._inertiaBuffer.push({ time: t.exported.now(), settings: e }); + }), + (lr.prototype._drainInertiaBuffer = function () { + for ( + var e = this._inertiaBuffer, i = t.exported.now(); + e.length > 0 && i - e[0].time > 160; + + ) + e.shift(); + }), + (lr.prototype._onMoveEnd = function (e) { + if ((this._drainInertiaBuffer(), !(this._inertiaBuffer.length < 2))) { + for ( + var i = { + zoom: 0, + bearing: 0, + pitch: 0, + pan: new t.pointGeometry(0, 0), + pinchAround: void 0, + around: void 0, + }, + r = 0, + o = this._inertiaBuffer; + r < o.length; + r += 1 + ) { + var a = o[r].settings; + (i.zoom += a.zoomDelta || 0), + (i.bearing += a.bearingDelta || 0), + (i.pitch += a.pitchDelta || 0), + a.panDelta && i.pan._add(a.panDelta), + a.around && (i.around = a.around), + a.pinchAround && (i.pinchAround = a.pinchAround); + } + var n = + this._inertiaBuffer[this._inertiaBuffer.length - 1].time - + this._inertiaBuffer[0].time, + s = {}; + if (i.pan.mag()) { + var l = hr(i.pan.mag(), n, t.extend({}, or, e || {})); + (s.offset = i.pan.mult(l.amount / i.pan.mag())), + (s.center = this._map.transform.center), + cr(s, l); + } + if (i.zoom) { + var c = hr(i.zoom, n, ar); + (s.zoom = this._map.transform.zoom + c.amount), cr(s, c); + } + if (i.bearing) { + var h = hr(i.bearing, n, nr); + (s.bearing = + this._map.transform.bearing + t.clamp(h.amount, -179, 179)), + cr(s, h); + } + if (i.pitch) { + var u = hr(i.pitch, n, sr); + (s.pitch = this._map.transform.pitch + u.amount), cr(s, u); + } + if (s.zoom || s.bearing) { + var p = void 0 === i.pinchAround ? i.around : i.pinchAround; + s.around = p ? this._map.unproject(p) : this._map.getCenter(); + } + return this.clear(), t.extend(s, { noMoveStart: !0 }); + } + }); + var ur = (function (e) { + function i(i, r, o, n) { + void 0 === n && (n = {}); + var s = a.mousePos(r.getCanvasContainer(), o), + l = r.unproject(s); + e.call( + this, + i, + t.extend({ point: s, lngLat: l, originalEvent: o }, n), + ), + (this._defaultPrevented = !1), + (this.target = r); + } + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i); + var r = { defaultPrevented: { configurable: !0 } }; + return ( + (i.prototype.preventDefault = function () { + this._defaultPrevented = !0; + }), + (r.defaultPrevented.get = function () { + return this._defaultPrevented; + }), + Object.defineProperties(i.prototype, r), + i + ); + })(t.Event), + pr = (function (e) { + function i(i, r, o) { + var n = 'touchend' === i ? o.changedTouches : o.touches, + s = a.touchPos(r.getCanvasContainer(), n), + l = s.map(function (t) { + return r.unproject(t); + }), + c = s.reduce(function (t, e, i, r) { + return t.add(e.div(r.length)); + }, new t.pointGeometry(0, 0)), + h = r.unproject(c); + e.call(this, i, { + points: s, + point: c, + lngLats: l, + lngLat: h, + originalEvent: o, + }), + (this._defaultPrevented = !1); + } + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i); + var r = { defaultPrevented: { configurable: !0 } }; + return ( + (i.prototype.preventDefault = function () { + this._defaultPrevented = !0; + }), + (r.defaultPrevented.get = function () { + return this._defaultPrevented; + }), + Object.defineProperties(i.prototype, r), + i + ); + })(t.Event), + dr = (function (t) { + function e(e, i, r) { + t.call(this, e, { originalEvent: r }), (this._defaultPrevented = !1); + } + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e); + var i = { defaultPrevented: { configurable: !0 } }; + return ( + (e.prototype.preventDefault = function () { + this._defaultPrevented = !0; + }), + (i.defaultPrevented.get = function () { + return this._defaultPrevented; + }), + Object.defineProperties(e.prototype, i), + e + ); + })(t.Event), + _r = function (t, e) { + (this._map = t), (this._clickTolerance = e.clickTolerance); + }; + (_r.prototype.reset = function () { + delete this._mousedownPos; + }), + (_r.prototype.wheel = function (t) { + return this._firePreventable(new dr(t.type, this._map, t)); + }), + (_r.prototype.mousedown = function (t, e) { + return ( + (this._mousedownPos = e), + this._firePreventable(new ur(t.type, this._map, t)) + ); + }), + (_r.prototype.mouseup = function (t) { + this._map.fire(new ur(t.type, this._map, t)); + }), + (_r.prototype.click = function (t, e) { + (this._mousedownPos && + this._mousedownPos.dist(e) >= this._clickTolerance) || + this._map.fire(new ur(t.type, this._map, t)); + }), + (_r.prototype.dblclick = function (t) { + return this._firePreventable(new ur(t.type, this._map, t)); + }), + (_r.prototype.mouseover = function (t) { + this._map.fire(new ur(t.type, this._map, t)); + }), + (_r.prototype.mouseout = function (t) { + this._map.fire(new ur(t.type, this._map, t)); + }), + (_r.prototype.touchstart = function (t) { + return this._firePreventable(new pr(t.type, this._map, t)); + }), + (_r.prototype.touchmove = function (t) { + this._map.fire(new pr(t.type, this._map, t)); + }), + (_r.prototype.touchend = function (t) { + this._map.fire(new pr(t.type, this._map, t)); + }), + (_r.prototype.touchcancel = function (t) { + this._map.fire(new pr(t.type, this._map, t)); + }), + (_r.prototype._firePreventable = function (t) { + if ((this._map.fire(t), t.defaultPrevented)) return {}; + }), + (_r.prototype.isEnabled = function () { + return !0; + }), + (_r.prototype.isActive = function () { + return !1; + }), + (_r.prototype.enable = function () {}), + (_r.prototype.disable = function () {}); + var fr = function (t) { + this._map = t; + }; + (fr.prototype.reset = function () { + (this._delayContextMenu = !1), + (this._ignoreContextMenu = !0), + delete this._contextMenuEvent; + }), + (fr.prototype.mousemove = function (t) { + this._map.fire(new ur(t.type, this._map, t)); + }), + (fr.prototype.mousedown = function () { + (this._delayContextMenu = !0), (this._ignoreContextMenu = !1); + }), + (fr.prototype.mouseup = function () { + (this._delayContextMenu = !1), + this._contextMenuEvent && + (this._map.fire( + new ur('contextmenu', this._map, this._contextMenuEvent), + ), + delete this._contextMenuEvent); + }), + (fr.prototype.contextmenu = function (t) { + this._delayContextMenu + ? (this._contextMenuEvent = t) + : this._ignoreContextMenu || + this._map.fire(new ur(t.type, this._map, t)), + this._map.listens('contextmenu') && t.preventDefault(); + }), + (fr.prototype.isEnabled = function () { + return !0; + }), + (fr.prototype.isActive = function () { + return !1; + }), + (fr.prototype.enable = function () {}), + (fr.prototype.disable = function () {}); + var mr = function (t, e) { + (this._map = t), + (this._el = t.getCanvasContainer()), + (this._container = t.getContainer()), + (this._clickTolerance = e.clickTolerance || 1); + }; + function gr(t, e) { + if (t.length !== e.length) + throw new Error( + 'The number of touches and points are not equal - touches ' + + t.length + + ', points ' + + e.length, + ); + for (var i = {}, r = 0; r < t.length; r++) i[t[r].identifier] = e[r]; + return i; + } + (mr.prototype.isEnabled = function () { + return !!this._enabled; + }), + (mr.prototype.isActive = function () { + return !!this._active; + }), + (mr.prototype.enable = function () { + this.isEnabled() || (this._enabled = !0); + }), + (mr.prototype.disable = function () { + this.isEnabled() && (this._enabled = !1); + }), + (mr.prototype.mousedown = function (t, e) { + this.isEnabled() && + t.shiftKey && + 0 === t.button && + (a.disableDrag(), + (this._startPos = this._lastPos = e), + (this._active = !0)); + }), + (mr.prototype.mousemoveWindow = function (t, e) { + if (this._active) { + var i = e; + if ( + !( + this._lastPos.equals(i) || + (!this._box && i.dist(this._startPos) < this._clickTolerance) + ) + ) { + var r = this._startPos; + (this._lastPos = i), + this._box || + ((this._box = a.create( + 'div', + 'maplibregl-boxzoom mapboxgl-boxzoom', + this._container, + )), + this._container.classList.add( + 'maplibregl-crosshair', + 'mapboxgl-crosshair', + ), + this._fireEvent('boxzoomstart', t)); + var o = Math.min(r.x, i.x), + n = Math.max(r.x, i.x), + s = Math.min(r.y, i.y), + l = Math.max(r.y, i.y); + a.setTransform(this._box, 'translate(' + o + 'px,' + s + 'px)'), + (this._box.style.width = n - o + 'px'), + (this._box.style.height = l - s + 'px'); + } + } + }), + (mr.prototype.mouseupWindow = function (e, i) { + var r = this; + if (this._active && 0 === e.button) { + var o = this._startPos, + n = i; + if ((this.reset(), a.suppressClick(), o.x !== n.x || o.y !== n.y)) + return ( + this._map.fire(new t.Event('boxzoomend', { originalEvent: e })), + { + cameraAnimation: function (t) { + return t.fitScreenCoordinates(o, n, r._map.getBearing(), { + linear: !0, + }); + }, + } + ); + this._fireEvent('boxzoomcancel', e); + } + }), + (mr.prototype.keydown = function (t) { + this._active && + 27 === t.keyCode && + (this.reset(), this._fireEvent('boxzoomcancel', t)); + }), + (mr.prototype.reset = function () { + (this._active = !1), + this._container.classList.remove( + 'maplibregl-crosshair', + 'mapboxgl-crosshair', + ), + this._box && (a.remove(this._box), (this._box = null)), + a.enableDrag(), + delete this._startPos, + delete this._lastPos; + }), + (mr.prototype._fireEvent = function (e, i) { + return this._map.fire(new t.Event(e, { originalEvent: i })); + }); + var vr = function (t) { + this.reset(), (this.numTouches = t.numTouches); + }; + (vr.prototype.reset = function () { + delete this.centroid, + delete this.startTime, + delete this.touches, + (this.aborted = !1); + }), + (vr.prototype.touchstart = function (e, i, r) { + (this.centroid || r.length > this.numTouches) && (this.aborted = !0), + this.aborted || + (void 0 === this.startTime && (this.startTime = e.timeStamp), + r.length === this.numTouches && + ((this.centroid = (function (e) { + for ( + var i = new t.pointGeometry(0, 0), r = 0, o = e; + r < o.length; + r += 1 + ) + i._add(o[r]); + return i.div(e.length); + })(i)), + (this.touches = gr(r, i)))); + }), + (vr.prototype.touchmove = function (t, e, i) { + if (!this.aborted && this.centroid) { + var r = gr(i, e); + for (var o in this.touches) { + var a = r[o]; + (!a || a.dist(this.touches[o]) > 30) && (this.aborted = !0); + } + } + }), + (vr.prototype.touchend = function (t, e, i) { + if ( + ((!this.centroid || t.timeStamp - this.startTime > 500) && + (this.aborted = !0), + 0 === i.length) + ) { + var r = !this.aborted && this.centroid; + if ((this.reset(), r)) return r; + } + }); + var yr = function (t) { + (this.singleTap = new vr(t)), (this.numTaps = t.numTaps), this.reset(); + }; + (yr.prototype.reset = function () { + (this.lastTime = 1 / 0), + delete this.lastTap, + (this.count = 0), + this.singleTap.reset(); + }), + (yr.prototype.touchstart = function (t, e, i) { + this.singleTap.touchstart(t, e, i); + }), + (yr.prototype.touchmove = function (t, e, i) { + this.singleTap.touchmove(t, e, i); + }), + (yr.prototype.touchend = function (t, e, i) { + var r = this.singleTap.touchend(t, e, i); + if (r) { + var o = t.timeStamp - this.lastTime < 500, + a = !this.lastTap || this.lastTap.dist(r) < 30; + if ( + ((o && a) || this.reset(), + this.count++, + (this.lastTime = t.timeStamp), + (this.lastTap = r), + this.count === this.numTaps) + ) + return this.reset(), r; + } + }); + var xr = function () { + (this._zoomIn = new yr({ numTouches: 1, numTaps: 2 })), + (this._zoomOut = new yr({ numTouches: 2, numTaps: 1 })), + this.reset(); + }; + (xr.prototype.reset = function () { + (this._active = !1), this._zoomIn.reset(), this._zoomOut.reset(); + }), + (xr.prototype.touchstart = function (t, e, i) { + this._zoomIn.touchstart(t, e, i), this._zoomOut.touchstart(t, e, i); + }), + (xr.prototype.touchmove = function (t, e, i) { + this._zoomIn.touchmove(t, e, i), this._zoomOut.touchmove(t, e, i); + }), + (xr.prototype.touchend = function (t, e, i) { + var r = this, + o = this._zoomIn.touchend(t, e, i), + a = this._zoomOut.touchend(t, e, i); + return o + ? ((this._active = !0), + t.preventDefault(), + setTimeout(function () { + return r.reset(); + }, 0), + { + cameraAnimation: function (e) { + return e.easeTo( + { + duration: 300, + zoom: e.getZoom() + 1, + around: e.unproject(o), + }, + { originalEvent: t }, + ); + }, + }) + : a + ? ((this._active = !0), + t.preventDefault(), + setTimeout(function () { + return r.reset(); + }, 0), + { + cameraAnimation: function (e) { + return e.easeTo( + { + duration: 300, + zoom: e.getZoom() - 1, + around: e.unproject(a), + }, + { originalEvent: t }, + ); + }, + }) + : void 0; + }), + (xr.prototype.touchcancel = function () { + this.reset(); + }), + (xr.prototype.enable = function () { + this._enabled = !0; + }), + (xr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (xr.prototype.isEnabled = function () { + return this._enabled; + }), + (xr.prototype.isActive = function () { + return this._active; + }); + var br = { 0: 1, 2: 2 }, + wr = function (t) { + this.reset(), (this._clickTolerance = t.clickTolerance || 1); + }; + (wr.prototype.reset = function () { + (this._active = !1), + (this._moved = !1), + delete this._lastPoint, + delete this._eventButton; + }), + (wr.prototype._correctButton = function (t, e) { + return !1; + }), + (wr.prototype._move = function (t, e) { + return {}; + }), + (wr.prototype.mousedown = function (t, e) { + if (!this._lastPoint) { + var i = a.mouseButton(t); + this._correctButton(t, i) && + ((this._lastPoint = e), (this._eventButton = i)); + } + }), + (wr.prototype.mousemoveWindow = function (t, e) { + var i = this._lastPoint; + if (i) + if ( + (t.preventDefault(), + (function (t, e) { + var i = br[e]; + return void 0 === t.buttons || (t.buttons & i) !== i; + })(t, this._eventButton)) + ) + this.reset(); + else if (this._moved || !(e.dist(i) < this._clickTolerance)) + return (this._moved = !0), (this._lastPoint = e), this._move(i, e); + }), + (wr.prototype.mouseupWindow = function (t) { + this._lastPoint && + a.mouseButton(t) === this._eventButton && + (this._moved && a.suppressClick(), this.reset()); + }), + (wr.prototype.enable = function () { + this._enabled = !0; + }), + (wr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (wr.prototype.isEnabled = function () { + return this._enabled; + }), + (wr.prototype.isActive = function () { + return this._active; + }); + var Tr = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.mousedown = function (e, i) { + t.prototype.mousedown.call(this, e, i), + this._lastPoint && (this._active = !0); + }), + (e.prototype._correctButton = function (t, e) { + return 0 === e && !t.ctrlKey; + }), + (e.prototype._move = function (t, e) { + return { around: e, panDelta: e.sub(t) }; + }), + e + ); + })(wr), + Er = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._correctButton = function (t, e) { + return (0 === e && t.ctrlKey) || 2 === e; + }), + (e.prototype._move = function (t, e) { + var i = 0.8 * (e.x - t.x); + if (i) return (this._active = !0), { bearingDelta: i }; + }), + (e.prototype.contextmenu = function (t) { + t.preventDefault(); + }), + e + ); + })(wr), + Ir = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype._correctButton = function (t, e) { + return (0 === e && t.ctrlKey) || 2 === e; + }), + (e.prototype._move = function (t, e) { + var i = -0.5 * (e.y - t.y); + if (i) return (this._active = !0), { pitchDelta: i }; + }), + (e.prototype.contextmenu = function (t) { + t.preventDefault(); + }), + e + ); + })(wr), + Cr = function (t, e) { + (this._minTouches = t.cooperativeGestures ? 2 : 1), + (this._clickTolerance = t.clickTolerance || 1), + (this._map = e), + this.reset(); + }; + (Cr.prototype.reset = function () { + var e = this; + (this._active = !1), + (this._touches = {}), + (this._sum = new t.pointGeometry(0, 0)), + setTimeout(function () { + e._cancelCooperativeMessage = !1; + }, 200); + }), + (Cr.prototype.touchstart = function (t, e, i) { + return this._calculateTransform(t, e, i); + }), + (Cr.prototype.touchmove = function (t, e, i) { + if ( + (this._map._cooperativeGestures && + (2 === this._minTouches && + i.length < 2 && + !this._cancelCooperativeMessage + ? this._map._onCooperativeGesture(t, !1, i.length) + : this._cancelCooperativeMessage || + (this._cancelCooperativeMessage = !0)), + this._active && !(i.length < this._minTouches)) + ) + return t.preventDefault(), this._calculateTransform(t, e, i); + }), + (Cr.prototype.touchend = function (t, e, i) { + this._calculateTransform(t, e, i), + this._active && i.length < this._minTouches && this.reset(); + }), + (Cr.prototype.touchcancel = function () { + this.reset(); + }), + (Cr.prototype._calculateTransform = function (e, i, r) { + r.length > 0 && (this._active = !0); + var o = gr(r, i), + a = new t.pointGeometry(0, 0), + n = new t.pointGeometry(0, 0), + s = 0; + for (var l in o) { + var c = o[l], + h = this._touches[l]; + h && (a._add(c), n._add(c.sub(h)), s++, (o[l] = c)); + } + if (((this._touches = o), !(s < this._minTouches) && n.mag())) { + var u = n.div(s); + if ((this._sum._add(u), !(this._sum.mag() < this._clickTolerance))) + return { around: a.div(s), panDelta: u }; + } + }), + (Cr.prototype.enable = function () { + this._enabled = !0; + }), + (Cr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (Cr.prototype.isEnabled = function () { + return this._enabled; + }), + (Cr.prototype.isActive = function () { + return this._active; + }); + var Sr = function () { + this.reset(); + }; + function Dr(t, e, i) { + for (var r = 0; r < t.length; r++) if (t[r].identifier === i) return e[r]; + } + function zr(t, e) { + return Math.log(t / e) / Math.LN2; + } + (Sr.prototype.reset = function () { + (this._active = !1), delete this._firstTwoTouches; + }), + (Sr.prototype._start = function (t) {}), + (Sr.prototype._move = function (t, e, i) { + return {}; + }), + (Sr.prototype.touchstart = function (t, e, i) { + this._firstTwoTouches || + i.length < 2 || + ((this._firstTwoTouches = [i[0].identifier, i[1].identifier]), + this._start([e[0], e[1]])); + }), + (Sr.prototype.touchmove = function (t, e, i) { + if (this._firstTwoTouches) { + t.preventDefault(); + var r = this._firstTwoTouches, + o = r[1], + a = Dr(i, e, r[0]), + n = Dr(i, e, o); + if (a && n) { + var s = this._aroundCenter ? null : a.add(n).div(2); + return this._move([a, n], s, t); + } + } + }), + (Sr.prototype.touchend = function (t, e, i) { + if (this._firstTwoTouches) { + var r = this._firstTwoTouches, + o = r[1], + n = Dr(i, e, r[0]), + s = Dr(i, e, o); + (n && s) || (this._active && a.suppressClick(), this.reset()); + } + }), + (Sr.prototype.touchcancel = function () { + this.reset(); + }), + (Sr.prototype.enable = function (t) { + (this._enabled = !0), + (this._aroundCenter = !!t && 'center' === t.around); + }), + (Sr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (Sr.prototype.isEnabled = function () { + return this._enabled; + }), + (Sr.prototype.isActive = function () { + return this._active; + }); + var Pr = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.reset = function () { + t.prototype.reset.call(this), + delete this._distance, + delete this._startDistance; + }), + (e.prototype._start = function (t) { + this._startDistance = this._distance = t[0].dist(t[1]); + }), + (e.prototype._move = function (t, e) { + var i = this._distance; + if ( + ((this._distance = t[0].dist(t[1])), + this._active || + !(Math.abs(zr(this._distance, this._startDistance)) < 0.1)) + ) + return ( + (this._active = !0), + { zoomDelta: zr(this._distance, i), pinchAround: e } + ); + }), + e + ); + })(Sr); + function Mr(t, e) { + return (180 * t.angleWith(e)) / Math.PI; + } + var Ar = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.reset = function () { + t.prototype.reset.call(this), + delete this._minDiameter, + delete this._startVector, + delete this._vector; + }), + (e.prototype._start = function (t) { + (this._startVector = this._vector = t[0].sub(t[1])), + (this._minDiameter = t[0].dist(t[1])); + }), + (e.prototype._move = function (t, e) { + var i = this._vector; + if ( + ((this._vector = t[0].sub(t[1])), + this._active || !this._isBelowThreshold(this._vector)) + ) + return ( + (this._active = !0), + { bearingDelta: Mr(this._vector, i), pinchAround: e } + ); + }), + (e.prototype._isBelowThreshold = function (t) { + this._minDiameter = Math.min(this._minDiameter, t.mag()); + var e = (25 / (Math.PI * this._minDiameter)) * 360, + i = Mr(t, this._startVector); + return Math.abs(i) < e; + }), + e + ); + })(Sr); + function Rr(t) { + return Math.abs(t.y) > Math.abs(t.x); + } + var Lr = (function (t) { + function e(e) { + t.call(this), (this._map = e); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + (e.prototype.reset = function () { + t.prototype.reset.call(this), + (this._valid = void 0), + delete this._firstMove, + delete this._lastPoints; + }), + (e.prototype.touchstart = function (e, i, r) { + t.prototype.touchstart.call(this, e, i, r), + (this._currentTouchCount = r.length); + }), + (e.prototype._start = function (t) { + (this._lastPoints = t), Rr(t[0].sub(t[1])) && (this._valid = !1); + }), + (e.prototype._move = function (t, e, i) { + if ( + !(this._map._cooperativeGestures && this._currentTouchCount < 3) + ) { + var r = t[0].sub(this._lastPoints[0]), + o = t[1].sub(this._lastPoints[1]); + if ( + ((this._valid = this.gestureBeginsVertically( + r, + o, + i.timeStamp, + )), + this._valid) + ) + return ( + (this._lastPoints = t), + (this._active = !0), + { pitchDelta: ((r.y + o.y) / 2) * -0.5 } + ); + } + }), + (e.prototype.gestureBeginsVertically = function (t, e, i) { + if (void 0 !== this._valid) return this._valid; + var r = t.mag() >= 2, + o = e.mag() >= 2; + if (r || o) { + if (!r || !o) + return ( + void 0 === this._firstMove && (this._firstMove = i), + i - this._firstMove < 100 && void 0 + ); + var a = t.y > 0 == e.y > 0; + return Rr(t) && Rr(e) && a; + } + }), + e + ); + })(Sr), + kr = { panStep: 100, bearingStep: 15, pitchStep: 10 }, + Br = function () { + var t = kr; + (this._panStep = t.panStep), + (this._bearingStep = t.bearingStep), + (this._pitchStep = t.pitchStep), + (this._rotationDisabled = !1); + }; + function Or(t) { + return t * (2 - t); + } + (Br.prototype.reset = function () { + this._active = !1; + }), + (Br.prototype.keydown = function (t) { + var e = this; + if (!(t.altKey || t.ctrlKey || t.metaKey)) { + var i = 0, + r = 0, + o = 0, + a = 0, + n = 0; + switch (t.keyCode) { + case 61: + case 107: + case 171: + case 187: + i = 1; + break; + case 189: + case 109: + case 173: + i = -1; + break; + case 37: + t.shiftKey ? (r = -1) : (t.preventDefault(), (a = -1)); + break; + case 39: + t.shiftKey ? (r = 1) : (t.preventDefault(), (a = 1)); + break; + case 38: + t.shiftKey ? (o = 1) : (t.preventDefault(), (n = -1)); + break; + case 40: + t.shiftKey ? (o = -1) : (t.preventDefault(), (n = 1)); + break; + default: + return; + } + return ( + this._rotationDisabled && ((r = 0), (o = 0)), + { + cameraAnimation: function (s) { + var l = s.getZoom(); + s.easeTo( + { + duration: 300, + easeId: 'keyboardHandler', + easing: Or, + zoom: i ? Math.round(l) + i * (t.shiftKey ? 2 : 1) : l, + bearing: s.getBearing() + r * e._bearingStep, + pitch: s.getPitch() + o * e._pitchStep, + offset: [-a * e._panStep, -n * e._panStep], + center: s.getCenter(), + }, + { originalEvent: t }, + ); + }, + } + ); + } + }), + (Br.prototype.enable = function () { + this._enabled = !0; + }), + (Br.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (Br.prototype.isEnabled = function () { + return this._enabled; + }), + (Br.prototype.isActive = function () { + return this._active; + }), + (Br.prototype.disableRotation = function () { + this._rotationDisabled = !0; + }), + (Br.prototype.enableRotation = function () { + this._rotationDisabled = !1; + }); + var Fr = 4.000244140625, + Ur = function (e, i) { + (this._map = e), + (this._el = e.getCanvasContainer()), + (this._handler = i), + (this._delta = 0), + (this._defaultZoomRate = 0.01), + (this._wheelZoomRate = 0.0022222222222222222), + t.bindAll(['_onTimeout'], this); + }; + (Ur.prototype.setZoomRate = function (t) { + this._defaultZoomRate = t; + }), + (Ur.prototype.setWheelZoomRate = function (t) { + this._wheelZoomRate = t; + }), + (Ur.prototype.isEnabled = function () { + return !!this._enabled; + }), + (Ur.prototype.isActive = function () { + return !!this._active || void 0 !== this._finishTimeout; + }), + (Ur.prototype.isZooming = function () { + return !!this._zooming; + }), + (Ur.prototype.enable = function (t) { + this.isEnabled() || + ((this._enabled = !0), + (this._aroundCenter = t && 'center' === t.around)); + }), + (Ur.prototype.disable = function () { + this.isEnabled() && (this._enabled = !1); + }), + (Ur.prototype.wheel = function (e) { + if (this.isEnabled()) { + if (this._map._cooperativeGestures) { + if (!this._map._metaPress) return; + e.preventDefault(); + } + var i = + e.deltaMode === WheelEvent.DOM_DELTA_LINE + ? 40 * e.deltaY + : e.deltaY, + r = t.exported.now(), + o = r - (this._lastWheelEventTime || 0); + (this._lastWheelEventTime = r), + 0 !== i && i % Fr == 0 + ? (this._type = 'wheel') + : 0 !== i && Math.abs(i) < 4 + ? (this._type = 'trackpad') + : o > 400 + ? ((this._type = null), + (this._lastValue = i), + (this._timeout = setTimeout(this._onTimeout, 40, e))) + : this._type || + ((this._type = Math.abs(o * i) < 200 ? 'trackpad' : 'wheel'), + this._timeout && + (clearTimeout(this._timeout), + (this._timeout = null), + (i += this._lastValue))), + e.shiftKey && i && (i /= 4), + this._type && + ((this._lastWheelEvent = e), + (this._delta -= i), + this._active || this._start(e)), + e.preventDefault(); + } + }), + (Ur.prototype._onTimeout = function (t) { + (this._type = 'wheel'), + (this._delta -= this._lastValue), + this._active || this._start(t); + }), + (Ur.prototype._start = function (e) { + if (this._delta) { + this._frameId && (this._frameId = null), + (this._active = !0), + this.isZooming() || (this._zooming = !0), + this._finishTimeout && + (clearTimeout(this._finishTimeout), delete this._finishTimeout); + var i = a.mousePos(this._el, e); + (this._around = t.LngLat.convert( + this._aroundCenter ? this._map.getCenter() : this._map.unproject(i), + )), + (this._aroundPoint = this._map.transform.locationPoint( + this._around, + )), + this._frameId || + ((this._frameId = !0), this._handler._triggerRenderFrame()); + } + }), + (Ur.prototype.renderFrame = function () { + var e = this; + if (this._frameId && ((this._frameId = null), this.isActive())) { + var i = this._map.transform; + if (0 !== this._delta) { + var r = + 'wheel' === this._type && Math.abs(this._delta) > Fr + ? this._wheelZoomRate + : this._defaultZoomRate, + o = 2 / (1 + Math.exp(-Math.abs(this._delta * r))); + this._delta < 0 && 0 !== o && (o = 1 / o); + var a = + 'number' == typeof this._targetZoom + ? i.zoomScale(this._targetZoom) + : i.scale; + (this._targetZoom = Math.min( + i.maxZoom, + Math.max(i.minZoom, i.scaleZoom(a * o)), + )), + 'wheel' === this._type && + ((this._startZoom = i.zoom), + (this._easing = this._smoothOutEasing(200))), + (this._delta = 0); + } + var n, + s = 'number' == typeof this._targetZoom ? this._targetZoom : i.zoom, + l = this._startZoom, + c = this._easing, + h = !1; + if ('wheel' === this._type && l && c) { + var u = Math.min( + (t.exported.now() - this._lastWheelEventTime) / 200, + 1, + ), + p = c(u); + (n = t.number(l, s, p)), + u < 1 ? this._frameId || (this._frameId = !0) : (h = !0); + } else (n = s), (h = !0); + return ( + (this._active = !0), + h && + ((this._active = !1), + (this._finishTimeout = setTimeout(function () { + (e._zooming = !1), + e._handler._triggerRenderFrame(), + delete e._targetZoom, + delete e._finishTimeout; + }, 200))), + { + noInertia: !0, + needsRenderFrame: !h, + zoomDelta: n - i.zoom, + around: this._aroundPoint, + originalEvent: this._lastWheelEvent, + } + ); + } + }), + (Ur.prototype._smoothOutEasing = function (e) { + var i = t.ease; + if (this._prevEase) { + var r = this._prevEase, + o = (t.exported.now() - r.start) / r.duration, + a = r.easing(o + 0.01) - r.easing(o), + n = (0.27 / Math.sqrt(a * a + 1e-4)) * 0.01, + s = Math.sqrt(0.0729 - n * n); + i = t.bezier(n, s, 0.25, 1); + } + return ( + (this._prevEase = { + start: t.exported.now(), + duration: e, + easing: i, + }), + i + ); + }), + (Ur.prototype.reset = function () { + this._active = !1; + }); + var Nr = function (t, e) { + (this._clickZoom = t), (this._tapZoom = e); + }; + (Nr.prototype.enable = function () { + this._clickZoom.enable(), this._tapZoom.enable(); + }), + (Nr.prototype.disable = function () { + this._clickZoom.disable(), this._tapZoom.disable(); + }), + (Nr.prototype.isEnabled = function () { + return this._clickZoom.isEnabled() && this._tapZoom.isEnabled(); + }), + (Nr.prototype.isActive = function () { + return this._clickZoom.isActive() || this._tapZoom.isActive(); + }); + var Gr = function () { + this.reset(); + }; + (Gr.prototype.reset = function () { + this._active = !1; + }), + (Gr.prototype.dblclick = function (t, e) { + return ( + t.preventDefault(), + { + cameraAnimation: function (i) { + i.easeTo( + { + duration: 300, + zoom: i.getZoom() + (t.shiftKey ? -1 : 1), + around: i.unproject(e), + }, + { originalEvent: t }, + ); + }, + } + ); + }), + (Gr.prototype.enable = function () { + this._enabled = !0; + }), + (Gr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (Gr.prototype.isEnabled = function () { + return this._enabled; + }), + (Gr.prototype.isActive = function () { + return this._active; + }); + var jr = function () { + (this._tap = new yr({ numTouches: 1, numTaps: 1 })), this.reset(); + }; + (jr.prototype.reset = function () { + (this._active = !1), + delete this._swipePoint, + delete this._swipeTouch, + delete this._tapTime, + this._tap.reset(); + }), + (jr.prototype.touchstart = function (t, e, i) { + this._swipePoint || + (this._tapTime && t.timeStamp - this._tapTime > 500 && this.reset(), + this._tapTime + ? i.length > 0 && + ((this._swipePoint = e[0]), (this._swipeTouch = i[0].identifier)) + : this._tap.touchstart(t, e, i)); + }), + (jr.prototype.touchmove = function (t, e, i) { + if (this._tapTime) { + if (this._swipePoint) { + if (i[0].identifier !== this._swipeTouch) return; + var r = e[0], + o = r.y - this._swipePoint.y; + return ( + (this._swipePoint = r), + t.preventDefault(), + (this._active = !0), + { zoomDelta: o / 128 } + ); + } + } else this._tap.touchmove(t, e, i); + }), + (jr.prototype.touchend = function (t, e, i) { + this._tapTime + ? this._swipePoint && 0 === i.length && this.reset() + : this._tap.touchend(t, e, i) && (this._tapTime = t.timeStamp); + }), + (jr.prototype.touchcancel = function () { + this.reset(); + }), + (jr.prototype.enable = function () { + this._enabled = !0; + }), + (jr.prototype.disable = function () { + (this._enabled = !1), this.reset(); + }), + (jr.prototype.isEnabled = function () { + return this._enabled; + }), + (jr.prototype.isActive = function () { + return this._active; + }); + var Zr = function (t, e, i) { + (this._el = t), (this._mousePan = e), (this._touchPan = i); + }; + (Zr.prototype.enable = function (t) { + (this._inertiaOptions = t || {}), + this._mousePan.enable(), + this._touchPan.enable(), + this._el.classList.add( + 'maplibregl-touch-drag-pan', + 'mapboxgl-touch-drag-pan', + ); + }), + (Zr.prototype.disable = function () { + this._mousePan.disable(), + this._touchPan.disable(), + this._el.classList.remove( + 'maplibregl-touch-drag-pan', + 'mapboxgl-touch-drag-pan', + ); + }), + (Zr.prototype.isEnabled = function () { + return this._mousePan.isEnabled() && this._touchPan.isEnabled(); + }), + (Zr.prototype.isActive = function () { + return this._mousePan.isActive() || this._touchPan.isActive(); + }); + var Vr = function (t, e, i) { + (this._pitchWithRotate = t.pitchWithRotate), + (this._mouseRotate = e), + (this._mousePitch = i); + }; + (Vr.prototype.enable = function () { + this._mouseRotate.enable(), + this._pitchWithRotate && this._mousePitch.enable(); + }), + (Vr.prototype.disable = function () { + this._mouseRotate.disable(), this._mousePitch.disable(); + }), + (Vr.prototype.isEnabled = function () { + return ( + this._mouseRotate.isEnabled() && + (!this._pitchWithRotate || this._mousePitch.isEnabled()) + ); + }), + (Vr.prototype.isActive = function () { + return this._mouseRotate.isActive() || this._mousePitch.isActive(); + }); + var qr = function (t, e, i, r) { + (this._el = t), + (this._touchZoom = e), + (this._touchRotate = i), + (this._tapDragZoom = r), + (this._rotationDisabled = !1), + (this._enabled = !0); + }; + (qr.prototype.enable = function (t) { + this._touchZoom.enable(t), + this._rotationDisabled || this._touchRotate.enable(t), + this._tapDragZoom.enable(), + this._el.classList.add( + 'maplibregl-touch-zoom-rotate', + 'mapboxgl-touch-zoom-rotate', + ); + }), + (qr.prototype.disable = function () { + this._touchZoom.disable(), + this._touchRotate.disable(), + this._tapDragZoom.disable(), + this._el.classList.remove( + 'maplibregl-touch-zoom-rotate', + 'mapboxgl-touch-zoom-rotate', + ); + }), + (qr.prototype.isEnabled = function () { + return ( + this._touchZoom.isEnabled() && + (this._rotationDisabled || this._touchRotate.isEnabled()) && + this._tapDragZoom.isEnabled() + ); + }), + (qr.prototype.isActive = function () { + return ( + this._touchZoom.isActive() || + this._touchRotate.isActive() || + this._tapDragZoom.isActive() + ); + }), + (qr.prototype.disableRotation = function () { + (this._rotationDisabled = !0), this._touchRotate.disable(); + }), + (qr.prototype.enableRotation = function () { + (this._rotationDisabled = !1), + this._touchZoom.isEnabled() && this._touchRotate.enable(); + }); + var Xr = function (t) { + return t.zoom || t.drag || t.pitch || t.rotate; + }, + Wr = (function (t) { + function e() { + t.apply(this, arguments); + } + return ( + t && (e.__proto__ = t), + ((e.prototype = Object.create(t && t.prototype)).constructor = e), + e + ); + })(t.Event); + function Hr(t) { + return ( + (t.panDelta && t.panDelta.mag()) || + t.zoomDelta || + t.bearingDelta || + t.pitchDelta + ); + } + var Kr = function (e, i) { + (this._map = e), + (this._el = this._map.getCanvasContainer()), + (this._handlers = []), + (this._handlersById = {}), + (this._changes = []), + (this._inertia = new lr(e)), + (this._bearingSnap = i.bearingSnap), + (this._previousActiveHandlers = {}), + (this._eventsInProgress = {}), + this._addDefaultHandlers(i), + t.bindAll(['handleEvent', 'handleWindowEvent'], this); + var r = this._el; + this._listeners = [ + [r, 'touchstart', { passive: !0 }], + [r, 'touchmove', { passive: !1 }], + [r, 'touchend', void 0], + [r, 'touchcancel', void 0], + [r, 'mousedown', void 0], + [r, 'mousemove', void 0], + [r, 'mouseup', void 0], + [document, 'mousemove', { capture: !0 }], + [document, 'mouseup', void 0], + [r, 'mouseover', void 0], + [r, 'mouseout', void 0], + [r, 'dblclick', void 0], + [r, 'click', void 0], + [r, 'keydown', { capture: !1 }], + [r, 'keyup', void 0], + [r, 'wheel', { passive: !1 }], + [r, 'contextmenu', void 0], + [window, 'blur', void 0], + ]; + for (var o = 0, n = this._listeners; o < n.length; o += 1) { + var s = n[o], + l = s[0]; + a.addEventListener( + l, + s[1], + l === document ? this.handleWindowEvent : this.handleEvent, + s[2], + ); + } + }; + (Kr.prototype.destroy = function () { + for (var t = 0, e = this._listeners; t < e.length; t += 1) { + var i = e[t], + r = i[0]; + a.removeEventListener( + r, + i[1], + r === document ? this.handleWindowEvent : this.handleEvent, + i[2], + ); + } + }), + (Kr.prototype._addDefaultHandlers = function (t) { + var e = this._map, + i = e.getCanvasContainer(); + this._add('mapEvent', new _r(e, t)); + var r = (e.boxZoom = new mr(e, t)); + this._add('boxZoom', r); + var o = new xr(), + a = new Gr(); + (e.doubleClickZoom = new Nr(a, o)), + this._add('tapZoom', o), + this._add('clickZoom', a); + var n = new jr(); + this._add('tapDragZoom', n); + var s = (e.touchPitch = new Lr(e)); + this._add('touchPitch', s); + var l = new Er(t), + c = new Ir(t); + (e.dragRotate = new Vr(t, l, c)), + this._add('mouseRotate', l, ['mousePitch']), + this._add('mousePitch', c, ['mouseRotate']); + var h = new Tr(t), + u = new Cr(t, e); + (e.dragPan = new Zr(i, h, u)), + this._add('mousePan', h), + this._add('touchPan', u, ['touchZoom', 'touchRotate']); + var p = new Ar(), + d = new Pr(); + (e.touchZoomRotate = new qr(i, d, p, n)), + this._add('touchRotate', p, ['touchPan', 'touchZoom']), + this._add('touchZoom', d, ['touchPan', 'touchRotate']); + var _ = (e.scrollZoom = new Ur(e, this)); + this._add('scrollZoom', _, ['mousePan']); + var f = (e.keyboard = new Br()); + this._add('keyboard', f), this._add('blockableMapEvent', new fr(e)); + for ( + var m = 0, + g = [ + 'boxZoom', + 'doubleClickZoom', + 'tapDragZoom', + 'touchPitch', + 'dragRotate', + 'dragPan', + 'touchZoomRotate', + 'scrollZoom', + 'keyboard', + ]; + m < g.length; + m += 1 + ) { + var v = g[m]; + t.interactive && t[v] && e[v].enable(t[v]); + } + }), + (Kr.prototype._add = function (t, e, i) { + this._handlers.push({ handlerName: t, handler: e, allowed: i }), + (this._handlersById[t] = e); + }), + (Kr.prototype.stop = function (t) { + if (!this._updatingCamera) { + for (var e = 0, i = this._handlers; e < i.length; e += 1) + i[e].handler.reset(); + this._inertia.clear(), + this._fireEvents({}, {}, t), + (this._changes = []); + } + }), + (Kr.prototype.isActive = function () { + for (var t = 0, e = this._handlers; t < e.length; t += 1) + if (e[t].handler.isActive()) return !0; + return !1; + }), + (Kr.prototype.isZooming = function () { + return ( + !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming() + ); + }), + (Kr.prototype.isRotating = function () { + return !!this._eventsInProgress.rotate; + }), + (Kr.prototype.isMoving = function () { + return Boolean(Xr(this._eventsInProgress)) || this.isZooming(); + }), + (Kr.prototype._blockedByActive = function (t, e, i) { + for (var r in t) if (r !== i && (!e || e.indexOf(r) < 0)) return !0; + return !1; + }), + (Kr.prototype.handleWindowEvent = function (t) { + this.handleEvent(t, t.type + 'Window'); + }), + (Kr.prototype._getMapTouches = function (t) { + for (var e = [], i = 0; i < t.length; i++) + this._el.contains(t[i].target) && e.push(t[i]); + return e; + }), + (Kr.prototype.handleEvent = function (t, e) { + if ('blur' !== t.type) { + this._updatingCamera = !0; + for ( + var i = 'renderFrame' === t.type ? void 0 : t, + r = { needsRenderFrame: !1 }, + o = {}, + n = {}, + s = t.touches, + l = s ? this._getMapTouches(s) : void 0, + c = l ? a.touchPos(this._el, l) : a.mousePos(this._el, t), + h = 0, + u = this._handlers; + h < u.length; + h += 1 + ) { + var p = u[h], + d = p.handlerName, + _ = p.handler, + f = p.allowed; + if (_.isEnabled()) { + var m = void 0; + this._blockedByActive(n, f, d) + ? _.reset() + : _[e || t.type] && + ((m = _[e || t.type](t, c, l)), + this.mergeHandlerResult(r, o, m, d, i), + m && m.needsRenderFrame && this._triggerRenderFrame()), + (m || _.isActive()) && (n[d] = _); + } + } + var g = {}; + for (var v in this._previousActiveHandlers) n[v] || (g[v] = i); + (this._previousActiveHandlers = n), + (Object.keys(g).length || Hr(r)) && + (this._changes.push([r, o, g]), this._triggerRenderFrame()), + (Object.keys(n).length || Hr(r)) && this._map._stop(!0), + (this._updatingCamera = !1); + var y = r.cameraAnimation; + y && + (this._inertia.clear(), + this._fireEvents({}, {}, !0), + (this._changes = []), + y(this._map)); + } else this.stop(!0); + }), + (Kr.prototype.mergeHandlerResult = function (e, i, r, o, a) { + if (r) { + t.extend(e, r); + var n = { handlerName: o, originalEvent: r.originalEvent || a }; + void 0 !== r.zoomDelta && (i.zoom = n), + void 0 !== r.panDelta && (i.drag = n), + void 0 !== r.pitchDelta && (i.pitch = n), + void 0 !== r.bearingDelta && (i.rotate = n); + } + }), + (Kr.prototype._applyChanges = function () { + for ( + var e = {}, i = {}, r = {}, o = 0, a = this._changes; + o < a.length; + o += 1 + ) { + var n = a[o], + s = n[0], + l = n[1], + c = n[2]; + s.panDelta && + (e.panDelta = (e.panDelta || new t.pointGeometry(0, 0))._add( + s.panDelta, + )), + s.zoomDelta && (e.zoomDelta = (e.zoomDelta || 0) + s.zoomDelta), + s.bearingDelta && + (e.bearingDelta = (e.bearingDelta || 0) + s.bearingDelta), + s.pitchDelta && (e.pitchDelta = (e.pitchDelta || 0) + s.pitchDelta), + void 0 !== s.around && (e.around = s.around), + void 0 !== s.pinchAround && (e.pinchAround = s.pinchAround), + s.noInertia && (e.noInertia = s.noInertia), + t.extend(i, l), + t.extend(r, c); + } + this._updateMapTransform(e, i, r), (this._changes = []); + }), + (Kr.prototype._updateMapTransform = function (e, i, r) { + var o = this._map, + a = o.transform, + n = o.style && o.style.terrain; + if (!(Hr(e) || (n && this._drag))) return this._fireEvents(i, r, !0); + var s = e.panDelta, + l = e.zoomDelta, + c = e.bearingDelta, + h = e.pitchDelta, + u = e.around, + p = e.pinchAround; + void 0 !== p && (u = p), + o._stop(!0), + (u = u || o.transform.centerPoint); + var d = a.pointLocation(s ? u.sub(s) : u); + c && (a.bearing += c), + h && (a.pitch += h), + l && (a.zoom += l), + n + ? i.drag && !this._drag + ? ((this._drag = { + center: a.centerPoint, + lngLat: a.pointLocation(u), + point: u, + handlerName: i.drag.handlerName, + }), + o.fire(new t.Event('freezeElevation', { freeze: !0 }))) + : this._drag && r[this._drag.handlerName] + ? (o.fire(new t.Event('freezeElevation', { freeze: !1 })), + (this._drag = null)) + : i.drag && + this._drag && + (a.center = a.pointLocation(a.centerPoint.sub(s))) + : a.setLocationAtPoint(d, u), + this._map._update(), + e.noInertia || this._inertia.record(e), + this._fireEvents(i, r, !0); + }), + (Kr.prototype._fireEvents = function (e, i, r) { + var o = this, + a = Xr(this._eventsInProgress), + n = Xr(e), + s = {}; + for (var l in e) + this._eventsInProgress[l] || (s[l + 'start'] = e[l].originalEvent), + (this._eventsInProgress[l] = e[l]); + for (var c in (!a && n && this._fireEvent('movestart', n.originalEvent), + s)) + this._fireEvent(c, s[c]); + for (var h in (n && this._fireEvent('move', n.originalEvent), e)) + this._fireEvent(h, e[h].originalEvent); + var u, + p = {}; + for (var d in this._eventsInProgress) { + var _ = this._eventsInProgress[d], + f = _.handlerName, + m = _.originalEvent; + this._handlersById[f].isActive() || + (delete this._eventsInProgress[d], (p[d + 'end'] = u = i[f] || m)); + } + for (var g in p) this._fireEvent(g, p[g]); + var v = Xr(this._eventsInProgress); + if (r && (a || n) && !v) { + this._updatingCamera = !0; + var y = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), + x = function (t) { + return 0 !== t && -o._bearingSnap < t && t < o._bearingSnap; + }; + y + ? (x(y.bearing || this._map.getBearing()) && (y.bearing = 0), + this._map.easeTo(y, { originalEvent: u })) + : (this._map.fire(new t.Event('moveend', { originalEvent: u })), + x(this._map.getBearing()) && this._map.resetNorth()), + (this._updatingCamera = !1); + } + }), + (Kr.prototype._fireEvent = function (e, i) { + this._map.fire(new t.Event(e, i ? { originalEvent: i } : {})); + }), + (Kr.prototype._requestFrame = function () { + var t = this; + return ( + this._map.triggerRepaint(), + this._map._renderTaskQueue.add(function (e) { + delete t._frameId, + t.handleEvent(new Wr('renderFrame', { timeStamp: e })), + t._applyChanges(); + }) + ); + }), + (Kr.prototype._triggerRenderFrame = function () { + void 0 === this._frameId && (this._frameId = this._requestFrame()); + }); + var Yr = (function (e) { + function i(i, r) { + e.call(this), + (this._moving = !1), + (this._zooming = !1), + (this.transform = i), + (this._bearingSnap = r.bearingSnap), + t.bindAll(['_renderFrameCallback'], this); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.getCenter = function () { + return new t.LngLat( + this.transform.center.lng, + this.transform.center.lat, + ); + }), + (i.prototype.setCenter = function (t, e) { + return this.jumpTo({ center: t }, e); + }), + (i.prototype.panBy = function (e, i, r) { + return ( + (e = t.pointGeometry.convert(e).mult(-1)), + this.panTo(this.transform.center, t.extend({ offset: e }, i), r) + ); + }), + (i.prototype.panTo = function (e, i, r) { + return this.easeTo(t.extend({ center: e }, i), r); + }), + (i.prototype.getZoom = function () { + return this.transform.zoom; + }), + (i.prototype.setZoom = function (t, e) { + return this.jumpTo({ zoom: t }, e), this; + }), + (i.prototype.zoomTo = function (e, i, r) { + return this.easeTo(t.extend({ zoom: e }, i), r); + }), + (i.prototype.zoomIn = function (t, e) { + return this.zoomTo(this.getZoom() + 1, t, e), this; + }), + (i.prototype.zoomOut = function (t, e) { + return this.zoomTo(this.getZoom() - 1, t, e), this; + }), + (i.prototype.getBearing = function () { + return this.transform.bearing; + }), + (i.prototype.setBearing = function (t, e) { + return this.jumpTo({ bearing: t }, e), this; + }), + (i.prototype.getPadding = function () { + return this.transform.padding; + }), + (i.prototype.setPadding = function (t, e) { + return this.jumpTo({ padding: t }, e), this; + }), + (i.prototype.rotateTo = function (e, i, r) { + return this.easeTo(t.extend({ bearing: e }, i), r); + }), + (i.prototype.resetNorth = function (e, i) { + return this.rotateTo(0, t.extend({ duration: 1e3 }, e), i), this; + }), + (i.prototype.resetNorthPitch = function (e, i) { + return ( + this.easeTo( + t.extend({ bearing: 0, pitch: 0, duration: 1e3 }, e), + i, + ), + this + ); + }), + (i.prototype.snapToNorth = function (t, e) { + return Math.abs(this.getBearing()) < this._bearingSnap + ? this.resetNorth(t, e) + : this; + }), + (i.prototype.getPitch = function () { + return this.transform.pitch; + }), + (i.prototype.setPitch = function (t, e) { + return this.jumpTo({ pitch: t }, e), this; + }), + (i.prototype.cameraForBounds = function (e, i) { + e = t.LngLatBounds.convert(e); + var r = (i && i.bearing) || 0; + return this._cameraForBoxAndBearing( + e.getNorthWest(), + e.getSouthEast(), + r, + i, + ); + }), + (i.prototype._cameraForBoxAndBearing = function (e, i, r, o) { + var a = { top: 0, bottom: 0, right: 0, left: 0 }; + if ( + 'number' == + typeof (o = t.extend( + { padding: a, offset: [0, 0], maxZoom: this.transform.maxZoom }, + o, + )).padding + ) { + var n = o.padding; + o.padding = { top: n, bottom: n, right: n, left: n }; + } + o.padding = t.extend(a, o.padding); + var s = this.transform, + l = s.padding, + c = s.project(t.LngLat.convert(e)), + h = s.project(t.LngLat.convert(i)), + u = c.rotate((-r * Math.PI) / 180), + p = h.rotate((-r * Math.PI) / 180), + d = new t.pointGeometry(Math.max(u.x, p.x), Math.max(u.y, p.y)), + _ = new t.pointGeometry(Math.min(u.x, p.x), Math.min(u.y, p.y)), + f = d.sub(_), + m = + (s.width - + (l.left + l.right + o.padding.left + o.padding.right)) / + f.x, + g = + (s.height - + (l.top + l.bottom + o.padding.top + o.padding.bottom)) / + f.y; + if (!(g < 0 || m < 0)) { + var v = Math.min( + s.scaleZoom(s.scale * Math.min(m, g)), + o.maxZoom, + ), + y = t.pointGeometry.convert(o.offset), + x = new t.pointGeometry( + (o.padding.left - o.padding.right) / 2, + (o.padding.top - o.padding.bottom) / 2, + ).rotate((r * Math.PI) / 180), + b = y.add(x).mult(s.scale / s.zoomScale(v)); + return { + center: s.unproject(c.add(h).div(2).sub(b)), + zoom: v, + bearing: r, + }; + } + t.warnOnce( + 'Map cannot fit within canvas with the given bounds, padding, and/or offset.', + ); + }), + (i.prototype.fitBounds = function (t, e, i) { + return this._fitInternal(this.cameraForBounds(t, e), e, i); + }), + (i.prototype.fitScreenCoordinates = function (e, i, r, o, a) { + return this._fitInternal( + this._cameraForBoxAndBearing( + this.transform.pointLocation(t.pointGeometry.convert(e)), + this.transform.pointLocation(t.pointGeometry.convert(i)), + r, + o, + ), + o, + a, + ); + }), + (i.prototype._fitInternal = function (e, i, r) { + return e + ? (delete (i = t.extend(e, i)).padding, + i.linear ? this.easeTo(i, r) : this.flyTo(i, r)) + : this; + }), + (i.prototype.jumpTo = function (e, i) { + this.stop(); + var r = this.transform, + o = !1, + a = !1, + n = !1; + return ( + 'zoom' in e && + r.zoom !== +e.zoom && + ((o = !0), (r.zoom = +e.zoom)), + void 0 !== e.center && (r.center = t.LngLat.convert(e.center)), + 'bearing' in e && + r.bearing !== +e.bearing && + ((a = !0), (r.bearing = +e.bearing)), + 'pitch' in e && + r.pitch !== +e.pitch && + ((n = !0), (r.pitch = +e.pitch)), + null == e.padding || + r.isPaddingEqual(e.padding) || + (r.padding = e.padding), + this.fire(new t.Event('movestart', i)).fire( + new t.Event('move', i), + ), + o && + this.fire(new t.Event('zoomstart', i)) + .fire(new t.Event('zoom', i)) + .fire(new t.Event('zoomend', i)), + a && + this.fire(new t.Event('rotatestart', i)) + .fire(new t.Event('rotate', i)) + .fire(new t.Event('rotateend', i)), + n && + this.fire(new t.Event('pitchstart', i)) + .fire(new t.Event('pitch', i)) + .fire(new t.Event('pitchend', i)), + this.fire(new t.Event('moveend', i)) + ); + }), + (i.prototype.calculateCameraOptionsFromTo = function (e, i, r, o) { + void 0 === o && (o = 0); + var a = t.MercatorCoordinate.fromLngLat(e, i), + n = t.MercatorCoordinate.fromLngLat(r, o), + s = n.x - a.x, + l = n.y - a.y, + c = n.z - a.z, + h = Math.hypot(s, l, c); + if (0 === h) + throw new Error( + "Can't calculate camera options with same From and To", + ); + var u = Math.hypot(s, l), + p = this.transform.scaleZoom( + this.transform.cameraToCenterDistance / + h / + this.transform.tileSize, + ), + d = (180 * Math.atan2(s, -l)) / Math.PI, + _ = (180 * Math.acos(u / h)) / Math.PI; + return ( + (_ = c < 0 ? 90 - _ : 90 + _), + { center: n.toLngLat(), zoom: p, pitch: _, bearing: d } + ); + }), + (i.prototype.easeTo = function (e, i) { + var r = this; + this._stop(!1, e.easeId), + (!1 === + (e = t.extend( + { offset: [0, 0], duration: 500, easing: t.ease }, + e, + )).animate || + (!e.essential && t.exported.prefersReducedMotion)) && + (e.duration = 0); + var o = this.transform, + a = this.getZoom(), + n = this.getBearing(), + s = this.getPitch(), + l = this.getPadding(), + c = 'zoom' in e ? +e.zoom : a, + h = 'bearing' in e ? this._normalizeBearing(e.bearing, n) : n, + u = 'pitch' in e ? +e.pitch : s, + p = 'padding' in e ? e.padding : o.padding, + d = t.pointGeometry.convert(e.offset), + _ = o.centerPoint.add(d), + f = o.pointLocation(_), + m = t.LngLat.convert(e.center || f); + this._normalizeCenter(m); + var g, + v, + y = o.project(f), + x = o.project(m).sub(y), + b = o.zoomScale(c - a); + e.around && + ((g = t.LngLat.convert(e.around)), (v = o.locationPoint(g))); + var w = { + moving: this._moving, + zooming: this._zooming, + rotating: this._rotating, + pitching: this._pitching, + }; + return ( + (this._zooming = this._zooming || c !== a), + (this._rotating = this._rotating || n !== h), + (this._pitching = this._pitching || u !== s), + (this._padding = !o.isPaddingEqual(p)), + (this._easeId = e.easeId), + this._prepareEase(i, e.noMoveStart, w), + this._ease( + function (e) { + if ( + (r._zooming && (o.zoom = t.number(a, c, e)), + r._rotating && (o.bearing = t.number(n, h, e)), + r._pitching && (o.pitch = t.number(s, u, e)), + r._padding && + (o.interpolatePadding(l, p, e), + (_ = o.centerPoint.add(d))), + g) + ) + o.setLocationAtPoint(g, v); + else { + var f = o.zoomScale(o.zoom - a), + m = c > a ? Math.min(2, b) : Math.max(0.5, b), + w = Math.pow(m, 1 - e), + T = o.unproject(y.add(x.mult(e * w)).mult(f)); + o.setLocationAtPoint(o.renderWorldCopies ? T.wrap() : T, _); + } + r._fireMoveEvents(i); + }, + function (t) { + r._afterEase(i, t); + }, + e, + ), + this + ); + }), + (i.prototype._prepareEase = function (e, i, r) { + void 0 === r && (r = {}), + (this._moving = !0), + this.fire(new t.Event('freezeElevation', { freeze: !0 })), + i || r.moving || this.fire(new t.Event('movestart', e)), + this._zooming && + !r.zooming && + this.fire(new t.Event('zoomstart', e)), + this._rotating && + !r.rotating && + this.fire(new t.Event('rotatestart', e)), + this._pitching && + !r.pitching && + this.fire(new t.Event('pitchstart', e)); + }), + (i.prototype._fireMoveEvents = function (e) { + this.fire(new t.Event('move', e)), + this._zooming && this.fire(new t.Event('zoom', e)), + this._rotating && this.fire(new t.Event('rotate', e)), + this._pitching && this.fire(new t.Event('pitch', e)); + }), + (i.prototype._afterEase = function (e, i) { + if (!this._easeId || !i || this._easeId !== i) { + delete this._easeId, + this.fire(new t.Event('freezeElevation', { freeze: !1 })); + var r = this._zooming, + o = this._rotating, + a = this._pitching; + (this._moving = !1), + (this._zooming = !1), + (this._rotating = !1), + (this._pitching = !1), + (this._padding = !1), + r && this.fire(new t.Event('zoomend', e)), + o && this.fire(new t.Event('rotateend', e)), + a && this.fire(new t.Event('pitchend', e)), + this.fire(new t.Event('moveend', e)); + } + }), + (i.prototype.flyTo = function (e, i) { + var r = this; + if (!e.essential && t.exported.prefersReducedMotion) { + var o = t.pick(e, [ + 'center', + 'zoom', + 'bearing', + 'pitch', + 'around', + ]); + return this.jumpTo(o, i); + } + this.stop(), + (e = t.extend( + { offset: [0, 0], speed: 1.2, curve: 1.42, easing: t.ease }, + e, + )); + var a = this.transform, + n = this.getZoom(), + s = this.getBearing(), + l = this.getPitch(), + c = this.getPadding(), + h = 'zoom' in e ? t.clamp(+e.zoom, a.minZoom, a.maxZoom) : n, + u = 'bearing' in e ? this._normalizeBearing(e.bearing, s) : s, + p = 'pitch' in e ? +e.pitch : l, + d = 'padding' in e ? e.padding : a.padding, + _ = a.zoomScale(h - n), + f = t.pointGeometry.convert(e.offset), + m = a.centerPoint.add(f), + g = a.pointLocation(m), + v = t.LngLat.convert(e.center || g); + this._normalizeCenter(v); + var y = a.project(g), + x = a.project(v).sub(y), + b = e.curve, + w = Math.max(a.width, a.height), + T = w / _, + E = x.mag(); + if ('minZoom' in e) { + var I = t.clamp(Math.min(e.minZoom, n, h), a.minZoom, a.maxZoom), + C = w / a.zoomScale(I - n); + b = Math.sqrt((C / E) * 2); + } + var S = b * b; + function D(t) { + var e = + (T * T - w * w + (t ? -1 : 1) * S * S * E * E) / + (2 * (t ? T : w) * S * E); + return Math.log(Math.sqrt(e * e + 1) - e); + } + function z(t) { + return (Math.exp(t) - Math.exp(-t)) / 2; + } + function P(t) { + return (Math.exp(t) + Math.exp(-t)) / 2; + } + var M = D(0), + A = function (t) { + return P(M) / P(M + b * t); + }, + R = function (t) { + return ( + (w * ((P(M) * (z((e = M + b * t)) / P(e)) - z(M)) / S)) / E + ); + var e; + }, + L = (D(1) - M) / b; + if (Math.abs(E) < 1e-6 || !isFinite(L)) { + if (Math.abs(w - T) < 1e-6) return this.easeTo(e, i); + var k = T < w ? -1 : 1; + (L = Math.abs(Math.log(T / w)) / b), + (R = function () { + return 0; + }), + (A = function (t) { + return Math.exp(k * b * t); + }); + } + return ( + (e.duration = + 'duration' in e + ? +e.duration + : (1e3 * L) / + ('screenSpeed' in e ? +e.screenSpeed / b : +e.speed)), + e.maxDuration && e.duration > e.maxDuration && (e.duration = 0), + (this._zooming = !0), + (this._rotating = s !== u), + (this._pitching = p !== l), + (this._padding = !a.isPaddingEqual(d)), + this._prepareEase(i, !1), + this._ease( + function (e) { + var o = e * L, + _ = 1 / A(o); + (a.zoom = 1 === e ? h : n + a.scaleZoom(_)), + r._rotating && (a.bearing = t.number(s, u, e)), + r._pitching && (a.pitch = t.number(l, p, e)), + r._padding && + (a.interpolatePadding(c, d, e), + (m = a.centerPoint.add(f))); + var g = + 1 === e ? v : a.unproject(y.add(x.mult(R(o))).mult(_)); + a.setLocationAtPoint(a.renderWorldCopies ? g.wrap() : g, m), + r._fireMoveEvents(i); + }, + function () { + return r._afterEase(i); + }, + e, + ), + this + ); + }), + (i.prototype.isEasing = function () { + return !!this._easeFrameId; + }), + (i.prototype.stop = function () { + return this._stop(); + }), + (i.prototype._stop = function (t, e) { + if ( + (this._easeFrameId && + (this._cancelRenderFrame(this._easeFrameId), + delete this._easeFrameId, + delete this._onEaseFrame), + this._onEaseEnd) + ) { + var i = this._onEaseEnd; + delete this._onEaseEnd, i.call(this, e); + } + if (!t) { + var r = this.handlers; + r && r.stop(!1); + } + return this; + }), + (i.prototype._ease = function (e, i, r) { + !1 === r.animate || 0 === r.duration + ? (e(1), i()) + : ((this._easeStart = t.exported.now()), + (this._easeOptions = r), + (this._onEaseFrame = e), + (this._onEaseEnd = i), + (this._easeFrameId = this._requestRenderFrame( + this._renderFrameCallback, + ))); + }), + (i.prototype._renderFrameCallback = function () { + var e = Math.min( + (t.exported.now() - this._easeStart) / this._easeOptions.duration, + 1, + ); + this._onEaseFrame(this._easeOptions.easing(e)), + e < 1 + ? (this._easeFrameId = this._requestRenderFrame( + this._renderFrameCallback, + )) + : this.stop(); + }), + (i.prototype._normalizeBearing = function (e, i) { + e = t.wrap(e, -180, 180); + var r = Math.abs(e - i); + return ( + Math.abs(e - 360 - i) < r && (e -= 360), + Math.abs(e + 360 - i) < r && (e += 360), + e + ); + }), + (i.prototype._normalizeCenter = function (t) { + var e = this.transform; + if (e.renderWorldCopies && !e.lngRange) { + var i = t.lng - e.center.lng; + t.lng += i > 180 ? -360 : i < -180 ? 360 : 0; + } + }), + i + ); + })(t.Evented), + Jr = function (e) { + void 0 === e && (e = {}), + (this.options = e), + t.bindAll( + [ + '_toggleAttribution', + '_updateData', + '_updateCompact', + '_updateCompactMinimize', + ], + this, + ); + }; + (Jr.prototype.getDefaultPosition = function () { + return 'bottom-right'; + }), + (Jr.prototype.onAdd = function (t) { + return ( + (this._map = t), + (this._compact = this.options && this.options.compact), + (this._container = a.create( + 'details', + 'maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib', + )), + (this._compactButton = a.create( + 'summary', + 'maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button', + this._container, + )), + this._compactButton.addEventListener( + 'click', + this._toggleAttribution, + ), + this._setElementTitle(this._compactButton, 'ToggleAttribution'), + (this._innerContainer = a.create( + 'div', + 'maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner', + this._container, + )), + this._updateAttributions(), + this._updateCompact(), + this._map.on('styledata', this._updateData), + this._map.on('sourcedata', this._updateData), + this._map.on('terrain', this._updateData), + this._map.on('resize', this._updateCompact), + this._map.on('drag', this._updateCompactMinimize), + this._container + ); + }), + (Jr.prototype.onRemove = function () { + a.remove(this._container), + this._map.off('styledata', this._updateData), + this._map.off('sourcedata', this._updateData), + this._map.off('terrain', this._updateData), + this._map.off('resize', this._updateCompact), + this._map.off('drag', this._updateCompactMinimize), + (this._map = void 0), + (this._compact = void 0), + (this._attribHTML = void 0); + }), + (Jr.prototype._setElementTitle = function (t, e) { + var i = this._map._getUIString('AttributionControl.' + e); + (t.title = i), t.setAttribute('aria-label', i); + }), + (Jr.prototype._toggleAttribution = function () { + this._container.classList.contains('maplibregl-compact') && + (this._container.classList.contains('maplibregl-compact-show') + ? (this._container.setAttribute('open', ''), + this._container.classList.remove( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + )) + : (this._container.classList.add( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + ), + this._container.removeAttribute('open'))); + }), + (Jr.prototype._updateData = function (t) { + !t || + ('metadata' !== t.sourceDataType && + 'visibility' !== t.sourceDataType && + 'style' !== t.dataType && + 'terrain' !== t.type) || + this._updateAttributions(); + }), + (Jr.prototype._updateAttributions = function () { + if (this._map.style) { + var t = []; + if ( + (this.options.customAttribution && + (Array.isArray(this.options.customAttribution) + ? (t = t.concat( + this.options.customAttribution.map(function (t) { + return 'string' != typeof t ? '' : t; + }), + )) + : 'string' == typeof this.options.customAttribution && + t.push(this.options.customAttribution)), + this._map.style.stylesheet) + ) { + var e = this._map.style.stylesheet; + (this.styleOwner = e.owner), (this.styleId = e.id); + } + var i = this._map.style.sourceCaches; + for (var r in i) { + var o = i[r]; + if (o.used || o.usedForTerrain) { + var a = o.getSource(); + a.attribution && + t.indexOf(a.attribution) < 0 && + t.push(a.attribution); + } + } + (t = t.filter(function (t) { + return String(t).trim(); + })).sort(function (t, e) { + return t.length - e.length; + }); + var n = (t = t.filter(function (e, i) { + for (var r = i + 1; r < t.length; r++) + if (t[r].indexOf(e) >= 0) return !1; + return !0; + })).join(' | '); + n !== this._attribHTML && + ((this._attribHTML = n), + t.length + ? ((this._innerContainer.innerHTML = n), + this._container.classList.remove( + 'maplibregl-attrib-empty', + 'mapboxgl-attrib-empty', + )) + : this._container.classList.add( + 'maplibregl-attrib-empty', + 'mapboxgl-attrib-empty', + ), + this._updateCompact(), + (this._editLink = null)); + } + }), + (Jr.prototype._updateCompact = function () { + this._map.getCanvasContainer().offsetWidth <= 640 || this._compact + ? !1 === this._compact + ? this._container.setAttribute('open', '') + : this._container.classList.contains('maplibregl-compact') || + this._container.classList.contains('maplibregl-attrib-empty') || + (this._container.setAttribute('open', ''), + this._container.classList.add( + 'maplibregl-compact', + 'mapboxgl-compact', + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + )) + : (this._container.setAttribute('open', ''), + this._container.classList.contains('maplibregl-compact') && + this._container.classList.remove( + 'maplibregl-compact', + 'maplibregl-compact-show', + 'mapboxgl-compact', + 'mapboxgl-compact-show', + )); + }), + (Jr.prototype._updateCompactMinimize = function () { + this._container.classList.contains('maplibregl-compact') && + this._container.classList.contains('maplibregl-compact-show') && + this._container.classList.remove( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + ); + }); + var Qr = function (e) { + void 0 === e && (e = {}), + (this.options = e), + t.bindAll(['_updateCompact'], this); + }; + (Qr.prototype.getDefaultPosition = function () { + return 'bottom-left'; + }), + (Qr.prototype.onAdd = function (t) { + (this._map = t), + (this._compact = this.options && this.options.compact), + (this._container = a.create('div', 'maplibregl-ctrl mapboxgl-ctrl')); + var e = a.create('a', 'maplibregl-ctrl-logo mapboxgl-ctrl-logo'); + return ( + (e.target = '_blank'), + (e.rel = 'noopener nofollow'), + (e.href = 'https://maplibre.org/'), + e.setAttribute( + 'aria-label', + this._map._getUIString('LogoControl.Title'), + ), + e.setAttribute('rel', 'noopener nofollow'), + this._container.appendChild(e), + (this._container.style.display = 'block'), + this._map.on('resize', this._updateCompact), + this._updateCompact(), + this._container + ); + }), + (Qr.prototype.onRemove = function () { + a.remove(this._container), + this._map.off('resize', this._updateCompact), + (this._map = void 0), + (this._compact = void 0); + }), + (Qr.prototype._updateCompact = function () { + var t = this._container.children; + if (t.length) { + var e = t[0]; + this._map.getCanvasContainer().offsetWidth <= 640 || this._compact + ? !1 !== this._compact && + e.classList.add('maplibregl-compact', 'mapboxgl-compact') + : e.classList.remove('maplibregl-compact', 'mapboxgl-compact'); + } + }); + var $r = function () { + (this._queue = []), + (this._id = 0), + (this._cleared = !1), + (this._currentlyRunning = !1); + }; + ($r.prototype.add = function (t) { + var e = ++this._id; + return this._queue.push({ callback: t, id: e, cancelled: !1 }), e; + }), + ($r.prototype.remove = function (t) { + for ( + var e = this._currentlyRunning, + i = 0, + r = e ? this._queue.concat(e) : this._queue; + i < r.length; + i += 1 + ) { + var o = r[i]; + if (o.id === t) return void (o.cancelled = !0); + } + }), + ($r.prototype.run = function (t) { + if ((void 0 === t && (t = 0), this._currentlyRunning)) + throw new Error('Attempting to run(), but is already running.'); + var e = (this._currentlyRunning = this._queue); + this._queue = []; + for (var i = 0, r = e; i < r.length; i += 1) { + var o = r[i]; + if (!o.cancelled && (o.callback(t), this._cleared)) break; + } + (this._cleared = !1), (this._currentlyRunning = !1); + }), + ($r.prototype.clear = function () { + this._currentlyRunning && (this._cleared = !0), (this._queue = []); + }); + var to = { + 'AttributionControl.ToggleAttribution': 'Toggle attribution', + 'AttributionControl.MapFeedback': 'Map feedback', + 'FullscreenControl.Enter': 'Enter fullscreen', + 'FullscreenControl.Exit': 'Exit fullscreen', + 'GeolocateControl.FindMyLocation': 'Find my location', + 'GeolocateControl.LocationNotAvailable': 'Location not available', + 'LogoControl.Title': 'Mapbox logo', + 'NavigationControl.ResetBearing': 'Reset bearing to north', + 'NavigationControl.ZoomIn': 'Zoom in', + 'NavigationControl.ZoomOut': 'Zoom out', + 'ScaleControl.Feet': 'ft', + 'ScaleControl.Meters': 'm', + 'ScaleControl.Kilometers': 'km', + 'ScaleControl.Miles': 'mi', + 'ScaleControl.NauticalMiles': 'nm', + 'TerrainControl.enableTerrain': 'Enable terrain', + 'TerrainControl.disableTerrain': 'Disable terrain', + }, + eo = { + center: [0, 0], + zoom: 0, + bearing: 0, + pitch: 0, + minZoom: -2, + maxZoom: 22, + minPitch: 0, + maxPitch: 60, + interactive: !0, + scrollZoom: !0, + boxZoom: !0, + dragRotate: !0, + dragPan: !0, + keyboard: !0, + doubleClickZoom: !0, + touchZoomRotate: !0, + touchPitch: !0, + cooperativeGestures: void 0, + bearingSnap: 7, + clickTolerance: 3, + pitchWithRotate: !0, + hash: !1, + attributionControl: !0, + maplibreLogo: !1, + failIfMajorPerformanceCaveat: !1, + preserveDrawingBuffer: !1, + trackResize: !0, + renderWorldCopies: !0, + refreshExpiredTiles: !0, + maxTileCacheSize: null, + localIdeographFontFamily: 'sans-serif', + transformRequest: null, + fadeDuration: 300, + crossSourceCollisions: !0, + }, + io = (function (i) { + function r(e) { + var r, + o = this; + if ( + (t.PerformanceUtils.mark(t.PerformanceMarkers.create), + null != (e = t.extend({}, eo, e)).minZoom && + null != e.maxZoom && + e.minZoom > e.maxZoom) + ) + throw new Error('maxZoom must be greater than or equal to minZoom'); + if ( + null != e.minPitch && + null != e.maxPitch && + e.minPitch > e.maxPitch + ) + throw new Error( + 'maxPitch must be greater than or equal to minPitch', + ); + if (null != e.minPitch && e.minPitch < 0) + throw new Error('minPitch must be greater than or equal to 0'); + if (null != e.maxPitch && e.maxPitch > 85) + throw new Error('maxPitch must be less than or equal to 85'); + var a = new tr( + e.minZoom, + e.maxZoom, + e.minPitch, + e.maxPitch, + e.renderWorldCopies, + ); + if ( + (i.call(this, a, { bearingSnap: e.bearingSnap }), + (this._interactive = e.interactive), + (this._cooperativeGestures = e.cooperativeGestures), + (this._maxTileCacheSize = e.maxTileCacheSize), + (this._failIfMajorPerformanceCaveat = + e.failIfMajorPerformanceCaveat), + (this._preserveDrawingBuffer = e.preserveDrawingBuffer), + (this._antialias = e.antialias), + (this._trackResize = e.trackResize), + (this._bearingSnap = e.bearingSnap), + (this._refreshExpiredTiles = e.refreshExpiredTiles), + (this._fadeDuration = e.fadeDuration), + (this._crossSourceCollisions = e.crossSourceCollisions), + (this._crossFadingFactor = 1), + (this._collectResourceTiming = e.collectResourceTiming), + (this._renderTaskQueue = new $r()), + (this._controls = []), + (this._mapId = t.uniqueId()), + (this._locale = t.extend({}, to, e.locale)), + (this._clickTolerance = e.clickTolerance), + (this._pixelRatio = + null !== (r = e.pixelRatio) && void 0 !== r + ? r + : devicePixelRatio), + (this._requestManager = new n(e.transformRequest)), + 'string' == typeof e.container) + ) { + if ( + ((this._container = document.getElementById(e.container)), + !this._container) + ) + throw new Error("Container '" + e.container + "' not found."); + } else { + if (!(e.container instanceof HTMLElement)) + throw new Error( + "Invalid type: 'container' must be a String or HTMLElement.", + ); + this._container = e.container; + } + if ( + (e.maxBounds && this.setMaxBounds(e.maxBounds), + t.bindAll( + [ + '_onWindowOnline', + '_onWindowResize', + '_onMapScroll', + '_contextLost', + '_contextRestored', + ], + this, + ), + this._setupContainer(), + this._setupPainter(), + void 0 === this.painter) + ) + throw new Error('Failed to initialize WebGL.'); + this.on('move', function () { + return o._update(!1); + }), + this.on('moveend', function () { + return o._update(!1); + }), + this.on('zoom', function () { + return o._update(!0); + }), + this.on('terrain', function () { + (o.painter.terrainFacilitator.dirty = !0), o._update(!0); + }), + 'undefined' != typeof window && + (addEventListener('online', this._onWindowOnline, !1), + addEventListener('resize', this._onWindowResize, !1), + addEventListener('orientationchange', this._onWindowResize, !1)), + (this.handlers = new Kr(this, e)), + this._cooperativeGestures && this._setupCooperativeGestures(), + (this._hash = + e.hash && + new ir(('string' == typeof e.hash && e.hash) || void 0).addTo( + this, + )), + (this._hash && this._hash._onHashChange()) || + (this.jumpTo({ + center: e.center, + zoom: e.zoom, + bearing: e.bearing, + pitch: e.pitch, + }), + e.bounds && + (this.resize(), + this.fitBounds( + e.bounds, + t.extend({}, e.fitBoundsOptions, { duration: 0 }), + ))), + this.resize(), + (this._localIdeographFontFamily = e.localIdeographFontFamily), + e.style && + this.setStyle(e.style, { + localIdeographFontFamily: e.localIdeographFontFamily, + }), + e.attributionControl && + this.addControl( + new Jr({ customAttribution: e.customAttribution }), + ), + e.maplibreLogo && this.addControl(new Qr(), e.logoPosition), + this.on('style.load', function () { + o.transform.unmodified && o.jumpTo(o.style.stylesheet); + }), + this.on('data', function (e) { + o._update('style' === e.dataType), + o.fire(new t.Event(e.dataType + 'data', e)); + }), + this.on('dataloading', function (e) { + o.fire(new t.Event(e.dataType + 'dataloading', e)); + }), + this.on('dataabort', function (e) { + o.fire(new t.Event('sourcedataabort', e)); + }); + } + i && (r.__proto__ = i), + ((r.prototype = Object.create(i && i.prototype)).constructor = r); + var o = { + showTileBoundaries: { configurable: !0 }, + showPadding: { configurable: !0 }, + showCollisionBoxes: { configurable: !0 }, + showOverdrawInspector: { configurable: !0 }, + repaint: { configurable: !0 }, + vertices: { configurable: !0 }, + version: { configurable: !0 }, + }; + return ( + (r.prototype._getMapId = function () { + return this._mapId; + }), + (r.prototype.addControl = function (e, i) { + if ( + (void 0 === i && + (i = e.getDefaultPosition + ? e.getDefaultPosition() + : 'top-right'), + !e || !e.onAdd) + ) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.', + ), + ), + ); + var r = e.onAdd(this); + this._controls.push(e); + var o = this._controlPositions[i]; + return ( + -1 !== i.indexOf('bottom') + ? o.insertBefore(r, o.firstChild) + : o.appendChild(r), + this + ); + }), + (r.prototype.removeControl = function (e) { + if (!e || !e.onRemove) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.', + ), + ), + ); + var i = this._controls.indexOf(e); + return ( + i > -1 && this._controls.splice(i, 1), e.onRemove(this), this + ); + }), + (r.prototype.hasControl = function (t) { + return this._controls.indexOf(t) > -1; + }), + (r.prototype.calculateCameraOptionsFromTo = function (t, e, r, o) { + return ( + null == o && + this.style.terrain && + (o = this.transform.getElevation(r, this.style.terrain)), + i.prototype.calculateCameraOptionsFromTo.call(this, t, e, r, o) + ); + }), + (r.prototype.resize = function (e) { + var i = this._containerDimensions(), + r = i[0], + o = i[1]; + this._resizeCanvas(r, o, this.getPixelRatio()), + this.transform.resize(r, o), + this.painter.resize(r, o, this.getPixelRatio()); + var a = !this._moving; + return ( + a && + (this.stop(), + this.fire(new t.Event('movestart', e)).fire( + new t.Event('move', e), + )), + this.fire(new t.Event('resize', e)), + a && this.fire(new t.Event('moveend', e)), + this + ); + }), + (r.prototype.getPixelRatio = function () { + return this._pixelRatio; + }), + (r.prototype.setPixelRatio = function (t) { + var e = this._containerDimensions(), + i = e[0], + r = e[1]; + (this._pixelRatio = t), + this._resizeCanvas(i, r, t), + this.painter.resize(i, r, t); + }), + (r.prototype.getBounds = function () { + return this.transform.getBounds(); + }), + (r.prototype.getMaxBounds = function () { + return this.transform.getMaxBounds(); + }), + (r.prototype.setMaxBounds = function (e) { + return ( + this.transform.setMaxBounds(t.LngLatBounds.convert(e)), + this._update() + ); + }), + (r.prototype.setMinZoom = function (t) { + if ((t = null == t ? -2 : t) >= -2 && t <= this.transform.maxZoom) + return ( + (this.transform.minZoom = t), + this._update(), + this.getZoom() < t && this.setZoom(t), + this + ); + throw new Error( + 'minZoom must be between -2 and the current maxZoom, inclusive', + ); + }), + (r.prototype.getMinZoom = function () { + return this.transform.minZoom; + }), + (r.prototype.setMaxZoom = function (t) { + if ((t = null == t ? 22 : t) >= this.transform.minZoom) + return ( + (this.transform.maxZoom = t), + this._update(), + this.getZoom() > t && this.setZoom(t), + this + ); + throw new Error('maxZoom must be greater than the current minZoom'); + }), + (r.prototype.getMaxZoom = function () { + return this.transform.maxZoom; + }), + (r.prototype.setMinPitch = function (t) { + if ((t = null == t ? 0 : t) < 0) + throw new Error('minPitch must be greater than or equal to 0'); + if (t >= 0 && t <= this.transform.maxPitch) + return ( + (this.transform.minPitch = t), + this._update(), + this.getPitch() < t && this.setPitch(t), + this + ); + throw new Error( + 'minPitch must be between 0 and the current maxPitch, inclusive', + ); + }), + (r.prototype.getMinPitch = function () { + return this.transform.minPitch; + }), + (r.prototype.setMaxPitch = function (t) { + if ((t = null == t ? 60 : 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 + ); + throw new Error( + 'maxPitch must be greater than the current minPitch', + ); + }), + (r.prototype.getMaxPitch = function () { + return this.transform.maxPitch; + }), + (r.prototype.getRenderWorldCopies = function () { + return this.transform.renderWorldCopies; + }), + (r.prototype.setRenderWorldCopies = function (t) { + return (this.transform.renderWorldCopies = t), this._update(); + }), + (r.prototype.project = function (e) { + return this.transform.locationPoint( + t.LngLat.convert(e), + this.style && this.style.terrain, + ); + }), + (r.prototype.unproject = function (e) { + return this.transform.pointLocation( + t.pointGeometry.convert(e), + this.style && this.style.terrain, + ); + }), + (r.prototype.isMoving = function () { + return this._moving || this.handlers.isMoving(); + }), + (r.prototype.isZooming = function () { + return this._zooming || this.handlers.isZooming(); + }), + (r.prototype.isRotating = function () { + return this._rotating || this.handlers.isRotating(); + }), + (r.prototype._createDelegatedListener = function (t, e, i) { + var r, + o = this; + if ('mouseenter' === t || 'mouseover' === t) { + var a = !1; + return { + layer: e, + listener: i, + delegates: { + mousemove: function (r) { + var n = o.getLayer(e) + ? o.queryRenderedFeatures(r.point, { layers: [e] }) + : []; + n.length + ? a || + ((a = !0), + i.call( + o, + new ur(t, o, r.originalEvent, { features: n }), + )) + : (a = !1); + }, + mouseout: function () { + a = !1; + }, + }, + }; + } + if ('mouseleave' === t || 'mouseout' === t) { + var n = !1; + return { + layer: e, + listener: i, + delegates: { + mousemove: function (r) { + (o.getLayer(e) + ? o.queryRenderedFeatures(r.point, { layers: [e] }) + : [] + ).length + ? (n = !0) + : n && + ((n = !1), i.call(o, new ur(t, o, r.originalEvent))); + }, + mouseout: function (e) { + n && ((n = !1), i.call(o, new ur(t, o, e.originalEvent))); + }, + }, + }; + } + return { + layer: e, + listener: i, + delegates: + ((r = {}), + (r[t] = function (t) { + var r = o.getLayer(e) + ? o.queryRenderedFeatures(t.point, { layers: [e] }) + : []; + r.length && + ((t.features = r), i.call(o, t), delete t.features); + }), + r), + }; + }), + (r.prototype.on = function (t, e, r) { + if (void 0 === r) return i.prototype.on.call(this, t, e); + var o = this._createDelegatedListener(t, e, r); + for (var a in ((this._delegatedListeners = + this._delegatedListeners || {}), + (this._delegatedListeners[t] = this._delegatedListeners[t] || []), + this._delegatedListeners[t].push(o), + o.delegates)) + this.on(a, o.delegates[a]); + return this; + }), + (r.prototype.once = function (t, e, r) { + if (void 0 === r) return i.prototype.once.call(this, t, e); + var o = this._createDelegatedListener(t, e, r); + for (var a in o.delegates) this.once(a, o.delegates[a]); + return this; + }), + (r.prototype.off = function (t, e, r) { + var o = this; + return void 0 === r + ? i.prototype.off.call(this, t, e) + : (this._delegatedListeners && + this._delegatedListeners[t] && + (function (i) { + for (var a = i[t], n = 0; n < a.length; n++) { + var s = a[n]; + if (s.layer === e && s.listener === r) { + for (var l in s.delegates) o.off(l, s.delegates[l]); + return a.splice(n, 1), o; + } + } + })(this._delegatedListeners), + this); + }), + (r.prototype.queryRenderedFeatures = function (e, i) { + if (!this.style) return []; + var r; + if ( + (void 0 !== i || + void 0 === e || + e instanceof t.pointGeometry || + Array.isArray(e) || + ((i = e), (e = void 0)), + (i = i || {}), + (e = e || [ + [0, 0], + [this.transform.width, this.transform.height], + ]) instanceof t.pointGeometry || 'number' == typeof e[0]) + ) + r = [t.pointGeometry.convert(e)]; + else { + var o = t.pointGeometry.convert(e[0]), + a = t.pointGeometry.convert(e[1]); + r = [ + o, + new t.pointGeometry(a.x, o.y), + a, + new t.pointGeometry(o.x, a.y), + o, + ]; + } + return this.style.queryRenderedFeatures(r, i, this.transform); + }), + (r.prototype.querySourceFeatures = function (t, e) { + return this.style.querySourceFeatures(t, e); + }), + (r.prototype.setStyle = function (e, i) { + return !1 !== + (i = t.extend( + {}, + { localIdeographFontFamily: this._localIdeographFontFamily }, + i, + )).diff && + i.localIdeographFontFamily === this._localIdeographFontFamily && + this.style && + e + ? (this._diffStyle(e, i), this) + : ((this._localIdeographFontFamily = i.localIdeographFontFamily), + this._updateStyle(e, i)); + }), + (r.prototype.setTransformRequest = function (t) { + return this._requestManager.setTransformRequest(t), this; + }), + (r.prototype._getUIString = function (t) { + var e = this._locale[t]; + if (null == e) throw new Error("Missing UI string '" + t + "'"); + return e; + }), + (r.prototype._updateStyle = function (t, e) { + return ( + this.style && + (this.style.setEventedParent(null), this.style._remove()), + t + ? ((this.style = new ie(this, e || {})), + this.style.setEventedParent(this, { style: this.style }), + 'string' == typeof t + ? this.style.loadURL(t) + : this.style.loadJSON(t), + this) + : (delete this.style, this) + ); + }), + (r.prototype._lazyInitEmptyStyle = function () { + this.style || + ((this.style = new ie(this, {})), + this.style.setEventedParent(this, { style: this.style }), + this.style.loadEmpty()); + }), + (r.prototype._diffStyle = function (e, i) { + var r = this; + if ('string' == typeof e) { + var o = this._requestManager.transformRequest( + e, + t.ResourceType.Style, + ); + t.getJSON(o, function (e, o) { + e ? r.fire(new t.ErrorEvent(e)) : o && r._updateDiff(o, i); + }); + } else 'object' == typeof e && this._updateDiff(e, i); + }), + (r.prototype._updateDiff = function (e, i) { + try { + this.style.setState(e) && this._update(!0); + } catch (r) { + t.warnOnce( + 'Unable to perform style diff: ' + + (r.message || r.error || r) + + '. Rebuilding the style from scratch.', + ), + this._updateStyle(e, i); + } + }), + (r.prototype.getStyle = function () { + if (this.style) return this.style.serialize(); + }), + (r.prototype.isStyleLoaded = function () { + return this.style + ? this.style.loaded() + : t.warnOnce('There is no style added to the map.'); + }), + (r.prototype.addSource = function (t, e) { + return ( + this._lazyInitEmptyStyle(), + this.style.addSource(t, e), + this._update(!0) + ); + }), + (r.prototype.isSourceLoaded = function (e) { + var i = this.style && this.style.sourceCaches[e]; + if (void 0 !== i) return i.loaded(); + this.fire( + new t.ErrorEvent( + new Error("There is no source with ID '" + e + "'"), + ), + ); + }), + (r.prototype.setTerrain = function (t) { + return this.style.setTerrain(t), this; + }), + (r.prototype.getTerrain = function () { + return this.style.terrain && this.style.terrain.options; + }), + (r.prototype.areTilesLoaded = function () { + var t = this.style && this.style.sourceCaches; + for (var e in t) { + var i = t[e]._tiles; + for (var r in i) { + var o = i[r]; + if ('loaded' !== o.state && 'errored' !== o.state) return !1; + } + } + return !0; + }), + (r.prototype.addSourceType = function (t, e, i) { + return ( + this._lazyInitEmptyStyle(), this.style.addSourceType(t, e, i) + ); + }), + (r.prototype.removeSource = function (t) { + return this.style.removeSource(t), this._update(!0); + }), + (r.prototype.getSource = function (t) { + return this.style.getSource(t); + }), + (r.prototype.addImage = function (e, i, r) { + void 0 === r && (r = {}); + var o = r.pixelRatio; + void 0 === o && (o = 1); + var a = r.sdf; + void 0 === a && (a = !1); + var n = r.stretchX, + s = r.stretchY, + l = r.content; + if ( + (this._lazyInitEmptyStyle(), + i instanceof HTMLImageElement || t.isImageBitmap(i)) + ) { + var c = t.exported.getImageData(i); + this.style.addImage(e, { + data: new t.RGBAImage( + { width: c.width, height: c.height }, + c.data, + ), + pixelRatio: o, + stretchX: n, + stretchY: s, + content: l, + sdf: a, + version: 0, + }); + } else { + if (void 0 === i.width || void 0 === i.height) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`', + ), + ), + ); + var h = i; + this.style.addImage(e, { + data: new t.RGBAImage( + { width: i.width, height: i.height }, + new Uint8Array(i.data), + ), + pixelRatio: o, + stretchX: n, + stretchY: s, + content: l, + sdf: a, + version: 0, + userImage: h, + }), + h.onAdd && h.onAdd(this, e); + } + }), + (r.prototype.updateImage = function (e, i) { + var r = this.style.getImage(e); + if (!r) + return this.fire( + new t.ErrorEvent( + new Error( + 'The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.', + ), + ), + ); + var o = + i instanceof HTMLImageElement || t.isImageBitmap(i) + ? t.exported.getImageData(i) + : i, + a = o.width, + n = o.height, + s = o.data; + if (void 0 === a || void 0 === n) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`', + ), + ), + ); + if (a !== r.data.width || n !== r.data.height) + return this.fire( + new t.ErrorEvent( + new Error( + 'The width and height of the updated image must be that same as the previous version of the image', + ), + ), + ); + var l = !(i instanceof HTMLImageElement || t.isImageBitmap(i)); + r.data.replace(s, l), this.style.updateImage(e, r); + }), + (r.prototype.hasImage = function (e) { + return e + ? !!this.style.getImage(e) + : (this.fire( + new t.ErrorEvent(new Error('Missing required image id')), + ), + !1); + }), + (r.prototype.removeImage = function (t) { + this.style.removeImage(t); + }), + (r.prototype.loadImage = function (e, i) { + t.getImage( + this._requestManager.transformRequest(e, t.ResourceType.Image), + i, + ); + }), + (r.prototype.listImages = function () { + return this.style.listImages(); + }), + (r.prototype.addLayer = function (t, e) { + return ( + this._lazyInitEmptyStyle(), + this.style.addLayer(t, e), + this._update(!0) + ); + }), + (r.prototype.moveLayer = function (t, e) { + return this.style.moveLayer(t, e), this._update(!0); + }), + (r.prototype.removeLayer = function (t) { + return this.style.removeLayer(t), this._update(!0); + }), + (r.prototype.getLayer = function (t) { + return this.style.getLayer(t); + }), + (r.prototype.setLayerZoomRange = function (t, e, i) { + return this.style.setLayerZoomRange(t, e, i), this._update(!0); + }), + (r.prototype.setFilter = function (t, e, i) { + return ( + void 0 === i && (i = {}), + this.style.setFilter(t, e, i), + this._update(!0) + ); + }), + (r.prototype.getFilter = function (t) { + return this.style.getFilter(t); + }), + (r.prototype.setPaintProperty = function (t, e, i, r) { + return ( + void 0 === r && (r = {}), + this.style.setPaintProperty(t, e, i, r), + this._update(!0) + ); + }), + (r.prototype.getPaintProperty = function (t, e) { + return this.style.getPaintProperty(t, e); + }), + (r.prototype.setLayoutProperty = function (t, e, i, r) { + return ( + void 0 === r && (r = {}), + this.style.setLayoutProperty(t, e, i, r), + this._update(!0) + ); + }), + (r.prototype.getLayoutProperty = function (t, e) { + return this.style.getLayoutProperty(t, e); + }), + (r.prototype.setLight = function (t, e) { + return ( + void 0 === e && (e = {}), + this._lazyInitEmptyStyle(), + this.style.setLight(t, e), + this._update(!0) + ); + }), + (r.prototype.getLight = function () { + return this.style.getLight(); + }), + (r.prototype.setFeatureState = function (t, e) { + return this.style.setFeatureState(t, e), this._update(); + }), + (r.prototype.removeFeatureState = function (t, e) { + return this.style.removeFeatureState(t, e), this._update(); + }), + (r.prototype.getFeatureState = function (t) { + return this.style.getFeatureState(t); + }), + (r.prototype.getContainer = function () { + return this._container; + }), + (r.prototype.getCanvasContainer = function () { + return this._canvasContainer; + }), + (r.prototype.getCanvas = function () { + return this._canvas; + }), + (r.prototype._containerDimensions = function () { + var t = 0, + e = 0; + return ( + this._container && + ((t = this._container.clientWidth || 400), + (e = this._container.clientHeight || 300)), + [t, e] + ); + }), + (r.prototype._setupContainer = function () { + var t = this._container; + t.classList.add('maplibregl-map', 'mapboxgl-map'); + var e = (this._canvasContainer = a.create( + 'div', + 'maplibregl-canvas-container mapboxgl-canvas-container', + t, + )); + this._interactive && + e.classList.add('maplibregl-interactive', 'mapboxgl-interactive'), + (this._canvas = a.create( + 'canvas', + 'maplibregl-canvas mapboxgl-canvas', + e, + )), + this._canvas.addEventListener( + 'webglcontextlost', + this._contextLost, + !1, + ), + this._canvas.addEventListener( + 'webglcontextrestored', + this._contextRestored, + !1, + ), + this._canvas.setAttribute('tabindex', '0'), + this._canvas.setAttribute('aria-label', 'Map'), + this._canvas.setAttribute('role', 'region'); + var i = this._containerDimensions(); + this._resizeCanvas(i[0], i[1], this.getPixelRatio()); + var r = (this._controlContainer = a.create( + 'div', + 'maplibregl-control-container mapboxgl-control-container', + t, + )), + o = (this._controlPositions = {}); + ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach( + function (t) { + o[t] = a.create( + 'div', + 'maplibregl-ctrl-' + t + ' mapboxgl-ctrl-' + t, + r, + ); + }, + ), + this._container.addEventListener('scroll', this._onMapScroll, !1); + }), + (r.prototype._setupCooperativeGestures = function () { + var t = this, + e = this._container; + (this._metaPress = !1), + (this._cooperativeGesturesScreen = a.create( + 'div', + 'maplibregl-cooperative-gesture-screen', + e, + )); + var i = 'Control', + r = + 'boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.windowsHelpText + ? this._cooperativeGestures.windowsHelpText + : 'Use Ctrl + scroll to zoom the map'; + 0 === navigator.platform.indexOf('Mac') && + ((r = + 'boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.macHelpText + ? this._cooperativeGestures.macHelpText + : 'Use ⌘ + scroll to zoom the map'), + (i = 'Meta')), + (this._cooperativeGesturesScreen.innerHTML = + '\n
' + + r + + '
\n
' + + ('boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.mobileHelpText + ? this._cooperativeGestures.mobileHelpText + : 'Use two fingers to move the map') + + '
\n '), + document.addEventListener('keydown', function (e) { + e.key === i && (t._metaPress = !0); + }), + document.addEventListener('keyup', function (e) { + e.key === i && (t._metaPress = !1); + }), + this._canvasContainer.addEventListener( + 'wheel', + function (e) { + t._onCooperativeGesture(e, t._metaPress, 1); + }, + !1, + ), + this._canvasContainer.classList.remove( + 'mapboxgl-touch-drag-pan', + 'maplibregl-touch-drag-pan', + ); + }), + (r.prototype._resizeCanvas = function (t, e, i) { + (this._canvas.width = i * t), + (this._canvas.height = i * e), + (this._canvas.style.width = t + 'px'), + (this._canvas.style.height = e + 'px'); + }), + (r.prototype._setupPainter = function () { + var i = t.extend({}, e.webGLContextAttributes, { + failIfMajorPerformanceCaveat: + this._failIfMajorPerformanceCaveat, + preserveDrawingBuffer: this._preserveDrawingBuffer, + antialias: this._antialias || !1, + }), + r = + this._canvas.getContext('webgl', i) || + this._canvas.getContext('experimental-webgl', i); + r + ? ((this.painter = new Yi(r, this.transform)), + t.exported$1.testSupport(r)) + : this.fire( + new t.ErrorEvent(new Error('Failed to initialize WebGL')), + ); + }), + (r.prototype._contextLost = function (e) { + e.preventDefault(), + this._frame && (this._frame.cancel(), (this._frame = null)), + this.fire(new t.Event('webglcontextlost', { originalEvent: e })); + }), + (r.prototype._contextRestored = function (e) { + this._setupPainter(), + this.resize(), + this._update(), + this.fire( + new t.Event('webglcontextrestored', { originalEvent: e }), + ); + }), + (r.prototype._onMapScroll = function (t) { + if (t.target === this._container) + return ( + (this._container.scrollTop = 0), + (this._container.scrollLeft = 0), + !1 + ); + }), + (r.prototype._onCooperativeGesture = function (t, e, i) { + var r = this; + return ( + !e && + i < 2 && + (this._cooperativeGesturesScreen.classList.add( + 'maplibregl-show', + ), + setTimeout(function () { + r._cooperativeGesturesScreen.classList.remove( + 'maplibregl-show', + ); + }, 100)), + !1 + ); + }), + (r.prototype.loaded = function () { + return ( + !this._styleDirty && + !this._sourcesDirty && + !!this.style && + this.style.loaded() + ); + }), + (r.prototype._update = function (t) { + return this.style + ? ((this._styleDirty = this._styleDirty || t), + (this._sourcesDirty = !0), + this.triggerRepaint(), + this) + : this; + }), + (r.prototype._requestRenderFrame = function (t) { + return this._update(), this._renderTaskQueue.add(t); + }), + (r.prototype._cancelRenderFrame = function (t) { + this._renderTaskQueue.remove(t); + }), + (r.prototype._render = function (e) { + var i, + r = this, + o = 0, + a = this.painter.context.extTimerQuery; + if ( + (this.listens('gpu-timing-frame') && + ((i = a.createQueryEXT()), + a.beginQueryEXT(a.TIME_ELAPSED_EXT, i), + (o = t.exported.now())), + this.painter.context.setDirty(), + this.painter.setBaseState(), + this._renderTaskQueue.run(e), + !this._removed) + ) { + var n = !1; + if (this.style && this._styleDirty) { + this._styleDirty = !1; + var s = this.transform.zoom, + l = t.exported.now(); + this.style.zoomHistory.update(s, l); + var c = new t.EvaluationParameters(s, { + now: l, + fadeDuration: this._fadeDuration, + zoomHistory: this.style.zoomHistory, + transition: this.style.getTransition(), + }), + h = c.crossFadingFactor(); + (1 === h && h === this._crossFadingFactor) || + ((n = !0), (this._crossFadingFactor = h)), + this.style.update(c); + } + if ( + (this.style && + this._sourcesDirty && + ((this._sourcesDirty = !1), + this.style._updateSources(this.transform)), + this.style.terrain && + this.style.terrain.sourceCache.update( + this.transform, + this.style.terrain, + ), + this.transform.updateElevation(this.style.terrain), + (this._placementDirty = + this.style && + this.style._updatePlacement( + this.painter.transform, + this.showCollisionBoxes, + this._fadeDuration, + this._crossSourceCollisions, + )), + this.painter.render(this.style, { + showTileBoundaries: this.showTileBoundaries, + showOverdrawInspector: this._showOverdrawInspector, + rotating: this.isRotating(), + zooming: this.isZooming(), + moving: this.isMoving(), + fadeDuration: this._fadeDuration, + showPadding: this.showPadding, + gpuTiming: !!this.listens('gpu-timing-layer'), + }), + this.fire(new t.Event('render')), + this.loaded() && + !this._loaded && + ((this._loaded = !0), + t.PerformanceUtils.mark(t.PerformanceMarkers.load), + this.fire(new t.Event('load'))), + this.style && + (this.style.hasTransitions() || n) && + (this._styleDirty = !0), + this.style && + !this._placementDirty && + this.style._releaseSymbolFadeTiles(), + this.listens('gpu-timing-frame')) + ) { + var u = t.exported.now() - o; + a.endQueryEXT(a.TIME_ELAPSED_EXT, i), + setTimeout(function () { + var e = a.getQueryObjectEXT(i, a.QUERY_RESULT_EXT) / 1e6; + a.deleteQueryEXT(i), + r.fire( + new t.Event('gpu-timing-frame', { + cpuTime: u, + gpuTime: e, + }), + ); + }, 50); + } + if (this.listens('gpu-timing-layer')) { + var p = this.painter.collectGpuTimers(); + setTimeout(function () { + var e = r.painter.queryGpuTimers(p); + r.fire(new t.Event('gpu-timing-layer', { layerTimes: e })); + }, 50); + } + var d = + this._sourcesDirty || this._styleDirty || this._placementDirty; + return ( + d || this._repaint + ? this.triggerRepaint() + : !this.isMoving() && + this.loaded() && + this.fire(new t.Event('idle')), + !this._loaded || + this._fullyLoaded || + d || + ((this._fullyLoaded = !0), + t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)), + this + ); + } + }), + (r.prototype.redraw = function () { + return ( + this.style && + (this._frame && (this._frame.cancel(), (this._frame = null)), + this._render(0)), + this + ); + }), + (r.prototype.remove = function () { + this._hash && this._hash.remove(); + for (var e = 0, i = this._controls; e < i.length; e += 1) + i[e].onRemove(this); + (this._controls = []), + this._frame && (this._frame.cancel(), (this._frame = null)), + this._renderTaskQueue.clear(), + this.painter.destroy(), + this.handlers.destroy(), + delete this.handlers, + this.setStyle(null), + 'undefined' != typeof window && + (removeEventListener('resize', this._onWindowResize, !1), + removeEventListener( + 'orientationchange', + this._onWindowResize, + !1, + ), + removeEventListener('online', this._onWindowOnline, !1)); + var r = this.painter.context.gl.getExtension('WEBGL_lose_context'); + r && r.loseContext(), + this._canvas.removeEventListener( + 'webglcontextrestored', + this._contextRestored, + !1, + ), + this._canvas.removeEventListener( + 'webglcontextlost', + this._contextLost, + !1, + ), + a.remove(this._canvasContainer), + a.remove(this._controlContainer), + this._cooperativeGestures && + a.remove(this._cooperativeGesturesScreen), + this._container.classList.remove( + 'maplibregl-map', + 'mapboxgl-map', + ), + t.PerformanceUtils.clearMetrics(), + (this._removed = !0), + this.fire(new t.Event('remove')); + }), + (r.prototype.triggerRepaint = function () { + var e = this; + this.style && + !this._frame && + (this._frame = t.exported.frame(function (i) { + t.PerformanceUtils.frame(i), (e._frame = null), e._render(i); + })); + }), + (r.prototype._onWindowOnline = function () { + this._update(); + }), + (r.prototype._onWindowResize = function (t) { + this._trackResize && this.resize({ originalEvent: t })._update(); + }), + (o.showTileBoundaries.get = function () { + return !!this._showTileBoundaries; + }), + (o.showTileBoundaries.set = function (t) { + this._showTileBoundaries !== t && + ((this._showTileBoundaries = t), this._update()); + }), + (o.showPadding.get = function () { + return !!this._showPadding; + }), + (o.showPadding.set = function (t) { + this._showPadding !== t && + ((this._showPadding = t), this._update()); + }), + (o.showCollisionBoxes.get = function () { + return !!this._showCollisionBoxes; + }), + (o.showCollisionBoxes.set = function (t) { + this._showCollisionBoxes !== t && + ((this._showCollisionBoxes = t), + t ? this.style._generateCollisionBoxes() : this._update()); + }), + (o.showOverdrawInspector.get = function () { + return !!this._showOverdrawInspector; + }), + (o.showOverdrawInspector.set = function (t) { + this._showOverdrawInspector !== t && + ((this._showOverdrawInspector = t), this._update()); + }), + (o.repaint.get = function () { + return !!this._repaint; + }), + (o.repaint.set = function (t) { + this._repaint !== t && ((this._repaint = t), this.triggerRepaint()); + }), + (o.vertices.get = function () { + return !!this._vertices; + }), + (o.vertices.set = function (t) { + (this._vertices = t), this._update(); + }), + (r.prototype._setCacheLimits = function (e, i) { + t.setCacheLimits(e, i); + }), + (o.version.get = function () { + return '2.4.0'; + }), + Object.defineProperties(r.prototype, o), + r + ); + })(Yr), + ro = { showCompass: !0, showZoom: !0, visualizePitch: !1 }, + oo = function (e) { + var i = this; + (this.options = t.extend({}, ro, e)), + (this._container = a.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + this._container.addEventListener('contextmenu', function (t) { + return t.preventDefault(); + }), + this.options.showZoom && + (t.bindAll(['_setButtonTitle', '_updateZoomButtons'], this), + (this._zoomInButton = this._createButton( + 'maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in', + function (t) { + return i._map.zoomIn({}, { originalEvent: t }); + }, + )), + a + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._zoomInButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._zoomOutButton = this._createButton( + 'maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out', + function (t) { + return i._map.zoomOut({}, { originalEvent: t }); + }, + )), + a + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._zoomOutButton, + ) + .setAttribute('aria-hidden', 'true')), + this.options.showCompass && + (t.bindAll(['_rotateCompassArrow'], this), + (this._compass = this._createButton( + 'maplibregl-ctrl-compass mapboxgl-ctrl-compass', + function (t) { + i.options.visualizePitch + ? i._map.resetNorthPitch({}, { originalEvent: t }) + : i._map.resetNorth({}, { originalEvent: t }); + }, + )), + (this._compassIcon = a.create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._compass, + )), + this._compassIcon.setAttribute('aria-hidden', 'true')); + }; + (oo.prototype._updateZoomButtons = function () { + var t = this._map.getZoom(), + e = t === this._map.getMaxZoom(), + i = t === this._map.getMinZoom(); + (this._zoomInButton.disabled = e), + (this._zoomOutButton.disabled = i), + this._zoomInButton.setAttribute('aria-disabled', e.toString()), + this._zoomOutButton.setAttribute('aria-disabled', i.toString()); + }), + (oo.prototype._rotateCompassArrow = function () { + var t = this.options.visualizePitch + ? 'scale(' + + 1 / + Math.pow( + Math.cos(this._map.transform.pitch * (Math.PI / 180)), + 0.5, + ) + + ') rotateX(' + + this._map.transform.pitch + + 'deg) rotateZ(' + + this._map.transform.angle * (180 / Math.PI) + + 'deg)' + : 'rotate(' + this._map.transform.angle * (180 / Math.PI) + 'deg)'; + this._compassIcon.style.transform = t; + }), + (oo.prototype.onAdd = function (t) { + return ( + (this._map = t), + this.options.showZoom && + (this._setButtonTitle(this._zoomInButton, 'ZoomIn'), + this._setButtonTitle(this._zoomOutButton, 'ZoomOut'), + this._map.on('zoom', this._updateZoomButtons), + this._updateZoomButtons()), + this.options.showCompass && + (this._setButtonTitle(this._compass, 'ResetBearing'), + this.options.visualizePitch && + this._map.on('pitch', this._rotateCompassArrow), + this._map.on('rotate', this._rotateCompassArrow), + this._rotateCompassArrow(), + (this._handler = new ao( + this._map, + this._compass, + this.options.visualizePitch, + ))), + this._container + ); + }), + (oo.prototype.onRemove = function () { + a.remove(this._container), + this.options.showZoom && + this._map.off('zoom', this._updateZoomButtons), + this.options.showCompass && + (this.options.visualizePitch && + this._map.off('pitch', this._rotateCompassArrow), + this._map.off('rotate', this._rotateCompassArrow), + this._handler.off(), + delete this._handler), + delete this._map; + }), + (oo.prototype._createButton = function (t, e) { + var i = a.create('button', t, this._container); + return (i.type = 'button'), i.addEventListener('click', e), i; + }), + (oo.prototype._setButtonTitle = function (t, e) { + var i = this._map._getUIString('NavigationControl.' + e); + (t.title = i), t.setAttribute('aria-label', i); + }); + var ao = function (e, i, r) { + void 0 === r && (r = !1), + (this._clickTolerance = 10), + (this.element = i), + (this.mouseRotate = new Er({ + clickTolerance: e.dragRotate._mouseRotate._clickTolerance, + })), + (this.map = e), + r && + (this.mousePitch = new Ir({ + clickTolerance: e.dragRotate._mousePitch._clickTolerance, + })), + t.bindAll( + [ + 'mousedown', + 'mousemove', + 'mouseup', + 'touchstart', + 'touchmove', + 'touchend', + 'reset', + ], + this, + ), + a.addEventListener(i, 'mousedown', this.mousedown), + a.addEventListener(i, 'touchstart', this.touchstart, { passive: !1 }), + a.addEventListener(i, 'touchmove', this.touchmove), + a.addEventListener(i, 'touchend', this.touchend), + a.addEventListener(i, 'touchcancel', this.reset); + }; + function no(e, i, r) { + if (((e = new t.LngLat(e.lng, e.lat)), i)) { + var o = new t.LngLat(e.lng - 360, e.lat), + a = new t.LngLat(e.lng + 360, e.lat), + n = r.locationPoint(e).distSqr(i); + r.locationPoint(o).distSqr(i) < n + ? (e = o) + : r.locationPoint(a).distSqr(i) < n && (e = a); + } + for (; Math.abs(e.lng - r.center.lng) > 180; ) { + var s = r.locationPoint(e); + if (s.x >= 0 && s.y >= 0 && s.x <= r.width && s.y <= r.height) break; + e.lng > r.center.lng ? (e.lng -= 360) : (e.lng += 360); + } + return e; + } + (ao.prototype.down = function (t, e) { + this.mouseRotate.mousedown(t, e), + this.mousePitch && this.mousePitch.mousedown(t, e), + a.disableDrag(); + }), + (ao.prototype.move = function (t, e) { + var i = this.map, + r = this.mouseRotate.mousemoveWindow(t, e); + if ( + (r && r.bearingDelta && i.setBearing(i.getBearing() + r.bearingDelta), + this.mousePitch) + ) { + var o = this.mousePitch.mousemoveWindow(t, e); + o && o.pitchDelta && i.setPitch(i.getPitch() + o.pitchDelta); + } + }), + (ao.prototype.off = function () { + var t = this.element; + a.removeEventListener(t, 'mousedown', this.mousedown), + a.removeEventListener(t, 'touchstart', this.touchstart, { + passive: !1, + }), + a.removeEventListener(t, 'touchmove', this.touchmove), + a.removeEventListener(t, 'touchend', this.touchend), + a.removeEventListener(t, 'touchcancel', this.reset), + this.offTemp(); + }), + (ao.prototype.offTemp = function () { + a.enableDrag(), + a.removeEventListener(window, 'mousemove', this.mousemove), + a.removeEventListener(window, 'mouseup', this.mouseup); + }), + (ao.prototype.mousedown = function (e) { + this.down( + t.extend({}, e, { + ctrlKey: !0, + preventDefault: function () { + return e.preventDefault(); + }, + }), + a.mousePos(this.element, e), + ), + a.addEventListener(window, 'mousemove', this.mousemove), + a.addEventListener(window, 'mouseup', this.mouseup); + }), + (ao.prototype.mousemove = function (t) { + this.move(t, a.mousePos(this.element, t)); + }), + (ao.prototype.mouseup = function (t) { + this.mouseRotate.mouseupWindow(t), + this.mousePitch && this.mousePitch.mouseupWindow(t), + this.offTemp(); + }), + (ao.prototype.touchstart = function (t) { + 1 !== t.targetTouches.length + ? this.reset() + : ((this._startPos = this._lastPos = + a.touchPos(this.element, t.targetTouches)[0]), + this.down( + { + type: 'mousedown', + button: 0, + ctrlKey: !0, + preventDefault: function () { + return t.preventDefault(); + }, + }, + this._startPos, + )); + }), + (ao.prototype.touchmove = function (t) { + 1 !== t.targetTouches.length + ? this.reset() + : ((this._lastPos = a.touchPos(this.element, t.targetTouches)[0]), + this.move( + { + preventDefault: function () { + return t.preventDefault(); + }, + }, + this._lastPos, + )); + }), + (ao.prototype.touchend = function (t) { + 0 === t.targetTouches.length && + this._startPos && + this._lastPos && + this._startPos.dist(this._lastPos) < this._clickTolerance && + this.element.click(), + this.reset(); + }), + (ao.prototype.reset = function () { + this.mouseRotate.reset(), + this.mousePitch && this.mousePitch.reset(), + delete this._startPos, + delete this._lastPos, + this.offTemp(); + }); + var so = { + center: 'translate(-50%,-50%)', + top: 'translate(-50%,0)', + 'top-left': 'translate(0,0)', + 'top-right': 'translate(-100%,0)', + bottom: 'translate(-50%,-100%)', + 'bottom-left': 'translate(0,-100%)', + 'bottom-right': 'translate(-100%,-100%)', + left: 'translate(0,-50%)', + right: 'translate(-100%,-50%)', + }; + function lo(t, e, i) { + var r = t.classList; + for (var o in so) + r.remove( + 'maplibregl-' + i + '-anchor-' + o, + 'mapboxgl-' + i + '-anchor-' + o, + ); + r.add( + 'maplibregl-' + i + '-anchor-' + e, + 'mapboxgl-' + i + '-anchor-' + e, + ); + } + var co, + ho = (function (e) { + function i(i, r) { + if ( + (e.call(this), + (i instanceof HTMLElement || r) && + (i = t.extend({ element: i }, r)), + t.bindAll( + [ + '_update', + '_onMove', + '_onUp', + '_addDragHandler', + '_onMapClick', + '_onKeyPress', + ], + this, + ), + (this._anchor = (i && i.anchor) || 'center'), + (this._color = (i && i.color) || '#3FB1CE'), + (this._scale = (i && i.scale) || 1), + (this._draggable = (i && i.draggable) || !1), + (this._clickTolerance = (i && i.clickTolerance) || 0), + (this._isDragging = !1), + (this._state = 'inactive'), + (this._rotation = (i && i.rotation) || 0), + (this._rotationAlignment = (i && i.rotationAlignment) || 'auto'), + (this._pitchAlignment = + i && i.pitchAlignment && 'auto' !== i.pitchAlignment + ? i.pitchAlignment + : this._rotationAlignment), + i && i.element) + ) + (this._element = i.element), + (this._offset = t.pointGeometry.convert( + (i && i.offset) || [0, 0], + )); + else { + (this._defaultMarker = !0), + (this._element = a.create('div')), + this._element.setAttribute('aria-label', 'Map marker'); + var o = a.createNS('http://www.w3.org/2000/svg', 'svg'); + o.setAttributeNS(null, 'display', 'block'), + o.setAttributeNS(null, 'height', '41px'), + o.setAttributeNS(null, 'width', '27px'), + o.setAttributeNS(null, 'viewBox', '0 0 27 41'); + var n = a.createNS('http://www.w3.org/2000/svg', 'g'); + n.setAttributeNS(null, 'stroke', 'none'), + n.setAttributeNS(null, 'stroke-width', '1'), + n.setAttributeNS(null, 'fill', 'none'), + n.setAttributeNS(null, 'fill-rule', 'evenodd'); + var s = a.createNS('http://www.w3.org/2000/svg', 'g'); + s.setAttributeNS(null, 'fill-rule', 'nonzero'); + var l = a.createNS('http://www.w3.org/2000/svg', 'g'); + l.setAttributeNS(null, 'transform', 'translate(3.0, 29.0)'), + l.setAttributeNS(null, 'fill', '#000000'); + for ( + var c = 0, + h = [ + { rx: '10.5', ry: '5.25002273' }, + { rx: '10.5', ry: '5.25002273' }, + { rx: '9.5', ry: '4.77275007' }, + { rx: '8.5', ry: '4.29549936' }, + { rx: '7.5', ry: '3.81822308' }, + { rx: '6.5', ry: '3.34094679' }, + { rx: '5.5', ry: '2.86367051' }, + { rx: '4.5', ry: '2.38636864' }, + ]; + c < h.length; + c += 1 + ) { + var u = h[c], + p = a.createNS('http://www.w3.org/2000/svg', 'ellipse'); + p.setAttributeNS(null, 'opacity', '0.04'), + p.setAttributeNS(null, 'cx', '10.5'), + p.setAttributeNS(null, 'cy', '5.80029008'), + p.setAttributeNS(null, 'rx', u.rx), + p.setAttributeNS(null, 'ry', u.ry), + l.appendChild(p); + } + var d = a.createNS('http://www.w3.org/2000/svg', 'g'); + d.setAttributeNS(null, 'fill', this._color); + var _ = a.createNS('http://www.w3.org/2000/svg', 'path'); + _.setAttributeNS( + null, + 'd', + 'M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z', + ), + d.appendChild(_); + var f = a.createNS('http://www.w3.org/2000/svg', 'g'); + f.setAttributeNS(null, 'opacity', '0.25'), + f.setAttributeNS(null, 'fill', '#000000'); + var m = a.createNS('http://www.w3.org/2000/svg', 'path'); + m.setAttributeNS( + null, + 'd', + 'M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z', + ), + f.appendChild(m); + var g = a.createNS('http://www.w3.org/2000/svg', 'g'); + g.setAttributeNS(null, 'transform', 'translate(6.0, 7.0)'), + g.setAttributeNS(null, 'fill', '#FFFFFF'); + var v = a.createNS('http://www.w3.org/2000/svg', 'g'); + v.setAttributeNS(null, 'transform', 'translate(8.0, 8.0)'); + var y = a.createNS('http://www.w3.org/2000/svg', 'circle'); + y.setAttributeNS(null, 'fill', '#000000'), + y.setAttributeNS(null, 'opacity', '0.25'), + y.setAttributeNS(null, 'cx', '5.5'), + y.setAttributeNS(null, 'cy', '5.5'), + y.setAttributeNS(null, 'r', '5.4999962'); + var x = a.createNS('http://www.w3.org/2000/svg', 'circle'); + x.setAttributeNS(null, 'fill', '#FFFFFF'), + x.setAttributeNS(null, 'cx', '5.5'), + x.setAttributeNS(null, 'cy', '5.5'), + x.setAttributeNS(null, 'r', '5.4999962'), + v.appendChild(y), + v.appendChild(x), + s.appendChild(l), + s.appendChild(d), + s.appendChild(f), + s.appendChild(g), + s.appendChild(v), + o.appendChild(s), + o.setAttributeNS(null, 'height', 41 * this._scale + 'px'), + o.setAttributeNS(null, 'width', 27 * this._scale + 'px'), + this._element.appendChild(o), + (this._offset = t.pointGeometry.convert( + (i && i.offset) || [0, -14], + )); + } + this._element.classList.add('maplibregl-marker', 'mapboxgl-marker'), + this._element.addEventListener('dragstart', function (t) { + t.preventDefault(); + }), + this._element.addEventListener('mousedown', function (t) { + t.preventDefault(); + }), + lo(this._element, this._anchor, 'marker'), + (this._popup = null); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.addTo = function (t) { + return ( + this.remove(), + (this._map = t), + t.getCanvasContainer().appendChild(this._element), + t.on('move', this._update), + t.on('moveend', this._update), + this.setDraggable(this._draggable), + this._update(), + this._map.on('click', this._onMapClick), + this + ); + }), + (i.prototype.remove = function () { + return ( + this._opacityTimeout && + (clearTimeout(this._opacityTimeout), + delete this._opacityTimeout), + this._map && + (this._map.off('click', this._onMapClick), + this._map.off('move', this._update), + this._map.off('moveend', this._update), + this._map.off('mousedown', this._addDragHandler), + this._map.off('touchstart', this._addDragHandler), + this._map.off('mouseup', this._onUp), + this._map.off('touchend', this._onUp), + this._map.off('mousemove', this._onMove), + this._map.off('touchmove', this._onMove), + delete this._map), + a.remove(this._element), + this._popup && this._popup.remove(), + this + ); + }), + (i.prototype.getLngLat = function () { + return this._lngLat; + }), + (i.prototype.setLngLat = function (e) { + return ( + (this._lngLat = t.LngLat.convert(e)), + (this._pos = null), + this._popup && this._popup.setLngLat(this._lngLat), + this._update(), + this + ); + }), + (i.prototype.getElement = function () { + return this._element; + }), + (i.prototype.setPopup = function (t) { + if ( + (this._popup && + (this._popup.remove(), + (this._popup = null), + this._element.removeEventListener('keypress', this._onKeyPress), + this._originalTabIndex || + this._element.removeAttribute('tabindex')), + t) + ) { + if (!('offset' in t.options)) { + var e = Math.sqrt(Math.pow(13.5, 2) / 2); + t.options.offset = this._defaultMarker + ? { + top: [0, 0], + 'top-left': [0, 0], + 'top-right': [0, 0], + bottom: [0, -38.1], + 'bottom-left': [e, -1 * (24.6 + e)], + 'bottom-right': [-e, -1 * (24.6 + e)], + left: [13.5, -24.6], + right: [-13.5, -24.6], + } + : this._offset; + } + (this._popup = t), + this._lngLat && this._popup.setLngLat(this._lngLat), + (this._originalTabIndex = + this._element.getAttribute('tabindex')), + this._originalTabIndex || + this._element.setAttribute('tabindex', '0'), + this._element.addEventListener('keypress', this._onKeyPress); + } + return this; + }), + (i.prototype._onKeyPress = function (t) { + var e = t.code, + i = t.charCode || t.keyCode; + ('Space' !== e && 'Enter' !== e && 32 !== i && 13 !== i) || + this.togglePopup(); + }), + (i.prototype._onMapClick = function (t) { + var e = t.originalEvent.target, + i = this._element; + this._popup && (e === i || i.contains(e)) && this.togglePopup(); + }), + (i.prototype.getPopup = function () { + return this._popup; + }), + (i.prototype.togglePopup = function () { + var t = this._popup; + return t + ? (t.isOpen() ? t.remove() : t.addTo(this._map), this) + : this; + }), + (i.prototype._update = function (t) { + var e = this; + if (this._map) { + this._map.transform.renderWorldCopies && + (this._lngLat = no( + this._lngLat, + this._pos, + this._map.transform, + )), + (this._pos = this._map + .project(this._lngLat) + ._add(this._offset)); + var i = ''; + 'viewport' === this._rotationAlignment || + 'auto' === this._rotationAlignment + ? (i = 'rotateZ(' + this._rotation + 'deg)') + : 'map' === this._rotationAlignment && + (i = + 'rotateZ(' + + (this._rotation - this._map.getBearing()) + + 'deg)'); + var r = ''; + 'viewport' === this._pitchAlignment || + 'auto' === this._pitchAlignment + ? (r = 'rotateX(0deg)') + : 'map' === this._pitchAlignment && + (r = 'rotateX(' + this._map.getPitch() + 'deg)'), + (t && 'moveend' !== t.type) || (this._pos = this._pos.round()), + a.setTransform( + this._element, + so[this._anchor] + + ' translate(' + + this._pos.x + + 'px, ' + + this._pos.y + + 'px) ' + + r + + ' ' + + i, + ), + this._map.style && + this._map.style.terrain && + !this._opacityTimeout && + (this._opacityTimeout = setTimeout(function () { + var t = e._map.unproject(e._pos), + i = + (40075016.686 * + Math.abs(Math.cos((e._lngLat.lat * Math.PI) / 180))) / + Math.pow(2, e._map.transform.tileZoom + 8); + (e._element.style.opacity = + t.distanceTo(e._lngLat) > 20 * i ? '0.2' : '1.0'), + (e._opacityTimeout = null); + }, 100)); + } + }), + (i.prototype.getOffset = function () { + return this._offset; + }), + (i.prototype.setOffset = function (e) { + return ( + (this._offset = t.pointGeometry.convert(e)), this._update(), this + ); + }), + (i.prototype._onMove = function (e) { + if (!this._isDragging) { + var i = this._clickTolerance || this._map._clickTolerance; + this._isDragging = e.point.dist(this._pointerdownPos) >= i; + } + this._isDragging && + ((this._pos = e.point.sub(this._positionDelta)), + (this._lngLat = this._map.unproject(this._pos)), + this.setLngLat(this._lngLat), + (this._element.style.pointerEvents = 'none'), + 'pending' === this._state && + ((this._state = 'active'), this.fire(new t.Event('dragstart'))), + this.fire(new t.Event('drag'))); + }), + (i.prototype._onUp = function () { + (this._element.style.pointerEvents = 'auto'), + (this._positionDelta = null), + (this._pointerdownPos = null), + (this._isDragging = !1), + this._map.off('mousemove', this._onMove), + this._map.off('touchmove', this._onMove), + 'active' === this._state && this.fire(new t.Event('dragend')), + (this._state = 'inactive'); + }), + (i.prototype._addDragHandler = function (t) { + this._element.contains(t.originalEvent.target) && + (t.preventDefault(), + (this._positionDelta = t.point.sub(this._pos).add(this._offset)), + (this._pointerdownPos = t.point), + (this._state = 'pending'), + this._map.on('mousemove', this._onMove), + this._map.on('touchmove', this._onMove), + this._map.once('mouseup', this._onUp), + this._map.once('touchend', this._onUp)); + }), + (i.prototype.setDraggable = function (t) { + return ( + (this._draggable = !!t), + this._map && + (t + ? (this._map.on('mousedown', this._addDragHandler), + this._map.on('touchstart', this._addDragHandler)) + : (this._map.off('mousedown', this._addDragHandler), + this._map.off('touchstart', this._addDragHandler))), + this + ); + }), + (i.prototype.isDraggable = function () { + return this._draggable; + }), + (i.prototype.setRotation = function (t) { + return (this._rotation = t || 0), this._update(), this; + }), + (i.prototype.getRotation = function () { + return this._rotation; + }), + (i.prototype.setRotationAlignment = function (t) { + return ( + (this._rotationAlignment = t || 'auto'), this._update(), this + ); + }), + (i.prototype.getRotationAlignment = function () { + return this._rotationAlignment; + }), + (i.prototype.setPitchAlignment = function (t) { + return ( + (this._pitchAlignment = + t && 'auto' !== t ? t : this._rotationAlignment), + this._update(), + this + ); + }), + (i.prototype.getPitchAlignment = function () { + return this._pitchAlignment; + }), + i + ); + })(t.Evented), + uo = { + positionOptions: { + enableHighAccuracy: !1, + maximumAge: 0, + timeout: 6e3, + }, + fitBoundsOptions: { maxZoom: 15 }, + trackUserLocation: !1, + showAccuracyCircle: !0, + showUserLocation: !0, + }, + po = 0, + _o = !1, + fo = (function (e) { + function i(i) { + e.call(this), + (this.options = t.extend({}, uo, i)), + t.bindAll( + [ + '_onSuccess', + '_onError', + '_onZoom', + '_finish', + '_setupUI', + '_updateCamera', + '_updateMarker', + ], + this, + ); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.onAdd = function (t) { + var e; + return ( + (this._map = t), + (this._container = a.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + (e = this._setupUI), + void 0 !== co + ? e(co) + : void 0 !== window.navigator.permissions + ? window.navigator.permissions + .query({ name: 'geolocation' }) + .then(function (t) { + e((co = 'denied' !== t.state)); + }) + : ((co = !!window.navigator.geolocation), e(co)), + this._container + ); + }), + (i.prototype.onRemove = function () { + void 0 !== this._geolocationWatchID && + (window.navigator.geolocation.clearWatch( + this._geolocationWatchID, + ), + (this._geolocationWatchID = void 0)), + this.options.showUserLocation && + this._userLocationDotMarker && + this._userLocationDotMarker.remove(), + this.options.showAccuracyCircle && + this._accuracyCircleMarker && + this._accuracyCircleMarker.remove(), + a.remove(this._container), + this._map.off('zoom', this._onZoom), + (this._map = void 0), + (po = 0), + (_o = !1); + }), + (i.prototype._isOutOfMapMaxBounds = function (t) { + var e = this._map.getMaxBounds(), + i = t.coords; + return ( + e && + (i.longitude < e.getWest() || + i.longitude > e.getEast() || + i.latitude < e.getSouth() || + i.latitude > e.getNorth()) + ); + }), + (i.prototype._setErrorState = function () { + switch (this._watchState) { + case 'WAITING_ACTIVE': + (this._watchState = 'ACTIVE_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ); + break; + case 'ACTIVE_LOCK': + (this._watchState = 'ACTIVE_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ); + break; + case 'BACKGROUND': + (this._watchState = 'BACKGROUND_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ); + break; + case 'ACTIVE_ERROR': + break; + default: + throw new Error('Unexpected watchState ' + this._watchState); + } + }), + (i.prototype._onSuccess = function (e) { + if (this._map) { + if (this._isOutOfMapMaxBounds(e)) + return ( + this._setErrorState(), + this.fire(new t.Event('outofmaxbounds', e)), + this._updateMarker(), + void this._finish() + ); + if (this.options.trackUserLocation) + switch (((this._lastKnownPosition = e), this._watchState)) { + case 'WAITING_ACTIVE': + case 'ACTIVE_LOCK': + case 'ACTIVE_ERROR': + (this._watchState = 'ACTIVE_LOCK'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'BACKGROUND': + case 'BACKGROUND_ERROR': + (this._watchState = 'BACKGROUND'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ); + break; + default: + throw new Error( + 'Unexpected watchState ' + this._watchState, + ); + } + this.options.showUserLocation && + 'OFF' !== this._watchState && + this._updateMarker(e), + (this.options.trackUserLocation && + 'ACTIVE_LOCK' !== this._watchState) || + this._updateCamera(e), + this.options.showUserLocation && + this._dotElement.classList.remove( + 'maplibregl-user-location-dot-stale', + 'mapboxgl-user-location-dot-stale', + ), + this.fire(new t.Event('geolocate', e)), + this._finish(); + } + }), + (i.prototype._updateCamera = function (e) { + var i = new t.LngLat(e.coords.longitude, e.coords.latitude), + r = e.coords.accuracy, + o = this._map.getBearing(), + a = t.extend({ bearing: o }, this.options.fitBoundsOptions); + this._map.fitBounds(i.toBounds(r), a, { geolocateSource: !0 }); + }), + (i.prototype._updateMarker = function (e) { + if (e) { + var i = new t.LngLat(e.coords.longitude, e.coords.latitude); + this._accuracyCircleMarker.setLngLat(i).addTo(this._map), + this._userLocationDotMarker.setLngLat(i).addTo(this._map), + (this._accuracy = e.coords.accuracy), + this.options.showUserLocation && + this.options.showAccuracyCircle && + this._updateCircleRadius(); + } else + this._userLocationDotMarker.remove(), + this._accuracyCircleMarker.remove(); + }), + (i.prototype._updateCircleRadius = function () { + var t = this._map._container.clientHeight / 2, + e = this._map.unproject([0, t]), + i = this._map.unproject([1, t]), + r = e.distanceTo(i), + o = Math.ceil((2 * this._accuracy) / r); + (this._circleElement.style.width = o + 'px'), + (this._circleElement.style.height = o + 'px'); + }), + (i.prototype._onZoom = function () { + this.options.showUserLocation && + this.options.showAccuracyCircle && + this._updateCircleRadius(); + }), + (i.prototype._onError = function (e) { + if (this._map) { + if (this.options.trackUserLocation) + if (1 === e.code) { + (this._watchState = 'OFF'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + (this._geolocateButton.disabled = !0); + var i = this._map._getUIString( + 'GeolocateControl.LocationNotAvailable', + ); + (this._geolocateButton.title = i), + this._geolocateButton.setAttribute('aria-label', i), + void 0 !== this._geolocationWatchID && this._clearWatch(); + } else { + if (3 === e.code && _o) return; + this._setErrorState(); + } + 'OFF' !== this._watchState && + this.options.showUserLocation && + this._dotElement.classList.add( + 'maplibregl-user-location-dot-stale', + 'mapboxgl-user-location-dot-stale', + ), + this.fire(new t.Event('error', e)), + this._finish(); + } + }), + (i.prototype._finish = function () { + this._timeoutId && clearTimeout(this._timeoutId), + (this._timeoutId = void 0); + }), + (i.prototype._setupUI = function (e) { + var i = this; + if ( + (this._container.addEventListener('contextmenu', function (t) { + return t.preventDefault(); + }), + (this._geolocateButton = a.create( + 'button', + 'maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate', + this._container, + )), + a + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._geolocateButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._geolocateButton.type = 'button'), + !1 === e) + ) { + t.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.title = r), + this._geolocateButton.setAttribute('aria-label', r); + } else { + var o = this._map._getUIString('GeolocateControl.FindMyLocation'); + (this._geolocateButton.title = o), + this._geolocateButton.setAttribute('aria-label', o); + } + this.options.trackUserLocation && + (this._geolocateButton.setAttribute('aria-pressed', 'false'), + (this._watchState = 'OFF')), + this.options.showUserLocation && + ((this._dotElement = a.create( + 'div', + 'maplibregl-user-location-dot mapboxgl-user-location-dot', + )), + (this._userLocationDotMarker = new ho(this._dotElement)), + (this._circleElement = a.create( + 'div', + 'maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle', + )), + (this._accuracyCircleMarker = new ho({ + element: this._circleElement, + pitchAlignment: 'map', + })), + this.options.trackUserLocation && (this._watchState = 'OFF'), + this._map.on('zoom', this._onZoom)), + this._geolocateButton.addEventListener( + 'click', + this.trigger.bind(this), + ), + (this._setup = !0), + this.options.trackUserLocation && + this._map.on('movestart', function (e) { + e.geolocateSource || + 'ACTIVE_LOCK' !== i._watchState || + (e.originalEvent && 'resize' === e.originalEvent.type) || + ((i._watchState = 'BACKGROUND'), + i._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + i._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + i.fire(new t.Event('trackuserlocationend'))); + }); + }), + (i.prototype.trigger = function () { + if (!this._setup) + return ( + t.warnOnce('Geolocate control triggered before added to a map'), + !1 + ); + if (this.options.trackUserLocation) { + switch (this._watchState) { + case 'OFF': + (this._watchState = 'WAITING_ACTIVE'), + this.fire(new t.Event('trackuserlocationstart')); + break; + case 'WAITING_ACTIVE': + case 'ACTIVE_LOCK': + case 'ACTIVE_ERROR': + case 'BACKGROUND_ERROR': + po--, + (_o = !1), + (this._watchState = 'OFF'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this.fire(new t.Event('trackuserlocationend')); + break; + case 'BACKGROUND': + (this._watchState = 'ACTIVE_LOCK'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._lastKnownPosition && + this._updateCamera(this._lastKnownPosition), + this.fire(new t.Event('trackuserlocationstart')); + break; + default: + throw new Error('Unexpected watchState ' + this._watchState); + } + switch (this._watchState) { + case 'WAITING_ACTIVE': + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'ACTIVE_LOCK': + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'OFF': + break; + default: + throw new Error('Unexpected watchState ' + this._watchState); + } + if ( + 'OFF' === this._watchState && + void 0 !== this._geolocationWatchID + ) + this._clearWatch(); + else if (void 0 === this._geolocationWatchID) { + var e; + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.setAttribute('aria-pressed', 'true'), + ++po > 1 + ? ((e = { maximumAge: 6e5, timeout: 0 }), (_o = !0)) + : ((e = this.options.positionOptions), (_o = !1)), + (this._geolocationWatchID = + window.navigator.geolocation.watchPosition( + this._onSuccess, + this._onError, + e, + )); + } + } else + window.navigator.geolocation.getCurrentPosition( + this._onSuccess, + this._onError, + this.options.positionOptions, + ), + (this._timeoutId = setTimeout(this._finish, 1e4)); + return !0; + }), + (i.prototype._clearWatch = function () { + window.navigator.geolocation.clearWatch(this._geolocationWatchID), + (this._geolocationWatchID = void 0), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.setAttribute('aria-pressed', 'false'), + this.options.showUserLocation && this._updateMarker(null); + }), + i + ); + })(t.Evented), + mo = { maxWidth: 100, unit: 'metric' }, + go = function (e) { + (this.options = t.extend({}, mo, e)), + t.bindAll(['_onMove', 'setUnit'], this); + }; + function vo(t, e, i) { + var r = (i && i.maxWidth) || 100, + o = t._container.clientHeight / 2, + a = t.unproject([0, o]), + n = t.unproject([r, o]), + s = a.distanceTo(n); + if (i && 'imperial' === i.unit) { + var l = 3.2808 * s; + l > 5280 + ? yo(e, r, l / 5280, t._getUIString('ScaleControl.Miles')) + : yo(e, r, l, t._getUIString('ScaleControl.Feet')); + } else i && 'nautical' === i.unit ? yo(e, r, s / 1852, t._getUIString('ScaleControl.NauticalMiles')) : s >= 1e3 ? yo(e, r, s / 1e3, t._getUIString('ScaleControl.Kilometers')) : yo(e, r, s, t._getUIString('ScaleControl.Meters')); + } + function yo(t, e, i, r) { + var o, + a, + n, + s = + ((o = i), + (a = Math.pow(10, ('' + Math.floor(o)).length - 1)) * + (n = + (n = o / a) >= 10 + ? 10 + : n >= 5 + ? 5 + : n >= 3 + ? 3 + : n >= 2 + ? 2 + : n >= 1 + ? 1 + : (function (t) { + var e = Math.pow(10, Math.ceil(-Math.log(t) / Math.LN10)); + return Math.round(t * e) / e; + })(n))); + (t.style.width = e * (s / i) + 'px'), (t.innerHTML = s + ' ' + r); + } + (go.prototype.getDefaultPosition = function () { + return 'bottom-left'; + }), + (go.prototype._onMove = function () { + vo(this._map, this._container, this.options); + }), + (go.prototype.onAdd = function (t) { + return ( + (this._map = t), + (this._container = a.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale', + t.getContainer(), + )), + this._map.on('move', this._onMove), + this._onMove(), + this._container + ); + }), + (go.prototype.onRemove = function () { + a.remove(this._container), + this._map.off('move', this._onMove), + (this._map = void 0); + }), + (go.prototype.setUnit = function (t) { + (this.options.unit = t), vo(this._map, this._container, this.options); + }); + var xo = function (e) { + (this._fullscreen = !1), + e && + e.container && + (e.container instanceof HTMLElement + ? (this._container = e.container) + : t.warnOnce( + "Full screen control 'container' must be a DOM element.", + )), + t.bindAll(['_onClickFullscreen', '_changeIcon'], this), + 'onfullscreenchange' in document + ? (this._fullscreenchange = 'fullscreenchange') + : 'onmozfullscreenchange' in document + ? (this._fullscreenchange = 'mozfullscreenchange') + : 'onwebkitfullscreenchange' in document + ? (this._fullscreenchange = 'webkitfullscreenchange') + : 'onmsfullscreenchange' in document && + (this._fullscreenchange = 'MSFullscreenChange'); + }; + (xo.prototype.onAdd = function (e) { + return ( + (this._map = e), + this._container || (this._container = this._map.getContainer()), + (this._controlContainer = a.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + this._checkFullscreenSupport() + ? this._setupUI() + : ((this._controlContainer.style.display = 'none'), + t.warnOnce('This device does not support fullscreen mode.')), + this._controlContainer + ); + }), + (xo.prototype.onRemove = function () { + a.remove(this._controlContainer), + (this._map = null), + window.document.removeEventListener( + this._fullscreenchange, + this._changeIcon, + ); + }), + (xo.prototype._checkFullscreenSupport = function () { + return !!( + document.fullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled || + document.webkitFullscreenEnabled + ); + }), + (xo.prototype._setupUI = function () { + var t = (this._fullscreenButton = a.create( + 'button', + 'maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen', + this._controlContainer, + )); + a + .create('span', 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', t) + .setAttribute('aria-hidden', 'true'), + (t.type = 'button'), + this._updateTitle(), + this._fullscreenButton.addEventListener( + 'click', + this._onClickFullscreen, + ), + window.document.addEventListener( + this._fullscreenchange, + this._changeIcon, + ); + }), + (xo.prototype._updateTitle = function () { + var t = this._getTitle(); + this._fullscreenButton.setAttribute('aria-label', t), + (this._fullscreenButton.title = t); + }), + (xo.prototype._getTitle = function () { + return this._map._getUIString( + this._isFullscreen() + ? 'FullscreenControl.Exit' + : 'FullscreenControl.Enter', + ); + }), + (xo.prototype._isFullscreen = function () { + return this._fullscreen; + }), + (xo.prototype._changeIcon = function () { + ((window.document.fullscreenElement || + window.document.mozFullScreenElement || + window.document.webkitFullscreenElement || + window.document.msFullscreenElement) === + this._container) !== + this._fullscreen && + ((this._fullscreen = !this._fullscreen), + this._fullscreenButton.classList.toggle('maplibregl-ctrl-shrink'), + this._fullscreenButton.classList.toggle('mapboxgl-ctrl-shrink'), + this._fullscreenButton.classList.toggle('maplibregl-ctrl-fullscreen'), + this._fullscreenButton.classList.toggle('mapboxgl-ctrl-fullscreen'), + this._updateTitle()); + }), + (xo.prototype._onClickFullscreen = function () { + this._isFullscreen() + ? window.document.exitFullscreen + ? window.document.exitFullscreen() + : window.document.mozCancelFullScreen + ? window.document.mozCancelFullScreen() + : window.document.msExitFullscreen + ? window.document.msExitFullscreen() + : window.document.webkitCancelFullScreen && + window.document.webkitCancelFullScreen() + : this._container.requestFullscreen + ? this._container.requestFullscreen() + : this._container.mozRequestFullScreen + ? this._container.mozRequestFullScreen() + : this._container.msRequestFullscreen + ? this._container.msRequestFullscreen() + : this._container.webkitRequestFullscreen && + this._container.webkitRequestFullscreen(); + }); + var bo = function (e) { + (this.options = e), + t.bindAll(['_toggleTerrain', '_updateTerrainIcon'], this); + }; + (bo.prototype.onAdd = function (t) { + return ( + (this._map = t), + (this._container = a.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + (this._terrainButton = a.create( + 'button', + 'maplibregl-ctrl-terrain mapboxgl-ctrl-terrain', + this._container, + )), + a + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._terrainButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._terrainButton.type = 'button'), + this._terrainButton.addEventListener('click', this._toggleTerrain), + this._updateTerrainIcon(), + this._map.on('terrain', this._updateTerrainIcon), + this._container + ); + }), + (bo.prototype.onRemove = function () { + a.remove(this._container), + this._map.off('terrain', this._updateTerrainIcon), + (this._map = void 0); + }), + (bo.prototype._toggleTerrain = function () { + this._map.getTerrain() + ? this._map.setTerrain(null) + : this._map.setTerrain(this.options), + this._updateTerrainIcon(); + }), + (bo.prototype._updateTerrainIcon = function () { + this._terrainButton.classList.remove( + 'maplibregl-ctrl-terrain', + 'mapboxgl-ctrl-terrain', + ), + this._terrainButton.classList.remove( + 'maplibregl-ctrl-terrain-enabled', + 'mapboxgl-ctrl-terrain-enabled', + ), + this._map.style.terrain + ? (this._terrainButton.classList.add( + 'maplibregl-ctrl-terrain-enabled', + 'mapboxgl-ctrl-terrain-enabled', + ), + (this._terrainButton.title = this._map._getUIString( + 'TerrainControl.disableTerrain', + ))) + : (this._terrainButton.classList.add( + 'maplibregl-ctrl-terrain', + 'mapboxgl-ctrl-terrain', + ), + (this._terrainButton.title = this._map._getUIString( + 'TerrainControl.enableTerrain', + ))); + }); + var wo = { + closeButton: !0, + closeOnClick: !0, + focusAfterOpen: !0, + className: '', + maxWidth: '240px', + }, + To = [ + 'a[href]', + "[tabindex]:not([tabindex='-1'])", + "[contenteditable]:not([contenteditable='false'])", + 'button:not([disabled])', + 'input:not([disabled])', + 'select:not([disabled])', + 'textarea:not([disabled])', + ].join(', '), + Eo = (function (e) { + function i(i) { + e.call(this), + (this.options = t.extend(Object.create(wo), i)), + t.bindAll( + [ + '_update', + '_onClose', + 'remove', + '_onMouseMove', + '_onMouseUp', + '_onDrag', + ], + this, + ); + } + return ( + e && (i.__proto__ = e), + ((i.prototype = Object.create(e && e.prototype)).constructor = i), + (i.prototype.addTo = function (e) { + return ( + this._map && this.remove(), + (this._map = e), + this.options.closeOnClick && this._map.on('click', this._onClose), + this.options.closeOnMove && this._map.on('move', this._onClose), + this._map.on('remove', this.remove), + this._update(), + this._focusFirstElement(), + this._trackPointer + ? (this._map.on('mousemove', this._onMouseMove), + this._map.on('mouseup', this._onMouseUp), + this._container && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.add( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )) + : this._map.on('move', this._update), + this.fire(new t.Event('open')), + this + ); + }), + (i.prototype.isOpen = function () { + return !!this._map; + }), + (i.prototype.remove = function () { + return ( + this._content && a.remove(this._content), + this._container && + (a.remove(this._container), delete this._container), + this._map && + (this._map.off('move', this._update), + this._map.off('move', this._onClose), + this._map.off('click', this._onClose), + this._map.off('remove', this.remove), + this._map.off('mousemove', this._onMouseMove), + this._map.off('mouseup', this._onMouseUp), + this._map.off('drag', this._onDrag), + delete this._map), + this.fire(new t.Event('close')), + this + ); + }), + (i.prototype.getLngLat = function () { + return this._lngLat; + }), + (i.prototype.setLngLat = function (e) { + return ( + (this._lngLat = t.LngLat.convert(e)), + (this._pos = null), + (this._trackPointer = !1), + this._update(), + this._map && + (this._map.on('move', this._update), + this._map.off('mousemove', this._onMouseMove), + this._container && + this._container.classList.remove( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.remove( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )), + this + ); + }), + (i.prototype.trackPointer = function () { + return ( + (this._trackPointer = !0), + (this._pos = null), + this._update(), + this._map && + (this._map.off('move', this._update), + this._map.on('mousemove', this._onMouseMove), + this._map.on('drag', this._onDrag), + this._container && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.add( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )), + this + ); + }), + (i.prototype.getElement = function () { + return this._container; + }), + (i.prototype.setText = function (t) { + return this.setDOMContent(document.createTextNode(t)); + }), + (i.prototype.setHTML = function (t) { + var e, + i = document.createDocumentFragment(), + r = document.createElement('body'); + for (r.innerHTML = t; (e = r.firstChild); ) i.appendChild(e); + return this.setDOMContent(i); + }), + (i.prototype.getMaxWidth = function () { + return this._container && this._container.style.maxWidth; + }), + (i.prototype.setMaxWidth = function (t) { + return (this.options.maxWidth = t), this._update(), this; + }), + (i.prototype.setDOMContent = function (t) { + if (this._content) + for (; this._content.hasChildNodes(); ) + this._content.firstChild && + this._content.removeChild(this._content.firstChild); + else + this._content = a.create( + 'div', + 'maplibregl-popup-content mapboxgl-popup-content', + this._container, + ); + return ( + this._content.appendChild(t), + this._createCloseButton(), + this._update(), + this._focusFirstElement(), + this + ); + }), + (i.prototype.addClassName = function (t) { + this._container && this._container.classList.add(t); + }), + (i.prototype.removeClassName = function (t) { + this._container && this._container.classList.remove(t); + }), + (i.prototype.setOffset = function (t) { + return (this.options.offset = t), this._update(), this; + }), + (i.prototype.toggleClassName = function (t) { + if (this._container) return this._container.classList.toggle(t); + }), + (i.prototype._createCloseButton = function () { + this.options.closeButton && + ((this._closeButton = a.create( + 'button', + 'maplibregl-popup-close-button mapboxgl-popup-close-button', + this._content, + )), + (this._closeButton.type = 'button'), + this._closeButton.setAttribute('aria-label', 'Close popup'), + (this._closeButton.innerHTML = '×'), + this._closeButton.addEventListener('click', this._onClose)); + }), + (i.prototype._onMouseUp = function (t) { + this._update(t.point); + }), + (i.prototype._onMouseMove = function (t) { + this._update(t.point); + }), + (i.prototype._onDrag = function (t) { + this._update(t.point); + }), + (i.prototype._update = function (t) { + var e = this; + if ( + this._map && + (this._lngLat || this._trackPointer) && + this._content && + (this._container || + ((this._container = a.create( + 'div', + 'maplibregl-popup mapboxgl-popup', + this._map.getContainer(), + )), + (this._tip = a.create( + 'div', + 'maplibregl-popup-tip mapboxgl-popup-tip', + this._container, + )), + this._container.appendChild(this._content), + this.options.className && + this.options.className.split(' ').forEach(function (t) { + return e._container.classList.add(t); + }), + this._trackPointer && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + )), + this.options.maxWidth && + this._container.style.maxWidth !== this.options.maxWidth && + (this._container.style.maxWidth = this.options.maxWidth), + this._map.transform.renderWorldCopies && + !this._trackPointer && + (this._lngLat = no( + this._lngLat, + this._pos, + this._map.transform, + )), + !this._trackPointer || t) + ) { + var i = (this._pos = + this._trackPointer && t + ? t + : this._map.project(this._lngLat)), + r = this.options.anchor, + o = Io(this.options.offset); + if (!r) { + var n, + s = this._container.offsetWidth, + l = this._container.offsetHeight; + (n = + i.y + o.bottom.y < l + ? ['top'] + : i.y > this._map.transform.height - l + ? ['bottom'] + : []), + i.x < s / 2 + ? n.push('left') + : i.x > this._map.transform.width - s / 2 && + n.push('right'), + (r = 0 === n.length ? 'bottom' : n.join('-')); + } + var c = i.add(o[r]).round(); + a.setTransform( + this._container, + so[r] + ' translate(' + c.x + 'px,' + c.y + 'px)', + ), + lo(this._container, r, 'popup'); + } + }), + (i.prototype._focusFirstElement = function () { + if (this.options.focusAfterOpen && this._container) { + var t = this._container.querySelector(To); + t && t.focus(); + } + }), + (i.prototype._onClose = function () { + this.remove(); + }), + i + ); + })(t.Evented); + function Io(e) { + if (e) { + if ('number' == typeof e) { + var i = Math.round(Math.sqrt(0.5 * Math.pow(e, 2))); + return { + center: new t.pointGeometry(0, 0), + top: new t.pointGeometry(0, e), + 'top-left': new t.pointGeometry(i, i), + 'top-right': new t.pointGeometry(-i, i), + bottom: new t.pointGeometry(0, -e), + 'bottom-left': new t.pointGeometry(i, -i), + 'bottom-right': new t.pointGeometry(-i, -i), + left: new t.pointGeometry(e, 0), + right: new t.pointGeometry(-e, 0), + }; + } + if (e instanceof t.pointGeometry || Array.isArray(e)) { + var r = t.pointGeometry.convert(e); + return { + center: r, + top: r, + 'top-left': r, + 'top-right': r, + bottom: r, + 'bottom-left': r, + 'bottom-right': r, + left: r, + right: r, + }; + } + return { + center: t.pointGeometry.convert(e.center || [0, 0]), + top: t.pointGeometry.convert(e.top || [0, 0]), + 'top-left': t.pointGeometry.convert(e['top-left'] || [0, 0]), + 'top-right': t.pointGeometry.convert(e['top-right'] || [0, 0]), + bottom: t.pointGeometry.convert(e.bottom || [0, 0]), + 'bottom-left': t.pointGeometry.convert(e['bottom-left'] || [0, 0]), + 'bottom-right': t.pointGeometry.convert(e['bottom-right'] || [0, 0]), + left: t.pointGeometry.convert(e.left || [0, 0]), + right: t.pointGeometry.convert(e.right || [0, 0]), + }; + } + return Io(new t.pointGeometry(0, 0)); + } + var Co = { + supported: e, + setRTLTextPlugin: t.setRTLTextPlugin, + getRTLTextPluginStatus: t.getRTLTextPluginStatus, + Map: io, + NavigationControl: oo, + GeolocateControl: fo, + AttributionControl: Jr, + LogoControl: Qr, + ScaleControl: go, + FullscreenControl: xo, + TerrainControl: bo, + Popup: Eo, + Marker: ho, + Style: ie, + LngLat: t.LngLat, + LngLatBounds: t.LngLatBounds, + Point: t.pointGeometry, + MercatorCoordinate: t.MercatorCoordinate, + Evented: t.Evented, + AJAXError: t.AJAXError, + config: t.config, + CanvasSource: A, + GeoJSONSource: D, + ImageSource: P, + RasterDEMTileSource: S, + RasterTileSource: C, + VectorTileSource: I, + VideoSource: M, + prewarm: function () { + W().acquire(Z); + }, + clearPrewarmedResources: function () { + var t = q; + t && + (t.isPreloaded() && 1 === t.numActive() + ? (t.release(Z), (q = 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 version() { + return '2.4.0'; + }, + get workerCount() { + return V.workerCount; + }, + set workerCount(t) { + V.workerCount = t; + }, + get maxParallelImageRequests() { + return t.config.MAX_PARALLEL_IMAGE_REQUESTS; + }, + set maxParallelImageRequests(e) { + t.config.MAX_PARALLEL_IMAGE_REQUESTS = e; + }, + clearStorage: function (e) { + t.clearTileCache(e); + }, + workerUrl: '', + addProtocol: function (e, i) { + t.config.REGISTERED_PROTOCOLS[e] = i; + }, + removeProtocol: function (e) { + delete t.config.REGISTERED_PROTOCOLS[e]; + }, + }; + return ( + (function (e) { + for (var i = [], r = arguments.length - 1; r-- > 0; ) + i[r] = arguments[r + 1]; + t.extend.apply(void 0, [e].concat(i)); + })(Co, { + isSafari: t.isSafari, + getPerformanceMetrics: t.PerformanceUtils.getPerformanceMetrics, + }), + Co + ); + }); + + // + + var maplibregl$1 = maplibregl; + + return maplibregl$1; +}); //# sourceMappingURL=maplibre-gl-compat.js.map diff --git a/public/resources/maplibre-gl-inspect-compat.min.js b/public/resources/maplibre-gl-inspect-compat.min.js index 5efad9f..a11fcad 100644 --- a/public/resources/maplibre-gl-inspect-compat.min.js +++ b/public/resources/maplibre-gl-inspect-compat.min.js @@ -1 +1,1655 @@ -!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MaplibreInspect=t()}(function(){return function r(o,i,s){function a(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return a(o[e][1][t]||t)},n,n.exports,r,o,i,s)}return i[e].exports}for(var u="function"==typeof require&&require,t=0;t
'+t+'
'+(null==(e=e)?e:e instanceof Date?e.toLocaleString():"object"===r(e)||"number"==typeof e||"string"==typeof e?e.toString():e)+"
"}function i(t){return t.map(function(t){return'
'+(n='
'+((e=t).layer["source-layer"]||e.layer.source)+"
",r=o("$type",e.geometry.type),t=Object.keys(e.properties).map(function(t){return o(t,e.properties[t])}),[n,r].concat(t).join(""))+"
";var e,n,r}).join("")}e.exports=function(t){return'
'+i(t)+"
"}},{}],6:[function(t,e,n){"use strict";function o(){return(o=Object.assign||function(t){for(var e=1;e=Number.MAX_SAFE_INTEGER);n++)e+=t.charCodeAt(n);return e}(t.seed);else{if(void 0!==t.seed&&null!==t.seed)throw new TypeError("The seed value must be an integer or string");a=null}var e,n;if(null===t.count||void 0===t.count)return function(t,e){switch(e.format){case"hsvArray":return t;case"hslArray":return d(t);case"hsl":var n=d(t);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var r=d(t),o=e.alpha||Math.random();return"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+o+")";case"rgbArray":return f(t);case"rgb":return"rgb("+f(t).join(", ")+")";case"rgba":r=f(t),o=e.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return function(t){t=f(t);function e(t){t=t.toString(16);return 1==t.length?"0"+t:t}return"#"+e(t[0])+e(t[1])+e(t[2])}(t)}}([e=function(t){{if(0o.length;){var s=c(t);null!==a&&(t.seed=a),o.push(s)}return t.count=r,o}var l=[];function p(t){for(var e in 334<=t&&t<=360&&(t-=360),u){var n=u[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return u[e]}return"Color not found"}function h(t){if(null===a){var e=Math.random();return e+=.618033988749895,e%=1,Math.floor(t[0]+e*(t[1]+1-t[0]))}var n=t[1]||1,e=t[0]||0,t=(a=(9301*a+49297)%233280)/233280;return Math.floor(e+t*(n-e))}function t(t,e,n){var r=n[0][0],o=n[n.length-1][0],i=n[n.length-1][1],s=n[0][1];u[t]={hueRange:e,lowerBounds:n,saturationRange:[r,o],brightnessRange:[i,s]}}function f(t){var e=t[0];360===(e=0===e?1:e)&&(e=359),e/=360;var n=t[1]/100,r=t[2]/100,t=Math.floor(6*e),e=6*e-t,o=r*(1-n),i=r*(1-e*n),s=r*(1-(1-e)*n),a=256,u=256,c=256;switch(t){case 0:a=r,u=s,c=o;break;case 1:a=i,u=r,c=o;break;case 2:a=o,u=r,c=s;break;case 3:a=o,u=i,c=r;break;case 4:a=s,u=o,c=r;break;case 5:a=r,u=o,c=i}return[Math.floor(255*a),Math.floor(255*u),Math.floor(255*c)]}function y(t){t=3===(t=t.replace(/^#/,"")).length?t.replace(/(.)/g,"$1$1"):t;var e=parseInt(t.substr(0,2),16)/255,n=parseInt(t.substr(2,2),16)/255,r=parseInt(t.substr(4,2),16)/255,o=Math.max(e,n,r),i=o-Math.min(e,n,r),s=o?i/o:0;switch(o){case e:return[(n-r)/i%6*60||0,s,o];case n:return[60*((r-e)/i+2)||0,s,o];case r:return[60*((e-n)/i+4)||0,s,o]}}function d(t){var e=t[0],n=t[1]/100,r=t[2]/100,t=(2-n)*r;return[e,Math.round(n*r/(t<1?t:2-t)*1e4)/100,t/2*100]}return c},"object"==typeof n?(i=o(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):r.randomColor=o()},{}]},{},[1])(1)}); \ No newline at end of file +!(function (t) { + 'object' == typeof exports && 'undefined' != typeof module + ? (module.exports = t()) + : 'function' == typeof define && define.amd + ? define([], t) + : (('undefined' != typeof window + ? window + : 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : this + ).MaplibreInspect = t()); +})(function () { + return (function r(o, i, s) { + function a(e, t) { + if (!i[e]) { + if (!o[e]) { + var n = 'function' == typeof require && require; + if (!t && n) return n(e, !0); + if (u) return u(e, !0); + throw ( + (((n = new Error("Cannot find module '" + e + "'")).code = + 'MODULE_NOT_FOUND'), + n) + ); + } + (n = i[e] = { exports: {} }), + o[e][0].call( + n.exports, + function (t) { + return a(o[e][1][t] || t); + }, + n, + n.exports, + r, + o, + i, + s, + ); + } + return i[e].exports; + } + for ( + var u = 'function' == typeof require && require, t = 0; + t < s.length; + t++ + ) + a(s[t]); + return a; + })( + { + 1: [ + function (t, e, n) { + 'use strict'; + t = t('./lib/MaplibreInspect'); + e.exports = t; + }, + { './lib/MaplibreInspect': 3 }, + ], + 2: [ + function (t, e, n) { + 'use strict'; + function r() { + return (r = + Object.assign || + function (t) { + for (var e = 1; e < arguments.length; e++) { + var n, + r = arguments[e]; + for (n in r) + Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]); + } + return t; + }).apply(this, arguments); + } + function o(t) { + var e, n; + (t = r({ show: !0, onToggle: function () {} }, t)), + (this._btn = + (((n = document.createElement('button')).className = + 'maplibregl-ctrl-icon maplibregl-ctrl-inspect'), + (n.type = 'button'), + (n['aria-label'] = 'Inspect'), + n)), + (this._btn.onclick = t.onToggle), + (this.elem = + ((e = this._btn), + (n = t.show), + ((t = document.createElement('div')).className = + 'maplibregl-ctrl maplibregl-ctrl-group'), + t.appendChild(e), + n || (t.style.display = 'none'), + t)); + } + (o.prototype.setInspectIcon = function () { + this._btn.className = + 'maplibregl-ctrl-icon maplibregl-ctrl-inspect'; + }), + (o.prototype.setMapIcon = function () { + this._btn.className = 'maplibregl-ctrl-icon maplibregl-ctrl-map'; + }), + (e.exports = o); + }, + {}, + ], + 3: [ + function (t, e, n) { + 'use strict'; + function i() { + return (i = + Object.assign || + function (t) { + for (var e = 1; e < arguments.length; e++) { + var n, + r = arguments[e]; + for (n in r) + Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]); + } + return t; + }).apply(this, arguments); + } + var r = t('./stylegen'), + o = t('./InspectButton'), + s = t('lodash.isequal'), + a = t('./renderPopup'), + u = t('./colors'); + function c(t) { + if (!(this instanceof c)) + throw new Error( + 'MaplibreInspect needs to be called with the new keyword', + ); + var e = null; + window.maplibregl + ? (e = new window.maplibregl.Popup({ + closeButton: !1, + closeOnClick: !1, + })) + : t.popup || + console.error( + 'Maplibre GL JS can not be found. Make sure to include it or pass an initialized MaplibreGL Popup to MaplibreInspect if you are using moduleis.', + ), + (this.options = i( + { + showInspectMap: !1, + showInspectButton: !0, + showInspectMapPopup: !0, + showMapPopup: !1, + showMapPopupOnHover: !0, + showInspectMapPopupOnHover: !0, + blockHoverPopupOnClick: !1, + backgroundColor: '#fff', + assignLayerColor: u.brightColor, + buildInspectStyle: r.generateInspectStyle, + renderPopup: a, + popup: e, + selectThreshold: 5, + useInspectStyle: !0, + queryParameters: {}, + sources: {}, + }, + t, + )), + (this.sources = this.options.sources), + (this.assignLayerColor = this.options.assignLayerColor), + (this.toggleInspector = this.toggleInspector.bind(this)), + (this._popup = this.options.popup), + (this._popupBlocked = !1), + (this._showInspectMap = this.options.showInspectMap), + (this._onSourceChange = this._onSourceChange.bind(this)), + (this._onMousemove = this._onMousemove.bind(this)), + (this._onRightClick = this._onRightClick.bind(this)), + (this._onStyleChange = this._onStyleChange.bind(this)), + (this._originalStyle = null), + (this._toggle = new o({ + show: this.options.showInspectButton, + onToggle: this.toggleInspector.bind(this), + })); + } + (c.prototype.toggleInspector = function () { + (this._showInspectMap = !this._showInspectMap), this.render(); + }), + (c.prototype._inspectStyle = function () { + var t = r.generateColoredLayers( + this.sources, + this.assignLayerColor, + ); + return this.options.buildInspectStyle(this._map.getStyle(), t, { + backgroundColor: this.options.backgroundColor, + }); + }), + (c.prototype.render = function () { + var t; + this._showInspectMap + ? (this.options.useInspectStyle && + this._map.setStyle( + i((t = this._inspectStyle()), { + metadata: i({}, t.metadata, { + 'maplibregl-inspect:inspect': !0, + }), + }), + ), + this._toggle.setMapIcon()) + : this._originalStyle && + (this._popup && this._popup.remove(), + this.options.useInspectStyle && + this._map.setStyle(this._originalStyle), + this._toggle.setInspectIcon()); + }), + (c.prototype._onSourceChange = function (t) { + var r = this.sources, + o = this._map, + e = o.getStyle(), + n = Object.keys(e.sources), + e = i({}, r); + 'visibility' !== t.sourceDataType && + t.isSourceLoaded && + (Object.keys(o.style.sourceCaches).forEach(function (t) { + var e = o.style.sourceCaches[t] || { _source: {} }, + n = e._source.vectorLayerIds; + n ? (r[t] = n) : 'geojson' === e._source.type && (r[t] = []); + }), + Object.keys(r).forEach(function (t) { + -1 === n.indexOf(t) && delete r[t]; + }), + !s(e, r) && 0 < Object.keys(r).length && this.render()); + }), + (c.prototype._onStyleChange = function () { + var t, + e = this._map.getStyle(); + ((t = e).metadata && t.metadata['maplibregl-inspect:inspect']) || + (this._originalStyle = e); + }), + (c.prototype._onRightClick = function () { + this.options.showMapPopupOnHover || + this.options.showInspectMapPopupOnHover || + this.options.blockHoverPopupOnClick || + (this._popup && this._popup.remove()); + }), + (c.prototype._onMousemove = function (t) { + if (this._showInspectMap) { + if (!this.options.showInspectMapPopup) return; + if ( + 'mousemove' === t.type && + !this.options.showInspectMapPopupOnHover + ) + return; + 'click' === t.type && + this.options.showInspectMapPopupOnHover && + this.options.blockHoverPopupOnClick && + (this._popupBlocked = !this._popupBlocked); + } else { + if (!this.options.showMapPopup) return; + if ('mousemove' === t.type && !this.options.showMapPopupOnHover) + return; + 'click' === t.type && + this.options.showMapPopupOnHover && + this.options.blockHoverPopupOnClick && + (this._popupBlocked = !this._popupBlocked); + } + var e; + !this._popupBlocked && + this._popup && + ((e = + 0 === this.options.selectThreshold + ? t.point + : [ + [ + t.point.x - this.options.selectThreshold, + t.point.y + this.options.selectThreshold, + ], + [ + t.point.x + this.options.selectThreshold, + t.point.y - this.options.selectThreshold, + ], + ]), + (e = + this._map.queryRenderedFeatures( + e, + this.options.queryParameters, + ) || []), + (this._map.getCanvas().style.cursor = e.length + ? 'pointer' + : ''), + e.length + ? (this._popup.setLngLat(t.lngLat), + 'string' == typeof (e = this.options.renderPopup(e)) + ? this._popup.setHTML(e) + : this._popup.setDOMContent(e), + this._popup.addTo(this._map)) + : this._popup.remove()); + }), + (c.prototype.onAdd = function (t) { + return ( + (this._map = t), + 0 === Object.keys(this.sources).length && + (t.on('tiledata', this._onSourceChange), + t.on('sourcedata', this._onSourceChange)), + t.on('styledata', this._onStyleChange), + t.on('load', this._onStyleChange), + t.on('mousemove', this._onMousemove), + t.on('click', this._onMousemove), + t.on('contextmenu', this._onRightClick), + this._toggle.elem + ); + }), + (c.prototype.onRemove = function () { + this._map.off('styledata', this._onStyleChange), + this._map.off('load', this._onStyleChange), + this._map.off('tiledata', this._onSourceChange), + this._map.off('sourcedata', this._onSourceChange), + this._map.off('mousemove', this._onMousemove), + this._map.off('click', this._onMousemove), + this._map.off('contextmenu', this._onRightClick); + var t = this._toggle.elem; + t.parentNode.removeChild(t), (this._map = void 0); + }), + (e.exports = c); + }, + { + './InspectButton': 2, + './colors': 4, + './renderPopup': 5, + './stylegen': 6, + 'lodash.isequal': 7, + }, + ], + 4: [ + function (t, e, n) { + 'use strict'; + var o = t('randomcolor'); + n.brightColor = function (t, e) { + var n = 'bright', + r = null; + return ( + /water|ocean|lake|sea|river/.test(t) && (r = 'blue'), + /state|country|place/.test(t) && (r = 'pink'), + /road|highway|transport/.test(t) && (r = 'orange'), + /contour|building/.test(t) && (r = 'monochrome'), + /building/.test(t) && (n = 'dark'), + /contour|landuse/.test(t) && (r = 'yellow'), + /wood|forest|park|landcover/.test(t) && (r = 'green'), + 'rgba(' + + o({ luminosity: n, hue: r, seed: t, format: 'rgbArray' }) + .concat([e || 1]) + .join(', ') + + ')' + ); + }; + }, + { randomcolor: 8 }, + ], + 5: [ + function (t, e, n) { + 'use strict'; + function r(t) { + return (r = + 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator + ? function (t) { + return typeof t; + } + : function (t) { + return t && + 'function' == typeof Symbol && + t.constructor === Symbol && + t !== Symbol.prototype + ? 'symbol' + : typeof t; + })(t); + } + function o(t, e) { + return ( + '
' + + t + + '
' + + (null == (e = e) + ? e + : e instanceof Date + ? e.toLocaleString() + : 'object' === r(e) || + 'number' == typeof e || + 'string' == typeof e + ? e.toString() + : e) + + '
' + ); + } + function i(t) { + return t + .map(function (t) { + return ( + '
' + + ((n = + '
' + + ((e = t).layer['source-layer'] || e.layer.source) + + '
'), + (r = o('$type', e.geometry.type)), + (t = Object.keys(e.properties).map(function (t) { + return o(t, e.properties[t]); + })), + [n, r].concat(t).join('')) + + '
' + ); + var e, n, r; + }) + .join(''); + } + e.exports = function (t) { + return '
' + i(t) + '
'; + }; + }, + {}, + ], + 6: [ + function (t, e, n) { + 'use strict'; + function o() { + return (o = + Object.assign || + function (t) { + for (var e = 1; e < arguments.length; e++) { + var n, + r = arguments[e]; + for (n in r) + Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]); + } + return t; + }).apply(this, arguments); + } + function a(t, e, n) { + t = { + id: [e, n, 'circle'].join('_'), + source: e, + type: 'circle', + paint: { 'circle-color': t, 'circle-radius': 2 }, + filter: ['==', '$type', 'Point'], + }; + return n && (t['source-layer'] = n), t; + } + function u(t, e, n, r) { + t = { + id: [n, r, 'polygon'].join('_'), + source: n, + type: 'fill', + paint: { + 'fill-color': t, + 'fill-antialias': !0, + 'fill-outline-color': t, + }, + filter: ['==', '$type', 'Polygon'], + }; + return r && (t['source-layer'] = r), t; + } + function c(t, e, n) { + t = { + id: [e, n, 'line'].join('_'), + source: e, + layout: { 'line-join': 'round', 'line-cap': 'round' }, + type: 'line', + paint: { 'line-color': t }, + filter: ['==', '$type', 'LineString'], + }; + return n && (t['source-layer'] = n), t; + } + (n.polygonLayer = u), + (n.lineLayer = c), + (n.circleLayer = a), + (n.generateInspectStyle = function (n, t, e) { + var e = { + id: 'background', + type: 'background', + paint: { + 'background-color': (e = o({ backgroundColor: '#fff' }, e)) + .backgroundColor, + }, + }, + r = {}; + return ( + Object.keys(n.sources).forEach(function (t) { + var e = n.sources[t]; + ('vector' !== e.type && 'geojson' !== e.type) || (r[t] = e); + }), + o(n, { layers: [e].concat(t), soources: r }) + ); + }), + (n.generateColoredLayers = function (e, n) { + var r = [], + o = [], + i = []; + function s(t) { + t = n.bind(null, t); + return { + circle: t(0.8), + line: t(0.6), + polygon: t(0.3), + polygonOutline: t(0.6), + default: t(1), + }; + } + return ( + Object.keys(e).forEach(function (n) { + var t = e[n]; + t && 0 !== t.length + ? t.forEach(function (t) { + var e = s(t); + o.push(a(e.circle, n, t)), + i.push(c(e.line, n, t)), + r.push(u(e.polygon, e.polygonOutline, n, t)); + }) + : ((t = s(n)), + o.push(a(t.circle, n)), + i.push(c(t.line, n)), + r.push(u(t.polygon, t.polygonOutline, n))); + }), + r.concat(i).concat(o) + ); + }); + }, + {}, + ], + 7: [ + function (t, Ft, Ht) { + !function ($t) { + !function () { + var r = '__lodash_hash_undefined__', + b = 1, + d = 2, + h = 9007199254740991, + p = '[object Arguments]', + f = '[object Array]', + e = '[object AsyncFunction]', + y = '[object Boolean]', + g = '[object Date]', + _ = '[object Error]', + n = '[object Function]', + o = '[object GeneratorFunction]', + v = '[object Map]', + m = '[object Number]', + i = '[object Null]', + w = '[object Object]', + s = '[object Promise]', + a = '[object Proxy]', + j = '[object RegExp]', + k = '[object Set]', + O = '[object String]', + M = '[object Symbol]', + u = '[object Undefined]', + c = '[object WeakMap]', + I = '[object ArrayBuffer]', + S = '[object DataView]', + l = /^\[object .+?Constructor\]$/, + C = /^(?:0|[1-9]\d*)$/, + P = {}; + (P['[object Float32Array]'] = + P['[object Float64Array]'] = + P['[object Int8Array]'] = + P['[object Int16Array]'] = + P['[object Int32Array]'] = + P['[object Uint8Array]'] = + P['[object Uint8ClampedArray]'] = + P['[object Uint16Array]'] = + P['[object Uint32Array]'] = + !0), + (P[p] = + P[f] = + P[I] = + P[y] = + P[S] = + P[g] = + P[_] = + P[n] = + P[v] = + P[m] = + P[w] = + P[j] = + P[k] = + P[O] = + P[c] = + !1); + var t = 'object' == typeof $t && $t && $t.Object === Object && $t, + A = + 'object' == typeof self && + self && + self.Object === Object && + self, + z = t || A || Function('return this')(), + L = 'object' == typeof Ht && Ht && !Ht.nodeType && Ht, + x = L && 'object' == typeof Ft && Ft && !Ft.nodeType && Ft, + R = x && x.exports === L, + E = R && t.process, + T = (function () { + try { + return E && E.binding && E.binding('util'); + } catch (t) {} + })(), + A = T && T.isTypedArray; + function B(t) { + var n = -1, + r = Array(t.size); + return ( + t.forEach(function (t, e) { + r[++n] = [e, t]; + }), + r + ); + } + function $(t) { + var e = -1, + n = Array(t.size); + return ( + t.forEach(function (t) { + n[++e] = t; + }), + n + ); + } + var F, + H, + x = Array.prototype, + L = Function.prototype, + N = Object.prototype, + t = z['__core-js_shared__'], + q = L.toString, + D = N.hasOwnProperty, + U = (T = /[^.]+$/.exec((t && t.keys && t.keys.IE_PROTO) || '')) + ? 'Symbol(src)_1.' + T + : '', + G = N.toString, + V = RegExp( + '^' + + q + .call(D) + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace( + /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, + '$1.*?', + ) + + '$', + ), + L = R ? z.Buffer : void 0, + t = z.Symbol, + W = z.Uint8Array, + J = N.propertyIsEnumerable, + X = x.splice, + K = t ? t.toStringTag : void 0, + Q = Object.getOwnPropertySymbols, + T = L ? L.isBuffer : void 0, + Y = + ((F = Object.keys), + (H = Object), + function (t) { + return F(H(t)); + }), + R = kt(z, 'DataView'), + Z = kt(z, 'Map'), + x = kt(z, 'Promise'), + L = kt(z, 'Set'), + z = kt(z, 'WeakMap'), + tt = kt(Object, 'create'), + et = It(R), + nt = It(Z), + rt = It(x), + ot = It(L), + it = It(z), + t = t ? t.prototype : void 0, + st = t ? t.valueOf : void 0; + function at(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function ut(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function ct(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function lt(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.__data__ = new ct(); ++e < n; ) this.add(t[e]); + } + function pt(t) { + t = this.__data__ = new ut(t); + this.size = t.size; + } + function ht(t, e) { + var n, + r, + o, + i = Pt(t), + s = !i && Ct(t), + a = !i && !s && At(t), + u = !i && !s && !a && Tt(t), + c = i || s || a || u, + l = c + ? (function (t, e) { + for (var n = -1, r = Array(t); ++n < t; ) r[n] = e(n); + return r; + })(t.length, String) + : [], + p = l.length; + for (n in t) + (!e && !D.call(t, n)) || + (c && + ('length' == n || + (a && ('offset' == n || 'parent' == n)) || + (u && + ('buffer' == n || + 'byteLength' == n || + 'byteOffset' == n)) || + ((r = n), + !!(o = null == (o = p) ? h : o) && + ('number' == typeof r || C.test(r)) && + -1 < r && + r % 1 == 0 && + r < o))) || + l.push(n); + return l; + } + function ft(t, e) { + for (var n = t.length; n--; ) if (St(t[n][0], e)) return n; + return -1; + } + function yt(t, e, n) { + e = e(t); + return Pt(t) + ? e + : (function (t, e) { + for (var n = -1, r = e.length, o = t.length; ++n < r; ) + t[o + n] = e[n]; + return t; + })(e, n(t)); + } + function dt(t) { + return null == t + ? void 0 === t + ? u + : i + : K && K in Object(t) + ? (function (t) { + var e = D.call(t, K), + n = t[K]; + try { + var r = !(t[K] = void 0); + } catch (t) {} + var o = G.call(t); + r && (e ? (t[K] = n) : delete t[K]); + return o; + })(t) + : G.call(t); + } + function gt(t) { + return Rt(t) && dt(t) == p; + } + function _t(t, e, n, r, o) { + return ( + t === e || + (null == t || null == e || (!Rt(t) && !Rt(e)) + ? t != t && e != e + : (function (t, e, n, r, o, i) { + var s = Pt(t), + a = Pt(e), + u = s ? f : Mt(t), + c = a ? f : Mt(e), + l = (u = u == p ? w : u) == w, + a = (c = c == p ? w : c) == w, + c = u == c; + if (c && At(t)) { + if (!At(e)) return !1; + l = !(s = !0); + } + if (c && !l) + return ( + (i = i || new pt()), + s || Tt(t) + ? mt(t, e, n, r, o, i) + : (function (t, e, n, r, o, i, s) { + switch (n) { + case S: + if ( + t.byteLength != e.byteLength || + t.byteOffset != e.byteOffset + ) + return !1; + (t = t.buffer), (e = e.buffer); + case I: + return t.byteLength == e.byteLength && + i(new W(t), new W(e)) + ? !0 + : !1; + case y: + case g: + case m: + return St(+t, +e); + case _: + return ( + t.name == e.name && + t.message == e.message + ); + case j: + case O: + return t == e + ''; + case v: + var a = B; + case k: + var u = r & b; + if ( + ((a = a || $), t.size != e.size && !u) + ) + return !1; + u = s.get(t); + if (u) return u == e; + (r |= d), s.set(t, e); + a = mt(a(t), a(e), r, o, i, s); + return s.delete(t), a; + case M: + if (st) return st.call(t) == st.call(e); + } + return !1; + })(t, e, u, n, r, o, i) + ); + if (!(n & b)) { + (l = l && D.call(t, '__wrapped__')), + (a = a && D.call(e, '__wrapped__')); + if (l || a) { + (l = l ? t.value() : t), (a = a ? e.value() : e); + return (i = i || new pt()), o(l, a, n, r, i); + } + } + return ( + c && + ((i = i || new pt()), + (function (t, e, n, r, o, i) { + var s = n & b, + a = wt(t), + u = a.length, + c = wt(e).length; + if (u != c && !s) return !1; + var l = u; + for (; l--; ) { + var p = a[l]; + if (!(s ? p in e : D.call(e, p))) return !1; + } + var h = i.get(t); + if (h && i.get(e)) return h == e; + var f = !0; + i.set(t, e), i.set(e, t); + var y = s; + for (; ++l < u; ) { + p = a[l]; + var d, + g = t[p], + _ = e[p]; + if ( + !(void 0 === + (d = r + ? s + ? r(_, g, p, e, t, i) + : r(g, _, p, t, e, i) + : d) + ? g === _ || o(g, _, n, r, i) + : d) + ) { + f = !1; + break; + } + y = y || 'constructor' == p; + } + f && + !y && + ((c = t.constructor), + (h = e.constructor), + c != h && + 'constructor' in t && + 'constructor' in e && + !( + 'function' == typeof c && + c instanceof c && + 'function' == typeof h && + h instanceof h + ) && + (f = !1)); + return i.delete(t), i.delete(e), f; + })(t, e, n, r, o, i)) + ); + })(t, e, n, r, _t, o)) + ); + } + function bt(t) { + var e; + return ( + xt(t) && + ((e = t), !(U && U in e)) && + (zt(t) ? V : l).test(It(t)) + ); + } + function vt(t) { + if ( + ((n = + ('function' == typeof (n = (e = t) && e.constructor) && + n.prototype) || + N), + e !== n) + ) + return Y(t); + var e, + n, + r, + o = []; + for (r in Object(t)) + D.call(t, r) && 'constructor' != r && o.push(r); + return o; + } + function mt(t, e, n, r, o, i) { + var s = n & b, + a = t.length, + u = e.length; + if (a != u && !(s && a < u)) return !1; + u = i.get(t); + if (u && i.get(e)) return u == e; + var c = -1, + l = !0, + p = n & d ? new lt() : void 0; + for (i.set(t, e), i.set(e, t); ++c < a; ) { + var h, + f = t[c], + y = e[c]; + if ( + void 0 !== + (h = r + ? s + ? r(y, f, c, e, t, i) + : r(f, y, c, t, e, i) + : h) + ) { + if (h) continue; + l = !1; + break; + } + if (p) { + if ( + !(function (t, e) { + for ( + var n = -1, r = null == t ? 0 : t.length; + ++n < r; + + ) + if (e(t[n], n, t)) return 1; + })(e, function (t, e) { + return ( + !p.has(e) && + (f === t || o(f, t, n, r, i)) && + p.push(e) + ); + }) + ) { + l = !1; + break; + } + } else if (f !== y && !o(f, y, n, r, i)) { + l = !1; + break; + } + } + return i.delete(t), i.delete(e), l; + } + function wt(t) { + return yt(t, Bt, Ot); + } + function jt(t, e) { + var n, + r = t.__data__; + return ( + 'string' == (t = typeof (n = e)) || + 'number' == t || + 'symbol' == t || + 'boolean' == t + ? '__proto__' !== n + : null === n + ) + ? r['string' == typeof e ? 'string' : 'hash'] + : r.map; + } + function kt(t, e) { + (e = e), (e = null == (t = t) ? void 0 : t[e]); + return bt(e) ? e : void 0; + } + (at.prototype.clear = function () { + (this.__data__ = tt ? tt(null) : {}), (this.size = 0); + }), + (at.prototype.delete = function (t) { + return ( + (t = this.has(t) && delete this.__data__[t]), + (this.size -= t ? 1 : 0), + t + ); + }), + (at.prototype.get = function (t) { + var e = this.__data__; + if (tt) { + var n = e[t]; + return n === r ? void 0 : n; + } + return D.call(e, t) ? e[t] : void 0; + }), + (at.prototype.has = function (t) { + var e = this.__data__; + return tt ? void 0 !== e[t] : D.call(e, t); + }), + (at.prototype.set = function (t, e) { + var n = this.__data__; + return ( + (this.size += this.has(t) ? 0 : 1), + (n[t] = tt && void 0 === e ? r : e), + this + ); + }), + (ut.prototype.clear = function () { + (this.__data__ = []), (this.size = 0); + }), + (ut.prototype.delete = function (t) { + var e = this.__data__; + return ( + !((t = ft(e, t)) < 0) && + (t == e.length - 1 ? e.pop() : X.call(e, t, 1), + --this.size, + !0) + ); + }), + (ut.prototype.get = function (t) { + var e = this.__data__; + return (t = ft(e, t)) < 0 ? void 0 : e[t][1]; + }), + (ut.prototype.has = function (t) { + return -1 < ft(this.__data__, t); + }), + (ut.prototype.set = function (t, e) { + var n = this.__data__, + r = ft(n, t); + return ( + r < 0 ? (++this.size, n.push([t, e])) : (n[r][1] = e), this + ); + }), + (ct.prototype.clear = function () { + (this.size = 0), + (this.__data__ = { + hash: new at(), + map: new (Z || ut)(), + string: new at(), + }); + }), + (ct.prototype.delete = function (t) { + return ( + (t = jt(this, t).delete(t)), (this.size -= t ? 1 : 0), t + ); + }), + (ct.prototype.get = function (t) { + return jt(this, t).get(t); + }), + (ct.prototype.has = function (t) { + return jt(this, t).has(t); + }), + (ct.prototype.set = function (t, e) { + var n = jt(this, t), + r = n.size; + return n.set(t, e), (this.size += n.size == r ? 0 : 1), this; + }), + (lt.prototype.add = lt.prototype.push = + function (t) { + return this.__data__.set(t, r), this; + }), + (lt.prototype.has = function (t) { + return this.__data__.has(t); + }), + (pt.prototype.clear = function () { + (this.__data__ = new ut()), (this.size = 0); + }), + (pt.prototype.delete = function (t) { + var e = this.__data__, + t = e.delete(t); + return (this.size = e.size), t; + }), + (pt.prototype.get = function (t) { + return this.__data__.get(t); + }), + (pt.prototype.has = function (t) { + return this.__data__.has(t); + }), + (pt.prototype.set = function (t, e) { + var n = this.__data__; + if (n instanceof ut) { + var r = n.__data__; + if (!Z || r.length < 199) + return r.push([t, e]), (this.size = ++n.size), this; + n = this.__data__ = new ct(r); + } + return n.set(t, e), (this.size = n.size), this; + }); + var Ot = Q + ? function (e) { + return null == e + ? [] + : ((e = Object(e)), + (function (t, e) { + for ( + var n = -1, + r = null == t ? 0 : t.length, + o = 0, + i = []; + ++n < r; + + ) { + var s = t[n]; + e(s, n, t) && (i[o++] = s); + } + return i; + })(Q(e), function (t) { + return J.call(e, t); + })); + } + : function () { + return []; + }, + Mt = dt; + function It(t) { + if (null != t) { + try { + return q.call(t); + } catch (t) {} + try { + return t + ''; + } catch (t) {} + } + return ''; + } + function St(t, e) { + return t === e || (t != t && e != e); + } + ((R && Mt(new R(new ArrayBuffer(1))) != S) || + (Z && Mt(new Z()) != v) || + (x && Mt(x.resolve()) != s) || + (L && Mt(new L()) != k) || + (z && Mt(new z()) != c)) && + (Mt = function (t) { + var e = dt(t), + t = e == w ? t.constructor : void 0, + t = t ? It(t) : ''; + if (t) + switch (t) { + case et: + return S; + case nt: + return v; + case rt: + return s; + case ot: + return k; + case it: + return c; + } + return e; + }); + var Ct = gt( + (function () { + return arguments; + })(), + ) + ? gt + : function (t) { + return ( + Rt(t) && D.call(t, 'callee') && !J.call(t, 'callee') + ); + }, + Pt = Array.isArray; + var At = + T || + function () { + return !1; + }; + function zt(t) { + if (xt(t)) { + t = dt(t); + return t == n || t == o || t == e || t == a; + } + } + function Lt(t) { + return 'number' == typeof t && -1 < t && t % 1 == 0 && t <= h; + } + function xt(t) { + var e = typeof t; + return null != t && ('object' == e || 'function' == e); + } + function Rt(t) { + return null != t && 'object' == typeof t; + } + var Et, + Tt = A + ? ((Et = A), + function (t) { + return Et(t); + }) + : function (t) { + return Rt(t) && Lt(t.length) && !!P[dt(t)]; + }; + function Bt(t) { + return (null != (e = t) && Lt(e.length) && !zt(e) ? ht : vt)(t); + var e; + } + Ft.exports = function (t, e) { + return _t(t, e); + }; + }.call(this); + }.call( + this, + 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : 'undefined' != typeof window + ? window + : {}, + ); + }, + {}, + ], + 8: [ + function (t, e, n) { + var r, o, i; + (r = this), + (o = function () { + var a = null, + u = {}; + t('monochrome', null, [ + [0, 0], + [100, 0], + ]), + t( + 'red', + [-26, 18], + [ + [20, 100], + [30, 92], + [40, 89], + [50, 85], + [60, 78], + [70, 70], + [80, 60], + [90, 55], + [100, 50], + ], + ), + t( + 'orange', + [18, 46], + [ + [20, 100], + [30, 93], + [40, 88], + [50, 86], + [60, 85], + [70, 70], + [100, 70], + ], + ), + t( + 'yellow', + [46, 62], + [ + [25, 100], + [40, 94], + [50, 89], + [60, 86], + [70, 84], + [80, 82], + [90, 80], + [100, 75], + ], + ), + t( + 'green', + [62, 178], + [ + [30, 100], + [40, 90], + [50, 85], + [60, 81], + [70, 74], + [80, 64], + [90, 50], + [100, 40], + ], + ), + t( + 'blue', + [178, 257], + [ + [20, 100], + [30, 86], + [40, 80], + [50, 74], + [60, 60], + [70, 52], + [80, 44], + [90, 39], + [100, 35], + ], + ), + t( + 'purple', + [257, 282], + [ + [20, 100], + [30, 87], + [40, 79], + [50, 70], + [60, 65], + [70, 59], + [80, 52], + [90, 45], + [100, 42], + ], + ), + t( + 'pink', + [282, 334], + [ + [20, 100], + [30, 90], + [40, 86], + [60, 84], + [80, 80], + [90, 75], + [100, 73], + ], + ); + function c(t) { + if ( + void 0 !== (t = t || {}).seed && + null !== t.seed && + t.seed === parseInt(t.seed, 10) + ) + a = t.seed; + else if ('string' == typeof t.seed) + a = (function (t) { + for ( + var e = 0, n = 0; + n !== t.length && !(e >= Number.MAX_SAFE_INTEGER); + n++ + ) + e += t.charCodeAt(n); + return e; + })(t.seed); + else { + if (void 0 !== t.seed && null !== t.seed) + throw new TypeError( + 'The seed value must be an integer or string', + ); + a = null; + } + var e, n; + if (null === t.count || void 0 === t.count) + return (function (t, e) { + switch (e.format) { + case 'hsvArray': + return t; + case 'hslArray': + return d(t); + case 'hsl': + var n = d(t); + return ( + 'hsl(' + n[0] + ', ' + n[1] + '%, ' + n[2] + '%)' + ); + case 'hsla': + var r = d(t), + o = e.alpha || Math.random(); + return ( + 'hsla(' + + r[0] + + ', ' + + r[1] + + '%, ' + + r[2] + + '%, ' + + o + + ')' + ); + case 'rgbArray': + return f(t); + case 'rgb': + return 'rgb(' + f(t).join(', ') + ')'; + case 'rgba': + (r = f(t)), (o = e.alpha || Math.random()); + return 'rgba(' + r.join(', ') + ', ' + o + ')'; + default: + return (function (t) { + t = f(t); + function e(t) { + t = t.toString(16); + return 1 == t.length ? '0' + t : t; + } + return '#' + e(t[0]) + e(t[1]) + e(t[2]); + })(t); + } + })( + [ + (e = (function (t) { + { + if (0 < l.length) { + var e = h( + (i = (function (t) { + if (isNaN(t)) { + if ('string' == typeof t) + if (u[t]) { + var e = u[t]; + if (e.hueRange) return e.hueRange; + } else if ( + t.match( + /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i, + ) + ) + return p(y(t)[0]).hueRange; + } else { + e = parseInt(t); + if (e < 360 && 0 < e) return p(t).hueRange; + } + return [0, 360]; + })(t.hue)), + ), + n = (i[1] - i[0]) / l.length, + r = parseInt((e - i[0]) / n); + !0 === l[r] + ? (r = (r + 2) % l.length) + : (l[r] = !0); + var o = (i[0] + r * n) % 359, + n = (i[0] + (r + 1) * n) % 359; + return (e = + (e = h((i = [o, n]))) < 0 ? 360 + e : e); + } + var i = (function (t) { + if ('number' == typeof parseInt(t)) { + var e = parseInt(t); + if (e < 360 && 0 < e) return [e, e]; + } + if ('string' == typeof t) + if (u[t]) { + e = u[t]; + if (e.hueRange) return e.hueRange; + } else if ( + t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i) + ) { + t = y(t)[0]; + return [t, t]; + } + return [0, 360]; + })(t.hue); + return (e = (e = h(i)) < 0 ? 360 + e : e); + } + })(t)), + (n = (function (t, e) { + if ('monochrome' === e.hue) return 0; + if ('random' === e.luminosity) return h([0, 100]); + var t = (function (t) { + return p(t).saturationRange; + })(t), + n = t[0], + r = t[1]; + switch (e.luminosity) { + case 'bright': + n = 55; + break; + case 'dark': + n = r - 10; + break; + case 'light': + r = 55; + } + return h([n, r]); + })(e, t)), + (function (t, e, n) { + var r = (function (t, e) { + for ( + var n = p(t).lowerBounds, r = 0; + r < n.length - 1; + r++ + ) { + var o = n[r][0], + i = n[r][1], + s = n[r + 1][0], + a = n[r + 1][1]; + if (o <= e && e <= s) { + s = (a - i) / (s - o); + return s * e + (i - s * o); + } + } + return 0; + })(t, e), + o = 100; + switch (n.luminosity) { + case 'dark': + o = r + 20; + break; + case 'light': + r = (o + r) / 2; + break; + case 'random': + (r = 0), (o = 100); + } + return h([r, o]); + })(e, n, t), + ], + t, + ); + for (var r = t.count, o = [], i = 0; i < t.count; i++) + l.push(!1); + for (t.count = null; r > o.length; ) { + var s = c(t); + null !== a && (t.seed = a), o.push(s); + } + return (t.count = r), o; + } + var l = []; + function p(t) { + for (var e in (334 <= t && t <= 360 && (t -= 360), u)) { + var n = u[e]; + if (n.hueRange && t >= n.hueRange[0] && t <= n.hueRange[1]) + return u[e]; + } + return 'Color not found'; + } + function h(t) { + if (null === a) { + var e = Math.random(); + return ( + (e += 0.618033988749895), + (e %= 1), + Math.floor(t[0] + e * (t[1] + 1 - t[0])) + ); + } + var n = t[1] || 1, + e = t[0] || 0, + t = (a = (9301 * a + 49297) % 233280) / 233280; + return Math.floor(e + t * (n - e)); + } + function t(t, e, n) { + var r = n[0][0], + o = n[n.length - 1][0], + i = n[n.length - 1][1], + s = n[0][1]; + u[t] = { + hueRange: e, + lowerBounds: n, + saturationRange: [r, o], + brightnessRange: [i, s], + }; + } + function f(t) { + var e = t[0]; + 360 === (e = 0 === e ? 1 : e) && (e = 359), (e /= 360); + var n = t[1] / 100, + r = t[2] / 100, + t = Math.floor(6 * e), + e = 6 * e - t, + o = r * (1 - n), + i = r * (1 - e * n), + s = r * (1 - (1 - e) * n), + a = 256, + u = 256, + c = 256; + switch (t) { + case 0: + (a = r), (u = s), (c = o); + break; + case 1: + (a = i), (u = r), (c = o); + break; + case 2: + (a = o), (u = r), (c = s); + break; + case 3: + (a = o), (u = i), (c = r); + break; + case 4: + (a = s), (u = o), (c = r); + break; + case 5: + (a = r), (u = o), (c = i); + } + return [ + Math.floor(255 * a), + Math.floor(255 * u), + Math.floor(255 * c), + ]; + } + function y(t) { + t = + 3 === (t = t.replace(/^#/, '')).length + ? t.replace(/(.)/g, '$1$1') + : t; + var e = parseInt(t.substr(0, 2), 16) / 255, + n = parseInt(t.substr(2, 2), 16) / 255, + r = parseInt(t.substr(4, 2), 16) / 255, + o = Math.max(e, n, r), + i = o - Math.min(e, n, r), + s = o ? i / o : 0; + switch (o) { + case e: + return [(((n - r) / i) % 6) * 60 || 0, s, o]; + case n: + return [60 * ((r - e) / i + 2) || 0, s, o]; + case r: + return [60 * ((e - n) / i + 4) || 0, s, o]; + } + } + function d(t) { + var e = t[0], + n = t[1] / 100, + r = t[2] / 100, + t = (2 - n) * r; + return [ + e, + Math.round(((n * r) / (t < 1 ? t : 2 - t)) * 1e4) / 100, + (t / 2) * 100, + ]; + } + return c; + }), + 'object' == typeof n + ? ((i = o()), + ((n = + 'object' == typeof e && e && e.exports + ? (e.exports = i) + : n).randomColor = i)) + : (r.randomColor = o()); + }, + {}, + ], + }, + {}, + [1], + )(1); +}); diff --git a/public/resources/maplibre-gl-inspect.min.js b/public/resources/maplibre-gl-inspect.min.js index 04f6d75..bca3ad5 100644 --- a/public/resources/maplibre-gl-inspect.min.js +++ b/public/resources/maplibre-gl-inspect.min.js @@ -1 +1,1598 @@ -!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MaplibreInspect=t()}(function(){return function r(o,i,s){function a(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return a(o[e][1][t]||t)},n,n.exports,r,o,i,s)}return i[e].exports}for(var u="function"==typeof require&&require,t=0;t
'+t+'
'+(null==(e=e)?e:e instanceof Date?e.toLocaleString():"object"==typeof e||"number"==typeof e||"string"==typeof e?e.toString():e)+"
"}function r(t){return t.map(function(t){return'
'+(n='
'+((e=t).layer["source-layer"]||e.layer.source)+"
",r=o("$type",e.geometry.type),t=Object.keys(e.properties).map(function(t){return o(t,e.properties[t])}),[n,r].concat(t).join(""))+"
";var e,n,r}).join("")}e.exports=function(t){return'
'+r(t)+"
"}},{}],6:[function(t,e,n){function a(t,e,n){t={id:[e,n,"circle"].join("_"),source:e,type:"circle",paint:{"circle-color":t,"circle-radius":2},filter:["==","$type","Point"]};return n&&(t["source-layer"]=n),t}function u(t,e,n,r){t={id:[n,r,"polygon"].join("_"),source:n,type:"fill",paint:{"fill-color":t,"fill-antialias":!0,"fill-outline-color":t},filter:["==","$type","Polygon"]};return r&&(t["source-layer"]=r),t}function c(t,e,n){t={id:[e,n,"line"].join("_"),source:e,layout:{"line-join":"round","line-cap":"round"},type:"line",paint:{"line-color":t},filter:["==","$type","LineString"]};return n&&(t["source-layer"]=n),t}n.polygonLayer=u,n.lineLayer=c,n.circleLayer=a,n.generateInspectStyle=function(n,t,e){var e={id:"background",type:"background",paint:{"background-color":(e=Object.assign({backgroundColor:"#fff"},e)).backgroundColor}},r={};return Object.keys(n.sources).forEach(function(t){var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(r[t]=e)}),Object.assign(n,{layers:[e].concat(t),soources:r})},n.generateColoredLayers=function(e,n){var r=[],o=[],i=[];function s(t){t=n.bind(null,t);return{circle:t(.8),line:t(.6),polygon:t(.3),polygonOutline:t(.6),default:t(1)}}return Object.keys(e).forEach(function(n){var t=e[n];t&&0!==t.length?t.forEach(function(t){var e=s(t);o.push(a(e.circle,n,t)),i.push(c(e.line,n,t)),r.push(u(e.polygon,e.polygonOutline,n,t))}):(t=s(n),o.push(a(t.circle,n)),i.push(c(t.line,n)),r.push(u(t.polygon,t.polygonOutline,n)))}),r.concat(i).concat(o)}},{}],7:[function(t,Ft,Ht){!function($t){!function(){var r="__lodash_hash_undefined__",b=1,y=2,h=9007199254740991,p="[object Arguments]",f="[object Array]",e="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",_="[object Error]",n="[object Function]",o="[object GeneratorFunction]",v="[object Map]",m="[object Number]",i="[object Null]",w="[object Object]",s="[object Promise]",a="[object Proxy]",j="[object RegExp]",k="[object Set]",O="[object String]",M="[object Symbol]",u="[object Undefined]",c="[object WeakMap]",I="[object ArrayBuffer]",C="[object DataView]",l=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[p]=A[f]=A[I]=A[d]=A[C]=A[g]=A[_]=A[n]=A[v]=A[m]=A[w]=A[j]=A[k]=A[O]=A[c]=!1;var t="object"==typeof $t&&$t&&$t.Object===Object&&$t,P="object"==typeof self&&self&&self.Object===Object&&self,z=t||P||Function("return this")(),L="object"==typeof Ht&&Ht&&!Ht.nodeType&&Ht,x=L&&"object"==typeof Ft&&Ft&&!Ft.nodeType&&Ft,R=x&&x.exports===L,E=R&&t.process,T=function(){try{return E&&E.binding&&E.binding("util")}catch(t){}}(),P=T&&T.isTypedArray;function B(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var F,H,x=Array.prototype,L=Function.prototype,N=Object.prototype,t=z["__core-js_shared__"],q=L.toString,D=N.hasOwnProperty,U=(T=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",G=N.toString,V=RegExp("^"+q.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=R?z.Buffer:void 0,t=z.Symbol,W=z.Uint8Array,J=N.propertyIsEnumerable,X=x.splice,K=t?t.toStringTag:void 0,Q=Object.getOwnPropertySymbols,T=L?L.isBuffer:void 0,Y=(F=Object.keys,H=Object,function(t){return F(H(t))}),R=kt(z,"DataView"),Z=kt(z,"Map"),x=kt(z,"Promise"),L=kt(z,"Set"),z=kt(z,"WeakMap"),tt=kt(Object,"create"),et=It(R),nt=It(Z),rt=It(x),ot=It(L),it=It(z),t=t?t.prototype:void 0,st=t?t.valueOf:void 0;function at(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=Number.MAX_SAFE_INTEGER);n++)e+=t.charCodeAt(n);return e}(t.seed);else{if(void 0!==t.seed&&null!==t.seed)throw new TypeError("The seed value must be an integer or string");a=null}var e,n;if(null===t.count||void 0===t.count)return function(t,e){switch(e.format){case"hsvArray":return t;case"hslArray":return y(t);case"hsl":var n=y(t);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var r=y(t),o=e.alpha||Math.random();return"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+o+")";case"rgbArray":return f(t);case"rgb":return"rgb("+f(t).join(", ")+")";case"rgba":r=f(t),o=e.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return function(t){t=f(t);function e(t){t=t.toString(16);return 1==t.length?"0"+t:t}return"#"+e(t[0])+e(t[1])+e(t[2])}(t)}}([e=function(t){{if(0o.length;){var s=c(t);null!==a&&(t.seed=a),o.push(s)}return t.count=r,o}var l=[];function p(t){for(var e in 334<=t&&t<=360&&(t-=360),u){var n=u[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return u[e]}return"Color not found"}function h(t){if(null===a){var e=Math.random();return e+=.618033988749895,e%=1,Math.floor(t[0]+e*(t[1]+1-t[0]))}var n=t[1]||1,e=t[0]||0,t=(a=(9301*a+49297)%233280)/233280;return Math.floor(e+t*(n-e))}function t(t,e,n){var r=n[0][0],o=n[n.length-1][0],i=n[n.length-1][1],s=n[0][1];u[t]={hueRange:e,lowerBounds:n,saturationRange:[r,o],brightnessRange:[i,s]}}function f(t){var e=t[0];360===(e=0===e?1:e)&&(e=359),e/=360;var n=t[1]/100,r=t[2]/100,t=Math.floor(6*e),e=6*e-t,o=r*(1-n),i=r*(1-e*n),s=r*(1-(1-e)*n),a=256,u=256,c=256;switch(t){case 0:a=r,u=s,c=o;break;case 1:a=i,u=r,c=o;break;case 2:a=o,u=r,c=s;break;case 3:a=o,u=i,c=r;break;case 4:a=s,u=o,c=r;break;case 5:a=r,u=o,c=i}return[Math.floor(255*a),Math.floor(255*u),Math.floor(255*c)]}function d(t){t=3===(t=t.replace(/^#/,"")).length?t.replace(/(.)/g,"$1$1"):t;var e=parseInt(t.substr(0,2),16)/255,n=parseInt(t.substr(2,2),16)/255,r=parseInt(t.substr(4,2),16)/255,o=Math.max(e,n,r),i=o-Math.min(e,n,r),s=o?i/o:0;switch(o){case e:return[(n-r)/i%6*60||0,s,o];case n:return[60*((r-e)/i+2)||0,s,o];case r:return[60*((e-n)/i+4)||0,s,o]}}function y(t){var e=t[0],n=t[1]/100,r=t[2]/100,t=(2-n)*r;return[e,Math.round(n*r/(t<1?t:2-t)*1e4)/100,t/2*100]}return c},"object"==typeof n?(i=o(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):r.randomColor=o()},{}]},{},[1])(1)}); \ No newline at end of file +!(function (t) { + 'object' == typeof exports && 'undefined' != typeof module + ? (module.exports = t()) + : 'function' == typeof define && define.amd + ? define([], t) + : (('undefined' != typeof window + ? window + : 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : this + ).MaplibreInspect = t()); +})(function () { + return (function r(o, i, s) { + function a(e, t) { + if (!i[e]) { + if (!o[e]) { + var n = 'function' == typeof require && require; + if (!t && n) return n(e, !0); + if (u) return u(e, !0); + throw ( + (((n = new Error("Cannot find module '" + e + "'")).code = + 'MODULE_NOT_FOUND'), + n) + ); + } + (n = i[e] = { exports: {} }), + o[e][0].call( + n.exports, + function (t) { + return a(o[e][1][t] || t); + }, + n, + n.exports, + r, + o, + i, + s, + ); + } + return i[e].exports; + } + for ( + var u = 'function' == typeof require && require, t = 0; + t < s.length; + t++ + ) + a(s[t]); + return a; + })( + { + 1: [ + function (t, e, n) { + t = t('./lib/MaplibreInspect'); + e.exports = t; + }, + { './lib/MaplibreInspect': 3 }, + ], + 2: [ + function (t, e, n) { + function r(t) { + var e, n; + (t = Object.assign({ show: !0, onToggle: function () {} }, t)), + (this._btn = + (((n = document.createElement('button')).className = + 'maplibregl-ctrl-icon maplibregl-ctrl-inspect'), + (n.type = 'button'), + (n['aria-label'] = 'Inspect'), + n)), + (this._btn.onclick = t.onToggle), + (this.elem = + ((e = this._btn), + (n = t.show), + ((t = document.createElement('div')).className = + 'maplibregl-ctrl maplibregl-ctrl-group'), + t.appendChild(e), + n || (t.style.display = 'none'), + t)); + } + (r.prototype.setInspectIcon = function () { + this._btn.className = + 'maplibregl-ctrl-icon maplibregl-ctrl-inspect'; + }), + (r.prototype.setMapIcon = function () { + this._btn.className = 'maplibregl-ctrl-icon maplibregl-ctrl-map'; + }), + (e.exports = r); + }, + {}, + ], + 3: [ + function (t, e, n) { + var r = t('./stylegen'), + o = t('./InspectButton'), + i = t('lodash.isequal'), + s = t('./renderPopup'), + a = t('./colors'); + function u(t) { + if (!(this instanceof u)) + throw new Error( + 'MaplibreInspect needs to be called with the new keyword', + ); + var e = null; + window.maplibregl + ? (e = new window.maplibregl.Popup({ + closeButton: !1, + closeOnClick: !1, + })) + : t.popup || + console.error( + 'Maplibre GL JS can not be found. Make sure to include it or pass an initialized MaplibreGL Popup to MaplibreInspect if you are using moduleis.', + ), + (this.options = Object.assign( + { + showInspectMap: !1, + showInspectButton: !0, + showInspectMapPopup: !0, + showMapPopup: !1, + showMapPopupOnHover: !0, + showInspectMapPopupOnHover: !0, + blockHoverPopupOnClick: !1, + backgroundColor: '#fff', + assignLayerColor: a.brightColor, + buildInspectStyle: r.generateInspectStyle, + renderPopup: s, + popup: e, + selectThreshold: 5, + useInspectStyle: !0, + queryParameters: {}, + sources: {}, + }, + t, + )), + (this.sources = this.options.sources), + (this.assignLayerColor = this.options.assignLayerColor), + (this.toggleInspector = this.toggleInspector.bind(this)), + (this._popup = this.options.popup), + (this._popupBlocked = !1), + (this._showInspectMap = this.options.showInspectMap), + (this._onSourceChange = this._onSourceChange.bind(this)), + (this._onMousemove = this._onMousemove.bind(this)), + (this._onRightClick = this._onRightClick.bind(this)), + (this._onStyleChange = this._onStyleChange.bind(this)), + (this._originalStyle = null), + (this._toggle = new o({ + show: this.options.showInspectButton, + onToggle: this.toggleInspector.bind(this), + })); + } + (u.prototype.toggleInspector = function () { + (this._showInspectMap = !this._showInspectMap), this.render(); + }), + (u.prototype._inspectStyle = function () { + var t = r.generateColoredLayers( + this.sources, + this.assignLayerColor, + ); + return this.options.buildInspectStyle(this._map.getStyle(), t, { + backgroundColor: this.options.backgroundColor, + }); + }), + (u.prototype.render = function () { + var t; + this._showInspectMap + ? (this.options.useInspectStyle && + this._map.setStyle( + ((t = this._inspectStyle()), + Object.assign(t, { + metadata: Object.assign({}, t.metadata, { + 'maplibregl-inspect:inspect': !0, + }), + })), + ), + this._toggle.setMapIcon()) + : this._originalStyle && + (this._popup && this._popup.remove(), + this.options.useInspectStyle && + this._map.setStyle(this._originalStyle), + this._toggle.setInspectIcon()); + }), + (u.prototype._onSourceChange = function (t) { + var r = this.sources, + o = this._map, + e = o.getStyle(), + n = Object.keys(e.sources), + e = Object.assign({}, r); + 'visibility' !== t.sourceDataType && + t.isSourceLoaded && + (Object.keys(o.style.sourceCaches).forEach(function (t) { + var e = o.style.sourceCaches[t] || { _source: {} }, + n = e._source.vectorLayerIds; + n ? (r[t] = n) : 'geojson' === e._source.type && (r[t] = []); + }), + Object.keys(r).forEach(function (t) { + -1 === n.indexOf(t) && delete r[t]; + }), + !i(e, r) && 0 < Object.keys(r).length && this.render()); + }), + (u.prototype._onStyleChange = function () { + var t, + e = this._map.getStyle(); + ((t = e).metadata && t.metadata['maplibregl-inspect:inspect']) || + (this._originalStyle = e); + }), + (u.prototype._onRightClick = function () { + this.options.showMapPopupOnHover || + this.options.showInspectMapPopupOnHover || + this.options.blockHoverPopupOnClick || + (this._popup && this._popup.remove()); + }), + (u.prototype._onMousemove = function (t) { + if (this._showInspectMap) { + if (!this.options.showInspectMapPopup) return; + if ( + 'mousemove' === t.type && + !this.options.showInspectMapPopupOnHover + ) + return; + 'click' === t.type && + this.options.showInspectMapPopupOnHover && + this.options.blockHoverPopupOnClick && + (this._popupBlocked = !this._popupBlocked); + } else { + if (!this.options.showMapPopup) return; + if ('mousemove' === t.type && !this.options.showMapPopupOnHover) + return; + 'click' === t.type && + this.options.showMapPopupOnHover && + this.options.blockHoverPopupOnClick && + (this._popupBlocked = !this._popupBlocked); + } + var e; + !this._popupBlocked && + this._popup && + ((e = + 0 === this.options.selectThreshold + ? t.point + : [ + [ + t.point.x - this.options.selectThreshold, + t.point.y + this.options.selectThreshold, + ], + [ + t.point.x + this.options.selectThreshold, + t.point.y - this.options.selectThreshold, + ], + ]), + (e = + this._map.queryRenderedFeatures( + e, + this.options.queryParameters, + ) || []), + (this._map.getCanvas().style.cursor = e.length + ? 'pointer' + : ''), + e.length + ? (this._popup.setLngLat(t.lngLat), + 'string' == typeof (e = this.options.renderPopup(e)) + ? this._popup.setHTML(e) + : this._popup.setDOMContent(e), + this._popup.addTo(this._map)) + : this._popup.remove()); + }), + (u.prototype.onAdd = function (t) { + return ( + (this._map = t), + 0 === Object.keys(this.sources).length && + (t.on('tiledata', this._onSourceChange), + t.on('sourcedata', this._onSourceChange)), + t.on('styledata', this._onStyleChange), + t.on('load', this._onStyleChange), + t.on('mousemove', this._onMousemove), + t.on('click', this._onMousemove), + t.on('contextmenu', this._onRightClick), + this._toggle.elem + ); + }), + (u.prototype.onRemove = function () { + this._map.off('styledata', this._onStyleChange), + this._map.off('load', this._onStyleChange), + this._map.off('tiledata', this._onSourceChange), + this._map.off('sourcedata', this._onSourceChange), + this._map.off('mousemove', this._onMousemove), + this._map.off('click', this._onMousemove), + this._map.off('contextmenu', this._onRightClick); + var t = this._toggle.elem; + t.parentNode.removeChild(t), (this._map = void 0); + }), + (e.exports = u); + }, + { + './InspectButton': 2, + './colors': 4, + './renderPopup': 5, + './stylegen': 6, + 'lodash.isequal': 7, + }, + ], + 4: [ + function (t, e, n) { + var o = t('randomcolor'); + n.brightColor = function (t, e) { + var n = 'bright', + r = null; + return ( + /water|ocean|lake|sea|river/.test(t) && (r = 'blue'), + /state|country|place/.test(t) && (r = 'pink'), + /road|highway|transport/.test(t) && (r = 'orange'), + /contour|building/.test(t) && (r = 'monochrome'), + /building/.test(t) && (n = 'dark'), + /contour|landuse/.test(t) && (r = 'yellow'), + /wood|forest|park|landcover/.test(t) && (r = 'green'), + 'rgba(' + + o({ luminosity: n, hue: r, seed: t, format: 'rgbArray' }) + .concat([e || 1]) + .join(', ') + + ')' + ); + }; + }, + { randomcolor: 8 }, + ], + 5: [ + function (t, e, n) { + function o(t, e) { + return ( + '
' + + t + + '
' + + (null == (e = e) + ? e + : e instanceof Date + ? e.toLocaleString() + : 'object' == typeof e || + 'number' == typeof e || + 'string' == typeof e + ? e.toString() + : e) + + '
' + ); + } + function r(t) { + return t + .map(function (t) { + return ( + '
' + + ((n = + '
' + + ((e = t).layer['source-layer'] || e.layer.source) + + '
'), + (r = o('$type', e.geometry.type)), + (t = Object.keys(e.properties).map(function (t) { + return o(t, e.properties[t]); + })), + [n, r].concat(t).join('')) + + '
' + ); + var e, n, r; + }) + .join(''); + } + e.exports = function (t) { + return '
' + r(t) + '
'; + }; + }, + {}, + ], + 6: [ + function (t, e, n) { + function a(t, e, n) { + t = { + id: [e, n, 'circle'].join('_'), + source: e, + type: 'circle', + paint: { 'circle-color': t, 'circle-radius': 2 }, + filter: ['==', '$type', 'Point'], + }; + return n && (t['source-layer'] = n), t; + } + function u(t, e, n, r) { + t = { + id: [n, r, 'polygon'].join('_'), + source: n, + type: 'fill', + paint: { + 'fill-color': t, + 'fill-antialias': !0, + 'fill-outline-color': t, + }, + filter: ['==', '$type', 'Polygon'], + }; + return r && (t['source-layer'] = r), t; + } + function c(t, e, n) { + t = { + id: [e, n, 'line'].join('_'), + source: e, + layout: { 'line-join': 'round', 'line-cap': 'round' }, + type: 'line', + paint: { 'line-color': t }, + filter: ['==', '$type', 'LineString'], + }; + return n && (t['source-layer'] = n), t; + } + (n.polygonLayer = u), + (n.lineLayer = c), + (n.circleLayer = a), + (n.generateInspectStyle = function (n, t, e) { + var e = { + id: 'background', + type: 'background', + paint: { + 'background-color': (e = Object.assign( + { backgroundColor: '#fff' }, + e, + )).backgroundColor, + }, + }, + r = {}; + return ( + Object.keys(n.sources).forEach(function (t) { + var e = n.sources[t]; + ('vector' !== e.type && 'geojson' !== e.type) || (r[t] = e); + }), + Object.assign(n, { layers: [e].concat(t), soources: r }) + ); + }), + (n.generateColoredLayers = function (e, n) { + var r = [], + o = [], + i = []; + function s(t) { + t = n.bind(null, t); + return { + circle: t(0.8), + line: t(0.6), + polygon: t(0.3), + polygonOutline: t(0.6), + default: t(1), + }; + } + return ( + Object.keys(e).forEach(function (n) { + var t = e[n]; + t && 0 !== t.length + ? t.forEach(function (t) { + var e = s(t); + o.push(a(e.circle, n, t)), + i.push(c(e.line, n, t)), + r.push(u(e.polygon, e.polygonOutline, n, t)); + }) + : ((t = s(n)), + o.push(a(t.circle, n)), + i.push(c(t.line, n)), + r.push(u(t.polygon, t.polygonOutline, n))); + }), + r.concat(i).concat(o) + ); + }); + }, + {}, + ], + 7: [ + function (t, Ft, Ht) { + !function ($t) { + !function () { + var r = '__lodash_hash_undefined__', + b = 1, + y = 2, + h = 9007199254740991, + p = '[object Arguments]', + f = '[object Array]', + e = '[object AsyncFunction]', + d = '[object Boolean]', + g = '[object Date]', + _ = '[object Error]', + n = '[object Function]', + o = '[object GeneratorFunction]', + v = '[object Map]', + m = '[object Number]', + i = '[object Null]', + w = '[object Object]', + s = '[object Promise]', + a = '[object Proxy]', + j = '[object RegExp]', + k = '[object Set]', + O = '[object String]', + M = '[object Symbol]', + u = '[object Undefined]', + c = '[object WeakMap]', + I = '[object ArrayBuffer]', + C = '[object DataView]', + l = /^\[object .+?Constructor\]$/, + S = /^(?:0|[1-9]\d*)$/, + A = {}; + (A['[object Float32Array]'] = + A['[object Float64Array]'] = + A['[object Int8Array]'] = + A['[object Int16Array]'] = + A['[object Int32Array]'] = + A['[object Uint8Array]'] = + A['[object Uint8ClampedArray]'] = + A['[object Uint16Array]'] = + A['[object Uint32Array]'] = + !0), + (A[p] = + A[f] = + A[I] = + A[d] = + A[C] = + A[g] = + A[_] = + A[n] = + A[v] = + A[m] = + A[w] = + A[j] = + A[k] = + A[O] = + A[c] = + !1); + var t = 'object' == typeof $t && $t && $t.Object === Object && $t, + P = + 'object' == typeof self && + self && + self.Object === Object && + self, + z = t || P || Function('return this')(), + L = 'object' == typeof Ht && Ht && !Ht.nodeType && Ht, + x = L && 'object' == typeof Ft && Ft && !Ft.nodeType && Ft, + R = x && x.exports === L, + E = R && t.process, + T = (function () { + try { + return E && E.binding && E.binding('util'); + } catch (t) {} + })(), + P = T && T.isTypedArray; + function B(t) { + var n = -1, + r = Array(t.size); + return ( + t.forEach(function (t, e) { + r[++n] = [e, t]; + }), + r + ); + } + function $(t) { + var e = -1, + n = Array(t.size); + return ( + t.forEach(function (t) { + n[++e] = t; + }), + n + ); + } + var F, + H, + x = Array.prototype, + L = Function.prototype, + N = Object.prototype, + t = z['__core-js_shared__'], + q = L.toString, + D = N.hasOwnProperty, + U = (T = /[^.]+$/.exec((t && t.keys && t.keys.IE_PROTO) || '')) + ? 'Symbol(src)_1.' + T + : '', + G = N.toString, + V = RegExp( + '^' + + q + .call(D) + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace( + /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, + '$1.*?', + ) + + '$', + ), + L = R ? z.Buffer : void 0, + t = z.Symbol, + W = z.Uint8Array, + J = N.propertyIsEnumerable, + X = x.splice, + K = t ? t.toStringTag : void 0, + Q = Object.getOwnPropertySymbols, + T = L ? L.isBuffer : void 0, + Y = + ((F = Object.keys), + (H = Object), + function (t) { + return F(H(t)); + }), + R = kt(z, 'DataView'), + Z = kt(z, 'Map'), + x = kt(z, 'Promise'), + L = kt(z, 'Set'), + z = kt(z, 'WeakMap'), + tt = kt(Object, 'create'), + et = It(R), + nt = It(Z), + rt = It(x), + ot = It(L), + it = It(z), + t = t ? t.prototype : void 0, + st = t ? t.valueOf : void 0; + function at(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function ut(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function ct(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var r = t[e]; + this.set(r[0], r[1]); + } + } + function lt(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.__data__ = new ct(); ++e < n; ) this.add(t[e]); + } + function pt(t) { + t = this.__data__ = new ut(t); + this.size = t.size; + } + function ht(t, e) { + var n, + r, + o, + i = At(t), + s = !i && St(t), + a = !i && !s && Pt(t), + u = !i && !s && !a && Tt(t), + c = i || s || a || u, + l = c + ? (function (t, e) { + for (var n = -1, r = Array(t); ++n < t; ) r[n] = e(n); + return r; + })(t.length, String) + : [], + p = l.length; + for (n in t) + (!e && !D.call(t, n)) || + (c && + ('length' == n || + (a && ('offset' == n || 'parent' == n)) || + (u && + ('buffer' == n || + 'byteLength' == n || + 'byteOffset' == n)) || + ((r = n), + !!(o = null == (o = p) ? h : o) && + ('number' == typeof r || S.test(r)) && + -1 < r && + r % 1 == 0 && + r < o))) || + l.push(n); + return l; + } + function ft(t, e) { + for (var n = t.length; n--; ) if (Ct(t[n][0], e)) return n; + return -1; + } + function dt(t, e, n) { + e = e(t); + return At(t) + ? e + : (function (t, e) { + for (var n = -1, r = e.length, o = t.length; ++n < r; ) + t[o + n] = e[n]; + return t; + })(e, n(t)); + } + function yt(t) { + return null == t + ? void 0 === t + ? u + : i + : K && K in Object(t) + ? (function (t) { + var e = D.call(t, K), + n = t[K]; + try { + var r = !(t[K] = void 0); + } catch (t) {} + var o = G.call(t); + r && (e ? (t[K] = n) : delete t[K]); + return o; + })(t) + : G.call(t); + } + function gt(t) { + return Rt(t) && yt(t) == p; + } + function _t(t, e, n, r, o) { + return ( + t === e || + (null == t || null == e || (!Rt(t) && !Rt(e)) + ? t != t && e != e + : (function (t, e, n, r, o, i) { + var s = At(t), + a = At(e), + u = s ? f : Mt(t), + c = a ? f : Mt(e), + l = (u = u == p ? w : u) == w, + a = (c = c == p ? w : c) == w, + c = u == c; + if (c && Pt(t)) { + if (!Pt(e)) return !1; + l = !(s = !0); + } + if (c && !l) + return ( + (i = i || new pt()), + s || Tt(t) + ? mt(t, e, n, r, o, i) + : (function (t, e, n, r, o, i, s) { + switch (n) { + case C: + if ( + t.byteLength != e.byteLength || + t.byteOffset != e.byteOffset + ) + return !1; + (t = t.buffer), (e = e.buffer); + case I: + return t.byteLength == e.byteLength && + i(new W(t), new W(e)) + ? !0 + : !1; + case d: + case g: + case m: + return Ct(+t, +e); + case _: + return ( + t.name == e.name && + t.message == e.message + ); + case j: + case O: + return t == e + ''; + case v: + var a = B; + case k: + var u = r & b; + if ( + ((a = a || $), t.size != e.size && !u) + ) + return !1; + u = s.get(t); + if (u) return u == e; + (r |= y), s.set(t, e); + a = mt(a(t), a(e), r, o, i, s); + return s.delete(t), a; + case M: + if (st) return st.call(t) == st.call(e); + } + return !1; + })(t, e, u, n, r, o, i) + ); + if (!(n & b)) { + (l = l && D.call(t, '__wrapped__')), + (a = a && D.call(e, '__wrapped__')); + if (l || a) { + (l = l ? t.value() : t), (a = a ? e.value() : e); + return (i = i || new pt()), o(l, a, n, r, i); + } + } + return ( + c && + ((i = i || new pt()), + (function (t, e, n, r, o, i) { + var s = n & b, + a = wt(t), + u = a.length, + c = wt(e).length; + if (u != c && !s) return !1; + var l = u; + for (; l--; ) { + var p = a[l]; + if (!(s ? p in e : D.call(e, p))) return !1; + } + var h = i.get(t); + if (h && i.get(e)) return h == e; + var f = !0; + i.set(t, e), i.set(e, t); + var d = s; + for (; ++l < u; ) { + p = a[l]; + var y, + g = t[p], + _ = e[p]; + if ( + !(void 0 === + (y = r + ? s + ? r(_, g, p, e, t, i) + : r(g, _, p, t, e, i) + : y) + ? g === _ || o(g, _, n, r, i) + : y) + ) { + f = !1; + break; + } + d = d || 'constructor' == p; + } + f && + !d && + ((c = t.constructor), + (h = e.constructor), + c != h && + 'constructor' in t && + 'constructor' in e && + !( + 'function' == typeof c && + c instanceof c && + 'function' == typeof h && + h instanceof h + ) && + (f = !1)); + return i.delete(t), i.delete(e), f; + })(t, e, n, r, o, i)) + ); + })(t, e, n, r, _t, o)) + ); + } + function bt(t) { + var e; + return ( + xt(t) && + ((e = t), !(U && U in e)) && + (zt(t) ? V : l).test(It(t)) + ); + } + function vt(t) { + if ( + ((n = + ('function' == typeof (n = (e = t) && e.constructor) && + n.prototype) || + N), + e !== n) + ) + return Y(t); + var e, + n, + r, + o = []; + for (r in Object(t)) + D.call(t, r) && 'constructor' != r && o.push(r); + return o; + } + function mt(t, e, n, r, o, i) { + var s = n & b, + a = t.length, + u = e.length; + if (a != u && !(s && a < u)) return !1; + u = i.get(t); + if (u && i.get(e)) return u == e; + var c = -1, + l = !0, + p = n & y ? new lt() : void 0; + for (i.set(t, e), i.set(e, t); ++c < a; ) { + var h, + f = t[c], + d = e[c]; + if ( + void 0 !== + (h = r + ? s + ? r(d, f, c, e, t, i) + : r(f, d, c, t, e, i) + : h) + ) { + if (h) continue; + l = !1; + break; + } + if (p) { + if ( + !(function (t, e) { + for ( + var n = -1, r = null == t ? 0 : t.length; + ++n < r; + + ) + if (e(t[n], n, t)) return 1; + })(e, function (t, e) { + return ( + !p.has(e) && + (f === t || o(f, t, n, r, i)) && + p.push(e) + ); + }) + ) { + l = !1; + break; + } + } else if (f !== d && !o(f, d, n, r, i)) { + l = !1; + break; + } + } + return i.delete(t), i.delete(e), l; + } + function wt(t) { + return dt(t, Bt, Ot); + } + function jt(t, e) { + var n, + r = t.__data__; + return ( + 'string' == (t = typeof (n = e)) || + 'number' == t || + 'symbol' == t || + 'boolean' == t + ? '__proto__' !== n + : null === n + ) + ? r['string' == typeof e ? 'string' : 'hash'] + : r.map; + } + function kt(t, e) { + (e = e), (e = null == (t = t) ? void 0 : t[e]); + return bt(e) ? e : void 0; + } + (at.prototype.clear = function () { + (this.__data__ = tt ? tt(null) : {}), (this.size = 0); + }), + (at.prototype.delete = function (t) { + return ( + (t = this.has(t) && delete this.__data__[t]), + (this.size -= t ? 1 : 0), + t + ); + }), + (at.prototype.get = function (t) { + var e = this.__data__; + if (tt) { + var n = e[t]; + return n === r ? void 0 : n; + } + return D.call(e, t) ? e[t] : void 0; + }), + (at.prototype.has = function (t) { + var e = this.__data__; + return tt ? void 0 !== e[t] : D.call(e, t); + }), + (at.prototype.set = function (t, e) { + var n = this.__data__; + return ( + (this.size += this.has(t) ? 0 : 1), + (n[t] = tt && void 0 === e ? r : e), + this + ); + }), + (ut.prototype.clear = function () { + (this.__data__ = []), (this.size = 0); + }), + (ut.prototype.delete = function (t) { + var e = this.__data__; + return ( + !((t = ft(e, t)) < 0) && + (t == e.length - 1 ? e.pop() : X.call(e, t, 1), + --this.size, + !0) + ); + }), + (ut.prototype.get = function (t) { + var e = this.__data__; + return (t = ft(e, t)) < 0 ? void 0 : e[t][1]; + }), + (ut.prototype.has = function (t) { + return -1 < ft(this.__data__, t); + }), + (ut.prototype.set = function (t, e) { + var n = this.__data__, + r = ft(n, t); + return ( + r < 0 ? (++this.size, n.push([t, e])) : (n[r][1] = e), this + ); + }), + (ct.prototype.clear = function () { + (this.size = 0), + (this.__data__ = { + hash: new at(), + map: new (Z || ut)(), + string: new at(), + }); + }), + (ct.prototype.delete = function (t) { + return ( + (t = jt(this, t).delete(t)), (this.size -= t ? 1 : 0), t + ); + }), + (ct.prototype.get = function (t) { + return jt(this, t).get(t); + }), + (ct.prototype.has = function (t) { + return jt(this, t).has(t); + }), + (ct.prototype.set = function (t, e) { + var n = jt(this, t), + r = n.size; + return n.set(t, e), (this.size += n.size == r ? 0 : 1), this; + }), + (lt.prototype.add = lt.prototype.push = + function (t) { + return this.__data__.set(t, r), this; + }), + (lt.prototype.has = function (t) { + return this.__data__.has(t); + }), + (pt.prototype.clear = function () { + (this.__data__ = new ut()), (this.size = 0); + }), + (pt.prototype.delete = function (t) { + var e = this.__data__, + t = e.delete(t); + return (this.size = e.size), t; + }), + (pt.prototype.get = function (t) { + return this.__data__.get(t); + }), + (pt.prototype.has = function (t) { + return this.__data__.has(t); + }), + (pt.prototype.set = function (t, e) { + var n = this.__data__; + if (n instanceof ut) { + var r = n.__data__; + if (!Z || r.length < 199) + return r.push([t, e]), (this.size = ++n.size), this; + n = this.__data__ = new ct(r); + } + return n.set(t, e), (this.size = n.size), this; + }); + var Ot = Q + ? function (e) { + return null == e + ? [] + : ((e = Object(e)), + (function (t, e) { + for ( + var n = -1, + r = null == t ? 0 : t.length, + o = 0, + i = []; + ++n < r; + + ) { + var s = t[n]; + e(s, n, t) && (i[o++] = s); + } + return i; + })(Q(e), function (t) { + return J.call(e, t); + })); + } + : function () { + return []; + }, + Mt = yt; + function It(t) { + if (null != t) { + try { + return q.call(t); + } catch (t) {} + try { + return t + ''; + } catch (t) {} + } + return ''; + } + function Ct(t, e) { + return t === e || (t != t && e != e); + } + ((R && Mt(new R(new ArrayBuffer(1))) != C) || + (Z && Mt(new Z()) != v) || + (x && Mt(x.resolve()) != s) || + (L && Mt(new L()) != k) || + (z && Mt(new z()) != c)) && + (Mt = function (t) { + var e = yt(t), + t = e == w ? t.constructor : void 0, + t = t ? It(t) : ''; + if (t) + switch (t) { + case et: + return C; + case nt: + return v; + case rt: + return s; + case ot: + return k; + case it: + return c; + } + return e; + }); + var St = gt( + (function () { + return arguments; + })(), + ) + ? gt + : function (t) { + return ( + Rt(t) && D.call(t, 'callee') && !J.call(t, 'callee') + ); + }, + At = Array.isArray; + var Pt = + T || + function () { + return !1; + }; + function zt(t) { + if (xt(t)) { + t = yt(t); + return t == n || t == o || t == e || t == a; + } + } + function Lt(t) { + return 'number' == typeof t && -1 < t && t % 1 == 0 && t <= h; + } + function xt(t) { + var e = typeof t; + return null != t && ('object' == e || 'function' == e); + } + function Rt(t) { + return null != t && 'object' == typeof t; + } + var Et, + Tt = P + ? ((Et = P), + function (t) { + return Et(t); + }) + : function (t) { + return Rt(t) && Lt(t.length) && !!A[yt(t)]; + }; + function Bt(t) { + return (null != (e = t) && Lt(e.length) && !zt(e) ? ht : vt)(t); + var e; + } + Ft.exports = function (t, e) { + return _t(t, e); + }; + }.call(this); + }.call( + this, + 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : 'undefined' != typeof window + ? window + : {}, + ); + }, + {}, + ], + 8: [ + function (t, e, n) { + var r, o, i; + (r = this), + (o = function () { + var a = null, + u = {}; + t('monochrome', null, [ + [0, 0], + [100, 0], + ]), + t( + 'red', + [-26, 18], + [ + [20, 100], + [30, 92], + [40, 89], + [50, 85], + [60, 78], + [70, 70], + [80, 60], + [90, 55], + [100, 50], + ], + ), + t( + 'orange', + [18, 46], + [ + [20, 100], + [30, 93], + [40, 88], + [50, 86], + [60, 85], + [70, 70], + [100, 70], + ], + ), + t( + 'yellow', + [46, 62], + [ + [25, 100], + [40, 94], + [50, 89], + [60, 86], + [70, 84], + [80, 82], + [90, 80], + [100, 75], + ], + ), + t( + 'green', + [62, 178], + [ + [30, 100], + [40, 90], + [50, 85], + [60, 81], + [70, 74], + [80, 64], + [90, 50], + [100, 40], + ], + ), + t( + 'blue', + [178, 257], + [ + [20, 100], + [30, 86], + [40, 80], + [50, 74], + [60, 60], + [70, 52], + [80, 44], + [90, 39], + [100, 35], + ], + ), + t( + 'purple', + [257, 282], + [ + [20, 100], + [30, 87], + [40, 79], + [50, 70], + [60, 65], + [70, 59], + [80, 52], + [90, 45], + [100, 42], + ], + ), + t( + 'pink', + [282, 334], + [ + [20, 100], + [30, 90], + [40, 86], + [60, 84], + [80, 80], + [90, 75], + [100, 73], + ], + ); + function c(t) { + if ( + void 0 !== (t = t || {}).seed && + null !== t.seed && + t.seed === parseInt(t.seed, 10) + ) + a = t.seed; + else if ('string' == typeof t.seed) + a = (function (t) { + for ( + var e = 0, n = 0; + n !== t.length && !(e >= Number.MAX_SAFE_INTEGER); + n++ + ) + e += t.charCodeAt(n); + return e; + })(t.seed); + else { + if (void 0 !== t.seed && null !== t.seed) + throw new TypeError( + 'The seed value must be an integer or string', + ); + a = null; + } + var e, n; + if (null === t.count || void 0 === t.count) + return (function (t, e) { + switch (e.format) { + case 'hsvArray': + return t; + case 'hslArray': + return y(t); + case 'hsl': + var n = y(t); + return ( + 'hsl(' + n[0] + ', ' + n[1] + '%, ' + n[2] + '%)' + ); + case 'hsla': + var r = y(t), + o = e.alpha || Math.random(); + return ( + 'hsla(' + + r[0] + + ', ' + + r[1] + + '%, ' + + r[2] + + '%, ' + + o + + ')' + ); + case 'rgbArray': + return f(t); + case 'rgb': + return 'rgb(' + f(t).join(', ') + ')'; + case 'rgba': + (r = f(t)), (o = e.alpha || Math.random()); + return 'rgba(' + r.join(', ') + ', ' + o + ')'; + default: + return (function (t) { + t = f(t); + function e(t) { + t = t.toString(16); + return 1 == t.length ? '0' + t : t; + } + return '#' + e(t[0]) + e(t[1]) + e(t[2]); + })(t); + } + })( + [ + (e = (function (t) { + { + if (0 < l.length) { + var e = h( + (i = (function (t) { + if (isNaN(t)) { + if ('string' == typeof t) + if (u[t]) { + var e = u[t]; + if (e.hueRange) return e.hueRange; + } else if ( + t.match( + /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i, + ) + ) + return p(d(t)[0]).hueRange; + } else { + e = parseInt(t); + if (e < 360 && 0 < e) return p(t).hueRange; + } + return [0, 360]; + })(t.hue)), + ), + n = (i[1] - i[0]) / l.length, + r = parseInt((e - i[0]) / n); + !0 === l[r] + ? (r = (r + 2) % l.length) + : (l[r] = !0); + var o = (i[0] + r * n) % 359, + n = (i[0] + (r + 1) * n) % 359; + return (e = + (e = h((i = [o, n]))) < 0 ? 360 + e : e); + } + var i = (function (t) { + if ('number' == typeof parseInt(t)) { + var e = parseInt(t); + if (e < 360 && 0 < e) return [e, e]; + } + if ('string' == typeof t) + if (u[t]) { + e = u[t]; + if (e.hueRange) return e.hueRange; + } else if ( + t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i) + ) { + t = d(t)[0]; + return [t, t]; + } + return [0, 360]; + })(t.hue); + return (e = (e = h(i)) < 0 ? 360 + e : e); + } + })(t)), + (n = (function (t, e) { + if ('monochrome' === e.hue) return 0; + if ('random' === e.luminosity) return h([0, 100]); + var t = (function (t) { + return p(t).saturationRange; + })(t), + n = t[0], + r = t[1]; + switch (e.luminosity) { + case 'bright': + n = 55; + break; + case 'dark': + n = r - 10; + break; + case 'light': + r = 55; + } + return h([n, r]); + })(e, t)), + (function (t, e, n) { + var r = (function (t, e) { + for ( + var n = p(t).lowerBounds, r = 0; + r < n.length - 1; + r++ + ) { + var o = n[r][0], + i = n[r][1], + s = n[r + 1][0], + a = n[r + 1][1]; + if (o <= e && e <= s) { + s = (a - i) / (s - o); + return s * e + (i - s * o); + } + } + return 0; + })(t, e), + o = 100; + switch (n.luminosity) { + case 'dark': + o = r + 20; + break; + case 'light': + r = (o + r) / 2; + break; + case 'random': + (r = 0), (o = 100); + } + return h([r, o]); + })(e, n, t), + ], + t, + ); + for (var r = t.count, o = [], i = 0; i < t.count; i++) + l.push(!1); + for (t.count = null; r > o.length; ) { + var s = c(t); + null !== a && (t.seed = a), o.push(s); + } + return (t.count = r), o; + } + var l = []; + function p(t) { + for (var e in (334 <= t && t <= 360 && (t -= 360), u)) { + var n = u[e]; + if (n.hueRange && t >= n.hueRange[0] && t <= n.hueRange[1]) + return u[e]; + } + return 'Color not found'; + } + function h(t) { + if (null === a) { + var e = Math.random(); + return ( + (e += 0.618033988749895), + (e %= 1), + Math.floor(t[0] + e * (t[1] + 1 - t[0])) + ); + } + var n = t[1] || 1, + e = t[0] || 0, + t = (a = (9301 * a + 49297) % 233280) / 233280; + return Math.floor(e + t * (n - e)); + } + function t(t, e, n) { + var r = n[0][0], + o = n[n.length - 1][0], + i = n[n.length - 1][1], + s = n[0][1]; + u[t] = { + hueRange: e, + lowerBounds: n, + saturationRange: [r, o], + brightnessRange: [i, s], + }; + } + function f(t) { + var e = t[0]; + 360 === (e = 0 === e ? 1 : e) && (e = 359), (e /= 360); + var n = t[1] / 100, + r = t[2] / 100, + t = Math.floor(6 * e), + e = 6 * e - t, + o = r * (1 - n), + i = r * (1 - e * n), + s = r * (1 - (1 - e) * n), + a = 256, + u = 256, + c = 256; + switch (t) { + case 0: + (a = r), (u = s), (c = o); + break; + case 1: + (a = i), (u = r), (c = o); + break; + case 2: + (a = o), (u = r), (c = s); + break; + case 3: + (a = o), (u = i), (c = r); + break; + case 4: + (a = s), (u = o), (c = r); + break; + case 5: + (a = r), (u = o), (c = i); + } + return [ + Math.floor(255 * a), + Math.floor(255 * u), + Math.floor(255 * c), + ]; + } + function d(t) { + t = + 3 === (t = t.replace(/^#/, '')).length + ? t.replace(/(.)/g, '$1$1') + : t; + var e = parseInt(t.substr(0, 2), 16) / 255, + n = parseInt(t.substr(2, 2), 16) / 255, + r = parseInt(t.substr(4, 2), 16) / 255, + o = Math.max(e, n, r), + i = o - Math.min(e, n, r), + s = o ? i / o : 0; + switch (o) { + case e: + return [(((n - r) / i) % 6) * 60 || 0, s, o]; + case n: + return [60 * ((r - e) / i + 2) || 0, s, o]; + case r: + return [60 * ((e - n) / i + 4) || 0, s, o]; + } + } + function y(t) { + var e = t[0], + n = t[1] / 100, + r = t[2] / 100, + t = (2 - n) * r; + return [ + e, + Math.round(((n * r) / (t < 1 ? t : 2 - t)) * 1e4) / 100, + (t / 2) * 100, + ]; + } + return c; + }), + 'object' == typeof n + ? ((i = o()), + ((n = + 'object' == typeof e && e && e.exports + ? (e.exports = i) + : n).randomColor = i)) + : (r.randomColor = o()); + }, + {}, + ], + }, + {}, + [1], + )(1); +}); diff --git a/public/resources/maplibre-gl.js b/public/resources/maplibre-gl.js index 270e761..ea778e6 100644 --- a/public/resources/maplibre-gl.js +++ b/public/resources/maplibre-gl.js @@ -1,44 +1,36164 @@ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/LICENSE.txt */ (function (global, factory) { -typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : -typeof define === 'function' && define.amd ? define(factory) : -(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory()); -})(this, (function () { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' + ? (module.exports = factory()) + : typeof define === 'function' && define.amd + ? define(factory) + : ((global = + typeof globalThis !== 'undefined' ? globalThis : global || self), + (global.maplibregl = factory())); +})(this, function () { + 'use strict'; -/* eslint-disable */ + /* eslint-disable */ -var shared, worker, maplibregl; -// define gets called three times: one for each chunk. we rely on the order -// they're imported to know which is which -function define(_, chunk) { + var shared, worker, maplibregl; + // define gets called three times: one for each chunk. we rely on the order + // they're imported to know which is which + function define(_, chunk) { if (!shared) { - shared = chunk; + shared = chunk; } else if (!worker) { - worker = chunk; + worker = chunk; } else { - var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' + var workerBundleString = + 'var sharedChunk = {}; (' + + shared + + ')(sharedChunk); (' + + worker + + ')(sharedChunk);'; - var sharedChunk = {}; - shared(sharedChunk); - maplibregl = chunk(sharedChunk); - if (typeof window !== 'undefined') { - maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); - } + var sharedChunk = {}; + shared(sharedChunk); + maplibregl = chunk(sharedChunk); + if (typeof window !== 'undefined') { + maplibregl.workerUrl = window.URL.createObjectURL( + new Blob([workerBundleString], { type: 'text/javascript' }), + ); + } } -} + } + define(['exports'], function (t) { + 'use strict'; + var e = r; + function r(t, e, r, n) { + (this.cx = 3 * t), + (this.bx = 3 * (r - t) - this.cx), + (this.ax = 1 - this.cx - this.bx), + (this.cy = 3 * e), + (this.by = 3 * (n - e) - this.cy), + (this.ay = 1 - this.cy - this.by), + (this.p1x = t), + (this.p1y = e), + (this.p2x = r), + (this.p2y = n); + } + function n(t, r, n, i) { + const a = new e(t, r, n, i); + return function (t) { + return a.solve(t); + }; + } + r.prototype = { + sampleCurveX: function (t) { + return ((this.ax * t + this.bx) * t + this.cx) * t; + }, + sampleCurveY: function (t) { + return ((this.ay * t + this.by) * t + this.cy) * t; + }, + sampleCurveDerivativeX: function (t) { + return (3 * this.ax * t + 2 * this.bx) * t + this.cx; + }, + solveCurveX: function (t, e) { + if ((void 0 === e && (e = 1e-6), t < 0)) return 0; + if (t > 1) return 1; + for (var r = t, n = 0; n < 8; n++) { + var i = this.sampleCurveX(r) - t; + if (Math.abs(i) < e) return r; + var a = this.sampleCurveDerivativeX(r); + if (Math.abs(a) < 1e-6) break; + r -= i / a; + } + var s = 0, + o = 1; + for ( + r = t, n = 0; + n < 20 && ((i = this.sampleCurveX(r)), !(Math.abs(i - t) < e)); + n++ + ) + t > i ? (s = r) : (o = r), (r = 0.5 * (o - s) + s); + return r; + }, + solve: function (t, e) { + return this.sampleCurveY(this.solveCurveX(t, e)); + }, + }; + const i = n(0.25, 0.1, 0.25, 1); + function a(t, e, r) { + return Math.min(r, Math.max(e, t)); + } + function s(t, e, r) { + const n = r - e, + i = ((((t - e) % n) + n) % n) + e; + return i === e ? r : i; + } + function o(t, ...e) { + for (const r of e) for (const e in r) t[e] = r[e]; + return t; + } + let l = 1; + function u(t, e) { + t.forEach((t) => { + e[t] && (e[t] = e[t].bind(e)); + }); + } + function c(t, e, r) { + const n = {}; + for (const i in t) n[i] = e.call(r || this, t[i], i, t); + return n; + } + function h(t, e, r) { + const n = {}; + for (const i in t) e.call(r || this, t[i], i, t) && (n[i] = t[i]); + return n; + } + function p(t) { + return Array.isArray(t) + ? t.map(p) + : 'object' == typeof t && t + ? c(t, p) + : t; + } + const f = {}; + function d(t) { + f[t] || ('undefined' != typeof console && console.warn(t), (f[t] = !0)); + } + function y(t, e, r) { + return (r.y - t.y) * (e.x - t.x) > (e.y - t.y) * (r.x - t.x); + } + function m(t) { + let e = 0; + for (let r, n, i = 0, a = t.length, s = a - 1; i < a; s = i++) + (r = t[i]), (n = t[s]), (e += (n.x - r.x) * (r.y + n.y)); + return e; + } + function g() { + return ( + 'undefined' != typeof WorkerGlobalScope && + 'undefined' != typeof self && + self instanceof WorkerGlobalScope + ); + } + function x(t) { + const e = {}; + if ( + (t.replace( + /(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, + (t, r, n, i) => { + const a = n || i; + return (e[r] = !a || a.toLowerCase()), ''; + }, + ), + e['max-age']) + ) { + const t = parseInt(e['max-age'], 10); + isNaN(t) ? delete e['max-age'] : (e['max-age'] = t); + } + return e; + } + let v, + b, + w = null; + function _(t) { + if (null == w) { + const e = t.navigator ? t.navigator.userAgent : null; + w = + !!t.safari || + !( + !e || + !( + /\b(iPad|iPhone|iPod)\b/.test(e) || + (e.match('Safari') && !e.match('Chrome')) + ) + ); + } + return w; + } + function A(t) { + return 'undefined' != typeof ImageBitmap && t instanceof ImageBitmap; + } + const k = { + now: + 'undefined' != typeof performance && performance && performance.now + ? performance.now.bind(performance) + : Date.now.bind(Date), + frame(t) { + const e = requestAnimationFrame(t); + return { cancel: () => cancelAnimationFrame(e) }; + }, + getImageData(t, e = 0) { + const r = window.document.createElement('canvas'), + n = r.getContext('2d'); + if (!n) throw new Error('failed to create canvas 2d context'); + return ( + (r.width = t.width), + (r.height = t.height), + n.drawImage(t, 0, 0, t.width, t.height), + n.getImageData(-e, -e, t.width + 2 * e, t.height + 2 * e) + ); + }, + resolveURL: (t) => ( + v || (v = document.createElement('a')), (v.href = t), v.href + ), + hardwareConcurrency: + ('undefined' != typeof navigator && navigator.hardwareConcurrency) || 4, + get prefersReducedMotion() { + return ( + !!matchMedia && + (null == b && (b = matchMedia('(prefers-reduced-motion: reduce)')), + b.matches) + ); + }, + }; + var S = I; + function I(t, e) { + (this.x = t), (this.y = e); + } + (I.prototype = { + clone: function () { + return new I(this.x, this.y); + }, + add: function (t) { + return this.clone()._add(t); + }, + sub: function (t) { + return this.clone()._sub(t); + }, + multByPoint: function (t) { + return this.clone()._multByPoint(t); + }, + divByPoint: function (t) { + return this.clone()._divByPoint(t); + }, + mult: function (t) { + return this.clone()._mult(t); + }, + div: function (t) { + return this.clone()._div(t); + }, + rotate: function (t) { + return this.clone()._rotate(t); + }, + rotateAround: function (t, e) { + return this.clone()._rotateAround(t, e); + }, + matMult: function (t) { + return this.clone()._matMult(t); + }, + unit: function () { + return this.clone()._unit(); + }, + perp: function () { + return this.clone()._perp(); + }, + round: function () { + return this.clone()._round(); + }, + mag: function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }, + equals: function (t) { + return this.x === t.x && this.y === t.y; + }, + dist: function (t) { + return Math.sqrt(this.distSqr(t)); + }, + distSqr: function (t) { + var e = t.x - this.x, + r = t.y - this.y; + return e * e + r * r; + }, + angle: function () { + return Math.atan2(this.y, this.x); + }, + angleTo: function (t) { + return Math.atan2(this.y - t.y, this.x - t.x); + }, + angleWith: function (t) { + return this.angleWithSep(t.x, t.y); + }, + angleWithSep: function (t, e) { + return Math.atan2(this.x * e - this.y * t, this.x * t + this.y * e); + }, + _matMult: function (t) { + var e = t[2] * this.x + t[3] * this.y; + return (this.x = t[0] * this.x + t[1] * this.y), (this.y = e), this; + }, + _add: function (t) { + return (this.x += t.x), (this.y += t.y), this; + }, + _sub: function (t) { + return (this.x -= t.x), (this.y -= t.y), this; + }, + _mult: function (t) { + return (this.x *= t), (this.y *= t), this; + }, + _div: function (t) { + return (this.x /= t), (this.y /= t), this; + }, + _multByPoint: function (t) { + return (this.x *= t.x), (this.y *= t.y), this; + }, + _divByPoint: function (t) { + return (this.x /= t.x), (this.y /= t.y), this; + }, + _unit: function () { + return this._div(this.mag()), this; + }, + _perp: function () { + var t = this.y; + return (this.y = this.x), (this.x = -t), this; + }, + _rotate: function (t) { + var e = Math.cos(t), + r = Math.sin(t), + n = r * this.x + e * this.y; + return (this.x = e * this.x - r * this.y), (this.y = n), this; + }, + _rotateAround: function (t, e) { + var r = Math.cos(t), + n = Math.sin(t), + i = e.y + n * (this.x - e.x) + r * (this.y - e.y); + return ( + (this.x = e.x + r * (this.x - e.x) - n * (this.y - e.y)), + (this.y = i), + this + ); + }, + _round: function () { + return ( + (this.x = Math.round(this.x)), (this.y = Math.round(this.y)), this + ); + }, + }), + (I.convert = function (t) { + return t instanceof I ? t : Array.isArray(t) ? new I(t[0], t[1]) : t; + }); + const M = { MAX_PARALLEL_IMAGE_REQUESTS: 16, REGISTERED_PROTOCOLS: {} }, + z = 'mapbox-tiles'; + let B, + C, + P = 500, + V = 50; + function E() { + 'undefined' == typeof caches || B || (B = caches.open(z)); + } + let F = 1 / 0; + const T = { + supported: !1, + testSupport: function (t) { + !$ && D && (R ? O(t) : (L = t)); + }, + }; + let L, + D, + $ = !1, + R = !1; + function O(t) { + const e = t.createTexture(); + t.bindTexture(t.TEXTURE_2D, e); + try { + if ( + (t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, D), + t.isContextLost()) + ) + return; + T.supported = !0; + } catch (t) {} + t.deleteTexture(e), ($ = !0); + } + 'undefined' != typeof document && + ((D = document.createElement('img')), + (D.onload = function () { + L && O(L), (L = null), (R = !0); + }), + (D.onerror = function () { + ($ = !0), (L = null); + }), + (D.src = + 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=')); + const U = { + Unknown: 'Unknown', + Style: 'Style', + Source: 'Source', + Tile: 'Tile', + Glyphs: 'Glyphs', + SpriteImage: 'SpriteImage', + SpriteJSON: 'SpriteJSON', + Image: 'Image', + }; + 'function' == typeof Object.freeze && Object.freeze(U); + class q extends Error { + constructor(t, e, r, n) { + super(`AJAXError: ${e} (${t}): ${r}`), + (this.status = t), + (this.statusText = e), + (this.url = r), + (this.body = n); + } + } + const j = g() + ? () => self.worker && self.worker.referrer + : () => + ('blob:' === window.location.protocol ? window.parent : window) + .location.href; + function N(t, e) { + const r = new AbortController(), + n = new Request(t.url, { + method: t.method || 'GET', + body: t.body, + credentials: t.credentials, + headers: t.headers, + referrer: j(), + signal: r.signal, + }); + let i = !1, + a = !1; + 'json' === t.type && n.headers.set('Accept', 'application/json'); + return ( + ((r, s, o) => { + if (a) return; + const l = Date.now(); + fetch(n) + .then((r) => + r.ok + ? ((r, s, o) => { + ('arrayBuffer' === t.type + ? r.arrayBuffer() + : 'json' === t.type + ? r.json() + : r.text() + ) + .then((t) => { + a || + (s && + o && + (function (t, e, r) { + if ((E(), !B)) return; + const n = { + status: e.status, + statusText: e.statusText, + headers: new Headers(), + }; + e.headers.forEach((t, e) => n.headers.set(e, t)); + const i = x(e.headers.get('Cache-Control') || ''); + i['no-store'] || + (i['max-age'] && + n.headers.set( + 'Expires', + new Date( + r + 1e3 * i['max-age'], + ).toUTCString(), + ), + new Date(n.headers.get('Expires')).getTime() - + r < + 42e4 || + (function (t, e) { + if (void 0 === C) + try { + new Response(new ReadableStream()), + (C = !0); + } catch (t) { + C = !1; + } + C ? e(t.body) : t.blob().then(e); + })(e, (e) => { + const r = new Response(e, n); + E(), + B && + B.then((e) => + e.put( + (function (t) { + const e = t.indexOf('?'); + return e < 0 ? t : t.slice(0, e); + })(t.url), + r, + ), + ).catch((t) => d(t.message)); + })); + })(n, s, o), + (i = !0), + e( + null, + t, + r.headers.get('Cache-Control'), + r.headers.get('Expires'), + )); + }) + .catch((t) => { + a || e(new Error(t.message)); + }); + })(r, null, l) + : r + .blob() + .then((n) => e(new q(r.status, r.statusText, t.url, n))), + ) + .catch((t) => { + 20 !== t.code && e(new Error(t.message)); + }); + })(), + { + cancel: () => { + (a = !0), i || r.abort(); + }, + } + ); + } + const Z = function (t, e) { + if (/:\/\//.test(t.url) && !/^https?:|^file:/.test(t.url)) { + if (g() && self.worker && self.worker.actor) + return self.worker.actor.send('getResource', t, e); + if (!g()) { + const r = t.url.substring(0, t.url.indexOf('://')); + return (M.REGISTERED_PROTOCOLS[r] || N)(t, e); + } + } + if ( + !( + /^file:/.test((r = t.url)) || + (/^file:/.test(j()) && !/^\w+:/.test(r)) + ) + ) { + if ( + fetch && + Request && + AbortController && + Object.prototype.hasOwnProperty.call(Request.prototype, 'signal') + ) + return N(t, e); + if (g() && self.worker && self.worker.actor) + return self.worker.actor.send('getResource', t, e, void 0, !0); + } + var r; + return (function (t, e) { + const r = new XMLHttpRequest(); + r.open(t.method || 'GET', t.url, !0), + 'arrayBuffer' === t.type && (r.responseType = 'arraybuffer'); + for (const e in t.headers) r.setRequestHeader(e, t.headers[e]); + return ( + 'json' === t.type && + ((r.responseType = 'text'), + r.setRequestHeader('Accept', 'application/json')), + (r.withCredentials = 'include' === t.credentials), + (r.onerror = () => { + e(new Error(r.statusText)); + }), + (r.onload = () => { + if ( + ((r.status >= 200 && r.status < 300) || 0 === r.status) && + null !== r.response + ) { + let n = r.response; + if ('json' === t.type) + try { + n = JSON.parse(r.response); + } catch (t) { + return e(t); + } + e( + null, + n, + r.getResponseHeader('Cache-Control'), + r.getResponseHeader('Expires'), + ); + } else { + const n = new Blob([r.response], { + type: r.getResponseHeader('Content-Type'), + }); + e(new q(r.status, r.statusText, t.url, n)); + } + }), + r.send(t.body), + { cancel: () => r.abort() } + ); + })(t, e); + }, + K = function (t, e) { + return Z(o(t, { type: 'arrayBuffer' }), e); + }; + function G(t) { + const e = window.document.createElement('a'); + return ( + (e.href = t), + e.protocol === window.document.location.protocol && + e.host === window.document.location.host + ); + } + const J = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII='; + let X, Y; + (X = []), (Y = 0); + const H = function (t, e) { + if ( + (T.supported && + (t.headers || (t.headers = {}), + (t.headers.accept = 'image/webp,*/*')), + Y >= M.MAX_PARALLEL_IMAGE_REQUESTS) + ) { + const r = { + requestParameters: t, + callback: e, + cancelled: !1, + cancel() { + this.cancelled = !0; + }, + }; + return X.push(r), r; + } + Y++; + let r = !1; + const n = () => { + if (!r) + for (r = !0, Y--; X.length && Y < M.MAX_PARALLEL_IMAGE_REQUESTS; ) { + const t = X.shift(), + { requestParameters: e, callback: r, cancelled: n } = t; + n || (t.cancel = H(e, r).cancel); + } + }, + i = K(t, (t, r, i, a) => { + n(), + t + ? e(t) + : r && + (function (t, e) { + 'function' == typeof createImageBitmap + ? (function (t, e) { + const r = new Blob([new Uint8Array(t)], { + type: 'image/png', + }); + createImageBitmap(r) + .then((t) => { + e(null, t); + }) + .catch((t) => { + e( + new Error( + `Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`, + ), + ); + }); + })(t, e) + : (function (t, e) { + const r = new Image(); + (r.onload = () => { + e(null, r), + URL.revokeObjectURL(r.src), + (r.onload = null), + window.requestAnimationFrame(() => { + r.src = J; + }); + }), + (r.onerror = () => + e( + new Error( + 'Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.', + ), + )); + const n = new Blob([new Uint8Array(t)], { + type: 'image/png', + }); + r.src = t.byteLength ? URL.createObjectURL(n) : J; + })(t, e); + })(r, (t, r) => { + null != t + ? e(t) + : null != r && e(null, r, { cacheControl: i, expires: a }); + }); + }); + return { + cancel: () => { + i.cancel(), n(); + }, + }; + }; + function W(t, e, r) { + (r[t] && -1 !== r[t].indexOf(e)) || ((r[t] = r[t] || []), r[t].push(e)); + } + function Q(t, e, r) { + if (r && r[t]) { + const n = r[t].indexOf(e); + -1 !== n && r[t].splice(n, 1); + } + } + class tt { + constructor(t, e = {}) { + o(this, e), (this.type = t); + } + } + class et extends tt { + constructor(t, e = {}) { + super('error', o({ error: t }, e)); + } + } + class rt { + on(t, e) { + return ( + (this._listeners = this._listeners || {}), + W(t, e, this._listeners), + this + ); + } + off(t, e) { + return Q(t, e, this._listeners), Q(t, e, this._oneTimeListeners), this; + } + once(t, e) { + return ( + (this._oneTimeListeners = this._oneTimeListeners || {}), + W(t, e, this._oneTimeListeners), + this + ); + } + fire(t, e) { + 'string' == typeof t && (t = new tt(t, e || {})); + const r = t.type; + if (this.listens(r)) { + t.target = this; + const e = + this._listeners && this._listeners[r] + ? this._listeners[r].slice() + : []; + for (const r of e) r.call(this, t); + const n = + this._oneTimeListeners && this._oneTimeListeners[r] + ? this._oneTimeListeners[r].slice() + : []; + for (const e of n) Q(r, e, this._oneTimeListeners), e.call(this, t); + const i = this._eventedParent; + i && + (o( + t, + 'function' == typeof this._eventedParentData + ? this._eventedParentData() + : this._eventedParentData, + ), + i.fire(t)); + } else t instanceof et && console.error(t.error); + return this; + } + listens(t) { + return ( + (this._listeners && + this._listeners[t] && + this._listeners[t].length > 0) || + (this._oneTimeListeners && + this._oneTimeListeners[t] && + this._oneTimeListeners[t].length > 0) || + (this._eventedParent && this._eventedParent.listens(t)) + ); + } + setEventedParent(t, e) { + return (this._eventedParent = t), (this._eventedParentData = e), this; + } + } + var nt = { + $version: 8, + $root: { + version: { required: !0, type: 'enum', values: [8] }, + name: { type: 'string' }, + metadata: { type: '*' }, + center: { type: 'array', value: 'number' }, + zoom: { type: 'number' }, + bearing: { type: 'number', default: 0, period: 360, units: 'degrees' }, + pitch: { type: 'number', default: 0, units: 'degrees' }, + light: { type: 'light' }, + terrain: { type: 'terrain' }, + sources: { required: !0, type: 'sources' }, + sprite: { type: 'string' }, + glyphs: { type: 'string' }, + transition: { type: 'transition' }, + layers: { required: !0, type: 'array', value: 'layer' }, + }, + sources: { '*': { type: 'source' } }, + source: [ + 'source_vector', + 'source_raster', + 'source_raster_dem', + 'source_geojson', + 'source_video', + 'source_image', + ], + source_vector: { + type: { required: !0, type: 'enum', values: { vector: {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + scheme: { type: 'enum', values: { xyz: {}, tms: {} }, default: 'xyz' }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + attribution: { type: 'string' }, + promoteId: { type: 'promoteId' }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_raster: { + type: { required: !0, type: 'enum', values: { raster: {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + tileSize: { type: 'number', default: 512, units: 'pixels' }, + scheme: { type: 'enum', values: { xyz: {}, tms: {} }, default: 'xyz' }, + attribution: { type: 'string' }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_raster_dem: { + type: { required: !0, type: 'enum', values: { 'raster-dem': {} } }, + url: { type: 'string' }, + tiles: { type: 'array', value: 'string' }, + bounds: { + type: 'array', + value: 'number', + length: 4, + default: [-180, -85.051129, 180, 85.051129], + }, + minzoom: { type: 'number', default: 0 }, + maxzoom: { type: 'number', default: 22 }, + tileSize: { type: 'number', default: 512, units: 'pixels' }, + attribution: { type: 'string' }, + encoding: { + type: 'enum', + values: { terrarium: {}, mapbox: {} }, + default: 'mapbox', + }, + volatile: { type: 'boolean', default: !1 }, + '*': { type: '*' }, + }, + source_geojson: { + type: { required: !0, type: 'enum', values: { geojson: {} } }, + data: { type: '*' }, + maxzoom: { type: 'number', default: 18 }, + attribution: { type: 'string' }, + buffer: { type: 'number', default: 128, maximum: 512, minimum: 0 }, + filter: { type: '*' }, + tolerance: { type: 'number', default: 0.375 }, + cluster: { type: 'boolean', default: !1 }, + clusterRadius: { type: 'number', default: 50, minimum: 0 }, + clusterMaxZoom: { type: 'number' }, + clusterMinPoints: { type: 'number' }, + clusterProperties: { type: '*' }, + lineMetrics: { type: 'boolean', default: !1 }, + generateId: { type: 'boolean', default: !1 }, + promoteId: { type: 'promoteId' }, + }, + source_video: { + type: { required: !0, type: 'enum', values: { video: {} } }, + urls: { required: !0, type: 'array', value: 'string' }, + coordinates: { + required: !0, + type: 'array', + length: 4, + value: { type: 'array', length: 2, value: 'number' }, + }, + }, + source_image: { + type: { required: !0, type: 'enum', values: { image: {} } }, + url: { required: !0, type: 'string' }, + coordinates: { + required: !0, + type: 'array', + length: 4, + value: { type: 'array', length: 2, value: 'number' }, + }, + }, + layer: { + id: { type: 'string', required: !0 }, + type: { + type: 'enum', + values: { + fill: {}, + line: {}, + symbol: {}, + circle: {}, + heatmap: {}, + 'fill-extrusion': {}, + raster: {}, + hillshade: {}, + background: {}, + }, + required: !0, + }, + metadata: { type: '*' }, + source: { type: 'string' }, + 'source-layer': { type: 'string' }, + minzoom: { type: 'number', minimum: 0, maximum: 24 }, + maxzoom: { type: 'number', minimum: 0, maximum: 24 }, + filter: { type: 'filter' }, + layout: { type: 'layout' }, + paint: { type: 'paint' }, + }, + layout: [ + 'layout_fill', + 'layout_line', + 'layout_circle', + 'layout_heatmap', + 'layout_fill-extrusion', + 'layout_symbol', + 'layout_raster', + 'layout_hillshade', + 'layout_background', + ], + layout_background: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_fill: { + 'fill-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_circle: { + 'circle-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_heatmap: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + 'layout_fill-extrusion': { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_line: { + 'line-cap': { + type: 'enum', + values: { butt: {}, round: {}, square: {} }, + default: 'butt', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-join': { + type: 'enum', + values: { bevel: {}, round: {}, miter: {} }, + default: 'miter', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'line-miter-limit': { + type: 'number', + default: 2, + requires: [{ 'line-join': 'miter' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-round-limit': { + type: 'number', + default: 1.05, + requires: [{ 'line-join': 'round' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_symbol: { + 'symbol-placement': { + type: 'enum', + values: { point: {}, line: {}, 'line-center': {} }, + default: 'point', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-spacing': { + type: 'number', + default: 250, + minimum: 1, + units: 'pixels', + requires: [{ 'symbol-placement': 'line' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-avoid-edges': { + type: 'boolean', + default: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'symbol-sort-key': { + type: 'number', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'symbol-z-order': { + type: 'enum', + values: { auto: {}, 'viewport-y': {}, source: {} }, + default: 'auto', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-allow-overlap': { + type: 'boolean', + default: !1, + requires: ['icon-image', { '!': 'icon-overlap' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-overlap': { + type: 'enum', + values: { never: {}, always: {}, cooperative: {} }, + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-ignore-placement': { + type: 'boolean', + default: !1, + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-optional': { + type: 'boolean', + default: !1, + requires: ['icon-image', 'text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-rotation-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-size': { + type: 'number', + default: 1, + minimum: 0, + units: 'factor of the original icon size', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-text-fit': { + type: 'enum', + values: { none: {}, width: {}, height: {}, both: {} }, + default: 'none', + requires: ['icon-image', 'text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-text-fit-padding': { + type: 'array', + value: 'number', + length: 4, + default: [0, 0, 0, 0], + units: 'pixels', + requires: [ + 'icon-image', + 'text-field', + { 'icon-text-fit': ['both', 'width', 'height'] }, + ], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-image': { + type: 'resolvedImage', + tokens: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-rotate': { + type: 'number', + default: 0, + period: 360, + units: 'degrees', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-padding': { + type: 'padding', + default: [2], + units: 'pixels', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-keep-upright': { + type: 'boolean', + default: !1, + requires: [ + 'icon-image', + { 'icon-rotation-alignment': 'map' }, + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-offset': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-anchor': { + type: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + default: 'center', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'icon-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, auto: {} }, + default: 'auto', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-rotation-alignment': { + type: 'enum', + values: { map: {}, viewport: {}, 'viewport-glyph': {}, auto: {} }, + default: 'auto', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-field': { + type: 'formatted', + default: '', + tokens: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-font': { + type: 'array', + value: 'string', + default: ['Open Sans Regular', 'Arial Unicode MS Regular'], + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-size': { + type: 'number', + default: 16, + minimum: 0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-max-width': { + type: 'number', + default: 10, + minimum: 0, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-line-height': { + type: 'number', + default: 1.2, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-letter-spacing': { + type: 'number', + default: 0, + units: 'ems', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-justify': { + type: 'enum', + values: { auto: {}, left: {}, center: {}, right: {} }, + default: 'center', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-radial-offset': { + type: 'number', + units: 'ems', + default: 0, + requires: ['text-field'], + 'property-type': 'data-driven', + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + }, + 'text-variable-anchor': { + type: 'array', + value: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + requires: ['text-field', { 'symbol-placement': ['point'] }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-anchor': { + type: 'enum', + values: { + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + 'top-left': {}, + 'top-right': {}, + 'bottom-left': {}, + 'bottom-right': {}, + }, + default: 'center', + requires: ['text-field', { '!': 'text-variable-anchor' }], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-max-angle': { + type: 'number', + default: 45, + units: 'degrees', + requires: [ + 'text-field', + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-writing-mode': { + type: 'array', + value: 'enum', + values: { horizontal: {}, vertical: {} }, + requires: ['text-field', { 'symbol-placement': ['point'] }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-rotate': { + type: 'number', + default: 0, + period: 360, + units: 'degrees', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-padding': { + type: 'number', + default: 2, + minimum: 0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-keep-upright': { + type: 'boolean', + default: !0, + requires: [ + 'text-field', + { 'text-rotation-alignment': 'map' }, + { 'symbol-placement': ['line', 'line-center'] }, + ], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-transform': { + type: 'enum', + values: { none: {}, uppercase: {}, lowercase: {} }, + default: 'none', + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-offset': { + type: 'array', + value: 'number', + units: 'ems', + length: 2, + default: [0, 0], + requires: ['text-field', { '!': 'text-radial-offset' }], + expression: { interpolated: !0, parameters: ['zoom', 'feature'] }, + 'property-type': 'data-driven', + }, + 'text-allow-overlap': { + type: 'boolean', + default: !1, + requires: ['text-field', { '!': 'text-overlap' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-overlap': { + type: 'enum', + values: { never: {}, always: {}, cooperative: {} }, + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-ignore-placement': { + type: 'boolean', + default: !1, + requires: ['text-field'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-optional': { + type: 'boolean', + default: !1, + requires: ['text-field', 'icon-image'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_raster: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + layout_hillshade: { + visibility: { + type: 'enum', + values: { visible: {}, none: {} }, + default: 'visible', + 'property-type': 'constant', + }, + }, + filter: { type: 'array', value: '*' }, + filter_operator: { + type: 'enum', + values: { + '==': {}, + '!=': {}, + '>': {}, + '>=': {}, + '<': {}, + '<=': {}, + in: {}, + '!in': {}, + all: {}, + any: {}, + none: {}, + has: {}, + '!has': {}, + within: {}, + }, + }, + geometry_type: { + type: 'enum', + values: { Point: {}, LineString: {}, Polygon: {} }, + }, + function: { + expression: { type: 'expression' }, + stops: { type: 'array', value: 'function_stop' }, + base: { type: 'number', default: 1, minimum: 0 }, + property: { type: 'string', default: '$zoom' }, + type: { + type: 'enum', + values: { + identity: {}, + exponential: {}, + interval: {}, + categorical: {}, + }, + default: 'exponential', + }, + colorSpace: { + type: 'enum', + values: { rgb: {}, lab: {}, hcl: {} }, + default: 'rgb', + }, + default: { type: '*', required: !1 }, + }, + function_stop: { + type: 'array', + minimum: 0, + maximum: 24, + value: ['number', 'color'], + length: 2, + }, + expression: { type: 'array', value: '*', minimum: 1 }, + light: { + anchor: { + type: 'enum', + default: 'viewport', + values: { map: {}, viewport: {} }, + 'property-type': 'data-constant', + transition: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + }, + position: { + type: 'array', + default: [1.15, 210, 30], + length: 3, + value: 'number', + 'property-type': 'data-constant', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + }, + color: { + type: 'color', + 'property-type': 'data-constant', + default: '#ffffff', + expression: { interpolated: !0, parameters: ['zoom'] }, + transition: !0, + }, + intensity: { + type: 'number', + 'property-type': 'data-constant', + default: 0.5, + minimum: 0, + maximum: 1, + expression: { interpolated: !0, parameters: ['zoom'] }, + transition: !0, + }, + }, + terrain: { + source: { type: 'string', required: !0 }, + exaggeration: { type: 'number', minimum: 0, default: 1 }, + elevationOffset: { type: 'number', default: 450 }, + }, + paint: [ + 'paint_fill', + 'paint_line', + 'paint_circle', + 'paint_heatmap', + 'paint_fill-extrusion', + 'paint_symbol', + 'paint_raster', + 'paint_hillshade', + 'paint_background', + ], + paint_fill: { + 'fill-antialias': { + type: 'boolean', + default: !0, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'fill-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-outline-color': { + type: 'color', + transition: !0, + requires: [{ '!': 'fill-pattern' }, { 'fill-antialias': !0 }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['fill-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + }, + 'paint_fill-extrusion': { + 'fill-extrusion-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'fill-extrusion-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['fill-extrusion-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'fill-extrusion-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + 'fill-extrusion-height': { + type: 'number', + default: 0, + minimum: 0, + units: 'meters', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-base': { + type: 'number', + default: 0, + minimum: 0, + units: 'meters', + transition: !0, + requires: ['fill-extrusion-height'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'fill-extrusion-vertical-gradient': { + type: 'boolean', + default: !0, + transition: !1, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_line: { + 'line-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'line-pattern' }], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['line-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'line-width': { + type: 'number', + default: 1, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-gap-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-offset': { + type: 'number', + default: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'line-dasharray': { + type: 'array', + value: 'number', + minimum: 0, + transition: !0, + units: 'line widths', + requires: [{ '!': 'line-pattern' }], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'cross-faded', + }, + 'line-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + 'property-type': 'cross-faded-data-driven', + }, + 'line-gradient': { + type: 'color', + transition: !1, + requires: [ + { '!': 'line-dasharray' }, + { '!': 'line-pattern' }, + { source: 'geojson', has: { lineMetrics: !0 } }, + ], + expression: { interpolated: !0, parameters: ['line-progress'] }, + 'property-type': 'color-ramp', + }, + }, + paint_circle: { + 'circle-radius': { + type: 'number', + default: 5, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-blur': { + type: 'number', + default: 0, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['circle-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-pitch-scale': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-pitch-alignment': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'viewport', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'circle-stroke-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-stroke-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'circle-stroke-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + }, + paint_heatmap: { + 'heatmap-radius': { + type: 'number', + default: 30, + minimum: 1, + transition: !0, + units: 'pixels', + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'heatmap-weight': { + type: 'number', + default: 1, + minimum: 0, + transition: !1, + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'heatmap-intensity': { + type: 'number', + default: 1, + minimum: 0, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'heatmap-color': { + type: 'color', + default: [ + 'interpolate', + ['linear'], + ['heatmap-density'], + 0, + 'rgba(0, 0, 255, 0)', + 0.1, + 'royalblue', + 0.3, + 'cyan', + 0.5, + 'lime', + 0.7, + 'yellow', + 1, + 'red', + ], + transition: !1, + expression: { interpolated: !0, parameters: ['heatmap-density'] }, + 'property-type': 'color-ramp', + }, + 'heatmap-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_symbol: { + 'icon-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-color': { + type: 'color', + default: 'rgba(0, 0, 0, 0)', + transition: !0, + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-halo-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'icon-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + requires: ['icon-image'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'icon-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['icon-image', 'icon-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-color': { + type: 'color', + default: '#000000', + transition: !0, + overridable: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-color': { + type: 'color', + default: 'rgba(0, 0, 0, 0)', + transition: !0, + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-width': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-halo-blur': { + type: 'number', + default: 0, + minimum: 0, + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { + interpolated: !0, + parameters: ['zoom', 'feature', 'feature-state'], + }, + 'property-type': 'data-driven', + }, + 'text-translate': { + type: 'array', + value: 'number', + length: 2, + default: [0, 0], + transition: !0, + units: 'pixels', + requires: ['text-field'], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'text-translate-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'map', + requires: ['text-field', 'text-translate'], + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_raster: { + 'raster-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-hue-rotate': { + type: 'number', + default: 0, + period: 360, + transition: !0, + units: 'degrees', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-brightness-min': { + type: 'number', + default: 0, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-brightness-max': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-saturation': { + type: 'number', + default: 0, + minimum: -1, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-contrast': { + type: 'number', + default: 0, + minimum: -1, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-resampling': { + type: 'enum', + values: { linear: {}, nearest: {} }, + default: 'linear', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'raster-fade-duration': { + type: 'number', + default: 300, + minimum: 0, + transition: !1, + units: 'milliseconds', + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_hillshade: { + 'hillshade-illumination-direction': { + type: 'number', + default: 335, + minimum: 0, + maximum: 359, + transition: !1, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-illumination-anchor': { + type: 'enum', + values: { map: {}, viewport: {} }, + default: 'viewport', + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-exaggeration': { + type: 'number', + default: 0.5, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-shadow-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-highlight-color': { + type: 'color', + default: '#FFFFFF', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'hillshade-accent-color': { + type: 'color', + default: '#000000', + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + paint_background: { + 'background-color': { + type: 'color', + default: '#000000', + transition: !0, + requires: [{ '!': 'background-pattern' }], + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + 'background-pattern': { + type: 'resolvedImage', + transition: !0, + expression: { interpolated: !1, parameters: ['zoom'] }, + 'property-type': 'cross-faded', + }, + 'background-opacity': { + type: 'number', + default: 1, + minimum: 0, + maximum: 1, + transition: !0, + expression: { interpolated: !0, parameters: ['zoom'] }, + 'property-type': 'data-constant', + }, + }, + transition: { + duration: { + type: 'number', + default: 300, + minimum: 0, + units: 'milliseconds', + }, + delay: { + type: 'number', + default: 0, + minimum: 0, + units: 'milliseconds', + }, + }, + 'property-type': { + 'data-driven': { type: 'property-type' }, + 'cross-faded': { type: 'property-type' }, + 'cross-faded-data-driven': { type: 'property-type' }, + 'color-ramp': { type: 'property-type' }, + 'data-constant': { type: 'property-type' }, + constant: { type: 'property-type' }, + }, + promoteId: { '*': { type: 'string' } }, + }; + class it { + constructor(t, e, r, n) { + (this.message = (t ? `${t}: ` : '') + r), + n && (this.identifier = n), + null != e && e.__line__ && (this.line = e.__line__); + } + } + function at(t) { + const e = t.value; + return e + ? [new it(t.key, e, 'constants have been deprecated as of v8')] + : []; + } + function st(t, ...e) { + for (const r of e) for (const e in r) t[e] = r[e]; + return t; + } + function ot(t) { + return t instanceof Number || t instanceof String || t instanceof Boolean + ? t.valueOf() + : t; + } + function lt(t) { + if (Array.isArray(t)) return t.map(lt); + if ( + t instanceof Object && + !(t instanceof Number || t instanceof String || t instanceof Boolean) + ) { + const e = {}; + for (const r in t) e[r] = lt(t[r]); + return e; + } + return ot(t); + } + class ut extends Error { + constructor(t, e) { + super(e), (this.message = e), (this.key = t); + } + } + class ct { + constructor(t, e = []) { + (this.parent = t), (this.bindings = {}); + for (const [t, r] of e) this.bindings[t] = r; + } + concat(t) { + return new ct(this, t); + } + get(t) { + if (this.bindings[t]) return this.bindings[t]; + if (this.parent) return this.parent.get(t); + throw new Error(`${t} not found in scope.`); + } + has(t) { + return !!this.bindings[t] || (!!this.parent && this.parent.has(t)); + } + } + const ht = { kind: 'null' }, + pt = { kind: 'number' }, + ft = { kind: 'string' }, + dt = { kind: 'boolean' }, + yt = { kind: 'color' }, + mt = { kind: 'object' }, + gt = { kind: 'value' }, + xt = { kind: 'collator' }, + vt = { kind: 'formatted' }, + bt = { kind: 'padding' }, + wt = { kind: 'resolvedImage' }; + function _t(t, e) { + return { kind: 'array', itemType: t, N: e }; + } + function At(t) { + if ('array' === t.kind) { + const e = At(t.itemType); + return 'number' == typeof t.N + ? `array<${e}, ${t.N}>` + : 'value' === t.itemType.kind + ? 'array' + : `array<${e}>`; + } + return t.kind; + } + const kt = [ht, pt, ft, dt, yt, vt, mt, _t(gt), bt, wt]; + function St(t, e) { + if ('error' === e.kind) return null; + if ('array' === t.kind) { + if ( + 'array' === e.kind && + ((0 === e.N && 'value' === e.itemType.kind) || + !St(t.itemType, e.itemType)) && + ('number' != typeof t.N || t.N === e.N) + ) + return null; + } else { + if (t.kind === e.kind) return null; + if ('value' === t.kind) for (const t of kt) if (!St(t, e)) return null; + } + return `Expected ${At(t)} but found ${At(e)} instead.`; + } + function It(t, e) { + return e.some((e) => e.kind === t.kind); + } + function Mt(t, e) { + return e.some((e) => + 'null' === e + ? null === t + : 'array' === e + ? Array.isArray(t) + : 'object' === e + ? t && !Array.isArray(t) && 'object' == typeof t + : e === typeof t, + ); + } + var zt, + Bt = { + 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 Ct(t) { + return (t = Math.round(t)) < 0 ? 0 : t > 255 ? 255 : t; + } + function Pt(t) { + return Ct( + '%' === t[t.length - 1] ? (parseFloat(t) / 100) * 255 : parseInt(t), + ); + } + function Vt(t) { + return (e = + '%' === t[t.length - 1] ? parseFloat(t) / 100 : parseFloat(t)) < 0 + ? 0 + : e > 1 + ? 1 + : e; + var e; + } + function Et(t, e, r) { + return ( + r < 0 ? (r += 1) : r > 1 && (r -= 1), + 6 * r < 1 + ? t + (e - t) * r * 6 + : 2 * r < 1 + ? e + : 3 * r < 2 + ? t + (e - t) * (2 / 3 - r) * 6 + : t + ); + } + try { + zt = {}.parseCSSColor = function (t) { + var e, + r = t.replace(/ /g, '').toLowerCase(); + if (r in Bt) return Bt[r].slice(); + if ('#' === r[0]) + return 4 === r.length + ? (e = parseInt(r.substr(1), 16)) >= 0 && e <= 4095 + ? [ + ((3840 & e) >> 4) | ((3840 & e) >> 8), + (240 & e) | ((240 & e) >> 4), + (15 & e) | ((15 & e) << 4), + 1, + ] + : null + : 7 === r.length && + (e = parseInt(r.substr(1), 16)) >= 0 && + e <= 16777215 + ? [(16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 1] + : null; + var n = r.indexOf('('), + i = r.indexOf(')'); + if (-1 !== n && i + 1 === r.length) { + var a = r.substr(0, n), + s = r.substr(n + 1, i - (n + 1)).split(','), + o = 1; + switch (a) { + case 'rgba': + if (4 !== s.length) return null; + o = Vt(s.pop()); + case 'rgb': + return 3 !== s.length ? null : [Pt(s[0]), Pt(s[1]), Pt(s[2]), o]; + case 'hsla': + if (4 !== s.length) return null; + o = Vt(s.pop()); + case 'hsl': + if (3 !== s.length) return null; + var l = (((parseFloat(s[0]) % 360) + 360) % 360) / 360, + u = Vt(s[1]), + c = Vt(s[2]), + h = c <= 0.5 ? c * (u + 1) : c + u - c * u, + p = 2 * c - h; + return [ + Ct(255 * Et(p, h, l + 1 / 3)), + Ct(255 * Et(p, h, l)), + Ct(255 * Et(p, h, l - 1 / 3)), + o, + ]; + default: + return null; + } + } + return null; + }; + } catch (t) {} + class Ft { + constructor(t, e, r, n = 1) { + (this.r = t), (this.g = e), (this.b = r), (this.a = n); + } + static parse(t) { + if (!t) return; + if (t instanceof Ft) return t; + if ('string' != typeof t) return; + const e = zt(t); + return e + ? new Ft( + (e[0] / 255) * e[3], + (e[1] / 255) * e[3], + (e[2] / 255) * e[3], + e[3], + ) + : void 0; + } + toString() { + const [t, e, r, n] = this.toArray(); + return `rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`; + } + toArray() { + const { r: t, g: e, b: r, a: n } = this; + return 0 === n + ? [0, 0, 0, 0] + : [(255 * t) / n, (255 * e) / n, (255 * r) / n, n]; + } + } + (Ft.black = new Ft(0, 0, 0, 1)), + (Ft.white = new Ft(1, 1, 1, 1)), + (Ft.transparent = new Ft(0, 0, 0, 0)), + (Ft.red = new Ft(1, 0, 0, 1)); + class Tt { + constructor(t, e, r) { + (this.sensitivity = t + ? e + ? 'variant' + : 'case' + : e + ? 'accent' + : 'base'), + (this.locale = r), + (this.collator = new Intl.Collator(this.locale ? this.locale : [], { + sensitivity: this.sensitivity, + usage: 'search', + })); + } + compare(t, e) { + return this.collator.compare(t, e); + } + resolvedLocale() { + return new Intl.Collator( + this.locale ? this.locale : [], + ).resolvedOptions().locale; + } + } + class Lt { + constructor(t, e, r, n, i) { + (this.text = t), + (this.image = e), + (this.scale = r), + (this.fontStack = n), + (this.textColor = i); + } + } + class Dt { + constructor(t) { + this.sections = t; + } + static fromString(t) { + return new Dt([new Lt(t, null, null, null, null)]); + } + isEmpty() { + return ( + 0 === this.sections.length || + !this.sections.some( + (t) => + 0 !== t.text.length || (t.image && 0 !== t.image.name.length), + ) + ); + } + static factory(t) { + return t instanceof Dt ? t : Dt.fromString(t); + } + toString() { + return 0 === this.sections.length + ? '' + : this.sections.map((t) => t.text).join(''); + } + } + class $t { + constructor(t) { + this.values = t.slice(); + } + static parse(t) { + if (t instanceof $t) return t; + if ('number' == typeof t) return new $t([t, t, t, t]); + if (Array.isArray(t) && !(t.length < 1 || t.length > 4)) { + for (const e of t) if ('number' != typeof e) return; + switch (t.length) { + case 1: + t = [t[0], t[0], t[0], t[0]]; + break; + case 2: + t = [t[0], t[1], t[0], t[1]]; + break; + case 3: + t = [t[0], t[1], t[2], t[1]]; + } + return new $t(t); + } + } + toString() { + return JSON.stringify(this.values); + } + } + class Rt { + constructor(t) { + (this.name = t.name), (this.available = t.available); + } + toString() { + return this.name; + } + static fromString(t) { + return t ? new Rt({ name: t, available: !1 }) : null; + } + } + function Ot(t, e, r, n) { + return 'number' == typeof t && + t >= 0 && + t <= 255 && + 'number' == typeof e && + e >= 0 && + e <= 255 && + 'number' == typeof r && + r >= 0 && + r <= 255 + ? void 0 === n || ('number' == typeof n && n >= 0 && n <= 1) + ? null + : `Invalid rgba value [${[t, e, r, n].join( + ', ', + )}]: 'a' must be between 0 and 1.` + : `Invalid rgba value [${('number' == typeof n + ? [t, e, r, n] + : [t, e, r] + ).join(', ')}]: 'r', 'g', and 'b' must be between 0 and 255.`; + } + function Ut(t) { + if (null === t) return !0; + if ('string' == typeof t) return !0; + if ('boolean' == typeof t) return !0; + if ('number' == typeof t) return !0; + if (t instanceof Ft) return !0; + if (t instanceof Tt) return !0; + if (t instanceof Dt) return !0; + if (t instanceof $t) return !0; + if (t instanceof Rt) return !0; + if (Array.isArray(t)) { + for (const e of t) if (!Ut(e)) return !1; + return !0; + } + if ('object' == typeof t) { + for (const e in t) if (!Ut(t[e])) return !1; + return !0; + } + return !1; + } + function qt(t) { + if (null === t) return ht; + if ('string' == typeof t) return ft; + if ('boolean' == typeof t) return dt; + if ('number' == typeof t) return pt; + if (t instanceof Ft) return yt; + if (t instanceof Tt) return xt; + if (t instanceof Dt) return vt; + if (t instanceof $t) return bt; + if (t instanceof Rt) return wt; + if (Array.isArray(t)) { + const e = t.length; + let r; + for (const e of t) { + const t = qt(e); + if (r) { + if (r === t) continue; + r = gt; + break; + } + r = t; + } + return _t(r || gt, e); + } + return mt; + } + function jt(t) { + const e = typeof t; + return null === t + ? '' + : 'string' === e || 'number' === e || 'boolean' === e + ? String(t) + : t instanceof Ft || + t instanceof Dt || + t instanceof $t || + t instanceof Rt + ? t.toString() + : JSON.stringify(t); + } + class Nt { + constructor(t, e) { + (this.type = t), (this.value = e); + } + static parse(t, e) { + if (2 !== t.length) + return e.error( + `'literal' expression requires exactly one argument, but found ${ + t.length - 1 + } instead.`, + ); + if (!Ut(t[1])) return e.error('invalid value'); + const r = t[1]; + let n = qt(r); + const i = e.expectedType; + return ( + 'array' !== n.kind || + 0 !== n.N || + !i || + 'array' !== i.kind || + ('number' == typeof i.N && 0 !== i.N) || + (n = i), + new Nt(n, r) + ); + } + evaluate() { + return this.value; + } + eachChild() {} + outputDefined() { + return !0; + } + } + class Zt { + constructor(t) { + (this.name = 'ExpressionEvaluationError'), (this.message = t); + } + toJSON() { + return this.message; + } + } + const Kt = { string: ft, number: pt, boolean: dt, object: mt }; + class Gt { + constructor(t, e) { + (this.type = t), (this.args = e); + } + static parse(t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + let r, + n = 1; + const i = t[0]; + if ('array' === i) { + let i, a; + if (t.length > 2) { + const r = t[1]; + if ('string' != typeof r || !(r in Kt) || 'object' === r) + return e.error( + 'The item type argument of "array" must be one of string, number, boolean', + 1, + ); + (i = Kt[r]), n++; + } else i = gt; + if (t.length > 3) { + if ( + null !== t[2] && + ('number' != typeof t[2] || t[2] < 0 || t[2] !== Math.floor(t[2])) + ) + return e.error( + 'The length argument to "array" must be a positive integer literal', + 2, + ); + (a = t[2]), n++; + } + r = _t(i, a); + } else { + if (!Kt[i]) throw new Error(`Types doesn't contain name = ${i}`); + r = Kt[i]; + } + const a = []; + for (; n < t.length; n++) { + const r = e.parse(t[n], n, gt); + if (!r) return null; + a.push(r); + } + return new Gt(r, a); + } + evaluate(t) { + for (let e = 0; e < this.args.length; e++) { + const r = this.args[e].evaluate(t); + if (!St(this.type, qt(r))) return r; + if (e === this.args.length - 1) + throw new Zt( + `Expected value to be of type ${At(this.type)}, but found ${At( + qt(r), + )} instead.`, + ); + } + throw new Error(); + } + eachChild(t) { + this.args.forEach(t); + } + outputDefined() { + return this.args.every((t) => t.outputDefined()); + } + } + const Jt = { + 'to-boolean': dt, + 'to-color': yt, + 'to-number': pt, + 'to-string': ft, + }; + class Xt { + constructor(t, e) { + (this.type = t), (this.args = e); + } + static parse(t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + const r = t[0]; + if (!Jt[r]) + throw new Error( + `Can't parse ${r} as it is not part of the known types`, + ); + if (('to-boolean' === r || 'to-string' === r) && 2 !== t.length) + return e.error('Expected one argument.'); + const n = Jt[r], + i = []; + for (let r = 1; r < t.length; r++) { + const n = e.parse(t[r], r, gt); + if (!n) return null; + i.push(n); + } + return new Xt(n, i); + } + evaluate(t) { + if ('boolean' === this.type.kind) + return Boolean(this.args[0].evaluate(t)); + if ('color' === this.type.kind) { + let e, r; + for (const n of this.args) { + if (((e = n.evaluate(t)), (r = null), e instanceof Ft)) return e; + if ('string' == typeof e) { + const r = t.parseColor(e); + if (r) return r; + } else if ( + Array.isArray(e) && + ((r = + e.length < 3 || e.length > 4 + ? `Invalid rbga value ${JSON.stringify( + e, + )}: expected an array containing either three or four numeric values.` + : Ot(e[0], e[1], e[2], e[3])), + !r) + ) + return new Ft(e[0] / 255, e[1] / 255, e[2] / 255, e[3]); + } + throw new Zt( + r || + `Could not parse color from value '${ + 'string' == typeof e ? e : JSON.stringify(e) + }'`, + ); + } + if ('padding' === this.type.kind) { + let e; + for (const r of this.args) { + e = r.evaluate(t); + const n = $t.parse(e); + if (n) return n; + } + throw new Zt( + `Could not parse padding from value '${ + 'string' == typeof e ? e : JSON.stringify(e) + }'`, + ); + } + if ('number' === this.type.kind) { + let e = null; + for (const r of this.args) { + if (((e = r.evaluate(t)), null === e)) return 0; + const n = Number(e); + if (!isNaN(n)) return n; + } + throw new Zt(`Could not convert ${JSON.stringify(e)} to number.`); + } + return 'formatted' === this.type.kind + ? Dt.fromString(jt(this.args[0].evaluate(t))) + : 'resolvedImage' === this.type.kind + ? Rt.fromString(jt(this.args[0].evaluate(t))) + : jt(this.args[0].evaluate(t)); + } + eachChild(t) { + this.args.forEach(t); + } + outputDefined() { + return this.args.every((t) => t.outputDefined()); + } + } + const Yt = ['Unknown', 'Point', 'LineString', 'Polygon']; + class Ht { + constructor() { + (this.globals = null), + (this.feature = null), + (this.featureState = null), + (this.formattedSection = null), + (this._parseColorCache = {}), + (this.availableImages = null), + (this.canonical = null); + } + id() { + return this.feature && 'id' in this.feature ? this.feature.id : null; + } + geometryType() { + return this.feature + ? 'number' == typeof this.feature.type + ? Yt[this.feature.type] + : this.feature.type + : null; + } + geometry() { + return this.feature && 'geometry' in this.feature + ? this.feature.geometry + : null; + } + canonicalID() { + return this.canonical; + } + properties() { + return (this.feature && this.feature.properties) || {}; + } + parseColor(t) { + let e = this._parseColorCache[t]; + return e || (e = this._parseColorCache[t] = Ft.parse(t)), e; + } + } + class Wt { + constructor(t, e, r, n) { + (this.name = t), (this.type = e), (this._evaluate = r), (this.args = n); + } + evaluate(t) { + return this._evaluate(t, this.args); + } + eachChild(t) { + this.args.forEach(t); + } + outputDefined() { + return !1; + } + static parse(t, e) { + const r = t[0], + n = Wt.definitions[r]; + if (!n) + return e.error( + `Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`, + 0, + ); + const i = Array.isArray(n) ? n[0] : n.type, + a = Array.isArray(n) ? [[n[1], n[2]]] : n.overloads, + s = a.filter(([e]) => !Array.isArray(e) || e.length === t.length - 1); + let o = null; + for (const [n, a] of s) { + o = new we(e.registry, e.path, null, e.scope); + const s = []; + let l = !1; + for (let e = 1; e < t.length; e++) { + const r = t[e], + i = Array.isArray(n) ? n[e - 1] : n.type, + a = o.parse(r, 1 + s.length, i); + if (!a) { + l = !0; + break; + } + s.push(a); + } + if (!l) + if (Array.isArray(n) && n.length !== s.length) + o.error( + `Expected ${n.length} arguments, but found ${s.length} instead.`, + ); + else { + for (let t = 0; t < s.length; t++) { + const e = Array.isArray(n) ? n[t] : n.type, + r = s[t]; + o.concat(t + 1).checkSubtype(e, r.type); + } + if (0 === o.errors.length) return new Wt(r, i, a, s); + } + } + if (1 === s.length) e.errors.push(...o.errors); + else { + const r = (s.length ? s : a) + .map(([t]) => { + return ( + (e = t), + Array.isArray(e) + ? `(${e.map(At).join(', ')})` + : `(${At(e.type)}...)` + ); + var e; + }) + .join(' | '), + n = []; + for (let r = 1; r < t.length; r++) { + const i = e.parse(t[r], 1 + n.length); + if (!i) return null; + n.push(At(i.type)); + } + e.error( + `Expected arguments of type ${r}, but found (${n.join( + ', ', + )}) instead.`, + ); + } + return null; + } + static register(t, e) { + Wt.definitions = e; + for (const r in e) t[r] = Wt; + } + } + class Qt { + constructor(t, e, r) { + (this.type = xt), + (this.locale = r), + (this.caseSensitive = t), + (this.diacriticSensitive = e); + } + static parse(t, e) { + if (2 !== t.length) return e.error('Expected one argument.'); + const r = t[1]; + if ('object' != typeof r || Array.isArray(r)) + return e.error('Collator options argument must be an object.'); + const n = e.parse( + void 0 !== r['case-sensitive'] && r['case-sensitive'], + 1, + dt, + ); + if (!n) return null; + const i = e.parse( + void 0 !== r['diacritic-sensitive'] && r['diacritic-sensitive'], + 1, + dt, + ); + if (!i) return null; + let a = null; + return r.locale && ((a = e.parse(r.locale, 1, ft)), !a) + ? null + : new Qt(n, i, a); + } + evaluate(t) { + return new Tt( + this.caseSensitive.evaluate(t), + this.diacriticSensitive.evaluate(t), + this.locale ? this.locale.evaluate(t) : null, + ); + } + eachChild(t) { + t(this.caseSensitive), + t(this.diacriticSensitive), + this.locale && t(this.locale); + } + outputDefined() { + return !1; + } + } + const te = 8192; + function ee(t, e) { + (t[0] = Math.min(t[0], e[0])), + (t[1] = Math.min(t[1], e[1])), + (t[2] = Math.max(t[2], e[0])), + (t[3] = Math.max(t[3], e[1])); + } + function re(t, e) { + return !(t[0] <= e[0] || t[2] >= e[2] || t[1] <= e[1] || t[3] >= e[3]); + } + function ne(t, e) { + const r = (180 + t[0]) / 360, + n = + (180 - + (180 / Math.PI) * + Math.log(Math.tan(Math.PI / 4 + (t[1] * Math.PI) / 360))) / + 360, + i = Math.pow(2, e.z); + return [Math.round(r * i * te), Math.round(n * i * te)]; + } + function ie(t, e, r) { + const n = t[0] - e[0], + i = t[1] - e[1], + a = t[0] - r[0], + s = t[1] - r[1]; + return n * s - a * i == 0 && n * a <= 0 && i * s <= 0; + } + function ae(t, e) { + let r = !1; + for (let s = 0, o = e.length; s < o; s++) { + const o = e[s]; + for (let e = 0, s = o.length; e < s - 1; e++) { + if (ie(t, o[e], o[e + 1])) return !1; + (i = o[e])[1] > (n = t)[1] != (a = o[e + 1])[1] > n[1] && + n[0] < ((a[0] - i[0]) * (n[1] - i[1])) / (a[1] - i[1]) + i[0] && + (r = !r); + } + } + var n, i, a; + return r; + } + function se(t, e) { + for (let r = 0; r < e.length; r++) if (ae(t, e[r])) return !0; + return !1; + } + function oe(t, e, r, n) { + const i = n[0] - r[0], + a = n[1] - r[1], + s = (t[0] - r[0]) * a - i * (t[1] - r[1]), + o = (e[0] - r[0]) * a - i * (e[1] - r[1]); + return (s > 0 && o < 0) || (s < 0 && o > 0); + } + function le(t, e, r) { + for (const u of r) + for (let r = 0; r < u.length - 1; ++r) + if ( + 0 != + (o = [(s = u[r + 1])[0] - (a = u[r])[0], s[1] - a[1]])[0] * + (l = [(i = e)[0] - (n = t)[0], i[1] - n[1]])[1] - + o[1] * l[0] && + oe(n, i, a, s) && + oe(a, s, n, i) + ) + return !0; + var n, i, a, s, o, l; + return !1; + } + function ue(t, e) { + for (let r = 0; r < t.length; ++r) if (!ae(t[r], e)) return !1; + for (let r = 0; r < t.length - 1; ++r) + if (le(t[r], t[r + 1], e)) return !1; + return !0; + } + function ce(t, e) { + for (let r = 0; r < e.length; r++) if (ue(t, e[r])) return !0; + return !1; + } + function he(t, e, r) { + const n = []; + for (let i = 0; i < t.length; i++) { + const a = []; + for (let n = 0; n < t[i].length; n++) { + const s = ne(t[i][n], r); + ee(e, s), a.push(s); + } + n.push(a); + } + return n; + } + function pe(t, e, r) { + const n = []; + for (let i = 0; i < t.length; i++) { + const a = he(t[i], e, r); + n.push(a); + } + return n; + } + function fe(t, e, r, n) { + if (t[0] < r[0] || t[0] > r[2]) { + const e = 0.5 * n; + let i = t[0] - r[0] > e ? -n : r[0] - t[0] > e ? n : 0; + 0 === i && (i = t[0] - r[2] > e ? -n : r[2] - t[0] > e ? n : 0), + (t[0] += i); + } + ee(e, t); + } + function de(t, e, r, n) { + const i = Math.pow(2, n.z) * te, + a = [n.x * te, n.y * te], + s = []; + for (const n of t) + for (const t of n) { + const n = [t.x + a[0], t.y + a[1]]; + fe(n, e, r, i), s.push(n); + } + return s; + } + function ye(t, e, r, n) { + const i = Math.pow(2, n.z) * te, + a = [n.x * te, n.y * te], + s = []; + for (const r of t) { + const t = []; + for (const n of r) { + const r = [n.x + a[0], n.y + a[1]]; + ee(e, r), t.push(r); + } + s.push(t); + } + if (e[2] - e[0] <= i / 2) { + ((o = e)[0] = o[1] = 1 / 0), (o[2] = o[3] = -1 / 0); + for (const t of s) for (const n of t) fe(n, e, r, i); + } + var o; + return s; + } + class me { + constructor(t, e) { + (this.type = dt), (this.geojson = t), (this.geometries = e); + } + static parse(t, e) { + if (2 !== t.length) + return e.error( + `'within' expression requires exactly one argument, but found ${ + t.length - 1 + } instead.`, + ); + if (Ut(t[1])) { + const e = t[1]; + if ('FeatureCollection' === e.type) + for (let t = 0; t < e.features.length; ++t) { + const r = e.features[t].geometry.type; + if ('Polygon' === r || 'MultiPolygon' === r) + return new me(e, e.features[t].geometry); + } + else if ('Feature' === e.type) { + const t = e.geometry.type; + if ('Polygon' === t || 'MultiPolygon' === t) + return new me(e, e.geometry); + } else if ('Polygon' === e.type || 'MultiPolygon' === e.type) + return new me(e, e); + } + return e.error( + "'within' expression requires valid geojson object that contains polygon geometry type.", + ); + } + evaluate(t) { + if (null != t.geometry() && null != t.canonicalID()) { + if ('Point' === t.geometryType()) + return (function (t, e) { + const r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + i = t.canonicalID(); + if ('Polygon' === e.type) { + const a = he(e.coordinates, n, i), + s = de(t.geometry(), r, n, i); + if (!re(r, n)) return !1; + for (const t of s) if (!ae(t, a)) return !1; + } + if ('MultiPolygon' === e.type) { + const a = pe(e.coordinates, n, i), + s = de(t.geometry(), r, n, i); + if (!re(r, n)) return !1; + for (const t of s) if (!se(t, a)) return !1; + } + return !0; + })(t, this.geometries); + if ('LineString' === t.geometryType()) + return (function (t, e) { + const r = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + n = [1 / 0, 1 / 0, -1 / 0, -1 / 0], + i = t.canonicalID(); + if ('Polygon' === e.type) { + const a = he(e.coordinates, n, i), + s = ye(t.geometry(), r, n, i); + if (!re(r, n)) return !1; + for (const t of s) if (!ue(t, a)) return !1; + } + if ('MultiPolygon' === e.type) { + const a = pe(e.coordinates, n, i), + s = ye(t.geometry(), r, n, i); + if (!re(r, n)) return !1; + for (const t of s) if (!ce(t, a)) return !1; + } + return !0; + })(t, this.geometries); + } + return !1; + } + eachChild() {} + outputDefined() { + return !0; + } + } + function ge(t) { + if (t instanceof Wt) { + if ('get' === t.name && 1 === t.args.length) return !1; + if ('feature-state' === t.name) return !1; + if ('has' === t.name && 1 === t.args.length) return !1; + if ( + 'properties' === t.name || + 'geometry-type' === t.name || + 'id' === t.name + ) + return !1; + if (/^filter-/.test(t.name)) return !1; + } + if (t instanceof me) return !1; + let e = !0; + return ( + t.eachChild((t) => { + e && !ge(t) && (e = !1); + }), + e + ); + } + function xe(t) { + if (t instanceof Wt && 'feature-state' === t.name) return !1; + let e = !0; + return ( + t.eachChild((t) => { + e && !xe(t) && (e = !1); + }), + e + ); + } + function ve(t, e) { + if (t instanceof Wt && e.indexOf(t.name) >= 0) return !1; + let r = !0; + return ( + t.eachChild((t) => { + r && !ve(t, e) && (r = !1); + }), + r + ); + } + class be { + constructor(t, e) { + (this.type = e.type), (this.name = t), (this.boundExpression = e); + } + static parse(t, e) { + if (2 !== t.length || 'string' != typeof t[1]) + return e.error( + "'var' expression requires exactly one string literal argument.", + ); + const r = t[1]; + return e.scope.has(r) + ? new be(r, e.scope.get(r)) + : e.error( + `Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`, + 1, + ); + } + evaluate(t) { + return this.boundExpression.evaluate(t); + } + eachChild() {} + outputDefined() { + return !1; + } + } + class we { + constructor(t, e = [], r, n = new ct(), i = []) { + (this.registry = t), + (this.path = e), + (this.key = e.map((t) => `[${t}]`).join('')), + (this.scope = n), + (this.errors = i), + (this.expectedType = r); + } + parse(t, e, r, n, i = {}) { + return e ? this.concat(e, r, n)._parse(t, i) : this._parse(t, i); + } + _parse(t, e) { + function r(t, e, r) { + return 'assert' === r + ? new Gt(e, [t]) + : 'coerce' === r + ? new Xt(e, [t]) + : t; + } + if ( + ((null !== t && + 'string' != typeof t && + 'boolean' != typeof t && + 'number' != typeof t) || + (t = ['literal', t]), + Array.isArray(t)) + ) { + if (0 === t.length) + return this.error( + 'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].', + ); + const n = t[0]; + if ('string' != typeof n) + return ( + this.error( + `Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`, + 0, + ), + null + ); + const i = this.registry[n]; + if (i) { + let n = i.parse(t, this); + if (!n) return null; + if (this.expectedType) { + const t = this.expectedType, + i = n.type; + if ( + ('string' !== t.kind && + 'number' !== t.kind && + 'boolean' !== t.kind && + 'object' !== t.kind && + 'array' !== t.kind) || + 'value' !== i.kind + ) + if ( + ('color' !== t.kind && + 'formatted' !== t.kind && + 'resolvedImage' !== t.kind) || + ('value' !== i.kind && 'string' !== i.kind) + ) + if ( + 'padding' !== t.kind || + ('value' !== i.kind && + 'number' !== i.kind && + 'array' !== i.kind) + ) { + if (this.checkSubtype(t, i)) return null; + } else n = r(n, t, e.typeAnnotation || 'coerce'); + else n = r(n, t, e.typeAnnotation || 'coerce'); + else n = r(n, t, e.typeAnnotation || 'assert'); + } + if ( + !(n instanceof Nt) && + 'resolvedImage' !== n.type.kind && + _e(n) + ) { + const t = new Ht(); + try { + n = new Nt(n.type, n.evaluate(t)); + } catch (t) { + return this.error(t.message), null; + } + } + return n; + } + return this.error( + `Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`, + 0, + ); + } + return this.error( + void 0 === t + ? "'undefined' value invalid. Use null instead." + : 'object' == typeof t + ? 'Bare objects invalid. Use ["literal", {...}] instead.' + : `Expected an array, but found ${typeof t} instead.`, + ); + } + concat(t, e, r) { + const n = 'number' == typeof t ? this.path.concat(t) : this.path, + i = r ? this.scope.concat(r) : this.scope; + return new we(this.registry, n, e || null, i, this.errors); + } + error(t, ...e) { + const r = `${this.key}${e.map((t) => `[${t}]`).join('')}`; + this.errors.push(new ut(r, t)); + } + checkSubtype(t, e) { + const r = St(t, e); + return r && this.error(r), r; + } + } + function _e(t) { + if (t instanceof be) return _e(t.boundExpression); + if (t instanceof Wt && 'error' === t.name) return !1; + if (t instanceof Qt) return !1; + if (t instanceof me) return !1; + const e = t instanceof Xt || t instanceof Gt; + let r = !0; + return ( + t.eachChild((t) => { + r = e ? r && _e(t) : r && t instanceof Nt; + }), + !!r && + ge(t) && + ve(t, [ + 'zoom', + 'heatmap-density', + 'line-progress', + 'accumulated', + 'is-supported-script', + ]) + ); + } + function Ae(t, e) { + const r = t.length - 1; + let n, + i, + a = 0, + s = r, + o = 0; + for (; a <= s; ) + if ( + ((o = Math.floor((a + s) / 2)), (n = t[o]), (i = t[o + 1]), n <= e) + ) { + if (o === r || e < i) return o; + a = o + 1; + } else { + if (!(n > e)) throw new Zt('Input is not a number.'); + s = o - 1; + } + return 0; + } + class ke { + constructor(t, e, r) { + (this.type = t), + (this.input = e), + (this.labels = []), + (this.outputs = []); + for (const [t, e] of r) this.labels.push(t), this.outputs.push(e); + } + static parse(t, e) { + if (t.length - 1 < 4) + return e.error( + `Expected at least 4 arguments, but found only ${t.length - 1}.`, + ); + if ((t.length - 1) % 2 != 0) + return e.error('Expected an even number of arguments.'); + const r = e.parse(t[1], 1, pt); + if (!r) return null; + const n = []; + let i = null; + e.expectedType && + 'value' !== e.expectedType.kind && + (i = e.expectedType); + for (let r = 1; r < t.length; r += 2) { + const a = 1 === r ? -1 / 0 : t[r], + s = t[r + 1], + o = r, + l = r + 1; + if ('number' != typeof a) + return e.error( + 'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', + o, + ); + if (n.length && n[n.length - 1][0] >= a) + return e.error( + 'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', + o, + ); + const u = e.parse(s, l, i); + if (!u) return null; + (i = i || u.type), n.push([a, u]); + } + return new ke(i, r, n); + } + evaluate(t) { + const e = this.labels, + r = this.outputs; + if (1 === e.length) return r[0].evaluate(t); + const n = this.input.evaluate(t); + if (n <= e[0]) return r[0].evaluate(t); + const i = e.length; + return n >= e[i - 1] ? r[i - 1].evaluate(t) : r[Ae(e, n)].evaluate(t); + } + eachChild(t) { + t(this.input); + for (const e of this.outputs) t(e); + } + outputDefined() { + return this.outputs.every((t) => t.outputDefined()); + } + } + function Se(t, e, r) { + return t * (1 - r) + e * r; + } + var Ie = Object.freeze({ + __proto__: null, + number: Se, + color: function (t, e, r) { + return new Ft( + Se(t.r, e.r, r), + Se(t.g, e.g, r), + Se(t.b, e.b, r), + Se(t.a, e.a, r), + ); + }, + array: function (t, e, r) { + return t.map((t, n) => Se(t, e[n], r)); + }, + padding: function (t, e, r) { + const n = t.values, + i = e.values; + return new $t([ + Se(n[0], i[0], r), + Se(n[1], i[1], r), + Se(n[2], i[2], r), + Se(n[3], i[3], r), + ]); + }, + }); + const Me = 0.95047, + ze = 1.08883, + Be = 4 / 29, + Ce = 6 / 29, + Pe = 3 * Ce * Ce, + Ve = Math.PI / 180, + Ee = 180 / Math.PI; + function Fe(t) { + return t > 0.008856451679035631 ? Math.pow(t, 1 / 3) : t / Pe + Be; + } + function Te(t) { + return t > Ce ? t * t * t : Pe * (t - Be); + } + function Le(t) { + return ( + 255 * + (t <= 0.0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055) + ); + } + function De(t) { + return (t /= 255) <= 0.04045 + ? t / 12.92 + : Math.pow((t + 0.055) / 1.055, 2.4); + } + function $e(t) { + const e = De(t.r), + r = De(t.g), + n = De(t.b), + i = Fe((0.4124564 * e + 0.3575761 * r + 0.1804375 * n) / Me), + a = Fe((0.2126729 * e + 0.7151522 * r + 0.072175 * n) / 1); + return { + l: 116 * a - 16, + a: 500 * (i - a), + b: 200 * (a - Fe((0.0193339 * e + 0.119192 * r + 0.9503041 * n) / ze)), + alpha: t.a, + }; + } + function Re(t) { + let e = (t.l + 16) / 116, + r = isNaN(t.a) ? e : e + t.a / 500, + n = isNaN(t.b) ? e : e - t.b / 200; + return ( + (e = 1 * Te(e)), + (r = Me * Te(r)), + (n = ze * Te(n)), + new Ft( + Le(3.2404542 * r - 1.5371385 * e - 0.4985314 * n), + Le(-0.969266 * r + 1.8760108 * e + 0.041556 * n), + Le(0.0556434 * r - 0.2040259 * e + 1.0572252 * n), + t.alpha, + ) + ); + } + function Oe(t, e, r) { + const n = e - t; + return t + r * (n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n); + } + const Ue = { + forward: $e, + reverse: Re, + interpolate: function (t, e, r) { + return { + l: Se(t.l, e.l, r), + a: Se(t.a, e.a, r), + b: Se(t.b, e.b, r), + alpha: Se(t.alpha, e.alpha, r), + }; + }, + }, + qe = { + forward: function (t) { + const { l: e, a: r, b: n } = $e(t), + i = Math.atan2(n, r) * Ee; + return { + h: i < 0 ? i + 360 : i, + c: Math.sqrt(r * r + n * n), + l: e, + alpha: t.a, + }; + }, + reverse: function (t) { + const e = t.h * Ve, + r = t.c; + return Re({ + l: t.l, + a: Math.cos(e) * r, + b: Math.sin(e) * r, + alpha: t.alpha, + }); + }, + interpolate: function (t, e, r) { + return { + h: Oe(t.h, e.h, r), + c: Se(t.c, e.c, r), + l: Se(t.l, e.l, r), + alpha: Se(t.alpha, e.alpha, r), + }; + }, + }; + var je = Object.freeze({ __proto__: null, lab: Ue, hcl: qe }); + class Ne { + constructor(t, e, r, n, i) { + (this.type = t), + (this.operator = e), + (this.interpolation = r), + (this.input = n), + (this.labels = []), + (this.outputs = []); + for (const [t, e] of i) this.labels.push(t), this.outputs.push(e); + } + static interpolationFactor(t, r, n, i) { + let a = 0; + if ('exponential' === t.name) a = Ze(r, t.base, n, i); + else if ('linear' === t.name) a = Ze(r, 1, n, i); + else if ('cubic-bezier' === t.name) { + const s = t.controlPoints; + a = new e(s[0], s[1], s[2], s[3]).solve(Ze(r, 1, n, i)); + } + return a; + } + static parse(t, e) { + let [r, n, i, ...a] = t; + if (!Array.isArray(n) || 0 === n.length) + return e.error('Expected an interpolation type expression.', 1); + if ('linear' === n[0]) n = { name: 'linear' }; + else if ('exponential' === n[0]) { + const t = n[1]; + if ('number' != typeof t) + return e.error( + 'Exponential interpolation requires a numeric base.', + 1, + 1, + ); + n = { name: 'exponential', base: t }; + } else { + if ('cubic-bezier' !== n[0]) + return e.error(`Unknown interpolation type ${String(n[0])}`, 1, 0); + { + const t = n.slice(1); + if ( + 4 !== t.length || + t.some((t) => 'number' != typeof t || t < 0 || t > 1) + ) + return e.error( + 'Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', + 1, + ); + n = { name: 'cubic-bezier', controlPoints: t }; + } + } + if (t.length - 1 < 4) + return e.error( + `Expected at least 4 arguments, but found only ${t.length - 1}.`, + ); + if ((t.length - 1) % 2 != 0) + return e.error('Expected an even number of arguments.'); + if (((i = e.parse(i, 2, pt)), !i)) return null; + const s = []; + let o = null; + 'interpolate-hcl' === r || 'interpolate-lab' === r + ? (o = yt) + : e.expectedType && + 'value' !== e.expectedType.kind && + (o = e.expectedType); + for (let t = 0; t < a.length; t += 2) { + const r = a[t], + n = a[t + 1], + i = t + 3, + l = t + 4; + if ('number' != typeof r) + return e.error( + 'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', + i, + ); + if (s.length && s[s.length - 1][0] >= r) + return e.error( + 'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', + i, + ); + const u = e.parse(n, l, o); + if (!u) return null; + (o = o || u.type), s.push([r, u]); + } + return 'number' === o.kind || + 'color' === o.kind || + 'padding' === o.kind || + ('array' === o.kind && + 'number' === o.itemType.kind && + 'number' == typeof o.N) + ? new Ne(o, r, n, i, s) + : e.error(`Type ${At(o)} is not interpolatable.`); + } + evaluate(t) { + const e = this.labels, + r = this.outputs; + if (1 === e.length) return r[0].evaluate(t); + const n = this.input.evaluate(t); + if (n <= e[0]) return r[0].evaluate(t); + const i = e.length; + if (n >= e[i - 1]) return r[i - 1].evaluate(t); + const a = Ae(e, n), + s = Ne.interpolationFactor(this.interpolation, n, e[a], e[a + 1]), + o = r[a].evaluate(t), + l = r[a + 1].evaluate(t); + return 'interpolate' === this.operator + ? Ie[this.type.kind.toLowerCase()](o, l, s) + : 'interpolate-hcl' === this.operator + ? qe.reverse(qe.interpolate(qe.forward(o), qe.forward(l), s)) + : Ue.reverse(Ue.interpolate(Ue.forward(o), Ue.forward(l), s)); + } + eachChild(t) { + t(this.input); + for (const e of this.outputs) t(e); + } + outputDefined() { + return this.outputs.every((t) => t.outputDefined()); + } + } + function Ze(t, e, r, n) { + const i = n - r, + a = t - r; + return 0 === i + ? 0 + : 1 === e + ? a / i + : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1); + } + class Ke { + constructor(t, e) { + (this.type = t), (this.args = e); + } + static parse(t, e) { + if (t.length < 2) return e.error('Expectected at least one argument.'); + let r = null; + const n = e.expectedType; + n && 'value' !== n.kind && (r = n); + const i = []; + for (const n of t.slice(1)) { + const t = e.parse(n, 1 + i.length, r, void 0, { + typeAnnotation: 'omit', + }); + if (!t) return null; + (r = r || t.type), i.push(t); + } + if (!r) throw new Error('No output type'); + const a = n && i.some((t) => St(n, t.type)); + return new Ke(a ? gt : r, i); + } + evaluate(t) { + let e, + r = null, + n = 0; + for (const i of this.args) + if ( + (n++, + (r = i.evaluate(t)), + r && + r instanceof Rt && + !r.available && + (e || (e = r.name), + (r = null), + n === this.args.length && (r = e)), + null !== r) + ) + break; + return r; + } + eachChild(t) { + this.args.forEach(t); + } + outputDefined() { + return this.args.every((t) => t.outputDefined()); + } + } + class Ge { + constructor(t, e) { + (this.type = e.type), (this.bindings = [].concat(t)), (this.result = e); + } + evaluate(t) { + return this.result.evaluate(t); + } + eachChild(t) { + for (const e of this.bindings) t(e[1]); + t(this.result); + } + static parse(t, e) { + if (t.length < 4) + return e.error( + `Expected at least 3 arguments, but found ${t.length - 1} instead.`, + ); + const r = []; + for (let n = 1; n < t.length - 1; n += 2) { + const i = t[n]; + if ('string' != typeof i) + return e.error( + `Expected string, but found ${typeof i} instead.`, + n, + ); + if (/[^a-zA-Z0-9_]/.test(i)) + return e.error( + "Variable names must contain only alphanumeric characters or '_'.", + n, + ); + const a = e.parse(t[n + 1], n + 1); + if (!a) return null; + r.push([i, a]); + } + const n = e.parse(t[t.length - 1], t.length - 1, e.expectedType, r); + return n ? new Ge(r, n) : null; + } + outputDefined() { + return this.result.outputDefined(); + } + } + class Je { + constructor(t, e, r) { + (this.type = t), (this.index = e), (this.input = r); + } + static parse(t, e) { + if (3 !== t.length) + return e.error( + `Expected 2 arguments, but found ${t.length - 1} instead.`, + ); + const r = e.parse(t[1], 1, pt), + n = e.parse(t[2], 2, _t(e.expectedType || gt)); + return r && n ? new Je(n.type.itemType, r, n) : null; + } + evaluate(t) { + const e = this.index.evaluate(t), + r = this.input.evaluate(t); + if (e < 0) throw new Zt(`Array index out of bounds: ${e} < 0.`); + if (e >= r.length) + throw new Zt(`Array index out of bounds: ${e} > ${r.length - 1}.`); + if (e !== Math.floor(e)) + throw new Zt( + `Array index must be an integer, but found ${e} instead.`, + ); + return r[e]; + } + eachChild(t) { + t(this.index), t(this.input); + } + outputDefined() { + return !1; + } + } + class Xe { + constructor(t, e) { + (this.type = dt), (this.needle = t), (this.haystack = e); + } + static parse(t, e) { + if (3 !== t.length) + return e.error( + `Expected 2 arguments, but found ${t.length - 1} instead.`, + ); + const r = e.parse(t[1], 1, gt), + n = e.parse(t[2], 2, gt); + return r && n + ? It(r.type, [dt, ft, pt, ht, gt]) + ? new Xe(r, n) + : e.error( + `Expected first argument to be of type boolean, string, number or null, but found ${At( + r.type, + )} instead`, + ) + : null; + } + evaluate(t) { + const e = this.needle.evaluate(t), + r = this.haystack.evaluate(t); + if (!r) return !1; + if (!Mt(e, ['boolean', 'string', 'number', 'null'])) + throw new Zt( + `Expected first argument to be of type boolean, string, number or null, but found ${At( + qt(e), + )} instead.`, + ); + if (!Mt(r, ['string', 'array'])) + throw new Zt( + `Expected second argument to be of type array or string, but found ${At( + qt(r), + )} instead.`, + ); + return r.indexOf(e) >= 0; + } + eachChild(t) { + t(this.needle), t(this.haystack); + } + outputDefined() { + return !0; + } + } + class Ye { + constructor(t, e, r) { + (this.type = pt), + (this.needle = t), + (this.haystack = e), + (this.fromIndex = r); + } + static parse(t, e) { + if (t.length <= 2 || t.length >= 5) + return e.error( + `Expected 3 or 4 arguments, but found ${t.length - 1} instead.`, + ); + const r = e.parse(t[1], 1, gt), + n = e.parse(t[2], 2, gt); + if (!r || !n) return null; + if (!It(r.type, [dt, ft, pt, ht, gt])) + return e.error( + `Expected first argument to be of type boolean, string, number or null, but found ${At( + r.type, + )} instead`, + ); + if (4 === t.length) { + const i = e.parse(t[3], 3, pt); + return i ? new Ye(r, n, i) : null; + } + return new Ye(r, n); + } + evaluate(t) { + const e = this.needle.evaluate(t), + r = this.haystack.evaluate(t); + if (!Mt(e, ['boolean', 'string', 'number', 'null'])) + throw new Zt( + `Expected first argument to be of type boolean, string, number or null, but found ${At( + qt(e), + )} instead.`, + ); + if (!Mt(r, ['string', 'array'])) + throw new Zt( + `Expected second argument to be of type array or string, but found ${At( + qt(r), + )} instead.`, + ); + if (this.fromIndex) { + const n = this.fromIndex.evaluate(t); + return r.indexOf(e, n); + } + return r.indexOf(e); + } + eachChild(t) { + t(this.needle), t(this.haystack), this.fromIndex && t(this.fromIndex); + } + outputDefined() { + return !1; + } + } + class He { + constructor(t, e, r, n, i, a) { + (this.inputType = t), + (this.type = e), + (this.input = r), + (this.cases = n), + (this.outputs = i), + (this.otherwise = a); + } + static parse(t, e) { + if (t.length < 5) + return e.error( + `Expected at least 4 arguments, but found only ${t.length - 1}.`, + ); + if (t.length % 2 != 1) + return e.error('Expected an even number of arguments.'); + let r, n; + e.expectedType && + 'value' !== e.expectedType.kind && + (n = e.expectedType); + const i = {}, + a = []; + for (let s = 2; s < t.length - 1; s += 2) { + let o = t[s]; + const l = t[s + 1]; + Array.isArray(o) || (o = [o]); + const u = e.concat(s); + if (0 === o.length) + return u.error('Expected at least one branch label.'); + for (const t of o) { + if ('number' != typeof t && 'string' != typeof t) + return u.error('Branch labels must be numbers or strings.'); + if ('number' == typeof t && Math.abs(t) > Number.MAX_SAFE_INTEGER) + return u.error( + `Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`, + ); + if ('number' == typeof t && Math.floor(t) !== t) + return u.error('Numeric branch labels must be integer values.'); + if (r) { + if (u.checkSubtype(r, qt(t))) return null; + } else r = qt(t); + if (void 0 !== i[String(t)]) + return u.error('Branch labels must be unique.'); + i[String(t)] = a.length; + } + const c = e.parse(l, s, n); + if (!c) return null; + (n = n || c.type), a.push(c); + } + const s = e.parse(t[1], 1, gt); + if (!s) return null; + const o = e.parse(t[t.length - 1], t.length - 1, n); + return o + ? 'value' !== s.type.kind && e.concat(1).checkSubtype(r, s.type) + ? null + : new He(r, n, s, i, a, o) + : null; + } + evaluate(t) { + const e = this.input.evaluate(t); + return ( + (qt(e) === this.inputType && this.outputs[this.cases[e]]) || + this.otherwise + ).evaluate(t); + } + eachChild(t) { + t(this.input), this.outputs.forEach(t), t(this.otherwise); + } + outputDefined() { + return ( + this.outputs.every((t) => t.outputDefined()) && + this.otherwise.outputDefined() + ); + } + } + class We { + constructor(t, e, r) { + (this.type = t), (this.branches = e), (this.otherwise = r); + } + static parse(t, e) { + if (t.length < 4) + return e.error( + `Expected at least 3 arguments, but found only ${t.length - 1}.`, + ); + if (t.length % 2 != 0) + return e.error('Expected an odd number of arguments.'); + let r; + e.expectedType && + 'value' !== e.expectedType.kind && + (r = e.expectedType); + const n = []; + for (let i = 1; i < t.length - 1; i += 2) { + const a = e.parse(t[i], i, dt); + if (!a) return null; + const s = e.parse(t[i + 1], i + 1, r); + if (!s) return null; + n.push([a, s]), (r = r || s.type); + } + const i = e.parse(t[t.length - 1], t.length - 1, r); + if (!i) return null; + if (!r) throw new Error("Can't infer output type"); + return new We(r, n, i); + } + evaluate(t) { + for (const [e, r] of this.branches) + if (e.evaluate(t)) return r.evaluate(t); + return this.otherwise.evaluate(t); + } + eachChild(t) { + for (const [e, r] of this.branches) t(e), t(r); + t(this.otherwise); + } + outputDefined() { + return ( + this.branches.every(([t, e]) => e.outputDefined()) && + this.otherwise.outputDefined() + ); + } + } + class Qe { + constructor(t, e, r, n) { + (this.type = t), + (this.input = e), + (this.beginIndex = r), + (this.endIndex = n); + } + static parse(t, e) { + if (t.length <= 2 || t.length >= 5) + return e.error( + `Expected 3 or 4 arguments, but found ${t.length - 1} instead.`, + ); + const r = e.parse(t[1], 1, gt), + n = e.parse(t[2], 2, pt); + if (!r || !n) return null; + if (!It(r.type, [_t(gt), ft, gt])) + return e.error( + `Expected first argument to be of type array or string, but found ${At( + r.type, + )} instead`, + ); + if (4 === t.length) { + const i = e.parse(t[3], 3, pt); + return i ? new Qe(r.type, r, n, i) : null; + } + return new Qe(r.type, r, n); + } + evaluate(t) { + const e = this.input.evaluate(t), + r = this.beginIndex.evaluate(t); + if (!Mt(e, ['string', 'array'])) + throw new Zt( + `Expected first argument to be of type array or string, but found ${At( + qt(e), + )} instead.`, + ); + if (this.endIndex) { + const n = this.endIndex.evaluate(t); + return e.slice(r, n); + } + return e.slice(r); + } + eachChild(t) { + t(this.input), t(this.beginIndex), this.endIndex && t(this.endIndex); + } + outputDefined() { + return !1; + } + } + function tr(t, e) { + return '==' === t || '!=' === t + ? 'boolean' === e.kind || + 'string' === e.kind || + 'number' === e.kind || + 'null' === e.kind || + 'value' === e.kind + : 'string' === e.kind || 'number' === e.kind || 'value' === e.kind; + } + function er(t, e, r, n) { + return 0 === n.compare(e, r); + } + function rr(t, e, r) { + const n = '==' !== t && '!=' !== t; + return class i { + constructor(t, e, r) { + (this.type = dt), + (this.lhs = t), + (this.rhs = e), + (this.collator = r), + (this.hasUntypedArgument = + 'value' === t.type.kind || 'value' === e.type.kind); + } + static parse(t, e) { + if (3 !== t.length && 4 !== t.length) + return e.error('Expected two or three arguments.'); + const r = t[0]; + let a = e.parse(t[1], 1, gt); + if (!a) return null; + if (!tr(r, a.type)) + return e + .concat(1) + .error( + `"${r}" comparisons are not supported for type '${At( + a.type, + )}'.`, + ); + let s = e.parse(t[2], 2, gt); + if (!s) return null; + if (!tr(r, s.type)) + return e + .concat(2) + .error( + `"${r}" comparisons are not supported for type '${At( + s.type, + )}'.`, + ); + if ( + a.type.kind !== s.type.kind && + 'value' !== a.type.kind && + 'value' !== s.type.kind + ) + return e.error( + `Cannot compare types '${At(a.type)}' and '${At(s.type)}'.`, + ); + n && + ('value' === a.type.kind && 'value' !== s.type.kind + ? (a = new Gt(s.type, [a])) + : 'value' !== a.type.kind && + 'value' === s.type.kind && + (s = new Gt(a.type, [s]))); + let o = null; + if (4 === t.length) { + if ( + 'string' !== a.type.kind && + 'string' !== s.type.kind && + 'value' !== a.type.kind && + 'value' !== s.type.kind + ) + return e.error( + 'Cannot use collator to compare non-string types.', + ); + if (((o = e.parse(t[3], 3, xt)), !o)) return null; + } + return new i(a, s, o); + } + evaluate(i) { + const a = this.lhs.evaluate(i), + s = this.rhs.evaluate(i); + if (n && this.hasUntypedArgument) { + const e = qt(a), + r = qt(s); + if ( + e.kind !== r.kind || + ('string' !== e.kind && 'number' !== e.kind) + ) + throw new Zt( + `Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`, + ); + } + if (this.collator && !n && this.hasUntypedArgument) { + const t = qt(a), + r = qt(s); + if ('string' !== t.kind || 'string' !== r.kind) return e(i, a, s); + } + return this.collator + ? r(i, a, s, this.collator.evaluate(i)) + : e(i, a, s); + } + eachChild(t) { + t(this.lhs), t(this.rhs), this.collator && t(this.collator); + } + outputDefined() { + return !0; + } + }; + } + const nr = rr( + '==', + function (t, e, r) { + return e === r; + }, + er, + ), + ir = rr( + '!=', + function (t, e, r) { + return e !== r; + }, + function (t, e, r, n) { + return !er(0, e, r, n); + }, + ), + ar = rr( + '<', + function (t, e, r) { + return e < r; + }, + function (t, e, r, n) { + return n.compare(e, r) < 0; + }, + ), + sr = rr( + '>', + function (t, e, r) { + return e > r; + }, + function (t, e, r, n) { + return n.compare(e, r) > 0; + }, + ), + or = rr( + '<=', + function (t, e, r) { + return e <= r; + }, + function (t, e, r, n) { + return n.compare(e, r) <= 0; + }, + ), + lr = rr( + '>=', + function (t, e, r) { + return e >= r; + }, + function (t, e, r, n) { + return n.compare(e, r) >= 0; + }, + ); + class ur { + constructor(t, e, r, n, i) { + (this.type = ft), + (this.number = t), + (this.locale = e), + (this.currency = r), + (this.minFractionDigits = n), + (this.maxFractionDigits = i); + } + static parse(t, e) { + if (3 !== t.length) return e.error('Expected two arguments.'); + const r = e.parse(t[1], 1, pt); + if (!r) return null; + const n = t[2]; + if ('object' != typeof n || Array.isArray(n)) + return e.error('NumberFormat options argument must be an object.'); + let i = null; + if (n.locale && ((i = e.parse(n.locale, 1, ft)), !i)) return null; + let a = null; + if (n.currency && ((a = e.parse(n.currency, 1, ft)), !a)) return null; + let s = null; + if ( + n['min-fraction-digits'] && + ((s = e.parse(n['min-fraction-digits'], 1, pt)), !s) + ) + return null; + let o = null; + return n['max-fraction-digits'] && + ((o = e.parse(n['max-fraction-digits'], 1, pt)), !o) + ? null + : new ur(r, i, a, s, o); + } + evaluate(t) { + return new Intl.NumberFormat( + this.locale ? this.locale.evaluate(t) : [], + { + style: this.currency ? 'currency' : 'decimal', + currency: this.currency ? this.currency.evaluate(t) : void 0, + minimumFractionDigits: this.minFractionDigits + ? this.minFractionDigits.evaluate(t) + : void 0, + maximumFractionDigits: this.maxFractionDigits + ? this.maxFractionDigits.evaluate(t) + : void 0, + }, + ).format(this.number.evaluate(t)); + } + eachChild(t) { + t(this.number), + this.locale && t(this.locale), + this.currency && t(this.currency), + this.minFractionDigits && t(this.minFractionDigits), + this.maxFractionDigits && t(this.maxFractionDigits); + } + outputDefined() { + return !1; + } + } + class cr { + constructor(t) { + (this.type = vt), (this.sections = t); + } + static parse(t, e) { + if (t.length < 2) return e.error('Expected at least one argument.'); + const r = t[1]; + if (!Array.isArray(r) && 'object' == typeof r) + return e.error('First argument must be an image or text section.'); + const n = []; + let i = !1; + for (let r = 1; r <= t.length - 1; ++r) { + const a = t[r]; + if (i && 'object' == typeof a && !Array.isArray(a)) { + i = !1; + let t = null; + if (a['font-scale'] && ((t = e.parse(a['font-scale'], 1, pt)), !t)) + return null; + let r = null; + if ( + a['text-font'] && + ((r = e.parse(a['text-font'], 1, _t(ft))), !r) + ) + return null; + let s = null; + if (a['text-color'] && ((s = e.parse(a['text-color'], 1, yt)), !s)) + return null; + const o = n[n.length - 1]; + (o.scale = t), (o.font = r), (o.textColor = s); + } else { + const a = e.parse(t[r], 1, gt); + if (!a) return null; + const s = a.type.kind; + if ( + 'string' !== s && + 'value' !== s && + 'null' !== s && + 'resolvedImage' !== s + ) + return e.error( + "Formatted text type must be 'string', 'value', 'image' or 'null'.", + ); + (i = !0), + n.push({ content: a, scale: null, font: null, textColor: null }); + } + } + return new cr(n); + } + evaluate(t) { + return new Dt( + this.sections.map((e) => { + const r = e.content.evaluate(t); + return qt(r) === wt + ? new Lt('', r, null, null, null) + : new Lt( + jt(r), + null, + e.scale ? e.scale.evaluate(t) : null, + e.font ? e.font.evaluate(t).join(',') : null, + e.textColor ? e.textColor.evaluate(t) : null, + ); + }), + ); + } + eachChild(t) { + for (const e of this.sections) + t(e.content), + e.scale && t(e.scale), + e.font && t(e.font), + e.textColor && t(e.textColor); + } + outputDefined() { + return !1; + } + } + class hr { + constructor(t) { + (this.type = wt), (this.input = t); + } + static parse(t, e) { + if (2 !== t.length) return e.error('Expected two arguments.'); + const r = e.parse(t[1], 1, ft); + return r ? new hr(r) : e.error('No image name provided.'); + } + evaluate(t) { + const e = this.input.evaluate(t), + r = Rt.fromString(e); + return ( + r && + t.availableImages && + (r.available = t.availableImages.indexOf(e) > -1), + r + ); + } + eachChild(t) { + t(this.input); + } + outputDefined() { + return !1; + } + } + class pr { + constructor(t) { + (this.type = pt), (this.input = t); + } + static parse(t, e) { + if (2 !== t.length) + return e.error( + `Expected 1 argument, but found ${t.length - 1} instead.`, + ); + const r = e.parse(t[1], 1); + return r + ? 'array' !== r.type.kind && + 'string' !== r.type.kind && + 'value' !== r.type.kind + ? e.error( + `Expected argument of type string or array, but found ${At( + r.type, + )} instead.`, + ) + : new pr(r) + : null; + } + evaluate(t) { + const e = this.input.evaluate(t); + if ('string' == typeof e) return e.length; + if (Array.isArray(e)) return e.length; + throw new Zt( + `Expected value to be of type string or array, but found ${At( + qt(e), + )} instead.`, + ); + } + eachChild(t) { + t(this.input); + } + outputDefined() { + return !1; + } + } + const fr = { + '==': nr, + '!=': ir, + '>': sr, + '<': ar, + '>=': lr, + '<=': or, + array: Gt, + at: Je, + boolean: Gt, + case: We, + coalesce: Ke, + collator: Qt, + format: cr, + image: hr, + in: Xe, + 'index-of': Ye, + interpolate: Ne, + 'interpolate-hcl': Ne, + 'interpolate-lab': Ne, + length: pr, + let: Ge, + literal: Nt, + match: He, + number: Gt, + 'number-format': ur, + object: Gt, + slice: Qe, + step: ke, + string: Gt, + 'to-boolean': Xt, + 'to-color': Xt, + 'to-number': Xt, + 'to-string': Xt, + var: be, + within: me, + }; + function dr(t, [e, r, n, i]) { + (e = e.evaluate(t)), (r = r.evaluate(t)), (n = n.evaluate(t)); + const a = i ? i.evaluate(t) : 1, + s = Ot(e, r, n, a); + if (s) throw new Zt(s); + return new Ft((e / 255) * a, (r / 255) * a, (n / 255) * a, a); + } + function yr(t, e) { + return t in e; + } + function mr(t, e) { + const r = e[t]; + return void 0 === r ? null : r; + } + function gr(t) { + return { type: t }; + } + function xr(t) { + return { result: 'success', value: t }; + } + function vr(t) { + return { result: 'error', value: t }; + } + function br(t) { + return ( + 'data-driven' === t['property-type'] || + 'cross-faded-data-driven' === t['property-type'] + ); + } + function wr(t) { + return !!t.expression && t.expression.parameters.indexOf('zoom') > -1; + } + function _r(t) { + return !!t.expression && t.expression.interpolated; + } + function Ar(t) { + return t instanceof Number + ? 'number' + : t instanceof String + ? 'string' + : t instanceof Boolean + ? 'boolean' + : Array.isArray(t) + ? 'array' + : null === t + ? 'null' + : typeof t; + } + function kr(t) { + return 'object' == typeof t && null !== t && !Array.isArray(t); + } + function Sr(t) { + return t; + } + function Ir(t, e) { + const r = 'color' === e.type, + n = t.stops && 'object' == typeof t.stops[0][0], + i = n || !(n || void 0 !== t.property), + a = t.type || (_r(e) ? 'exponential' : 'interval'); + if (r || 'padding' === e.type) { + const n = r ? Ft.parse : $t.parse; + (t = st({}, t)).stops && + (t.stops = t.stops.map((t) => [t[0], n(t[1])])), + (t.default = n(t.default ? t.default : e.default)); + } + if (t.colorSpace && 'rgb' !== t.colorSpace && !je[t.colorSpace]) + throw new Error(`Unknown color space: ${t.colorSpace}`); + let s, o, l; + if ('exponential' === a) s = Cr; + else if ('interval' === a) s = Br; + else if ('categorical' === a) { + (s = zr), (o = Object.create(null)); + for (const e of t.stops) o[e[0]] = e[1]; + l = typeof t.stops[0][0]; + } else { + if ('identity' !== a) throw new Error(`Unknown function type "${a}"`); + s = Pr; + } + if (n) { + const r = {}, + n = []; + for (let e = 0; e < t.stops.length; e++) { + const i = t.stops[e], + a = i[0].zoom; + void 0 === r[a] && + ((r[a] = { + zoom: a, + type: t.type, + property: t.property, + default: t.default, + stops: [], + }), + n.push(a)), + r[a].stops.push([i[0].value, i[1]]); + } + const i = []; + for (const t of n) i.push([r[t].zoom, Ir(r[t], e)]); + const a = { name: 'linear' }; + return { + kind: 'composite', + interpolationType: a, + interpolationFactor: Ne.interpolationFactor.bind(void 0, a), + zoomStops: i.map((t) => t[0]), + evaluate: ({ zoom: r }, n) => + Cr({ stops: i, base: t.base }, e, r).evaluate(r, n), + }; + } + if (i) { + const r = + 'exponential' === a + ? { name: 'exponential', base: void 0 !== t.base ? t.base : 1 } + : null; + return { + kind: 'camera', + interpolationType: r, + interpolationFactor: Ne.interpolationFactor.bind(void 0, r), + zoomStops: t.stops.map((t) => t[0]), + evaluate: ({ zoom: r }) => s(t, e, r, o, l), + }; + } + return { + kind: 'source', + evaluate(r, n) { + const i = n && n.properties ? n.properties[t.property] : void 0; + return void 0 === i ? Mr(t.default, e.default) : s(t, e, i, o, l); + }, + }; + } + function Mr(t, e, r) { + return void 0 !== t ? t : void 0 !== e ? e : void 0 !== r ? r : void 0; + } + function zr(t, e, r, n, i) { + return Mr(typeof r === i ? n[r] : void 0, t.default, e.default); + } + function Br(t, e, r) { + if ('number' !== Ar(r)) return Mr(t.default, e.default); + const n = t.stops.length; + if (1 === n) return t.stops[0][1]; + if (r <= t.stops[0][0]) return t.stops[0][1]; + if (r >= t.stops[n - 1][0]) return t.stops[n - 1][1]; + const i = Ae( + t.stops.map((t) => t[0]), + r, + ); + return t.stops[i][1]; + } + function Cr(t, e, r) { + const n = void 0 !== t.base ? t.base : 1; + if ('number' !== Ar(r)) return Mr(t.default, e.default); + const i = t.stops.length; + if (1 === i) return t.stops[0][1]; + if (r <= t.stops[0][0]) return t.stops[0][1]; + if (r >= t.stops[i - 1][0]) return t.stops[i - 1][1]; + const a = Ae( + t.stops.map((t) => t[0]), + r, + ), + s = (function (t, e, r, n) { + const i = n - r, + a = t - r; + return 0 === i + ? 0 + : 1 === e + ? a / i + : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1); + })(r, n, t.stops[a][0], t.stops[a + 1][0]), + o = t.stops[a][1], + l = t.stops[a + 1][1]; + let u = Ie[e.type] || Sr; + if (t.colorSpace && 'rgb' !== t.colorSpace) { + const e = je[t.colorSpace]; + u = (t, r) => e.reverse(e.interpolate(e.forward(t), e.forward(r), s)); + } + return 'function' == typeof o.evaluate + ? { + evaluate(...t) { + const e = o.evaluate.apply(void 0, t), + r = l.evaluate.apply(void 0, t); + if (void 0 !== e && void 0 !== r) return u(e, r, s); + }, + } + : u(o, l, s); + } + function Pr(t, e, r) { + switch (e.type) { + case 'color': + r = Ft.parse(r); + break; + case 'formatted': + r = Dt.fromString(r.toString()); + break; + case 'resolvedImage': + r = Rt.fromString(r.toString()); + break; + case 'padding': + r = $t.parse(r); + break; + default: + Ar(r) === e.type || + ('enum' === e.type && e.values[r]) || + (r = void 0); + } + return Mr(r, t.default, e.default); + } + Wt.register(fr, { + error: [ + { kind: 'error' }, + [ft], + (t, [e]) => { + throw new Zt(e.evaluate(t)); + }, + ], + typeof: [ft, [gt], (t, [e]) => At(qt(e.evaluate(t)))], + 'to-rgba': [_t(pt, 4), [yt], (t, [e]) => e.evaluate(t).toArray()], + rgb: [yt, [pt, pt, pt], dr], + rgba: [yt, [pt, pt, pt, pt], dr], + has: { + type: dt, + overloads: [ + [[ft], (t, [e]) => yr(e.evaluate(t), t.properties())], + [[ft, mt], (t, [e, r]) => yr(e.evaluate(t), r.evaluate(t))], + ], + }, + get: { + type: gt, + overloads: [ + [[ft], (t, [e]) => mr(e.evaluate(t), t.properties())], + [[ft, mt], (t, [e, r]) => mr(e.evaluate(t), r.evaluate(t))], + ], + }, + 'feature-state': [ + gt, + [ft], + (t, [e]) => mr(e.evaluate(t), t.featureState || {}), + ], + properties: [mt, [], (t) => t.properties()], + 'geometry-type': [ft, [], (t) => t.geometryType()], + id: [gt, [], (t) => t.id()], + zoom: [pt, [], (t) => t.globals.zoom], + 'heatmap-density': [pt, [], (t) => t.globals.heatmapDensity || 0], + 'line-progress': [pt, [], (t) => t.globals.lineProgress || 0], + accumulated: [ + gt, + [], + (t) => + void 0 === t.globals.accumulated ? null : t.globals.accumulated, + ], + '+': [ + pt, + gr(pt), + (t, e) => { + let r = 0; + for (const n of e) r += n.evaluate(t); + return r; + }, + ], + '*': [ + pt, + gr(pt), + (t, e) => { + let r = 1; + for (const n of e) r *= n.evaluate(t); + return r; + }, + ], + '-': { + type: pt, + overloads: [ + [[pt, pt], (t, [e, r]) => e.evaluate(t) - r.evaluate(t)], + [[pt], (t, [e]) => -e.evaluate(t)], + ], + }, + '/': [pt, [pt, pt], (t, [e, r]) => e.evaluate(t) / r.evaluate(t)], + '%': [pt, [pt, pt], (t, [e, r]) => e.evaluate(t) % r.evaluate(t)], + ln2: [pt, [], () => Math.LN2], + pi: [pt, [], () => Math.PI], + e: [pt, [], () => Math.E], + '^': [ + pt, + [pt, pt], + (t, [e, r]) => Math.pow(e.evaluate(t), r.evaluate(t)), + ], + sqrt: [pt, [pt], (t, [e]) => Math.sqrt(e.evaluate(t))], + log10: [pt, [pt], (t, [e]) => Math.log(e.evaluate(t)) / Math.LN10], + ln: [pt, [pt], (t, [e]) => Math.log(e.evaluate(t))], + log2: [pt, [pt], (t, [e]) => Math.log(e.evaluate(t)) / Math.LN2], + sin: [pt, [pt], (t, [e]) => Math.sin(e.evaluate(t))], + cos: [pt, [pt], (t, [e]) => Math.cos(e.evaluate(t))], + tan: [pt, [pt], (t, [e]) => Math.tan(e.evaluate(t))], + asin: [pt, [pt], (t, [e]) => Math.asin(e.evaluate(t))], + acos: [pt, [pt], (t, [e]) => Math.acos(e.evaluate(t))], + atan: [pt, [pt], (t, [e]) => Math.atan(e.evaluate(t))], + min: [pt, gr(pt), (t, e) => Math.min(...e.map((e) => e.evaluate(t)))], + max: [pt, gr(pt), (t, e) => Math.max(...e.map((e) => e.evaluate(t)))], + abs: [pt, [pt], (t, [e]) => Math.abs(e.evaluate(t))], + round: [ + pt, + [pt], + (t, [e]) => { + const r = e.evaluate(t); + return r < 0 ? -Math.round(-r) : Math.round(r); + }, + ], + floor: [pt, [pt], (t, [e]) => Math.floor(e.evaluate(t))], + ceil: [pt, [pt], (t, [e]) => Math.ceil(e.evaluate(t))], + 'filter-==': [ + dt, + [ft, gt], + (t, [e, r]) => t.properties()[e.value] === r.value, + ], + 'filter-id-==': [dt, [gt], (t, [e]) => t.id() === e.value], + 'filter-type-==': [dt, [ft], (t, [e]) => t.geometryType() === e.value], + 'filter-<': [ + dt, + [ft, gt], + (t, [e, r]) => { + const n = t.properties()[e.value], + i = r.value; + return typeof n == typeof i && n < i; + }, + ], + 'filter-id-<': [ + dt, + [gt], + (t, [e]) => { + const r = t.id(), + n = e.value; + return typeof r == typeof n && r < n; + }, + ], + 'filter->': [ + dt, + [ft, gt], + (t, [e, r]) => { + const n = t.properties()[e.value], + i = r.value; + return typeof n == typeof i && n > i; + }, + ], + 'filter-id->': [ + dt, + [gt], + (t, [e]) => { + const r = t.id(), + n = e.value; + return typeof r == typeof n && r > n; + }, + ], + 'filter-<=': [ + dt, + [ft, gt], + (t, [e, r]) => { + const n = t.properties()[e.value], + i = r.value; + return typeof n == typeof i && n <= i; + }, + ], + 'filter-id-<=': [ + dt, + [gt], + (t, [e]) => { + const r = t.id(), + n = e.value; + return typeof r == typeof n && r <= n; + }, + ], + 'filter->=': [ + dt, + [ft, gt], + (t, [e, r]) => { + const n = t.properties()[e.value], + i = r.value; + return typeof n == typeof i && n >= i; + }, + ], + 'filter-id->=': [ + dt, + [gt], + (t, [e]) => { + const r = t.id(), + n = e.value; + return typeof r == typeof n && r >= n; + }, + ], + 'filter-has': [dt, [gt], (t, [e]) => e.value in t.properties()], + 'filter-has-id': [dt, [], (t) => null !== t.id() && void 0 !== t.id()], + 'filter-type-in': [ + dt, + [_t(ft)], + (t, [e]) => e.value.indexOf(t.geometryType()) >= 0, + ], + 'filter-id-in': [dt, [_t(gt)], (t, [e]) => e.value.indexOf(t.id()) >= 0], + 'filter-in-small': [ + dt, + [ft, _t(gt)], + (t, [e, r]) => r.value.indexOf(t.properties()[e.value]) >= 0, + ], + 'filter-in-large': [ + dt, + [ft, _t(gt)], + (t, [e, r]) => + (function (t, e, r, n) { + for (; r <= n; ) { + const i = (r + n) >> 1; + if (e[i] === t) return !0; + e[i] > t ? (n = i - 1) : (r = i + 1); + } + return !1; + })(t.properties()[e.value], r.value, 0, r.value.length - 1), + ], + all: { + type: dt, + overloads: [ + [[dt, dt], (t, [e, r]) => e.evaluate(t) && r.evaluate(t)], + [ + gr(dt), + (t, e) => { + for (const r of e) if (!r.evaluate(t)) return !1; + return !0; + }, + ], + ], + }, + any: { + type: dt, + overloads: [ + [[dt, dt], (t, [e, r]) => e.evaluate(t) || r.evaluate(t)], + [ + gr(dt), + (t, e) => { + for (const r of e) if (r.evaluate(t)) return !0; + return !1; + }, + ], + ], + }, + '!': [dt, [dt], (t, [e]) => !e.evaluate(t)], + 'is-supported-script': [ + dt, + [ft], + (t, [e]) => { + const r = t.globals && t.globals.isSupportedScript; + return !r || r(e.evaluate(t)); + }, + ], + upcase: [ft, [ft], (t, [e]) => e.evaluate(t).toUpperCase()], + downcase: [ft, [ft], (t, [e]) => e.evaluate(t).toLowerCase()], + concat: [ft, gr(gt), (t, e) => e.map((e) => jt(e.evaluate(t))).join('')], + 'resolved-locale': [ft, [xt], (t, [e]) => e.evaluate(t).resolvedLocale()], + }); + class Vr { + constructor(t, e) { + (this.expression = t), + (this._warningHistory = {}), + (this._evaluator = new Ht()), + (this._defaultValue = e + ? (function (t) { + return 'color' === t.type && kr(t.default) + ? new Ft(0, 0, 0, 0) + : 'color' === t.type + ? Ft.parse(t.default) || null + : 'padding' === t.type + ? $t.parse(t.default) || null + : void 0 === t.default + ? null + : t.default; + })(e) + : null), + (this._enumValues = e && 'enum' === e.type ? e.values : null); + } + evaluateWithoutErrorHandling(t, e, r, n, i, a) { + return ( + (this._evaluator.globals = t), + (this._evaluator.feature = e), + (this._evaluator.featureState = r), + (this._evaluator.canonical = n), + (this._evaluator.availableImages = i || null), + (this._evaluator.formattedSection = a), + this.expression.evaluate(this._evaluator) + ); + } + evaluate(t, e, r, n, i, a) { + (this._evaluator.globals = t), + (this._evaluator.feature = e || null), + (this._evaluator.featureState = r || null), + (this._evaluator.canonical = n), + (this._evaluator.availableImages = i || null), + (this._evaluator.formattedSection = a || null); + try { + const t = this.expression.evaluate(this._evaluator); + if (null == t || ('number' == typeof t && t != t)) + return this._defaultValue; + if (this._enumValues && !(t in this._enumValues)) + throw new Zt( + `Expected value to be one of ${Object.keys(this._enumValues) + .map((t) => JSON.stringify(t)) + .join(', ')}, but found ${JSON.stringify(t)} instead.`, + ); + return t; + } catch (t) { + return ( + this._warningHistory[t.message] || + ((this._warningHistory[t.message] = !0), + 'undefined' != typeof console && console.warn(t.message)), + this._defaultValue + ); + } + } + } + function Er(t) { + return ( + Array.isArray(t) && + t.length > 0 && + 'string' == typeof t[0] && + t[0] in fr + ); + } + function Fr(t, e) { + const r = new we( + fr, + [], + e + ? (function (t) { + const e = { + color: yt, + string: ft, + number: pt, + enum: ft, + boolean: dt, + formatted: vt, + padding: bt, + resolvedImage: wt, + }; + return 'array' === t.type + ? _t(e[t.value] || gt, t.length) + : e[t.type]; + })(e) + : void 0, + ), + n = r.parse( + t, + void 0, + void 0, + void 0, + e && 'string' === e.type ? { typeAnnotation: 'coerce' } : void 0, + ); + return n ? xr(new Vr(n, e)) : vr(r.errors); + } + class Tr { + constructor(t, e) { + (this.kind = t), + (this._styleExpression = e), + (this.isStateDependent = 'constant' !== t && !xe(e.expression)); + } + evaluateWithoutErrorHandling(t, e, r, n, i, a) { + return this._styleExpression.evaluateWithoutErrorHandling( + t, + e, + r, + n, + i, + a, + ); + } + evaluate(t, e, r, n, i, a) { + return this._styleExpression.evaluate(t, e, r, n, i, a); + } + } + class Lr { + constructor(t, e, r, n) { + (this.kind = t), + (this.zoomStops = r), + (this._styleExpression = e), + (this.isStateDependent = 'camera' !== t && !xe(e.expression)), + (this.interpolationType = n); + } + evaluateWithoutErrorHandling(t, e, r, n, i, a) { + return this._styleExpression.evaluateWithoutErrorHandling( + t, + e, + r, + n, + i, + a, + ); + } + evaluate(t, e, r, n, i, a) { + return this._styleExpression.evaluate(t, e, r, n, i, a); + } + interpolationFactor(t, e, r) { + return this.interpolationType + ? Ne.interpolationFactor(this.interpolationType, t, e, r) + : 0; + } + } + function Dr(t, e) { + const r = Fr(t, e); + if ('error' === r.result) return r; + const n = r.value.expression, + i = ge(n); + if (!i && !br(e)) + return vr([new ut('', 'data expressions not supported')]); + const a = ve(n, ['zoom']); + if (!a && !wr(e)) + return vr([new ut('', 'zoom expressions not supported')]); + const s = Rr(n); + return s || a + ? s instanceof ut + ? vr([s]) + : s instanceof Ne && !_r(e) + ? vr([ + new ut( + '', + '"interpolate" expressions cannot be used with this property', + ), + ]) + : xr( + s + ? new Lr( + i ? 'camera' : 'composite', + r.value, + s.labels, + s instanceof Ne ? s.interpolation : void 0, + ) + : new Tr(i ? 'constant' : 'source', r.value), + ) + : vr([ + new ut( + '', + '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.', + ), + ]); + } + class $r { + constructor(t, e) { + (this._parameters = t), + (this._specification = e), + st(this, Ir(this._parameters, this._specification)); + } + static deserialize(t) { + return new $r(t._parameters, t._specification); + } + static serialize(t) { + return { _parameters: t._parameters, _specification: t._specification }; + } + } + function Rr(t) { + let e = null; + if (t instanceof Ge) e = Rr(t.result); + else if (t instanceof Ke) { + for (const r of t.args) if (((e = Rr(r)), e)) break; + } else + (t instanceof ke || t instanceof Ne) && + t.input instanceof Wt && + 'zoom' === t.input.name && + (e = t); + return ( + e instanceof ut || + t.eachChild((t) => { + const r = Rr(t); + r instanceof ut + ? (e = r) + : !e && r + ? (e = new ut( + '', + '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.', + )) + : e && + r && + e !== r && + (e = new ut( + '', + 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.', + )); + }), + e + ); + } + function Or(t) { + const e = t.key, + r = t.value, + n = t.valueSpec || {}, + i = t.objectElementValidators || {}, + a = t.style, + s = t.styleSpec; + let o = []; + const l = Ar(r); + if ('object' !== l) return [new it(e, r, `object expected, ${l} found`)]; + for (const t in r) { + const l = t.split('.')[0], + u = n[l] || n['*']; + let c; + if (i[l]) c = i[l]; + else if (n[l]) c = yn; + else if (i['*']) c = i['*']; + else { + if (!n['*']) { + o.push(new it(e, r[t], `unknown property "${t}"`)); + continue; + } + c = yn; + } + o = o.concat( + c( + { + key: (e ? `${e}.` : e) + t, + value: r[t], + valueSpec: u, + style: a, + styleSpec: s, + object: r, + objectKey: t, + }, + r, + ), + ); + } + for (const t in n) + i[t] || + (n[t].required && + void 0 === n[t].default && + void 0 === r[t] && + o.push(new it(e, r, `missing required property "${t}"`))); + return o; + } + function Ur(t) { + const e = t.value, + r = t.valueSpec, + n = t.style, + i = t.styleSpec, + a = t.key, + s = t.arrayElementValidator || yn; + if ('array' !== Ar(e)) + return [new it(a, e, `array expected, ${Ar(e)} found`)]; + if (r.length && e.length !== r.length) + return [ + new it( + a, + e, + `array length ${r.length} expected, length ${e.length} found`, + ), + ]; + if (r['min-length'] && e.length < r['min-length']) + return [ + new it( + a, + e, + `array length at least ${r['min-length']} expected, length ${e.length} found`, + ), + ]; + let o = { type: r.value, values: r.values }; + i.$version < 7 && (o.function = r.function), + 'object' === Ar(r.value) && (o = r.value); + let l = []; + for (let t = 0; t < e.length; t++) + l = l.concat( + s({ + array: e, + arrayIndex: t, + value: e[t], + valueSpec: o, + style: n, + styleSpec: i, + key: `${a}[${t}]`, + }), + ); + return l; + } + function qr(t) { + const e = t.key, + r = t.value, + n = t.valueSpec; + let i = Ar(r); + return ( + 'number' === i && r != r && (i = 'NaN'), + 'number' !== i + ? [new it(e, r, `number expected, ${i} found`)] + : 'minimum' in n && r < n.minimum + ? [new it(e, r, `${r} is less than the minimum value ${n.minimum}`)] + : 'maximum' in n && r > n.maximum + ? [ + new it( + e, + r, + `${r} is greater than the maximum value ${n.maximum}`, + ), + ] + : [] + ); + } + function jr(t) { + const e = t.valueSpec, + r = ot(t.value.type); + let n, + i, + a, + s = {}; + const o = 'categorical' !== r && void 0 === t.value.property, + l = !o, + u = + 'array' === Ar(t.value.stops) && + 'array' === Ar(t.value.stops[0]) && + 'object' === Ar(t.value.stops[0][0]), + c = Or({ + key: t.key, + value: t.value, + valueSpec: t.styleSpec.function, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + stops: function (t) { + if ('identity' === r) + return [ + new it( + t.key, + t.value, + 'identity function may not have a "stops" property', + ), + ]; + let e = []; + const n = t.value; + return ( + (e = e.concat( + Ur({ + key: t.key, + value: n, + valueSpec: t.valueSpec, + style: t.style, + styleSpec: t.styleSpec, + arrayElementValidator: h, + }), + )), + 'array' === Ar(n) && + 0 === n.length && + e.push(new it(t.key, n, 'array must have at least one stop')), + e + ); + }, + default: function (t) { + return yn({ + key: t.key, + value: t.value, + valueSpec: e, + style: t.style, + styleSpec: t.styleSpec, + }); + }, + }, + }); + return ( + 'identity' === r && + o && + c.push( + new it(t.key, t.value, 'missing required property "property"'), + ), + 'identity' === r || + t.value.stops || + c.push(new it(t.key, t.value, 'missing required property "stops"')), + 'exponential' === r && + t.valueSpec.expression && + !_r(t.valueSpec) && + c.push(new it(t.key, t.value, 'exponential functions not supported')), + t.styleSpec.$version >= 8 && + (l && !br(t.valueSpec) + ? c.push(new it(t.key, t.value, 'property functions not supported')) + : o && + !wr(t.valueSpec) && + c.push(new it(t.key, t.value, 'zoom functions not supported'))), + ('categorical' !== r && !u) || + void 0 !== t.value.property || + c.push(new it(t.key, t.value, '"property" property is required')), + c + ); + function h(t) { + let r = []; + const n = t.value, + o = t.key; + if ('array' !== Ar(n)) + return [new it(o, n, `array expected, ${Ar(n)} found`)]; + if (2 !== n.length) + return [ + new it(o, n, `array length 2 expected, length ${n.length} found`), + ]; + if (u) { + if ('object' !== Ar(n[0])) + return [new it(o, n, `object expected, ${Ar(n[0])} found`)]; + if (void 0 === n[0].zoom) + return [new it(o, n, 'object stop key must have zoom')]; + if (void 0 === n[0].value) + return [new it(o, n, 'object stop key must have value')]; + if (a && a > ot(n[0].zoom)) + return [ + new it( + o, + n[0].zoom, + 'stop zoom values must appear in ascending order', + ), + ]; + ot(n[0].zoom) !== a && ((a = ot(n[0].zoom)), (i = void 0), (s = {})), + (r = r.concat( + Or({ + key: `${o}[0]`, + value: n[0], + valueSpec: { zoom: {} }, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { zoom: qr, value: p }, + }), + )); + } else r = r.concat(p({ key: `${o}[0]`, value: n[0], valueSpec: {}, style: t.style, styleSpec: t.styleSpec }, n)); + return Er(lt(n[1])) + ? r.concat([ + new it( + `${o}[1]`, + n[1], + 'expressions are not allowed in function stops.', + ), + ]) + : r.concat( + yn({ + key: `${o}[1]`, + value: n[1], + valueSpec: e, + style: t.style, + styleSpec: t.styleSpec, + }), + ); + } + function p(t, a) { + const o = Ar(t.value), + l = ot(t.value), + u = null !== t.value ? t.value : a; + if (n) { + if (o !== n) + return [ + new it( + t.key, + u, + `${o} stop domain type must match previous stop domain type ${n}`, + ), + ]; + } else n = o; + if ('number' !== o && 'string' !== o && 'boolean' !== o) + return [ + new it( + t.key, + u, + 'stop domain value must be a number, string, or boolean', + ), + ]; + if ('number' !== o && 'categorical' !== r) { + let n = `number expected, ${o} found`; + return ( + br(e) && + void 0 === r && + (n += + '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), + [new it(t.key, u, n)] + ); + } + return 'categorical' !== r || + 'number' !== o || + (isFinite(l) && Math.floor(l) === l) + ? 'categorical' !== r && 'number' === o && void 0 !== i && l < i + ? [ + new it( + t.key, + u, + 'stop domain values must appear in ascending order', + ), + ] + : ((i = l), + 'categorical' === r && l in s + ? [new it(t.key, u, 'stop domain values must be unique')] + : ((s[l] = !0), [])) + : [new it(t.key, u, `integer expected, found ${l}`)]; + } + } + function Nr(t) { + const e = ('property' === t.expressionContext ? Dr : Fr)( + lt(t.value), + t.valueSpec, + ); + if ('error' === e.result) + return e.value.map( + (e) => new it(`${t.key}${e.key}`, t.value, e.message), + ); + const r = e.value.expression || e.value._styleExpression.expression; + if ( + 'property' === t.expressionContext && + 'text-font' === t.propertyKey && + !r.outputDefined() + ) + return [ + new it( + t.key, + t.value, + `Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`, + ), + ]; + if ( + 'property' === t.expressionContext && + 'layout' === t.propertyType && + !xe(r) + ) + return [ + new it( + t.key, + t.value, + '"feature-state" data expressions are not supported with layout properties.', + ), + ]; + if ('filter' === t.expressionContext && !xe(r)) + return [ + new it( + t.key, + t.value, + '"feature-state" data expressions are not supported with filters.', + ), + ]; + if (t.expressionContext && 0 === t.expressionContext.indexOf('cluster')) { + if (!ve(r, ['zoom', 'feature-state'])) + return [ + new it( + t.key, + t.value, + '"zoom" and "feature-state" expressions are not supported with cluster properties.', + ), + ]; + if ('cluster-initial' === t.expressionContext && !ge(r)) + return [ + new it( + t.key, + t.value, + 'Feature data expressions are not supported with initial expression part of cluster properties.', + ), + ]; + } + return []; + } + function Zr(t) { + const e = t.key, + r = t.value, + n = t.valueSpec, + i = []; + return ( + Array.isArray(n.values) + ? -1 === n.values.indexOf(ot(r)) && + i.push( + new it( + e, + r, + `expected one of [${n.values.join(', ')}], ${JSON.stringify( + r, + )} found`, + ), + ) + : -1 === Object.keys(n.values).indexOf(ot(r)) && + i.push( + new it( + e, + r, + `expected one of [${Object.keys(n.values).join( + ', ', + )}], ${JSON.stringify(r)} found`, + ), + ), + i + ); + } + function Kr(t) { + if (!0 === t || !1 === t) return !0; + if (!Array.isArray(t) || 0 === t.length) return !1; + switch (t[0]) { + case 'has': + return t.length >= 2 && '$id' !== t[1] && '$type' !== t[1]; + case 'in': + return ( + t.length >= 3 && ('string' != typeof t[1] || Array.isArray(t[2])) + ); + case '!in': + case '!has': + case 'none': + return !1; + case '==': + case '!=': + case '>': + case '>=': + case '<': + case '<=': + return 3 !== t.length || Array.isArray(t[1]) || Array.isArray(t[2]); + case 'any': + case 'all': + for (const e of t.slice(1)) + if (!Kr(e) && 'boolean' != typeof e) return !1; + return !0; + default: + return !0; + } + } + const Gr = { + type: 'boolean', + default: !1, + transition: !1, + 'property-type': 'data-driven', + expression: { interpolated: !1, parameters: ['zoom', 'feature'] }, + }; + function Jr(t) { + if (null == t) return { filter: () => !0, needGeometry: !1 }; + Kr(t) || (t = Hr(t)); + const e = Fr(t, Gr); + if ('error' === e.result) + throw new Error( + e.value.map((t) => `${t.key}: ${t.message}`).join(', '), + ); + return { + filter: (t, r, n) => e.value.evaluate(t, r, {}, n), + needGeometry: Yr(t), + }; + } + function Xr(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function Yr(t) { + if (!Array.isArray(t)) return !1; + if ('within' === t[0]) return !0; + for (let e = 1; e < t.length; e++) if (Yr(t[e])) return !0; + return !1; + } + function Hr(t) { + if (!t) return !0; + const e = t[0]; + return t.length <= 1 + ? 'any' !== e + : '==' === e + ? Wr(t[1], t[2], '==') + : '!=' === e + ? en(Wr(t[1], t[2], '==')) + : '<' === e || '>' === e || '<=' === e || '>=' === e + ? Wr(t[1], t[2], e) + : 'any' === e + ? ((r = t.slice(1)), ['any'].concat(r.map(Hr))) + : 'all' === e + ? ['all'].concat(t.slice(1).map(Hr)) + : 'none' === e + ? ['all'].concat(t.slice(1).map(Hr).map(en)) + : 'in' === e + ? Qr(t[1], t.slice(2)) + : '!in' === e + ? en(Qr(t[1], t.slice(2))) + : 'has' === e + ? tn(t[1]) + : '!has' === e + ? en(tn(t[1])) + : 'within' !== e || t; + var r; + } + function Wr(t, e, r) { + switch (t) { + case '$type': + return [`filter-type-${r}`, e]; + case '$id': + return [`filter-id-${r}`, e]; + default: + return [`filter-${r}`, t, e]; + } + } + function Qr(t, e) { + if (0 === e.length) return !1; + switch (t) { + case '$type': + return ['filter-type-in', ['literal', e]]; + case '$id': + return ['filter-id-in', ['literal', e]]; + default: + return e.length > 200 && !e.some((t) => typeof t != typeof e[0]) + ? ['filter-in-large', t, ['literal', e.sort(Xr)]] + : ['filter-in-small', t, ['literal', e]]; + } + } + function tn(t) { + switch (t) { + case '$type': + return !0; + case '$id': + return ['filter-has-id']; + default: + return ['filter-has', t]; + } + } + function en(t) { + return ['!', t]; + } + function rn(t) { + return Kr(lt(t.value)) + ? Nr( + st({}, t, { + expressionContext: 'filter', + valueSpec: { value: 'boolean' }, + }), + ) + : nn(t); + } + function nn(t) { + const e = t.value, + r = t.key; + if ('array' !== Ar(e)) + return [new it(r, e, `array expected, ${Ar(e)} found`)]; + const n = t.styleSpec; + let i, + a = []; + if (e.length < 1) + return [new it(r, e, 'filter array must have at least 1 element')]; + switch ( + ((a = a.concat( + Zr({ + key: `${r}[0]`, + value: e[0], + valueSpec: n.filter_operator, + style: t.style, + styleSpec: t.styleSpec, + }), + )), + ot(e[0])) + ) { + case '<': + case '<=': + case '>': + case '>=': + e.length >= 2 && + '$type' === ot(e[1]) && + a.push( + new it(r, e, `"$type" cannot be use with operator "${e[0]}"`), + ); + case '==': + case '!=': + 3 !== e.length && + a.push( + new it( + r, + e, + `filter array for operator "${e[0]}" must have 3 elements`, + ), + ); + case 'in': + case '!in': + e.length >= 2 && + ((i = Ar(e[1])), + 'string' !== i && + a.push(new it(`${r}[1]`, e[1], `string expected, ${i} found`))); + for (let s = 2; s < e.length; s++) + (i = Ar(e[s])), + '$type' === ot(e[1]) + ? (a = a.concat( + Zr({ + key: `${r}[${s}]`, + value: e[s], + valueSpec: n.geometry_type, + style: t.style, + styleSpec: t.styleSpec, + }), + )) + : 'string' !== i && + 'number' !== i && + 'boolean' !== i && + a.push( + new it( + `${r}[${s}]`, + e[s], + `string, number, or boolean expected, ${i} found`, + ), + ); + break; + case 'any': + case 'all': + case 'none': + for (let n = 1; n < e.length; n++) + a = a.concat( + nn({ + key: `${r}[${n}]`, + value: e[n], + style: t.style, + styleSpec: t.styleSpec, + }), + ); + break; + case 'has': + case '!has': + (i = Ar(e[1])), + 2 !== e.length + ? a.push( + new it( + r, + e, + `filter array for "${e[0]}" operator must have 2 elements`, + ), + ) + : 'string' !== i && + a.push(new it(`${r}[1]`, e[1], `string expected, ${i} found`)); + break; + case 'within': + (i = Ar(e[1])), + 2 !== e.length + ? a.push( + new it( + r, + e, + `filter array for "${e[0]}" operator must have 2 elements`, + ), + ) + : 'object' !== i && + a.push(new it(`${r}[1]`, e[1], `object expected, ${i} found`)); + } + return a; + } + function an(t, e) { + const r = t.key, + n = t.style, + i = t.styleSpec, + a = t.value, + s = t.objectKey, + o = i[`${e}_${t.layerType}`]; + if (!o) return []; + const l = s.match(/^(.*)-transition$/); + if ('paint' === e && l && o[l[1]] && o[l[1]].transition) + return yn({ + key: r, + value: a, + valueSpec: i.transition, + style: n, + styleSpec: i, + }); + const u = t.valueSpec || o[s]; + if (!u) return [new it(r, a, `unknown property "${s}"`)]; + let c; + if ( + 'string' === Ar(a) && + br(u) && + !u.tokens && + (c = /^{([^}]+)}$/.exec(a)) + ) + return [ + new it( + r, + a, + `"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify( + c[1], + )} }\`.`, + ), + ]; + const h = []; + return ( + 'symbol' === t.layerType && + ('text-field' === s && + n && + !n.glyphs && + h.push( + new it( + r, + a, + 'use of "text-field" requires a style "glyphs" property', + ), + ), + 'text-font' === s && + kr(lt(a)) && + 'identity' === ot(a.type) && + h.push( + new it(r, a, '"text-font" does not support identity functions'), + )), + h.concat( + yn({ + key: t.key, + value: a, + valueSpec: u, + style: n, + styleSpec: i, + expressionContext: 'property', + propertyType: e, + propertyKey: s, + }), + ) + ); + } + function sn(t) { + return an(t, 'paint'); + } + function on(t) { + return an(t, 'layout'); + } + function ln(t) { + let e = []; + const r = t.value, + n = t.key, + i = t.style, + a = t.styleSpec; + r.type || + r.ref || + e.push(new it(n, r, 'either "type" or "ref" is required')); + let s = ot(r.type); + const o = ot(r.ref); + if (r.id) { + const a = ot(r.id); + for (let s = 0; s < t.arrayIndex; s++) { + const t = i.layers[s]; + ot(t.id) === a && + e.push( + new it( + n, + r.id, + `duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`, + ), + ); + } + } + if ('ref' in r) { + let t; + ['type', 'source', 'source-layer', 'filter', 'layout'].forEach((t) => { + t in r && + e.push(new it(n, r[t], `"${t}" is prohibited for ref layers`)); + }), + i.layers.forEach((e) => { + ot(e.id) === o && (t = e); + }), + t + ? t.ref + ? e.push( + new it(n, r.ref, 'ref cannot reference another ref layer'), + ) + : (s = ot(t.type)) + : e.push(new it(n, r.ref, `ref layer "${o}" not found`)); + } else if ('background' !== s) + if (r.source) { + const t = i.sources && i.sources[r.source], + a = t && ot(t.type); + t + ? 'vector' === a && 'raster' === s + ? e.push( + new it( + n, + r.source, + `layer "${r.id}" requires a raster source`, + ), + ) + : 'raster' === a && 'raster' !== s + ? e.push( + new it( + n, + r.source, + `layer "${r.id}" requires a vector source`, + ), + ) + : 'vector' !== a || r['source-layer'] + ? 'raster-dem' === a && 'hillshade' !== s + ? e.push( + new it( + n, + r.source, + "raster-dem source can only be used with layer type 'hillshade'.", + ), + ) + : 'line' !== s || + !r.paint || + !r.paint['line-gradient'] || + ('geojson' === a && t.lineMetrics) || + e.push( + new it( + n, + r, + `layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`, + ), + ) + : e.push( + new it(n, r, `layer "${r.id}" must specify a "source-layer"`), + ) + : e.push(new it(n, r.source, `source "${r.source}" not found`)); + } else e.push(new it(n, r, 'missing required property "source"')); + return ( + (e = e.concat( + Or({ + key: n, + value: r, + valueSpec: a.layer, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': () => [], + type: () => + yn({ + key: `${n}.type`, + value: r.type, + valueSpec: a.layer.type, + style: t.style, + styleSpec: t.styleSpec, + object: r, + objectKey: 'type', + }), + filter: rn, + layout: (t) => + Or({ + layer: r, + key: t.key, + value: t.value, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': (t) => on(st({ layerType: s }, t)), + }, + }), + paint: (t) => + Or({ + layer: r, + key: t.key, + value: t.value, + style: t.style, + styleSpec: t.styleSpec, + objectElementValidators: { + '*': (t) => sn(st({ layerType: s }, t)), + }, + }), + }, + }), + )), + e + ); + } + function un(t) { + const e = t.value, + r = t.key, + n = Ar(e); + return 'string' !== n + ? [new it(r, e, `string expected, ${n} found`)] + : []; + } + const cn = { + promoteId: function ({ key: t, value: e }) { + if ('string' === Ar(e)) return un({ key: t, value: e }); + { + const r = []; + for (const n in e) r.push(...un({ key: `${t}.${n}`, value: e[n] })); + return r; + } + }, + }; + function hn(t) { + const e = t.value, + r = t.key, + n = t.styleSpec, + i = t.style; + if (!e.type) return [new it(r, e, '"type" is required')]; + const a = ot(e.type); + let s; + switch (a) { + case 'vector': + case 'raster': + case 'raster-dem': + return ( + (s = Or({ + key: r, + value: e, + valueSpec: n[`source_${a.replace('-', '_')}`], + style: t.style, + styleSpec: n, + objectElementValidators: cn, + })), + s + ); + case 'geojson': + if ( + ((s = Or({ + key: r, + value: e, + valueSpec: n.source_geojson, + style: i, + styleSpec: n, + objectElementValidators: cn, + })), + e.cluster) + ) + for (const t in e.clusterProperties) { + const [n, i] = e.clusterProperties[t], + a = 'string' == typeof n ? [n, ['accumulated'], ['get', t]] : n; + s.push( + ...Nr({ + key: `${r}.${t}.map`, + value: i, + expressionContext: 'cluster-map', + }), + ), + s.push( + ...Nr({ + key: `${r}.${t}.reduce`, + value: a, + expressionContext: 'cluster-reduce', + }), + ); + } + return s; + case 'video': + return Or({ + key: r, + value: e, + valueSpec: n.source_video, + style: i, + styleSpec: n, + }); + case 'image': + return Or({ + key: r, + value: e, + valueSpec: n.source_image, + style: i, + styleSpec: n, + }); + case 'canvas': + return [ + new it( + r, + null, + 'Please use runtime APIs to add canvas sources, rather than including them in stylesheets.', + 'source.canvas', + ), + ]; + default: + return Zr({ + key: `${r}.type`, + value: e.type, + valueSpec: { + values: [ + 'vector', + 'raster', + 'raster-dem', + 'geojson', + 'video', + 'image', + ], + }, + style: i, + styleSpec: n, + }); + } + } + function pn(t) { + const e = t.value, + r = t.styleSpec, + n = r.light, + i = t.style; + let a = []; + const s = Ar(e); + if (void 0 === e) return a; + if ('object' !== s) + return ( + (a = a.concat([new it('light', e, `object expected, ${s} found`)])), a + ); + for (const t in e) { + const s = t.match(/^(.*)-transition$/); + a = a.concat( + s && n[s[1]] && n[s[1]].transition + ? yn({ + key: t, + value: e[t], + valueSpec: r.transition, + style: i, + styleSpec: r, + }) + : n[t] + ? yn({ + key: t, + value: e[t], + valueSpec: n[t], + style: i, + styleSpec: r, + }) + : [new it(t, e[t], `unknown property "${t}"`)], + ); + } + return a; + } + function fn(t) { + const e = t.value, + r = t.styleSpec, + n = r.terrain, + i = t.style; + let a = []; + const s = Ar(e); + if (void 0 === e) return a; + if ('object' !== s) + return ( + (a = a.concat([new it('terrain', e, `object expected, ${s} found`)])), + a + ); + for (const t in e) + a = a.concat( + n[t] + ? yn({ + key: t, + value: e[t], + valueSpec: n[t], + style: i, + styleSpec: r, + }) + : [new it(t, e[t], `unknown property "${t}"`)], + ); + return a; + } + const dn = { + '*': () => [], + array: Ur, + boolean: function (t) { + const e = t.value, + r = t.key, + n = Ar(e); + return 'boolean' !== n + ? [new it(r, e, `boolean expected, ${n} found`)] + : []; + }, + number: qr, + color: function (t) { + const e = t.key, + r = t.value, + n = Ar(r); + return 'string' !== n + ? [new it(e, r, `color expected, ${n} found`)] + : null === zt(r) + ? [new it(e, r, `color expected, "${r}" found`)] + : []; + }, + constants: at, + enum: Zr, + filter: rn, + function: jr, + layer: ln, + object: Or, + source: hn, + light: pn, + terrain: fn, + string: un, + formatted: function (t) { + return 0 === un(t).length ? [] : Nr(t); + }, + resolvedImage: function (t) { + return 0 === un(t).length ? [] : Nr(t); + }, + padding: function (t) { + const e = t.key, + r = t.value; + if ('array' === Ar(r)) { + if (r.length < 1 || r.length > 4) + return [ + new it( + e, + r, + `padding requires 1 to 4 values; ${r.length} values found`, + ), + ]; + const t = { type: 'number' }; + let n = []; + for (let i = 0; i < r.length; i++) + n = n.concat(yn({ key: `${e}[${i}]`, value: r[i], valueSpec: t })); + return n; + } + return qr({ key: e, value: r, valueSpec: {} }); + }, + }; + function yn(t) { + const e = t.value, + r = t.valueSpec, + n = t.styleSpec; + return r.expression && kr(ot(e)) + ? jr(t) + : r.expression && Er(lt(e)) + ? Nr(t) + : r.type && dn[r.type] + ? dn[r.type](t) + : Or(st({}, t, { valueSpec: r.type ? n[r.type] : r })); + } + function mn(t) { + const e = t.value, + r = t.key, + n = un(t); + return ( + n.length || + (-1 === e.indexOf('{fontstack}') && + n.push( + new it(r, e, '"glyphs" url must include a "{fontstack}" token'), + ), + -1 === e.indexOf('{range}') && + n.push( + new it(r, e, '"glyphs" url must include a "{range}" token'), + )), + n + ); + } + function gn(t, e = nt) { + let r = []; + return ( + (r = r.concat( + yn({ + key: '', + value: t, + valueSpec: e.$root, + styleSpec: e, + style: t, + objectElementValidators: { glyphs: mn, '*': () => [] }, + }), + )), + t.constants && + (r = r.concat( + at({ + key: 'constants', + value: t.constants, + style: t, + styleSpec: e, + }), + )), + xn(r) + ); + } + function xn(t) { + return [].concat(t).sort((t, e) => t.line - e.line); + } + function vn(t) { + return function (...e) { + return xn(t.apply(this, e)); + }; + } + (gn.source = vn(hn)), + (gn.light = vn(pn)), + (gn.terrain = vn(fn)), + (gn.layer = vn(ln)), + (gn.filter = vn(rn)), + (gn.paintProperty = vn(sn)), + (gn.layoutProperty = vn(on)); + const bn = gn, + wn = bn.light, + _n = bn.paintProperty, + An = bn.layoutProperty; + function kn(t, e) { + let r = !1; + if (e && e.length) + for (const n of e) t.fire(new et(new Error(n.message))), (r = !0); + return r; + } + class Sn { + constructor(t, e, r) { + const n = (this.cells = []); + if (t instanceof ArrayBuffer) { + this.arrayBuffer = t; + const i = new Int32Array(this.arrayBuffer); + (t = i[0]), (this.d = (e = i[1]) + 2 * (r = i[2])); + for (let t = 0; t < this.d * this.d; t++) { + const e = i[3 + t], + r = i[3 + t + 1]; + n.push(e === r ? null : i.subarray(e, r)); + } + const a = i[3 + n.length + 1]; + (this.keys = i.subarray(i[3 + n.length], a)), + (this.bboxes = i.subarray(a)), + (this.insert = this._insertReadonly); + } else { + this.d = e + 2 * r; + for (let t = 0; t < this.d * this.d; t++) n.push([]); + (this.keys = []), (this.bboxes = []); + } + (this.n = e), + (this.extent = t), + (this.padding = r), + (this.scale = e / t), + (this.uid = 0); + const i = (r / e) * t; + (this.min = -i), (this.max = t + i); + } + insert(t, e, r, n, i) { + this._forEachCell( + e, + r, + n, + i, + this._insertCell, + this.uid++, + void 0, + void 0, + ), + this.keys.push(t), + this.bboxes.push(e), + this.bboxes.push(r), + this.bboxes.push(n), + this.bboxes.push(i); + } + _insertReadonly() { + throw new Error( + 'Cannot insert into a GridIndex created from an ArrayBuffer.', + ); + } + _insertCell(t, e, r, n, i, a) { + this.cells[i].push(a); + } + query(t, e, r, n, i) { + const a = this.min, + s = this.max; + if (t <= a && e <= a && s <= r && s <= n && !i) + return Array.prototype.slice.call(this.keys); + { + const a = []; + return this._forEachCell(t, e, r, n, this._queryCell, a, {}, i), a; + } + } + _queryCell(t, e, r, n, i, a, s, o) { + const l = this.cells[i]; + if (null !== l) { + const i = this.keys, + u = this.bboxes; + for (let c = 0; c < l.length; c++) { + const h = l[c]; + if (void 0 === s[h]) { + const l = 4 * h; + ( + o + ? o(u[l + 0], u[l + 1], u[l + 2], u[l + 3]) + : t <= u[l + 2] && + e <= u[l + 3] && + r >= u[l + 0] && + n >= u[l + 1] + ) + ? ((s[h] = !0), a.push(i[h])) + : (s[h] = !1); + } + } + } + } + _forEachCell(t, e, r, n, i, a, s, o) { + const l = this._convertToCellCoord(t), + u = this._convertToCellCoord(e), + c = this._convertToCellCoord(r), + h = this._convertToCellCoord(n); + for (let p = l; p <= c; p++) + for (let l = u; l <= h; l++) { + const u = this.d * l + p; + if ( + (!o || + o( + this._convertFromCellCoord(p), + this._convertFromCellCoord(l), + this._convertFromCellCoord(p + 1), + this._convertFromCellCoord(l + 1), + )) && + i.call(this, t, e, r, n, u, a, s, o) + ) + return; + } + } + _convertFromCellCoord(t) { + return (t - this.padding) / this.scale; + } + _convertToCellCoord(t) { + return Math.max( + 0, + Math.min(this.d - 1, Math.floor(t * this.scale) + this.padding), + ); + } + toArrayBuffer() { + if (this.arrayBuffer) return this.arrayBuffer; + const t = this.cells, + e = 3 + this.cells.length + 1 + 1; + let r = 0; + for (let t = 0; t < this.cells.length; t++) r += this.cells[t].length; + const n = new Int32Array(e + r + this.keys.length + this.bboxes.length); + (n[0] = this.extent), (n[1] = this.n), (n[2] = this.padding); + let i = e; + for (let e = 0; e < t.length; e++) { + const r = t[e]; + (n[3 + e] = i), n.set(r, i), (i += r.length); + } + return ( + (n[3 + t.length] = i), + n.set(this.keys, i), + (i += this.keys.length), + (n[3 + t.length + 1] = i), + n.set(this.bboxes, i), + (i += this.bboxes.length), + n.buffer + ); + } + static serialize(t, e) { + const r = t.toArrayBuffer(); + return e && e.push(r), { buffer: r }; + } + static deserialize(t) { + return new Sn(t.buffer); + } + } + const In = {}; + function Mn(t, e, r = {}) { + if (In[t]) throw new Error(`${t} is already registered.`); + Object.defineProperty(e, '_classRegistryKey', { + value: t, + writeable: !1, + }), + (In[t] = { klass: e, omit: r.omit || [], shallow: r.shallow || [] }); + } + Mn('Object', Object), + Mn('TransferableGridIndex', Sn), + Mn('Color', Ft), + Mn('Error', Error), + Mn('AJAXError', q), + Mn('ResolvedImage', Rt), + Mn('StylePropertyFunction', $r), + Mn('StyleExpression', Vr, { omit: ['_evaluator'] }), + Mn('ZoomDependentExpression', Lr), + Mn('ZoomConstantExpression', Tr), + Mn('CompoundExpression', Wt, { omit: ['_evaluate'] }); + for (const t in fr) fr[t]._classRegistryKey || Mn(`Expression_${t}`, fr[t]); + function zn(t) { + return ( + t && + 'undefined' != typeof ArrayBuffer && + (t instanceof ArrayBuffer || + (t.constructor && 'ArrayBuffer' === t.constructor.name)) + ); + } + function Bn(t, e) { + if ( + null == t || + 'boolean' == typeof t || + 'number' == typeof t || + 'string' == typeof t || + t instanceof Boolean || + t instanceof Number || + t instanceof String || + t instanceof Date || + t instanceof RegExp || + t instanceof Blob + ) + return t; + if (zn(t)) return e && e.push(t), t; + if (A(t)) return e && e.push(t), t; + if (ArrayBuffer.isView(t)) { + const r = t; + return e && e.push(r.buffer), r; + } + if (t instanceof ImageData) return e && e.push(t.data.buffer), t; + if (Array.isArray(t)) { + const r = []; + for (const n of t) r.push(Bn(n, e)); + return r; + } + if ('object' == typeof t) { + const r = t.constructor, + n = r._classRegistryKey; + if (!n) throw new Error("can't serialize object of unregistered class"); + if (!In[n]) throw new Error(`${n} is not registered.`); + const i = r.serialize ? r.serialize(t, e) : {}; + if (r.serialize) { + if (e && i === e[e.length - 1]) + throw new Error( + "statically serialized object won't survive transfer of $name property", + ); + } else { + for (const r in t) { + if (!t.hasOwnProperty(r)) continue; + if (In[n].omit.indexOf(r) >= 0) continue; + const a = t[r]; + i[r] = In[n].shallow.indexOf(r) >= 0 ? a : Bn(a, e); + } + t instanceof Error && (i.message = t.message); + } + if (i.$name) + throw new Error( + '$name property is reserved for worker serialization logic.', + ); + return 'Object' !== n && (i.$name = n), i; + } + throw new Error("can't serialize object of type " + typeof t); + } + function Cn(t) { + if ( + null == t || + 'boolean' == typeof t || + 'number' == typeof t || + 'string' == typeof t || + t instanceof Boolean || + t instanceof Number || + t instanceof String || + t instanceof Date || + t instanceof RegExp || + t instanceof Blob || + zn(t) || + A(t) || + ArrayBuffer.isView(t) || + t instanceof ImageData + ) + return t; + if (Array.isArray(t)) return t.map(Cn); + if ('object' == typeof t) { + const e = t.$name || 'Object'; + if (!In[e]) + throw new Error(`can't deserialize unregistered class ${e}`); + const { klass: r } = In[e]; + if (!r) throw new Error(`can't deserialize unregistered class ${e}`); + if (r.deserialize) return r.deserialize(t); + const n = Object.create(r.prototype); + for (const r of Object.keys(t)) { + if ('$name' === r) continue; + const i = t[r]; + n[r] = In[e].shallow.indexOf(r) >= 0 ? i : Cn(i); + } + return n; + } + throw new Error("can't deserialize object of type " + typeof t); + } + class Pn { + constructor() { + this.first = !0; + } + update(t, e) { + const r = Math.floor(t); + return this.first + ? ((this.first = !1), + (this.lastIntegerZoom = r), + (this.lastIntegerZoomTime = 0), + (this.lastZoom = t), + (this.lastFloorZoom = r), + !0) + : (this.lastFloorZoom > r + ? ((this.lastIntegerZoom = r + 1), (this.lastIntegerZoomTime = e)) + : this.lastFloorZoom < r && + ((this.lastIntegerZoom = r), (this.lastIntegerZoomTime = e)), + t !== this.lastZoom && + ((this.lastZoom = t), (this.lastFloorZoom = r), !0)); + } + } + const Vn = { + 'Latin-1 Supplement': (t) => t >= 128 && t <= 255, + Arabic: (t) => t >= 1536 && t <= 1791, + 'Arabic Supplement': (t) => t >= 1872 && t <= 1919, + 'Arabic Extended-A': (t) => t >= 2208 && t <= 2303, + 'Hangul Jamo': (t) => t >= 4352 && t <= 4607, + 'Unified Canadian Aboriginal Syllabics': (t) => t >= 5120 && t <= 5759, + Khmer: (t) => t >= 6016 && t <= 6143, + 'Unified Canadian Aboriginal Syllabics Extended': (t) => + t >= 6320 && t <= 6399, + 'General Punctuation': (t) => t >= 8192 && t <= 8303, + 'Letterlike Symbols': (t) => t >= 8448 && t <= 8527, + 'Number Forms': (t) => t >= 8528 && t <= 8591, + 'Miscellaneous Technical': (t) => t >= 8960 && t <= 9215, + 'Control Pictures': (t) => t >= 9216 && t <= 9279, + 'Optical Character Recognition': (t) => t >= 9280 && t <= 9311, + 'Enclosed Alphanumerics': (t) => t >= 9312 && t <= 9471, + 'Geometric Shapes': (t) => t >= 9632 && t <= 9727, + 'Miscellaneous Symbols': (t) => t >= 9728 && t <= 9983, + 'Miscellaneous Symbols and Arrows': (t) => t >= 11008 && t <= 11263, + 'CJK Radicals Supplement': (t) => t >= 11904 && t <= 12031, + 'Kangxi Radicals': (t) => t >= 12032 && t <= 12255, + 'Ideographic Description Characters': (t) => t >= 12272 && t <= 12287, + 'CJK Symbols and Punctuation': (t) => t >= 12288 && t <= 12351, + Hiragana: (t) => t >= 12352 && t <= 12447, + Katakana: (t) => t >= 12448 && t <= 12543, + Bopomofo: (t) => t >= 12544 && t <= 12591, + 'Hangul Compatibility Jamo': (t) => t >= 12592 && t <= 12687, + Kanbun: (t) => t >= 12688 && t <= 12703, + 'Bopomofo Extended': (t) => t >= 12704 && t <= 12735, + 'CJK Strokes': (t) => t >= 12736 && t <= 12783, + 'Katakana Phonetic Extensions': (t) => t >= 12784 && t <= 12799, + 'Enclosed CJK Letters and Months': (t) => t >= 12800 && t <= 13055, + 'CJK Compatibility': (t) => t >= 13056 && t <= 13311, + 'CJK Unified Ideographs Extension A': (t) => t >= 13312 && t <= 19903, + 'Yijing Hexagram Symbols': (t) => t >= 19904 && t <= 19967, + 'CJK Unified Ideographs': (t) => t >= 19968 && t <= 40959, + 'Yi Syllables': (t) => t >= 40960 && t <= 42127, + 'Yi Radicals': (t) => t >= 42128 && t <= 42191, + 'Hangul Jamo Extended-A': (t) => t >= 43360 && t <= 43391, + 'Hangul Syllables': (t) => t >= 44032 && t <= 55215, + 'Hangul Jamo Extended-B': (t) => t >= 55216 && t <= 55295, + 'Private Use Area': (t) => t >= 57344 && t <= 63743, + 'CJK Compatibility Ideographs': (t) => t >= 63744 && t <= 64255, + 'Arabic Presentation Forms-A': (t) => t >= 64336 && t <= 65023, + 'Vertical Forms': (t) => t >= 65040 && t <= 65055, + 'CJK Compatibility Forms': (t) => t >= 65072 && t <= 65103, + 'Small Form Variants': (t) => t >= 65104 && t <= 65135, + 'Arabic Presentation Forms-B': (t) => t >= 65136 && t <= 65279, + 'Halfwidth and Fullwidth Forms': (t) => t >= 65280 && t <= 65519, + }; + function En(t) { + for (const e of t) if (Ln(e.charCodeAt(0))) return !0; + return !1; + } + function Fn(t) { + for (const e of t) if (!Tn(e.charCodeAt(0))) return !1; + return !0; + } + function Tn(t) { + return !( + Vn.Arabic(t) || + Vn['Arabic Supplement'](t) || + Vn['Arabic Extended-A'](t) || + Vn['Arabic Presentation Forms-A'](t) || + Vn['Arabic Presentation Forms-B'](t) + ); + } + function Ln(t) { + return !( + 746 !== t && + 747 !== t && + (t < 4352 || + !( + Vn['Bopomofo Extended'](t) || + Vn.Bopomofo(t) || + (Vn['CJK Compatibility Forms'](t) && !(t >= 65097 && t <= 65103)) || + Vn['CJK Compatibility Ideographs'](t) || + Vn['CJK Compatibility'](t) || + Vn['CJK Radicals Supplement'](t) || + Vn['CJK Strokes'](t) || + !( + !Vn['CJK Symbols and Punctuation'](t) || + (t >= 12296 && t <= 12305) || + (t >= 12308 && t <= 12319) || + 12336 === t + ) || + Vn['CJK Unified Ideographs Extension A'](t) || + Vn['CJK Unified Ideographs'](t) || + Vn['Enclosed CJK Letters and Months'](t) || + Vn['Hangul Compatibility Jamo'](t) || + Vn['Hangul Jamo Extended-A'](t) || + Vn['Hangul Jamo Extended-B'](t) || + Vn['Hangul Jamo'](t) || + Vn['Hangul Syllables'](t) || + Vn.Hiragana(t) || + Vn['Ideographic Description Characters'](t) || + Vn.Kanbun(t) || + Vn['Kangxi Radicals'](t) || + Vn['Katakana Phonetic Extensions'](t) || + (Vn.Katakana(t) && 12540 !== t) || + !( + !Vn['Halfwidth and Fullwidth Forms'](t) || + 65288 === t || + 65289 === t || + 65293 === t || + (t >= 65306 && t <= 65310) || + 65339 === t || + 65341 === t || + 65343 === t || + (t >= 65371 && t <= 65503) || + 65507 === t || + (t >= 65512 && t <= 65519) + ) || + !( + !Vn['Small Form Variants'](t) || + (t >= 65112 && t <= 65118) || + (t >= 65123 && t <= 65126) + ) || + Vn['Unified Canadian Aboriginal Syllabics'](t) || + Vn['Unified Canadian Aboriginal Syllabics Extended'](t) || + Vn['Vertical Forms'](t) || + Vn['Yijing Hexagram Symbols'](t) || + Vn['Yi Syllables'](t) || + Vn['Yi Radicals'](t) + )) + ); + } + function Dn(t) { + return !( + Ln(t) || + (function (t) { + return !!( + (Vn['Latin-1 Supplement'](t) && + (167 === t || + 169 === t || + 174 === t || + 177 === t || + 188 === t || + 189 === t || + 190 === t || + 215 === t || + 247 === t)) || + (Vn['General Punctuation'](t) && + (8214 === t || + 8224 === t || + 8225 === t || + 8240 === t || + 8241 === t || + 8251 === t || + 8252 === t || + 8258 === t || + 8263 === t || + 8264 === t || + 8265 === t || + 8273 === t)) || + Vn['Letterlike Symbols'](t) || + Vn['Number Forms'](t) || + (Vn['Miscellaneous Technical'](t) && + ((t >= 8960 && t <= 8967) || + (t >= 8972 && t <= 8991) || + (t >= 8996 && t <= 9e3) || + 9003 === t || + (t >= 9085 && t <= 9114) || + (t >= 9150 && t <= 9165) || + 9167 === t || + (t >= 9169 && t <= 9179) || + (t >= 9186 && t <= 9215))) || + (Vn['Control Pictures'](t) && 9251 !== t) || + Vn['Optical Character Recognition'](t) || + Vn['Enclosed Alphanumerics'](t) || + Vn['Geometric Shapes'](t) || + (Vn['Miscellaneous Symbols'](t) && !(t >= 9754 && t <= 9759)) || + (Vn['Miscellaneous Symbols and Arrows'](t) && + ((t >= 11026 && t <= 11055) || + (t >= 11088 && t <= 11097) || + (t >= 11192 && t <= 11243))) || + Vn['CJK Symbols and Punctuation'](t) || + Vn.Katakana(t) || + Vn['Private Use Area'](t) || + Vn['CJK Compatibility Forms'](t) || + Vn['Small Form Variants'](t) || + Vn['Halfwidth and Fullwidth Forms'](t) || + 8734 === t || + 8756 === t || + 8757 === t || + (t >= 9984 && t <= 10087) || + (t >= 10102 && t <= 10131) || + 65532 === t || + 65533 === t + ); + })(t) + ); + } + function $n(t) { + return ( + (t >= 1424 && t <= 2303) || + Vn['Arabic Presentation Forms-A'](t) || + Vn['Arabic Presentation Forms-B'](t) + ); + } + function Rn(t, e) { + return !( + (!e && $n(t)) || + (t >= 2304 && t <= 3583) || + (t >= 3840 && t <= 4255) || + Vn.Khmer(t) + ); + } + function On(t) { + for (const e of t) if ($n(e.charCodeAt(0))) return !0; + return !1; + } + const Un = 'deferred', + qn = 'loading', + jn = 'loaded'; + let Nn = null, + Zn = 'unavailable', + Kn = null; + const Gn = function (t) { + t && + 'string' == typeof t && + t.indexOf('NetworkError') > -1 && + (Zn = 'error'), + Nn && Nn(t); + }; + function Jn() { + Xn.fire(new tt('pluginStateChange', { pluginStatus: Zn, pluginURL: Kn })); + } + const Xn = new rt(), + Yn = function () { + return Zn; + }, + Hn = function () { + if (Zn !== Un || !Kn) + throw new Error( + 'rtl-text-plugin cannot be downloaded unless a pluginURL is specified', + ); + (Zn = qn), + Jn(), + Kn && + K({ url: Kn }, (t) => { + t ? Gn(t) : ((Zn = jn), Jn()); + }); + }, + Wn = { + applyArabicShaping: null, + processBidirectionalText: null, + processStyledBidirectionalText: null, + isLoaded: () => Zn === jn || null != Wn.applyArabicShaping, + isLoading: () => Zn === qn, + setState(t) { + if (!g()) + throw new Error( + 'Cannot set the state of the rtl-text-plugin when not in the web-worker context', + ); + (Zn = t.pluginStatus), (Kn = t.pluginURL); + }, + isParsed() { + if (!g()) + throw new Error( + 'rtl-text-plugin is only parsed on the worker-threads', + ); + return ( + null != Wn.applyArabicShaping && + null != Wn.processBidirectionalText && + null != Wn.processStyledBidirectionalText + ); + }, + getPluginURL() { + if (!g()) + throw new Error( + 'rtl-text-plugin url can only be queried from the worker threads', + ); + return Kn; + }, + }; + class Qn { + constructor(t, e) { + (this.zoom = t), + e + ? ((this.now = e.now), + (this.fadeDuration = e.fadeDuration), + (this.zoomHistory = e.zoomHistory), + (this.transition = e.transition)) + : ((this.now = 0), + (this.fadeDuration = 0), + (this.zoomHistory = new Pn()), + (this.transition = {})); + } + isSupportedScript(t) { + return (function (t, e) { + for (const r of t) if (!Rn(r.charCodeAt(0), e)) return !1; + return !0; + })(t, Wn.isLoaded()); + } + crossFadingFactor() { + return 0 === this.fadeDuration + ? 1 + : Math.min( + (this.now - this.zoomHistory.lastIntegerZoomTime) / + this.fadeDuration, + 1, + ); + } + getCrossfadeParameters() { + const t = this.zoom, + e = t - Math.floor(t), + r = this.crossFadingFactor(); + return t > this.zoomHistory.lastIntegerZoom + ? { fromScale: 2, toScale: 1, t: e + (1 - e) * r } + : { fromScale: 0.5, toScale: 1, t: 1 - (1 - r) * e }; + } + } + class ti { + constructor(t, e) { + (this.property = t), + (this.value = e), + (this.expression = (function (t, e) { + if (kr(t)) return new $r(t, e); + if (Er(t)) { + const r = Dr(t, e); + if ('error' === r.result) + throw new Error( + r.value.map((t) => `${t.key}: ${t.message}`).join(', '), + ); + return r.value; + } + { + let r = t; + return ( + 'color' === e.type && 'string' == typeof t + ? (r = Ft.parse(t)) + : 'padding' !== e.type || + ('number' != typeof t && !Array.isArray(t)) || + (r = $t.parse(t)), + { kind: 'constant', evaluate: () => r } + ); + } + })(void 0 === e ? t.specification.default : e, t.specification)); + } + isDataDriven() { + return ( + 'source' === this.expression.kind || + 'composite' === this.expression.kind + ); + } + possiblyEvaluate(t, e, r) { + return this.property.possiblyEvaluate(this, t, e, r); + } + } + class ei { + constructor(t) { + (this.property = t), (this.value = new ti(t, void 0)); + } + transitioned(t, e) { + return new ni( + this.property, + this.value, + e, + o({}, t.transition, this.transition), + t.now, + ); + } + untransitioned() { + return new ni(this.property, this.value, null, {}, 0); + } + } + class ri { + constructor(t) { + (this._properties = t), + (this._values = Object.create(t.defaultTransitionablePropertyValues)); + } + getValue(t) { + return p(this._values[t].value.value); + } + setValue(t, e) { + Object.prototype.hasOwnProperty.call(this._values, t) || + (this._values[t] = new ei(this._values[t].property)), + (this._values[t].value = new ti( + this._values[t].property, + null === e ? void 0 : p(e), + )); + } + getTransition(t) { + return p(this._values[t].transition); + } + setTransition(t, e) { + Object.prototype.hasOwnProperty.call(this._values, t) || + (this._values[t] = new ei(this._values[t].property)), + (this._values[t].transition = p(e) || void 0); + } + serialize() { + const t = {}; + for (const e of Object.keys(this._values)) { + const r = this.getValue(e); + void 0 !== r && (t[e] = r); + const n = this.getTransition(e); + void 0 !== n && (t[`${e}-transition`] = n); + } + return t; + } + transitioned(t, e) { + const r = new ii(this._properties); + for (const n of Object.keys(this._values)) + r._values[n] = this._values[n].transitioned(t, e._values[n]); + return r; + } + untransitioned() { + const t = new ii(this._properties); + for (const e of Object.keys(this._values)) + t._values[e] = this._values[e].untransitioned(); + return t; + } + } + class ni { + constructor(t, e, r, n, i) { + (this.property = t), + (this.value = e), + (this.begin = i + n.delay || 0), + (this.end = this.begin + n.duration || 0), + t.specification.transition && + (n.delay || n.duration) && + (this.prior = r); + } + possiblyEvaluate(t, e, r) { + const n = t.now || 0, + i = this.value.possiblyEvaluate(t, e, r), + a = this.prior; + if (a) { + if (n > this.end) return (this.prior = null), i; + if (this.value.isDataDriven()) return (this.prior = null), i; + if (n < this.begin) return a.possiblyEvaluate(t, e, r); + { + const s = (n - this.begin) / (this.end - this.begin); + return this.property.interpolate( + a.possiblyEvaluate(t, e, r), + i, + (function (t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + const e = t * t, + r = e * t; + return 4 * (t < 0.5 ? r : 3 * (t - e) + r - 0.75); + })(s), + ); + } + } + return i; + } + } + class ii { + constructor(t) { + (this._properties = t), + (this._values = Object.create(t.defaultTransitioningPropertyValues)); + } + possiblyEvaluate(t, e, r) { + const n = new oi(this._properties); + for (const i of Object.keys(this._values)) + n._values[i] = this._values[i].possiblyEvaluate(t, e, r); + return n; + } + hasTransition() { + for (const t of Object.keys(this._values)) + if (this._values[t].prior) return !0; + return !1; + } + } + class ai { + constructor(t) { + (this._properties = t), + (this._values = Object.create(t.defaultPropertyValues)); + } + getValue(t) { + return p(this._values[t].value); + } + setValue(t, e) { + this._values[t] = new ti( + this._values[t].property, + null === e ? void 0 : p(e), + ); + } + serialize() { + const t = {}; + for (const e of Object.keys(this._values)) { + const r = this.getValue(e); + void 0 !== r && (t[e] = r); + } + return t; + } + possiblyEvaluate(t, e, r) { + const n = new oi(this._properties); + for (const i of Object.keys(this._values)) + n._values[i] = this._values[i].possiblyEvaluate(t, e, r); + return n; + } + } + class si { + constructor(t, e, r) { + (this.property = t), (this.value = e), (this.parameters = r); + } + isConstant() { + return 'constant' === this.value.kind; + } + constantOr(t) { + return 'constant' === this.value.kind ? this.value.value : t; + } + evaluate(t, e, r, n) { + return this.property.evaluate(this.value, this.parameters, t, e, r, n); + } + } + class oi { + constructor(t) { + (this._properties = t), + (this._values = Object.create(t.defaultPossiblyEvaluatedValues)); + } + get(t) { + return this._values[t]; + } + } + class li { + constructor(t) { + this.specification = t; + } + possiblyEvaluate(t, e) { + if (t.isDataDriven()) + throw new Error('Value should not be data driven'); + return t.expression.evaluate(e); + } + interpolate(t, e, r) { + const n = Ie[this.specification.type]; + return n ? n(t, e, r) : t; + } + } + class ui { + constructor(t, e) { + (this.specification = t), (this.overrides = e); + } + possiblyEvaluate(t, e, r, n) { + return new si( + this, + 'constant' === t.expression.kind || 'camera' === t.expression.kind + ? { + kind: 'constant', + value: t.expression.evaluate(e, null, {}, r, n), + } + : t.expression, + e, + ); + } + interpolate(t, e, r) { + if ('constant' !== t.value.kind || 'constant' !== e.value.kind) + return t; + if (void 0 === t.value.value || void 0 === e.value.value) + return new si( + this, + { kind: 'constant', value: void 0 }, + t.parameters, + ); + const n = Ie[this.specification.type]; + return n + ? new si( + this, + { kind: 'constant', value: n(t.value.value, e.value.value, r) }, + t.parameters, + ) + : t; + } + evaluate(t, e, r, n, i, a) { + return 'constant' === t.kind ? t.value : t.evaluate(e, r, n, i, a); + } + } + class ci extends ui { + possiblyEvaluate(t, e, r, n) { + if (void 0 === t.value) + return new si(this, { kind: 'constant', value: void 0 }, e); + if ('constant' === t.expression.kind) { + const i = t.expression.evaluate(e, null, {}, r, n), + a = + 'resolvedImage' === t.property.specification.type && + 'string' != typeof i + ? i.name + : i, + s = this._calculate(a, a, a, e); + return new si(this, { kind: 'constant', value: s }, e); + } + if ('camera' === t.expression.kind) { + const r = this._calculate( + t.expression.evaluate({ zoom: e.zoom - 1 }), + t.expression.evaluate({ zoom: e.zoom }), + t.expression.evaluate({ zoom: e.zoom + 1 }), + e, + ); + return new si(this, { kind: 'constant', value: r }, e); + } + return new si(this, t.expression, e); + } + evaluate(t, e, r, n, i, a) { + if ('source' === t.kind) { + const s = t.evaluate(e, r, n, i, a); + return this._calculate(s, s, s, e); + } + return 'composite' === t.kind + ? this._calculate( + t.evaluate({ zoom: Math.floor(e.zoom) - 1 }, r, n), + t.evaluate({ zoom: Math.floor(e.zoom) }, r, n), + t.evaluate({ zoom: Math.floor(e.zoom) + 1 }, r, n), + e, + ) + : t.value; + } + _calculate(t, e, r, n) { + return n.zoom > n.zoomHistory.lastIntegerZoom + ? { from: t, to: e } + : { from: r, to: e }; + } + interpolate(t) { + return t; + } + } + class hi { + constructor(t) { + this.specification = t; + } + possiblyEvaluate(t, e, r, n) { + if (void 0 !== t.value) { + if ('constant' === t.expression.kind) { + const i = t.expression.evaluate(e, null, {}, r, n); + return this._calculate(i, i, i, e); + } + return this._calculate( + t.expression.evaluate(new Qn(Math.floor(e.zoom - 1), e)), + t.expression.evaluate(new Qn(Math.floor(e.zoom), e)), + t.expression.evaluate(new Qn(Math.floor(e.zoom + 1), e)), + e, + ); + } + } + _calculate(t, e, r, n) { + return n.zoom > n.zoomHistory.lastIntegerZoom + ? { from: t, to: e } + : { from: r, to: e }; + } + interpolate(t) { + return t; + } + } + class pi { + constructor(t) { + this.specification = t; + } + possiblyEvaluate(t, e, r, n) { + return !!t.expression.evaluate(e, null, {}, r, n); + } + interpolate() { + return !1; + } + } + class fi { + constructor(t) { + (this.properties = t), + (this.defaultPropertyValues = {}), + (this.defaultTransitionablePropertyValues = {}), + (this.defaultTransitioningPropertyValues = {}), + (this.defaultPossiblyEvaluatedValues = {}), + (this.overridableProperties = []); + for (const e in t) { + const r = t[e]; + r.specification.overridable && this.overridableProperties.push(e); + const n = (this.defaultPropertyValues[e] = new ti(r, void 0)), + i = (this.defaultTransitionablePropertyValues[e] = new ei(r)); + (this.defaultTransitioningPropertyValues[e] = i.untransitioned()), + (this.defaultPossiblyEvaluatedValues[e] = n.possiblyEvaluate({})); + } + } + } + Mn('DataDrivenProperty', ui), + Mn('DataConstantProperty', li), + Mn('CrossFadedDataDrivenProperty', ci), + Mn('CrossFadedProperty', hi), + Mn('ColorRampProperty', pi); + const di = '-transition'; + class yi extends rt { + constructor(t, e) { + if ( + (super(), + (this.id = t.id), + (this.type = t.type), + (this._featureFilter = { filter: () => !0, needGeometry: !1 }), + 'custom' !== t.type && + ((this.metadata = t.metadata), + (this.minzoom = t.minzoom), + (this.maxzoom = t.maxzoom), + 'background' !== t.type && + ((this.source = t.source), + (this.sourceLayer = t['source-layer']), + (this.filter = t.filter)), + e.layout && (this._unevaluatedLayout = new ai(e.layout)), + e.paint)) + ) { + this._transitionablePaint = new ri(e.paint); + for (const e in t.paint) + this.setPaintProperty(e, t.paint[e], { validate: !1 }); + for (const e in t.layout) + this.setLayoutProperty(e, t.layout[e], { validate: !1 }); + (this._transitioningPaint = + this._transitionablePaint.untransitioned()), + (this.paint = new oi(e.paint)); + } + } + getCrossfadeParameters() { + return this._crossfadeParameters; + } + getLayoutProperty(t) { + return 'visibility' === t + ? this.visibility + : this._unevaluatedLayout.getValue(t); + } + setLayoutProperty(t, e, r = {}) { + (null != e && + this._validate(An, `layers.${this.id}.layout.${t}`, t, e, r)) || + ('visibility' !== t + ? this._unevaluatedLayout.setValue(t, e) + : (this.visibility = e)); + } + getPaintProperty(t) { + return t.endsWith(di) + ? this._transitionablePaint.getTransition(t.slice(0, -di.length)) + : this._transitionablePaint.getValue(t); + } + setPaintProperty(t, e, r = {}) { + if ( + null != e && + this._validate(_n, `layers.${this.id}.paint.${t}`, t, e, r) + ) + return !1; + if (t.endsWith(di)) + return ( + this._transitionablePaint.setTransition( + t.slice(0, -di.length), + e || void 0, + ), + !1 + ); + { + const r = this._transitionablePaint._values[t], + n = + 'cross-faded-data-driven' === + r.property.specification['property-type'], + i = r.value.isDataDriven(), + a = r.value; + this._transitionablePaint.setValue(t, e), + this._handleSpecialPaintPropertyUpdate(t); + const s = this._transitionablePaint._values[t].value; + return ( + s.isDataDriven() || + i || + n || + this._handleOverridablePaintPropertyUpdate(t, a, s) + ); + } + } + _handleSpecialPaintPropertyUpdate(t) {} + _handleOverridablePaintPropertyUpdate(t, e, r) { + return !1; + } + isHidden(t) { + return ( + !!(this.minzoom && t < this.minzoom) || + !!(this.maxzoom && t >= this.maxzoom) || + 'none' === this.visibility + ); + } + updateTransitions(t) { + this._transitioningPaint = this._transitionablePaint.transitioned( + t, + this._transitioningPaint, + ); + } + hasTransition() { + return this._transitioningPaint.hasTransition(); + } + recalculate(t, e) { + t.getCrossfadeParameters && + (this._crossfadeParameters = t.getCrossfadeParameters()), + this._unevaluatedLayout && + (this.layout = this._unevaluatedLayout.possiblyEvaluate( + t, + void 0, + e, + )), + (this.paint = this._transitioningPaint.possiblyEvaluate( + t, + void 0, + e, + )); + } + serialize() { + const t = { + id: this.id, + type: this.type, + source: this.source, + 'source-layer': this.sourceLayer, + metadata: this.metadata, + minzoom: this.minzoom, + maxzoom: this.maxzoom, + filter: this.filter, + layout: + this._unevaluatedLayout && this._unevaluatedLayout.serialize(), + paint: + this._transitionablePaint && this._transitionablePaint.serialize(), + }; + return ( + this.visibility && + ((t.layout = t.layout || {}), + (t.layout.visibility = this.visibility)), + h( + t, + (t, e) => + !( + void 0 === t || + ('layout' === e && !Object.keys(t).length) || + ('paint' === e && !Object.keys(t).length) + ), + ) + ); + } + _validate(t, e, r, n, i = {}) { + return ( + (!i || !1 !== i.validate) && + kn( + this, + t.call(bn, { + key: e, + layerType: this.type, + objectKey: r, + value: n, + styleSpec: nt, + style: { glyphs: !0, sprite: !0 }, + }), + ) + ); + } + is3D() { + return !1; + } + isTileClipped() { + return !1; + } + hasOffscreenPass() { + return !1; + } + resize() {} + isStateDependent() { + for (const t in this.paint._values) { + const e = this.paint.get(t); + if ( + e instanceof si && + br(e.property.specification) && + ('source' === e.value.kind || 'composite' === e.value.kind) && + e.value.isStateDependent + ) + return !0; + } + return !1; + } + } + const mi = { + Int8: Int8Array, + Uint8: Uint8Array, + Int16: Int16Array, + Uint16: Uint16Array, + Int32: Int32Array, + Uint32: Uint32Array, + Float32: Float32Array, + }; + class gi { + constructor(t, e) { + (this._structArray = t), + (this._pos1 = e * this.size), + (this._pos2 = this._pos1 / 2), + (this._pos4 = this._pos1 / 4), + (this._pos8 = this._pos1 / 8); + } + } + class xi { + constructor() { + (this.isTransferred = !1), (this.capacity = -1), this.resize(0); + } + static serialize(t, e) { + return ( + t._trim(), + e && ((t.isTransferred = !0), e.push(t.arrayBuffer)), + { length: t.length, arrayBuffer: t.arrayBuffer } + ); + } + static deserialize(t) { + const e = Object.create(this.prototype); + return ( + (e.arrayBuffer = t.arrayBuffer), + (e.length = t.length), + (e.capacity = t.arrayBuffer.byteLength / e.bytesPerElement), + e._refreshViews(), + e + ); + } + _trim() { + this.length !== this.capacity && + ((this.capacity = this.length), + (this.arrayBuffer = this.arrayBuffer.slice( + 0, + this.length * this.bytesPerElement, + )), + this._refreshViews()); + } + clear() { + this.length = 0; + } + resize(t) { + this.reserve(t), (this.length = t); + } + reserve(t) { + if (t > this.capacity) { + (this.capacity = Math.max(t, Math.floor(5 * this.capacity), 128)), + (this.arrayBuffer = new ArrayBuffer( + this.capacity * this.bytesPerElement, + )); + const e = this.uint8; + this._refreshViews(), e && this.uint8.set(e); + } + } + _refreshViews() { + throw new Error( + '_refreshViews() must be implemented by each concrete StructArray layout', + ); + } + } + function vi(t, e = 1) { + let r = 0, + n = 0; + return { + members: t.map((t) => { + const i = mi[t.type].BYTES_PER_ELEMENT, + a = (r = bi(r, Math.max(e, i))), + s = t.components || 1; + return ( + (n = Math.max(n, i)), + (r += i * s), + { name: t.name, type: t.type, components: s, offset: a } + ); + }), + size: bi(r, Math.max(n, e)), + alignment: e, + }; + } + function bi(t, e) { + return Math.ceil(t / e) * e; + } + class wi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e) { + const r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + } + emplace(t, e, r) { + const n = 2 * t; + return (this.int16[n + 0] = e), (this.int16[n + 1] = r), t; + } + } + (wi.prototype.bytesPerElement = 4), Mn('StructArrayLayout2i4', wi); + class _i extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n) { + const i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + } + emplace(t, e, r, n, i) { + const a = 4 * t; + return ( + (this.int16[a + 0] = e), + (this.int16[a + 1] = r), + (this.int16[a + 2] = n), + (this.int16[a + 3] = i), + t + ); + } + } + (_i.prototype.bytesPerElement = 8), Mn('StructArrayLayout4i8', _i); + class Ai extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a) { + const s = this.length; + return this.resize(s + 1), this.emplace(s, t, e, r, n, i, a); + } + emplace(t, e, r, n, i, a, s) { + const o = 6 * t; + return ( + (this.int16[o + 0] = e), + (this.int16[o + 1] = r), + (this.int16[o + 2] = n), + (this.int16[o + 3] = i), + (this.int16[o + 4] = a), + (this.int16[o + 5] = s), + t + ); + } + } + (Ai.prototype.bytesPerElement = 12), Mn('StructArrayLayout2i4i12', Ai); + class ki extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a) { + const s = this.length; + return this.resize(s + 1), this.emplace(s, t, e, r, n, i, a); + } + emplace(t, e, r, n, i, a, s) { + const o = 4 * t, + l = 8 * t; + return ( + (this.int16[o + 0] = e), + (this.int16[o + 1] = r), + (this.uint8[l + 4] = n), + (this.uint8[l + 5] = i), + (this.uint8[l + 6] = a), + (this.uint8[l + 7] = s), + t + ); + } + } + (ki.prototype.bytesPerElement = 8), Mn('StructArrayLayout2i4ub8', ki); + class Si extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t, e) { + const r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + } + emplace(t, e, r) { + const n = 2 * t; + return (this.float32[n + 0] = e), (this.float32[n + 1] = r), t; + } + } + (Si.prototype.bytesPerElement = 8), Mn('StructArrayLayout2f8', Si); + class Ii extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a, s, o, l, u) { + const c = this.length; + return ( + this.resize(c + 1), this.emplace(c, t, e, r, n, i, a, s, o, l, u) + ); + } + emplace(t, e, r, n, i, a, s, o, l, u, c) { + const h = 10 * t; + return ( + (this.uint16[h + 0] = e), + (this.uint16[h + 1] = r), + (this.uint16[h + 2] = n), + (this.uint16[h + 3] = i), + (this.uint16[h + 4] = a), + (this.uint16[h + 5] = s), + (this.uint16[h + 6] = o), + (this.uint16[h + 7] = l), + (this.uint16[h + 8] = u), + (this.uint16[h + 9] = c), + t + ); + } + } + (Ii.prototype.bytesPerElement = 20), Mn('StructArrayLayout10ui20', Ii); + class Mi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a, s, o, l, u, c, h) { + const p = this.length; + return ( + this.resize(p + 1), + this.emplace(p, t, e, r, n, i, a, s, o, l, u, c, h) + ); + } + emplace(t, e, r, n, i, a, s, o, l, u, c, h, p) { + const f = 12 * t; + return ( + (this.int16[f + 0] = e), + (this.int16[f + 1] = r), + (this.int16[f + 2] = n), + (this.int16[f + 3] = i), + (this.uint16[f + 4] = a), + (this.uint16[f + 5] = s), + (this.uint16[f + 6] = o), + (this.uint16[f + 7] = l), + (this.int16[f + 8] = u), + (this.int16[f + 9] = c), + (this.int16[f + 10] = h), + (this.int16[f + 11] = p), + t + ); + } + } + (Mi.prototype.bytesPerElement = 24), Mn('StructArrayLayout4i4ui4i24', Mi); + class zi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t, e, r) { + const n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + } + emplace(t, e, r, n) { + const i = 3 * t; + return ( + (this.float32[i + 0] = e), + (this.float32[i + 1] = r), + (this.float32[i + 2] = n), + t + ); + } + } + (zi.prototype.bytesPerElement = 12), Mn('StructArrayLayout3f12', zi); + class Bi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)); + } + emplaceBack(t) { + const e = this.length; + return this.resize(e + 1), this.emplace(e, t); + } + emplace(t, e) { + return (this.uint32[1 * t + 0] = e), t; + } + } + (Bi.prototype.bytesPerElement = 4), Mn('StructArrayLayout1ul4', Bi); + class Ci extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a, s, o, l) { + const u = this.length; + return this.resize(u + 1), this.emplace(u, t, e, r, n, i, a, s, o, l); + } + emplace(t, e, r, n, i, a, s, o, l, u) { + const c = 10 * t, + h = 5 * t; + return ( + (this.int16[c + 0] = e), + (this.int16[c + 1] = r), + (this.int16[c + 2] = n), + (this.int16[c + 3] = i), + (this.int16[c + 4] = a), + (this.int16[c + 5] = s), + (this.uint32[h + 3] = o), + (this.uint16[c + 8] = l), + (this.uint16[c + 9] = u), + t + ); + } + } + (Ci.prototype.bytesPerElement = 20), Mn('StructArrayLayout6i1ul2ui20', Ci); + class Pi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a) { + const s = this.length; + return this.resize(s + 1), this.emplace(s, t, e, r, n, i, a); + } + emplace(t, e, r, n, i, a, s) { + const o = 6 * t; + return ( + (this.int16[o + 0] = e), + (this.int16[o + 1] = r), + (this.int16[o + 2] = n), + (this.int16[o + 3] = i), + (this.int16[o + 4] = a), + (this.int16[o + 5] = s), + t + ); + } + } + (Pi.prototype.bytesPerElement = 12), Mn('StructArrayLayout2i2i2i12', Pi); + class Vi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i) { + const a = this.length; + return this.resize(a + 1), this.emplace(a, t, e, r, n, i); + } + emplace(t, e, r, n, i, a) { + const s = 4 * t, + o = 8 * t; + return ( + (this.float32[s + 0] = e), + (this.float32[s + 1] = r), + (this.float32[s + 2] = n), + (this.int16[o + 6] = i), + (this.int16[o + 7] = a), + t + ); + } + } + (Vi.prototype.bytesPerElement = 16), Mn('StructArrayLayout2f1f2i16', Vi); + class Ei extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n) { + const i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + } + emplace(t, e, r, n, i) { + const a = 12 * t, + s = 3 * t; + return ( + (this.uint8[a + 0] = e), + (this.uint8[a + 1] = r), + (this.float32[s + 1] = n), + (this.float32[s + 2] = i), + t + ); + } + } + (Ei.prototype.bytesPerElement = 12), Mn('StructArrayLayout2ub2f12', Ei); + class Fi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r) { + const n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + } + emplace(t, e, r, n) { + const i = 3 * t; + return ( + (this.uint16[i + 0] = e), + (this.uint16[i + 1] = r), + (this.uint16[i + 2] = n), + t + ); + } + } + (Fi.prototype.bytesPerElement = 6), Mn('StructArrayLayout3ui6', Fi); + class Ti extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n, i, a, s, o, l, u, c, h, p, f, d, y, m) { + const g = this.length; + return ( + this.resize(g + 1), + this.emplace(g, t, e, r, n, i, a, s, o, l, u, c, h, p, f, d, y, m) + ); + } + emplace(t, e, r, n, i, a, s, o, l, u, c, h, p, f, d, y, m, g) { + const x = 24 * t, + v = 12 * t, + b = 48 * t; + return ( + (this.int16[x + 0] = e), + (this.int16[x + 1] = r), + (this.uint16[x + 2] = n), + (this.uint16[x + 3] = i), + (this.uint32[v + 2] = a), + (this.uint32[v + 3] = s), + (this.uint32[v + 4] = o), + (this.uint16[x + 10] = l), + (this.uint16[x + 11] = u), + (this.uint16[x + 12] = c), + (this.float32[v + 7] = h), + (this.float32[v + 8] = p), + (this.uint8[b + 36] = f), + (this.uint8[b + 37] = d), + (this.uint8[b + 38] = y), + (this.uint32[v + 10] = m), + (this.int16[x + 22] = g), + t + ); + } + } + (Ti.prototype.bytesPerElement = 48), + Mn('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', Ti); + class Li extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack( + t, + e, + r, + n, + i, + a, + s, + o, + l, + u, + c, + h, + p, + f, + d, + y, + m, + g, + x, + v, + b, + w, + _, + A, + k, + S, + I, + M, + ) { + const z = this.length; + return ( + this.resize(z + 1), + this.emplace( + z, + t, + e, + r, + n, + i, + a, + s, + o, + l, + u, + c, + h, + p, + f, + d, + y, + m, + g, + x, + v, + b, + w, + _, + A, + k, + S, + I, + M, + ) + ); + } + emplace( + t, + e, + r, + n, + i, + a, + s, + o, + l, + u, + c, + h, + p, + f, + d, + y, + m, + g, + x, + v, + b, + w, + _, + A, + k, + S, + I, + M, + z, + ) { + const B = 34 * t, + C = 17 * t; + return ( + (this.int16[B + 0] = e), + (this.int16[B + 1] = r), + (this.int16[B + 2] = n), + (this.int16[B + 3] = i), + (this.int16[B + 4] = a), + (this.int16[B + 5] = s), + (this.int16[B + 6] = o), + (this.int16[B + 7] = l), + (this.uint16[B + 8] = u), + (this.uint16[B + 9] = c), + (this.uint16[B + 10] = h), + (this.uint16[B + 11] = p), + (this.uint16[B + 12] = f), + (this.uint16[B + 13] = d), + (this.uint16[B + 14] = y), + (this.uint16[B + 15] = m), + (this.uint16[B + 16] = g), + (this.uint16[B + 17] = x), + (this.uint16[B + 18] = v), + (this.uint16[B + 19] = b), + (this.uint16[B + 20] = w), + (this.uint16[B + 21] = _), + (this.uint16[B + 22] = A), + (this.uint32[C + 12] = k), + (this.float32[C + 13] = S), + (this.float32[C + 14] = I), + (this.float32[C + 15] = M), + (this.float32[C + 16] = z), + t + ); + } + } + (Li.prototype.bytesPerElement = 68), + Mn('StructArrayLayout8i15ui1ul4f68', Li); + class Di extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t) { + const e = this.length; + return this.resize(e + 1), this.emplace(e, t); + } + emplace(t, e) { + return (this.float32[1 * t + 0] = e), t; + } + } + (Di.prototype.bytesPerElement = 4), Mn('StructArrayLayout1f4', Di); + class $i extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.int16 = new Int16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r) { + const n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + } + emplace(t, e, r, n) { + const i = 3 * t; + return ( + (this.int16[i + 0] = e), + (this.int16[i + 1] = r), + (this.int16[i + 2] = n), + t + ); + } + } + ($i.prototype.bytesPerElement = 6), Mn('StructArrayLayout3i6', $i); + class Ri extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint32 = new Uint32Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e, r) { + const n = this.length; + return this.resize(n + 1), this.emplace(n, t, e, r); + } + emplace(t, e, r, n) { + const i = 4 * t; + return ( + (this.uint32[2 * t + 0] = e), + (this.uint16[i + 2] = r), + (this.uint16[i + 3] = n), + t + ); + } + } + (Ri.prototype.bytesPerElement = 8), Mn('StructArrayLayout1ul2ui8', Ri); + class Oi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t, e) { + const r = this.length; + return this.resize(r + 1), this.emplace(r, t, e); + } + emplace(t, e, r) { + const n = 2 * t; + return (this.uint16[n + 0] = e), (this.uint16[n + 1] = r), t; + } + } + (Oi.prototype.bytesPerElement = 4), Mn('StructArrayLayout2ui4', Oi); + class Ui extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.uint16 = new Uint16Array(this.arrayBuffer)); + } + emplaceBack(t) { + const e = this.length; + return this.resize(e + 1), this.emplace(e, t); + } + emplace(t, e) { + return (this.uint16[1 * t + 0] = e), t; + } + } + (Ui.prototype.bytesPerElement = 2), Mn('StructArrayLayout1ui2', Ui); + class qi extends xi { + _refreshViews() { + (this.uint8 = new Uint8Array(this.arrayBuffer)), + (this.float32 = new Float32Array(this.arrayBuffer)); + } + emplaceBack(t, e, r, n) { + const i = this.length; + return this.resize(i + 1), this.emplace(i, t, e, r, n); + } + emplace(t, e, r, n, i) { + const a = 4 * t; + return ( + (this.float32[a + 0] = e), + (this.float32[a + 1] = r), + (this.float32[a + 2] = n), + (this.float32[a + 3] = i), + t + ); + } + } + (qi.prototype.bytesPerElement = 16), Mn('StructArrayLayout4f16', qi); + class ji extends gi { + get anchorPointX() { + return this._structArray.int16[this._pos2 + 0]; + } + get anchorPointY() { + return this._structArray.int16[this._pos2 + 1]; + } + get x1() { + return this._structArray.int16[this._pos2 + 2]; + } + get y1() { + return this._structArray.int16[this._pos2 + 3]; + } + get x2() { + return this._structArray.int16[this._pos2 + 4]; + } + get y2() { + return this._structArray.int16[this._pos2 + 5]; + } + get featureIndex() { + return this._structArray.uint32[this._pos4 + 3]; + } + get sourceLayerIndex() { + return this._structArray.uint16[this._pos2 + 8]; + } + get bucketIndex() { + return this._structArray.uint16[this._pos2 + 9]; + } + get anchorPoint() { + return new S(this.anchorPointX, this.anchorPointY); + } + } + ji.prototype.size = 20; + class Ni extends Ci { + get(t) { + return new ji(this, t); + } + } + Mn('CollisionBoxArray', Ni); + class Zi extends gi { + get anchorX() { + return this._structArray.int16[this._pos2 + 0]; + } + get anchorY() { + return this._structArray.int16[this._pos2 + 1]; + } + get glyphStartIndex() { + return this._structArray.uint16[this._pos2 + 2]; + } + get numGlyphs() { + return this._structArray.uint16[this._pos2 + 3]; + } + get vertexStartIndex() { + return this._structArray.uint32[this._pos4 + 2]; + } + get lineStartIndex() { + return this._structArray.uint32[this._pos4 + 3]; + } + get lineLength() { + return this._structArray.uint32[this._pos4 + 4]; + } + get segment() { + return this._structArray.uint16[this._pos2 + 10]; + } + get lowerSize() { + return this._structArray.uint16[this._pos2 + 11]; + } + get upperSize() { + return this._structArray.uint16[this._pos2 + 12]; + } + get lineOffsetX() { + return this._structArray.float32[this._pos4 + 7]; + } + get lineOffsetY() { + return this._structArray.float32[this._pos4 + 8]; + } + get writingMode() { + return this._structArray.uint8[this._pos1 + 36]; + } + get placedOrientation() { + return this._structArray.uint8[this._pos1 + 37]; + } + set placedOrientation(t) { + this._structArray.uint8[this._pos1 + 37] = t; + } + get hidden() { + return this._structArray.uint8[this._pos1 + 38]; + } + set hidden(t) { + this._structArray.uint8[this._pos1 + 38] = t; + } + get crossTileID() { + return this._structArray.uint32[this._pos4 + 10]; + } + set crossTileID(t) { + this._structArray.uint32[this._pos4 + 10] = t; + } + get associatedIconIndex() { + return this._structArray.int16[this._pos2 + 22]; + } + } + Zi.prototype.size = 48; + class Ki extends Ti { + get(t) { + return new Zi(this, t); + } + } + Mn('PlacedSymbolArray', Ki); + class Gi extends gi { + get anchorX() { + return this._structArray.int16[this._pos2 + 0]; + } + get anchorY() { + return this._structArray.int16[this._pos2 + 1]; + } + get rightJustifiedTextSymbolIndex() { + return this._structArray.int16[this._pos2 + 2]; + } + get centerJustifiedTextSymbolIndex() { + return this._structArray.int16[this._pos2 + 3]; + } + get leftJustifiedTextSymbolIndex() { + return this._structArray.int16[this._pos2 + 4]; + } + get verticalPlacedTextSymbolIndex() { + return this._structArray.int16[this._pos2 + 5]; + } + get placedIconSymbolIndex() { + return this._structArray.int16[this._pos2 + 6]; + } + get verticalPlacedIconSymbolIndex() { + return this._structArray.int16[this._pos2 + 7]; + } + get key() { + return this._structArray.uint16[this._pos2 + 8]; + } + get textBoxStartIndex() { + return this._structArray.uint16[this._pos2 + 9]; + } + get textBoxEndIndex() { + return this._structArray.uint16[this._pos2 + 10]; + } + get verticalTextBoxStartIndex() { + return this._structArray.uint16[this._pos2 + 11]; + } + get verticalTextBoxEndIndex() { + return this._structArray.uint16[this._pos2 + 12]; + } + get iconBoxStartIndex() { + return this._structArray.uint16[this._pos2 + 13]; + } + get iconBoxEndIndex() { + return this._structArray.uint16[this._pos2 + 14]; + } + get verticalIconBoxStartIndex() { + return this._structArray.uint16[this._pos2 + 15]; + } + get verticalIconBoxEndIndex() { + return this._structArray.uint16[this._pos2 + 16]; + } + get featureIndex() { + return this._structArray.uint16[this._pos2 + 17]; + } + get numHorizontalGlyphVertices() { + return this._structArray.uint16[this._pos2 + 18]; + } + get numVerticalGlyphVertices() { + return this._structArray.uint16[this._pos2 + 19]; + } + get numIconVertices() { + return this._structArray.uint16[this._pos2 + 20]; + } + get numVerticalIconVertices() { + return this._structArray.uint16[this._pos2 + 21]; + } + get useRuntimeCollisionCircles() { + return this._structArray.uint16[this._pos2 + 22]; + } + get crossTileID() { + return this._structArray.uint32[this._pos4 + 12]; + } + set crossTileID(t) { + this._structArray.uint32[this._pos4 + 12] = t; + } + get textBoxScale() { + return this._structArray.float32[this._pos4 + 13]; + } + get textOffset0() { + return this._structArray.float32[this._pos4 + 14]; + } + get textOffset1() { + return this._structArray.float32[this._pos4 + 15]; + } + get collisionCircleDiameter() { + return this._structArray.float32[this._pos4 + 16]; + } + } + Gi.prototype.size = 68; + class Ji extends Li { + get(t) { + return new Gi(this, t); + } + } + Mn('SymbolInstanceArray', Ji); + class Xi extends Di { + getoffsetX(t) { + return this.float32[1 * t + 0]; + } + } + Mn('GlyphOffsetArray', Xi); + class Yi extends $i { + getx(t) { + return this.int16[3 * t + 0]; + } + gety(t) { + return this.int16[3 * t + 1]; + } + gettileUnitDistanceFromAnchor(t) { + return this.int16[3 * t + 2]; + } + } + Mn('SymbolLineVertexArray', Yi); + class Hi extends gi { + get featureIndex() { + return this._structArray.uint32[this._pos4 + 0]; + } + get sourceLayerIndex() { + return this._structArray.uint16[this._pos2 + 2]; + } + get bucketIndex() { + return this._structArray.uint16[this._pos2 + 3]; + } + } + Hi.prototype.size = 8; + class Wi extends Ri { + get(t) { + return new Hi(this, t); + } + } + Mn('FeatureIndexArray', Wi); + class Qi extends wi {} + class ta extends wi {} + class ea extends wi {} + class ra extends Ai {} + class na extends ki {} + class ia extends Si {} + class aa extends Ii {} + class sa extends Mi {} + class oa extends zi {} + class la extends Bi {} + class ua extends Pi {} + class ca extends Ei {} + class ha extends Fi {} + class pa extends Oi {} + const fa = vi([{ name: 'a_pos', components: 2, type: 'Int16' }], 4), + { members: da } = fa; + class ya { + constructor(t = []) { + this.segments = t; + } + prepareSegment(t, e, r, n) { + let i = this.segments[this.segments.length - 1]; + return ( + t > ya.MAX_VERTEX_ARRAY_LENGTH && + d( + `Max vertices per segment is ${ya.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`, + ), + (!i || + i.vertexLength + t > ya.MAX_VERTEX_ARRAY_LENGTH || + i.sortKey !== n) && + ((i = { + vertexOffset: e.length, + primitiveOffset: r.length, + vertexLength: 0, + primitiveLength: 0, + }), + void 0 !== n && (i.sortKey = n), + this.segments.push(i)), + i + ); + } + get() { + return this.segments; + } + destroy() { + for (const t of this.segments) + for (const e in t.vaos) t.vaos[e].destroy(); + } + static simpleSegment(t, e, r, n) { + return new ya([ + { + vertexOffset: t, + primitiveOffset: e, + vertexLength: r, + primitiveLength: n, + vaos: {}, + sortKey: 0, + }, + ]); + } + } + function ma(t, e) { + return 256 * (t = a(Math.floor(t), 0, 255)) + a(Math.floor(e), 0, 255); + } + (ya.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1), Mn('SegmentVector', ya); + const ga = vi([ + { name: 'a_pattern_from', components: 4, type: 'Uint16' }, + { name: 'a_pattern_to', components: 4, type: 'Uint16' }, + { name: 'a_pixel_ratio_from', components: 1, type: 'Uint16' }, + { name: 'a_pixel_ratio_to', components: 1, type: 'Uint16' }, + ]); + var xa = { exports: {} }, + va = { exports: {} }; + va.exports = function (t, e) { + var r, n, i, a, s, o, l, u; + for ( + n = t.length - (r = 3 & t.length), + i = e, + s = 3432918353, + o = 461845907, + u = 0; + u < n; -define(["exports"],(function(t){"use strict";var e=r;function r(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}function n(t,r,n,i){const a=new e(t,r,n,i);return function(t){return a.solve(t)}}r.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?s=r:o=r,r=.5*(o-s)+s;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};const i=n(.25,.1,.25,1);function a(t,e,r){return Math.min(r,Math.max(e,t))}function s(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function o(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let l=1;function u(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e));}));}function c(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function h(t,e,r){const n={};for(const i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function p(t){return Array.isArray(t)?t.map(p):"object"==typeof t&&t?c(t,p):t}const f={};function d(t){f[t]||("undefined"!=typeof console&&console.warn(t),f[t]=!0);}function y(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function m(t){let e=0;for(let r,n,i=0,a=t.length,s=a-1;i@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t;}return e}let v,b,w=null;function _(t){if(null==w){const e=t.navigator?t.navigator.userAgent:null;w=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")));}return w}function A(t){return "undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const k={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return {cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const r=window.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(v||(v=document.createElement("a")),v.href=t,v.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==b&&(b=matchMedia("(prefers-reduced-motion: reduce)")),b.matches)}};var S=I;function I(t,e){this.x=t,this.y=e;}I.prototype={clone:function(){return new I(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},I.convert=function(t){return t instanceof I?t:Array.isArray(t)?new I(t[0],t[1]):t};const M={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},z="mapbox-tiles";let B,C,P=500,V=50;function E(){"undefined"==typeof caches||B||(B=caches.open(z));}let F=1/0;const T={supported:!1,testSupport:function(t){!$&&D&&(R?O(t):L=t);}};let L,D,$=!1,R=!1;function O(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,D),t.isContextLost())return;T.supported=!0;}catch(t){}t.deleteTexture(e),$=!0;}"undefined"!=typeof document&&(D=document.createElement("img"),D.onload=function(){L&&O(L),L=null,R=!0;},D.onerror=function(){$=!0,L=null;},D.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const U={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(U);class q extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n;}}const j=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function N(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:j(),signal:r.signal});let i=!1,a=!1;"json"===t.type&&n.headers.set("Accept","application/json");return ((r,s,o)=>{if(a)return;const l=Date.now();fetch(n).then((r=>r.ok?((r,s,o)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{a||(s&&o&&function(t,e,r){if(E(),!B)return;const n={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const i=x(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===C)try{new Response(new ReadableStream),C=!0;}catch(t){C=!1;}C?e(t.body):t.blob().then(e);}(e,(e=>{const r=new Response(e,n);E(),B&&B.then((e=>e.put(function(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}(t.url),r))).catch((t=>d(t.message)));})));}(n,s,o),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")));})).catch((t=>{a||e(new Error(t.message));}));})(r,null,l):r.blob().then((n=>e(new q(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message));}));})(),{cancel:()=>{a=!0,i||r.abort();}}}const Z=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!g()){const r=t.url.substring(0,t.url.indexOf("://"));return (M.REGISTERED_PROTOCOLS[r]||N)(t,e)}}if(!(/^file:/.test(r=t.url)||/^file:/.test(j())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return N(t,e);if(g()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return "json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText));},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"));}else {const n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new q(r.status,r.statusText,t.url,n));}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},K=function(t,e){return Z(o(t,{type:"arrayBuffer"}),e)};function G(t){const e=window.document.createElement("a");return e.href=t,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let X,Y;X=[],Y=0;const H=function(t,e){if(T.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Y>=M.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0;}};return X.push(r),r}Y++;let r=!1;const n=()=>{if(!r)for(r=!0,Y--;X.length&&Y{n(),t?e(t):r&&function(t,e){"function"==typeof createImageBitmap?function(t,e){const r=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(r).then((t=>{e(null,t);})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));}));}(t,e):function(t,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=J;}));},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(n):J;}(t,e);}(r,((t,r)=>{null!=t?e(t):null!=r&&e(null,r,{cacheControl:i,expires:a});}));}));return {cancel:()=>{i.cancel(),n();}}};function W(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e));}function Q(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}class tt{constructor(t,e={}){o(this,e),this.type=t;}}class et extends tt{constructor(t,e={}){super("error",o({error:t},e));}}class rt{on(t,e){return this._listeners=this._listeners||{},W(t,e,this._listeners),this}off(t,e){return Q(t,e,this._listeners),Q(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},W(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new tt(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)Q(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(o(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof et&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var nt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class it{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);}}function at(t){const e=t.value;return e?[new it(t.key,e,"constants have been deprecated as of v8")]:[]}function st(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}function ot(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function lt(t){if(Array.isArray(t))return t.map(lt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=lt(t[r]);return e}return ot(t)}class ut extends Error{constructor(t,e){super(e),this.message=e,this.key=t;}}class ct{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r;}concat(t){return new ct(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return !!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ht={kind:"null"},pt={kind:"number"},ft={kind:"string"},dt={kind:"boolean"},yt={kind:"color"},mt={kind:"object"},gt={kind:"value"},xt={kind:"collator"},vt={kind:"formatted"},bt={kind:"padding"},wt={kind:"resolvedImage"};function _t(t,e){return {kind:"array",itemType:t,N:e}}function At(t){if("array"===t.kind){const e=At(t.itemType);return "number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const kt=[ht,pt,ft,dt,yt,vt,mt,_t(gt),bt,wt];function St(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!St(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of kt)if(!St(t,e))return null}return `Expected ${At(t)} but found ${At(e)} instead.`}function It(t,e){return e.some((e=>e.kind===t.kind))}function Mt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}var zt,Bt={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 Ct(t){return (t=Math.round(t))<0?0:t>255?255:t}function Pt(t){return Ct("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Vt(t){return (e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e;}function Et(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{zt={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in Bt)return Bt[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf("("),i=r.indexOf(")");if(-1!==n&&i+1===r.length){var a=r.substr(0,n),s=r.substr(n+1,i-(n+1)).split(","),o=1;switch(a){case"rgba":if(4!==s.length)return null;o=Vt(s.pop());case"rgb":return 3!==s.length?null:[Pt(s[0]),Pt(s[1]),Pt(s[2]),o];case"hsla":if(4!==s.length)return null;o=Vt(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,u=Vt(s[1]),c=Vt(s[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return [Ct(255*Et(p,h,l+1/3)),Ct(255*Et(p,h,l)),Ct(255*Et(p,h,l-1/3)),o];default:return null}}return null};}catch(t){}class Ft{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n;}static parse(t){if(!t)return;if(t instanceof Ft)return t;if("string"!=typeof t)return;const e=zt(t);return e?new Ft(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return `rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}}Ft.black=new Ft(0,0,0,1),Ft.white=new Ft(1,1,1,1),Ft.transparent=new Ft(0,0,0,0),Ft.red=new Ft(1,0,0,1);class Tt{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Lt{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;}}class Dt{constructor(t){this.sections=t;}static fromString(t){return new Dt([new Lt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Dt?t:Dt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class $t{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof $t)return t;if("number"==typeof t)return new $t([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];}return new $t(t)}}toString(){return JSON.stringify(this.values)}}class Rt{constructor(t){this.name=t.name,this.available=t.available;}toString(){return this.name}static fromString(t){return t?new Rt({name:t,available:!1}):null}}function Ot(t,e,r,n){return "number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ut(t){if(null===t)return !0;if("string"==typeof t)return !0;if("boolean"==typeof t)return !0;if("number"==typeof t)return !0;if(t instanceof Ft)return !0;if(t instanceof Tt)return !0;if(t instanceof Dt)return !0;if(t instanceof $t)return !0;if(t instanceof Rt)return !0;if(Array.isArray(t)){for(const e of t)if(!Ut(e))return !1;return !0}if("object"==typeof t){for(const e in t)if(!Ut(t[e]))return !1;return !0}return !1}function qt(t){if(null===t)return ht;if("string"==typeof t)return ft;if("boolean"==typeof t)return dt;if("number"==typeof t)return pt;if(t instanceof Ft)return yt;if(t instanceof Tt)return xt;if(t instanceof Dt)return vt;if(t instanceof $t)return bt;if(t instanceof Rt)return wt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=qt(e);if(r){if(r===t)continue;r=gt;break}r=t;}return _t(r||gt,e)}return mt}function jt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ft||t instanceof Dt||t instanceof $t||t instanceof Rt?t.toString():JSON.stringify(t)}class Nt{constructor(t,e){this.type=t,this.value=e;}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ut(t[1]))return e.error("invalid value");const r=t[1];let n=qt(r);const i=e.expectedType;return "array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new Nt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}}class Zt{constructor(t){this.name="ExpressionEvaluationError",this.message=t;}toJSON(){return this.message}}const Kt={string:ft,number:pt,boolean:dt,object:mt};class Gt{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,a;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Kt)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Kt[r],n++;}else i=gt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++;}r=_t(i,a);}else {if(!Kt[i])throw new Error(`Types doesn't contain name = ${i}`);r=Kt[i];}const a=[];for(;nt.outputDefined()))}}const Jt={"to-boolean":dt,"to-color":yt,"to-number":pt,"to-string":ft};class Xt{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!Jt[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const n=Jt[r],i=[];for(let r=1;r4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ot(e[0],e[1],e[2],e[3]),!r))return new Ft(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Zt(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("padding"===this.type.kind){let e;for(const r of this.args){e=r.evaluate(t);const n=$t.parse(e);if(n)return n}throw new Zt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Zt(`Could not convert ${JSON.stringify(e)} to number.`)}return "formatted"===this.type.kind?Dt.fromString(jt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Rt.fromString(jt(this.args[0].evaluate(t))):jt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Yt=["Unknown","Point","LineString","Polygon"];class Ht{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null;}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Yt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Ft.parse(t)),e}}class Wt{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n;}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}static parse(t,e){const r=t[0],n=Wt.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,a]of s){o=new we(e.registry,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(At).join(", ")})`:`(${At(e.type)}...)`;var e;})).join(" | "),n=[];for(let r=1;r=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ne(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*te),Math.round(n*i*te)]}function ie(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return n*s-a*i==0&&n*a<=0&&i*s<=0}function ae(t,e){let r=!1;for(let s=0,o=e.length;s(n=t)[1]!=(a=o[e+1])[1]>n[1]&&n[0]<(a[0]-i[0])*(n[1]-i[1])/(a[1]-i[1])+i[0]&&(r=!r);}}var n,i,a;return r}function se(t,e){for(let r=0;r0&&o<0||s<0&&o>0}function le(t,e,r){for(const u of r)for(let r=0;rr[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i;}ee(e,t);}function de(t,e,r,n){const i=Math.pow(2,n.z)*te,a=[n.x*te,n.y*te],s=[];for(const n of t)for(const t of n){const n=[t.x+a[0],t.y+a[1]];fe(n,e,r,i),s.push(n);}return s}function ye(t,e,r,n){const i=Math.pow(2,n.z)*te,a=[n.x*te,n.y*te],s=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+a[0],n.y+a[1]];ee(e,r),t.push(r);}s.push(t);}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of s)for(const n of t)fe(n,e,r,i);}var o;return s}class me{constructor(t,e){this.type=dt,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ut(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!ge(t)&&(e=!1);})),e}function xe(t){if(t instanceof Wt&&"feature-state"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!xe(t)&&(e=!1);})),e}function ve(t,e){if(t instanceof Wt&&e.indexOf(t.name)>=0)return !1;let r=!0;return t.eachChild((t=>{r&&!ve(t,e)&&(r=!1);})),r}class be{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e;}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new be(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return !1}}class we{constructor(t,e=[],r,n=new ct,i=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r;}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return "assert"===r?new Gt(e,[t]):"coerce"===r?new Xt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind)if("padding"!==t.kind||"value"!==i.kind&&"number"!==i.kind&&"array"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"coerce");else n=r(n,t,e.typeAnnotation||"assert");}if(!(n instanceof Nt)&&"resolvedImage"!==n.type.kind&&_e(n)){const t=new Ht;try{n=new Nt(n.type,n.evaluate(t));}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new we(this.registry,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ut(r,t));}checkSubtype(t,e){const r=St(t,e);return r&&this.error(r),r}}function _e(t){if(t instanceof be)return _e(t.boundExpression);if(t instanceof Wt&&"error"===t.name)return !1;if(t instanceof Qt)return !1;if(t instanceof me)return !1;const e=t instanceof Xt||t instanceof Gt;let r=!0;return t.eachChild((t=>{r=e?r&&_e(t):r&&t instanceof Nt;})),!!r&&ge(t)&&ve(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ae(t,e){const r=t.length-1;let n,i,a=0,s=r,o=0;for(;a<=s;)if(o=Math.floor((a+s)/2),n=t[o],i=t[o+1],n<=e){if(o===r||ee))throw new Zt("Input is not a number.");s=o-1;}return 0}class ke{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e);}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,pt);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(s,l,i);if(!u)return null;i=i||u.type,n.push([a,u]);}return new ke(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ae(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Se(t,e,r){return t*(1-r)+e*r}var Ie=Object.freeze({__proto__:null,number:Se,color:function(t,e,r){return new Ft(Se(t.r,e.r,r),Se(t.g,e.g,r),Se(t.b,e.b,r),Se(t.a,e.a,r))},array:function(t,e,r){return t.map(((t,n)=>Se(t,e[n],r)))},padding:function(t,e,r){const n=t.values,i=e.values;return new $t([Se(n[0],i[0],r),Se(n[1],i[1],r),Se(n[2],i[2],r),Se(n[3],i[3],r)])}});const Me=.95047,ze=1.08883,Be=4/29,Ce=6/29,Pe=3*Ce*Ce,Ve=Math.PI/180,Ee=180/Math.PI;function Fe(t){return t>.008856451679035631?Math.pow(t,1/3):t/Pe+Be}function Te(t){return t>Ce?t*t*t:Pe*(t-Be)}function Le(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function De(t){return (t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $e(t){const e=De(t.r),r=De(t.g),n=De(t.b),i=Fe((.4124564*e+.3575761*r+.1804375*n)/Me),a=Fe((.2126729*e+.7151522*r+.072175*n)/1);return {l:116*a-16,a:500*(i-a),b:200*(a-Fe((.0193339*e+.119192*r+.9503041*n)/ze)),alpha:t.a}}function Re(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Te(e),r=Me*Te(r),n=ze*Te(n),new Ft(Le(3.2404542*r-1.5371385*e-.4985314*n),Le(-.969266*r+1.8760108*e+.041556*n),Le(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Oe(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Ue={forward:$e,reverse:Re,interpolate:function(t,e,r){return {l:Se(t.l,e.l,r),a:Se(t.a,e.a,r),b:Se(t.b,e.b,r),alpha:Se(t.alpha,e.alpha,r)}}},qe={forward:function(t){const{l:e,a:r,b:n}=$e(t),i=Math.atan2(n,r)*Ee;return {h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ve,r=t.c;return Re({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return {h:Oe(t.h,e.h,r),c:Se(t.c,e.c,r),l:Se(t.l,e.l,r),alpha:Se(t.alpha,e.alpha,r)}}};var je=Object.freeze({__proto__:null,lab:Ue,hcl:qe});class Ne{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e);}static interpolationFactor(t,r,n,i){let a=0;if("exponential"===t.name)a=Ze(r,t.base,n,i);else if("linear"===t.name)a=Ze(r,1,n,i);else if("cubic-bezier"===t.name){const s=t.controlPoints;a=new e(s[0],s[1],s[2],s[3]).solve(Ze(r,1,n,i));}return a}static parse(t,e){let[r,n,i,...a]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t};}else {if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,pt),!i)return null;const s=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=yt:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,s.push([r,u]);}return "number"===o.kind||"color"===o.kind||"padding"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Ne(o,r,n,i,s):e.error(`Type ${At(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const a=Ae(e,n),s=Ne.interpolationFactor(this.interpolation,n,e[a],e[a+1]),o=r[a].evaluate(t),l=r[a+1].evaluate(t);return "interpolate"===this.operator?Ie[this.type.kind.toLowerCase()](o,l,s):"interpolate-hcl"===this.operator?qe.reverse(qe.interpolate(qe.forward(o),qe.forward(l),s)):Ue.reverse(Ue.interpolate(Ue.forward(o),Ue.forward(l),s))}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ze(t,e,r,n){const i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}class Ke{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t);}if(!r)throw new Error("No output type");const a=n&&i.some((t=>St(n,t.type)));return new Ke(a?gt:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof Rt&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ge{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e;}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result);}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n=r.length)throw new Zt(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new Zt(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}}class Xe{constructor(t,e){this.type=dt,this.needle=t,this.haystack=e;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);return r&&n?It(r.type,[dt,ft,pt,ht,gt])?new Xe(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${At(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!Mt(e,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${At(qt(e))} instead.`);if(!Mt(r,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${At(qt(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}}class Ye{constructor(t,e,r){this.type=pt,this.needle=t,this.haystack=e,this.fromIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);if(!r||!n)return null;if(!It(r.type,[dt,ft,pt,ht,gt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${At(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new Ye(r,n,i):null}return new Ye(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Mt(e,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${At(qt(e))} instead.`);if(!Mt(r,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${At(qt(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}}class He{constructor(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a;}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},a=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,qt(t)))return null}else r=qt(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=a.length;}const c=e.parse(l,s,n);if(!c)return null;n=n||c.type,a.push(c);}const s=e.parse(t[1],1,gt);if(!s)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==s.type.kind&&e.concat(1).checkSubtype(r,s.type)?null:new He(r,n,s,i,a,o):null}evaluate(t){const e=this.input.evaluate(t);return (qt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class We{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r;}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;ie.outputDefined()))&&this.otherwise.outputDefined()}}class Qe{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,gt),n=e.parse(t[2],2,pt);if(!r||!n)return null;if(!It(r.type,[_t(gt),ft,gt]))return e.error(`Expected first argument to be of type array or string, but found ${At(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new Qe(r.type,r,n,i):null}return new Qe(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Mt(e,["string","array"]))throw new Zt(`Expected first argument to be of type array or string, but found ${At(qt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}}function tr(t,e){return "=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function er(t,e,r,n){return 0===n.compare(e,r)}function rr(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=dt,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind;}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let a=e.parse(t[1],1,gt);if(!a)return null;if(!tr(r,a.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${At(a.type)}'.`);let s=e.parse(t[2],2,gt);if(!s)return null;if(!tr(r,s.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${At(s.type)}'.`);if(a.type.kind!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${At(a.type)}' and '${At(s.type)}'.`);n&&("value"===a.type.kind&&"value"!==s.type.kind?a=new Gt(s.type,[a]):"value"!==a.type.kind&&"value"===s.type.kind&&(s=new Gt(a.type,[s])));let o=null;if(4===t.length){if("string"!==a.type.kind&&"string"!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,xt),!o)return null}return new i(a,s,o)}evaluate(i){const a=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=qt(a),r=qt(s);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new Zt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=qt(a),r=qt(s);if("string"!==t.kind||"string"!==r.kind)return e(i,a,s)}return this.collator?r(i,a,s,this.collator.evaluate(i)):e(i,a,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}}}const nr=rr("==",(function(t,e,r){return e===r}),er),ir=rr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !er(0,e,r,n)})),ar=rr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),or=rr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),lr=rr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class ur{constructor(t,e,r,n,i){this.type=ft,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,pt);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parse(n.locale,1,ft),!i))return null;let a=null;if(n.currency&&(a=e.parse(n.currency,1,ft),!a))return null;let s=null;if(n["min-fraction-digits"]&&(s=e.parse(n["min-fraction-digits"],1,pt),!s))return null;let o=null;return n["max-fraction-digits"]&&(o=e.parse(n["max-fraction-digits"],1,pt),!o)?null:new ur(r,i,a,s,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}}class cr{constructor(t){this.type=vt,this.sections=t;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const a=t[r];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;let t=null;if(a["font-scale"]&&(t=e.parse(a["font-scale"],1,pt),!t))return null;let r=null;if(a["text-font"]&&(r=e.parse(a["text-font"],1,_t(ft)),!r))return null;let s=null;if(a["text-color"]&&(s=e.parse(a["text-color"],1,yt),!s))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=s;}else {const a=e.parse(t[r],1,gt);if(!a)return null;const s=a.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:a,scale:null,font:null,textColor:null});}}return new cr(n)}evaluate(t){return new Dt(this.sections.map((e=>{const r=e.content.evaluate(t);return qt(r)===wt?new Lt("",r,null,null,null):new Lt(jt(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor);}outputDefined(){return !1}}class hr{constructor(t){this.type=wt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,ft);return r?new hr(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=Rt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input);}outputDefined(){return !1}}class pr{constructor(t){this.type=pt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${At(r.type)} instead.`):new pr(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Zt(`Expected value to be of type string or array, but found ${At(qt(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}}const fr={"==":nr,"!=":ir,">":sr,"<":ar,">=":lr,"<=":or,array:Gt,at:Je,boolean:Gt,case:We,coalesce:Ke,collator:Qt,format:cr,image:hr,in:Xe,"index-of":Ye,interpolate:Ne,"interpolate-hcl":Ne,"interpolate-lab":Ne,length:pr,let:Ge,literal:Nt,match:He,number:Gt,"number-format":ur,object:Gt,slice:Qe,step:ke,string:Gt,"to-boolean":Xt,"to-color":Xt,"to-number":Xt,"to-string":Xt,var:be,within:me};function dr(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const a=i?i.evaluate(t):1,s=Ot(e,r,n,a);if(s)throw new Zt(s);return new Ft(e/255*a,r/255*a,n/255*a,a)}function yr(t,e){return t in e}function mr(t,e){const r=e[t];return void 0===r?null:r}function gr(t){return {type:t}}function xr(t){return {result:"success",value:t}}function vr(t){return {result:"error",value:t}}function br(t){return "data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function wr(t){return !!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function _r(t){return !!t.expression&&t.expression.interpolated}function Ar(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function kr(t){return "object"==typeof t&&null!==t&&!Array.isArray(t)}function Sr(t){return t}function Ir(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),a=t.type||(_r(e)?"exponential":"interval");if(r||"padding"===e.type){const n=r?Ft.parse:$t.parse;(t=st({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default);}if(t.colorSpace&&"rgb"!==t.colorSpace&&!je[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let s,o,l;if("exponential"===a)s=Cr;else if("interval"===a)s=Br;else if("categorical"===a){s=zr,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0];}else {if("identity"!==a)throw new Error(`Unknown function type "${a}"`);s=Pr;}if(n){const r={},n=[];for(let e=0;et[0])),evaluate:({zoom:r},n)=>Cr({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===a?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return {kind:"camera",interpolationType:r,interpolationFactor:Ne.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>s(t,e,r,o,l)}}return {kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Mr(t.default,e.default):s(t,e,i,o,l)}}}function Mr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function zr(t,e,r,n,i){return Mr(typeof r===i?n[r]:void 0,t.default,e.default)}function Br(t,e,r){if("number"!==Ar(r))return Mr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Ae(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Cr(t,e,r){const n=void 0!==t.base?t.base:1;if("number"!==Ar(r))return Mr(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const a=Ae(t.stops.map((t=>t[0])),r),s=function(t,e,r,n){const i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1];let u=Ie[e.type]||Sr;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=je[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),s));}return "function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,s)}}:u(o,l,s)}function Pr(t,e,r){switch(e.type){case"color":r=Ft.parse(r);break;case"formatted":r=Dt.fromString(r.toString());break;case"resolvedImage":r=Rt.fromString(r.toString());break;case"padding":r=$t.parse(r);break;default:Ar(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0);}return Mr(r,t.default,e.default)}Wt.register(fr,{error:[{kind:"error"},[ft],(t,[e])=>{throw new Zt(e.evaluate(t))}],typeof:[ft,[gt],(t,[e])=>At(qt(e.evaluate(t)))],"to-rgba":[_t(pt,4),[yt],(t,[e])=>e.evaluate(t).toArray()],rgb:[yt,[pt,pt,pt],dr],rgba:[yt,[pt,pt,pt,pt],dr],has:{type:dt,overloads:[[[ft],(t,[e])=>yr(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,r])=>yr(e.evaluate(t),r.evaluate(t))]]},get:{type:gt,overloads:[[[ft],(t,[e])=>mr(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,r])=>mr(e.evaluate(t),r.evaluate(t))]]},"feature-state":[gt,[ft],(t,[e])=>mr(e.evaluate(t),t.featureState||{})],properties:[mt,[],t=>t.properties()],"geometry-type":[ft,[],t=>t.geometryType()],id:[gt,[],t=>t.id()],zoom:[pt,[],t=>t.globals.zoom],"heatmap-density":[pt,[],t=>t.globals.heatmapDensity||0],"line-progress":[pt,[],t=>t.globals.lineProgress||0],accumulated:[gt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[pt,gr(pt),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[pt,gr(pt),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:pt,overloads:[[[pt,pt],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[pt],(t,[e])=>-e.evaluate(t)]]},"/":[pt,[pt,pt],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[pt,[pt,pt],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[pt,[pt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))],log2:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[pt,[pt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[pt,[pt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[pt,[pt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[pt,[pt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[pt,[pt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[pt,[pt],(t,[e])=>Math.atan(e.evaluate(t))],min:[pt,gr(pt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[pt,gr(pt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[pt,[pt],(t,[e])=>Math.abs(e.evaluate(t))],round:[pt,[pt],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[pt,[pt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[pt,[pt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[dt,[ft,gt],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[dt,[gt],(t,[e])=>t.id()===e.value],"filter-type-==":[dt,[ft],(t,[e])=>t.geometryType()===e.value],"filter-<":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n{const r=t.id(),n=e.value;return typeof r==typeof n&&r":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[dt,[ft,gt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[dt,[gt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[dt,[gt],(t,[e])=>e.value in t.properties()],"filter-has-id":[dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[dt,[_t(ft)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[dt,[_t(gt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[dt,[ft,_t(gt)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[dt,[ft,_t(gt)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[gr(dt),(t,e)=>{for(const r of e)if(!r.evaluate(t))return !1;return !0}]]},any:{type:dt,overloads:[[[dt,dt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[gr(dt),(t,e)=>{for(const r of e)if(r.evaluate(t))return !0;return !1}]]},"!":[dt,[dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[dt,[ft],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return !r||r(e.evaluate(t))}],upcase:[ft,[ft],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ft,[ft],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ft,gr(gt),(t,e)=>e.map((e=>jt(e.evaluate(t)))).join("")],"resolved-locale":[ft,[xt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Vr{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ht,this._defaultValue=e?function(t){return "color"===t.type&&kr(t.default)?new Ft(0,0,0,0):"color"===t.type?Ft.parse(t.default)||null:"padding"===t.type?$t.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null;}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Zt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Er(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in fr}function Fr(t,e){const r=new we(fr,[],e?function(t){const e={color:yt,string:ft,number:pt,enum:ft,boolean:dt,formatted:vt,padding:bt,resolvedImage:wt};return "array"===t.type?_t(e[t.value]||gt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?xr(new Vr(n,e)):vr(r.errors)}class Tr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!xe(e.expression);}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)}evaluate(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)}}class Lr{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!xe(e.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)}evaluate(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)}interpolationFactor(t,e,r){return this.interpolationType?Ne.interpolationFactor(this.interpolationType,t,e,r):0}}function Dr(t,e){const r=Fr(t,e);if("error"===r.result)return r;const n=r.value.expression,i=ge(n);if(!i&&!br(e))return vr([new ut("","data expressions not supported")]);const a=ve(n,["zoom"]);if(!a&&!wr(e))return vr([new ut("","zoom expressions not supported")]);const s=Rr(n);return s||a?s instanceof ut?vr([s]):s instanceof Ne&&!_r(e)?vr([new ut("",'"interpolate" expressions cannot be used with this property')]):xr(s?new Lr(i?"camera":"composite",r.value,s.labels,s instanceof Ne?s.interpolation:void 0):new Tr(i?"constant":"source",r.value)):vr([new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $r{constructor(t,e){this._parameters=t,this._specification=e,st(this,Ir(this._parameters,this._specification));}static deserialize(t){return new $r(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function Rr(t){let e=null;if(t instanceof Ge)e=Rr(t.result);else if(t instanceof Ke){for(const r of t.args)if(e=Rr(r),e)break}else (t instanceof ke||t instanceof Ne)&&t.input instanceof Wt&&"zoom"===t.input.name&&(e=t);return e instanceof ut||t.eachChild((t=>{const r=Rr(t);r instanceof ut?e=r:!e&&r?e=new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new ut("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));})),e}function Or(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},a=t.style,s=t.styleSpec;let o=[];const l=Ar(r);if("object"!==l)return [new it(e,r,`object expected, ${l} found`)];for(const t in r){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(i[l])c=i[l];else if(n[l])c=yn;else if(i["*"])c=i["*"];else {if(!n["*"]){o.push(new it(e,r[t],`unknown property "${t}"`));continue}c=yn;}o=o.concat(c({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:u,style:a,styleSpec:s,object:r,objectKey:t},r));}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&o.push(new it(e,r,`missing required property "${t}"`));return o}function Ur(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,a=t.key,s=t.arrayElementValidator||yn;if("array"!==Ar(e))return [new it(a,e,`array expected, ${Ar(e)} found`)];if(r.length&&e.length!==r.length)return [new it(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.lengthn.maximum?[new it(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function jr(t){const e=t.valueSpec,r=ot(t.value.type);let n,i,a,s={};const o="categorical"!==r&&void 0===t.value.property,l=!o,u="array"===Ar(t.value.stops)&&"array"===Ar(t.value.stops[0])&&"object"===Ar(t.value.stops[0][0]),c=Or({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return [new it(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Ur({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Ar(n)&&0===n.length&&e.push(new it(t.key,n,"array must have at least one stop")),e},default:function(t){return yn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return "identity"===r&&o&&c.push(new it(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||c.push(new it(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!_r(t.valueSpec)&&c.push(new it(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!br(t.valueSpec)?c.push(new it(t.key,t.value,"property functions not supported")):o&&!wr(t.valueSpec)&&c.push(new it(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||c.push(new it(t.key,t.value,'"property" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if("array"!==Ar(n))return [new it(o,n,`array expected, ${Ar(n)} found`)];if(2!==n.length)return [new it(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==Ar(n[0]))return [new it(o,n,`object expected, ${Ar(n[0])} found`)];if(void 0===n[0].zoom)return [new it(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return [new it(o,n,"object stop key must have value")];if(a&&a>ot(n[0].zoom))return [new it(o,n[0].zoom,"stop zoom values must appear in ascending order")];ot(n[0].zoom)!==a&&(a=ot(n[0].zoom),i=void 0,s={}),r=r.concat(Or({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:qr,value:p}}));}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Er(lt(n[1]))?r.concat([new it(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(yn({key:`${o}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,a){const o=Ar(t.value),l=ot(t.value),u=null!==t.value?t.value:a;if(n){if(o!==n)return [new it(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return [new it(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==r){let n=`number expected, ${o} found`;return br(e)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new it(t.key,u,n)]}return "categorical"!==r||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===o&&void 0!==i&&lnew it(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return [new it(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!xe(r))return [new it(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!xe(r))return [new it(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ve(r,["zoom","feature-state"]))return [new it(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ge(r))return [new it(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return []}function Zr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(ot(r))&&i.push(new it(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(ot(r))&&i.push(new it(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Kr(t){if(!0===t||!1===t)return !0;if(!Array.isArray(t)||0===t.length)return !1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return !1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Kr(e)&&"boolean"!=typeof e)return !1;return !0;default:return !0}}const Gr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Jr(t){if(null==t)return {filter:()=>!0,needGeometry:!1};Kr(t)||(t=Hr(t));const e=Fr(t,Gr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return {filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:Yr(t)}}function Xr(t,e){return te?1:0}function Yr(t){if(!Array.isArray(t))return !1;if("within"===t[0])return !0;for(let e=1;e"===e||"<="===e||">="===e?Wr(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Hr))):"all"===e?["all"].concat(t.slice(1).map(Hr)):"none"===e?["all"].concat(t.slice(1).map(Hr).map(en)):"in"===e?Qr(t[1],t.slice(2)):"!in"===e?en(Qr(t[1],t.slice(2))):"has"===e?tn(t[1]):"!has"===e?en(tn(t[1])):"within"!==e||t;var r;}function Wr(t,e,r){switch(t){case"$type":return [`filter-type-${r}`,e];case"$id":return [`filter-id-${r}`,e];default:return [`filter-${r}`,t,e]}}function Qr(t,e){if(0===e.length)return !1;switch(t){case"$type":return ["filter-type-in",["literal",e]];case"$id":return ["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Xr)]]:["filter-in-small",t,["literal",e]]}}function tn(t){switch(t){case"$type":return !0;case"$id":return ["filter-has-id"];default:return ["filter-has",t]}}function en(t){return ["!",t]}function rn(t){return Kr(lt(t.value))?Nr(st({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):nn(t)}function nn(t){const e=t.value,r=t.key;if("array"!==Ar(e))return [new it(r,e,`array expected, ${Ar(e)} found`)];const n=t.styleSpec;let i,a=[];if(e.length<1)return [new it(r,e,"filter array must have at least 1 element")];switch(a=a.concat(Zr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ot(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===ot(e[1])&&a.push(new it(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&a.push(new it(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Ar(e[1]),"string"!==i&&a.push(new it(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let s=2;s{t in r&&e.push(new it(n,r[t],`"${t}" is prohibited for ref layers`));})),i.layers.forEach((e=>{ot(e.id)===o&&(t=e);})),t?t.ref?e.push(new it(n,r.ref,"ref cannot reference another ref layer")):s=ot(t.type):e.push(new it(n,r.ref,`ref layer "${o}" not found`));}else if("background"!==s)if(r.source){const t=i.sources&&i.sources[r.source],a=t&&ot(t.type);t?"vector"===a&&"raster"===s?e.push(new it(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===a&&"raster"!==s?e.push(new it(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==a||r["source-layer"]?"raster-dem"===a&&"hillshade"!==s?e.push(new it(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===a&&t.lineMetrics||e.push(new it(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new it(n,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new it(n,r.source,`source "${r.source}" not found`));}else e.push(new it(n,r,'missing required property "source"'));return e=e.concat(Or({key:n,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>yn({key:`${n}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:rn,layout:t=>Or({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>on(st({layerType:s},t))}}),paint:t=>Or({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>sn(st({layerType:s},t))}})}})),e}function un(t){const e=t.value,r=t.key,n=Ar(e);return "string"!==n?[new it(r,e,`string expected, ${n} found`)]:[]}const cn={promoteId:function({key:t,value:e}){if("string"===Ar(e))return un({key:t,value:e});{const r=[];for(const n in e)r.push(...un({key:`${t}.${n}`,value:e[n]}));return r}}};function hn(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return [new it(r,e,'"type" is required')];const a=ot(e.type);let s;switch(a){case"vector":case"raster":case"raster-dem":return s=Or({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:cn}),s;case"geojson":if(s=Or({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:cn}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],a="string"==typeof n?[n,["accumulated"],["get",t]]:n;s.push(...Nr({key:`${r}.${t}.map`,value:i,expressionContext:"cluster-map"})),s.push(...Nr({key:`${r}.${t}.reduce`,value:a,expressionContext:"cluster-reduce"}));}return s;case"video":return Or({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return Or({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return [new it(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Zr({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function pn(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let a=[];const s=Ar(e);if(void 0===e)return a;if("object"!==s)return a=a.concat([new it("light",e,`object expected, ${s} found`)]),a;for(const t in e){const s=t.match(/^(.*)-transition$/);a=a.concat(s&&n[s[1]]&&n[s[1]].transition?yn({key:t,value:e[t],valueSpec:r.transition,style:i,styleSpec:r}):n[t]?yn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new it(t,e[t],`unknown property "${t}"`)]);}return a}function fn(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let a=[];const s=Ar(e);if(void 0===e)return a;if("object"!==s)return a=a.concat([new it("terrain",e,`object expected, ${s} found`)]),a;for(const t in e)a=a.concat(n[t]?yn({key:t,value:e[t],valueSpec:n[t],style:i,styleSpec:r}):[new it(t,e[t],`unknown property "${t}"`)]);return a}const dn={"*":()=>[],array:Ur,boolean:function(t){const e=t.value,r=t.key,n=Ar(e);return "boolean"!==n?[new it(r,e,`boolean expected, ${n} found`)]:[]},number:qr,color:function(t){const e=t.key,r=t.value,n=Ar(r);return "string"!==n?[new it(e,r,`color expected, ${n} found`)]:null===zt(r)?[new it(e,r,`color expected, "${r}" found`)]:[]},constants:at,enum:Zr,filter:rn,function:jr,layer:ln,object:Or,source:hn,light:pn,terrain:fn,string:un,formatted:function(t){return 0===un(t).length?[]:Nr(t)},resolvedImage:function(t){return 0===un(t).length?[]:Nr(t)},padding:function(t){const e=t.key,r=t.value;if("array"===Ar(r)){if(r.length<1||r.length>4)return [new it(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const t={type:"number"};let n=[];for(let i=0;i[]}})),t.constants&&(r=r.concat(at({key:"constants",value:t.constants,style:t,styleSpec:e}))),xn(r)}function xn(t){return [].concat(t).sort(((t,e)=>t.line-e.line))}function vn(t){return function(...e){return xn(t.apply(this,e))}}gn.source=vn(hn),gn.light=vn(pn),gn.terrain=vn(fn),gn.layer=vn(ln),gn.filter=vn(rn),gn.paintProperty=vn(sn),gn.layoutProperty=vn(on);const bn=gn,wn=bn.light,_n=bn.paintProperty,An=bn.layoutProperty;function kn(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new et(new Error(n.message))),r=!0;return r}class Sn{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t=u[l+0]&&n>=u[l+1])?(s[h]=!0,a.push(i[h])):s[h]=!1;}}}}_forEachCell(t,e,r,n,i,a,s,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,a,s,o))return}}_convertFromCellCoord(t){return (t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t=0)continue;const a=t[r];i[r]=In[n].shallow.indexOf(r)>=0?a:Bn(a,e);}t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function Cn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||zn(t)||A(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Cn);if("object"==typeof t){const e=t.$name||"Object";if(!In[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=In[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const i=t[r];n[r]=In[e].shallow.indexOf(r)>=0?i:Cn(i);}return n}throw new Error("can't deserialize object of type "+typeof t)}class Pn{constructor(){this.first=!0;}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function En(t){for(const e of t)if(Ln(e.charCodeAt(0)))return !0;return !1}function Fn(t){for(const e of t)if(!Tn(e.charCodeAt(0)))return !1;return !0}function Tn(t){return !(Vn.Arabic(t)||Vn["Arabic Supplement"](t)||Vn["Arabic Extended-A"](t)||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t))}function Ln(t){return !(746!==t&&747!==t&&(t<4352||!(Vn["Bopomofo Extended"](t)||Vn.Bopomofo(t)||Vn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Vn["CJK Compatibility Ideographs"](t)||Vn["CJK Compatibility"](t)||Vn["CJK Radicals Supplement"](t)||Vn["CJK Strokes"](t)||!(!Vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn["CJK Unified Ideographs Extension A"](t)||Vn["CJK Unified Ideographs"](t)||Vn["Enclosed CJK Letters and Months"](t)||Vn["Hangul Compatibility Jamo"](t)||Vn["Hangul Jamo Extended-A"](t)||Vn["Hangul Jamo Extended-B"](t)||Vn["Hangul Jamo"](t)||Vn["Hangul Syllables"](t)||Vn.Hiragana(t)||Vn["Ideographic Description Characters"](t)||Vn.Kanbun(t)||Vn["Kangxi Radicals"](t)||Vn["Katakana Phonetic Extensions"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn["Unified Canadian Aboriginal Syllabics"](t)||Vn["Unified Canadian Aboriginal Syllabics Extended"](t)||Vn["Vertical Forms"](t)||Vn["Yijing Hexagram Symbols"](t)||Vn["Yi Syllables"](t)||Vn["Yi Radicals"](t))))}function Dn(t){return !(Ln(t)||function(t){return !!(Vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn["Letterlike Symbols"](t)||Vn["Number Forms"](t)||Vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn["Control Pictures"](t)&&9251!==t||Vn["Optical Character Recognition"](t)||Vn["Enclosed Alphanumerics"](t)||Vn["Geometric Shapes"](t)||Vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn["CJK Symbols and Punctuation"](t)||Vn.Katakana(t)||Vn["Private Use Area"](t)||Vn["CJK Compatibility Forms"](t)||Vn["Small Form Variants"](t)||Vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function $n(t){return t>=1424&&t<=2303||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t)}function Rn(t,e){return !(!e&&$n(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function On(t){for(const e of t)if($n(e.charCodeAt(0)))return !0;return !1}const Un="deferred",qn="loading",jn="loaded";let Nn=null,Zn="unavailable",Kn=null;const Gn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Zn="error"),Nn&&Nn(t);};function Jn(){Xn.fire(new tt("pluginStateChange",{pluginStatus:Zn,pluginURL:Kn}));}const Xn=new rt,Yn=function(){return Zn},Hn=function(){if(Zn!==Un||!Kn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Zn=qn,Jn(),Kn&&K({url:Kn},(t=>{t?Gn(t):(Zn=jn,Jn());}));},Wn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Zn===jn||null!=Wn.applyArabicShaping,isLoading:()=>Zn===qn,setState(t){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Zn=t.pluginStatus,Kn=t.pluginURL;},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Wn.applyArabicShaping&&null!=Wn.processBidirectionalText&&null!=Wn.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Kn}};class Qn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Pn,this.transition={});}isSupportedScript(t){return function(t,e){for(const r of t)if(!Rn(r.charCodeAt(0),e))return !1;return !0}(t,Wn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class ti{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(kr(t))return new $r(t,e);if(Er(t)){const r=Dr(t,e);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let r=t;return "color"===e.type&&"string"==typeof t?r=Ft.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(r=$t.parse(t)),{kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification);}isDataDriven(){return "source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class ei{constructor(t){this.property=t,this.value=new ti(t,void 0);}transitioned(t,e){return new ni(this.property,this.value,e,o({},t.transition,this.transition),t.now)}untransitioned(){return new ni(this.property,this.value,null,{},0)}}class ri{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);}getValue(t){return p(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ei(this._values[t].property)),this._values[t].value=new ti(this._values[t].property,null===e?void 0:p(e));}getTransition(t){return p(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ei(this._values[t].property)),this._values[t].transition=p(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n);}return t}transitioned(t,e){const r=new ii(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new ii(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class ni{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(a){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(s))}}return i}}class ii{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,r){const n=new oi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class ai{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues);}getValue(t){return p(this._values[t].value)}setValue(t,e){this._values[t]=new ti(this._values[t].property,null===e?void 0:p(e));}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);}return t}possiblyEvaluate(t,e,r){const n=new oi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class si{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r;}isConstant(){return "constant"===this.value.kind}constantOr(t){return "constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class oi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class li{constructor(t){this.specification=t;}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){const n=Ie[this.specification.type];return n?n(t,e,r):t}}class ui{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,r,n){return new si(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new si(this,{kind:"constant",value:void 0},t.parameters);const n=Ie[this.specification.type];return n?new si(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,a){return "constant"===t.kind?t.value:t.evaluate(e,r,n,i,a)}}class ci extends ui{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new si(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),a="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,s=this._calculate(a,a,a,e);return new si(this,{kind:"constant",value:s},e)}if("camera"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new si(this,{kind:"constant",value:r},e)}return new si(this,t.expression,e)}evaluate(t,e,r,n,i,a){if("source"===t.kind){const s=t.evaluate(e,r,n,i,a);return this._calculate(s,s,s,e)}return "composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class hi{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Qn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class pi{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)}interpolate(){return !1}}class fi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new ti(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new ei(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}}}Mn("DataDrivenProperty",ui),Mn("DataConstantProperty",li),Mn("CrossFadedDataDrivenProperty",ci),Mn("CrossFadedProperty",hi),Mn("ColorRampProperty",pi);const di="-transition";class yi extends rt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new ai(e.layout)),e.paint)){this._transitionablePaint=new ri(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oi(e.paint);}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return "visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(An,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);}getPaintProperty(t){return t.endsWith(di)?this._transitionablePaint.getTransition(t.slice(0,-di.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(_n,`layers.${this.id}.paint.${t}`,t,e,r))return !1;if(t.endsWith(di))return this._transitionablePaint.setTransition(t.slice(0,-di.length),e||void 0),!1;{const r=this._transitionablePaint._values[t],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,a,s)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return !1}isHidden(t){return !!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),h(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return (!i||!1!==i.validate)&&kn(this,t.call(bn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:nt,style:{glyphs:!0,sprite:!0}}))}is3D(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof si&&br(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}}const mi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gi{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class xi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0);}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(t){this.reserve(t),this.length=t;}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function vi(t,e=1){let r=0,n=0;return {members:t.map((t=>{const i=mi[t.type].BYTES_PER_ELEMENT,a=r=bi(r,Math.max(e,i)),s=t.components||1;return n=Math.max(n,i),r+=i*s,{name:t.name,type:t.type,components:s,offset:a}})),size:bi(r,Math.max(n,e)),alignment:e}}function bi(t,e){return Math.ceil(t/e)*e}class wi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}wi.prototype.bytesPerElement=4,Mn("StructArrayLayout2i4",wi);class _i extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t}}_i.prototype.bytesPerElement=8,Mn("StructArrayLayout4i8",_i);class Ai extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,t}}Ai.prototype.bytesPerElement=12,Mn("StructArrayLayout2i4i12",Ai);class ki extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=s,t}}ki.prototype.bytesPerElement=8,Mn("StructArrayLayout2i4ub8",ki);class Si extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Si.prototype.bytesPerElement=8,Mn("StructArrayLayout2f8",Si);class Ii extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,a,s,o,l,u)}emplace(t,e,r,n,i,a,s,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}Ii.prototype.bytesPerElement=20,Mn("StructArrayLayout10ui20",Ii);class Mi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,a,s,o,l,u,c,h)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}Mi.prototype.bytesPerElement=24,Mn("StructArrayLayout4i4ui4i24",Mi);class zi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}zi.prototype.bytesPerElement=12,Mn("StructArrayLayout3f12",zi);class Bi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Bi.prototype.bytesPerElement=4,Mn("StructArrayLayout1ul4",Bi);class Ci extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,a,s,o,l)}emplace(t,e,r,n,i,a,s,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=a,this.int16[c+5]=s,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}Ci.prototype.bytesPerElement=20,Mn("StructArrayLayout6i1ul2ui20",Ci);class Pi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,t}}Pi.prototype.bytesPerElement=12,Mn("StructArrayLayout2i2i2i12",Pi);class Vi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)}emplace(t,e,r,n,i,a){const s=4*t,o=8*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.int16[o+6]=i,this.int16[o+7]=a,t}}Vi.prototype.bytesPerElement=16,Mn("StructArrayLayout2f1f2i16",Vi);class Ei extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=12*t,s=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[s+1]=n,this.float32[s+2]=i,t}}Ei.prototype.bytesPerElement=12,Mn("StructArrayLayout2ub2f12",Ei);class Fi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Fi.prototype.bytesPerElement=6,Mn("StructArrayLayout3ui6",Fi);class Ti extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}Ti.prototype.bytesPerElement=48,Mn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ti);class Li extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,M){const z=this.length;return this.resize(z+1),this.emplace(z,t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,M)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,M,z){const B=34*t,C=17*t;return this.int16[B+0]=e,this.int16[B+1]=r,this.int16[B+2]=n,this.int16[B+3]=i,this.int16[B+4]=a,this.int16[B+5]=s,this.int16[B+6]=o,this.int16[B+7]=l,this.uint16[B+8]=u,this.uint16[B+9]=c,this.uint16[B+10]=h,this.uint16[B+11]=p,this.uint16[B+12]=f,this.uint16[B+13]=d,this.uint16[B+14]=y,this.uint16[B+15]=m,this.uint16[B+16]=g,this.uint16[B+17]=x,this.uint16[B+18]=v,this.uint16[B+19]=b,this.uint16[B+20]=w,this.uint16[B+21]=_,this.uint16[B+22]=A,this.uint32[C+12]=k,this.float32[C+13]=S,this.float32[C+14]=I,this.float32[C+15]=M,this.float32[C+16]=z,t}}Li.prototype.bytesPerElement=68,Mn("StructArrayLayout8i15ui1ul4f68",Li);class Di extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Di.prototype.bytesPerElement=4,Mn("StructArrayLayout1f4",Di);class $i extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}$i.prototype.bytesPerElement=6,Mn("StructArrayLayout3i6",$i);class Ri extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Ri.prototype.bytesPerElement=8,Mn("StructArrayLayout1ul2ui8",Ri);class Oi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Oi.prototype.bytesPerElement=4,Mn("StructArrayLayout2ui4",Oi);class Ui extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ui.prototype.bytesPerElement=2,Mn("StructArrayLayout1ui2",Ui);class qi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t}}qi.prototype.bytesPerElement=16,Mn("StructArrayLayout4f16",qi);class ji extends gi{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new S(this.anchorPointX,this.anchorPointY)}}ji.prototype.size=20;class Ni extends Ci{get(t){return new ji(this,t)}}Mn("CollisionBoxArray",Ni);class Zi extends gi{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t;}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Zi.prototype.size=48;class Ki extends Ti{get(t){return new Zi(this,t)}}Mn("PlacedSymbolArray",Ki);class Gi extends gi{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t;}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Gi.prototype.size=68;class Ji extends Li{get(t){return new Gi(this,t)}}Mn("SymbolInstanceArray",Ji);class Xi extends Di{getoffsetX(t){return this.float32[1*t+0]}}Mn("GlyphOffsetArray",Xi);class Yi extends $i{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Mn("SymbolLineVertexArray",Yi);class Hi extends gi{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Hi.prototype.size=8;class Wi extends Ri{get(t){return new Hi(this,t)}}Mn("FeatureIndexArray",Wi);class Qi extends wi{}class ta extends wi{}class ea extends wi{}class ra extends Ai{}class na extends ki{}class ia extends Si{}class aa extends Ii{}class sa extends Mi{}class oa extends zi{}class la extends Bi{}class ua extends Pi{}class ca extends Ei{}class ha extends Fi{}class pa extends Oi{}const fa=vi([{name:"a_pos",components:2,type:"Int16"}],4),{members:da}=fa;class ya{constructor(t=[]){this.segments=t;}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>ya.MAX_VERTEX_ARRAY_LENGTH&&d(`Max vertices per segment is ${ya.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>ya.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy();}static simpleSegment(t,e,r,n){return new ya([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function ma(t,e){return 256*(t=a(Math.floor(t),0,255))+a(Math.floor(e),0,255)}ya.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Mn("SegmentVector",ya);const ga=vi([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var xa={exports:{}},va={exports:{}};va.exports=function(t,e){var r,n,i,a,s,o,l,u;for(n=t.length-(r=3&t.length),i=e,s=3432918353,o=461845907,u=0;u>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var ba={exports:{}};ba.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var wa=va.exports,_a=ba.exports;xa.exports=wa,xa.exports.murmur3=wa,xa.exports.murmur2=_a;class Aa{constructor(){this.ids=[],this.positions=[],this.indexed=!1;}add(t,e,r,n){this.ids.push(ka(t)),this.positions.push(e,r,n);}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=ka(t);let r=0,n=this.ids.length-1;for(;r>1;this.ids[t]>=e?n=t:r=t+1;}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Sa(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Aa;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ka(t){const e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:xa.exports(String(t))}function Sa(t,e,r,n){for(;r>1];let a=r-1,s=n+1;for(;;){do{a++;}while(t[a]i);if(a>=s)break;Ia(t,a,s),Ia(e,3*a,3*s),Ia(e,3*a+1,3*s+1),Ia(e,3*a+2,3*s+2);}s-r`u_${t}`)),this.type=r;}setUniform(t,e,r){t.set(r.constantOr(this.value));}getBinding(t,e,r){return "color"===this.type?new Ca(t,e):new za(t,e)}}class Fa{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1;}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr;}setUniform(t,e,r,n){const i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i);}getBinding(t,e,r){return "u_pattern"===r.substr(0,9)?new Ba(t,e):new za(t,e)}}class Ta{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(t,e,r,n,i){const a=this.paintVertexArray.length,s=this.expression.evaluate(new Qn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i);}_setPaintValue(t,e,r){if("color"===this.type){const n=Va(r);for(let r=t;r`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new a;}populatePaintArray(t,e,r,n,i){const a=this.expression.evaluate(new Qn(this.zoom),e,{},n,[],i),s=this.expression.evaluate(new Qn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,a,s);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),a=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,a);}_setPaintValue(t,e,r,n){if("color"===this.type){const i=Va(r),a=Va(n);for(let r=t;r`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ta||r instanceof La)for(let e=0;e!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new $a(n,e,r);this.needsUpload=!1,this._featureMap=new Aa,this._bufferOffset=0;}populatePaintArrays(t,e,r,n,i,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,a);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}function Oa(t,e){return {"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Ua(t,e,r){const n={color:{source:Si,composite:qi},number:{source:Di,composite:Si}},i=function(t){return {"line-pattern":{source:aa,composite:aa},"fill-pattern":{source:aa,composite:aa},"fill-extrusion-pattern":{source:aa,composite:aa}}[t]}(t);return i&&i[r]||n[e][r]}Mn("ConstantBinder",Ea),Mn("CrossFadedConstantBinder",Fa),Mn("SourceExpressionBinder",Ta),Mn("CrossFadedCompositeBinder",Da),Mn("CompositeExpressionBinder",La),Mn("ProgramConfiguration",$a,{omit:["_buffers"]}),Mn("ProgramConfigurationSet",Ra);var qa=8192;const ja=Math.pow(2,14)-1,Na=-ja-1;function Za(t){const e=qa/t.extent,r=t.loadGeometry();for(let t=0;tr.x+1||sr.y+1)&&d("Geometry exceeds allowed extent, reduce your vector tile buffer size");}}return r}function Ka(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Za(t):[]}}function Ga(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}class Ja{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ta,this.indexArray=new ha,this.segments=new ya,this.programConfigurations=new Ra(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){const n=this.layers[0],i=[];let a=null,s=!1;"circle"===n.type&&(a=n.layout.get("circle-sort-key"),s=!a.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ka(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),u,r))continue;const c=s?a.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Za(e),patterns:{},sortKey:c};i.push(h);}s&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:a,sourceLayerIndex:s}=n,o=t[a].feature;this.addFeature(n,i,a,r),e.featureIndex.insert(o,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,da),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=qa||n<0||n>=qa)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),a=i.vertexLength;Ga(this.layoutVertexArray,r,n,-1,-1),Ga(this.layoutVertexArray,r,n,1,-1),Ga(this.layoutVertexArray,r,n,1,1),Ga(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),i.vertexLength+=4,i.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);}}function Xa(t,e){for(let r=0;r1){if(Qa(t,e))return !0;for(let n=0;n1?r:r.sub(e)._mult(i)._add(e))}function ns(t,e){let r,n,i,a=!1;for(let s=0;se.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);}return a}function is(t,e){let r=!1;for(let n=0,i=t.length-1;ne.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r);}return r}function as(t,e,r){const n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return !1;const a=y(t,e,r[0]);return a!==y(t,e,r[1])||a!==y(t,e,r[2])||a!==y(t,e,r[3])}function ss(t,e,r){const n=e.paint.get(t).value;return "constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function os(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ls(t,e,r,n,i){if(!e[0]&&!e[1])return t;const a=S.convert(e)._mult(i);"viewport"===r&&a._rotate(-n);const s=[];for(let e=0;et.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const s=t.data,o=e.data;if(s===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=a;const s=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*s.r/s.a),i.data[r+n+1]=Math.floor(255*s.g/s.a),i.data[r+n+2]=Math.floor(255*s.b/s.a),i.data[r+n+3]=Math.floor(255*s.a);};if(t.clips)for(let e=0,i=0;e80*r){n=a=t[0],i=s=t[1];for(var d=r;da&&(a=o),l>s&&(s=l);u=0!==(u=Math.max(a-n,s-i))?32767/u:0;}return $s(p,f,r,n,i,u,0),f}function Ls(t,e,r,n,i){var a,s;if(i===so(t,e,r,n)>0)for(a=e;a=e;a-=n)s=no(a,t[a],t[a+1],s);return s&&Hs(s,s.next)&&(io(s),s=s.next),s}function Ds(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Hs(n,n.next)&&0!==Ys(n.prev,n,n.next))n=n.next;else {if(io(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function $s(t,e,r,n,i,a,s){if(t){!s&&a&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=Ks(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,s,o,l,u=1;do{for(r=t,t=null,a=null,s=0;r;){for(s++,n=r,o=0,e=0;e0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n;}a.nextZ=null,u*=2;}while(s>1)}(i);}(t,n,i,a);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,a?Os(t,n,i,a):Rs(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),io(t),t=l.next,u=l.next;else if((t=l)===u){s?1===s?$s(t=Us(Ds(t),e,r),e,r,n,i,a,2):2===s&&qs(t,e,r,n,i,a):$s(Ds(t),e,r,n,i,a,1);break}}}function Rs(t){var e=t.prev,r=t,n=t.next;if(Ys(e,r,n)>=0)return !1;for(var i=e.x,a=r.x,s=n.x,o=e.y,l=r.y,u=n.y,c=ia?i>s?i:s:a>s?a:s,f=o>l?o>u?o:u:l>u?l:u,d=n.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&Js(i,o,a,l,s,u,d.x,d.y)&&Ys(d.prev,d,d.next)>=0)return !1;d=d.next;}return !0}function Os(t,e,r,n){var i=t.prev,a=t,s=t.next;if(Ys(i,a,s)>=0)return !1;for(var o=i.x,l=a.x,u=s.x,c=i.y,h=a.y,p=s.y,f=ol?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=Ks(f,d,e,r,n),x=Ks(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&Js(o,c,l,h,u,p,v.x,v.y)&&Ys(v.prev,v,v.next)>=0)return !1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==s&&Js(o,c,l,h,u,p,b.x,b.y)&&Ys(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&Js(o,c,l,h,u,p,v.x,v.y)&&Ys(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==s&&Js(o,c,l,h,u,p,b.x,b.y)&&Ys(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function Us(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!Hs(i,a)&&Ws(i,n,n.next,a)&&eo(i,a)&&eo(a,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(a.i/r|0),io(n),io(n.next),n=t=a),n=n.next;}while(n!==t);return Ds(n)}function qs(t,e,r,n,i,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&Xs(s,o)){var l=ro(s,o);return s=Ds(s,s.next),l=Ds(l,l.next),$s(s,e,r,n,i,a,0),void $s(l,e,r,n,i,a,0)}o=o.next;}s=s.next;}while(s!==t)}function js(t,e){return t.x-e.x}function Ns(t,e){var r=function(t,e){var r,n=e,i=t.x,a=t.y,s=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var o=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>s&&(s=o,r=n.x=n.x&&n.x>=c&&i!==n.x&&Js(ar.x||n.x===r.x&&Zs(r,n)))&&(r=n,p=l)),n=n.next;}while(n!==u);return r}(t,e);if(!r)return e;var n=ro(r,t);return Ds(n,n.next),Ds(r,r.next)}function Zs(t,e){return Ys(t.prev,t,e.prev)<0&&Ys(e.next,t,t.next)<0}function Ks(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Gs(t){var e=t,r=t;do{(e.x=(t-s)*(a-o)&&(t-s)*(n-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(i-s)*(n-o)}function Xs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ws(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(eo(t,e)&&eo(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(Ys(t.prev,t,e.prev)||Ys(t,e.prev,e))||Hs(t,e)&&Ys(t.prev,t,t.next)>0&&Ys(e.prev,e,e.next)>0)}function Ys(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Hs(t,e){return t.x===e.x&&t.y===e.y}function Ws(t,e,r,n){var i=to(Ys(t,e,r)),a=to(Ys(t,e,n)),s=to(Ys(r,n,t)),o=to(Ys(r,n,e));return i!==a&&s!==o||!(0!==i||!Qs(t,r,e))||!(0!==a||!Qs(t,n,e))||!(0!==s||!Qs(r,t,n))||!(0!==o||!Qs(r,e,n))}function Qs(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function to(t){return t>0?1:t<0?-1:0}function eo(t,e){return Ys(t.prev,t,t.next)<0?Ys(t,e,t.next)>=0&&Ys(t,t.prev,e)>=0:Ys(t,e,t.prev)<0||Ys(t,t.next,e)<0}function ro(t,e){var r=new ao(t.i,t.x,t.y),n=new ao(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function no(t,e,r,n){var i=new ao(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function io(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function ao(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function so(t,e,r,n){for(var i=0,a=e,s=r-n;ar;){if(n-r>600){var a=n-r+1,s=e-r+1,o=Math.log(a),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(a-l)/a)*(s-a/2<0?-1:1);lo(t,e,Math.max(r,Math.floor(e-s*l/a+u)),Math.min(n,Math.floor(e+(a-s)*l/a+u)),i);}var c=t[e],h=r,p=n;for(uo(t,r,e),i(t[n],c)>0&&uo(t,r,n);h0;)p--;}0===i(t[r],c)?uo(t,r,p):uo(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1);}}function uo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function co(t,e){return te?1:0}function ho(t,e){const r=t.length;if(r<=1)return [t];const n=[];let i,a;for(let e=0;e1)for(let t=0;t0&&r.holes.push(n+=t[i-1].length);}return r};class mo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ea,this.indexArray=new ha,this.indexArray2=new pa,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.segments2=new ya,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=fo("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),a=[];for(const{feature:s,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ka(s,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Za(s),patterns:{},sortKey:h};a.push(p);}i&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of a){const{geometry:i,index:a,sourceLayerIndex:s}=n;if(this.hasPattern){const t=yo("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,a,r,{});e.featureIndex.insert(t[a].feature,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Es),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy());}addFeature(t,e,r,n,i){for(const t of ho(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],a=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&a.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t>3;}if(i--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new Ao(a,s));else {if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone());}}return e&&o.push(e),o},So.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())o&&(o=i),(a+=t.readSVarint())u&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return [s,l,o,u]},So.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),s=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=So.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}Co.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new zo(this._pbf,e,this.extent,this._keys,this._values)};var Vo=Bo;function Eo(t,e,r){if(3===t){var n=new Vo(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}_o.VectorTile=function(t,e){this.layers=t.readFields(Eo,{},e);},_o.VectorTileFeature=ko,_o.VectorTileLayer=Bo;const Fo=_o.VectorTileFeature.types,To=Math.pow(2,13);function Lo(t,e,r,n,i,a,s,o){t.emplaceBack(e,r,2*Math.floor(n*To)+s,i*To*2,a*To*2,Math.round(o));}class Do{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ra,this.centroidVertexArray=new Qi,this.indexArray=new ha,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.features=[],this.hasPattern=fo("fill-extrusion",this.layers,e);for(const{feature:n,id:i,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,o=Ka(n,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:s,index:a,geometry:t?o.geometry:Za(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(yo("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,a,r,{}),e.featureIndex.insert(n,l.geometry,a,s,this.index,!0);}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wo),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,bo.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy());}addFeature(t,e,r,n,i){const a={x:0,y:0,vertexCount:0};for(const r of ho(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(Ro(t))continue;let e=0;for(let r=0;r=1){const s=t[r-1];if(!$o(i,s)){n.vertexLength+4>ya.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),r=s.dist(i);e+r>32768&&(e=0),Lo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),Lo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),a.x+=2*i.x,a.y+=2*i.y,a.vertexCount+=2,e+=r,Lo(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),Lo(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e),a.x+=2*s.x,a.y+=2*s.y,a.vertexCount+=2;const o=n.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),n.vertexLength+=4,n.primitiveLength+=2;}}}}if(n.vertexLength+e>ya.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Fo[t.type])continue;const i=[],s=[],o=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&s.push(i.length/2);for(let e=0;eqa)||t.y===e.y&&(t.y<0||t.y>qa)}function Ro(t){return t.every((t=>t.x<0))||t.every((t=>t.x>qa))||t.every((t=>t.y<0))||t.every((t=>t.y>qa))}Mn("FillExtrusionBucket",Do,{omit:["layers","features"]});var Oo={paint:new fi({"fill-extrusion-opacity":new li(nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ui(nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new li(nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new li(nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ci(nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ui(nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ui(nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new li(nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Uo(t,e){return t.x*e.x+t.y*e.y}function qo(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;rt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new na,this.layoutVertexArray2=new ia,this.indexArray=new ha,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=fo("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),a=[];for(const{feature:e,id:s,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ka(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Za(e),patterns:{},sortKey:c};a.push(h);}i&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of a){const{geometry:i,index:a,sourceLayerIndex:s}=n;if(this.hasPattern){const t=yo("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,a,r,{});e.featureIndex.insert(t[a].feature,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ko)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,No),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return {start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),o=a.get("line-cap"),l=a.get("line-miter-limit"),u=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,s,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}addLine(t,e,r,n,i,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e;}}const A=p&&f;let k=A?r:s?"butt":n;if(A&&"round"===k&&(vi&&(k="bevel"),"bevel"===k&&(v>2&&(k="flipbevel"),v100)m=y.mult(-1);else {const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1));}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c);}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let e=1;e2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e;}}}}addCurrentVertex(t,e,r,n,i,a=!1){const s=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,s,o,a,!0,-n,i),this.distance>Xo/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a));}addHalfVertex({x:t,y:e},r,n,i,a,s,o){const l=.5*(this.lineClips?this.scaledDistance*(Xo-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(a?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),a?this.e2=u:this.e1=u;}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance();}}Mn("LineBucket",Yo,{omit:["layers","patternFeatures"]});const Ho=new fi({"line-cap":new li(nt.layout_line["line-cap"]),"line-join":new ui(nt.layout_line["line-join"]),"line-miter-limit":new li(nt.layout_line["line-miter-limit"]),"line-round-limit":new li(nt.layout_line["line-round-limit"]),"line-sort-key":new ui(nt.layout_line["line-sort-key"])});var Wo={paint:new fi({"line-opacity":new ui(nt.paint_line["line-opacity"]),"line-color":new ui(nt.paint_line["line-color"]),"line-translate":new li(nt.paint_line["line-translate"]),"line-translate-anchor":new li(nt.paint_line["line-translate-anchor"]),"line-width":new ui(nt.paint_line["line-width"]),"line-gap-width":new ui(nt.paint_line["line-gap-width"]),"line-offset":new ui(nt.paint_line["line-offset"]),"line-blur":new ui(nt.paint_line["line-blur"]),"line-dasharray":new hi(nt.paint_line["line-dasharray"]),"line-pattern":new ci(nt.paint_line["line-pattern"]),"line-gradient":new pi(nt.paint_line["line-gradient"])}),layout:Ho};const Qo=new class extends ui{possiblyEvaluate(t,e){return e=new Qn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=o({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(Wo.paint.properties["line-width"].specification);function tl(t,e){return e>0?e+2*t:t}Qo.useIntegerZoom=!0;const el=vi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rl=vi([{name:"a_projected_pos",components:3,type:"Float32"}],4);vi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const nl=vi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);vi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const il=vi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),al=vi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function sl(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return "uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Wn.applyArabicShaping&&(t=Wn.applyArabicShaping(t)),t}(t.text,e,r);})),t}vi([{name:"triangle",components:3,type:"Uint16"}]),vi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),vi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),vi([{type:"Float32",name:"offsetX"}]),vi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const ol={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ll=24,ul=pl,cl=function(t,e,r,n,i){var a,s,o=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,a=f&(1<<-c)-1,f>>=-c,c+=o;c>0;a=256*a+t[e+h],h+=p,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===a)a=1-u;else {if(a===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),a-=u;}return (f?-1:1)*s*Math.pow(2,a-n)},hl=function(t,e,r,n,i,a){var s,o,l,u=8*a-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(o=0,s=c):s+h>=1?(o=(e*l-1)*Math.pow(2,i),s+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(s=s<0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y;};function pl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}pl.Varint=0,pl.Fixed64=1,pl.Bytes=2,pl.Fixed32=5;var fl,dl=4294967296,yl=1/dl,ml="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function gl(t){return t.type===pl.Bytes?t.readVarint()+t.pos:t.pos+1}function xl(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function vl(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function bl(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function Pl(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Vl(t,e,r){1===t&&r.readMessage(El,e);}function El(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:a,left:s,top:o,advance:l}=r.readMessage(Fl,{});e.push({id:t,bitmap:new zs({width:i+6,height:a+6},n),metrics:{width:i,height:a,left:s,top:o,advance:l}});}}function Fl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}function Tl(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,a=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,a=Math.max(a,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Bl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Pl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Bl(this.buf,this.pos)+Bl(this.buf,this.pos+4)*dl;return this.pos+=8,t},readSFixed64:function(){var t=Bl(this.buf,this.pos)+Pl(this.buf,this.pos+4)*dl;return this.pos+=8,t},readFloat:function(){var t=cl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=cl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return xl(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return xl(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return xl(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return xl(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return xl(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return xl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ml?function(t,e,r){return ml.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(s=t[i+2],128==(192&(a=t[i+1]))&&128==(192&s)&&((u=(15&l)<<12|(63&a)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=t[i+2],o=t[i+3],128==(192&(a=t[i+1]))&&128==(192&s)&&128==(192&o)&&((u=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==pl.Bytes)return t.push(this.readVarint(e));var r=gl(this);for(t=t||[];this.pos127;);else if(e===pl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===pl.Fixed32)this.pos+=4;else {if(e!==pl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&vl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),hl(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),hl(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&vl(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,pl.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,bl,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,wl,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,kl,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,_l,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Al,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Sl,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Il,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Ml,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,zl,e);},writeBytesField:function(t,e){this.writeTag(t,pl.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,pl.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,pl.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,pl.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,pl.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,pl.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,pl.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,pl.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,pl.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,pl.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};class Ll{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=a,this.version=r;}get tl(){return [this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return [this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return [(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Dl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:a,h:s}=Tl(i),o=new Bs({width:a||1,height:s||1});for(const e in t){const n=t[e],i=r[e].paddedRect;Bs.copy(n.data,o,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data);}for(const t in e){const r=e[t],i=n[t].paddedRect,a=i.x+1,s=i.y+1,l=r.data.width,u=r.data.height;Bs.copy(r.data,o,{x:0,y:0},{x:a,y:s},r.data),Bs.copy(r.data,o,{x:0,y:u-1},{x:a,y:s-1},{width:l,height:1}),Bs.copy(r.data,o,{x:0,y:0},{x:a,y:s+u},{width:l,height:1}),Bs.copy(r.data,o,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:u}),Bs.copy(r.data,o,{x:0,y:0},{x:a+l,y:s},{width:1,height:u});}this.image=o,this.iconPositions=r,this.patternPositions=n;}addImages(t,e,r){for(const n in t){const i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new Ll(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e);}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i});}}Mn("ImagePosition",Ll),Mn("ImageAtlas",Dl),t.WritingMode=void 0,(fl=t.WritingMode||(t.WritingMode={}))[fl.none=0]="none",fl[fl.horizontal=1]="horizontal",fl[fl.vertical=2]="vertical",fl[fl.horizontalOnly=3]="horizontalOnly";const $l=-17;class Rl{constructor(){this.scale=1,this.fontStack="",this.imageName=null;}static forText(t,e){const r=new Rl;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new Rl;return e.imageName=t,e}}class Ol{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;}static fromFeature(t,e){const r=new Ol;for(let n=0;n=0&&r>=t&&ql[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e);}substring(t,e){const r=new Ol;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Rl.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ul(e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m){const g=Ol.fromFeature(e,a);let x;p===t.WritingMode.vertical&&g.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:b}=Wn;if(v&&1===g.sections.length){x=[];const t=v(g.toString(),Xl(g,c,s,r,i,d,y));for(const e of t){const t=new Ol;t.text=e,t.sections=g.sections;for(let r=0;r0&&n>_&&(_=n);}else {const t=n[y.fontStack],e=t&&t[g];if(e&&e.rect)A=e.rect,b=e.metrics;else {const t=r[y.fontStack],e=t&&t[g];if(!e)continue;b=e.metrics;}x=(a-y.scale)*ll;}I?(e.verticalizable=!0,w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:I,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=S*y.scale+c):(w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:I,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=b.advance*y.scale+c);}0!==w.length&&(y=Math.max(f-c,y),Hl(w,0,w.length-1,g,_)),f=0;const A=s*a+_;b.lineOffset=Math.max(_,l),d+=A,m=Math.max(A,m),++x;}var v;const b=d-$l,{horizontalAlign:w,verticalAlign:_}=Yl(o);((function(t,e,r,n,i,a,s,o,l){const u=(e-r)*i;let c=0;c=a!==s?-o*n-$l:(-n*l+.5)*s;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c;}))(e.positionedLines,g,w,_,y,m,s,b,a.length),e.top+=-_*b,e.bottom=e.top+b,e.left+=-w*y,e.right=e.left+y;}(_,r,n,i,x,o,l,u,p,c,f,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(w)&&_}const ql={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},jl={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 Nl(t,e,r,n,i,a){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*ll/a+i:0}{const n=r[e.fontStack],a=n&&n[t];return a?a.metrics.advance*e.scale+i:0}}function Zl(t,e,r,n){const i=Math.pow(t-e,2);return n?t=0;let c=0;for(let r=0;r-r/2;){if(s--,s<0)return !1;o-=t[s].dist(a),a=t[s];}o+=t[s].dist(t[s+1]),s++;const l=[];let u=0;for(;on;)u-=l.shift().angleDelta;if(u>i)return !1;s++,o+=e.dist(r);}return !0}function iu(t){let e=0;for(let r=0;ru){const c=(u-l)/a,h=Se(n.x,i.x,c),p=Se(n.y,i.y,c),f=new ru(h,p,i.angleTo(n),r);return f._round(),!s||nu(t,f,o,s,e)?f:void 0}l+=a;}}function lu(t,e,r,n,i,a,s,o,l){const u=au(n,a,s),c=su(n,i),h=c*s,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&g=0&&x=0&&p+u<=c){const r=new ru(g,x,y,e);r._round(),n&&!nu(t,r,a,n,i)||f.push(r);}}h+=d;}return o||f.length||s||(f=uu(t,h/2,r,n,i,a,s,!0,l)),f}function cu(t,e,r,n,i){const a=[];for(let s=0;s=n&&u.x>=n||(s.x>=n?s=new S(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=n&&(u=new S(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=i&&u.y>=i||(s.y>=i?s=new S(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y>=i&&(u=new S(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),l&&s.equals(l[l.length-1])||(l=[s],a.push(l)),l.push(u)))));}}return a}function hu(t,e,r,n){const i=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=a.stretchX||[[0,o]],p=a.stretchY||[[0,l]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=o-d,g=l-y;let x=0,v=d,b=0,w=y,_=0,A=m,k=0,I=g;if(a.content&&n){const t=a.content;x=pu(h,0,t[0]),b=pu(p,0,t[1]),v=pu(h,t[0],t[2]),w=pu(p,t[1],t[3]),_=t[0]-x,k=t[1]-b,A=t[2]-t[0]-v,I=t[3]-t[1]-w;}const M=(n,i,o,l)=>{const h=du(n.stretch-x,v,u,t.left),p=yu(n.fixed-_,A,n.stretch,d),f=du(i.stretch-b,w,c,t.top),m=yu(i.fixed-k,I,i.stretch,y),g=du(o.stretch-x,v,u,t.left),M=yu(o.fixed-_,A,o.stretch,d),z=du(l.stretch-b,w,c,t.top),B=yu(l.fixed-k,I,l.stretch,y),C=new S(h,f),P=new S(g,f),V=new S(g,z),E=new S(h,z),F=new S(p/s,m/s),T=new S(M/s,B/s),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),r=[e,-t,t,e];C._matMult(r),P._matMult(r),E._matMult(r),V._matMult(r);}const D=n.stretch+n.fixed,$=i.stretch+i.fixed;return {tl:C,tr:P,bl:E,br:V,tex:{x:a.paddedRect.x+1+D,y:a.paddedRect.y+1+$,w:o.stretch+o.fixed-D,h:l.stretch+l.fixed-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:T,minFontScaleX:A/s/u,minFontScaleY:I/s/c,isSDF:r}};if(n&&(a.stretchX||a.stretchY)){const t=fu(h,m,d),e=fu(p,g,y);for(let r=0;r0&&(n=Math.max(10,n),this.circleDiameter=n);}else {let l=a.top*s-o[0],c=a.bottom*s+o[2],h=a.left*s-o[3],p=a.right*s+o[1];const f=a.collisionPadding;if(f&&(h-=f[0]*s,l-=f[1]*s,p+=f[2]*s,c+=f[3]*s),u){const t=new S(h,l),e=new S(p,l),r=new S(h,c),n=new S(p,c),i=u*Math.PI/180;t._rotate(i),e._rotate(i),r._rotate(i),n._rotate(i),h=Math.min(t.x,e.x,r.x,n.x),p=Math.max(t.x,e.x,r.x,n.x),l=Math.min(t.y,e.y,r.y,n.y),c=Math.max(t.y,e.y,r.y,n.y);}t.emplaceBack(e.x,e.y,h,l,p,c,r,n,i);}this.boxEndIndex=t.length;}}class gu{constructor(t=[],e=xu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this.length++,this._up(this.length-1);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i;}e[t]=n;}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t=0)break;e[t]=a,t=n;}e[t]=i;}}function xu(t,e){return te?1:0}function vu(t,e=1,r=!1){let n=1/0,i=1/0,a=-1/0,s=-1/0;const o=t[0];for(let t=0;ta)&&(a=e.x),(!t||e.y>s)&&(s=e.y);}const l=Math.min(a-n,s-i);let u=l/2;const c=new gu([],bu);if(0===l)return new S(n,i);for(let e=n;eh.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new wu(n.p.x-u,n.p.y-u,u,t)),c.push(new wu(n.p.x+u,n.p.y-u,u,t)),c.push(new wu(n.p.x-u,n.p.y+u,u,t)),c.push(new wu(n.p.x+u,n.p.y+u,u,t)),p+=4);}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function bu(t,e){return e.max-t.max}function wu(t,e,r,n){this.p=new S(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;it.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,rs(t,i,o));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}const _u=Number.POSITIVE_INFINITY;function Au(t,e){return e[1]!==_u?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r;}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7;}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e;}return [r,n]}(t,e[0])}function ku(t){switch(t){case"right":case"top-right":case"bottom-right":return "right";case"left":case"top-left":case"bottom-left":return "left"}return "center"}function Su(e,r,n,i,a,s,o,l,u,c,h){let p=s.textMaxSize.evaluate(r,{});void 0===p&&(p=o);const f=e.layers[0].layout,y=f.get("icon-offset").evaluate(r,{},h),m=zu(n.horizontal),g=o/24,x=e.tilePixelRatio*g,v=e.tilePixelRatio*p/24,b=e.tilePixelRatio*l,w=e.tilePixelRatio*f.get("symbol-spacing"),_=f.get("text-padding")*e.tilePixelRatio,A=function(t,e,r,n=1){const i=t.get("icon-padding").evaluate(e,{},r),a=i&&i.values;return [a[0]*n,a[1]*n,a[2]*n,a[3]*n]}(f,r,h,e.tilePixelRatio),k=f.get("text-max-angle")/180*Math.PI,S="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),I="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),M=f.get("symbol-placement"),z=w/2,B=f.get("icon-text-fit");let C;i&&"none"!==B&&(e.allowVerticalPlacement&&n.vertical&&(C=Ql(i,n.vertical,B,f.get("icon-text-fit-padding"),y,g)),m&&(i=Ql(i,m,B,f.get("icon-text-fit-padding"),y,g)));const P=(l,p)=>{p.x<0||p.x>=qa||p.y<0||p.y>=qa||function(e,r,n,i,a,s,o,l,u,c,h,p,f,y,m,g,x,v,b,w,_,A,k,S,I){const M=e.addToLineVertexArray(r,n);let z,B,C,P,V=0,E=0,F=0,T=0,L=-1,D=-1;const $={};let R=xa.exports(""),O=0,U=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[O,U]=l.layout.get("text-offset").evaluate(_,{},S).map((t=>t*ll)):(O=l.layout.get("text-radial-offset").evaluate(_,{},S)*ll,U=_u),e.allowVerticalPlacement&&i.vertical){const t=l.layout.get("text-rotate").evaluate(_,{},S)+90;C=new mu(u,r,c,h,p,i.vertical,f,y,m,t),o&&(P=new mu(u,r,c,h,p,o,x,v,m,t));}if(a){const n=l.layout.get("icon-rotate").evaluate(_,{}),i="none"!==l.layout.get("icon-text-fit"),s=hu(a,n,k,i),f=o?hu(o,n,k,i):void 0;B=new mu(u,r,c,h,p,a,x,v,!1,n),V=4*s.length;const y=e.iconSizeData;let m=null;"source"===y.kind?(m=[tu*l.layout.get("icon-size").evaluate(_,{})],m[0]>Iu&&d(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===y.kind&&(m=[tu*A.compositeIconSizes[0].evaluate(_,{},S),tu*A.compositeIconSizes[1].evaluate(_,{},S)],(m[0]>Iu||m[1]>Iu)&&d(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,m,w,b,_,t.WritingMode.none,r,M.lineStartIndex,M.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,f&&(E=4*f.length,e.addSymbols(e.icon,f,m,w,b,_,t.WritingMode.vertical,r,M.lineStartIndex,M.lineLength,-1,S),D=e.icon.placedSymbolArray.length-1);}const q=Object.keys(i.horizontal);for(const n of q){const a=i.horizontal[n];if(!z){R=xa.exports(a.text);const t=l.layout.get("text-rotate").evaluate(_,{},S);z=new mu(u,r,c,h,p,a,f,y,m,t);}const o=1===a.positionedLines.length;if(F+=Mu(e,r,a,s,l,m,_,g,M,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,o?q:[n],$,L,A,S),o)break}i.vertical&&(T+=Mu(e,r,i.vertical,s,l,m,_,g,M,t.WritingMode.vertical,["vertical"],$,D,A,S));const j=z?z.boxStartIndex:e.collisionBoxArray.length,N=z?z.boxEndIndex:e.collisionBoxArray.length,Z=C?C.boxStartIndex:e.collisionBoxArray.length,K=C?C.boxEndIndex:e.collisionBoxArray.length,G=B?B.boxStartIndex:e.collisionBoxArray.length,J=B?B.boxEndIndex:e.collisionBoxArray.length,X=P?P.boxStartIndex:e.collisionBoxArray.length,Y=P?P.boxEndIndex:e.collisionBoxArray.length;let H=-1;const W=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;H=W(z,H),H=W(C,H),H=W(B,H),H=W(P,H);const Q=H>-1?1:0;Q&&(H*=I/ll),e.glyphOffsetArray.length>=Du.MAX_GLYPHS&&d("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==_.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,_.sortKey),e.symbolInstances.emplaceBack(r.x,r.y,$.right>=0?$.right:-1,$.center>=0?$.center:-1,$.left>=0?$.left:-1,$.vertical||-1,L,D,R,j,N,Z,K,G,J,X,Y,c,F,T,V,E,Q,0,f,O,U,H);}(e,p,l,n,i,a,C,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,x,[_,_,_,_],S,u,b,A,I,y,r,s,c,h,o);};if("line"===M)for(const t of cu(r.geometry,0,0,qa,qa)){const r=lu(t,w,k,n.vertical||m,i,24,v,e.overscaling,qa);for(const n of r){const r=m;r&&Bu(e,r.text,z,n)||P(t,n);}}else if("line-center"===M){for(const t of r.geometry)if(t.length>1){const e=ou(t,k,n.vertical||m,i,24,v);e&&P(t,e);}}else if("Polygon"===r.type)for(const t of ho(r.geometry,0)){const e=vu(t,16);P(t[0],new ru(e.x,e.y,0));}else if("LineString"===r.type)for(const t of r.geometry)P(t,new ru(t[0].x,t[0].y,0));else if("Point"===r.type)for(const t of r.geometry)for(const e of t)P([e],new ru(e.x,e.y,0));}const Iu=32640;function Mu(t,e,r,n,i,a,s,o,l,u,c,h,p,f,y){const m=function(t,e,r,n,i,a,s,o){const l=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const a=n.rect||{};let c=4,h=!0,p=1,f=0;const d=(i||o)&&n.vertical,y=n.metrics.advance*n.scale/2;if(o&&e.verticalizable){const e=(n.scale-1)*ll,r=(ll-n.metrics.width*n.scale)/2;f=t.lineOffset/2-(n.imageName?-r:e);}if(n.imageName){const t=s[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p;}const m=i?[n.x+y,n.y]:[0,0];let g=i?[0,0]:[n.x+y+r[0],n.y+r[1]-f],x=[0,0];d&&(x=g,g=[0,0]);const v=(n.metrics.left-c)*n.scale-y+g[0],b=(-n.metrics.top-c)*n.scale+g[1],w=v+a.w*n.scale/p,_=b+a.h*n.scale/p,A=new S(v,b),k=new S(w,b),I=new S(v,_),M=new S(w,_);if(d){const t=new S(-y,y-$l),e=-Math.PI/2,r=12-y,i=new S(22-r,-(n.imageName?r:0)),a=new S(...x);A._rotateAround(e,t)._add(i)._add(a),k._rotateAround(e,t)._add(i)._add(a),I._rotateAround(e,t)._add(i)._add(a),M._rotateAround(e,t)._add(i)._add(a);}if(l){const t=Math.sin(l),e=Math.cos(l),r=[e,-t,t,e];A._matMult(r),k._matMult(r),I._matMult(r),M._matMult(r);}const z=new S(0,0),B=new S(0,0);u.push({tl:A,tr:k,bl:I,br:M,tex:a,writingMode:e.writingMode,glyphOffset:m,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:z,pixelOffsetBR:B,minFontScaleX:0,minFontScaleY:0});}return u}(0,r,o,i,a,s,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[tu*i.layout.get("text-size").evaluate(s,{})],x[0]>Iu&&d(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[tu*f.compositeTextSizes[0].evaluate(s,{},y),tu*f.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>Iu||x[1]>Iu)&&d(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,u,e,l.lineStartIndex,l.lineLength,p,y);for(const e of c)h[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function zu(t){for(const e in t)return t[e];return null}function Bu(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ds([]),this.placementViewportMatrix=ds([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=eu(this.zoom,r["text-size"]),this.iconSizeData=eu(this.zoom,r["icon-size"]);const n=this.layers[0].layout,i=n.get("symbol-sort-key"),a=n.get("symbol-z-order");this.canOverlap="never"!==qu(n,"text-overlap","text-allow-overlap")||"never"!==qu(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!i.isConstant(),this.sortFeaturesByY=("viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID;}createArrays(){this.text=new Tu(new Ra(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Tu(new Ra(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Xi,this.lineVertexArray=new Yi,this.symbolInstances=new Ji;}calculateGlyphDependencies(t,e,r,n,i){for(let a=0;a0)&&("constant"!==s.value.kind||s.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=r.iconDependencies,f=r.glyphDependencies,d=r.availableImages,y=new Qn(this.zoom);for(const{feature:r,id:o,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,g=Ka(r,e);if(!i._featureFilter.filter(y,g,n))continue;let x,v;if(e||(g.geometry=Za(r)),u){const t=i.getValueAndResolveTokens("text-field",g,n,d),e=Dt.factory(t);Fu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Yn()||this.hasRTLText&&Wn.isParsed())&&(x=sl(e,i,g));}if(c){const t=i.getValueAndResolveTokens("icon-image",g,n,d);v=t instanceof Rt?t:Rt.fromString(t);}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},n):void 0;if(this.features.push({id:o,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:r.properties,type:Cu[r.type],sortKey:b}),v&&(p[v.name]=!0),x){const e=s.evaluate(g,{},n).join(","),r="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of x.sections)if(t.image)p[t.image.name]=!0;else {const n=En(x.toString()),i=t.fontStack||e,a=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,a,r,this.allowVerticalPlacement,n);}}}"line"===a.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function a(e){n.push(t[e]),i++;}function s(t,e,i){const a=r[t];return delete r[t],r[e]=a,n[a].geometry[0].pop(),n[a].geometry[0]=n[a].geometry[0].concat(i[0]),a}function o(t,r,i){const a=e[r];return delete e[r],e[t]=a,n[a].geometry[0].shift(),n[a].geometry[0]=i[0].concat(n[a].geometry[0]),a}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;ut.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r));}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;en[t]-n[e]||i[e]-i[t])),a}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t);})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}Mn("SymbolBucket",Du,{omit:["layers","collisionBoxArray","features","compareText"]}),Du.MAX_GLYPHS=65535,Du.addDynamicAttributes=Eu;const $u=new fi({"symbol-placement":new li(nt.layout_symbol["symbol-placement"]),"symbol-spacing":new li(nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new li(nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ui(nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new li(nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new li(nt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new li(nt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new li(nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new li(nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new li(nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ui(nt.layout_symbol["icon-size"]),"icon-text-fit":new li(nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new li(nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ui(nt.layout_symbol["icon-image"]),"icon-rotate":new ui(nt.layout_symbol["icon-rotate"]),"icon-padding":new ui(nt.layout_symbol["icon-padding"]),"icon-keep-upright":new li(nt.layout_symbol["icon-keep-upright"]),"icon-offset":new ui(nt.layout_symbol["icon-offset"]),"icon-anchor":new ui(nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new li(nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new li(nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new li(nt.layout_symbol["text-rotation-alignment"]),"text-field":new ui(nt.layout_symbol["text-field"]),"text-font":new ui(nt.layout_symbol["text-font"]),"text-size":new ui(nt.layout_symbol["text-size"]),"text-max-width":new ui(nt.layout_symbol["text-max-width"]),"text-line-height":new li(nt.layout_symbol["text-line-height"]),"text-letter-spacing":new ui(nt.layout_symbol["text-letter-spacing"]),"text-justify":new ui(nt.layout_symbol["text-justify"]),"text-radial-offset":new ui(nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new li(nt.layout_symbol["text-variable-anchor"]),"text-anchor":new ui(nt.layout_symbol["text-anchor"]),"text-max-angle":new li(nt.layout_symbol["text-max-angle"]),"text-writing-mode":new li(nt.layout_symbol["text-writing-mode"]),"text-rotate":new ui(nt.layout_symbol["text-rotate"]),"text-padding":new li(nt.layout_symbol["text-padding"]),"text-keep-upright":new li(nt.layout_symbol["text-keep-upright"]),"text-transform":new ui(nt.layout_symbol["text-transform"]),"text-offset":new ui(nt.layout_symbol["text-offset"]),"text-allow-overlap":new li(nt.layout_symbol["text-allow-overlap"]),"text-overlap":new li(nt.layout_symbol["text-overlap"]),"text-ignore-placement":new li(nt.layout_symbol["text-ignore-placement"]),"text-optional":new li(nt.layout_symbol["text-optional"])});var Ru={paint:new fi({"icon-opacity":new ui(nt.paint_symbol["icon-opacity"]),"icon-color":new ui(nt.paint_symbol["icon-color"]),"icon-halo-color":new ui(nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ui(nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ui(nt.paint_symbol["icon-halo-blur"]),"icon-translate":new li(nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new li(nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ui(nt.paint_symbol["text-opacity"]),"text-color":new ui(nt.paint_symbol["text-color"],{runtimeType:yt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ui(nt.paint_symbol["text-halo-color"]),"text-halo-width":new ui(nt.paint_symbol["text-halo-width"]),"text-halo-blur":new ui(nt.paint_symbol["text-halo-blur"]),"text-translate":new li(nt.paint_symbol["text-translate"]),"text-translate-anchor":new li(nt.paint_symbol["text-translate-anchor"])}),layout:$u};class Ou{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ht,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}Mn("FormatSectionOverride",Ou,{omit:["defaultValue"]});class Uu extends yi{constructor(t){super(t,Ru);}recalculate(t,e){if(super.recalculate(t,e),"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"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e;}else this.layout._values["text-writing-mode"]=["horizontal"];}this._setPaintOverrides();}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),a=this._unevaluatedLayout._values[t];return a.isDataDriven()||Er(a.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}(e.properties,i)}createBucket(t){return new Du(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ru.paint.overridableProperties){if(!Uu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Ou(e),n=new Vr(r,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new Tr("source",n):new Lr("composite",n,e.value.zoomStops),this.paint._values[t]=new si(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&Uu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=Ru.paint.properties[e];let i=!1;const a=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Dt)a(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof Nt&&qt(e.value)===vt?a(e.value.sections):e instanceof cr?a(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}}function qu(t,e,r){let n="never";const i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var ju={paint:new fi({"background-color":new li(nt.paint_background["background-color"]),"background-pattern":new hi(nt.paint_background["background-pattern"]),"background-opacity":new li(nt.paint_background["background-opacity"])})},Nu={paint:new fi({"raster-opacity":new li(nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new li(nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new li(nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new li(nt.paint_raster["raster-brightness-max"]),"raster-saturation":new li(nt.paint_raster["raster-saturation"]),"raster-contrast":new li(nt.paint_raster["raster-contrast"]),"raster-resampling":new li(nt.paint_raster["raster-resampling"]),"raster-fade-duration":new li(nt.paint_raster["raster-fade-duration"])})};class Zu extends yi{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);},this.implementation=t;}is3D(){return "3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){throw new Error("Custom layers cannot be serialized")}}const Ku={circle:class extends yi{constructor(t){super(t,cs);}createBucket(t){return new Ja(t)}queryRadius(t){const e=t;return ss("circle-radius",this,e)+ss("circle-stroke-width",this,e)+os(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,a,s,o){const l=ls(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>_s(t,e)))}(l,o),p=c?u*s:u;for(const t of n)for(const e of t){const t=c?e:_s(e,o);let r=p;const n=bs([],[e.x,e.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=n[3]/a.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=a.cameraToCenterDistance/n[3]),Ya(h,t,r))return !0}return !1}},heatmap:class extends yi{constructor(t){super(t,ks),this._updateColorRamp();}createBucket(t){return new As(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=Cs({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null);}queryRadius(){return 0}queryIntersectsFeature(){return !1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends yi{constructor(t){super(t,Ps);}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends yi{constructor(t){super(t,xo);}recalculate(t,e){super.recalculate(t,e);const 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"]);}createBucket(t){return new mo(t)}queryRadius(){return os(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,a,s){return Ha(ls(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s),n)}isTileClipped(){return !0}},"fill-extrusion":class extends yi{constructor(t){super(t,Oo);}createBucket(t){return new Do(t)}queryRadius(){return os(this.paint.get("fill-extrusion-translate"))}is3D(){return !0}queryIntersectsFeature(t,e,r,n,i,a,s,o){const l=ls(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),u=this.paint.get("fill-extrusion-height").evaluate(e,r),c=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e,r,n){const i=[];for(const r of t){const t=[r.x,r.y,0,1];bs(t,t,e),i.push(new S(t[0]/t[3],t[1]/t[3]));}return i}(l,o),p=function(t,e,r,n){const i=[],a=[],s=n[8]*e,o=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,h=n[9]*r,p=n[10]*r,f=n[11]*r;for(const e of t){const t=[],r=[];for(const i of e){const e=i.x,a=i.y,d=n[0]*e+n[4]*a+n[12],y=n[1]*e+n[5]*a+n[13],m=n[2]*e+n[6]*a+n[14],g=n[3]*e+n[7]*a+n[15],x=m+l,v=g+u,b=d+c,w=y+h,_=m+p,A=g+f,k=new S((d+s)/v,(y+o)/v);k.z=x/v,t.push(k);const I=new S(b/A,w/A);I.z=_/A,r.push(I);}i.push(t),a.push(r);}return [i,a]}(n,c,u,o);return function(t,e,r){let n=1/0;Ha(r,e)&&(n=qo(r,e[0]));for(let i=0;i=3)for(let e=0;e{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){delete this._channel,this._callback=()=>{};}}const Ju=6371008.8;class Xu{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Xu(s(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Ju*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Yu(new Xu(this.lng-r,this.lat-e),new Xu(this.lng+r,this.lat+e))}static convert(t){if(t instanceof Xu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Xu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Xu(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Yu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]));}setNorthEast(t){return this._ne=t instanceof Xu?new Xu(t.lng,t.lat):Xu.convert(t),this}setSouthWest(t){return this._sw=t instanceof Xu?new Xu(t.lng,t.lat):Xu.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof Xu)n=t,i=t;else {if(!(t instanceof Yu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Yu.convert(t)):this.extend(Xu.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new Xu(n.lng,n.lat),this._ne=new Xu(i.lng,i.lat)),this}getCenter(){return new Xu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Xu(this.getWest(),this.getNorth())}getSouthEast(){return new Xu(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(t){const{lng:e,lat:r}=Xu.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof Yu?t:t?new Yu(t):t}}const Hu=2*Math.PI*Ju;function Wu(t){return Hu*Math.cos(t*Math.PI/180)}function Qu(t){return (180+t)/360}function tc(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ec(t,e){return t/Wu(e)}function rc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class nc{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r;}static fromLngLat(t,e=0){const r=Xu.convert(t);return new nc(Qu(r.lng),tc(r.lat),ec(e,r.lat))}toLngLat(){return new Xu(360*this.x-180,rc(this.y))}toAltitude(){return this.z*Wu(rc(this.y))}meterInMercatorCoordinateUnits(){return 1/Hu*(t=rc(this.y),1/Math.cos(t*Math.PI/180));var t;}}function ic(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class ac{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=lc(0,t,t,e,r);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(a=this.y,s=this.z,o=ic(256*(i=this.x),256*(a=Math.pow(2,s)-a-1),s),l=ic(256*(i+1),256*(a+1),s),o[0]+","+o[1]+","+l[0]+","+l[1]);var i,a,s,o,l;const u=function(t,e,r){let n,i="";for(let a=t;a>0;a--)n=1<1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new S((t.x*e-this.x)*qa,(t.y*e-this.y)*qa)}toString(){return `${this.z}/${this.x}/${this.y}`}}class sc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=lc(t,e.z,e.z,e.x,e.y);}}class oc{constructor(t,e,r,n,i){if(t= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new ac(r,+n,+i),this.key=lc(e,t,r,n,i);}clone(){return new oc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new oc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new oc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?lc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):lc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return !1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new oc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new oc(e,this.wrap,e,r,n),new oc(e,this.wrap,e,r+1,n),new oc(e,this.wrap,e,r,n+1),new oc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=r),r=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return (e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return (256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}getPixels(){return new Bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:a=s-1;break;case 1:s=a+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=a;e=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class hc{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i;}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t;}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class pc{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Sn(qa,16,0),this.grid3D=new Sn(qa,16,0),this.featureIndexArray=new Wi,this.promoteId=e;}insert(t,e,r,n,i,a){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=a?this.grid3D:this.grid;for(let t=0;t=0&&n[3]>=0&&o.insert(s,n[0],n[1],n[2],n[3]);}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new _o.VectorTile(new ul(this.rawTileData)).layers,this.sourceLayerCoder=new cc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},a=qa/t.tileSize/t.scale,s=Jr(i.filter),o=t.queryGeometry,l=t.queryPadding*a,u=dc(o),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=dc(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((e,r,n,i)=>function(t,e,r,n,i){for(const a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return !0;const a=[new S(e,r),new S(e,i),new S(n,i),new S(n,r)];if(t.length>2)for(const e of a)if(is(t,e))return !0;for(let e=0;e(p||(p=Za(e)),r.queryIntersectsFeature(o,e,n,p,this.z,t.transform,a,t.pixelPosMatrix))));}return f}loadMatchingFeature(t,e,r,n,i,a,s,l,u,c,h){const p=this.bucketLayerIDs[e];if(a&&!function(t,e){for(let r=0;r=0)return !0;return !1}(a,p))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){const t=Ka(d,!0);if(!i.filter(new Qn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Qn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e{const s=e instanceof oi?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s}))}function dc(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const a of t)e=Math.min(e,a.x),r=Math.min(r,a.y),n=Math.max(n,a.x),i=Math.max(i,a.y);return {minX:e,minY:r,maxX:n,maxY:i}}function yc(t,e){return e-t}var mc;Mn("FeatureIndex",pc,{omit:["rawTileData","sourceLayerCoder"]}),t.PerformanceMarkers=void 0,(mc=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",mc.load="load",mc.fullLoad="fullLoad";let gc=null,xc=[];const vc=1e3/30,bc={mark(t){performance.mark(t);},frame(t){const e=t;null!=gc&&xc.push(e-gc),gc=e;},clearMetrics(){gc=null,xc=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e]);},getPerformanceMetrics(){performance.measure("loadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure("fullLoadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName("loadTime")[0].duration,r=performance.getEntriesByName("fullLoadTime")[0].duration,n=xc.length,i=1/(xc.reduce(((t,e)=>t+e),0)/n/1e3),a=xc.filter((t=>t>vc)).reduce(((t,e)=>t+(e-vc)/vc),0);return {loadTime:e,fullLoadTime:r,fps:i,percentDroppedFrames:a/(n+a)*100}}};t.AJAXError=q,t.ARRAY_TYPE=ps,t.Actor=class{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},u(["receive","process"],this),this.invoker=new Gu(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=g()?t:window;}send(t,e,r,n,i=!1){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);const s=_(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Bn(e,s)},s),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:"",targetMapId:n,sourceMapId:this.mapId});}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t();}else g()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e);}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e);}processTask(t,e){if(""===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Cn(e.error)):r(null,Cn(e.data)));}else {let r=!1;const n=_(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"",sourceMapId:this.mapId,error:e?Bn(e):null,data:Bn(i,n)},n);}:t=>{r=!0;};let a=null;const s=Cn(e.data);if(this.parent[e.type])a=this.parent[e.type](e.sourceMapId,s,i);else if(this.parent.getWorkerSource){const t=e.type.split(".");a=this.parent.getWorkerSource(e.sourceMapId,t[0],s.source)[t[1]](s,i);}else i(new Error(`Could not find function ${e.type}`));!r&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel);}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1);}},t.AlphaImage=zs,t.CanonicalTileID=ac,t.CollisionBoxArray=Ni,t.CollisionCircleLayoutArray=class extends Vi{},t.Color=Ft,t.DEMData=uc,t.DataConstantProperty=li,t.DictionaryCoder=cc,t.EXTENT=qa,t.ErrorEvent=et,t.EvaluationParameters=Qn,t.Event=tt,t.Evented=rt,t.FeatureIndex=pc,t.FillBucket=mo,t.FillExtrusionBucket=Do,t.GeoJSONFeature=hc,t.ImageAtlas=Dl,t.ImagePosition=Ll,t.LineBucket=Yo,t.LineStripIndexArray=class extends Ui{},t.LngLat=Xu,t.LngLatBounds=Yu,t.MercatorCoordinate=nc,t.ONE_EM=ll,t.OverscaledTileID=oc,t.PerformanceUtils=bc,t.PosArray=Qi,t.Properties=fi,t.QuadTriangleArray=class extends Fi{},t.RGBAImage=Bs,t.RasterBoundsArray=class extends _i{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start);}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.ResourceType=U,t.SegmentVector=ya,t.SymbolBucket=Du,t.Transitionable=ri,t.TriangleIndexArray=ha,t.Uniform1f=za,t.Uniform1i=class extends Ma{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t));}},t.Uniform2f=class extends Ma{constructor(t,e){super(t,e),this.current=[0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]));}},t.Uniform3f=class extends Ma{constructor(t,e){super(t,e),this.current=[0,0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]));}},t.Uniform4f=Ba,t.UniformColor=Ca,t.UniformMatrix4f=class extends Ma{constructor(t,e){super(t,e),this.current=Pa;}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=sc,t.ValidationError=it,t.ZoomHistory=Pn,t.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},t.addDynamicAttributes=Eu,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let a=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(a=t),i[s]=e,0==--n&&r(a,i);}));}));},t.bezier=n,t.bindAll=u,t.cacheEntryPossiblyAdded=function(t){F++,F>V&&(t.getActor().send("enforceCacheSizeLimit",P),F=0);},t.clamp=a,t.clearTileCache=function(t){const e=caches.delete(z);t&&e.catch(t).then((()=>t()));},t.clipLine=cu,t.clone=function(t){var e=new ps(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=p,t.clone$2=function(t){var e=new ps(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=al,t.config=M,t.copy=function(t,e){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},t.create=function(){var t=new ps(16);return ps!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=fs,t.createExpression=Fr,t.createFilter=Jr,t.createLayout=vi,t.createStyleLayer=function(t){return "custom"===t.type?new Zu(t):new Ku[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=i*l-a*o,t[1]=a*s-n*l,t[2]=n*o-i*s,t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=i,t.emitValidationErrors=kn,t.enforceCacheSizeLimit=function(t){E(),B&&B.then((e=>{e.keys().then((r=>{for(let n=0;n{}}},t.identity=ds,t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],s=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*s,v=r*l-i*s,b=r*u-a*s,w=n*l-i*o,_=n*u-a*o,A=i*u-a*l,k=c*y-h*d,S=c*m-p*d,I=c*g-f*d,M=h*m-p*y,z=h*g-f*y,B=p*g-f*m,C=x*B-v*z+b*M+w*I-_*S+A*k;return C?(t[0]=(o*B-l*z+u*M)*(C=1/C),t[1]=(i*z-n*B-a*M)*C,t[2]=(y*A-m*_+g*w)*C,t[3]=(p*_-h*A-f*w)*C,t[4]=(l*I-s*B-u*S)*C,t[5]=(r*B-i*I+a*S)*C,t[6]=(m*b-d*A-g*v)*C,t[7]=(c*A-p*b+f*v)*C,t[8]=(s*z-o*I+u*k)*C,t[9]=(n*I-r*z-a*k)*C,t[10]=(d*_-y*b+g*x)*C,t[11]=(h*b-c*_-f*x)*C,t[12]=(o*S-s*M-l*k)*C,t[13]=(r*M-n*S+i*k)*C,t[14]=(y*v-d*w-m*x)*C,t[15]=(c*w-h*v+p*x)*C,t):null},t.isImageBitmap=A,t.isSafari=_,t.isWorker=g,t.keysDifference=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r},t.lazyLoadRTLTextPlugin=function(){Wn.isLoading()||Wn.isLoaded()||"deferred"!==Yn()||Hn();},t.makeRequest=Z,t.mapObject=c,t.mercatorXfromLng=Qu,t.mercatorYfromLat=tc,t.mercatorZfromAltitude=ec,t.mul=gs,t.mul$1=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},t.multiply=ys,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=Se,t.ortho=function(t,e,r,n,i,a,s){var o=1/(e-r),l=1/(n-i),u=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(s+a)*u,t[15]=1,t},t.parseCacheControl=x,t.parseGlyphPbf=function(t){return new ul(t).readFields(Vl,[])},t.pbf=ul,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=qa/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const r=e.bucket.layers[0].layout,n=e.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Qn(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Qn(t),e.canonical),n["text-size"].possiblyEvaluate(new Qn(r),e.canonical)];}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Qn(t),e.canonical),n["icon-size"].possiblyEvaluate(new Qn(r),e.canonical)];}const a=r.get("text-line-height")*ll,s="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),o=r.get("text-keep-upright"),l=r.get("text-size");for(const n of e.bucket.features){const u=r.get("text-font").evaluate(n,{},e.canonical).join(","),c=l.evaluate(n,{},e.canonical),h=i.layoutTextSize.evaluate(n,{},e.canonical),p=i.layoutIconSize.evaluate(n,{},e.canonical),f={horizontal:{},vertical:void 0},y=n.text;let m,g=[0,0];if(y){const i=y.toString(),l=r.get("text-letter-spacing").evaluate(n,{},e.canonical)*ll,p=Fn(i)?l:0,d=r.get("text-anchor").evaluate(n,{},e.canonical),m=r.get("text-variable-anchor");if(!m){const t=r.get("text-radial-offset").evaluate(n,{},e.canonical);g=t?Au(d,[t*ll,_u]):r.get("text-offset").evaluate(n,{},e.canonical).map((t=>t*ll));}let x=s?"center":r.get("text-justify").evaluate(n,{},e.canonical);const v=r.get("symbol-placement"),b="point"===v?r.get("text-max-width").evaluate(n,{},e.canonical)*ll:0,w=()=>{e.bucket.allowVerticalPlacement&&En(i)&&(f.vertical=Ul(y,e.glyphMap,e.glyphPositions,e.imagePositions,u,b,a,d,"left",p,g,t.WritingMode.vertical,!0,v,h,c));};if(!s&&m){const r="auto"===x?m.map((t=>ku(t))):[x];let n=!1;for(let i=0;i>> 16) * s) & 65535) << 16)) & + 4294967295) << + 15) | + (l >>> 17))) * + o + + ((((l >>> 16) * o) & 65535) << 16)) & + 4294967295) << + 13) | + (i >>> 19))) + + (((5 * (i >>> 16)) & 65535) << 16)) & + 4294967295)) + + (((58964 + (a >>> 16)) & 65535) << 16)); + switch (((l = 0), r)) { + case 3: + l ^= (255 & t.charCodeAt(u + 2)) << 16; + case 2: + l ^= (255 & t.charCodeAt(u + 1)) << 8; + case 1: + i ^= l = + ((65535 & + (l = + ((l = + ((65535 & (l ^= 255 & t.charCodeAt(u))) * s + + ((((l >>> 16) * s) & 65535) << 16)) & + 4294967295) << + 15) | + (l >>> 17))) * + o + + ((((l >>> 16) * o) & 65535) << 16)) & + 4294967295; + } + return ( + (i ^= t.length), + (i = + (2246822507 * (65535 & (i ^= i >>> 16)) + + (((2246822507 * (i >>> 16)) & 65535) << 16)) & + 4294967295), + (i = + (3266489909 * (65535 & (i ^= i >>> 13)) + + (((3266489909 * (i >>> 16)) & 65535) << 16)) & + 4294967295), + (i ^= i >>> 16) >>> 0 + ); + }; + var ba = { exports: {} }; + ba.exports = function (t, e) { + for (var r, n = t.length, i = e ^ n, a = 0; n >= 4; ) + (r = + 1540483477 * + (65535 & + (r = + (255 & t.charCodeAt(a)) | + ((255 & t.charCodeAt(++a)) << 8) | + ((255 & t.charCodeAt(++a)) << 16) | + ((255 & t.charCodeAt(++a)) << 24))) + + (((1540483477 * (r >>> 16)) & 65535) << 16)), + (i = + (1540483477 * (65535 & i) + + (((1540483477 * (i >>> 16)) & 65535) << 16)) ^ + (r = + 1540483477 * (65535 & (r ^= r >>> 24)) + + (((1540483477 * (r >>> 16)) & 65535) << 16))), + (n -= 4), + ++a; + switch (n) { + case 3: + i ^= (255 & t.charCodeAt(a + 2)) << 16; + case 2: + i ^= (255 & t.charCodeAt(a + 1)) << 8; + case 1: + i = + 1540483477 * (65535 & (i ^= 255 & t.charCodeAt(a))) + + (((1540483477 * (i >>> 16)) & 65535) << 16); + } + return ( + (i = + 1540483477 * (65535 & (i ^= i >>> 13)) + + (((1540483477 * (i >>> 16)) & 65535) << 16)), + (i ^= i >>> 15) >>> 0 + ); + }; + var wa = va.exports, + _a = ba.exports; + (xa.exports = wa), (xa.exports.murmur3 = wa), (xa.exports.murmur2 = _a); + class Aa { + constructor() { + (this.ids = []), (this.positions = []), (this.indexed = !1); + } + add(t, e, r, n) { + this.ids.push(ka(t)), this.positions.push(e, r, n); + } + getPositions(t) { + if (!this.indexed) + throw new Error( + 'Trying to get index, but feature positions are not indexed', + ); + const e = ka(t); + let r = 0, + n = this.ids.length - 1; + for (; r < n; ) { + const t = (r + n) >> 1; + this.ids[t] >= e ? (n = t) : (r = t + 1); + } + const i = []; + for (; this.ids[r] === e; ) + i.push({ + index: this.positions[3 * r], + start: this.positions[3 * r + 1], + end: this.positions[3 * r + 2], + }), + r++; + return i; + } + static serialize(t, e) { + const r = new Float64Array(t.ids), + n = new Uint32Array(t.positions); + return ( + Sa(r, n, 0, r.length - 1), + e && e.push(r.buffer, n.buffer), + { ids: r, positions: n } + ); + } + static deserialize(t) { + const e = new Aa(); + return ( + (e.ids = t.ids), (e.positions = t.positions), (e.indexed = !0), e + ); + } + } + function ka(t) { + const e = +t; + return !isNaN(e) && e <= Number.MAX_SAFE_INTEGER + ? e + : xa.exports(String(t)); + } + function Sa(t, e, r, n) { + for (; r < n; ) { + const i = t[(r + n) >> 1]; + let a = r - 1, + s = n + 1; + for (;;) { + do { + a++; + } while (t[a] < i); + do { + s--; + } while (t[s] > i); + if (a >= s) break; + Ia(t, a, s), + Ia(e, 3 * a, 3 * s), + Ia(e, 3 * a + 1, 3 * s + 1), + Ia(e, 3 * a + 2, 3 * s + 2); + } + s - r < n - s + ? (Sa(t, e, r, s), (r = s + 1)) + : (Sa(t, e, s + 1, n), (n = s)); + } + } + function Ia(t, e, r) { + const n = t[e]; + (t[e] = t[r]), (t[r] = n); + } + Mn('FeaturePositionMap', Aa); + class Ma { + constructor(t, e) { + (this.gl = t.gl), (this.location = e); + } + } + class za extends Ma { + constructor(t, e) { + super(t, e), (this.current = 0); + } + set(t) { + this.current !== t && + ((this.current = t), this.gl.uniform1f(this.location, t)); + } + } + class Ba extends Ma { + constructor(t, e) { + super(t, e), (this.current = [0, 0, 0, 0]); + } + set(t) { + (t[0] === this.current[0] && + t[1] === this.current[1] && + t[2] === this.current[2] && + t[3] === this.current[3]) || + ((this.current = t), + this.gl.uniform4f(this.location, t[0], t[1], t[2], t[3])); + } + } + class Ca extends Ma { + constructor(t, e) { + super(t, e), (this.current = Ft.transparent); + } + set(t) { + (t.r === this.current.r && + t.g === this.current.g && + t.b === this.current.b && + t.a === this.current.a) || + ((this.current = t), + this.gl.uniform4f(this.location, t.r, t.g, t.b, t.a)); + } + } + const Pa = new Float32Array(16); + function Va(t) { + return [ma(255 * t.r, 255 * t.g), ma(255 * t.b, 255 * t.a)]; + } + class Ea { + constructor(t, e, r) { + (this.value = t), + (this.uniformNames = e.map((t) => `u_${t}`)), + (this.type = r); + } + setUniform(t, e, r) { + t.set(r.constantOr(this.value)); + } + getBinding(t, e, r) { + return 'color' === this.type ? new Ca(t, e) : new za(t, e); + } + } + class Fa { + constructor(t, e) { + (this.uniformNames = e.map((t) => `u_${t}`)), + (this.patternFrom = null), + (this.patternTo = null), + (this.pixelRatioFrom = 1), + (this.pixelRatioTo = 1); + } + setConstantPatternPositions(t, e) { + (this.pixelRatioFrom = e.pixelRatio), + (this.pixelRatioTo = t.pixelRatio), + (this.patternFrom = e.tlbr), + (this.patternTo = t.tlbr); + } + setUniform(t, e, r, n) { + const i = + 'u_pattern_to' === n + ? this.patternTo + : 'u_pattern_from' === n + ? this.patternFrom + : 'u_pixel_ratio_to' === n + ? this.pixelRatioTo + : 'u_pixel_ratio_from' === n + ? this.pixelRatioFrom + : null; + i && t.set(i); + } + getBinding(t, e, r) { + return 'u_pattern' === r.substr(0, 9) ? new Ba(t, e) : new za(t, e); + } + } + class Ta { + constructor(t, e, r, n) { + (this.expression = t), + (this.type = r), + (this.maxValue = 0), + (this.paintVertexAttributes = e.map((t) => ({ + name: `a_${t}`, + type: 'Float32', + components: 'color' === r ? 2 : 1, + offset: 0, + }))), + (this.paintVertexArray = new n()); + } + populatePaintArray(t, e, r, n, i) { + const a = this.paintVertexArray.length, + s = this.expression.evaluate(new Qn(0), e, {}, n, [], i); + this.paintVertexArray.resize(t), this._setPaintValue(a, t, s); + } + updatePaintArray(t, e, r, n) { + const i = this.expression.evaluate({ zoom: 0 }, r, n); + this._setPaintValue(t, e, i); + } + _setPaintValue(t, e, r) { + if ('color' === this.type) { + const n = Va(r); + for (let r = t; r < e; r++) + this.paintVertexArray.emplace(r, n[0], n[1]); + } else { + for (let n = t; n < e; n++) this.paintVertexArray.emplace(n, r); + this.maxValue = Math.max(this.maxValue, Math.abs(r)); + } + } + upload(t) { + this.paintVertexArray && + this.paintVertexArray.arrayBuffer && + (this.paintVertexBuffer && this.paintVertexBuffer.buffer + ? this.paintVertexBuffer.updateData(this.paintVertexArray) + : (this.paintVertexBuffer = t.createVertexBuffer( + this.paintVertexArray, + this.paintVertexAttributes, + this.expression.isStateDependent, + ))); + } + destroy() { + this.paintVertexBuffer && this.paintVertexBuffer.destroy(); + } + } + class La { + constructor(t, e, r, n, i, a) { + (this.expression = t), + (this.uniformNames = e.map((t) => `u_${t}_t`)), + (this.type = r), + (this.useIntegerZoom = n), + (this.zoom = i), + (this.maxValue = 0), + (this.paintVertexAttributes = e.map((t) => ({ + name: `a_${t}`, + type: 'Float32', + components: 'color' === r ? 4 : 2, + offset: 0, + }))), + (this.paintVertexArray = new a()); + } + populatePaintArray(t, e, r, n, i) { + const a = this.expression.evaluate(new Qn(this.zoom), e, {}, n, [], i), + s = this.expression.evaluate(new Qn(this.zoom + 1), e, {}, n, [], i), + o = this.paintVertexArray.length; + this.paintVertexArray.resize(t), this._setPaintValue(o, t, a, s); + } + updatePaintArray(t, e, r, n) { + const i = this.expression.evaluate({ zoom: this.zoom }, r, n), + a = this.expression.evaluate({ zoom: this.zoom + 1 }, r, n); + this._setPaintValue(t, e, i, a); + } + _setPaintValue(t, e, r, n) { + if ('color' === this.type) { + const i = Va(r), + a = Va(n); + for (let r = t; r < e; r++) + this.paintVertexArray.emplace(r, i[0], i[1], a[0], a[1]); + } else { + for (let i = t; i < e; i++) this.paintVertexArray.emplace(i, r, n); + this.maxValue = Math.max(this.maxValue, Math.abs(r), Math.abs(n)); + } + } + upload(t) { + this.paintVertexArray && + this.paintVertexArray.arrayBuffer && + (this.paintVertexBuffer && this.paintVertexBuffer.buffer + ? this.paintVertexBuffer.updateData(this.paintVertexArray) + : (this.paintVertexBuffer = t.createVertexBuffer( + this.paintVertexArray, + this.paintVertexAttributes, + this.expression.isStateDependent, + ))); + } + destroy() { + this.paintVertexBuffer && this.paintVertexBuffer.destroy(); + } + setUniform(t, e) { + const r = this.useIntegerZoom ? Math.floor(e.zoom) : e.zoom, + n = a( + this.expression.interpolationFactor(r, this.zoom, this.zoom + 1), + 0, + 1, + ); + t.set(n); + } + getBinding(t, e, r) { + return new za(t, e); + } + } + class Da { + constructor(t, e, r, n, i, a) { + (this.expression = t), + (this.type = e), + (this.useIntegerZoom = r), + (this.zoom = n), + (this.layerId = a), + (this.zoomInPaintVertexArray = new i()), + (this.zoomOutPaintVertexArray = new i()); + } + populatePaintArray(t, e, r) { + const n = this.zoomInPaintVertexArray.length; + this.zoomInPaintVertexArray.resize(t), + this.zoomOutPaintVertexArray.resize(t), + this._setPaintValues(n, t, e.patterns && e.patterns[this.layerId], r); + } + updatePaintArray(t, e, r, n, i) { + this._setPaintValues(t, e, r.patterns && r.patterns[this.layerId], i); + } + _setPaintValues(t, e, r, n) { + if (!n || !r) return; + const { min: i, mid: a, max: s } = r, + o = n[i], + l = n[a], + u = n[s]; + if (o && l && u) + for (let r = t; r < e; r++) + this.zoomInPaintVertexArray.emplace( + r, + l.tl[0], + l.tl[1], + l.br[0], + l.br[1], + o.tl[0], + o.tl[1], + o.br[0], + o.br[1], + l.pixelRatio, + o.pixelRatio, + ), + this.zoomOutPaintVertexArray.emplace( + r, + l.tl[0], + l.tl[1], + l.br[0], + l.br[1], + u.tl[0], + u.tl[1], + u.br[0], + u.br[1], + l.pixelRatio, + u.pixelRatio, + ); + } + upload(t) { + this.zoomInPaintVertexArray && + this.zoomInPaintVertexArray.arrayBuffer && + this.zoomOutPaintVertexArray && + this.zoomOutPaintVertexArray.arrayBuffer && + ((this.zoomInPaintVertexBuffer = t.createVertexBuffer( + this.zoomInPaintVertexArray, + ga.members, + this.expression.isStateDependent, + )), + (this.zoomOutPaintVertexBuffer = t.createVertexBuffer( + this.zoomOutPaintVertexArray, + ga.members, + this.expression.isStateDependent, + ))); + } + destroy() { + this.zoomOutPaintVertexBuffer && + this.zoomOutPaintVertexBuffer.destroy(), + this.zoomInPaintVertexBuffer && + this.zoomInPaintVertexBuffer.destroy(); + } + } + class $a { + constructor(t, e, r) { + (this.binders = {}), (this._buffers = []); + const n = []; + for (const i in t.paint._values) { + if (!r(i)) continue; + const a = t.paint.get(i); + if (!(a instanceof si && br(a.property.specification))) continue; + const s = Oa(i, t.type), + o = a.value, + l = a.property.specification.type, + u = a.property.useIntegerZoom, + c = a.property.specification['property-type'], + h = 'cross-faded' === c || 'cross-faded-data-driven' === c; + if ('constant' === o.kind) + (this.binders[i] = h ? new Fa(o.value, s) : new Ea(o.value, s, l)), + n.push(`/u_${i}`); + else if ('source' === o.kind || h) { + const r = Ua(i, l, 'source'); + (this.binders[i] = h + ? new Da(o, l, u, e, r, t.id) + : new Ta(o, s, l, r)), + n.push(`/a_${i}`); + } else { + const t = Ua(i, l, 'composite'); + (this.binders[i] = new La(o, s, l, u, e, t)), n.push(`/z_${i}`); + } + } + this.cacheKey = n.sort().join(''); + } + getMaxValue(t) { + const e = this.binders[t]; + return e instanceof Ta || e instanceof La ? e.maxValue : 0; + } + populatePaintArrays(t, e, r, n, i) { + for (const a in this.binders) { + const s = this.binders[a]; + (s instanceof Ta || s instanceof La || s instanceof Da) && + s.populatePaintArray(t, e, r, n, i); + } + } + setConstantPatternPositions(t, e) { + for (const r in this.binders) { + const n = this.binders[r]; + n instanceof Fa && n.setConstantPatternPositions(t, e); + } + } + updatePaintArrays(t, e, r, n, i) { + let a = !1; + for (const s in t) { + const o = e.getPositions(s); + for (const e of o) { + const o = r.feature(e.index); + for (const r in this.binders) { + const l = this.binders[r]; + if ( + (l instanceof Ta || l instanceof La || l instanceof Da) && + !0 === l.expression.isStateDependent + ) { + const u = n.paint.get(r); + (l.expression = u.value), + l.updatePaintArray(e.start, e.end, o, t[s], i), + (a = !0); + } + } + } + } + return a; + } + defines() { + const t = []; + for (const e in this.binders) { + const r = this.binders[e]; + (r instanceof Ea || r instanceof Fa) && + t.push(...r.uniformNames.map((t) => `#define HAS_UNIFORM_${t}`)); + } + return t; + } + getBinderAttributes() { + const t = []; + for (const e in this.binders) { + const r = this.binders[e]; + if (r instanceof Ta || r instanceof La) + for (let e = 0; e < r.paintVertexAttributes.length; e++) + t.push(r.paintVertexAttributes[e].name); + else if (r instanceof Da) + for (let e = 0; e < ga.members.length; e++) + t.push(ga.members[e].name); + } + return t; + } + getBinderUniforms() { + const t = []; + for (const e in this.binders) { + const r = this.binders[e]; + if (r instanceof Ea || r instanceof Fa || r instanceof La) + for (const e of r.uniformNames) t.push(e); + } + return t; + } + getPaintVertexBuffers() { + return this._buffers; + } + getUniforms(t, e) { + const r = []; + for (const n in this.binders) { + const i = this.binders[n]; + if (i instanceof Ea || i instanceof Fa || i instanceof La) + for (const a of i.uniformNames) + if (e[a]) { + const s = i.getBinding(t, e[a], a); + r.push({ name: a, property: n, binding: s }); + } + } + return r; + } + setUniforms(t, e, r, n) { + for (const { name: t, property: i, binding: a } of e) + this.binders[i].setUniform(a, n, r.get(i), t); + } + updatePaintBuffers(t) { + this._buffers = []; + for (const e in this.binders) { + const r = this.binders[e]; + if (t && r instanceof Da) { + const e = + 2 === t.fromScale + ? r.zoomInPaintVertexBuffer + : r.zoomOutPaintVertexBuffer; + e && this._buffers.push(e); + } else + (r instanceof Ta || r instanceof La) && + r.paintVertexBuffer && + this._buffers.push(r.paintVertexBuffer); + } + } + upload(t) { + for (const e in this.binders) { + const r = this.binders[e]; + (r instanceof Ta || r instanceof La || r instanceof Da) && + r.upload(t); + } + this.updatePaintBuffers(); + } + destroy() { + for (const t in this.binders) { + const e = this.binders[t]; + (e instanceof Ta || e instanceof La || e instanceof Da) && + e.destroy(); + } + } + } + class Ra { + constructor(t, e, r = () => !0) { + this.programConfigurations = {}; + for (const n of t) this.programConfigurations[n.id] = new $a(n, e, r); + (this.needsUpload = !1), + (this._featureMap = new Aa()), + (this._bufferOffset = 0); + } + populatePaintArrays(t, e, r, n, i, a) { + for (const r in this.programConfigurations) + this.programConfigurations[r].populatePaintArrays(t, e, n, i, a); + void 0 !== e.id && this._featureMap.add(e.id, r, this._bufferOffset, t), + (this._bufferOffset = t), + (this.needsUpload = !0); + } + updatePaintArrays(t, e, r, n) { + for (const i of r) + this.needsUpload = + this.programConfigurations[i.id].updatePaintArrays( + t, + this._featureMap, + e, + i, + n, + ) || this.needsUpload; + } + get(t) { + return this.programConfigurations[t]; + } + upload(t) { + if (this.needsUpload) { + for (const e in this.programConfigurations) + this.programConfigurations[e].upload(t); + this.needsUpload = !1; + } + } + destroy() { + for (const t in this.programConfigurations) + this.programConfigurations[t].destroy(); + } + } + function Oa(t, e) { + return ( + { + 'text-opacity': ['opacity'], + 'icon-opacity': ['opacity'], + 'text-color': ['fill_color'], + 'icon-color': ['fill_color'], + 'text-halo-color': ['halo_color'], + 'icon-halo-color': ['halo_color'], + 'text-halo-blur': ['halo_blur'], + 'icon-halo-blur': ['halo_blur'], + 'text-halo-width': ['halo_width'], + 'icon-halo-width': ['halo_width'], + 'line-gap-width': ['gapwidth'], + 'line-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + 'fill-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + 'fill-extrusion-pattern': [ + 'pattern_to', + 'pattern_from', + 'pixel_ratio_to', + 'pixel_ratio_from', + ], + }[t] || [t.replace(`${e}-`, '').replace(/-/g, '_')] + ); + } + function Ua(t, e, r) { + const n = { + color: { source: Si, composite: qi }, + number: { source: Di, composite: Si }, + }, + i = (function (t) { + return { + 'line-pattern': { source: aa, composite: aa }, + 'fill-pattern': { source: aa, composite: aa }, + 'fill-extrusion-pattern': { source: aa, composite: aa }, + }[t]; + })(t); + return (i && i[r]) || n[e][r]; + } + Mn('ConstantBinder', Ea), + Mn('CrossFadedConstantBinder', Fa), + Mn('SourceExpressionBinder', Ta), + Mn('CrossFadedCompositeBinder', Da), + Mn('CompositeExpressionBinder', La), + Mn('ProgramConfiguration', $a, { omit: ['_buffers'] }), + Mn('ProgramConfigurationSet', Ra); + var qa = 8192; + const ja = Math.pow(2, 14) - 1, + Na = -ja - 1; + function Za(t) { + const e = qa / t.extent, + r = t.loadGeometry(); + for (let t = 0; t < r.length; t++) { + const n = r[t]; + for (let t = 0; t < n.length; t++) { + const r = n[t], + i = Math.round(r.x * e), + s = Math.round(r.y * e); + (r.x = a(i, Na, ja)), + (r.y = a(s, Na, ja)), + (i < r.x || i > r.x + 1 || s < r.y || s > r.y + 1) && + d( + 'Geometry exceeds allowed extent, reduce your vector tile buffer size', + ); + } + } + return r; + } + function Ka(t, e) { + return { + type: t.type, + id: t.id, + properties: t.properties, + geometry: e ? Za(t) : [], + }; + } + function Ga(t, e, r, n, i) { + t.emplaceBack(2 * e + (n + 1) / 2, 2 * r + (i + 1) / 2); + } + class Ja { + constructor(t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map((t) => t.id)), + (this.index = t.index), + (this.hasPattern = !1), + (this.layoutVertexArray = new ta()), + (this.indexArray = new ha()), + (this.segments = new ya()), + (this.programConfigurations = new Ra(t.layers, t.zoom)), + (this.stateDependentLayerIds = this.layers + .filter((t) => t.isStateDependent()) + .map((t) => t.id)); + } + populate(t, e, r) { + const n = this.layers[0], + i = []; + let a = null, + s = !1; + 'circle' === n.type && + ((a = n.layout.get('circle-sort-key')), (s = !a.isConstant())); + for (const { feature: e, id: n, index: o, sourceLayerIndex: l } of t) { + const t = this.layers[0]._featureFilter.needGeometry, + u = Ka(e, t); + if (!this.layers[0]._featureFilter.filter(new Qn(this.zoom), u, r)) + continue; + const c = s ? a.evaluate(u, {}, r) : void 0, + h = { + id: n, + properties: e.properties, + type: e.type, + sourceLayerIndex: l, + index: o, + geometry: t ? u.geometry : Za(e), + patterns: {}, + sortKey: c, + }; + i.push(h); + } + s && i.sort((t, e) => t.sortKey - e.sortKey); + for (const n of i) { + const { geometry: i, index: a, sourceLayerIndex: s } = n, + o = t[a].feature; + this.addFeature(n, i, a, r), + e.featureIndex.insert(o, i, a, s, this.index); + } + } + update(t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + } + isEmpty() { + return 0 === this.layoutVertexArray.length; + } + uploadPending() { + return !this.uploaded || this.programConfigurations.needsUpload; + } + upload(t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + da, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy()); + } + addFeature(t, e, r, n) { + for (const r of e) + for (const e of r) { + const r = e.x, + n = e.y; + if (r < 0 || r >= qa || n < 0 || n >= qa) continue; + const i = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + t.sortKey, + ), + a = i.vertexLength; + Ga(this.layoutVertexArray, r, n, -1, -1), + Ga(this.layoutVertexArray, r, n, 1, -1), + Ga(this.layoutVertexArray, r, n, 1, 1), + Ga(this.layoutVertexArray, r, n, -1, 1), + this.indexArray.emplaceBack(a, a + 1, a + 2), + this.indexArray.emplaceBack(a, a + 3, a + 2), + (i.vertexLength += 4), + (i.primitiveLength += 2); + } + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + {}, + n, + ); + } + } + function Xa(t, e) { + for (let r = 0; r < t.length; r++) if (is(e, t[r])) return !0; + for (let r = 0; r < e.length; r++) if (is(t, e[r])) return !0; + return !!Qa(t, e); + } + function Ya(t, e, r) { + return !!is(t, e) || !!es(e, t, r); + } + function Ha(t, e) { + if (1 === t.length) return ns(e, t[0]); + for (let r = 0; r < e.length; r++) { + const n = e[r]; + for (let e = 0; e < n.length; e++) if (is(t, n[e])) return !0; + } + for (let r = 0; r < t.length; r++) if (ns(e, t[r])) return !0; + for (let r = 0; r < e.length; r++) if (Qa(t, e[r])) return !0; + return !1; + } + function Wa(t, e, r) { + if (t.length > 1) { + if (Qa(t, e)) return !0; + for (let n = 0; n < e.length; n++) if (es(e[n], t, r)) return !0; + } + for (let n = 0; n < t.length; n++) if (es(t[n], e, r)) return !0; + return !1; + } + function Qa(t, e) { + if (0 === t.length || 0 === e.length) return !1; + for (let r = 0; r < t.length - 1; r++) { + const n = t[r], + i = t[r + 1]; + for (let t = 0; t < e.length - 1; t++) + if (ts(n, i, e[t], e[t + 1])) return !0; + } + return !1; + } + function ts(t, e, r, n) { + return y(t, r, n) !== y(e, r, n) && y(t, e, r) !== y(t, e, n); + } + function es(t, e, r) { + const n = r * r; + if (1 === e.length) return t.distSqr(e[0]) < n; + for (let r = 1; r < e.length; r++) + if (rs(t, e[r - 1], e[r]) < n) return !0; + return !1; + } + function rs(t, e, r) { + const n = e.distSqr(r); + if (0 === n) return t.distSqr(e); + const i = ((t.x - e.x) * (r.x - e.x) + (t.y - e.y) * (r.y - e.y)) / n; + return t.distSqr(i < 0 ? e : i > 1 ? r : r.sub(e)._mult(i)._add(e)); + } + function ns(t, e) { + let r, + n, + i, + a = !1; + for (let s = 0; s < t.length; s++) { + r = t[s]; + for (let t = 0, s = r.length - 1; t < r.length; s = t++) + (n = r[t]), + (i = r[s]), + n.y > e.y != i.y > e.y && + e.x < ((i.x - n.x) * (e.y - n.y)) / (i.y - n.y) + n.x && + (a = !a); + } + return a; + } + function is(t, e) { + let r = !1; + for (let n = 0, i = t.length - 1; n < t.length; i = n++) { + const a = t[n], + s = t[i]; + a.y > e.y != s.y > e.y && + e.x < ((s.x - a.x) * (e.y - a.y)) / (s.y - a.y) + a.x && + (r = !r); + } + return r; + } + function as(t, e, r) { + const n = r[0], + i = r[2]; + if ( + (t.x < n.x && e.x < n.x) || + (t.x > i.x && e.x > i.x) || + (t.y < n.y && e.y < n.y) || + (t.y > i.y && e.y > i.y) + ) + return !1; + const a = y(t, e, r[0]); + return a !== y(t, e, r[1]) || a !== y(t, e, r[2]) || a !== y(t, e, r[3]); + } + function ss(t, e, r) { + const n = e.paint.get(t).value; + return 'constant' === n.kind + ? n.value + : r.programConfigurations.get(e.id).getMaxValue(t); + } + function os(t) { + return Math.sqrt(t[0] * t[0] + t[1] * t[1]); + } + function ls(t, e, r, n, i) { + if (!e[0] && !e[1]) return t; + const a = S.convert(e)._mult(i); + 'viewport' === r && a._rotate(-n); + const s = []; + for (let e = 0; e < t.length; e++) s.push(t[e].sub(a)); + return s; + } + Mn('CircleBucket', Ja, { omit: ['layers'] }); + const us = new fi({ + 'circle-sort-key': new ui(nt.layout_circle['circle-sort-key']), + }); + var cs = { + paint: new fi({ + 'circle-radius': new ui(nt.paint_circle['circle-radius']), + 'circle-color': new ui(nt.paint_circle['circle-color']), + 'circle-blur': new ui(nt.paint_circle['circle-blur']), + 'circle-opacity': new ui(nt.paint_circle['circle-opacity']), + 'circle-translate': new li(nt.paint_circle['circle-translate']), + 'circle-translate-anchor': new li( + nt.paint_circle['circle-translate-anchor'], + ), + 'circle-pitch-scale': new li(nt.paint_circle['circle-pitch-scale']), + 'circle-pitch-alignment': new li( + nt.paint_circle['circle-pitch-alignment'], + ), + 'circle-stroke-width': new ui(nt.paint_circle['circle-stroke-width']), + 'circle-stroke-color': new ui(nt.paint_circle['circle-stroke-color']), + 'circle-stroke-opacity': new ui( + nt.paint_circle['circle-stroke-opacity'], + ), + }), + layout: us, + }, + hs = 1e-6, + ps = 'undefined' != typeof Float32Array ? Float32Array : Array; + function fs() { + var t = new ps(9); + return ( + ps != Float32Array && + ((t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[5] = 0), + (t[6] = 0), + (t[7] = 0)), + (t[0] = 1), + (t[4] = 1), + (t[8] = 1), + t + ); + } + function ds(t) { + return ( + (t[0] = 1), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = 1), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = 1), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0), + (t[15] = 1), + t + ); + } + function ys(t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + s = e[3], + o = e[4], + l = e[5], + u = e[6], + c = e[7], + h = e[8], + p = e[9], + f = e[10], + d = e[11], + y = e[12], + m = e[13], + g = e[14], + x = e[15], + v = r[0], + b = r[1], + w = r[2], + _ = r[3]; + return ( + (t[0] = v * n + b * o + w * h + _ * y), + (t[1] = v * i + b * l + w * p + _ * m), + (t[2] = v * a + b * u + w * f + _ * g), + (t[3] = v * s + b * c + w * d + _ * x), + (t[4] = + (v = r[4]) * n + (b = r[5]) * o + (w = r[6]) * h + (_ = r[7]) * y), + (t[5] = v * i + b * l + w * p + _ * m), + (t[6] = v * a + b * u + w * f + _ * g), + (t[7] = v * s + b * c + w * d + _ * x), + (t[8] = + (v = r[8]) * n + (b = r[9]) * o + (w = r[10]) * h + (_ = r[11]) * y), + (t[9] = v * i + b * l + w * p + _ * m), + (t[10] = v * a + b * u + w * f + _ * g), + (t[11] = v * s + b * c + w * d + _ * x), + (t[12] = + (v = r[12]) * n + + (b = r[13]) * o + + (w = r[14]) * h + + (_ = r[15]) * y), + (t[13] = v * i + b * l + w * p + _ * m), + (t[14] = v * a + b * u + w * f + _ * g), + (t[15] = v * s + b * c + w * d + _ * x), + t + ); + } + Math.hypot || + (Math.hypot = function () { + for (var t = 0, e = arguments.length; e--; ) + t += arguments[e] * arguments[e]; + return Math.sqrt(t); + }); + var ms, + gs = ys; + function xs() { + var t = new ps(3); + return ps != Float32Array && ((t[0] = 0), (t[1] = 0), (t[2] = 0)), t; + } + function vs(t, e, r) { + var n = new ps(3); + return (n[0] = t), (n[1] = e), (n[2] = r), n; + } + function bs(t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + s = e[3]; + return ( + (t[0] = r[0] * n + r[4] * i + r[8] * a + r[12] * s), + (t[1] = r[1] * n + r[5] * i + r[9] * a + r[13] * s), + (t[2] = r[2] * n + r[6] * i + r[10] * a + r[14] * s), + (t[3] = r[3] * n + r[7] * i + r[11] * a + r[15] * s), + t + ); + } + function ws() { + var t = new ps(4); + return ( + ps != Float32Array && ((t[0] = 0), (t[1] = 0), (t[2] = 0)), + (t[3] = 1), + t + ); + } + function _s(t, e) { + const r = bs([], [t.x, t.y, 0, 1], e); + return new S(r[0] / r[3], r[1] / r[3]); + } + xs(), + (ms = new ps(4)), + ps != Float32Array && + ((ms[0] = 0), (ms[1] = 0), (ms[2] = 0), (ms[3] = 0)), + xs(), + vs(1, 0, 0), + vs(0, 1, 0), + ws(), + ws(), + fs(), + (function () { + var t; + (t = new ps(2)), ps != Float32Array && ((t[0] = 0), (t[1] = 0)); + })(); + class As extends Ja {} + Mn('HeatmapBucket', As, { omit: ['layers'] }); + var ks = { + paint: new fi({ + 'heatmap-radius': new ui(nt.paint_heatmap['heatmap-radius']), + 'heatmap-weight': new ui(nt.paint_heatmap['heatmap-weight']), + 'heatmap-intensity': new li(nt.paint_heatmap['heatmap-intensity']), + 'heatmap-color': new pi(nt.paint_heatmap['heatmap-color']), + 'heatmap-opacity': new li(nt.paint_heatmap['heatmap-opacity']), + }), + }; + function Ss(t, { width: e, height: r }, n, i) { + if (i) { + if (i instanceof Uint8ClampedArray) i = new Uint8Array(i.buffer); + else if (i.length !== e * r * n) + throw new RangeError( + `mismatched image size. expected: ${i.length} but got: ${ + e * r * n + }`, + ); + } else i = new Uint8Array(e * r * n); + return (t.width = e), (t.height = r), (t.data = i), t; + } + function Is(t, { width: e, height: r }, n) { + if (e === t.width && r === t.height) return; + const i = Ss({}, { width: e, height: r }, n); + Ms( + t, + i, + { x: 0, y: 0 }, + { x: 0, y: 0 }, + { width: Math.min(t.width, e), height: Math.min(t.height, r) }, + n, + ), + (t.width = e), + (t.height = r), + (t.data = i.data); + } + function Ms(t, e, r, n, i, a) { + if (0 === i.width || 0 === i.height) return e; + if ( + i.width > t.width || + i.height > t.height || + r.x > t.width - i.width || + r.y > t.height - i.height + ) + throw new RangeError('out of range source coordinates for image copy'); + if ( + i.width > e.width || + i.height > e.height || + n.x > e.width - i.width || + n.y > e.height - i.height + ) + throw new RangeError( + 'out of range destination coordinates for image copy', + ); + const s = t.data, + o = e.data; + if (s === o) + throw new Error('srcData equals dstData, so image is already copied'); + for (let l = 0; l < i.height; l++) { + const u = ((r.y + l) * t.width + r.x) * a, + c = ((n.y + l) * e.width + n.x) * a; + for (let t = 0; t < i.width * a; t++) o[c + t] = s[u + t]; + } + return e; + } + class zs { + constructor(t, e) { + Ss(this, t, 1, e); + } + resize(t) { + Is(this, t, 1); + } + clone() { + return new zs( + { width: this.width, height: this.height }, + new Uint8Array(this.data), + ); + } + static copy(t, e, r, n, i) { + Ms(t, e, r, n, i, 1); + } + } + class Bs { + constructor(t, e) { + Ss(this, t, 4, e); + } + resize(t) { + Is(this, t, 4); + } + replace(t, e) { + e + ? this.data.set(t) + : (this.data = + t instanceof Uint8ClampedArray ? new Uint8Array(t.buffer) : t); + } + clone() { + return new Bs( + { width: this.width, height: this.height }, + new Uint8Array(this.data), + ); + } + static copy(t, e, r, n, i) { + Ms(t, e, r, n, i, 4); + } + } + function Cs(t) { + const e = {}, + r = t.resolution || 256, + n = t.clips ? t.clips.length : 1, + i = t.image || new Bs({ width: r, height: n }); + if ((Math.log(r) / Math.LN2) % 1 != 0) + throw new Error(`width is not a power of 2 - ${r}`); + const a = (r, n, a) => { + e[t.evaluationKey] = a; + const s = t.expression.evaluate(e); + (i.data[r + n + 0] = Math.floor((255 * s.r) / s.a)), + (i.data[r + n + 1] = Math.floor((255 * s.g) / s.a)), + (i.data[r + n + 2] = Math.floor((255 * s.b) / s.a)), + (i.data[r + n + 3] = Math.floor(255 * s.a)); + }; + if (t.clips) + for (let e = 0, i = 0; e < n; ++e, i += 4 * r) + for (let n = 0, s = 0; n < r; n++, s += 4) { + const o = n / (r - 1), + { start: l, end: u } = t.clips[e]; + a(i, s, l * (1 - o) + u * o); + } + else for (let t = 0, e = 0; t < r; t++, e += 4) a(0, e, t / (r - 1)); + return i; + } + Mn('AlphaImage', zs), Mn('RGBAImage', Bs); + var Ps = { + paint: new fi({ + 'hillshade-illumination-direction': new li( + nt.paint_hillshade['hillshade-illumination-direction'], + ), + 'hillshade-illumination-anchor': new li( + nt.paint_hillshade['hillshade-illumination-anchor'], + ), + 'hillshade-exaggeration': new li( + nt.paint_hillshade['hillshade-exaggeration'], + ), + 'hillshade-shadow-color': new li( + nt.paint_hillshade['hillshade-shadow-color'], + ), + 'hillshade-highlight-color': new li( + nt.paint_hillshade['hillshade-highlight-color'], + ), + 'hillshade-accent-color': new li( + nt.paint_hillshade['hillshade-accent-color'], + ), + }), + }; + const Vs = vi([{ name: 'a_pos', components: 2, type: 'Int16' }], 4), + { members: Es } = Vs; + var Fs = { exports: {} }; + function Ts(t, e, r) { + r = r || 2; + var n, + i, + a, + s, + o, + l, + u, + c = e && e.length, + h = c ? e[0] * r : t.length, + p = Ls(t, 0, h, r, !0), + f = []; + if (!p || p.next === p.prev) return f; + if ( + (c && + (p = (function (t, e, r, n) { + var i, + a, + s, + o = []; + for (i = 0, a = e.length; i < a; i++) + (s = Ls( + t, + e[i] * n, + i < a - 1 ? e[i + 1] * n : t.length, + n, + !1, + )) === s.next && (s.steiner = !0), + o.push(Gs(s)); + for (o.sort(js), i = 0; i < o.length; i++) r = Ns(o[i], r); + return r; + })(t, e, p, r)), + t.length > 80 * r) + ) { + (n = a = t[0]), (i = s = t[1]); + for (var d = r; d < h; d += r) + (o = t[d]) < n && (n = o), + (l = t[d + 1]) < i && (i = l), + o > a && (a = o), + l > s && (s = l); + u = 0 !== (u = Math.max(a - n, s - i)) ? 32767 / u : 0; + } + return $s(p, f, r, n, i, u, 0), f; + } + function Ls(t, e, r, n, i) { + var a, s; + if (i === so(t, e, r, n) > 0) + for (a = e; a < r; a += n) s = no(a, t[a], t[a + 1], s); + else for (a = r - n; a >= e; a -= n) s = no(a, t[a], t[a + 1], s); + return s && Hs(s, s.next) && (io(s), (s = s.next)), s; + } + function Ds(t, e) { + if (!t) return t; + e || (e = t); + var r, + n = t; + do { + if ( + ((r = !1), + n.steiner || (!Hs(n, n.next) && 0 !== Ys(n.prev, n, n.next))) + ) + n = n.next; + else { + if ((io(n), (n = e = n.prev) === n.next)) break; + r = !0; + } + } while (r || n !== e); + return e; + } + function $s(t, e, r, n, i, a, s) { + if (t) { + !s && + a && + (function (t, e, r, n) { + var i = t; + do { + 0 === i.z && (i.z = Ks(i.x, i.y, e, r, n)), + (i.prevZ = i.prev), + (i.nextZ = i.next), + (i = i.next); + } while (i !== t); + (i.prevZ.nextZ = null), + (i.prevZ = null), + (function (t) { + var e, + r, + n, + i, + a, + s, + o, + l, + u = 1; + do { + for (r = t, t = null, a = null, s = 0; r; ) { + for ( + s++, n = r, o = 0, e = 0; + e < u && (o++, (n = n.nextZ)); + e++ + ); + for (l = u; o > 0 || (l > 0 && n); ) + 0 !== o && (0 === l || !n || r.z <= n.z) + ? ((i = r), (r = r.nextZ), o--) + : ((i = n), (n = n.nextZ), l--), + a ? (a.nextZ = i) : (t = i), + (i.prevZ = a), + (a = i); + r = n; + } + (a.nextZ = null), (u *= 2); + } while (s > 1); + })(i); + })(t, n, i, a); + for (var o, l, u = t; t.prev !== t.next; ) + if (((o = t.prev), (l = t.next), a ? Os(t, n, i, a) : Rs(t))) + e.push((o.i / r) | 0), + e.push((t.i / r) | 0), + e.push((l.i / r) | 0), + io(t), + (t = l.next), + (u = l.next); + else if ((t = l) === u) { + s + ? 1 === s + ? $s((t = Us(Ds(t), e, r)), e, r, n, i, a, 2) + : 2 === s && qs(t, e, r, n, i, a) + : $s(Ds(t), e, r, n, i, a, 1); + break; + } + } + } + function Rs(t) { + var e = t.prev, + r = t, + n = t.next; + if (Ys(e, r, n) >= 0) return !1; + for ( + var i = e.x, + a = r.x, + s = n.x, + o = e.y, + l = r.y, + u = n.y, + c = i < a ? (i < s ? i : s) : a < s ? a : s, + h = o < l ? (o < u ? o : u) : l < u ? l : u, + p = i > a ? (i > s ? i : s) : a > s ? a : s, + f = o > l ? (o > u ? o : u) : l > u ? l : u, + d = n.next; + d !== e; -define(["./shared"],(function(e){"use strict";function t(e){const o=typeof e;if("number"===o||"boolean"===o||"string"===o||null==e)return JSON.stringify(e);if(Array.isArray(e)){let o="[";for(const i of e)o+=`${t(i)},`;return `${o}]`}const i=Object.keys(e).sort();let r="{";for(let o=0;othis._layers[e.id])),o=t[0];if("none"===o.visibility)continue;const i=o.source||"";let r=this.familiesBySource[i];r||(r=this.familiesBySource[i]={});const n=o.sourceLayer||"_geojsonTileLayer";let s=r[n];s||(s=r[n]=[]),s.push(t);}}}class r{constructor(t){const o={},i=[];for(const e in t){const r=t[e],n=o[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const o={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(o),n[e]={rect:o,metrics:t.metrics};}}const{w:r,h:n}=e.potpack(i),s=new e.AlphaImage({width:r||1,height:n||1});for(const i in t){const r=t[i];for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const a=o[i][t].rect;e.AlphaImage.copy(n.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},n.bitmap);}}this.image=s,this.positions=o;}}e.register("GlyphAtlas",r);class n{constructor(t){this.tileID=new e.OverscaledTileID(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,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;}parse(t,o,i,n,a){this.status="parsing",this.data=t,this.collisionBoxArray=new e.CollisionBoxArray;const l=new e.DictionaryCoder(Object.keys(t.layers).sort()),c=new e.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:i},p=o.familiesBySource[this.source];for(const o in p){const r=t.layers[o];if(!r)continue;1===r.version&&e.warnOnce(`Vector tile source "${this.source}" layer "${o}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=l.encode(o),a=[];for(let e=0;e=o.maxzoom||"none"!==o.visibility&&(s(t,this.zoom,i),(u[o.id]=o.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))));}}let f,d,g,m;const y=e.mapObject(h.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(y).length?n.send("getGlyphs",{uid:this.uid,stacks:y},((e,t)=>{f||(f=e,d=t,w.call(this));})):d={};const v=Object.keys(h.iconDependencies);v.length?n.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,g=t,w.call(this));})):g={};const x=Object.keys(h.patternDependencies);function w(){if(f)return a(f);if(d&&g&&m){const t=new r(d),o=new e.ImageAtlas(g,m);for(const r in u){const n=u[r];n instanceof e.SymbolBucket?(s(n.layers,this.zoom,i),e.performSymbolLayout({bucket:n,glyphMap:d,glyphPositions:t.positions,imageMap:g,imagePositions:o.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):n.hasPattern&&(n instanceof e.LineBucket||n instanceof e.FillBucket||n instanceof e.FillExtrusionBucket)&&(s(n.layers,this.zoom,i),n.addFeatures(h,this.tileID.canonical,o.patternPositions));}this.status="done",a(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:o,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?t.positions:null});}}x.length?n.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,m=t,w.call(this));})):m={},w.call(this);}}function s(t,o,i){const r=new e.EvaluationParameters(o);for(const e of t)e.recalculate(r,i);}function a(t,o){const i=e.getArrayBuffer(t.request,((t,i,r,n)=>{t?o(t):i&&o(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(i)),rawData:i,cacheControl:r,expires:n});}));return ()=>{i.cancel(),o();}}class l{constructor(e,t,o,i){this.actor=e,this.layerIndex=t,this.availableImages=o,this.loadVectorData=i||a,this.loading={},this.loaded={};}loadTile(t,o){const i=t.uid;this.loading||(this.loading={});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),s=this.loading[i]=new n(t);s.abort=this.loadVectorData(t,((t,n)=>{if(delete this.loading[i],t||!n)return s.status="done",this.loaded[i]=s,o(t);const a=n.rawData,l={};n.expires&&(l.expires=n.expires),n.cacheControl&&(l.cacheControl=n.cacheControl);const c={};if(r){const e=r.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)));}s.vectorTile=n.vectorTile,s.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,i)=>{if(t||!i)return o(t);o(null,e.extend({rawTileData:a.slice(0)},i,l,c));})),this.loaded=this.loaded||{},this.loaded[i]=s;}));}reloadTile(e,t){const o=this.loaded,i=e.uid,r=this;if(o&&o[i]){const n=o[i];n.showCollisionBoxes=e.showCollisionBoxes;const s=(e,o)=>{const i=n.reloadCallback;i&&(delete n.reloadCallback,n.parse(n.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),t(e,o);};"parsing"===n.status?n.reloadCallback=s:"done"===n.status&&(n.vectorTile?n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s());}}abortTile(e,t){const o=this.loading,i=e.uid;o&&o[i]&&o[i].abort&&(o[i].abort(),delete o[i]),t();}removeTile(e,t){const o=this.loaded,i=e.uid;o&&o[i]&&delete o[i],t();}}class c{constructor(){this.loaded={};}loadTile(t,o){const{uid:i,encoding:r,rawImageData:n}=t,s=e.isImageBitmap(n)?this.getImageData(n):n,a=new e.DEMData(i,s,r);this.loaded=this.loaded||{},this.loaded[i]=a,o(null,a);}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const o=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:o.width,height:o.height},o.data)}removeTile(e){const t=this.loaded,o=e.uid;t&&t[o]&&delete t[o];}}var u=function e(t,o){var i,r=t&&t.type;if("FeatureCollection"===r)for(i=0;i=Math.abs(a)?o-l+a:a-l+o,o=l;}o+i>=0!=!!t&&e.reverse();}const f=e.vectorTile.VectorTileFeature.prototype.toGeoJSON;class d{constructor(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));}loadGeometry(){if(1===this._feature.type){const t=[];for(const o of this._feature.geometry)t.push([new e.pointGeometry(o[0],o[1])]);return t}{const t=[];for(const o of this._feature.geometry){const i=[];for(const t of o)i.push(new e.pointGeometry(t[0],t[1]));t.push(i);}return t}}toGeoJSON(e,t,o){return f.call(this,e,t,o)}}class g{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=t.length,this._features=t;}feature(e){return new d(this._features[e])}}var m={exports:{}},y=e.pointGeometry,v=e.vectorTile.VectorTileFeature,x=w;function w(e,t){this.options=t||{},this.features=e,this.length=e.length;}function S(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;}w.prototype.feature=function(e){return new S(this.features[e],this.options.extent)},S.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t>31}function D(e,t){for(var o=e.loadGeometry(),i=e.type,r=0,n=0,s=o.length,a=0;a>1;O(e,t,s,i,r,n%2),z(e,t,o,i,s-1,n+1),z(e,t,o,s+1,r,n+1);}function O(e,t,o,i,r,n){for(;r>i;){if(r-i>600){const s=r-i+1,a=o-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);O(e,t,o,Math.max(i,Math.floor(o-a*c/s+u)),Math.min(r,Math.floor(o+(s-a)*c/s+u)),n);}const s=t[2*o+n];let a=i,l=r;for(E(e,t,i,o),t[2*r+n]>s&&E(e,t,i,r);as;)l--;}t[2*i+n]===s?E(e,t,i,l):(l++,E(e,t,l,r)),l<=o&&(i=l+1),o<=l&&(r=l-1);}}function E(e,t,o,i){F(e,o,i),F(t,2*o,2*i),F(t,2*o+1,2*i+1);}function F(e,t,o){const i=e[t];e[t]=e[o],e[o]=i;}function N(e,t,o,i){const r=e-o,n=t-i;return r*r+n*n}m.exports=b,m.exports.fromVectorTileJs=b,m.exports.fromGeojsonVt=function(e,t){t=t||{};var o={};for(var i in e)o[i]=new I(e[i].features,t),o[i].name=i,o[i].version=t.version,o[i].extent=t.extent;return b({layers:o})},m.exports.GeoJSONWrapper=I;const A=e=>e[0],B=e=>e[1];class J{constructor(e,t=A,o=B,i=64,r=Float64Array){this.nodeSize=i,this.points=e;const n=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new n(e.length),a=this.coords=new r(2*e.length);for(let i=0;i=o&&c<=r&&u>=i&&u<=n&&l.push(e[s]);continue}const d=Math.floor((f+p)/2);c=t[2*d],u=t[2*d+1],c>=o&&c<=r&&u>=i&&u<=n&&l.push(e[d]);const g=(h+1)%2;(0===h?o<=c:i<=u)&&(a.push(f),a.push(d-1),a.push(g)),(0===h?r>=c:n>=u)&&(a.push(d+1),a.push(p),a.push(g));}return l}(this.ids,this.coords,e,t,o,i,this.nodeSize)}within(e,t,o){return function(e,t,o,i,r,n){const s=[0,e.length-1,0],a=[],l=r*r;for(;s.length;){const c=s.pop(),u=s.pop(),h=s.pop();if(u-h<=n){for(let r=h;r<=u;r++)N(t[2*r],t[2*r+1],o,i)<=l&&a.push(e[r]);continue}const p=Math.floor((h+u)/2),f=t[2*p],d=t[2*p+1];N(f,d,o,i)<=l&&a.push(e[p]);const g=(c+1)%2;(0===c?o-r<=f:i-r<=d)&&(s.push(h),s.push(p-1),s.push(g)),(0===c?o+r>=f:i+r>=d)&&(s.push(p+1),s.push(u),s.push(g));}return a}(this.ids,this.coords,e,t,o,this.nodeSize)}}const Z={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},G=Math.fround||(j=new Float32Array(1),e=>(j[0]=+e,j[0]));var j;class Y{constructor(e){this.options=H(Object.create(Z),e),this.trees=new Array(this.options.maxZoom+1);}load(e){const{log:t,minZoom:o,maxZoom:i,nodeSize:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;let s=[];for(let t=0;t=o;e--){const o=+Date.now();s=this._cluster(s,e),this.trees[e]=new J(s,K,Q,r,Float32Array),t&&console.log("z%d: %d clusters in %dms",e,s.length,+Date.now()-o);}return t&&console.timeEnd("total time"),this}getClusters(e,t){let o=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,r=180;else if(o>r){const e=this.getClusters([o,i,180,n],t),s=this.getClusters([-180,i,r,n],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range($(o),q(n),$(r),q(i)),l=[];for(const e of a){const t=s.points[e];l.push(t.numPoints?R(t):this.points[t.index]);}return l}getChildren(e){const t=this._getOriginId(e),o=this._getOriginZoom(e),i="No cluster with the specified id.",r=this.trees[o];if(!r)throw new Error(i);const n=r.points[t];if(!n)throw new Error(i);const s=this.options.radius/(this.options.extent*Math.pow(2,o-1)),a=r.within(n.x,n.y,s),l=[];for(const t of a){const o=r.points[t];o.parentId===e&&l.push(o.numPoints?R(o):this.points[o.index]);}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,o){const i=[];return this._appendLeaves(i,e,t=t||10,o=o||0,0),i}getTile(e,t,o){const i=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:n,radius:s}=this.options,a=s/n,l=(o-a)/r,c=(o+1+a)/r,u={features:[]};return this._addTileFeatures(i.range((t-a)/r,l,(t+1+a)/r,c),i.points,t,o,r,u),0===t&&this._addTileFeatures(i.range(1-a/r,l,1,c),i.points,r,o,r,u),t===r-1&&this._addTileFeatures(i.range(0,l,a/r,c),i.points,-1,o,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const o=this.getChildren(e);if(t++,1!==o.length)break;e=o[0].properties.cluster_id;}return t}_appendLeaves(e,t,o,i,r){const n=this.getChildren(t);for(const t of n){const n=t.properties;if(n&&n.cluster?r+n.point_count<=i?r+=n.point_count:r=this._appendLeaves(e,n.cluster_id,o,i,r):rt&&(h+=o.numPoints||1);}if(h>u&&h>=s){let e=r.x*u,s=r.y*u,a=n&&u>1?this._map(r,!0):null;const p=(i<<5)+(t+1)+this.points.length;for(const o of c){const i=l.points[o];if(i.zoom<=t)continue;i.zoom=t;const c=i.numPoints||1;e+=i.x*c,s+=i.y*c,i.parentId=p,n&&(a||(a=this._map(r,!0)),n(a,this._map(i)));}r.parentId=p,o.push(V(e/h,s/h,p,h,a));}else if(o.push(r),h>1)for(const e of c){const i=l.points[e];i.zoom<=t||(i.zoom=t,o.push(i));}}return o}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?H({},e.properties):e.properties;const o=this.points[e.index].properties,i=this.options.map(o);return t&&i===o?H({},i):i}}function V(e,t,o,i,r){return {x:G(e),y:G(t),zoom:1/0,id:o,parentId:-1,numPoints:i,properties:r}}function X(e,t){const[o,i]=e.geometry.coordinates;return {x:G($(o)),y:G(q(i)),zoom:1/0,index:t,parentId:-1}}function R(e){return {type:"Feature",id:e.id,properties:W(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),U(e.y)]}};var t;}function W(e){const t=e.numPoints,o=t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?Math.round(t/100)/10+"k":t;return H(H({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:o})}function $(e){return e/360+.5}function q(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function U(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function H(e,t){for(const o in t)e[o]=t[o];return e}function K(e){return e.x}function Q(e){return e.y}function ee(e,t,o,i){for(var r,n=i,s=o-t>>1,a=o-t,l=e[t],c=e[t+1],u=e[o],h=e[o+1],p=t+3;pn)r=p,n=f;else if(f===n){var d=Math.abs(p-s);di&&(r-t>3&&ee(e,t,r,i),e[r+2]=n,o-r>3&&ee(e,r,o,i));}function te(e,t,o,i,r,n){var s=r-o,a=n-i;if(0!==s||0!==a){var l=((e-o)*s+(t-i)*a)/(s*s+a*a);l>1?(o=r,i=n):l>0&&(o+=s*l,i+=a*l);}return (s=e-o)*s+(a=t-i)*a}function oe(e,t,o,i){var r={id:void 0===e?null:e,type:t,geometry:o,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,o=e.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)ie(e,t);else if("Polygon"===o||"MultiLineString"===o)for(var i=0;i0&&(s+=i?(r*c-l*n)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-n,2))),r=l,n=c;}var u=t.length-3;t[2]=1,ee(t,0,u,o),t[u+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size;}function ae(e,t,o,i){for(var r=0;r1?1:o}function ue(e,t,o,i,r,n,s,a){if(i/=t,n>=(o/=t)&&s=i)return null;for(var l=[],c=0;c=o&&d=i)){var g=[];if("Point"===p||"MultiPoint"===p)he(h,g,o,i,r);else if("LineString"===p)pe(h,g,o,i,r,!1,a.lineMetrics);else if("MultiLineString"===p)de(h,g,o,i,r,!1);else if("Polygon"===p)de(h,g,o,i,r,!0);else if("MultiPolygon"===p)for(var m=0;m=o&&s<=i&&(t.push(e[n]),t.push(e[n+1]),t.push(e[n+2]));}}function pe(e,t,o,i,r,n,s){for(var a,l,c=fe(e),u=0===r?me:ye,h=e.start,p=0;po&&(l=u(c,f,d,m,y,o),s&&(c.start=h+a*l)):v>i?x=o&&(l=u(c,f,d,m,y,o),w=!0),x>i&&v<=i&&(l=u(c,f,d,m,y,i),w=!0),!n&&w&&(s&&(c.end=h+a*l),t.push(c),c=fe(e)),s&&(h+=a);}var S=e.length-3;f=e[S],d=e[S+1],g=e[S+2],(v=0===r?f:d)>=o&&v<=i&&ge(c,f,d,g),S=c.length-3,n&&S>=3&&(c[S]!==c[0]||c[S+1]!==c[1])&&ge(c,c[0],c[1],c[2]),c.length&&t.push(c);}function fe(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function de(e,t,o,i,r,n){for(var s=0;ss.maxX&&(s.maxX=u),h>s.maxY&&(s.maxY=h);}return s}function Ie(e,t,o,i){var r=t.geometry,n=t.type,s=[];if("Point"===n||"MultiPoint"===n)for(var a=0;a0&&t.size<(r?s:i))o.numPoints+=t.length/3;else {for(var a=[],l=0;ls)&&(o.numSimplified++,a.push(t[l]),a.push(t[l+1])),o.numPoints++;r&&function(e,t){for(var o=0,i=0,r=e.length,n=r-2;i0===t)for(i=0,r=e.length;i24)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 i=function(e,t){var o=[];if("FeatureCollection"===e.type)for(var i=0;i1&&console.time("creation"),p=this.tiles[h]=Me(e,t,o,i,l),this.tileCoords.push({z:t,x:o,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,o,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++;}if(p.source=e,r){if(t===l.maxZoom||t===r)continue;var d=1<1&&console.time("clipping");var g,m,y,v,x,w,S=.5*l.buffer/l.extent,M=.5-S,I=.5+S,b=1+S;g=m=y=v=null,x=ue(e,u,o-S,o+I,0,p.minX,p.maxX,l),w=ue(e,u,o+M,o+b,0,p.minX,p.maxX,l),e=null,x&&(g=ue(x,u,i-S,i+I,1,p.minY,p.maxY,l),m=ue(x,u,i+M,i+b,1,p.minY,p.maxY,l),x=null),w&&(y=ue(w,u,i-S,i+I,1,p.minY,p.maxY,l),v=ue(w,u,i+M,i+b,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*o,2*i),a.push(m||[],t+1,2*o,2*i+1),a.push(y||[],t+1,2*o+1,2*i),a.push(v||[],t+1,2*o+1,2*i+1);}}},ke.prototype.getTile=function(e,t,o){var i=this.options,r=i.extent,n=i.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,o);for(var l,c=e,u=t,h=o;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[Pe(c,u,h)];return l&&l.source?(n>1&&console.log("found parent tile z%d-%d-%d",c,u,h),n>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,e,t,o),n>1&&console.timeEnd("drilling down"),this.tiles[a]?we(this.tiles[a],r):null):null};class Ce extends l{constructor(e,t,o,i){super(e,t,o,Te),i&&(this.loadGeoJSON=i);}loadData(t,o){var i;null===(i=this._pendingRequest)||void 0===i||i.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=o,this._pendingRequest=this.loadGeoJSON(t,((i,n)=>{if(delete this._pendingCallback,delete this._pendingRequest,i||!n)return o(i);if("object"!=typeof n)return o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{u(n,!0);try{if(t.filter){const o=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const i=n.features.filter((e=>o.value.evaluate({zoom:0},e)));n={type:"FeatureCollection",features:i};}this._geoJSONIndex=t.cluster?new Y(function({superclusterOptions:t,clusterProperties:o}){if(!o||!t)return t;const i={},r={},n={accumulated:null,zoom:0},s={properties:null},a=Object.keys(o);for(const t of a){const[n,s]=o[t],a=e.createExpression(s),l=e.createExpression("string"==typeof n?[n,["accumulated"],["get",t]]:n);i[t]=a.value,r[t]=l.value;}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(n,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)n.accumulated=e[t],e[t]=r[t].evaluate(n,s);},t}(t)).load(n.features):function(e,t){return new ke(e,t)}(n,t.geojsonVtOptions);}catch(i){return o(i)}this.loaded={};const s={};if(r){const e=r.finish();e&&(s.resourceTiming={},s.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)));}o(null,s);}}));}reloadTile(e,t){const o=this.loaded;return o&&o[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,o){if(t.request)return e.getJSON(t.request,o);if("string"==typeof t.data)try{o(null,JSON.parse(t.data));}catch(e){o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));}else o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return {cancel:()=>{}}}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t();}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId));}catch(e){t(e);}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId));}catch(e){t(e);}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset));}catch(e){t(e);}}}class _e{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:Ce},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText;};}setReferrer(e,t){this.referrer=t;}setImages(e,t,o){this.availableImages[e]=t;for(const o in this.workerSources[e]){const i=this.workerSources[e][o];for(const e in i)i[e].availableImages=t;}o();}setLayers(e,t,o){this.getLayerIndex(e).replace(t),o();}updateLayers(e,t,o){this.getLayerIndex(e).update(t.layers,t.removedIds),o();}loadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).loadTile(t,o);}loadDEMTile(e,t,o){this.getDEMWorkerSource(e,t.source).loadTile(t,o);}reloadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).reloadTile(t,o);}abortTile(e,t,o){this.getWorkerSource(e,t.type,t.source).abortTile(t,o);}removeTile(e,t,o){this.getWorkerSource(e,t.type,t.source).removeTile(t,o);}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t);}removeSource(e,t,o){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const i=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==i.removeSource?i.removeSource(t,o):o();}loadWorkerSource(e,t,o){try{this.self.importScripts(t.url),o();}catch(e){o(e.toString());}}syncRTLPluginState(t,o,i){try{e.plugin.setState(o);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const o=e.plugin.isParsed();i(o?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),o);}}catch(e){i(e.toString());}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new i),t}getWorkerSource(e,t,o){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][o]){const i={send:(t,o,i)=>{this.actor.send(t,o,i,e);}};this.workerSources[e][t][o]=new this.workerSourceTypes[t](i,this.getLayerIndex(e),this.getAvailableImages(e));}return this.workerSources[e][t][o]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new c),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,o){e.enforceCacheSizeLimit(o);}}return e.isWorker()&&(self.worker=new _e(self)),_e})); + ) { + if ( + d.x >= c && + d.x <= p && + d.y >= h && + d.y <= f && + Js(i, o, a, l, s, u, d.x, d.y) && + Ys(d.prev, d, d.next) >= 0 + ) + return !1; + d = d.next; + } + return !0; + } + function Os(t, e, r, n) { + var i = t.prev, + a = t, + s = t.next; + if (Ys(i, a, s) >= 0) return !1; + for ( + var o = i.x, + l = a.x, + u = s.x, + c = i.y, + h = a.y, + p = s.y, + f = o < l ? (o < u ? o : u) : l < u ? l : u, + d = c < h ? (c < p ? c : p) : h < p ? h : p, + y = o > l ? (o > u ? o : u) : l > u ? l : u, + m = c > h ? (c > p ? c : p) : h > p ? h : p, + g = Ks(f, d, e, r, n), + x = Ks(y, m, e, r, n), + v = t.prevZ, + b = t.nextZ; + v && v.z >= g && b && b.z <= x; -define(["./shared"],(function(t){"use strict";var e=i;function i(t){return !function(t){return "undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return !1;var t,e,i=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(i);try{e=new Worker(o),t=!0;}catch(e){t=!1;}return e&&e.terminate(),URL.revokeObjectURL(o),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return !1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===o[e=t&&t.failIfMajorPerformanceCaveat]&&(o[e]=function(t){var e,o=function(t){var e=document.createElement("canvas"),o=Object.create(i.webGLContextAttributes);return o.failIfMajorPerformanceCaveat=t,e.getContext("webgl",o)||e.getContext("experimental-webgl",o)}(t);if(!o)return !1;try{e=o.createShader(o.VERTEX_SHADER);}catch(t){return !1}return !(!e||o.isContextLost())&&(o.shaderSource(e,"void main() {}"),o.compileShader(e),!0===o.getShaderParameter(e,o.COMPILE_STATUS))}(e)),o[e]?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 e;}(t)}var o={};function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(let i=0;i{window.removeEventListener("click",r.suppressClickInternal,!0);}),0);}static mousePos(e,i){const o=e.getBoundingClientRect();return new t.pointGeometry(i.clientX-o.left-e.clientLeft,i.clientY-o.top-e.clientTop)}static touchPos(e,i){const o=e.getBoundingClientRect(),a=[];for(let r=0;r-1);l++,r[l]=n,s[l]=c,s[l+1]=u;}for(let n=0,l=0;n{let o=this.entries[t];o||(o=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=o.glyphs[e];if(void 0!==a)return void i(null,{stack:t,id:e,glyph:a});if(a=this._tinySDF(o,t,e),a)return o.glyphs[e]=a,void i(null,{stack:t,id:e,glyph:a});const r=Math.floor(e/256);if(256*r>65535)return void i(new Error("glyphs > 65535 not supported"));if(o.ranges[r])return void i(null,{stack:t,id:e,glyph:a});let s=o.requests[r];s||(s=o.requests[r]=[],_.loadGlyphRange(t,r,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(o.glyphs[+t]=e[+t]);o.ranges[r]=!0;}for(const i of s)i(t,e);delete o.requests[r];}))),s.push(((o,a)=>{o?i(o):a&&i(null,{stack:t,id:e,glyph:a[e]||null});}));}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:o,glyph:a}of e)(t[i]||(t[i]={}))[o]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};i(null,t);}}));}_doesCharSupportLocalGlyph(e){return !!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,o){const a=this.localIdeographFontFamily;if(!a)return;if(!this._doesCharSupportLocalGlyph(o))return;let r=e.tinySDF;if(!r){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),r=e.tinySDF=new _.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:a,fontWeight:t});}const s=r.draw(String.fromCharCode(o));return {id:o,bitmap:new t.AlphaImage({width:s.width||30,height:s.height||30},s.data),metrics:{width:s.glyphWidth||24,height:s.glyphHeight||24,left:s.glyphLeft||0,top:s.glyphTop-27||-8,advance:s.glyphAdvance||24}}}}_.loadGlyphRange=function(e,i,o,a,r){const s=256*i,n=s+255,l=a.transformRequest(o.replace("{fontstack}",e).replace("{range}",`${s}-${n}`),t.ResourceType.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)r(e);else if(i){const e={};for(const o of t.parseGlyphPbf(i))e[o.id]=o;r(null,e);}}));},_.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:r="normal",fontStyle:s="normal"}={}){this.buffer=e,this.cutoff=o,this.radius=i;const n=this.size=t+4*e,l=this._createCanvas(n),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${r} ${t}px ${a}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(n*n),this.gridInner=new Float64Array(n*n),this.f=new Float64Array(n),this.z=new Float64Array(n+1),this.v=new Uint16Array(n);}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:r}=this.ctx.measureText(t),s=Math.ceil(i),n=Math.min(this.size-this.buffer,Math.ceil(r-a)),l=Math.min(this.size-this.buffer,s+Math.ceil(o)),c=n+2*this.buffer,h=l+2*this.buffer,m=Math.max(c*h,0),_=new Uint8ClampedArray(m),p={data:_,width:c,height:h,glyphWidth:n,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===n||0===l)return p;const{ctx:f,buffer:g,gridInner:x,gridOuter:v}=this;f.clearRect(g,g,n,l),f.fillText(t,g,g+s);const y=f.getImageData(g,g,n,l);v.fill(u,0,m),x.fill(0,0,m);for(let t=0;t0?t*t:0,x[o]=t<0?t*t:0;}}d(v,0,0,c,h,c,this.f,this.v,this.z),d(x,g,g,n,l,c,this.f,this.v,this.z);for(let t=0;t1&&(s=t[++r]);const l=Math.abs(n-s.left),c=Math.abs(n-s.right),h=Math.min(l,c);let u;const d=e/i*(o+1);if(s.isDash){const t=o-Math.abs(d);u=Math.sqrt(h*h+t*t);}else u=o-Math.sqrt(h*h+d*d);this.data[a+n]=Math.max(0,Math.min(255,u+128));}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],o=t[e+1];i.zeroLength?t.splice(e,1):o&&o.isDash===i.isDash&&(o.left=i.left,t.splice(e,1));}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const o=this.width*this.nextRow;let a=0,r=t[a];for(let e=0;e1&&(r=t[++a]);const i=Math.abs(e-r.left),s=Math.abs(e-r.right),n=Math.min(i,s);this.data[o+e]=Math.max(0,Math.min(255,(r.isDash?n:-n)+128));}}addDash(e,i){const o=i?7:0,a=2*o+1;if(this.nextRow+a>this.height)return t.warnOnce("LineAtlas out of space"),null;let r=0;for(let t=0;t{t.send(e,i,o);}),o=o||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove();})),this.actors=[],this.workerPool.release(this.id);}}function y(e,i,o){const a=function(i,a){if(i)return o(i);if(a){const i=t.pick(t.extend(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(i.vectorLayers=a.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),o(null,i);}};return e.url?t.getJSON(i.transformRequest(e.url,t.ResourceType.Source),a):t.exported.frame((()=>a(null,e)))}v.Actor=t.Actor;class b{constructor(e,i,o){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=o||24;}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),o=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),a=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),r=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=o&&e.x=a&&e.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new b(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})));}));}loaded(){return this._loaded}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load();}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load();}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(o,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function r(o,a){return delete e.request,e.aborted?i(null):o&&404!==o.status?i(o):(a&&a.resourceTiming&&(e.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&a&&e.setExpiryData(a),e.loadVectorData(a,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}a.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",a,r.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",a,r.bind(this)));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0);}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0);}hasTransition(){return !1}}class T extends t.Evented{constructor(e,i,o,a){super(),this.id=e,this.dispatcher=o,this.setEventedParent(a),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]));}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=y(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new b(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})));}));}loaded(){return this._loaded}onAdd(t){this.map=t,this.load();}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=t.getImage(this.map._requestManager.transformRequest(o,t.ResourceType.Tile),((o,a,r)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(o)e.state="errored",i(o);else if(a){this.map._refreshExpiredTiles&&e.setExpiryData(r);const o=this.map.painter.context,s=o.gl;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new l(o,a,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),o.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,o.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,o.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),i(null);}}));}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e();}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e();}hasTransition(){return !1}}let E;class I extends T{constructor(e,i,o,a){super(e,i,o,a),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox";}serialize(){return {type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const o=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function a(t,o){t&&(e.state="errored",i(t)),o&&(e.dem=o,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null));}e.request=t.getImage(this.map._requestManager.transformRequest(o,t.ResourceType.Tile),function(o,r){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(o)e.state="errored",i(o);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(r),delete r.cacheControl,delete r.expires;const i=t.isImageBitmap(r)&&(null==E&&(E="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),E)?r:t.exported.getImageData(r,1),o={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",o,a.bind(this)));}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID);}_getNeighboringTiles(e){const i=e.canonical,o=Math.pow(2,i.z),a=(i.x-1+o)%o,r=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+o)%o,n=i.x+1===o?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,r,i.z,a,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,r,i.z,a,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1{if(this._pendingLoads--,this._removed||o&&o.abandoned)return void this.fire(new t.Event("dataabort",{dataType:"source",sourceDataType:e}));let a=null;if(o&&o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0)),i)return void this.fire(new t.ErrorEvent(i));const r={dataType:"source",sourceDataType:e};this._collectResourceTiming&&a&&a.length>0&&t.extend(r,{resourceTiming:a}),this.fire(new t.Event("data",r));}));}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const o={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,o,((o,a)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):o?e(o):(t.loadVectorData(a,this.map.painter,"reloadTile"===i),e(null)))));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0;}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id});}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id});}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return !1}}var S=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class D extends t.Evented{constructor(t,e,i,o){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=e;}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),((o,a)=>{this._loaded=!0,o?this.fire(new t.ErrorEvent(o)):a&&(this.image=a,e&&(this.coordinates=e),i&&i(),this._finishLoading());}));}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null;})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})));}onAdd(t){this.map=t,this.load();}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,o=1/0,a=-1/0,r=-1/0;for(const t of e)i=Math.min(i,t.x),o=Math.min(o,t.y),a=Math.max(a,t.x),r=Math.max(r,t.y);const s=Math.max(a-i,r-o),n=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,n);return new t.CanonicalTileID(n,Math.floor((i+a)/2*l),Math.floor((o+r)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const o=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(o[0].x,o[0].y,0,0),this._boundsArray.emplaceBack(o[1].x,o[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(o[3].x,o[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(o[2].x,o[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,S.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new l(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null));}serialize(){return {type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}}class z extends D{constructor(t,e,i,o){super(t,e,i,o),this.roundZoom=!0,this.type="video",this.options=e;}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint();})),this.map&&this.video.play(),this._finishLoading());}));}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e;}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,S.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new l(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}serialize(){return {type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class P extends D{constructor(e,i,o,a){super(e,i,o,a),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play();}onRemove(){this.pause();}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,o=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,S.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l(i,this.canvas,o.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture);}}serialize(){return {type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of [this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return !0;return !1}}const M={vector:w,raster:T,"raster-dem":I,geojson:C,video:z,image:D,canvas:P};function A(e,i){const o=t.create();return t.translate(o,o,[1,1,0]),t.scale(o,o,[.5*e.width,.5*e.height,1]),t.multiply(o,o,e.calculatePosMatrix(i.toUnwrapped()))}function L(t,e,i,o,a,r){const s=function(t,e,i){if(t)for(const o of t){const t=e[o];if(t&&t.source===i&&"fill-extrusion"===t.type)return !0}else for(const t in e){const o=e[t];if(o.source===i&&"fill-extrusion"===o.type)return !0}return !1}(a&&a.layers,e,t.id),n=r.maxPitchScaleFactor(),l=t.tilesIn(o,n,s);l.sort(R);const c=[];for(const o of l)c.push({wrappedTileID:o.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(e,i,t._state,o.queryGeometry,o.cameraQueryGeometry,o.scale,a,r,n,A(t.transform,o.tileID))});const h=function(t){const e={},i={};for(const o of t){const t=o.queryResults,a=o.wrappedTileID,r=i[a]=i[a]||{};for(const i in t){const o=t[i],a=r[i]=r[i]||{},s=e[i]=e[i]||[];for(const t of o)a[t.featureIndex]||(a[t.featureIndex]=!0,s.push(t));}}return e}(c);for(const e in h)h[e].forEach((e=>{const i=e.feature,o=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o;}));return h}function R(t,e){const i=t.tileID,o=e.tileID;return i.overscaledZ-o.overscaledZ||i.canonical.y-o.canonical.y||i.wrap-o.wrap||i.canonical.x-o.canonical.x}class k{constructor(e,i){this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading";}registerFadeDuration(e){const i=e+this.timeAdded;it.saveTileTexture(e))),this.demTexture=null,this.textures=[],this.textureCoords={};}loadVectorData(e,i,o){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){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(t,e){const i={};if(!e)return i;for(const o of t){const t=o.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){o.layers=t,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=o;}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!o)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e));}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage);}else this.collisionBoxArray=new t.CollisionBoxArray;}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded";}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,i,o,a,r,s,n,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:a,scale:r,tileSize:this.tileSize,pixelPosMatrix:c,transform:n,params:s,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const a=o.loadVTLayers(),r=i?i.sourceLayer:"",s=a._geojsonTileLayer||a[r];if(!s)return;const n=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;it)e=!1;else if(i)if(this.expirationTime{this.remove(t,a);}),i)),this.data[o].push(a),this.order.push(o),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,o=void 0===e?0:this.data[i].indexOf(e),a=this.data[i][o];return this.data[i].splice(o,1),a.timeout&&clearTimeout(a.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}filter(t){const e=[];for(const i in this.data)for(const o of this.data[i])t(o.value)||e.push(o);for(const t of e)this.remove(t.value.tileID,t);}}class F{constructor(){this.state={},this.stateChanges={},this.deletedStates={};}updateState(e,i,o){const a=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][a]=this.stateChanges[e][a]||{},t.extend(this.stateChanges[e][a],o),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==a&&(this.deletedStates[e][t]=null);}else if(this.deletedStates[e]&&null===this.deletedStates[e][a]){this.deletedStates[e][a]={};for(const t in this.state[e][a])o[t]||(this.deletedStates[e][a][t]=null);}else for(const t in o)this.deletedStates[e]&&this.deletedStates[e][a]&&null===this.deletedStates[e][a][t]&&delete this.deletedStates[e][a][t];}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const o=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][o]&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][o])for(i in this.deletedStates[t][o]={},this.stateChanges[t][o])this.deletedStates[t][o][i]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null;}getState(e,i){const o=String(i),a=t.extend({},(this.state[e]||{})[o],(this.stateChanges[e]||{})[o]);if(null===this.deletedStates[e])return {};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return {};for(const e in t)delete a[e];}return a}initializeTileState(t,e){t.setFeatureState(this.state,e);}coalesceChanges(e,i){const o={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const o in this.stateChanges[e])this.state[e][o]||(this.state[e][o]={}),t.extend(this.state[e][o],this.stateChanges[e][o]),i[o]=this.state[e][o];o[e]=i;}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t];}o[e]=o[e]||{},t.extend(o[e],i);}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(o).length)for(const t in e)e[t].setFeatureState(o,i);}}class O extends t.Evented{constructor(e,i,o){super(),this.id=e,this.dispatcher=o,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain));})),this.on("dataloading",(()=>{this._sourceErrored=!1;})),this.on("error",(()=>{this._sourceErrored=this._source.loaded();})),this._source=function(e,i,o,a){const r=new M[i.type](e,i,o,a);if(r.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${r.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],r),r}(e,i,o,this),this._tiles={},this._cache=new B(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new F;}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t);}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t);}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain);}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}));}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager);}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(U).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const o=e.tileID,a=i.tileID,r=new t.pointGeometry(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),s=new t.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-a.overscaledZ||s.y-r.y||s.x-r.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(U).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return !!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading");}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)));}_tileLoaded(e,i,o,a){if(a)return e.state="errored",void(404!==a.status?this._source.fire(new t.ErrorEvent(a,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.exported.now(),"expired"===o&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}));}_backfillDEM(t){const e=this.getRenderableIds();for(let o=0;o1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,o),t.neighboringTiles&&t.neighboringTiles[r]&&(t.neighboringTiles[r].backfilled=!0)));}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,o){for(const a in this._tiles){let r=this._tiles[a];if(o[a]||!r.hasData()||r.tileID.overscaledZ<=e||r.tileID.overscaledZ>i)continue;let s=r.tileID;for(;r&&r.tileID.overscaledZ>e+1;){const t=r.tileID.scaledTo(r.tileID.overscaledZ-1);r=this._tiles[t.key],r&&r.hasData()&&(s=t);}let n=s;for(;n.overscaledZ>e;)if(n=n.scaledTo(n.overscaledZ-1),t[n.key]){o[s.key]=s;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),o=this._getLoadedTile(e);if(o)return o}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,o=Math.floor(e*i*5),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+e),t[o.tileID.key]=o;}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t]);}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let o;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(o=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(o=o.filter((t=>this._source.hasTile(t))))):o=[];const a=e.coveringZoomLevel(this._source),r=Math.max(a-O.maxOverzooming,this._source.minzoom),s=Math.max(a+O.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of o)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const o=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[o.key]=o;}o=o.concat(Object.values(t));}const n=this._updateRetainedTiles(o,a);if(N(this._source.type)){const e={},l={},c=Object.keys(n);for(const i of c){const o=n[i],a=this._tiles[i];if(!a||a.fadeEndTime&&a.fadeEndTime<=t.exported.now())continue;const s=this.findLoadedParent(o,r);s&&(this._addTile(s.tileID),e[s.tileID.key]=s.tileID),l[i]=o;}this._retainLoadedChildren(l,a,s,n);for(const t in e)n[t]||(this._coveredTiles[t]=!0,n[t]=e[t]);if(i){const t={},e={};for(const i of o)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const o=e[i].children(this._source.maxzoom);this._tiles[o[0].key]&&this._tiles[o[1].key]&&this._tiles[o[2].key]&&this._tiles[o[3].key]&&(t[o[0].key]=n[o[0].key]=o[0],t[o[1].key]=n[o[1].key]=o[1],t[o[2].key]=n[o[2].key]=o[2],t[o[3].key]=n[o[3].key]=o[3],delete e[i]);}for(const i in e){const o=this.findLoadedParent(e[i],this._source.minzoom);if(o){t[o.tileID.key]=n[o.tileID.key]=o.tileID;for(const e in t)t[e].isChildOf(o.tileID)&&delete t[e];}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0);}}for(const t in n)this._tiles[t].clearFadeHold();const l=t.keysDifference(this._tiles,n);for(const t of l){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t);}this._updateLoadedParentTileCache();}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t);}_updateRetainedTiles(t,e){const i={},o={},a=Math.max(e-O.maxOverzooming,this._source.minzoom),r=Math.max(e+O.maxUnderzooming,this._source.minzoom),s={};for(const o of t){const t=this._addTile(o);i[o.key]=o,t.hasData()||ethis._source.maxzoom){const t=r.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else {const t=r.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let s=t.wasRequested();for(let e=r.overscaledZ-1;e>=a;--e){const a=r.scaledTo(e);if(o[a.key])break;if(o[a.key]=!0,t=this.getTile(a),!t&&s&&(t=this._addTile(a)),t&&(i[a.key]=a,s=t.wasRequested(),t.hasData()))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,o=this._tiles[t].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}e.push(o.key);const t=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;o=t;}for(const t of e)this._loadedParentTiles[t]=i;}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const o=i;return i||(i=new k(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,o||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t];}),i));}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset();}tilesIn(e,i,o){const a=[],r=this.transform;if(!r)return a;const s=o?r.getCameraQueryGeometry(e):e,n=e.map((t=>r.pointCoordinate(t,this.terrain))),l=s.map((t=>r.pointCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,d=-1/0,m=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),d=Math.max(d,t.x),m=Math.max(m,t.y);for(let e=0;e=0&&f[1].y+p>=0){const t=n.map((t=>s.getTilePoint(t))),e=l.map((t=>s.getTilePoint(t)));a.push({tile:o,tileID:s,queryGeometry:t,cameraQueryGeometry:e,scale:_});}}return a}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return !0;if(N(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.exported.now())return !0}return !1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i);}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i);}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const o=this._tiles[t];o&&o.setDependencies(e,i);}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)));}}function U(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||o-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function N(t){return "raster"===t||"image"===t||"video"===t}O.maxOverzooming=10,O.maxUnderzooming=3;const G="mapboxgl_preloaded_worker_pool";class Z{constructor(){this.active={};}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[G]}numActive(){return Object.keys(this.active).length}}const V=Math.floor(t.exported.hardwareConcurrency/2);let q;function j(){return q||(q=new Z),q}function $(e,i){const o={};for(const t in e)"ref"!==t&&(o[t]=e[t]);return t.refProperties.forEach((t=>{t in i&&(o[t]=i[t]);})),o}function X(t){t=t.slice();const e=Object.create(null);for(let i=0;i0?(a-s)/n:0;return this.points[r].mult(1-l).add(this.points[i].mult(l))}}function ot(t,e){let i=!0;return "always"===t||"never"!==t&&"never"!==e||(i=!1),i}class at{constructor(t,e,i){const o=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||o<0||e>this.height)return [];const n=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=o){if(a)return [{key:null,x1:t,y1:e,x2:i,y2:o}];for(let t=0;t0}hitTestCircle(t,e,i,o,a){const r=t-i,s=t+i,n=e-i,l=e+i;if(s<0||r>this.width||l<0||n>this.height)return !1;const c=[];return this._forEachCell(r,n,s,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:o,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(t,e,i,o,a,r,s,n){const{seenUids:l,hitTest:c,overlapMode:h}=s,u=this.boxCells[a];if(null!==u){const a=this.bboxes;for(const s of u)if(!l.box[s]){l.box[s]=!0;const u=4*s,d=this.boxKeys[s];if(t<=a[u+2]&&e<=a[u+3]&&i>=a[u+0]&&o>=a[u+1]&&(!n||n(d))&&(!c||!ot(h,d.overlapMode))&&(r.push({key:d,x1:a[u],y1:a[u+1],x2:a[u+2],y2:a[u+3]}),c))return !0}}const d=this.circleCells[a];if(null!==d){const a=this.circles;for(const s of d)if(!l.circle[s]){l.circle[s]=!0;const u=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(a[u],a[u+1],a[u+2],t,e,i,o)&&(!n||n(d))&&(!c||!ot(h,d.overlapMode))){const t=a[u],e=a[u+1],i=a[u+2];if(r.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return !0}}}return !1}_queryCellCircle(t,e,i,o,a,r,s,n){const{circle:l,seenUids:c,overlapMode:h}=s,u=this.boxCells[a];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,o=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!n||n(o))&&!ot(h,o.overlapMode))return r.push(!0),!0}}const d=this.circleCells[a];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,o=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!n||n(o))&&!ot(h,o.overlapMode))return r.push(!0),!0}}}_forEachCell(t,e,i,o,a,r,s,n){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(o);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(a.call(this,t,e,i,o,this.xCellCount*l+d,r,s,n))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,o,a,r){const s=o-t,n=a-e,l=i+r;return l*l>s*s+n*n}_circleAndRectCollide(t,e,i,o,a,r,s){const n=(r-o)/2,l=Math.abs(t-(o+n));if(l>n+i)return !1;const c=(s-a)/2,h=Math.abs(e-(a+c));if(h>c+i)return !1;if(l<=n||h<=c)return !0;const u=l-n,d=h-c;return u*u+d*d<=i*i}}function rt(e,i,o,a,r){const s=t.create();return i?(t.scale(s,s,[1/r,1/r,1]),o||t.rotateZ(s,s,a.angle)):t.multiply(s,a.labelPlaneMatrix,e),s}function st(e,i,o,a,r){if(i){const i=t.clone(e);return t.scale(i,i,[r,r,1]),o||t.rotateZ(i,i,-a.angle),i}return a.glCoordMatrix}function nt(e,i,o){let a;o?(a=[e.x,e.y,o(e.x,e.y),1],t.transformMat4(a,a,i)):(a=[e.x,e.y,0,1],xt(a,a,i));const r=a[3];return {point:new t.pointGeometry(a[0]/r,a[1]/r),signedDistanceFromCamera:r}}function lt(t,e){return .5+t/e*.5}function ct(t,e){const i=t[0]/t[3],o=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&o>=-e[1]&&o<=e[1]}function ht(e,i,o,a,r,s,n,l,c,h){const u=a?e.textSizeData:e.iconSizeData,d=t.evaluateSizeForZoom(u,o.transform.zoom),m=[256/o.width*2+1,256/o.height*2+1],_=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();const p=e.lineVertexArray,f=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=o.transform.width/o.transform.height;let x=!1;for(let a=0;aMath.abs(o.x-i.x)*a?{useVertical:!0}:(e===t.WritingMode.vertical?i.yo.x)?{needsFlipping:!0}:null}function mt(e,i,o,a,r,s,n,l,c,h,u,d,m,_,p,f){const g=i/24,x=e.lineOffsetX*g,v=e.lineOffsetY*g;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,r=e.lineStartIndex+e.lineLength,h=ut(g,l,x,v,o,u,d,e,c,s,m,p,f);if(!h)return {notEnoughRoom:!0};const b=nt(h.first.point,n,f).point,w=nt(h.last.point,n,f).point;if(a&&!o){const t=dt(e.writingMode,b,w,_);if(t)return t}y=[h.first];for(let a=e.glyphStartIndex+1;a0?s.point:_t(d,a,i,1,r,f),l=dt(e.writingMode,i,n,_);if(l)return l}const i=pt(g*l.getoffsetX(e.glyphStartIndex),x,v,o,u,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,s,m,p,f);if(!i)return {notEnoughRoom:!0};y=[i];}for(const e of y)t.addDynamicAttributes(h,e.point,e.angle);return {}}function _t(t,e,i,o,a,r){const s=nt(t.add(t.sub(e)._unit()),a,r).point,n=i.sub(s);return i.add(n._mult(o/n.mag()))}function pt(e,i,o,a,r,s,n,l,c,h,u,d,m,_){const p=a?e-i:e+i;let f=p>0?1:-1,g=0;a&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let x=f>0?l+n:l+n+1,v=r,y=r,b=0,w=0;const T=Math.abs(p),E=[];for(;b+w<=T;){if(x+=f,x=c)return null;if(y=v,E.push(v),v=d[x],void 0===v){const e=new t.pointGeometry(h.getx(x),h.gety(x)),i=nt(e,u,_);if(i.signedDistanceFromCamera>0)v=d[x]=i.point;else {const i=x-f;v=_t(0===b?s:new t.pointGeometry(h.getx(i),h.gety(i)),e,y,T-b+1,u,_);}}b+=w,w=y.dist(v);}const I=(T-b)/w,C=v.sub(y),S=C.mult(I)._add(y);S._add(C._unit()._perp()._mult(o*f));const D=g+Math.atan2(v.y-y.y,v.x-y.x);return E.push(S),{point:S,angle:m?D:0,path:E}}const ft=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function gt(t,e){for(let i=0;i=1;t--)h.push(s.path[t]);for(let t=1;tnt(t,l,_)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point));}let g=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t=o.x&&i.x<=a.x&&e.y>=o.y&&i.y<=a.y?[h]:i.xa.x||i.ya.y?[]:t.clipLine([h],o.x,o.y,a.x,a.y);}for(const t of g){r.reset(t,.25*i);let o=0;o=r.length<=.5*i?1:Math.ceil(r.paddedLength/f)+1;for(let t=0;t=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(t,e,i,o){return i>=0&&t=0&&et.collisionGroupID===e};}return this.collisionGroups[t]}}function Dt(e,i,o,a,r){const{horizontalAlign:s,verticalAlign:n}=t.getAnchorAlignment(e),l=-(s-.5)*i,c=-(n-.5)*o,h=t.evaluateVariableOffset(e,a);return new t.pointGeometry(l+h[0]*r,c+h[1]*r)}function zt(e,i,o,a,r,s){const{x1:n,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:d}=e,m=new t.pointGeometry(i,o);return a&&m._rotate(r?s:-s),{x1:n+m.x,y1:c+m.y,x2:l+m.x,y2:h+m.y,anchorPointX:u,anchorPointY:d}}class Pt{constructor(t,e,i,o,a){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new St(o),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={};}getBucketParts(e,i,o,a){const r=o.getBucket(i),s=o.latestFeatureIndex;if(!r||!s||i.id!==r.layerIds[0])return;const n=o.collisionBoxArray,l=r.layers[0].layout,c=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),h=o.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(o.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),_=bt(o,1,this.transform.zoom),p=rt(u,d,m,this.transform,_);let f=null;if(d){const e=st(u,d,m,this.transform,_);f=t.multiply([],this.transform.labelPlaneMatrix,e);}this.retainedQueryData[r.bucketInstanceId]=new Ct(r.bucketInstanceId,s,r.sourceLayerIndex,r.index,o.tileID);const g={bucket:r,layout:l,posMatrix:u,textLabelPlaneMatrix:p,labelToScreenMatrix:f,scale:c,textPixelRatio:h,holdingForFade:o.holdingForFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(r.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(r.sourceID)};if(a)for(const t of r.sortKeyRanges){const{sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:a,parameters:g});}else e.push({symbolInstanceStart:0,symbolInstanceEnd:r.symbolInstances.length,parameters:g});}attemptAnchorPlacement(t,e,i,o,a,r,s,n,l,c,h,u,d,m,_,p){const f=[u.textOffset0,u.textOffset1],g=Dt(t,i,o,f,a),x=this.collisionIndex.placeCollisionBox(zt(e,g.x,g.y,r,s,this.transform.angle),h,n,l,c.predicate,p);if((!_||0!==this.collisionIndex.placeCollisionBox(zt(_,g.x,g.y,r,s,this.transform.angle),h,n,l,c.predicate,p).box.length)&&x.box.length>0){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(e=this.prevPlacement.variableOffsets[u.crossTileID].anchor),0===u.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[u.crossTileID]={textOffset:f,width:i,height:o,anchor:t,textBoxScale:a,prevAnchor:e},this.markUsedJustification(d,t,u,m),d.allowVerticalPlacement&&(this.markUsedOrientation(d,m,u),this.placedOrientations[u.crossTileID]=m),{shift:g,placedGlyphBoxes:x}}}placeLayerBucketPart(e,i,o){const{bucket:a,layout:r,posMatrix:s,textLabelPlaneMatrix:n,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:d,collisionGroup:m}=e.parameters,_=r.get("text-optional"),p=r.get("icon-optional"),f=t.getOverlapMode(r,"text-overlap","text-allow-overlap"),g="always"===f,x=t.getOverlapMode(r,"icon-overlap","icon-allow-overlap"),v="always"===x,y="map"===r.get("text-rotation-alignment"),b="map"===r.get("text-pitch-alignment"),w="none"!==r.get("icon-text-fit"),T="viewport-y"===r.get("symbol-z-order"),E=g&&(v||!a.hasIconData()||p),I=v&&(g||!a.hasTextData()||_);!a.collisionArrays&&u&&a.deserializeCollisionBoxes(u);const C=(e,u)=>{if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Et(!1,!1,!1));let v=!1,T=!1,C=!0,S=null,D={box:null,offscreen:null},z={box:null,offscreen:null},P=null,M=null,A=null,L=0,R=0,k=0;u.textFeatureIndex?L=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),u.verticalTextFeatureIndex&&(R=u.verticalTextFeatureIndex);const B=this.retainedQueryData[a.bucketInstanceId].tileID,F=this.terrain?(t,e)=>this.terrain.getElevation(B,t,e):null;for(const t of ["textBox","verticalTextBox","iconBox","verticalIconBox"]){const e=u[t];e&&(e.elevation=F?F(e.anchorPointX,e.anchorPointY):0);}const O=u.textBox;if(O){const i=i=>{let o=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,o=t,this.markUsedOrientation(a,o,e));}return o},o=(i,o)=>{if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of a.writingModes)if(e===t.WritingMode.vertical?(D=o(),z=D):D=i(),D&&D.box&&D.box.length)break}else D=i();};if(r.get("text-variable-anchor")){let n=r.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];n.indexOf(t.anchor)>0&&(n=n.filter((e=>e!==t.anchor)),n.unshift(t.anchor));}const l=(t,i,o)=>{const r=t.x2-t.x1,l=t.y2-t.y1,h=e.textBoxScale,u=w&&"never"===x?i:null;let d={box:[],offscreen:!1};const _="never"!==f?2*n.length:n.length;for(let i=0;i<_;++i){const _=this.attemptAnchorPlacement(n[i%n.length],t,r,l,h,y,b,c,s,m,i>=n.length?f:"never",e,a,o,u,F);if(_&&(d=_.placedGlyphBoxes,d&&d.box&&d.box.length)){v=!0,S=_.shift;break}}return d};o((()=>l(O,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&!(D&&D.box&&D.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),D&&(v=D.box,C=D.offscreen);const h=i(D&&D.box);if(!v&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(a,t.anchor,e,h));}}else {const r=(t,i)=>{const o=this.collisionIndex.placeCollisionBox(t,f,c,s,m.predicate,F);return o&&o.box&&o.box.length&&(this.markUsedOrientation(a,i,e),this.placedOrientations[e.crossTileID]=i),o};o((()=>r(O,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(D&&D.box&&D.box.length);}}if(P=D,v=P&&P.box&&P.box.length>0,C=P&&P.offscreen,e.useRuntimeCollisionCircles){const i=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(a.textSizeData,d,i),h=r.get("text-padding");M=this.collisionIndex.placeCollisionCircles(f,i,a.lineVertexArray,a.glyphOffsetArray,c,s,n,l,o,b,m.predicate,e.collisionCircleDiameter,h,F),M.circles.length&&M.collisionDetected&&!o&&t.warnOnce("Collisions detected, but collision boxes are not shown"),v=g||M.circles.length>0&&!M.collisionDetected,C=C&&M.offscreen;}if(u.iconFeatureIndex&&(k=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&S?zt(t,S.x,S.y,y,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,x,c,s,m.predicate,F)};z&&z.box&&z.box.length&&u.verticalIconBox?(A=t(u.verticalIconBox),T=A.box.length>0):(A=t(u.iconBox),T=A.box.length>0),C=C&&A.offscreen;}const U=_||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,N=p||0===e.numIconVertices;if(U||N?N?U||(T=T&&v):v=T&&v:T=v=T&&v,v&&P&&P.box&&this.collisionIndex.insertCollisionBox(P.box,f,r.get("text-ignore-placement"),a.bucketInstanceId,z&&z.box&&R?R:L,m.ID),T&&A&&this.collisionIndex.insertCollisionBox(A.box,x,r.get("icon-ignore-placement"),a.bucketInstanceId,k,m.ID),M&&(v&&this.collisionIndex.insertCollisionCircles(M.circles,f,r.get("text-ignore-placement"),a.bucketInstanceId,L,m.ID),o)){const t=a.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new It);for(let t=0;t=0;--e){const i=t[e];C(a.symbolInstances.get(i),a.collisionArrays[i]);}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=r>=0&&t!==r?0:o.crossTileID);}markUsedOrientation(e,i,o){const a=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,r=i===t.WritingMode.vertical?i:0,s=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=a;o.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=r);}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const o=e?e.symbolFadeChange(t):1,a=e?e.opacities:{},r=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],r=a[t];r?(this.opacities[t]=new Tt(r,o,e.text,e.icon),i=i||e.text!==r.text.placed||e.icon!==r.icon.placed):(this.opacities[t]=new Tt(null,o,e.text,e.icon,e.skipFade),i=i||e.text||e.icon);}for(const t in a){const e=a[t];if(!this.opacities[t]){const a=new Tt(e,o,!1,!1);a.isHidden()||(this.opacities[t]=a,i=i||e.text.placed||e.icon.placed);}}for(const t in r)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=r[t]);for(const t in s)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=s[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t);}updateLayerOpacities(t,e){const i={};for(const o of e){const e=o.getBucket(t);e&&o.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,o.collisionBoxArray);}}updateBucketOpacities(e,i,o){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const a=e.layers[0].layout,r=new Tt(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),n=a.get("icon-allow-overlap"),l=a.get("text-variable-anchor"),c="map"===a.get("text-rotation-alignment"),h="map"===a.get("text-pitch-alignment"),u="none"!==a.get("icon-text-fit"),d=new Tt(null,0,s&&(n||!e.hasIconData()||a.get("icon-optional")),n&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const m=(t,e,i)=>{for(let o=0;o0,g=this.placedOrientations[a.crossTileID],x=g===t.WritingMode.vertical,v=g===t.WritingMode.horizontal||g===t.WritingMode.horizontalOnly;if(s>0||n>0){const t=Ut(p.text);m(e.text,s,x?Nt:t),m(e.text,n,v?Nt:t);const i=p.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||x?1:0);})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const o=this.variableOffsets[a.crossTileID];o&&this.markUsedJustification(e,o.anchor,a,g);const r=this.placedOrientations[a.crossTileID];r&&(this.markUsedJustification(e,"left",a,r),this.markUsedOrientation(e,r,a));}if(f){const t=Ut(p.icon),i=!(u&&a.verticalPlacedIconSymbolIndex&&x);a.placedIconSymbolIndex>=0&&(m(e.icon,a.numIconVertices,i?t:Nt),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=p.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,a.numVerticalIconVertices,i?Nt:t),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=p.icon.isHidden());}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[o];if(i){let o=new t.pointGeometry(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[_];e?(o=Dt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&o._rotate(h?this.transform.angle:-this.transform.angle)):t=!1;}i.textBox&&Mt(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||x,o.x,o.y),i.verticalTextBox&&Mt(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||v,o.x,o.y);}const a=Boolean(!v&&i.verticalIconBox);i.iconBox&&Mt(e.iconCollisionBox.collisionVertexArray,p.icon.placed,a,u?o.x:0,u?o.y:0),i.verticalIconBox&&Mt(e.iconCollisionBox.collisionVertexArray,p.icon.placed,!a,u?o.x:0,u?o.y:0);}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId];}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0;}}function Mt(t,e,i,o,a){t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0),t.emplaceBack(e?1:0,i?1:0,o||0,a||0);}const At=Math.pow(2,25),Lt=Math.pow(2,24),Rt=Math.pow(2,17),kt=Math.pow(2,16),Bt=Math.pow(2,9),Ft=Math.pow(2,8),Ot=Math.pow(2,1);function Ut(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*At+e*Lt+i*Rt+e*kt+i*Bt+e*Ft+i*Ot+e}const Nt=0;class Gt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];}continuePlacement(t,e,i,o,a){const r=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex{const e=t.exported.now()-a;return !this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=a)&&(!t.maxzoom||t.maxzoom>a)){if(this._inProgressLayer||(this._inProgressLayer=new Gt(t)),this._inProgressLayer.continuePlacement(o[t.source],this.placement,this._showCollisionBoxes,t,r))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(t){return this.placement.commit(t),this.placement}}const Vt=512/t.EXTENT/2;class qt{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;it.overscaledZ)for(const i in a){const r=a[i];r.tileID.isChildOf(t)&&r.findMatches(e.symbolInstances,t,o);}else {const r=a[t.scaledTo(Number(i)).key];r&&r.findMatches(e.symbolInstances,t,o);}}for(let t=0;t{e[t]=!0;}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t];}}var Wt=t.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ht extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom;}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const e=this._tiles[t];e.textures.forEach((t=>t.destroy())),e.textures=[];}}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];for(const o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[o.key]=new k(o,this.tileSize));}removeOutdated(t){const e={};this.renderHistory=this.renderHistory.filter(((t,e)=>this.renderHistory.indexOf(t)===e)).slice(0,this.renderHistorySize);for(const t of this._renderableTilesKeys)e[t]=!0;for(const t of this.renderHistory)e[t]=!0;for(const i in this._tiles)e[i]||(this._tiles[i].clearTextures(t),delete this._tiles[i]);}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(e.canonical)){const a=e.clone();a.posMatrix=new Float64Array(16),t.ortho(a.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[o]=a;}else if(a.canonical.isChildOf(e.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16);const s=a.canonical.z-e.canonical.z,n=a.canonical.x-(a.canonical.x>>s<>s<>s;t.ortho(r.posMatrix,0,c,0,c,0,1),t.translate(r.posMatrix,r.posMatrix,[-n*c,-l*c,0]),i[o]=r;}else if(e.canonical.isChildOf(a.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16);const s=e.canonical.z-a.canonical.z,n=e.canonical.x-(e.canonical.x>>s<>s<>s;t.ortho(r.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(r.posMatrix,r.posMatrix,[n*c,l*c,0]),t.scale(r.posMatrix,r.posMatrix,[1/2**s,1/2**s,0]),i[o]=r;}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let o=t.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o=i.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(t.scaledTo(o--).key);return a}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeLoaded>=t))}}class Kt{constructor(t,e,i){this.style=t,this.sourceCache=new Ht(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.elevationOffset="number"==typeof i.elevationOffset?i.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache();}getDEMElevation(e,i,o,a=t.EXTENT){if(!(i>=0&&i=0&&oe.canonical.z&&(e.canonical.z>=o?a=e.canonical.z-o:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const r=e.canonical.x-(e.canonical.x>>a<>a<>8<<4|t>>8,i[e+3]=0;const o=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),a=new l(e,o,e.gl.RGBA,{premultiply:!1});return a.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(e){const i=new Uint8Array(4),o=this.style.map.painter,a=o.context,r=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(e.x,o.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,i),a.bindFramebuffer.set(null);const s=i[0]+(i[2]>>4<<8),n=i[1]+((15&i[2])<<8),l=this.coordsIndex[255-i[3]],c=l&&this.sourceCache.getTileByID(l);if(!c)return null;const h=this._coordsTextureSize,u=(1<t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),Jt=t.pick(W,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qt=t.pick(W,["setCenter","setZoom","setBearing","setPitch"]),te=function(){const e={},i=t.spec.$version;for(const o in t.spec.$root){const a=t.spec.$root[o];if(a.required){let t=null;t="version"===o?i:"array"===a.type?[]:{},null!=t&&(e[o]=t);}}return e}();class ee extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new v(j(),this),this.imageManager=new h,this.imageManager.setEventedParent(this),this.glyphManager=new _(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new x(256,512),this.crossTileSymbolIndex=new Xt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const o=this;this._rtlTextPluginCallback=ee.registerForPluginStateChange((e=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in o.sourceCaches)o.sourceCaches[t].reload();}));})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e);}}));}loadURL(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const o="boolean"!=typeof i.validate||i.validate,a=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(a,((e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,o);}));}loadJSON(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,this._load(e,!1!==i.validate);}));}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(te,!1);}_load(e,i){if(i&&Yt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);const o=X(this.stylesheet.layers);this._order=o.map((t=>t.id)),this._layers={},this._serializedLayers={};for(let e of o)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new g(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"));}_loadSprite(e){this._spriteRequest=function(e,i,o,a){let r,s,n;const l=o>1?"@2x":"";let c=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),((t,e)=>{c=null,n||(n=t,r=e,u());})),h=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),((t,e)=>{h=null,n||(n=t,s=e,u());}));function u(){if(n)a(n);else if(r&&s){const e=t.exported.getImageData(s),i={};for(const o in r){const{width:a,height:s,x:n,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:m}=r[o],_=new t.RGBAImage({width:a,height:s});t.RGBAImage.copy(e,_,{x:n,y:l},{x:0,y:0},{width:a,height:s}),i[o]={data:_,pixelRatio:h,sdf:c,stretchX:u,stretchY:d,content:m};}a(null,i);}}return {cancel(){c&&(c.cancel(),c=null),h&&(h.cancel(),h=null);}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));}));}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const o=e.sourceLayer;if(!o)return;const a=i.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(o))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${o}" does not exist on source "${a.id}" as specified by style layer "${e.id}".`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize());}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return !0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return !0;for(const t in this._layers)if(this._layers[t].hasTransition())return !0;return !1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else {if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t);}}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates();}const o={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];o[t]=e.used,e.used=!1;}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0);}for(const e in o){const i=this.sourceCaches[e];o[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}));}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}));}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={};}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e});}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={};}setTerrain(e){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),e){const t=this.sourceCaches[e.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain=new Kt(this,t,e),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=t=>{t.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain));},this._terrainDataCallback=t=>{t.tile&&(t.sourceId===e.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(t.sourceId,t.tile.tileID)):"geojson"===t.source.type&&this.terrain.rememberForRerender(t.sourceId,t.tile.tileID));},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback);}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new t.Event("terrain",{terrain:e}));}setState(e){if(this._checkLoaded(),Yt(this,t.validateStyle(e)))return !1;(e=t.clone$1(e)).layers=X(e.layers);const i=function(t,e){if(!t)return [{command:W.setStyle,args:[e]}];let i=[];try{if(!a(t.version,e.version))return [{command:W.setStyle,args:[e]}];a(t.center,e.center)||i.push({command:W.setCenter,args:[e.center]}),a(t.zoom,e.zoom)||i.push({command:W.setZoom,args:[e.zoom]}),a(t.bearing,e.bearing)||i.push({command:W.setBearing,args:[e.bearing]}),a(t.pitch,e.pitch)||i.push({command:W.setPitch,args:[e.pitch]}),a(t.sprite,e.sprite)||i.push({command:W.setSprite,args:[e.sprite]}),a(t.glyphs,e.glyphs)||i.push({command:W.setGlyphs,args:[e.glyphs]}),a(t.transition,e.transition)||i.push({command:W.setTransition,args:[e.transition]}),a(t.light,e.light)||i.push({command:W.setLight,args:[e.light]});const o={},r=[];!function(t,e,i,o){let r;for(r in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e,r)||K(r,i,o));for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(t,r)?a(t[r],e[r])||("geojson"===t[r].type&&"geojson"===e[r].type&&J(t,e,r)?i.push({command:W.setGeoJSONSourceData,args:[r,e[r].data]}):Y(r,e,i,o)):H(r,e,i));}(t.sources,e.sources,r,o);const s=[];t.layers&&t.layers.forEach((t=>{o[t.source]?i.push({command:W.removeLayer,args:[t.id]}):s.push(t);})),i=i.concat(r),function(t,e,i){e=e||[];const o=(t=t||[]).map(tt),r=e.map(tt),s=t.reduce(et,{}),n=e.reduce(et,{}),l=o.slice(),c=Object.create(null);let h,u,d,m,_,p,f;for(h=0,u=0;h!(t.command in Qt)));if(0===i.length)return !1;const o=i.filter((t=>!(t.command in Jt)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(", ")}.`);return i.forEach((t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args);})),this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e);}updateImage(t,e){this.imageManager.updateImage(t,e);}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e);}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}));}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,o={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,o))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const a=this.sourceCaches[e]=new O(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,(()=>({isSourceLoaded:this.loaded(),source:a.serialize(),sourceId:e}))),a.onAdd(this.map),this._changed=!0;}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0;}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0;}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,o={}){this._checkLoaded();const a=e.id;if(this.getLayer(a))return void this.fire(new t.ErrorEvent(new Error(`Layer "${a}" already exists on this map.`)));let r;if("custom"===e.type){if(Yt(this,t.validateCustomStyleLayer(e)))return;r=t.createStyleLayer(e);}else {if("object"==typeof e.source&&(this.addSource(a,e.source),e=t.clone$1(e),e=t.extend(e,{source:a})),this._validate(t.validateStyle.layer,`layers.${a}`,e,{arrayIndex:-1},o))return;r=t.createStyleLayer(e),this._validateLayer(r),r.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[r.id]=r.serialize();}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${a}" before non-existing layer "${i}".`)));else {if(this._order.splice(s,0,a),this._layerOrderChanged=!0,this._layers[a]=r,this._removedLayers[a]&&r.source&&"custom"!==r.type){const t=this._removedLayers[a];delete this._removedLayers[a],t.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause());}this._updateLayer(r),r.onAdd&&r.onAdd(this.map);}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const o=this._order.indexOf(e);this._order.splice(o,1);const a=i?this._order.indexOf(i):this._order.length;i&&-1===a?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(a,0,e),this._layerOrderChanged=!0);}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map);}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,o){this._checkLoaded();const a=this.getLayer(e);a?a.minzoom===i&&a.maxzoom===o||(null!=i&&(a.minzoom=i),null!=o&&(a.maxzoom=o),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)));}setFilter(e,i,o={}){this._checkLoaded();const r=this.getLayer(e);if(r){if(!a(r.filter,i))return null==i?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(t.validateStyle.filter,`layers.${r.id}.filter`,i,null,o)||(r.filter=t.clone$1(i),this._updateLayer(r)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)));}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,o,r={}){this._checkLoaded();const s=this.getLayer(e);s?a(s.getLayoutProperty(i),o)||(s.setLayoutProperty(i,o,r),this._updateLayer(s)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)));}getLayoutProperty(e,i){const o=this.getLayer(e);if(o)return o.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)));}setPaintProperty(e,i,o,r={}){this._checkLoaded();const s=this.getLayer(e);s?a(s.getPaintProperty(i),o)||(s.setPaintProperty(i,o,r)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)));}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const o=e.source,a=e.sourceLayer,r=this.sourceCaches[o];if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)));const s=r.getSource().type;"geojson"===s&&a?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||a?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.setFeatureState(a,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}removeFeatureState(e,i){this._checkLoaded();const o=e.source,a=this.sourceCaches[o];if(void 0===a)return void this.fire(new t.ErrorEvent(new Error(`The source '${o}' does not exist in the map's style.`)));const r=a.getSource().type,s="vector"===r?e.sourceLayer:void 0;"vector"!==r||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):a.removeFeatureState(s,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));}getFeatureState(e){this._checkLoaded();const i=e.source,o=e.sourceLayer,a=this.sourceCaches[i];if(void 0!==a)return "vector"!==a.getSource().type||o?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.getFeatureState(o,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(t=>t.serialize())),layers:this._serializeLayers(this._order)},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0;}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},o=[];for(let a=this._order.length-1;a>=0;a--){const r=this._order[a];if(e(r)){i[r]=a;for(const e of t){const t=e[r];if(t)for(const e of t)o.push(e);}}}o.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const a=[];for(let r=this._order.length-1;r>=0;r--){const s=this._order[r];if(e(s))for(let t=o.length-1;t>=0;t--){const e=o[t].feature;if(i[e.layer.id]{const o=i.featureSortOrder;if(o){const i=o.indexOf(t.featureIndex);return o.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of a)e.push(t);}}for(const e in n)n[e].forEach((o=>{const a=o.feature,r=i[t[e].source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=r;}));return n}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(r)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const o=this.sourceCaches[e];return o?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),o=[],a={};for(let t=0;tt.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)));}const o=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);s=s||o;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((r=r||this._layerOrderChanged||0===o)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Zt(e,this.terrain,this._order,r,i,o,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),n=!0),s&&this.pauseablePlacement.placement.setStale()),n||s)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source]);}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles();}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const o=this.sourceCaches[e.source];o&&o.setDependencies(e.tileID.key,e.type,e.icons);}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);}getResource(e,i,o){return t.makeRequest(i,o)}}ee.getSourceType=function(t){return M[t]},ee.setSourceType=function(t,e){M[t]=e;},ee.registerForPluginStateChange=t.registerForPluginStateChange;var ie="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const oe={prelude:ae("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:ae("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ae("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ae("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(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;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(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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ae("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:ae("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:ae("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ae("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ae("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:ae("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:ae("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ae("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ae("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ae("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ae("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\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;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ae("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ae("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}"),linePattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:ae("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ae("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:ae("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ae("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:ae("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ie),terrainDepth:ae("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",ie),terrainCoords:ae("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",ie)};function ae(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/attribute ([\w]+) ([\w]+)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=r?r.concat(a):a,n={};return {fragmentSource:t=t.replace(i,((t,e,i,o,a)=>(n[a]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = u_${a};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,o,a)=>{const r="float"===o?"vec2":"vec4",s=a.match(/color/)?"color":r;return n[a]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${r} a_${a};\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${r} a_${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`})),staticAttributes:o,staticUniforms:s}}class re{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;}bind(t,e,i,o,a,r,s,n,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==o.length;for(let t=0;!c&&t({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_offset:new t.Uniform1f(e,i.u_terrain_offset),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,w),this.binderUniforms=a?a.getUniforms(e,w):[];}draw(t,e,i,o,a,r,s,n,l,c,h,u,d,m,_,p,f,g){const x=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(o),t.setColorMode(a),t.setCullFace(r),n){t.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,n.depthTexture),t.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,n.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(n[t]);}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(s[t]);_&&_.setUniforms(t,this.binderUniforms,d,{zoom:m});let v=0;switch(e){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1;}for(const i of u.get()){const o=i.vaos||(i.vaos={});(o[l]||(o[l]=new re)).bind(t,this,c,_?_.getPaintVertexBuffers():[],h,i.vertexOffset,p,f,g),x.drawElements(e,i.primitiveLength*v,x.UNSIGNED_SHORT,i.primitiveOffset*v*2);}}}function le(t,e,i){const o=1/bt(i,1,e.transform.tileZoom),a=Math.pow(2,i.tileID.overscaledZ),r=i.tileSize*Math.pow(2,e.transform.tileZoom)/a,s=r*(i.tileID.canonical.x+i.tileID.wrap*a),n=r*i.tileID.canonical.y;return {u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[o,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,n>>16],u_pixel_coord_lower:[65535&s,65535&n]}}const ce=(e,i,o,a)=>{const r=i.style.light,s=r.properties.get("position"),n=[s.x,s.y,s.z],l=t.create$1();"viewport"===r.properties.get("anchor")&&t.fromRotation(l,-i.transform.angle),t.transformMat3(n,n,l);const c=r.properties.get("color");return {u_matrix:e,u_lightpos:n,u_lightintensity:r.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+o,u_opacity:a}},he=(e,i,o,a,r,s,n)=>t.extend(ce(e,i,o,a),le(s,i,n),{u_height_factor:-Math.pow(2,r.overscaledZ)/n.tileSize/8}),ue=t=>({u_matrix:t}),de=(e,i,o,a)=>t.extend(ue(e),le(o,i,a)),me=(t,e)=>({u_matrix:t,u_world:e}),_e=(e,i,o,a,r)=>t.extend(de(e,i,o,a),{u_world:r}),pe=(t,e,i,o)=>{const a=t.transform;let r,s;if("map"===o.paint.get("circle-pitch-alignment")){const t=bt(i,1,a.zoom);r=!0,s=[t,t];}else r=!1,s=a.pixelsToGLUnits;return {u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===o.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+r,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:s}},fe=(t,e,i)=>{const o=bt(i,1,e.zoom),a=Math.pow(2,e.zoom-i.tileID.overscaledZ),r=i.tileID.overscaleFactor();return {u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:o,u_extrude_scale:[e.pixelsToGLUnits[0]/(o*a),e.pixelsToGLUnits[1]/(o*a)],u_overscale_factor:r}},ge=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),xe=t=>({u_matrix:t}),ve=(t,e,i,o)=>({u_matrix:t,u_extrude_scale:bt(e,1,i),u_intensity:o});function ye(e,i){const o=Math.pow(2,i.canonical.z),a=i.canonical.y;return [new t.MercatorCoordinate(0,a/o).toLngLat().lat,new t.MercatorCoordinate(0,(a+1)/o).toLngLat().lat]}const be=(t,e,i,o)=>{const a=t.transform;return {u_matrix:Ce(t,e,i,o),u_ratio:1/bt(e,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},we=(e,i,o,a,r)=>t.extend(be(e,i,o,r),{u_image:0,u_image_height:a}),Te=(t,e,i,o,a)=>{const r=t.transform,s=Ie(e,r);return {u_matrix:Ce(t,e,i,a),u_texsize:e.imageAtlasTexture.size,u_ratio:1/bt(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Ee=(e,i,o,a,r,s)=>{const n=e.lineAtlas,l=Ie(i,e.transform),c="round"===o.layout.get("line-cap"),h=n.getDash(a.from,c),u=n.getDash(a.to,c),d=h.width*r.fromScale,m=u.width*r.toScale;return t.extend(be(e,i,o,s),{u_patternscale_a:[l/d,-h.height/2],u_patternscale_b:[l/m,-u.height/2],u_sdfgamma:n.width/(256*Math.min(d,m)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:r.t})};function Ie(t,e){return 1/bt(t,1,e.tileZoom)}function Ce(t,e,i,o){return t.translatePosMatrix(o?o.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Se=(t,e,i,o,a)=>{return {u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(s=a.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(r=a.paint.get("raster-contrast"),r>0?1/(1-r):1+r),u_spin_weights:De(a.paint.get("raster-hue-rotate"))};var r,s;};function De(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const ze=(t,e,i,o,a,r,s,n,l,c)=>{const h=a.transform;return {u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:r,u_label_plane_matrix:s,u_coord_matrix:n,u_is_text:+l,u_pitch_with_map:+o,u_texsize:c,u_texture:0}},Pe=(e,i,o,a,r,s,n,l,c,h,u)=>{const d=r.transform;return t.extend(ze(e,i,o,a,r,s,n,l,c,h),{u_gamma_scale:a?Math.cos(d._pitch)*d.cameraToCenterDistance:1,u_device_pixel_ratio:r.pixelRatio,u_is_halo:+u})},Me=(e,i,o,a,r,s,n,l,c,h)=>t.extend(Pe(e,i,o,a,r,s,n,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),Ae=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Le=(e,i,o,a,r,s)=>t.extend(function(t,e,i,o){const a=i.imageManager.getPattern(t.from.toString()),r=i.imageManager.getPattern(t.to.toString()),{width:s,height:n}=i.imageManager.getPixelSize(),l=Math.pow(2,o.tileID.overscaledZ),c=o.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(o.tileID.canonical.x+o.tileID.wrap*l),u=c*o.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:r.tl,u_pattern_br_b:r.br,u_texsize:[s,n],u_mix:e.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:r.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/bt(o,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(a,s,o,r),{u_matrix:e,u_opacity:i}),Re={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id)})};class ke{constructor(t,e,i){this.context=t;const o=t.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindElementBuffer.set(this.buffer);}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}const Be={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Fe{constructor(t,e,i,o){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=o,this.context=t;const a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindVertexBuffer.set(this.buffer);}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);}enableAttributes(t,e){for(let i=0;i0){const i=t.create(),o=x;t.mul(i,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,g.placementViewportMatrix),u.push({circleArray:y,circleOffset:m,transform:o,invTransform:i,coord:p}),d+=y.length/4,m=d;}v&&h.draw(l,c.LINES,wi.disabled,Ei.disabled,e.colorModeForRenderPass(),Ii.disabled,fe(x,e.transform,f),e.style.terrain&&e.style.terrain.getTerrainData(p),o.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer);}if(!n||!u.length)return;const _=e.useProgram("collisionCircle"),p=new t.CollisionCircleLayoutArray;p.resize(4*d),p._trim();let f=0;for(const t of u)for(let e=0;e=0&&(p[f.associatedIconIndex]={shiftedAnchor:I,angle:C});}else gt(f.numGlyphs,m);}if(h){_.clear();const i=e.icon.placedSymbolArray;for(let e=0;ee.style.terrain.getElevation(l,t,i):null,i="map"===o.layout.get("text-rotation-alignment");ht(c,l.posMatrix,e,r,B,F,g,h,i,t);}const N=e.translatePosMatrix(l.posMatrix,a,s,n),G=x||r&&T||U?Di:B,Z=e.translatePosMatrix(F,a,s,n,!0),V=m&&0!==o.paint.get(r?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=m?c.iconsInText?Me(w.kind,S,v,g,e,N,G,Z,z,L):Pe(w.kind,S,v,g,e,N,G,Z,r,z,!0):ze(w.kind,S,v,g,e,N,G,Z,r,z);const j={program:C,buffers:u,uniformValues:q,atlasTexture:P,atlasTextureIcon:R,atlasInterpolation:M,atlasInterpolationIcon:A,isSDF:m,hasHalo:V};if(y&&c.canOverlap){b=!0;const e=u.segments.get();for(const i of e)E.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:j,terrainData:D});}else E.push({segments:u.segments,sortKey:0,state:j,terrainData:D});}b&&E.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of E){const i=t.state;if(m.activeTexture.set(_.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,_.CLAMP_TO_EDGE),i.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),i.isSDF){const a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,Li(i.buffers,t.segments,o,e,i.program,w,u,d,a,t.terrainData)),a.u_is_halo=0;}Li(i.buffers,t.segments,o,e,i.program,w,u,d,i.uniformValues,t.terrainData);}}function Li(t,e,i,o,a,r,s,n,l,c){const h=o.context;a.draw(h,h.gl.TRIANGLES,r,s,n,Ii.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,o.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer);}function Ri(t,e,i,o,a,r,s){const n=t.context.gl,l=i.paint.get("fill-pattern"),c=l&&l.constantOr(1),h=i.getCrossfadeParameters();let u,d,m,_,p;s?(d=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=n.LINES):(d=c?"fillPattern":"fill",u=n.TRIANGLES);for(const f of o){const o=e.getTile(f);if(c&&!o.patternsLoaded())continue;const g=o.getBucket(i);if(!g)continue;const x=g.programConfigurations.get(i.id),v=t.useProgram(d,x),y=t.style.terrain&&t.style.terrain.getTerrainData(f);c&&(t.context.activeTexture.set(n.TEXTURE0),o.imageAtlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE),x.updatePaintBuffers(h));const b=l.constantOr(null);if(b&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[b.to.toString()],i=t.patternPositions[b.from.toString()];e&&i&&x.setConstantPatternPositions(e,i);}const w=y?f:null,T=t.translatePosMatrix(w?w.posMatrix:f.posMatrix,o,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(s){_=g.indexBuffer2,p=g.segments2;const e=[n.drawingBufferWidth,n.drawingBufferHeight];m="fillOutlinePattern"===d&&c?_e(T,t,h,o,e):me(T,e);}else _=g.indexBuffer,p=g.segments,m=c?de(T,t,h,o):ue(T);v.draw(t.context,u,a,t.stencilModeForClipping(f),r,Ii.disabled,m,y,i.id,g.layoutVertexBuffer,_,p,i.paint,t.transform.zoom,x);}}function ki(t,e,i,o,a,r,s){const n=t.context,l=n.gl,c=i.paint.get("fill-extrusion-pattern"),h=c.constantOr(1),u=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity");for(const m of o){const o=e.getTile(m),_=o.getBucket(i);if(!_)continue;const p=t.style.terrain&&t.style.terrain.getTerrainData(m),f=_.programConfigurations.get(i.id),g=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",f);h&&(t.context.activeTexture.set(l.TEXTURE0),o.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),f.updatePaintBuffers(u));const x=c.constantOr(null);if(x&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[x.to.toString()],i=t.patternPositions[x.from.toString()];e&&i&&f.setConstantPatternPositions(e,i);}const v=t.translatePosMatrix(m.posMatrix,o,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),y=i.paint.get("fill-extrusion-vertical-gradient"),b=h?he(v,t,y,d,m,u,o):ce(v,t,y,d);g.draw(n,n.gl.TRIANGLES,a,r,s,Ii.backCCW,b,p,i.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,i.paint,t.transform.zoom,f,t.style.terrain&&_.centroidVertexBuffer);}}function Bi(t,e,i,o,a,r,s){const n=t.context,l=n.gl,c=i.fbo;if(!c)return;const h=t.useProgram("hillshade"),u=t.style.terrain&&t.style.terrain.getTerrainData(e);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(n,l.TRIANGLES,a,r,s,Ii.disabled,((t,e,i,o)=>{const a=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let n=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(n-=t.transform.angle);const l=!t.options.moving;return {u_matrix:o?o.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:ye(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),n],u_shadow:a,u_highlight:r,u_accent:s}})(t,i,o,u?e:null),u,o.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}function Fi(e,i,o,a,r,s){const n=e.context,c=n.gl,h=i.dem;if(h&&h.data){const u=h.dim,d=h.stride,m=h.getPixels();if(n.activeTexture.set(c.TEXTURE1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(d),i.demTexture){const t=i.demTexture;t.update(m,{premultiply:!1}),t.bind(c.NEAREST,c.CLAMP_TO_EDGE);}else i.demTexture=new l(n,m,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);n.activeTexture.set(c.TEXTURE0);let _=i.fbo;if(!_){const t=new l(n,{width:u,height:u,data:null},c.RGBA);t.bind(c.LINEAR,c.CLAMP_TO_EDGE),_=i.fbo=n.createFramebuffer(u,u,!0),_.colorAttachment.set(t.texture);}n.bindFramebuffer.set(_.framebuffer),n.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(n,c.TRIANGLES,a,r,s,Ii.disabled,((e,i)=>{const o=i.stride,a=t.create();return t.ortho(a,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(a,a,[0,-t.EXTENT,0]),{u_matrix:a,u_image:1,u_dimension:[o,o],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,h),null,o.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1;}}function Oi(e,i,o,a,r,s){const n=a.paint.get("raster-fade-duration");if(!s&&n>0){const a=t.exported.now(),s=(a-e.timeAdded)/n,l=i?(a-i.timeAdded)/n:-1,c=o.getSource(),h=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=u&&e.refreshedUponExpiration?1:t.clamp(u?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return {opacity:1,mix:0}}const Ui=new t.Color(1,0,0,1),Ni=new t.Color(0,1,0,1),Gi=new t.Color(0,0,1,1),Zi=new t.Color(1,0,1,1),Vi=new t.Color(0,1,1,1);function qi(t,e,i,o){$i(t,0,e+i/2,t.transform.width,i,o);}function ji(t,e,i,o){$i(t,e-i/2,0,i,t.transform.height,o);}function $i(t,e,i,o,a,r){const s=t.context,n=s.gl;n.enable(n.SCISSOR_TEST),n.scissor(e*t.pixelRatio,i*t.pixelRatio,o*t.pixelRatio,a*t.pixelRatio),s.clear({color:r}),n.disable(n.SCISSOR_TEST);}function Xi(e,i,o){const a=e.context,r=a.gl,s=o.posMatrix,n=e.useProgram("debug"),l=wi.disabled,c=Ei.disabled,h=e.colorModeForRenderPass(),u="$debug",d=e.style.terrain&&e.style.terrain.getTerrainData(o);a.activeTexture.set(r.TEXTURE0),e.emptyTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE);const m=i.getTileByID(o.key).latestRawTileData,_=Math.floor((m&&m.byteLength||0)/1024),p=i.getTile(o).tileSize,f=512/Math.min(p,512)*(o.overscaledZ/e.transform.zoom)*.5;let g=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(g+=` => ${o.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,o=t.context.gl,a=t.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(e,5,5),a.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);}(e,`${g} ${_}kB`),n.draw(a,r.TRIANGLES,l,c,yi.alphaBlended,Ii.disabled,ge(s,t.Color.transparent,f),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),n.draw(a,r.LINE_STRIP,l,c,h,Ii.disabled,ge(s,t.Color.red),d,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);}function Wi(t,e,i){const o=t.context,a=o.gl,r=t.colorModeForRenderPass(),s=new wi(a.LEQUAL,wi.ReadWrite,t.depthRangeFor3D),n=t.useProgram("terrain"),l=e.getTerrainMesh(),c=e.getTerrainData(i.tileID);o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]),o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,e.getRTTFramebuffer().colorAttachment.get());const h=t.transform.calculatePosMatrix(i.tileID.toUnwrapped());n.draw(o,a.TRIANGLES,s,Ei.disabled,r,Ii.backCCW,{u_matrix:h,u_texture:0},c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments);}function Hi(t,e,i,o){const a=t.context,r=i.tileSize*e.qualityFactor;i.textures[o]||(i.textures[o]=t.getTileTexture(r)||new l(a,{width:r,height:r,data:null},a.gl.RGBA),i.textures[o].bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),0===o&&e.sourceCache.renderHistory.unshift(i.tileID.key));const s=e.getRTTFramebuffer();s.colorAttachment.set(i.textures[o].texture),a.bindFramebuffer.set(s.framebuffer),a.viewport.set([0,0,r,r]);}class Ki{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init();}_init(){const t=this.painter.style,e=t.terrain;for(const i in t.sourceCaches){this._coordsDescendingInv[i]={};const o=t.sourceCaches[i].getVisibleCoordinates();for(const t of o){const o=e.sourceCache.getTerrainCoords(t);for(const t in o)this._coordsDescendingInv[i][t]||(this._coordsDescendingInv[i][t]=[]),this._coordsDescendingInv[i][t].push(o[t]);}}for(const e of t._order){const i=t._layers[e],o=i.source;if(this._renderToTexture[i.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(const t in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][t]=this._coordsDescendingInv[o][t].map((t=>t.key)).sort().join();}}return this._renderableTiles.forEach((t=>{for(const i in this._coordsDescendingInvStr){const o=this._coordsDescendingInvStr[i][t.tileID.key];o&&o!==t.textureCoords[i]&&t.clearTextures(this.painter),e.needsRerender(i,t.tileID)&&t.clearTextures(this.painter);}this._rerender[t.tileID.key]=!t.textures.length;})),e.clearRerenderCache(),e.sourceCache.removeOutdated(this.painter),this}renderLayer(e){const i=e.type,o=this.painter,a=o.style._order,r=o.currentLayer,s=r+1===a.length;if(this._renderToTexture[i]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(a[r]),!s))return !0;if(this._renderToTexture[this._prevType]||"hillshade"===i||this._renderToTexture[i]&&s){this._prevType=i;const s=this._stacks.length-1,n=this._stacks[s]||[];for(const e of this._renderableTiles){if(Hi(o,o.style.terrain,e,s),this._rerender[e.tileID.key]){o.context.clear({color:t.Color.transparent});for(let t=0;ti.style.terrain.getElevation(r,t,e):null);}}}(a,e,o,i,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),r),0!==o.paint.get("icon-opacity").constantOr(1)&&Ai(e,i,o,a,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),s,n),0!==o.paint.get("text-opacity").constantOr(1)&&Ai(e,i,o,a,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),s,n),i.map.showCollisionBoxes&&(Si(e,i,o,a,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Si(e,i,o,a,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1));},circle:function(e,i,o,a){if("translucent"!==e.renderPass)return;const r=o.paint.get("circle-opacity"),s=o.paint.get("circle-stroke-width"),n=o.paint.get("circle-stroke-opacity"),l=!o.layout.get("circle-sort-key").isConstant();if(0===r.constantOr(1)&&(0===s.constantOr(1)||0===n.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,wi.ReadOnly),d=Ei.disabled,m=e.colorModeForRenderPass(),_=[];for(let r=0;rt.sortKey-e.sortKey));for(const t of _){const{programConfiguration:i,program:a,layoutVertexBuffer:r,indexBuffer:s,uniformValues:n,terrainData:l}=t.state;a.draw(c,h.TRIANGLES,u,d,m,Ii.disabled,n,l,o.id,r,s,t.segments,o.paint,e.transform.zoom,i);}},heatmap:function(e,i,o,a){if(0!==o.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const r=e.context,s=r.gl,n=Ei.disabled,l=new yi([s.ONE,s.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const o=t.gl;t.activeTexture.set(o.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let a=i.heatmapFbo;if(a)o.bindTexture(o.TEXTURE_2D,a.colorAttachment.get()),t.bindFramebuffer.set(a.framebuffer);else {const r=o.createTexture();o.bindTexture(o.TEXTURE_2D,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),a=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,o){const a=t.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,e.width/4,e.height/4,0,a.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),o.colorAttachment.set(i);}(t,e,r,a);}}(r,e,o),r.clear({color:t.Color.transparent});for(let t=0;t{const r=t.create();t.ortho(r,0,e.width,e.height,0,0,1);const s=e.context.gl;return {u_matrix:r,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom);}(e,o));},line:function(e,i,o,a){if("translucent"!==e.renderPass)return;const r=o.paint.get("line-opacity"),s=o.paint.get("line-width");if(0===r.constantOr(1)||0===s.constantOr(1))return;const n=e.depthModeForSublayer(0,wi.ReadOnly),c=e.colorModeForRenderPass(),h=o.paint.get("line-dasharray"),u=o.paint.get("line-pattern"),d=u.constantOr(1),m=o.paint.get("line-gradient"),_=o.getCrossfadeParameters(),p=d?"linePattern":h?"lineSDF":m?"lineGradient":"line",f=e.context,g=f.gl;let x=!0;for(const r of a){const a=i.getTile(r);if(d&&!a.patternsLoaded())continue;const s=a.getBucket(o);if(!s)continue;const v=s.programConfigurations.get(o.id),y=e.context.program.get(),b=e.useProgram(p,v),w=x||b.program!==y,T=e.style.terrain&&e.style.terrain.getTerrainData(r),E=u.constantOr(null);if(E&&a.imageAtlas){const t=a.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&v.setConstantPatternPositions(e,i);}const I=T?r:null,C=d?Te(e,a,o,_,I):h?Ee(e,a,o,h,_,I):m?we(e,a,o,s.lineClipsArray.length,I):be(e,a,o,I);if(d)f.activeTexture.set(g.TEXTURE0),a.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),v.updatePaintBuffers(_);else if(h&&(w||e.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(f);else if(m){const a=s.gradients[o.id];let n=a.texture;if(o.gradientVersion!==a.version){let c=256;if(o.stepInterpolant){const o=i.getSource().maxzoom,a=r.canonical.z===o?Math.ceil(1<256&&this.clearStencil(),i.setColorMode(yi.disabled),i.setDepthMode(wi.disabled);const a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,r=this.style.terrain&&this.style.terrain.getTerrainData(t);a.draw(i,o.TRIANGLES,wi.disabled,new Ei({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),yi.disabled,Ii.disabled,xe(t.posMatrix),r,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ei({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ei({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),o=i[i.length-1].overscaledZ,a=i[0].overscaledZ-o+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const t={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=a[t.source],i=s[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i);}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer{i.source&&!i.isHidden(this.transform.zoom)&&(i.source!==(e&&e.id)&&(e=this.style.sourceCaches[i.source]),(!t||t.getSource().maxzoom0?e.pop():null}isPatternMissing(t){if(!t)return !1;if(!t.from||!t.to)return !0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new ne(this.context,t,oe[t],e,Re[t],this._showOverdrawInspector,this.style.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy();}}class Qi{constructor(t,e){this.points=t,this.planes=e;}static fromInvProjectionMatrix(e,i,o){const a=Math.pow(2,o),r=[[-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((o=>{const r=1/(o=t.transformMat4([],o,e))[3]/i*a;return t.mul$1(o,o,[r,r,1/o[3],r])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const i=t.sub([],r[e[0]],r[e[1]]),o=t.sub([],r[e[2]],r[e[1]]),a=t.normalize([],t.cross([],i,o)),s=-t.dot(a,r[e[1]]);return a.concat(s)}));return new Qi(r,s)}}class to{constructor(e,i){this.min=e,this.max=i,this.center=t.scale$1([],t.add([],this.min,this.max),.5);}quadrant(e){const i=[e%2==0,e<2],o=t.clone$2(this.min),a=t.clone$2(this.max);for(let t=0;t=0&&s++;if(0===s)return 0;s!==i.length&&(o=!1);}if(o)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,o=-Number.MAX_VALUE;for(let a=0;athis.max[t]-this.min[t])return 0}return 1}}class eo{constructor(t=0,e=0,i=0,o=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=o;}interpolate(e,i,o){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,o)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,o)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,o)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,o)),this}getCenter(e,i){const o=t.clamp((this.left+e-this.right)/2,0,e),a=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new eo(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class io{constructor(e,i,o,a,r){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===r||!!r,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==o?0:o,this._maxPitch=null==a?60:a,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new eo,this._posMatrixCache={},this._alignedPosMatrixCache={};}clone(){const t=new io(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t));}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t));}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return -this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;var o;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(o=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o),function(t,e,i){var o=e[0],a=e[1],r=e[2],s=e[3],n=Math.sin(i),l=Math.cos(i);t[0]=o*l+r*n,t[1]=a*l+s*n,t[2]=o*-n+r*l,t[3]=a*-n+s*l;}(this.rotationMatrix,this.rotationMatrix,this.angle));}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices());}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices());}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const o=this.pointCoordinate(new t.pointGeometry(0,0)),a=this.pointCoordinate(new t.pointGeometry(this.width,0)),r=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),s=this.pointCoordinate(new t.pointGeometry(0,this.height)),n=Math.floor(Math.min(o.x,a.x,r.x,s.x)),l=Math.floor(Math.max(o.x,a.x,r.x,s.x)),c=1;for(let o=n-c;o<=l+c;o++)0!==o&&i.push(new t.UnwrappedTileID(o,e));}return i}coveringTiles(e){var i,o;let a=this.coveringZoomLevel(e);const r=a;if(void 0!==e.minzoom&&ae.maxzoom&&(a=e.maxzoom);const s=this.pointCoordinate(this.getCameraPoint()),n=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,a),c=[l*s.x,l*s.y,0],h=[l*n.x,l*n.y,0],u=Qi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a);let d=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(d=a);const m=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,_=t=>({aabb:new to([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),p=[],f=[],g=a,x=e.reparseOverscaled?r:a;if(this._renderWorldCopies)for(let t=1;t<=3;t++)p.push(_(-t)),p.push(_(t));for(p.push(_(0));p.length>0;){const a=p.pop(),r=a.x,s=a.y;let n=a.fullyVisible;if(!n){const t=a.aabb.intersects(u);if(0===t)continue;n=2===t;}const l=e.terrain?c:h,_=a.aabb.distanceX(l),v=a.aabb.distanceY(l),y=Math.max(Math.abs(_),Math.abs(v)),b=m+(1<b&&a.zoom>=d){const e=g-a.zoom,i=c[0]-.5-(r<>1),u=a.zoom+1;let d=a.aabb.quadrant(l);if(e.terrain){const r=new t.OverscaledTileID(u,a.wrap,u,c,h),s=e.terrain.getMinMaxElevation(r),n=null!==(i=s.minElevation)&&void 0!==i?i:this.elevation,l=null!==(o=s.maxElevation)&&void 0!==o?o:this.elevation;d=new to([d.min[0],d.min[1],n],[d.max[0],d.max[1],l]);}p.push({aabb:d,zoom:u,x:c,y:h,wrap:a.wrap,fullyVisible:n});}}return f.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0);}getElevation(e,i){const o=t.MercatorCoordinate.fromLngLat(e),a=(1<s&&(a=s-e);}if(this.lngRange){const e=(n+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),a=c.x/2;i-al&&(o=l-a);}void 0===o&&void 0===a||(this.center=this.unproject(new t.pointGeometry(void 0!==o?o:u.x,void 0!==a?a:u.y)).wrap()),this._unmodified=h,this._constraining=!1;}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let a=t.identity(new Float64Array(16));t.scale(a,a,[this.width/2,-this.height/2,1]),t.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=t.identity(new Float64Array(16)),t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const r=Math.PI/2+this._pitch,s=this._fov*(.5+e.y/this.height),n=Math.sin(s)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-r-s,.01,Math.PI-.01)),l=this.getHorizon(),c=2*Math.atan(l/this.cameraToCenterDistance)*(.5+e.y/(2*l)),h=Math.sin(c)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-r-c,.01,Math.PI-.01)),u=Math.cos(Math.PI/2-this._pitch)*n+this.cameraToSeaLevelDistance,d=Math.cos(Math.PI/2-this._pitch)*h+this.cameraToSeaLevelDistance,m=1.01*Math.min(u,d),_=this.height/50;a=new Float64Array(16),t.perspective(a,this._fov,this.width/this.height,_,m),a[8]=2*-e.x/this.width,a[9]=2*e.y/this.height,t.scale(a,a,[1,-1,1]),t.translate(a,a,[0,0,-this.cameraToCenterDistance]),t.rotateX(a,a,this._pitch),t.rotateZ(a,a,this.angle),t.translate(a,a,[-i,-o,0]),this.mercatorMatrix=t.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),t.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,a),t.translate(a,a,[0,0,-this.elevation]),this.projMatrix=a,this.invProjMatrix=t.invert([],a),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,a);const p=this.width%2/2,f=this.height%2/2,g=Math.cos(this.angle),x=Math.sin(this.angle),v=i-Math.round(i)+g*p+x*f,y=o-Math.round(o)+g*f+x*p,b=new Float64Array(a);if(t.translate(b,b,[v>.5?v-1:v,y>.5?y-1:y,0]),this.alignedProjMatrix=b,a=t.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={};}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.pointGeometry(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return [e[0],i];{let o=i.x,a=i.y,r=i.x,s=i.y;for(const t of e)o=Math.min(o,t.x),a=Math.min(a,t.y),r=Math.max(r,t.x),s=Math.max(s,t.y);return [new t.pointGeometry(o,a),new t.pointGeometry(r,a),new t.pointGeometry(r,s),new t.pointGeometry(o,s),new t.pointGeometry(o,a)]}}}class oo{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,o=null;const a=()=>{o=null,i&&(t(),o=setTimeout(a,300),i=!1);};return ()=>(i=!0,o||a(),o)}(this._updateHashUnthrottled.bind(this));}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,o=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,o),r=Math.round(e.lng*a)/a,s=Math.round(e.lat*a)/a,n=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${r}/${s}/${i}`:`${i}/${s}/${r}`,(n||l)&&(c+="/"+Math.round(10*n)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const o=i.split("=")[0];return o===t?(e=!0,`${o}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return `#${c}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t);})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t);}catch(t){}}}const ao={linearity:.3,easing:t.bezier(0,0,.3,1)},ro=t.extend({deceleration:2500,maxSpeed:1400},ao),so=t.extend({deceleration:20,maxSpeed:1400},ao),no=t.extend({deceleration:1e3,maxSpeed:360},ao),lo=t.extend({deceleration:1e3,maxSpeed:90},ao);class co{constructor(t){this._map=t,this.clear();}clear(){this._inertiaBuffer=[];}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e});}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift();}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(i.pan.mag()){const r=uo(i.pan.mag(),o,t.extend({},ro,e||{}));a.offset=i.pan.mult(r.amount/i.pan.mag()),a.center=this._map.transform.center,ho(a,r);}if(i.zoom){const t=uo(i.zoom,o,so);a.zoom=this._map.transform.zoom+t.amount,ho(a,t);}if(i.bearing){const e=uo(i.bearing,o,no);a.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),ho(a,e);}if(i.pitch){const t=uo(i.pitch,o,lo);a.pitch=this._map.transform.pitch+t.amount,ho(a,t);}if(a.zoom||a.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter();}return this.clear(),t.extend(a,{noMoveStart:!0})}}function ho(t,e){(!t.duration||t.durationi.unproject(t))),l=s.reduce(((t,e,i,o)=>t.add(e.div(o.length))),new t.pointGeometry(0,0));super(e,{points:s,point:l,lngLats:n,lngLat:i.unproject(l),originalEvent:o}),this._defaultPrevented=!1;}preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}}class po extends t.Event{constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1;}preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}}class fo{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance;}reset(){delete this._mousedownPos;}wheel(t){return this._firePreventable(new po(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new mo(t.type,this._map,t))}mouseup(t){this._map.fire(new mo(t.type,this._map,t));}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new mo(t.type,this._map,t));}dblclick(t){return this._firePreventable(new mo(t.type,this._map,t))}mouseover(t){this._map.fire(new mo(t.type,this._map,t));}mouseout(t){this._map.fire(new mo(t.type,this._map,t));}touchstart(t){return this._firePreventable(new _o(t.type,this._map,t))}touchmove(t){this._map.fire(new _o(t.type,this._map,t));}touchend(t){this._map.fire(new _o(t.type,this._map,t));}touchcancel(t){this._map.fire(new _o(t.type,this._map,t));}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class go{constructor(t){this._map=t;}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent;}mousemove(t){this._map.fire(new mo(t.type,this._map,t));}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new mo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new mo(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class xo{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;}isEnabled(){return !!this._enabled}isActive(){return !!this._active}enable(){this.isEnabled()||(this._enabled=!0);}disable(){this.isEnabled()&&(this._enabled=!1);}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(r.disableDrag(),this._startPos=this._lastPos=e,this._active=!0);}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)t.fitScreenCoordinates(o,a,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e);}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t));}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos;}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function vo(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=vo(o,i)));}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const o=vo(i,e);for(const t in this.touches){const e=this.touches[t],i=o[t];(!i||i.dist(e)>30)&&(this.aborted=!0);}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class bo{constructor(t){this.singleTap=new yo(t),this.numTaps=t.numTaps,this.reset();}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();}touchstart(t,e,i){this.singleTap.touchstart(t,e,i);}touchmove(t,e,i){this.singleTap.touchmove(t,e,i);}touchend(t,e,i){const o=this.singleTap.touchend(t,e,i);if(o){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(o)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class wo{constructor(){this._zoomIn=new bo({numTouches:1,numTaps:2}),this._zoomOut=new bo({numTouches:2,numTaps:1}),this.reset();}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);}touchend(t,e,i){const o=this._zoomIn.touchend(t,e,i),a=this._zoomOut.touchend(t,e,i);return o?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(o)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}):void 0}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}const To={0:1,2:2};class Eo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1;}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton;}_correctButton(t,e){return !1}_move(t,e){return {}}mousedown(t,e){if(this._lastPoint)return;const i=r.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i);}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){const i=To[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i){this._cancelCooperativeMessage=!1;}),200);}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length0&&(this._active=!0);const a=vo(o,i),r=new t.pointGeometry(0,0),s=new t.pointGeometry(0,0);let n=0;for(const t in a){const e=a[t],i=this._touches[t];i&&(r._add(e),s._add(e.sub(i)),n++,a[t]=e);}if(this._touches=a,nMath.abs(t.x)}class Bo extends zo{constructor(t){super(),this._map=t;}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints;}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length;}_start(t){this._lastPoints=t,ko(t[0].sub(t[1]))&&(this._valid=!1);}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const o=t.mag()>=2,a=e.mag()>=2;if(!o&&!a)return;if(!o||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const r=t.y>0==e.y>0;return ko(t)&&ko(e)&&r}}const Fo={panStep:100,bearingStep:15,pitchStep:10};class Oo{constructor(){const t=Fo;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1;}reset(){this._active=!1;}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,o=0,a=0,r=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?o=1:(t.preventDefault(),r=-1);break;case 40:t.shiftKey?o=-1:(t.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,o=0),{cameraAnimation:s=>{const n=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Uo,zoom:e?Math.round(n)+e*(t.shiftKey?2:1):n,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+o*this._pitchStep,offset:[-a*this._panStep,-r*this._panStep],center:s.getCenter()},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0;}enableRotation(){this._rotationDisabled=!1;}}function Uo(t){return t*(2-t)}const No=4.000244140625;class Go{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this);}setZoomRate(t){this._defaultZoomRate=t;}setWheelZoomRate(t){this._wheelZoomRate=t;}isEnabled(){return !!this._enabled}isActive(){return !!this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around);}disable(){this.isEnabled()&&(this._enabled=!1);}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;e.preventDefault();}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const o=t.exported.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==i&&i%No==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault();}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t);}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>No?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const o="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,o=this._startZoom,a=this._easing;let r,s=!1;if("wheel"===this._type&&o&&a){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),n=a(e);r=t.number(o,i,n),e<1?this._frameId||(this._frameId=!0):s=!0;}else r=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:r-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,o=(t.exported.now()-e.start)/e.duration,a=e.easing(o+.01)-e.easing(o),r=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-r*r);i=t.bezier(r,s,.25,1);}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1;}}class Zo{constructor(t,e){this._clickZoom=t,this._tapZoom=e;}enable(){this._clickZoom.enable(),this._tapZoom.enable();}disable(){this._clickZoom.disable(),this._tapZoom.disable();}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Vo{constructor(){this.reset();}reset(){this._active=!1;}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(){this._tap=new bo({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset();}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i));}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const o=e[0],a=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:a/128}}}else this._tap.touchmove(t,e,i);}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp);}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class jo{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class $o{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable();}disable(){this._mouseRotate.disable(),this._mousePitch.disable();}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Xo{constructor(t,e,i,o){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0;}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate");}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable();}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();}}const Wo=t=>t.zoom||t.drag||t.pitch||t.rotate;class Ho extends t.Event{}function Ko(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class Yo{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new co(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)r.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}destroy(){for(const[t,e,i]of this._listeners)r.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new fo(e,t));const o=e.boxZoom=new xo(e,t);this._add("boxZoom",o);const a=new wo,r=new Vo;e.doubleClickZoom=new Zo(r,a),this._add("tapZoom",a),this._add("clickZoom",r);const s=new qo;this._add("tapDragZoom",s);const n=e.touchPitch=new Bo(e);this._add("touchPitch",n);const l=new Co(t),c=new So(t);e.dragRotate=new $o(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const h=new Io(t),u=new Do(t,e);e.dragPan=new jo(i,h,u),this._add("mousePan",h),this._add("touchPan",u,["touchZoom","touchRotate"]);const d=new Ro,m=new Ao;e.touchZoomRotate=new Xo(i,m,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const _=e.scrollZoom=new Go(e,this);this._add("scrollZoom",_,["mousePan"]);const p=e.keyboard=new Oo;this._add("keyboard",p),this._add("blockableMapEvent",new go(e));for(const i of ["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i]);}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e;}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[];}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return !0;return !1}isZooming(){return !!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return !!this._eventsInProgress.rotate}isMoving(){return Boolean(Wo(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const o in t)if(o!==i&&(!e||e.indexOf(o)<0))return !0;return !1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`);}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,o={needsRenderFrame:!1},a={},s={},n=t.touches,l=n?this._getMapTouches(n):void 0,c=l?r.touchPos(this._el,l):r.mousePos(this._el,t);for(const{handlerName:r,handler:n,allowed:h}of this._handlers){if(!n.isEnabled())continue;let u;this._blockedByActive(s,h,r)?n.reset():n[e||t.type]&&(u=n[e||t.type](t,c,l),this.mergeHandlerResult(o,a,u,r,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||n.isActive())&&(s[r]=n);}const h={};for(const t in this._previousActiveHandlers)s[t]||(h[t]=i);this._previousActiveHandlers=s,(Object.keys(h).length||Ko(o))&&(this._changes.push([o,a,h]),this._triggerRenderFrame()),(Object.keys(s).length||Ko(o))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=o;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map));}mergeHandlerResult(e,i,o,a,r){if(!o)return;t.extend(e,o);const s={handlerName:a,originalEvent:o.originalEvent||r};void 0!==o.zoomDelta&&(i.zoom=s),void 0!==o.panDelta&&(i.drag=s),void 0!==o.pitchDelta&&(i.pitch=s),void 0!==o.bearingDelta&&(i.rotate=s);}_applyChanges(){const e={},i={},o={};for(const[a,r,s]of this._changes)a.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(a.panDelta)),a.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+a.pitchDelta),void 0!==a.around&&(e.around=a.around),void 0!==a.pinchAround&&(e.pinchAround=a.pinchAround),a.noInertia&&(e.noInertia=a.noInertia),t.extend(i,r),t.extend(o,s);this._updateMapTransform(e,i,o),this._changes=[];}_updateMapTransform(e,i,o){const a=this._map,r=a.transform,s=a.style&&a.style.terrain;if(!(Ko(e)||s&&this._drag))return this._fireEvents(i,o,!0);let{panDelta:n,zoomDelta:l,bearingDelta:c,pitchDelta:h,around:u,pinchAround:d}=e;void 0!==d&&(u=d),a._stop(!0),u=u||a.transform.centerPoint;const m=r.pointLocation(n?u.sub(n):u);c&&(r.bearing+=c),h&&(r.pitch+=h),l&&(r.zoom+=l),s?i.drag&&!this._drag?(this._drag={center:r.centerPoint,lngLat:r.pointLocation(u),point:u,handlerName:i.drag.handlerName},a.fire(new t.Event("freezeElevation",{freeze:!0}))):this._drag&&o[this._drag.handlerName]?(a.fire(new t.Event("freezeElevation",{freeze:!1})),this._drag=null):i.drag&&this._drag&&(r.center=r.pointLocation(r.centerPoint.sub(n))):r.setLocationAtPoint(m,u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,o,!0);}_fireEvents(e,i,o){const a=Wo(this._eventsInProgress),r=Wo(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t];}!a&&r&&this._fireEvent("movestart",r.originalEvent);for(const t in s)this._fireEvent(t,s[t]);r&&this._fireEvent("move",r.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i);}const n={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:o}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||o,n[`${t}end`]=l);}for(const t in n)this._fireEvent(t,n[t]);const c=Wo(this._eventsInProgress);if(o&&(a||r)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ho("renderFrame",{timeStamp:t})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}const Jo={extend:(e,...i)=>t.extend(e,...i),run(t){t();},logToElement(t,e=!1,i="log"){const o=window.document.getElementById(i);o&&(e&&(o.innerHTML=""),o.innerHTML+=`
${t}`);}};class Qo extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this);}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,o){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),o)}panTo(e,i,o){return this.easeTo(t.extend({center:e},i),o)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,o){return this.easeTo(t.extend({zoom:e},i),o)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,o){return this.easeTo(t.extend({bearing:e},i),o)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=t.number(a,l,e)),this._rotating&&(o.bearing=t.number(r,c,e)),this._pitching&&(o.pitch=t.number(s,h,e)),this._padding&&(o.interpolatePadding(n,u,e),m=o.centerPoint.add(d)),v)o.setLocationAtPoint(v,y);else {const t=o.zoomScale(o.zoom-a),i=l>a?Math.min(2,x):Math.max(.5,x),r=Math.pow(i,1-e),s=o.unproject(f.add(g.mult(e*r)).mult(t));o.setLocationAtPoint(o.renderWorldCopies?s.wrap():s,m);}this._fireMoveEvents(i);}),(t=>{this._afterEase(i,t);}),e),this}_prepareEase(e,i,o={}){this._moving=!0,this.fire(new t.Event("freezeElevation",{freeze:!0})),i||o.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!o.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new t.Event("pitchstart",e));}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e));}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId,this.fire(new t.Event("freezeElevation",{freeze:!1}));const o=this._zooming,a=this._rotating,r=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new t.Event("zoomend",e)),a&&this.fire(new t.Event("rotateend",e)),r&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e));}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const o=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(o,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const o=this.transform,a=this.getZoom(),r=this.getBearing(),s=this.getPitch(),n=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,c="bearing"in e?this._normalizeBearing(e.bearing,r):r,h="pitch"in e?+e.pitch:s,u="padding"in e?e.padding:o.padding,d=o.zoomScale(l-a),m=t.pointGeometry.convert(e.offset);let _=o.centerPoint.add(m);const p=o.pointLocation(_),f=t.LngLat.convert(e.center||p);this._normalizeCenter(f);const g=o.project(p),x=o.project(f).sub(g);let v=e.curve;const y=Math.max(o.width,o.height),b=y/d,w=x.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,a,l),o.minZoom,o.maxZoom),r=y/o.zoomScale(i-a);v=Math.sqrt(r/w*2);}const T=v*v;function E(t){const e=(b*b-y*y+(t?-1:1)*T*T*w*w)/(2*(t?b:y)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function I(t){return (Math.exp(t)-Math.exp(-t))/2}function C(t){return (Math.exp(t)+Math.exp(-t))/2}const S=E(0);let D=function(t){return C(S)/C(S+v*t)},z=function(t){return y*((C(S)*(I(e=S+v*t)/C(e))-I(S))/T)/w;var e;},P=(E(1)-S)/v;if(Math.abs(w)<1e-6||!isFinite(P)){if(Math.abs(y-b)<1e-6)return this.easeTo(e,i);const t=be.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==c,this._pitching=h!==s,this._padding=!o.isPaddingEqual(u),this._prepareEase(i,!1),this._ease((e=>{const d=e*P,p=1/D(d);o.zoom=1===e?l:a+o.scaleZoom(p),this._rotating&&(o.bearing=t.number(r,c,e)),this._pitching&&(o.pitch=t.number(s,h,e)),this._padding&&(o.interpolatePadding(n,u,e),_=o.centerPoint.add(m));const v=1===e?f:o.unproject(g.add(x.mult(z(d))).mult(p));o.setLocationAtPoint(o.renderWorldCopies?v.wrap():v,_),this._fireMoveEvents(i);}),(()=>this._afterEase(i)),e),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e);}if(!t){const t=this.handlers;t&&t.stop(!1);}return this}_ease(e,i,o){!1===o.animate||0===o.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const o=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0;}}class ta{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this);}getDefaultPosition(){return "bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=r.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0;}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i);}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")));}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions();}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id;}const e=this._map.style.sourceCaches;for(const i in e){const o=e[i];if(o.used||o.usedForTerrain){const e=o.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution);}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let o=i+1;o=0)return !1;return !0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null);}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"));}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show");}}class ea{constructor(e={}){this.options=e,t.bindAll(["_updateCompact"],this);}getDefaultPosition(){return "bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=r.create("div","maplibregl-ctrl mapboxgl-ctrl");const e=r.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){r.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0;}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact");}}}class ia{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}const oa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},aa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ra={showCompass:!0,showZoom:!0,visualizePitch:!1};class sa{constructor(e,i,o=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Co({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,o&&(this.mousePitch=new So({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener(i,"mousedown",this.mousedown),r.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),r.addEventListener(i,"touchmove",this.touchmove),r.addEventListener(i,"touchend",this.touchend),r.addEventListener(i,"touchcancel",this.reset);}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag();}move(t,e){const i=this.map,o=this.mouseRotate.mousemoveWindow(t,e);if(o&&o.bearingDelta&&i.setBearing(i.getBearing()+o.bearingDelta),this.mousePitch){const o=this.mousePitch.mousemoveWindow(t,e);o&&o.pitchDelta&&i.setPitch(i.getPitch()+o.pitchDelta);}}off(){const t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp();}offTemp(){r.enableDrag(),r.removeEventListener(window,"mousemove",this.mousemove),r.removeEventListener(window,"mouseup",this.mouseup);}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),r.mousePos(this.element,e)),r.addEventListener(window,"mousemove",this.mousemove),r.addEventListener(window,"mouseup",this.mouseup);}mousemove(t){this.move(t,r.mousePos(this.element,t));}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp();}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos));}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos));}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const t=o.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=o.width&&t.y<=o.height)break;e.lng>o.center.lng?e.lng-=360:e.lng+=360;}return e}const la={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ca(t,e,i){const o=t.classList;for(const t in la)o.remove(`maplibregl-${i}-anchor-${t}`,`mapboxgl-${i}-anchor-${t}`);o.add(`maplibregl-${i}-anchor-${e}`,`mapboxgl-${i}-anchor-${e}`);}class ha extends t.Evented{constructor(e,i){if(super(),(e instanceof HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else {this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");const i=r.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${o}px`),i.setAttributeNS(null,"width",`${a}px`),i.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"fill-rule","evenodd");const n=r.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");const l=r.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=r.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e);}const h=r.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=r.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(u);const d=r.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const m=r.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(m);const _=r.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(6.0, 7.0)"),_.setAttributeNS(null,"fill","#FFFFFF");const p=r.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(8.0, 8.0)");const f=r.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");const g=r.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),p.appendChild(f),p.appendChild(g),n.appendChild(l),n.appendChild(h),n.appendChild(d),n.appendChild(_),n.appendChild(p),i.appendChild(n),i.setAttributeNS(null,"height",o*this._scale+"px"),i.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(i),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14]);}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault();})),this._element.addEventListener("mousedown",(t=>{t.preventDefault();})),ca(this._element,this._anchor,"marker"),this._popup=null;}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),r.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,o=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[o,-1*(e-i+o)],"bottom-right":[-o,-1*(e-i+o)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset;}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress);}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup();}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup();}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=na(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),r.setTransform(this._element,`${la[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null;}),100));}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t;}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")));}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive";}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp));}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ua={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let da,ma=0,_a=!1;const pa={maxWidth:100,unit:"metric"};function fa(t,e,i){const o=i&&i.maxWidth||100,a=t._container.clientHeight/2,r=t.unproject([0,a]),s=t.unproject([o,a]),n=r.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*n;i>5280?ga(e,o,i/5280,t._getUIString("ScaleControl.Miles")):ga(e,o,i,t._getUIString("ScaleControl.Feet"));}else i&&"nautical"===i.unit?ga(e,o,n/1852,t._getUIString("ScaleControl.NauticalMiles")):n>=1e3?ga(e,o,n/1e3,t._getUIString("ScaleControl.Kilometers")):ga(e,o,n,t._getUIString("ScaleControl.Meters"));}function ga(t,e,i,o){const a=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(a/i)+"px",t.innerHTML=`${a} ${o}`;}const xa={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},va=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ya(e){if(e){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return {center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-left":new t.pointGeometry(i,i),"top-right":new t.pointGeometry(-i,i),bottom:new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(i,-i),"bottom-right":new t.pointGeometry(-i,-i),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){const i=t.pointGeometry.convert(e);return {center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return {center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0])}}return ya(new t.pointGeometry(0,0))}const ba={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends Qo{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},aa,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new io(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ia,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},oa,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this._requestManager=new s(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else {if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container;}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0);})),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Yo(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new oo("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ta({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ea,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet);})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e));})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e));})),this.on("dataabort",(e=>{this.fire(new t.Event("sourcedataabort",e));}));}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=e.onAdd(this);this._controls.push(e);const a=this._controlPositions[i];return -1!==i.indexOf("bottom")?a.insertBefore(o,a.firstChild):a.appendChild(o),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,o){return null==o&&this.style.terrain&&(o=this.transform.getElevation(i,this.style.terrain)),super.calculateCameraOptionsFromTo(t,e,i,o)}resize(e){const i=this._containerDimensions(),o=i[0],a=i[1];this._resizeCanvas(o,a,this.getPixelRatio()),this.transform.resize(o,a),this.painter.resize(o,a,this.getPixelRatio());const r=!this._moving;return r&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),r&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t);}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.style.terrain)}unproject(e){return this.transform.pointLocation(t.pointGeometry.convert(e),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let o=!1;const a=a=>{const r=this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[];r.length?o||(o=!0,i.call(this,new mo(t,this,a.originalEvent,{features:r}))):o=!1;};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:()=>{o=!1;}}}}if("mouseleave"===t||"mouseout"===t){let o=!1;const a=a=>{(this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,i.call(this,new mo(t,this,a.originalEvent)));},r=e=>{o&&(o=!1,i.call(this,new mo(t,this,e.originalEvent)));};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:r}}}{const o=t=>{const o=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];o.length&&(t.features=o,i.call(this,t),delete t.features);};return {layer:e,listener:i,delegates:{[t]:o}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const o=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o);for(const t in o.delegates)this.on(t,o.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const o=this._createDelegatedListener(t,e,i);for(const t in o.delegates)this.once(t,o.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(o=>{const a=this._delegatedListeners[t];for(let t=0;t{e?this.fire(new t.ErrorEvent(e)):o&&this._updateDiff(o,i);}));}else "object"==typeof e&&this._updateDiff(e,i);}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0);}catch(o){t.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(e,i);}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)));}setTerrain(t){return this.style.setTerrain(t),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return !1}}return !0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:o=1,sdf:a=!1,stretchX:r,stretchY:s,content:n}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:c,data:h}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},h),pixelRatio:o,stretchX:r,stretchY:s,content:n,sdf:a,version:0});}else {if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:l,height:c,data:h}=i,u=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(h)),pixelRatio:o,stretchX:r,stretchY:s,content:n,sdf:a,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e);}}}updateImage(e,i){const o=this.style.getImage(e);if(!o)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:r,height:s,data:n}=a;if(void 0===r||void 0===s)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(r!==o.data.width||s!==o.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));o.data.replace(n,l),this.style.updateImage(e,o);}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t);}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i);}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,o={}){return this.style.setPaintProperty(t,e,i,o),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,o={}){return this.style.setLayoutProperty(t,e,i,o),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");const e=this._canvasContainer=r.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=r.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const o=this._controlContainer=r.create("div","maplibregl-control-container mapboxgl-control-container",t),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{a[t]=r.create("div",`maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`,o);})),this._container.addEventListener("scroll",this._onMapScroll,!1);}_setupCooperativeGestures(){const t=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=r.create("div","maplibregl-cooperative-gesture-screen",t);let e="Control",i="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(i="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",e="Meta"),this._cooperativeGesturesScreen.innerHTML=`\n
${i}
\n
${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
\n `,document.addEventListener("keydown",(t=>{t.key===e&&(this._metaPress=!0);})),document.addEventListener("keyup",(t=>{t.key===e&&(this._metaPress=!1);})),this._canvasContainer.addEventListener("wheel",(t=>{this._onCooperativeGesture(t,this._metaPress,1);}),!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan");}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`;}_setupPainter(){const i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);o?(this.painter=new Ji(o,this.transform),t.exported$1.testSupport(o)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")));}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}));}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}));}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(t,e,i){return !e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show");}),100)),!1}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t);}_render(e){let i,o=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,i),o=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.exported.now();this.style.zoomHistory.update(e,i);const o=new t.EvaluationParameters(e,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=o.crossFadingFactor();1===a&&a===this._crossFadingFactor||(r=!0,this._crossFadingFactor=a),this.style.update(o);}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-o;a.endQueryEXT(a.TIME_ELAPSED_EXT,i),setTimeout((()=>{const o=a.getQueryObjectEXT(i,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:o}));}),50);}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}));}),50);}const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),r.remove(this._canvasContainer),r.remove(this._controlContainer),this._cooperativeGestures&&r.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"));}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e);})));}_onWindowOnline(){this._update();}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update();}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update());}get showPadding(){return !!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update());}get repaint(){return !!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(t){this._vertices=t,this._update();}_setCacheLimits(e,i){t.setCacheLimits(e,i);}get version(){return "2.4.0"}},NavigationControl:class{constructor(e){this.options=t.extend({},ra,e),this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t});})),this._compassIcon=r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"));}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString());}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t;}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new sa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){r.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map;}_createButton(t,e){const i=r.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i);}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},ua,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this);}onAdd(t){var e;return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==da?e(da):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((t=>{da="denied"!==t.state,e(da);})):(da=!!window.navigator.geolocation,e(da)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ma=0,_a=!1;}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish();}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,a=this._map.getBearing(),r=t.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(o),r,{geolocateSource:!0});}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),o=e.distanceTo(i),a=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`;}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===e.code&&_a)return;this._setErrorState();}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish();}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;}_setupUI(e){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=r.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e);}else {const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ha(this._dotElement),this._circleElement=r.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ha({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",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")));}));}trigger(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ma--,_a=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ma++,ma>1?(t={maximumAge:6e5,timeout:0},_a=!0):(t=this.options.positionOptions,_a=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null);}},AttributionControl:ta,LogoControl:ea,ScaleControl:class{constructor(e){this.options=t.extend({},pa,e),t.bindAll(["_onMove","setUnit"],this);}getDefaultPosition(){return "bottom-left"}_onMove(){fa(this._map,this._container,this.options);}onAdd(t){return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0;}setUnit(t){this.options.unit=t,fa(this._map,this._container,this.options);}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange");}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){r.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon);}_checkFullscreenSupport(){return !!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=r.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon);}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t;}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle());}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen();}},TerrainControl:class{constructor(e){this.options=e,t.bindAll(["_toggleTerrain","_updateTerrainIcon"],this);}onAdd(t){return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=r.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){r.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0;}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon();}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"));}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(xa),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this);}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return !!this._map}remove(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let o;for(i.innerHTML=t;o=i.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t);}removeClassName(t){this._container&&this._container.classList.remove(t);}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=r.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose));}_onMouseUp(t){this._update(t.point);}_onMouseMove(t){this._update(t.point);}_onDrag(t){this._update(t.point);}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=r.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=na(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let i=this.options.anchor;const o=ya(this.options.offset);if(!i){const t=this._container.offsetWidth,a=this._container.offsetHeight;let r;r=e.y+o.bottom.ythis._map.transform.height-a?["bottom"]:[],e.xthis._map.transform.width-t/2&&r.push("right"),i=0===r.length?"bottom":r.join("-");}const a=e.add(o[i]).round();r.setTransform(this._container,`${la[i]} translate(${a.x}px,${a.y}px)`),ca(this._container,i,"popup");}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(va);t&&t.focus();}_onClose(){this.remove();}},Marker:ha,Style:ee,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:P,GeoJSONSource:C,ImageSource:D,RasterDEMTileSource:I,RasterTileSource:T,VectorTileSource:w,VideoSource:z,prewarm:function(){j().acquire(G);},clearPrewarmedResources:function(){const t=q;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(G),q=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 version(){return "2.4.0"},get workerCount(){return Z.workerCount},set workerCount(t){Z.workerCount=t;},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e;},clearStorage(e){t.clearTileCache(e);},workerUrl:"",addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i;},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e];}};return Jo.extend(ba,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),ba})); + ) { + if ( + v.x >= f && + v.x <= y && + v.y >= d && + v.y <= m && + v !== i && + v !== s && + Js(o, c, l, h, u, p, v.x, v.y) && + Ys(v.prev, v, v.next) >= 0 + ) + return !1; + if ( + ((v = v.prevZ), + b.x >= f && + b.x <= y && + b.y >= d && + b.y <= m && + b !== i && + b !== s && + Js(o, c, l, h, u, p, b.x, b.y) && + Ys(b.prev, b, b.next) >= 0) + ) + return !1; + b = b.nextZ; + } + for (; v && v.z >= g; ) { + if ( + v.x >= f && + v.x <= y && + v.y >= d && + v.y <= m && + v !== i && + v !== s && + Js(o, c, l, h, u, p, v.x, v.y) && + Ys(v.prev, v, v.next) >= 0 + ) + return !1; + v = v.prevZ; + } + for (; b && b.z <= x; ) { + if ( + b.x >= f && + b.x <= y && + b.y >= d && + b.y <= m && + b !== i && + b !== s && + Js(o, c, l, h, u, p, b.x, b.y) && + Ys(b.prev, b, b.next) >= 0 + ) + return !1; + b = b.nextZ; + } + return !0; + } + function Us(t, e, r) { + var n = t; + do { + var i = n.prev, + a = n.next.next; + !Hs(i, a) && + Ws(i, n, n.next, a) && + eo(i, a) && + eo(a, i) && + (e.push((i.i / r) | 0), + e.push((n.i / r) | 0), + e.push((a.i / r) | 0), + io(n), + io(n.next), + (n = t = a)), + (n = n.next); + } while (n !== t); + return Ds(n); + } + function qs(t, e, r, n, i, a) { + var s = t; + do { + for (var o = s.next.next; o !== s.prev; ) { + if (s.i !== o.i && Xs(s, o)) { + var l = ro(s, o); + return ( + (s = Ds(s, s.next)), + (l = Ds(l, l.next)), + $s(s, e, r, n, i, a, 0), + void $s(l, e, r, n, i, a, 0) + ); + } + o = o.next; + } + s = s.next; + } while (s !== t); + } + function js(t, e) { + return t.x - e.x; + } + function Ns(t, e) { + var r = (function (t, e) { + var r, + n = e, + i = t.x, + a = t.y, + s = -1 / 0; + do { + if (a <= n.y && a >= n.next.y && n.next.y !== n.y) { + var o = n.x + ((a - n.y) * (n.next.x - n.x)) / (n.next.y - n.y); + if ( + o <= i && + o > s && + ((s = o), (r = n.x < n.next.x ? n : n.next), o === i) + ) + return r; + } + n = n.next; + } while (n !== e); + if (!r) return null; + var l, + u = r, + c = r.x, + h = r.y, + p = 1 / 0; + n = r; + do { + i >= n.x && + n.x >= c && + i !== n.x && + Js(a < h ? i : s, a, c, h, a < h ? s : i, a, n.x, n.y) && + ((l = Math.abs(a - n.y) / (i - n.x)), + eo(n, t) && + (l < p || + (l === p && (n.x > r.x || (n.x === r.x && Zs(r, n))))) && + ((r = n), (p = l))), + (n = n.next); + } while (n !== u); + return r; + })(t, e); + if (!r) return e; + var n = ro(r, t); + return Ds(n, n.next), Ds(r, r.next); + } + function Zs(t, e) { + return Ys(t.prev, t, e.prev) < 0 && Ys(e.next, t, t.next) < 0; + } + function Ks(t, e, r, n, i) { + return ( + (t = + 1431655765 & + ((t = + 858993459 & + ((t = + 252645135 & + ((t = 16711935 & ((t = ((t - r) * i) | 0) | (t << 8))) | + (t << 4))) | + (t << 2))) | + (t << 1))) | + ((e = + 1431655765 & + ((e = + 858993459 & + ((e = + 252645135 & + ((e = 16711935 & ((e = ((e - n) * i) | 0) | (e << 8))) | + (e << 4))) | + (e << 2))) | + (e << 1))) << + 1) + ); + } + function Gs(t) { + var e = t, + r = t; + do { + (e.x < r.x || (e.x === r.x && e.y < r.y)) && (r = e), (e = e.next); + } while (e !== t); + return r; + } + function Js(t, e, r, n, i, a, s, o) { + return ( + (i - s) * (e - o) >= (t - s) * (a - o) && + (t - s) * (n - o) >= (r - s) * (e - o) && + (r - s) * (a - o) >= (i - s) * (n - o) + ); + } + function Xs(t, e) { + return ( + t.next.i !== e.i && + t.prev.i !== e.i && + !(function (t, e) { + var r = t; + do { + if ( + r.i !== t.i && + r.next.i !== t.i && + r.i !== e.i && + r.next.i !== e.i && + Ws(r, r.next, t, e) + ) + return !0; + r = r.next; + } while (r !== t); + return !1; + })(t, e) && + ((eo(t, e) && + eo(e, t) && + (function (t, e) { + var r = t, + n = !1, + i = (t.x + e.x) / 2, + a = (t.y + e.y) / 2; + do { + r.y > a != r.next.y > a && + r.next.y !== r.y && + i < ((r.next.x - r.x) * (a - r.y)) / (r.next.y - r.y) + r.x && + (n = !n), + (r = r.next); + } while (r !== t); + return n; + })(t, e) && + (Ys(t.prev, t, e.prev) || Ys(t, e.prev, e))) || + (Hs(t, e) && Ys(t.prev, t, t.next) > 0 && Ys(e.prev, e, e.next) > 0)) + ); + } + function Ys(t, e, r) { + return (e.y - t.y) * (r.x - e.x) - (e.x - t.x) * (r.y - e.y); + } + function Hs(t, e) { + return t.x === e.x && t.y === e.y; + } + function Ws(t, e, r, n) { + var i = to(Ys(t, e, r)), + a = to(Ys(t, e, n)), + s = to(Ys(r, n, t)), + o = to(Ys(r, n, e)); + return ( + (i !== a && s !== o) || + !(0 !== i || !Qs(t, r, e)) || + !(0 !== a || !Qs(t, n, e)) || + !(0 !== s || !Qs(r, t, n)) || + !(0 !== o || !Qs(r, e, n)) + ); + } + function Qs(t, e, r) { + return ( + e.x <= Math.max(t.x, r.x) && + e.x >= Math.min(t.x, r.x) && + e.y <= Math.max(t.y, r.y) && + e.y >= Math.min(t.y, r.y) + ); + } + function to(t) { + return t > 0 ? 1 : t < 0 ? -1 : 0; + } + function eo(t, e) { + return Ys(t.prev, t, t.next) < 0 + ? Ys(t, e, t.next) >= 0 && Ys(t, t.prev, e) >= 0 + : Ys(t, e, t.prev) < 0 || Ys(t, t.next, e) < 0; + } + function ro(t, e) { + var r = new ao(t.i, t.x, t.y), + n = new ao(e.i, e.x, e.y), + i = t.next, + a = e.prev; + return ( + (t.next = e), + (e.prev = t), + (r.next = i), + (i.prev = r), + (n.next = r), + (r.prev = n), + (a.next = n), + (n.prev = a), + n + ); + } + function no(t, e, r, n) { + var i = new ao(t, e, r); + return ( + n + ? ((i.next = n.next), (i.prev = n), (n.next.prev = i), (n.next = i)) + : ((i.prev = i), (i.next = i)), + i + ); + } + function io(t) { + (t.next.prev = t.prev), + (t.prev.next = t.next), + t.prevZ && (t.prevZ.nextZ = t.nextZ), + t.nextZ && (t.nextZ.prevZ = t.prevZ); + } + function ao(t, e, r) { + (this.i = t), + (this.x = e), + (this.y = r), + (this.prev = null), + (this.next = null), + (this.z = 0), + (this.prevZ = null), + (this.nextZ = null), + (this.steiner = !1); + } + function so(t, e, r, n) { + for (var i = 0, a = e, s = r - n; a < r; a += n) + (i += (t[s] - t[a]) * (t[a + 1] + t[s + 1])), (s = a); + return i; + } + function oo(t, e, r, n, i) { + lo(t, e, r || 0, n || t.length - 1, i || co); + } + function lo(t, e, r, n, i) { + for (; n > r; ) { + if (n - r > 600) { + var a = n - r + 1, + s = e - r + 1, + o = Math.log(a), + l = 0.5 * Math.exp((2 * o) / 3), + u = + 0.5 * Math.sqrt((o * l * (a - l)) / a) * (s - a / 2 < 0 ? -1 : 1); + lo( + t, + e, + Math.max(r, Math.floor(e - (s * l) / a + u)), + Math.min(n, Math.floor(e + ((a - s) * l) / a + u)), + i, + ); + } + var c = t[e], + h = r, + p = n; + for (uo(t, r, e), i(t[n], c) > 0 && uo(t, r, n); h < p; ) { + for (uo(t, h, p), h++, p--; i(t[h], c) < 0; ) h++; + for (; i(t[p], c) > 0; ) p--; + } + 0 === i(t[r], c) ? uo(t, r, p) : uo(t, ++p, n), + p <= e && (r = p + 1), + e <= p && (n = p - 1); + } + } + function uo(t, e, r) { + var n = t[e]; + (t[e] = t[r]), (t[r] = n); + } + function co(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function ho(t, e) { + const r = t.length; + if (r <= 1) return [t]; + const n = []; + let i, a; + for (let e = 0; e < r; e++) { + const r = m(t[e]); + 0 !== r && + ((t[e].area = Math.abs(r)), + void 0 === a && (a = r < 0), + a === r < 0 ? (i && n.push(i), (i = [t[e]])) : i.push(t[e])); + } + if ((i && n.push(i), e > 1)) + for (let t = 0; t < n.length; t++) + n[t].length <= e || + (oo(n[t], e, 1, n[t].length - 1, po), (n[t] = n[t].slice(0, e))); + return n; + } + function po(t, e) { + return e.area - t.area; + } + function fo(t, e, r) { + const n = r.patternDependencies; + let i = !1; + for (const r of e) { + const e = r.paint.get(`${t}-pattern`); + e.isConstant() || (i = !0); + const a = e.constantOr(null); + a && ((i = !0), (n[a.to] = !0), (n[a.from] = !0)); + } + return i; + } + function yo(t, e, r, n, i) { + const a = i.patternDependencies; + for (const s of e) { + const e = s.paint.get(`${t}-pattern`).value; + if ('constant' !== e.kind) { + let t = e.evaluate({ zoom: n - 1 }, r, {}, i.availableImages), + o = e.evaluate({ zoom: n }, r, {}, i.availableImages), + l = e.evaluate({ zoom: n + 1 }, r, {}, i.availableImages); + (t = t && t.name ? t.name : t), + (o = o && o.name ? o.name : o), + (l = l && l.name ? l.name : l), + (a[t] = !0), + (a[o] = !0), + (a[l] = !0), + (r.patterns[s.id] = { min: t, mid: o, max: l }); + } + } + return r; + } + (Fs.exports = Ts), + (Fs.exports.default = Ts), + (Ts.deviation = function (t, e, r, n) { + var i = e && e.length, + a = Math.abs(so(t, 0, i ? e[0] * r : t.length, r)); + if (i) + for (var s = 0, o = e.length; s < o; s++) + a -= Math.abs( + so(t, e[s] * r, s < o - 1 ? e[s + 1] * r : t.length, r), + ); + var l = 0; + for (s = 0; s < n.length; s += 3) { + var u = n[s] * r, + c = n[s + 1] * r, + h = n[s + 2] * r; + l += Math.abs( + (t[u] - t[h]) * (t[c + 1] - t[u + 1]) - + (t[u] - t[c]) * (t[h + 1] - t[u + 1]), + ); + } + return 0 === a && 0 === l ? 0 : Math.abs((l - a) / a); + }), + (Ts.flatten = function (t) { + for ( + var e = t[0][0].length, + r = { vertices: [], holes: [], dimensions: e }, + n = 0, + i = 0; + i < t.length; + i++ + ) { + for (var a = 0; a < t[i].length; a++) + for (var s = 0; s < e; s++) r.vertices.push(t[i][a][s]); + i > 0 && r.holes.push((n += t[i - 1].length)); + } + return r; + }); + class mo { + constructor(t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map((t) => t.id)), + (this.index = t.index), + (this.hasPattern = !1), + (this.patternFeatures = []), + (this.layoutVertexArray = new ea()), + (this.indexArray = new ha()), + (this.indexArray2 = new pa()), + (this.programConfigurations = new Ra(t.layers, t.zoom)), + (this.segments = new ya()), + (this.segments2 = new ya()), + (this.stateDependentLayerIds = this.layers + .filter((t) => t.isStateDependent()) + .map((t) => t.id)); + } + populate(t, e, r) { + this.hasPattern = fo('fill', this.layers, e); + const n = this.layers[0].layout.get('fill-sort-key'), + i = !n.isConstant(), + a = []; + for (const { feature: s, id: o, index: l, sourceLayerIndex: u } of t) { + const t = this.layers[0]._featureFilter.needGeometry, + c = Ka(s, t); + if (!this.layers[0]._featureFilter.filter(new Qn(this.zoom), c, r)) + continue; + const h = i ? n.evaluate(c, {}, r, e.availableImages) : void 0, + p = { + id: o, + properties: s.properties, + type: s.type, + sourceLayerIndex: u, + index: l, + geometry: t ? c.geometry : Za(s), + patterns: {}, + sortKey: h, + }; + a.push(p); + } + i && a.sort((t, e) => t.sortKey - e.sortKey); + for (const n of a) { + const { geometry: i, index: a, sourceLayerIndex: s } = n; + if (this.hasPattern) { + const t = yo('fill', this.layers, n, this.zoom, e); + this.patternFeatures.push(t); + } else this.addFeature(n, i, a, r, {}); + e.featureIndex.insert(t[a].feature, i, a, s, this.index); + } + } + update(t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + } + addFeatures(t, e, r) { + for (const t of this.patternFeatures) + this.addFeature(t, t.geometry, t.index, e, r); + } + isEmpty() { + return 0 === this.layoutVertexArray.length; + } + uploadPending() { + return !this.uploaded || this.programConfigurations.needsUpload; + } + upload(t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + Es, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray)), + (this.indexBuffer2 = t.createIndexBuffer(this.indexArray2))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.indexBuffer2.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.segments2.destroy()); + } + addFeature(t, e, r, n, i) { + for (const t of ho(e, 500)) { + let e = 0; + for (const r of t) e += r.length; + const r = this.segments.prepareSegment( + e, + this.layoutVertexArray, + this.indexArray, + ), + n = r.vertexLength, + i = [], + a = []; + for (const e of t) { + if (0 === e.length) continue; + e !== t[0] && a.push(i.length / 2); + const r = this.segments2.prepareSegment( + e.length, + this.layoutVertexArray, + this.indexArray2, + ), + n = r.vertexLength; + this.layoutVertexArray.emplaceBack(e[0].x, e[0].y), + this.indexArray2.emplaceBack(n + e.length - 1, n), + i.push(e[0].x), + i.push(e[0].y); + for (let t = 1; t < e.length; t++) + this.layoutVertexArray.emplaceBack(e[t].x, e[t].y), + this.indexArray2.emplaceBack(n + t - 1, n + t), + i.push(e[t].x), + i.push(e[t].y); + (r.vertexLength += e.length), (r.primitiveLength += e.length); + } + const s = Fs.exports(i, a); + for (let t = 0; t < s.length; t += 3) + this.indexArray.emplaceBack(n + s[t], n + s[t + 1], n + s[t + 2]); + (r.vertexLength += e), (r.primitiveLength += s.length / 3); + } + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + } + } + Mn('FillBucket', mo, { omit: ['layers', 'patternFeatures'] }); + const go = new fi({ + 'fill-sort-key': new ui(nt.layout_fill['fill-sort-key']), + }); + var xo = { + paint: new fi({ + 'fill-antialias': new li(nt.paint_fill['fill-antialias']), + 'fill-opacity': new ui(nt.paint_fill['fill-opacity']), + 'fill-color': new ui(nt.paint_fill['fill-color']), + 'fill-outline-color': new ui(nt.paint_fill['fill-outline-color']), + 'fill-translate': new li(nt.paint_fill['fill-translate']), + 'fill-translate-anchor': new li(nt.paint_fill['fill-translate-anchor']), + 'fill-pattern': new ci(nt.paint_fill['fill-pattern']), + }), + layout: go, + }; + const vo = vi( + [ + { name: 'a_pos', components: 2, type: 'Int16' }, + { name: 'a_normal_ed', components: 4, type: 'Int16' }, + ], + 4, + ), + bo = vi([{ name: 'a_centroid', components: 2, type: 'Int16' }], 4), + { members: wo } = vo; + var _o = {}, + Ao = S, + ko = So; + function So(t, e, r, n, i) { + (this.properties = {}), + (this.extent = r), + (this.type = 0), + (this._pbf = t), + (this._geometry = -1), + (this._keys = n), + (this._values = i), + t.readFields(Io, this, e); + } + function Io(t, e, r) { + 1 == t + ? (e.id = r.readVarint()) + : 2 == t + ? (function (t, e) { + for (var r = t.readVarint() + t.pos; t.pos < r; ) { + var n = e._keys[t.readVarint()], + i = e._values[t.readVarint()]; + e.properties[n] = i; + } + })(r, e) + : 3 == t + ? (e.type = r.readVarint()) + : 4 == t && (e._geometry = r.pos); + } + function Mo(t) { + for (var e, r, n = 0, i = 0, a = t.length, s = a - 1; i < a; s = i++) + n += ((r = t[s]).x - (e = t[i]).x) * (e.y + r.y); + return n; + } + (So.types = ['Unknown', 'Point', 'LineString', 'Polygon']), + (So.prototype.loadGeometry = function () { + var t = this._pbf; + t.pos = this._geometry; + for ( + var e, r = t.readVarint() + t.pos, n = 1, i = 0, a = 0, s = 0, o = []; + t.pos < r; -// + ) { + if (i <= 0) { + var l = t.readVarint(); + (n = 7 & l), (i = l >> 3); + } + if ((i--, 1 === n || 2 === n)) + (a += t.readSVarint()), + (s += t.readSVarint()), + 1 === n && (e && o.push(e), (e = [])), + e.push(new Ao(a, s)); + else { + if (7 !== n) throw new Error('unknown command ' + n); + e && e.push(e[0].clone()); + } + } + return e && o.push(e), o; + }), + (So.prototype.bbox = function () { + var t = this._pbf; + t.pos = this._geometry; + for ( + var e = t.readVarint() + t.pos, + r = 1, + n = 0, + i = 0, + a = 0, + s = 1 / 0, + o = -1 / 0, + l = 1 / 0, + u = -1 / 0; + t.pos < e; -var maplibregl$1 = maplibregl; + ) { + if (n <= 0) { + var c = t.readVarint(); + (r = 7 & c), (n = c >> 3); + } + if ((n--, 1 === r || 2 === r)) + (i += t.readSVarint()) < s && (s = i), + i > o && (o = i), + (a += t.readSVarint()) < l && (l = a), + a > u && (u = a); + else if (7 !== r) throw new Error('unknown command ' + r); + } + return [s, l, o, u]; + }), + (So.prototype.toGeoJSON = function (t, e, r) { + var n, + i, + a = this.extent * Math.pow(2, r), + s = this.extent * t, + o = this.extent * e, + l = this.loadGeometry(), + u = So.types[this.type]; + function c(t) { + for (var e = 0; e < t.length; e++) { + var r = t[e]; + t[e] = [ + (360 * (r.x + s)) / a - 180, + (360 / Math.PI) * + Math.atan( + Math.exp(((180 - (360 * (r.y + o)) / a) * Math.PI) / 180), + ) - + 90, + ]; + } + } + switch (this.type) { + case 1: + var h = []; + for (n = 0; n < l.length; n++) h[n] = l[n][0]; + c((l = h)); + break; + case 2: + for (n = 0; n < l.length; n++) c(l[n]); + break; + case 3: + for ( + l = (function (t) { + var e = t.length; + if (e <= 1) return [t]; + for (var r, n, i = [], a = 0; a < e; a++) { + var s = Mo(t[a]); + 0 !== s && + (void 0 === n && (n = s < 0), + n === s < 0 + ? (r && i.push(r), (r = [t[a]])) + : r.push(t[a])); + } + return r && i.push(r), i; + })(l), + n = 0; + n < l.length; + n++ + ) + for (i = 0; i < l[n].length; i++) c(l[n][i]); + } + 1 === l.length ? (l = l[0]) : (u = 'Multi' + u); + var p = { + type: 'Feature', + geometry: { type: u, coordinates: l }, + properties: this.properties, + }; + return 'id' in this && (p.id = this.id), p; + }); + var zo = ko, + Bo = Co; + function Co(t, e) { + (this.version = 1), + (this.name = null), + (this.extent = 4096), + (this.length = 0), + (this._pbf = t), + (this._keys = []), + (this._values = []), + (this._features = []), + t.readFields(Po, this, e), + (this.length = this._features.length); + } + function Po(t, e, r) { + 15 === t + ? (e.version = r.readVarint()) + : 1 === t + ? (e.name = r.readString()) + : 5 === t + ? (e.extent = r.readVarint()) + : 2 === t + ? e._features.push(r.pos) + : 3 === t + ? e._keys.push(r.readString()) + : 4 === t && + e._values.push( + (function (t) { + for (var e = null, r = t.readVarint() + t.pos; t.pos < r; ) { + var n = t.readVarint() >> 3; + e = + 1 === n + ? t.readString() + : 2 === n + ? t.readFloat() + : 3 === n + ? t.readDouble() + : 4 === n + ? t.readVarint64() + : 5 === n + ? t.readVarint() + : 6 === n + ? t.readSVarint() + : 7 === n + ? t.readBoolean() + : null; + } + return e; + })(r), + ); + } + Co.prototype.feature = function (t) { + if (t < 0 || t >= this._features.length) + throw new Error('feature index out of bounds'); + this._pbf.pos = this._features[t]; + var e = this._pbf.readVarint() + this._pbf.pos; + return new zo(this._pbf, e, this.extent, this._keys, this._values); + }; + var Vo = Bo; + function Eo(t, e, r) { + if (3 === t) { + var n = new Vo(r, r.readVarint() + r.pos); + n.length && (e[n.name] = n); + } + } + (_o.VectorTile = function (t, e) { + this.layers = t.readFields(Eo, {}, e); + }), + (_o.VectorTileFeature = ko), + (_o.VectorTileLayer = Bo); + const Fo = _o.VectorTileFeature.types, + To = Math.pow(2, 13); + function Lo(t, e, r, n, i, a, s, o) { + t.emplaceBack( + e, + r, + 2 * Math.floor(n * To) + s, + i * To * 2, + a * To * 2, + Math.round(o), + ); + } + class Do { + constructor(t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map((t) => t.id)), + (this.index = t.index), + (this.hasPattern = !1), + (this.layoutVertexArray = new ra()), + (this.centroidVertexArray = new Qi()), + (this.indexArray = new ha()), + (this.programConfigurations = new Ra(t.layers, t.zoom)), + (this.segments = new ya()), + (this.stateDependentLayerIds = this.layers + .filter((t) => t.isStateDependent()) + .map((t) => t.id)); + } + populate(t, e, r) { + (this.features = []), + (this.hasPattern = fo('fill-extrusion', this.layers, e)); + for (const { feature: n, id: i, index: a, sourceLayerIndex: s } of t) { + const t = this.layers[0]._featureFilter.needGeometry, + o = Ka(n, t); + if (!this.layers[0]._featureFilter.filter(new Qn(this.zoom), o, r)) + continue; + const l = { + id: i, + sourceLayerIndex: s, + index: a, + geometry: t ? o.geometry : Za(n), + properties: n.properties, + type: n.type, + patterns: {}, + }; + this.hasPattern + ? this.features.push( + yo('fill-extrusion', this.layers, l, this.zoom, e), + ) + : this.addFeature(l, l.geometry, a, r, {}), + e.featureIndex.insert(n, l.geometry, a, s, this.index, !0); + } + } + addFeatures(t, e, r) { + for (const t of this.features) { + const { geometry: n } = t; + this.addFeature(t, n, t.index, e, r); + } + } + update(t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + } + isEmpty() { + return ( + 0 === this.layoutVertexArray.length && + 0 === this.centroidVertexArray.length + ); + } + uploadPending() { + return !this.uploaded || this.programConfigurations.needsUpload; + } + upload(t) { + this.uploaded || + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + wo, + )), + (this.centroidVertexBuffer = t.createVertexBuffer( + this.centroidVertexArray, + bo.members, + !0, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.centroidVertexBuffer.destroy()); + } + addFeature(t, e, r, n, i) { + const a = { x: 0, y: 0, vertexCount: 0 }; + for (const r of ho(e, 500)) { + let e = 0; + for (const t of r) e += t.length; + let n = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + ); + for (const t of r) { + if (0 === t.length) continue; + if (Ro(t)) continue; + let e = 0; + for (let r = 0; r < t.length; r++) { + const i = t[r]; + if (r >= 1) { + const s = t[r - 1]; + if (!$o(i, s)) { + n.vertexLength + 4 > ya.MAX_VERTEX_ARRAY_LENGTH && + (n = this.segments.prepareSegment( + 4, + this.layoutVertexArray, + this.indexArray, + )); + const t = i.sub(s)._perp()._unit(), + r = s.dist(i); + e + r > 32768 && (e = 0), + Lo(this.layoutVertexArray, i.x, i.y, t.x, t.y, 0, 0, e), + Lo(this.layoutVertexArray, i.x, i.y, t.x, t.y, 0, 1, e), + (a.x += 2 * i.x), + (a.y += 2 * i.y), + (a.vertexCount += 2), + (e += r), + Lo(this.layoutVertexArray, s.x, s.y, t.x, t.y, 0, 0, e), + Lo(this.layoutVertexArray, s.x, s.y, t.x, t.y, 0, 1, e), + (a.x += 2 * s.x), + (a.y += 2 * s.y), + (a.vertexCount += 2); + const o = n.vertexLength; + this.indexArray.emplaceBack(o, o + 2, o + 1), + this.indexArray.emplaceBack(o + 1, o + 2, o + 3), + (n.vertexLength += 4), + (n.primitiveLength += 2); + } + } + } + } + if ( + (n.vertexLength + e > ya.MAX_VERTEX_ARRAY_LENGTH && + (n = this.segments.prepareSegment( + e, + this.layoutVertexArray, + this.indexArray, + )), + 'Polygon' !== Fo[t.type]) + ) + continue; + const i = [], + s = [], + o = n.vertexLength; + for (const t of r) + if (0 !== t.length) { + t !== r[0] && s.push(i.length / 2); + for (let e = 0; e < t.length; e++) { + const r = t[e]; + Lo(this.layoutVertexArray, r.x, r.y, 0, 0, 1, 1, 0), + (a.x += r.x), + (a.y += r.y), + (a.vertexCount += 1), + i.push(r.x), + i.push(r.y); + } + } + const l = Fs.exports(i, s); + for (let t = 0; t < l.length; t += 3) + this.indexArray.emplaceBack(o + l[t], o + l[t + 2], o + l[t + 1]); + (n.primitiveLength += l.length / 3), (n.vertexLength += e); + } + for (let t = 0; t < a.vertexCount; t++) + this.centroidVertexArray.emplaceBack( + Math.floor(a.x / a.vertexCount), + Math.floor(a.y / a.vertexCount), + ); + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + } + } + function $o(t, e) { + return ( + (t.x === e.x && (t.x < 0 || t.x > qa)) || + (t.y === e.y && (t.y < 0 || t.y > qa)) + ); + } + function Ro(t) { + return ( + t.every((t) => t.x < 0) || + t.every((t) => t.x > qa) || + t.every((t) => t.y < 0) || + t.every((t) => t.y > qa) + ); + } + Mn('FillExtrusionBucket', Do, { omit: ['layers', 'features'] }); + var Oo = { + paint: new fi({ + 'fill-extrusion-opacity': new li( + nt['paint_fill-extrusion']['fill-extrusion-opacity'], + ), + 'fill-extrusion-color': new ui( + nt['paint_fill-extrusion']['fill-extrusion-color'], + ), + 'fill-extrusion-translate': new li( + nt['paint_fill-extrusion']['fill-extrusion-translate'], + ), + 'fill-extrusion-translate-anchor': new li( + nt['paint_fill-extrusion']['fill-extrusion-translate-anchor'], + ), + 'fill-extrusion-pattern': new ci( + nt['paint_fill-extrusion']['fill-extrusion-pattern'], + ), + 'fill-extrusion-height': new ui( + nt['paint_fill-extrusion']['fill-extrusion-height'], + ), + 'fill-extrusion-base': new ui( + nt['paint_fill-extrusion']['fill-extrusion-base'], + ), + 'fill-extrusion-vertical-gradient': new li( + nt['paint_fill-extrusion']['fill-extrusion-vertical-gradient'], + ), + }), + }; + function Uo(t, e) { + return t.x * e.x + t.y * e.y; + } + function qo(t, e) { + if (1 === t.length) { + let r = 0; + const n = e[r++]; + let i; + for (; !i || n.equals(i); ) if (((i = e[r++]), !i)) return 1 / 0; + for (; r < e.length; r++) { + const a = e[r], + s = t[0], + o = i.sub(n), + l = a.sub(n), + u = s.sub(n), + c = Uo(o, o), + h = Uo(o, l), + p = Uo(l, l), + f = Uo(u, o), + d = Uo(u, l), + y = c * p - h * h, + m = (p * f - h * d) / y, + g = (c * d - h * f) / y, + x = n.z * (1 - m - g) + i.z * m + a.z * g; + if (isFinite(x)) return x; + } + return 1 / 0; + } + { + let t = 1 / 0; + for (const r of e) t = Math.min(t, r.z); + return t; + } + } + const jo = vi( + [ + { name: 'a_pos_normal', components: 2, type: 'Int16' }, + { name: 'a_data', components: 4, type: 'Uint8' }, + ], + 4, + ), + { members: No } = jo, + Zo = vi([ + { name: 'a_uv_x', components: 1, type: 'Float32' }, + { name: 'a_split_index', components: 1, type: 'Float32' }, + ]), + { members: Ko } = Zo, + Go = _o.VectorTileFeature.types, + Jo = Math.cos((Math.PI / 180) * 37.5), + Xo = Math.pow(2, 14) / 0.5; + class Yo { + constructor(t) { + (this.zoom = t.zoom), + (this.overscaling = t.overscaling), + (this.layers = t.layers), + (this.layerIds = this.layers.map((t) => t.id)), + (this.index = t.index), + (this.hasPattern = !1), + (this.patternFeatures = []), + (this.lineClipsArray = []), + (this.gradients = {}), + this.layers.forEach((t) => { + this.gradients[t.id] = {}; + }), + (this.layoutVertexArray = new na()), + (this.layoutVertexArray2 = new ia()), + (this.indexArray = new ha()), + (this.programConfigurations = new Ra(t.layers, t.zoom)), + (this.segments = new ya()), + (this.maxLineLength = 0), + (this.stateDependentLayerIds = this.layers + .filter((t) => t.isStateDependent()) + .map((t) => t.id)); + } + populate(t, e, r) { + this.hasPattern = fo('line', this.layers, e); + const n = this.layers[0].layout.get('line-sort-key'), + i = !n.isConstant(), + a = []; + for (const { feature: e, id: s, index: o, sourceLayerIndex: l } of t) { + const t = this.layers[0]._featureFilter.needGeometry, + u = Ka(e, t); + if (!this.layers[0]._featureFilter.filter(new Qn(this.zoom), u, r)) + continue; + const c = i ? n.evaluate(u, {}, r) : void 0, + h = { + id: s, + properties: e.properties, + type: e.type, + sourceLayerIndex: l, + index: o, + geometry: t ? u.geometry : Za(e), + patterns: {}, + sortKey: c, + }; + a.push(h); + } + i && a.sort((t, e) => t.sortKey - e.sortKey); + for (const n of a) { + const { geometry: i, index: a, sourceLayerIndex: s } = n; + if (this.hasPattern) { + const t = yo('line', this.layers, n, this.zoom, e); + this.patternFeatures.push(t); + } else this.addFeature(n, i, a, r, {}); + e.featureIndex.insert(t[a].feature, i, a, s, this.index); + } + } + update(t, e, r) { + this.stateDependentLayers.length && + this.programConfigurations.updatePaintArrays( + t, + e, + this.stateDependentLayers, + r, + ); + } + addFeatures(t, e, r) { + for (const t of this.patternFeatures) + this.addFeature(t, t.geometry, t.index, e, r); + } + isEmpty() { + return 0 === this.layoutVertexArray.length; + } + uploadPending() { + return !this.uploaded || this.programConfigurations.needsUpload; + } + upload(t) { + this.uploaded || + (0 !== this.layoutVertexArray2.length && + (this.layoutVertexBuffer2 = t.createVertexBuffer( + this.layoutVertexArray2, + Ko, + )), + (this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + No, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray))), + this.programConfigurations.upload(t), + (this.uploaded = !0); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy()); + } + lineFeatureClips(t) { + if ( + t.properties && + Object.prototype.hasOwnProperty.call( + t.properties, + 'mapbox_clip_start', + ) && + Object.prototype.hasOwnProperty.call(t.properties, 'mapbox_clip_end') + ) + return { + start: +t.properties.mapbox_clip_start, + end: +t.properties.mapbox_clip_end, + }; + } + addFeature(t, e, r, n, i) { + const a = this.layers[0].layout, + s = a.get('line-join').evaluate(t, {}), + o = a.get('line-cap'), + l = a.get('line-miter-limit'), + u = a.get('line-round-limit'); + this.lineClips = this.lineFeatureClips(t); + for (const r of e) this.addLine(r, t, s, o, l, u); + this.programConfigurations.populatePaintArrays( + this.layoutVertexArray.length, + t, + r, + i, + n, + ); + } + addLine(t, e, r, n, i, a) { + if ( + ((this.distance = 0), + (this.scaledDistance = 0), + (this.totalDistance = 0), + this.lineClips) + ) { + this.lineClipsArray.push(this.lineClips); + for (let e = 0; e < t.length - 1; e++) + this.totalDistance += t[e].dist(t[e + 1]); + this.updateScaledDistance(), + (this.maxLineLength = Math.max( + this.maxLineLength, + this.totalDistance, + )); + } + const s = 'Polygon' === Go[e.type]; + let o = t.length; + for (; o >= 2 && t[o - 1].equals(t[o - 2]); ) o--; + let l = 0; + for (; l < o - 1 && t[l].equals(t[l + 1]); ) l++; + if (o < (s ? 3 : 2)) return; + 'bevel' === r && (i = 1.05); + const u = + this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0, + c = this.segments.prepareSegment( + 10 * o, + this.layoutVertexArray, + this.indexArray, + ); + let h, p, f, d, y; + (this.e1 = this.e2 = -1), + s && ((h = t[o - 2]), (y = t[l].sub(h)._unit()._perp())); + for (let e = l; e < o; e++) { + if ( + ((f = e === o - 1 ? (s ? t[l + 1] : void 0) : t[e + 1]), + f && t[e].equals(f)) + ) + continue; + y && (d = y), + h && (p = h), + (h = t[e]), + (y = f ? f.sub(h)._unit()._perp() : d), + (d = d || y); + let m = d.add(y); + (0 === m.x && 0 === m.y) || m._unit(); + const g = d.x * y.x + d.y * y.y, + x = m.x * y.x + m.y * y.y, + v = 0 !== x ? 1 / x : 1 / 0, + b = 2 * Math.sqrt(2 - 2 * x), + w = x < Jo && p && f, + _ = d.x * y.y - d.y * y.x > 0; + if (w && e > l) { + const t = h.dist(p); + if (t > 2 * u) { + const e = h.sub( + h + .sub(p) + ._mult(u / t) + ._round(), + ); + this.updateDistance(p, e), + this.addCurrentVertex(e, d, 0, 0, c), + (p = e); + } + } + const A = p && f; + let k = A ? r : s ? 'butt' : n; + if ( + (A && + 'round' === k && + (v < a ? (k = 'miter') : v <= 2 && (k = 'fakeround')), + 'miter' === k && v > i && (k = 'bevel'), + 'bevel' === k && + (v > 2 && (k = 'flipbevel'), v < i && (k = 'miter')), + p && this.updateDistance(p, h), + 'miter' === k) + ) + m._mult(v), this.addCurrentVertex(h, m, 0, 0, c); + else if ('flipbevel' === k) { + if (v > 100) m = y.mult(-1); + else { + const t = (v * d.add(y).mag()) / d.sub(y).mag(); + m._perp()._mult(t * (_ ? -1 : 1)); + } + this.addCurrentVertex(h, m, 0, 0, c), + this.addCurrentVertex(h, m.mult(-1), 0, 0, c); + } else if ('bevel' === k || 'fakeround' === k) { + const t = -Math.sqrt(v * v - 1), + e = _ ? t : 0, + r = _ ? 0 : t; + if ( + (p && this.addCurrentVertex(h, d, e, r, c), 'fakeround' === k) + ) { + const t = Math.round((180 * b) / Math.PI / 20); + for (let e = 1; e < t; e++) { + let r = e / t; + if (0.5 !== r) { + const t = r - 0.5; + r += + r * + t * + (r - 1) * + ((1.0904 + g * (g * (3.55645 - 1.43519 * g) - 3.2452)) * + t * + t + + (0.848013 + g * (0.215638 * g - 1.06021))); + } + const n = y + .sub(d) + ._mult(r) + ._add(d) + ._unit() + ._mult(_ ? -1 : 1); + this.addHalfVertex(h, n.x, n.y, !1, _, 0, c); + } + } + f && this.addCurrentVertex(h, y, -e, -r, c); + } else if ('butt' === k) this.addCurrentVertex(h, m, 0, 0, c); + else if ('square' === k) { + const t = p ? 1 : -1; + this.addCurrentVertex(h, m, t, t, c); + } else + 'round' === k && + (p && + (this.addCurrentVertex(h, d, 0, 0, c), + this.addCurrentVertex(h, d, 1, 1, c, !0)), + f && + (this.addCurrentVertex(h, y, -1, -1, c, !0), + this.addCurrentVertex(h, y, 0, 0, c))); + if (w && e < o - 1) { + const t = h.dist(f); + if (t > 2 * u) { + const e = h.add( + f + .sub(h) + ._mult(u / t) + ._round(), + ); + this.updateDistance(h, e), + this.addCurrentVertex(e, y, 0, 0, c), + (h = e); + } + } + } + } + addCurrentVertex(t, e, r, n, i, a = !1) { + const s = e.y * n - e.x, + o = -e.y - e.x * n; + this.addHalfVertex(t, e.x + e.y * r, e.y - e.x * r, a, !1, r, i), + this.addHalfVertex(t, s, o, a, !0, -n, i), + this.distance > Xo / 2 && + 0 === this.totalDistance && + ((this.distance = 0), this.addCurrentVertex(t, e, r, n, i, a)); + } + addHalfVertex({ x: t, y: e }, r, n, i, a, s, o) { + const l = + 0.5 * + (this.lineClips + ? this.scaledDistance * (Xo - 1) + : this.scaledDistance); + this.layoutVertexArray.emplaceBack( + (t << 1) + (i ? 1 : 0), + (e << 1) + (a ? 1 : 0), + Math.round(63 * r) + 128, + Math.round(63 * n) + 128, + (1 + (0 === s ? 0 : s < 0 ? -1 : 1)) | ((63 & l) << 2), + l >> 6, + ), + this.lineClips && + this.layoutVertexArray2.emplaceBack( + (this.scaledDistance - this.lineClips.start) / + (this.lineClips.end - this.lineClips.start), + this.lineClipsArray.length, + ); + const u = o.vertexLength++; + this.e1 >= 0 && + this.e2 >= 0 && + (this.indexArray.emplaceBack(this.e1, this.e2, u), + o.primitiveLength++), + a ? (this.e2 = u) : (this.e1 = u); + } + updateScaledDistance() { + this.scaledDistance = this.lineClips + ? this.lineClips.start + + ((this.lineClips.end - this.lineClips.start) * this.distance) / + this.totalDistance + : this.distance; + } + updateDistance(t, e) { + (this.distance += t.dist(e)), this.updateScaledDistance(); + } + } + Mn('LineBucket', Yo, { omit: ['layers', 'patternFeatures'] }); + const Ho = new fi({ + 'line-cap': new li(nt.layout_line['line-cap']), + 'line-join': new ui(nt.layout_line['line-join']), + 'line-miter-limit': new li(nt.layout_line['line-miter-limit']), + 'line-round-limit': new li(nt.layout_line['line-round-limit']), + 'line-sort-key': new ui(nt.layout_line['line-sort-key']), + }); + var Wo = { + paint: new fi({ + 'line-opacity': new ui(nt.paint_line['line-opacity']), + 'line-color': new ui(nt.paint_line['line-color']), + 'line-translate': new li(nt.paint_line['line-translate']), + 'line-translate-anchor': new li(nt.paint_line['line-translate-anchor']), + 'line-width': new ui(nt.paint_line['line-width']), + 'line-gap-width': new ui(nt.paint_line['line-gap-width']), + 'line-offset': new ui(nt.paint_line['line-offset']), + 'line-blur': new ui(nt.paint_line['line-blur']), + 'line-dasharray': new hi(nt.paint_line['line-dasharray']), + 'line-pattern': new ci(nt.paint_line['line-pattern']), + 'line-gradient': new pi(nt.paint_line['line-gradient']), + }), + layout: Ho, + }; + const Qo = new (class extends ui { + possiblyEvaluate(t, e) { + return ( + (e = new Qn(Math.floor(e.zoom), { + now: e.now, + fadeDuration: e.fadeDuration, + zoomHistory: e.zoomHistory, + transition: e.transition, + })), + super.possiblyEvaluate(t, e) + ); + } + evaluate(t, e, r, n) { + return ( + (e = o({}, e, { zoom: Math.floor(e.zoom) })), + super.evaluate(t, e, r, n) + ); + } + })(Wo.paint.properties['line-width'].specification); + function tl(t, e) { + return e > 0 ? e + 2 * t : t; + } + Qo.useIntegerZoom = !0; + const el = vi( + [ + { name: 'a_pos_offset', components: 4, type: 'Int16' }, + { name: 'a_data', components: 4, type: 'Uint16' }, + { name: 'a_pixeloffset', components: 4, type: 'Int16' }, + ], + 4, + ), + rl = vi([{ name: 'a_projected_pos', components: 3, type: 'Float32' }], 4); + vi([{ name: 'a_fade_opacity', components: 1, type: 'Uint32' }], 4); + const nl = vi([ + { name: 'a_placed', components: 2, type: 'Uint8' }, + { name: 'a_shift', components: 2, type: 'Float32' }, + ]); + vi([ + { type: 'Int16', name: 'anchorPointX' }, + { type: 'Int16', name: 'anchorPointY' }, + { type: 'Int16', name: 'x1' }, + { type: 'Int16', name: 'y1' }, + { type: 'Int16', name: 'x2' }, + { type: 'Int16', name: 'y2' }, + { type: 'Uint32', name: 'featureIndex' }, + { type: 'Uint16', name: 'sourceLayerIndex' }, + { type: 'Uint16', name: 'bucketIndex' }, + ]); + const il = vi( + [ + { name: 'a_pos', components: 2, type: 'Int16' }, + { name: 'a_anchor_pos', components: 2, type: 'Int16' }, + { name: 'a_extrude', components: 2, type: 'Int16' }, + ], + 4, + ), + al = vi( + [ + { name: 'a_pos', components: 2, type: 'Float32' }, + { name: 'a_radius', components: 1, type: 'Float32' }, + { name: 'a_flags', components: 2, type: 'Int16' }, + ], + 4, + ); + function sl(t, e, r) { + return ( + t.sections.forEach((t) => { + t.text = (function (t, e, r) { + const n = e.layout.get('text-transform').evaluate(r, {}); + return ( + 'uppercase' === n + ? (t = t.toLocaleUpperCase()) + : 'lowercase' === n && (t = t.toLocaleLowerCase()), + Wn.applyArabicShaping && (t = Wn.applyArabicShaping(t)), + t + ); + })(t.text, e, r); + }), + t + ); + } + vi([{ name: 'triangle', components: 3, type: 'Uint16' }]), + vi([ + { type: 'Int16', name: 'anchorX' }, + { type: 'Int16', name: 'anchorY' }, + { type: 'Uint16', name: 'glyphStartIndex' }, + { type: 'Uint16', name: 'numGlyphs' }, + { type: 'Uint32', name: 'vertexStartIndex' }, + { type: 'Uint32', name: 'lineStartIndex' }, + { type: 'Uint32', name: 'lineLength' }, + { type: 'Uint16', name: 'segment' }, + { type: 'Uint16', name: 'lowerSize' }, + { type: 'Uint16', name: 'upperSize' }, + { type: 'Float32', name: 'lineOffsetX' }, + { type: 'Float32', name: 'lineOffsetY' }, + { type: 'Uint8', name: 'writingMode' }, + { type: 'Uint8', name: 'placedOrientation' }, + { type: 'Uint8', name: 'hidden' }, + { type: 'Uint32', name: 'crossTileID' }, + { type: 'Int16', name: 'associatedIconIndex' }, + ]), + vi([ + { type: 'Int16', name: 'anchorX' }, + { type: 'Int16', name: 'anchorY' }, + { type: 'Int16', name: 'rightJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'centerJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'leftJustifiedTextSymbolIndex' }, + { type: 'Int16', name: 'verticalPlacedTextSymbolIndex' }, + { type: 'Int16', name: 'placedIconSymbolIndex' }, + { type: 'Int16', name: 'verticalPlacedIconSymbolIndex' }, + { type: 'Uint16', name: 'key' }, + { type: 'Uint16', name: 'textBoxStartIndex' }, + { type: 'Uint16', name: 'textBoxEndIndex' }, + { type: 'Uint16', name: 'verticalTextBoxStartIndex' }, + { type: 'Uint16', name: 'verticalTextBoxEndIndex' }, + { type: 'Uint16', name: 'iconBoxStartIndex' }, + { type: 'Uint16', name: 'iconBoxEndIndex' }, + { type: 'Uint16', name: 'verticalIconBoxStartIndex' }, + { type: 'Uint16', name: 'verticalIconBoxEndIndex' }, + { type: 'Uint16', name: 'featureIndex' }, + { type: 'Uint16', name: 'numHorizontalGlyphVertices' }, + { type: 'Uint16', name: 'numVerticalGlyphVertices' }, + { type: 'Uint16', name: 'numIconVertices' }, + { type: 'Uint16', name: 'numVerticalIconVertices' }, + { type: 'Uint16', name: 'useRuntimeCollisionCircles' }, + { type: 'Uint32', name: 'crossTileID' }, + { type: 'Float32', name: 'textBoxScale' }, + { type: 'Float32', components: 2, name: 'textOffset' }, + { type: 'Float32', name: 'collisionCircleDiameter' }, + ]), + vi([{ type: 'Float32', name: 'offsetX' }]), + vi([ + { type: 'Int16', name: 'x' }, + { type: 'Int16', name: 'y' }, + { type: 'Int16', name: 'tileUnitDistanceFromAnchor' }, + ]); + const ol = { + '!': '︕', + '#': '#', + $: '$', + '%': '%', + '&': '&', + '(': '︵', + ')': '︶', + '*': '*', + '+': '+', + ',': '︐', + '-': '︲', + '.': '・', + '/': '/', + ':': '︓', + ';': '︔', + '<': '︿', + '=': '=', + '>': '﹀', + '?': '︖', + '@': '@', + '[': '﹇', + '\\': '\', + ']': '﹈', + '^': '^', + _: '︳', + '`': '`', + '{': '︷', + '|': '―', + '}': '︸', + '~': '~', + '¢': '¢', + '£': '£', + '¥': '¥', + '¦': '¦', + '¬': '¬', + '¯': ' ̄', + '–': '︲', + '—': '︱', + '‘': '﹃', + '’': '﹄', + '“': '﹁', + '”': '﹂', + '…': '︙', + '‧': '・', + '₩': '₩', + '、': '︑', + '。': '︒', + '〈': '︿', + '〉': '﹀', + '《': '︽', + '》': '︾', + '「': '﹁', + '」': '﹂', + '『': '﹃', + '』': '﹄', + '【': '︻', + '】': '︼', + '〔': '︹', + '〕': '︺', + '〖': '︗', + '〗': '︘', + '!': '︕', + '(': '︵', + ')': '︶', + ',': '︐', + '-': '︲', + '.': '・', + ':': '︓', + ';': '︔', + '<': '︿', + '>': '﹀', + '?': '︖', + '[': '﹇', + ']': '﹈', + '_': '︳', + '{': '︷', + '|': '―', + '}': '︸', + '⦅': '︵', + '⦆': '︶', + '。': '︒', + '「': '﹁', + '」': '﹂', + }; + var ll = 24, + ul = pl, + cl = function (t, e, r, n, i) { + var a, + s, + o = 8 * i - n - 1, + l = (1 << o) - 1, + u = l >> 1, + c = -7, + h = r ? i - 1 : 0, + p = r ? -1 : 1, + f = t[e + h]; + for ( + h += p, a = f & ((1 << -c) - 1), f >>= -c, c += o; + c > 0; + a = 256 * a + t[e + h], h += p, c -= 8 + ); + for ( + s = a & ((1 << -c) - 1), a >>= -c, c += n; + c > 0; + s = 256 * s + t[e + h], h += p, c -= 8 + ); + if (0 === a) a = 1 - u; + else { + if (a === l) return s ? NaN : (1 / 0) * (f ? -1 : 1); + (s += Math.pow(2, n)), (a -= u); + } + return (f ? -1 : 1) * s * Math.pow(2, a - n); + }, + hl = function (t, e, r, n, i, a) { + var s, + o, + l, + u = 8 * a - i - 1, + c = (1 << u) - 1, + h = c >> 1, + p = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, + f = n ? 0 : a - 1, + d = n ? 1 : -1, + y = e < 0 || (0 === e && 1 / e < 0) ? 1 : 0; + for ( + e = Math.abs(e), + isNaN(e) || e === 1 / 0 + ? ((o = isNaN(e) ? 1 : 0), (s = c)) + : ((s = Math.floor(Math.log(e) / Math.LN2)), + e * (l = Math.pow(2, -s)) < 1 && (s--, (l *= 2)), + (e += s + h >= 1 ? p / l : p * Math.pow(2, 1 - h)) * l >= 2 && + (s++, (l /= 2)), + s + h >= c + ? ((o = 0), (s = c)) + : s + h >= 1 + ? ((o = (e * l - 1) * Math.pow(2, i)), (s += h)) + : ((o = e * Math.pow(2, h - 1) * Math.pow(2, i)), (s = 0))); + i >= 8; + t[r + f] = 255 & o, f += d, o /= 256, i -= 8 + ); + for ( + s = (s << i) | o, u += i; + u > 0; + t[r + f] = 255 & s, f += d, s /= 256, u -= 8 + ); + t[r + f - d] |= 128 * y; + }; + function pl(t) { + (this.buf = + ArrayBuffer.isView && ArrayBuffer.isView(t) + ? t + : new Uint8Array(t || 0)), + (this.pos = 0), + (this.type = 0), + (this.length = this.buf.length); + } + (pl.Varint = 0), (pl.Fixed64 = 1), (pl.Bytes = 2), (pl.Fixed32 = 5); + var fl, + dl = 4294967296, + yl = 1 / dl, + ml = 'undefined' == typeof TextDecoder ? null : new TextDecoder('utf8'); + function gl(t) { + return t.type === pl.Bytes ? t.readVarint() + t.pos : t.pos + 1; + } + function xl(t, e, r) { + return r + ? 4294967296 * e + (t >>> 0) + : 4294967296 * (e >>> 0) + (t >>> 0); + } + function vl(t, e, r) { + var n = + e <= 16383 + ? 1 + : e <= 2097151 + ? 2 + : e <= 268435455 + ? 3 + : Math.floor(Math.log(e) / (7 * Math.LN2)); + r.realloc(n); + for (var i = r.pos - 1; i >= t; i--) r.buf[i + n] = r.buf[i]; + } + function bl(t, e) { + for (var r = 0; r < t.length; r++) e.writeVarint(t[r]); + } + function wl(t, e) { + for (var r = 0; r < t.length; r++) e.writeSVarint(t[r]); + } + function _l(t, e) { + for (var r = 0; r < t.length; r++) e.writeFloat(t[r]); + } + function Al(t, e) { + for (var r = 0; r < t.length; r++) e.writeDouble(t[r]); + } + function kl(t, e) { + for (var r = 0; r < t.length; r++) e.writeBoolean(t[r]); + } + function Sl(t, e) { + for (var r = 0; r < t.length; r++) e.writeFixed32(t[r]); + } + function Il(t, e) { + for (var r = 0; r < t.length; r++) e.writeSFixed32(t[r]); + } + function Ml(t, e) { + for (var r = 0; r < t.length; r++) e.writeFixed64(t[r]); + } + function zl(t, e) { + for (var r = 0; r < t.length; r++) e.writeSFixed64(t[r]); + } + function Bl(t, e) { + return (t[e] | (t[e + 1] << 8) | (t[e + 2] << 16)) + 16777216 * t[e + 3]; + } + function Cl(t, e, r) { + (t[r] = e), + (t[r + 1] = e >>> 8), + (t[r + 2] = e >>> 16), + (t[r + 3] = e >>> 24); + } + function Pl(t, e) { + return (t[e] | (t[e + 1] << 8) | (t[e + 2] << 16)) + (t[e + 3] << 24); + } + function Vl(t, e, r) { + 1 === t && r.readMessage(El, e); + } + function El(t, e, r) { + if (3 === t) { + const { + id: t, + bitmap: n, + width: i, + height: a, + left: s, + top: o, + advance: l, + } = r.readMessage(Fl, {}); + e.push({ + id: t, + bitmap: new zs({ width: i + 6, height: a + 6 }, n), + metrics: { width: i, height: a, left: s, top: o, advance: l }, + }); + } + } + function Fl(t, e, r) { + 1 === t + ? (e.id = r.readVarint()) + : 2 === t + ? (e.bitmap = r.readBytes()) + : 3 === t + ? (e.width = r.readVarint()) + : 4 === t + ? (e.height = r.readVarint()) + : 5 === t + ? (e.left = r.readSVarint()) + : 6 === t + ? (e.top = r.readSVarint()) + : 7 === t && (e.advance = r.readVarint()); + } + function Tl(t) { + let e = 0, + r = 0; + for (const n of t) (e += n.w * n.h), (r = Math.max(r, n.w)); + t.sort((t, e) => e.h - t.h); + const n = [ + { + x: 0, + y: 0, + w: Math.max(Math.ceil(Math.sqrt(e / 0.95)), r), + h: 1 / 0, + }, + ]; + let i = 0, + a = 0; + for (const e of t) + for (let t = n.length - 1; t >= 0; t--) { + const r = n[t]; + if (!(e.w > r.w || e.h > r.h)) { + if ( + ((e.x = r.x), + (e.y = r.y), + (a = Math.max(a, e.y + e.h)), + (i = Math.max(i, e.x + e.w)), + e.w === r.w && e.h === r.h) + ) { + const e = n.pop(); + t < n.length && (n[t] = e); + } else + e.h === r.h + ? ((r.x += e.w), (r.w -= e.w)) + : e.w === r.w + ? ((r.y += e.h), (r.h -= e.h)) + : (n.push({ x: r.x + e.w, y: r.y, w: r.w - e.w, h: e.h }), + (r.y += e.h), + (r.h -= e.h)); + break; + } + } + return { w: i, h: a, fill: e / (i * a) || 0 }; + } + pl.prototype = { + destroy: function () { + this.buf = null; + }, + readFields: function (t, e, r) { + for (r = r || this.length; this.pos < r; ) { + var n = this.readVarint(), + i = n >> 3, + a = this.pos; + (this.type = 7 & n), t(i, e, this), this.pos === a && this.skip(n); + } + return e; + }, + readMessage: function (t, e) { + return this.readFields(t, e, this.readVarint() + this.pos); + }, + readFixed32: function () { + var t = Bl(this.buf, this.pos); + return (this.pos += 4), t; + }, + readSFixed32: function () { + var t = Pl(this.buf, this.pos); + return (this.pos += 4), t; + }, + readFixed64: function () { + var t = Bl(this.buf, this.pos) + Bl(this.buf, this.pos + 4) * dl; + return (this.pos += 8), t; + }, + readSFixed64: function () { + var t = Bl(this.buf, this.pos) + Pl(this.buf, this.pos + 4) * dl; + return (this.pos += 8), t; + }, + readFloat: function () { + var t = cl(this.buf, this.pos, !0, 23, 4); + return (this.pos += 4), t; + }, + readDouble: function () { + var t = cl(this.buf, this.pos, !0, 52, 8); + return (this.pos += 8), t; + }, + readVarint: function (t) { + var e, + r, + n = this.buf; + return ( + (e = 127 & (r = n[this.pos++])), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 7), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 14), + r < 128 + ? e + : ((e |= (127 & (r = n[this.pos++])) << 21), + r < 128 + ? e + : (function (t, e, r) { + var n, + i, + a = r.buf; + if (((n = (112 & (i = a[r.pos++])) >> 4), i < 128)) + return xl(t, n, e); + if (((n |= (127 & (i = a[r.pos++])) << 3), i < 128)) + return xl(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 10), i < 128) + ) + return xl(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 17), i < 128) + ) + return xl(t, n, e); + if ( + ((n |= (127 & (i = a[r.pos++])) << 24), i < 128) + ) + return xl(t, n, e); + if (((n |= (1 & (i = a[r.pos++])) << 31), i < 128)) + return xl(t, n, e); + throw new Error( + 'Expected varint not more than 10 bytes', + ); + })((e |= (15 & (r = n[this.pos])) << 28), t, this)))) + ); + }, + readVarint64: function () { + return this.readVarint(!0); + }, + readSVarint: function () { + var t = this.readVarint(); + return t % 2 == 1 ? (t + 1) / -2 : t / 2; + }, + readBoolean: function () { + return Boolean(this.readVarint()); + }, + readString: function () { + var t = this.readVarint() + this.pos, + e = this.pos; + return ( + (this.pos = t), + t - e >= 12 && ml + ? (function (t, e, r) { + return ml.decode(t.subarray(e, r)); + })(this.buf, e, t) + : (function (t, e, r) { + for (var n = '', i = e; i < r; ) { + var a, + s, + o, + l = t[i], + u = null, + c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1; + if (i + c > r) break; + 1 === c + ? l < 128 && (u = l) + : 2 === c + ? 128 == (192 & (a = t[i + 1])) && + (u = ((31 & l) << 6) | (63 & a)) <= 127 && + (u = null) + : 3 === c + ? ((s = t[i + 2]), + 128 == (192 & (a = t[i + 1])) && + 128 == (192 & s) && + ((u = ((15 & l) << 12) | ((63 & a) << 6) | (63 & s)) <= + 2047 || + (u >= 55296 && u <= 57343)) && + (u = null)) + : 4 === c && + ((s = t[i + 2]), + (o = t[i + 3]), + 128 == (192 & (a = t[i + 1])) && + 128 == (192 & s) && + 128 == (192 & o) && + ((u = + ((15 & l) << 18) | + ((63 & a) << 12) | + ((63 & s) << 6) | + (63 & o)) <= 65535 || + u >= 1114112) && + (u = null)), + null === u + ? ((u = 65533), (c = 1)) + : u > 65535 && + ((u -= 65536), + (n += String.fromCharCode(((u >>> 10) & 1023) | 55296)), + (u = 56320 | (1023 & u))), + (n += String.fromCharCode(u)), + (i += c); + } + return n; + })(this.buf, e, t) + ); + }, + readBytes: function () { + var t = this.readVarint() + this.pos, + e = this.buf.subarray(this.pos, t); + return (this.pos = t), e; + }, + readPackedVarint: function (t, e) { + if (this.type !== pl.Bytes) return t.push(this.readVarint(e)); + var r = gl(this); + for (t = t || []; this.pos < r; ) t.push(this.readVarint(e)); + return t; + }, + readPackedSVarint: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readSVarint()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readSVarint()); + return t; + }, + readPackedBoolean: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readBoolean()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readBoolean()); + return t; + }, + readPackedFloat: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readFloat()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readFloat()); + return t; + }, + readPackedDouble: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readDouble()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readDouble()); + return t; + }, + readPackedFixed32: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readFixed32()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readFixed32()); + return t; + }, + readPackedSFixed32: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readSFixed32()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readSFixed32()); + return t; + }, + readPackedFixed64: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readFixed64()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readFixed64()); + return t; + }, + readPackedSFixed64: function (t) { + if (this.type !== pl.Bytes) return t.push(this.readSFixed64()); + var e = gl(this); + for (t = t || []; this.pos < e; ) t.push(this.readSFixed64()); + return t; + }, + skip: function (t) { + var e = 7 & t; + if (e === pl.Varint) for (; this.buf[this.pos++] > 127; ); + else if (e === pl.Bytes) this.pos = this.readVarint() + this.pos; + else if (e === pl.Fixed32) this.pos += 4; + else { + if (e !== pl.Fixed64) throw new Error('Unimplemented type: ' + e); + this.pos += 8; + } + }, + writeTag: function (t, e) { + this.writeVarint((t << 3) | e); + }, + realloc: function (t) { + for (var e = this.length || 16; e < this.pos + t; ) e *= 2; + if (e !== this.length) { + var r = new Uint8Array(e); + r.set(this.buf), (this.buf = r), (this.length = e); + } + }, + finish: function () { + return ( + (this.length = this.pos), + (this.pos = 0), + this.buf.subarray(0, this.length) + ); + }, + writeFixed32: function (t) { + this.realloc(4), Cl(this.buf, t, this.pos), (this.pos += 4); + }, + writeSFixed32: function (t) { + this.realloc(4), Cl(this.buf, t, this.pos), (this.pos += 4); + }, + writeFixed64: function (t) { + this.realloc(8), + Cl(this.buf, -1 & t, this.pos), + Cl(this.buf, Math.floor(t * yl), this.pos + 4), + (this.pos += 8); + }, + writeSFixed64: function (t) { + this.realloc(8), + Cl(this.buf, -1 & t, this.pos), + Cl(this.buf, Math.floor(t * yl), this.pos + 4), + (this.pos += 8); + }, + writeVarint: function (t) { + (t = +t || 0) > 268435455 || t < 0 + ? (function (t, e) { + var r, n; + if ( + (t >= 0 + ? ((r = t % 4294967296 | 0), (n = (t / 4294967296) | 0)) + : ((n = ~(-t / 4294967296)), + 4294967295 ^ (r = ~(-t % 4294967296)) + ? (r = (r + 1) | 0) + : ((r = 0), (n = (n + 1) | 0))), + t >= 0x10000000000000000 || t < -0x10000000000000000) + ) + throw new Error("Given varint doesn't fit into 10 bytes"); + e.realloc(10), + (function (t, e, r) { + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (t >>>= 7), + (r.buf[r.pos++] = (127 & t) | 128), + (r.buf[r.pos] = 127 & (t >>>= 7)); + })(r, 0, e), + (function (t, e) { + var r = (7 & t) << 4; + (e.buf[e.pos++] |= r | ((t >>>= 3) ? 128 : 0)), + t && + ((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = + (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && + ((e.buf[e.pos++] = + (127 & t) | ((t >>>= 7) ? 128 : 0)), + t && (e.buf[e.pos++] = 127 & t))))); + })(n, e); + })(t, this) + : (this.realloc(4), + (this.buf[this.pos++] = (127 & t) | (t > 127 ? 128 : 0)), + t <= 127 || + ((this.buf[this.pos++] = + (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)), + t <= 127 || + ((this.buf[this.pos++] = + (127 & (t >>>= 7)) | (t > 127 ? 128 : 0)), + t <= 127 || (this.buf[this.pos++] = (t >>> 7) & 127)))); + }, + writeSVarint: function (t) { + this.writeVarint(t < 0 ? 2 * -t - 1 : 2 * t); + }, + writeBoolean: function (t) { + this.writeVarint(Boolean(t)); + }, + writeString: function (t) { + (t = String(t)), this.realloc(4 * t.length), this.pos++; + var e = this.pos; + this.pos = (function (t, e, r) { + for (var n, i, a = 0; a < e.length; a++) { + if ((n = e.charCodeAt(a)) > 55295 && n < 57344) { + if (!i) { + n > 56319 || a + 1 === e.length + ? ((t[r++] = 239), (t[r++] = 191), (t[r++] = 189)) + : (i = n); + continue; + } + if (n < 56320) { + (t[r++] = 239), (t[r++] = 191), (t[r++] = 189), (i = n); + continue; + } + (n = ((i - 55296) << 10) | (n - 56320) | 65536), (i = null); + } else + i && ((t[r++] = 239), (t[r++] = 191), (t[r++] = 189), (i = null)); + n < 128 + ? (t[r++] = n) + : (n < 2048 + ? (t[r++] = (n >> 6) | 192) + : (n < 65536 + ? (t[r++] = (n >> 12) | 224) + : ((t[r++] = (n >> 18) | 240), + (t[r++] = ((n >> 12) & 63) | 128)), + (t[r++] = ((n >> 6) & 63) | 128)), + (t[r++] = (63 & n) | 128)); + } + return r; + })(this.buf, t, this.pos); + var r = this.pos - e; + r >= 128 && vl(e, r, this), + (this.pos = e - 1), + this.writeVarint(r), + (this.pos += r); + }, + writeFloat: function (t) { + this.realloc(4), hl(this.buf, t, this.pos, !0, 23, 4), (this.pos += 4); + }, + writeDouble: function (t) { + this.realloc(8), hl(this.buf, t, this.pos, !0, 52, 8), (this.pos += 8); + }, + writeBytes: function (t) { + var e = t.length; + this.writeVarint(e), this.realloc(e); + for (var r = 0; r < e; r++) this.buf[this.pos++] = t[r]; + }, + writeRawMessage: function (t, e) { + this.pos++; + var r = this.pos; + t(e, this); + var n = this.pos - r; + n >= 128 && vl(r, n, this), + (this.pos = r - 1), + this.writeVarint(n), + (this.pos += n); + }, + writeMessage: function (t, e, r) { + this.writeTag(t, pl.Bytes), this.writeRawMessage(e, r); + }, + writePackedVarint: function (t, e) { + e.length && this.writeMessage(t, bl, e); + }, + writePackedSVarint: function (t, e) { + e.length && this.writeMessage(t, wl, e); + }, + writePackedBoolean: function (t, e) { + e.length && this.writeMessage(t, kl, e); + }, + writePackedFloat: function (t, e) { + e.length && this.writeMessage(t, _l, e); + }, + writePackedDouble: function (t, e) { + e.length && this.writeMessage(t, Al, e); + }, + writePackedFixed32: function (t, e) { + e.length && this.writeMessage(t, Sl, e); + }, + writePackedSFixed32: function (t, e) { + e.length && this.writeMessage(t, Il, e); + }, + writePackedFixed64: function (t, e) { + e.length && this.writeMessage(t, Ml, e); + }, + writePackedSFixed64: function (t, e) { + e.length && this.writeMessage(t, zl, e); + }, + writeBytesField: function (t, e) { + this.writeTag(t, pl.Bytes), this.writeBytes(e); + }, + writeFixed32Field: function (t, e) { + this.writeTag(t, pl.Fixed32), this.writeFixed32(e); + }, + writeSFixed32Field: function (t, e) { + this.writeTag(t, pl.Fixed32), this.writeSFixed32(e); + }, + writeFixed64Field: function (t, e) { + this.writeTag(t, pl.Fixed64), this.writeFixed64(e); + }, + writeSFixed64Field: function (t, e) { + this.writeTag(t, pl.Fixed64), this.writeSFixed64(e); + }, + writeVarintField: function (t, e) { + this.writeTag(t, pl.Varint), this.writeVarint(e); + }, + writeSVarintField: function (t, e) { + this.writeTag(t, pl.Varint), this.writeSVarint(e); + }, + writeStringField: function (t, e) { + this.writeTag(t, pl.Bytes), this.writeString(e); + }, + writeFloatField: function (t, e) { + this.writeTag(t, pl.Fixed32), this.writeFloat(e); + }, + writeDoubleField: function (t, e) { + this.writeTag(t, pl.Fixed64), this.writeDouble(e); + }, + writeBooleanField: function (t, e) { + this.writeVarintField(t, Boolean(e)); + }, + }; + class Ll { + constructor( + t, + { pixelRatio: e, version: r, stretchX: n, stretchY: i, content: a }, + ) { + (this.paddedRect = t), + (this.pixelRatio = e), + (this.stretchX = n), + (this.stretchY = i), + (this.content = a), + (this.version = r); + } + get tl() { + return [this.paddedRect.x + 1, this.paddedRect.y + 1]; + } + get br() { + return [ + this.paddedRect.x + this.paddedRect.w - 1, + this.paddedRect.y + this.paddedRect.h - 1, + ]; + } + get tlbr() { + return this.tl.concat(this.br); + } + get displaySize() { + return [ + (this.paddedRect.w - 2) / this.pixelRatio, + (this.paddedRect.h - 2) / this.pixelRatio, + ]; + } + } + class Dl { + constructor(t, e) { + const r = {}, + n = {}; + this.haveRenderCallbacks = []; + const i = []; + this.addImages(t, r, i), this.addImages(e, n, i); + const { w: a, h: s } = Tl(i), + o = new Bs({ width: a || 1, height: s || 1 }); + for (const e in t) { + const n = t[e], + i = r[e].paddedRect; + Bs.copy( + n.data, + o, + { x: 0, y: 0 }, + { x: i.x + 1, y: i.y + 1 }, + n.data, + ); + } + for (const t in e) { + const r = e[t], + i = n[t].paddedRect, + a = i.x + 1, + s = i.y + 1, + l = r.data.width, + u = r.data.height; + Bs.copy(r.data, o, { x: 0, y: 0 }, { x: a, y: s }, r.data), + Bs.copy( + r.data, + o, + { x: 0, y: u - 1 }, + { x: a, y: s - 1 }, + { width: l, height: 1 }, + ), + Bs.copy( + r.data, + o, + { x: 0, y: 0 }, + { x: a, y: s + u }, + { width: l, height: 1 }, + ), + Bs.copy( + r.data, + o, + { x: l - 1, y: 0 }, + { x: a - 1, y: s }, + { width: 1, height: u }, + ), + Bs.copy( + r.data, + o, + { x: 0, y: 0 }, + { x: a + l, y: s }, + { width: 1, height: u }, + ); + } + (this.image = o), (this.iconPositions = r), (this.patternPositions = n); + } + addImages(t, e, r) { + for (const n in t) { + const i = t[n], + a = { x: 0, y: 0, w: i.data.width + 2, h: i.data.height + 2 }; + r.push(a), + (e[n] = new Ll(a, i)), + i.hasRenderCallback && this.haveRenderCallbacks.push(n); + } + } + patchUpdatedImages(t, e) { + t.dispatchRenderCallbacks(this.haveRenderCallbacks); + for (const r in t.updatedImages) + this.patchUpdatedImage(this.iconPositions[r], t.getImage(r), e), + this.patchUpdatedImage(this.patternPositions[r], t.getImage(r), e); + } + patchUpdatedImage(t, e, r) { + if (!t || !e) return; + if (t.version === e.version) return; + t.version = e.version; + const [n, i] = t.tl; + r.update(e.data, void 0, { x: n, y: i }); + } + } + Mn('ImagePosition', Ll), + Mn('ImageAtlas', Dl), + (t.WritingMode = void 0), + ((fl = t.WritingMode || (t.WritingMode = {}))[(fl.none = 0)] = 'none'), + (fl[(fl.horizontal = 1)] = 'horizontal'), + (fl[(fl.vertical = 2)] = 'vertical'), + (fl[(fl.horizontalOnly = 3)] = 'horizontalOnly'); + const $l = -17; + class Rl { + constructor() { + (this.scale = 1), (this.fontStack = ''), (this.imageName = null); + } + static forText(t, e) { + const r = new Rl(); + return (r.scale = t || 1), (r.fontStack = e), r; + } + static forImage(t) { + const e = new Rl(); + return (e.imageName = t), e; + } + } + class Ol { + constructor() { + (this.text = ''), + (this.sectionIndex = []), + (this.sections = []), + (this.imageSectionID = null); + } + static fromFeature(t, e) { + const r = new Ol(); + for (let n = 0; n < t.sections.length; n++) { + const i = t.sections[n]; + i.image ? r.addImageSection(i) : r.addTextSection(i, e); + } + return r; + } + length() { + return this.text.length; + } + getSection(t) { + return this.sections[this.sectionIndex[t]]; + } + getSectionIndex(t) { + return this.sectionIndex[t]; + } + getCharCode(t) { + return this.text.charCodeAt(t); + } + verticalizePunctuation() { + this.text = (function (t) { + let e = ''; + for (let r = 0; r < t.length; r++) { + const n = t.charCodeAt(r + 1) || null, + i = t.charCodeAt(r - 1) || null; + e += + (n && Dn(n) && !ol[t[r + 1]]) || + (i && Dn(i) && !ol[t[r - 1]]) || + !ol[t[r]] + ? t[r] + : ol[t[r]]; + } + return e; + })(this.text); + } + trim() { + let t = 0; + for ( + let e = 0; + e < this.text.length && ql[this.text.charCodeAt(e)]; + e++ + ) + t++; + let e = this.text.length; + for ( + let r = this.text.length - 1; + r >= 0 && r >= t && ql[this.text.charCodeAt(r)]; + r-- + ) + e--; + (this.text = this.text.substring(t, e)), + (this.sectionIndex = this.sectionIndex.slice(t, e)); + } + substring(t, e) { + const r = new Ol(); + return ( + (r.text = this.text.substring(t, e)), + (r.sectionIndex = this.sectionIndex.slice(t, e)), + (r.sections = this.sections), + r + ); + } + toString() { + return this.text; + } + getMaxScale() { + return this.sectionIndex.reduce( + (t, e) => Math.max(t, this.sections[e].scale), + 0, + ); + } + addTextSection(t, e) { + (this.text += t.text), + this.sections.push(Rl.forText(t.scale, t.fontStack || e)); + const r = this.sections.length - 1; + for (let e = 0; e < t.text.length; ++e) this.sectionIndex.push(r); + } + addImageSection(t) { + const e = t.image ? t.image.name : ''; + if (0 === e.length) + return void d("Can't add FormattedSection with an empty image."); + const r = this.getNextImageSectionCharCode(); + r + ? ((this.text += String.fromCharCode(r)), + this.sections.push(Rl.forImage(e)), + this.sectionIndex.push(this.sections.length - 1)) + : d('Reached maximum number of images 6401'); + } + getNextImageSectionCharCode() { + return this.imageSectionID + ? this.imageSectionID >= 63743 + ? null + : ++this.imageSectionID + : ((this.imageSectionID = 57344), this.imageSectionID); + } + } + function Ul(e, r, n, i, a, s, o, l, u, c, h, p, f, d, y, m) { + const g = Ol.fromFeature(e, a); + let x; + p === t.WritingMode.vertical && g.verticalizePunctuation(); + const { processBidirectionalText: v, processStyledBidirectionalText: b } = + Wn; + if (v && 1 === g.sections.length) { + x = []; + const t = v(g.toString(), Xl(g, c, s, r, i, d, y)); + for (const e of t) { + const t = new Ol(); + (t.text = e), (t.sections = g.sections); + for (let r = 0; r < e.length; r++) t.sectionIndex.push(0); + x.push(t); + } + } else if (b) { + x = []; + const t = b(g.text, g.sectionIndex, Xl(g, c, s, r, i, d, y)); + for (const e of t) { + const t = new Ol(); + (t.text = e[0]), + (t.sectionIndex = e[1]), + (t.sections = g.sections), + x.push(t); + } + } else + x = (function (t, e) { + const r = [], + n = t.text; + let i = 0; + for (const n of e) r.push(t.substring(i, n)), (i = n); + return i < n.length && r.push(t.substring(i, n.length)), r; + })(g, Xl(g, c, s, r, i, d, y)); + const w = [], + _ = { + positionedLines: w, + text: g.toString(), + top: h[1], + bottom: h[1], + left: h[0], + right: h[0], + writingMode: p, + iconsInText: !1, + verticalizable: !1, + }; + return ( + (function (e, r, n, i, a, s, o, l, u, c, h, p) { + let f = 0, + d = $l, + y = 0, + m = 0; + const g = 'right' === l ? 1 : 'left' === l ? 0 : 0.5; + let x = 0; + for (const o of a) { + o.trim(); + const a = o.getMaxScale(), + l = (a - 1) * ll, + b = { positionedGlyphs: [], lineOffset: 0 }; + e.positionedLines[x] = b; + const w = b.positionedGlyphs; + let _ = 0; + if (!o.length()) { + (d += s), ++x; + continue; + } + for (let s = 0; s < o.length(); s++) { + const y = o.getSection(s), + m = o.getSectionIndex(s), + g = o.getCharCode(s); + let x = 0, + b = null, + A = null, + k = null, + S = ll; + const I = !( + u === t.WritingMode.horizontal || + (!h && !Ln(g)) || + (h && + (ql[g] || + ((v = g), + Vn.Arabic(v) || + Vn['Arabic Supplement'](v) || + Vn['Arabic Extended-A'](v) || + Vn['Arabic Presentation Forms-A'](v) || + Vn['Arabic Presentation Forms-B'](v)))) + ); + if (y.imageName) { + const t = i[y.imageName]; + if (!t) continue; + (k = y.imageName), + (e.iconsInText = e.iconsInText || !0), + (A = t.paddedRect); + const r = t.displaySize; + (y.scale = (y.scale * ll) / p), + (b = { + width: r[0], + height: r[1], + left: 1, + top: -3, + advance: I ? r[1] : r[0], + }), + (x = l + (ll - r[1] * y.scale)), + (S = b.advance); + const n = I ? r[0] * y.scale - ll * a : r[1] * y.scale - ll * a; + n > 0 && n > _ && (_ = n); + } else { + const t = n[y.fontStack], + e = t && t[g]; + if (e && e.rect) (A = e.rect), (b = e.metrics); + else { + const t = r[y.fontStack], + e = t && t[g]; + if (!e) continue; + b = e.metrics; + } + x = (a - y.scale) * ll; + } + I + ? ((e.verticalizable = !0), + w.push({ + glyph: g, + imageName: k, + x: f, + y: d + x, + vertical: I, + scale: y.scale, + fontStack: y.fontStack, + sectionIndex: m, + metrics: b, + rect: A, + }), + (f += S * y.scale + c)) + : (w.push({ + glyph: g, + imageName: k, + x: f, + y: d + x, + vertical: I, + scale: y.scale, + fontStack: y.fontStack, + sectionIndex: m, + metrics: b, + rect: A, + }), + (f += b.advance * y.scale + c)); + } + 0 !== w.length && + ((y = Math.max(f - c, y)), Hl(w, 0, w.length - 1, g, _)), + (f = 0); + const A = s * a + _; + (b.lineOffset = Math.max(_, l)), + (d += A), + (m = Math.max(A, m)), + ++x; + } + var v; + const b = d - $l, + { horizontalAlign: w, verticalAlign: _ } = Yl(o); + (function (t, e, r, n, i, a, s, o, l) { + const u = (e - r) * i; + let c = 0; + c = a !== s ? -o * n - $l : (-n * l + 0.5) * s; + for (const e of t) + for (const t of e.positionedGlyphs) (t.x += u), (t.y += c); + })(e.positionedLines, g, w, _, y, m, s, b, a.length), + (e.top += -_ * b), + (e.bottom = e.top + b), + (e.left += -w * y), + (e.right = e.left + y); + })(_, r, n, i, x, o, l, u, p, c, f, m), + !(function (t) { + for (const e of t) if (0 !== e.positionedGlyphs.length) return !1; + return !0; + })(w) && _ + ); + } + const ql = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, + jl = { + 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 Nl(t, e, r, n, i, a) { + if (e.imageName) { + const t = n[e.imageName]; + return t ? (t.displaySize[0] * e.scale * ll) / a + i : 0; + } + { + const n = r[e.fontStack], + a = n && n[t]; + return a ? a.metrics.advance * e.scale + i : 0; + } + } + function Zl(t, e, r, n) { + const i = Math.pow(t - e, 2); + return n ? (t < e ? i / 2 : 2 * i) : i + Math.abs(r) * r; + } + function Kl(t, e, r) { + let n = 0; + return ( + 10 === t && (n -= 1e4), + r && (n += 150), + (40 !== t && 65288 !== t) || (n += 50), + (41 !== e && 65289 !== e) || (n += 50), + n + ); + } + function Gl(t, e, r, n, i, a) { + let s = null, + o = Zl(e, r, i, a); + for (const t of n) { + const n = Zl(e - t.x, r, i, a) + t.badness; + n <= o && ((s = t), (o = n)); + } + return { index: t, x: e, priorBreak: s, badness: o }; + } + function Jl(t) { + return t ? Jl(t.priorBreak).concat(t.index) : []; + } + function Xl(t, e, r, n, i, a, s) { + if ('point' !== a) return []; + if (!t) return []; + const o = [], + l = (function (t, e, r, n, i, a) { + let s = 0; + for (let r = 0; r < t.length(); r++) { + const o = t.getSection(r); + s += Nl(t.getCharCode(r), o, n, i, e, a); + } + return s / Math.max(1, Math.ceil(s / r)); + })(t, e, r, n, i, s), + u = t.text.indexOf('​') >= 0; + let c = 0; + for (let r = 0; r < t.length(); r++) { + const a = t.getSection(r), + p = t.getCharCode(r); + if ((ql[p] || (c += Nl(p, a, n, i, e, s)), r < t.length() - 1)) { + const e = !( + (h = p) < 11904 || + !( + Vn['Bopomofo Extended'](h) || + Vn.Bopomofo(h) || + Vn['CJK Compatibility Forms'](h) || + Vn['CJK Compatibility Ideographs'](h) || + Vn['CJK Compatibility'](h) || + Vn['CJK Radicals Supplement'](h) || + Vn['CJK Strokes'](h) || + Vn['CJK Symbols and Punctuation'](h) || + Vn['CJK Unified Ideographs Extension A'](h) || + Vn['CJK Unified Ideographs'](h) || + Vn['Enclosed CJK Letters and Months'](h) || + Vn['Halfwidth and Fullwidth Forms'](h) || + Vn.Hiragana(h) || + Vn['Ideographic Description Characters'](h) || + Vn['Kangxi Radicals'](h) || + Vn['Katakana Phonetic Extensions'](h) || + Vn.Katakana(h) || + Vn['Vertical Forms'](h) || + Vn['Yi Radicals'](h) || + Vn['Yi Syllables'](h) + ) + ); + (jl[p] || e || a.imageName) && + o.push(Gl(r + 1, c, l, o, Kl(p, t.getCharCode(r + 1), e && u), !1)); + } + } + var h; + return Jl(Gl(t.length(), c, l, o, 0, !0)); + } + function Yl(t) { + let e = 0.5, + r = 0.5; + switch (t) { + case 'right': + case 'top-right': + case 'bottom-right': + e = 1; + break; + case 'left': + case 'top-left': + case 'bottom-left': + e = 0; + } + switch (t) { + case 'bottom': + case 'bottom-right': + case 'bottom-left': + r = 1; + break; + case 'top': + case 'top-right': + case 'top-left': + r = 0; + } + return { horizontalAlign: e, verticalAlign: r }; + } + function Hl(t, e, r, n, i) { + if (!n && !i) return; + const a = t[r], + s = (t[r].x + a.metrics.advance * a.scale) * n; + for (let n = e; n <= r; n++) (t[n].x -= s), (t[n].y += i); + } + function Wl(t, e, r) { + const { horizontalAlign: n, verticalAlign: i } = Yl(r), + a = e[0] - t.displaySize[0] * n, + s = e[1] - t.displaySize[1] * i; + return { + image: t, + top: s, + bottom: s + t.displaySize[1], + left: a, + right: a + t.displaySize[0], + }; + } + function Ql(t, e, r, n, i, a) { + const s = t.image; + let o; + if (s.content) { + const t = s.content, + e = s.pixelRatio || 1; + o = [ + t[0] / e, + t[1] / e, + s.displaySize[0] - t[2] / e, + s.displaySize[1] - t[3] / e, + ]; + } + const l = e.left * a, + u = e.right * a; + let c, h, p, f; + 'width' === r || 'both' === r + ? ((f = i[0] + l - n[3]), (h = i[0] + u + n[1])) + : ((f = i[0] + (l + u - s.displaySize[0]) / 2), + (h = f + s.displaySize[0])); + const d = e.top * a, + y = e.bottom * a; + return ( + 'height' === r || 'both' === r + ? ((c = i[1] + d - n[0]), (p = i[1] + y + n[2])) + : ((c = i[1] + (d + y - s.displaySize[1]) / 2), + (p = c + s.displaySize[1])), + { image: s, top: c, right: h, bottom: p, left: f, collisionPadding: o } + ); + } + const tu = 128; + function eu(t, e) { + const { expression: r } = e; + if ('constant' === r.kind) + return { kind: 'constant', layoutSize: r.evaluate(new Qn(t + 1)) }; + if ('source' === r.kind) return { kind: 'source' }; + { + const { zoomStops: e, interpolationType: n } = r; + let i = 0; + for (; i < e.length && e[i] <= t; ) i++; + i = Math.max(0, i - 1); + let a = i; + for (; a < e.length && e[a] < t + 1; ) a++; + a = Math.min(e.length - 1, a); + const s = e[i], + o = e[a]; + return 'composite' === r.kind + ? { kind: 'composite', minZoom: s, maxZoom: o, interpolationType: n } + : { + kind: 'camera', + minZoom: s, + maxZoom: o, + minSize: r.evaluate(new Qn(s)), + maxSize: r.evaluate(new Qn(o)), + interpolationType: n, + }; + } + } + class ru extends S { + constructor(t, e, r, n) { + super(t, e), (this.angle = r), void 0 !== n && (this.segment = n); + } + clone() { + return new ru(this.x, this.y, this.angle, this.segment); + } + } + function nu(t, e, r, n, i) { + if (void 0 === e.segment) return !0; + let a = e, + s = e.segment + 1, + o = 0; + for (; o > -r / 2; ) { + if ((s--, s < 0)) return !1; + (o -= t[s].dist(a)), (a = t[s]); + } + (o += t[s].dist(t[s + 1])), s++; + const l = []; + let u = 0; + for (; o < r / 2; ) { + const e = t[s], + r = t[s + 1]; + if (!r) return !1; + let a = t[s - 1].angleTo(e) - e.angleTo(r); + for ( + a = Math.abs(((a + 3 * Math.PI) % (2 * Math.PI)) - Math.PI), + l.push({ distance: o, angleDelta: a }), + u += a; + o - l[0].distance > n; -return maplibregl$1; + ) + u -= l.shift().angleDelta; + if (u > i) return !1; + s++, (o += e.dist(r)); + } + return !0; + } + function iu(t) { + let e = 0; + for (let r = 0; r < t.length - 1; r++) e += t[r].dist(t[r + 1]); + return e; + } + function au(t, e, r) { + return t ? 0.6 * e * r : 0; + } + function su(t, e) { + return Math.max(t ? t.right - t.left : 0, e ? e.right - e.left : 0); + } + function ou(t, e, r, n, i, a) { + const s = au(r, i, a), + o = su(r, n) * a; + let l = 0; + const u = iu(t) / 2; + for (let r = 0; r < t.length - 1; r++) { + const n = t[r], + i = t[r + 1], + a = n.dist(i); + if (l + a > u) { + const c = (u - l) / a, + h = Se(n.x, i.x, c), + p = Se(n.y, i.y, c), + f = new ru(h, p, i.angleTo(n), r); + return f._round(), !s || nu(t, f, o, s, e) ? f : void 0; + } + l += a; + } + } + function lu(t, e, r, n, i, a, s, o, l) { + const u = au(n, a, s), + c = su(n, i), + h = c * s, + p = 0 === t[0].x || t[0].x === l || 0 === t[0].y || t[0].y === l; + return ( + e - h < e / 4 && (e = h + e / 4), + uu( + t, + p ? ((e / 2) * o) % e : ((c / 2 + 2 * a) * s * o) % e, + e, + u, + r, + h, + p, + !1, + l, + ) + ); + } + function uu(t, e, r, n, i, a, s, o, l) { + const u = a / 2, + c = iu(t); + let h = 0, + p = e - r, + f = []; + for (let e = 0; e < t.length - 1; e++) { + const s = t[e], + o = t[e + 1], + d = s.dist(o), + y = o.angleTo(s); + for (; p + r < h + d; ) { + p += r; + const m = (p - h) / d, + g = Se(s.x, o.x, m), + x = Se(s.y, o.y, m); + if (g >= 0 && g < l && x >= 0 && x < l && p - u >= 0 && p + u <= c) { + const r = new ru(g, x, y, e); + r._round(), (n && !nu(t, r, a, n, i)) || f.push(r); + } + } + h += d; + } + return o || f.length || s || (f = uu(t, h / 2, r, n, i, a, s, !0, l)), f; + } + function cu(t, e, r, n, i) { + const a = []; + for (let s = 0; s < t.length; s++) { + const o = t[s]; + let l; + for (let t = 0; t < o.length - 1; t++) { + let s = o[t], + u = o[t + 1]; + (s.x < e && u.x < e) || + (s.x < e + ? (s = new S( + e, + s.y + ((e - s.x) / (u.x - s.x)) * (u.y - s.y), + )._round()) + : u.x < e && + (u = new S( + e, + s.y + ((e - s.x) / (u.x - s.x)) * (u.y - s.y), + )._round()), + (s.y < r && u.y < r) || + (s.y < r + ? (s = new S( + s.x + ((r - s.y) / (u.y - s.y)) * (u.x - s.x), + r, + )._round()) + : u.y < r && + (u = new S( + s.x + ((r - s.y) / (u.y - s.y)) * (u.x - s.x), + r, + )._round()), + (s.x >= n && u.x >= n) || + (s.x >= n + ? (s = new S( + n, + s.y + ((n - s.x) / (u.x - s.x)) * (u.y - s.y), + )._round()) + : u.x >= n && + (u = new S( + n, + s.y + ((n - s.x) / (u.x - s.x)) * (u.y - s.y), + )._round()), + (s.y >= i && u.y >= i) || + (s.y >= i + ? (s = new S( + s.x + ((i - s.y) / (u.y - s.y)) * (u.x - s.x), + i, + )._round()) + : u.y >= i && + (u = new S( + s.x + ((i - s.y) / (u.y - s.y)) * (u.x - s.x), + i, + )._round()), + (l && s.equals(l[l.length - 1])) || ((l = [s]), a.push(l)), + l.push(u))))); + } + } + return a; + } + function hu(t, e, r, n) { + const i = [], + a = t.image, + s = a.pixelRatio, + o = a.paddedRect.w - 2, + l = a.paddedRect.h - 2, + u = t.right - t.left, + c = t.bottom - t.top, + h = a.stretchX || [[0, o]], + p = a.stretchY || [[0, l]], + f = (t, e) => t + e[1] - e[0], + d = h.reduce(f, 0), + y = p.reduce(f, 0), + m = o - d, + g = l - y; + let x = 0, + v = d, + b = 0, + w = y, + _ = 0, + A = m, + k = 0, + I = g; + if (a.content && n) { + const t = a.content; + (x = pu(h, 0, t[0])), + (b = pu(p, 0, t[1])), + (v = pu(h, t[0], t[2])), + (w = pu(p, t[1], t[3])), + (_ = t[0] - x), + (k = t[1] - b), + (A = t[2] - t[0] - v), + (I = t[3] - t[1] - w); + } + const M = (n, i, o, l) => { + const h = du(n.stretch - x, v, u, t.left), + p = yu(n.fixed - _, A, n.stretch, d), + f = du(i.stretch - b, w, c, t.top), + m = yu(i.fixed - k, I, i.stretch, y), + g = du(o.stretch - x, v, u, t.left), + M = yu(o.fixed - _, A, o.stretch, d), + z = du(l.stretch - b, w, c, t.top), + B = yu(l.fixed - k, I, l.stretch, y), + C = new S(h, f), + P = new S(g, f), + V = new S(g, z), + E = new S(h, z), + F = new S(p / s, m / s), + T = new S(M / s, B / s), + L = (e * Math.PI) / 180; + if (L) { + const t = Math.sin(L), + e = Math.cos(L), + r = [e, -t, t, e]; + C._matMult(r), P._matMult(r), E._matMult(r), V._matMult(r); + } + const D = n.stretch + n.fixed, + $ = i.stretch + i.fixed; + return { + tl: C, + tr: P, + bl: E, + br: V, + tex: { + x: a.paddedRect.x + 1 + D, + y: a.paddedRect.y + 1 + $, + w: o.stretch + o.fixed - D, + h: l.stretch + l.fixed - $, + }, + writingMode: void 0, + glyphOffset: [0, 0], + sectionIndex: 0, + pixelOffsetTL: F, + pixelOffsetBR: T, + minFontScaleX: A / s / u, + minFontScaleY: I / s / c, + isSDF: r, + }; + }; + if (n && (a.stretchX || a.stretchY)) { + const t = fu(h, m, d), + e = fu(p, g, y); + for (let r = 0; r < t.length - 1; r++) { + const n = t[r], + a = t[r + 1]; + for (let t = 0; t < e.length - 1; t++) + i.push(M(n, e[t], a, e[t + 1])); + } + } else i.push(M({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: o + 1 }, { fixed: 0, stretch: l + 1 })); + return i; + } + function pu(t, e, r) { + let n = 0; + for (const i of t) + n += Math.max(e, Math.min(r, i[1])) - Math.max(e, Math.min(r, i[0])); + return n; + } + function fu(t, e, r) { + const n = [{ fixed: -1, stretch: 0 }]; + for (const [e, r] of t) { + const t = n[n.length - 1]; + n.push({ fixed: e - t.stretch, stretch: t.stretch }), + n.push({ fixed: e - t.stretch, stretch: t.stretch + (r - e) }); + } + return n.push({ fixed: e + 1, stretch: r }), n; + } + function du(t, e, r, n) { + return (t / e) * r + n; + } + function yu(t, e, r, n) { + return t - (e * r) / n; + } + Mn('Anchor', ru); + class mu { + constructor(t, e, r, n, i, a, s, o, l, u) { + if (((this.boxStartIndex = t.length), l)) { + let t = a.top, + e = a.bottom; + const r = a.collisionPadding; + r && ((t -= r[1]), (e += r[3])); + let n = e - t; + n > 0 && ((n = Math.max(10, n)), (this.circleDiameter = n)); + } else { + let l = a.top * s - o[0], + c = a.bottom * s + o[2], + h = a.left * s - o[3], + p = a.right * s + o[1]; + const f = a.collisionPadding; + if ( + (f && + ((h -= f[0] * s), + (l -= f[1] * s), + (p += f[2] * s), + (c += f[3] * s)), + u) + ) { + const t = new S(h, l), + e = new S(p, l), + r = new S(h, c), + n = new S(p, c), + i = (u * Math.PI) / 180; + t._rotate(i), + e._rotate(i), + r._rotate(i), + n._rotate(i), + (h = Math.min(t.x, e.x, r.x, n.x)), + (p = Math.max(t.x, e.x, r.x, n.x)), + (l = Math.min(t.y, e.y, r.y, n.y)), + (c = Math.max(t.y, e.y, r.y, n.y)); + } + t.emplaceBack(e.x, e.y, h, l, p, c, r, n, i); + } + this.boxEndIndex = t.length; + } + } + class gu { + constructor(t = [], e = xu) { + if ( + ((this.data = t), + (this.length = this.data.length), + (this.compare = e), + this.length > 0) + ) + for (let t = (this.length >> 1) - 1; t >= 0; t--) this._down(t); + } + push(t) { + this.data.push(t), this.length++, this._up(this.length - 1); + } + pop() { + if (0 === this.length) return; + const t = this.data[0], + e = this.data.pop(); + return ( + this.length--, + this.length > 0 && ((this.data[0] = e), this._down(0)), + t + ); + } + peek() { + return this.data[0]; + } + _up(t) { + const { data: e, compare: r } = this, + n = e[t]; + for (; t > 0; ) { + const i = (t - 1) >> 1, + a = e[i]; + if (r(n, a) >= 0) break; + (e[t] = a), (t = i); + } + e[t] = n; + } + _down(t) { + const { data: e, compare: r } = this, + n = this.length >> 1, + i = e[t]; + for (; t < n; ) { + let n = 1 + (t << 1), + a = e[n]; + const s = n + 1; + if ( + (s < this.length && r(e[s], a) < 0 && ((n = s), (a = e[s])), + r(a, i) >= 0) + ) + break; + (e[t] = a), (t = n); + } + e[t] = i; + } + } + function xu(t, e) { + return t < e ? -1 : t > e ? 1 : 0; + } + function vu(t, e = 1, r = !1) { + let n = 1 / 0, + i = 1 / 0, + a = -1 / 0, + s = -1 / 0; + const o = t[0]; + for (let t = 0; t < o.length; t++) { + const e = o[t]; + (!t || e.x < n) && (n = e.x), + (!t || e.y < i) && (i = e.y), + (!t || e.x > a) && (a = e.x), + (!t || e.y > s) && (s = e.y); + } + const l = Math.min(a - n, s - i); + let u = l / 2; + const c = new gu([], bu); + if (0 === l) return new S(n, i); + for (let e = n; e < a; e += l) + for (let r = i; r < s; r += l) c.push(new wu(e + u, r + u, u, t)); + let h = (function (t) { + let e = 0, + r = 0, + n = 0; + const i = t[0]; + for (let t = 0, a = i.length, s = a - 1; t < a; s = t++) { + const a = i[t], + o = i[s], + l = a.x * o.y - o.x * a.y; + (r += (a.x + o.x) * l), (n += (a.y + o.y) * l), (e += 3 * l); + } + return new wu(r / e, n / e, 0, t); + })(t), + p = c.length; + for (; c.length; ) { + const n = c.pop(); + (n.d > h.d || !h.d) && + ((h = n), + r && + console.log( + 'found best %d after %d probes', + Math.round(1e4 * n.d) / 1e4, + p, + )), + n.max - h.d <= e || + ((u = n.h / 2), + c.push(new wu(n.p.x - u, n.p.y - u, u, t)), + c.push(new wu(n.p.x + u, n.p.y - u, u, t)), + c.push(new wu(n.p.x - u, n.p.y + u, u, t)), + c.push(new wu(n.p.x + u, n.p.y + u, u, t)), + (p += 4)); + } + return ( + r && + (console.log(`num probes: ${p}`), + console.log(`best distance: ${h.d}`)), + h.p + ); + } + function bu(t, e) { + return e.max - t.max; + } + function wu(t, e, r, n) { + (this.p = new S(t, e)), + (this.h = r), + (this.d = (function (t, e) { + let r = !1, + n = 1 / 0; + for (let i = 0; i < e.length; i++) { + const a = e[i]; + for (let e = 0, i = a.length, s = i - 1; e < i; s = e++) { + const i = a[e], + o = a[s]; + i.y > t.y != o.y > t.y && + t.x < ((o.x - i.x) * (t.y - i.y)) / (o.y - i.y) + i.x && + (r = !r), + (n = Math.min(n, rs(t, i, o))); + } + } + return (r ? 1 : -1) * Math.sqrt(n); + })(this.p, n)), + (this.max = this.d + this.h * Math.SQRT2); + } + const _u = Number.POSITIVE_INFINITY; + function Au(t, e) { + return e[1] !== _u + ? (function (t, e, r) { + let n = 0, + i = 0; + switch (((e = Math.abs(e)), (r = Math.abs(r)), t)) { + case 'top-right': + case 'top-left': + case 'top': + i = r - 7; + break; + case 'bottom-right': + case 'bottom-left': + case 'bottom': + i = 7 - r; + } + switch (t) { + case 'top-right': + case 'bottom-right': + case 'right': + n = -e; + break; + case 'top-left': + case 'bottom-left': + case 'left': + n = e; + } + return [n, i]; + })(t, e[0], e[1]) + : (function (t, e) { + let r = 0, + n = 0; + e < 0 && (e = 0); + const i = e / Math.sqrt(2); + switch (t) { + case 'top-right': + case 'top-left': + n = i - 7; + break; + case 'bottom-right': + case 'bottom-left': + n = 7 - i; + break; + case 'bottom': + n = 7 - e; + break; + case 'top': + n = e - 7; + } + switch (t) { + case 'top-right': + case 'bottom-right': + r = -i; + break; + case 'top-left': + case 'bottom-left': + r = i; + break; + case 'left': + r = e; + break; + case 'right': + r = -e; + } + return [r, n]; + })(t, e[0]); + } + function ku(t) { + switch (t) { + case 'right': + case 'top-right': + case 'bottom-right': + return 'right'; + case 'left': + case 'top-left': + case 'bottom-left': + return 'left'; + } + return 'center'; + } + function Su(e, r, n, i, a, s, o, l, u, c, h) { + let p = s.textMaxSize.evaluate(r, {}); + void 0 === p && (p = o); + const f = e.layers[0].layout, + y = f.get('icon-offset').evaluate(r, {}, h), + m = zu(n.horizontal), + g = o / 24, + x = e.tilePixelRatio * g, + v = (e.tilePixelRatio * p) / 24, + b = e.tilePixelRatio * l, + w = e.tilePixelRatio * f.get('symbol-spacing'), + _ = f.get('text-padding') * e.tilePixelRatio, + A = (function (t, e, r, n = 1) { + const i = t.get('icon-padding').evaluate(e, {}, r), + a = i && i.values; + return [a[0] * n, a[1] * n, a[2] * n, a[3] * n]; + })(f, r, h, e.tilePixelRatio), + k = (f.get('text-max-angle') / 180) * Math.PI, + S = + 'viewport' !== f.get('text-rotation-alignment') && + 'point' !== f.get('symbol-placement'), + I = + 'map' === f.get('icon-rotation-alignment') && + 'point' !== f.get('symbol-placement'), + M = f.get('symbol-placement'), + z = w / 2, + B = f.get('icon-text-fit'); + let C; + i && + 'none' !== B && + (e.allowVerticalPlacement && + n.vertical && + (C = Ql(i, n.vertical, B, f.get('icon-text-fit-padding'), y, g)), + m && (i = Ql(i, m, B, f.get('icon-text-fit-padding'), y, g))); + const P = (l, p) => { + p.x < 0 || + p.x >= qa || + p.y < 0 || + p.y >= qa || + (function ( + e, + r, + n, + i, + a, + s, + o, + l, + u, + c, + h, + p, + f, + y, + m, + g, + x, + v, + b, + w, + _, + A, + k, + S, + I, + ) { + const M = e.addToLineVertexArray(r, n); + let z, + B, + C, + P, + V = 0, + E = 0, + F = 0, + T = 0, + L = -1, + D = -1; + const $ = {}; + let R = xa.exports(''), + O = 0, + U = 0; + if ( + (void 0 === l._unevaluatedLayout.getValue('text-radial-offset') + ? ([O, U] = l.layout + .get('text-offset') + .evaluate(_, {}, S) + .map((t) => t * ll)) + : ((O = + l.layout.get('text-radial-offset').evaluate(_, {}, S) * ll), + (U = _u)), + e.allowVerticalPlacement && i.vertical) + ) { + const t = l.layout.get('text-rotate').evaluate(_, {}, S) + 90; + (C = new mu(u, r, c, h, p, i.vertical, f, y, m, t)), + o && (P = new mu(u, r, c, h, p, o, x, v, m, t)); + } + if (a) { + const n = l.layout.get('icon-rotate').evaluate(_, {}), + i = 'none' !== l.layout.get('icon-text-fit'), + s = hu(a, n, k, i), + f = o ? hu(o, n, k, i) : void 0; + (B = new mu(u, r, c, h, p, a, x, v, !1, n)), (V = 4 * s.length); + const y = e.iconSizeData; + let m = null; + 'source' === y.kind + ? ((m = [tu * l.layout.get('icon-size').evaluate(_, {})]), + m[0] > Iu && + d( + `${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`, + )) + : 'composite' === y.kind && + ((m = [ + tu * A.compositeIconSizes[0].evaluate(_, {}, S), + tu * A.compositeIconSizes[1].evaluate(_, {}, S), + ]), + (m[0] > Iu || m[1] > Iu) && + d( + `${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`, + )), + e.addSymbols( + e.icon, + s, + m, + w, + b, + _, + t.WritingMode.none, + r, + M.lineStartIndex, + M.lineLength, + -1, + S, + ), + (L = e.icon.placedSymbolArray.length - 1), + f && + ((E = 4 * f.length), + e.addSymbols( + e.icon, + f, + m, + w, + b, + _, + t.WritingMode.vertical, + r, + M.lineStartIndex, + M.lineLength, + -1, + S, + ), + (D = e.icon.placedSymbolArray.length - 1)); + } + const q = Object.keys(i.horizontal); + for (const n of q) { + const a = i.horizontal[n]; + if (!z) { + R = xa.exports(a.text); + const t = l.layout.get('text-rotate').evaluate(_, {}, S); + z = new mu(u, r, c, h, p, a, f, y, m, t); + } + const o = 1 === a.positionedLines.length; + if ( + ((F += Mu( + e, + r, + a, + s, + l, + m, + _, + g, + M, + i.vertical + ? t.WritingMode.horizontal + : t.WritingMode.horizontalOnly, + o ? q : [n], + $, + L, + A, + S, + )), + o) + ) + break; + } + i.vertical && + (T += Mu( + e, + r, + i.vertical, + s, + l, + m, + _, + g, + M, + t.WritingMode.vertical, + ['vertical'], + $, + D, + A, + S, + )); + const j = z ? z.boxStartIndex : e.collisionBoxArray.length, + N = z ? z.boxEndIndex : e.collisionBoxArray.length, + Z = C ? C.boxStartIndex : e.collisionBoxArray.length, + K = C ? C.boxEndIndex : e.collisionBoxArray.length, + G = B ? B.boxStartIndex : e.collisionBoxArray.length, + J = B ? B.boxEndIndex : e.collisionBoxArray.length, + X = P ? P.boxStartIndex : e.collisionBoxArray.length, + Y = P ? P.boxEndIndex : e.collisionBoxArray.length; + let H = -1; + const W = (t, e) => + t && t.circleDiameter ? Math.max(t.circleDiameter, e) : e; + (H = W(z, H)), (H = W(C, H)), (H = W(B, H)), (H = W(P, H)); + const Q = H > -1 ? 1 : 0; + Q && (H *= I / ll), + e.glyphOffsetArray.length >= Du.MAX_GLYPHS && + d( + 'Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907', + ), + void 0 !== _.sortKey && + e.addToSortKeyRanges(e.symbolInstances.length, _.sortKey), + e.symbolInstances.emplaceBack( + r.x, + r.y, + $.right >= 0 ? $.right : -1, + $.center >= 0 ? $.center : -1, + $.left >= 0 ? $.left : -1, + $.vertical || -1, + L, + D, + R, + j, + N, + Z, + K, + G, + J, + X, + Y, + c, + F, + T, + V, + E, + Q, + 0, + f, + O, + U, + H, + ); + })( + e, + p, + l, + n, + i, + a, + C, + e.layers[0], + e.collisionBoxArray, + r.index, + r.sourceLayerIndex, + e.index, + x, + [_, _, _, _], + S, + u, + b, + A, + I, + y, + r, + s, + c, + h, + o, + ); + }; + if ('line' === M) + for (const t of cu(r.geometry, 0, 0, qa, qa)) { + const r = lu(t, w, k, n.vertical || m, i, 24, v, e.overscaling, qa); + for (const n of r) { + const r = m; + (r && Bu(e, r.text, z, n)) || P(t, n); + } + } + else if ('line-center' === M) { + for (const t of r.geometry) + if (t.length > 1) { + const e = ou(t, k, n.vertical || m, i, 24, v); + e && P(t, e); + } + } else if ('Polygon' === r.type) + for (const t of ho(r.geometry, 0)) { + const e = vu(t, 16); + P(t[0], new ru(e.x, e.y, 0)); + } + else if ('LineString' === r.type) + for (const t of r.geometry) P(t, new ru(t[0].x, t[0].y, 0)); + else if ('Point' === r.type) + for (const t of r.geometry) + for (const e of t) P([e], new ru(e.x, e.y, 0)); + } + const Iu = 32640; + function Mu(t, e, r, n, i, a, s, o, l, u, c, h, p, f, y) { + const m = (function (t, e, r, n, i, a, s, o) { + const l = + (n.layout.get('text-rotate').evaluate(a, {}) * Math.PI) / 180, + u = []; + for (const t of e.positionedLines) + for (const n of t.positionedGlyphs) { + if (!n.rect) continue; + const a = n.rect || {}; + let c = 4, + h = !0, + p = 1, + f = 0; + const d = (i || o) && n.vertical, + y = (n.metrics.advance * n.scale) / 2; + if (o && e.verticalizable) { + const e = (n.scale - 1) * ll, + r = (ll - n.metrics.width * n.scale) / 2; + f = t.lineOffset / 2 - (n.imageName ? -r : e); + } + if (n.imageName) { + const t = s[n.imageName]; + (h = t.sdf), (p = t.pixelRatio), (c = 1 / p); + } + const m = i ? [n.x + y, n.y] : [0, 0]; + let g = i ? [0, 0] : [n.x + y + r[0], n.y + r[1] - f], + x = [0, 0]; + d && ((x = g), (g = [0, 0])); + const v = (n.metrics.left - c) * n.scale - y + g[0], + b = (-n.metrics.top - c) * n.scale + g[1], + w = v + (a.w * n.scale) / p, + _ = b + (a.h * n.scale) / p, + A = new S(v, b), + k = new S(w, b), + I = new S(v, _), + M = new S(w, _); + if (d) { + const t = new S(-y, y - $l), + e = -Math.PI / 2, + r = 12 - y, + i = new S(22 - r, -(n.imageName ? r : 0)), + a = new S(...x); + A._rotateAround(e, t)._add(i)._add(a), + k._rotateAround(e, t)._add(i)._add(a), + I._rotateAround(e, t)._add(i)._add(a), + M._rotateAround(e, t)._add(i)._add(a); + } + if (l) { + const t = Math.sin(l), + e = Math.cos(l), + r = [e, -t, t, e]; + A._matMult(r), k._matMult(r), I._matMult(r), M._matMult(r); + } + const z = new S(0, 0), + B = new S(0, 0); + u.push({ + tl: A, + tr: k, + bl: I, + br: M, + tex: a, + writingMode: e.writingMode, + glyphOffset: m, + sectionIndex: n.sectionIndex, + isSDF: h, + pixelOffsetTL: z, + pixelOffsetBR: B, + minFontScaleX: 0, + minFontScaleY: 0, + }); + } + return u; + })(0, r, o, i, a, s, n, t.allowVerticalPlacement), + g = t.textSizeData; + let x = null; + 'source' === g.kind + ? ((x = [tu * i.layout.get('text-size').evaluate(s, {})]), + x[0] > Iu && + d( + `${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`, + )) + : 'composite' === g.kind && + ((x = [ + tu * f.compositeTextSizes[0].evaluate(s, {}, y), + tu * f.compositeTextSizes[1].evaluate(s, {}, y), + ]), + (x[0] > Iu || x[1] > Iu) && + d( + `${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`, + )), + t.addSymbols( + t.text, + m, + x, + o, + a, + s, + u, + e, + l.lineStartIndex, + l.lineLength, + p, + y, + ); + for (const e of c) h[e] = t.text.placedSymbolArray.length - 1; + return 4 * m.length; + } + function zu(t) { + for (const e in t) return t[e]; + return null; + } + function Bu(t, e, r, n) { + const i = t.compareText; + if (e in i) { + const t = i[e]; + for (let e = t.length - 1; e >= 0; e--) if (n.dist(t[e]) < r) return !0; + } else i[e] = []; + return i[e].push(n), !1; + } + const Cu = _o.VectorTileFeature.types, + Pu = [ + { name: 'a_fade_opacity', components: 1, type: 'Uint8', offset: 0 }, + ]; + function Vu(t, e, r, n, i, a, s, o, l, u, c, h, p) { + const f = o ? Math.min(Iu, Math.round(o[0])) : 0, + d = o ? Math.min(Iu, Math.round(o[1])) : 0; + t.emplaceBack( + e, + r, + Math.round(32 * n), + Math.round(32 * i), + a, + s, + (f << 1) + (l ? 1 : 0), + d, + 16 * u, + 16 * c, + 256 * h, + 256 * p, + ); + } + function Eu(t, e, r) { + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r), + t.emplaceBack(e.x, e.y, r); + } + function Fu(t) { + for (const e of t.sections) if (On(e.text)) return !0; + return !1; + } + class Tu { + constructor(t) { + (this.layoutVertexArray = new sa()), + (this.indexArray = new ha()), + (this.programConfigurations = t), + (this.segments = new ya()), + (this.dynamicLayoutVertexArray = new oa()), + (this.opacityVertexArray = new la()), + (this.placedSymbolArray = new Ki()); + } + isEmpty() { + return ( + 0 === this.layoutVertexArray.length && + 0 === this.indexArray.length && + 0 === this.dynamicLayoutVertexArray.length && + 0 === this.opacityVertexArray.length + ); + } + upload(t, e, r, n) { + this.isEmpty() || + (r && + ((this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + el.members, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray, e)), + (this.dynamicLayoutVertexBuffer = t.createVertexBuffer( + this.dynamicLayoutVertexArray, + rl.members, + !0, + )), + (this.opacityVertexBuffer = t.createVertexBuffer( + this.opacityVertexArray, + Pu, + !0, + )), + (this.opacityVertexBuffer.itemSize = 1)), + (r || n) && this.programConfigurations.upload(t)); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.programConfigurations.destroy(), + this.segments.destroy(), + this.dynamicLayoutVertexBuffer.destroy(), + this.opacityVertexBuffer.destroy()); + } + } + Mn('SymbolBuffers', Tu); + class Lu { + constructor(t, e, r) { + (this.layoutVertexArray = new t()), + (this.layoutAttributes = e), + (this.indexArray = new r()), + (this.segments = new ya()), + (this.collisionVertexArray = new ca()); + } + upload(t) { + (this.layoutVertexBuffer = t.createVertexBuffer( + this.layoutVertexArray, + this.layoutAttributes, + )), + (this.indexBuffer = t.createIndexBuffer(this.indexArray)), + (this.collisionVertexBuffer = t.createVertexBuffer( + this.collisionVertexArray, + nl.members, + !0, + )); + } + destroy() { + this.layoutVertexBuffer && + (this.layoutVertexBuffer.destroy(), + this.indexBuffer.destroy(), + this.segments.destroy(), + this.collisionVertexBuffer.destroy()); + } + } + Mn('CollisionBuffers', Lu); + class Du { + constructor(e) { + (this.collisionBoxArray = e.collisionBoxArray), + (this.zoom = e.zoom), + (this.overscaling = e.overscaling), + (this.layers = e.layers), + (this.layerIds = this.layers.map((t) => t.id)), + (this.index = e.index), + (this.pixelRatio = e.pixelRatio), + (this.sourceLayerIndex = e.sourceLayerIndex), + (this.hasPattern = !1), + (this.hasRTLText = !1), + (this.sortKeyRanges = []), + (this.collisionCircleArray = []), + (this.placementInvProjMatrix = ds([])), + (this.placementViewportMatrix = ds([])); + const r = this.layers[0]._unevaluatedLayout._values; + (this.textSizeData = eu(this.zoom, r['text-size'])), + (this.iconSizeData = eu(this.zoom, r['icon-size'])); + const n = this.layers[0].layout, + i = n.get('symbol-sort-key'), + a = n.get('symbol-z-order'); + (this.canOverlap = + 'never' !== qu(n, 'text-overlap', 'text-allow-overlap') || + 'never' !== qu(n, 'icon-overlap', 'icon-allow-overlap') || + n.get('text-ignore-placement') || + n.get('icon-ignore-placement')), + (this.sortFeaturesByKey = 'viewport-y' !== a && !i.isConstant()), + (this.sortFeaturesByY = + ('viewport-y' === a || ('auto' === a && !this.sortFeaturesByKey)) && + this.canOverlap), + 'point' === n.get('symbol-placement') && + (this.writingModes = n + .get('text-writing-mode') + .map((e) => t.WritingMode[e])), + (this.stateDependentLayerIds = this.layers + .filter((t) => t.isStateDependent()) + .map((t) => t.id)), + (this.sourceID = e.sourceID); + } + createArrays() { + (this.text = new Tu( + new Ra(this.layers, this.zoom, (t) => /^text/.test(t)), + )), + (this.icon = new Tu( + new Ra(this.layers, this.zoom, (t) => /^icon/.test(t)), + )), + (this.glyphOffsetArray = new Xi()), + (this.lineVertexArray = new Yi()), + (this.symbolInstances = new Ji()); + } + calculateGlyphDependencies(t, e, r, n, i) { + for (let a = 0; a < t.length; a++) + if (((e[t.charCodeAt(a)] = !0), (r || n) && i)) { + const r = ol[t.charAt(a)]; + r && (e[r.charCodeAt(0)] = !0); + } + } + populate(e, r, n) { + const i = this.layers[0], + a = i.layout, + s = a.get('text-font'), + o = a.get('text-field'), + l = a.get('icon-image'), + u = + ('constant' !== o.value.kind || + (o.value.value instanceof Dt && !o.value.value.isEmpty()) || + o.value.value.toString().length > 0) && + ('constant' !== s.value.kind || s.value.value.length > 0), + c = + 'constant' !== l.value.kind || + !!l.value.value || + Object.keys(l.parameters).length > 0, + h = a.get('symbol-sort-key'); + if (((this.features = []), !u && !c)) return; + const p = r.iconDependencies, + f = r.glyphDependencies, + d = r.availableImages, + y = new Qn(this.zoom); + for (const { feature: r, id: o, index: l, sourceLayerIndex: m } of e) { + const e = i._featureFilter.needGeometry, + g = Ka(r, e); + if (!i._featureFilter.filter(y, g, n)) continue; + let x, v; + if ((e || (g.geometry = Za(r)), u)) { + const t = i.getValueAndResolveTokens('text-field', g, n, d), + e = Dt.factory(t); + Fu(e) && (this.hasRTLText = !0), + (!this.hasRTLText || + 'unavailable' === Yn() || + (this.hasRTLText && Wn.isParsed())) && + (x = sl(e, i, g)); + } + if (c) { + const t = i.getValueAndResolveTokens('icon-image', g, n, d); + v = t instanceof Rt ? t : Rt.fromString(t); + } + if (!x && !v) continue; + const b = this.sortFeaturesByKey ? h.evaluate(g, {}, n) : void 0; + if ( + (this.features.push({ + id: o, + text: x, + icon: v, + index: l, + sourceLayerIndex: m, + geometry: g.geometry, + properties: r.properties, + type: Cu[r.type], + sortKey: b, + }), + v && (p[v.name] = !0), + x) + ) { + const e = s.evaluate(g, {}, n).join(','), + r = + 'viewport' !== a.get('text-rotation-alignment') && + 'point' !== a.get('symbol-placement'); + this.allowVerticalPlacement = + this.writingModes && + this.writingModes.indexOf(t.WritingMode.vertical) >= 0; + for (const t of x.sections) + if (t.image) p[t.image.name] = !0; + else { + const n = En(x.toString()), + i = t.fontStack || e, + a = (f[i] = f[i] || {}); + this.calculateGlyphDependencies( + t.text, + a, + r, + this.allowVerticalPlacement, + n, + ); + } + } + } + 'line' === a.get('symbol-placement') && + (this.features = (function (t) { + const e = {}, + r = {}, + n = []; + let i = 0; + function a(e) { + n.push(t[e]), i++; + } + function s(t, e, i) { + const a = r[t]; + return ( + delete r[t], + (r[e] = a), + n[a].geometry[0].pop(), + (n[a].geometry[0] = n[a].geometry[0].concat(i[0])), + a + ); + } + function o(t, r, i) { + const a = e[r]; + return ( + delete e[r], + (e[t] = a), + n[a].geometry[0].shift(), + (n[a].geometry[0] = i[0].concat(n[a].geometry[0])), + a + ); + } + function l(t, e, r) { + const n = r ? e[0][e[0].length - 1] : e[0][0]; + return `${t}:${n.x}:${n.y}`; + } + for (let u = 0; u < t.length; u++) { + const c = t[u], + h = c.geometry, + p = c.text ? c.text.toString() : null; + if (!p) { + a(u); + continue; + } + const f = l(p, h), + d = l(p, h, !0); + if (f in r && d in e && r[f] !== e[d]) { + const t = o(f, d, h), + i = s(f, d, n[t].geometry); + delete e[f], + delete r[d], + (r[l(p, n[i].geometry, !0)] = i), + (n[t].geometry = null); + } else + f in r + ? s(f, d, h) + : d in e + ? o(f, d, h) + : (a(u), (e[f] = i - 1), (r[d] = i - 1)); + } + return n.filter((t) => t.geometry); + })(this.features)), + this.sortFeaturesByKey && + this.features.sort((t, e) => t.sortKey - e.sortKey); + } + update(t, e, r) { + this.stateDependentLayers.length && + (this.text.programConfigurations.updatePaintArrays( + t, + e, + this.layers, + r, + ), + this.icon.programConfigurations.updatePaintArrays( + t, + e, + this.layers, + r, + )); + } + isEmpty() { + return 0 === this.symbolInstances.length && !this.hasRTLText; + } + uploadPending() { + return ( + !this.uploaded || + this.text.programConfigurations.needsUpload || + this.icon.programConfigurations.needsUpload + ); + } + upload(t) { + !this.uploaded && + this.hasDebugData() && + (this.textCollisionBox.upload(t), this.iconCollisionBox.upload(t)), + this.text.upload( + t, + this.sortFeaturesByY, + !this.uploaded, + this.text.programConfigurations.needsUpload, + ), + this.icon.upload( + t, + this.sortFeaturesByY, + !this.uploaded, + this.icon.programConfigurations.needsUpload, + ), + (this.uploaded = !0); + } + destroyDebugData() { + this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(); + } + destroy() { + this.text.destroy(), + this.icon.destroy(), + this.hasDebugData() && this.destroyDebugData(); + } + addToLineVertexArray(t, e) { + const r = this.lineVertexArray.length; + if (void 0 !== t.segment) { + let r = t.dist(e[t.segment + 1]), + n = t.dist(e[t.segment]); + const i = {}; + for (let n = t.segment + 1; n < e.length; n++) + (i[n] = { x: e[n].x, y: e[n].y, tileUnitDistanceFromAnchor: r }), + n < e.length - 1 && (r += e[n + 1].dist(e[n])); + for (let r = t.segment || 0; r >= 0; r--) + (i[r] = { x: e[r].x, y: e[r].y, tileUnitDistanceFromAnchor: n }), + r > 0 && (n += e[r - 1].dist(e[r])); + for (let t = 0; t < e.length; t++) { + const e = i[t]; + this.lineVertexArray.emplaceBack( + e.x, + e.y, + e.tileUnitDistanceFromAnchor, + ); + } + } + return { + lineStartIndex: r, + lineLength: this.lineVertexArray.length - r, + }; + } + addSymbols(e, r, n, i, a, s, o, l, u, c, h, p) { + const f = e.indexArray, + d = e.layoutVertexArray, + y = e.segments.prepareSegment( + 4 * r.length, + d, + f, + this.canOverlap ? s.sortKey : void 0, + ), + m = this.glyphOffsetArray.length, + g = y.vertexLength, + x = + this.allowVerticalPlacement && o === t.WritingMode.vertical + ? Math.PI / 2 + : 0, + v = s.text && s.text.sections; + for (let t = 0; t < r.length; t++) { + const { + tl: i, + tr: a, + bl: o, + br: u, + tex: c, + pixelOffsetTL: h, + pixelOffsetBR: m, + minFontScaleX: g, + minFontScaleY: b, + glyphOffset: w, + isSDF: _, + sectionIndex: A, + } = r[t], + k = y.vertexLength, + S = w[1]; + Vu(d, l.x, l.y, i.x, S + i.y, c.x, c.y, n, _, h.x, h.y, g, b), + Vu(d, l.x, l.y, a.x, S + a.y, c.x + c.w, c.y, n, _, m.x, h.y, g, b), + Vu(d, l.x, l.y, o.x, S + o.y, c.x, c.y + c.h, n, _, h.x, m.y, g, b), + Vu( + d, + l.x, + l.y, + u.x, + S + u.y, + c.x + c.w, + c.y + c.h, + n, + _, + m.x, + m.y, + g, + b, + ), + Eu(e.dynamicLayoutVertexArray, l, x), + f.emplaceBack(k, k + 1, k + 2), + f.emplaceBack(k + 1, k + 2, k + 3), + (y.vertexLength += 4), + (y.primitiveLength += 2), + this.glyphOffsetArray.emplaceBack(w[0]), + (t !== r.length - 1 && A === r[t + 1].sectionIndex) || + e.programConfigurations.populatePaintArrays( + d.length, + s, + s.index, + {}, + p, + v && v[A], + ); + } + e.placedSymbolArray.emplaceBack( + l.x, + l.y, + m, + this.glyphOffsetArray.length - m, + g, + u, + c, + l.segment, + n ? n[0] : 0, + n ? n[1] : 0, + i[0], + i[1], + o, + 0, + !1, + 0, + h, + ); + } + _addCollisionDebugVertex(t, e, r, n, i, a) { + return ( + e.emplaceBack(0, 0), + t.emplaceBack(r.x, r.y, n, i, Math.round(a.x), Math.round(a.y)) + ); + } + addCollisionDebugVertices(t, e, r, n, i, a, s) { + const o = i.segments.prepareSegment( + 4, + i.layoutVertexArray, + i.indexArray, + ), + l = o.vertexLength, + u = i.layoutVertexArray, + c = i.collisionVertexArray, + h = s.anchorX, + p = s.anchorY; + this._addCollisionDebugVertex(u, c, a, h, p, new S(t, e)), + this._addCollisionDebugVertex(u, c, a, h, p, new S(r, e)), + this._addCollisionDebugVertex(u, c, a, h, p, new S(r, n)), + this._addCollisionDebugVertex(u, c, a, h, p, new S(t, n)), + (o.vertexLength += 4); + const 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), + (o.primitiveLength += 4); + } + addDebugCollisionBoxes(t, e, r, n) { + for (let i = t; i < e; i++) { + const t = this.collisionBoxArray.get(i); + this.addCollisionDebugVertices( + t.x1, + t.y1, + t.x2, + t.y2, + n ? this.textCollisionBox : this.iconCollisionBox, + t.anchorPoint, + r, + ); + } + } + generateCollisionDebugBuffers() { + this.hasDebugData() && this.destroyDebugData(), + (this.textCollisionBox = new Lu(ua, il.members, pa)), + (this.iconCollisionBox = new Lu(ua, il.members, pa)); + for (let t = 0; t < this.symbolInstances.length; t++) { + const e = this.symbolInstances.get(t); + this.addDebugCollisionBoxes( + e.textBoxStartIndex, + e.textBoxEndIndex, + e, + !0, + ), + this.addDebugCollisionBoxes( + e.verticalTextBoxStartIndex, + e.verticalTextBoxEndIndex, + e, + !0, + ), + this.addDebugCollisionBoxes( + e.iconBoxStartIndex, + e.iconBoxEndIndex, + e, + !1, + ), + this.addDebugCollisionBoxes( + e.verticalIconBoxStartIndex, + e.verticalIconBoxEndIndex, + e, + !1, + ); + } + } + _deserializeCollisionBoxesForSymbol(t, e, r, n, i, a, s, o, l) { + const u = {}; + for (let n = e; n < r; n++) { + const e = t.get(n); + (u.textBox = { + x1: e.x1, + y1: e.y1, + x2: e.x2, + y2: e.y2, + anchorPointX: e.anchorPointX, + anchorPointY: e.anchorPointY, + }), + (u.textFeatureIndex = e.featureIndex); + break; + } + for (let e = n; e < i; e++) { + const r = t.get(e); + (u.verticalTextBox = { + x1: r.x1, + y1: r.y1, + x2: r.x2, + y2: r.y2, + anchorPointX: r.anchorPointX, + anchorPointY: r.anchorPointY, + }), + (u.verticalTextFeatureIndex = r.featureIndex); + break; + } + for (let e = a; e < s; e++) { + const r = t.get(e); + (u.iconBox = { + x1: r.x1, + y1: r.y1, + x2: r.x2, + y2: r.y2, + anchorPointX: r.anchorPointX, + anchorPointY: r.anchorPointY, + }), + (u.iconFeatureIndex = r.featureIndex); + break; + } + for (let e = o; e < l; e++) { + const r = t.get(e); + (u.verticalIconBox = { + x1: r.x1, + y1: r.y1, + x2: r.x2, + y2: r.y2, + anchorPointX: r.anchorPointX, + anchorPointY: r.anchorPointY, + }), + (u.verticalIconFeatureIndex = r.featureIndex); + break; + } + return u; + } + deserializeCollisionBoxes(t) { + this.collisionArrays = []; + for (let e = 0; e < this.symbolInstances.length; e++) { + const r = this.symbolInstances.get(e); + this.collisionArrays.push( + this._deserializeCollisionBoxesForSymbol( + t, + r.textBoxStartIndex, + r.textBoxEndIndex, + r.verticalTextBoxStartIndex, + r.verticalTextBoxEndIndex, + r.iconBoxStartIndex, + r.iconBoxEndIndex, + r.verticalIconBoxStartIndex, + r.verticalIconBoxEndIndex, + ), + ); + } + } + hasTextData() { + return this.text.segments.get().length > 0; + } + hasIconData() { + return this.icon.segments.get().length > 0; + } + hasDebugData() { + return this.textCollisionBox && this.iconCollisionBox; + } + hasTextCollisionBoxData() { + return ( + this.hasDebugData() && this.textCollisionBox.segments.get().length > 0 + ); + } + hasIconCollisionBoxData() { + return ( + this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0 + ); + } + addIndicesForPlacedSymbol(t, e) { + const r = t.placedSymbolArray.get(e), + n = r.vertexStartIndex + 4 * r.numGlyphs; + for (let e = r.vertexStartIndex; e < n; e += 4) + t.indexArray.emplaceBack(e, e + 1, e + 2), + t.indexArray.emplaceBack(e + 1, e + 2, e + 3); + } + getSortedSymbolIndexes(t) { + if (this.sortedAngle === t && void 0 !== this.symbolInstanceIndexes) + return this.symbolInstanceIndexes; + const e = Math.sin(t), + r = Math.cos(t), + n = [], + i = [], + a = []; + for (let t = 0; t < this.symbolInstances.length; ++t) { + a.push(t); + const s = this.symbolInstances.get(t); + n.push(0 | Math.round(e * s.anchorX + r * s.anchorY)), + i.push(s.featureIndex); + } + return a.sort((t, e) => n[t] - n[e] || i[e] - i[t]), a; + } + addToSortKeyRanges(t, e) { + const r = this.sortKeyRanges[this.sortKeyRanges.length - 1]; + r && r.sortKey === e + ? (r.symbolInstanceEnd = t + 1) + : this.sortKeyRanges.push({ + sortKey: e, + symbolInstanceStart: t, + symbolInstanceEnd: t + 1, + }); + } + sortFeatures(t) { + if ( + this.sortFeaturesByY && + this.sortedAngle !== t && + !( + this.text.segments.get().length > 1 || + this.icon.segments.get().length > 1 + ) + ) { + (this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t)), + (this.sortedAngle = t), + this.text.indexArray.clear(), + this.icon.indexArray.clear(), + (this.featureSortOrder = []); + for (const t of this.symbolInstanceIndexes) { + const e = this.symbolInstances.get(t); + this.featureSortOrder.push(e.featureIndex), + [ + e.rightJustifiedTextSymbolIndex, + e.centerJustifiedTextSymbolIndex, + e.leftJustifiedTextSymbolIndex, + ].forEach((t, e, r) => { + t >= 0 && + r.indexOf(t) === e && + this.addIndicesForPlacedSymbol(this.text, t); + }), + e.verticalPlacedTextSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.text, + e.verticalPlacedTextSymbolIndex, + ), + e.placedIconSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.icon, + e.placedIconSymbolIndex, + ), + e.verticalPlacedIconSymbolIndex >= 0 && + this.addIndicesForPlacedSymbol( + this.icon, + e.verticalPlacedIconSymbolIndex, + ); + } + this.text.indexBuffer && + this.text.indexBuffer.updateData(this.text.indexArray), + this.icon.indexBuffer && + this.icon.indexBuffer.updateData(this.icon.indexArray); + } + } + } + Mn('SymbolBucket', Du, { + omit: ['layers', 'collisionBoxArray', 'features', 'compareText'], + }), + (Du.MAX_GLYPHS = 65535), + (Du.addDynamicAttributes = Eu); + const $u = new fi({ + 'symbol-placement': new li(nt.layout_symbol['symbol-placement']), + 'symbol-spacing': new li(nt.layout_symbol['symbol-spacing']), + 'symbol-avoid-edges': new li(nt.layout_symbol['symbol-avoid-edges']), + 'symbol-sort-key': new ui(nt.layout_symbol['symbol-sort-key']), + 'symbol-z-order': new li(nt.layout_symbol['symbol-z-order']), + 'icon-allow-overlap': new li(nt.layout_symbol['icon-allow-overlap']), + 'icon-overlap': new li(nt.layout_symbol['icon-overlap']), + 'icon-ignore-placement': new li( + nt.layout_symbol['icon-ignore-placement'], + ), + 'icon-optional': new li(nt.layout_symbol['icon-optional']), + 'icon-rotation-alignment': new li( + nt.layout_symbol['icon-rotation-alignment'], + ), + 'icon-size': new ui(nt.layout_symbol['icon-size']), + 'icon-text-fit': new li(nt.layout_symbol['icon-text-fit']), + 'icon-text-fit-padding': new li( + nt.layout_symbol['icon-text-fit-padding'], + ), + 'icon-image': new ui(nt.layout_symbol['icon-image']), + 'icon-rotate': new ui(nt.layout_symbol['icon-rotate']), + 'icon-padding': new ui(nt.layout_symbol['icon-padding']), + 'icon-keep-upright': new li(nt.layout_symbol['icon-keep-upright']), + 'icon-offset': new ui(nt.layout_symbol['icon-offset']), + 'icon-anchor': new ui(nt.layout_symbol['icon-anchor']), + 'icon-pitch-alignment': new li(nt.layout_symbol['icon-pitch-alignment']), + 'text-pitch-alignment': new li(nt.layout_symbol['text-pitch-alignment']), + 'text-rotation-alignment': new li( + nt.layout_symbol['text-rotation-alignment'], + ), + 'text-field': new ui(nt.layout_symbol['text-field']), + 'text-font': new ui(nt.layout_symbol['text-font']), + 'text-size': new ui(nt.layout_symbol['text-size']), + 'text-max-width': new ui(nt.layout_symbol['text-max-width']), + 'text-line-height': new li(nt.layout_symbol['text-line-height']), + 'text-letter-spacing': new ui(nt.layout_symbol['text-letter-spacing']), + 'text-justify': new ui(nt.layout_symbol['text-justify']), + 'text-radial-offset': new ui(nt.layout_symbol['text-radial-offset']), + 'text-variable-anchor': new li(nt.layout_symbol['text-variable-anchor']), + 'text-anchor': new ui(nt.layout_symbol['text-anchor']), + 'text-max-angle': new li(nt.layout_symbol['text-max-angle']), + 'text-writing-mode': new li(nt.layout_symbol['text-writing-mode']), + 'text-rotate': new ui(nt.layout_symbol['text-rotate']), + 'text-padding': new li(nt.layout_symbol['text-padding']), + 'text-keep-upright': new li(nt.layout_symbol['text-keep-upright']), + 'text-transform': new ui(nt.layout_symbol['text-transform']), + 'text-offset': new ui(nt.layout_symbol['text-offset']), + 'text-allow-overlap': new li(nt.layout_symbol['text-allow-overlap']), + 'text-overlap': new li(nt.layout_symbol['text-overlap']), + 'text-ignore-placement': new li( + nt.layout_symbol['text-ignore-placement'], + ), + 'text-optional': new li(nt.layout_symbol['text-optional']), + }); + var Ru = { + paint: new fi({ + 'icon-opacity': new ui(nt.paint_symbol['icon-opacity']), + 'icon-color': new ui(nt.paint_symbol['icon-color']), + 'icon-halo-color': new ui(nt.paint_symbol['icon-halo-color']), + 'icon-halo-width': new ui(nt.paint_symbol['icon-halo-width']), + 'icon-halo-blur': new ui(nt.paint_symbol['icon-halo-blur']), + 'icon-translate': new li(nt.paint_symbol['icon-translate']), + 'icon-translate-anchor': new li( + nt.paint_symbol['icon-translate-anchor'], + ), + 'text-opacity': new ui(nt.paint_symbol['text-opacity']), + 'text-color': new ui(nt.paint_symbol['text-color'], { + runtimeType: yt, + getOverride: (t) => t.textColor, + hasOverride: (t) => !!t.textColor, + }), + 'text-halo-color': new ui(nt.paint_symbol['text-halo-color']), + 'text-halo-width': new ui(nt.paint_symbol['text-halo-width']), + 'text-halo-blur': new ui(nt.paint_symbol['text-halo-blur']), + 'text-translate': new li(nt.paint_symbol['text-translate']), + 'text-translate-anchor': new li( + nt.paint_symbol['text-translate-anchor'], + ), + }), + layout: $u, + }; + class Ou { + constructor(t) { + if (void 0 === t.property.overrides) + throw new Error( + 'overrides must be provided to instantiate FormatSectionOverride class', + ); + (this.type = t.property.overrides + ? t.property.overrides.runtimeType + : ht), + (this.defaultValue = t); + } + evaluate(t) { + if (t.formattedSection) { + const e = this.defaultValue.property.overrides; + if (e && e.hasOverride(t.formattedSection)) + return e.getOverride(t.formattedSection); + } + return t.feature && t.featureState + ? this.defaultValue.evaluate(t.feature, t.featureState) + : this.defaultValue.property.specification.default; + } + eachChild(t) { + this.defaultValue.isConstant() || + t(this.defaultValue.value._styleExpression.expression); + } + outputDefined() { + return !1; + } + serialize() { + return null; + } + } + Mn('FormatSectionOverride', Ou, { omit: ['defaultValue'] }); + class Uu extends yi { + constructor(t) { + super(t, Ru); + } + recalculate(t, e) { + if ( + (super.recalculate(t, e), + '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'] = + 'map' === this.layout.get('text-rotation-alignment') + ? 'map' + : 'viewport'), + 'auto' === this.layout.get('icon-pitch-alignment') && + (this.layout._values['icon-pitch-alignment'] = this.layout.get( + 'icon-rotation-alignment', + )), + 'point' === this.layout.get('symbol-placement')) + ) { + const t = this.layout.get('text-writing-mode'); + if (t) { + const e = []; + for (const r of t) e.indexOf(r) < 0 && e.push(r); + this.layout._values['text-writing-mode'] = e; + } else this.layout._values['text-writing-mode'] = ['horizontal']; + } + this._setPaintOverrides(); + } + getValueAndResolveTokens(t, e, r, n) { + const i = this.layout.get(t).evaluate(e, {}, r, n), + a = this._unevaluatedLayout._values[t]; + return a.isDataDriven() || Er(a.value) || !i + ? i + : (function (t, e) { + return e.replace(/{([^{}]+)}/g, (e, r) => + r in t ? String(t[r]) : '', + ); + })(e.properties, i); + } + createBucket(t) { + return new Du(t); + } + queryRadius() { + return 0; + } + queryIntersectsFeature() { + throw new Error('Should take a different path in FeatureIndex'); + } + _setPaintOverrides() { + for (const t of Ru.paint.overridableProperties) { + if (!Uu.hasPaintOverride(this.layout, t)) continue; + const e = this.paint.get(t), + r = new Ou(e), + n = new Vr(r, e.property.specification); + let i = null; + (i = + 'constant' === e.value.kind || 'source' === e.value.kind + ? new Tr('source', n) + : new Lr('composite', n, e.value.zoomStops)), + (this.paint._values[t] = new si(e.property, i, e.parameters)); + } + } + _handleOverridablePaintPropertyUpdate(t, e, r) { + return ( + !(!this.layout || e.isDataDriven() || r.isDataDriven()) && + Uu.hasPaintOverride(this.layout, t) + ); + } + static hasPaintOverride(t, e) { + const r = t.get('text-field'), + n = Ru.paint.properties[e]; + let i = !1; + const a = (t) => { + for (const e of t) + if (n.overrides && n.overrides.hasOverride(e)) return void (i = !0); + }; + if ('constant' === r.value.kind && r.value.value instanceof Dt) + a(r.value.value.sections); + else if ('source' === r.value.kind) { + const t = (e) => { + i || + (e instanceof Nt && qt(e.value) === vt + ? a(e.value.sections) + : e instanceof cr + ? a(e.sections) + : e.eachChild(t)); + }, + e = r.value; + e._styleExpression && t(e._styleExpression.expression); + } + return i; + } + } + function qu(t, e, r) { + let n = 'never'; + const i = t.get(e); + return i ? (n = i) : t.get(r) && (n = 'always'), n; + } + var ju = { + paint: new fi({ + 'background-color': new li(nt.paint_background['background-color']), + 'background-pattern': new hi( + nt.paint_background['background-pattern'], + ), + 'background-opacity': new li( + nt.paint_background['background-opacity'], + ), + }), + }, + Nu = { + paint: new fi({ + 'raster-opacity': new li(nt.paint_raster['raster-opacity']), + 'raster-hue-rotate': new li(nt.paint_raster['raster-hue-rotate']), + 'raster-brightness-min': new li( + nt.paint_raster['raster-brightness-min'], + ), + 'raster-brightness-max': new li( + nt.paint_raster['raster-brightness-max'], + ), + 'raster-saturation': new li(nt.paint_raster['raster-saturation']), + 'raster-contrast': new li(nt.paint_raster['raster-contrast']), + 'raster-resampling': new li(nt.paint_raster['raster-resampling']), + 'raster-fade-duration': new li( + nt.paint_raster['raster-fade-duration'], + ), + }), + }; + class Zu extends yi { + constructor(t) { + super(t, {}), + (this.onAdd = (t) => { + this.implementation.onAdd && + this.implementation.onAdd(t, t.painter.context.gl); + }), + (this.onRemove = (t) => { + this.implementation.onRemove && + this.implementation.onRemove(t, t.painter.context.gl); + }), + (this.implementation = t); + } + is3D() { + return '3d' === this.implementation.renderingMode; + } + hasOffscreenPass() { + return void 0 !== this.implementation.prerender; + } + recalculate() {} + updateTransitions() {} + hasTransition() { + return !1; + } + serialize() { + throw new Error('Custom layers cannot be serialized'); + } + } + const Ku = { + circle: class extends yi { + constructor(t) { + super(t, cs); + } + createBucket(t) { + return new Ja(t); + } + queryRadius(t) { + const e = t; + return ( + ss('circle-radius', this, e) + + ss('circle-stroke-width', this, e) + + os(this.paint.get('circle-translate')) + ); + } + queryIntersectsFeature(t, e, r, n, i, a, s, o) { + const l = ls( + t, + this.paint.get('circle-translate'), + this.paint.get('circle-translate-anchor'), + a.angle, + s, + ), + u = + this.paint.get('circle-radius').evaluate(e, r) + + this.paint.get('circle-stroke-width').evaluate(e, r), + c = 'map' === this.paint.get('circle-pitch-alignment'), + h = c + ? l + : (function (t, e) { + return t.map((t) => _s(t, e)); + })(l, o), + p = c ? u * s : u; + for (const t of n) + for (const e of t) { + const t = c ? e : _s(e, o); + let r = p; + const n = bs([], [e.x, e.y, 0, 1], o); + if ( + ('viewport' === this.paint.get('circle-pitch-scale') && + 'map' === this.paint.get('circle-pitch-alignment') + ? (r *= n[3] / a.cameraToCenterDistance) + : 'map' === this.paint.get('circle-pitch-scale') && + 'viewport' === this.paint.get('circle-pitch-alignment') && + (r *= a.cameraToCenterDistance / n[3]), + Ya(h, t, r)) + ) + return !0; + } + return !1; + } + }, + heatmap: class extends yi { + constructor(t) { + super(t, ks), this._updateColorRamp(); + } + createBucket(t) { + return new As(t); + } + _handleSpecialPaintPropertyUpdate(t) { + 'heatmap-color' === t && this._updateColorRamp(); + } + _updateColorRamp() { + (this.colorRamp = Cs({ + expression: + this._transitionablePaint._values['heatmap-color'].value + .expression, + evaluationKey: 'heatmapDensity', + image: this.colorRamp, + })), + (this.colorRampTexture = null); + } + resize() { + this.heatmapFbo && + (this.heatmapFbo.destroy(), (this.heatmapFbo = null)); + } + queryRadius() { + return 0; + } + queryIntersectsFeature() { + return !1; + } + hasOffscreenPass() { + return ( + 0 !== this.paint.get('heatmap-opacity') && + 'none' !== this.visibility + ); + } + }, + hillshade: class extends yi { + constructor(t) { + super(t, Ps); + } + hasOffscreenPass() { + return ( + 0 !== this.paint.get('hillshade-exaggeration') && + 'none' !== this.visibility + ); + } + }, + fill: class extends yi { + constructor(t) { + super(t, xo); + } + recalculate(t, e) { + super.recalculate(t, e); + const 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']); + } + createBucket(t) { + return new mo(t); + } + queryRadius() { + return os(this.paint.get('fill-translate')); + } + queryIntersectsFeature(t, e, r, n, i, a, s) { + return Ha( + ls( + t, + this.paint.get('fill-translate'), + this.paint.get('fill-translate-anchor'), + a.angle, + s, + ), + n, + ); + } + isTileClipped() { + return !0; + } + }, + 'fill-extrusion': class extends yi { + constructor(t) { + super(t, Oo); + } + createBucket(t) { + return new Do(t); + } + queryRadius() { + return os(this.paint.get('fill-extrusion-translate')); + } + is3D() { + return !0; + } + queryIntersectsFeature(t, e, r, n, i, a, s, o) { + const l = ls( + t, + this.paint.get('fill-extrusion-translate'), + this.paint.get('fill-extrusion-translate-anchor'), + a.angle, + s, + ), + u = this.paint.get('fill-extrusion-height').evaluate(e, r), + c = this.paint.get('fill-extrusion-base').evaluate(e, r), + h = (function (t, e, r, n) { + const i = []; + for (const r of t) { + const t = [r.x, r.y, 0, 1]; + bs(t, t, e), i.push(new S(t[0] / t[3], t[1] / t[3])); + } + return i; + })(l, o), + p = (function (t, e, r, n) { + const i = [], + a = [], + s = n[8] * e, + o = n[9] * e, + l = n[10] * e, + u = n[11] * e, + c = n[8] * r, + h = n[9] * r, + p = n[10] * r, + f = n[11] * r; + for (const e of t) { + const t = [], + r = []; + for (const i of e) { + const e = i.x, + a = i.y, + d = n[0] * e + n[4] * a + n[12], + y = n[1] * e + n[5] * a + n[13], + m = n[2] * e + n[6] * a + n[14], + g = n[3] * e + n[7] * a + n[15], + x = m + l, + v = g + u, + b = d + c, + w = y + h, + _ = m + p, + A = g + f, + k = new S((d + s) / v, (y + o) / v); + (k.z = x / v), t.push(k); + const I = new S(b / A, w / A); + (I.z = _ / A), r.push(I); + } + i.push(t), a.push(r); + } + return [i, a]; + })(n, c, u, o); + return (function (t, e, r) { + let n = 1 / 0; + Ha(r, e) && (n = qo(r, e[0])); + for (let i = 0; i < e.length; i++) { + const a = e[i], + s = t[i]; + for (let t = 0; t < a.length - 1; t++) { + const e = a[t], + i = [e, a[t + 1], s[t + 1], s[t], e]; + Xa(r, i) && (n = Math.min(n, qo(r, i))); + } + } + return n !== 1 / 0 && n; + })(p[0], p[1], h); + } + }, + line: class extends yi { + constructor(t) { + super(t, Wo), (this.gradientVersion = 0); + } + _handleSpecialPaintPropertyUpdate(t) { + 'line-gradient' === t && + ((this.stepInterpolant = + this._transitionablePaint._values['line-gradient'].value + .expression._styleExpression.expression instanceof ke), + (this.gradientVersion = + (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER)); + } + gradientExpression() { + return this._transitionablePaint._values['line-gradient'].value + .expression; + } + recalculate(t, e) { + super.recalculate(t, e), + (this.paint._values['line-floorwidth'] = Qo.possiblyEvaluate( + this._transitioningPaint._values['line-width'].value, + t, + )); + } + createBucket(t) { + return new Yo(t); + } + queryRadius(t) { + const e = t, + r = tl(ss('line-width', this, e), ss('line-gap-width', this, e)), + n = ss('line-offset', this, e); + return r / 2 + Math.abs(n) + os(this.paint.get('line-translate')); + } + queryIntersectsFeature(t, e, r, n, i, a, s) { + const o = ls( + t, + this.paint.get('line-translate'), + this.paint.get('line-translate-anchor'), + a.angle, + s, + ), + l = + (s / 2) * + tl( + this.paint.get('line-width').evaluate(e, r), + this.paint.get('line-gap-width').evaluate(e, r), + ), + u = this.paint.get('line-offset').evaluate(e, r); + return ( + u && + (n = (function (t, e) { + const r = []; + for (let n = 0; n < t.length; n++) { + const i = t[n], + a = []; + for (let t = 0; t < i.length; t++) { + const r = i[t - 1], + n = i[t], + s = i[t + 1], + o = 0 === t ? new S(0, 0) : n.sub(r)._unit()._perp(), + l = + t === i.length - 1 + ? new S(0, 0) + : s.sub(n)._unit()._perp(), + u = o._add(l)._unit(), + c = u.x * l.x + u.y * l.y; + 0 !== c && u._mult(1 / c), a.push(u._mult(e)._add(n)); + } + r.push(a); + } + return r; + })(n, u * s)), + (function (t, e, r) { + for (let n = 0; n < e.length; n++) { + const i = e[n]; + if (t.length >= 3) + for (let e = 0; e < i.length; e++) if (is(t, i[e])) return !0; + if (Wa(t, i, r)) return !0; + } + return !1; + })(o, n, l) + ); + } + isTileClipped() { + return !0; + } + }, + symbol: Uu, + background: class extends yi { + constructor(t) { + super(t, ju); + } + }, + raster: class extends yi { + constructor(t) { + super(t, Nu); + } + }, + }; + class Gu { + constructor(t) { + (this._callback = t), + (this._triggered = !1), + 'undefined' != typeof MessageChannel && + ((this._channel = new MessageChannel()), + (this._channel.port2.onmessage = () => { + (this._triggered = !1), this._callback(); + })); + } + trigger() { + this._triggered || + ((this._triggered = !0), + this._channel + ? this._channel.port1.postMessage(!0) + : setTimeout(() => { + (this._triggered = !1), this._callback(); + }, 0)); + } + remove() { + delete this._channel, (this._callback = () => {}); + } + } + const Ju = 6371008.8; + class Xu { + constructor(t, e) { + if (isNaN(t) || isNaN(e)) + throw new Error(`Invalid LngLat object: (${t}, ${e})`); + if (((this.lng = +t), (this.lat = +e), this.lat > 90 || this.lat < -90)) + throw new Error( + 'Invalid LngLat latitude value: must be between -90 and 90', + ); + } + wrap() { + return new Xu(s(this.lng, -180, 180), this.lat); + } + toArray() { + return [this.lng, this.lat]; + } + toString() { + return `LngLat(${this.lng}, ${this.lat})`; + } + distanceTo(t) { + const e = Math.PI / 180, + r = this.lat * e, + n = t.lat * e, + i = + Math.sin(r) * Math.sin(n) + + Math.cos(r) * Math.cos(n) * Math.cos((t.lng - this.lng) * e); + return Ju * Math.acos(Math.min(i, 1)); + } + toBounds(t = 0) { + const e = (360 * t) / 40075017, + r = e / Math.cos((Math.PI / 180) * this.lat); + return new Yu( + new Xu(this.lng - r, this.lat - e), + new Xu(this.lng + r, this.lat + e), + ); + } + static convert(t) { + if (t instanceof Xu) return t; + if (Array.isArray(t) && (2 === t.length || 3 === t.length)) + return new Xu(Number(t[0]), Number(t[1])); + if (!Array.isArray(t) && 'object' == typeof t && null !== t) + return new Xu(Number('lng' in t ? t.lng : t.lon), Number(t.lat)); + throw new Error( + '`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]', + ); + } + } + class Yu { + constructor(t, e) { + t && + (e + ? this.setSouthWest(t).setNorthEast(e) + : 4 === t.length + ? this.setSouthWest([t[0], t[1]]).setNorthEast([t[2], t[3]]) + : this.setSouthWest(t[0]).setNorthEast(t[1])); + } + setNorthEast(t) { + return ( + (this._ne = t instanceof Xu ? new Xu(t.lng, t.lat) : Xu.convert(t)), + this + ); + } + setSouthWest(t) { + return ( + (this._sw = t instanceof Xu ? new Xu(t.lng, t.lat) : Xu.convert(t)), + this + ); + } + extend(t) { + const e = this._sw, + r = this._ne; + let n, i; + if (t instanceof Xu) (n = t), (i = t); + else { + if (!(t instanceof Yu)) + return Array.isArray(t) + ? 4 === t.length || t.every(Array.isArray) + ? this.extend(Yu.convert(t)) + : this.extend(Xu.convert(t)) + : this; + if (((n = t._sw), (i = t._ne), !n || !i)) return this; + } + return ( + e || r + ? ((e.lng = Math.min(n.lng, e.lng)), + (e.lat = Math.min(n.lat, e.lat)), + (r.lng = Math.max(i.lng, r.lng)), + (r.lat = Math.max(i.lat, r.lat))) + : ((this._sw = new Xu(n.lng, n.lat)), + (this._ne = new Xu(i.lng, i.lat))), + this + ); + } + getCenter() { + return new Xu( + (this._sw.lng + this._ne.lng) / 2, + (this._sw.lat + this._ne.lat) / 2, + ); + } + getSouthWest() { + return this._sw; + } + getNorthEast() { + return this._ne; + } + getNorthWest() { + return new Xu(this.getWest(), this.getNorth()); + } + getSouthEast() { + return new Xu(this.getEast(), this.getSouth()); + } + getWest() { + return this._sw.lng; + } + getSouth() { + return this._sw.lat; + } + getEast() { + return this._ne.lng; + } + getNorth() { + return this._ne.lat; + } + toArray() { + return [this._sw.toArray(), this._ne.toArray()]; + } + toString() { + return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`; + } + isEmpty() { + return !(this._sw && this._ne); + } + contains(t) { + const { lng: e, lat: r } = Xu.convert(t); + let n = this._sw.lng <= e && e <= this._ne.lng; + return ( + this._sw.lng > this._ne.lng && + (n = this._sw.lng >= e && e >= this._ne.lng), + this._sw.lat <= r && r <= this._ne.lat && n + ); + } + static convert(t) { + return t instanceof Yu ? t : t ? new Yu(t) : t; + } + } + const Hu = 2 * Math.PI * Ju; + function Wu(t) { + return Hu * Math.cos((t * Math.PI) / 180); + } + function Qu(t) { + return (180 + t) / 360; + } + function tc(t) { + return ( + (180 - + (180 / Math.PI) * + Math.log(Math.tan(Math.PI / 4 + (t * Math.PI) / 360))) / + 360 + ); + } + function ec(t, e) { + return t / Wu(e); + } + function rc(t) { + return ( + (360 / Math.PI) * + Math.atan(Math.exp(((180 - 360 * t) * Math.PI) / 180)) - + 90 + ); + } + class nc { + constructor(t, e, r = 0) { + (this.x = +t), (this.y = +e), (this.z = +r); + } + static fromLngLat(t, e = 0) { + const r = Xu.convert(t); + return new nc(Qu(r.lng), tc(r.lat), ec(e, r.lat)); + } + toLngLat() { + return new Xu(360 * this.x - 180, rc(this.y)); + } + toAltitude() { + return this.z * Wu(rc(this.y)); + } + meterInMercatorCoordinateUnits() { + return (1 / Hu) * ((t = rc(this.y)), 1 / Math.cos((t * Math.PI) / 180)); + var t; + } + } + function ic(t, e, r) { + var n = (2 * Math.PI * 6378137) / 256 / Math.pow(2, r); + return [ + t * n - (2 * Math.PI * 6378137) / 2, + e * n - (2 * Math.PI * 6378137) / 2, + ]; + } + class ac { + constructor(t, e, r) { + if ( + t < 0 || + t > 25 || + r < 0 || + r >= Math.pow(2, t) || + e < 0 || + e >= Math.pow(2, t) + ) + throw new Error( + `x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow( + 2, + t, + )}, 0<=y<${Math.pow(2, t)} 0<=z<=25 `, + ); + (this.z = t), + (this.x = e), + (this.y = r), + (this.key = lc(0, t, t, e, r)); + } + equals(t) { + return this.z === t.z && this.x === t.x && this.y === t.y; + } + url(t, e, r) { + const n = + ((a = this.y), + (s = this.z), + (o = ic(256 * (i = this.x), 256 * (a = Math.pow(2, s) - a - 1), s)), + (l = ic(256 * (i + 1), 256 * (a + 1), s)), + o[0] + ',' + o[1] + ',' + l[0] + ',' + l[1]); + var i, a, s, o, l; + const u = (function (t, e, r) { + let n, + i = ''; + for (let a = t; a > 0; a--) + (n = 1 << (a - 1)), (i += (e & n ? 1 : 0) + (r & n ? 2 : 0)); + return i; + })(this.z, this.x, this.y); + return t[(this.x + this.y) % t.length] + .replace( + /{prefix}/g, + (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' === r ? Math.pow(2, this.z) - this.y - 1 : this.y), + ) + .replace(/{ratio}/g, e > 1 ? '@2x' : '') + .replace(/{quadkey}/g, u) + .replace(/{bbox-epsg-3857}/g, n); + } + isChildOf(t) { + const e = this.z - t.z; + return e > 0 && t.x === this.x >> e && t.y === this.y >> e; + } + getTilePoint(t) { + const e = Math.pow(2, this.z); + return new S((t.x * e - this.x) * qa, (t.y * e - this.y) * qa); + } + toString() { + return `${this.z}/${this.x}/${this.y}`; + } + } + class sc { + constructor(t, e) { + (this.wrap = t), + (this.canonical = e), + (this.key = lc(t, e.z, e.z, e.x, e.y)); + } + } + class oc { + constructor(t, e, r, n, i) { + if (t < r) + throw new Error( + `overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`, + ); + (this.overscaledZ = t), + (this.wrap = e), + (this.canonical = new ac(r, +n, +i)), + (this.key = lc(e, t, r, n, i)); + } + clone() { + return new oc( + this.overscaledZ, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + } + equals(t) { + return ( + this.overscaledZ === t.overscaledZ && + this.wrap === t.wrap && + this.canonical.equals(t.canonical) + ); + } + scaledTo(t) { + if (t > this.overscaledZ) + throw new Error( + `targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`, + ); + const e = this.canonical.z - t; + return t > this.canonical.z + ? new oc( + t, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ) + : new oc( + t, + this.wrap, + t, + this.canonical.x >> e, + this.canonical.y >> e, + ); + } + calculateScaledKey(t, e) { + if (t > this.overscaledZ) + throw new Error( + `targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`, + ); + const r = this.canonical.z - t; + return t > this.canonical.z + ? lc( + this.wrap * +e, + t, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ) + : lc( + this.wrap * +e, + t, + t, + this.canonical.x >> r, + this.canonical.y >> r, + ); + } + isChildOf(t) { + if (t.wrap !== this.wrap) return !1; + const e = this.canonical.z - t.canonical.z; + return ( + 0 === t.overscaledZ || + (t.overscaledZ < this.overscaledZ && + t.canonical.x === this.canonical.x >> e && + t.canonical.y === this.canonical.y >> e) + ); + } + children(t) { + if (this.overscaledZ >= t) + return [ + new oc( + this.overscaledZ + 1, + this.wrap, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ), + ]; + const e = this.canonical.z + 1, + r = 2 * this.canonical.x, + n = 2 * this.canonical.y; + return [ + new oc(e, this.wrap, e, r, n), + new oc(e, this.wrap, e, r + 1, n), + new oc(e, this.wrap, e, r, n + 1), + new oc(e, this.wrap, e, r + 1, n + 1), + ]; + } + isLessThan(t) { + return ( + this.wrap < t.wrap || + (!(this.wrap > t.wrap) && + (this.overscaledZ < t.overscaledZ || + (!(this.overscaledZ > t.overscaledZ) && + (this.canonical.x < t.canonical.x || + (!(this.canonical.x > t.canonical.x) && + this.canonical.y < t.canonical.y))))) + ); + } + wrapped() { + return new oc( + this.overscaledZ, + 0, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + } + unwrapTo(t) { + return new oc( + this.overscaledZ, + t, + this.canonical.z, + this.canonical.x, + this.canonical.y, + ); + } + overscaleFactor() { + return Math.pow(2, this.overscaledZ - this.canonical.z); + } + toUnwrapped() { + return new sc(this.wrap, this.canonical); + } + toString() { + return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`; + } + getTilePoint(t) { + return this.canonical.getTilePoint(new nc(t.x - this.wrap, t.y)); + } + } + function lc(t, e, r, n, i) { + (t *= 2) < 0 && (t = -1 * t - 1); + const a = 1 << r; + return ( + (a * a * t + a * i + n).toString(36) + r.toString(36) + e.toString(36) + ); + } + Mn('CanonicalTileID', ac), + Mn('OverscaledTileID', oc, { omit: ['posMatrix'] }); + class uc { + constructor(t, e, r) { + if (((this.uid = t), e.height !== e.width)) + throw new RangeError('DEM tiles must be square'); + if (r && 'mapbox' !== r && 'terrarium' !== r) + return void d( + `"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`, + ); + this.stride = e.height; + const n = (this.dim = e.height - 2); + (this.data = new Uint32Array(e.data.buffer)), + (this.encoding = r || 'mapbox'); + for (let t = 0; t < n; t++) + (this.data[this._idx(-1, t)] = this.data[this._idx(0, t)]), + (this.data[this._idx(n, t)] = this.data[this._idx(n - 1, t)]), + (this.data[this._idx(t, -1)] = this.data[this._idx(t, 0)]), + (this.data[this._idx(t, n)] = this.data[this._idx(t, n - 1)]); + (this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)]), + (this.data[this._idx(n, -1)] = this.data[this._idx(n - 1, 0)]), + (this.data[this._idx(-1, n)] = this.data[this._idx(0, n - 1)]), + (this.data[this._idx(n, n)] = this.data[this._idx(n - 1, n - 1)]), + (this.min = Number.MAX_SAFE_INTEGER), + (this.max = Number.MIN_SAFE_INTEGER); + for (let t = 0; t < n; t++) + for (let e = 0; e < n; e++) { + const r = this.get(t, e); + r > this.max && (this.max = r), r < this.min && (this.min = r); + } + } + get(t, e) { + const r = new Uint8Array(this.data.buffer), + n = 4 * this._idx(t, e); + return ( + 'terrarium' === this.encoding + ? this._unpackTerrarium + : this._unpackMapbox + )(r[n], r[n + 1], r[n + 2]); + } + getUnpackVector() { + return 'terrarium' === this.encoding + ? [256, 1, 1 / 256, 32768] + : [6553.6, 25.6, 0.1, 1e4]; + } + _idx(t, e) { + if (t < -1 || t >= this.dim + 1 || e < -1 || e >= this.dim + 1) + throw new RangeError('out of range source coordinates for DEM data'); + return (e + 1) * this.stride + (t + 1); + } + _unpackMapbox(t, e, r) { + return (256 * t * 256 + 256 * e + r) / 10 - 1e4; + } + _unpackTerrarium(t, e, r) { + return 256 * t + e + r / 256 - 32768; + } + getPixels() { + return new Bs( + { width: this.stride, height: this.stride }, + new Uint8Array(this.data.buffer), + ); + } + backfillBorder(t, e, r) { + if (this.dim !== t.dim) throw new Error('dem dimension mismatch'); + let n = e * this.dim, + i = e * this.dim + this.dim, + a = r * this.dim, + s = r * this.dim + this.dim; + switch (e) { + case -1: + n = i - 1; + break; + case 1: + i = n + 1; + } + switch (r) { + case -1: + a = s - 1; + break; + case 1: + s = a + 1; + } + const o = -e * this.dim, + l = -r * this.dim; + for (let e = a; e < s; e++) + for (let r = n; r < i; r++) + this.data[this._idx(r, e)] = t.data[this._idx(r + o, e + l)]; + } + } + Mn('DEMData', uc); + class cc { + constructor(t) { + (this._stringToNumber = {}), (this._numberToString = []); + for (let e = 0; e < t.length; e++) { + const r = t[e]; + (this._stringToNumber[r] = e), (this._numberToString[e] = r); + } + } + encode(t) { + return this._stringToNumber[t]; + } + decode(t) { + if (t >= this._numberToString.length) + throw new Error( + `Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`, + ); + return this._numberToString[t]; + } + } + class hc { + constructor(t, e, r, n, i) { + (this.type = 'Feature'), + (this._vectorTileFeature = t), + (t._z = e), + (t._x = r), + (t._y = n), + (this.properties = t.properties), + (this.id = i); + } + get geometry() { + return ( + void 0 === this._geometry && + (this._geometry = this._vectorTileFeature.toGeoJSON( + this._vectorTileFeature._x, + this._vectorTileFeature._y, + this._vectorTileFeature._z, + ).geometry), + this._geometry + ); + } + set geometry(t) { + this._geometry = t; + } + toJSON() { + const t = { geometry: this.geometry }; + for (const e in this) + '_geometry' !== e && '_vectorTileFeature' !== e && (t[e] = this[e]); + return t; + } + } + class pc { + constructor(t, e) { + (this.tileID = t), + (this.x = t.canonical.x), + (this.y = t.canonical.y), + (this.z = t.canonical.z), + (this.grid = new Sn(qa, 16, 0)), + (this.grid3D = new Sn(qa, 16, 0)), + (this.featureIndexArray = new Wi()), + (this.promoteId = e); + } + insert(t, e, r, n, i, a) { + const s = this.featureIndexArray.length; + this.featureIndexArray.emplaceBack(r, n, i); + const o = a ? this.grid3D : this.grid; + for (let t = 0; t < e.length; t++) { + const r = e[t], + n = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; + for (let t = 0; t < r.length; t++) { + const e = r[t]; + (n[0] = Math.min(n[0], e.x)), + (n[1] = Math.min(n[1], e.y)), + (n[2] = Math.max(n[2], e.x)), + (n[3] = Math.max(n[3], e.y)); + } + n[0] < qa && + n[1] < qa && + n[2] >= 0 && + n[3] >= 0 && + o.insert(s, n[0], n[1], n[2], n[3]); + } + } + loadVTLayers() { + return ( + this.vtLayers || + ((this.vtLayers = new _o.VectorTile( + new ul(this.rawTileData), + ).layers), + (this.sourceLayerCoder = new cc( + this.vtLayers + ? Object.keys(this.vtLayers).sort() + : ['_geojsonTileLayer'], + ))), + this.vtLayers + ); + } + query(t, e, r, n) { + this.loadVTLayers(); + const i = t.params || {}, + a = qa / t.tileSize / t.scale, + s = Jr(i.filter), + o = t.queryGeometry, + l = t.queryPadding * a, + u = dc(o), + c = this.grid.query(u.minX - l, u.minY - l, u.maxX + l, u.maxY + l), + h = dc(t.cameraQueryGeometry), + p = this.grid3D.query( + h.minX - l, + h.minY - l, + h.maxX + l, + h.maxY + l, + (e, r, n, i) => + (function (t, e, r, n, i) { + for (const a of t) + if (e <= a.x && r <= a.y && n >= a.x && i >= a.y) return !0; + const a = [new S(e, r), new S(e, i), new S(n, i), new S(n, r)]; + if (t.length > 2) for (const e of a) if (is(t, e)) return !0; + for (let e = 0; e < t.length - 1; e++) + if (as(t[e], t[e + 1], a)) return !0; + return !1; + })(t.cameraQueryGeometry, e - l, r - l, n + l, i + l), + ); + for (const t of p) c.push(t); + c.sort(yc); + const f = {}; + let d; + for (let l = 0; l < c.length; l++) { + const u = c[l]; + if (u === d) continue; + d = u; + const h = this.featureIndexArray.get(u); + let p = null; + this.loadMatchingFeature( + f, + h.bucketIndex, + h.sourceLayerIndex, + h.featureIndex, + s, + i.layers, + i.availableImages, + e, + r, + n, + (e, r, n) => ( + p || (p = Za(e)), + r.queryIntersectsFeature( + o, + e, + n, + p, + this.z, + t.transform, + a, + t.pixelPosMatrix, + ) + ), + ); + } + return f; + } + loadMatchingFeature(t, e, r, n, i, a, s, l, u, c, h) { + const p = this.bucketLayerIDs[e]; + if ( + a && + !(function (t, e) { + for (let r = 0; r < t.length; r++) + if (e.indexOf(t[r]) >= 0) return !0; + return !1; + })(a, p) + ) + return; + const f = this.sourceLayerCoder.decode(r), + d = this.vtLayers[f].feature(n); + if (i.needGeometry) { + const t = Ka(d, !0); + if ( + !i.filter(new Qn(this.tileID.overscaledZ), t, this.tileID.canonical) + ) + return; + } else if (!i.filter(new Qn(this.tileID.overscaledZ), d)) return; + const y = this.getId(d, f); + for (let e = 0; e < p.length; e++) { + const r = p[e]; + if (a && a.indexOf(r) < 0) continue; + const i = l[r]; + if (!i) continue; + let f = {}; + y && c && (f = c.getState(i.sourceLayer || '_geojsonTileLayer', y)); + const m = o({}, u[r]); + (m.paint = fc(m.paint, i.paint, d, f, s)), + (m.layout = fc(m.layout, i.layout, d, f, s)); + const g = !h || h(d, i, f); + if (!g) continue; + const x = new hc(d, this.z, this.x, this.y, y); + x.layer = m; + let v = t[r]; + void 0 === v && (v = t[r] = []), + v.push({ featureIndex: n, feature: x, intersectionZ: g }); + } + } + lookupSymbolFeatures(t, e, r, n, i, a, s, o) { + const l = {}; + this.loadVTLayers(); + const u = Jr(i); + for (const i of t) this.loadMatchingFeature(l, r, n, i, u, a, s, o, e); + return l; + } + hasLayer(t) { + for (const e of this.bucketLayerIDs) + for (const r of e) if (t === r) return !0; + return !1; + } + getId(t, e) { + let r = t.id; + return ( + this.promoteId && + ((r = + t.properties[ + 'string' == typeof this.promoteId + ? this.promoteId + : this.promoteId[e] + ]), + 'boolean' == typeof r && (r = Number(r))), + r + ); + } + } + function fc(t, e, r, n, i) { + return c(t, (t, a) => { + const s = e instanceof oi ? e.get(a) : null; + return s && s.evaluate ? s.evaluate(r, n, i) : s; + }); + } + function dc(t) { + let e = 1 / 0, + r = 1 / 0, + n = -1 / 0, + i = -1 / 0; + for (const a of t) + (e = Math.min(e, a.x)), + (r = Math.min(r, a.y)), + (n = Math.max(n, a.x)), + (i = Math.max(i, a.y)); + return { minX: e, minY: r, maxX: n, maxY: i }; + } + function yc(t, e) { + return e - t; + } + var mc; + Mn('FeatureIndex', pc, { omit: ['rawTileData', 'sourceLayerCoder'] }), + (t.PerformanceMarkers = void 0), + ((mc = t.PerformanceMarkers || (t.PerformanceMarkers = {})).create = + 'create'), + (mc.load = 'load'), + (mc.fullLoad = 'fullLoad'); + let gc = null, + xc = []; + const vc = 1e3 / 30, + bc = { + mark(t) { + performance.mark(t); + }, + frame(t) { + const e = t; + null != gc && xc.push(e - gc), (gc = e); + }, + clearMetrics() { + (gc = null), + (xc = []), + performance.clearMeasures('loadTime'), + performance.clearMeasures('fullLoadTime'); + for (const e in t.PerformanceMarkers) + performance.clearMarks(t.PerformanceMarkers[e]); + }, + getPerformanceMetrics() { + performance.measure( + 'loadTime', + t.PerformanceMarkers.create, + t.PerformanceMarkers.load, + ), + performance.measure( + 'fullLoadTime', + t.PerformanceMarkers.create, + t.PerformanceMarkers.fullLoad, + ); + const e = performance.getEntriesByName('loadTime')[0].duration, + r = performance.getEntriesByName('fullLoadTime')[0].duration, + n = xc.length, + i = 1 / (xc.reduce((t, e) => t + e, 0) / n / 1e3), + a = xc.filter((t) => t > vc).reduce((t, e) => t + (e - vc) / vc, 0); + return { + loadTime: e, + fullLoadTime: r, + fps: i, + percentDroppedFrames: (a / (n + a)) * 100, + }; + }, + }; + (t.AJAXError = q), + (t.ARRAY_TYPE = ps), + (t.Actor = class { + constructor(t, e, r) { + (this.target = t), + (this.parent = e), + (this.mapId = r), + (this.callbacks = {}), + (this.tasks = {}), + (this.taskQueue = []), + (this.cancelCallbacks = {}), + u(['receive', 'process'], this), + (this.invoker = new Gu(this.process)), + this.target.addEventListener('message', this.receive, !1), + (this.globalScope = g() ? t : window); + } + send(t, e, r, n, i = !1) { + const a = Math.round(1e18 * Math.random()) + .toString(36) + .substring(0, 10); + r && (this.callbacks[a] = r); + const s = _(this.globalScope) ? void 0 : []; + return ( + this.target.postMessage( + { + id: a, + type: t, + hasCallback: !!r, + targetMapId: n, + mustQueue: i, + sourceMapId: this.mapId, + data: Bn(e, s), + }, + s, + ), + { + cancel: () => { + r && delete this.callbacks[a], + this.target.postMessage({ + id: a, + type: '', + targetMapId: n, + sourceMapId: this.mapId, + }); + }, + } + ); + } + receive(t) { + const e = t.data, + r = e.id; + if (r && (!e.targetMapId || this.mapId === e.targetMapId)) + if ('' === e.type) { + delete this.tasks[r]; + const t = this.cancelCallbacks[r]; + delete this.cancelCallbacks[r], t && t(); + } else + g() || e.mustQueue + ? ((this.tasks[r] = e), + this.taskQueue.push(r), + this.invoker.trigger()) + : this.processTask(r, e); + } + process() { + if (!this.taskQueue.length) return; + const t = this.taskQueue.shift(), + e = this.tasks[t]; + delete this.tasks[t], + this.taskQueue.length && this.invoker.trigger(), + e && this.processTask(t, e); + } + processTask(t, e) { + if ('' === e.type) { + const r = this.callbacks[t]; + delete this.callbacks[t], + r && (e.error ? r(Cn(e.error)) : r(null, Cn(e.data))); + } else { + let r = !1; + const n = _(this.globalScope) ? void 0 : [], + i = e.hasCallback + ? (e, i) => { + (r = !0), + delete this.cancelCallbacks[t], + this.target.postMessage( + { + id: t, + type: '', + sourceMapId: this.mapId, + error: e ? Bn(e) : null, + data: Bn(i, n), + }, + n, + ); + } + : (t) => { + r = !0; + }; + let a = null; + const s = Cn(e.data); + if (this.parent[e.type]) + a = this.parent[e.type](e.sourceMapId, s, i); + else if (this.parent.getWorkerSource) { + const t = e.type.split('.'); + a = this.parent + .getWorkerSource(e.sourceMapId, t[0], s.source) + [t[1]](s, i); + } else i(new Error(`Could not find function ${e.type}`)); + !r && a && a.cancel && (this.cancelCallbacks[t] = a.cancel); + } + } + remove() { + this.invoker.remove(), + this.target.removeEventListener('message', this.receive, !1); + } + }), + (t.AlphaImage = zs), + (t.CanonicalTileID = ac), + (t.CollisionBoxArray = Ni), + (t.CollisionCircleLayoutArray = class extends Vi {}), + (t.Color = Ft), + (t.DEMData = uc), + (t.DataConstantProperty = li), + (t.DictionaryCoder = cc), + (t.EXTENT = qa), + (t.ErrorEvent = et), + (t.EvaluationParameters = Qn), + (t.Event = tt), + (t.Evented = rt), + (t.FeatureIndex = pc), + (t.FillBucket = mo), + (t.FillExtrusionBucket = Do), + (t.GeoJSONFeature = hc), + (t.ImageAtlas = Dl), + (t.ImagePosition = Ll), + (t.LineBucket = Yo), + (t.LineStripIndexArray = class extends Ui {}), + (t.LngLat = Xu), + (t.LngLatBounds = Yu), + (t.MercatorCoordinate = nc), + (t.ONE_EM = ll), + (t.OverscaledTileID = oc), + (t.PerformanceUtils = bc), + (t.PosArray = Qi), + (t.Properties = fi), + (t.QuadTriangleArray = class extends Fi {}), + (t.RGBAImage = Bs), + (t.RasterBoundsArray = class extends _i {}), + (t.RequestPerformance = class { + constructor(t) { + (this._marks = { + start: [t.url, 'start'].join('#'), + end: [t.url, 'end'].join('#'), + measure: t.url.toString(), + }), + performance.mark(this._marks.start); + } + finish() { + performance.mark(this._marks.end); + let t = performance.getEntriesByName(this._marks.measure); + return ( + 0 === t.length && + (performance.measure( + this._marks.measure, + this._marks.start, + this._marks.end, + ), + (t = performance.getEntriesByName(this._marks.measure)), + performance.clearMarks(this._marks.start), + performance.clearMarks(this._marks.end), + performance.clearMeasures(this._marks.measure)), + t + ); + } + }), + (t.ResourceType = U), + (t.SegmentVector = ya), + (t.SymbolBucket = Du), + (t.Transitionable = ri), + (t.TriangleIndexArray = ha), + (t.Uniform1f = za), + (t.Uniform1i = class extends Ma { + constructor(t, e) { + super(t, e), (this.current = 0); + } + set(t) { + this.current !== t && + ((this.current = t), this.gl.uniform1i(this.location, t)); + } + }), + (t.Uniform2f = class extends Ma { + constructor(t, e) { + super(t, e), (this.current = [0, 0]); + } + set(t) { + (t[0] === this.current[0] && t[1] === this.current[1]) || + ((this.current = t), this.gl.uniform2f(this.location, t[0], t[1])); + } + }), + (t.Uniform3f = class extends Ma { + constructor(t, e) { + super(t, e), (this.current = [0, 0, 0]); + } + set(t) { + (t[0] === this.current[0] && + t[1] === this.current[1] && + t[2] === this.current[2]) || + ((this.current = t), + this.gl.uniform3f(this.location, t[0], t[1], t[2])); + } + }), + (t.Uniform4f = Ba), + (t.UniformColor = Ca), + (t.UniformMatrix4f = class extends Ma { + constructor(t, e) { + super(t, e), (this.current = Pa); + } + set(t) { + if (t[12] !== this.current[12] || t[0] !== this.current[0]) + return ( + (this.current = t), + void this.gl.uniformMatrix4fv(this.location, !1, t) + ); + for (let e = 1; e < 16; e++) + if (t[e] !== this.current[e]) { + (this.current = t), + this.gl.uniformMatrix4fv(this.location, !1, t); + break; + } + } + }), + (t.UnwrappedTileID = sc), + (t.ValidationError = it), + (t.ZoomHistory = Pn), + (t.add = function (t, e, r) { + return ( + (t[0] = e[0] + r[0]), (t[1] = e[1] + r[1]), (t[2] = e[2] + r[2]), t + ); + }), + (t.addDynamicAttributes = Eu), + (t.asyncAll = function (t, e, r) { + if (!t.length) return r(null, []); + let n = t.length; + const i = new Array(t.length); + let a = null; + t.forEach((t, s) => { + e(t, (t, e) => { + t && (a = t), (i[s] = e), 0 == --n && r(a, i); + }); + }); + }), + (t.bezier = n), + (t.bindAll = u), + (t.cacheEntryPossiblyAdded = function (t) { + F++, F > V && (t.getActor().send('enforceCacheSizeLimit', P), (F = 0)); + }), + (t.clamp = a), + (t.clearTileCache = function (t) { + const e = caches.delete(z); + t && e.catch(t).then(() => t()); + }), + (t.clipLine = cu), + (t.clone = function (t) { + var e = new ps(16); + return ( + (e[0] = t[0]), + (e[1] = t[1]), + (e[2] = t[2]), + (e[3] = t[3]), + (e[4] = t[4]), + (e[5] = t[5]), + (e[6] = t[6]), + (e[7] = t[7]), + (e[8] = t[8]), + (e[9] = t[9]), + (e[10] = t[10]), + (e[11] = t[11]), + (e[12] = t[12]), + (e[13] = t[13]), + (e[14] = t[14]), + (e[15] = t[15]), + e + ); + }), + (t.clone$1 = p), + (t.clone$2 = function (t) { + var e = new ps(3); + return (e[0] = t[0]), (e[1] = t[1]), (e[2] = t[2]), e; + }), + (t.collisionCircleLayout = al), + (t.config = M), + (t.copy = function (t, e) { + 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 + ); + }), + (t.create = function () { + var t = new ps(16); + return ( + ps != Float32Array && + ((t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0)), + (t[0] = 1), + (t[5] = 1), + (t[10] = 1), + (t[15] = 1), + t + ); + }), + (t.create$1 = fs), + (t.createExpression = Fr), + (t.createFilter = Jr), + (t.createLayout = vi), + (t.createStyleLayer = function (t) { + return 'custom' === t.type ? new Zu(t) : new Ku[t.type](t); + }), + (t.cross = function (t, e, r) { + var n = e[0], + i = e[1], + a = e[2], + s = r[0], + o = r[1], + l = r[2]; + return ( + (t[0] = i * l - a * o), + (t[1] = a * s - n * l), + (t[2] = n * o - i * s), + t + ); + }), + (t.dot = function (t, e) { + return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]; + }), + (t.dot$1 = function (t, e) { + return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3]; + }), + (t.ease = i), + (t.emitValidationErrors = kn), + (t.enforceCacheSizeLimit = function (t) { + E(), + B && + B.then((e) => { + e.keys().then((r) => { + for (let n = 0; n < r.length - t; n++) e.delete(r[n]); + }); + }); + }), + (t.equals = function (t, e) { + var r = t[0], + n = t[1], + i = t[2], + a = t[3], + s = t[4], + o = t[5], + l = t[6], + u = t[7], + c = t[8], + h = t[9], + p = t[10], + f = t[11], + d = t[12], + y = t[13], + m = t[14], + g = t[15], + x = e[0], + v = e[1], + b = e[2], + w = e[3], + _ = e[4], + A = e[5], + k = e[6], + S = e[7], + I = e[8], + M = e[9], + z = e[10], + B = e[11], + C = e[12], + P = e[13], + V = e[14], + E = e[15]; + return ( + Math.abs(r - x) <= hs * Math.max(1, Math.abs(r), Math.abs(x)) && + Math.abs(n - v) <= hs * Math.max(1, Math.abs(n), Math.abs(v)) && + Math.abs(i - b) <= hs * Math.max(1, Math.abs(i), Math.abs(b)) && + Math.abs(a - w) <= hs * Math.max(1, Math.abs(a), Math.abs(w)) && + Math.abs(s - _) <= hs * Math.max(1, Math.abs(s), Math.abs(_)) && + Math.abs(o - A) <= hs * Math.max(1, Math.abs(o), Math.abs(A)) && + Math.abs(l - k) <= hs * Math.max(1, Math.abs(l), Math.abs(k)) && + Math.abs(u - S) <= hs * Math.max(1, Math.abs(u), Math.abs(S)) && + Math.abs(c - I) <= hs * Math.max(1, Math.abs(c), Math.abs(I)) && + Math.abs(h - M) <= hs * Math.max(1, Math.abs(h), Math.abs(M)) && + Math.abs(p - z) <= hs * Math.max(1, Math.abs(p), Math.abs(z)) && + Math.abs(f - B) <= hs * Math.max(1, Math.abs(f), Math.abs(B)) && + Math.abs(d - C) <= hs * Math.max(1, Math.abs(d), Math.abs(C)) && + Math.abs(y - P) <= hs * Math.max(1, Math.abs(y), Math.abs(P)) && + Math.abs(m - V) <= hs * Math.max(1, Math.abs(m), Math.abs(V)) && + Math.abs(g - E) <= hs * Math.max(1, Math.abs(g), Math.abs(E)) + ); + }), + (t.evaluateSizeForFeature = function ( + t, + { uSize: e, uSizeT: r }, + { lowerSize: n, upperSize: i }, + ) { + return 'source' === t.kind + ? n / tu + : 'composite' === t.kind + ? Se(n / tu, i / tu, r) + : e; + }), + (t.evaluateSizeForZoom = function (t, e) { + let r = 0, + n = 0; + if ('constant' === t.kind) n = t.layoutSize; + else if ('source' !== t.kind) { + const { interpolationType: i, minZoom: s, maxZoom: o } = t, + l = i ? a(Ne.interpolationFactor(i, e, s, o), 0, 1) : 0; + 'camera' === t.kind ? (n = Se(t.minSize, t.maxSize, l)) : (r = l); + } + return { uSizeT: r, uSize: n }; + }), + (t.evaluateVariableOffset = Au), + (t.evented = Xn), + (t.exported = k), + (t.exported$1 = T), + (t.extend = o), + (t.filterObject = h), + (t.fromRotation = function (t, e) { + var r = Math.sin(e), + n = Math.cos(e); + return ( + (t[0] = n), + (t[1] = r), + (t[2] = 0), + (t[3] = -r), + (t[4] = n), + (t[5] = 0), + (t[6] = 0), + (t[7] = 0), + (t[8] = 1), + t + ); + }), + (t.fromScaling = function (t, e) { + return ( + (t[0] = e[0]), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = e[1]), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = e[2]), + (t[11] = 0), + (t[12] = 0), + (t[13] = 0), + (t[14] = 0), + (t[15] = 1), + t + ); + }), + (t.getAnchorAlignment = Yl), + (t.getAnchorJustification = ku), + (t.getArrayBuffer = K), + (t.getImage = H), + (t.getJSON = function (t, e) { + return Z(o(t, { type: 'json' }), e); + }), + (t.getOverlapMode = qu), + (t.getRTLTextPluginStatus = Yn), + (t.getReferrer = j), + (t.getVideo = function (t, e) { + const r = window.document.createElement('video'); + (r.muted = !0), + (r.onloadstart = function () { + e(null, r); + }); + for (let e = 0; e < t.length; e++) { + const n = window.document.createElement('source'); + G(t[e]) || (r.crossOrigin = 'Anonymous'), + (n.src = t[e]), + r.appendChild(n); + } + return { cancel: () => {} }; + }), + (t.identity = ds), + (t.invert = function (t, e) { + var r = e[0], + n = e[1], + i = e[2], + a = e[3], + s = e[4], + o = e[5], + l = e[6], + u = e[7], + c = e[8], + h = e[9], + p = e[10], + f = e[11], + d = e[12], + y = e[13], + m = e[14], + g = e[15], + x = r * o - n * s, + v = r * l - i * s, + b = r * u - a * s, + w = n * l - i * o, + _ = n * u - a * o, + A = i * u - a * l, + k = c * y - h * d, + S = c * m - p * d, + I = c * g - f * d, + M = h * m - p * y, + z = h * g - f * y, + B = p * g - f * m, + C = x * B - v * z + b * M + w * I - _ * S + A * k; + return C + ? ((t[0] = (o * B - l * z + u * M) * (C = 1 / C)), + (t[1] = (i * z - n * B - a * M) * C), + (t[2] = (y * A - m * _ + g * w) * C), + (t[3] = (p * _ - h * A - f * w) * C), + (t[4] = (l * I - s * B - u * S) * C), + (t[5] = (r * B - i * I + a * S) * C), + (t[6] = (m * b - d * A - g * v) * C), + (t[7] = (c * A - p * b + f * v) * C), + (t[8] = (s * z - o * I + u * k) * C), + (t[9] = (n * I - r * z - a * k) * C), + (t[10] = (d * _ - y * b + g * x) * C), + (t[11] = (h * b - c * _ - f * x) * C), + (t[12] = (o * S - s * M - l * k) * C), + (t[13] = (r * M - n * S + i * k) * C), + (t[14] = (y * v - d * w - m * x) * C), + (t[15] = (c * w - h * v + p * x) * C), + t) + : null; + }), + (t.isImageBitmap = A), + (t.isSafari = _), + (t.isWorker = g), + (t.keysDifference = function (t, e) { + const r = []; + for (const n in t) n in e || r.push(n); + return r; + }), + (t.lazyLoadRTLTextPlugin = function () { + Wn.isLoading() || Wn.isLoaded() || 'deferred' !== Yn() || Hn(); + }), + (t.makeRequest = Z), + (t.mapObject = c), + (t.mercatorXfromLng = Qu), + (t.mercatorYfromLat = tc), + (t.mercatorZfromAltitude = ec), + (t.mul = gs), + (t.mul$1 = function (t, e, r) { + return ( + (t[0] = e[0] * r[0]), + (t[1] = e[1] * r[1]), + (t[2] = e[2] * r[2]), + (t[3] = e[3] * r[3]), + t + ); + }), + (t.multiply = ys), + (t.nextPowerOfTwo = function (t) { + return t <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t) / Math.LN2)); + }), + (t.normalize = function (t, e) { + var r = e[0], + n = e[1], + i = e[2], + a = r * r + n * n + i * i; + return ( + a > 0 && (a = 1 / Math.sqrt(a)), + (t[0] = e[0] * a), + (t[1] = e[1] * a), + (t[2] = e[2] * a), + t + ); + }), + (t.number = Se), + (t.ortho = function (t, e, r, n, i, a, s) { + var o = 1 / (e - r), + l = 1 / (n - i), + u = 1 / (a - s); + return ( + (t[0] = -2 * o), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = -2 * l), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[10] = 2 * u), + (t[11] = 0), + (t[12] = (e + r) * o), + (t[13] = (i + n) * l), + (t[14] = (s + a) * u), + (t[15] = 1), + t + ); + }), + (t.parseCacheControl = x), + (t.parseGlyphPbf = function (t) { + return new ul(t).readFields(Vl, []); + }), + (t.pbf = ul), + (t.performSymbolLayout = function (e) { + e.bucket.createArrays(), + (e.bucket.tilePixelRatio = qa / (512 * e.bucket.overscaling)), + (e.bucket.compareText = {}), + (e.bucket.iconsNeedLinear = !1); + const r = e.bucket.layers[0].layout, + n = e.bucket.layers[0]._unevaluatedLayout._values, + i = { + layoutIconSize: n['icon-size'].possiblyEvaluate( + new Qn(e.bucket.zoom + 1), + e.canonical, + ), + layoutTextSize: n['text-size'].possiblyEvaluate( + new Qn(e.bucket.zoom + 1), + e.canonical, + ), + textMaxSize: n['text-size'].possiblyEvaluate(new Qn(18)), + }; + if ('composite' === e.bucket.textSizeData.kind) { + const { minZoom: t, maxZoom: r } = e.bucket.textSizeData; + i.compositeTextSizes = [ + n['text-size'].possiblyEvaluate(new Qn(t), e.canonical), + n['text-size'].possiblyEvaluate(new Qn(r), e.canonical), + ]; + } + if ('composite' === e.bucket.iconSizeData.kind) { + const { minZoom: t, maxZoom: r } = e.bucket.iconSizeData; + i.compositeIconSizes = [ + n['icon-size'].possiblyEvaluate(new Qn(t), e.canonical), + n['icon-size'].possiblyEvaluate(new Qn(r), e.canonical), + ]; + } + const a = r.get('text-line-height') * ll, + s = + 'viewport' !== r.get('text-rotation-alignment') && + 'point' !== r.get('symbol-placement'), + o = r.get('text-keep-upright'), + l = r.get('text-size'); + for (const n of e.bucket.features) { + const u = r.get('text-font').evaluate(n, {}, e.canonical).join(','), + c = l.evaluate(n, {}, e.canonical), + h = i.layoutTextSize.evaluate(n, {}, e.canonical), + p = i.layoutIconSize.evaluate(n, {}, e.canonical), + f = { horizontal: {}, vertical: void 0 }, + y = n.text; + let m, + g = [0, 0]; + if (y) { + const i = y.toString(), + l = + r.get('text-letter-spacing').evaluate(n, {}, e.canonical) * ll, + p = Fn(i) ? l : 0, + d = r.get('text-anchor').evaluate(n, {}, e.canonical), + m = r.get('text-variable-anchor'); + if (!m) { + const t = r + .get('text-radial-offset') + .evaluate(n, {}, e.canonical); + g = t + ? Au(d, [t * ll, _u]) + : r + .get('text-offset') + .evaluate(n, {}, e.canonical) + .map((t) => t * ll); + } + let x = s + ? 'center' + : r.get('text-justify').evaluate(n, {}, e.canonical); + const v = r.get('symbol-placement'), + b = + 'point' === v + ? r.get('text-max-width').evaluate(n, {}, e.canonical) * ll + : 0, + w = () => { + e.bucket.allowVerticalPlacement && + En(i) && + (f.vertical = Ul( + y, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + u, + b, + a, + d, + 'left', + p, + g, + t.WritingMode.vertical, + !0, + v, + h, + c, + )); + }; + if (!s && m) { + const r = 'auto' === x ? m.map((t) => ku(t)) : [x]; + let n = !1; + for (let i = 0; i < r.length; i++) { + const s = r[i]; + if (!f.horizontal[s]) + if (n) f.horizontal[s] = f.horizontal[0]; + else { + const r = Ul( + y, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + u, + b, + a, + 'center', + s, + p, + g, + t.WritingMode.horizontal, + !1, + v, + h, + c, + ); + r && + ((f.horizontal[s] = r), + (n = 1 === r.positionedLines.length)); + } + } + w(); + } else { + 'auto' === x && (x = ku(d)); + const r = Ul( + y, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + u, + b, + a, + d, + x, + p, + g, + t.WritingMode.horizontal, + !1, + v, + h, + c, + ); + r && (f.horizontal[x] = r), + w(), + En(i) && + s && + o && + (f.vertical = Ul( + y, + e.glyphMap, + e.glyphPositions, + e.imagePositions, + u, + b, + a, + d, + x, + p, + g, + t.WritingMode.vertical, + !1, + v, + h, + c, + )); + } + } + let x = !1; + if (n.icon && n.icon.name) { + const t = e.imageMap[n.icon.name]; + t && + ((m = Wl( + e.imagePositions[n.icon.name], + r.get('icon-offset').evaluate(n, {}, e.canonical), + r.get('icon-anchor').evaluate(n, {}, e.canonical), + )), + (x = !!t.sdf), + void 0 === e.bucket.sdfIcons + ? (e.bucket.sdfIcons = x) + : e.bucket.sdfIcons !== x && + d( + 'Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer', + ), + (t.pixelRatio !== e.bucket.pixelRatio || + 0 !== r.get('icon-rotate').constantOr(1)) && + (e.bucket.iconsNeedLinear = !0)); + } + const v = zu(f.horizontal) || f.vertical; + (e.bucket.iconsInText = !!v && v.iconsInText), + (v || m) && + Su(e.bucket, n, f, m, e.imageMap, i, h, p, g, x, e.canonical); + } + e.showCollisionBoxes && e.bucket.generateCollisionDebugBuffers(); + }), + (t.perspective = function (t, e, r, n, i) { + var a, + s = 1 / Math.tan(e / 2); + return ( + (t[0] = s / r), + (t[1] = 0), + (t[2] = 0), + (t[3] = 0), + (t[4] = 0), + (t[5] = s), + (t[6] = 0), + (t[7] = 0), + (t[8] = 0), + (t[9] = 0), + (t[11] = -1), + (t[12] = 0), + (t[13] = 0), + (t[15] = 0), + null != i && i !== 1 / 0 + ? ((t[10] = (i + n) * (a = 1 / (n - i))), (t[14] = 2 * i * n * a)) + : ((t[10] = -1), (t[14] = -2 * n)), + t + ); + }), + (t.pick = function (t, e) { + const r = {}; + for (let n = 0; n < e.length; n++) { + const i = e[n]; + i in t && (r[i] = t[i]); + } + return r; + }), + (t.plugin = Wn), + (t.pointGeometry = S), + (t.polygonIntersectsPolygon = Xa), + (t.potpack = Tl), + (t.refProperties = [ + 'type', + 'source', + 'source-layer', + 'minzoom', + 'maxzoom', + 'filter', + 'layout', + ]), + (t.register = Mn), + (t.registerForPluginStateChange = function (t) { + return ( + t({ pluginStatus: Zn, pluginURL: Kn }), + Xn.on('pluginStateChange', t), + t + ); + }), + (t.renderColorRamp = Cs), + (t.rotateX = function (t, e, r) { + var n = Math.sin(r), + i = Math.cos(r), + a = e[4], + s = e[5], + o = e[6], + l = e[7], + u = e[8], + c = e[9], + h = e[10], + p = e[11]; + return ( + e !== t && + ((t[0] = e[0]), + (t[1] = e[1]), + (t[2] = e[2]), + (t[3] = e[3]), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15])), + (t[4] = a * i + u * n), + (t[5] = s * i + c * n), + (t[6] = o * i + h * n), + (t[7] = l * i + p * n), + (t[8] = u * i - a * n), + (t[9] = c * i - s * n), + (t[10] = h * i - o * n), + (t[11] = p * i - l * n), + t + ); + }), + (t.rotateZ = function (t, e, r) { + var n = Math.sin(r), + i = Math.cos(r), + a = e[0], + s = e[1], + o = e[2], + l = e[3], + u = e[4], + c = e[5], + h = e[6], + p = e[7]; + return ( + e !== t && + ((t[8] = e[8]), + (t[9] = e[9]), + (t[10] = e[10]), + (t[11] = e[11]), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15])), + (t[0] = a * i + u * n), + (t[1] = s * i + c * n), + (t[2] = o * i + h * n), + (t[3] = l * i + p * n), + (t[4] = u * i - a * n), + (t[5] = c * i - s * n), + (t[6] = h * i - o * n), + (t[7] = p * i - l * n), + t + ); + }), + (t.scale = function (t, e, r) { + var n = r[0], + i = r[1], + a = r[2]; + return ( + (t[0] = e[0] * n), + (t[1] = e[1] * n), + (t[2] = e[2] * n), + (t[3] = e[3] * n), + (t[4] = e[4] * i), + (t[5] = e[5] * i), + (t[6] = e[6] * i), + (t[7] = e[7] * i), + (t[8] = e[8] * a), + (t[9] = e[9] * a), + (t[10] = e[10] * a), + (t[11] = e[11] * a), + (t[12] = e[12]), + (t[13] = e[13]), + (t[14] = e[14]), + (t[15] = e[15]), + t + ); + }), + (t.scale$1 = function (t, e, r) { + return (t[0] = e[0] * r), (t[1] = e[1] * r), (t[2] = e[2] * r), t; + }), + (t.setCacheLimits = function (t, e) { + (P = t), (V = e); + }), + (t.setRTLTextPlugin = function (t, e, r = !1) { + if (Zn === Un || Zn === qn || Zn === jn) + throw new Error('setRTLTextPlugin cannot be called multiple times.'); + (Kn = k.resolveURL(t)), (Zn = Un), (Nn = e), Jn(), r || Hn(); + }), + (t.spec = nt), + (t.sphericalToCartesian = function ([t, e, r]) { + return ( + (e += 90), + (e *= Math.PI / 180), + (r *= Math.PI / 180), + { + x: t * Math.cos(e) * Math.sin(r), + y: t * Math.sin(e) * Math.sin(r), + z: t * Math.cos(r), + } + ); + }), + (t.sqrLen = function (t) { + var e = t[0], + r = t[1]; + return e * e + r * r; + }), + (t.sub = function (t, e, r) { + return ( + (t[0] = e[0] - r[0]), (t[1] = e[1] - r[1]), (t[2] = e[2] - r[2]), t + ); + }), + (t.toEvaluationFeature = Ka), + (t.transformMat3 = function (t, e, r) { + var n = e[0], + i = e[1], + a = e[2]; + return ( + (t[0] = n * r[0] + i * r[3] + a * r[6]), + (t[1] = n * r[1] + i * r[4] + a * r[7]), + (t[2] = n * r[2] + i * r[5] + a * r[8]), + t + ); + }), + (t.transformMat4 = bs), + (t.transformMat4$1 = function (t, e, r) { + var n = e[0], + i = e[1]; + return ( + (t[0] = r[0] * n + r[4] * i + r[12]), + (t[1] = r[1] * n + r[5] * i + r[13]), + t + ); + }), + (t.translate = function (t, e, r) { + var n, + i, + a, + s, + o, + l, + u, + c, + h, + p, + f, + d, + y = r[0], + m = r[1], + g = r[2]; + return ( + e === t + ? ((t[12] = e[0] * y + e[4] * m + e[8] * g + e[12]), + (t[13] = e[1] * y + e[5] * m + e[9] * g + e[13]), + (t[14] = e[2] * y + e[6] * m + e[10] * g + e[14]), + (t[15] = e[3] * y + e[7] * m + e[11] * g + e[15])) + : ((i = e[1]), + (a = e[2]), + (s = e[3]), + (o = e[4]), + (l = e[5]), + (u = e[6]), + (c = e[7]), + (h = e[8]), + (p = e[9]), + (f = e[10]), + (d = e[11]), + (t[0] = n = e[0]), + (t[1] = i), + (t[2] = a), + (t[3] = s), + (t[4] = o), + (t[5] = l), + (t[6] = u), + (t[7] = c), + (t[8] = h), + (t[9] = p), + (t[10] = f), + (t[11] = d), + (t[12] = n * y + o * m + h * g + e[12]), + (t[13] = i * y + l * m + p * g + e[13]), + (t[14] = a * y + u * m + f * g + e[14]), + (t[15] = s * y + c * m + d * g + e[15])), + t + ); + }), + (t.triggerPluginCompletionEvent = Gn), + (t.unicodeBlockLookup = Vn), + (t.uniqueId = function () { + return l++; + }), + (t.validateCustomStyleLayer = function (t) { + const e = [], + r = t.id; + return ( + void 0 === r && + e.push({ message: `layers.${r}: missing required property "id"` }), + void 0 === t.render && + e.push({ + message: `layers.${r}: missing required method "render"`, + }), + t.renderingMode && + '2d' !== t.renderingMode && + '3d' !== t.renderingMode && + e.push({ + message: `layers.${r}: property "renderingMode" must be either "2d" or "3d"`, + }), + e + ); + }), + (t.validateLight = wn), + (t.validateStyle = bn), + (t.vectorTile = _o), + (t.warnOnce = d), + (t.wrap = s); + }); -})); + define(['./shared'], function (e) { + 'use strict'; + function t(e) { + const o = typeof e; + if ('number' === o || 'boolean' === o || 'string' === o || null == e) + return JSON.stringify(e); + if (Array.isArray(e)) { + let o = '['; + for (const i of e) o += `${t(i)},`; + return `${o}]`; + } + const i = Object.keys(e).sort(); + let r = '{'; + for (let o = 0; o < i.length; o++) + r += `${JSON.stringify(i[o])}:${t(e[i[o]])},`; + return `${r}}`; + } + function o(o) { + let i = ''; + for (const r of e.refProperties) i += `/${t(o[r])}`; + return i; + } + class i { + constructor(e) { + (this.keyCache = {}), e && this.replace(e); + } + replace(e) { + (this._layerConfigs = {}), (this._layers = {}), this.update(e, []); + } + update(t, i) { + for (const o of t) { + this._layerConfigs[o.id] = o; + const t = (this._layers[o.id] = e.createStyleLayer(o)); + (t._featureFilter = e.createFilter(t.filter)), + this.keyCache[o.id] && delete this.keyCache[o.id]; + } + for (const e of i) + delete this.keyCache[e], + delete this._layerConfigs[e], + delete this._layers[e]; + this.familiesBySource = {}; + const r = (function (e, t) { + const i = {}; + for (let r = 0; r < e.length; r++) { + const n = (t && t[e[r].id]) || o(e[r]); + t && (t[e[r].id] = n); + let s = i[n]; + s || (s = i[n] = []), s.push(e[r]); + } + const r = []; + for (const e in i) r.push(i[e]); + return r; + })(Object.values(this._layerConfigs), this.keyCache); + for (const e of r) { + const t = e.map((e) => this._layers[e.id]), + o = t[0]; + if ('none' === o.visibility) continue; + const i = o.source || ''; + let r = this.familiesBySource[i]; + r || (r = this.familiesBySource[i] = {}); + const n = o.sourceLayer || '_geojsonTileLayer'; + let s = r[n]; + s || (s = r[n] = []), s.push(t); + } + } + } + class r { + constructor(t) { + const o = {}, + i = []; + for (const e in t) { + const r = t[e], + n = (o[e] = {}); + for (const e in r) { + const t = r[+e]; + if (!t || 0 === t.bitmap.width || 0 === t.bitmap.height) continue; + const o = { + x: 0, + y: 0, + w: t.bitmap.width + 2, + h: t.bitmap.height + 2, + }; + i.push(o), (n[e] = { rect: o, metrics: t.metrics }); + } + } + const { w: r, h: n } = e.potpack(i), + s = new e.AlphaImage({ width: r || 1, height: n || 1 }); + for (const i in t) { + const r = t[i]; + for (const t in r) { + const n = r[+t]; + if (!n || 0 === n.bitmap.width || 0 === n.bitmap.height) continue; + const a = o[i][t].rect; + e.AlphaImage.copy( + n.bitmap, + s, + { x: 0, y: 0 }, + { x: a.x + 1, y: a.y + 1 }, + n.bitmap, + ); + } + } + (this.image = s), (this.positions = o); + } + } + e.register('GlyphAtlas', r); + class n { + constructor(t) { + (this.tileID = new e.OverscaledTileID( + t.tileID.overscaledZ, + t.tileID.wrap, + t.tileID.canonical.z, + t.tileID.canonical.x, + t.tileID.canonical.y, + )), + (this.uid = t.uid), + (this.zoom = t.zoom), + (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); + } + parse(t, o, i, n, a) { + (this.status = 'parsing'), + (this.data = t), + (this.collisionBoxArray = new e.CollisionBoxArray()); + const l = new e.DictionaryCoder(Object.keys(t.layers).sort()), + c = new e.FeatureIndex(this.tileID, this.promoteId); + c.bucketLayerIDs = []; + const u = {}, + h = { + featureIndex: c, + iconDependencies: {}, + patternDependencies: {}, + glyphDependencies: {}, + availableImages: i, + }, + p = o.familiesBySource[this.source]; + for (const o in p) { + const r = t.layers[o]; + if (!r) continue; + 1 === r.version && + e.warnOnce( + `Vector tile source "${this.source}" layer "${o}" does not use vector tile spec v2 and therefore may have some rendering errors.`, + ); + const n = l.encode(o), + a = []; + for (let e = 0; e < r.length; e++) { + const t = r.feature(e), + i = c.getId(t, o); + a.push({ feature: t, id: i, index: e, sourceLayerIndex: n }); + } + for (const t of p[o]) { + const o = t[0]; + o.source !== this.source && + e.warnOnce( + `layer.source = ${o.source} does not equal this.source = ${this.source}`, + ), + (o.minzoom && this.zoom < Math.floor(o.minzoom)) || + (o.maxzoom && this.zoom >= o.maxzoom) || + ('none' !== o.visibility && + (s(t, this.zoom, i), + (u[o.id] = o.createBucket({ + index: c.bucketLayerIDs.length, + layers: t, + zoom: this.zoom, + pixelRatio: this.pixelRatio, + overscaling: this.overscaling, + collisionBoxArray: this.collisionBoxArray, + sourceLayerIndex: n, + sourceID: this.source, + })).populate(a, h, this.tileID.canonical), + c.bucketLayerIDs.push(t.map((e) => e.id)))); + } + } + let f, d, g, m; + const y = e.mapObject(h.glyphDependencies, (e) => + Object.keys(e).map(Number), + ); + Object.keys(y).length + ? n.send('getGlyphs', { uid: this.uid, stacks: y }, (e, t) => { + f || ((f = e), (d = t), w.call(this)); + }) + : (d = {}); + const v = Object.keys(h.iconDependencies); + v.length + ? n.send( + 'getImages', + { + icons: v, + source: this.source, + tileID: this.tileID, + type: 'icons', + }, + (e, t) => { + f || ((f = e), (g = t), w.call(this)); + }, + ) + : (g = {}); + const x = Object.keys(h.patternDependencies); + function w() { + if (f) return a(f); + if (d && g && m) { + const t = new r(d), + o = new e.ImageAtlas(g, m); + for (const r in u) { + const n = u[r]; + n instanceof e.SymbolBucket + ? (s(n.layers, this.zoom, i), + e.performSymbolLayout({ + bucket: n, + glyphMap: d, + glyphPositions: t.positions, + imageMap: g, + imagePositions: o.iconPositions, + showCollisionBoxes: this.showCollisionBoxes, + canonical: this.tileID.canonical, + })) + : n.hasPattern && + (n instanceof e.LineBucket || + n instanceof e.FillBucket || + n instanceof e.FillExtrusionBucket) && + (s(n.layers, this.zoom, i), + n.addFeatures(h, this.tileID.canonical, o.patternPositions)); + } + (this.status = 'done'), + a(null, { + buckets: Object.values(u).filter((e) => !e.isEmpty()), + featureIndex: c, + collisionBoxArray: this.collisionBoxArray, + glyphAtlasImage: t.image, + imageAtlas: o, + glyphMap: this.returnDependencies ? d : null, + iconMap: this.returnDependencies ? g : null, + glyphPositions: this.returnDependencies ? t.positions : null, + }); + } + } + x.length + ? n.send( + 'getImages', + { + icons: x, + source: this.source, + tileID: this.tileID, + type: 'patterns', + }, + (e, t) => { + f || ((f = e), (m = t), w.call(this)); + }, + ) + : (m = {}), + w.call(this); + } + } + function s(t, o, i) { + const r = new e.EvaluationParameters(o); + for (const e of t) e.recalculate(r, i); + } + function a(t, o) { + const i = e.getArrayBuffer(t.request, (t, i, r, n) => { + t + ? o(t) + : i && + o(null, { + vectorTile: new e.vectorTile.VectorTile(new e.pbf(i)), + rawData: i, + cacheControl: r, + expires: n, + }); + }); + return () => { + i.cancel(), o(); + }; + } + class l { + constructor(e, t, o, i) { + (this.actor = e), + (this.layerIndex = t), + (this.availableImages = o), + (this.loadVectorData = i || a), + (this.loading = {}), + (this.loaded = {}); + } + loadTile(t, o) { + const i = t.uid; + this.loading || (this.loading = {}); + const r = + !!(t && t.request && t.request.collectResourceTiming) && + new e.RequestPerformance(t.request), + s = (this.loading[i] = new n(t)); + s.abort = this.loadVectorData(t, (t, n) => { + if ((delete this.loading[i], t || !n)) + return (s.status = 'done'), (this.loaded[i] = s), o(t); + const a = n.rawData, + l = {}; + n.expires && (l.expires = n.expires), + n.cacheControl && (l.cacheControl = n.cacheControl); + const c = {}; + if (r) { + const e = r.finish(); + e && (c.resourceTiming = JSON.parse(JSON.stringify(e))); + } + (s.vectorTile = n.vectorTile), + s.parse( + n.vectorTile, + this.layerIndex, + this.availableImages, + this.actor, + (t, i) => { + if (t || !i) return o(t); + o(null, e.extend({ rawTileData: a.slice(0) }, i, l, c)); + }, + ), + (this.loaded = this.loaded || {}), + (this.loaded[i] = s); + }); + } + reloadTile(e, t) { + const o = this.loaded, + i = e.uid, + r = this; + if (o && o[i]) { + const n = o[i]; + n.showCollisionBoxes = e.showCollisionBoxes; + const s = (e, o) => { + const i = n.reloadCallback; + i && + (delete n.reloadCallback, + n.parse( + n.vectorTile, + r.layerIndex, + this.availableImages, + r.actor, + i, + )), + t(e, o); + }; + 'parsing' === n.status + ? (n.reloadCallback = s) + : 'done' === n.status && + (n.vectorTile + ? n.parse( + n.vectorTile, + this.layerIndex, + this.availableImages, + this.actor, + s, + ) + : s()); + } + } + abortTile(e, t) { + const o = this.loading, + i = e.uid; + o && o[i] && o[i].abort && (o[i].abort(), delete o[i]), t(); + } + removeTile(e, t) { + const o = this.loaded, + i = e.uid; + o && o[i] && delete o[i], t(); + } + } + class c { + constructor() { + this.loaded = {}; + } + loadTile(t, o) { + const { uid: i, encoding: r, rawImageData: n } = t, + s = e.isImageBitmap(n) ? this.getImageData(n) : n, + a = new e.DEMData(i, s, r); + (this.loaded = this.loaded || {}), (this.loaded[i] = a), o(null, a); + } + getImageData(t) { + (this.offscreenCanvas && this.offscreenCanvasContext) || + ((this.offscreenCanvas = new OffscreenCanvas(t.width, t.height)), + (this.offscreenCanvasContext = + this.offscreenCanvas.getContext('2d'))), + (this.offscreenCanvas.width = t.width), + (this.offscreenCanvas.height = t.height), + this.offscreenCanvasContext.drawImage(t, 0, 0, t.width, t.height); + const o = this.offscreenCanvasContext.getImageData( + -1, + -1, + t.width + 2, + t.height + 2, + ); + return ( + this.offscreenCanvasContext.clearRect( + 0, + 0, + this.offscreenCanvas.width, + this.offscreenCanvas.height, + ), + new e.RGBAImage({ width: o.width, height: o.height }, o.data) + ); + } + removeTile(e) { + const t = this.loaded, + o = e.uid; + t && t[o] && delete t[o]; + } + } + var u = function e(t, o) { + var i, + r = t && t.type; + if ('FeatureCollection' === r) + for (i = 0; i < t.features.length; i++) e(t.features[i], o); + else if ('GeometryCollection' === r) + for (i = 0; i < t.geometries.length; i++) e(t.geometries[i], o); + else if ('Feature' === r) e(t.geometry, o); + else if ('Polygon' === r) h(t.coordinates, o); + else if ('MultiPolygon' === r) + for (i = 0; i < t.coordinates.length; i++) h(t.coordinates[i], o); + return t; + }; + function h(e, t) { + if (0 !== e.length) { + p(e[0], t); + for (var o = 1; o < e.length; o++) p(e[o], !t); + } + } + function p(e, t) { + for (var o = 0, i = 0, r = 0, n = e.length, s = n - 1; r < n; s = r++) { + var a = (e[r][0] - e[s][0]) * (e[s][1] + e[r][1]), + l = o + a; + (i += Math.abs(o) >= Math.abs(a) ? o - l + a : a - l + o), (o = l); + } + o + i >= 0 != !!t && e.reverse(); + } + const f = e.vectorTile.VectorTileFeature.prototype.toGeoJSON; + class d { + constructor(t) { + (this._feature = t), + (this.extent = e.EXTENT), + (this.type = t.type), + (this.properties = t.tags), + 'id' in t && !isNaN(t.id) && (this.id = parseInt(t.id, 10)); + } + loadGeometry() { + if (1 === this._feature.type) { + const t = []; + for (const o of this._feature.geometry) + t.push([new e.pointGeometry(o[0], o[1])]); + return t; + } + { + const t = []; + for (const o of this._feature.geometry) { + const i = []; + for (const t of o) i.push(new e.pointGeometry(t[0], t[1])); + t.push(i); + } + return t; + } + } + toGeoJSON(e, t, o) { + return f.call(this, e, t, o); + } + } + class g { + constructor(t) { + (this.layers = { _geojsonTileLayer: this }), + (this.name = '_geojsonTileLayer'), + (this.extent = e.EXTENT), + (this.length = t.length), + (this._features = t); + } + feature(e) { + return new d(this._features[e]); + } + } + var m = { exports: {} }, + y = e.pointGeometry, + v = e.vectorTile.VectorTileFeature, + x = w; + function w(e, t) { + (this.options = t || {}), (this.features = e), (this.length = e.length); + } + function S(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); + } + (w.prototype.feature = function (e) { + return new S(this.features[e], this.options.extent); + }), + (S.prototype.loadGeometry = function () { + var e = this.rawGeometry; + this.geometry = []; + for (var t = 0; t < e.length; t++) { + for (var o = e[t], i = [], r = 0; r < o.length; r++) + i.push(new y(o[r][0], o[r][1])); + this.geometry.push(i); + } + return this.geometry; + }), + (S.prototype.bbox = function () { + this.geometry || this.loadGeometry(); + for ( + var e = this.geometry, + t = 1 / 0, + o = -1 / 0, + i = 1 / 0, + r = -1 / 0, + n = 0; + n < e.length; + n++ + ) + for (var s = e[n], a = 0; a < s.length; a++) { + var l = s[a]; + (t = Math.min(t, l.x)), + (o = Math.max(o, l.x)), + (i = Math.min(i, l.y)), + (r = Math.max(r, l.y)); + } + return [t, i, o, r]; + }), + (S.prototype.toGeoJSON = v.prototype.toGeoJSON); + var M = e.pbf, + I = x; + function b(e) { + var t = new M(); + return ( + (function (e, t) { + for (var o in e.layers) t.writeMessage(3, k, e.layers[o]); + })(e, t), + t.finish() + ); + } + function k(e, t) { + var o; + t.writeVarintField(15, e.version || 1), + t.writeStringField(1, e.name || ''), + t.writeVarintField(5, e.extent || 4096); + var i = { keys: [], values: [], keycache: {}, valuecache: {} }; + for (o = 0; o < e.length; o++) + (i.feature = e.feature(o)), t.writeMessage(2, P, i); + var r = i.keys; + for (o = 0; o < r.length; o++) t.writeStringField(3, r[o]); + var n = i.values; + for (o = 0; o < n.length; o++) t.writeMessage(4, L, n[o]); + } + function P(e, t) { + var o = e.feature; + void 0 !== o.id && t.writeVarintField(1, o.id), + t.writeMessage(2, T, e), + t.writeVarintField(3, o.type), + t.writeMessage(4, D, o); + } + function T(e, t) { + var o = e.feature, + i = e.keys, + r = e.values, + n = e.keycache, + s = e.valuecache; + for (var a in o.properties) { + var l = o.properties[a], + c = n[a]; + if (null !== l) { + void 0 === c && (i.push(a), (n[a] = c = i.length - 1)), + t.writeVarint(c); + var u = typeof l; + 'string' !== u && + 'boolean' !== u && + 'number' !== u && + (l = JSON.stringify(l)); + var h = u + ':' + l, + p = s[h]; + void 0 === p && (r.push(l), (s[h] = p = r.length - 1)), + t.writeVarint(p); + } + } + } + function C(e, t) { + return (t << 3) + (7 & e); + } + function _(e) { + return (e << 1) ^ (e >> 31); + } + function D(e, t) { + for ( + var o = e.loadGeometry(), i = e.type, r = 0, n = 0, s = o.length, a = 0; + a < s; + a++ + ) { + var l = o[a], + c = 1; + 1 === i && (c = l.length), t.writeVarint(C(1, c)); + for (var u = 3 === i ? l.length - 1 : l.length, h = 0; h < u; h++) { + 1 === h && 1 !== i && t.writeVarint(C(2, u - 1)); + var p = l[h].x - r, + f = l[h].y - n; + t.writeVarint(_(p)), t.writeVarint(_(f)), (r += p), (n += f); + } + 3 === i && t.writeVarint(C(7, 1)); + } + } + function L(e, t) { + var o = typeof e; + 'string' === o + ? t.writeStringField(1, e) + : 'boolean' === o + ? t.writeBooleanField(7, e) + : 'number' === o && + (e % 1 != 0 + ? t.writeDoubleField(3, e) + : e < 0 + ? t.writeSVarintField(6, e) + : t.writeVarintField(5, e)); + } + function z(e, t, o, i, r, n) { + if (r - i <= o) return; + const s = (i + r) >> 1; + O(e, t, s, i, r, n % 2), + z(e, t, o, i, s - 1, n + 1), + z(e, t, o, s + 1, r, n + 1); + } + function O(e, t, o, i, r, n) { + for (; r > i; ) { + if (r - i > 600) { + const s = r - i + 1, + a = o - i + 1, + l = Math.log(s), + c = 0.5 * Math.exp((2 * l) / 3), + u = + 0.5 * Math.sqrt((l * c * (s - c)) / s) * (a - s / 2 < 0 ? -1 : 1); + O( + e, + t, + o, + Math.max(i, Math.floor(o - (a * c) / s + u)), + Math.min(r, Math.floor(o + ((s - a) * c) / s + u)), + n, + ); + } + const s = t[2 * o + n]; + let a = i, + l = r; + for (E(e, t, i, o), t[2 * r + n] > s && E(e, t, i, r); a < l; ) { + for (E(e, t, a, l), a++, l--; t[2 * a + n] < s; ) a++; + for (; t[2 * l + n] > s; ) l--; + } + t[2 * i + n] === s ? E(e, t, i, l) : (l++, E(e, t, l, r)), + l <= o && (i = l + 1), + o <= l && (r = l - 1); + } + } + function E(e, t, o, i) { + F(e, o, i), F(t, 2 * o, 2 * i), F(t, 2 * o + 1, 2 * i + 1); + } + function F(e, t, o) { + const i = e[t]; + (e[t] = e[o]), (e[o] = i); + } + function N(e, t, o, i) { + const r = e - o, + n = t - i; + return r * r + n * n; + } + (m.exports = b), + (m.exports.fromVectorTileJs = b), + (m.exports.fromGeojsonVt = function (e, t) { + t = t || {}; + var o = {}; + for (var i in e) + (o[i] = new I(e[i].features, t)), + (o[i].name = i), + (o[i].version = t.version), + (o[i].extent = t.extent); + return b({ layers: o }); + }), + (m.exports.GeoJSONWrapper = I); + const A = (e) => e[0], + B = (e) => e[1]; + class J { + constructor(e, t = A, o = B, i = 64, r = Float64Array) { + (this.nodeSize = i), (this.points = e); + const n = e.length < 65536 ? Uint16Array : Uint32Array, + s = (this.ids = new n(e.length)), + a = (this.coords = new r(2 * e.length)); + for (let i = 0; i < e.length; i++) + (s[i] = i), (a[2 * i] = t(e[i])), (a[2 * i + 1] = o(e[i])); + z(s, a, i, 0, s.length - 1, 0); + } + range(e, t, o, i) { + return (function (e, t, o, i, r, n, s) { + const a = [0, e.length - 1, 0], + l = []; + let c, u; + for (; a.length; ) { + const h = a.pop(), + p = a.pop(), + f = a.pop(); + if (p - f <= s) { + for (let s = f; s <= p; s++) + (c = t[2 * s]), + (u = t[2 * s + 1]), + c >= o && c <= r && u >= i && u <= n && l.push(e[s]); + continue; + } + const d = Math.floor((f + p) / 2); + (c = t[2 * d]), + (u = t[2 * d + 1]), + c >= o && c <= r && u >= i && u <= n && l.push(e[d]); + const g = (h + 1) % 2; + (0 === h ? o <= c : i <= u) && + (a.push(f), a.push(d - 1), a.push(g)), + (0 === h ? r >= c : n >= u) && + (a.push(d + 1), a.push(p), a.push(g)); + } + return l; + })(this.ids, this.coords, e, t, o, i, this.nodeSize); + } + within(e, t, o) { + return (function (e, t, o, i, r, n) { + const s = [0, e.length - 1, 0], + a = [], + l = r * r; + for (; s.length; ) { + const c = s.pop(), + u = s.pop(), + h = s.pop(); + if (u - h <= n) { + for (let r = h; r <= u; r++) + N(t[2 * r], t[2 * r + 1], o, i) <= l && a.push(e[r]); + continue; + } + const p = Math.floor((h + u) / 2), + f = t[2 * p], + d = t[2 * p + 1]; + N(f, d, o, i) <= l && a.push(e[p]); + const g = (c + 1) % 2; + (0 === c ? o - r <= f : i - r <= d) && + (s.push(h), s.push(p - 1), s.push(g)), + (0 === c ? o + r >= f : i + r >= d) && + (s.push(p + 1), s.push(u), s.push(g)); + } + return a; + })(this.ids, this.coords, e, t, o, this.nodeSize); + } + } + const Z = { + minZoom: 0, + maxZoom: 16, + minPoints: 2, + radius: 40, + extent: 512, + nodeSize: 64, + log: !1, + generateId: !1, + reduce: null, + map: (e) => e, + }, + G = + Math.fround || ((j = new Float32Array(1)), (e) => ((j[0] = +e), j[0])); + var j; + class Y { + constructor(e) { + (this.options = H(Object.create(Z), e)), + (this.trees = new Array(this.options.maxZoom + 1)); + } + load(e) { + const { log: t, minZoom: o, maxZoom: i, nodeSize: r } = this.options; + t && console.time('total time'); + const n = `prepare ${e.length} points`; + t && console.time(n), (this.points = e); + let s = []; + for (let t = 0; t < e.length; t++) e[t].geometry && s.push(X(e[t], t)); + (this.trees[i + 1] = new J(s, K, Q, r, Float32Array)), + t && console.timeEnd(n); + for (let e = i; e >= o; e--) { + const o = +Date.now(); + (s = this._cluster(s, e)), + (this.trees[e] = new J(s, K, Q, r, Float32Array)), + t && + console.log( + 'z%d: %d clusters in %dms', + e, + s.length, + +Date.now() - o, + ); + } + return t && console.timeEnd('total time'), this; + } + getClusters(e, t) { + let o = ((((e[0] + 180) % 360) + 360) % 360) - 180; + const i = Math.max(-90, Math.min(90, e[1])); + let r = 180 === e[2] ? 180 : ((((e[2] + 180) % 360) + 360) % 360) - 180; + const n = Math.max(-90, Math.min(90, e[3])); + if (e[2] - e[0] >= 360) (o = -180), (r = 180); + else if (o > r) { + const e = this.getClusters([o, i, 180, n], t), + s = this.getClusters([-180, i, r, n], t); + return e.concat(s); + } + const s = this.trees[this._limitZoom(t)], + a = s.range($(o), q(n), $(r), q(i)), + l = []; + for (const e of a) { + const t = s.points[e]; + l.push(t.numPoints ? R(t) : this.points[t.index]); + } + return l; + } + getChildren(e) { + const t = this._getOriginId(e), + o = this._getOriginZoom(e), + i = 'No cluster with the specified id.', + r = this.trees[o]; + if (!r) throw new Error(i); + const n = r.points[t]; + if (!n) throw new Error(i); + const s = + this.options.radius / (this.options.extent * Math.pow(2, o - 1)), + a = r.within(n.x, n.y, s), + l = []; + for (const t of a) { + const o = r.points[t]; + o.parentId === e && l.push(o.numPoints ? R(o) : this.points[o.index]); + } + if (0 === l.length) throw new Error(i); + return l; + } + getLeaves(e, t, o) { + const i = []; + return this._appendLeaves(i, e, (t = t || 10), (o = o || 0), 0), i; + } + getTile(e, t, o) { + const i = this.trees[this._limitZoom(e)], + r = Math.pow(2, e), + { extent: n, radius: s } = this.options, + a = s / n, + l = (o - a) / r, + c = (o + 1 + a) / r, + u = { features: [] }; + return ( + this._addTileFeatures( + i.range((t - a) / r, l, (t + 1 + a) / r, c), + i.points, + t, + o, + r, + u, + ), + 0 === t && + this._addTileFeatures( + i.range(1 - a / r, l, 1, c), + i.points, + r, + o, + r, + u, + ), + t === r - 1 && + this._addTileFeatures( + i.range(0, l, a / r, c), + i.points, + -1, + o, + r, + u, + ), + u.features.length ? u : null + ); + } + getClusterExpansionZoom(e) { + let t = this._getOriginZoom(e) - 1; + for (; t <= this.options.maxZoom; ) { + const o = this.getChildren(e); + if ((t++, 1 !== o.length)) break; + e = o[0].properties.cluster_id; + } + return t; + } + _appendLeaves(e, t, o, i, r) { + const n = this.getChildren(t); + for (const t of n) { + const n = t.properties; + if ( + (n && n.cluster + ? r + n.point_count <= i + ? (r += n.point_count) + : (r = this._appendLeaves(e, n.cluster_id, o, i, r)) + : r < i + ? r++ + : e.push(t), + e.length === o) + ) + break; + } + return r; + } + _addTileFeatures(e, t, o, i, r, n) { + for (const s of e) { + const e = t[s], + a = e.numPoints; + let l, c, u; + if (a) (l = W(e)), (c = e.x), (u = e.y); + else { + const t = this.points[e.index]; + (l = t.properties), + (c = $(t.geometry.coordinates[0])), + (u = q(t.geometry.coordinates[1])); + } + const h = { + type: 1, + geometry: [ + [ + Math.round(this.options.extent * (c * r - o)), + Math.round(this.options.extent * (u * r - i)), + ], + ], + tags: l, + }; + let p; + a + ? (p = e.id) + : this.options.generateId + ? (p = e.index) + : this.points[e.index].id && (p = this.points[e.index].id), + void 0 !== p && (h.id = p), + n.features.push(h); + } + } + _limitZoom(e) { + return Math.max( + this.options.minZoom, + Math.min(Math.floor(+e), this.options.maxZoom + 1), + ); + } + _cluster(e, t) { + const o = [], + { radius: i, extent: r, reduce: n, minPoints: s } = this.options, + a = i / (r * Math.pow(2, t)); + for (let i = 0; i < e.length; i++) { + const r = e[i]; + if (r.zoom <= t) continue; + r.zoom = t; + const l = this.trees[t + 1], + c = l.within(r.x, r.y, a), + u = r.numPoints || 1; + let h = u; + for (const e of c) { + const o = l.points[e]; + o.zoom > t && (h += o.numPoints || 1); + } + if (h > u && h >= s) { + let e = r.x * u, + s = r.y * u, + a = n && u > 1 ? this._map(r, !0) : null; + const p = (i << 5) + (t + 1) + this.points.length; + for (const o of c) { + const i = l.points[o]; + if (i.zoom <= t) continue; + i.zoom = t; + const c = i.numPoints || 1; + (e += i.x * c), + (s += i.y * c), + (i.parentId = p), + n && (a || (a = this._map(r, !0)), n(a, this._map(i))); + } + (r.parentId = p), o.push(V(e / h, s / h, p, h, a)); + } else if ((o.push(r), h > 1)) + for (const e of c) { + const i = l.points[e]; + i.zoom <= t || ((i.zoom = t), o.push(i)); + } + } + return o; + } + _getOriginId(e) { + return (e - this.points.length) >> 5; + } + _getOriginZoom(e) { + return (e - this.points.length) % 32; + } + _map(e, t) { + if (e.numPoints) return t ? H({}, e.properties) : e.properties; + const o = this.points[e.index].properties, + i = this.options.map(o); + return t && i === o ? H({}, i) : i; + } + } + function V(e, t, o, i, r) { + return { + x: G(e), + y: G(t), + zoom: 1 / 0, + id: o, + parentId: -1, + numPoints: i, + properties: r, + }; + } + function X(e, t) { + const [o, i] = e.geometry.coordinates; + return { x: G($(o)), y: G(q(i)), zoom: 1 / 0, index: t, parentId: -1 }; + } + function R(e) { + return { + type: 'Feature', + id: e.id, + properties: W(e), + geometry: { + type: 'Point', + coordinates: [((t = e.x), 360 * (t - 0.5)), U(e.y)], + }, + }; + var t; + } + function W(e) { + const t = e.numPoints, + o = + t >= 1e4 + ? `${Math.round(t / 1e3)}k` + : t >= 1e3 + ? Math.round(t / 100) / 10 + 'k' + : t; + return H(H({}, e.properties), { + cluster: !0, + cluster_id: e.id, + point_count: t, + point_count_abbreviated: o, + }); + } + function $(e) { + return e / 360 + 0.5; + } + function q(e) { + const t = Math.sin((e * Math.PI) / 180), + o = 0.5 - (0.25 * Math.log((1 + t) / (1 - t))) / Math.PI; + return o < 0 ? 0 : o > 1 ? 1 : o; + } + function U(e) { + const t = ((180 - 360 * e) * Math.PI) / 180; + return (360 * Math.atan(Math.exp(t))) / Math.PI - 90; + } + function H(e, t) { + for (const o in t) e[o] = t[o]; + return e; + } + function K(e) { + return e.x; + } + function Q(e) { + return e.y; + } + function ee(e, t, o, i) { + for ( + var r, + n = i, + s = (o - t) >> 1, + a = o - t, + l = e[t], + c = e[t + 1], + u = e[o], + h = e[o + 1], + p = t + 3; + p < o; + p += 3 + ) { + var f = te(e[p], e[p + 1], l, c, u, h); + if (f > n) (r = p), (n = f); + else if (f === n) { + var d = Math.abs(p - s); + d < a && ((r = p), (a = d)); + } + } + n > i && + (r - t > 3 && ee(e, t, r, i), + (e[r + 2] = n), + o - r > 3 && ee(e, r, o, i)); + } + function te(e, t, o, i, r, n) { + var s = r - o, + a = n - i; + if (0 !== s || 0 !== a) { + var l = ((e - o) * s + (t - i) * a) / (s * s + a * a); + l > 1 ? ((o = r), (i = n)) : l > 0 && ((o += s * l), (i += a * l)); + } + return (s = e - o) * s + (a = t - i) * a; + } + function oe(e, t, o, i) { + var r = { + id: void 0 === e ? null : e, + type: t, + geometry: o, + tags: i, + minX: 1 / 0, + minY: 1 / 0, + maxX: -1 / 0, + maxY: -1 / 0, + }; + return ( + (function (e) { + var t = e.geometry, + o = e.type; + if ('Point' === o || 'MultiPoint' === o || 'LineString' === o) + ie(e, t); + else if ('Polygon' === o || 'MultiLineString' === o) + for (var i = 0; i < t.length; i++) ie(e, t[i]); + else if ('MultiPolygon' === o) + for (i = 0; i < t.length; i++) + for (var r = 0; r < t[i].length; r++) ie(e, t[i][r]); + })(r), + r + ); + } + function ie(e, t) { + for (var o = 0; o < t.length; o += 3) + (e.minX = Math.min(e.minX, t[o])), + (e.minY = Math.min(e.minY, t[o + 1])), + (e.maxX = Math.max(e.maxX, t[o])), + (e.maxY = Math.max(e.maxY, t[o + 1])); + } + function re(e, t, o, i) { + if (t.geometry) { + var r = t.geometry.coordinates, + n = t.geometry.type, + s = Math.pow(o.tolerance / ((1 << o.maxZoom) * o.extent), 2), + a = [], + l = t.id; + if ( + (o.promoteId + ? (l = t.properties[o.promoteId]) + : o.generateId && (l = i || 0), + 'Point' === n) + ) + ne(r, a); + else if ('MultiPoint' === n) + for (var c = 0; c < r.length; c++) ne(r[c], a); + else if ('LineString' === n) se(r, a, s, !1); + else if ('MultiLineString' === n) { + if (o.lineMetrics) { + for (c = 0; c < r.length; c++) + se(r[c], (a = []), s, !1), + e.push(oe(l, 'LineString', a, t.properties)); + return; + } + ae(r, a, s, !1); + } else if ('Polygon' === n) ae(r, a, s, !0); + else { + if ('MultiPolygon' !== n) { + if ('GeometryCollection' === n) { + for (c = 0; c < t.geometry.geometries.length; c++) + re( + e, + { + id: l, + geometry: t.geometry.geometries[c], + properties: t.properties, + }, + o, + i, + ); + return; + } + throw new Error('Input data is not a valid GeoJSON object.'); + } + for (c = 0; c < r.length; c++) { + var u = []; + ae(r[c], u, s, !0), a.push(u); + } + } + e.push(oe(l, n, a, t.properties)); + } + } + function ne(e, t) { + t.push(le(e[0])), t.push(ce(e[1])), t.push(0); + } + function se(e, t, o, i) { + for (var r, n, s = 0, a = 0; a < e.length; a++) { + var l = le(e[a][0]), + c = ce(e[a][1]); + t.push(l), + t.push(c), + t.push(0), + a > 0 && + (s += i + ? (r * c - l * n) / 2 + : Math.sqrt(Math.pow(l - r, 2) + Math.pow(c - n, 2))), + (r = l), + (n = c); + } + var u = t.length - 3; + (t[2] = 1), + ee(t, 0, u, o), + (t[u + 2] = 1), + (t.size = Math.abs(s)), + (t.start = 0), + (t.end = t.size); + } + function ae(e, t, o, i) { + for (var r = 0; r < e.length; r++) { + var n = []; + se(e[r], n, o, i), t.push(n); + } + } + function le(e) { + return e / 360 + 0.5; + } + function ce(e) { + var t = Math.sin((e * Math.PI) / 180), + o = 0.5 - (0.25 * Math.log((1 + t) / (1 - t))) / Math.PI; + return o < 0 ? 0 : o > 1 ? 1 : o; + } + function ue(e, t, o, i, r, n, s, a) { + if (((i /= t), n >= (o /= t) && s < i)) return e; + if (s < o || n >= i) return null; + for (var l = [], c = 0; c < e.length; c++) { + var u = e[c], + h = u.geometry, + p = u.type, + f = 0 === r ? u.minX : u.minY, + d = 0 === r ? u.maxX : u.maxY; + if (f >= o && d < i) l.push(u); + else if (!(d < o || f >= i)) { + var g = []; + if ('Point' === p || 'MultiPoint' === p) he(h, g, o, i, r); + else if ('LineString' === p) pe(h, g, o, i, r, !1, a.lineMetrics); + else if ('MultiLineString' === p) de(h, g, o, i, r, !1); + else if ('Polygon' === p) de(h, g, o, i, r, !0); + else if ('MultiPolygon' === p) + for (var m = 0; m < h.length; m++) { + var y = []; + de(h[m], y, o, i, r, !0), y.length && g.push(y); + } + if (g.length) { + if (a.lineMetrics && 'LineString' === p) { + for (m = 0; m < g.length; m++) l.push(oe(u.id, p, g[m], u.tags)); + continue; + } + ('LineString' !== p && 'MultiLineString' !== p) || + (1 === g.length + ? ((p = 'LineString'), (g = g[0])) + : (p = 'MultiLineString')), + ('Point' !== p && 'MultiPoint' !== p) || + (p = 3 === g.length ? 'Point' : 'MultiPoint'), + l.push(oe(u.id, p, g, u.tags)); + } + } + } + return l.length ? l : null; + } + function he(e, t, o, i, r) { + for (var n = 0; n < e.length; n += 3) { + var s = e[n + r]; + s >= o && s <= i && (t.push(e[n]), t.push(e[n + 1]), t.push(e[n + 2])); + } + } + function pe(e, t, o, i, r, n, s) { + for ( + var a, l, c = fe(e), u = 0 === r ? me : ye, h = e.start, p = 0; + p < e.length - 3; + p += 3 + ) { + var f = e[p], + d = e[p + 1], + g = e[p + 2], + m = e[p + 3], + y = e[p + 4], + v = 0 === r ? f : d, + x = 0 === r ? m : y, + w = !1; + s && (a = Math.sqrt(Math.pow(f - m, 2) + Math.pow(d - y, 2))), + v < o + ? x > o && ((l = u(c, f, d, m, y, o)), s && (c.start = h + a * l)) + : v > i + ? x < i && ((l = u(c, f, d, m, y, i)), s && (c.start = h + a * l)) + : ge(c, f, d, g), + x < o && v >= o && ((l = u(c, f, d, m, y, o)), (w = !0)), + x > i && v <= i && ((l = u(c, f, d, m, y, i)), (w = !0)), + !n && w && (s && (c.end = h + a * l), t.push(c), (c = fe(e))), + s && (h += a); + } + var S = e.length - 3; + (f = e[S]), + (d = e[S + 1]), + (g = e[S + 2]), + (v = 0 === r ? f : d) >= o && v <= i && ge(c, f, d, g), + (S = c.length - 3), + n && + S >= 3 && + (c[S] !== c[0] || c[S + 1] !== c[1]) && + ge(c, c[0], c[1], c[2]), + c.length && t.push(c); + } + function fe(e) { + var t = []; + return (t.size = e.size), (t.start = e.start), (t.end = e.end), t; + } + function de(e, t, o, i, r, n) { + for (var s = 0; s < e.length; s++) pe(e[s], t, o, i, r, n, !1); + } + function ge(e, t, o, i) { + e.push(t), e.push(o), e.push(i); + } + function me(e, t, o, i, r, n) { + var s = (n - t) / (i - t); + return e.push(n), e.push(o + (r - o) * s), e.push(1), s; + } + function ye(e, t, o, i, r, n) { + var s = (n - o) / (r - o); + return e.push(t + (i - t) * s), e.push(n), e.push(1), s; + } + function ve(e, t) { + for (var o = [], i = 0; i < e.length; i++) { + var r, + n = e[i], + s = n.type; + if ('Point' === s || 'MultiPoint' === s || 'LineString' === s) + r = xe(n.geometry, t); + else if ('MultiLineString' === s || 'Polygon' === s) { + r = []; + for (var a = 0; a < n.geometry.length; a++) + r.push(xe(n.geometry[a], t)); + } else if ('MultiPolygon' === s) + for (r = [], a = 0; a < n.geometry.length; a++) { + for (var l = [], c = 0; c < n.geometry[a].length; c++) + l.push(xe(n.geometry[a][c], t)); + r.push(l); + } + o.push(oe(n.id, s, r, n.tags)); + } + return o; + } + function xe(e, t) { + var o = []; + (o.size = e.size), + void 0 !== e.start && ((o.start = e.start), (o.end = e.end)); + for (var i = 0; i < e.length; i += 3) + o.push(e[i] + t, e[i + 1], e[i + 2]); + return o; + } + function we(e, t) { + if (e.transformed) return e; + var o, + i, + r, + n = 1 << e.z, + s = e.x, + a = e.y; + for (o = 0; o < e.features.length; o++) { + var l = e.features[o], + c = l.geometry, + u = l.type; + if (((l.geometry = []), 1 === u)) + for (i = 0; i < c.length; i += 2) + l.geometry.push(Se(c[i], c[i + 1], t, n, s, a)); + else + for (i = 0; i < c.length; i++) { + var h = []; + for (r = 0; r < c[i].length; r += 2) + h.push(Se(c[i][r], c[i][r + 1], t, n, s, a)); + l.geometry.push(h); + } + } + return (e.transformed = !0), e; + } + function Se(e, t, o, i, r, n) { + return [Math.round(o * (e * i - r)), Math.round(o * (t * i - n))]; + } + function Me(e, t, o, i, r) { + for ( + var n = t === r.maxZoom ? 0 : r.tolerance / ((1 << t) * r.extent), + s = { + features: [], + numPoints: 0, + numSimplified: 0, + numFeatures: 0, + source: null, + x: o, + y: i, + z: t, + transformed: !1, + minX: 2, + minY: 1, + maxX: -1, + maxY: 0, + }, + a = 0; + a < e.length; + a++ + ) { + s.numFeatures++, Ie(s, e[a], n, r); + var l = e[a].minX, + c = e[a].minY, + u = e[a].maxX, + h = e[a].maxY; + l < s.minX && (s.minX = l), + c < s.minY && (s.minY = c), + u > s.maxX && (s.maxX = u), + h > s.maxY && (s.maxY = h); + } + return s; + } + function Ie(e, t, o, i) { + var r = t.geometry, + n = t.type, + s = []; + if ('Point' === n || 'MultiPoint' === n) + for (var a = 0; a < r.length; a += 3) + s.push(r[a]), s.push(r[a + 1]), e.numPoints++, e.numSimplified++; + else if ('LineString' === n) be(s, r, e, o, !1, !1); + else if ('MultiLineString' === n || 'Polygon' === n) + for (a = 0; a < r.length; a++) + be(s, r[a], e, o, 'Polygon' === n, 0 === a); + else if ('MultiPolygon' === n) + for (var l = 0; l < r.length; l++) { + var c = r[l]; + for (a = 0; a < c.length; a++) be(s, c[a], e, o, !0, 0 === a); + } + if (s.length) { + var u = t.tags || null; + if ('LineString' === n && i.lineMetrics) { + for (var h in ((u = {}), t.tags)) u[h] = t.tags[h]; + (u.mapbox_clip_start = r.start / r.size), + (u.mapbox_clip_end = r.end / r.size); + } + var p = { + geometry: s, + type: + 'Polygon' === n || 'MultiPolygon' === n + ? 3 + : 'LineString' === n || 'MultiLineString' === n + ? 2 + : 1, + tags: u, + }; + null !== t.id && (p.id = t.id), e.features.push(p); + } + } + function be(e, t, o, i, r, n) { + var s = i * i; + if (i > 0 && t.size < (r ? s : i)) o.numPoints += t.length / 3; + else { + for (var a = [], l = 0; l < t.length; l += 3) + (0 === i || t[l + 2] > s) && + (o.numSimplified++, a.push(t[l]), a.push(t[l + 1])), + o.numPoints++; + r && + (function (e, t) { + for ( + var o = 0, i = 0, r = e.length, n = r - 2; + i < r; + n = i, i += 2 + ) + o += (e[i] - e[n]) * (e[i + 1] + e[n + 1]); + if (o > 0 === t) + for (i = 0, r = e.length; i < r / 2; i += 2) { + var s = e[i], + a = e[i + 1]; + (e[i] = e[r - 2 - i]), + (e[i + 1] = e[r - 1 - i]), + (e[r - 2 - i] = s), + (e[r - 1 - i] = a); + } + })(a, n), + e.push(a); + } + } + function ke(e, t) { + var o = (t = this.options = + (function (e, t) { + for (var o in t) e[o] = t[o]; + return e; + })(Object.create(this.options), t)).debug; + if ( + (o && 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 i = (function (e, t) { + var o = []; + if ('FeatureCollection' === e.type) + for (var i = 0; i < e.features.length; i++) + re(o, e.features[i], t, i); + else re(o, 'Feature' === e.type ? e : { geometry: e }, t); + return o; + })(e, t); + (this.tiles = {}), + (this.tileCoords = []), + o && + (console.timeEnd('preprocess data'), + console.log( + 'index: maxZoom: %d, maxPoints: %d', + t.indexMaxZoom, + t.indexMaxPoints, + ), + console.time('generate tiles'), + (this.stats = {}), + (this.total = 0)), + (i = (function (e, t) { + var o = t.buffer / t.extent, + i = e, + r = ue(e, 1, -1 - o, o, 0, -1, 2, t), + n = ue(e, 1, 1 - o, 2 + o, 0, -1, 2, t); + return ( + (r || n) && + ((i = ue(e, 1, -o, 1 + o, 0, -1, 2, t) || []), + r && (i = ve(r, 1).concat(i)), + n && (i = i.concat(ve(n, -1)))), + i + ); + })(i, t)), + i.length && this.splitTile(i, 0, 0, 0), + o && + (i.length && + console.log( + 'features: %d, points: %d', + this.tiles[0].numFeatures, + this.tiles[0].numPoints, + ), + console.timeEnd('generate tiles'), + console.log( + 'tiles generated:', + this.total, + JSON.stringify(this.stats), + )); + } + function Pe(e, t, o) { + return 32 * ((1 << e) * o + t) + e; + } + function Te(e, t) { + const o = e.tileID.canonical; + if (!this._geoJSONIndex) return t(null, null); + const i = this._geoJSONIndex.getTile(o.z, o.x, o.y); + if (!i) return t(null, null); + const r = new g(i.features); + let n = m.exports(r); + (0 === n.byteOffset && n.byteLength === n.buffer.byteLength) || + (n = new Uint8Array(n)), + t(null, { vectorTile: r, rawData: n.buffer }); + } + (ke.prototype.options = { + maxZoom: 14, + indexMaxZoom: 5, + indexMaxPoints: 1e5, + tolerance: 3, + extent: 4096, + buffer: 64, + lineMetrics: !1, + promoteId: null, + generateId: !1, + debug: 0, + }), + (ke.prototype.splitTile = function (e, t, o, i, r, n, s) { + for (var a = [e, t, o, i], l = this.options, c = l.debug; a.length; ) { + (i = a.pop()), (o = a.pop()), (t = a.pop()), (e = a.pop()); + var u = 1 << t, + h = Pe(t, o, i), + p = this.tiles[h]; + if ( + !p && + (c > 1 && console.time('creation'), + (p = this.tiles[h] = Me(e, t, o, i, l)), + this.tileCoords.push({ z: t, x: o, y: i }), + c) + ) { + c > 1 && + (console.log( + 'tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', + t, + o, + i, + p.numFeatures, + p.numPoints, + p.numSimplified, + ), + console.timeEnd('creation')); + var f = 'z' + t; + (this.stats[f] = (this.stats[f] || 0) + 1), this.total++; + } + if (((p.source = e), r)) { + if (t === l.maxZoom || t === r) continue; + var d = 1 << (r - t); + if (o !== Math.floor(n / d) || i !== Math.floor(s / d)) continue; + } else if (t === l.indexMaxZoom || p.numPoints <= l.indexMaxPoints) + continue; + if (((p.source = null), 0 !== e.length)) { + c > 1 && console.time('clipping'); + var g, + m, + y, + v, + x, + w, + S = (0.5 * l.buffer) / l.extent, + M = 0.5 - S, + I = 0.5 + S, + b = 1 + S; + (g = m = y = v = null), + (x = ue(e, u, o - S, o + I, 0, p.minX, p.maxX, l)), + (w = ue(e, u, o + M, o + b, 0, p.minX, p.maxX, l)), + (e = null), + x && + ((g = ue(x, u, i - S, i + I, 1, p.minY, p.maxY, l)), + (m = ue(x, u, i + M, i + b, 1, p.minY, p.maxY, l)), + (x = null)), + w && + ((y = ue(w, u, i - S, i + I, 1, p.minY, p.maxY, l)), + (v = ue(w, u, i + M, i + b, 1, p.minY, p.maxY, l)), + (w = null)), + c > 1 && console.timeEnd('clipping'), + a.push(g || [], t + 1, 2 * o, 2 * i), + a.push(m || [], t + 1, 2 * o, 2 * i + 1), + a.push(y || [], t + 1, 2 * o + 1, 2 * i), + a.push(v || [], t + 1, 2 * o + 1, 2 * i + 1); + } + } + }), + (ke.prototype.getTile = function (e, t, o) { + var i = this.options, + r = i.extent, + n = i.debug; + if (e < 0 || e > 24) return null; + var s = 1 << e, + a = Pe(e, (t = ((t % s) + s) % s), o); + if (this.tiles[a]) return we(this.tiles[a], r); + n > 1 && console.log('drilling down to z%d-%d-%d', e, t, o); + for (var l, c = e, u = t, h = o; !l && c > 0; ) + c--, + (u = Math.floor(u / 2)), + (h = Math.floor(h / 2)), + (l = this.tiles[Pe(c, u, h)]); + return l && l.source + ? (n > 1 && console.log('found parent tile z%d-%d-%d', c, u, h), + n > 1 && console.time('drilling down'), + this.splitTile(l.source, c, u, h, e, t, o), + n > 1 && console.timeEnd('drilling down'), + this.tiles[a] ? we(this.tiles[a], r) : null) + : null; + }); + class Ce extends l { + constructor(e, t, o, i) { + super(e, t, o, Te), i && (this.loadGeoJSON = i); + } + loadData(t, o) { + var i; + null === (i = this._pendingRequest) || void 0 === i || i.cancel(), + this._pendingCallback && + this._pendingCallback(null, { abandoned: !0 }); + const r = + !!(t && t.request && t.request.collectResourceTiming) && + new e.RequestPerformance(t.request); + (this._pendingCallback = o), + (this._pendingRequest = this.loadGeoJSON(t, (i, n) => { + if ( + (delete this._pendingCallback, + delete this._pendingRequest, + i || !n) + ) + return o(i); + if ('object' != typeof n) + return o( + new Error( + `Input data given to '${t.source}' is not a valid GeoJSON object.`, + ), + ); + { + u(n, !0); + try { + if (t.filter) { + const o = e.createExpression(t.filter, { + type: 'boolean', + 'property-type': 'data-driven', + overridable: !1, + transition: !1, + }); + if ('error' === o.result) + throw new Error( + o.value.map((e) => `${e.key}: ${e.message}`).join(', '), + ); + const i = n.features.filter((e) => + o.value.evaluate({ zoom: 0 }, e), + ); + n = { type: 'FeatureCollection', features: i }; + } + this._geoJSONIndex = t.cluster + ? new Y( + (function ({ + superclusterOptions: t, + clusterProperties: o, + }) { + if (!o || !t) return t; + const i = {}, + r = {}, + n = { accumulated: null, zoom: 0 }, + s = { properties: null }, + a = Object.keys(o); + for (const t of a) { + const [n, s] = o[t], + a = e.createExpression(s), + l = e.createExpression( + 'string' == typeof n + ? [n, ['accumulated'], ['get', t]] + : n, + ); + (i[t] = a.value), (r[t] = l.value); + } + return ( + (t.map = (e) => { + s.properties = e; + const t = {}; + for (const e of a) t[e] = i[e].evaluate(n, s); + return t; + }), + (t.reduce = (e, t) => { + s.properties = t; + for (const t of a) + (n.accumulated = e[t]), + (e[t] = r[t].evaluate(n, s)); + }), + t + ); + })(t), + ).load(n.features) + : (function (e, t) { + return new ke(e, t); + })(n, t.geojsonVtOptions); + } catch (i) { + return o(i); + } + this.loaded = {}; + const s = {}; + if (r) { + const e = r.finish(); + e && + ((s.resourceTiming = {}), + (s.resourceTiming[t.source] = JSON.parse(JSON.stringify(e)))); + } + o(null, s); + } + })); + } + reloadTile(e, t) { + const o = this.loaded; + return o && o[e.uid] ? super.reloadTile(e, t) : this.loadTile(e, t); + } + loadGeoJSON(t, o) { + if (t.request) return e.getJSON(t.request, o); + if ('string' == typeof t.data) + try { + o(null, JSON.parse(t.data)); + } catch (e) { + o( + new Error( + `Input data given to '${t.source}' is not a valid GeoJSON object.`, + ), + ); + } + else + o( + new Error( + `Input data given to '${t.source}' is not a valid GeoJSON object.`, + ), + ); + return { cancel: () => {} }; + } + removeSource(e, t) { + this._pendingCallback && this._pendingCallback(null, { abandoned: !0 }), + t(); + } + getClusterExpansionZoom(e, t) { + try { + t(null, this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)); + } catch (e) { + t(e); + } + } + getClusterChildren(e, t) { + try { + t(null, this._geoJSONIndex.getChildren(e.clusterId)); + } catch (e) { + t(e); + } + } + getClusterLeaves(e, t) { + try { + t(null, this._geoJSONIndex.getLeaves(e.clusterId, e.limit, e.offset)); + } catch (e) { + t(e); + } + } + } + class _e { + constructor(t) { + (this.self = t), + (this.actor = new e.Actor(t, this)), + (this.layerIndexes = {}), + (this.availableImages = {}), + (this.workerSourceTypes = { vector: l, geojson: Ce }), + (this.workerSources = {}), + (this.demWorkerSources = {}), + (this.self.registerWorkerSource = (e, t) => { + if (this.workerSourceTypes[e]) + throw new Error( + `Worker source with name "${e}" already registered.`, + ); + this.workerSourceTypes[e] = t; + }), + (this.self.registerRTLTextPlugin = (t) => { + if (e.plugin.isParsed()) + throw new Error('RTL text plugin already registered.'); + (e.plugin.applyArabicShaping = t.applyArabicShaping), + (e.plugin.processBidirectionalText = t.processBidirectionalText), + (e.plugin.processStyledBidirectionalText = + t.processStyledBidirectionalText); + }); + } + setReferrer(e, t) { + this.referrer = t; + } + setImages(e, t, o) { + this.availableImages[e] = t; + for (const o in this.workerSources[e]) { + const i = this.workerSources[e][o]; + for (const e in i) i[e].availableImages = t; + } + o(); + } + setLayers(e, t, o) { + this.getLayerIndex(e).replace(t), o(); + } + updateLayers(e, t, o) { + this.getLayerIndex(e).update(t.layers, t.removedIds), o(); + } + loadTile(e, t, o) { + this.getWorkerSource(e, t.type, t.source).loadTile(t, o); + } + loadDEMTile(e, t, o) { + this.getDEMWorkerSource(e, t.source).loadTile(t, o); + } + reloadTile(e, t, o) { + this.getWorkerSource(e, t.type, t.source).reloadTile(t, o); + } + abortTile(e, t, o) { + this.getWorkerSource(e, t.type, t.source).abortTile(t, o); + } + removeTile(e, t, o) { + this.getWorkerSource(e, t.type, t.source).removeTile(t, o); + } + removeDEMTile(e, t) { + this.getDEMWorkerSource(e, t.source).removeTile(t); + } + removeSource(e, t, o) { + if ( + !this.workerSources[e] || + !this.workerSources[e][t.type] || + !this.workerSources[e][t.type][t.source] + ) + return; + const i = this.workerSources[e][t.type][t.source]; + delete this.workerSources[e][t.type][t.source], + void 0 !== i.removeSource ? i.removeSource(t, o) : o(); + } + loadWorkerSource(e, t, o) { + try { + this.self.importScripts(t.url), o(); + } catch (e) { + o(e.toString()); + } + } + syncRTLPluginState(t, o, i) { + try { + e.plugin.setState(o); + const t = e.plugin.getPluginURL(); + if (e.plugin.isLoaded() && !e.plugin.isParsed() && null != t) { + this.self.importScripts(t); + const o = e.plugin.isParsed(); + i( + o + ? void 0 + : new Error( + `RTL Text Plugin failed to import scripts from ${t}`, + ), + o, + ); + } + } catch (e) { + i(e.toString()); + } + } + getAvailableImages(e) { + let t = this.availableImages[e]; + return t || (t = []), t; + } + getLayerIndex(e) { + let t = this.layerIndexes[e]; + return t || (t = this.layerIndexes[e] = new i()), t; + } + getWorkerSource(e, t, o) { + if ( + (this.workerSources[e] || (this.workerSources[e] = {}), + this.workerSources[e][t] || (this.workerSources[e][t] = {}), + !this.workerSources[e][t][o]) + ) { + const i = { + send: (t, o, i) => { + this.actor.send(t, o, i, e); + }, + }; + this.workerSources[e][t][o] = new this.workerSourceTypes[t]( + i, + this.getLayerIndex(e), + this.getAvailableImages(e), + ); + } + return this.workerSources[e][t][o]; + } + getDEMWorkerSource(e, t) { + return ( + this.demWorkerSources[e] || (this.demWorkerSources[e] = {}), + this.demWorkerSources[e][t] || + (this.demWorkerSources[e][t] = new c()), + this.demWorkerSources[e][t] + ); + } + enforceCacheSizeLimit(t, o) { + e.enforceCacheSizeLimit(o); + } + } + return e.isWorker() && (self.worker = new _e(self)), _e; + }); + + define(['./shared'], function (t) { + 'use strict'; + var e = i; + function i(t) { + return !(function (t) { + return 'undefined' == typeof window || 'undefined' == typeof document + ? 'not a browser' + : Array.prototype && + Array.prototype.every && + Array.prototype.filter && + Array.prototype.forEach && + Array.prototype.indexOf && + Array.prototype.lastIndexOf && + Array.prototype.map && + Array.prototype.some && + Array.prototype.reduce && + Array.prototype.reduceRight && + Array.isArray + ? Function.prototype && Function.prototype.bind + ? Object.keys && + Object.create && + Object.getPrototypeOf && + Object.getOwnPropertyNames && + Object.isSealed && + Object.isFrozen && + Object.isExtensible && + Object.getOwnPropertyDescriptor && + Object.defineProperty && + Object.defineProperties && + Object.seal && + Object.freeze && + Object.preventExtensions + ? 'JSON' in window && 'parse' in JSON && 'stringify' in JSON + ? (function () { + if ( + !( + 'Worker' in window && + 'Blob' in window && + 'URL' in window + ) + ) + return !1; + var t, + e, + i = new Blob([''], { type: 'text/javascript' }), + o = URL.createObjectURL(i); + try { + (e = new Worker(o)), (t = !0); + } catch (e) { + t = !1; + } + return e && e.terminate(), URL.revokeObjectURL(o), t; + })() + ? 'Uint8ClampedArray' in window + ? ArrayBuffer.isView + ? (function () { + var t = document.createElement('canvas'); + t.width = t.height = 1; + var e = t.getContext('2d'); + if (!e) return !1; + var i = e.getImageData(0, 0, 1, 1); + return i && i.width === t.width; + })() + ? (void 0 === + o[(e = t && t.failIfMajorPerformanceCaveat)] && + (o[e] = (function (t) { + var e, + o = (function (t) { + var e = document.createElement('canvas'), + o = Object.create(i.webGLContextAttributes); + return ( + (o.failIfMajorPerformanceCaveat = t), + e.getContext('webgl', o) || + e.getContext('experimental-webgl', o) + ); + })(t); + if (!o) return !1; + try { + e = o.createShader(o.VERTEX_SHADER); + } catch (t) { + return !1; + } + return ( + !(!e || o.isContextLost()) && + (o.shaderSource(e, 'void main() {}'), + o.compileShader(e), + !0 === + o.getShaderParameter(e, o.COMPILE_STATUS)) + ); + })(e)), + o[e] + ? 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 e; + })(t); + } + var o = {}; + function a(t, e) { + if (Array.isArray(t)) { + if (!Array.isArray(e) || t.length !== e.length) return !1; + for (let i = 0; i < t.length; i++) if (!a(t[i], e[i])) return !1; + return !0; + } + if ('object' == typeof t && null !== t && null !== e) { + if ('object' != typeof e) return !1; + if (Object.keys(t).length !== Object.keys(e).length) return !1; + for (const i in t) if (!a(t[i], e[i])) return !1; + return !0; + } + return t === e; + } + i.webGLContextAttributes = { + antialias: !1, + alpha: !0, + stencil: !0, + depth: !0, + }; + class r { + static testProp(t) { + if (!r.docStyle) return t[0]; + for (let e = 0; e < t.length; e++) if (t[e] in r.docStyle) return t[e]; + return t[0]; + } + static create(t, e, i) { + const o = window.document.createElement(t); + return void 0 !== e && (o.className = e), i && i.appendChild(o), o; + } + static createNS(t, e) { + return window.document.createElementNS(t, e); + } + static disableDrag() { + r.docStyle && + r.selectProp && + ((r.userSelect = r.docStyle[r.selectProp]), + (r.docStyle[r.selectProp] = 'none')); + } + static enableDrag() { + r.docStyle && r.selectProp && (r.docStyle[r.selectProp] = r.userSelect); + } + static setTransform(t, e) { + t.style[r.transformProp] = e; + } + static addEventListener(t, e, i, o = {}) { + t.addEventListener(e, i, 'passive' in o ? o : o.capture); + } + static removeEventListener(t, e, i, o = {}) { + t.removeEventListener(e, i, 'passive' in o ? o : o.capture); + } + static suppressClickInternal(t) { + t.preventDefault(), + t.stopPropagation(), + window.removeEventListener('click', r.suppressClickInternal, !0); + } + static suppressClick() { + window.addEventListener('click', r.suppressClickInternal, !0), + window.setTimeout(() => { + window.removeEventListener('click', r.suppressClickInternal, !0); + }, 0); + } + static mousePos(e, i) { + const o = e.getBoundingClientRect(); + return new t.pointGeometry( + i.clientX - o.left - e.clientLeft, + i.clientY - o.top - e.clientTop, + ); + } + static touchPos(e, i) { + const o = e.getBoundingClientRect(), + a = []; + for (let r = 0; r < i.length; r++) + a.push( + new t.pointGeometry( + i[r].clientX - o.left - e.clientLeft, + i[r].clientY - o.top - e.clientTop, + ), + ); + return a; + } + static mouseButton(t) { + return t.button; + } + static remove(t) { + t.parentNode && t.parentNode.removeChild(t); + } + } + (r.docStyle = + 'undefined' != typeof window && + window.document && + window.document.documentElement.style), + (r.selectProp = r.testProp([ + 'userSelect', + 'MozUserSelect', + 'WebkitUserSelect', + 'msUserSelect', + ])), + (r.transformProp = r.testProp(['transform', 'WebkitTransform'])); + class s { + constructor(t) { + this._transformRequestFn = t; + } + transformRequest(t, e) { + return ( + (this._transformRequestFn && this._transformRequestFn(t, e)) || { + url: t, + } + ); + } + normalizeSpriteURL(t, e, i) { + const o = (function (t) { + const e = t.match(n); + if (!e) throw new Error(`Unable to parse URL "${t}"`); + return { + protocol: e[1], + authority: e[2], + path: e[3] || '/', + params: e[4] ? e[4].split('&') : [], + }; + })(t); + return ( + (o.path += `${e}${i}`), + (function (t) { + const e = t.params.length ? `?${t.params.join('&')}` : ''; + return `${t.protocol}://${t.authority}${t.path}${e}`; + })(o) + ); + } + setTransformRequest(t) { + this._transformRequestFn = t; + } + } + const n = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/; + class l { + constructor(t, e, i, o) { + (this.context = t), + (this.format = i), + (this.texture = t.gl.createTexture()), + this.update(e, o); + } + update(e, i, o) { + const { width: a, height: r } = e, + s = !((this.size && this.size[0] === a && this.size[1] === r) || o), + { context: n } = this, + { gl: l } = n; + if ( + ((this.useMipmap = Boolean(i && i.useMipmap)), + l.bindTexture(l.TEXTURE_2D, this.texture), + n.pixelStoreUnpackFlipY.set(!1), + n.pixelStoreUnpack.set(1), + n.pixelStoreUnpackPremultiplyAlpha.set( + this.format === l.RGBA && (!i || !1 !== i.premultiply), + ), + s) + ) + (this.size = [a, r]), + e instanceof HTMLImageElement || + e instanceof HTMLCanvasElement || + e instanceof HTMLVideoElement || + e instanceof ImageData || + t.isImageBitmap(e) + ? l.texImage2D( + l.TEXTURE_2D, + 0, + this.format, + this.format, + l.UNSIGNED_BYTE, + e, + ) + : l.texImage2D( + l.TEXTURE_2D, + 0, + this.format, + a, + r, + 0, + this.format, + l.UNSIGNED_BYTE, + e.data, + ); + else { + const { x: i, y: s } = o || { x: 0, y: 0 }; + e instanceof HTMLImageElement || + e instanceof HTMLCanvasElement || + e instanceof HTMLVideoElement || + e instanceof ImageData || + t.isImageBitmap(e) + ? l.texSubImage2D(l.TEXTURE_2D, 0, i, s, l.RGBA, l.UNSIGNED_BYTE, e) + : l.texSubImage2D( + l.TEXTURE_2D, + 0, + i, + s, + a, + r, + l.RGBA, + l.UNSIGNED_BYTE, + e.data, + ); + } + this.useMipmap && + this.isSizePowerOfTwo() && + l.generateMipmap(l.TEXTURE_2D); + } + bind(t, e, i) { + const { context: o } = this, + { gl: a } = o; + a.bindTexture(a.TEXTURE_2D, this.texture), + i !== a.LINEAR_MIPMAP_NEAREST || + this.isSizePowerOfTwo() || + (i = a.LINEAR), + t !== this.filter && + (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, t), + a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, i || t), + (this.filter = t)), + e !== this.wrap && + (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, e), + a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, e), + (this.wrap = e)); + } + isSizePowerOfTwo() { + return ( + this.size[0] === this.size[1] && + (Math.log(this.size[0]) / Math.LN2) % 1 == 0 + ); + } + destroy() { + const { gl: t } = this.context; + t.deleteTexture(this.texture), (this.texture = null); + } + } + function c(t) { + const { userImage: e } = t; + return ( + !!(e && e.render && e.render()) && + (t.data.replace(new Uint8Array(e.data.buffer)), !0) + ); + } + class h extends t.Evented { + constructor() { + super(), + (this.images = {}), + (this.updatedImages = {}), + (this.callbackDispatchedThisFrame = {}), + (this.loaded = !1), + (this.requestors = []), + (this.patterns = {}), + (this.atlasImage = new t.RGBAImage({ width: 1, height: 1 })), + (this.dirty = !0); + } + isLoaded() { + return this.loaded; + } + setLoaded(t) { + if (this.loaded !== t && ((this.loaded = t), t)) { + for (const { ids: t, callback: e } of this.requestors) + this._notify(t, e); + this.requestors = []; + } + } + getImage(t) { + return this.images[t]; + } + addImage(t, e) { + if (this.images[t]) + throw new Error( + `Image id ${t} already exist, use updateImage instead`, + ); + this._validate(t, e) && (this.images[t] = e); + } + _validate(e, i) { + let o = !0; + return ( + this._validateStretch(i.stretchX, i.data && i.data.width) || + (this.fire( + new t.ErrorEvent( + new Error(`Image "${e}" has invalid "stretchX" value`), + ), + ), + (o = !1)), + this._validateStretch(i.stretchY, i.data && i.data.height) || + (this.fire( + new t.ErrorEvent( + new Error(`Image "${e}" has invalid "stretchY" value`), + ), + ), + (o = !1)), + this._validateContent(i.content, i) || + (this.fire( + new t.ErrorEvent( + new Error(`Image "${e}" has invalid "content" value`), + ), + ), + (o = !1)), + o + ); + } + _validateStretch(t, e) { + if (!t) return !0; + let i = 0; + for (const o of t) { + if (o[0] < i || o[1] < o[0] || e < o[1]) return !1; + i = o[1]; + } + return !0; + } + _validateContent(t, e) { + return !( + t && + (4 !== t.length || + t[0] < 0 || + e.data.width < t[0] || + t[1] < 0 || + e.data.height < t[1] || + t[2] < 0 || + e.data.width < t[2] || + t[3] < 0 || + e.data.height < t[3] || + t[2] < t[0] || + t[3] < t[1]) + ); + } + updateImage(t, e) { + const i = this.images[t]; + if (i.data.width !== e.data.width || i.data.height !== e.data.height) + throw new Error( + `size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${e.data.width}x${e.data.height}).`, + ); + (e.version = i.version + 1), + (this.images[t] = e), + (this.updatedImages[t] = !0); + } + removeImage(t) { + const e = this.images[t]; + delete this.images[t], + delete this.patterns[t], + e.userImage && e.userImage.onRemove && e.userImage.onRemove(); + } + listImages() { + return Object.keys(this.images); + } + getImages(t, e) { + let i = !0; + if (!this.isLoaded()) for (const e of t) this.images[e] || (i = !1); + this.isLoaded() || i + ? this._notify(t, e) + : this.requestors.push({ ids: t, callback: e }); + } + _notify(e, i) { + const o = {}; + for (const i of e) { + this.images[i] || + this.fire(new t.Event('styleimagemissing', { id: i })); + const e = this.images[i]; + e + ? (o[i] = { + data: e.data.clone(), + pixelRatio: e.pixelRatio, + sdf: e.sdf, + version: e.version, + stretchX: e.stretchX, + stretchY: e.stretchY, + content: e.content, + hasRenderCallback: Boolean(e.userImage && e.userImage.render), + }) + : t.warnOnce( + `Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`, + ); + } + i(null, o); + } + getPixelSize() { + const { width: t, height: e } = this.atlasImage; + return { width: t, height: e }; + } + getPattern(e) { + const i = this.patterns[e], + o = this.getImage(e); + if (!o) return null; + if (i && i.position.version === o.version) return i.position; + if (i) i.position.version = o.version; + else { + const i = { w: o.data.width + 2, h: o.data.height + 2, x: 0, y: 0 }, + a = new t.ImagePosition(i, o); + this.patterns[e] = { bin: i, position: a }; + } + return this._updatePatternAtlas(), this.patterns[e].position; + } + bind(t) { + const e = t.gl; + this.atlasTexture + ? this.dirty && + (this.atlasTexture.update(this.atlasImage), (this.dirty = !1)) + : (this.atlasTexture = new l(t, this.atlasImage, e.RGBA)), + this.atlasTexture.bind(e.LINEAR, e.CLAMP_TO_EDGE); + } + _updatePatternAtlas() { + const e = []; + for (const t in this.patterns) e.push(this.patterns[t].bin); + const { w: i, h: o } = t.potpack(e), + a = this.atlasImage; + a.resize({ width: i || 1, height: o || 1 }); + for (const e in this.patterns) { + const { bin: i } = this.patterns[e], + o = i.x + 1, + r = i.y + 1, + s = this.images[e].data, + n = s.width, + l = s.height; + t.RGBAImage.copy( + s, + a, + { x: 0, y: 0 }, + { x: o, y: r }, + { width: n, height: l }, + ), + t.RGBAImage.copy( + s, + a, + { x: 0, y: l - 1 }, + { x: o, y: r - 1 }, + { width: n, height: 1 }, + ), + t.RGBAImage.copy( + s, + a, + { x: 0, y: 0 }, + { x: o, y: r + l }, + { width: n, height: 1 }, + ), + t.RGBAImage.copy( + s, + a, + { x: n - 1, y: 0 }, + { x: o - 1, y: r }, + { width: 1, height: l }, + ), + t.RGBAImage.copy( + s, + a, + { x: 0, y: 0 }, + { x: o + n, y: r }, + { width: 1, height: l }, + ); + } + this.dirty = !0; + } + beginFrame() { + this.callbackDispatchedThisFrame = {}; + } + dispatchRenderCallbacks(e) { + for (const i of e) { + if (this.callbackDispatchedThisFrame[i]) continue; + this.callbackDispatchedThisFrame[i] = !0; + const e = this.images[i]; + e || t.warnOnce(`Image with ID: "${i}" was not found`), + c(e) && this.updateImage(i, e); + } + } + } + const u = 1e20; + function d(t, e, i, o, a, r, s, n, l) { + for (let c = e; c < e + o; c++) m(t, i * r + c, r, a, s, n, l); + for (let c = i; c < i + a; c++) m(t, c * r + e, 1, o, s, n, l); + } + function m(t, e, i, o, a, r, s) { + (r[0] = 0), (s[0] = -u), (s[1] = u), (a[0] = t[e]); + for (let n = 1, l = 0, c = 0; n < o; n++) { + a[n] = t[e + n * i]; + const o = n * n; + do { + const t = r[l]; + c = (a[n] - a[t] + o - t * t) / (n - t) / 2; + } while (c <= s[l] && --l > -1); + l++, (r[l] = n), (s[l] = c), (s[l + 1] = u); + } + for (let n = 0, l = 0; n < o; n++) { + for (; s[l + 1] < n; ) l++; + const o = r[l], + c = n - o; + t[e + n * i] = a[o] + c * c; + } + } + class _ { + constructor(t, e) { + (this.requestManager = t), + (this.localIdeographFontFamily = e), + (this.entries = {}); + } + setURL(t) { + this.url = t; + } + getGlyphs(e, i) { + const o = []; + for (const t in e) for (const i of e[t]) o.push({ stack: t, id: i }); + t.asyncAll( + o, + ({ stack: t, id: e }, i) => { + let o = this.entries[t]; + o || + (o = this.entries[t] = { glyphs: {}, requests: {}, ranges: {} }); + let a = o.glyphs[e]; + if (void 0 !== a) + return void i(null, { stack: t, id: e, glyph: a }); + if (((a = this._tinySDF(o, t, e)), a)) + return ( + (o.glyphs[e] = a), void i(null, { stack: t, id: e, glyph: a }) + ); + const r = Math.floor(e / 256); + if (256 * r > 65535) + return void i(new Error('glyphs > 65535 not supported')); + if (o.ranges[r]) return void i(null, { stack: t, id: e, glyph: a }); + let s = o.requests[r]; + s || + ((s = o.requests[r] = []), + _.loadGlyphRange(t, r, this.url, this.requestManager, (t, e) => { + if (e) { + for (const t in e) + this._doesCharSupportLocalGlyph(+t) || + (o.glyphs[+t] = e[+t]); + o.ranges[r] = !0; + } + for (const i of s) i(t, e); + delete o.requests[r]; + })), + s.push((o, a) => { + o + ? i(o) + : a && i(null, { stack: t, id: e, glyph: a[e] || null }); + }); + }, + (t, e) => { + if (t) i(t); + else if (e) { + const t = {}; + for (const { stack: i, id: o, glyph: a } of e) + (t[i] || (t[i] = {}))[o] = a && { + id: a.id, + bitmap: a.bitmap.clone(), + metrics: a.metrics, + }; + i(null, t); + } + }, + ); + } + _doesCharSupportLocalGlyph(e) { + return ( + !!this.localIdeographFontFamily && + (t.unicodeBlockLookup['CJK Unified Ideographs'](e) || + t.unicodeBlockLookup['Hangul Syllables'](e) || + t.unicodeBlockLookup.Hiragana(e) || + t.unicodeBlockLookup.Katakana(e)) + ); + } + _tinySDF(e, i, o) { + const a = this.localIdeographFontFamily; + if (!a) return; + if (!this._doesCharSupportLocalGlyph(o)) return; + let r = e.tinySDF; + if (!r) { + let t = '400'; + /bold/i.test(i) + ? (t = '900') + : /medium/i.test(i) + ? (t = '500') + : /light/i.test(i) && (t = '200'), + (r = e.tinySDF = + new _.TinySDF({ + fontSize: 24, + buffer: 3, + radius: 8, + cutoff: 0.25, + fontFamily: a, + fontWeight: t, + })); + } + const s = r.draw(String.fromCharCode(o)); + return { + id: o, + bitmap: new t.AlphaImage( + { width: s.width || 30, height: s.height || 30 }, + s.data, + ), + metrics: { + width: s.glyphWidth || 24, + height: s.glyphHeight || 24, + left: s.glyphLeft || 0, + top: s.glyphTop - 27 || -8, + advance: s.glyphAdvance || 24, + }, + }; + } + } + (_.loadGlyphRange = function (e, i, o, a, r) { + const s = 256 * i, + n = s + 255, + l = a.transformRequest( + o.replace('{fontstack}', e).replace('{range}', `${s}-${n}`), + t.ResourceType.Glyphs, + ); + t.getArrayBuffer(l, (e, i) => { + if (e) r(e); + else if (i) { + const e = {}; + for (const o of t.parseGlyphPbf(i)) e[o.id] = o; + r(null, e); + } + }); + }), + (_.TinySDF = class { + constructor({ + fontSize: t = 24, + buffer: e = 3, + radius: i = 8, + cutoff: o = 0.25, + fontFamily: a = 'sans-serif', + fontWeight: r = 'normal', + fontStyle: s = 'normal', + } = {}) { + (this.buffer = e), (this.cutoff = o), (this.radius = i); + const n = (this.size = t + 4 * e), + l = this._createCanvas(n), + c = (this.ctx = l.getContext('2d', { willReadFrequently: !0 })); + (c.font = `${s} ${r} ${t}px ${a}`), + (c.textBaseline = 'alphabetic'), + (c.textAlign = 'left'), + (c.fillStyle = 'black'), + (this.gridOuter = new Float64Array(n * n)), + (this.gridInner = new Float64Array(n * n)), + (this.f = new Float64Array(n)), + (this.z = new Float64Array(n + 1)), + (this.v = new Uint16Array(n)); + } + _createCanvas(t) { + const e = document.createElement('canvas'); + return (e.width = e.height = t), e; + } + draw(t) { + const { + width: e, + actualBoundingBoxAscent: i, + actualBoundingBoxDescent: o, + actualBoundingBoxLeft: a, + actualBoundingBoxRight: r, + } = this.ctx.measureText(t), + s = Math.ceil(i), + n = Math.min(this.size - this.buffer, Math.ceil(r - a)), + l = Math.min(this.size - this.buffer, s + Math.ceil(o)), + c = n + 2 * this.buffer, + h = l + 2 * this.buffer, + m = Math.max(c * h, 0), + _ = new Uint8ClampedArray(m), + p = { + data: _, + width: c, + height: h, + glyphWidth: n, + glyphHeight: l, + glyphTop: s, + glyphLeft: 0, + glyphAdvance: e, + }; + if (0 === n || 0 === l) return p; + const { ctx: f, buffer: g, gridInner: x, gridOuter: v } = this; + f.clearRect(g, g, n, l), f.fillText(t, g, g + s); + const y = f.getImageData(g, g, n, l); + v.fill(u, 0, m), x.fill(0, 0, m); + for (let t = 0; t < l; t++) + for (let e = 0; e < n; e++) { + const i = y.data[4 * (t * n + e) + 3] / 255; + if (0 === i) continue; + const o = (t + g) * c + e + g; + if (1 === i) (v[o] = 0), (x[o] = u); + else { + const t = 0.5 - i; + (v[o] = t > 0 ? t * t : 0), (x[o] = t < 0 ? t * t : 0); + } + } + d(v, 0, 0, c, h, c, this.f, this.v, this.z), + d(x, g, g, n, l, c, this.f, this.v, this.z); + for (let t = 0; t < m; t++) { + const e = Math.sqrt(v[t]) - Math.sqrt(x[t]); + _[t] = Math.round(255 - 255 * (e / this.radius + this.cutoff)); + } + return p; + } + }); + const p = new t.Properties({ + anchor: new t.DataConstantProperty(t.spec.light.anchor), + position: new (class { + constructor() { + this.specification = t.spec.light.position; + } + possiblyEvaluate(e, i) { + return t.sphericalToCartesian(e.expression.evaluate(i)); + } + interpolate(e, i, o) { + return { + x: t.number(e.x, i.x, o), + y: t.number(e.y, i.y, o), + z: t.number(e.z, i.z, o), + }; + } + })(), + color: new t.DataConstantProperty(t.spec.light.color), + intensity: new t.DataConstantProperty(t.spec.light.intensity), + }), + f = '-transition'; + class g extends t.Evented { + constructor(e) { + super(), + (this._transitionable = new t.Transitionable(p)), + this.setLight(e), + (this._transitioning = this._transitionable.untransitioned()); + } + getLight() { + return this._transitionable.serialize(); + } + setLight(e, i = {}) { + if (!this._validate(t.validateLight, e, i)) + for (const t in e) { + const i = e[t]; + t.endsWith(f) + ? this._transitionable.setTransition(t.slice(0, -f.length), i) + : this._transitionable.setValue(t, i); + } + } + updateTransitions(t) { + this._transitioning = this._transitionable.transitioned( + t, + this._transitioning, + ); + } + hasTransition() { + return this._transitioning.hasTransition(); + } + recalculate(t) { + this.properties = this._transitioning.possiblyEvaluate(t); + } + _validate(e, i, o) { + return ( + (!o || !1 !== o.validate) && + t.emitValidationErrors( + this, + e.call( + t.validateStyle, + t.extend({ + value: i, + style: { glyphs: !0, sprite: !0 }, + styleSpec: t.spec, + }), + ), + ) + ); + } + } + class x { + constructor(t, e) { + (this.width = t), + (this.height = e), + (this.nextRow = 0), + (this.data = new Uint8Array(this.width * this.height)), + (this.dashEntry = {}); + } + getDash(t, e) { + const i = t.join(',') + String(e); + return ( + this.dashEntry[i] || (this.dashEntry[i] = this.addDash(t, e)), + this.dashEntry[i] + ); + } + getDashRanges(t, e, i) { + const o = []; + let a = t.length % 2 == 1 ? -t[t.length - 1] * i : 0, + r = t[0] * i, + s = !0; + o.push({ left: a, right: r, isDash: s, zeroLength: 0 === t[0] }); + let n = t[0]; + for (let e = 1; e < t.length; e++) { + s = !s; + const l = t[e]; + (a = n * i), + (n += l), + (r = n * i), + o.push({ left: a, right: r, isDash: s, zeroLength: 0 === l }); + } + return o; + } + addRoundDash(t, e, i) { + const o = e / 2; + for (let e = -i; e <= i; e++) { + const a = this.width * (this.nextRow + i + e); + let r = 0, + s = t[r]; + for (let n = 0; n < this.width; n++) { + n / s.right > 1 && (s = t[++r]); + const l = Math.abs(n - s.left), + c = Math.abs(n - s.right), + h = Math.min(l, c); + let u; + const d = (e / i) * (o + 1); + if (s.isDash) { + const t = o - Math.abs(d); + u = Math.sqrt(h * h + t * t); + } else u = o - Math.sqrt(h * h + d * d); + this.data[a + n] = Math.max(0, Math.min(255, u + 128)); + } + } + } + addRegularDash(t) { + for (let e = t.length - 1; e >= 0; --e) { + const i = t[e], + o = t[e + 1]; + i.zeroLength + ? t.splice(e, 1) + : o && o.isDash === i.isDash && ((o.left = i.left), t.splice(e, 1)); + } + const e = t[0], + i = t[t.length - 1]; + e.isDash === i.isDash && + ((e.left = i.left - this.width), (i.right = e.right + this.width)); + const o = this.width * this.nextRow; + let a = 0, + r = t[a]; + for (let e = 0; e < this.width; e++) { + e / r.right > 1 && (r = t[++a]); + const i = Math.abs(e - r.left), + s = Math.abs(e - r.right), + n = Math.min(i, s); + this.data[o + e] = Math.max( + 0, + Math.min(255, (r.isDash ? n : -n) + 128), + ); + } + } + addDash(e, i) { + const o = i ? 7 : 0, + a = 2 * o + 1; + if (this.nextRow + a > this.height) + return t.warnOnce('LineAtlas out of space'), null; + let r = 0; + for (let t = 0; t < e.length; t++) r += e[t]; + if (0 !== r) { + const t = this.width / r, + a = this.getDashRanges(e, this.width, t); + i ? this.addRoundDash(a, t, o) : this.addRegularDash(a); + } + const s = { + y: (this.nextRow + o + 0.5) / this.height, + height: (2 * o) / this.height, + width: r, + }; + return (this.nextRow += a), (this.dirty = !0), s; + } + bind(t) { + const e = t.gl; + this.texture + ? (e.bindTexture(e.TEXTURE_2D, this.texture), + this.dirty && + ((this.dirty = !1), + e.texSubImage2D( + e.TEXTURE_2D, + 0, + 0, + 0, + this.width, + this.height, + e.ALPHA, + e.UNSIGNED_BYTE, + this.data, + ))) + : ((this.texture = e.createTexture()), + e.bindTexture(e.TEXTURE_2D, this.texture), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), + e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), + e.texImage2D( + e.TEXTURE_2D, + 0, + e.ALPHA, + this.width, + this.height, + 0, + e.ALPHA, + e.UNSIGNED_BYTE, + this.data, + )); + } + } + class v { + constructor(e, i) { + (this.workerPool = e), + (this.actors = []), + (this.currentActor = 0), + (this.id = t.uniqueId()); + const o = this.workerPool.acquire(this.id); + for (let t = 0; t < o.length; t++) { + const e = new v.Actor(o[t], i, this.id); + (e.name = `Worker ${t}`), this.actors.push(e); + } + if (!this.actors.length) throw new Error('No actors found'); + } + broadcast(e, i, o) { + t.asyncAll( + this.actors, + (t, o) => { + t.send(e, i, o); + }, + (o = o || function () {}), + ); + } + getActor() { + return ( + (this.currentActor = (this.currentActor + 1) % this.actors.length), + this.actors[this.currentActor] + ); + } + remove() { + this.actors.forEach((t) => { + t.remove(); + }), + (this.actors = []), + this.workerPool.release(this.id); + } + } + function y(e, i, o) { + const a = function (i, a) { + if (i) return o(i); + if (a) { + const i = t.pick(t.extend(a, e), [ + 'tiles', + 'minzoom', + 'maxzoom', + 'attribution', + 'bounds', + 'scheme', + 'tileSize', + 'encoding', + ]); + a.vector_layers && + ((i.vectorLayers = a.vector_layers), + (i.vectorLayerIds = i.vectorLayers.map((t) => t.id))), + o(null, i); + } + }; + return e.url + ? t.getJSON(i.transformRequest(e.url, t.ResourceType.Source), a) + : t.exported.frame(() => a(null, e)); + } + v.Actor = t.Actor; + class b { + constructor(e, i, o) { + (this.bounds = t.LngLatBounds.convert(this.validateBounds(e))), + (this.minzoom = i || 0), + (this.maxzoom = o || 24); + } + validateBounds(t) { + return Array.isArray(t) && 4 === t.length + ? [ + Math.max(-180, t[0]), + Math.max(-90, t[1]), + Math.min(180, t[2]), + Math.min(90, t[3]), + ] + : [-180, -90, 180, 90]; + } + contains(e) { + const i = Math.pow(2, e.z), + o = Math.floor(t.mercatorXfromLng(this.bounds.getWest()) * i), + a = Math.floor(t.mercatorYfromLat(this.bounds.getNorth()) * i), + r = Math.ceil(t.mercatorXfromLng(this.bounds.getEast()) * i), + s = Math.ceil(t.mercatorYfromLat(this.bounds.getSouth()) * i); + return e.x >= o && e.x < r && e.y >= a && e.y < s; + } + } + class w extends t.Evented { + constructor(e, i, o, a) { + if ( + (super(), + (this.id = e), + (this.dispatcher = o), + (this.type = 'vector'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.scheme = 'xyz'), + (this.tileSize = 512), + (this.reparseOverscaled = !0), + (this.isTileClipped = !0), + (this._loaded = !1), + t.extend(this, t.pick(i, ['url', 'scheme', 'tileSize', 'promoteId'])), + (this._options = t.extend({ type: 'vector' }, i)), + (this._collectResourceTiming = i.collectResourceTiming), + 512 !== this.tileSize) + ) + throw new Error('vector tile sources must have a tileSize of 512'); + this.setEventedParent(a); + } + load() { + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this._tileJSONRequest = y( + this._options, + this.map._requestManager, + (e, i) => { + (this._tileJSONRequest = null), + (this._loaded = !0), + this.map.style.sourceCaches[this.id].clearTiles(), + e + ? this.fire(new t.ErrorEvent(e)) + : i && + (t.extend(this, i), + i.bounds && + (this.tileBounds = new b( + i.bounds, + this.minzoom, + this.maxzoom, + )), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + ), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + )); + }, + )); + } + loaded() { + return this._loaded; + } + hasTile(t) { + return !this.tileBounds || this.tileBounds.contains(t.canonical); + } + onAdd(t) { + (this.map = t), this.load(); + } + setSourceProperty(t) { + this._tileJSONRequest && this._tileJSONRequest.cancel(), + t(), + this.load(); + } + setTiles(t) { + return ( + this.setSourceProperty(() => { + this._options.tiles = t; + }), + this + ); + } + setUrl(t) { + return ( + this.setSourceProperty(() => { + (this.url = t), (this._options.url = t); + }), + this + ); + } + onRemove() { + this._tileJSONRequest && + (this._tileJSONRequest.cancel(), (this._tileJSONRequest = null)); + } + serialize() { + return t.extend({}, this._options); + } + loadTile(e, i) { + const o = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ), + a = { + request: this.map._requestManager.transformRequest( + o, + t.ResourceType.Tile, + ), + uid: e.uid, + tileID: e.tileID, + zoom: e.tileID.overscaledZ, + tileSize: this.tileSize * e.tileID.overscaleFactor(), + type: this.type, + source: this.id, + pixelRatio: this.map.getPixelRatio(), + showCollisionBoxes: this.map.showCollisionBoxes, + promoteId: this.promoteId, + }; + function r(o, a) { + return ( + delete e.request, + e.aborted + ? i(null) + : o && 404 !== o.status + ? i(o) + : (a && a.resourceTiming && (e.resourceTiming = a.resourceTiming), + this.map._refreshExpiredTiles && a && e.setExpiryData(a), + e.loadVectorData(a, this.map.painter), + t.cacheEntryPossiblyAdded(this.dispatcher), + i(null), + void ( + e.reloadCallback && + (this.loadTile(e, e.reloadCallback), + (e.reloadCallback = null)) + )) + ); + } + (a.request.collectResourceTiming = this._collectResourceTiming), + e.actor && 'expired' !== e.state + ? 'loading' === e.state + ? (e.reloadCallback = i) + : (e.request = e.actor.send('reloadTile', a, r.bind(this))) + : ((e.actor = this.dispatcher.getActor()), + (e.request = e.actor.send('loadTile', a, r.bind(this)))); + } + abortTile(t) { + t.request && (t.request.cancel(), delete t.request), + t.actor && + t.actor.send( + 'abortTile', + { uid: t.uid, type: this.type, source: this.id }, + void 0, + ); + } + unloadTile(t) { + t.unloadVectorData(), + t.actor && + t.actor.send( + 'removeTile', + { uid: t.uid, type: this.type, source: this.id }, + void 0, + ); + } + hasTransition() { + return !1; + } + } + class T extends t.Evented { + constructor(e, i, o, a) { + super(), + (this.id = e), + (this.dispatcher = o), + this.setEventedParent(a), + (this.type = 'raster'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.roundZoom = !0), + (this.scheme = 'xyz'), + (this.tileSize = 512), + (this._loaded = !1), + (this._options = t.extend({ type: 'raster' }, i)), + t.extend(this, t.pick(i, ['url', 'scheme', 'tileSize'])); + } + load() { + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this._tileJSONRequest = y( + this._options, + this.map._requestManager, + (e, i) => { + (this._tileJSONRequest = null), + (this._loaded = !0), + e + ? this.fire(new t.ErrorEvent(e)) + : i && + (t.extend(this, i), + i.bounds && + (this.tileBounds = new b( + i.bounds, + this.minzoom, + this.maxzoom, + )), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + ), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + )); + }, + )); + } + loaded() { + return this._loaded; + } + onAdd(t) { + (this.map = t), this.load(); + } + onRemove() { + this._tileJSONRequest && + (this._tileJSONRequest.cancel(), (this._tileJSONRequest = null)); + } + serialize() { + return t.extend({}, this._options); + } + hasTile(t) { + return !this.tileBounds || this.tileBounds.contains(t.canonical); + } + loadTile(e, i) { + const o = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ); + e.request = t.getImage( + this.map._requestManager.transformRequest(o, t.ResourceType.Tile), + (o, a, r) => { + if ((delete e.request, e.aborted)) (e.state = 'unloaded'), i(null); + else if (o) (e.state = 'errored'), i(o); + else if (a) { + this.map._refreshExpiredTiles && e.setExpiryData(r); + const o = this.map.painter.context, + s = o.gl; + (e.texture = this.map.painter.getTileTexture(a.width)), + e.texture + ? e.texture.update(a, { useMipmap: !0 }) + : ((e.texture = new l(o, a, s.RGBA, { useMipmap: !0 })), + e.texture.bind( + s.LINEAR, + s.CLAMP_TO_EDGE, + s.LINEAR_MIPMAP_NEAREST, + ), + o.extTextureFilterAnisotropic && + s.texParameterf( + s.TEXTURE_2D, + o.extTextureFilterAnisotropic + .TEXTURE_MAX_ANISOTROPY_EXT, + o.extTextureFilterAnisotropicMax, + )), + (e.state = 'loaded'), + t.cacheEntryPossiblyAdded(this.dispatcher), + i(null); + } + }, + ); + } + abortTile(t, e) { + t.request && (t.request.cancel(), delete t.request), e(); + } + unloadTile(t, e) { + t.texture && this.map.painter.saveTileTexture(t.texture), e(); + } + hasTransition() { + return !1; + } + } + let E; + class I extends T { + constructor(e, i, o, a) { + super(e, i, o, a), + (this.type = 'raster-dem'), + (this.maxzoom = 22), + (this._options = t.extend({ type: 'raster-dem' }, i)), + (this.encoding = i.encoding || 'mapbox'); + } + serialize() { + return { + type: 'raster-dem', + url: this.url, + tileSize: this.tileSize, + tiles: this.tiles, + bounds: this.bounds, + encoding: this.encoding, + }; + } + loadTile(e, i) { + const o = e.tileID.canonical.url( + this.tiles, + this.map.getPixelRatio(), + this.scheme, + ); + function a(t, o) { + t && ((e.state = 'errored'), i(t)), + o && + ((e.dem = o), + (e.needsHillshadePrepare = !0), + (e.needsTerrainPrepare = !0), + (e.state = 'loaded'), + i(null)); + } + (e.request = t.getImage( + this.map._requestManager.transformRequest(o, t.ResourceType.Tile), + function (o, r) { + if ((delete e.request, e.aborted)) (e.state = 'unloaded'), i(null); + else if (o) (e.state = 'errored'), i(o); + else if (r) { + this.map._refreshExpiredTiles && e.setExpiryData(r), + delete r.cacheControl, + delete r.expires; + const i = + t.isImageBitmap(r) && + (null == E && + (E = + 'undefined' != typeof OffscreenCanvas && + new OffscreenCanvas(1, 1).getContext('2d') && + 'function' == typeof createImageBitmap), + E) + ? r + : t.exported.getImageData(r, 1), + o = { + uid: e.uid, + coord: e.tileID, + source: this.id, + rawImageData: i, + encoding: this.encoding, + }; + (e.actor && 'expired' !== e.state) || + ((e.actor = this.dispatcher.getActor()), + e.actor.send('loadDEMTile', o, a.bind(this))); + } + }.bind(this), + )), + (e.neighboringTiles = this._getNeighboringTiles(e.tileID)); + } + _getNeighboringTiles(e) { + const i = e.canonical, + o = Math.pow(2, i.z), + a = (i.x - 1 + o) % o, + r = 0 === i.x ? e.wrap - 1 : e.wrap, + s = (i.x + 1 + o) % o, + n = i.x + 1 === o ? e.wrap + 1 : e.wrap, + l = {}; + return ( + (l[new t.OverscaledTileID(e.overscaledZ, r, i.z, a, i.y).key] = { + backfilled: !1, + }), + (l[new t.OverscaledTileID(e.overscaledZ, n, i.z, s, i.y).key] = { + backfilled: !1, + }), + i.y > 0 && + ((l[new t.OverscaledTileID(e.overscaledZ, r, i.z, a, i.y - 1).key] = + { backfilled: !1 }), + (l[ + new t.OverscaledTileID( + e.overscaledZ, + e.wrap, + i.z, + i.x, + i.y - 1, + ).key + ] = { backfilled: !1 }), + (l[new t.OverscaledTileID(e.overscaledZ, n, i.z, s, i.y - 1).key] = + { backfilled: !1 })), + i.y + 1 < o && + ((l[new t.OverscaledTileID(e.overscaledZ, r, i.z, a, i.y + 1).key] = + { backfilled: !1 }), + (l[ + new t.OverscaledTileID( + e.overscaledZ, + e.wrap, + i.z, + i.x, + i.y + 1, + ).key + ] = { backfilled: !1 }), + (l[new t.OverscaledTileID(e.overscaledZ, n, i.z, s, i.y + 1).key] = + { backfilled: !1 })), + l + ); + } + unloadTile(t) { + t.demTexture && this.map.painter.saveTileTexture(t.demTexture), + t.fbo && (t.fbo.destroy(), delete t.fbo), + t.dem && delete t.dem, + delete t.neighboringTiles, + (t.state = 'unloaded'), + t.actor && + t.actor.send('removeDEMTile', { uid: t.uid, source: this.id }); + } + } + class C extends t.Evented { + constructor(e, i, o, a) { + super(), + (this.id = e), + (this.type = 'geojson'), + (this.minzoom = 0), + (this.maxzoom = 18), + (this.tileSize = 512), + (this.isTileClipped = !0), + (this.reparseOverscaled = !0), + (this._removed = !1), + (this._pendingLoads = 0), + (this.actor = o.getActor()), + this.setEventedParent(a), + (this._data = i.data), + (this._options = t.extend({}, i)), + (this._collectResourceTiming = i.collectResourceTiming), + void 0 !== i.maxzoom && (this.maxzoom = i.maxzoom), + i.type && (this.type = i.type), + i.attribution && (this.attribution = i.attribution), + (this.promoteId = i.promoteId); + const r = t.EXTENT / this.tileSize; + this.workerOptions = t.extend( + { + source: this.id, + cluster: i.cluster || !1, + geojsonVtOptions: { + buffer: (void 0 !== i.buffer ? i.buffer : 128) * r, + tolerance: (void 0 !== i.tolerance ? i.tolerance : 0.375) * r, + extent: t.EXTENT, + maxZoom: this.maxzoom, + lineMetrics: i.lineMetrics || !1, + generateId: i.generateId || !1, + }, + superclusterOptions: { + maxZoom: + void 0 !== i.clusterMaxZoom + ? i.clusterMaxZoom + : this.maxzoom - 1, + minPoints: Math.max(2, i.clusterMinPoints || 2), + extent: t.EXTENT, + radius: (i.clusterRadius || 50) * r, + log: !1, + generateId: i.generateId || !1, + }, + clusterProperties: i.clusterProperties, + filter: i.filter, + }, + i.workerOptions, + ); + } + load() { + this._updateWorkerData('metadata'); + } + onAdd(t) { + (this.map = t), this.load(); + } + setData(t) { + return (this._data = t), this._updateWorkerData('content'), this; + } + getClusterExpansionZoom(t, e) { + return ( + this.actor.send( + 'geojson.getClusterExpansionZoom', + { clusterId: t, source: this.id }, + e, + ), + this + ); + } + getClusterChildren(t, e) { + return ( + this.actor.send( + 'geojson.getClusterChildren', + { clusterId: t, source: this.id }, + e, + ), + this + ); + } + getClusterLeaves(t, e, i, o) { + return ( + this.actor.send( + 'geojson.getClusterLeaves', + { source: this.id, clusterId: t, limit: e, offset: i }, + o, + ), + this + ); + } + _updateWorkerData(e) { + const i = t.extend({}, this.workerOptions), + o = this._data; + 'string' == typeof o + ? ((i.request = this.map._requestManager.transformRequest( + t.exported.resolveURL(o), + t.ResourceType.Source, + )), + (i.request.collectResourceTiming = this._collectResourceTiming)) + : (i.data = JSON.stringify(o)), + this._pendingLoads++, + this.fire(new t.Event('dataloading', { dataType: 'source' })), + this.actor.send(`${this.type}.loadData`, i, (i, o) => { + if ((this._pendingLoads--, this._removed || (o && o.abandoned))) + return void this.fire( + new t.Event('dataabort', { + dataType: 'source', + sourceDataType: e, + }), + ); + let a = null; + if ( + (o && + o.resourceTiming && + o.resourceTiming[this.id] && + (a = o.resourceTiming[this.id].slice(0)), + i) + ) + return void this.fire(new t.ErrorEvent(i)); + const r = { dataType: 'source', sourceDataType: e }; + this._collectResourceTiming && + a && + a.length > 0 && + t.extend(r, { resourceTiming: a }), + this.fire(new t.Event('data', r)); + }); + } + loaded() { + return 0 === this._pendingLoads; + } + loadTile(t, e) { + const i = t.actor ? 'reloadTile' : 'loadTile'; + t.actor = this.actor; + const o = { + type: this.type, + uid: t.uid, + tileID: t.tileID, + zoom: t.tileID.overscaledZ, + maxZoom: this.maxzoom, + tileSize: this.tileSize, + source: this.id, + pixelRatio: this.map.getPixelRatio(), + showCollisionBoxes: this.map.showCollisionBoxes, + promoteId: this.promoteId, + }; + t.request = this.actor.send( + i, + o, + (o, a) => ( + delete t.request, + t.unloadVectorData(), + t.aborted + ? e(null) + : o + ? e(o) + : (t.loadVectorData(a, this.map.painter, 'reloadTile' === i), + e(null)) + ), + ); + } + abortTile(t) { + t.request && (t.request.cancel(), delete t.request), (t.aborted = !0); + } + unloadTile(t) { + t.unloadVectorData(), + this.actor.send('removeTile', { + uid: t.uid, + type: this.type, + source: this.id, + }); + } + onRemove() { + (this._removed = !0), + this.actor.send('removeSource', { type: this.type, source: this.id }); + } + serialize() { + return t.extend({}, this._options, { + type: this.type, + data: this._data, + }); + } + hasTransition() { + return !1; + } + } + var S = t.createLayout([ + { name: 'a_pos', type: 'Int16', components: 2 }, + { name: 'a_texture_pos', type: 'Int16', components: 2 }, + ]); + class D extends t.Evented { + constructor(t, e, i, o) { + super(), + (this.id = t), + (this.dispatcher = i), + (this.coordinates = e.coordinates), + (this.type = 'image'), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.tileSize = 512), + (this.tiles = {}), + (this._loaded = !1), + this.setEventedParent(o), + (this.options = e); + } + load(e, i) { + (this._loaded = !1), + this.fire(new t.Event('dataloading', { dataType: 'source' })), + (this.url = this.options.url), + t.getImage( + this.map._requestManager.transformRequest( + this.url, + t.ResourceType.Image, + ), + (o, a) => { + (this._loaded = !0), + o + ? this.fire(new t.ErrorEvent(o)) + : a && + ((this.image = a), + e && (this.coordinates = e), + i && i(), + this._finishLoading()); + }, + ); + } + loaded() { + return this._loaded; + } + updateImage(t) { + return this.image && t.url + ? ((this.options.url = t.url), + this.load(t.coordinates, () => { + this.texture = null; + }), + this) + : this; + } + _finishLoading() { + this.map && + (this.setCoordinates(this.coordinates), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'metadata', + }), + )); + } + onAdd(t) { + (this.map = t), this.load(); + } + setCoordinates(e) { + this.coordinates = e; + const i = e.map(t.MercatorCoordinate.fromLngLat); + (this.tileID = (function (e) { + let i = 1 / 0, + o = 1 / 0, + a = -1 / 0, + r = -1 / 0; + for (const t of e) + (i = Math.min(i, t.x)), + (o = Math.min(o, t.y)), + (a = Math.max(a, t.x)), + (r = Math.max(r, t.y)); + const s = Math.max(a - i, r - o), + n = Math.max(0, Math.floor(-Math.log(s) / Math.LN2)), + l = Math.pow(2, n); + return new t.CanonicalTileID( + n, + Math.floor(((i + a) / 2) * l), + Math.floor(((o + r) / 2) * l), + ); + })(i)), + (this.minzoom = this.maxzoom = this.tileID.z); + const o = i.map((t) => this.tileID.getTilePoint(t)._round()); + return ( + (this._boundsArray = new t.RasterBoundsArray()), + this._boundsArray.emplaceBack(o[0].x, o[0].y, 0, 0), + this._boundsArray.emplaceBack(o[1].x, o[1].y, t.EXTENT, 0), + this._boundsArray.emplaceBack(o[3].x, o[3].y, 0, t.EXTENT), + this._boundsArray.emplaceBack(o[2].x, o[2].y, t.EXTENT, t.EXTENT), + this.boundsBuffer && + (this.boundsBuffer.destroy(), delete this.boundsBuffer), + this.fire( + new t.Event('data', { + dataType: 'source', + sourceDataType: 'content', + }), + ), + this + ); + } + prepare() { + if (0 === Object.keys(this.tiles).length || !this.image) return; + const e = this.map.painter.context, + i = e.gl; + this.boundsBuffer || + (this.boundsBuffer = e.createVertexBuffer( + this._boundsArray, + S.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), + this.texture || + ((this.texture = new l(e, this.image, i.RGBA)), + this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)); + for (const t in this.tiles) { + const e = this.tiles[t]; + 'loaded' !== e.state && + ((e.state = 'loaded'), (e.texture = this.texture)); + } + } + loadTile(t, e) { + this.tileID && this.tileID.equals(t.tileID.canonical) + ? ((this.tiles[String(t.tileID.wrap)] = t), (t.buckets = {}), e(null)) + : ((t.state = 'errored'), e(null)); + } + serialize() { + return { + type: 'image', + url: this.options.url, + coordinates: this.coordinates, + }; + } + hasTransition() { + return !1; + } + } + class z extends D { + constructor(t, e, i, o) { + super(t, e, i, o), + (this.roundZoom = !0), + (this.type = 'video'), + (this.options = e); + } + load() { + this._loaded = !1; + const e = this.options; + this.urls = []; + for (const i of e.urls) + this.urls.push( + this.map._requestManager.transformRequest(i, t.ResourceType.Source) + .url, + ); + t.getVideo(this.urls, (e, i) => { + (this._loaded = !0), + e + ? this.fire(new t.ErrorEvent(e)) + : i && + ((this.video = i), + (this.video.loop = !0), + this.video.addEventListener('playing', () => { + this.map.triggerRepaint(); + }), + this.map && this.video.play(), + this._finishLoading()); + }); + } + pause() { + this.video && this.video.pause(); + } + play() { + this.video && this.video.play(); + } + seek(e) { + if (this.video) { + const i = this.video.seekable; + e < i.start(0) || e > i.end(0) + ? this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${this.id}`, + null, + `Playback for this video can be set only between the ${i.start( + 0, + )} and ${i.end(0)}-second mark.`, + ), + ), + ) + : (this.video.currentTime = e); + } + } + getVideo() { + return this.video; + } + onAdd(t) { + this.map || + ((this.map = t), + this.load(), + this.video && + (this.video.play(), this.setCoordinates(this.coordinates))); + } + prepare() { + if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) + return; + const e = this.map.painter.context, + i = e.gl; + this.boundsBuffer || + (this.boundsBuffer = e.createVertexBuffer( + this._boundsArray, + S.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), + this.texture + ? this.video.paused || + (this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE), + i.texSubImage2D( + i.TEXTURE_2D, + 0, + 0, + 0, + i.RGBA, + i.UNSIGNED_BYTE, + this.video, + )) + : ((this.texture = new l(e, this.video, i.RGBA)), + this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)); + for (const t in this.tiles) { + const e = this.tiles[t]; + 'loaded' !== e.state && + ((e.state = 'loaded'), (e.texture = this.texture)); + } + } + serialize() { + return { + type: 'video', + urls: this.urls, + coordinates: this.coordinates, + }; + } + hasTransition() { + return this.video && !this.video.paused; + } + } + class P extends D { + constructor(e, i, o, a) { + super(e, i, o, a), + i.coordinates + ? (Array.isArray(i.coordinates) && + 4 === i.coordinates.length && + !i.coordinates.some( + (t) => + !Array.isArray(t) || + 2 !== t.length || + t.some((t) => 'number' != typeof t), + )) || + this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${e}`, + null, + '"coordinates" property must be an array of 4 longitude/latitude array pairs', + ), + ), + ) + : this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${e}`, + null, + 'missing required property "coordinates"', + ), + ), + ), + i.animate && + 'boolean' != typeof i.animate && + this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${e}`, + null, + 'optional "animate" property must be a boolean value', + ), + ), + ), + i.canvas + ? 'string' == typeof i.canvas || + i.canvas instanceof HTMLCanvasElement || + this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${e}`, + null, + '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance', + ), + ), + ) + : this.fire( + new t.ErrorEvent( + new t.ValidationError( + `sources.${e}`, + null, + 'missing required property "canvas"', + ), + ), + ), + (this.options = i), + (this.animate = void 0 === i.animate || i.animate); + } + load() { + (this._loaded = !0), + this.canvas || + (this.canvas = + this.options.canvas instanceof HTMLCanvasElement + ? this.options.canvas + : document.getElementById(this.options.canvas)), + (this.width = this.canvas.width), + (this.height = this.canvas.height), + this._hasInvalidDimensions() + ? this.fire( + new t.ErrorEvent( + new Error( + 'Canvas dimensions cannot be less than or equal to zero.', + ), + ), + ) + : ((this.play = function () { + (this._playing = !0), this.map.triggerRepaint(); + }), + (this.pause = function () { + this._playing && (this.prepare(), (this._playing = !1)); + }), + this._finishLoading()); + } + getCanvas() { + return this.canvas; + } + onAdd(t) { + (this.map = t), this.load(), this.canvas && this.animate && this.play(); + } + onRemove() { + this.pause(); + } + prepare() { + let e = !1; + if ( + (this.canvas.width !== this.width && + ((this.width = this.canvas.width), (e = !0)), + this.canvas.height !== this.height && + ((this.height = this.canvas.height), (e = !0)), + this._hasInvalidDimensions()) + ) + return; + if (0 === Object.keys(this.tiles).length) return; + const i = this.map.painter.context, + o = i.gl; + this.boundsBuffer || + (this.boundsBuffer = i.createVertexBuffer( + this._boundsArray, + S.members, + )), + this.boundsSegments || + (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), + this.texture + ? (e || this._playing) && + this.texture.update(this.canvas, { premultiply: !0 }) + : (this.texture = new l(i, this.canvas, o.RGBA, { + premultiply: !0, + })); + for (const t in this.tiles) { + const e = this.tiles[t]; + 'loaded' !== e.state && + ((e.state = 'loaded'), (e.texture = this.texture)); + } + } + serialize() { + return { type: 'canvas', coordinates: this.coordinates }; + } + hasTransition() { + return this._playing; + } + _hasInvalidDimensions() { + for (const t of [this.canvas.width, this.canvas.height]) + if (isNaN(t) || t <= 0) return !0; + return !1; + } + } + const M = { + vector: w, + raster: T, + 'raster-dem': I, + geojson: C, + video: z, + image: D, + canvas: P, + }; + function A(e, i) { + const o = t.create(); + return ( + t.translate(o, o, [1, 1, 0]), + t.scale(o, o, [0.5 * e.width, 0.5 * e.height, 1]), + t.multiply(o, o, e.calculatePosMatrix(i.toUnwrapped())) + ); + } + function L(t, e, i, o, a, r) { + const s = (function (t, e, i) { + if (t) + for (const o of t) { + const t = e[o]; + if (t && t.source === i && 'fill-extrusion' === t.type) return !0; + } + else + for (const t in e) { + const o = e[t]; + if (o.source === i && 'fill-extrusion' === o.type) return !0; + } + return !1; + })(a && a.layers, e, t.id), + n = r.maxPitchScaleFactor(), + l = t.tilesIn(o, n, s); + l.sort(R); + const c = []; + for (const o of l) + c.push({ + wrappedTileID: o.tileID.wrapped().key, + queryResults: o.tile.queryRenderedFeatures( + e, + i, + t._state, + o.queryGeometry, + o.cameraQueryGeometry, + o.scale, + a, + r, + n, + A(t.transform, o.tileID), + ), + }); + const h = (function (t) { + const e = {}, + i = {}; + for (const o of t) { + const t = o.queryResults, + a = o.wrappedTileID, + r = (i[a] = i[a] || {}); + for (const i in t) { + const o = t[i], + a = (r[i] = r[i] || {}), + s = (e[i] = e[i] || []); + for (const t of o) + a[t.featureIndex] || ((a[t.featureIndex] = !0), s.push(t)); + } + } + return e; + })(c); + for (const e in h) + h[e].forEach((e) => { + const i = e.feature, + o = t.getFeatureState(i.layer['source-layer'], i.id); + (i.source = i.layer.source), + i.layer['source-layer'] && + (i.sourceLayer = i.layer['source-layer']), + (i.state = o); + }); + return h; + } + function R(t, e) { + const i = t.tileID, + o = e.tileID; + return ( + i.overscaledZ - o.overscaledZ || + i.canonical.y - o.canonical.y || + i.wrap - o.wrap || + i.canonical.x - o.canonical.x + ); + } + class k { + constructor(e, i) { + (this.tileID = e), + (this.uid = t.uniqueId()), + (this.uses = 0), + (this.tileSize = i), + (this.buckets = {}), + (this.expirationTime = null), + (this.queryPadding = 0), + (this.hasSymbolBuckets = !1), + (this.hasRTLText = !1), + (this.dependencies = {}), + (this.textures = []), + (this.textureCoords = {}), + (this.expiredRequestCount = 0), + (this.state = 'loading'); + } + registerFadeDuration(e) { + const i = e + this.timeAdded; + i < t.exported.now() || + (this.fadeEndTime && i < this.fadeEndTime) || + (this.fadeEndTime = i); + } + wasRequested() { + return ( + 'errored' === this.state || + 'loaded' === this.state || + 'reloading' === this.state + ); + } + clearTextures(t) { + this.demTexture && t.saveTileTexture(this.demTexture), + this.textures.forEach((e) => t.saveTileTexture(e)), + (this.demTexture = null), + (this.textures = []), + (this.textureCoords = {}); + } + loadVectorData(e, i, o) { + if ( + (this.hasData() && this.unloadVectorData(), + (this.state = 'loaded'), + e) + ) { + 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 (t, e) { + const i = {}; + if (!e) return i; + for (const o of t) { + const t = o.layerIds.map((t) => e.getLayer(t)).filter(Boolean); + if (0 !== t.length) { + (o.layers = t), + o.stateDependentLayerIds && + (o.stateDependentLayers = o.stateDependentLayerIds.map( + (e) => t.filter((t) => t.id === e)[0], + )); + for (const e of t) i[e.id] = o; + } + } + return i; + })(e.buckets, i.style)), + (this.hasSymbolBuckets = !1); + for (const e in this.buckets) { + const i = this.buckets[e]; + if (i instanceof t.SymbolBucket) { + if (((this.hasSymbolBuckets = !0), !o)) break; + i.justReloaded = !0; + } + } + if (((this.hasRTLText = !1), this.hasSymbolBuckets)) + for (const e in this.buckets) { + const i = this.buckets[e]; + if (i instanceof t.SymbolBucket && i.hasRTLText) { + (this.hasRTLText = !0), t.lazyLoadRTLTextPlugin(); + break; + } + } + this.queryPadding = 0; + for (const t in this.buckets) { + const e = this.buckets[t]; + this.queryPadding = Math.max( + this.queryPadding, + i.style.getLayer(t).queryRadius(e), + ); + } + e.imageAtlas && (this.imageAtlas = e.imageAtlas), + e.glyphAtlasImage && (this.glyphAtlasImage = e.glyphAtlasImage); + } else this.collisionBoxArray = new t.CollisionBoxArray(); + } + unloadVectorData() { + for (const t in this.buckets) this.buckets[t].destroy(); + (this.buckets = {}), + this.imageAtlasTexture && this.imageAtlasTexture.destroy(), + this.imageAtlas && (this.imageAtlas = null), + this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), + (this.latestFeatureIndex = null), + (this.state = 'unloaded'); + } + getBucket(t) { + return this.buckets[t.id]; + } + upload(t) { + for (const e in this.buckets) { + const i = this.buckets[e]; + i.uploadPending() && i.upload(t); + } + const e = t.gl; + this.imageAtlas && + !this.imageAtlas.uploaded && + ((this.imageAtlasTexture = new l(t, this.imageAtlas.image, e.RGBA)), + (this.imageAtlas.uploaded = !0)), + this.glyphAtlasImage && + ((this.glyphAtlasTexture = new l(t, this.glyphAtlasImage, e.ALPHA)), + (this.glyphAtlasImage = null)); + } + prepare(t) { + this.imageAtlas && + this.imageAtlas.patchUpdatedImages(t, this.imageAtlasTexture); + } + queryRenderedFeatures(t, e, i, o, a, r, s, n, l, c) { + return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData + ? this.latestFeatureIndex.query( + { + queryGeometry: o, + cameraQueryGeometry: a, + scale: r, + tileSize: this.tileSize, + pixelPosMatrix: c, + transform: n, + params: s, + queryPadding: this.queryPadding * l, + }, + t, + e, + i, + ) + : {}; + } + querySourceFeatures(e, i) { + const o = this.latestFeatureIndex; + if (!o || !o.rawTileData) return; + const a = o.loadVTLayers(), + r = i ? i.sourceLayer : '', + s = a._geojsonTileLayer || a[r]; + if (!s) return; + const n = t.createFilter(i && i.filter), + { z: l, x: c, y: h } = this.tileID.canonical, + u = { z: l, x: c, y: h }; + for (let i = 0; i < s.length; i++) { + const a = s.feature(i); + if (n.needGeometry) { + const e = t.toEvaluationFeature(a, !0); + if ( + !n.filter( + new t.EvaluationParameters(this.tileID.overscaledZ), + e, + this.tileID.canonical, + ) + ) + continue; + } else if ( + !n.filter(new t.EvaluationParameters(this.tileID.overscaledZ), a) + ) + continue; + const d = o.getId(a, r), + m = new t.GeoJSONFeature(a, l, c, h, d); + (m.tile = u), e.push(m); + } + } + hasData() { + return ( + 'loaded' === this.state || + 'reloading' === this.state || + 'expired' === this.state + ); + } + patternsLoaded() { + return ( + this.imageAtlas && + !!Object.keys(this.imageAtlas.patternPositions).length + ); + } + setExpiryData(e) { + const i = this.expirationTime; + if (e.cacheControl) { + const i = t.parseCacheControl(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) { + const t = Date.now(); + let e = !1; + if (this.expirationTime > t) e = !1; + else if (i) + if (this.expirationTime < i) e = !0; + else { + const o = this.expirationTime - i; + o ? (this.expirationTime = t + Math.max(o, 3e4)) : (e = !0); + } + else e = !0; + e + ? (this.expiredRequestCount++, (this.state = 'expired')) + : (this.expiredRequestCount = 0); + } + } + getExpiryTimeout() { + 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, + ); + } + setFeatureState(t, e) { + if ( + !this.latestFeatureIndex || + !this.latestFeatureIndex.rawTileData || + 0 === Object.keys(t).length + ) + return; + const i = this.latestFeatureIndex.loadVTLayers(); + for (const o in this.buckets) { + if (!e.style.hasLayer(o)) continue; + const a = this.buckets[o], + r = a.layers[0].sourceLayer || '_geojsonTileLayer', + s = i[r], + n = t[r]; + if (!s || !n || 0 === Object.keys(n).length) continue; + a.update( + n, + s, + (this.imageAtlas && this.imageAtlas.patternPositions) || {}, + ); + const l = e && e.style && e.style.getLayer(o); + l && + (this.queryPadding = Math.max(this.queryPadding, l.queryRadius(a))); + } + } + holdingForFade() { + return void 0 !== this.symbolFadeHoldUntil; + } + symbolFadeFinished() { + return ( + !this.symbolFadeHoldUntil || + this.symbolFadeHoldUntil < t.exported.now() + ); + } + clearFadeHold() { + this.symbolFadeHoldUntil = void 0; + } + setHoldDuration(e) { + this.symbolFadeHoldUntil = t.exported.now() + e; + } + setDependencies(t, e) { + const i = {}; + for (const t of e) i[t] = !0; + this.dependencies[t] = i; + } + hasDependency(t, e) { + for (const i of t) { + const t = this.dependencies[i]; + if (t) for (const i of e) if (t[i]) return !0; + } + return !1; + } + } + class B { + constructor(t, e) { + (this.max = t), (this.onRemove = e), this.reset(); + } + reset() { + for (const t in this.data) + for (const e of this.data[t]) + e.timeout && clearTimeout(e.timeout), this.onRemove(e.value); + return (this.data = {}), (this.order = []), this; + } + add(t, e, i) { + const o = t.wrapped().key; + void 0 === this.data[o] && (this.data[o] = []); + const a = { value: e, timeout: void 0 }; + if ( + (void 0 !== i && + (a.timeout = setTimeout(() => { + this.remove(t, a); + }, i)), + this.data[o].push(a), + this.order.push(o), + this.order.length > this.max) + ) { + const t = this._getAndRemoveByKey(this.order[0]); + t && this.onRemove(t); + } + return this; + } + has(t) { + return t.wrapped().key in this.data; + } + getAndRemove(t) { + return this.has(t) ? this._getAndRemoveByKey(t.wrapped().key) : null; + } + _getAndRemoveByKey(t) { + const e = this.data[t].shift(); + return ( + e.timeout && clearTimeout(e.timeout), + 0 === this.data[t].length && delete this.data[t], + this.order.splice(this.order.indexOf(t), 1), + e.value + ); + } + getByKey(t) { + const e = this.data[t]; + return e ? e[0].value : null; + } + get(t) { + return this.has(t) ? this.data[t.wrapped().key][0].value : null; + } + remove(t, e) { + if (!this.has(t)) return this; + const i = t.wrapped().key, + o = void 0 === e ? 0 : this.data[i].indexOf(e), + a = this.data[i][o]; + return ( + this.data[i].splice(o, 1), + a.timeout && clearTimeout(a.timeout), + 0 === this.data[i].length && delete this.data[i], + this.onRemove(a.value), + this.order.splice(this.order.indexOf(i), 1), + this + ); + } + setMaxSize(t) { + for (this.max = t; this.order.length > this.max; ) { + const t = this._getAndRemoveByKey(this.order[0]); + t && this.onRemove(t); + } + return this; + } + filter(t) { + const e = []; + for (const i in this.data) + for (const o of this.data[i]) t(o.value) || e.push(o); + for (const t of e) this.remove(t.value.tileID, t); + } + } + class F { + constructor() { + (this.state = {}), (this.stateChanges = {}), (this.deletedStates = {}); + } + updateState(e, i, o) { + const a = String(i); + if ( + ((this.stateChanges[e] = this.stateChanges[e] || {}), + (this.stateChanges[e][a] = this.stateChanges[e][a] || {}), + t.extend(this.stateChanges[e][a], o), + null === this.deletedStates[e]) + ) { + this.deletedStates[e] = {}; + for (const t in this.state[e]) + t !== a && (this.deletedStates[e][t] = null); + } else if (this.deletedStates[e] && null === this.deletedStates[e][a]) { + this.deletedStates[e][a] = {}; + for (const t in this.state[e][a]) + o[t] || (this.deletedStates[e][a][t] = null); + } else + for (const t in o) + this.deletedStates[e] && + this.deletedStates[e][a] && + null === this.deletedStates[e][a][t] && + delete this.deletedStates[e][a][t]; + } + removeFeatureState(t, e, i) { + if (null === this.deletedStates[t]) return; + const o = String(e); + if ( + ((this.deletedStates[t] = this.deletedStates[t] || {}), + i && void 0 !== e) + ) + null !== this.deletedStates[t][o] && + ((this.deletedStates[t][o] = this.deletedStates[t][o] || {}), + (this.deletedStates[t][o][i] = null)); + else if (void 0 !== e) + if (this.stateChanges[t] && this.stateChanges[t][o]) + for (i in ((this.deletedStates[t][o] = {}), + this.stateChanges[t][o])) + this.deletedStates[t][o][i] = null; + else this.deletedStates[t][o] = null; + else this.deletedStates[t] = null; + } + getState(e, i) { + const o = String(i), + a = t.extend( + {}, + (this.state[e] || {})[o], + (this.stateChanges[e] || {})[o], + ); + if (null === this.deletedStates[e]) return {}; + if (this.deletedStates[e]) { + const t = this.deletedStates[e][i]; + if (null === t) return {}; + for (const e in t) delete a[e]; + } + return a; + } + initializeTileState(t, e) { + t.setFeatureState(this.state, e); + } + coalesceChanges(e, i) { + const o = {}; + for (const e in this.stateChanges) { + this.state[e] = this.state[e] || {}; + const i = {}; + for (const o in this.stateChanges[e]) + this.state[e][o] || (this.state[e][o] = {}), + t.extend(this.state[e][o], this.stateChanges[e][o]), + (i[o] = this.state[e][o]); + o[e] = i; + } + for (const e in this.deletedStates) { + this.state[e] = this.state[e] || {}; + const i = {}; + if (null === this.deletedStates[e]) + for (const t in this.state[e]) (i[t] = {}), (this.state[e][t] = {}); + else + for (const t in this.deletedStates[e]) { + if (null === this.deletedStates[e][t]) this.state[e][t] = {}; + else + for (const i of Object.keys(this.deletedStates[e][t])) + delete this.state[e][t][i]; + i[t] = this.state[e][t]; + } + (o[e] = o[e] || {}), t.extend(o[e], i); + } + if ( + ((this.stateChanges = {}), + (this.deletedStates = {}), + 0 !== Object.keys(o).length) + ) + for (const t in e) e[t].setFeatureState(o, i); + } + } + class O extends t.Evented { + constructor(e, i, o) { + super(), + (this.id = e), + (this.dispatcher = o), + this.on('data', (t) => { + 'source' === t.dataType && + 'metadata' === t.sourceDataType && + (this._sourceLoaded = !0), + this._sourceLoaded && + !this._paused && + 'source' === t.dataType && + 'content' === t.sourceDataType && + (this.reload(), + this.transform && this.update(this.transform, this.terrain)); + }), + this.on('dataloading', () => { + this._sourceErrored = !1; + }), + this.on('error', () => { + this._sourceErrored = this._source.loaded(); + }), + (this._source = (function (e, i, o, a) { + const r = new M[i.type](e, i, o, a); + if (r.id !== e) + throw new Error( + `Expected Source id to be ${e} instead of ${r.id}`, + ); + return ( + t.bindAll(['load', 'abort', 'unload', 'serialize', 'prepare'], r), + r + ); + })(e, i, o, this)), + (this._tiles = {}), + (this._cache = new B(0, this._unloadTile.bind(this))), + (this._timers = {}), + (this._cacheTimers = {}), + (this._maxTileCacheSize = null), + (this._loadedParentTiles = {}), + (this._coveredTiles = {}), + (this._state = new F()); + } + onAdd(t) { + (this.map = t), + (this._maxTileCacheSize = t ? t._maxTileCacheSize : null), + this._source && this._source.onAdd && this._source.onAdd(t); + } + onRemove(t) { + this.clearTiles(), + this._source && this._source.onRemove && this._source.onRemove(t); + } + loaded() { + if (this._sourceErrored) return !0; + if (!this._sourceLoaded) return !1; + if (!this._source.loaded()) return !1; + for (const t in this._tiles) { + const e = this._tiles[t]; + if ('loaded' !== e.state && 'errored' !== e.state) return !1; + } + return !0; + } + getSource() { + return this._source; + } + pause() { + this._paused = !0; + } + resume() { + if (!this._paused) return; + const t = this._shouldReloadOnResume; + (this._paused = !1), + (this._shouldReloadOnResume = !1), + t && this.reload(), + this.transform && this.update(this.transform, this.terrain); + } + _loadTile(t, e) { + return this._source.loadTile(t, e); + } + _unloadTile(t) { + if (this._source.unloadTile) + return this._source.unloadTile(t, () => {}); + } + _abortTile(e) { + this._source.abortTile && this._source.abortTile(e, () => {}), + this._source.fire( + new t.Event('dataabort', { + tile: e, + coord: e.tileID, + dataType: 'source', + }), + ); + } + serialize() { + return this._source.serialize(); + } + prepare(t) { + this._source.prepare && this._source.prepare(), + this._state.coalesceChanges( + this._tiles, + this.map ? this.map.painter : null, + ); + for (const e in this._tiles) { + const i = this._tiles[e]; + i.upload(t), i.prepare(this.map.style.imageManager); + } + } + getIds() { + return Object.values(this._tiles) + .map((t) => t.tileID) + .sort(U) + .map((t) => t.key); + } + getRenderableIds(e) { + const i = []; + for (const t in this._tiles) + this._isIdRenderable(t, e) && i.push(this._tiles[t]); + return e + ? i + .sort((e, i) => { + const o = e.tileID, + a = i.tileID, + r = new t.pointGeometry(o.canonical.x, o.canonical.y)._rotate( + this.transform.angle, + ), + s = new t.pointGeometry(a.canonical.x, a.canonical.y)._rotate( + this.transform.angle, + ); + return o.overscaledZ - a.overscaledZ || s.y - r.y || s.x - r.x; + }) + .map((t) => t.tileID.key) + : i + .map((t) => t.tileID) + .sort(U) + .map((t) => t.key); + } + hasRenderableParent(t) { + const e = this.findLoadedParent(t, 0); + return !!e && this._isIdRenderable(e.tileID.key); + } + _isIdRenderable(t, e) { + return ( + this._tiles[t] && + this._tiles[t].hasData() && + !this._coveredTiles[t] && + (e || !this._tiles[t].holdingForFade()) + ); + } + reload() { + if (this._paused) this._shouldReloadOnResume = !0; + else { + this._cache.reset(); + for (const t in this._tiles) + 'errored' !== this._tiles[t].state && + this._reloadTile(t, 'reloading'); + } + } + _reloadTile(t, e) { + const i = this._tiles[t]; + i && + ('loading' !== i.state && (i.state = e), + this._loadTile(i, this._tileLoaded.bind(this, i, t, e))); + } + _tileLoaded(e, i, o, a) { + if (a) + return ( + (e.state = 'errored'), + void (404 !== a.status + ? this._source.fire(new t.ErrorEvent(a, { tile: e })) + : this.update(this.transform, this.terrain)) + ); + (e.timeAdded = t.exported.now()), + 'expired' === o && (e.refreshedUponExpiration = !0), + this._setTileReloadTimer(i, e), + 'raster-dem' === this.getSource().type && + e.dem && + this._backfillDEM(e), + this._state.initializeTileState( + e, + this.map ? this.map.painter : null, + ), + e.aborted || + this._source.fire( + new t.Event('data', { + dataType: 'source', + tile: e, + coord: e.tileID, + }), + ); + } + _backfillDEM(t) { + const e = this.getRenderableIds(); + for (let o = 0; o < e.length; o++) { + const a = e[o]; + if (t.neighboringTiles && t.neighboringTiles[a]) { + const e = this.getTileByID(a); + i(t, e), i(e, t); + } + } + function i(t, e) { + (t.needsHillshadePrepare = !0), (t.needsTerrainPrepare = !0); + let i = e.tileID.canonical.x - t.tileID.canonical.x; + const o = e.tileID.canonical.y - t.tileID.canonical.y, + a = Math.pow(2, t.tileID.canonical.z), + r = e.tileID.key; + (0 === i && 0 === o) || + Math.abs(o) > 1 || + (Math.abs(i) > 1 && + (1 === Math.abs(i + a) + ? (i += a) + : 1 === Math.abs(i - a) && (i -= a)), + e.dem && + t.dem && + (t.dem.backfillBorder(e.dem, i, o), + t.neighboringTiles && + t.neighboringTiles[r] && + (t.neighboringTiles[r].backfilled = !0))); + } + } + getTile(t) { + return this.getTileByID(t.key); + } + getTileByID(t) { + return this._tiles[t]; + } + _retainLoadedChildren(t, e, i, o) { + for (const a in this._tiles) { + let r = this._tiles[a]; + if ( + o[a] || + !r.hasData() || + r.tileID.overscaledZ <= e || + r.tileID.overscaledZ > i + ) + continue; + let s = r.tileID; + for (; r && r.tileID.overscaledZ > e + 1; ) { + const t = r.tileID.scaledTo(r.tileID.overscaledZ - 1); + (r = this._tiles[t.key]), r && r.hasData() && (s = t); + } + let n = s; + for (; n.overscaledZ > e; ) + if (((n = n.scaledTo(n.overscaledZ - 1)), t[n.key])) { + o[s.key] = s; + break; + } + } + } + findLoadedParent(t, e) { + if (t.key in this._loadedParentTiles) { + const i = this._loadedParentTiles[t.key]; + return i && i.tileID.overscaledZ >= e ? i : null; + } + for (let i = t.overscaledZ - 1; i >= e; i--) { + const e = t.scaledTo(i), + o = this._getLoadedTile(e); + if (o) return o; + } + } + _getLoadedTile(t) { + const e = this._tiles[t.key]; + return e && e.hasData() ? e : this._cache.getByKey(t.wrapped().key); + } + updateCacheSize(t) { + const e = Math.ceil(t.width / this._source.tileSize) + 1, + i = Math.ceil(t.height / this._source.tileSize) + 1, + o = Math.floor(e * i * 5), + a = + 'number' == typeof this._maxTileCacheSize + ? Math.min(this._maxTileCacheSize, o) + : o; + this._cache.setMaxSize(a); + } + handleWrapJump(t) { + const e = Math.round( + (t - (void 0 === this._prevLng ? t : this._prevLng)) / 360, + ); + if (((this._prevLng = t), e)) { + const t = {}; + for (const i in this._tiles) { + const o = this._tiles[i]; + (o.tileID = o.tileID.unwrapTo(o.tileID.wrap + e)), + (t[o.tileID.key] = o); + } + this._tiles = t; + for (const t in this._timers) + clearTimeout(this._timers[t]), delete this._timers[t]; + for (const t in this._tiles) + this._setTileReloadTimer(t, this._tiles[t]); + } + } + update(e, i) { + if ( + ((this.transform = e), + (this.terrain = i), + !this._sourceLoaded || this._paused) + ) + return; + let o; + this.updateCacheSize(e), + this.handleWrapJump(this.transform.center.lng), + (this._coveredTiles = {}), + this.used || this.usedForTerrain + ? this._source.tileID + ? (o = e + .getVisibleUnwrappedCoordinates(this._source.tileID) + .map( + (e) => + new t.OverscaledTileID( + e.canonical.z, + e.wrap, + e.canonical.z, + e.canonical.x, + e.canonical.y, + ), + )) + : ((o = e.coveringTiles({ + tileSize: this.usedForTerrain + ? this.tileSize + : this._source.tileSize, + minzoom: this._source.minzoom, + maxzoom: this._source.maxzoom, + roundZoom: !this.usedForTerrain && this._source.roundZoom, + reparseOverscaled: this._source.reparseOverscaled, + terrain: i, + })), + this._source.hasTile && + (o = o.filter((t) => this._source.hasTile(t)))) + : (o = []); + const a = e.coveringZoomLevel(this._source), + r = Math.max(a - O.maxOverzooming, this._source.minzoom), + s = Math.max(a + O.maxUnderzooming, this._source.minzoom); + if (this.usedForTerrain) { + const t = {}; + for (const e of o) + if (e.canonical.z > this._source.minzoom) { + const i = e.scaledTo(e.canonical.z - 1); + t[i.key] = i; + const o = e.scaledTo( + Math.max(this._source.minzoom, Math.min(e.canonical.z, 5)), + ); + t[o.key] = o; + } + o = o.concat(Object.values(t)); + } + const n = this._updateRetainedTiles(o, a); + if (N(this._source.type)) { + const e = {}, + l = {}, + c = Object.keys(n); + for (const i of c) { + const o = n[i], + a = this._tiles[i]; + if (!a || (a.fadeEndTime && a.fadeEndTime <= t.exported.now())) + continue; + const s = this.findLoadedParent(o, r); + s && (this._addTile(s.tileID), (e[s.tileID.key] = s.tileID)), + (l[i] = o); + } + this._retainLoadedChildren(l, a, s, n); + for (const t in e) + n[t] || ((this._coveredTiles[t] = !0), (n[t] = e[t])); + if (i) { + const t = {}, + e = {}; + for (const i of o) + this._tiles[i.key].hasData() ? (t[i.key] = i) : (e[i.key] = i); + for (const i in e) { + const o = e[i].children(this._source.maxzoom); + this._tiles[o[0].key] && + this._tiles[o[1].key] && + this._tiles[o[2].key] && + this._tiles[o[3].key] && + ((t[o[0].key] = n[o[0].key] = o[0]), + (t[o[1].key] = n[o[1].key] = o[1]), + (t[o[2].key] = n[o[2].key] = o[2]), + (t[o[3].key] = n[o[3].key] = o[3]), + delete e[i]); + } + for (const i in e) { + const o = this.findLoadedParent(e[i], this._source.minzoom); + if (o) { + t[o.tileID.key] = n[o.tileID.key] = o.tileID; + for (const e in t) t[e].isChildOf(o.tileID) && delete t[e]; + } + } + for (const e in this._tiles) t[e] || (this._coveredTiles[e] = !0); + } + } + for (const t in n) this._tiles[t].clearFadeHold(); + const l = t.keysDifference(this._tiles, n); + for (const t of l) { + const e = this._tiles[t]; + e.hasSymbolBuckets && !e.holdingForFade() + ? e.setHoldDuration(this.map._fadeDuration) + : (e.hasSymbolBuckets && !e.symbolFadeFinished()) || + this._removeTile(t); + } + this._updateLoadedParentTileCache(); + } + releaseSymbolFadeTiles() { + for (const t in this._tiles) + this._tiles[t].holdingForFade() && this._removeTile(t); + } + _updateRetainedTiles(t, e) { + const i = {}, + o = {}, + a = Math.max(e - O.maxOverzooming, this._source.minzoom), + r = Math.max(e + O.maxUnderzooming, this._source.minzoom), + s = {}; + for (const o of t) { + const t = this._addTile(o); + (i[o.key] = o), + t.hasData() || (e < this._source.maxzoom && (s[o.key] = o)); + } + this._retainLoadedChildren(s, e, r, i); + for (const r of t) { + let t = this._tiles[r.key]; + if (t.hasData()) continue; + if (e + 1 > this._source.maxzoom) { + const t = r.children(this._source.maxzoom)[0], + e = this.getTile(t); + if (e && e.hasData()) { + i[t.key] = t; + continue; + } + } else { + const t = r.children(this._source.maxzoom); + if (i[t[0].key] && i[t[1].key] && i[t[2].key] && i[t[3].key]) + continue; + } + let s = t.wasRequested(); + for (let e = r.overscaledZ - 1; e >= a; --e) { + const a = r.scaledTo(e); + if (o[a.key]) break; + if ( + ((o[a.key] = !0), + (t = this.getTile(a)), + !t && s && (t = this._addTile(a)), + t && ((i[a.key] = a), (s = t.wasRequested()), t.hasData())) + ) + break; + } + } + return i; + } + _updateLoadedParentTileCache() { + this._loadedParentTiles = {}; + for (const t in this._tiles) { + const e = []; + let i, + o = this._tiles[t].tileID; + for (; o.overscaledZ > 0; ) { + if (o.key in this._loadedParentTiles) { + i = this._loadedParentTiles[o.key]; + break; + } + e.push(o.key); + const t = o.scaledTo(o.overscaledZ - 1); + if (((i = this._getLoadedTile(t)), i)) break; + o = t; + } + for (const t of e) this._loadedParentTiles[t] = i; + } + } + _addTile(e) { + let i = this._tiles[e.key]; + if (i) return i; + (i = this._cache.getAndRemove(e)), + i && + (this._setTileReloadTimer(e.key, i), + (i.tileID = e), + this._state.initializeTileState( + i, + this.map ? this.map.painter : null, + ), + this._cacheTimers[e.key] && + (clearTimeout(this._cacheTimers[e.key]), + delete this._cacheTimers[e.key], + this._setTileReloadTimer(e.key, i))); + const o = i; + return ( + i || + ((i = new k(e, this._source.tileSize * e.overscaleFactor())), + this._loadTile(i, this._tileLoaded.bind(this, i, e.key, i.state))), + i.uses++, + (this._tiles[e.key] = i), + o || + this._source.fire( + new t.Event('dataloading', { + tile: i, + coord: i.tileID, + dataType: 'source', + }), + ), + i + ); + } + _setTileReloadTimer(t, e) { + t in this._timers && + (clearTimeout(this._timers[t]), delete this._timers[t]); + const i = e.getExpiryTimeout(); + i && + (this._timers[t] = setTimeout(() => { + this._reloadTile(t, 'expired'), delete this._timers[t]; + }, i)); + } + _removeTile(t) { + const e = this._tiles[t]; + e && + (e.uses--, + delete this._tiles[t], + this._timers[t] && + (clearTimeout(this._timers[t]), delete this._timers[t]), + e.uses > 0 || + (e.hasData() && 'reloading' !== e.state + ? this._cache.add(e.tileID, e, e.getExpiryTimeout()) + : ((e.aborted = !0), this._abortTile(e), this._unloadTile(e)))); + } + clearTiles() { + (this._shouldReloadOnResume = !1), (this._paused = !1); + for (const t in this._tiles) this._removeTile(t); + this._cache.reset(); + } + tilesIn(e, i, o) { + const a = [], + r = this.transform; + if (!r) return a; + const s = o ? r.getCameraQueryGeometry(e) : e, + n = e.map((t) => r.pointCoordinate(t, this.terrain)), + l = s.map((t) => r.pointCoordinate(t, this.terrain)), + c = this.getIds(); + let h = 1 / 0, + u = 1 / 0, + d = -1 / 0, + m = -1 / 0; + for (const t of l) + (h = Math.min(h, t.x)), + (u = Math.min(u, t.y)), + (d = Math.max(d, t.x)), + (m = Math.max(m, t.y)); + for (let e = 0; e < c.length; e++) { + const o = this._tiles[c[e]]; + if (o.holdingForFade()) continue; + const s = o.tileID, + _ = Math.pow(2, r.zoom - o.tileID.overscaledZ), + p = (i * o.queryPadding * t.EXTENT) / o.tileSize / _, + f = [ + s.getTilePoint(new t.MercatorCoordinate(h, u)), + s.getTilePoint(new t.MercatorCoordinate(d, m)), + ]; + if ( + f[0].x - p < t.EXTENT && + f[0].y - p < t.EXTENT && + f[1].x + p >= 0 && + f[1].y + p >= 0 + ) { + const t = n.map((t) => s.getTilePoint(t)), + e = l.map((t) => s.getTilePoint(t)); + a.push({ + tile: o, + tileID: s, + queryGeometry: t, + cameraQueryGeometry: e, + scale: _, + }); + } + } + return a; + } + getVisibleCoordinates(t) { + const e = this.getRenderableIds(t).map((t) => this._tiles[t].tileID); + for (const t of e) + t.posMatrix = this.transform.calculatePosMatrix(t.toUnwrapped()); + return e; + } + hasTransition() { + if (this._source.hasTransition()) return !0; + if (N(this._source.type)) + for (const e in this._tiles) { + const i = this._tiles[e]; + if (void 0 !== i.fadeEndTime && i.fadeEndTime >= t.exported.now()) + return !0; + } + return !1; + } + setFeatureState(t, e, i) { + this._state.updateState((t = t || '_geojsonTileLayer'), e, i); + } + removeFeatureState(t, e, i) { + this._state.removeFeatureState((t = t || '_geojsonTileLayer'), e, i); + } + getFeatureState(t, e) { + return this._state.getState((t = t || '_geojsonTileLayer'), e); + } + setDependencies(t, e, i) { + const o = this._tiles[t]; + o && o.setDependencies(e, i); + } + reloadTilesForDependencies(t, e) { + for (const i in this._tiles) + this._tiles[i].hasDependency(t, e) && + this._reloadTile(i, 'reloading'); + this._cache.filter((i) => !i.hasDependency(t, e)); + } + } + function U(t, e) { + const i = Math.abs(2 * t.wrap) - +(t.wrap < 0), + o = Math.abs(2 * e.wrap) - +(e.wrap < 0); + return ( + t.overscaledZ - e.overscaledZ || + o - i || + e.canonical.y - t.canonical.y || + e.canonical.x - t.canonical.x + ); + } + function N(t) { + return 'raster' === t || 'image' === t || 'video' === t; + } + (O.maxOverzooming = 10), (O.maxUnderzooming = 3); + const G = 'mapboxgl_preloaded_worker_pool'; + class Z { + constructor() { + this.active = {}; + } + acquire(t) { + if (!this.workers) + for (this.workers = []; this.workers.length < Z.workerCount; ) + this.workers.push(new Worker(ba.workerUrl)); + return (this.active[t] = !0), this.workers.slice(); + } + release(t) { + delete this.active[t], + 0 === this.numActive() && + (this.workers.forEach((t) => { + t.terminate(); + }), + (this.workers = null)); + } + isPreloaded() { + return !!this.active[G]; + } + numActive() { + return Object.keys(this.active).length; + } + } + const V = Math.floor(t.exported.hardwareConcurrency / 2); + let q; + function j() { + return q || (q = new Z()), q; + } + function $(e, i) { + const o = {}; + for (const t in e) 'ref' !== t && (o[t] = e[t]); + return ( + t.refProperties.forEach((t) => { + t in i && (o[t] = i[t]); + }), + o + ); + } + function X(t) { + t = t.slice(); + const e = Object.create(null); + for (let i = 0; i < t.length; i++) e[t[i].id] = t[i]; + for (let i = 0; i < t.length; i++) + 'ref' in t[i] && (t[i] = $(t[i], e[t[i].ref])); + return t; + } + Z.workerCount = Math.max(Math.min(V, 6), 1); + const W = { + setStyle: 'setStyle', + addLayer: 'addLayer', + removeLayer: 'removeLayer', + setPaintProperty: 'setPaintProperty', + setLayoutProperty: 'setLayoutProperty', + setFilter: 'setFilter', + addSource: 'addSource', + removeSource: 'removeSource', + setGeoJSONSourceData: 'setGeoJSONSourceData', + setLayerZoomRange: 'setLayerZoomRange', + setLayerProperty: 'setLayerProperty', + setCenter: 'setCenter', + setZoom: 'setZoom', + setBearing: 'setBearing', + setPitch: 'setPitch', + setSprite: 'setSprite', + setGlyphs: 'setGlyphs', + setTransition: 'setTransition', + setLight: 'setLight', + }; + function H(t, e, i) { + i.push({ command: W.addSource, args: [t, e[t]] }); + } + function K(t, e, i) { + e.push({ command: W.removeSource, args: [t] }), (i[t] = !0); + } + function Y(t, e, i, o) { + K(t, i, o), H(t, e, i); + } + function J(t, e, i) { + let o; + for (o in t[i]) + if ( + Object.prototype.hasOwnProperty.call(t[i], o) && + 'data' !== o && + !a(t[i][o], e[i][o]) + ) + return !1; + for (o in e[i]) + if ( + Object.prototype.hasOwnProperty.call(e[i], o) && + 'data' !== o && + !a(t[i][o], e[i][o]) + ) + return !1; + return !0; + } + function Q(t, e, i, o, r, s) { + let n; + for (n in ((e = e || {}), (t = t || {}))) + Object.prototype.hasOwnProperty.call(t, n) && + (a(t[n], e[n]) || i.push({ command: s, args: [o, n, e[n], r] })); + for (n in e) + Object.prototype.hasOwnProperty.call(e, n) && + !Object.prototype.hasOwnProperty.call(t, n) && + (a(t[n], e[n]) || i.push({ command: s, args: [o, n, e[n], r] })); + } + function tt(t) { + return t.id; + } + function et(t, e) { + return (t[e.id] = e), t; + } + class it { + constructor(t, e) { + this.reset(t, e); + } + reset(t, e) { + (this.points = t || []), (this._distances = [0]); + for (let t = 1; t < this.points.length; t++) + this._distances[t] = + this._distances[t - 1] + this.points[t].dist(this.points[t - 1]); + (this.length = this._distances[this._distances.length - 1]), + (this.padding = Math.min(e || 0, 0.5 * this.length)), + (this.paddedLength = this.length - 2 * this.padding); + } + lerp(e) { + if (1 === this.points.length) return this.points[0]; + e = t.clamp(e, 0, 1); + let i = 1, + o = this._distances[i]; + const a = e * this.paddedLength + this.padding; + for (; o < a && i < this._distances.length; ) o = this._distances[++i]; + const r = i - 1, + s = this._distances[r], + n = o - s, + l = n > 0 ? (a - s) / n : 0; + return this.points[r].mult(1 - l).add(this.points[i].mult(l)); + } + } + function ot(t, e) { + let i = !0; + return 'always' === t || ('never' !== t && 'never' !== e) || (i = !1), i; + } + class at { + constructor(t, e, i) { + const o = (this.boxCells = []), + a = (this.circleCells = []); + (this.xCellCount = Math.ceil(t / i)), + (this.yCellCount = Math.ceil(e / i)); + for (let t = 0; t < this.xCellCount * this.yCellCount; t++) + o.push([]), a.push([]); + (this.circleKeys = []), + (this.boxKeys = []), + (this.bboxes = []), + (this.circles = []), + (this.width = t), + (this.height = e), + (this.xScale = this.xCellCount / t), + (this.yScale = this.yCellCount / e), + (this.boxUid = 0), + (this.circleUid = 0); + } + keysLength() { + return this.boxKeys.length + this.circleKeys.length; + } + insert(t, e, i, o, a) { + this._forEachCell(e, i, o, a, this._insertBoxCell, this.boxUid++), + this.boxKeys.push(t), + this.bboxes.push(e), + this.bboxes.push(i), + this.bboxes.push(o), + this.bboxes.push(a); + } + insertCircle(t, e, i, o) { + this._forEachCell( + e - o, + i - o, + e + o, + i + o, + this._insertCircleCell, + this.circleUid++, + ), + this.circleKeys.push(t), + this.circles.push(e), + this.circles.push(i), + this.circles.push(o); + } + _insertBoxCell(t, e, i, o, a, r) { + this.boxCells[a].push(r); + } + _insertCircleCell(t, e, i, o, a, r) { + this.circleCells[a].push(r); + } + _query(t, e, i, o, a, r, s) { + if (i < 0 || t > this.width || o < 0 || e > this.height) return []; + const n = []; + if (t <= 0 && e <= 0 && this.width <= i && this.height <= o) { + if (a) return [{ key: null, x1: t, y1: e, x2: i, y2: o }]; + for (let t = 0; t < this.boxKeys.length; t++) + n.push({ + key: this.boxKeys[t], + x1: this.bboxes[4 * t], + y1: this.bboxes[4 * t + 1], + x2: this.bboxes[4 * t + 2], + y2: this.bboxes[4 * t + 3], + }); + for (let t = 0; t < this.circleKeys.length; t++) { + const e = this.circles[3 * t], + i = this.circles[3 * t + 1], + o = this.circles[3 * t + 2]; + n.push({ + key: this.circleKeys[t], + x1: e - o, + y1: i - o, + x2: e + o, + y2: i + o, + }); + } + } else this._forEachCell(t, e, i, o, this._queryCell, n, { hitTest: a, overlapMode: r, seenUids: { box: {}, circle: {} } }, s); + return n; + } + query(t, e, i, o) { + return this._query(t, e, i, o, !1, null); + } + hitTest(t, e, i, o, a, r) { + return this._query(t, e, i, o, !0, a, r).length > 0; + } + hitTestCircle(t, e, i, o, a) { + const r = t - i, + s = t + i, + n = e - i, + l = e + i; + if (s < 0 || r > this.width || l < 0 || n > this.height) return !1; + const c = []; + return ( + this._forEachCell( + r, + n, + s, + l, + this._queryCellCircle, + c, + { + hitTest: !0, + overlapMode: o, + circle: { x: t, y: e, radius: i }, + seenUids: { box: {}, circle: {} }, + }, + a, + ), + c.length > 0 + ); + } + _queryCell(t, e, i, o, a, r, s, n) { + const { seenUids: l, hitTest: c, overlapMode: h } = s, + u = this.boxCells[a]; + if (null !== u) { + const a = this.bboxes; + for (const s of u) + if (!l.box[s]) { + l.box[s] = !0; + const u = 4 * s, + d = this.boxKeys[s]; + if ( + t <= a[u + 2] && + e <= a[u + 3] && + i >= a[u + 0] && + o >= a[u + 1] && + (!n || n(d)) && + (!c || !ot(h, d.overlapMode)) && + (r.push({ + key: d, + x1: a[u], + y1: a[u + 1], + x2: a[u + 2], + y2: a[u + 3], + }), + c) + ) + return !0; + } + } + const d = this.circleCells[a]; + if (null !== d) { + const a = this.circles; + for (const s of d) + if (!l.circle[s]) { + l.circle[s] = !0; + const u = 3 * s, + d = this.circleKeys[s]; + if ( + this._circleAndRectCollide( + a[u], + a[u + 1], + a[u + 2], + t, + e, + i, + o, + ) && + (!n || n(d)) && + (!c || !ot(h, d.overlapMode)) + ) { + const t = a[u], + e = a[u + 1], + i = a[u + 2]; + if ( + (r.push({ + key: d, + x1: t - i, + y1: e - i, + x2: t + i, + y2: e + i, + }), + c) + ) + return !0; + } + } + } + return !1; + } + _queryCellCircle(t, e, i, o, a, r, s, n) { + const { circle: l, seenUids: c, overlapMode: h } = s, + u = this.boxCells[a]; + if (null !== u) { + const t = this.bboxes; + for (const e of u) + if (!c.box[e]) { + c.box[e] = !0; + const i = 4 * e, + o = this.boxKeys[e]; + if ( + this._circleAndRectCollide( + l.x, + l.y, + l.radius, + t[i + 0], + t[i + 1], + t[i + 2], + t[i + 3], + ) && + (!n || n(o)) && + !ot(h, o.overlapMode) + ) + return r.push(!0), !0; + } + } + const d = this.circleCells[a]; + if (null !== d) { + const t = this.circles; + for (const e of d) + if (!c.circle[e]) { + c.circle[e] = !0; + const i = 3 * e, + o = this.circleKeys[e]; + if ( + this._circlesCollide( + t[i], + t[i + 1], + t[i + 2], + l.x, + l.y, + l.radius, + ) && + (!n || n(o)) && + !ot(h, o.overlapMode) + ) + return r.push(!0), !0; + } + } + } + _forEachCell(t, e, i, o, a, r, s, n) { + const l = this._convertToXCellCoord(t), + c = this._convertToYCellCoord(e), + h = this._convertToXCellCoord(i), + u = this._convertToYCellCoord(o); + for (let d = l; d <= h; d++) + for (let l = c; l <= u; l++) + if (a.call(this, t, e, i, o, this.xCellCount * l + d, r, s, n)) + return; + } + _convertToXCellCoord(t) { + return Math.max( + 0, + Math.min(this.xCellCount - 1, Math.floor(t * this.xScale)), + ); + } + _convertToYCellCoord(t) { + return Math.max( + 0, + Math.min(this.yCellCount - 1, Math.floor(t * this.yScale)), + ); + } + _circlesCollide(t, e, i, o, a, r) { + const s = o - t, + n = a - e, + l = i + r; + return l * l > s * s + n * n; + } + _circleAndRectCollide(t, e, i, o, a, r, s) { + const n = (r - o) / 2, + l = Math.abs(t - (o + n)); + if (l > n + i) return !1; + const c = (s - a) / 2, + h = Math.abs(e - (a + c)); + if (h > c + i) return !1; + if (l <= n || h <= c) return !0; + const u = l - n, + d = h - c; + return u * u + d * d <= i * i; + } + } + function rt(e, i, o, a, r) { + const s = t.create(); + return ( + i + ? (t.scale(s, s, [1 / r, 1 / r, 1]), o || t.rotateZ(s, s, a.angle)) + : t.multiply(s, a.labelPlaneMatrix, e), + s + ); + } + function st(e, i, o, a, r) { + if (i) { + const i = t.clone(e); + return t.scale(i, i, [r, r, 1]), o || t.rotateZ(i, i, -a.angle), i; + } + return a.glCoordMatrix; + } + function nt(e, i, o) { + let a; + o + ? ((a = [e.x, e.y, o(e.x, e.y), 1]), t.transformMat4(a, a, i)) + : ((a = [e.x, e.y, 0, 1]), xt(a, a, i)); + const r = a[3]; + return { + point: new t.pointGeometry(a[0] / r, a[1] / r), + signedDistanceFromCamera: r, + }; + } + function lt(t, e) { + return 0.5 + (t / e) * 0.5; + } + function ct(t, e) { + const i = t[0] / t[3], + o = t[1] / t[3]; + return i >= -e[0] && i <= e[0] && o >= -e[1] && o <= e[1]; + } + function ht(e, i, o, a, r, s, n, l, c, h) { + const u = a ? e.textSizeData : e.iconSizeData, + d = t.evaluateSizeForZoom(u, o.transform.zoom), + m = [(256 / o.width) * 2 + 1, (256 / o.height) * 2 + 1], + _ = a + ? e.text.dynamicLayoutVertexArray + : e.icon.dynamicLayoutVertexArray; + _.clear(); + const p = e.lineVertexArray, + f = a ? e.text.placedSymbolArray : e.icon.placedSymbolArray, + g = o.transform.width / o.transform.height; + let x = !1; + for (let a = 0; a < f.length; a++) { + const v = f.get(a); + if (v.hidden || (v.writingMode === t.WritingMode.vertical && !x)) { + gt(v.numGlyphs, _); + continue; + } + let y; + if ( + ((x = !1), + h + ? ((y = [v.anchorX, v.anchorY, h(v.anchorX, v.anchorY), 1]), + t.transformMat4(y, y, i)) + : ((y = [v.anchorX, v.anchorY, 0, 1]), xt(y, y, i)), + !ct(y, m)) + ) { + gt(v.numGlyphs, _); + continue; + } + const b = lt(o.transform.cameraToCenterDistance, y[3]), + w = t.evaluateSizeForFeature(u, d, v), + T = n ? w / b : w * b, + E = new t.pointGeometry(v.anchorX, v.anchorY), + I = nt(E, r, h).point, + C = {}, + S = mt( + v, + T, + !1, + l, + i, + r, + s, + e.glyphOffsetArray, + p, + _, + I, + E, + C, + g, + c, + h, + ); + (x = S.useVertical), + (S.notEnoughRoom || + x || + (S.needsFlipping && + mt( + v, + T, + !0, + l, + i, + r, + s, + e.glyphOffsetArray, + p, + _, + I, + E, + C, + g, + c, + h, + ).notEnoughRoom)) && + gt(v.numGlyphs, _); + } + a + ? e.text.dynamicLayoutVertexBuffer.updateData(_) + : e.icon.dynamicLayoutVertexBuffer.updateData(_); + } + function ut(t, e, i, o, a, r, s, n, l, c, h, u, d) { + const m = n.glyphStartIndex + n.numGlyphs, + _ = n.lineStartIndex, + p = n.lineStartIndex + n.lineLength, + f = e.getoffsetX(n.glyphStartIndex), + g = e.getoffsetX(m - 1), + x = pt(t * f, i, o, a, r, s, n.segment, _, p, l, c, h, u, d); + if (!x) return null; + const v = pt(t * g, i, o, a, r, s, n.segment, _, p, l, c, h, u, d); + return v ? { first: x, last: v } : null; + } + function dt(e, i, o, a) { + return e === t.WritingMode.horizontal && + Math.abs(o.y - i.y) > Math.abs(o.x - i.x) * a + ? { useVertical: !0 } + : (e === t.WritingMode.vertical ? i.y < o.y : i.x > o.x) + ? { needsFlipping: !0 } + : null; + } + function mt(e, i, o, a, r, s, n, l, c, h, u, d, m, _, p, f) { + const g = i / 24, + x = e.lineOffsetX * g, + v = e.lineOffsetY * g; + let y; + if (e.numGlyphs > 1) { + const t = e.glyphStartIndex + e.numGlyphs, + i = e.lineStartIndex, + r = e.lineStartIndex + e.lineLength, + h = ut(g, l, x, v, o, u, d, e, c, s, m, p, f); + if (!h) return { notEnoughRoom: !0 }; + const b = nt(h.first.point, n, f).point, + w = nt(h.last.point, n, f).point; + if (a && !o) { + const t = dt(e.writingMode, b, w, _); + if (t) return t; + } + y = [h.first]; + for (let a = e.glyphStartIndex + 1; a < t - 1; a++) + y.push( + pt( + g * l.getoffsetX(a), + x, + v, + o, + u, + d, + e.segment, + i, + r, + c, + s, + m, + p, + f, + ), + ); + y.push(h.last); + } else { + if (a && !o) { + const i = nt(d, r, f).point, + o = e.lineStartIndex + e.segment + 1, + a = new t.pointGeometry(c.getx(o), c.gety(o)), + s = nt(a, r, f), + n = s.signedDistanceFromCamera > 0 ? s.point : _t(d, a, i, 1, r, f), + l = dt(e.writingMode, i, n, _); + if (l) return l; + } + const i = pt( + g * l.getoffsetX(e.glyphStartIndex), + x, + v, + o, + u, + d, + e.segment, + e.lineStartIndex, + e.lineStartIndex + e.lineLength, + c, + s, + m, + p, + f, + ); + if (!i) return { notEnoughRoom: !0 }; + y = [i]; + } + for (const e of y) t.addDynamicAttributes(h, e.point, e.angle); + return {}; + } + function _t(t, e, i, o, a, r) { + const s = nt(t.add(t.sub(e)._unit()), a, r).point, + n = i.sub(s); + return i.add(n._mult(o / n.mag())); + } + function pt(e, i, o, a, r, s, n, l, c, h, u, d, m, _) { + const p = a ? e - i : e + i; + let f = p > 0 ? 1 : -1, + g = 0; + a && ((f *= -1), (g = Math.PI)), f < 0 && (g += Math.PI); + let x = f > 0 ? l + n : l + n + 1, + v = r, + y = r, + b = 0, + w = 0; + const T = Math.abs(p), + E = []; + for (; b + w <= T; ) { + if (((x += f), x < l || x >= c)) return null; + if (((y = v), E.push(v), (v = d[x]), void 0 === v)) { + const e = new t.pointGeometry(h.getx(x), h.gety(x)), + i = nt(e, u, _); + if (i.signedDistanceFromCamera > 0) v = d[x] = i.point; + else { + const i = x - f; + v = _t( + 0 === b ? s : new t.pointGeometry(h.getx(i), h.gety(i)), + e, + y, + T - b + 1, + u, + _, + ); + } + } + (b += w), (w = y.dist(v)); + } + const I = (T - b) / w, + C = v.sub(y), + S = C.mult(I)._add(y); + S._add( + C._unit() + ._perp() + ._mult(o * f), + ); + const D = g + Math.atan2(v.y - y.y, v.x - y.x); + return E.push(S), { point: S, angle: m ? D : 0, path: E }; + } + const ft = new Float32Array([ + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + -1 / 0, + -1 / 0, + 0, + ]); + function gt(t, e) { + for (let i = 0; i < t; i++) { + const t = e.length; + e.resize(t + 4), e.float32.set(ft, 3 * t); + } + } + function xt(t, e, i) { + const o = e[0], + a = e[1]; + return ( + (t[0] = i[0] * o + i[4] * a + i[12]), + (t[1] = i[1] * o + i[5] * a + i[13]), + (t[3] = i[3] * o + i[7] * a + i[15]), + t + ); + } + const vt = 100; + class yt { + constructor( + t, + e = new at(t.width + 200, t.height + 200, 25), + i = new at(t.width + 200, t.height + 200, 25), + ) { + (this.transform = t), + (this.grid = e), + (this.ignoredGrid = i), + (this.pitchfactor = Math.cos(t._pitch) * t.cameraToCenterDistance), + (this.screenRightBoundary = t.width + vt), + (this.screenBottomBoundary = t.height + vt), + (this.gridRightBoundary = t.width + 200), + (this.gridBottomBoundary = t.height + 200), + (this.perspectiveRatioCutoff = 0.6); + } + placeCollisionBox(t, e, i, o, a, r) { + const s = this.projectAndGetPerspectiveRatio( + o, + t.anchorPointX, + t.anchorPointY, + r, + ), + n = i * s.perspectiveRatio, + l = t.x1 * n + s.point.x, + c = t.y1 * n + s.point.y, + h = t.x2 * n + s.point.x, + u = t.y2 * n + s.point.y; + return !this.isInsideGrid(l, c, h, u) || + ('always' !== e && this.grid.hitTest(l, c, h, u, e, a)) || + s.perspectiveRatio < this.perspectiveRatioCutoff + ? { box: [], offscreen: !1 } + : { box: [l, c, h, u], offscreen: this.isOffscreen(l, c, h, u) }; + } + placeCollisionCircles(e, i, o, a, r, s, n, l, c, h, u, d, m, _) { + const p = [], + f = new t.pointGeometry(i.anchorX, i.anchorY), + g = nt(f, s, _), + x = lt( + this.transform.cameraToCenterDistance, + g.signedDistanceFromCamera, + ), + v = (h ? r / x : r * x) / t.ONE_EM, + y = nt(f, n, _).point, + b = ut( + v, + a, + i.lineOffsetX * v, + i.lineOffsetY * v, + !1, + y, + f, + i, + o, + n, + {}, + !1, + _, + ); + let w = !1, + T = !1, + E = !0; + if (b) { + const i = 0.5 * d * x + m, + o = new t.pointGeometry(-100, -100), + a = new t.pointGeometry( + this.screenRightBoundary, + this.screenBottomBoundary, + ), + r = new it(), + s = b.first, + n = b.last; + let h = []; + for (let t = s.path.length - 1; t >= 1; t--) h.push(s.path[t]); + for (let t = 1; t < n.path.length; t++) h.push(n.path[t]); + const f = 2.5 * i; + if (l) { + const t = h.map((t) => nt(t, l, _)); + h = t.some((t) => t.signedDistanceFromCamera <= 0) + ? [] + : t.map((t) => t.point); + } + let g = []; + if (h.length > 0) { + const e = h[0].clone(), + i = h[0].clone(); + for (let t = 1; t < h.length; t++) + (e.x = Math.min(e.x, h[t].x)), + (e.y = Math.min(e.y, h[t].y)), + (i.x = Math.max(i.x, h[t].x)), + (i.y = Math.max(i.y, h[t].y)); + g = + e.x >= o.x && i.x <= a.x && e.y >= o.y && i.y <= a.y + ? [h] + : i.x < o.x || e.x > a.x || i.y < o.y || e.y > a.y + ? [] + : t.clipLine([h], o.x, o.y, a.x, a.y); + } + for (const t of g) { + r.reset(t, 0.25 * i); + let o = 0; + o = r.length <= 0.5 * i ? 1 : Math.ceil(r.paddedLength / f) + 1; + for (let t = 0; t < o; t++) { + const a = t / Math.max(o - 1, 1), + s = r.lerp(a), + n = s.x + vt, + l = s.y + vt; + p.push(n, l, i, 0); + const h = n - i, + d = l - i, + m = n + i, + _ = l + i; + if ( + ((E = E && this.isOffscreen(h, d, m, _)), + (T = T || this.isInsideGrid(h, d, m, _)), + 'always' !== e && + this.grid.hitTestCircle(n, l, i, e, u) && + ((w = !0), !c)) + ) + return { circles: [], offscreen: !1, collisionDetected: w }; + } + } + } + return { + circles: (!c && w) || !T || x < this.perspectiveRatioCutoff ? [] : p, + offscreen: E, + collisionDetected: w, + }; + } + queryRenderedSymbols(e) { + if ( + 0 === e.length || + (0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) + ) + return {}; + const i = []; + let o = 1 / 0, + a = 1 / 0, + r = -1 / 0, + s = -1 / 0; + for (const n of e) { + const e = new t.pointGeometry(n.x + vt, n.y + vt); + (o = Math.min(o, e.x)), + (a = Math.min(a, e.y)), + (r = Math.max(r, e.x)), + (s = Math.max(s, e.y)), + i.push(e); + } + const n = this.grid + .query(o, a, r, s) + .concat(this.ignoredGrid.query(o, a, r, s)), + l = {}, + c = {}; + for (const e of n) { + const o = e.key; + if ( + (void 0 === l[o.bucketInstanceId] && (l[o.bucketInstanceId] = {}), + l[o.bucketInstanceId][o.featureIndex]) + ) + continue; + const a = [ + new t.pointGeometry(e.x1, e.y1), + new t.pointGeometry(e.x2, e.y1), + new t.pointGeometry(e.x2, e.y2), + new t.pointGeometry(e.x1, e.y2), + ]; + t.polygonIntersectsPolygon(i, a) && + ((l[o.bucketInstanceId][o.featureIndex] = !0), + void 0 === c[o.bucketInstanceId] && (c[o.bucketInstanceId] = []), + c[o.bucketInstanceId].push(o.featureIndex)); + } + return c; + } + insertCollisionBox(t, e, i, o, a, r) { + (i ? this.ignoredGrid : this.grid).insert( + { + bucketInstanceId: o, + featureIndex: a, + collisionGroupID: r, + overlapMode: e, + }, + t[0], + t[1], + t[2], + t[3], + ); + } + insertCollisionCircles(t, e, i, o, a, r) { + const s = i ? this.ignoredGrid : this.grid, + n = { + bucketInstanceId: o, + featureIndex: a, + collisionGroupID: r, + overlapMode: e, + }; + for (let e = 0; e < t.length; e += 4) + s.insertCircle(n, t[e], t[e + 1], t[e + 2]); + } + projectAndGetPerspectiveRatio(e, i, o, a) { + let r; + return ( + a + ? ((r = [i, o, a(i, o), 1]), t.transformMat4(r, r, e)) + : ((r = [i, o, 0, 1]), xt(r, r, e)), + { + point: new t.pointGeometry( + ((r[0] / r[3] + 1) / 2) * this.transform.width + vt, + ((-r[1] / r[3] + 1) / 2) * this.transform.height + vt, + ), + perspectiveRatio: + 0.5 + (this.transform.cameraToCenterDistance / r[3]) * 0.5, + } + ); + } + isOffscreen(t, e, i, o) { + return ( + i < vt || + t >= this.screenRightBoundary || + o < vt || + e > this.screenBottomBoundary + ); + } + isInsideGrid(t, e, i, o) { + return ( + i >= 0 && + t < this.gridRightBoundary && + o >= 0 && + e < this.gridBottomBoundary + ); + } + getViewportMatrix() { + const e = t.identity([]); + return t.translate(e, e, [-100, -100, 0]), e; + } + } + function bt(e, i, o) { + return ( + i * (t.EXTENT / (e.tileSize * Math.pow(2, o - e.tileID.overscaledZ))) + ); + } + class wt { + constructor(t, e, i, o) { + (this.opacity = t + ? Math.max(0, Math.min(1, t.opacity + (t.placed ? e : -e))) + : o && i + ? 1 + : 0), + (this.placed = i); + } + isHidden() { + return 0 === this.opacity && !this.placed; + } + } + class Tt { + constructor(t, e, i, o, a) { + (this.text = new wt(t ? t.text : null, e, i, a)), + (this.icon = new wt(t ? t.icon : null, e, o, a)); + } + isHidden() { + return this.text.isHidden() && this.icon.isHidden(); + } + } + class Et { + constructor(t, e, i) { + (this.text = t), (this.icon = e), (this.skipFade = i); + } + } + class It { + constructor() { + (this.invProjMatrix = t.create()), + (this.viewportMatrix = t.create()), + (this.circles = []); + } + } + class Ct { + constructor(t, e, i, o, a) { + (this.bucketInstanceId = t), + (this.featureIndex = e), + (this.sourceLayerIndex = i), + (this.bucketIndex = o), + (this.tileID = a); + } + } + class St { + constructor(t) { + (this.crossSourceCollisions = t), + (this.maxGroupID = 0), + (this.collisionGroups = {}); + } + get(t) { + if (this.crossSourceCollisions) return { ID: 0, predicate: null }; + if (!this.collisionGroups[t]) { + const e = ++this.maxGroupID; + this.collisionGroups[t] = { + ID: e, + predicate: (t) => t.collisionGroupID === e, + }; + } + return this.collisionGroups[t]; + } + } + function Dt(e, i, o, a, r) { + const { horizontalAlign: s, verticalAlign: n } = t.getAnchorAlignment(e), + l = -(s - 0.5) * i, + c = -(n - 0.5) * o, + h = t.evaluateVariableOffset(e, a); + return new t.pointGeometry(l + h[0] * r, c + h[1] * r); + } + function zt(e, i, o, a, r, s) { + const { + x1: n, + x2: l, + y1: c, + y2: h, + anchorPointX: u, + anchorPointY: d, + } = e, + m = new t.pointGeometry(i, o); + return ( + a && m._rotate(r ? s : -s), + { + x1: n + m.x, + y1: c + m.y, + x2: l + m.x, + y2: h + m.y, + anchorPointX: u, + anchorPointY: d, + } + ); + } + class Pt { + constructor(t, e, i, o, a) { + (this.transform = t.clone()), + (this.terrain = e), + (this.collisionIndex = new yt(this.transform)), + (this.placements = {}), + (this.opacities = {}), + (this.variableOffsets = {}), + (this.stale = !1), + (this.commitTime = 0), + (this.fadeDuration = i), + (this.retainedQueryData = {}), + (this.collisionGroups = new St(o)), + (this.collisionCircleArrays = {}), + (this.prevPlacement = a), + a && (a.prevPlacement = void 0), + (this.placedOrientations = {}); + } + getBucketParts(e, i, o, a) { + const r = o.getBucket(i), + s = o.latestFeatureIndex; + if (!r || !s || i.id !== r.layerIds[0]) return; + const n = o.collisionBoxArray, + l = r.layers[0].layout, + c = Math.pow(2, this.transform.zoom - o.tileID.overscaledZ), + h = o.tileSize / t.EXTENT, + u = this.transform.calculatePosMatrix(o.tileID.toUnwrapped()), + d = 'map' === l.get('text-pitch-alignment'), + m = 'map' === l.get('text-rotation-alignment'), + _ = bt(o, 1, this.transform.zoom), + p = rt(u, d, m, this.transform, _); + let f = null; + if (d) { + const e = st(u, d, m, this.transform, _); + f = t.multiply([], this.transform.labelPlaneMatrix, e); + } + this.retainedQueryData[r.bucketInstanceId] = new Ct( + r.bucketInstanceId, + s, + r.sourceLayerIndex, + r.index, + o.tileID, + ); + const g = { + bucket: r, + layout: l, + posMatrix: u, + textLabelPlaneMatrix: p, + labelToScreenMatrix: f, + scale: c, + textPixelRatio: h, + holdingForFade: o.holdingForFade(), + collisionBoxArray: n, + partiallyEvaluatedTextSize: t.evaluateSizeForZoom( + r.textSizeData, + this.transform.zoom, + ), + collisionGroup: this.collisionGroups.get(r.sourceID), + }; + if (a) + for (const t of r.sortKeyRanges) { + const { + sortKey: i, + symbolInstanceStart: o, + symbolInstanceEnd: a, + } = t; + e.push({ + sortKey: i, + symbolInstanceStart: o, + symbolInstanceEnd: a, + parameters: g, + }); + } + else + e.push({ + symbolInstanceStart: 0, + symbolInstanceEnd: r.symbolInstances.length, + parameters: g, + }); + } + attemptAnchorPlacement(t, e, i, o, a, r, s, n, l, c, h, u, d, m, _, p) { + const f = [u.textOffset0, u.textOffset1], + g = Dt(t, i, o, f, a), + x = this.collisionIndex.placeCollisionBox( + zt(e, g.x, g.y, r, s, this.transform.angle), + h, + n, + l, + c.predicate, + p, + ); + if ( + (!_ || + 0 !== + this.collisionIndex.placeCollisionBox( + zt(_, g.x, g.y, r, s, this.transform.angle), + h, + n, + l, + c.predicate, + p, + ).box.length) && + x.box.length > 0 + ) { + let e; + if ( + (this.prevPlacement && + this.prevPlacement.variableOffsets[u.crossTileID] && + this.prevPlacement.placements[u.crossTileID] && + this.prevPlacement.placements[u.crossTileID].text && + (e = this.prevPlacement.variableOffsets[u.crossTileID].anchor), + 0 === u.crossTileID) + ) + throw new Error("symbolInstance.crossTileID can't be 0"); + return ( + (this.variableOffsets[u.crossTileID] = { + textOffset: f, + width: i, + height: o, + anchor: t, + textBoxScale: a, + prevAnchor: e, + }), + this.markUsedJustification(d, t, u, m), + d.allowVerticalPlacement && + (this.markUsedOrientation(d, m, u), + (this.placedOrientations[u.crossTileID] = m)), + { shift: g, placedGlyphBoxes: x } + ); + } + } + placeLayerBucketPart(e, i, o) { + const { + bucket: a, + layout: r, + posMatrix: s, + textLabelPlaneMatrix: n, + labelToScreenMatrix: l, + textPixelRatio: c, + holdingForFade: h, + collisionBoxArray: u, + partiallyEvaluatedTextSize: d, + collisionGroup: m, + } = e.parameters, + _ = r.get('text-optional'), + p = r.get('icon-optional'), + f = t.getOverlapMode(r, 'text-overlap', 'text-allow-overlap'), + g = 'always' === f, + x = t.getOverlapMode(r, 'icon-overlap', 'icon-allow-overlap'), + v = 'always' === x, + y = 'map' === r.get('text-rotation-alignment'), + b = 'map' === r.get('text-pitch-alignment'), + w = 'none' !== r.get('icon-text-fit'), + T = 'viewport-y' === r.get('symbol-z-order'), + E = g && (v || !a.hasIconData() || p), + I = v && (g || !a.hasTextData() || _); + !a.collisionArrays && u && a.deserializeCollisionBoxes(u); + const C = (e, u) => { + if (i[e.crossTileID]) return; + if (h) + return void (this.placements[e.crossTileID] = new Et(!1, !1, !1)); + let v = !1, + T = !1, + C = !0, + S = null, + D = { box: null, offscreen: null }, + z = { box: null, offscreen: null }, + P = null, + M = null, + A = null, + L = 0, + R = 0, + k = 0; + u.textFeatureIndex + ? (L = u.textFeatureIndex) + : e.useRuntimeCollisionCircles && (L = e.featureIndex), + u.verticalTextFeatureIndex && (R = u.verticalTextFeatureIndex); + const B = this.retainedQueryData[a.bucketInstanceId].tileID, + F = this.terrain + ? (t, e) => this.terrain.getElevation(B, t, e) + : null; + for (const t of [ + 'textBox', + 'verticalTextBox', + 'iconBox', + 'verticalIconBox', + ]) { + const e = u[t]; + e && (e.elevation = F ? F(e.anchorPointX, e.anchorPointY) : 0); + } + const O = u.textBox; + if (O) { + const i = (i) => { + let o = t.WritingMode.horizontal; + if (a.allowVerticalPlacement && !i && this.prevPlacement) { + const t = + this.prevPlacement.placedOrientations[e.crossTileID]; + t && + ((this.placedOrientations[e.crossTileID] = t), + (o = t), + this.markUsedOrientation(a, o, e)); + } + return o; + }, + o = (i, o) => { + if ( + a.allowVerticalPlacement && + e.numVerticalGlyphVertices > 0 && + u.verticalTextBox + ) { + for (const e of a.writingModes) + if ( + (e === t.WritingMode.vertical + ? ((D = o()), (z = D)) + : (D = i()), + D && D.box && D.box.length) + ) + break; + } else D = i(); + }; + if (r.get('text-variable-anchor')) { + let n = r.get('text-variable-anchor'); + if ( + this.prevPlacement && + this.prevPlacement.variableOffsets[e.crossTileID] + ) { + const t = this.prevPlacement.variableOffsets[e.crossTileID]; + n.indexOf(t.anchor) > 0 && + ((n = n.filter((e) => e !== t.anchor)), n.unshift(t.anchor)); + } + const l = (t, i, o) => { + const r = t.x2 - t.x1, + l = t.y2 - t.y1, + h = e.textBoxScale, + u = w && 'never' === x ? i : null; + let d = { box: [], offscreen: !1 }; + const _ = 'never' !== f ? 2 * n.length : n.length; + for (let i = 0; i < _; ++i) { + const _ = this.attemptAnchorPlacement( + n[i % n.length], + t, + r, + l, + h, + y, + b, + c, + s, + m, + i >= n.length ? f : 'never', + e, + a, + o, + u, + F, + ); + if ( + _ && + ((d = _.placedGlyphBoxes), d && d.box && d.box.length) + ) { + (v = !0), (S = _.shift); + break; + } + } + return d; + }; + o( + () => l(O, u.iconBox, t.WritingMode.horizontal), + () => { + const i = u.verticalTextBox; + return a.allowVerticalPlacement && + !(D && D.box && D.box.length) && + e.numVerticalGlyphVertices > 0 && + i + ? l(i, u.verticalIconBox, t.WritingMode.vertical) + : { box: null, offscreen: null }; + }, + ), + D && ((v = D.box), (C = D.offscreen)); + const h = i(D && D.box); + if (!v && this.prevPlacement) { + const t = this.prevPlacement.variableOffsets[e.crossTileID]; + t && + ((this.variableOffsets[e.crossTileID] = t), + this.markUsedJustification(a, t.anchor, e, h)); + } + } else { + const r = (t, i) => { + const o = this.collisionIndex.placeCollisionBox( + t, + f, + c, + s, + m.predicate, + F, + ); + return ( + o && + o.box && + o.box.length && + (this.markUsedOrientation(a, i, e), + (this.placedOrientations[e.crossTileID] = i)), + o + ); + }; + o( + () => r(O, t.WritingMode.horizontal), + () => { + const i = u.verticalTextBox; + return a.allowVerticalPlacement && + e.numVerticalGlyphVertices > 0 && + i + ? r(i, t.WritingMode.vertical) + : { box: null, offscreen: null }; + }, + ), + i(D && D.box && D.box.length); + } + } + if ( + ((P = D), + (v = P && P.box && P.box.length > 0), + (C = P && P.offscreen), + e.useRuntimeCollisionCircles) + ) { + const i = a.text.placedSymbolArray.get( + e.centerJustifiedTextSymbolIndex, + ), + c = t.evaluateSizeForFeature(a.textSizeData, d, i), + h = r.get('text-padding'); + (M = this.collisionIndex.placeCollisionCircles( + f, + i, + a.lineVertexArray, + a.glyphOffsetArray, + c, + s, + n, + l, + o, + b, + m.predicate, + e.collisionCircleDiameter, + h, + F, + )), + M.circles.length && + M.collisionDetected && + !o && + t.warnOnce( + 'Collisions detected, but collision boxes are not shown', + ), + (v = g || (M.circles.length > 0 && !M.collisionDetected)), + (C = C && M.offscreen); + } + if ((u.iconFeatureIndex && (k = u.iconFeatureIndex), u.iconBox)) { + const t = (t) => { + const e = + w && S ? zt(t, S.x, S.y, y, b, this.transform.angle) : t; + return this.collisionIndex.placeCollisionBox( + e, + x, + c, + s, + m.predicate, + F, + ); + }; + z && z.box && z.box.length && u.verticalIconBox + ? ((A = t(u.verticalIconBox)), (T = A.box.length > 0)) + : ((A = t(u.iconBox)), (T = A.box.length > 0)), + (C = C && A.offscreen); + } + const U = + _ || + (0 === e.numHorizontalGlyphVertices && + 0 === e.numVerticalGlyphVertices), + N = p || 0 === e.numIconVertices; + if ( + (U || N ? (N ? U || (T = T && v) : (v = T && v)) : (T = v = T && v), + v && + P && + P.box && + this.collisionIndex.insertCollisionBox( + P.box, + f, + r.get('text-ignore-placement'), + a.bucketInstanceId, + z && z.box && R ? R : L, + m.ID, + ), + T && + A && + this.collisionIndex.insertCollisionBox( + A.box, + x, + r.get('icon-ignore-placement'), + a.bucketInstanceId, + k, + m.ID, + ), + M && + (v && + this.collisionIndex.insertCollisionCircles( + M.circles, + f, + r.get('text-ignore-placement'), + a.bucketInstanceId, + L, + m.ID, + ), + o)) + ) { + const t = a.bucketInstanceId; + let e = this.collisionCircleArrays[t]; + void 0 === e && (e = this.collisionCircleArrays[t] = new It()); + for (let t = 0; t < M.circles.length; t += 4) + e.circles.push(M.circles[t + 0]), + e.circles.push(M.circles[t + 1]), + e.circles.push(M.circles[t + 2]), + e.circles.push(M.collisionDetected ? 1 : 0); + } + if (0 === e.crossTileID) + throw new Error("symbolInstance.crossTileID can't be 0"); + if (0 === a.bucketInstanceId) + throw new Error("bucket.bucketInstanceId can't be 0"); + (this.placements[e.crossTileID] = new Et( + v || E, + T || I, + C || a.justReloaded, + )), + (i[e.crossTileID] = !0); + }; + if (T) { + if (0 !== e.symbolInstanceStart) + throw new Error('bucket.bucketInstanceId should be 0'); + const t = a.getSortedSymbolIndexes(this.transform.angle); + for (let e = t.length - 1; e >= 0; --e) { + const i = t[e]; + C(a.symbolInstances.get(i), a.collisionArrays[i]); + } + } else for (let t = e.symbolInstanceStart; t < e.symbolInstanceEnd; t++) C(a.symbolInstances.get(t), a.collisionArrays[t]); + if (o && a.bucketInstanceId in this.collisionCircleArrays) { + const e = this.collisionCircleArrays[a.bucketInstanceId]; + t.invert(e.invProjMatrix, s), + (e.viewportMatrix = this.collisionIndex.getViewportMatrix()); + } + a.justReloaded = !1; + } + markUsedJustification(e, i, o, a) { + let r; + r = + a === t.WritingMode.vertical + ? o.verticalPlacedTextSymbolIndex + : { + left: o.leftJustifiedTextSymbolIndex, + center: o.centerJustifiedTextSymbolIndex, + right: o.rightJustifiedTextSymbolIndex, + }[t.getAnchorJustification(i)]; + const s = [ + o.leftJustifiedTextSymbolIndex, + o.centerJustifiedTextSymbolIndex, + o.rightJustifiedTextSymbolIndex, + o.verticalPlacedTextSymbolIndex, + ]; + for (const t of s) + t >= 0 && + (e.text.placedSymbolArray.get(t).crossTileID = + r >= 0 && t !== r ? 0 : o.crossTileID); + } + markUsedOrientation(e, i, o) { + const a = + i === t.WritingMode.horizontal || i === t.WritingMode.horizontalOnly + ? i + : 0, + r = i === t.WritingMode.vertical ? i : 0, + s = [ + o.leftJustifiedTextSymbolIndex, + o.centerJustifiedTextSymbolIndex, + o.rightJustifiedTextSymbolIndex, + ]; + for (const t of s) + e.text.placedSymbolArray.get(t).placedOrientation = a; + o.verticalPlacedTextSymbolIndex && + (e.text.placedSymbolArray.get( + o.verticalPlacedTextSymbolIndex, + ).placedOrientation = r); + } + commit(t) { + (this.commitTime = t), + (this.zoomAtLastRecencyCheck = this.transform.zoom); + const e = this.prevPlacement; + let i = !1; + this.prevZoomAdjustment = e ? e.zoomAdjustment(this.transform.zoom) : 0; + const o = e ? e.symbolFadeChange(t) : 1, + a = e ? e.opacities : {}, + r = e ? e.variableOffsets : {}, + s = e ? e.placedOrientations : {}; + for (const t in this.placements) { + const e = this.placements[t], + r = a[t]; + r + ? ((this.opacities[t] = new Tt(r, o, e.text, e.icon)), + (i = i || e.text !== r.text.placed || e.icon !== r.icon.placed)) + : ((this.opacities[t] = new Tt( + null, + o, + e.text, + e.icon, + e.skipFade, + )), + (i = i || e.text || e.icon)); + } + for (const t in a) { + const e = a[t]; + if (!this.opacities[t]) { + const a = new Tt(e, o, !1, !1); + a.isHidden() || + ((this.opacities[t] = a), + (i = i || e.text.placed || e.icon.placed)); + } + } + for (const t in r) + this.variableOffsets[t] || + !this.opacities[t] || + this.opacities[t].isHidden() || + (this.variableOffsets[t] = r[t]); + for (const t in s) + this.placedOrientations[t] || + !this.opacities[t] || + this.opacities[t].isHidden() || + (this.placedOrientations[t] = s[t]); + if (e && void 0 === e.lastPlacementChangeTime) + throw new Error( + 'Last placement time for previous placement is not defined', + ); + i + ? (this.lastPlacementChangeTime = t) + : 'number' != typeof this.lastPlacementChangeTime && + (this.lastPlacementChangeTime = e ? e.lastPlacementChangeTime : t); + } + updateLayerOpacities(t, e) { + const i = {}; + for (const o of e) { + const e = o.getBucket(t); + e && + o.latestFeatureIndex && + t.id === e.layerIds[0] && + this.updateBucketOpacities(e, i, o.collisionBoxArray); + } + } + updateBucketOpacities(e, i, o) { + e.hasTextData() && e.text.opacityVertexArray.clear(), + e.hasIconData() && e.icon.opacityVertexArray.clear(), + e.hasIconCollisionBoxData() && + e.iconCollisionBox.collisionVertexArray.clear(), + e.hasTextCollisionBoxData() && + e.textCollisionBox.collisionVertexArray.clear(); + const a = e.layers[0].layout, + r = new Tt(null, 0, !1, !1, !0), + s = a.get('text-allow-overlap'), + n = a.get('icon-allow-overlap'), + l = a.get('text-variable-anchor'), + c = 'map' === a.get('text-rotation-alignment'), + h = 'map' === a.get('text-pitch-alignment'), + u = 'none' !== a.get('icon-text-fit'), + d = new Tt( + null, + 0, + s && (n || !e.hasIconData() || a.get('icon-optional')), + n && (s || !e.hasTextData() || a.get('text-optional')), + !0, + ); + !e.collisionArrays && + o && + (e.hasIconCollisionBoxData() || e.hasTextCollisionBoxData()) && + e.deserializeCollisionBoxes(o); + const m = (t, e, i) => { + for (let o = 0; o < e / 4; o++) t.opacityVertexArray.emplaceBack(i); + }; + for (let o = 0; o < e.symbolInstances.length; o++) { + const a = e.symbolInstances.get(o), + { + numHorizontalGlyphVertices: s, + numVerticalGlyphVertices: n, + crossTileID: _, + } = a; + let p = this.opacities[_]; + i[_] ? (p = r) : p || ((p = d), (this.opacities[_] = p)), (i[_] = !0); + const f = a.numIconVertices > 0, + g = this.placedOrientations[a.crossTileID], + x = g === t.WritingMode.vertical, + v = + g === t.WritingMode.horizontal || + g === t.WritingMode.horizontalOnly; + if (s > 0 || n > 0) { + const t = Ut(p.text); + m(e.text, s, x ? Nt : t), m(e.text, n, v ? Nt : t); + const i = p.text.isHidden(); + [ + a.rightJustifiedTextSymbolIndex, + a.centerJustifiedTextSymbolIndex, + a.leftJustifiedTextSymbolIndex, + ].forEach((t) => { + t >= 0 && + (e.text.placedSymbolArray.get(t).hidden = i || x ? 1 : 0); + }), + a.verticalPlacedTextSymbolIndex >= 0 && + (e.text.placedSymbolArray.get( + a.verticalPlacedTextSymbolIndex, + ).hidden = i || v ? 1 : 0); + const o = this.variableOffsets[a.crossTileID]; + o && this.markUsedJustification(e, o.anchor, a, g); + const r = this.placedOrientations[a.crossTileID]; + r && + (this.markUsedJustification(e, 'left', a, r), + this.markUsedOrientation(e, r, a)); + } + if (f) { + const t = Ut(p.icon), + i = !(u && a.verticalPlacedIconSymbolIndex && x); + a.placedIconSymbolIndex >= 0 && + (m(e.icon, a.numIconVertices, i ? t : Nt), + (e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden = + p.icon.isHidden())), + a.verticalPlacedIconSymbolIndex >= 0 && + (m(e.icon, a.numVerticalIconVertices, i ? Nt : t), + (e.icon.placedSymbolArray.get( + a.verticalPlacedIconSymbolIndex, + ).hidden = p.icon.isHidden())); + } + if (e.hasIconCollisionBoxData() || e.hasTextCollisionBoxData()) { + const i = e.collisionArrays[o]; + if (i) { + let o = new t.pointGeometry(0, 0); + if (i.textBox || i.verticalTextBox) { + let t = !0; + if (l) { + const e = this.variableOffsets[_]; + e + ? ((o = Dt( + e.anchor, + e.width, + e.height, + e.textOffset, + e.textBoxScale, + )), + c && + o._rotate( + h ? this.transform.angle : -this.transform.angle, + )) + : (t = !1); + } + i.textBox && + Mt( + e.textCollisionBox.collisionVertexArray, + p.text.placed, + !t || x, + o.x, + o.y, + ), + i.verticalTextBox && + Mt( + e.textCollisionBox.collisionVertexArray, + p.text.placed, + !t || v, + o.x, + o.y, + ); + } + const a = Boolean(!v && i.verticalIconBox); + i.iconBox && + Mt( + e.iconCollisionBox.collisionVertexArray, + p.icon.placed, + a, + u ? o.x : 0, + u ? o.y : 0, + ), + i.verticalIconBox && + Mt( + e.iconCollisionBox.collisionVertexArray, + p.icon.placed, + !a, + u ? o.x : 0, + u ? o.y : 0, + ); + } + } + } + if ( + (e.sortFeatures(this.transform.angle), + this.retainedQueryData[e.bucketInstanceId] && + (this.retainedQueryData[e.bucketInstanceId].featureSortOrder = + e.featureSortOrder), + e.hasTextData() && + e.text.opacityVertexBuffer && + e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray), + e.hasIconData() && + e.icon.opacityVertexBuffer && + e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray), + e.hasIconCollisionBoxData() && + e.iconCollisionBox.collisionVertexBuffer && + e.iconCollisionBox.collisionVertexBuffer.updateData( + e.iconCollisionBox.collisionVertexArray, + ), + e.hasTextCollisionBoxData() && + e.textCollisionBox.collisionVertexBuffer && + e.textCollisionBox.collisionVertexBuffer.updateData( + e.textCollisionBox.collisionVertexArray, + ), + e.text.opacityVertexArray.length !== + e.text.layoutVertexArray.length / 4) + ) + throw new Error( + `bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`, + ); + if ( + e.icon.opacityVertexArray.length !== + e.icon.layoutVertexArray.length / 4 + ) + throw new Error( + `bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`, + ); + if (e.bucketInstanceId in this.collisionCircleArrays) { + const t = this.collisionCircleArrays[e.bucketInstanceId]; + (e.placementInvProjMatrix = t.invProjMatrix), + (e.placementViewportMatrix = t.viewportMatrix), + (e.collisionCircleArray = t.circles), + delete this.collisionCircleArrays[e.bucketInstanceId]; + } + } + symbolFadeChange(t) { + return 0 === this.fadeDuration + ? 1 + : (t - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment; + } + zoomAdjustment(t) { + return Math.max(0, (this.transform.zoom - t) / 1.5); + } + hasTransitions(t) { + return ( + this.stale || t - this.lastPlacementChangeTime < this.fadeDuration + ); + } + stillRecent(t, e) { + const i = + this.zoomAtLastRecencyCheck === e ? 1 - this.zoomAdjustment(e) : 1; + return ( + (this.zoomAtLastRecencyCheck = e), + this.commitTime + this.fadeDuration * i > t + ); + } + setStale() { + this.stale = !0; + } + } + function Mt(t, e, i, o, a) { + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, a || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, a || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, a || 0), + t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, a || 0); + } + const At = Math.pow(2, 25), + Lt = Math.pow(2, 24), + Rt = Math.pow(2, 17), + kt = Math.pow(2, 16), + Bt = Math.pow(2, 9), + Ft = Math.pow(2, 8), + Ot = Math.pow(2, 1); + function Ut(t) { + if (0 === t.opacity && !t.placed) return 0; + if (1 === t.opacity && t.placed) return 4294967295; + const e = t.placed ? 1 : 0, + i = Math.floor(127 * t.opacity); + return i * At + e * Lt + i * Rt + e * kt + i * Bt + e * Ft + i * Ot + e; + } + const Nt = 0; + class Gt { + constructor(t) { + (this._sortAcrossTiles = + 'viewport-y' !== t.layout.get('symbol-z-order') && + !t.layout.get('symbol-sort-key').isConstant()), + (this._currentTileIndex = 0), + (this._currentPartIndex = 0), + (this._seenCrossTileIDs = {}), + (this._bucketParts = []); + } + continuePlacement(t, e, i, o, a) { + const r = this._bucketParts; + for (; this._currentTileIndex < t.length; ) + if ( + (e.getBucketParts( + r, + o, + t[this._currentTileIndex], + this._sortAcrossTiles, + ), + this._currentTileIndex++, + a()) + ) + return !0; + for ( + this._sortAcrossTiles && + ((this._sortAcrossTiles = !1), + r.sort((t, e) => t.sortKey - e.sortKey)); + this._currentPartIndex < r.length; + + ) + if ( + (e.placeLayerBucketPart( + r[this._currentPartIndex], + this._seenCrossTileIDs, + i, + ), + this._currentPartIndex++, + a()) + ) + return !0; + return !1; + } + } + class Zt { + constructor(t, e, i, o, a, r, s, n) { + (this.placement = new Pt(t, e, r, s, n)), + (this._currentPlacementIndex = i.length - 1), + (this._forceFullPlacement = o), + (this._showCollisionBoxes = a), + (this._done = !1); + } + isDone() { + return this._done; + } + continuePlacement(e, i, o) { + const a = t.exported.now(), + r = () => { + const e = t.exported.now() - a; + return !this._forceFullPlacement && e > 2; + }; + for (; this._currentPlacementIndex >= 0; ) { + const t = i[e[this._currentPlacementIndex]], + a = this.placement.collisionIndex.transform.zoom; + if ( + 'symbol' === t.type && + (!t.minzoom || t.minzoom <= a) && + (!t.maxzoom || t.maxzoom > a) + ) { + if ( + (this._inProgressLayer || (this._inProgressLayer = new Gt(t)), + this._inProgressLayer.continuePlacement( + o[t.source], + this.placement, + this._showCollisionBoxes, + t, + r, + )) + ) + return; + delete this._inProgressLayer; + } + this._currentPlacementIndex--; + } + this._done = !0; + } + commit(t) { + return this.placement.commit(t), this.placement; + } + } + const Vt = 512 / t.EXTENT / 2; + class qt { + constructor(t, e, i) { + (this.tileID = t), + (this.indexedSymbolInstances = {}), + (this.bucketInstanceId = i); + for (let i = 0; i < e.length; i++) { + const o = e.get(i), + a = o.key; + this.indexedSymbolInstances[a] || + (this.indexedSymbolInstances[a] = []), + this.indexedSymbolInstances[a].push({ + crossTileID: o.crossTileID, + coord: this.getScaledCoordinates(o, t), + }); + } + } + getScaledCoordinates(e, i) { + const o = Vt / Math.pow(2, i.canonical.z - this.tileID.canonical.z); + return { + x: Math.floor((i.canonical.x * t.EXTENT + e.anchorX) * o), + y: Math.floor((i.canonical.y * t.EXTENT + e.anchorY) * o), + }; + } + findMatches(t, e, i) { + const o = + this.tileID.canonical.z < e.canonical.z + ? 1 + : Math.pow(2, this.tileID.canonical.z - e.canonical.z); + for (let a = 0; a < t.length; a++) { + const r = t.get(a); + if (r.crossTileID) continue; + const s = this.indexedSymbolInstances[r.key]; + if (!s) continue; + const n = this.getScaledCoordinates(r, e); + for (const t of s) + if ( + Math.abs(t.coord.x - n.x) <= o && + Math.abs(t.coord.y - n.y) <= o && + !i[t.crossTileID] + ) { + (i[t.crossTileID] = !0), (r.crossTileID = t.crossTileID); + break; + } + } + } + } + class jt { + constructor() { + this.maxCrossTileID = 0; + } + generate() { + return ++this.maxCrossTileID; + } + } + class $t { + constructor() { + (this.indexes = {}), (this.usedCrossTileIDs = {}), (this.lng = 0); + } + handleWrapJump(t) { + const e = Math.round((t - this.lng) / 360); + if (0 !== e) + for (const t in this.indexes) { + const i = this.indexes[t], + o = {}; + for (const t in i) { + const a = i[t]; + (a.tileID = a.tileID.unwrapTo(a.tileID.wrap + e)), + (o[a.tileID.key] = a); + } + this.indexes[t] = o; + } + this.lng = t; + } + addBucket(t, e, i) { + if (this.indexes[t.overscaledZ] && this.indexes[t.overscaledZ][t.key]) { + if ( + this.indexes[t.overscaledZ][t.key].bucketInstanceId === + e.bucketInstanceId + ) + return !1; + this.removeBucketCrossTileIDs( + t.overscaledZ, + this.indexes[t.overscaledZ][t.key], + ); + } + for (let t = 0; t < e.symbolInstances.length; t++) + e.symbolInstances.get(t).crossTileID = 0; + this.usedCrossTileIDs[t.overscaledZ] || + (this.usedCrossTileIDs[t.overscaledZ] = {}); + const o = this.usedCrossTileIDs[t.overscaledZ]; + for (const i in this.indexes) { + const a = this.indexes[i]; + if (Number(i) > t.overscaledZ) + for (const i in a) { + const r = a[i]; + r.tileID.isChildOf(t) && r.findMatches(e.symbolInstances, t, o); + } + else { + const r = a[t.scaledTo(Number(i)).key]; + r && r.findMatches(e.symbolInstances, t, o); + } + } + for (let t = 0; t < e.symbolInstances.length; t++) { + const a = e.symbolInstances.get(t); + a.crossTileID || + ((a.crossTileID = i.generate()), (o[a.crossTileID] = !0)); + } + return ( + void 0 === this.indexes[t.overscaledZ] && + (this.indexes[t.overscaledZ] = {}), + (this.indexes[t.overscaledZ][t.key] = new qt( + t, + e.symbolInstances, + e.bucketInstanceId, + )), + !0 + ); + } + removeBucketCrossTileIDs(t, e) { + for (const i in e.indexedSymbolInstances) + for (const o of e.indexedSymbolInstances[i]) + delete this.usedCrossTileIDs[t][o.crossTileID]; + } + removeStaleBuckets(t) { + let e = !1; + for (const i in this.indexes) { + const o = this.indexes[i]; + for (const a in o) + t[o[a].bucketInstanceId] || + (this.removeBucketCrossTileIDs(i, o[a]), delete o[a], (e = !0)); + } + return e; + } + } + class Xt { + constructor() { + (this.layerIndexes = {}), + (this.crossTileIDs = new jt()), + (this.maxBucketInstanceId = 0), + (this.bucketsInCurrentPlacement = {}); + } + addLayer(t, e, i) { + let o = this.layerIndexes[t.id]; + void 0 === o && (o = this.layerIndexes[t.id] = new $t()); + let a = !1; + const r = {}; + o.handleWrapJump(i); + for (const i of e) { + const e = i.getBucket(t); + e && + t.id === e.layerIds[0] && + (e.bucketInstanceId || + (e.bucketInstanceId = ++this.maxBucketInstanceId), + o.addBucket(i.tileID, e, this.crossTileIDs) && (a = !0), + (r[e.bucketInstanceId] = !0)); + } + return o.removeStaleBuckets(r) && (a = !0), a; + } + pruneUnusedLayers(t) { + const e = {}; + t.forEach((t) => { + e[t] = !0; + }); + for (const t in this.layerIndexes) e[t] || delete this.layerIndexes[t]; + } + } + var Wt = t.createLayout([{ name: 'a_pos', type: 'Int16', components: 2 }]); + class Ht extends t.Evented { + constructor(t) { + super(), + (this.sourceCache = t), + (this._tiles = {}), + (this._renderableTilesKeys = []), + (this._sourceTileCache = {}), + (this.renderHistory = []), + (this.minzoom = 0), + (this.maxzoom = 22), + (this.tileSize = 512), + (this.deltaZoom = 1), + (this.renderHistorySize = t._cache.max), + (t.usedForTerrain = !0), + (t.tileSize = this.tileSize * 2 ** this.deltaZoom); + } + destruct() { + (this.sourceCache.usedForTerrain = !1), + (this.sourceCache.tileSize = null); + for (const t in this._tiles) { + const e = this._tiles[t]; + e.textures.forEach((t) => t.destroy()), (e.textures = []); + } + } + update(e, i) { + this.sourceCache.update(e, i), (this._renderableTilesKeys = []); + for (const o of e.coveringTiles({ + tileSize: this.tileSize, + minzoom: this.minzoom, + maxzoom: this.maxzoom, + reparseOverscaled: !1, + terrain: i, + })) + this._renderableTilesKeys.push(o.key), + this._tiles[o.key] || + ((o.posMatrix = new Float64Array(16)), + t.ortho(o.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + (this._tiles[o.key] = new k(o, this.tileSize))); + } + removeOutdated(t) { + const e = {}; + this.renderHistory = this.renderHistory + .filter((t, e) => this.renderHistory.indexOf(t) === e) + .slice(0, this.renderHistorySize); + for (const t of this._renderableTilesKeys) e[t] = !0; + for (const t of this.renderHistory) e[t] = !0; + for (const i in this._tiles) + e[i] || (this._tiles[i].clearTextures(t), delete this._tiles[i]); + } + getRenderableTiles() { + return this._renderableTilesKeys.map((t) => this.getTileByID(t)); + } + getTileByID(t) { + return this._tiles[t]; + } + getTerrainCoords(e) { + const i = {}; + for (const o of this._renderableTilesKeys) { + const a = this._tiles[o].tileID; + if (a.canonical.equals(e.canonical)) { + const a = e.clone(); + (a.posMatrix = new Float64Array(16)), + t.ortho(a.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + (i[o] = a); + } else if (a.canonical.isChildOf(e.canonical)) { + const r = e.clone(); + r.posMatrix = new Float64Array(16); + const s = a.canonical.z - e.canonical.z, + n = a.canonical.x - ((a.canonical.x >> s) << s), + l = a.canonical.y - ((a.canonical.y >> s) << s), + c = t.EXTENT >> s; + t.ortho(r.posMatrix, 0, c, 0, c, 0, 1), + t.translate(r.posMatrix, r.posMatrix, [-n * c, -l * c, 0]), + (i[o] = r); + } else if (e.canonical.isChildOf(a.canonical)) { + const r = e.clone(); + r.posMatrix = new Float64Array(16); + const s = e.canonical.z - a.canonical.z, + n = e.canonical.x - ((e.canonical.x >> s) << s), + l = e.canonical.y - ((e.canonical.y >> s) << s), + c = t.EXTENT >> s; + t.ortho(r.posMatrix, 0, t.EXTENT, 0, t.EXTENT, 0, 1), + t.translate(r.posMatrix, r.posMatrix, [n * c, l * c, 0]), + t.scale(r.posMatrix, r.posMatrix, [1 / 2 ** s, 1 / 2 ** s, 0]), + (i[o] = r); + } + } + return i; + } + getSourceTile(t, e) { + const i = this.sourceCache._source; + let o = t.overscaledZ - this.deltaZoom; + if ((o > i.maxzoom && (o = i.maxzoom), o < i.minzoom)) return null; + this._sourceTileCache[t.key] || + (this._sourceTileCache[t.key] = t.scaledTo(o).key); + let a = this.sourceCache.getTileByID(this._sourceTileCache[t.key]); + if ((!a || !a.dem) && e) + for (; o >= i.minzoom && (!a || !a.dem); ) + a = this.sourceCache.getTileByID(t.scaledTo(o--).key); + return a; + } + tilesAfterTime(t = Date.now()) { + return Object.values(this._tiles).filter((e) => e.timeLoaded >= t); + } + } + class Kt { + constructor(t, e, i) { + (this.style = t), + (this.sourceCache = new Ht(e)), + (this.options = i), + (this.exaggeration = + 'number' == typeof i.exaggeration ? i.exaggeration : 1), + (this.elevationOffset = + 'number' == typeof i.elevationOffset ? i.elevationOffset : 450), + (this.qualityFactor = 2), + (this.meshSize = 128), + (this._demMatrixCache = {}), + (this.coordsIndex = []), + (this._coordsTextureSize = 1024), + this.clearRerenderCache(); + } + getDEMElevation(e, i, o, a = t.EXTENT) { + if (!(i >= 0 && i < a && o >= 0 && o < a)) return this.elevationOffset; + let r = 0; + const s = this.getTerrainData(e); + if (s.tile && s.tile.dem) { + const e = t.transformMat4$1( + [], + [(i / a) * t.EXTENT, (o / a) * t.EXTENT], + s.u_terrain_matrix, + ), + n = [e[0] * s.tile.dem.dim, e[1] * s.tile.dem.dim], + l = [Math.floor(n[0]), Math.floor(n[1])], + c = s.tile.dem.get(l[0], l[1]), + h = s.tile.dem.get(l[0], l[1] + 1), + u = s.tile.dem.get(l[0] + 1, l[1]), + d = s.tile.dem.get(l[0] + 1, l[1] + 1); + r = t.number( + t.number(c, h, n[0] - l[0]), + t.number(u, d, n[0] - l[0]), + n[1] - l[1], + ); + } + return r; + } + rememberForRerender(t, e) { + for (const i in this.sourceCache._tiles) { + const o = this.sourceCache._tiles[i]; + (o.tileID.equals(e) || o.tileID.isChildOf(e)) && + (t === this.sourceCache.sourceCache.id && + (o.timeLoaded = Date.now()), + (this._rerender[t] = this._rerender[t] || {}), + (this._rerender[t][o.tileID.key] = !0)); + } + } + needsRerender(t, e) { + return this._rerender[t] && this._rerender[t][e.key]; + } + clearRerenderCache() { + this._rerender = {}; + } + getElevation(e, i, o, a = t.EXTENT) { + return ( + (this.getDEMElevation(e, i, o, a) + this.elevationOffset) * + this.exaggeration + ); + } + getTerrainData(e) { + if (!this._emptyDemTexture) { + const e = this.style.map.painter.context, + i = new t.RGBAImage({ width: 1, height: 1 }, new Uint8Array(4)); + (this._emptyDepthTexture = new l(e, i, e.gl.RGBA, { + premultiply: !1, + })), + (this._emptyDemUnpack = [0, 0, 0, 0]), + (this._emptyDemTexture = new l( + e, + new t.RGBAImage({ width: 1, height: 1 }), + e.gl.RGBA, + { premultiply: !1 }, + )), + this._emptyDemTexture.bind(e.gl.NEAREST, e.gl.CLAMP_TO_EDGE), + (this._emptyDemMatrix = t.identity([])); + } + const i = this.sourceCache.getSourceTile(e, !0); + if (i && i.dem && (!i.demTexture || i.needsTerrainPrepare)) { + const t = this.style.map.painter.context; + (i.demTexture = this.style.map.painter.getTileTexture(i.dem.stride)), + i.demTexture + ? i.demTexture.update(i.dem.getPixels(), { premultiply: !1 }) + : (i.demTexture = new l(t, i.dem.getPixels(), t.gl.RGBA, { + premultiply: !1, + })), + i.demTexture.bind(t.gl.NEAREST, t.gl.CLAMP_TO_EDGE), + (i.needsTerrainPrepare = !1); + } + const o = i && i + i.tileID.key + e.key; + if (o && !this._demMatrixCache[o]) { + const o = this.sourceCache.sourceCache._source.maxzoom; + let a = e.canonical.z - i.tileID.canonical.z; + e.overscaledZ > e.canonical.z && + (e.canonical.z >= o + ? (a = e.canonical.z - o) + : t.warnOnce( + 'cannot calculate elevation if elevation maxzoom > source.maxzoom', + )); + const r = e.canonical.x - ((e.canonical.x >> a) << a), + s = e.canonical.y - ((e.canonical.y >> a) << a), + n = t.fromScaling(new Float64Array(16), [ + 1 / (t.EXTENT << a), + 1 / (t.EXTENT << a), + 0, + ]); + t.translate(n, n, [r * t.EXTENT, s * t.EXTENT, 0]), + (this._demMatrixCache[e.key] = { matrix: n, coord: e }); + } + return { + u_depth: 2, + u_terrain: 3, + u_terrain_dim: (i && i.dem && i.dem.dim) || 1, + u_terrain_matrix: o + ? this._demMatrixCache[e.key].matrix + : this._emptyDemMatrix, + u_terrain_unpack: + (i && i.dem && i.dem.getUnpackVector()) || this._emptyDemUnpack, + u_terrain_offset: this.elevationOffset, + u_terrain_exaggeration: this.exaggeration, + texture: ((i && i.demTexture) || this._emptyDemTexture).texture, + depthTexture: (this._fboDepthTexture || this._emptyDepthTexture) + .texture, + tile: i, + }; + } + getRTTFramebuffer() { + const t = this.style.map.painter; + if (!this._rttFramebuffer) { + const e = this.sourceCache.tileSize * this.qualityFactor; + (this._rttFramebuffer = t.context.createFramebuffer(e, e, !0)), + this._rttFramebuffer.depthAttachment.set( + t.context.createRenderbuffer( + t.context.gl.DEPTH_COMPONENT16, + e, + e, + ), + ); + } + return this._rttFramebuffer; + } + getFramebuffer(t) { + const e = this.style.map.painter, + i = e.width / devicePixelRatio, + o = e.height / devicePixelRatio; + return ( + !this._fbo || + (this._fbo.width === i && this._fbo.height === o) || + (this._fbo.destroy(), + this._fboCoordsTexture.destroy(), + this._fboDepthTexture.destroy(), + delete this._fbo, + delete this._fboDepthTexture, + delete this._fboCoordsTexture), + this._fboCoordsTexture || + ((this._fboCoordsTexture = new l( + e.context, + { width: i, height: o, data: null }, + e.context.gl.RGBA, + { premultiply: !1 }, + )), + this._fboCoordsTexture.bind( + e.context.gl.NEAREST, + e.context.gl.CLAMP_TO_EDGE, + )), + this._fboDepthTexture || + ((this._fboDepthTexture = new l( + e.context, + { width: i, height: o, data: null }, + e.context.gl.RGBA, + { premultiply: !1 }, + )), + this._fboDepthTexture.bind( + e.context.gl.NEAREST, + e.context.gl.CLAMP_TO_EDGE, + )), + this._fbo || + ((this._fbo = e.context.createFramebuffer(i, o, !0)), + this._fbo.depthAttachment.set( + e.context.createRenderbuffer( + e.context.gl.DEPTH_COMPONENT16, + i, + o, + ), + )), + this._fbo.colorAttachment.set( + 'coords' === t + ? this._fboCoordsTexture.texture + : this._fboDepthTexture.texture, + ), + this._fbo + ); + } + getCoordsTexture() { + const e = this.style.map.painter.context; + if (this._coordsTexture) return this._coordsTexture; + const i = new Uint8Array( + this._coordsTextureSize * this._coordsTextureSize * 4, + ); + for (let t = 0, e = 0; t < this._coordsTextureSize; t++) + for (let o = 0; o < this._coordsTextureSize; o++, e += 4) + (i[e + 0] = 255 & o), + (i[e + 1] = 255 & t), + (i[e + 2] = ((o >> 8) << 4) | (t >> 8)), + (i[e + 3] = 0); + const o = new t.RGBAImage( + { width: this._coordsTextureSize, height: this._coordsTextureSize }, + new Uint8Array(i.buffer), + ), + a = new l(e, o, e.gl.RGBA, { premultiply: !1 }); + return ( + a.bind(e.gl.NEAREST, e.gl.CLAMP_TO_EDGE), (this._coordsTexture = a), a + ); + } + pointCoordinate(e) { + const i = new Uint8Array(4), + o = this.style.map.painter, + a = o.context, + r = a.gl; + a.bindFramebuffer.set(this.getFramebuffer('coords').framebuffer), + r.readPixels( + e.x, + o.height / devicePixelRatio - e.y - 1, + 1, + 1, + r.RGBA, + r.UNSIGNED_BYTE, + i, + ), + a.bindFramebuffer.set(null); + const s = i[0] + ((i[2] >> 4) << 8), + n = i[1] + ((15 & i[2]) << 8), + l = this.coordsIndex[255 - i[3]], + c = l && this.sourceCache.getTileByID(l); + if (!c) return null; + const h = this._coordsTextureSize, + u = (1 << c.tileID.canonical.z) * h; + return new t.MercatorCoordinate( + (c.tileID.canonical.x * h + s) / u, + (c.tileID.canonical.y * h + n) / u, + this.getElevation(c.tileID, s, n, h), + ); + } + getTerrainMesh() { + if (this._mesh) return this._mesh; + const e = this.style.map.painter.context, + i = new t.PosArray(), + o = new t.TriangleIndexArray(), + a = this.meshSize, + r = t.EXTENT / a, + s = a * a; + for (let t = 0; t <= a; t++) + for (let e = 0; e <= a; e++) i.emplaceBack(e * r, t * r); + for (let t = 0; t < s; t += a + 1) + for (let e = 0; e < a; e++) + o.emplaceBack(e + t, a + e + t + 1, a + e + t + 2), + o.emplaceBack(e + t, a + e + t + 2, e + t + 1); + return ( + (this._mesh = { + indexBuffer: e.createIndexBuffer(o), + vertexBuffer: e.createVertexBuffer(i, Wt.members), + segments: t.SegmentVector.simpleSegment(0, 0, i.length, o.length), + }), + this._mesh + ); + } + getMinMaxElevation(t) { + const e = this.getTerrainData(t).tile, + i = { minElevation: null, maxElevation: null }; + return ( + e && + e.dem && + ((i.minElevation = + (e.dem.min + this.elevationOffset) * this.exaggeration), + (i.maxElevation = + (e.dem.max + this.elevationOffset) * this.exaggeration)), + i + ); + } + } + const Yt = (e, i) => + t.emitValidationErrors( + e, + i && i.filter((t) => 'source.canvas' !== t.identifier), + ), + Jt = t.pick(W, [ + 'addLayer', + 'removeLayer', + 'setPaintProperty', + 'setLayoutProperty', + 'setFilter', + 'addSource', + 'removeSource', + 'setLayerZoomRange', + 'setLight', + 'setTransition', + 'setGeoJSONSourceData', + ]), + Qt = t.pick(W, ['setCenter', 'setZoom', 'setBearing', 'setPitch']), + te = (function () { + const e = {}, + i = t.spec.$version; + for (const o in t.spec.$root) { + const a = t.spec.$root[o]; + if (a.required) { + let t = null; + (t = 'version' === o ? i : 'array' === a.type ? [] : {}), + null != t && (e[o] = t); + } + } + return e; + })(); + class ee extends t.Evented { + constructor(e, i = {}) { + super(), + (this.map = e), + (this.dispatcher = new v(j(), this)), + (this.imageManager = new h()), + this.imageManager.setEventedParent(this), + (this.glyphManager = new _( + e._requestManager, + i.localIdeographFontFamily, + )), + (this.lineAtlas = new x(256, 512)), + (this.crossTileSymbolIndex = new Xt()), + (this._layers = {}), + (this._serializedLayers = {}), + (this._order = []), + (this.sourceCaches = {}), + (this.zoomHistory = new t.ZoomHistory()), + (this._loaded = !1), + (this._availableImages = []), + this._resetUpdates(), + this.dispatcher.broadcast('setReferrer', t.getReferrer()); + const o = this; + (this._rtlTextPluginCallback = ee.registerForPluginStateChange((e) => { + o.dispatcher.broadcast( + 'syncRTLPluginState', + { pluginStatus: e.pluginStatus, pluginURL: e.pluginURL }, + (e, i) => { + if ((t.triggerPluginCompletionEvent(e), i && i.every((t) => t))) + for (const t in o.sourceCaches) o.sourceCaches[t].reload(); + }, + ); + })), + this.on('data', (t) => { + if ('source' !== t.dataType || 'metadata' !== t.sourceDataType) + return; + const e = this.sourceCaches[t.sourceId]; + if (!e) return; + const i = e.getSource(); + if (i && i.vectorLayerIds) + for (const t in this._layers) { + const e = this._layers[t]; + e.source === i.id && this._validateLayer(e); + } + }); + } + loadURL(e, i = {}) { + this.fire(new t.Event('dataloading', { dataType: 'style' })); + const o = 'boolean' != typeof i.validate || i.validate, + a = this.map._requestManager.transformRequest( + e, + t.ResourceType.Style, + ); + this._request = t.getJSON(a, (e, i) => { + (this._request = null), + e ? this.fire(new t.ErrorEvent(e)) : i && this._load(i, o); + }); + } + loadJSON(e, i = {}) { + this.fire(new t.Event('dataloading', { dataType: 'style' })), + (this._request = t.exported.frame(() => { + (this._request = null), this._load(e, !1 !== i.validate); + })); + } + loadEmpty() { + this.fire(new t.Event('dataloading', { dataType: 'style' })), + this._load(te, !1); + } + _load(e, i) { + if (i && Yt(this, t.validateStyle(e))) return; + (this._loaded = !0), (this.stylesheet = e); + for (const t in e.sources) + this.addSource(t, e.sources[t], { validate: !1 }); + e.sprite ? this._loadSprite(e.sprite) : this.imageManager.setLoaded(!0), + this.glyphManager.setURL(e.glyphs); + const o = X(this.stylesheet.layers); + (this._order = o.map((t) => t.id)), + (this._layers = {}), + (this._serializedLayers = {}); + for (let e of o) + (e = t.createStyleLayer(e)), + e.setEventedParent(this, { layer: { id: e.id } }), + (this._layers[e.id] = e), + (this._serializedLayers[e.id] = e.serialize()); + this.dispatcher.broadcast( + 'setLayers', + this._serializeLayers(this._order), + ), + (this.light = new g(this.stylesheet.light)), + this.setTerrain(this.stylesheet.terrain), + this.fire(new t.Event('data', { dataType: 'style' })), + this.fire(new t.Event('style.load')); + } + _loadSprite(e) { + this._spriteRequest = (function (e, i, o, a) { + let r, s, n; + const l = o > 1 ? '@2x' : ''; + let c = t.getJSON( + i.transformRequest( + i.normalizeSpriteURL(e, l, '.json'), + t.ResourceType.SpriteJSON, + ), + (t, e) => { + (c = null), n || ((n = t), (r = e), u()); + }, + ), + h = t.getImage( + i.transformRequest( + i.normalizeSpriteURL(e, l, '.png'), + t.ResourceType.SpriteImage, + ), + (t, e) => { + (h = null), n || ((n = t), (s = e), u()); + }, + ); + function u() { + if (n) a(n); + else if (r && s) { + const e = t.exported.getImageData(s), + i = {}; + for (const o in r) { + const { + width: a, + height: s, + x: n, + y: l, + sdf: c, + pixelRatio: h, + stretchX: u, + stretchY: d, + content: m, + } = r[o], + _ = new t.RGBAImage({ width: a, height: s }); + t.RGBAImage.copy( + e, + _, + { x: n, y: l }, + { x: 0, y: 0 }, + { width: a, height: s }, + ), + (i[o] = { + data: _, + pixelRatio: h, + sdf: c, + stretchX: u, + stretchY: d, + content: m, + }); + } + a(null, i); + } + } + return { + cancel() { + c && (c.cancel(), (c = null)), h && (h.cancel(), (h = null)); + }, + }; + })(e, this.map._requestManager, this.map.getPixelRatio(), (e, i) => { + if (((this._spriteRequest = null), e)) this.fire(new t.ErrorEvent(e)); + else if (i) for (const t in i) this.imageManager.addImage(t, i[t]); + this.imageManager.setLoaded(!0), + (this._availableImages = this.imageManager.listImages()), + this.dispatcher.broadcast('setImages', this._availableImages), + this.fire(new t.Event('data', { dataType: 'style' })); + }); + } + _validateLayer(e) { + const i = this.sourceCaches[e.source]; + if (!i) return; + const o = e.sourceLayer; + if (!o) return; + const a = i.getSource(); + ('geojson' === a.type || + (a.vectorLayerIds && -1 === a.vectorLayerIds.indexOf(o))) && + this.fire( + new t.ErrorEvent( + new Error( + `Source layer "${o}" does not exist on source "${a.id}" as specified by style layer "${e.id}".`, + ), + ), + ); + } + loaded() { + if (!this._loaded) return !1; + if (Object.keys(this._updatedSources).length) return !1; + for (const t in this.sourceCaches) + if (!this.sourceCaches[t].loaded()) return !1; + return !!this.imageManager.isLoaded(); + } + _serializeLayers(t) { + const e = []; + for (const i of t) { + const t = this._layers[i]; + 'custom' !== t.type && e.push(t.serialize()); + } + return e; + } + hasTransitions() { + if (this.light && this.light.hasTransition()) return !0; + for (const t in this.sourceCaches) + if (this.sourceCaches[t].hasTransition()) return !0; + for (const t in this._layers) + if (this._layers[t].hasTransition()) return !0; + return !1; + } + _checkLoaded() { + if (!this._loaded) throw new Error('Style is not done loading.'); + } + update(e) { + if (!this._loaded) return; + const i = this._changed; + if (this._changed) { + const t = Object.keys(this._updatedLayers), + i = Object.keys(this._removedLayers); + (t.length || i.length) && this._updateWorkerLayers(t, i); + for (const t in this._updatedSources) { + const e = this._updatedSources[t]; + if ('reload' === e) this._reloadSource(t); + else { + if ('clear' !== e) throw new Error(`Invalid action ${e}`); + this._clearSource(t); + } + } + this._updateTilesForChangedImages(); + for (const t in this._updatedPaintProps) + this._layers[t].updateTransitions(e); + this.light.updateTransitions(e), this._resetUpdates(); + } + const o = {}; + for (const t in this.sourceCaches) { + const e = this.sourceCaches[t]; + (o[t] = e.used), (e.used = !1); + } + for (const t of this._order) { + const i = this._layers[t]; + i.recalculate(e, this._availableImages), + !i.isHidden(e.zoom) && + i.source && + (this.sourceCaches[i.source].used = !0); + } + for (const e in o) { + const i = this.sourceCaches[e]; + o[e] !== i.used && + i.fire( + new t.Event('data', { + sourceDataType: 'visibility', + dataType: 'source', + sourceId: e, + }), + ); + } + this.light.recalculate(e), + (this.z = e.zoom), + i && this.fire(new t.Event('data', { dataType: 'style' })); + } + _updateTilesForChangedImages() { + const t = Object.keys(this._changedImages); + if (t.length) { + for (const e in this.sourceCaches) + this.sourceCaches[e].reloadTilesForDependencies( + ['icons', 'patterns'], + t, + ); + this._changedImages = {}; + } + } + _updateWorkerLayers(t, e) { + this.dispatcher.broadcast('updateLayers', { + layers: this._serializeLayers(t), + removedIds: e, + }); + } + _resetUpdates() { + (this._changed = !1), + (this._updatedLayers = {}), + (this._removedLayers = {}), + (this._updatedSources = {}), + (this._updatedPaintProps = {}), + (this._changedImages = {}); + } + setTerrain(e) { + if ( + (this._checkLoaded(), + this._terrainDataCallback && + this.off('data', this._terrainDataCallback), + this._terrainfreezeElevationCallback && + this.map.off( + 'freezeElevation', + this._terrainfreezeElevationCallback, + ), + e) + ) { + const t = this.sourceCaches[e.source]; + if (!t) + throw new Error( + `cannot load terrain, because there exists no source with ID: ${e.source}`, + ); + (this.terrain = new Kt(this, t, e)), + this.map.transform.updateElevation(this.terrain), + (this._terrainfreezeElevationCallback = (t) => { + t.freeze + ? (this.map.transform.freezeElevation = !0) + : ((this.map.transform.freezeElevation = !1), + this.map.transform.recalculateZoom(this.terrain)); + }), + (this._terrainDataCallback = (t) => { + t.tile && + (t.sourceId === e.source + ? (this.map.transform.updateElevation(this.terrain), + this.terrain.rememberForRerender(t.sourceId, t.tile.tileID)) + : 'geojson' === t.source.type && + this.terrain.rememberForRerender( + t.sourceId, + t.tile.tileID, + )); + }), + this.on('data', this._terrainDataCallback), + this.map.on( + 'freezeElevation', + this._terrainfreezeElevationCallback, + ); + } else this.terrain && this.terrain.sourceCache.destruct(), (this.terrain = null), this.map.transform.updateElevation(this.terrain); + this.map.fire(new t.Event('terrain', { terrain: e })); + } + setState(e) { + if ((this._checkLoaded(), Yt(this, t.validateStyle(e)))) return !1; + (e = t.clone$1(e)).layers = X(e.layers); + const i = (function (t, e) { + if (!t) return [{ command: W.setStyle, args: [e] }]; + let i = []; + try { + if (!a(t.version, e.version)) + return [{ command: W.setStyle, args: [e] }]; + a(t.center, e.center) || + i.push({ command: W.setCenter, args: [e.center] }), + a(t.zoom, e.zoom) || + i.push({ command: W.setZoom, args: [e.zoom] }), + a(t.bearing, e.bearing) || + i.push({ command: W.setBearing, args: [e.bearing] }), + a(t.pitch, e.pitch) || + i.push({ command: W.setPitch, args: [e.pitch] }), + a(t.sprite, e.sprite) || + i.push({ command: W.setSprite, args: [e.sprite] }), + a(t.glyphs, e.glyphs) || + i.push({ command: W.setGlyphs, args: [e.glyphs] }), + a(t.transition, e.transition) || + i.push({ command: W.setTransition, args: [e.transition] }), + a(t.light, e.light) || + i.push({ command: W.setLight, args: [e.light] }); + const o = {}, + r = []; + !(function (t, e, i, o) { + let r; + for (r in ((e = e || {}), (t = t || {}))) + Object.prototype.hasOwnProperty.call(t, r) && + (Object.prototype.hasOwnProperty.call(e, r) || K(r, i, o)); + for (r in e) + Object.prototype.hasOwnProperty.call(e, r) && + (Object.prototype.hasOwnProperty.call(t, r) + ? a(t[r], e[r]) || + ('geojson' === t[r].type && + 'geojson' === e[r].type && + J(t, e, r) + ? i.push({ + command: W.setGeoJSONSourceData, + args: [r, e[r].data], + }) + : Y(r, e, i, o)) + : H(r, e, i)); + })(t.sources, e.sources, r, o); + const s = []; + t.layers && + t.layers.forEach((t) => { + o[t.source] + ? i.push({ command: W.removeLayer, args: [t.id] }) + : s.push(t); + }), + (i = i.concat(r)), + (function (t, e, i) { + e = e || []; + const o = (t = t || []).map(tt), + r = e.map(tt), + s = t.reduce(et, {}), + n = e.reduce(et, {}), + l = o.slice(), + c = Object.create(null); + let h, u, d, m, _, p, f; + for (h = 0, u = 0; h < o.length; h++) + (d = o[h]), + Object.prototype.hasOwnProperty.call(n, d) + ? u++ + : (i.push({ command: W.removeLayer, args: [d] }), + l.splice(l.indexOf(d, u), 1)); + for (h = 0, u = 0; h < r.length; h++) + (d = r[r.length - 1 - h]), + l[l.length - 1 - h] !== d && + (Object.prototype.hasOwnProperty.call(s, d) + ? (i.push({ command: W.removeLayer, args: [d] }), + l.splice(l.lastIndexOf(d, l.length - u), 1)) + : u++, + (p = l[l.length - h]), + i.push({ command: W.addLayer, args: [n[d], p] }), + l.splice(l.length - h, 0, d), + (c[d] = !0)); + for (h = 0; h < r.length; h++) + if (((d = r[h]), (m = s[d]), (_ = n[d]), !c[d] && !a(m, _))) + if ( + a(m.source, _.source) && + a(m['source-layer'], _['source-layer']) && + a(m.type, _.type) + ) { + for (f in (Q( + m.layout, + _.layout, + i, + d, + null, + W.setLayoutProperty, + ), + Q(m.paint, _.paint, i, d, null, W.setPaintProperty), + a(m.filter, _.filter) || + i.push({ command: W.setFilter, args: [d, _.filter] }), + (a(m.minzoom, _.minzoom) && a(m.maxzoom, _.maxzoom)) || + i.push({ + command: W.setLayerZoomRange, + args: [d, _.minzoom, _.maxzoom], + }), + m)) + Object.prototype.hasOwnProperty.call(m, f) && + 'layout' !== f && + 'paint' !== f && + 'filter' !== f && + 'metadata' !== f && + 'minzoom' !== f && + 'maxzoom' !== f && + (0 === f.indexOf('paint.') + ? Q( + m[f], + _[f], + i, + d, + f.slice(6), + W.setPaintProperty, + ) + : a(m[f], _[f]) || + i.push({ + command: W.setLayerProperty, + args: [d, f, _[f]], + })); + for (f in _) + Object.prototype.hasOwnProperty.call(_, f) && + !Object.prototype.hasOwnProperty.call(m, f) && + 'layout' !== f && + 'paint' !== f && + 'filter' !== f && + 'metadata' !== f && + 'minzoom' !== f && + 'maxzoom' !== f && + (0 === f.indexOf('paint.') + ? Q( + m[f], + _[f], + i, + d, + f.slice(6), + W.setPaintProperty, + ) + : a(m[f], _[f]) || + i.push({ + command: W.setLayerProperty, + args: [d, f, _[f]], + })); + } else + i.push({ command: W.removeLayer, args: [d] }), + (p = l[l.lastIndexOf(d) + 1]), + i.push({ command: W.addLayer, args: [_, p] }); + })(s, e.layers, i); + } catch (t) { + console.warn('Unable to compute style diff:', t), + (i = [{ command: W.setStyle, args: [e] }]); + } + return i; + })(this.serialize(), e).filter((t) => !(t.command in Qt)); + if (0 === i.length) return !1; + const o = i.filter((t) => !(t.command in Jt)); + if (o.length > 0) + throw new Error( + `Unimplemented: ${o.map((t) => t.command).join(', ')}.`, + ); + return ( + i.forEach((t) => { + 'setTransition' !== t.command && + this[t.command].apply(this, t.args); + }), + (this.stylesheet = e), + !0 + ); + } + addImage(e, i) { + if (this.getImage(e)) + return this.fire( + new t.ErrorEvent( + new Error(`An image named "${e}" already exists.`), + ), + ); + this.imageManager.addImage(e, i), this._afterImageUpdated(e); + } + updateImage(t, e) { + this.imageManager.updateImage(t, e); + } + getImage(t) { + return this.imageManager.getImage(t); + } + removeImage(e) { + if (!this.getImage(e)) + return this.fire( + new t.ErrorEvent( + new Error(`An image named "${e}" does not exist.`), + ), + ); + this.imageManager.removeImage(e), this._afterImageUpdated(e); + } + _afterImageUpdated(e) { + (this._availableImages = this.imageManager.listImages()), + (this._changedImages[e] = !0), + (this._changed = !0), + this.dispatcher.broadcast('setImages', this._availableImages), + this.fire(new t.Event('data', { dataType: 'style' })); + } + listImages() { + return this._checkLoaded(), this.imageManager.listImages(); + } + addSource(e, i, o = {}) { + if ((this._checkLoaded(), void 0 !== this.sourceCaches[e])) + throw new Error(`Source "${e}" already exists.`); + if (!i.type) + throw new Error( + `The type property must be defined, but only the following properties were given: ${Object.keys( + i, + ).join(', ')}.`, + ); + if ( + ['vector', 'raster', 'geojson', 'video', 'image'].indexOf(i.type) >= + 0 && + this._validate(t.validateStyle.source, `sources.${e}`, i, null, o) + ) + return; + this.map && + this.map._collectResourceTiming && + (i.collectResourceTiming = !0); + const a = (this.sourceCaches[e] = new O(e, i, this.dispatcher)); + (a.style = this), + a.setEventedParent(this, () => ({ + isSourceLoaded: this.loaded(), + source: a.serialize(), + sourceId: e, + })), + a.onAdd(this.map), + (this._changed = !0); + } + removeSource(e) { + if ((this._checkLoaded(), void 0 === this.sourceCaches[e])) + throw new Error('There is no source with this ID'); + for (const i in this._layers) + if (this._layers[i].source === e) + return this.fire( + new t.ErrorEvent( + new Error( + `Source "${e}" cannot be removed while layer "${i}" is using it.`, + ), + ), + ); + const i = this.sourceCaches[e]; + delete this.sourceCaches[e], + delete this._updatedSources[e], + i.fire( + new t.Event('data', { + sourceDataType: 'metadata', + dataType: 'source', + sourceId: e, + }), + ), + i.setEventedParent(null), + i.onRemove(this.map), + (this._changed = !0); + } + setGeoJSONSourceData(t, e) { + if ((this._checkLoaded(), void 0 === this.sourceCaches[t])) + throw new Error(`There is no source with this ID=${t}`); + const i = this.sourceCaches[t].getSource(); + if ('geojson' !== i.type) + throw new Error( + `geojsonSource.type is ${i.type}, which is !== 'geojson`, + ); + i.setData(e), (this._changed = !0); + } + getSource(t) { + return this.sourceCaches[t] && this.sourceCaches[t].getSource(); + } + addLayer(e, i, o = {}) { + this._checkLoaded(); + const a = e.id; + if (this.getLayer(a)) + return void this.fire( + new t.ErrorEvent( + new Error(`Layer "${a}" already exists on this map.`), + ), + ); + let r; + if ('custom' === e.type) { + if (Yt(this, t.validateCustomStyleLayer(e))) return; + r = t.createStyleLayer(e); + } else { + if ( + ('object' == typeof e.source && + (this.addSource(a, e.source), + (e = t.clone$1(e)), + (e = t.extend(e, { source: a }))), + this._validate( + t.validateStyle.layer, + `layers.${a}`, + e, + { arrayIndex: -1 }, + o, + )) + ) + return; + (r = t.createStyleLayer(e)), + this._validateLayer(r), + r.setEventedParent(this, { layer: { id: a } }), + (this._serializedLayers[r.id] = r.serialize()); + } + const s = i ? this._order.indexOf(i) : this._order.length; + if (i && -1 === s) + this.fire( + new t.ErrorEvent( + new Error( + `Cannot add layer "${a}" before non-existing layer "${i}".`, + ), + ), + ); + else { + if ( + (this._order.splice(s, 0, a), + (this._layerOrderChanged = !0), + (this._layers[a] = r), + this._removedLayers[a] && r.source && 'custom' !== r.type) + ) { + const t = this._removedLayers[a]; + delete this._removedLayers[a], + t.type !== r.type + ? (this._updatedSources[r.source] = 'clear') + : ((this._updatedSources[r.source] = 'reload'), + this.sourceCaches[r.source].pause()); + } + this._updateLayer(r), r.onAdd && r.onAdd(this.map); + } + } + moveLayer(e, i) { + if ((this._checkLoaded(), (this._changed = !0), !this._layers[e])) + return void this.fire( + new t.ErrorEvent( + new Error( + `The layer '${e}' does not exist in the map's style and cannot be moved.`, + ), + ), + ); + if (e === i) return; + const o = this._order.indexOf(e); + this._order.splice(o, 1); + const a = i ? this._order.indexOf(i) : this._order.length; + i && -1 === a + ? this.fire( + new t.ErrorEvent( + new Error( + `Cannot move layer "${e}" before non-existing layer "${i}".`, + ), + ), + ) + : (this._order.splice(a, 0, e), (this._layerOrderChanged = !0)); + } + removeLayer(e) { + this._checkLoaded(); + const i = this._layers[e]; + if (!i) + return void this.fire( + new t.ErrorEvent( + new Error(`Cannot remove non-existing layer "${e}".`), + ), + ); + i.setEventedParent(null); + const o = this._order.indexOf(e); + this._order.splice(o, 1), + (this._layerOrderChanged = !0), + (this._changed = !0), + (this._removedLayers[e] = i), + delete this._layers[e], + delete this._serializedLayers[e], + delete this._updatedLayers[e], + delete this._updatedPaintProps[e], + i.onRemove && i.onRemove(this.map); + } + getLayer(t) { + return this._layers[t]; + } + hasLayer(t) { + return t in this._layers; + } + setLayerZoomRange(e, i, o) { + this._checkLoaded(); + const a = this.getLayer(e); + a + ? (a.minzoom === i && a.maxzoom === o) || + (null != i && (a.minzoom = i), + null != o && (a.maxzoom = o), + this._updateLayer(a)) + : this.fire( + new t.ErrorEvent( + new Error( + `Cannot set the zoom range of non-existing layer "${e}".`, + ), + ), + ); + } + setFilter(e, i, o = {}) { + this._checkLoaded(); + const r = this.getLayer(e); + if (r) { + if (!a(r.filter, i)) + return null == i + ? ((r.filter = void 0), void this._updateLayer(r)) + : void ( + this._validate( + t.validateStyle.filter, + `layers.${r.id}.filter`, + i, + null, + o, + ) || ((r.filter = t.clone$1(i)), this._updateLayer(r)) + ); + } else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`))); + } + getFilter(e) { + return t.clone$1(this.getLayer(e).filter); + } + setLayoutProperty(e, i, o, r = {}) { + this._checkLoaded(); + const s = this.getLayer(e); + s + ? a(s.getLayoutProperty(i), o) || + (s.setLayoutProperty(i, o, r), this._updateLayer(s)) + : this.fire( + new t.ErrorEvent( + new Error(`Cannot style non-existing layer "${e}".`), + ), + ); + } + getLayoutProperty(e, i) { + const o = this.getLayer(e); + if (o) return o.getLayoutProperty(i); + this.fire( + new t.ErrorEvent( + new Error(`Cannot get style of non-existing layer "${e}".`), + ), + ); + } + setPaintProperty(e, i, o, r = {}) { + this._checkLoaded(); + const s = this.getLayer(e); + s + ? a(s.getPaintProperty(i), o) || + (s.setPaintProperty(i, o, r) && this._updateLayer(s), + (this._changed = !0), + (this._updatedPaintProps[e] = !0)) + : this.fire( + new t.ErrorEvent( + new Error(`Cannot style non-existing layer "${e}".`), + ), + ); + } + getPaintProperty(t, e) { + return this.getLayer(t).getPaintProperty(e); + } + setFeatureState(e, i) { + this._checkLoaded(); + const o = e.source, + a = e.sourceLayer, + r = this.sourceCaches[o]; + if (void 0 === r) + return void this.fire( + new t.ErrorEvent( + new Error(`The source '${o}' does not exist in the map's style.`), + ), + ); + const s = r.getSource().type; + 'geojson' === s && a + ? this.fire( + new t.ErrorEvent( + new Error( + 'GeoJSON sources cannot have a sourceLayer parameter.', + ), + ), + ) + : 'vector' !== s || a + ? (void 0 === e.id && + this.fire( + new t.ErrorEvent( + new Error('The feature id parameter must be provided.'), + ), + ), + r.setFeatureState(a, e.id, i)) + : this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + } + removeFeatureState(e, i) { + this._checkLoaded(); + const o = e.source, + a = this.sourceCaches[o]; + if (void 0 === a) + return void this.fire( + new t.ErrorEvent( + new Error(`The source '${o}' does not exist in the map's style.`), + ), + ); + const r = a.getSource().type, + s = 'vector' === r ? e.sourceLayer : void 0; + 'vector' !== r || s + ? i && 'string' != typeof e.id && 'number' != typeof e.id + ? this.fire( + new t.ErrorEvent( + new Error( + 'A feature id is required to remove its specific state property.', + ), + ), + ) + : a.removeFeatureState(s, e.id, i) + : this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + } + getFeatureState(e) { + this._checkLoaded(); + const i = e.source, + o = e.sourceLayer, + a = this.sourceCaches[i]; + if (void 0 !== a) + return 'vector' !== a.getSource().type || o + ? (void 0 === e.id && + this.fire( + new t.ErrorEvent( + new Error('The feature id parameter must be provided.'), + ), + ), + a.getFeatureState(o, e.id)) + : void this.fire( + new t.ErrorEvent( + new Error( + 'The sourceLayer parameter must be provided for vector source types.', + ), + ), + ); + this.fire( + new t.ErrorEvent( + new Error(`The source '${i}' does not exist in the map's style.`), + ), + ); + } + getTransition() { + return t.extend( + { duration: 300, delay: 0 }, + this.stylesheet && this.stylesheet.transition, + ); + } + serialize() { + return t.filterObject( + { + version: this.stylesheet.version, + name: this.stylesheet.name, + metadata: this.stylesheet.metadata, + light: this.stylesheet.light, + center: this.stylesheet.center, + zoom: this.stylesheet.zoom, + bearing: this.stylesheet.bearing, + pitch: this.stylesheet.pitch, + sprite: this.stylesheet.sprite, + glyphs: this.stylesheet.glyphs, + transition: this.stylesheet.transition, + sources: t.mapObject(this.sourceCaches, (t) => t.serialize()), + layers: this._serializeLayers(this._order), + }, + (t) => void 0 !== t, + ); + } + _updateLayer(t) { + (this._updatedLayers[t.id] = !0), + t.source && + !this._updatedSources[t.source] && + 'raster' !== this.sourceCaches[t.source].getSource().type && + ((this._updatedSources[t.source] = 'reload'), + this.sourceCaches[t.source].pause()), + (this._changed = !0); + } + _flattenAndSortRenderedFeatures(t) { + const e = (t) => 'fill-extrusion' === this._layers[t].type, + i = {}, + o = []; + for (let a = this._order.length - 1; a >= 0; a--) { + const r = this._order[a]; + if (e(r)) { + i[r] = a; + for (const e of t) { + const t = e[r]; + if (t) for (const e of t) o.push(e); + } + } + } + o.sort((t, e) => e.intersectionZ - t.intersectionZ); + const a = []; + for (let r = this._order.length - 1; r >= 0; r--) { + const s = this._order[r]; + if (e(s)) + for (let t = o.length - 1; t >= 0; t--) { + const e = o[t].feature; + if (i[e.layer.id] < r) break; + a.push(e), o.pop(); + } + else + for (const e of t) { + const t = e[s]; + if (t) for (const e of t) a.push(e.feature); + } + } + return a; + } + queryRenderedFeatures(e, i, o) { + i && + i.filter && + this._validate( + t.validateStyle.filter, + 'queryRenderedFeatures.filter', + i.filter, + null, + i, + ); + const a = {}; + if (i && i.layers) { + if (!Array.isArray(i.layers)) + return ( + this.fire( + new t.ErrorEvent( + new Error('parameters.layers must be an Array.'), + ), + ), + [] + ); + for (const e of i.layers) { + const i = this._layers[e]; + if (!i) + return ( + this.fire( + new t.ErrorEvent( + new Error( + `The layer '${e}' does not exist in the map's style and cannot be queried for features.`, + ), + ), + ), + [] + ); + a[i.source] = !0; + } + } + const r = []; + i.availableImages = this._availableImages; + for (const t in this.sourceCaches) + (i.layers && !a[t]) || + r.push( + L( + this.sourceCaches[t], + this._layers, + this._serializedLayers, + e, + i, + o, + ), + ); + return ( + this.placement && + r.push( + (function (t, e, i, o, a, r, s) { + const n = {}, + l = r.queryRenderedSymbols(o), + c = []; + for (const t of Object.keys(l).map(Number)) c.push(s[t]); + c.sort(R); + for (const i of c) { + const o = i.featureIndex.lookupSymbolFeatures( + l[i.bucketInstanceId], + e, + i.bucketIndex, + i.sourceLayerIndex, + a.filter, + a.layers, + a.availableImages, + t, + ); + for (const t in o) { + const e = (n[t] = n[t] || []), + a = o[t]; + a.sort((t, e) => { + const o = i.featureSortOrder; + if (o) { + const i = o.indexOf(t.featureIndex); + return o.indexOf(e.featureIndex) - i; + } + return e.featureIndex - t.featureIndex; + }); + for (const t of a) e.push(t); + } + } + for (const e in n) + n[e].forEach((o) => { + const a = o.feature, + r = i[t[e].source].getFeatureState( + a.layer['source-layer'], + a.id, + ); + (a.source = a.layer.source), + a.layer['source-layer'] && + (a.sourceLayer = a.layer['source-layer']), + (a.state = r); + }); + return n; + })( + this._layers, + this._serializedLayers, + this.sourceCaches, + e, + i, + this.placement.collisionIndex, + this.placement.retainedQueryData, + ), + ), + this._flattenAndSortRenderedFeatures(r) + ); + } + querySourceFeatures(e, i) { + i && + i.filter && + this._validate( + t.validateStyle.filter, + 'querySourceFeatures.filter', + i.filter, + null, + i, + ); + const o = this.sourceCaches[e]; + return o + ? (function (t, e) { + const i = t.getRenderableIds().map((e) => t.getTileByID(e)), + o = [], + a = {}; + for (let t = 0; t < i.length; t++) { + const r = i[t], + s = r.tileID.canonical.key; + a[s] || ((a[s] = !0), r.querySourceFeatures(o, e)); + } + return o; + })(o, i) + : []; + } + addSourceType(t, e, i) { + return ee.getSourceType(t) + ? i(new Error(`A source type called "${t}" already exists.`)) + : (ee.setSourceType(t, e), + e.workerSourceURL + ? void this.dispatcher.broadcast( + 'loadWorkerSource', + { name: t, url: e.workerSourceURL }, + i, + ) + : i(null, null)); + } + getLight() { + return this.light.getLight(); + } + setLight(e, i = {}) { + this._checkLoaded(); + const o = this.light.getLight(); + let r = !1; + for (const t in e) + if (!a(e[t], o[t])) { + r = !0; + break; + } + if (!r) return; + const s = { + now: t.exported.now(), + transition: t.extend( + { duration: 300, delay: 0 }, + this.stylesheet.transition, + ), + }; + this.light.setLight(e, i), this.light.updateTransitions(s); + } + _validate(e, i, o, a, r = {}) { + return ( + (!r || !1 !== r.validate) && + Yt( + this, + e.call( + t.validateStyle, + t.extend( + { + key: i, + style: this.serialize(), + value: o, + styleSpec: t.spec, + }, + a, + ), + ), + ) + ); + } + _remove() { + this._request && (this._request.cancel(), (this._request = null)), + this._spriteRequest && + (this._spriteRequest.cancel(), (this._spriteRequest = null)), + t.evented.off('pluginStateChange', this._rtlTextPluginCallback); + for (const t in this._layers) this._layers[t].setEventedParent(null); + for (const t in this.sourceCaches) { + const e = this.sourceCaches[t]; + e.setEventedParent(null), e.onRemove(this.map); + } + this.imageManager.setEventedParent(null), + this.setEventedParent(null), + this.dispatcher.remove(); + } + _clearSource(t) { + this.sourceCaches[t].clearTiles(); + } + _reloadSource(t) { + this.sourceCaches[t].resume(), this.sourceCaches[t].reload(); + } + _updateSources(t) { + for (const e in this.sourceCaches) + this.sourceCaches[e].update(t, this.terrain); + } + _generateCollisionBoxes() { + for (const t in this.sourceCaches) this._reloadSource(t); + } + _updatePlacement(e, i, o, a, r = !1) { + let s = !1, + n = !1; + const l = {}; + for (const t of this._order) { + const i = this._layers[t]; + if ('symbol' !== i.type) continue; + if (!l[i.source]) { + const t = this.sourceCaches[i.source]; + l[i.source] = t + .getRenderableIds(!0) + .map((e) => t.getTileByID(e)) + .sort( + (t, e) => + e.tileID.overscaledZ - t.tileID.overscaledZ || + (t.tileID.isLessThan(e.tileID) ? -1 : 1), + ); + } + const o = this.crossTileSymbolIndex.addLayer( + i, + l[i.source], + e.center.lng, + ); + s = s || o; + } + if ( + (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), + ((r = r || this._layerOrderChanged || 0 === o) || + !this.pauseablePlacement || + (this.pauseablePlacement.isDone() && + !this.placement.stillRecent(t.exported.now(), e.zoom))) && + ((this.pauseablePlacement = new Zt( + e, + this.terrain, + this._order, + r, + i, + o, + a, + this.placement, + )), + (this._layerOrderChanged = !1)), + this.pauseablePlacement.isDone() + ? this.placement.setStale() + : (this.pauseablePlacement.continuePlacement( + this._order, + this._layers, + l, + ), + this.pauseablePlacement.isDone() && + ((this.placement = this.pauseablePlacement.commit( + t.exported.now(), + )), + (n = !0)), + s && this.pauseablePlacement.placement.setStale()), + n || s) + ) + for (const t of this._order) { + const e = this._layers[t]; + 'symbol' === e.type && + this.placement.updateLayerOpacities(e, l[e.source]); + } + return ( + !this.pauseablePlacement.isDone() || + this.placement.hasTransitions(t.exported.now()) + ); + } + _releaseSymbolFadeTiles() { + for (const t in this.sourceCaches) + this.sourceCaches[t].releaseSymbolFadeTiles(); + } + getImages(t, e, i) { + this.imageManager.getImages(e.icons, i), + this._updateTilesForChangedImages(); + const o = this.sourceCaches[e.source]; + o && o.setDependencies(e.tileID.key, e.type, e.icons); + } + getGlyphs(t, e, i) { + this.glyphManager.getGlyphs(e.stacks, i); + } + getResource(e, i, o) { + return t.makeRequest(i, o); + } + } + (ee.getSourceType = function (t) { + return M[t]; + }), + (ee.setSourceType = function (t, e) { + M[t] = e; + }), + (ee.registerForPluginStateChange = t.registerForPluginStateChange); + var ie = + 'attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}'; + const oe = { + prelude: ae( + '#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif', + '#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}', + ), + background: ae( + 'uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}', + ), + backgroundPattern: ae( + 'uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}', + ), + circle: ae( + '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(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;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(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);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}', + ), + clippingMask: ae( + '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: ae( + 'uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}', + ), + heatmapTexture: ae( + 'uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}', + ), + collisionBox: ae( + 'varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}', + 'attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}', + ), + collisionCircle: ae( + 'varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}', + 'attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}', + ), + debug: ae( + 'uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}', + 'attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}', + ), + fill: ae( + '#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}', + ), + fillOutline: ae( + 'varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}', + ), + fillOutlinePattern: ae( + 'uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}', + ), + fillPattern: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}', + ), + fillExtrusion: ae( + 'varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}', + ), + fillExtrusionPattern: ae( + 'uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\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;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}', + ), + hillshadePrepare: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}', + ), + hillshade: ae( + 'uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}', + ), + line: ae( + 'uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}', + ), + lineGradient: ae( + 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_width2=vec2(outset,inset);}', + ), + linePattern: ae( + '#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}', + ), + lineSDF: ae( + 'uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + '\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\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#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}', + ), + raster: ae( + 'uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}', + ), + symbolIcon: ae( + 'uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}', + ), + symbolSDF: ae( + '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}', + ), + symbolTextAndIcon: ae( + '#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}', + 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}', + ), + terrain: ae( + 'uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}', + ie, + ), + terrainDepth: ae( + 'varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}', + ie, + ), + terrainCoords: ae( + 'precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}', + ie, + ), + }; + function ae(t, e) { + const i = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, + o = e.match(/attribute ([\w]+) ([\w]+)/g), + a = t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), + r = e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), + s = r ? r.concat(a) : a, + n = {}; + return { + fragmentSource: (t = t.replace( + i, + (t, e, i, o, a) => ( + (n[a] = !0), + 'define' === e + ? `\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n` + : `\n#ifdef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = u_${a};\n#endif\n` + ), + )), + vertexSource: (e = e.replace(i, (t, e, i, o, a) => { + const r = 'float' === o ? 'vec2' : 'vec4', + s = a.match(/color/) ? 'color' : r; + return n[a] + ? 'define' === e + ? `\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${r} a_${a};\nvarying ${i} ${o} ${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n` + : 'vec4' === s + ? `\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n` + : `\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n` + : 'define' === e + ? `\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${i} ${r} a_${a};\n#else\nuniform ${i} ${o} u_${a};\n#endif\n` + : 'vec4' === s + ? `\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = a_${a};\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n` + : `\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${o} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${o} ${a} = u_${a};\n#endif\n`; + })), + staticAttributes: o, + staticUniforms: s, + }; + } + class re { + constructor() { + (this.boundProgram = null), + (this.boundLayoutVertexBuffer = null), + (this.boundPaintVertexBuffers = []), + (this.boundIndexBuffer = null), + (this.boundVertexOffset = null), + (this.boundDynamicVertexBuffer = null), + (this.vao = null); + } + bind(t, e, i, o, a, r, s, n, l) { + this.context = t; + let c = this.boundPaintVertexBuffers.length !== o.length; + for (let t = 0; !c && t < o.length; t++) + this.boundPaintVertexBuffers[t] !== o[t] && (c = !0); + t.extVertexArrayObject && + this.vao && + this.boundProgram === e && + this.boundLayoutVertexBuffer === i && + !c && + this.boundIndexBuffer === a && + this.boundVertexOffset === r && + this.boundDynamicVertexBuffer === s && + this.boundDynamicVertexBuffer2 === n && + this.boundDynamicVertexBuffer3 === l + ? (t.bindVertexArrayOES.set(this.vao), + s && s.bind(), + a && a.dynamicDraw && a.bind(), + n && n.bind(), + l && l.bind()) + : this.freshBind(e, i, o, a, r, s, n, l); + } + freshBind(t, e, i, o, a, r, s, n) { + let l; + const c = t.numAttributes, + h = this.context, + u = h.gl; + if (h.extVertexArrayObject) + this.vao && this.destroy(), + (this.vao = h.extVertexArrayObject.createVertexArrayOES()), + h.bindVertexArrayOES.set(this.vao), + (l = 0), + (this.boundProgram = t), + (this.boundLayoutVertexBuffer = e), + (this.boundPaintVertexBuffers = i), + (this.boundIndexBuffer = o), + (this.boundVertexOffset = a), + (this.boundDynamicVertexBuffer = r), + (this.boundDynamicVertexBuffer2 = s), + (this.boundDynamicVertexBuffer3 = n); + else { + l = h.currentNumAttributes || 0; + for (let t = c; t < l; t++) u.disableVertexAttribArray(t); + } + e.enableAttributes(u, t); + for (const e of i) e.enableAttributes(u, t); + r && r.enableAttributes(u, t), + s && s.enableAttributes(u, t), + n && n.enableAttributes(u, t), + e.bind(), + e.setVertexAttribPointers(u, t, a); + for (const e of i) e.bind(), e.setVertexAttribPointers(u, t, a); + r && (r.bind(), r.setVertexAttribPointers(u, t, a)), + o && o.bind(), + s && (s.bind(), s.setVertexAttribPointers(u, t, a)), + n && (n.bind(), n.setVertexAttribPointers(u, t, a)), + (h.currentNumAttributes = c); + } + destroy() { + this.vao && + (this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao), + (this.vao = null)); + } + } + function se(t) { + const e = []; + for (let i = 0; i < t.length; i++) { + if (null === t[i]) continue; + const o = t[i].split(' '); + e.push(o.pop()); + } + return e; + } + class ne { + constructor(e, i, o, a, r, s, n) { + const l = e.gl; + this.program = l.createProgram(); + const c = se(o.staticAttributes), + h = a ? a.getBinderAttributes() : [], + u = c.concat(h), + d = oe.prelude.staticUniforms ? se(oe.prelude.staticUniforms) : [], + m = o.staticUniforms ? se(o.staticUniforms) : [], + _ = a ? a.getBinderUniforms() : [], + p = d.concat(m).concat(_), + f = []; + for (const t of p) f.indexOf(t) < 0 && f.push(t); + const g = a ? a.defines() : []; + s && g.push('#define OVERDRAW_INSPECTOR;'), + n && g.push('#define TERRAIN3D;'); + const x = g + .concat(oe.prelude.fragmentSource, o.fragmentSource) + .join('\n'), + v = g.concat(oe.prelude.vertexSource, o.vertexSource).join('\n'), + y = l.createShader(l.FRAGMENT_SHADER); + if (l.isContextLost()) return void (this.failedToCreate = !0); + l.shaderSource(y, x), + l.compileShader(y), + l.attachShader(this.program, y); + const b = l.createShader(l.VERTEX_SHADER); + if (l.isContextLost()) return void (this.failedToCreate = !0); + l.shaderSource(b, v), + l.compileShader(b), + l.attachShader(this.program, b), + (this.attributes = {}); + const w = {}; + this.numAttributes = u.length; + for (let t = 0; t < this.numAttributes; t++) + u[t] && + (l.bindAttribLocation(this.program, t, u[t]), + (this.attributes[u[t]] = t)); + l.linkProgram(this.program), l.deleteShader(b), l.deleteShader(y); + for (let t = 0; t < f.length; t++) { + const e = f[t]; + if (e && !w[e]) { + const t = l.getUniformLocation(this.program, e); + t && (w[e] = t); + } + } + (this.fixedUniforms = r(e, w)), + (this.terrainUniforms = ((e, i) => ({ + u_depth: new t.Uniform1i(e, i.u_depth), + u_terrain: new t.Uniform1i(e, i.u_terrain), + u_terrain_dim: new t.Uniform1f(e, i.u_terrain_dim), + u_terrain_matrix: new t.UniformMatrix4f(e, i.u_terrain_matrix), + u_terrain_unpack: new t.Uniform4f(e, i.u_terrain_unpack), + u_terrain_offset: new t.Uniform1f(e, i.u_terrain_offset), + u_terrain_exaggeration: new t.Uniform1f( + e, + i.u_terrain_exaggeration, + ), + }))(e, w)), + (this.binderUniforms = a ? a.getUniforms(e, w) : []); + } + draw(t, e, i, o, a, r, s, n, l, c, h, u, d, m, _, p, f, g) { + const x = t.gl; + if (this.failedToCreate) return; + if ( + (t.program.set(this.program), + t.setDepthMode(i), + t.setStencilMode(o), + t.setColorMode(a), + t.setCullFace(r), + n) + ) { + t.activeTexture.set(x.TEXTURE2), + x.bindTexture(x.TEXTURE_2D, n.depthTexture), + t.activeTexture.set(x.TEXTURE3), + x.bindTexture(x.TEXTURE_2D, n.texture); + for (const t in this.terrainUniforms) + this.terrainUniforms[t].set(n[t]); + } + for (const t in this.fixedUniforms) this.fixedUniforms[t].set(s[t]); + _ && _.setUniforms(t, this.binderUniforms, d, { zoom: m }); + let v = 0; + switch (e) { + case x.LINES: + v = 2; + break; + case x.TRIANGLES: + v = 3; + break; + case x.LINE_STRIP: + v = 1; + } + for (const i of u.get()) { + const o = i.vaos || (i.vaos = {}); + (o[l] || (o[l] = new re())).bind( + t, + this, + c, + _ ? _.getPaintVertexBuffers() : [], + h, + i.vertexOffset, + p, + f, + g, + ), + x.drawElements( + e, + i.primitiveLength * v, + x.UNSIGNED_SHORT, + i.primitiveOffset * v * 2, + ); + } + } + } + function le(t, e, i) { + const o = 1 / bt(i, 1, e.transform.tileZoom), + a = Math.pow(2, i.tileID.overscaledZ), + r = (i.tileSize * Math.pow(2, e.transform.tileZoom)) / a, + s = r * (i.tileID.canonical.x + i.tileID.wrap * a), + n = r * i.tileID.canonical.y; + return { + u_image: 0, + u_texsize: i.imageAtlasTexture.size, + u_scale: [o, t.fromScale, t.toScale], + u_fade: t.t, + u_pixel_coord_upper: [s >> 16, n >> 16], + u_pixel_coord_lower: [65535 & s, 65535 & n], + }; + } + const ce = (e, i, o, a) => { + const r = i.style.light, + s = r.properties.get('position'), + n = [s.x, s.y, s.z], + l = t.create$1(); + 'viewport' === r.properties.get('anchor') && + t.fromRotation(l, -i.transform.angle), + t.transformMat3(n, n, l); + const c = r.properties.get('color'); + return { + u_matrix: e, + u_lightpos: n, + u_lightintensity: r.properties.get('intensity'), + u_lightcolor: [c.r, c.g, c.b], + u_vertical_gradient: +o, + u_opacity: a, + }; + }, + he = (e, i, o, a, r, s, n) => + t.extend(ce(e, i, o, a), le(s, i, n), { + u_height_factor: -Math.pow(2, r.overscaledZ) / n.tileSize / 8, + }), + ue = (t) => ({ u_matrix: t }), + de = (e, i, o, a) => t.extend(ue(e), le(o, i, a)), + me = (t, e) => ({ u_matrix: t, u_world: e }), + _e = (e, i, o, a, r) => t.extend(de(e, i, o, a), { u_world: r }), + pe = (t, e, i, o) => { + const a = t.transform; + let r, s; + if ('map' === o.paint.get('circle-pitch-alignment')) { + const t = bt(i, 1, a.zoom); + (r = !0), (s = [t, t]); + } else (r = !1), (s = a.pixelsToGLUnits); + return { + u_camera_to_center_distance: a.cameraToCenterDistance, + u_scale_with_map: +('map' === o.paint.get('circle-pitch-scale')), + u_matrix: t.translatePosMatrix( + e.posMatrix, + i, + o.paint.get('circle-translate'), + o.paint.get('circle-translate-anchor'), + ), + u_pitch_with_map: +r, + u_device_pixel_ratio: t.pixelRatio, + u_extrude_scale: s, + }; + }, + fe = (t, e, i) => { + const o = bt(i, 1, e.zoom), + a = Math.pow(2, e.zoom - i.tileID.overscaledZ), + r = i.tileID.overscaleFactor(); + return { + u_matrix: t, + u_camera_to_center_distance: e.cameraToCenterDistance, + u_pixels_to_tile_units: o, + u_extrude_scale: [ + e.pixelsToGLUnits[0] / (o * a), + e.pixelsToGLUnits[1] / (o * a), + ], + u_overscale_factor: r, + }; + }, + ge = (t, e, i = 1) => ({ + u_matrix: t, + u_color: e, + u_overlay: 0, + u_overlay_scale: i, + }), + xe = (t) => ({ u_matrix: t }), + ve = (t, e, i, o) => ({ + u_matrix: t, + u_extrude_scale: bt(e, 1, i), + u_intensity: o, + }); + function ye(e, i) { + const o = Math.pow(2, i.canonical.z), + a = i.canonical.y; + return [ + new t.MercatorCoordinate(0, a / o).toLngLat().lat, + new t.MercatorCoordinate(0, (a + 1) / o).toLngLat().lat, + ]; + } + const be = (t, e, i, o) => { + const a = t.transform; + return { + u_matrix: Ce(t, e, i, o), + u_ratio: 1 / bt(e, 1, a.zoom), + u_device_pixel_ratio: t.pixelRatio, + u_units_to_pixels: [ + 1 / a.pixelsToGLUnits[0], + 1 / a.pixelsToGLUnits[1], + ], + }; + }, + we = (e, i, o, a, r) => + t.extend(be(e, i, o, r), { u_image: 0, u_image_height: a }), + Te = (t, e, i, o, a) => { + const r = t.transform, + s = Ie(e, r); + return { + u_matrix: Ce(t, e, i, a), + u_texsize: e.imageAtlasTexture.size, + u_ratio: 1 / bt(e, 1, r.zoom), + u_device_pixel_ratio: t.pixelRatio, + u_image: 0, + u_scale: [s, o.fromScale, o.toScale], + u_fade: o.t, + u_units_to_pixels: [ + 1 / r.pixelsToGLUnits[0], + 1 / r.pixelsToGLUnits[1], + ], + }; + }, + Ee = (e, i, o, a, r, s) => { + const n = e.lineAtlas, + l = Ie(i, e.transform), + c = 'round' === o.layout.get('line-cap'), + h = n.getDash(a.from, c), + u = n.getDash(a.to, c), + d = h.width * r.fromScale, + m = u.width * r.toScale; + return t.extend(be(e, i, o, s), { + u_patternscale_a: [l / d, -h.height / 2], + u_patternscale_b: [l / m, -u.height / 2], + u_sdfgamma: n.width / (256 * Math.min(d, m) * e.pixelRatio) / 2, + u_image: 0, + u_tex_y_a: h.y, + u_tex_y_b: u.y, + u_mix: r.t, + }); + }; + function Ie(t, e) { + return 1 / bt(t, 1, e.tileZoom); + } + function Ce(t, e, i, o) { + return t.translatePosMatrix( + o ? o.posMatrix : e.tileID.posMatrix, + e, + i.paint.get('line-translate'), + i.paint.get('line-translate-anchor'), + ); + } + const Se = (t, e, i, o, a) => { + return { + u_matrix: t, + u_tl_parent: e, + u_scale_parent: i, + u_buffer_scale: 1, + u_fade_t: o.mix, + u_opacity: o.opacity * a.paint.get('raster-opacity'), + u_image0: 0, + u_image1: 1, + u_brightness_low: a.paint.get('raster-brightness-min'), + u_brightness_high: a.paint.get('raster-brightness-max'), + u_saturation_factor: + ((s = a.paint.get('raster-saturation')), + s > 0 ? 1 - 1 / (1.001 - s) : -s), + u_contrast_factor: + ((r = a.paint.get('raster-contrast')), r > 0 ? 1 / (1 - r) : 1 + r), + u_spin_weights: De(a.paint.get('raster-hue-rotate')), + }; + var r, s; + }; + function De(t) { + t *= Math.PI / 180; + const e = Math.sin(t), + i = Math.cos(t); + return [ + (2 * i + 1) / 3, + (-Math.sqrt(3) * e - i + 1) / 3, + (Math.sqrt(3) * e - i + 1) / 3, + ]; + } + const ze = (t, e, i, o, a, r, s, n, l, c) => { + const h = a.transform; + return { + u_is_size_zoom_constant: +('constant' === t || 'source' === t), + u_is_size_feature_constant: +('constant' === t || 'camera' === t), + u_size_t: e ? e.uSizeT : 0, + u_size: e ? e.uSize : 0, + u_camera_to_center_distance: h.cameraToCenterDistance, + u_pitch: (h.pitch / 360) * 2 * Math.PI, + u_rotate_symbol: +i, + u_aspect_ratio: h.width / h.height, + u_fade_change: a.options.fadeDuration ? a.symbolFadeChange : 1, + u_matrix: r, + u_label_plane_matrix: s, + u_coord_matrix: n, + u_is_text: +l, + u_pitch_with_map: +o, + u_texsize: c, + u_texture: 0, + }; + }, + Pe = (e, i, o, a, r, s, n, l, c, h, u) => { + const d = r.transform; + return t.extend(ze(e, i, o, a, r, s, n, l, c, h), { + u_gamma_scale: a ? Math.cos(d._pitch) * d.cameraToCenterDistance : 1, + u_device_pixel_ratio: r.pixelRatio, + u_is_halo: +u, + }); + }, + Me = (e, i, o, a, r, s, n, l, c, h) => + t.extend(Pe(e, i, o, a, r, s, n, l, !0, c, !0), { + u_texsize_icon: h, + u_texture_icon: 1, + }), + Ae = (t, e, i) => ({ u_matrix: t, u_opacity: e, u_color: i }), + Le = (e, i, o, a, r, s) => + t.extend( + (function (t, e, i, o) { + const a = i.imageManager.getPattern(t.from.toString()), + r = i.imageManager.getPattern(t.to.toString()), + { width: s, height: n } = i.imageManager.getPixelSize(), + l = Math.pow(2, o.tileID.overscaledZ), + c = (o.tileSize * Math.pow(2, i.transform.tileZoom)) / l, + h = c * (o.tileID.canonical.x + o.tileID.wrap * l), + u = c * o.tileID.canonical.y; + return { + u_image: 0, + u_pattern_tl_a: a.tl, + u_pattern_br_a: a.br, + u_pattern_tl_b: r.tl, + u_pattern_br_b: r.br, + u_texsize: [s, n], + u_mix: e.t, + u_pattern_size_a: a.displaySize, + u_pattern_size_b: r.displaySize, + u_scale_a: e.fromScale, + u_scale_b: e.toScale, + u_tile_units_to_pixels: 1 / bt(o, 1, i.transform.tileZoom), + u_pixel_coord_upper: [h >> 16, u >> 16], + u_pixel_coord_lower: [65535 & h, 65535 & u], + }; + })(a, s, o, r), + { u_matrix: e, u_opacity: i }, + ), + Re = { + fillExtrusion: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_lightpos: new t.Uniform3f(e, i.u_lightpos), + u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), + u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), + u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }), + fillExtrusionPattern: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_lightpos: new t.Uniform3f(e, i.u_lightpos), + u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), + u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), + u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), + u_height_factor: new t.Uniform1f(e, i.u_height_factor), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }), + fill: (e, i) => ({ u_matrix: new t.UniformMatrix4f(e, i.u_matrix) }), + fillPattern: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }), + fillOutline: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + }), + fillOutlinePattern: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + u_image: new t.Uniform1i(e, i.u_image), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }), + circle: (e, i) => ({ + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_scale_with_map: new t.Uniform1i(e, i.u_scale_with_map), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }), + collisionBox: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pixels_to_tile_units: new t.Uniform1f(e, i.u_pixels_to_tile_units), + u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), + u_overscale_factor: new t.Uniform1f(e, i.u_overscale_factor), + }), + collisionCircle: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_inv_matrix: new t.UniformMatrix4f(e, i.u_inv_matrix), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_viewport_size: new t.Uniform2f(e, i.u_viewport_size), + }), + debug: (e, i) => ({ + u_color: new t.UniformColor(e, i.u_color), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_overlay: new t.Uniform1i(e, i.u_overlay), + u_overlay_scale: new t.Uniform1f(e, i.u_overlay_scale), + }), + clippingMask: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }), + heatmap: (e, i) => ({ + u_extrude_scale: new t.Uniform1f(e, i.u_extrude_scale), + u_intensity: new t.Uniform1f(e, i.u_intensity), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }), + heatmapTexture: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_world: new t.Uniform2f(e, i.u_world), + u_image: new t.Uniform1i(e, i.u_image), + u_color_ramp: new t.Uniform1i(e, i.u_color_ramp), + u_opacity: new t.Uniform1f(e, i.u_opacity), + }), + hillshade: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_latrange: new t.Uniform2f(e, i.u_latrange), + u_light: new t.Uniform2f(e, i.u_light), + u_shadow: new t.UniformColor(e, i.u_shadow), + u_highlight: new t.UniformColor(e, i.u_highlight), + u_accent: new t.UniformColor(e, i.u_accent), + }), + hillshadePrepare: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_image: new t.Uniform1i(e, i.u_image), + u_dimension: new t.Uniform2f(e, i.u_dimension), + u_zoom: new t.Uniform1f(e, i.u_zoom), + u_unpack: new t.Uniform4f(e, i.u_unpack), + }), + line: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + }), + lineGradient: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_image: new t.Uniform1i(e, i.u_image), + u_image_height: new t.Uniform1f(e, i.u_image_height), + }), + linePattern: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_image: new t.Uniform1i(e, i.u_image), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_scale: new t.Uniform3f(e, i.u_scale), + u_fade: new t.Uniform1f(e, i.u_fade), + }), + lineSDF: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_ratio: new t.Uniform1f(e, i.u_ratio), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), + u_patternscale_a: new t.Uniform2f(e, i.u_patternscale_a), + u_patternscale_b: new t.Uniform2f(e, i.u_patternscale_b), + u_sdfgamma: new t.Uniform1f(e, i.u_sdfgamma), + u_image: new t.Uniform1i(e, i.u_image), + u_tex_y_a: new t.Uniform1f(e, i.u_tex_y_a), + u_tex_y_b: new t.Uniform1f(e, i.u_tex_y_b), + u_mix: new t.Uniform1f(e, i.u_mix), + }), + raster: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_tl_parent: new t.Uniform2f(e, i.u_tl_parent), + u_scale_parent: new t.Uniform1f(e, i.u_scale_parent), + u_buffer_scale: new t.Uniform1f(e, i.u_buffer_scale), + u_fade_t: new t.Uniform1f(e, i.u_fade_t), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_image0: new t.Uniform1i(e, i.u_image0), + u_image1: new t.Uniform1i(e, i.u_image1), + u_brightness_low: new t.Uniform1f(e, i.u_brightness_low), + u_brightness_high: new t.Uniform1f(e, i.u_brightness_high), + u_saturation_factor: new t.Uniform1f(e, i.u_saturation_factor), + u_contrast_factor: new t.Uniform1f(e, i.u_contrast_factor), + u_spin_weights: new t.Uniform3f(e, i.u_spin_weights), + }), + symbolIcon: (e, i) => ({ + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texture: new t.Uniform1i(e, i.u_texture), + }), + symbolSDF: (e, i) => ({ + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texture: new t.Uniform1i(e, i.u_texture), + u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_is_halo: new t.Uniform1i(e, i.u_is_halo), + }), + symbolTextAndIcon: (e, i) => ({ + u_is_size_zoom_constant: new t.Uniform1i( + e, + i.u_is_size_zoom_constant, + ), + u_is_size_feature_constant: new t.Uniform1i( + e, + i.u_is_size_feature_constant, + ), + u_size_t: new t.Uniform1f(e, i.u_size_t), + u_size: new t.Uniform1f(e, i.u_size), + u_camera_to_center_distance: new t.Uniform1f( + e, + i.u_camera_to_center_distance, + ), + u_pitch: new t.Uniform1f(e, i.u_pitch), + u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), + u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), + u_fade_change: new t.Uniform1f(e, i.u_fade_change), + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_label_plane_matrix: new t.UniformMatrix4f( + e, + i.u_label_plane_matrix, + ), + u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), + u_is_text: new t.Uniform1i(e, i.u_is_text), + u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_texsize_icon: new t.Uniform2f(e, i.u_texsize_icon), + u_texture: new t.Uniform1i(e, i.u_texture), + u_texture_icon: new t.Uniform1i(e, i.u_texture_icon), + u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), + u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), + u_is_halo: new t.Uniform1i(e, i.u_is_halo), + }), + background: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_color: new t.UniformColor(e, i.u_color), + }), + backgroundPattern: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_opacity: new t.Uniform1f(e, i.u_opacity), + u_image: new t.Uniform1i(e, i.u_image), + u_pattern_tl_a: new t.Uniform2f(e, i.u_pattern_tl_a), + u_pattern_br_a: new t.Uniform2f(e, i.u_pattern_br_a), + u_pattern_tl_b: new t.Uniform2f(e, i.u_pattern_tl_b), + u_pattern_br_b: new t.Uniform2f(e, i.u_pattern_br_b), + u_texsize: new t.Uniform2f(e, i.u_texsize), + u_mix: new t.Uniform1f(e, i.u_mix), + u_pattern_size_a: new t.Uniform2f(e, i.u_pattern_size_a), + u_pattern_size_b: new t.Uniform2f(e, i.u_pattern_size_b), + u_scale_a: new t.Uniform1f(e, i.u_scale_a), + u_scale_b: new t.Uniform1f(e, i.u_scale_b), + u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), + u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), + u_tile_units_to_pixels: new t.Uniform1f(e, i.u_tile_units_to_pixels), + }), + terrain: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texture: new t.Uniform1i(e, i.u_texture), + }), + terrainDepth: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + }), + terrainCoords: (e, i) => ({ + u_matrix: new t.UniformMatrix4f(e, i.u_matrix), + u_texture: new t.Uniform1i(e, i.u_texture), + u_terrain_coords_id: new t.Uniform1f(e, i.u_terrain_coords_id), + }), + }; + class ke { + constructor(t, e, i) { + this.context = t; + const o = t.gl; + (this.buffer = o.createBuffer()), + (this.dynamicDraw = Boolean(i)), + this.context.unbindVAO(), + t.bindElementBuffer.set(this.buffer), + o.bufferData( + o.ELEMENT_ARRAY_BUFFER, + e.arrayBuffer, + this.dynamicDraw ? o.DYNAMIC_DRAW : o.STATIC_DRAW, + ), + this.dynamicDraw || delete e.arrayBuffer; + } + bind() { + this.context.bindElementBuffer.set(this.buffer); + } + updateData(t) { + const e = this.context.gl; + if (!this.dynamicDraw) + throw new Error( + 'Attempted to update data while not in dynamic mode.', + ); + this.context.unbindVAO(), + this.bind(), + e.bufferSubData(e.ELEMENT_ARRAY_BUFFER, 0, t.arrayBuffer); + } + destroy() { + this.buffer && + (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); + } + } + const Be = { + Int8: 'BYTE', + Uint8: 'UNSIGNED_BYTE', + Int16: 'SHORT', + Uint16: 'UNSIGNED_SHORT', + Int32: 'INT', + Uint32: 'UNSIGNED_INT', + Float32: 'FLOAT', + }; + class Fe { + constructor(t, e, i, o) { + (this.length = e.length), + (this.attributes = i), + (this.itemSize = e.bytesPerElement), + (this.dynamicDraw = o), + (this.context = t); + const a = t.gl; + (this.buffer = a.createBuffer()), + t.bindVertexBuffer.set(this.buffer), + a.bufferData( + a.ARRAY_BUFFER, + e.arrayBuffer, + this.dynamicDraw ? a.DYNAMIC_DRAW : a.STATIC_DRAW, + ), + this.dynamicDraw || delete e.arrayBuffer; + } + bind() { + this.context.bindVertexBuffer.set(this.buffer); + } + updateData(t) { + if (t.length !== this.length) + throw new Error( + `Length of new data is ${t.length}, which doesn't match current length of ${this.length}`, + ); + const e = this.context.gl; + this.bind(), e.bufferSubData(e.ARRAY_BUFFER, 0, t.arrayBuffer); + } + enableAttributes(t, e) { + for (let i = 0; i < this.attributes.length; i++) { + const o = e.attributes[this.attributes[i].name]; + void 0 !== o && t.enableVertexAttribArray(o); + } + } + setVertexAttribPointers(t, e, i) { + for (let o = 0; o < this.attributes.length; o++) { + const a = this.attributes[o], + r = e.attributes[a.name]; + void 0 !== r && + t.vertexAttribPointer( + r, + a.components, + t[Be[a.type]], + !1, + this.itemSize, + a.offset + this.itemSize * (i || 0), + ); + } + } + destroy() { + this.buffer && + (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); + } + } + class Oe { + constructor(t) { + (this.gl = t.gl), + (this.default = this.getDefault()), + (this.current = this.default), + (this.dirty = !1); + } + get() { + return this.current; + } + set(t) {} + getDefault() { + return this.default; + } + setDefault() { + this.set(this.default); + } + } + class Ue extends Oe { + getDefault() { + return t.Color.transparent; + } + set(t) { + const e = this.current; + (t.r !== e.r || + t.g !== e.g || + t.b !== e.b || + t.a !== e.a || + this.dirty) && + (this.gl.clearColor(t.r, t.g, t.b, t.a), + (this.current = t), + (this.dirty = !1)); + } + } + class Ne extends Oe { + getDefault() { + return 1; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.clearDepth(t), (this.current = t), (this.dirty = !1)); + } + } + class Ge extends Oe { + getDefault() { + return 0; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.clearStencil(t), (this.current = t), (this.dirty = !1)); + } + } + class Ze extends Oe { + getDefault() { + return [!0, !0, !0, !0]; + } + set(t) { + const e = this.current; + (t[0] !== e[0] || + t[1] !== e[1] || + t[2] !== e[2] || + t[3] !== e[3] || + this.dirty) && + (this.gl.colorMask(t[0], t[1], t[2], t[3]), + (this.current = t), + (this.dirty = !1)); + } + } + class Ve extends Oe { + getDefault() { + return !0; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.depthMask(t), (this.current = t), (this.dirty = !1)); + } + } + class qe extends Oe { + getDefault() { + return 255; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.stencilMask(t), (this.current = t), (this.dirty = !1)); + } + } + class je extends Oe { + getDefault() { + return { func: this.gl.ALWAYS, ref: 0, mask: 255 }; + } + set(t) { + const e = this.current; + (t.func !== e.func || + t.ref !== e.ref || + t.mask !== e.mask || + this.dirty) && + (this.gl.stencilFunc(t.func, t.ref, t.mask), + (this.current = t), + (this.dirty = !1)); + } + } + class $e extends Oe { + getDefault() { + const t = this.gl; + return [t.KEEP, t.KEEP, t.KEEP]; + } + set(t) { + const e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || t[2] !== e[2] || this.dirty) && + (this.gl.stencilOp(t[0], t[1], t[2]), + (this.current = t), + (this.dirty = !1)); + } + } + class Xe extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + t ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), + (this.current = t), + (this.dirty = !1); + } + } + class We extends Oe { + getDefault() { + return [0, 1]; + } + set(t) { + const e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && + (this.gl.depthRange(t[0], t[1]), + (this.current = t), + (this.dirty = !1)); + } + } + class He extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + t ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), + (this.current = t), + (this.dirty = !1); + } + } + class Ke extends Oe { + getDefault() { + return this.gl.LESS; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.depthFunc(t), (this.current = t), (this.dirty = !1)); + } + } + class Ye extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + t ? e.enable(e.BLEND) : e.disable(e.BLEND), + (this.current = t), + (this.dirty = !1); + } + } + class Je extends Oe { + getDefault() { + const t = this.gl; + return [t.ONE, t.ZERO]; + } + set(t) { + const e = this.current; + (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && + (this.gl.blendFunc(t[0], t[1]), + (this.current = t), + (this.dirty = !1)); + } + } + class Qe extends Oe { + getDefault() { + return t.Color.transparent; + } + set(t) { + const e = this.current; + (t.r !== e.r || + t.g !== e.g || + t.b !== e.b || + t.a !== e.a || + this.dirty) && + (this.gl.blendColor(t.r, t.g, t.b, t.a), + (this.current = t), + (this.dirty = !1)); + } + } + class ti extends Oe { + getDefault() { + return this.gl.FUNC_ADD; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.blendEquation(t), (this.current = t), (this.dirty = !1)); + } + } + class ei extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + t ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), + (this.current = t), + (this.dirty = !1); + } + } + class ii extends Oe { + getDefault() { + return this.gl.BACK; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.cullFace(t), (this.current = t), (this.dirty = !1)); + } + } + class oi extends Oe { + getDefault() { + return this.gl.CCW; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.frontFace(t), (this.current = t), (this.dirty = !1)); + } + } + class ai extends Oe { + getDefault() { + return null; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.useProgram(t), (this.current = t), (this.dirty = !1)); + } + } + class ri extends Oe { + getDefault() { + return this.gl.TEXTURE0; + } + set(t) { + (t !== this.current || this.dirty) && + (this.gl.activeTexture(t), (this.current = t), (this.dirty = !1)); + } + } + class si extends Oe { + getDefault() { + const t = this.gl; + return [0, 0, t.drawingBufferWidth, t.drawingBufferHeight]; + } + set(t) { + const e = this.current; + (t[0] !== e[0] || + t[1] !== e[1] || + t[2] !== e[2] || + t[3] !== e[3] || + this.dirty) && + (this.gl.viewport(t[0], t[1], t[2], t[3]), + (this.current = t), + (this.dirty = !1)); + } + } + class ni extends Oe { + getDefault() { + return null; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.bindFramebuffer(e.FRAMEBUFFER, t), + (this.current = t), + (this.dirty = !1); + } + } + class li extends Oe { + getDefault() { + return null; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.bindRenderbuffer(e.RENDERBUFFER, t), + (this.current = t), + (this.dirty = !1); + } + } + class ci extends Oe { + getDefault() { + return null; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.bindTexture(e.TEXTURE_2D, t), (this.current = t), (this.dirty = !1); + } + } + class hi extends Oe { + getDefault() { + return null; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.bindBuffer(e.ARRAY_BUFFER, t), (this.current = t), (this.dirty = !1); + } + } + class ui extends Oe { + getDefault() { + return null; + } + set(t) { + const e = this.gl; + e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t), + (this.current = t), + (this.dirty = !1); + } + } + class di extends Oe { + constructor(t) { + super(t), (this.vao = t.extVertexArrayObject); + } + getDefault() { + return null; + } + set(t) { + this.vao && + (t !== this.current || this.dirty) && + (this.vao.bindVertexArrayOES(t), + (this.current = t), + (this.dirty = !1)); + } + } + class mi extends Oe { + getDefault() { + return 4; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.pixelStorei(e.UNPACK_ALIGNMENT, t), + (this.current = t), + (this.dirty = !1); + } + } + class _i extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t), + (this.current = t), + (this.dirty = !1); + } + } + class pi extends Oe { + getDefault() { + return !1; + } + set(t) { + if (t === this.current && !this.dirty) return; + const e = this.gl; + e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t), + (this.current = t), + (this.dirty = !1); + } + } + class fi extends Oe { + constructor(t, e) { + super(t), (this.context = t), (this.parent = e); + } + getDefault() { + return null; + } + } + class gi extends fi { + setDirty() { + this.dirty = !0; + } + set(t) { + if (t === this.current && !this.dirty) return; + this.context.bindFramebuffer.set(this.parent); + const e = this.gl; + e.framebufferTexture2D( + e.FRAMEBUFFER, + e.COLOR_ATTACHMENT0, + e.TEXTURE_2D, + t, + 0, + ), + (this.current = t), + (this.dirty = !1); + } + } + class xi extends fi { + set(t) { + if (t === this.current && !this.dirty) return; + this.context.bindFramebuffer.set(this.parent); + const e = this.gl; + e.framebufferRenderbuffer( + e.FRAMEBUFFER, + e.DEPTH_ATTACHMENT, + e.RENDERBUFFER, + t, + ), + (this.current = t), + (this.dirty = !1); + } + } + class vi { + constructor(t, e, i, o) { + (this.context = t), (this.width = e), (this.height = i); + const a = t.gl, + r = (this.framebuffer = a.createFramebuffer()); + if ( + ((this.colorAttachment = new gi(t, r)), + o && (this.depthAttachment = new xi(t, r)), + a.checkFramebufferStatus(a.FRAMEBUFFER) !== a.FRAMEBUFFER_COMPLETE) + ) + throw new Error('Framebuffer is not complete'); + } + destroy() { + const t = this.context.gl, + e = this.colorAttachment.get(); + if ((e && t.deleteTexture(e), this.depthAttachment)) { + const e = this.depthAttachment.get(); + e && t.deleteRenderbuffer(e); + } + t.deleteFramebuffer(this.framebuffer); + } + } + class yi { + constructor(t, e, i) { + (this.blendFunction = t), (this.blendColor = e), (this.mask = i); + } + } + (yi.Replace = [1, 0]), + (yi.disabled = new yi(yi.Replace, t.Color.transparent, [!1, !1, !1, !1])), + (yi.unblended = new yi(yi.Replace, t.Color.transparent, [ + !0, + !0, + !0, + !0, + ])), + (yi.alphaBlended = new yi([1, 771], t.Color.transparent, [ + !0, + !0, + !0, + !0, + ])); + class bi { + constructor(t) { + (this.gl = t), + (this.extVertexArrayObject = this.gl.getExtension( + 'OES_vertex_array_object', + )), + (this.clearColor = new Ue(this)), + (this.clearDepth = new Ne(this)), + (this.clearStencil = new Ge(this)), + (this.colorMask = new Ze(this)), + (this.depthMask = new Ve(this)), + (this.stencilMask = new qe(this)), + (this.stencilFunc = new je(this)), + (this.stencilOp = new $e(this)), + (this.stencilTest = new Xe(this)), + (this.depthRange = new We(this)), + (this.depthTest = new He(this)), + (this.depthFunc = new Ke(this)), + (this.blend = new Ye(this)), + (this.blendFunc = new Je(this)), + (this.blendColor = new Qe(this)), + (this.blendEquation = new ti(this)), + (this.cullFace = new ei(this)), + (this.cullFaceSide = new ii(this)), + (this.frontFace = new oi(this)), + (this.program = new ai(this)), + (this.activeTexture = new ri(this)), + (this.viewport = new si(this)), + (this.bindFramebuffer = new ni(this)), + (this.bindRenderbuffer = new li(this)), + (this.bindTexture = new ci(this)), + (this.bindVertexBuffer = new hi(this)), + (this.bindElementBuffer = new ui(this)), + (this.bindVertexArrayOES = this.extVertexArrayObject && new di(this)), + (this.pixelStoreUnpack = new mi(this)), + (this.pixelStoreUnpackPremultiplyAlpha = new _i(this)), + (this.pixelStoreUnpackFlipY = new pi(this)), + (this.extTextureFilterAnisotropic = + t.getExtension('EXT_texture_filter_anisotropic') || + t.getExtension('MOZ_EXT_texture_filter_anisotropic') || + t.getExtension('WEBKIT_EXT_texture_filter_anisotropic')), + this.extTextureFilterAnisotropic && + (this.extTextureFilterAnisotropicMax = t.getParameter( + this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT, + )), + (this.extTextureHalfFloat = t.getExtension('OES_texture_half_float')), + this.extTextureHalfFloat && + (t.getExtension('OES_texture_half_float_linear'), + (this.extRenderToTextureHalfFloat = t.getExtension( + 'EXT_color_buffer_half_float', + ))), + (this.extTimerQuery = t.getExtension('EXT_disjoint_timer_query')), + (this.maxTextureSize = t.getParameter(t.MAX_TEXTURE_SIZE)); + } + setDefault() { + 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(); + } + setDirty() { + (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); + } + createIndexBuffer(t, e) { + return new ke(this, t, e); + } + createVertexBuffer(t, e, i) { + return new Fe(this, t, e, i); + } + createRenderbuffer(t, e, i) { + const o = this.gl, + a = o.createRenderbuffer(); + return ( + this.bindRenderbuffer.set(a), + o.renderbufferStorage(o.RENDERBUFFER, t, e, i), + this.bindRenderbuffer.set(null), + a + ); + } + createFramebuffer(t, e, i) { + return new vi(this, t, e, i); + } + clear({ color: t, depth: e }) { + const i = this.gl; + let o = 0; + t && + ((o |= i.COLOR_BUFFER_BIT), + this.clearColor.set(t), + this.colorMask.set([!0, !0, !0, !0])), + void 0 !== e && + ((o |= i.DEPTH_BUFFER_BIT), + this.depthRange.set([0, 1]), + this.clearDepth.set(e), + this.depthMask.set(!0)), + i.clear(o); + } + setCullFace(t) { + !1 === t.enable + ? this.cullFace.set(!1) + : (this.cullFace.set(!0), + this.cullFaceSide.set(t.mode), + this.frontFace.set(t.frontFace)); + } + setDepthMode(t) { + t.func !== this.gl.ALWAYS || t.mask + ? (this.depthTest.set(!0), + this.depthFunc.set(t.func), + this.depthMask.set(t.mask), + this.depthRange.set(t.range)) + : this.depthTest.set(!1); + } + setStencilMode(t) { + t.test.func !== this.gl.ALWAYS || t.mask + ? (this.stencilTest.set(!0), + this.stencilMask.set(t.mask), + this.stencilOp.set([t.fail, t.depthFail, t.pass]), + this.stencilFunc.set({ + func: t.test.func, + ref: t.ref, + mask: t.test.mask, + })) + : this.stencilTest.set(!1); + } + setColorMode(t) { + a(t.blendFunction, yi.Replace) + ? this.blend.set(!1) + : (this.blend.set(!0), + this.blendFunc.set(t.blendFunction), + this.blendColor.set(t.blendColor)), + this.colorMask.set(t.mask); + } + unbindVAO() { + this.extVertexArrayObject && this.bindVertexArrayOES.set(null); + } + } + class wi { + constructor(t, e, i) { + (this.func = t), (this.mask = e), (this.range = i); + } + } + (wi.ReadOnly = !1), + (wi.ReadWrite = !0), + (wi.disabled = new wi(519, wi.ReadOnly, [0, 1])); + const Ti = 7680; + class Ei { + constructor(t, e, i, o, a, r) { + (this.test = t), + (this.ref = e), + (this.mask = i), + (this.fail = o), + (this.depthFail = a), + (this.pass = r); + } + } + Ei.disabled = new Ei({ func: 519, mask: 0 }, 0, 0, Ti, Ti, Ti); + class Ii { + constructor(t, e, i) { + (this.enable = t), (this.mode = e), (this.frontFace = i); + } + } + let Ci; + function Si(e, i, o, a, r, s, n) { + const l = e.context, + c = l.gl, + h = e.useProgram('collisionBox'), + u = []; + let d = 0, + m = 0; + for (let _ = 0; _ < a.length; _++) { + const p = a[_], + f = i.getTile(p), + g = f.getBucket(o); + if (!g) continue; + let x = p.posMatrix; + (0 === r[0] && 0 === r[1]) || + (x = e.translatePosMatrix(p.posMatrix, f, r, s)); + const v = n ? g.textCollisionBox : g.iconCollisionBox, + y = g.collisionCircleArray; + if (y.length > 0) { + const i = t.create(), + o = x; + t.mul(i, g.placementInvProjMatrix, e.transform.glCoordMatrix), + t.mul(i, i, g.placementViewportMatrix), + u.push({ + circleArray: y, + circleOffset: m, + transform: o, + invTransform: i, + coord: p, + }), + (d += y.length / 4), + (m = d); + } + v && + h.draw( + l, + c.LINES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ii.disabled, + fe(x, e.transform, f), + e.style.terrain && e.style.terrain.getTerrainData(p), + o.id, + v.layoutVertexBuffer, + v.indexBuffer, + v.segments, + null, + e.transform.zoom, + null, + null, + v.collisionVertexBuffer, + ); + } + if (!n || !u.length) return; + const _ = e.useProgram('collisionCircle'), + p = new t.CollisionCircleLayoutArray(); + p.resize(4 * d), p._trim(); + let f = 0; + for (const t of u) + for (let e = 0; e < t.circleArray.length / 4; e++) { + const i = 4 * e, + o = t.circleArray[i + 0], + a = t.circleArray[i + 1], + r = t.circleArray[i + 2], + s = t.circleArray[i + 3]; + p.emplace(f++, o, a, r, s, 0), + p.emplace(f++, o, a, r, s, 1), + p.emplace(f++, o, a, r, s, 2), + p.emplace(f++, o, a, r, s, 3); + } + (!Ci || Ci.length < 2 * d) && + (Ci = (function (e) { + const i = 2 * e, + o = new t.QuadTriangleArray(); + o.resize(i), o._trim(); + for (let t = 0; t < i; t++) { + const e = 6 * t; + (o.uint16[e + 0] = 4 * t + 0), + (o.uint16[e + 1] = 4 * t + 1), + (o.uint16[e + 2] = 4 * t + 2), + (o.uint16[e + 3] = 4 * t + 2), + (o.uint16[e + 4] = 4 * t + 3), + (o.uint16[e + 5] = 4 * t + 0); + } + return o; + })(d)); + const g = l.createIndexBuffer(Ci, !0), + x = l.createVertexBuffer(p, t.collisionCircleLayout.members, !0); + for (const i of u) { + const a = { + u_matrix: i.transform, + u_inv_matrix: i.invTransform, + u_camera_to_center_distance: (v = e.transform).cameraToCenterDistance, + u_viewport_size: [v.width, v.height], + }; + _.draw( + l, + c.TRIANGLES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ii.disabled, + a, + e.style.terrain && e.style.terrain.getTerrainData(i.coord), + o.id, + x, + g, + t.SegmentVector.simpleSegment( + 0, + 2 * i.circleOffset, + i.circleArray.length, + i.circleArray.length / 2, + ), + null, + e.transform.zoom, + null, + null, + null, + ); + } + var v; + x.destroy(), g.destroy(); + } + (Ii.disabled = new Ii(!1, 1029, 2305)), + (Ii.backCCW = new Ii(!0, 1029, 2305)); + const Di = t.identity(new Float32Array(16)); + function zi(e, i, o, a, r, s) { + const { horizontalAlign: n, verticalAlign: l } = t.getAnchorAlignment(e), + c = -(n - 0.5) * i, + h = -(l - 0.5) * o, + u = t.evaluateVariableOffset(e, a); + return new t.pointGeometry((c / r + u[0]) * s, (h / r + u[1]) * s); + } + function Pi(e, i, o, a, r, s, n, l, c, h, u) { + const d = e.text.placedSymbolArray, + m = e.text.dynamicLayoutVertexArray, + _ = e.icon.dynamicLayoutVertexArray, + p = {}; + m.clear(); + for (let _ = 0; _ < d.length; _++) { + const f = d.get(_), + g = e.allowVerticalPlacement && !f.placedOrientation, + x = f.hidden || !f.crossTileID || g ? null : a[f.crossTileID]; + if (x) { + const a = new t.pointGeometry(f.anchorX, f.anchorY), + d = nt(a, o ? n : s, u), + _ = lt(r.cameraToCenterDistance, d.signedDistanceFromCamera); + let g = + (t.evaluateSizeForFeature(e.textSizeData, c, f) * _) / t.ONE_EM; + o && (g *= e.tilePixelRatio / l); + const { + width: v, + height: y, + anchor: b, + textOffset: w, + textBoxScale: T, + } = x, + E = zi(b, v, y, w, T, g), + I = o + ? nt(a.add(E), s, u).point + : d.point.add(i ? E.rotate(-r.angle) : E), + C = + e.allowVerticalPlacement && + f.placedOrientation === t.WritingMode.vertical + ? Math.PI / 2 + : 0; + for (let e = 0; e < f.numGlyphs; e++) t.addDynamicAttributes(m, I, C); + h && + f.associatedIconIndex >= 0 && + (p[f.associatedIconIndex] = { shiftedAnchor: I, angle: C }); + } else gt(f.numGlyphs, m); + } + if (h) { + _.clear(); + const i = e.icon.placedSymbolArray; + for (let e = 0; e < i.length; e++) { + const o = i.get(e); + if (o.hidden) gt(o.numGlyphs, _); + else { + const i = p[e]; + if (i) + for (let e = 0; e < o.numGlyphs; e++) + t.addDynamicAttributes(_, i.shiftedAnchor, i.angle); + else gt(o.numGlyphs, _); + } + } + e.icon.dynamicLayoutVertexBuffer.updateData(_); + } + e.text.dynamicLayoutVertexBuffer.updateData(m); + } + function Mi(t, e, i) { + return i.iconsInText && e + ? 'symbolTextAndIcon' + : t + ? 'symbolSDF' + : 'symbolIcon'; + } + function Ai(e, i, o, a, r, s, n, l, c, h, u, d) { + const m = e.context, + _ = m.gl, + p = e.transform, + f = 'map' === l, + g = 'map' === c, + x = 'viewport' !== l && 'point' !== o.layout.get('symbol-placement'), + v = f && !g && !x, + y = !o.layout.get('symbol-sort-key').isConstant(); + let b = !1; + const w = e.depthModeForSublayer(0, wi.ReadOnly), + T = o.layout.get('text-variable-anchor'), + E = []; + for (const l of a) { + const a = i.getTile(l), + c = a.getBucket(o); + if (!c) continue; + const u = r ? c.text : c.icon; + if (!u || !u.segments.get().length) continue; + const d = u.programConfigurations.get(o.id), + m = r || c.sdfIcons, + w = r ? c.textSizeData : c.iconSizeData, + I = g || 0 !== p.pitch, + C = e.useProgram(Mi(m, r, c), d), + S = t.evaluateSizeForZoom(w, p.zoom), + D = e.style.terrain && e.style.terrain.getTerrainData(l); + let z, + P, + M, + A, + L = [0, 0], + R = null; + if (r) { + if ( + ((P = a.glyphAtlasTexture), + (M = _.LINEAR), + (z = a.glyphAtlasTexture.size), + c.iconsInText) + ) { + (L = a.imageAtlasTexture.size), (R = a.imageAtlasTexture); + const t = 'composite' === w.kind || 'camera' === w.kind; + A = + I || e.options.rotating || e.options.zooming || t + ? _.LINEAR + : _.NEAREST; + } + } else { + const t = + 1 !== o.layout.get('icon-size').constantOr(0) || c.iconsNeedLinear; + (P = a.imageAtlasTexture), + (M = + m || e.options.rotating || e.options.zooming || t || I + ? _.LINEAR + : _.NEAREST), + (z = a.imageAtlasTexture.size); + } + const k = bt(a, 1, e.transform.zoom), + B = rt(l.posMatrix, g, f, e.transform, k), + F = st(l.posMatrix, g, f, e.transform, k), + O = T && c.hasTextData(), + U = 'none' !== o.layout.get('icon-text-fit') && O && c.hasIconData(); + if (x) { + const t = e.style.terrain + ? (t, i) => e.style.terrain.getElevation(l, t, i) + : null, + i = 'map' === o.layout.get('text-rotation-alignment'); + ht(c, l.posMatrix, e, r, B, F, g, h, i, t); + } + const N = e.translatePosMatrix(l.posMatrix, a, s, n), + G = x || (r && T) || U ? Di : B, + Z = e.translatePosMatrix(F, a, s, n, !0), + V = + m && + 0 !== + o.paint + .get(r ? 'text-halo-width' : 'icon-halo-width') + .constantOr(1); + let q; + q = m + ? c.iconsInText + ? Me(w.kind, S, v, g, e, N, G, Z, z, L) + : Pe(w.kind, S, v, g, e, N, G, Z, r, z, !0) + : ze(w.kind, S, v, g, e, N, G, Z, r, z); + const j = { + program: C, + buffers: u, + uniformValues: q, + atlasTexture: P, + atlasTextureIcon: R, + atlasInterpolation: M, + atlasInterpolationIcon: A, + isSDF: m, + hasHalo: V, + }; + if (y && c.canOverlap) { + b = !0; + const e = u.segments.get(); + for (const i of e) + E.push({ + segments: new t.SegmentVector([i]), + sortKey: i.sortKey, + state: j, + terrainData: D, + }); + } else + E.push({ + segments: u.segments, + sortKey: 0, + state: j, + terrainData: D, + }); + } + b && E.sort((t, e) => t.sortKey - e.sortKey); + for (const t of E) { + const i = t.state; + if ( + (m.activeTexture.set(_.TEXTURE0), + i.atlasTexture.bind(i.atlasInterpolation, _.CLAMP_TO_EDGE), + i.atlasTextureIcon && + (m.activeTexture.set(_.TEXTURE1), + i.atlasTextureIcon && + i.atlasTextureIcon.bind( + i.atlasInterpolationIcon, + _.CLAMP_TO_EDGE, + )), + i.isSDF) + ) { + const a = i.uniformValues; + i.hasHalo && + ((a.u_is_halo = 1), + Li( + i.buffers, + t.segments, + o, + e, + i.program, + w, + u, + d, + a, + t.terrainData, + )), + (a.u_is_halo = 0); + } + Li( + i.buffers, + t.segments, + o, + e, + i.program, + w, + u, + d, + i.uniformValues, + t.terrainData, + ); + } + } + function Li(t, e, i, o, a, r, s, n, l, c) { + const h = o.context; + a.draw( + h, + h.gl.TRIANGLES, + r, + s, + n, + Ii.disabled, + l, + c, + i.id, + t.layoutVertexBuffer, + t.indexBuffer, + e, + i.paint, + o.transform.zoom, + t.programConfigurations.get(i.id), + t.dynamicLayoutVertexBuffer, + t.opacityVertexBuffer, + ); + } + function Ri(t, e, i, o, a, r, s) { + const n = t.context.gl, + l = i.paint.get('fill-pattern'), + c = l && l.constantOr(1), + h = i.getCrossfadeParameters(); + let u, d, m, _, p; + s + ? ((d = + c && !i.getPaintProperty('fill-outline-color') + ? 'fillOutlinePattern' + : 'fillOutline'), + (u = n.LINES)) + : ((d = c ? 'fillPattern' : 'fill'), (u = n.TRIANGLES)); + for (const f of o) { + const o = e.getTile(f); + if (c && !o.patternsLoaded()) continue; + const g = o.getBucket(i); + if (!g) continue; + const x = g.programConfigurations.get(i.id), + v = t.useProgram(d, x), + y = t.style.terrain && t.style.terrain.getTerrainData(f); + c && + (t.context.activeTexture.set(n.TEXTURE0), + o.imageAtlasTexture.bind(n.LINEAR, n.CLAMP_TO_EDGE), + x.updatePaintBuffers(h)); + const b = l.constantOr(null); + if (b && o.imageAtlas) { + const t = o.imageAtlas, + e = t.patternPositions[b.to.toString()], + i = t.patternPositions[b.from.toString()]; + e && i && x.setConstantPatternPositions(e, i); + } + const w = y ? f : null, + T = t.translatePosMatrix( + w ? w.posMatrix : f.posMatrix, + o, + i.paint.get('fill-translate'), + i.paint.get('fill-translate-anchor'), + ); + if (s) { + (_ = g.indexBuffer2), (p = g.segments2); + const e = [n.drawingBufferWidth, n.drawingBufferHeight]; + m = 'fillOutlinePattern' === d && c ? _e(T, t, h, o, e) : me(T, e); + } else + (_ = g.indexBuffer), + (p = g.segments), + (m = c ? de(T, t, h, o) : ue(T)); + v.draw( + t.context, + u, + a, + t.stencilModeForClipping(f), + r, + Ii.disabled, + m, + y, + i.id, + g.layoutVertexBuffer, + _, + p, + i.paint, + t.transform.zoom, + x, + ); + } + } + function ki(t, e, i, o, a, r, s) { + const n = t.context, + l = n.gl, + c = i.paint.get('fill-extrusion-pattern'), + h = c.constantOr(1), + u = i.getCrossfadeParameters(), + d = i.paint.get('fill-extrusion-opacity'); + for (const m of o) { + const o = e.getTile(m), + _ = o.getBucket(i); + if (!_) continue; + const p = t.style.terrain && t.style.terrain.getTerrainData(m), + f = _.programConfigurations.get(i.id), + g = t.useProgram(h ? 'fillExtrusionPattern' : 'fillExtrusion', f); + h && + (t.context.activeTexture.set(l.TEXTURE0), + o.imageAtlasTexture.bind(l.LINEAR, l.CLAMP_TO_EDGE), + f.updatePaintBuffers(u)); + const x = c.constantOr(null); + if (x && o.imageAtlas) { + const t = o.imageAtlas, + e = t.patternPositions[x.to.toString()], + i = t.patternPositions[x.from.toString()]; + e && i && f.setConstantPatternPositions(e, i); + } + const v = t.translatePosMatrix( + m.posMatrix, + o, + i.paint.get('fill-extrusion-translate'), + i.paint.get('fill-extrusion-translate-anchor'), + ), + y = i.paint.get('fill-extrusion-vertical-gradient'), + b = h ? he(v, t, y, d, m, u, o) : ce(v, t, y, d); + g.draw( + n, + n.gl.TRIANGLES, + a, + r, + s, + Ii.backCCW, + b, + p, + i.id, + _.layoutVertexBuffer, + _.indexBuffer, + _.segments, + i.paint, + t.transform.zoom, + f, + t.style.terrain && _.centroidVertexBuffer, + ); + } + } + function Bi(t, e, i, o, a, r, s) { + const n = t.context, + l = n.gl, + c = i.fbo; + if (!c) return; + const h = t.useProgram('hillshade'), + u = t.style.terrain && t.style.terrain.getTerrainData(e); + n.activeTexture.set(l.TEXTURE0), + l.bindTexture(l.TEXTURE_2D, c.colorAttachment.get()), + h.draw( + n, + l.TRIANGLES, + a, + r, + s, + Ii.disabled, + ((t, e, i, o) => { + const a = i.paint.get('hillshade-shadow-color'), + r = i.paint.get('hillshade-highlight-color'), + s = i.paint.get('hillshade-accent-color'); + let n = + i.paint.get('hillshade-illumination-direction') * (Math.PI / 180); + 'viewport' === i.paint.get('hillshade-illumination-anchor') && + (n -= t.transform.angle); + const l = !t.options.moving; + return { + u_matrix: o + ? o.posMatrix + : t.transform.calculatePosMatrix(e.tileID.toUnwrapped(), l), + u_image: 0, + u_latrange: ye(0, e.tileID), + u_light: [i.paint.get('hillshade-exaggeration'), n], + u_shadow: a, + u_highlight: r, + u_accent: s, + }; + })(t, i, o, u ? e : null), + u, + o.id, + t.rasterBoundsBuffer, + t.quadTriangleIndexBuffer, + t.rasterBoundsSegments, + ); + } + function Fi(e, i, o, a, r, s) { + const n = e.context, + c = n.gl, + h = i.dem; + if (h && h.data) { + const u = h.dim, + d = h.stride, + m = h.getPixels(); + if ( + (n.activeTexture.set(c.TEXTURE1), + n.pixelStoreUnpackPremultiplyAlpha.set(!1), + (i.demTexture = i.demTexture || e.getTileTexture(d)), + i.demTexture) + ) { + const t = i.demTexture; + t.update(m, { premultiply: !1 }), t.bind(c.NEAREST, c.CLAMP_TO_EDGE); + } else + (i.demTexture = new l(n, m, c.RGBA, { premultiply: !1 })), + i.demTexture.bind(c.NEAREST, c.CLAMP_TO_EDGE); + n.activeTexture.set(c.TEXTURE0); + let _ = i.fbo; + if (!_) { + const t = new l(n, { width: u, height: u, data: null }, c.RGBA); + t.bind(c.LINEAR, c.CLAMP_TO_EDGE), + (_ = i.fbo = n.createFramebuffer(u, u, !0)), + _.colorAttachment.set(t.texture); + } + n.bindFramebuffer.set(_.framebuffer), + n.viewport.set([0, 0, u, u]), + e.useProgram('hillshadePrepare').draw( + n, + c.TRIANGLES, + a, + r, + s, + Ii.disabled, + ((e, i) => { + const o = i.stride, + a = t.create(); + return ( + t.ortho(a, 0, t.EXTENT, -t.EXTENT, 0, 0, 1), + t.translate(a, a, [0, -t.EXTENT, 0]), + { + u_matrix: a, + u_image: 1, + u_dimension: [o, o], + u_zoom: e.overscaledZ, + u_unpack: i.getUnpackVector(), + } + ); + })(i.tileID, h), + null, + o.id, + e.rasterBoundsBuffer, + e.quadTriangleIndexBuffer, + e.rasterBoundsSegments, + ), + (i.needsHillshadePrepare = !1); + } + } + function Oi(e, i, o, a, r, s) { + const n = a.paint.get('raster-fade-duration'); + if (!s && n > 0) { + const a = t.exported.now(), + s = (a - e.timeAdded) / n, + l = i ? (a - i.timeAdded) / n : -1, + c = o.getSource(), + h = r.coveringZoomLevel({ + tileSize: c.tileSize, + roundZoom: c.roundZoom, + }), + u = + !i || + Math.abs(i.tileID.overscaledZ - h) > + Math.abs(e.tileID.overscaledZ - h), + d = u && e.refreshedUponExpiration ? 1 : t.clamp(u ? s : 1 - l, 0, 1); + return ( + e.refreshedUponExpiration && + s >= 1 && + (e.refreshedUponExpiration = !1), + i ? { opacity: 1, mix: 1 - d } : { opacity: d, mix: 0 } + ); + } + return { opacity: 1, mix: 0 }; + } + const Ui = new t.Color(1, 0, 0, 1), + Ni = new t.Color(0, 1, 0, 1), + Gi = new t.Color(0, 0, 1, 1), + Zi = new t.Color(1, 0, 1, 1), + Vi = new t.Color(0, 1, 1, 1); + function qi(t, e, i, o) { + $i(t, 0, e + i / 2, t.transform.width, i, o); + } + function ji(t, e, i, o) { + $i(t, e - i / 2, 0, i, t.transform.height, o); + } + function $i(t, e, i, o, a, r) { + const s = t.context, + n = s.gl; + n.enable(n.SCISSOR_TEST), + n.scissor( + e * t.pixelRatio, + i * t.pixelRatio, + o * t.pixelRatio, + a * t.pixelRatio, + ), + s.clear({ color: r }), + n.disable(n.SCISSOR_TEST); + } + function Xi(e, i, o) { + const a = e.context, + r = a.gl, + s = o.posMatrix, + n = e.useProgram('debug'), + l = wi.disabled, + c = Ei.disabled, + h = e.colorModeForRenderPass(), + u = '$debug', + d = e.style.terrain && e.style.terrain.getTerrainData(o); + a.activeTexture.set(r.TEXTURE0), + e.emptyTexture.bind(r.LINEAR, r.CLAMP_TO_EDGE); + const m = i.getTileByID(o.key).latestRawTileData, + _ = Math.floor(((m && m.byteLength) || 0) / 1024), + p = i.getTile(o).tileSize, + f = (512 / Math.min(p, 512)) * (o.overscaledZ / e.transform.zoom) * 0.5; + let g = o.canonical.toString(); + o.overscaledZ !== o.canonical.z && (g += ` => ${o.overscaledZ}`), + (function (t, e) { + t.initDebugOverlayCanvas(); + const i = t.debugOverlayCanvas, + o = t.context.gl, + a = t.debugOverlayCanvas.getContext('2d'); + a.clearRect(0, 0, i.width, i.height), + (a.shadowColor = 'white'), + (a.shadowBlur = 2), + (a.lineWidth = 1.5), + (a.strokeStyle = 'white'), + (a.textBaseline = 'top'), + (a.font = 'bold 36px Open Sans, sans-serif'), + a.fillText(e, 5, 5), + a.strokeText(e, 5, 5), + t.debugOverlayTexture.update(i), + t.debugOverlayTexture.bind(o.LINEAR, o.CLAMP_TO_EDGE); + })(e, `${g} ${_}kB`), + n.draw( + a, + r.TRIANGLES, + l, + c, + yi.alphaBlended, + Ii.disabled, + ge(s, t.Color.transparent, f), + null, + u, + e.debugBuffer, + e.quadTriangleIndexBuffer, + e.debugSegments, + ), + n.draw( + a, + r.LINE_STRIP, + l, + c, + h, + Ii.disabled, + ge(s, t.Color.red), + d, + u, + e.debugBuffer, + e.tileBorderIndexBuffer, + e.debugSegments, + ); + } + function Wi(t, e, i) { + const o = t.context, + a = o.gl, + r = t.colorModeForRenderPass(), + s = new wi(a.LEQUAL, wi.ReadWrite, t.depthRangeFor3D), + n = t.useProgram('terrain'), + l = e.getTerrainMesh(), + c = e.getTerrainData(i.tileID); + o.bindFramebuffer.set(null), + o.viewport.set([0, 0, t.width, t.height]), + o.activeTexture.set(a.TEXTURE0), + a.bindTexture( + a.TEXTURE_2D, + e.getRTTFramebuffer().colorAttachment.get(), + ); + const h = t.transform.calculatePosMatrix(i.tileID.toUnwrapped()); + n.draw( + o, + a.TRIANGLES, + s, + Ei.disabled, + r, + Ii.backCCW, + { u_matrix: h, u_texture: 0 }, + c, + 'terrain', + l.vertexBuffer, + l.indexBuffer, + l.segments, + ); + } + function Hi(t, e, i, o) { + const a = t.context, + r = i.tileSize * e.qualityFactor; + i.textures[o] || + ((i.textures[o] = + t.getTileTexture(r) || + new l(a, { width: r, height: r, data: null }, a.gl.RGBA)), + i.textures[o].bind(a.gl.LINEAR, a.gl.CLAMP_TO_EDGE), + 0 === o && e.sourceCache.renderHistory.unshift(i.tileID.key)); + const s = e.getRTTFramebuffer(); + s.colorAttachment.set(i.textures[o].texture), + a.bindFramebuffer.set(s.framebuffer), + a.viewport.set([0, 0, r, r]); + } + class Ki { + constructor(t) { + (this._coordsDescendingInv = {}), + (this._coordsDescendingInvStr = {}), + (this.painter = t), + (this._renderToTexture = { + background: !0, + fill: !0, + line: !0, + raster: !0, + }), + (this._coordsDescendingInv = {}), + (this._coordsDescendingInvStr = {}), + (this._stacks = []), + (this._prevType = null), + (this._rerender = {}), + (this._renderableTiles = + t.style.terrain.sourceCache.getRenderableTiles()), + this._init(); + } + _init() { + const t = this.painter.style, + e = t.terrain; + for (const i in t.sourceCaches) { + this._coordsDescendingInv[i] = {}; + const o = t.sourceCaches[i].getVisibleCoordinates(); + for (const t of o) { + const o = e.sourceCache.getTerrainCoords(t); + for (const t in o) + this._coordsDescendingInv[i][t] || + (this._coordsDescendingInv[i][t] = []), + this._coordsDescendingInv[i][t].push(o[t]); + } + } + for (const e of t._order) { + const i = t._layers[e], + o = i.source; + if ( + this._renderToTexture[i.type] && + !this._coordsDescendingInvStr[o] + ) { + this._coordsDescendingInvStr[o] = {}; + for (const t in this._coordsDescendingInv[o]) + this._coordsDescendingInvStr[o][t] = this._coordsDescendingInv[o][ + t + ] + .map((t) => t.key) + .sort() + .join(); + } + } + return ( + this._renderableTiles.forEach((t) => { + for (const i in this._coordsDescendingInvStr) { + const o = this._coordsDescendingInvStr[i][t.tileID.key]; + o && o !== t.textureCoords[i] && t.clearTextures(this.painter), + e.needsRerender(i, t.tileID) && t.clearTextures(this.painter); + } + this._rerender[t.tileID.key] = !t.textures.length; + }), + e.clearRerenderCache(), + e.sourceCache.removeOutdated(this.painter), + this + ); + } + renderLayer(e) { + const i = e.type, + o = this.painter, + a = o.style._order, + r = o.currentLayer, + s = r + 1 === a.length; + if ( + this._renderToTexture[i] && + ((this._prevType && this._renderToTexture[this._prevType]) || + this._stacks.push([]), + (this._prevType = i), + this._stacks[this._stacks.length - 1].push(a[r]), + !s) + ) + return !0; + if ( + this._renderToTexture[this._prevType] || + 'hillshade' === i || + (this._renderToTexture[i] && s) + ) { + this._prevType = i; + const s = this._stacks.length - 1, + n = this._stacks[s] || []; + for (const e of this._renderableTiles) { + if ((Hi(o, o.style.terrain, e, s), this._rerender[e.tileID.key])) { + o.context.clear({ color: t.Color.transparent }); + for (let t = 0; t < n.length; t++) { + const i = o.style._layers[n[t]], + a = i.source + ? this._coordsDescendingInv[i.source][e.tileID.key] + : [e.tileID]; + o._renderTileClippingMasks(i, a), + o.renderLayer(o, o.style.sourceCaches[i.source], i, a), + i.source && + (e.textureCoords[i.source] = + this._coordsDescendingInvStr[i.source][e.tileID.key]); + } + } + Wi(o, o.style.terrain, e); + } + if ('hillshade' === i) { + this._stacks.push([a[r]]); + for (const i of this._renderableTiles) { + const a = this._coordsDescendingInv[e.source][i.tileID.key]; + Hi(o, o.style.terrain, i, this._stacks.length - 1), + o.context.clear({ color: t.Color.transparent }), + o._renderTileClippingMasks(e, a), + o.renderLayer(o, o.style.sourceCaches[e.source], e, a), + Wi(o, o.style.terrain, i); + } + return !0; + } + return this._renderToTexture[i]; + } + return !1; + } + } + const Yi = { + symbol: function (e, i, o, a, r) { + if ('translucent' !== e.renderPass) return; + const s = Ei.disabled, + n = e.colorModeForRenderPass(); + o.layout.get('text-variable-anchor') && + (function (e, i, o, a, r, s, n) { + const l = i.transform, + c = 'map' === r, + h = 'map' === s; + for (const r of e) { + const e = a.getTile(r), + s = e.getBucket(o); + if (!s || !s.text || !s.text.segments.get().length) continue; + const u = t.evaluateSizeForZoom(s.textSizeData, l.zoom), + d = bt(e, 1, i.transform.zoom), + m = rt(r.posMatrix, h, c, i.transform, d), + _ = 'none' !== o.layout.get('icon-text-fit') && s.hasIconData(); + if (u) { + const t = Math.pow(2, l.zoom - e.tileID.overscaledZ); + Pi( + s, + c, + h, + n, + l, + m, + r.posMatrix, + t, + u, + _, + i.style.terrain + ? (t, e) => i.style.terrain.getElevation(r, t, e) + : null, + ); + } + } + })( + a, + e, + o, + i, + o.layout.get('text-rotation-alignment'), + o.layout.get('text-pitch-alignment'), + r, + ), + 0 !== o.paint.get('icon-opacity').constantOr(1) && + Ai( + e, + i, + o, + a, + !1, + o.paint.get('icon-translate'), + o.paint.get('icon-translate-anchor'), + o.layout.get('icon-rotation-alignment'), + o.layout.get('icon-pitch-alignment'), + o.layout.get('icon-keep-upright'), + s, + n, + ), + 0 !== o.paint.get('text-opacity').constantOr(1) && + Ai( + e, + i, + o, + a, + !0, + o.paint.get('text-translate'), + o.paint.get('text-translate-anchor'), + o.layout.get('text-rotation-alignment'), + o.layout.get('text-pitch-alignment'), + o.layout.get('text-keep-upright'), + s, + n, + ), + i.map.showCollisionBoxes && + (Si( + e, + i, + o, + a, + o.paint.get('text-translate'), + o.paint.get('text-translate-anchor'), + !0, + ), + Si( + e, + i, + o, + a, + o.paint.get('icon-translate'), + o.paint.get('icon-translate-anchor'), + !1, + )); + }, + circle: function (e, i, o, a) { + if ('translucent' !== e.renderPass) return; + const r = o.paint.get('circle-opacity'), + s = o.paint.get('circle-stroke-width'), + n = o.paint.get('circle-stroke-opacity'), + l = !o.layout.get('circle-sort-key').isConstant(); + if ( + 0 === r.constantOr(1) && + (0 === s.constantOr(1) || 0 === n.constantOr(1)) + ) + return; + const c = e.context, + h = c.gl, + u = e.depthModeForSublayer(0, wi.ReadOnly), + d = Ei.disabled, + m = e.colorModeForRenderPass(), + _ = []; + for (let r = 0; r < a.length; r++) { + const s = a[r], + n = i.getTile(s), + c = n.getBucket(o); + if (!c) continue; + const h = c.programConfigurations.get(o.id), + u = e.useProgram('circle', h), + d = c.layoutVertexBuffer, + m = c.indexBuffer, + p = e.style.terrain && e.style.terrain.getTerrainData(s), + f = { + programConfiguration: h, + program: u, + layoutVertexBuffer: d, + indexBuffer: m, + uniformValues: pe(e, s, n, o), + terrainData: p, + }; + if (l) { + const e = c.segments.get(); + for (const i of e) + _.push({ + segments: new t.SegmentVector([i]), + sortKey: i.sortKey, + state: f, + }); + } else _.push({ segments: c.segments, sortKey: 0, state: f }); + } + l && _.sort((t, e) => t.sortKey - e.sortKey); + for (const t of _) { + const { + programConfiguration: i, + program: a, + layoutVertexBuffer: r, + indexBuffer: s, + uniformValues: n, + terrainData: l, + } = t.state; + a.draw( + c, + h.TRIANGLES, + u, + d, + m, + Ii.disabled, + n, + l, + o.id, + r, + s, + t.segments, + o.paint, + e.transform.zoom, + i, + ); + } + }, + heatmap: function (e, i, o, a) { + if (0 !== o.paint.get('heatmap-opacity')) + if ('offscreen' === e.renderPass) { + const r = e.context, + s = r.gl, + n = Ei.disabled, + l = new yi([s.ONE, s.ONE], t.Color.transparent, [!0, !0, !0, !0]); + !(function (t, e, i) { + const o = t.gl; + t.activeTexture.set(o.TEXTURE1), + t.viewport.set([0, 0, e.width / 4, e.height / 4]); + let a = i.heatmapFbo; + if (a) + o.bindTexture(o.TEXTURE_2D, a.colorAttachment.get()), + t.bindFramebuffer.set(a.framebuffer); + else { + const r = o.createTexture(); + o.bindTexture(o.TEXTURE_2D, r), + o.texParameteri( + o.TEXTURE_2D, + o.TEXTURE_WRAP_S, + o.CLAMP_TO_EDGE, + ), + o.texParameteri( + o.TEXTURE_2D, + o.TEXTURE_WRAP_T, + o.CLAMP_TO_EDGE, + ), + o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), + o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MAG_FILTER, o.LINEAR), + (a = i.heatmapFbo = + t.createFramebuffer(e.width / 4, e.height / 4, !1)), + (function (t, e, i, o) { + const a = t.gl; + a.texImage2D( + a.TEXTURE_2D, + 0, + a.RGBA, + e.width / 4, + e.height / 4, + 0, + a.RGBA, + t.extRenderToTextureHalfFloat + ? t.extTextureHalfFloat.HALF_FLOAT_OES + : a.UNSIGNED_BYTE, + null, + ), + o.colorAttachment.set(i); + })(t, e, r, a); + } + })(r, e, o), + r.clear({ color: t.Color.transparent }); + for (let t = 0; t < a.length; t++) { + const c = a[t]; + if (i.hasRenderableParent(c)) continue; + const h = i.getTile(c), + u = h.getBucket(o); + if (!u) continue; + const d = u.programConfigurations.get(o.id), + m = e.useProgram('heatmap', d), + { zoom: _ } = e.transform; + m.draw( + r, + s.TRIANGLES, + wi.disabled, + n, + l, + Ii.disabled, + ve(c.posMatrix, h, _, o.paint.get('heatmap-intensity')), + null, + o.id, + u.layoutVertexBuffer, + u.indexBuffer, + u.segments, + o.paint, + e.transform.zoom, + d, + ); + } + r.viewport.set([0, 0, e.width, e.height]); + } else + 'translucent' === e.renderPass && + (e.context.setColorMode(e.colorModeForRenderPass()), + (function (e, i) { + const o = e.context, + a = o.gl, + r = i.heatmapFbo; + if (!r) return; + o.activeTexture.set(a.TEXTURE0), + a.bindTexture(a.TEXTURE_2D, r.colorAttachment.get()), + o.activeTexture.set(a.TEXTURE1); + let s = i.colorRampTexture; + s || (s = i.colorRampTexture = new l(o, i.colorRamp, a.RGBA)), + s.bind(a.LINEAR, a.CLAMP_TO_EDGE), + e.useProgram('heatmapTexture').draw( + o, + a.TRIANGLES, + wi.disabled, + Ei.disabled, + e.colorModeForRenderPass(), + Ii.disabled, + ((e, i, o, a) => { + const r = t.create(); + t.ortho(r, 0, e.width, e.height, 0, 0, 1); + const s = e.context.gl; + return { + u_matrix: r, + u_world: [s.drawingBufferWidth, s.drawingBufferHeight], + u_image: 0, + u_color_ramp: 1, + u_opacity: i.paint.get('heatmap-opacity'), + }; + })(e, i), + null, + i.id, + e.viewportBuffer, + e.quadTriangleIndexBuffer, + e.viewportSegments, + i.paint, + e.transform.zoom, + ); + })(e, o)); + }, + line: function (e, i, o, a) { + if ('translucent' !== e.renderPass) return; + const r = o.paint.get('line-opacity'), + s = o.paint.get('line-width'); + if (0 === r.constantOr(1) || 0 === s.constantOr(1)) return; + const n = e.depthModeForSublayer(0, wi.ReadOnly), + c = e.colorModeForRenderPass(), + h = o.paint.get('line-dasharray'), + u = o.paint.get('line-pattern'), + d = u.constantOr(1), + m = o.paint.get('line-gradient'), + _ = o.getCrossfadeParameters(), + p = d ? 'linePattern' : h ? 'lineSDF' : m ? 'lineGradient' : 'line', + f = e.context, + g = f.gl; + let x = !0; + for (const r of a) { + const a = i.getTile(r); + if (d && !a.patternsLoaded()) continue; + const s = a.getBucket(o); + if (!s) continue; + const v = s.programConfigurations.get(o.id), + y = e.context.program.get(), + b = e.useProgram(p, v), + w = x || b.program !== y, + T = e.style.terrain && e.style.terrain.getTerrainData(r), + E = u.constantOr(null); + if (E && a.imageAtlas) { + const t = a.imageAtlas, + e = t.patternPositions[E.to.toString()], + i = t.patternPositions[E.from.toString()]; + e && i && v.setConstantPatternPositions(e, i); + } + const I = T ? r : null, + C = d + ? Te(e, a, o, _, I) + : h + ? Ee(e, a, o, h, _, I) + : m + ? we(e, a, o, s.lineClipsArray.length, I) + : be(e, a, o, I); + if (d) + f.activeTexture.set(g.TEXTURE0), + a.imageAtlasTexture.bind(g.LINEAR, g.CLAMP_TO_EDGE), + v.updatePaintBuffers(_); + else if (h && (w || e.lineAtlas.dirty)) + f.activeTexture.set(g.TEXTURE0), e.lineAtlas.bind(f); + else if (m) { + const a = s.gradients[o.id]; + let n = a.texture; + if (o.gradientVersion !== a.version) { + let c = 256; + if (o.stepInterpolant) { + const o = i.getSource().maxzoom, + a = + r.canonical.z === o + ? Math.ceil(1 << (e.transform.maxZoom - r.canonical.z)) + : 1; + c = t.clamp( + t.nextPowerOfTwo((s.maxLineLength / t.EXTENT) * 1024 * a), + 256, + f.maxTextureSize, + ); + } + (a.gradient = t.renderColorRamp({ + expression: o.gradientExpression(), + evaluationKey: 'lineProgress', + resolution: c, + image: a.gradient || void 0, + clips: s.lineClipsArray, + })), + a.texture + ? a.texture.update(a.gradient) + : (a.texture = new l(f, a.gradient, g.RGBA)), + (a.version = o.gradientVersion), + (n = a.texture); + } + f.activeTexture.set(g.TEXTURE0), + n.bind(o.stepInterpolant ? g.NEAREST : g.LINEAR, g.CLAMP_TO_EDGE); + } + b.draw( + f, + g.TRIANGLES, + n, + e.stencilModeForClipping(r), + c, + Ii.disabled, + C, + T, + o.id, + s.layoutVertexBuffer, + s.indexBuffer, + s.segments, + o.paint, + e.transform.zoom, + v, + s.layoutVertexBuffer2, + ), + (x = !1); + } + }, + fill: function (e, i, o, a) { + const r = o.paint.get('fill-color'), + s = o.paint.get('fill-opacity'); + if (0 === s.constantOr(1)) return; + const n = e.colorModeForRenderPass(), + l = o.paint.get('fill-pattern'), + c = + e.opaquePassEnabledForLayer() && + !l.constantOr(1) && + 1 === r.constantOr(t.Color.transparent).a && + 1 === s.constantOr(0) + ? 'opaque' + : 'translucent'; + if (e.renderPass === c) { + const t = e.depthModeForSublayer( + 1, + 'opaque' === e.renderPass ? wi.ReadWrite : wi.ReadOnly, + ); + Ri(e, i, o, a, t, n, !1); + } + if ('translucent' === e.renderPass && o.paint.get('fill-antialias')) { + const t = e.depthModeForSublayer( + o.getPaintProperty('fill-outline-color') ? 2 : 0, + wi.ReadOnly, + ); + Ri(e, i, o, a, t, n, !0); + } + }, + 'fill-extrusion': function (t, e, i, o) { + const a = i.paint.get('fill-extrusion-opacity'); + if (0 !== a && 'translucent' === t.renderPass) { + const r = new wi( + t.context.gl.LEQUAL, + wi.ReadWrite, + t.depthRangeFor3D, + ); + if (1 !== a || i.paint.get('fill-extrusion-pattern').constantOr(1)) + ki(t, e, i, o, r, Ei.disabled, yi.disabled), + ki( + t, + e, + i, + o, + r, + t.stencilModeFor3D(), + t.colorModeForRenderPass(), + ); + else { + const a = t.colorModeForRenderPass(); + ki(t, e, i, o, r, Ei.disabled, a); + } + } + }, + hillshade: function (t, e, i, o) { + if ('offscreen' !== t.renderPass && 'translucent' !== t.renderPass) + return; + const a = t.context, + r = t.depthModeForSublayer(0, wi.ReadOnly), + s = t.colorModeForRenderPass(), + [n, l] = + 'translucent' === t.renderPass + ? t.stencilConfigForOverlap(o) + : [{}, o]; + for (const o of l) { + const a = e.getTile(o); + void 0 !== a.needsHillshadePrepare && + a.needsHillshadePrepare && + 'offscreen' === t.renderPass + ? Fi(t, a, i, r, Ei.disabled, s) + : 'translucent' === t.renderPass && + Bi(t, o, a, i, r, n[o.overscaledZ], s); + } + a.viewport.set([0, 0, t.width, t.height]); + }, + raster: function (t, e, i, o) { + if ('translucent' !== t.renderPass) return; + if (0 === i.paint.get('raster-opacity')) return; + if (!o.length) return; + const a = t.context, + r = a.gl, + s = e.getSource(), + n = t.useProgram('raster'), + l = t.colorModeForRenderPass(), + [c, h] = s instanceof D ? [{}, o] : t.stencilConfigForOverlap(o), + u = h[h.length - 1].overscaledZ, + d = !t.options.moving; + for (const o of h) { + const h = t.depthModeForSublayer( + o.overscaledZ - u, + 1 === i.paint.get('raster-opacity') ? wi.ReadWrite : wi.ReadOnly, + r.LESS, + ), + m = e.getTile(o); + m.registerFadeDuration(i.paint.get('raster-fade-duration')); + const _ = e.findLoadedParent(o, 0), + p = Oi(m, _, e, i, t.transform, t.style.terrain); + let f, g; + const x = + 'nearest' === i.paint.get('raster-resampling') + ? r.NEAREST + : r.LINEAR; + a.activeTexture.set(r.TEXTURE0), + m.texture.bind(x, r.CLAMP_TO_EDGE, r.LINEAR_MIPMAP_NEAREST), + a.activeTexture.set(r.TEXTURE1), + _ + ? (_.texture.bind(x, r.CLAMP_TO_EDGE, r.LINEAR_MIPMAP_NEAREST), + (f = Math.pow(2, _.tileID.overscaledZ - m.tileID.overscaledZ)), + (g = [ + (m.tileID.canonical.x * f) % 1, + (m.tileID.canonical.y * f) % 1, + ])) + : m.texture.bind(x, r.CLAMP_TO_EDGE, r.LINEAR_MIPMAP_NEAREST); + const v = t.style.terrain && t.style.terrain.getTerrainData(o), + y = v ? o : null, + b = y + ? y.posMatrix + : t.transform.calculatePosMatrix(o.toUnwrapped(), d), + w = Se(b, g || [0, 0], f || 1, p, i); + s instanceof D + ? n.draw( + a, + r.TRIANGLES, + h, + Ei.disabled, + l, + Ii.disabled, + w, + v, + i.id, + s.boundsBuffer, + t.quadTriangleIndexBuffer, + s.boundsSegments, + ) + : n.draw( + a, + r.TRIANGLES, + h, + c[o.overscaledZ], + l, + Ii.disabled, + w, + v, + i.id, + t.rasterBoundsBuffer, + t.quadTriangleIndexBuffer, + t.rasterBoundsSegments, + ); + } + }, + background: function (t, e, i, o) { + const a = i.paint.get('background-color'), + r = i.paint.get('background-opacity'); + if (0 === r) return; + const s = t.context, + n = s.gl, + l = t.transform, + c = l.tileSize, + h = i.paint.get('background-pattern'); + if (t.isPatternMissing(h)) return; + const u = + !h && 1 === a.a && 1 === r && t.opaquePassEnabledForLayer() + ? 'opaque' + : 'translucent'; + if (t.renderPass !== u) return; + const d = Ei.disabled, + m = t.depthModeForSublayer( + 0, + 'opaque' === u ? wi.ReadWrite : wi.ReadOnly, + ), + _ = t.colorModeForRenderPass(), + p = t.useProgram(h ? 'backgroundPattern' : 'background'), + f = o || l.coveringTiles({ tileSize: c, terrain: t.style.terrain }); + h && (s.activeTexture.set(n.TEXTURE0), t.imageManager.bind(t.context)); + const g = i.getCrossfadeParameters(); + for (const e of f) { + const l = o + ? e.posMatrix + : t.transform.calculatePosMatrix(e.toUnwrapped()), + u = h ? Le(l, r, t, h, { tileID: e, tileSize: c }, g) : Ae(l, r, a), + f = t.style.terrain && t.style.terrain.getTerrainData(e); + p.draw( + s, + n.TRIANGLES, + m, + d, + _, + Ii.disabled, + u, + f, + i.id, + t.tileExtentBuffer, + t.quadTriangleIndexBuffer, + t.tileExtentSegments, + ); + } + }, + debug: function (t, e, i) { + for (let o = 0; o < i.length; o++) Xi(t, e, i[o]); + }, + custom: function (t, e, i) { + const o = t.context, + a = i.implementation; + if ('offscreen' === t.renderPass) { + const e = a.prerender; + e && + (t.setCustomLayerDefaults(), + o.setColorMode(t.colorModeForRenderPass()), + e.call(a, o.gl, t.transform.customLayerMatrix()), + o.setDirty(), + t.setBaseState()); + } else if ('translucent' === t.renderPass) { + t.setCustomLayerDefaults(), + o.setColorMode(t.colorModeForRenderPass()), + o.setStencilMode(Ei.disabled); + const e = + '3d' === a.renderingMode + ? new wi(t.context.gl.LEQUAL, wi.ReadWrite, t.depthRangeFor3D) + : t.depthModeForSublayer(0, wi.ReadOnly); + o.setDepthMode(e), + a.render(o.gl, t.transform.customLayerMatrix()), + o.setDirty(), + t.setBaseState(), + o.bindFramebuffer.set(null); + } + }, + }; + class Ji { + constructor(e, i) { + (this.context = new bi(e)), + (this.transform = i), + (this._tileTextures = {}), + (this.terrainFacilitator = { + dirty: !0, + matrix: t.create(), + renderTime: 0, + }), + this.setup(), + (this.numSublayers = O.maxUnderzooming + O.maxOverzooming + 1), + (this.depthEpsilon = 1 / Math.pow(2, 16)), + (this.crossTileSymbolIndex = new Xt()), + (this.gpuTimers = {}); + } + resize(t, e, i) { + if ( + ((this.width = t * i), + (this.height = e * i), + (this.pixelRatio = i), + this.context.viewport.set([0, 0, this.width, this.height]), + this.style) + ) + for (const t of this.style._order) this.style._layers[t].resize(); + } + setup() { + const e = this.context, + i = new t.PosArray(); + i.emplaceBack(0, 0), + i.emplaceBack(t.EXTENT, 0), + i.emplaceBack(0, t.EXTENT), + i.emplaceBack(t.EXTENT, t.EXTENT), + (this.tileExtentBuffer = e.createVertexBuffer(i, Wt.members)), + (this.tileExtentSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)); + const o = new t.PosArray(); + o.emplaceBack(0, 0), + o.emplaceBack(t.EXTENT, 0), + o.emplaceBack(0, t.EXTENT), + o.emplaceBack(t.EXTENT, t.EXTENT), + (this.debugBuffer = e.createVertexBuffer(o, Wt.members)), + (this.debugSegments = t.SegmentVector.simpleSegment(0, 0, 4, 5)); + const a = new t.RasterBoundsArray(); + a.emplaceBack(0, 0, 0, 0), + a.emplaceBack(t.EXTENT, 0, t.EXTENT, 0), + a.emplaceBack(0, t.EXTENT, 0, t.EXTENT), + a.emplaceBack(t.EXTENT, t.EXTENT, t.EXTENT, t.EXTENT), + (this.rasterBoundsBuffer = e.createVertexBuffer(a, S.members)), + (this.rasterBoundsSegments = t.SegmentVector.simpleSegment( + 0, + 0, + 4, + 2, + )); + const r = new t.PosArray(); + r.emplaceBack(0, 0), + r.emplaceBack(1, 0), + r.emplaceBack(0, 1), + r.emplaceBack(1, 1), + (this.viewportBuffer = e.createVertexBuffer(r, Wt.members)), + (this.viewportSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)); + const s = new t.LineStripIndexArray(); + s.emplaceBack(0), + s.emplaceBack(1), + s.emplaceBack(3), + s.emplaceBack(2), + s.emplaceBack(0), + (this.tileBorderIndexBuffer = e.createIndexBuffer(s)); + const n = new t.TriangleIndexArray(); + n.emplaceBack(0, 1, 2), + n.emplaceBack(2, 1, 3), + (this.quadTriangleIndexBuffer = e.createIndexBuffer(n)), + (this.emptyTexture = new l( + e, + { width: 1, height: 1, data: new Uint8Array([0, 0, 0, 0]) }, + e.gl.RGBA, + )); + const c = this.context.gl; + this.stencilClearMode = new Ei( + { func: c.ALWAYS, mask: 0 }, + 0, + 255, + c.ZERO, + c.ZERO, + c.ZERO, + ); + } + clearStencil() { + const e = this.context, + i = e.gl; + (this.nextStencilID = 1), (this.currentStencilSource = void 0); + const o = t.create(); + t.ortho(o, 0, this.width, this.height, 0, 0, 1), + t.scale(o, o, [i.drawingBufferWidth, i.drawingBufferHeight, 0]), + this.useProgram('clippingMask').draw( + e, + i.TRIANGLES, + wi.disabled, + this.stencilClearMode, + yi.disabled, + Ii.disabled, + xe(o), + null, + '$clipping', + this.viewportBuffer, + this.quadTriangleIndexBuffer, + this.viewportSegments, + ); + } + _renderTileClippingMasks(t, e) { + if ( + this.currentStencilSource === t.source || + !t.isTileClipped() || + !e || + !e.length + ) + return; + this.currentStencilSource = t.source; + const i = this.context, + o = i.gl; + this.nextStencilID + e.length > 256 && this.clearStencil(), + i.setColorMode(yi.disabled), + i.setDepthMode(wi.disabled); + const a = this.useProgram('clippingMask'); + this._tileClippingMaskIDs = {}; + for (const t of e) { + const e = (this._tileClippingMaskIDs[t.key] = this.nextStencilID++), + r = this.style.terrain && this.style.terrain.getTerrainData(t); + a.draw( + i, + o.TRIANGLES, + wi.disabled, + new Ei( + { func: o.ALWAYS, mask: 0 }, + e, + 255, + o.KEEP, + o.KEEP, + o.REPLACE, + ), + yi.disabled, + Ii.disabled, + xe(t.posMatrix), + r, + '$clipping', + this.tileExtentBuffer, + this.quadTriangleIndexBuffer, + this.tileExtentSegments, + ); + } + } + stencilModeFor3D() { + (this.currentStencilSource = void 0), + this.nextStencilID + 1 > 256 && this.clearStencil(); + const t = this.nextStencilID++, + e = this.context.gl; + return new Ei( + { func: e.NOTEQUAL, mask: 255 }, + t, + 255, + e.KEEP, + e.KEEP, + e.REPLACE, + ); + } + stencilModeForClipping(t) { + const e = this.context.gl; + return new Ei( + { func: e.EQUAL, mask: 255 }, + this._tileClippingMaskIDs[t.key], + 0, + e.KEEP, + e.KEEP, + e.REPLACE, + ); + } + stencilConfigForOverlap(t) { + const e = this.context.gl, + i = t.sort((t, e) => e.overscaledZ - t.overscaledZ), + o = i[i.length - 1].overscaledZ, + a = i[0].overscaledZ - o + 1; + if (a > 1) { + (this.currentStencilSource = void 0), + this.nextStencilID + a > 256 && this.clearStencil(); + const t = {}; + for (let i = 0; i < a; i++) + t[i + o] = new Ei( + { func: e.GEQUAL, mask: 255 }, + i + this.nextStencilID, + 255, + e.KEEP, + e.KEEP, + e.REPLACE, + ); + return (this.nextStencilID += a), [t, i]; + } + return [{ [o]: Ei.disabled }, i]; + } + colorModeForRenderPass() { + const e = this.context.gl; + if (this._showOverdrawInspector) { + const i = 1 / 8; + return new yi([e.CONSTANT_COLOR, e.ONE], new t.Color(i, i, i, 0), [ + !0, + !0, + !0, + !0, + ]); + } + return 'opaque' === this.renderPass ? yi.unblended : yi.alphaBlended; + } + depthModeForSublayer(t, e, i) { + if (!this.opaquePassEnabledForLayer()) return wi.disabled; + const o = + 1 - + ((1 + this.currentLayer) * this.numSublayers + t) * this.depthEpsilon; + return new wi(i || this.context.gl.LEQUAL, e, [o, o]); + } + opaquePassEnabledForLayer() { + return this.currentLayer < this.opaquePassCutoff; + } + render(e, i) { + (this.style = e), + (this.options = i), + (this.lineAtlas = e.lineAtlas), + (this.imageManager = e.imageManager), + (this.glyphManager = e.glyphManager), + (this.symbolFadeChange = e.placement.symbolFadeChange( + t.exported.now(), + )), + this.imageManager.beginFrame(); + const o = this.style._order, + a = this.style.sourceCaches, + r = this.style.terrain && new Ki(this); + for (const t in a) { + const e = a[t]; + e.used && e.prepare(this.context); + } + const s = {}, + n = {}, + l = {}; + for (const t in a) { + const e = a[t]; + (s[t] = e.getVisibleCoordinates()), + (n[t] = s[t].slice().reverse()), + (l[t] = e.getVisibleCoordinates(!0).reverse()); + } + this.opaquePassCutoff = 1 / 0; + for (let t = 0; t < o.length; t++) + if (this.style._layers[o[t]].is3D()) { + this.opaquePassCutoff = t; + break; + } + if (r) { + this.opaquePassCutoff = 0; + const e = this.style.terrain.sourceCache.tilesAfterTime( + this.terrainFacilitator.renderTime, + ); + (this.terrainFacilitator.dirty || + !t.equals( + this.terrainFacilitator.matrix, + this.transform.projMatrix, + ) || + e.length) && + (t.copy(this.terrainFacilitator.matrix, this.transform.projMatrix), + (this.terrainFacilitator.renderTime = Date.now()), + (this.terrainFacilitator.dirty = !1), + (function (e, i) { + const o = e.context, + a = o.gl, + r = yi.unblended, + s = new wi(a.LEQUAL, wi.ReadWrite, [0, 1]), + n = i.getTerrainMesh(), + l = i.sourceCache.getRenderableTiles(), + c = e.useProgram('terrainDepth'); + o.bindFramebuffer.set(i.getFramebuffer('depth').framebuffer), + o.viewport.set([ + 0, + 0, + e.width / devicePixelRatio, + e.height / devicePixelRatio, + ]), + o.clear({ color: t.Color.transparent, depth: 1 }); + for (const t of l) { + const l = i.getTerrainData(t.tileID), + h = e.transform.calculatePosMatrix(t.tileID.toUnwrapped()); + c.draw( + o, + a.TRIANGLES, + s, + Ei.disabled, + r, + Ii.backCCW, + { u_matrix: h }, + l, + 'terrain', + n.vertexBuffer, + n.indexBuffer, + n.segments, + ); + } + o.bindFramebuffer.set(null), + o.viewport.set([0, 0, e.width, e.height]); + })(this, this.style.terrain), + (function (e, i) { + const o = e.context, + a = o.gl, + r = yi.unblended, + s = new wi(a.LEQUAL, wi.ReadWrite, [0, 1]), + n = i.getTerrainMesh(), + l = i.getCoordsTexture(), + c = i.sourceCache.getRenderableTiles(), + h = e.useProgram('terrainCoords'); + o.bindFramebuffer.set(i.getFramebuffer('coords').framebuffer), + o.viewport.set([ + 0, + 0, + e.width / devicePixelRatio, + e.height / devicePixelRatio, + ]), + o.clear({ color: t.Color.transparent, depth: 1 }), + (i.coordsIndex = []); + for (const t of c) { + const c = i.getTerrainData(t.tileID); + o.activeTexture.set(a.TEXTURE0), + a.bindTexture(a.TEXTURE_2D, l.texture); + const u = e.transform.calculatePosMatrix( + t.tileID.toUnwrapped(), + ); + h.draw( + o, + a.TRIANGLES, + s, + Ei.disabled, + r, + Ii.backCCW, + { + u_matrix: u, + u_terrain_coords_id: (255 - i.coordsIndex.length) / 255, + u_texture: 0, + }, + c, + 'terrain', + n.vertexBuffer, + n.indexBuffer, + n.segments, + ), + i.coordsIndex.push(t.tileID.key); + } + o.bindFramebuffer.set(null), + o.viewport.set([0, 0, e.width, e.height]); + })(this, this.style.terrain)); + } + this.renderPass = 'offscreen'; + for (const t of o) { + const e = this.style._layers[t]; + if (!e.hasOffscreenPass() || e.isHidden(this.transform.zoom)) + continue; + const i = n[e.source]; + ('custom' === e.type || i.length) && + this.renderLayer(this, a[e.source], e, i); + } + if ( + (this.context.bindFramebuffer.set(null), + this.context.clear({ + color: i.showOverdrawInspector + ? t.Color.black + : t.Color.transparent, + depth: 1, + }), + this.clearStencil(), + (this._showOverdrawInspector = i.showOverdrawInspector), + (this.depthRangeFor3D = [ + 0, + 1 - (e._order.length + 2) * this.numSublayers * this.depthEpsilon, + ]), + !r) + ) + for ( + this.renderPass = 'opaque', this.currentLayer = o.length - 1; + this.currentLayer >= 0; + this.currentLayer-- + ) { + const t = this.style._layers[o[this.currentLayer]], + e = a[t.source], + i = s[t.source]; + this._renderTileClippingMasks(t, i), + this.renderLayer(this, e, t, i); + } + for ( + this.renderPass = 'translucent', this.currentLayer = 0; + this.currentLayer < o.length; + this.currentLayer++ + ) { + const t = this.style._layers[o[this.currentLayer]], + e = a[t.source]; + if (r && r.renderLayer(t)) continue; + const i = ('symbol' === t.type ? l : n)[t.source]; + this._renderTileClippingMasks(t, s[t.source]), + this.renderLayer(this, e, t, i); + } + if (this.options.showTileBoundaries) { + let t, e; + Object.values(this.style._layers).forEach((i) => { + i.source && + !i.isHidden(this.transform.zoom) && + (i.source !== (e && e.id) && + (e = this.style.sourceCaches[i.source]), + (!t || t.getSource().maxzoom < e.getSource().maxzoom) && (t = e)); + }), + t && Yi.debug(this, t, t.getVisibleCoordinates()); + } + this.options.showPadding && + (function (t) { + const e = t.transform.padding; + qi(t, t.transform.height - (e.top || 0), 3, Ui), + qi(t, e.bottom || 0, 3, Ni), + ji(t, e.left || 0, 3, Gi), + ji(t, t.transform.width - (e.right || 0), 3, Zi); + const i = t.transform.centerPoint; + !(function (t, e, i, o) { + $i(t, e - 1, i - 10, 2, 20, o), $i(t, e - 10, i - 1, 20, 2, o); + })(t, i.x, t.transform.height - i.y, Vi); + })(this), + this.context.setDefault(); + } + renderLayer(t, e, i, o) { + i.isHidden(this.transform.zoom) || + (('background' === i.type || + 'custom' === i.type || + (o || []).length) && + ((this.id = i.id), + this.gpuTimingStart(i), + Yi[i.type](t, e, i, o, this.style.placement.variableOffsets), + this.gpuTimingEnd())); + } + gpuTimingStart(t) { + if (!this.options.gpuTiming) return; + const e = this.context.extTimerQuery; + let i = this.gpuTimers[t.id]; + i || + (i = this.gpuTimers[t.id] = + { calls: 0, cpuTime: 0, query: e.createQueryEXT() }), + i.calls++, + e.beginQueryEXT(e.TIME_ELAPSED_EXT, i.query); + } + gpuTimingEnd() { + if (!this.options.gpuTiming) return; + const t = this.context.extTimerQuery; + t.endQueryEXT(t.TIME_ELAPSED_EXT); + } + collectGpuTimers() { + const t = this.gpuTimers; + return (this.gpuTimers = {}), t; + } + queryGpuTimers(t) { + const e = {}; + for (const i in t) { + const o = t[i], + a = this.context.extTimerQuery, + r = a.getQueryObjectEXT(o.query, a.QUERY_RESULT_EXT) / 1e6; + a.deleteQueryEXT(o.query), (e[i] = r); + } + return e; + } + translatePosMatrix(e, i, o, a, r) { + if (!o[0] && !o[1]) return e; + const s = r + ? 'map' === a + ? this.transform.angle + : 0 + : 'viewport' === a + ? -this.transform.angle + : 0; + if (s) { + const t = Math.sin(s), + e = Math.cos(s); + o = [o[0] * e - o[1] * t, o[0] * t + o[1] * e]; + } + const n = [ + r ? o[0] : bt(i, o[0], this.transform.zoom), + r ? o[1] : bt(i, o[1], this.transform.zoom), + 0, + ], + l = new Float32Array(16); + return t.translate(l, e, n), l; + } + saveTileTexture(t) { + const e = this._tileTextures[t.size[0]]; + e ? e.push(t) : (this._tileTextures[t.size[0]] = [t]); + } + getTileTexture(t) { + const e = this._tileTextures[t]; + return e && e.length > 0 ? e.pop() : null; + } + isPatternMissing(t) { + if (!t) return !1; + if (!t.from || !t.to) return !0; + const e = this.imageManager.getPattern(t.from.toString()), + i = this.imageManager.getPattern(t.to.toString()); + return !e || !i; + } + useProgram(t, e) { + this.cache = this.cache || {}; + const i = + t + + (e ? e.cacheKey : '') + + (this._showOverdrawInspector ? '/overdraw' : '') + + (this.style.terrain ? '/terrain' : ''); + return ( + this.cache[i] || + (this.cache[i] = new ne( + this.context, + t, + oe[t], + e, + Re[t], + this._showOverdrawInspector, + this.style.terrain, + )), + this.cache[i] + ); + } + setCustomLayerDefaults() { + this.context.unbindVAO(), + this.context.cullFace.setDefault(), + this.context.activeTexture.setDefault(), + this.context.pixelStoreUnpack.setDefault(), + this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), + this.context.pixelStoreUnpackFlipY.setDefault(); + } + setBaseState() { + const t = this.context.gl; + this.context.cullFace.set(!1), + this.context.viewport.set([0, 0, this.width, this.height]), + this.context.blendEquation.set(t.FUNC_ADD); + } + initDebugOverlayCanvas() { + null == this.debugOverlayCanvas && + ((this.debugOverlayCanvas = document.createElement('canvas')), + (this.debugOverlayCanvas.width = 512), + (this.debugOverlayCanvas.height = 512), + (this.debugOverlayTexture = new l( + this.context, + this.debugOverlayCanvas, + this.context.gl.RGBA, + ))); + } + destroy() { + this.emptyTexture.destroy(), + this.debugOverlayTexture && this.debugOverlayTexture.destroy(); + } + } + class Qi { + constructor(t, e) { + (this.points = t), (this.planes = e); + } + static fromInvProjectionMatrix(e, i, o) { + const a = Math.pow(2, o), + r = [ + [-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((o) => { + const r = (1 / (o = t.transformMat4([], o, e))[3] / i) * a; + return t.mul$1(o, o, [r, r, 1 / o[3], r]); + }), + s = [ + [0, 1, 2], + [6, 5, 4], + [0, 3, 7], + [2, 1, 5], + [3, 2, 6], + [0, 4, 5], + ].map((e) => { + const i = t.sub([], r[e[0]], r[e[1]]), + o = t.sub([], r[e[2]], r[e[1]]), + a = t.normalize([], t.cross([], i, o)), + s = -t.dot(a, r[e[1]]); + return a.concat(s); + }); + return new Qi(r, s); + } + } + class to { + constructor(e, i) { + (this.min = e), + (this.max = i), + (this.center = t.scale$1([], t.add([], this.min, this.max), 0.5)); + } + quadrant(e) { + const i = [e % 2 == 0, e < 2], + o = t.clone$2(this.min), + a = t.clone$2(this.max); + for (let t = 0; t < i.length; t++) + (o[t] = i[t] ? this.min[t] : this.center[t]), + (a[t] = i[t] ? this.center[t] : this.max[t]); + return (a[2] = this.max[2]), new to(o, a); + } + distanceX(t) { + return Math.max(Math.min(this.max[0], t[0]), this.min[0]) - t[0]; + } + distanceY(t) { + return Math.max(Math.min(this.max[1], t[1]), this.min[1]) - t[1]; + } + intersects(e) { + const i = [ + [this.min[0], this.min[1], this.min[2], 1], + [this.max[0], this.min[1], this.min[2], 1], + [this.max[0], this.max[1], this.min[2], 1], + [this.min[0], this.max[1], this.min[2], 1], + [this.min[0], this.min[1], this.max[2], 1], + [this.max[0], this.min[1], this.max[2], 1], + [this.max[0], this.max[1], this.max[2], 1], + [this.min[0], this.max[1], this.max[2], 1], + ]; + let o = !0; + for (let a = 0; a < e.planes.length; a++) { + const r = e.planes[a]; + let s = 0; + for (let e = 0; e < i.length; e++) t.dot$1(r, i[e]) >= 0 && s++; + if (0 === s) return 0; + s !== i.length && (o = !1); + } + if (o) return 2; + for (let t = 0; t < 3; t++) { + let i = Number.MAX_VALUE, + o = -Number.MAX_VALUE; + for (let a = 0; a < e.points.length; a++) { + const r = e.points[a][t] - this.min[t]; + (i = Math.min(i, r)), (o = Math.max(o, r)); + } + if (o < 0 || i > this.max[t] - this.min[t]) return 0; + } + return 1; + } + } + class eo { + constructor(t = 0, e = 0, i = 0, o = 0) { + if ( + isNaN(t) || + t < 0 || + isNaN(e) || + e < 0 || + isNaN(i) || + i < 0 || + isNaN(o) || + o < 0 + ) + throw new Error( + 'Invalid value for edge-insets, top, bottom, left and right must all be numbers', + ); + (this.top = t), (this.bottom = e), (this.left = i), (this.right = o); + } + interpolate(e, i, o) { + return ( + null != i.top && + null != e.top && + (this.top = t.number(e.top, i.top, o)), + null != i.bottom && + null != e.bottom && + (this.bottom = t.number(e.bottom, i.bottom, o)), + null != i.left && + null != e.left && + (this.left = t.number(e.left, i.left, o)), + null != i.right && + null != e.right && + (this.right = t.number(e.right, i.right, o)), + this + ); + } + getCenter(e, i) { + const o = t.clamp((this.left + e - this.right) / 2, 0, e), + a = t.clamp((this.top + i - this.bottom) / 2, 0, i); + return new t.pointGeometry(o, a); + } + equals(t) { + return ( + this.top === t.top && + this.bottom === t.bottom && + this.left === t.left && + this.right === t.right + ); + } + clone() { + return new eo(this.top, this.bottom, this.left, this.right); + } + toJSON() { + return { + top: this.top, + bottom: this.bottom, + left: this.left, + right: this.right, + }; + } + } + class io { + constructor(e, i, o, a, r) { + (this.tileSize = 512), + (this.maxValidLatitude = 85.051129), + (this.freezeElevation = !1), + (this._renderWorldCopies = void 0 === r || !!r), + (this._minZoom = e || 0), + (this._maxZoom = i || 22), + (this._minPitch = null == o ? 0 : o), + (this._maxPitch = null == a ? 60 : a), + this.setMaxBounds(), + (this.width = 0), + (this.height = 0), + (this._center = new t.LngLat(0, 0)), + (this._elevation = 0), + (this.zoom = 0), + (this.angle = 0), + (this._fov = 0.6435011087932844), + (this._pitch = 0), + (this._unmodified = !0), + (this._edgeInsets = new eo()), + (this._posMatrixCache = {}), + (this._alignedPosMatrixCache = {}); + } + clone() { + const t = new io( + this._minZoom, + this._maxZoom, + this._minPitch, + this.maxPitch, + this._renderWorldCopies, + ); + return ( + (t.tileSize = this.tileSize), + (t.latRange = this.latRange), + (t.width = this.width), + (t.height = this.height), + (t._center = this._center), + (t._elevation = this._elevation), + (t.zoom = this.zoom), + (t.angle = this.angle), + (t._fov = this._fov), + (t._pitch = this._pitch), + (t._unmodified = this._unmodified), + (t._edgeInsets = this._edgeInsets.clone()), + t._calcMatrices(), + t + ); + } + get minZoom() { + return this._minZoom; + } + set minZoom(t) { + this._minZoom !== t && + ((this._minZoom = t), (this.zoom = Math.max(this.zoom, t))); + } + get maxZoom() { + return this._maxZoom; + } + set maxZoom(t) { + this._maxZoom !== t && + ((this._maxZoom = t), (this.zoom = Math.min(this.zoom, t))); + } + get minPitch() { + return this._minPitch; + } + set minPitch(t) { + this._minPitch !== t && + ((this._minPitch = t), (this.pitch = Math.max(this.pitch, t))); + } + get maxPitch() { + return this._maxPitch; + } + set maxPitch(t) { + this._maxPitch !== t && + ((this._maxPitch = t), (this.pitch = Math.min(this.pitch, t))); + } + get renderWorldCopies() { + return this._renderWorldCopies; + } + set renderWorldCopies(t) { + void 0 === t ? (t = !0) : null === t && (t = !1), + (this._renderWorldCopies = t); + } + get worldSize() { + return this.tileSize * this.scale; + } + get centerOffset() { + return this.centerPoint._sub(this.size._div(2)); + } + get size() { + return new t.pointGeometry(this.width, this.height); + } + get bearing() { + return (-this.angle / Math.PI) * 180; + } + set bearing(e) { + const i = (-t.wrap(e, -180, 180) * Math.PI) / 180; + var o; + this.angle !== i && + ((this._unmodified = !1), + (this.angle = i), + this._calcMatrices(), + (this.rotationMatrix = + ((o = new t.ARRAY_TYPE(4)), + t.ARRAY_TYPE != Float32Array && ((o[1] = 0), (o[2] = 0)), + (o[0] = 1), + (o[3] = 1), + o)), + (function (t, e, i) { + var o = e[0], + a = e[1], + r = e[2], + s = e[3], + n = Math.sin(i), + l = Math.cos(i); + (t[0] = o * l + r * n), + (t[1] = a * l + s * n), + (t[2] = o * -n + r * l), + (t[3] = a * -n + s * l); + })(this.rotationMatrix, this.rotationMatrix, this.angle)); + } + get pitch() { + return (this._pitch / Math.PI) * 180; + } + set pitch(e) { + const i = (t.clamp(e, this.minPitch, this.maxPitch) / 180) * Math.PI; + this._pitch !== i && + ((this._unmodified = !1), (this._pitch = i), this._calcMatrices()); + } + get fov() { + return (this._fov / Math.PI) * 180; + } + set fov(t) { + (t = Math.max(0.01, Math.min(60, t))), + this._fov !== t && + ((this._unmodified = !1), + (this._fov = (t / 180) * Math.PI), + this._calcMatrices()); + } + get zoom() { + return this._zoom; + } + set zoom(t) { + const e = Math.min(Math.max(t, this.minZoom), this.maxZoom); + this._zoom !== e && + ((this._unmodified = !1), + (this._zoom = e), + (this.scale = this.zoomScale(e)), + (this.tileZoom = Math.floor(e)), + (this.zoomFraction = e - this.tileZoom), + this._constrain(), + this._calcMatrices()); + } + get center() { + return this._center; + } + set center(t) { + (t.lat === this._center.lat && t.lng === this._center.lng) || + ((this._unmodified = !1), + (this._center = t), + this._constrain(), + this._calcMatrices()); + } + get elevation() { + return this._elevation; + } + set elevation(t) { + t !== this._elevation && + ((this._elevation = t), this._constrain(), this._calcMatrices()); + } + get padding() { + return this._edgeInsets.toJSON(); + } + set padding(t) { + this._edgeInsets.equals(t) || + ((this._unmodified = !1), + this._edgeInsets.interpolate(this._edgeInsets, t, 1), + this._calcMatrices()); + } + get centerPoint() { + return this._edgeInsets.getCenter(this.width, this.height); + } + isPaddingEqual(t) { + return this._edgeInsets.equals(t); + } + interpolatePadding(t, e, i) { + (this._unmodified = !1), + this._edgeInsets.interpolate(t, e, i), + this._constrain(), + this._calcMatrices(); + } + coveringZoomLevel(t) { + const e = (t.roundZoom ? Math.round : Math.floor)( + this.zoom + this.scaleZoom(this.tileSize / t.tileSize), + ); + return Math.max(0, e); + } + getVisibleUnwrappedCoordinates(e) { + const i = [new t.UnwrappedTileID(0, e)]; + if (this._renderWorldCopies) { + const o = this.pointCoordinate(new t.pointGeometry(0, 0)), + a = this.pointCoordinate(new t.pointGeometry(this.width, 0)), + r = this.pointCoordinate( + new t.pointGeometry(this.width, this.height), + ), + s = this.pointCoordinate(new t.pointGeometry(0, this.height)), + n = Math.floor(Math.min(o.x, a.x, r.x, s.x)), + l = Math.floor(Math.max(o.x, a.x, r.x, s.x)), + c = 1; + for (let o = n - c; o <= l + c; o++) + 0 !== o && i.push(new t.UnwrappedTileID(o, e)); + } + return i; + } + coveringTiles(e) { + var i, o; + let a = this.coveringZoomLevel(e); + const r = a; + if (void 0 !== e.minzoom && a < e.minzoom) return []; + void 0 !== e.maxzoom && a > e.maxzoom && (a = e.maxzoom); + const s = this.pointCoordinate(this.getCameraPoint()), + n = t.MercatorCoordinate.fromLngLat(this.center), + l = Math.pow(2, a), + c = [l * s.x, l * s.y, 0], + h = [l * n.x, l * n.y, 0], + u = Qi.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, a); + let d = e.minzoom || 0; + !e.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (d = a); + const m = e.terrain + ? (2 / Math.min(this.tileSize, e.tileSize)) * this.tileSize + : 3, + _ = (t) => ({ + aabb: new to([t * l, 0, 0], [(t + 1) * l, l, 0]), + zoom: 0, + x: 0, + y: 0, + wrap: t, + fullyVisible: !1, + }), + p = [], + f = [], + g = a, + x = e.reparseOverscaled ? r : a; + if (this._renderWorldCopies) + for (let t = 1; t <= 3; t++) p.push(_(-t)), p.push(_(t)); + for (p.push(_(0)); p.length > 0; ) { + const a = p.pop(), + r = a.x, + s = a.y; + let n = a.fullyVisible; + if (!n) { + const t = a.aabb.intersects(u); + if (0 === t) continue; + n = 2 === t; + } + const l = e.terrain ? c : h, + _ = a.aabb.distanceX(l), + v = a.aabb.distanceY(l), + y = Math.max(Math.abs(_), Math.abs(v)), + b = m + (1 << (g - a.zoom)) - 2; + if (a.zoom === g || (y > b && a.zoom >= d)) { + const e = g - a.zoom, + i = c[0] - 0.5 - (r << e), + o = c[1] - 0.5 - (s << e); + f.push({ + tileID: new t.OverscaledTileID( + a.zoom === g ? x : a.zoom, + a.wrap, + a.zoom, + r, + s, + ), + distanceSq: t.sqrLen([h[0] - 0.5 - r, h[1] - 0.5 - s]), + tileDistanceToCamera: Math.sqrt(i * i + o * o), + }); + } else + for (let l = 0; l < 4; l++) { + const c = (r << 1) + (l % 2), + h = (s << 1) + (l >> 1), + u = a.zoom + 1; + let d = a.aabb.quadrant(l); + if (e.terrain) { + const r = new t.OverscaledTileID(u, a.wrap, u, c, h), + s = e.terrain.getMinMaxElevation(r), + n = + null !== (i = s.minElevation) && void 0 !== i + ? i + : this.elevation, + l = + null !== (o = s.maxElevation) && void 0 !== o + ? o + : this.elevation; + d = new to([d.min[0], d.min[1], n], [d.max[0], d.max[1], l]); + } + p.push({ + aabb: d, + zoom: u, + x: c, + y: h, + wrap: a.wrap, + fullyVisible: n, + }); + } + } + return f + .sort((t, e) => t.distanceSq - e.distanceSq) + .map((t) => t.tileID); + } + resize(t, e) { + (this.width = t), + (this.height = e), + (this.pixelsToGLUnits = [2 / t, -2 / e]), + this._constrain(), + this._calcMatrices(); + } + get unmodified() { + return this._unmodified; + } + zoomScale(t) { + return Math.pow(2, t); + } + scaleZoom(t) { + return Math.log(t) / Math.LN2; + } + project(e) { + const i = t.clamp(e.lat, -this.maxValidLatitude, this.maxValidLatitude); + return new t.pointGeometry( + t.mercatorXfromLng(e.lng) * this.worldSize, + t.mercatorYfromLat(i) * this.worldSize, + ); + } + unproject(e) { + return new t.MercatorCoordinate( + e.x / this.worldSize, + e.y / this.worldSize, + ).toLngLat(); + } + get point() { + return this.project(this.center); + } + updateElevation(t) { + this.freezeElevation || + (this.elevation = t ? this.getElevation(this._center, t) : 0); + } + getElevation(e, i) { + const o = t.MercatorCoordinate.fromLngLat(e), + a = (1 << this.tileZoom) * t.EXTENT, + r = o.x * a, + s = o.y * a, + n = Math.floor(r / t.EXTENT), + l = Math.floor(s / t.EXTENT), + c = new t.OverscaledTileID(this.tileZoom, 0, this.tileZoom, n, l); + return i.getElevation(c, r % t.EXTENT, s % t.EXTENT, t.EXTENT); + } + getCameraPosition() { + return { + lngLat: this.pointLocation(this.getCameraPoint()), + altitude: + (Math.cos(this._pitch) * this.cameraToCenterDistance) / + this._pixelPerMeter + + this.elevation, + }; + } + recalculateZoom(e) { + const i = this.pointLocation(this.centerPoint, e), + o = this.getElevation(i, e); + if (!(this.elevation - o)) return; + const a = this.getCameraPosition(), + r = t.MercatorCoordinate.fromLngLat(a.lngLat, a.altitude), + s = t.MercatorCoordinate.fromLngLat(i, o), + n = r.x - s.x, + l = r.y - s.y, + c = r.z - s.z, + h = Math.sqrt(n * n + l * l + c * c), + u = this.scaleZoom(this.cameraToCenterDistance / h / this.tileSize); + (this._elevation = o), (this._center = i), (this.zoom = u); + } + setLocationAtPoint(e, i) { + const o = this.pointCoordinate(i), + a = this.pointCoordinate(this.centerPoint), + r = this.locationCoordinate(e), + s = new t.MercatorCoordinate(r.x - (o.x - a.x), r.y - (o.y - a.y)); + (this.center = this.coordinateLocation(s)), + this._renderWorldCopies && (this.center = this.center.wrap()); + } + locationPoint(t, e) { + return e + ? this.coordinatePoint( + this.locationCoordinate(t), + this.getElevation(t, e), + this.pixelMatrix3D, + ) + : this.coordinatePoint(this.locationCoordinate(t)); + } + pointLocation(t, e) { + return this.coordinateLocation(this.pointCoordinate(t, e)); + } + locationCoordinate(e) { + return t.MercatorCoordinate.fromLngLat(e); + } + coordinateLocation(t) { + return t && t.toLngLat(); + } + pointCoordinate(e, i) { + if (i) { + const t = i.pointCoordinate(e); + if (null != t) return t; + } + const o = [e.x, e.y, 0, 1], + a = [e.x, e.y, 1, 1]; + t.transformMat4(o, o, this.pixelMatrixInverse), + t.transformMat4(a, a, this.pixelMatrixInverse); + const r = o[3], + s = a[3], + n = o[1] / r, + l = a[1] / s, + c = o[2] / r, + h = a[2] / s, + u = c === h ? 0 : (0 - c) / (h - c); + return new t.MercatorCoordinate( + t.number(o[0] / r, a[0] / s, u) / this.worldSize, + t.number(n, l, u) / this.worldSize, + ); + } + coordinatePoint(e, i = 0, o = this.pixelMatrix) { + const a = [e.x * this.worldSize, e.y * this.worldSize, i, 1]; + return ( + t.transformMat4(a, a, o), + new t.pointGeometry(a[0] / a[3], a[1] / a[3]) + ); + } + getBounds() { + const e = Math.max(0, this.height / 2 - this.getHorizon()); + return new t.LngLatBounds() + .extend(this.pointLocation(new t.pointGeometry(0, e))) + .extend(this.pointLocation(new t.pointGeometry(this.width, e))) + .extend( + this.pointLocation(new t.pointGeometry(this.width, this.height)), + ) + .extend(this.pointLocation(new t.pointGeometry(0, this.height))); + } + getMaxBounds() { + return this.latRange && + 2 === this.latRange.length && + this.lngRange && + 2 === this.lngRange.length + ? new t.LngLatBounds( + [this.lngRange[0], this.latRange[0]], + [this.lngRange[1], this.latRange[1]], + ) + : null; + } + getHorizon() { + return ( + Math.tan(Math.PI / 2 - this._pitch) * + this.cameraToCenterDistance * + 0.85 + ); + } + setMaxBounds(t) { + t + ? ((this.lngRange = [t.getWest(), t.getEast()]), + (this.latRange = [t.getSouth(), t.getNorth()]), + this._constrain()) + : ((this.lngRange = null), + (this.latRange = [-this.maxValidLatitude, this.maxValidLatitude])); + } + calculatePosMatrix(e, i = !1) { + const o = e.key, + a = i ? this._alignedPosMatrixCache : this._posMatrixCache; + if (a[o]) return a[o]; + const r = e.canonical, + s = this.worldSize / this.zoomScale(r.z), + n = r.x + Math.pow(2, r.z) * e.wrap, + l = t.identity(new Float64Array(16)); + return ( + t.translate(l, l, [n * s, r.y * s, 0]), + t.scale(l, l, [s / t.EXTENT, s / t.EXTENT, 1]), + t.multiply(l, i ? this.alignedProjMatrix : this.projMatrix, l), + (a[o] = new Float32Array(l)), + a[o] + ); + } + customLayerMatrix() { + return this.mercatorMatrix.slice(); + } + _constrain() { + if (!this.center || !this.width || !this.height || this._constraining) + return; + this._constraining = !0; + let e, + i, + o, + a, + r = -90, + s = 90, + n = -180, + l = 180; + const c = this.size, + h = this._unmodified; + if (this.latRange) { + const i = this.latRange; + (r = t.mercatorYfromLat(i[1]) * this.worldSize), + (s = t.mercatorYfromLat(i[0]) * this.worldSize), + (e = s - r < c.y ? c.y / (s - r) : 0); + } + if (this.lngRange) { + const e = this.lngRange; + (n = t.wrap( + t.mercatorXfromLng(e[0]) * this.worldSize, + 0, + this.worldSize, + )), + (l = t.wrap( + t.mercatorXfromLng(e[1]) * this.worldSize, + 0, + this.worldSize, + )), + l < n && (l += this.worldSize), + (i = l - n < c.x ? c.x / (l - n) : 0); + } + const u = this.point, + d = Math.max(i || 0, e || 0); + if (d) + return ( + (this.center = this.unproject( + new t.pointGeometry(i ? (l + n) / 2 : u.x, e ? (s + r) / 2 : u.y), + )), + (this.zoom += this.scaleZoom(d)), + (this._unmodified = h), + void (this._constraining = !1) + ); + if (this.latRange) { + const t = u.y, + e = c.y / 2; + t - e < r && (a = r + e), t + e > s && (a = s - e); + } + if (this.lngRange) { + const e = (n + l) / 2, + i = t.wrap(u.x, e - this.worldSize / 2, e + this.worldSize / 2), + a = c.x / 2; + i - a < n && (o = n + a), i + a > l && (o = l - a); + } + (void 0 === o && void 0 === a) || + (this.center = this.unproject( + new t.pointGeometry(void 0 !== o ? o : u.x, void 0 !== a ? a : u.y), + ).wrap()), + (this._unmodified = h), + (this._constraining = !1); + } + _calcMatrices() { + if (!this.height) return; + const e = this.centerOffset, + i = this.point.x, + o = this.point.y; + (this.cameraToCenterDistance = + (0.5 / Math.tan(this._fov / 2)) * this.height), + (this._pixelPerMeter = + t.mercatorZfromAltitude(1, this.center.lat) * this.worldSize); + let a = t.identity(new Float64Array(16)); + t.scale(a, a, [this.width / 2, -this.height / 2, 1]), + t.translate(a, a, [1, -1, 0]), + (this.labelPlaneMatrix = a), + (a = t.identity(new Float64Array(16))), + t.scale(a, a, [1, -1, 1]), + t.translate(a, a, [-1, -1, 0]), + t.scale(a, a, [2 / this.width, 2 / this.height, 1]), + (this.glCoordMatrix = a), + (this.cameraToSeaLevelDistance = + this.cameraToCenterDistance + + (this._elevation * this._pixelPerMeter) / Math.cos(this._pitch)); + const r = Math.PI / 2 + this._pitch, + s = this._fov * (0.5 + e.y / this.height), + n = + (Math.sin(s) * this.cameraToSeaLevelDistance) / + Math.sin(t.clamp(Math.PI - r - s, 0.01, Math.PI - 0.01)), + l = this.getHorizon(), + c = + 2 * + Math.atan(l / this.cameraToCenterDistance) * + (0.5 + e.y / (2 * l)), + h = + (Math.sin(c) * this.cameraToSeaLevelDistance) / + Math.sin(t.clamp(Math.PI - r - c, 0.01, Math.PI - 0.01)), + u = + Math.cos(Math.PI / 2 - this._pitch) * n + + this.cameraToSeaLevelDistance, + d = + Math.cos(Math.PI / 2 - this._pitch) * h + + this.cameraToSeaLevelDistance, + m = 1.01 * Math.min(u, d), + _ = this.height / 50; + (a = new Float64Array(16)), + t.perspective(a, this._fov, this.width / this.height, _, m), + (a[8] = (2 * -e.x) / this.width), + (a[9] = (2 * e.y) / this.height), + t.scale(a, a, [1, -1, 1]), + t.translate(a, a, [0, 0, -this.cameraToCenterDistance]), + t.rotateX(a, a, this._pitch), + t.rotateZ(a, a, this.angle), + t.translate(a, a, [-i, -o, 0]), + (this.mercatorMatrix = t.scale([], a, [ + this.worldSize, + this.worldSize, + this.worldSize, + ])), + t.scale(a, a, [1, 1, this._pixelPerMeter]), + (this.pixelMatrix = t.multiply( + new Float64Array(16), + this.labelPlaneMatrix, + a, + )), + t.translate(a, a, [0, 0, -this.elevation]), + (this.projMatrix = a), + (this.invProjMatrix = t.invert([], a)), + (this.pixelMatrix3D = t.multiply( + new Float64Array(16), + this.labelPlaneMatrix, + a, + )); + const p = (this.width % 2) / 2, + f = (this.height % 2) / 2, + g = Math.cos(this.angle), + x = Math.sin(this.angle), + v = i - Math.round(i) + g * p + x * f, + y = o - Math.round(o) + g * f + x * p, + b = new Float64Array(a); + if ( + (t.translate(b, b, [v > 0.5 ? v - 1 : v, y > 0.5 ? y - 1 : y, 0]), + (this.alignedProjMatrix = b), + (a = t.invert(new Float64Array(16), this.pixelMatrix)), + !a) + ) + throw new Error('failed to invert matrix'); + (this.pixelMatrixInverse = a), + (this._posMatrixCache = {}), + (this._alignedPosMatrixCache = {}); + } + maxPitchScaleFactor() { + if (!this.pixelMatrixInverse) return 1; + const e = this.pointCoordinate(new t.pointGeometry(0, 0)), + i = [e.x * this.worldSize, e.y * this.worldSize, 0, 1]; + return ( + t.transformMat4(i, i, this.pixelMatrix)[3] / + this.cameraToCenterDistance + ); + } + getCameraPoint() { + const e = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1); + return this.centerPoint.add(new t.pointGeometry(0, e)); + } + getCameraQueryGeometry(e) { + const i = this.getCameraPoint(); + if (1 === e.length) return [e[0], i]; + { + let o = i.x, + a = i.y, + r = i.x, + s = i.y; + for (const t of e) + (o = Math.min(o, t.x)), + (a = Math.min(a, t.y)), + (r = Math.max(r, t.x)), + (s = Math.max(s, t.y)); + return [ + new t.pointGeometry(o, a), + new t.pointGeometry(r, a), + new t.pointGeometry(r, s), + new t.pointGeometry(o, s), + new t.pointGeometry(o, a), + ]; + } + } + } + class oo { + constructor(e) { + (this._hashName = e && encodeURIComponent(e)), + t.bindAll(['_getCurrentHash', '_onHashChange', '_updateHash'], this), + (this._updateHash = (function (t, e) { + let i = !1, + o = null; + const a = () => { + (o = null), i && (t(), (o = setTimeout(a, 300)), (i = !1)); + }; + return () => ((i = !0), o || a(), o); + })(this._updateHashUnthrottled.bind(this))); + } + addTo(t) { + return ( + (this._map = t), + addEventListener('hashchange', this._onHashChange, !1), + this._map.on('moveend', this._updateHash), + this + ); + } + remove() { + return ( + removeEventListener('hashchange', this._onHashChange, !1), + this._map.off('moveend', this._updateHash), + clearTimeout(this._updateHash()), + delete this._map, + this + ); + } + getHashString(t) { + const e = this._map.getCenter(), + i = Math.round(100 * this._map.getZoom()) / 100, + o = Math.ceil((i * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), + a = Math.pow(10, o), + r = Math.round(e.lng * a) / a, + s = Math.round(e.lat * a) / a, + n = this._map.getBearing(), + l = this._map.getPitch(); + let c = ''; + if ( + ((c += t ? `/${r}/${s}/${i}` : `${i}/${s}/${r}`), + (n || l) && (c += '/' + Math.round(10 * n) / 10), + l && (c += `/${Math.round(l)}`), + this._hashName) + ) { + const t = this._hashName; + let e = !1; + const i = window.location.hash + .slice(1) + .split('&') + .map((i) => { + const o = i.split('=')[0]; + return o === t ? ((e = !0), `${o}=${c}`) : i; + }) + .filter((t) => t); + return e || i.push(`${t}=${c}`), `#${i.join('&')}`; + } + return `#${c}`; + } + _getCurrentHash() { + const t = window.location.hash.replace('#', ''); + if (this._hashName) { + let e; + return ( + t + .split('&') + .map((t) => t.split('=')) + .forEach((t) => { + t[0] === this._hashName && (e = t); + }), + ((e && e[1]) || '').split('/') + ); + } + return t.split('/'); + } + _onHashChange() { + const t = this._getCurrentHash(); + if (t.length >= 3 && !t.some((t) => isNaN(t))) { + const e = + this._map.dragRotate.isEnabled() && + this._map.touchZoomRotate.isEnabled() + ? +(t[3] || 0) + : this._map.getBearing(); + return ( + this._map.jumpTo({ + center: [+t[2], +t[1]], + zoom: +t[0], + bearing: e, + pitch: +(t[4] || 0), + }), + !0 + ); + } + return !1; + } + _updateHashUnthrottled() { + const t = window.location.href.replace(/(#.+)?$/, this.getHashString()); + try { + window.history.replaceState(window.history.state, null, t); + } catch (t) {} + } + } + const ao = { linearity: 0.3, easing: t.bezier(0, 0, 0.3, 1) }, + ro = t.extend({ deceleration: 2500, maxSpeed: 1400 }, ao), + so = t.extend({ deceleration: 20, maxSpeed: 1400 }, ao), + no = t.extend({ deceleration: 1e3, maxSpeed: 360 }, ao), + lo = t.extend({ deceleration: 1e3, maxSpeed: 90 }, ao); + class co { + constructor(t) { + (this._map = t), this.clear(); + } + clear() { + this._inertiaBuffer = []; + } + record(e) { + this._drainInertiaBuffer(), + this._inertiaBuffer.push({ time: t.exported.now(), settings: e }); + } + _drainInertiaBuffer() { + const e = this._inertiaBuffer, + i = t.exported.now(); + for (; e.length > 0 && i - e[0].time > 160; ) e.shift(); + } + _onMoveEnd(e) { + if ((this._drainInertiaBuffer(), this._inertiaBuffer.length < 2)) + return; + const i = { + zoom: 0, + bearing: 0, + pitch: 0, + pan: new t.pointGeometry(0, 0), + pinchAround: void 0, + around: void 0, + }; + for (const { settings: t } of this._inertiaBuffer) + (i.zoom += t.zoomDelta || 0), + (i.bearing += t.bearingDelta || 0), + (i.pitch += t.pitchDelta || 0), + t.panDelta && i.pan._add(t.panDelta), + t.around && (i.around = t.around), + t.pinchAround && (i.pinchAround = t.pinchAround); + const o = + this._inertiaBuffer[this._inertiaBuffer.length - 1].time - + this._inertiaBuffer[0].time, + a = {}; + if (i.pan.mag()) { + const r = uo(i.pan.mag(), o, t.extend({}, ro, e || {})); + (a.offset = i.pan.mult(r.amount / i.pan.mag())), + (a.center = this._map.transform.center), + ho(a, r); + } + if (i.zoom) { + const t = uo(i.zoom, o, so); + (a.zoom = this._map.transform.zoom + t.amount), ho(a, t); + } + if (i.bearing) { + const e = uo(i.bearing, o, no); + (a.bearing = + this._map.transform.bearing + t.clamp(e.amount, -179, 179)), + ho(a, e); + } + if (i.pitch) { + const t = uo(i.pitch, o, lo); + (a.pitch = this._map.transform.pitch + t.amount), ho(a, t); + } + if (a.zoom || a.bearing) { + const t = void 0 === i.pinchAround ? i.around : i.pinchAround; + a.around = t ? this._map.unproject(t) : this._map.getCenter(); + } + return this.clear(), t.extend(a, { noMoveStart: !0 }); + } + } + function ho(t, e) { + (!t.duration || t.duration < e.duration) && + ((t.duration = e.duration), (t.easing = e.easing)); + } + function uo(e, i, o) { + const { maxSpeed: a, linearity: r, deceleration: s } = o, + n = t.clamp((e * r) / (i / 1e3), -a, a), + l = Math.abs(n) / (s * r); + return { easing: o.easing, duration: 1e3 * l, amount: n * (l / 2) }; + } + class mo extends t.Event { + constructor(e, i, o, a = {}) { + const s = r.mousePos(i.getCanvasContainer(), o), + n = i.unproject(s); + super(e, t.extend({ point: s, lngLat: n, originalEvent: o }, a)), + (this._defaultPrevented = !1), + (this.target = i); + } + preventDefault() { + this._defaultPrevented = !0; + } + get defaultPrevented() { + return this._defaultPrevented; + } + } + class _o extends t.Event { + constructor(e, i, o) { + const a = 'touchend' === e ? o.changedTouches : o.touches, + s = r.touchPos(i.getCanvasContainer(), a), + n = s.map((t) => i.unproject(t)), + l = s.reduce( + (t, e, i, o) => t.add(e.div(o.length)), + new t.pointGeometry(0, 0), + ); + super(e, { + points: s, + point: l, + lngLats: n, + lngLat: i.unproject(l), + originalEvent: o, + }), + (this._defaultPrevented = !1); + } + preventDefault() { + this._defaultPrevented = !0; + } + get defaultPrevented() { + return this._defaultPrevented; + } + } + class po extends t.Event { + constructor(t, e, i) { + super(t, { originalEvent: i }), (this._defaultPrevented = !1); + } + preventDefault() { + this._defaultPrevented = !0; + } + get defaultPrevented() { + return this._defaultPrevented; + } + } + class fo { + constructor(t, e) { + (this._map = t), (this._clickTolerance = e.clickTolerance); + } + reset() { + delete this._mousedownPos; + } + wheel(t) { + return this._firePreventable(new po(t.type, this._map, t)); + } + mousedown(t, e) { + return ( + (this._mousedownPos = e), + this._firePreventable(new mo(t.type, this._map, t)) + ); + } + mouseup(t) { + this._map.fire(new mo(t.type, this._map, t)); + } + click(t, e) { + (this._mousedownPos && + this._mousedownPos.dist(e) >= this._clickTolerance) || + this._map.fire(new mo(t.type, this._map, t)); + } + dblclick(t) { + return this._firePreventable(new mo(t.type, this._map, t)); + } + mouseover(t) { + this._map.fire(new mo(t.type, this._map, t)); + } + mouseout(t) { + this._map.fire(new mo(t.type, this._map, t)); + } + touchstart(t) { + return this._firePreventable(new _o(t.type, this._map, t)); + } + touchmove(t) { + this._map.fire(new _o(t.type, this._map, t)); + } + touchend(t) { + this._map.fire(new _o(t.type, this._map, t)); + } + touchcancel(t) { + this._map.fire(new _o(t.type, this._map, t)); + } + _firePreventable(t) { + if ((this._map.fire(t), t.defaultPrevented)) return {}; + } + isEnabled() { + return !0; + } + isActive() { + return !1; + } + enable() {} + disable() {} + } + class go { + constructor(t) { + this._map = t; + } + reset() { + (this._delayContextMenu = !1), + (this._ignoreContextMenu = !0), + delete this._contextMenuEvent; + } + mousemove(t) { + this._map.fire(new mo(t.type, this._map, t)); + } + mousedown() { + (this._delayContextMenu = !0), (this._ignoreContextMenu = !1); + } + mouseup() { + (this._delayContextMenu = !1), + this._contextMenuEvent && + (this._map.fire( + new mo('contextmenu', this._map, this._contextMenuEvent), + ), + delete this._contextMenuEvent); + } + contextmenu(t) { + this._delayContextMenu + ? (this._contextMenuEvent = t) + : this._ignoreContextMenu || + this._map.fire(new mo(t.type, this._map, t)), + this._map.listens('contextmenu') && t.preventDefault(); + } + isEnabled() { + return !0; + } + isActive() { + return !1; + } + enable() {} + disable() {} + } + class xo { + constructor(t, e) { + (this._map = t), + (this._el = t.getCanvasContainer()), + (this._container = t.getContainer()), + (this._clickTolerance = e.clickTolerance || 1); + } + isEnabled() { + return !!this._enabled; + } + isActive() { + return !!this._active; + } + enable() { + this.isEnabled() || (this._enabled = !0); + } + disable() { + this.isEnabled() && (this._enabled = !1); + } + mousedown(t, e) { + this.isEnabled() && + t.shiftKey && + 0 === t.button && + (r.disableDrag(), + (this._startPos = this._lastPos = e), + (this._active = !0)); + } + mousemoveWindow(t, e) { + if (!this._active) return; + const i = e; + if ( + this._lastPos.equals(i) || + (!this._box && i.dist(this._startPos) < this._clickTolerance) + ) + return; + const o = this._startPos; + (this._lastPos = i), + this._box || + ((this._box = r.create( + 'div', + 'maplibregl-boxzoom mapboxgl-boxzoom', + this._container, + )), + this._container.classList.add( + 'maplibregl-crosshair', + 'mapboxgl-crosshair', + ), + this._fireEvent('boxzoomstart', t)); + const a = Math.min(o.x, i.x), + s = Math.max(o.x, i.x), + n = Math.min(o.y, i.y), + l = Math.max(o.y, i.y); + r.setTransform(this._box, `translate(${a}px,${n}px)`), + (this._box.style.width = s - a + 'px'), + (this._box.style.height = l - n + 'px'); + } + mouseupWindow(e, i) { + if (!this._active) return; + if (0 !== e.button) return; + const o = this._startPos, + a = i; + if ((this.reset(), r.suppressClick(), o.x !== a.x || o.y !== a.y)) + return ( + this._map.fire(new t.Event('boxzoomend', { originalEvent: e })), + { + cameraAnimation: (t) => + t.fitScreenCoordinates(o, a, this._map.getBearing(), { + linear: !0, + }), + } + ); + this._fireEvent('boxzoomcancel', e); + } + keydown(t) { + this._active && + 27 === t.keyCode && + (this.reset(), this._fireEvent('boxzoomcancel', t)); + } + reset() { + (this._active = !1), + this._container.classList.remove( + 'maplibregl-crosshair', + 'mapboxgl-crosshair', + ), + this._box && (r.remove(this._box), (this._box = null)), + r.enableDrag(), + delete this._startPos, + delete this._lastPos; + } + _fireEvent(e, i) { + return this._map.fire(new t.Event(e, { originalEvent: i })); + } + } + function vo(t, e) { + if (t.length !== e.length) + throw new Error( + `The number of touches and points are not equal - touches ${t.length}, points ${e.length}`, + ); + const i = {}; + for (let o = 0; o < t.length; o++) i[t[o].identifier] = e[o]; + return i; + } + class yo { + constructor(t) { + this.reset(), (this.numTouches = t.numTouches); + } + reset() { + delete this.centroid, + delete this.startTime, + delete this.touches, + (this.aborted = !1); + } + touchstart(e, i, o) { + (this.centroid || o.length > this.numTouches) && (this.aborted = !0), + this.aborted || + (void 0 === this.startTime && (this.startTime = e.timeStamp), + o.length === this.numTouches && + ((this.centroid = (function (e) { + const i = new t.pointGeometry(0, 0); + for (const t of e) i._add(t); + return i.div(e.length); + })(i)), + (this.touches = vo(o, i)))); + } + touchmove(t, e, i) { + if (this.aborted || !this.centroid) return; + const o = vo(i, e); + for (const t in this.touches) { + const e = this.touches[t], + i = o[t]; + (!i || i.dist(e) > 30) && (this.aborted = !0); + } + } + touchend(t, e, i) { + if ( + ((!this.centroid || t.timeStamp - this.startTime > 500) && + (this.aborted = !0), + 0 === i.length) + ) { + const t = !this.aborted && this.centroid; + if ((this.reset(), t)) return t; + } + } + } + class bo { + constructor(t) { + (this.singleTap = new yo(t)), (this.numTaps = t.numTaps), this.reset(); + } + reset() { + (this.lastTime = 1 / 0), + delete this.lastTap, + (this.count = 0), + this.singleTap.reset(); + } + touchstart(t, e, i) { + this.singleTap.touchstart(t, e, i); + } + touchmove(t, e, i) { + this.singleTap.touchmove(t, e, i); + } + touchend(t, e, i) { + const o = this.singleTap.touchend(t, e, i); + if (o) { + const e = t.timeStamp - this.lastTime < 500, + i = !this.lastTap || this.lastTap.dist(o) < 30; + if ( + ((e && i) || this.reset(), + this.count++, + (this.lastTime = t.timeStamp), + (this.lastTap = o), + this.count === this.numTaps) + ) + return this.reset(), o; + } + } + } + class wo { + constructor() { + (this._zoomIn = new bo({ numTouches: 1, numTaps: 2 })), + (this._zoomOut = new bo({ numTouches: 2, numTaps: 1 })), + this.reset(); + } + reset() { + (this._active = !1), this._zoomIn.reset(), this._zoomOut.reset(); + } + touchstart(t, e, i) { + this._zoomIn.touchstart(t, e, i), this._zoomOut.touchstart(t, e, i); + } + touchmove(t, e, i) { + this._zoomIn.touchmove(t, e, i), this._zoomOut.touchmove(t, e, i); + } + touchend(t, e, i) { + const o = this._zoomIn.touchend(t, e, i), + a = this._zoomOut.touchend(t, e, i); + return o + ? ((this._active = !0), + t.preventDefault(), + setTimeout(() => this.reset(), 0), + { + cameraAnimation: (e) => + e.easeTo( + { + duration: 300, + zoom: e.getZoom() + 1, + around: e.unproject(o), + }, + { originalEvent: t }, + ), + }) + : a + ? ((this._active = !0), + t.preventDefault(), + setTimeout(() => this.reset(), 0), + { + cameraAnimation: (e) => + e.easeTo( + { + duration: 300, + zoom: e.getZoom() - 1, + around: e.unproject(a), + }, + { originalEvent: t }, + ), + }) + : void 0; + } + touchcancel() { + this.reset(); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + const To = { 0: 1, 2: 2 }; + class Eo { + constructor(t) { + this.reset(), (this._clickTolerance = t.clickTolerance || 1); + } + reset() { + (this._active = !1), + (this._moved = !1), + delete this._lastPoint, + delete this._eventButton; + } + _correctButton(t, e) { + return !1; + } + _move(t, e) { + return {}; + } + mousedown(t, e) { + if (this._lastPoint) return; + const i = r.mouseButton(t); + this._correctButton(t, i) && + ((this._lastPoint = e), (this._eventButton = i)); + } + mousemoveWindow(t, e) { + const i = this._lastPoint; + if (i) + if ( + (t.preventDefault(), + (function (t, e) { + const i = To[e]; + return void 0 === t.buttons || (t.buttons & i) !== i; + })(t, this._eventButton)) + ) + this.reset(); + else if (this._moved || !(e.dist(i) < this._clickTolerance)) + return (this._moved = !0), (this._lastPoint = e), this._move(i, e); + } + mouseupWindow(t) { + this._lastPoint && + r.mouseButton(t) === this._eventButton && + (this._moved && r.suppressClick(), this.reset()); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + class Io extends Eo { + mousedown(t, e) { + super.mousedown(t, e), this._lastPoint && (this._active = !0); + } + _correctButton(t, e) { + return 0 === e && !t.ctrlKey; + } + _move(t, e) { + return { around: e, panDelta: e.sub(t) }; + } + } + class Co extends Eo { + _correctButton(t, e) { + return (0 === e && t.ctrlKey) || 2 === e; + } + _move(t, e) { + const i = 0.8 * (e.x - t.x); + if (i) return (this._active = !0), { bearingDelta: i }; + } + contextmenu(t) { + t.preventDefault(); + } + } + class So extends Eo { + _correctButton(t, e) { + return (0 === e && t.ctrlKey) || 2 === e; + } + _move(t, e) { + const i = -0.5 * (e.y - t.y); + if (i) return (this._active = !0), { pitchDelta: i }; + } + contextmenu(t) { + t.preventDefault(); + } + } + class Do { + constructor(t, e) { + (this._minTouches = t.cooperativeGestures ? 2 : 1), + (this._clickTolerance = t.clickTolerance || 1), + (this._map = e), + this.reset(); + } + reset() { + (this._active = !1), + (this._touches = {}), + (this._sum = new t.pointGeometry(0, 0)), + setTimeout(() => { + this._cancelCooperativeMessage = !1; + }, 200); + } + touchstart(t, e, i) { + return this._calculateTransform(t, e, i); + } + touchmove(t, e, i) { + if ( + (this._map._cooperativeGestures && + (2 === this._minTouches && + i.length < 2 && + !this._cancelCooperativeMessage + ? this._map._onCooperativeGesture(t, !1, i.length) + : this._cancelCooperativeMessage || + (this._cancelCooperativeMessage = !0)), + this._active && !(i.length < this._minTouches)) + ) + return t.preventDefault(), this._calculateTransform(t, e, i); + } + touchend(t, e, i) { + this._calculateTransform(t, e, i), + this._active && i.length < this._minTouches && this.reset(); + } + touchcancel() { + this.reset(); + } + _calculateTransform(e, i, o) { + o.length > 0 && (this._active = !0); + const a = vo(o, i), + r = new t.pointGeometry(0, 0), + s = new t.pointGeometry(0, 0); + let n = 0; + for (const t in a) { + const e = a[t], + i = this._touches[t]; + i && (r._add(e), s._add(e.sub(i)), n++, (a[t] = e)); + } + if (((this._touches = a), n < this._minTouches || !s.mag())) return; + const l = s.div(n); + return ( + this._sum._add(l), + this._sum.mag() < this._clickTolerance + ? void 0 + : { around: r.div(n), panDelta: l } + ); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + class zo { + constructor() { + this.reset(); + } + reset() { + (this._active = !1), delete this._firstTwoTouches; + } + _start(t) {} + _move(t, e, i) { + return {}; + } + touchstart(t, e, i) { + this._firstTwoTouches || + i.length < 2 || + ((this._firstTwoTouches = [i[0].identifier, i[1].identifier]), + this._start([e[0], e[1]])); + } + touchmove(t, e, i) { + if (!this._firstTwoTouches) return; + t.preventDefault(); + const [o, a] = this._firstTwoTouches, + r = Po(i, e, o), + s = Po(i, e, a); + if (!r || !s) return; + const n = this._aroundCenter ? null : r.add(s).div(2); + return this._move([r, s], n, t); + } + touchend(t, e, i) { + if (!this._firstTwoTouches) return; + const [o, a] = this._firstTwoTouches, + s = Po(i, e, o), + n = Po(i, e, a); + (s && n) || (this._active && r.suppressClick(), this.reset()); + } + touchcancel() { + this.reset(); + } + enable(t) { + (this._enabled = !0), + (this._aroundCenter = !!t && 'center' === t.around); + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + function Po(t, e, i) { + for (let o = 0; o < t.length; o++) if (t[o].identifier === i) return e[o]; + } + function Mo(t, e) { + return Math.log(t / e) / Math.LN2; + } + class Ao extends zo { + reset() { + super.reset(), delete this._distance, delete this._startDistance; + } + _start(t) { + this._startDistance = this._distance = t[0].dist(t[1]); + } + _move(t, e) { + const i = this._distance; + if ( + ((this._distance = t[0].dist(t[1])), + this._active || + !(Math.abs(Mo(this._distance, this._startDistance)) < 0.1)) + ) + return ( + (this._active = !0), + { zoomDelta: Mo(this._distance, i), pinchAround: e } + ); + } + } + function Lo(t, e) { + return (180 * t.angleWith(e)) / Math.PI; + } + class Ro extends zo { + reset() { + super.reset(), + delete this._minDiameter, + delete this._startVector, + delete this._vector; + } + _start(t) { + (this._startVector = this._vector = t[0].sub(t[1])), + (this._minDiameter = t[0].dist(t[1])); + } + _move(t, e) { + const i = this._vector; + if ( + ((this._vector = t[0].sub(t[1])), + this._active || !this._isBelowThreshold(this._vector)) + ) + return ( + (this._active = !0), + { bearingDelta: Lo(this._vector, i), pinchAround: e } + ); + } + _isBelowThreshold(t) { + this._minDiameter = Math.min(this._minDiameter, t.mag()); + const e = (25 / (Math.PI * this._minDiameter)) * 360, + i = Lo(t, this._startVector); + return Math.abs(i) < e; + } + } + function ko(t) { + return Math.abs(t.y) > Math.abs(t.x); + } + class Bo extends zo { + constructor(t) { + super(), (this._map = t); + } + reset() { + super.reset(), + (this._valid = void 0), + delete this._firstMove, + delete this._lastPoints; + } + touchstart(t, e, i) { + super.touchstart(t, e, i), (this._currentTouchCount = i.length); + } + _start(t) { + (this._lastPoints = t), ko(t[0].sub(t[1])) && (this._valid = !1); + } + _move(t, e, i) { + if (this._map._cooperativeGestures && this._currentTouchCount < 3) + return; + const o = t[0].sub(this._lastPoints[0]), + a = t[1].sub(this._lastPoints[1]); + return ( + (this._valid = this.gestureBeginsVertically(o, a, i.timeStamp)), + this._valid + ? ((this._lastPoints = t), + (this._active = !0), + { pitchDelta: ((o.y + a.y) / 2) * -0.5 }) + : void 0 + ); + } + gestureBeginsVertically(t, e, i) { + if (void 0 !== this._valid) return this._valid; + const o = t.mag() >= 2, + a = e.mag() >= 2; + if (!o && !a) return; + if (!o || !a) + return ( + void 0 === this._firstMove && (this._firstMove = i), + i - this._firstMove < 100 && void 0 + ); + const r = t.y > 0 == e.y > 0; + return ko(t) && ko(e) && r; + } + } + const Fo = { panStep: 100, bearingStep: 15, pitchStep: 10 }; + class Oo { + constructor() { + const t = Fo; + (this._panStep = t.panStep), + (this._bearingStep = t.bearingStep), + (this._pitchStep = t.pitchStep), + (this._rotationDisabled = !1); + } + reset() { + this._active = !1; + } + keydown(t) { + if (t.altKey || t.ctrlKey || t.metaKey) return; + let e = 0, + i = 0, + o = 0, + a = 0, + r = 0; + switch (t.keyCode) { + case 61: + case 107: + case 171: + case 187: + e = 1; + break; + case 189: + case 109: + case 173: + e = -1; + break; + case 37: + t.shiftKey ? (i = -1) : (t.preventDefault(), (a = -1)); + break; + case 39: + t.shiftKey ? (i = 1) : (t.preventDefault(), (a = 1)); + break; + case 38: + t.shiftKey ? (o = 1) : (t.preventDefault(), (r = -1)); + break; + case 40: + t.shiftKey ? (o = -1) : (t.preventDefault(), (r = 1)); + break; + default: + return; + } + return ( + this._rotationDisabled && ((i = 0), (o = 0)), + { + cameraAnimation: (s) => { + const n = s.getZoom(); + s.easeTo( + { + duration: 300, + easeId: 'keyboardHandler', + easing: Uo, + zoom: e ? Math.round(n) + e * (t.shiftKey ? 2 : 1) : n, + bearing: s.getBearing() + i * this._bearingStep, + pitch: s.getPitch() + o * this._pitchStep, + offset: [-a * this._panStep, -r * this._panStep], + center: s.getCenter(), + }, + { originalEvent: t }, + ); + }, + } + ); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + disableRotation() { + this._rotationDisabled = !0; + } + enableRotation() { + this._rotationDisabled = !1; + } + } + function Uo(t) { + return t * (2 - t); + } + const No = 4.000244140625; + class Go { + constructor(e, i) { + (this._map = e), + (this._el = e.getCanvasContainer()), + (this._handler = i), + (this._delta = 0), + (this._defaultZoomRate = 0.01), + (this._wheelZoomRate = 0.0022222222222222222), + t.bindAll(['_onTimeout'], this); + } + setZoomRate(t) { + this._defaultZoomRate = t; + } + setWheelZoomRate(t) { + this._wheelZoomRate = t; + } + isEnabled() { + return !!this._enabled; + } + isActive() { + return !!this._active || void 0 !== this._finishTimeout; + } + isZooming() { + return !!this._zooming; + } + enable(t) { + this.isEnabled() || + ((this._enabled = !0), + (this._aroundCenter = t && 'center' === t.around)); + } + disable() { + this.isEnabled() && (this._enabled = !1); + } + wheel(e) { + if (!this.isEnabled()) return; + if (this._map._cooperativeGestures) { + if (!this._map._metaPress) return; + e.preventDefault(); + } + let i = + e.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * e.deltaY : e.deltaY; + const o = t.exported.now(), + a = o - (this._lastWheelEventTime || 0); + (this._lastWheelEventTime = o), + 0 !== i && i % No == 0 + ? (this._type = 'wheel') + : 0 !== i && Math.abs(i) < 4 + ? (this._type = 'trackpad') + : a > 400 + ? ((this._type = null), + (this._lastValue = i), + (this._timeout = setTimeout(this._onTimeout, 40, e))) + : this._type || + ((this._type = Math.abs(a * i) < 200 ? 'trackpad' : 'wheel'), + this._timeout && + (clearTimeout(this._timeout), + (this._timeout = null), + (i += this._lastValue))), + e.shiftKey && i && (i /= 4), + this._type && + ((this._lastWheelEvent = e), + (this._delta -= i), + this._active || this._start(e)), + e.preventDefault(); + } + _onTimeout(t) { + (this._type = 'wheel'), + (this._delta -= this._lastValue), + this._active || this._start(t); + } + _start(e) { + if (!this._delta) return; + this._frameId && (this._frameId = null), + (this._active = !0), + this.isZooming() || (this._zooming = !0), + this._finishTimeout && + (clearTimeout(this._finishTimeout), delete this._finishTimeout); + const i = r.mousePos(this._el, e); + (this._around = t.LngLat.convert( + this._aroundCenter ? this._map.getCenter() : this._map.unproject(i), + )), + (this._aroundPoint = this._map.transform.locationPoint(this._around)), + this._frameId || + ((this._frameId = !0), this._handler._triggerRenderFrame()); + } + renderFrame() { + if (!this._frameId) return; + if (((this._frameId = null), !this.isActive())) return; + const e = this._map.transform; + if (0 !== this._delta) { + const t = + 'wheel' === this._type && Math.abs(this._delta) > No + ? this._wheelZoomRate + : this._defaultZoomRate; + let i = 2 / (1 + Math.exp(-Math.abs(this._delta * t))); + this._delta < 0 && 0 !== i && (i = 1 / i); + const o = + 'number' == typeof this._targetZoom + ? e.zoomScale(this._targetZoom) + : e.scale; + (this._targetZoom = Math.min( + e.maxZoom, + Math.max(e.minZoom, e.scaleZoom(o * i)), + )), + 'wheel' === this._type && + ((this._startZoom = e.zoom), + (this._easing = this._smoothOutEasing(200))), + (this._delta = 0); + } + const i = + 'number' == typeof this._targetZoom ? this._targetZoom : e.zoom, + o = this._startZoom, + a = this._easing; + let r, + s = !1; + if ('wheel' === this._type && o && a) { + const e = Math.min( + (t.exported.now() - this._lastWheelEventTime) / 200, + 1, + ), + n = a(e); + (r = t.number(o, i, n)), + e < 1 ? this._frameId || (this._frameId = !0) : (s = !0); + } else (r = i), (s = !0); + return ( + (this._active = !0), + s && + ((this._active = !1), + (this._finishTimeout = setTimeout(() => { + (this._zooming = !1), + this._handler._triggerRenderFrame(), + delete this._targetZoom, + delete this._finishTimeout; + }, 200))), + { + noInertia: !0, + needsRenderFrame: !s, + zoomDelta: r - e.zoom, + around: this._aroundPoint, + originalEvent: this._lastWheelEvent, + } + ); + } + _smoothOutEasing(e) { + let i = t.ease; + if (this._prevEase) { + const e = this._prevEase, + o = (t.exported.now() - e.start) / e.duration, + a = e.easing(o + 0.01) - e.easing(o), + r = (0.27 / Math.sqrt(a * a + 1e-4)) * 0.01, + s = Math.sqrt(0.0729 - r * r); + i = t.bezier(r, s, 0.25, 1); + } + return ( + (this._prevEase = { + start: t.exported.now(), + duration: e, + easing: i, + }), + i + ); + } + reset() { + this._active = !1; + } + } + class Zo { + constructor(t, e) { + (this._clickZoom = t), (this._tapZoom = e); + } + enable() { + this._clickZoom.enable(), this._tapZoom.enable(); + } + disable() { + this._clickZoom.disable(), this._tapZoom.disable(); + } + isEnabled() { + return this._clickZoom.isEnabled() && this._tapZoom.isEnabled(); + } + isActive() { + return this._clickZoom.isActive() || this._tapZoom.isActive(); + } + } + class Vo { + constructor() { + this.reset(); + } + reset() { + this._active = !1; + } + dblclick(t, e) { + return ( + t.preventDefault(), + { + cameraAnimation: (i) => { + i.easeTo( + { + duration: 300, + zoom: i.getZoom() + (t.shiftKey ? -1 : 1), + around: i.unproject(e), + }, + { originalEvent: t }, + ); + }, + } + ); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + class qo { + constructor() { + (this._tap = new bo({ numTouches: 1, numTaps: 1 })), this.reset(); + } + reset() { + (this._active = !1), + delete this._swipePoint, + delete this._swipeTouch, + delete this._tapTime, + this._tap.reset(); + } + touchstart(t, e, i) { + this._swipePoint || + (this._tapTime && t.timeStamp - this._tapTime > 500 && this.reset(), + this._tapTime + ? i.length > 0 && + ((this._swipePoint = e[0]), (this._swipeTouch = i[0].identifier)) + : this._tap.touchstart(t, e, i)); + } + touchmove(t, e, i) { + if (this._tapTime) { + if (this._swipePoint) { + if (i[0].identifier !== this._swipeTouch) return; + const o = e[0], + a = o.y - this._swipePoint.y; + return ( + (this._swipePoint = o), + t.preventDefault(), + (this._active = !0), + { zoomDelta: a / 128 } + ); + } + } else this._tap.touchmove(t, e, i); + } + touchend(t, e, i) { + this._tapTime + ? this._swipePoint && 0 === i.length && this.reset() + : this._tap.touchend(t, e, i) && (this._tapTime = t.timeStamp); + } + touchcancel() { + this.reset(); + } + enable() { + this._enabled = !0; + } + disable() { + (this._enabled = !1), this.reset(); + } + isEnabled() { + return this._enabled; + } + isActive() { + return this._active; + } + } + class jo { + constructor(t, e, i) { + (this._el = t), (this._mousePan = e), (this._touchPan = i); + } + enable(t) { + (this._inertiaOptions = t || {}), + this._mousePan.enable(), + this._touchPan.enable(), + this._el.classList.add( + 'maplibregl-touch-drag-pan', + 'mapboxgl-touch-drag-pan', + ); + } + disable() { + this._mousePan.disable(), + this._touchPan.disable(), + this._el.classList.remove( + 'maplibregl-touch-drag-pan', + 'mapboxgl-touch-drag-pan', + ); + } + isEnabled() { + return this._mousePan.isEnabled() && this._touchPan.isEnabled(); + } + isActive() { + return this._mousePan.isActive() || this._touchPan.isActive(); + } + } + class $o { + constructor(t, e, i) { + (this._pitchWithRotate = t.pitchWithRotate), + (this._mouseRotate = e), + (this._mousePitch = i); + } + enable() { + this._mouseRotate.enable(), + this._pitchWithRotate && this._mousePitch.enable(); + } + disable() { + this._mouseRotate.disable(), this._mousePitch.disable(); + } + isEnabled() { + return ( + this._mouseRotate.isEnabled() && + (!this._pitchWithRotate || this._mousePitch.isEnabled()) + ); + } + isActive() { + return this._mouseRotate.isActive() || this._mousePitch.isActive(); + } + } + class Xo { + constructor(t, e, i, o) { + (this._el = t), + (this._touchZoom = e), + (this._touchRotate = i), + (this._tapDragZoom = o), + (this._rotationDisabled = !1), + (this._enabled = !0); + } + enable(t) { + this._touchZoom.enable(t), + this._rotationDisabled || this._touchRotate.enable(t), + this._tapDragZoom.enable(), + this._el.classList.add( + 'maplibregl-touch-zoom-rotate', + 'mapboxgl-touch-zoom-rotate', + ); + } + disable() { + this._touchZoom.disable(), + this._touchRotate.disable(), + this._tapDragZoom.disable(), + this._el.classList.remove( + 'maplibregl-touch-zoom-rotate', + 'mapboxgl-touch-zoom-rotate', + ); + } + isEnabled() { + return ( + this._touchZoom.isEnabled() && + (this._rotationDisabled || this._touchRotate.isEnabled()) && + this._tapDragZoom.isEnabled() + ); + } + isActive() { + return ( + this._touchZoom.isActive() || + this._touchRotate.isActive() || + this._tapDragZoom.isActive() + ); + } + disableRotation() { + (this._rotationDisabled = !0), this._touchRotate.disable(); + } + enableRotation() { + (this._rotationDisabled = !1), + this._touchZoom.isEnabled() && this._touchRotate.enable(); + } + } + const Wo = (t) => t.zoom || t.drag || t.pitch || t.rotate; + class Ho extends t.Event {} + function Ko(t) { + return ( + (t.panDelta && t.panDelta.mag()) || + t.zoomDelta || + t.bearingDelta || + t.pitchDelta + ); + } + class Yo { + constructor(e, i) { + (this._map = e), + (this._el = this._map.getCanvasContainer()), + (this._handlers = []), + (this._handlersById = {}), + (this._changes = []), + (this._inertia = new co(e)), + (this._bearingSnap = i.bearingSnap), + (this._previousActiveHandlers = {}), + (this._eventsInProgress = {}), + this._addDefaultHandlers(i), + t.bindAll(['handleEvent', 'handleWindowEvent'], this); + const o = this._el; + this._listeners = [ + [o, 'touchstart', { passive: !0 }], + [o, 'touchmove', { passive: !1 }], + [o, 'touchend', void 0], + [o, 'touchcancel', void 0], + [o, 'mousedown', void 0], + [o, 'mousemove', void 0], + [o, 'mouseup', void 0], + [document, 'mousemove', { capture: !0 }], + [document, 'mouseup', void 0], + [o, 'mouseover', void 0], + [o, 'mouseout', void 0], + [o, 'dblclick', void 0], + [o, 'click', void 0], + [o, 'keydown', { capture: !1 }], + [o, 'keyup', void 0], + [o, 'wheel', { passive: !1 }], + [o, 'contextmenu', void 0], + [window, 'blur', void 0], + ]; + for (const [t, e, i] of this._listeners) + r.addEventListener( + t, + e, + t === document ? this.handleWindowEvent : this.handleEvent, + i, + ); + } + destroy() { + for (const [t, e, i] of this._listeners) + r.removeEventListener( + t, + e, + t === document ? this.handleWindowEvent : this.handleEvent, + i, + ); + } + _addDefaultHandlers(t) { + const e = this._map, + i = e.getCanvasContainer(); + this._add('mapEvent', new fo(e, t)); + const o = (e.boxZoom = new xo(e, t)); + this._add('boxZoom', o); + const a = new wo(), + r = new Vo(); + (e.doubleClickZoom = new Zo(r, a)), + this._add('tapZoom', a), + this._add('clickZoom', r); + const s = new qo(); + this._add('tapDragZoom', s); + const n = (e.touchPitch = new Bo(e)); + this._add('touchPitch', n); + const l = new Co(t), + c = new So(t); + (e.dragRotate = new $o(t, l, c)), + this._add('mouseRotate', l, ['mousePitch']), + this._add('mousePitch', c, ['mouseRotate']); + const h = new Io(t), + u = new Do(t, e); + (e.dragPan = new jo(i, h, u)), + this._add('mousePan', h), + this._add('touchPan', u, ['touchZoom', 'touchRotate']); + const d = new Ro(), + m = new Ao(); + (e.touchZoomRotate = new Xo(i, m, d, s)), + this._add('touchRotate', d, ['touchPan', 'touchZoom']), + this._add('touchZoom', m, ['touchPan', 'touchRotate']); + const _ = (e.scrollZoom = new Go(e, this)); + this._add('scrollZoom', _, ['mousePan']); + const p = (e.keyboard = new Oo()); + this._add('keyboard', p), this._add('blockableMapEvent', new go(e)); + for (const i of [ + 'boxZoom', + 'doubleClickZoom', + 'tapDragZoom', + 'touchPitch', + 'dragRotate', + 'dragPan', + 'touchZoomRotate', + 'scrollZoom', + 'keyboard', + ]) + t.interactive && t[i] && e[i].enable(t[i]); + } + _add(t, e, i) { + this._handlers.push({ handlerName: t, handler: e, allowed: i }), + (this._handlersById[t] = e); + } + stop(t) { + if (!this._updatingCamera) { + for (const { handler: t } of this._handlers) t.reset(); + this._inertia.clear(), + this._fireEvents({}, {}, t), + (this._changes = []); + } + } + isActive() { + for (const { handler: t } of this._handlers) + if (t.isActive()) return !0; + return !1; + } + isZooming() { + return ( + !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming() + ); + } + isRotating() { + return !!this._eventsInProgress.rotate; + } + isMoving() { + return Boolean(Wo(this._eventsInProgress)) || this.isZooming(); + } + _blockedByActive(t, e, i) { + for (const o in t) if (o !== i && (!e || e.indexOf(o) < 0)) return !0; + return !1; + } + handleWindowEvent(t) { + this.handleEvent(t, `${t.type}Window`); + } + _getMapTouches(t) { + const e = []; + for (const i of t) this._el.contains(i.target) && e.push(i); + return e; + } + handleEvent(t, e) { + if ('blur' === t.type) return void this.stop(!0); + this._updatingCamera = !0; + const i = 'renderFrame' === t.type ? void 0 : t, + o = { needsRenderFrame: !1 }, + a = {}, + s = {}, + n = t.touches, + l = n ? this._getMapTouches(n) : void 0, + c = l ? r.touchPos(this._el, l) : r.mousePos(this._el, t); + for (const { handlerName: r, handler: n, allowed: h } of this + ._handlers) { + if (!n.isEnabled()) continue; + let u; + this._blockedByActive(s, h, r) + ? n.reset() + : n[e || t.type] && + ((u = n[e || t.type](t, c, l)), + this.mergeHandlerResult(o, a, u, r, i), + u && u.needsRenderFrame && this._triggerRenderFrame()), + (u || n.isActive()) && (s[r] = n); + } + const h = {}; + for (const t in this._previousActiveHandlers) s[t] || (h[t] = i); + (this._previousActiveHandlers = s), + (Object.keys(h).length || Ko(o)) && + (this._changes.push([o, a, h]), this._triggerRenderFrame()), + (Object.keys(s).length || Ko(o)) && this._map._stop(!0), + (this._updatingCamera = !1); + const { cameraAnimation: u } = o; + u && + (this._inertia.clear(), + this._fireEvents({}, {}, !0), + (this._changes = []), + u(this._map)); + } + mergeHandlerResult(e, i, o, a, r) { + if (!o) return; + t.extend(e, o); + const s = { handlerName: a, originalEvent: o.originalEvent || r }; + void 0 !== o.zoomDelta && (i.zoom = s), + void 0 !== o.panDelta && (i.drag = s), + void 0 !== o.pitchDelta && (i.pitch = s), + void 0 !== o.bearingDelta && (i.rotate = s); + } + _applyChanges() { + const e = {}, + i = {}, + o = {}; + for (const [a, r, s] of this._changes) + a.panDelta && + (e.panDelta = (e.panDelta || new t.pointGeometry(0, 0))._add( + a.panDelta, + )), + a.zoomDelta && (e.zoomDelta = (e.zoomDelta || 0) + a.zoomDelta), + a.bearingDelta && + (e.bearingDelta = (e.bearingDelta || 0) + a.bearingDelta), + a.pitchDelta && (e.pitchDelta = (e.pitchDelta || 0) + a.pitchDelta), + void 0 !== a.around && (e.around = a.around), + void 0 !== a.pinchAround && (e.pinchAround = a.pinchAround), + a.noInertia && (e.noInertia = a.noInertia), + t.extend(i, r), + t.extend(o, s); + this._updateMapTransform(e, i, o), (this._changes = []); + } + _updateMapTransform(e, i, o) { + const a = this._map, + r = a.transform, + s = a.style && a.style.terrain; + if (!(Ko(e) || (s && this._drag))) return this._fireEvents(i, o, !0); + let { + panDelta: n, + zoomDelta: l, + bearingDelta: c, + pitchDelta: h, + around: u, + pinchAround: d, + } = e; + void 0 !== d && (u = d), + a._stop(!0), + (u = u || a.transform.centerPoint); + const m = r.pointLocation(n ? u.sub(n) : u); + c && (r.bearing += c), + h && (r.pitch += h), + l && (r.zoom += l), + s + ? i.drag && !this._drag + ? ((this._drag = { + center: r.centerPoint, + lngLat: r.pointLocation(u), + point: u, + handlerName: i.drag.handlerName, + }), + a.fire(new t.Event('freezeElevation', { freeze: !0 }))) + : this._drag && o[this._drag.handlerName] + ? (a.fire(new t.Event('freezeElevation', { freeze: !1 })), + (this._drag = null)) + : i.drag && + this._drag && + (r.center = r.pointLocation(r.centerPoint.sub(n))) + : r.setLocationAtPoint(m, u), + this._map._update(), + e.noInertia || this._inertia.record(e), + this._fireEvents(i, o, !0); + } + _fireEvents(e, i, o) { + const a = Wo(this._eventsInProgress), + r = Wo(e), + s = {}; + for (const t in e) { + const { originalEvent: i } = e[t]; + this._eventsInProgress[t] || (s[`${t}start`] = i), + (this._eventsInProgress[t] = e[t]); + } + !a && r && this._fireEvent('movestart', r.originalEvent); + for (const t in s) this._fireEvent(t, s[t]); + r && this._fireEvent('move', r.originalEvent); + for (const t in e) { + const { originalEvent: i } = e[t]; + this._fireEvent(t, i); + } + const n = {}; + let l; + for (const t in this._eventsInProgress) { + const { handlerName: e, originalEvent: o } = + this._eventsInProgress[t]; + this._handlersById[e].isActive() || + (delete this._eventsInProgress[t], + (l = i[e] || o), + (n[`${t}end`] = l)); + } + for (const t in n) this._fireEvent(t, n[t]); + const c = Wo(this._eventsInProgress); + if (o && (a || r) && !c) { + this._updatingCamera = !0; + const e = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), + i = (t) => + 0 !== t && -this._bearingSnap < t && t < this._bearingSnap; + e + ? (i(e.bearing || this._map.getBearing()) && (e.bearing = 0), + this._map.easeTo(e, { originalEvent: l })) + : (this._map.fire(new t.Event('moveend', { originalEvent: l })), + i(this._map.getBearing()) && this._map.resetNorth()), + (this._updatingCamera = !1); + } + } + _fireEvent(e, i) { + this._map.fire(new t.Event(e, i ? { originalEvent: i } : {})); + } + _requestFrame() { + return ( + this._map.triggerRepaint(), + this._map._renderTaskQueue.add((t) => { + delete this._frameId, + this.handleEvent(new Ho('renderFrame', { timeStamp: t })), + this._applyChanges(); + }) + ); + } + _triggerRenderFrame() { + void 0 === this._frameId && (this._frameId = this._requestFrame()); + } + } + const Jo = { + extend: (e, ...i) => t.extend(e, ...i), + run(t) { + t(); + }, + logToElement(t, e = !1, i = 'log') { + const o = window.document.getElementById(i); + o && (e && (o.innerHTML = ''), (o.innerHTML += `
${t}`)); + }, + }; + class Qo extends t.Evented { + constructor(e, i) { + super(), + (this._moving = !1), + (this._zooming = !1), + (this.transform = e), + (this._bearingSnap = i.bearingSnap), + t.bindAll(['_renderFrameCallback'], this); + } + getCenter() { + return new t.LngLat( + this.transform.center.lng, + this.transform.center.lat, + ); + } + setCenter(t, e) { + return this.jumpTo({ center: t }, e); + } + panBy(e, i, o) { + return ( + (e = t.pointGeometry.convert(e).mult(-1)), + this.panTo(this.transform.center, t.extend({ offset: e }, i), o) + ); + } + panTo(e, i, o) { + return this.easeTo(t.extend({ center: e }, i), o); + } + getZoom() { + return this.transform.zoom; + } + setZoom(t, e) { + return this.jumpTo({ zoom: t }, e), this; + } + zoomTo(e, i, o) { + return this.easeTo(t.extend({ zoom: e }, i), o); + } + zoomIn(t, e) { + return this.zoomTo(this.getZoom() + 1, t, e), this; + } + zoomOut(t, e) { + return this.zoomTo(this.getZoom() - 1, t, e), this; + } + getBearing() { + return this.transform.bearing; + } + setBearing(t, e) { + return this.jumpTo({ bearing: t }, e), this; + } + getPadding() { + return this.transform.padding; + } + setPadding(t, e) { + return this.jumpTo({ padding: t }, e), this; + } + rotateTo(e, i, o) { + return this.easeTo(t.extend({ bearing: e }, i), o); + } + resetNorth(e, i) { + return this.rotateTo(0, t.extend({ duration: 1e3 }, e), i), this; + } + resetNorthPitch(e, i) { + return ( + this.easeTo(t.extend({ bearing: 0, pitch: 0, duration: 1e3 }, e), i), + this + ); + } + snapToNorth(t, e) { + return Math.abs(this.getBearing()) < this._bearingSnap + ? this.resetNorth(t, e) + : this; + } + getPitch() { + return this.transform.pitch; + } + setPitch(t, e) { + return this.jumpTo({ pitch: t }, e), this; + } + cameraForBounds(e, i) { + e = t.LngLatBounds.convert(e); + const o = (i && i.bearing) || 0; + return this._cameraForBoxAndBearing( + e.getNorthWest(), + e.getSouthEast(), + o, + i, + ); + } + _cameraForBoxAndBearing(e, i, o, a) { + const r = { top: 0, bottom: 0, right: 0, left: 0 }; + if ( + 'number' == + typeof (a = t.extend( + { padding: r, offset: [0, 0], maxZoom: this.transform.maxZoom }, + a, + )).padding + ) { + const t = a.padding; + a.padding = { top: t, bottom: t, right: t, left: t }; + } + a.padding = t.extend(r, a.padding); + const s = this.transform, + n = s.padding, + l = s.project(t.LngLat.convert(e)), + c = s.project(t.LngLat.convert(i)), + h = l.rotate((-o * Math.PI) / 180), + u = c.rotate((-o * Math.PI) / 180), + d = new t.pointGeometry(Math.max(h.x, u.x), Math.max(h.y, u.y)), + m = new t.pointGeometry(Math.min(h.x, u.x), Math.min(h.y, u.y)), + _ = d.sub(m), + p = + (s.width - (n.left + n.right + a.padding.left + a.padding.right)) / + _.x, + f = + (s.height - (n.top + n.bottom + a.padding.top + a.padding.bottom)) / + _.y; + if (f < 0 || p < 0) + return void t.warnOnce( + 'Map cannot fit within canvas with the given bounds, padding, and/or offset.', + ); + const g = Math.min(s.scaleZoom(s.scale * Math.min(p, f)), a.maxZoom), + x = t.pointGeometry.convert(a.offset), + v = new t.pointGeometry( + (a.padding.left - a.padding.right) / 2, + (a.padding.top - a.padding.bottom) / 2, + ).rotate((o * Math.PI) / 180), + y = x.add(v).mult(s.scale / s.zoomScale(g)); + return { + center: s.unproject(l.add(c).div(2).sub(y)), + zoom: g, + bearing: o, + }; + } + fitBounds(t, e, i) { + return this._fitInternal(this.cameraForBounds(t, e), e, i); + } + fitScreenCoordinates(e, i, o, a, r) { + return this._fitInternal( + this._cameraForBoxAndBearing( + this.transform.pointLocation(t.pointGeometry.convert(e)), + this.transform.pointLocation(t.pointGeometry.convert(i)), + o, + a, + ), + a, + r, + ); + } + _fitInternal(e, i, o) { + return e + ? (delete (i = t.extend(e, i)).padding, + i.linear ? this.easeTo(i, o) : this.flyTo(i, o)) + : this; + } + jumpTo(e, i) { + this.stop(); + const o = this.transform; + let a = !1, + r = !1, + s = !1; + return ( + 'zoom' in e && o.zoom !== +e.zoom && ((a = !0), (o.zoom = +e.zoom)), + void 0 !== e.center && (o.center = t.LngLat.convert(e.center)), + 'bearing' in e && + o.bearing !== +e.bearing && + ((r = !0), (o.bearing = +e.bearing)), + 'pitch' in e && + o.pitch !== +e.pitch && + ((s = !0), (o.pitch = +e.pitch)), + null == e.padding || + o.isPaddingEqual(e.padding) || + (o.padding = e.padding), + this.fire(new t.Event('movestart', i)).fire(new t.Event('move', i)), + a && + this.fire(new t.Event('zoomstart', i)) + .fire(new t.Event('zoom', i)) + .fire(new t.Event('zoomend', i)), + r && + this.fire(new t.Event('rotatestart', i)) + .fire(new t.Event('rotate', i)) + .fire(new t.Event('rotateend', i)), + s && + this.fire(new t.Event('pitchstart', i)) + .fire(new t.Event('pitch', i)) + .fire(new t.Event('pitchend', i)), + this.fire(new t.Event('moveend', i)) + ); + } + calculateCameraOptionsFromTo(e, i, o, a = 0) { + const r = t.MercatorCoordinate.fromLngLat(e, i), + s = t.MercatorCoordinate.fromLngLat(o, a), + n = s.x - r.x, + l = s.y - r.y, + c = s.z - r.z, + h = Math.hypot(n, l, c); + if (0 === h) + throw new Error( + "Can't calculate camera options with same From and To", + ); + const u = Math.hypot(n, l), + d = this.transform.scaleZoom( + this.transform.cameraToCenterDistance / h / this.transform.tileSize, + ), + m = (180 * Math.atan2(n, -l)) / Math.PI; + let _ = (180 * Math.acos(u / h)) / Math.PI; + return ( + (_ = c < 0 ? 90 - _ : 90 + _), + { center: s.toLngLat(), zoom: d, pitch: _, bearing: m } + ); + } + easeTo(e, i) { + this._stop(!1, e.easeId), + (!1 === + (e = t.extend({ offset: [0, 0], duration: 500, easing: t.ease }, e)) + .animate || + (!e.essential && t.exported.prefersReducedMotion)) && + (e.duration = 0); + const o = this.transform, + a = this.getZoom(), + r = this.getBearing(), + s = this.getPitch(), + n = this.getPadding(), + l = 'zoom' in e ? +e.zoom : a, + c = 'bearing' in e ? this._normalizeBearing(e.bearing, r) : r, + h = 'pitch' in e ? +e.pitch : s, + u = 'padding' in e ? e.padding : o.padding, + d = t.pointGeometry.convert(e.offset); + let m = o.centerPoint.add(d); + const _ = o.pointLocation(m), + p = t.LngLat.convert(e.center || _); + this._normalizeCenter(p); + const f = o.project(_), + g = o.project(p).sub(f), + x = o.zoomScale(l - a); + let v, y; + e.around && + ((v = t.LngLat.convert(e.around)), (y = o.locationPoint(v))); + const b = { + moving: this._moving, + zooming: this._zooming, + rotating: this._rotating, + pitching: this._pitching, + }; + return ( + (this._zooming = this._zooming || l !== a), + (this._rotating = this._rotating || r !== c), + (this._pitching = this._pitching || h !== s), + (this._padding = !o.isPaddingEqual(u)), + (this._easeId = e.easeId), + this._prepareEase(i, e.noMoveStart, b), + this._ease( + (e) => { + if ( + (this._zooming && (o.zoom = t.number(a, l, e)), + this._rotating && (o.bearing = t.number(r, c, e)), + this._pitching && (o.pitch = t.number(s, h, e)), + this._padding && + (o.interpolatePadding(n, u, e), (m = o.centerPoint.add(d))), + v) + ) + o.setLocationAtPoint(v, y); + else { + const t = o.zoomScale(o.zoom - a), + i = l > a ? Math.min(2, x) : Math.max(0.5, x), + r = Math.pow(i, 1 - e), + s = o.unproject(f.add(g.mult(e * r)).mult(t)); + o.setLocationAtPoint(o.renderWorldCopies ? s.wrap() : s, m); + } + this._fireMoveEvents(i); + }, + (t) => { + this._afterEase(i, t); + }, + e, + ), + this + ); + } + _prepareEase(e, i, o = {}) { + (this._moving = !0), + this.fire(new t.Event('freezeElevation', { freeze: !0 })), + i || o.moving || this.fire(new t.Event('movestart', e)), + this._zooming && !o.zooming && this.fire(new t.Event('zoomstart', e)), + this._rotating && + !o.rotating && + this.fire(new t.Event('rotatestart', e)), + this._pitching && + !o.pitching && + this.fire(new t.Event('pitchstart', e)); + } + _fireMoveEvents(e) { + this.fire(new t.Event('move', e)), + this._zooming && this.fire(new t.Event('zoom', e)), + this._rotating && this.fire(new t.Event('rotate', e)), + this._pitching && this.fire(new t.Event('pitch', e)); + } + _afterEase(e, i) { + if (this._easeId && i && this._easeId === i) return; + delete this._easeId, + this.fire(new t.Event('freezeElevation', { freeze: !1 })); + const o = this._zooming, + a = this._rotating, + r = this._pitching; + (this._moving = !1), + (this._zooming = !1), + (this._rotating = !1), + (this._pitching = !1), + (this._padding = !1), + o && this.fire(new t.Event('zoomend', e)), + a && this.fire(new t.Event('rotateend', e)), + r && this.fire(new t.Event('pitchend', e)), + this.fire(new t.Event('moveend', e)); + } + flyTo(e, i) { + if (!e.essential && t.exported.prefersReducedMotion) { + const o = t.pick(e, ['center', 'zoom', 'bearing', 'pitch', 'around']); + return this.jumpTo(o, i); + } + this.stop(), + (e = t.extend( + { offset: [0, 0], speed: 1.2, curve: 1.42, easing: t.ease }, + e, + )); + const o = this.transform, + a = this.getZoom(), + r = this.getBearing(), + s = this.getPitch(), + n = this.getPadding(), + l = 'zoom' in e ? t.clamp(+e.zoom, o.minZoom, o.maxZoom) : a, + c = 'bearing' in e ? this._normalizeBearing(e.bearing, r) : r, + h = 'pitch' in e ? +e.pitch : s, + u = 'padding' in e ? e.padding : o.padding, + d = o.zoomScale(l - a), + m = t.pointGeometry.convert(e.offset); + let _ = o.centerPoint.add(m); + const p = o.pointLocation(_), + f = t.LngLat.convert(e.center || p); + this._normalizeCenter(f); + const g = o.project(p), + x = o.project(f).sub(g); + let v = e.curve; + const y = Math.max(o.width, o.height), + b = y / d, + w = x.mag(); + if ('minZoom' in e) { + const i = t.clamp(Math.min(e.minZoom, a, l), o.minZoom, o.maxZoom), + r = y / o.zoomScale(i - a); + v = Math.sqrt((r / w) * 2); + } + const T = v * v; + function E(t) { + const e = + (b * b - y * y + (t ? -1 : 1) * T * T * w * w) / + (2 * (t ? b : y) * T * w); + return Math.log(Math.sqrt(e * e + 1) - e); + } + function I(t) { + return (Math.exp(t) - Math.exp(-t)) / 2; + } + function C(t) { + return (Math.exp(t) + Math.exp(-t)) / 2; + } + const S = E(0); + let D = function (t) { + return C(S) / C(S + v * t); + }, + z = function (t) { + return (y * ((C(S) * (I((e = S + v * t)) / C(e)) - I(S)) / T)) / w; + var e; + }, + P = (E(1) - S) / v; + if (Math.abs(w) < 1e-6 || !isFinite(P)) { + if (Math.abs(y - b) < 1e-6) return this.easeTo(e, i); + const t = b < y ? -1 : 1; + (P = Math.abs(Math.log(b / y)) / v), + (z = function () { + return 0; + }), + (D = function (e) { + return Math.exp(t * v * e); + }); + } + return ( + (e.duration = + 'duration' in e + ? +e.duration + : (1e3 * P) / + ('screenSpeed' in e ? +e.screenSpeed / v : +e.speed)), + e.maxDuration && e.duration > e.maxDuration && (e.duration = 0), + (this._zooming = !0), + (this._rotating = r !== c), + (this._pitching = h !== s), + (this._padding = !o.isPaddingEqual(u)), + this._prepareEase(i, !1), + this._ease( + (e) => { + const d = e * P, + p = 1 / D(d); + (o.zoom = 1 === e ? l : a + o.scaleZoom(p)), + this._rotating && (o.bearing = t.number(r, c, e)), + this._pitching && (o.pitch = t.number(s, h, e)), + this._padding && + (o.interpolatePadding(n, u, e), (_ = o.centerPoint.add(m))); + const v = 1 === e ? f : o.unproject(g.add(x.mult(z(d))).mult(p)); + o.setLocationAtPoint(o.renderWorldCopies ? v.wrap() : v, _), + this._fireMoveEvents(i); + }, + () => this._afterEase(i), + e, + ), + this + ); + } + isEasing() { + return !!this._easeFrameId; + } + stop() { + return this._stop(); + } + _stop(t, e) { + if ( + (this._easeFrameId && + (this._cancelRenderFrame(this._easeFrameId), + delete this._easeFrameId, + delete this._onEaseFrame), + this._onEaseEnd) + ) { + const t = this._onEaseEnd; + delete this._onEaseEnd, t.call(this, e); + } + if (!t) { + const t = this.handlers; + t && t.stop(!1); + } + return this; + } + _ease(e, i, o) { + !1 === o.animate || 0 === o.duration + ? (e(1), i()) + : ((this._easeStart = t.exported.now()), + (this._easeOptions = o), + (this._onEaseFrame = e), + (this._onEaseEnd = i), + (this._easeFrameId = this._requestRenderFrame( + this._renderFrameCallback, + ))); + } + _renderFrameCallback() { + const e = Math.min( + (t.exported.now() - this._easeStart) / this._easeOptions.duration, + 1, + ); + this._onEaseFrame(this._easeOptions.easing(e)), + e < 1 + ? (this._easeFrameId = this._requestRenderFrame( + this._renderFrameCallback, + )) + : this.stop(); + } + _normalizeBearing(e, i) { + e = t.wrap(e, -180, 180); + const o = Math.abs(e - i); + return ( + Math.abs(e - 360 - i) < o && (e -= 360), + Math.abs(e + 360 - i) < o && (e += 360), + e + ); + } + _normalizeCenter(t) { + const e = this.transform; + if (!e.renderWorldCopies || e.lngRange) return; + const i = t.lng - e.center.lng; + t.lng += i > 180 ? -360 : i < -180 ? 360 : 0; + } + } + class ta { + constructor(e = {}) { + (this.options = e), + t.bindAll( + [ + '_toggleAttribution', + '_updateData', + '_updateCompact', + '_updateCompactMinimize', + ], + this, + ); + } + getDefaultPosition() { + return 'bottom-right'; + } + onAdd(t) { + return ( + (this._map = t), + (this._compact = this.options && this.options.compact), + (this._container = r.create( + 'details', + 'maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib', + )), + (this._compactButton = r.create( + 'summary', + 'maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button', + this._container, + )), + this._compactButton.addEventListener( + 'click', + this._toggleAttribution, + ), + this._setElementTitle(this._compactButton, 'ToggleAttribution'), + (this._innerContainer = r.create( + 'div', + 'maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner', + this._container, + )), + this._updateAttributions(), + this._updateCompact(), + this._map.on('styledata', this._updateData), + this._map.on('sourcedata', this._updateData), + this._map.on('terrain', this._updateData), + this._map.on('resize', this._updateCompact), + this._map.on('drag', this._updateCompactMinimize), + this._container + ); + } + onRemove() { + r.remove(this._container), + this._map.off('styledata', this._updateData), + this._map.off('sourcedata', this._updateData), + this._map.off('terrain', this._updateData), + this._map.off('resize', this._updateCompact), + this._map.off('drag', this._updateCompactMinimize), + (this._map = void 0), + (this._compact = void 0), + (this._attribHTML = void 0); + } + _setElementTitle(t, e) { + const i = this._map._getUIString(`AttributionControl.${e}`); + (t.title = i), t.setAttribute('aria-label', i); + } + _toggleAttribution() { + this._container.classList.contains('maplibregl-compact') && + (this._container.classList.contains('maplibregl-compact-show') + ? (this._container.setAttribute('open', ''), + this._container.classList.remove( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + )) + : (this._container.classList.add( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + ), + this._container.removeAttribute('open'))); + } + _updateData(t) { + !t || + ('metadata' !== t.sourceDataType && + 'visibility' !== t.sourceDataType && + 'style' !== t.dataType && + 'terrain' !== t.type) || + this._updateAttributions(); + } + _updateAttributions() { + if (!this._map.style) return; + let t = []; + if ( + (this.options.customAttribution && + (Array.isArray(this.options.customAttribution) + ? (t = t.concat( + this.options.customAttribution.map((t) => + 'string' != typeof t ? '' : t, + ), + )) + : 'string' == typeof this.options.customAttribution && + t.push(this.options.customAttribution)), + this._map.style.stylesheet) + ) { + const t = this._map.style.stylesheet; + (this.styleOwner = t.owner), (this.styleId = t.id); + } + const e = this._map.style.sourceCaches; + for (const i in e) { + const o = e[i]; + if (o.used || o.usedForTerrain) { + const e = o.getSource(); + e.attribution && + t.indexOf(e.attribution) < 0 && + t.push(e.attribution); + } + } + (t = t.filter((t) => String(t).trim())), + t.sort((t, e) => t.length - e.length), + (t = t.filter((e, i) => { + for (let o = i + 1; o < t.length; o++) + if (t[o].indexOf(e) >= 0) return !1; + return !0; + })); + const i = t.join(' | '); + i !== this._attribHTML && + ((this._attribHTML = i), + t.length + ? ((this._innerContainer.innerHTML = i), + this._container.classList.remove( + 'maplibregl-attrib-empty', + 'mapboxgl-attrib-empty', + )) + : this._container.classList.add( + 'maplibregl-attrib-empty', + 'mapboxgl-attrib-empty', + ), + this._updateCompact(), + (this._editLink = null)); + } + _updateCompact() { + this._map.getCanvasContainer().offsetWidth <= 640 || this._compact + ? !1 === this._compact + ? this._container.setAttribute('open', '') + : this._container.classList.contains('maplibregl-compact') || + this._container.classList.contains('maplibregl-attrib-empty') || + (this._container.setAttribute('open', ''), + this._container.classList.add( + 'maplibregl-compact', + 'mapboxgl-compact', + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + )) + : (this._container.setAttribute('open', ''), + this._container.classList.contains('maplibregl-compact') && + this._container.classList.remove( + 'maplibregl-compact', + 'maplibregl-compact-show', + 'mapboxgl-compact', + 'mapboxgl-compact-show', + )); + } + _updateCompactMinimize() { + this._container.classList.contains('maplibregl-compact') && + this._container.classList.contains('maplibregl-compact-show') && + this._container.classList.remove( + 'maplibregl-compact-show', + 'mapboxgl-compact-show', + ); + } + } + class ea { + constructor(e = {}) { + (this.options = e), t.bindAll(['_updateCompact'], this); + } + getDefaultPosition() { + return 'bottom-left'; + } + onAdd(t) { + (this._map = t), + (this._compact = this.options && this.options.compact), + (this._container = r.create('div', 'maplibregl-ctrl mapboxgl-ctrl')); + const e = r.create('a', 'maplibregl-ctrl-logo mapboxgl-ctrl-logo'); + return ( + (e.target = '_blank'), + (e.rel = 'noopener nofollow'), + (e.href = 'https://maplibre.org/'), + e.setAttribute( + 'aria-label', + this._map._getUIString('LogoControl.Title'), + ), + e.setAttribute('rel', 'noopener nofollow'), + this._container.appendChild(e), + (this._container.style.display = 'block'), + this._map.on('resize', this._updateCompact), + this._updateCompact(), + this._container + ); + } + onRemove() { + r.remove(this._container), + this._map.off('resize', this._updateCompact), + (this._map = void 0), + (this._compact = void 0); + } + _updateCompact() { + const t = this._container.children; + if (t.length) { + const e = t[0]; + this._map.getCanvasContainer().offsetWidth <= 640 || this._compact + ? !1 !== this._compact && + e.classList.add('maplibregl-compact', 'mapboxgl-compact') + : e.classList.remove('maplibregl-compact', 'mapboxgl-compact'); + } + } + } + class ia { + constructor() { + (this._queue = []), + (this._id = 0), + (this._cleared = !1), + (this._currentlyRunning = !1); + } + add(t) { + const e = ++this._id; + return this._queue.push({ callback: t, id: e, cancelled: !1 }), e; + } + remove(t) { + const e = this._currentlyRunning, + i = e ? this._queue.concat(e) : this._queue; + for (const e of i) if (e.id === t) return void (e.cancelled = !0); + } + run(t = 0) { + if (this._currentlyRunning) + throw new Error('Attempting to run(), but is already running.'); + const e = (this._currentlyRunning = this._queue); + this._queue = []; + for (const i of e) + if (!i.cancelled && (i.callback(t), this._cleared)) break; + (this._cleared = !1), (this._currentlyRunning = !1); + } + clear() { + this._currentlyRunning && (this._cleared = !0), (this._queue = []); + } + } + const oa = { + 'AttributionControl.ToggleAttribution': 'Toggle attribution', + 'AttributionControl.MapFeedback': 'Map feedback', + 'FullscreenControl.Enter': 'Enter fullscreen', + 'FullscreenControl.Exit': 'Exit fullscreen', + 'GeolocateControl.FindMyLocation': 'Find my location', + 'GeolocateControl.LocationNotAvailable': 'Location not available', + 'LogoControl.Title': 'Mapbox logo', + 'NavigationControl.ResetBearing': 'Reset bearing to north', + 'NavigationControl.ZoomIn': 'Zoom in', + 'NavigationControl.ZoomOut': 'Zoom out', + 'ScaleControl.Feet': 'ft', + 'ScaleControl.Meters': 'm', + 'ScaleControl.Kilometers': 'km', + 'ScaleControl.Miles': 'mi', + 'ScaleControl.NauticalMiles': 'nm', + 'TerrainControl.enableTerrain': 'Enable terrain', + 'TerrainControl.disableTerrain': 'Disable terrain', + }, + aa = { + center: [0, 0], + zoom: 0, + bearing: 0, + pitch: 0, + minZoom: -2, + maxZoom: 22, + minPitch: 0, + maxPitch: 60, + interactive: !0, + scrollZoom: !0, + boxZoom: !0, + dragRotate: !0, + dragPan: !0, + keyboard: !0, + doubleClickZoom: !0, + touchZoomRotate: !0, + touchPitch: !0, + cooperativeGestures: void 0, + bearingSnap: 7, + clickTolerance: 3, + pitchWithRotate: !0, + hash: !1, + attributionControl: !0, + maplibreLogo: !1, + failIfMajorPerformanceCaveat: !1, + preserveDrawingBuffer: !1, + trackResize: !0, + renderWorldCopies: !0, + refreshExpiredTiles: !0, + maxTileCacheSize: null, + localIdeographFontFamily: 'sans-serif', + transformRequest: null, + fadeDuration: 300, + crossSourceCollisions: !0, + }, + ra = { showCompass: !0, showZoom: !0, visualizePitch: !1 }; + class sa { + constructor(e, i, o = !1) { + (this._clickTolerance = 10), + (this.element = i), + (this.mouseRotate = new Co({ + clickTolerance: e.dragRotate._mouseRotate._clickTolerance, + })), + (this.map = e), + o && + (this.mousePitch = new So({ + clickTolerance: e.dragRotate._mousePitch._clickTolerance, + })), + t.bindAll( + [ + 'mousedown', + 'mousemove', + 'mouseup', + 'touchstart', + 'touchmove', + 'touchend', + 'reset', + ], + this, + ), + r.addEventListener(i, 'mousedown', this.mousedown), + r.addEventListener(i, 'touchstart', this.touchstart, { passive: !1 }), + r.addEventListener(i, 'touchmove', this.touchmove), + r.addEventListener(i, 'touchend', this.touchend), + r.addEventListener(i, 'touchcancel', this.reset); + } + down(t, e) { + this.mouseRotate.mousedown(t, e), + this.mousePitch && this.mousePitch.mousedown(t, e), + r.disableDrag(); + } + move(t, e) { + const i = this.map, + o = this.mouseRotate.mousemoveWindow(t, e); + if ( + (o && o.bearingDelta && i.setBearing(i.getBearing() + o.bearingDelta), + this.mousePitch) + ) { + const o = this.mousePitch.mousemoveWindow(t, e); + o && o.pitchDelta && i.setPitch(i.getPitch() + o.pitchDelta); + } + } + off() { + const t = this.element; + r.removeEventListener(t, 'mousedown', this.mousedown), + r.removeEventListener(t, 'touchstart', this.touchstart, { + passive: !1, + }), + r.removeEventListener(t, 'touchmove', this.touchmove), + r.removeEventListener(t, 'touchend', this.touchend), + r.removeEventListener(t, 'touchcancel', this.reset), + this.offTemp(); + } + offTemp() { + r.enableDrag(), + r.removeEventListener(window, 'mousemove', this.mousemove), + r.removeEventListener(window, 'mouseup', this.mouseup); + } + mousedown(e) { + this.down( + t.extend({}, e, { + ctrlKey: !0, + preventDefault: () => e.preventDefault(), + }), + r.mousePos(this.element, e), + ), + r.addEventListener(window, 'mousemove', this.mousemove), + r.addEventListener(window, 'mouseup', this.mouseup); + } + mousemove(t) { + this.move(t, r.mousePos(this.element, t)); + } + mouseup(t) { + this.mouseRotate.mouseupWindow(t), + this.mousePitch && this.mousePitch.mouseupWindow(t), + this.offTemp(); + } + touchstart(t) { + 1 !== t.targetTouches.length + ? this.reset() + : ((this._startPos = this._lastPos = + r.touchPos(this.element, t.targetTouches)[0]), + this.down( + { + type: 'mousedown', + button: 0, + ctrlKey: !0, + preventDefault: () => t.preventDefault(), + }, + this._startPos, + )); + } + touchmove(t) { + 1 !== t.targetTouches.length + ? this.reset() + : ((this._lastPos = r.touchPos(this.element, t.targetTouches)[0]), + this.move( + { preventDefault: () => t.preventDefault() }, + this._lastPos, + )); + } + touchend(t) { + 0 === t.targetTouches.length && + this._startPos && + this._lastPos && + this._startPos.dist(this._lastPos) < this._clickTolerance && + this.element.click(), + this.reset(); + } + reset() { + this.mouseRotate.reset(), + this.mousePitch && this.mousePitch.reset(), + delete this._startPos, + delete this._lastPos, + this.offTemp(); + } + } + function na(e, i, o) { + if (((e = new t.LngLat(e.lng, e.lat)), i)) { + const a = new t.LngLat(e.lng - 360, e.lat), + r = new t.LngLat(e.lng + 360, e.lat), + s = o.locationPoint(e).distSqr(i); + o.locationPoint(a).distSqr(i) < s + ? (e = a) + : o.locationPoint(r).distSqr(i) < s && (e = r); + } + for (; Math.abs(e.lng - o.center.lng) > 180; ) { + const t = o.locationPoint(e); + if (t.x >= 0 && t.y >= 0 && t.x <= o.width && t.y <= o.height) break; + e.lng > o.center.lng ? (e.lng -= 360) : (e.lng += 360); + } + return e; + } + const la = { + center: 'translate(-50%,-50%)', + top: 'translate(-50%,0)', + 'top-left': 'translate(0,0)', + 'top-right': 'translate(-100%,0)', + bottom: 'translate(-50%,-100%)', + 'bottom-left': 'translate(0,-100%)', + 'bottom-right': 'translate(-100%,-100%)', + left: 'translate(0,-50%)', + right: 'translate(-100%,-50%)', + }; + function ca(t, e, i) { + const o = t.classList; + for (const t in la) + o.remove(`maplibregl-${i}-anchor-${t}`, `mapboxgl-${i}-anchor-${t}`); + o.add(`maplibregl-${i}-anchor-${e}`, `mapboxgl-${i}-anchor-${e}`); + } + class ha extends t.Evented { + constructor(e, i) { + if ( + (super(), + (e instanceof HTMLElement || i) && (e = t.extend({ element: e }, i)), + t.bindAll( + [ + '_update', + '_onMove', + '_onUp', + '_addDragHandler', + '_onMapClick', + '_onKeyPress', + ], + this, + ), + (this._anchor = (e && e.anchor) || 'center'), + (this._color = (e && e.color) || '#3FB1CE'), + (this._scale = (e && e.scale) || 1), + (this._draggable = (e && e.draggable) || !1), + (this._clickTolerance = (e && e.clickTolerance) || 0), + (this._isDragging = !1), + (this._state = 'inactive'), + (this._rotation = (e && e.rotation) || 0), + (this._rotationAlignment = (e && e.rotationAlignment) || 'auto'), + (this._pitchAlignment = + e && e.pitchAlignment && 'auto' !== e.pitchAlignment + ? e.pitchAlignment + : this._rotationAlignment), + e && e.element) + ) + (this._element = e.element), + (this._offset = t.pointGeometry.convert((e && e.offset) || [0, 0])); + else { + (this._defaultMarker = !0), + (this._element = r.create('div')), + this._element.setAttribute('aria-label', 'Map marker'); + const i = r.createNS('http://www.w3.org/2000/svg', 'svg'), + o = 41, + a = 27; + i.setAttributeNS(null, 'display', 'block'), + i.setAttributeNS(null, 'height', `${o}px`), + i.setAttributeNS(null, 'width', `${a}px`), + i.setAttributeNS(null, 'viewBox', `0 0 ${a} ${o}`); + const s = r.createNS('http://www.w3.org/2000/svg', 'g'); + s.setAttributeNS(null, 'stroke', 'none'), + s.setAttributeNS(null, 'stroke-width', '1'), + s.setAttributeNS(null, 'fill', 'none'), + s.setAttributeNS(null, 'fill-rule', 'evenodd'); + const n = r.createNS('http://www.w3.org/2000/svg', 'g'); + n.setAttributeNS(null, 'fill-rule', 'nonzero'); + const l = r.createNS('http://www.w3.org/2000/svg', 'g'); + l.setAttributeNS(null, 'transform', 'translate(3.0, 29.0)'), + l.setAttributeNS(null, 'fill', '#000000'); + const c = [ + { rx: '10.5', ry: '5.25002273' }, + { rx: '10.5', ry: '5.25002273' }, + { rx: '9.5', ry: '4.77275007' }, + { rx: '8.5', ry: '4.29549936' }, + { rx: '7.5', ry: '3.81822308' }, + { rx: '6.5', ry: '3.34094679' }, + { rx: '5.5', ry: '2.86367051' }, + { rx: '4.5', ry: '2.38636864' }, + ]; + for (const t of c) { + const e = r.createNS('http://www.w3.org/2000/svg', 'ellipse'); + e.setAttributeNS(null, 'opacity', '0.04'), + e.setAttributeNS(null, 'cx', '10.5'), + e.setAttributeNS(null, 'cy', '5.80029008'), + e.setAttributeNS(null, 'rx', t.rx), + e.setAttributeNS(null, 'ry', t.ry), + l.appendChild(e); + } + const h = r.createNS('http://www.w3.org/2000/svg', 'g'); + h.setAttributeNS(null, 'fill', this._color); + const u = r.createNS('http://www.w3.org/2000/svg', 'path'); + u.setAttributeNS( + null, + 'd', + 'M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z', + ), + h.appendChild(u); + const d = r.createNS('http://www.w3.org/2000/svg', 'g'); + d.setAttributeNS(null, 'opacity', '0.25'), + d.setAttributeNS(null, 'fill', '#000000'); + const m = r.createNS('http://www.w3.org/2000/svg', 'path'); + m.setAttributeNS( + null, + 'd', + 'M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z', + ), + d.appendChild(m); + const _ = r.createNS('http://www.w3.org/2000/svg', 'g'); + _.setAttributeNS(null, 'transform', 'translate(6.0, 7.0)'), + _.setAttributeNS(null, 'fill', '#FFFFFF'); + const p = r.createNS('http://www.w3.org/2000/svg', 'g'); + p.setAttributeNS(null, 'transform', 'translate(8.0, 8.0)'); + const f = r.createNS('http://www.w3.org/2000/svg', 'circle'); + f.setAttributeNS(null, 'fill', '#000000'), + f.setAttributeNS(null, 'opacity', '0.25'), + f.setAttributeNS(null, 'cx', '5.5'), + f.setAttributeNS(null, 'cy', '5.5'), + f.setAttributeNS(null, 'r', '5.4999962'); + const g = r.createNS('http://www.w3.org/2000/svg', 'circle'); + g.setAttributeNS(null, 'fill', '#FFFFFF'), + g.setAttributeNS(null, 'cx', '5.5'), + g.setAttributeNS(null, 'cy', '5.5'), + g.setAttributeNS(null, 'r', '5.4999962'), + p.appendChild(f), + p.appendChild(g), + n.appendChild(l), + n.appendChild(h), + n.appendChild(d), + n.appendChild(_), + n.appendChild(p), + i.appendChild(n), + i.setAttributeNS(null, 'height', o * this._scale + 'px'), + i.setAttributeNS(null, 'width', a * this._scale + 'px'), + this._element.appendChild(i), + (this._offset = t.pointGeometry.convert( + (e && e.offset) || [0, -14], + )); + } + this._element.classList.add('maplibregl-marker', 'mapboxgl-marker'), + this._element.addEventListener('dragstart', (t) => { + t.preventDefault(); + }), + this._element.addEventListener('mousedown', (t) => { + t.preventDefault(); + }), + ca(this._element, this._anchor, 'marker'), + (this._popup = null); + } + addTo(t) { + return ( + this.remove(), + (this._map = t), + t.getCanvasContainer().appendChild(this._element), + t.on('move', this._update), + t.on('moveend', this._update), + this.setDraggable(this._draggable), + this._update(), + this._map.on('click', this._onMapClick), + this + ); + } + remove() { + return ( + this._opacityTimeout && + (clearTimeout(this._opacityTimeout), delete this._opacityTimeout), + this._map && + (this._map.off('click', this._onMapClick), + this._map.off('move', this._update), + this._map.off('moveend', this._update), + this._map.off('mousedown', this._addDragHandler), + this._map.off('touchstart', this._addDragHandler), + this._map.off('mouseup', this._onUp), + this._map.off('touchend', this._onUp), + this._map.off('mousemove', this._onMove), + this._map.off('touchmove', this._onMove), + delete this._map), + r.remove(this._element), + this._popup && this._popup.remove(), + this + ); + } + getLngLat() { + return this._lngLat; + } + setLngLat(e) { + return ( + (this._lngLat = t.LngLat.convert(e)), + (this._pos = null), + this._popup && this._popup.setLngLat(this._lngLat), + this._update(), + this + ); + } + getElement() { + return this._element; + } + setPopup(t) { + if ( + (this._popup && + (this._popup.remove(), + (this._popup = null), + this._element.removeEventListener('keypress', this._onKeyPress), + this._originalTabIndex || + this._element.removeAttribute('tabindex')), + t) + ) { + if (!('offset' in t.options)) { + const e = 38.1, + i = 13.5, + o = Math.sqrt(Math.pow(i, 2) / 2); + t.options.offset = this._defaultMarker + ? { + top: [0, 0], + 'top-left': [0, 0], + 'top-right': [0, 0], + bottom: [0, -e], + 'bottom-left': [o, -1 * (e - i + o)], + 'bottom-right': [-o, -1 * (e - i + o)], + left: [i, -1 * (e - i)], + right: [-i, -1 * (e - i)], + } + : this._offset; + } + (this._popup = t), + this._lngLat && this._popup.setLngLat(this._lngLat), + (this._originalTabIndex = this._element.getAttribute('tabindex')), + this._originalTabIndex || + this._element.setAttribute('tabindex', '0'), + this._element.addEventListener('keypress', this._onKeyPress); + } + return this; + } + _onKeyPress(t) { + const e = t.code, + i = t.charCode || t.keyCode; + ('Space' !== e && 'Enter' !== e && 32 !== i && 13 !== i) || + this.togglePopup(); + } + _onMapClick(t) { + const e = t.originalEvent.target, + i = this._element; + this._popup && (e === i || i.contains(e)) && this.togglePopup(); + } + getPopup() { + return this._popup; + } + togglePopup() { + const t = this._popup; + return t ? (t.isOpen() ? t.remove() : t.addTo(this._map), this) : this; + } + _update(t) { + if (!this._map) return; + this._map.transform.renderWorldCopies && + (this._lngLat = na(this._lngLat, this._pos, this._map.transform)), + (this._pos = this._map.project(this._lngLat)._add(this._offset)); + let e = ''; + 'viewport' === this._rotationAlignment || + 'auto' === this._rotationAlignment + ? (e = `rotateZ(${this._rotation}deg)`) + : 'map' === this._rotationAlignment && + (e = `rotateZ(${this._rotation - this._map.getBearing()}deg)`); + let i = ''; + 'viewport' === this._pitchAlignment || 'auto' === this._pitchAlignment + ? (i = 'rotateX(0deg)') + : 'map' === this._pitchAlignment && + (i = `rotateX(${this._map.getPitch()}deg)`), + (t && 'moveend' !== t.type) || (this._pos = this._pos.round()), + r.setTransform( + this._element, + `${la[this._anchor]} translate(${this._pos.x}px, ${ + this._pos.y + }px) ${i} ${e}`, + ), + this._map.style && + this._map.style.terrain && + !this._opacityTimeout && + (this._opacityTimeout = setTimeout(() => { + const t = this._map.unproject(this._pos), + e = + (40075016.686 * + Math.abs(Math.cos((this._lngLat.lat * Math.PI) / 180))) / + Math.pow(2, this._map.transform.tileZoom + 8); + (this._element.style.opacity = + t.distanceTo(this._lngLat) > 20 * e ? '0.2' : '1.0'), + (this._opacityTimeout = null); + }, 100)); + } + getOffset() { + return this._offset; + } + setOffset(e) { + return ( + (this._offset = t.pointGeometry.convert(e)), this._update(), this + ); + } + _onMove(e) { + if (!this._isDragging) { + const t = this._clickTolerance || this._map._clickTolerance; + this._isDragging = e.point.dist(this._pointerdownPos) >= t; + } + this._isDragging && + ((this._pos = e.point.sub(this._positionDelta)), + (this._lngLat = this._map.unproject(this._pos)), + this.setLngLat(this._lngLat), + (this._element.style.pointerEvents = 'none'), + 'pending' === this._state && + ((this._state = 'active'), this.fire(new t.Event('dragstart'))), + this.fire(new t.Event('drag'))); + } + _onUp() { + (this._element.style.pointerEvents = 'auto'), + (this._positionDelta = null), + (this._pointerdownPos = null), + (this._isDragging = !1), + this._map.off('mousemove', this._onMove), + this._map.off('touchmove', this._onMove), + 'active' === this._state && this.fire(new t.Event('dragend')), + (this._state = 'inactive'); + } + _addDragHandler(t) { + this._element.contains(t.originalEvent.target) && + (t.preventDefault(), + (this._positionDelta = t.point.sub(this._pos).add(this._offset)), + (this._pointerdownPos = t.point), + (this._state = 'pending'), + this._map.on('mousemove', this._onMove), + this._map.on('touchmove', this._onMove), + this._map.once('mouseup', this._onUp), + this._map.once('touchend', this._onUp)); + } + setDraggable(t) { + return ( + (this._draggable = !!t), + this._map && + (t + ? (this._map.on('mousedown', this._addDragHandler), + this._map.on('touchstart', this._addDragHandler)) + : (this._map.off('mousedown', this._addDragHandler), + this._map.off('touchstart', this._addDragHandler))), + this + ); + } + isDraggable() { + return this._draggable; + } + setRotation(t) { + return (this._rotation = t || 0), this._update(), this; + } + getRotation() { + return this._rotation; + } + setRotationAlignment(t) { + return (this._rotationAlignment = t || 'auto'), this._update(), this; + } + getRotationAlignment() { + return this._rotationAlignment; + } + setPitchAlignment(t) { + return ( + (this._pitchAlignment = + t && 'auto' !== t ? t : this._rotationAlignment), + this._update(), + this + ); + } + getPitchAlignment() { + return this._pitchAlignment; + } + } + const ua = { + positionOptions: { enableHighAccuracy: !1, maximumAge: 0, timeout: 6e3 }, + fitBoundsOptions: { maxZoom: 15 }, + trackUserLocation: !1, + showAccuracyCircle: !0, + showUserLocation: !0, + }; + let da, + ma = 0, + _a = !1; + const pa = { maxWidth: 100, unit: 'metric' }; + function fa(t, e, i) { + const o = (i && i.maxWidth) || 100, + a = t._container.clientHeight / 2, + r = t.unproject([0, a]), + s = t.unproject([o, a]), + n = r.distanceTo(s); + if (i && 'imperial' === i.unit) { + const i = 3.2808 * n; + i > 5280 + ? ga(e, o, i / 5280, t._getUIString('ScaleControl.Miles')) + : ga(e, o, i, t._getUIString('ScaleControl.Feet')); + } else i && 'nautical' === i.unit ? ga(e, o, n / 1852, t._getUIString('ScaleControl.NauticalMiles')) : n >= 1e3 ? ga(e, o, n / 1e3, t._getUIString('ScaleControl.Kilometers')) : ga(e, o, n, t._getUIString('ScaleControl.Meters')); + } + function ga(t, e, i, o) { + const a = (function (t) { + const e = Math.pow(10, `${Math.floor(t)}`.length - 1); + let i = t / e; + return ( + (i = + i >= 10 + ? 10 + : i >= 5 + ? 5 + : i >= 3 + ? 3 + : i >= 2 + ? 2 + : i >= 1 + ? 1 + : (function (t) { + const e = Math.pow(10, Math.ceil(-Math.log(t) / Math.LN10)); + return Math.round(t * e) / e; + })(i)), + e * i + ); + })(i); + (t.style.width = e * (a / i) + 'px'), (t.innerHTML = `${a} ${o}`); + } + const xa = { + closeButton: !0, + closeOnClick: !0, + focusAfterOpen: !0, + className: '', + maxWidth: '240px', + }, + va = [ + 'a[href]', + "[tabindex]:not([tabindex='-1'])", + "[contenteditable]:not([contenteditable='false'])", + 'button:not([disabled])', + 'input:not([disabled])', + 'select:not([disabled])', + 'textarea:not([disabled])', + ].join(', '); + function ya(e) { + if (e) { + if ('number' == typeof e) { + const i = Math.round(Math.sqrt(0.5 * Math.pow(e, 2))); + return { + center: new t.pointGeometry(0, 0), + top: new t.pointGeometry(0, e), + 'top-left': new t.pointGeometry(i, i), + 'top-right': new t.pointGeometry(-i, i), + bottom: new t.pointGeometry(0, -e), + 'bottom-left': new t.pointGeometry(i, -i), + 'bottom-right': new t.pointGeometry(-i, -i), + left: new t.pointGeometry(e, 0), + right: new t.pointGeometry(-e, 0), + }; + } + if (e instanceof t.pointGeometry || Array.isArray(e)) { + const i = t.pointGeometry.convert(e); + return { + center: i, + top: i, + 'top-left': i, + 'top-right': i, + bottom: i, + 'bottom-left': i, + 'bottom-right': i, + left: i, + right: i, + }; + } + return { + center: t.pointGeometry.convert(e.center || [0, 0]), + top: t.pointGeometry.convert(e.top || [0, 0]), + 'top-left': t.pointGeometry.convert(e['top-left'] || [0, 0]), + 'top-right': t.pointGeometry.convert(e['top-right'] || [0, 0]), + bottom: t.pointGeometry.convert(e.bottom || [0, 0]), + 'bottom-left': t.pointGeometry.convert(e['bottom-left'] || [0, 0]), + 'bottom-right': t.pointGeometry.convert(e['bottom-right'] || [0, 0]), + left: t.pointGeometry.convert(e.left || [0, 0]), + right: t.pointGeometry.convert(e.right || [0, 0]), + }; + } + return ya(new t.pointGeometry(0, 0)); + } + const ba = { + supported: e, + setRTLTextPlugin: t.setRTLTextPlugin, + getRTLTextPluginStatus: t.getRTLTextPluginStatus, + Map: class extends Qo { + constructor(e) { + var i; + if ( + (t.PerformanceUtils.mark(t.PerformanceMarkers.create), + null != (e = t.extend({}, aa, e)).minZoom && + null != e.maxZoom && + e.minZoom > e.maxZoom) + ) + throw new Error('maxZoom must be greater than or equal to minZoom'); + if ( + null != e.minPitch && + null != e.maxPitch && + e.minPitch > e.maxPitch + ) + throw new Error( + 'maxPitch must be greater than or equal to minPitch', + ); + if (null != e.minPitch && e.minPitch < 0) + throw new Error('minPitch must be greater than or equal to 0'); + if (null != e.maxPitch && e.maxPitch > 85) + throw new Error('maxPitch must be less than or equal to 85'); + if ( + (super( + new io( + e.minZoom, + e.maxZoom, + e.minPitch, + e.maxPitch, + e.renderWorldCopies, + ), + { bearingSnap: e.bearingSnap }, + ), + (this._interactive = e.interactive), + (this._cooperativeGestures = e.cooperativeGestures), + (this._maxTileCacheSize = e.maxTileCacheSize), + (this._failIfMajorPerformanceCaveat = + e.failIfMajorPerformanceCaveat), + (this._preserveDrawingBuffer = e.preserveDrawingBuffer), + (this._antialias = e.antialias), + (this._trackResize = e.trackResize), + (this._bearingSnap = e.bearingSnap), + (this._refreshExpiredTiles = e.refreshExpiredTiles), + (this._fadeDuration = e.fadeDuration), + (this._crossSourceCollisions = e.crossSourceCollisions), + (this._crossFadingFactor = 1), + (this._collectResourceTiming = e.collectResourceTiming), + (this._renderTaskQueue = new ia()), + (this._controls = []), + (this._mapId = t.uniqueId()), + (this._locale = t.extend({}, oa, e.locale)), + (this._clickTolerance = e.clickTolerance), + (this._pixelRatio = + null !== (i = e.pixelRatio) && void 0 !== i + ? i + : devicePixelRatio), + (this._requestManager = new s(e.transformRequest)), + 'string' == typeof e.container) + ) { + if ( + ((this._container = document.getElementById(e.container)), + !this._container) + ) + throw new Error(`Container '${e.container}' not found.`); + } else { + if (!(e.container instanceof HTMLElement)) + throw new Error( + "Invalid type: 'container' must be a String or HTMLElement.", + ); + this._container = e.container; + } + if ( + (e.maxBounds && this.setMaxBounds(e.maxBounds), + t.bindAll( + [ + '_onWindowOnline', + '_onWindowResize', + '_onMapScroll', + '_contextLost', + '_contextRestored', + ], + this, + ), + this._setupContainer(), + this._setupPainter(), + void 0 === this.painter) + ) + throw new Error('Failed to initialize WebGL.'); + this.on('move', () => this._update(!1)), + this.on('moveend', () => this._update(!1)), + this.on('zoom', () => this._update(!0)), + this.on('terrain', () => { + (this.painter.terrainFacilitator.dirty = !0), this._update(!0); + }), + 'undefined' != typeof window && + (addEventListener('online', this._onWindowOnline, !1), + addEventListener('resize', this._onWindowResize, !1), + addEventListener('orientationchange', this._onWindowResize, !1)), + (this.handlers = new Yo(this, e)), + this._cooperativeGestures && this._setupCooperativeGestures(), + (this._hash = + e.hash && + new oo(('string' == typeof e.hash && e.hash) || void 0).addTo( + this, + )), + (this._hash && this._hash._onHashChange()) || + (this.jumpTo({ + center: e.center, + zoom: e.zoom, + bearing: e.bearing, + pitch: e.pitch, + }), + e.bounds && + (this.resize(), + this.fitBounds( + e.bounds, + t.extend({}, e.fitBoundsOptions, { duration: 0 }), + ))), + this.resize(), + (this._localIdeographFontFamily = e.localIdeographFontFamily), + e.style && + this.setStyle(e.style, { + localIdeographFontFamily: e.localIdeographFontFamily, + }), + e.attributionControl && + this.addControl( + new ta({ customAttribution: e.customAttribution }), + ), + e.maplibreLogo && this.addControl(new ea(), e.logoPosition), + this.on('style.load', () => { + this.transform.unmodified && this.jumpTo(this.style.stylesheet); + }), + this.on('data', (e) => { + this._update('style' === e.dataType), + this.fire(new t.Event(`${e.dataType}data`, e)); + }), + this.on('dataloading', (e) => { + this.fire(new t.Event(`${e.dataType}dataloading`, e)); + }), + this.on('dataabort', (e) => { + this.fire(new t.Event('sourcedataabort', e)); + }); + } + _getMapId() { + return this._mapId; + } + addControl(e, i) { + if ( + (void 0 === i && + (i = e.getDefaultPosition ? e.getDefaultPosition() : 'top-right'), + !e || !e.onAdd) + ) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.', + ), + ), + ); + const o = e.onAdd(this); + this._controls.push(e); + const a = this._controlPositions[i]; + return ( + -1 !== i.indexOf('bottom') + ? a.insertBefore(o, a.firstChild) + : a.appendChild(o), + this + ); + } + removeControl(e) { + if (!e || !e.onRemove) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.', + ), + ), + ); + const i = this._controls.indexOf(e); + return i > -1 && this._controls.splice(i, 1), e.onRemove(this), this; + } + hasControl(t) { + return this._controls.indexOf(t) > -1; + } + calculateCameraOptionsFromTo(t, e, i, o) { + return ( + null == o && + this.style.terrain && + (o = this.transform.getElevation(i, this.style.terrain)), + super.calculateCameraOptionsFromTo(t, e, i, o) + ); + } + resize(e) { + const i = this._containerDimensions(), + o = i[0], + a = i[1]; + this._resizeCanvas(o, a, this.getPixelRatio()), + this.transform.resize(o, a), + this.painter.resize(o, a, this.getPixelRatio()); + const r = !this._moving; + return ( + r && + (this.stop(), + this.fire(new t.Event('movestart', e)).fire( + new t.Event('move', e), + )), + this.fire(new t.Event('resize', e)), + r && this.fire(new t.Event('moveend', e)), + this + ); + } + getPixelRatio() { + return this._pixelRatio; + } + setPixelRatio(t) { + const [e, i] = this._containerDimensions(); + (this._pixelRatio = t), + this._resizeCanvas(e, i, t), + this.painter.resize(e, i, t); + } + getBounds() { + return this.transform.getBounds(); + } + getMaxBounds() { + return this.transform.getMaxBounds(); + } + setMaxBounds(e) { + return ( + this.transform.setMaxBounds(t.LngLatBounds.convert(e)), + this._update() + ); + } + setMinZoom(t) { + if ((t = null == t ? -2 : t) >= -2 && t <= this.transform.maxZoom) + return ( + (this.transform.minZoom = t), + this._update(), + this.getZoom() < t && this.setZoom(t), + this + ); + throw new Error( + 'minZoom must be between -2 and the current maxZoom, inclusive', + ); + } + getMinZoom() { + return this.transform.minZoom; + } + setMaxZoom(t) { + if ((t = null == t ? 22 : t) >= this.transform.minZoom) + return ( + (this.transform.maxZoom = t), + this._update(), + this.getZoom() > t && this.setZoom(t), + this + ); + throw new Error('maxZoom must be greater than the current minZoom'); + } + getMaxZoom() { + return this.transform.maxZoom; + } + setMinPitch(t) { + if ((t = null == t ? 0 : t) < 0) + throw new Error('minPitch must be greater than or equal to 0'); + if (t >= 0 && t <= this.transform.maxPitch) + return ( + (this.transform.minPitch = t), + this._update(), + this.getPitch() < t && this.setPitch(t), + this + ); + throw new Error( + 'minPitch must be between 0 and the current maxPitch, inclusive', + ); + } + getMinPitch() { + return this.transform.minPitch; + } + setMaxPitch(t) { + if ((t = null == t ? 60 : 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 + ); + throw new Error('maxPitch must be greater than the current minPitch'); + } + getMaxPitch() { + return this.transform.maxPitch; + } + getRenderWorldCopies() { + return this.transform.renderWorldCopies; + } + setRenderWorldCopies(t) { + return (this.transform.renderWorldCopies = t), this._update(); + } + project(e) { + return this.transform.locationPoint( + t.LngLat.convert(e), + this.style && this.style.terrain, + ); + } + unproject(e) { + return this.transform.pointLocation( + t.pointGeometry.convert(e), + this.style && this.style.terrain, + ); + } + isMoving() { + return this._moving || this.handlers.isMoving(); + } + isZooming() { + return this._zooming || this.handlers.isZooming(); + } + isRotating() { + return this._rotating || this.handlers.isRotating(); + } + _createDelegatedListener(t, e, i) { + if ('mouseenter' === t || 'mouseover' === t) { + let o = !1; + const a = (a) => { + const r = this.getLayer(e) + ? this.queryRenderedFeatures(a.point, { layers: [e] }) + : []; + r.length + ? o || + ((o = !0), + i.call( + this, + new mo(t, this, a.originalEvent, { features: r }), + )) + : (o = !1); + }; + return { + layer: e, + listener: i, + delegates: { + mousemove: a, + mouseout: () => { + o = !1; + }, + }, + }; + } + if ('mouseleave' === t || 'mouseout' === t) { + let o = !1; + const a = (a) => { + (this.getLayer(e) + ? this.queryRenderedFeatures(a.point, { layers: [e] }) + : [] + ).length + ? (o = !0) + : o && + ((o = !1), i.call(this, new mo(t, this, a.originalEvent))); + }, + r = (e) => { + o && ((o = !1), i.call(this, new mo(t, this, e.originalEvent))); + }; + return { + layer: e, + listener: i, + delegates: { mousemove: a, mouseout: r }, + }; + } + { + const o = (t) => { + const o = this.getLayer(e) + ? this.queryRenderedFeatures(t.point, { layers: [e] }) + : []; + o.length && + ((t.features = o), i.call(this, t), delete t.features); + }; + return { layer: e, listener: i, delegates: { [t]: o } }; + } + } + on(t, e, i) { + if (void 0 === i) return super.on(t, e); + const o = this._createDelegatedListener(t, e, i); + (this._delegatedListeners = this._delegatedListeners || {}), + (this._delegatedListeners[t] = this._delegatedListeners[t] || []), + this._delegatedListeners[t].push(o); + for (const t in o.delegates) this.on(t, o.delegates[t]); + return this; + } + once(t, e, i) { + if (void 0 === i) return super.once(t, e); + const o = this._createDelegatedListener(t, e, i); + for (const t in o.delegates) this.once(t, o.delegates[t]); + return this; + } + off(t, e, i) { + return void 0 === i + ? super.off(t, e) + : (this._delegatedListeners && + this._delegatedListeners[t] && + ((o) => { + const a = this._delegatedListeners[t]; + for (let t = 0; t < a.length; t++) { + const o = a[t]; + if (o.layer === e && o.listener === i) { + for (const t in o.delegates) this.off(t, o.delegates[t]); + return a.splice(t, 1), this; + } + } + })(), + this); + } + queryRenderedFeatures(e, i) { + if (!this.style) return []; + let o; + if ( + (void 0 !== i || + void 0 === e || + e instanceof t.pointGeometry || + Array.isArray(e) || + ((i = e), (e = void 0)), + (i = i || {}), + (e = e || [ + [0, 0], + [this.transform.width, this.transform.height], + ]) instanceof t.pointGeometry || 'number' == typeof e[0]) + ) + o = [t.pointGeometry.convert(e)]; + else { + const i = t.pointGeometry.convert(e[0]), + a = t.pointGeometry.convert(e[1]); + o = [ + i, + new t.pointGeometry(a.x, i.y), + a, + new t.pointGeometry(i.x, a.y), + i, + ]; + } + return this.style.queryRenderedFeatures(o, i, this.transform); + } + querySourceFeatures(t, e) { + return this.style.querySourceFeatures(t, e); + } + setStyle(e, i) { + return !1 !== + (i = t.extend( + {}, + { localIdeographFontFamily: this._localIdeographFontFamily }, + i, + )).diff && + i.localIdeographFontFamily === this._localIdeographFontFamily && + this.style && + e + ? (this._diffStyle(e, i), this) + : ((this._localIdeographFontFamily = i.localIdeographFontFamily), + this._updateStyle(e, i)); + } + setTransformRequest(t) { + return this._requestManager.setTransformRequest(t), this; + } + _getUIString(t) { + const e = this._locale[t]; + if (null == e) throw new Error(`Missing UI string '${t}'`); + return e; + } + _updateStyle(t, e) { + return ( + this.style && + (this.style.setEventedParent(null), this.style._remove()), + t + ? ((this.style = new ee(this, e || {})), + this.style.setEventedParent(this, { style: this.style }), + 'string' == typeof t + ? this.style.loadURL(t) + : this.style.loadJSON(t), + this) + : (delete this.style, this) + ); + } + _lazyInitEmptyStyle() { + this.style || + ((this.style = new ee(this, {})), + this.style.setEventedParent(this, { style: this.style }), + this.style.loadEmpty()); + } + _diffStyle(e, i) { + if ('string' == typeof e) { + const o = this._requestManager.transformRequest( + e, + t.ResourceType.Style, + ); + t.getJSON(o, (e, o) => { + e ? this.fire(new t.ErrorEvent(e)) : o && this._updateDiff(o, i); + }); + } else 'object' == typeof e && this._updateDiff(e, i); + } + _updateDiff(e, i) { + try { + this.style.setState(e) && this._update(!0); + } catch (o) { + t.warnOnce( + `Unable to perform style diff: ${ + o.message || o.error || o + }. Rebuilding the style from scratch.`, + ), + this._updateStyle(e, i); + } + } + getStyle() { + if (this.style) return this.style.serialize(); + } + isStyleLoaded() { + return this.style + ? this.style.loaded() + : t.warnOnce('There is no style added to the map.'); + } + addSource(t, e) { + return ( + this._lazyInitEmptyStyle(), + this.style.addSource(t, e), + this._update(!0) + ); + } + isSourceLoaded(e) { + const i = this.style && this.style.sourceCaches[e]; + if (void 0 !== i) return i.loaded(); + this.fire( + new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)), + ); + } + setTerrain(t) { + return this.style.setTerrain(t), this; + } + getTerrain() { + return this.style.terrain && this.style.terrain.options; + } + areTilesLoaded() { + const t = this.style && this.style.sourceCaches; + for (const e in t) { + const i = t[e]._tiles; + for (const t in i) { + const e = i[t]; + if ('loaded' !== e.state && 'errored' !== e.state) return !1; + } + } + return !0; + } + addSourceType(t, e, i) { + return this._lazyInitEmptyStyle(), this.style.addSourceType(t, e, i); + } + removeSource(t) { + return this.style.removeSource(t), this._update(!0); + } + getSource(t) { + return this.style.getSource(t); + } + addImage( + e, + i, + { + pixelRatio: o = 1, + sdf: a = !1, + stretchX: r, + stretchY: s, + content: n, + } = {}, + ) { + if ( + (this._lazyInitEmptyStyle(), + i instanceof HTMLImageElement || t.isImageBitmap(i)) + ) { + const { width: l, height: c, data: h } = t.exported.getImageData(i); + this.style.addImage(e, { + data: new t.RGBAImage({ width: l, height: c }, h), + pixelRatio: o, + stretchX: r, + stretchY: s, + content: n, + sdf: a, + version: 0, + }); + } else { + if (void 0 === i.width || void 0 === i.height) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`', + ), + ), + ); + { + const { width: l, height: c, data: h } = i, + u = i; + this.style.addImage(e, { + data: new t.RGBAImage( + { width: l, height: c }, + new Uint8Array(h), + ), + pixelRatio: o, + stretchX: r, + stretchY: s, + content: n, + sdf: a, + version: 0, + userImage: u, + }), + u.onAdd && u.onAdd(this, e); + } + } + } + updateImage(e, i) { + const o = this.style.getImage(e); + if (!o) + return this.fire( + new t.ErrorEvent( + new Error( + 'The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.', + ), + ), + ); + const a = + i instanceof HTMLImageElement || t.isImageBitmap(i) + ? t.exported.getImageData(i) + : i, + { width: r, height: s, data: n } = a; + if (void 0 === r || void 0 === s) + return this.fire( + new t.ErrorEvent( + new Error( + 'Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`', + ), + ), + ); + if (r !== o.data.width || s !== o.data.height) + return this.fire( + new t.ErrorEvent( + new Error( + 'The width and height of the updated image must be that same as the previous version of the image', + ), + ), + ); + const l = !(i instanceof HTMLImageElement || t.isImageBitmap(i)); + o.data.replace(n, l), this.style.updateImage(e, o); + } + hasImage(e) { + return e + ? !!this.style.getImage(e) + : (this.fire( + new t.ErrorEvent(new Error('Missing required image id')), + ), + !1); + } + removeImage(t) { + this.style.removeImage(t); + } + loadImage(e, i) { + t.getImage( + this._requestManager.transformRequest(e, t.ResourceType.Image), + i, + ); + } + listImages() { + return this.style.listImages(); + } + addLayer(t, e) { + return ( + this._lazyInitEmptyStyle(), + this.style.addLayer(t, e), + this._update(!0) + ); + } + moveLayer(t, e) { + return this.style.moveLayer(t, e), this._update(!0); + } + removeLayer(t) { + return this.style.removeLayer(t), this._update(!0); + } + getLayer(t) { + return this.style.getLayer(t); + } + setLayerZoomRange(t, e, i) { + return this.style.setLayerZoomRange(t, e, i), this._update(!0); + } + setFilter(t, e, i = {}) { + return this.style.setFilter(t, e, i), this._update(!0); + } + getFilter(t) { + return this.style.getFilter(t); + } + setPaintProperty(t, e, i, o = {}) { + return this.style.setPaintProperty(t, e, i, o), this._update(!0); + } + getPaintProperty(t, e) { + return this.style.getPaintProperty(t, e); + } + setLayoutProperty(t, e, i, o = {}) { + return this.style.setLayoutProperty(t, e, i, o), this._update(!0); + } + getLayoutProperty(t, e) { + return this.style.getLayoutProperty(t, e); + } + setLight(t, e = {}) { + return ( + this._lazyInitEmptyStyle(), + this.style.setLight(t, e), + this._update(!0) + ); + } + getLight() { + return this.style.getLight(); + } + setFeatureState(t, e) { + return this.style.setFeatureState(t, e), this._update(); + } + removeFeatureState(t, e) { + return this.style.removeFeatureState(t, e), this._update(); + } + getFeatureState(t) { + return this.style.getFeatureState(t); + } + getContainer() { + return this._container; + } + getCanvasContainer() { + return this._canvasContainer; + } + getCanvas() { + return this._canvas; + } + _containerDimensions() { + let t = 0, + e = 0; + return ( + this._container && + ((t = this._container.clientWidth || 400), + (e = this._container.clientHeight || 300)), + [t, e] + ); + } + _setupContainer() { + const t = this._container; + t.classList.add('maplibregl-map', 'mapboxgl-map'); + const e = (this._canvasContainer = r.create( + 'div', + 'maplibregl-canvas-container mapboxgl-canvas-container', + t, + )); + this._interactive && + e.classList.add('maplibregl-interactive', 'mapboxgl-interactive'), + (this._canvas = r.create( + 'canvas', + 'maplibregl-canvas mapboxgl-canvas', + e, + )), + this._canvas.addEventListener( + 'webglcontextlost', + this._contextLost, + !1, + ), + this._canvas.addEventListener( + 'webglcontextrestored', + this._contextRestored, + !1, + ), + this._canvas.setAttribute('tabindex', '0'), + this._canvas.setAttribute('aria-label', 'Map'), + this._canvas.setAttribute('role', 'region'); + const i = this._containerDimensions(); + this._resizeCanvas(i[0], i[1], this.getPixelRatio()); + const o = (this._controlContainer = r.create( + 'div', + 'maplibregl-control-container mapboxgl-control-container', + t, + )), + a = (this._controlPositions = {}); + ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach( + (t) => { + a[t] = r.create( + 'div', + `maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`, + o, + ); + }, + ), + this._container.addEventListener('scroll', this._onMapScroll, !1); + } + _setupCooperativeGestures() { + const t = this._container; + (this._metaPress = !1), + (this._cooperativeGesturesScreen = r.create( + 'div', + 'maplibregl-cooperative-gesture-screen', + t, + )); + let e = 'Control', + i = + 'boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.windowsHelpText + ? this._cooperativeGestures.windowsHelpText + : 'Use Ctrl + scroll to zoom the map'; + 0 === navigator.platform.indexOf('Mac') && + ((i = + 'boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.macHelpText + ? this._cooperativeGestures.macHelpText + : 'Use ⌘ + scroll to zoom the map'), + (e = 'Meta')), + (this._cooperativeGesturesScreen.innerHTML = `\n
${i}
\n
${ + 'boolean' != typeof this._cooperativeGestures && + this._cooperativeGestures.mobileHelpText + ? this._cooperativeGestures.mobileHelpText + : 'Use two fingers to move the map' + }
\n `), + document.addEventListener('keydown', (t) => { + t.key === e && (this._metaPress = !0); + }), + document.addEventListener('keyup', (t) => { + t.key === e && (this._metaPress = !1); + }), + this._canvasContainer.addEventListener( + 'wheel', + (t) => { + this._onCooperativeGesture(t, this._metaPress, 1); + }, + !1, + ), + this._canvasContainer.classList.remove( + 'mapboxgl-touch-drag-pan', + 'maplibregl-touch-drag-pan', + ); + } + _resizeCanvas(t, e, i) { + (this._canvas.width = i * t), + (this._canvas.height = i * e), + (this._canvas.style.width = `${t}px`), + (this._canvas.style.height = `${e}px`); + } + _setupPainter() { + const i = t.extend({}, e.webGLContextAttributes, { + failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, + preserveDrawingBuffer: this._preserveDrawingBuffer, + antialias: this._antialias || !1, + }), + o = + this._canvas.getContext('webgl', i) || + this._canvas.getContext('experimental-webgl', i); + o + ? ((this.painter = new Ji(o, this.transform)), + t.exported$1.testSupport(o)) + : this.fire( + new t.ErrorEvent(new Error('Failed to initialize WebGL')), + ); + } + _contextLost(e) { + e.preventDefault(), + this._frame && (this._frame.cancel(), (this._frame = null)), + this.fire(new t.Event('webglcontextlost', { originalEvent: e })); + } + _contextRestored(e) { + this._setupPainter(), + this.resize(), + this._update(), + this.fire( + new t.Event('webglcontextrestored', { originalEvent: e }), + ); + } + _onMapScroll(t) { + if (t.target === this._container) + return ( + (this._container.scrollTop = 0), + (this._container.scrollLeft = 0), + !1 + ); + } + _onCooperativeGesture(t, e, i) { + return ( + !e && + i < 2 && + (this._cooperativeGesturesScreen.classList.add('maplibregl-show'), + setTimeout(() => { + this._cooperativeGesturesScreen.classList.remove( + 'maplibregl-show', + ); + }, 100)), + !1 + ); + } + loaded() { + return ( + !this._styleDirty && + !this._sourcesDirty && + !!this.style && + this.style.loaded() + ); + } + _update(t) { + return this.style + ? ((this._styleDirty = this._styleDirty || t), + (this._sourcesDirty = !0), + this.triggerRepaint(), + this) + : this; + } + _requestRenderFrame(t) { + return this._update(), this._renderTaskQueue.add(t); + } + _cancelRenderFrame(t) { + this._renderTaskQueue.remove(t); + } + _render(e) { + let i, + o = 0; + const a = this.painter.context.extTimerQuery; + if ( + (this.listens('gpu-timing-frame') && + ((i = a.createQueryEXT()), + a.beginQueryEXT(a.TIME_ELAPSED_EXT, i), + (o = t.exported.now())), + this.painter.context.setDirty(), + this.painter.setBaseState(), + this._renderTaskQueue.run(e), + this._removed) + ) + return; + let r = !1; + if (this.style && this._styleDirty) { + this._styleDirty = !1; + const e = this.transform.zoom, + i = t.exported.now(); + this.style.zoomHistory.update(e, i); + const o = new t.EvaluationParameters(e, { + now: i, + fadeDuration: this._fadeDuration, + zoomHistory: this.style.zoomHistory, + transition: this.style.getTransition(), + }), + a = o.crossFadingFactor(); + (1 === a && a === this._crossFadingFactor) || + ((r = !0), (this._crossFadingFactor = a)), + this.style.update(o); + } + if ( + (this.style && + this._sourcesDirty && + ((this._sourcesDirty = !1), + this.style._updateSources(this.transform)), + this.style.terrain && + this.style.terrain.sourceCache.update( + this.transform, + this.style.terrain, + ), + this.transform.updateElevation(this.style.terrain), + (this._placementDirty = + this.style && + this.style._updatePlacement( + this.painter.transform, + this.showCollisionBoxes, + this._fadeDuration, + this._crossSourceCollisions, + )), + this.painter.render(this.style, { + showTileBoundaries: this.showTileBoundaries, + showOverdrawInspector: this._showOverdrawInspector, + rotating: this.isRotating(), + zooming: this.isZooming(), + moving: this.isMoving(), + fadeDuration: this._fadeDuration, + showPadding: this.showPadding, + gpuTiming: !!this.listens('gpu-timing-layer'), + }), + this.fire(new t.Event('render')), + this.loaded() && + !this._loaded && + ((this._loaded = !0), + t.PerformanceUtils.mark(t.PerformanceMarkers.load), + this.fire(new t.Event('load'))), + this.style && + (this.style.hasTransitions() || r) && + (this._styleDirty = !0), + this.style && + !this._placementDirty && + this.style._releaseSymbolFadeTiles(), + this.listens('gpu-timing-frame')) + ) { + const e = t.exported.now() - o; + a.endQueryEXT(a.TIME_ELAPSED_EXT, i), + setTimeout(() => { + const o = a.getQueryObjectEXT(i, a.QUERY_RESULT_EXT) / 1e6; + a.deleteQueryEXT(i), + this.fire( + new t.Event('gpu-timing-frame', { cpuTime: e, gpuTime: o }), + ); + }, 50); + } + if (this.listens('gpu-timing-layer')) { + const e = this.painter.collectGpuTimers(); + setTimeout(() => { + const i = this.painter.queryGpuTimers(e); + this.fire(new t.Event('gpu-timing-layer', { layerTimes: i })); + }, 50); + } + const s = + this._sourcesDirty || this._styleDirty || this._placementDirty; + return ( + s || this._repaint + ? this.triggerRepaint() + : !this.isMoving() && + this.loaded() && + this.fire(new t.Event('idle')), + !this._loaded || + this._fullyLoaded || + s || + ((this._fullyLoaded = !0), + t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)), + this + ); + } + redraw() { + return ( + this.style && + (this._frame && (this._frame.cancel(), (this._frame = null)), + this._render(0)), + this + ); + } + remove() { + this._hash && this._hash.remove(); + for (const t of this._controls) t.onRemove(this); + (this._controls = []), + this._frame && (this._frame.cancel(), (this._frame = null)), + this._renderTaskQueue.clear(), + this.painter.destroy(), + this.handlers.destroy(), + delete this.handlers, + this.setStyle(null), + 'undefined' != typeof window && + (removeEventListener('resize', this._onWindowResize, !1), + removeEventListener( + 'orientationchange', + this._onWindowResize, + !1, + ), + removeEventListener('online', this._onWindowOnline, !1)); + const e = this.painter.context.gl.getExtension('WEBGL_lose_context'); + e && e.loseContext(), + this._canvas.removeEventListener( + 'webglcontextrestored', + this._contextRestored, + !1, + ), + this._canvas.removeEventListener( + 'webglcontextlost', + this._contextLost, + !1, + ), + r.remove(this._canvasContainer), + r.remove(this._controlContainer), + this._cooperativeGestures && + r.remove(this._cooperativeGesturesScreen), + this._container.classList.remove('maplibregl-map', 'mapboxgl-map'), + t.PerformanceUtils.clearMetrics(), + (this._removed = !0), + this.fire(new t.Event('remove')); + } + triggerRepaint() { + this.style && + !this._frame && + (this._frame = t.exported.frame((e) => { + t.PerformanceUtils.frame(e), + (this._frame = null), + this._render(e); + })); + } + _onWindowOnline() { + this._update(); + } + _onWindowResize(t) { + this._trackResize && this.resize({ originalEvent: t })._update(); + } + get showTileBoundaries() { + return !!this._showTileBoundaries; + } + set showTileBoundaries(t) { + this._showTileBoundaries !== t && + ((this._showTileBoundaries = t), this._update()); + } + get showPadding() { + return !!this._showPadding; + } + set showPadding(t) { + this._showPadding !== t && ((this._showPadding = t), this._update()); + } + get showCollisionBoxes() { + return !!this._showCollisionBoxes; + } + set showCollisionBoxes(t) { + this._showCollisionBoxes !== t && + ((this._showCollisionBoxes = t), + t ? this.style._generateCollisionBoxes() : this._update()); + } + get showOverdrawInspector() { + return !!this._showOverdrawInspector; + } + set showOverdrawInspector(t) { + this._showOverdrawInspector !== t && + ((this._showOverdrawInspector = t), this._update()); + } + get repaint() { + return !!this._repaint; + } + set repaint(t) { + this._repaint !== t && ((this._repaint = t), this.triggerRepaint()); + } + get vertices() { + return !!this._vertices; + } + set vertices(t) { + (this._vertices = t), this._update(); + } + _setCacheLimits(e, i) { + t.setCacheLimits(e, i); + } + get version() { + return '2.4.0'; + } + }, + NavigationControl: class { + constructor(e) { + (this.options = t.extend({}, ra, e)), + (this._container = r.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + this._container.addEventListener('contextmenu', (t) => + t.preventDefault(), + ), + this.options.showZoom && + (t.bindAll(['_setButtonTitle', '_updateZoomButtons'], this), + (this._zoomInButton = this._createButton( + 'maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in', + (t) => this._map.zoomIn({}, { originalEvent: t }), + )), + r + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._zoomInButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._zoomOutButton = this._createButton( + 'maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out', + (t) => this._map.zoomOut({}, { originalEvent: t }), + )), + r + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._zoomOutButton, + ) + .setAttribute('aria-hidden', 'true')), + this.options.showCompass && + (t.bindAll(['_rotateCompassArrow'], this), + (this._compass = this._createButton( + 'maplibregl-ctrl-compass mapboxgl-ctrl-compass', + (t) => { + this.options.visualizePitch + ? this._map.resetNorthPitch({}, { originalEvent: t }) + : this._map.resetNorth({}, { originalEvent: t }); + }, + )), + (this._compassIcon = r.create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._compass, + )), + this._compassIcon.setAttribute('aria-hidden', 'true')); + } + _updateZoomButtons() { + const t = this._map.getZoom(), + e = t === this._map.getMaxZoom(), + i = t === this._map.getMinZoom(); + (this._zoomInButton.disabled = e), + (this._zoomOutButton.disabled = i), + this._zoomInButton.setAttribute('aria-disabled', e.toString()), + this._zoomOutButton.setAttribute('aria-disabled', i.toString()); + } + _rotateCompassArrow() { + const t = this.options.visualizePitch + ? `scale(${ + 1 / + Math.pow( + Math.cos(this._map.transform.pitch * (Math.PI / 180)), + 0.5, + ) + }) rotateX(${this._map.transform.pitch}deg) rotateZ(${ + this._map.transform.angle * (180 / Math.PI) + }deg)` + : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`; + this._compassIcon.style.transform = t; + } + onAdd(t) { + return ( + (this._map = t), + this.options.showZoom && + (this._setButtonTitle(this._zoomInButton, 'ZoomIn'), + this._setButtonTitle(this._zoomOutButton, 'ZoomOut'), + this._map.on('zoom', this._updateZoomButtons), + this._updateZoomButtons()), + this.options.showCompass && + (this._setButtonTitle(this._compass, 'ResetBearing'), + this.options.visualizePitch && + this._map.on('pitch', this._rotateCompassArrow), + this._map.on('rotate', this._rotateCompassArrow), + this._rotateCompassArrow(), + (this._handler = new sa( + this._map, + this._compass, + this.options.visualizePitch, + ))), + this._container + ); + } + onRemove() { + r.remove(this._container), + this.options.showZoom && + this._map.off('zoom', this._updateZoomButtons), + this.options.showCompass && + (this.options.visualizePitch && + this._map.off('pitch', this._rotateCompassArrow), + this._map.off('rotate', this._rotateCompassArrow), + this._handler.off(), + delete this._handler), + delete this._map; + } + _createButton(t, e) { + const i = r.create('button', t, this._container); + return (i.type = 'button'), i.addEventListener('click', e), i; + } + _setButtonTitle(t, e) { + const i = this._map._getUIString(`NavigationControl.${e}`); + (t.title = i), t.setAttribute('aria-label', i); + } + }, + GeolocateControl: class extends t.Evented { + constructor(e) { + super(), + (this.options = t.extend({}, ua, e)), + t.bindAll( + [ + '_onSuccess', + '_onError', + '_onZoom', + '_finish', + '_setupUI', + '_updateCamera', + '_updateMarker', + ], + this, + ); + } + onAdd(t) { + var e; + return ( + (this._map = t), + (this._container = r.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + (e = this._setupUI), + void 0 !== da + ? e(da) + : void 0 !== window.navigator.permissions + ? window.navigator.permissions + .query({ name: 'geolocation' }) + .then((t) => { + (da = 'denied' !== t.state), e(da); + }) + : ((da = !!window.navigator.geolocation), e(da)), + this._container + ); + } + onRemove() { + void 0 !== this._geolocationWatchID && + (window.navigator.geolocation.clearWatch(this._geolocationWatchID), + (this._geolocationWatchID = void 0)), + this.options.showUserLocation && + this._userLocationDotMarker && + this._userLocationDotMarker.remove(), + this.options.showAccuracyCircle && + this._accuracyCircleMarker && + this._accuracyCircleMarker.remove(), + r.remove(this._container), + this._map.off('zoom', this._onZoom), + (this._map = void 0), + (ma = 0), + (_a = !1); + } + _isOutOfMapMaxBounds(t) { + const e = this._map.getMaxBounds(), + i = t.coords; + return ( + e && + (i.longitude < e.getWest() || + i.longitude > e.getEast() || + i.latitude < e.getSouth() || + i.latitude > e.getNorth()) + ); + } + _setErrorState() { + switch (this._watchState) { + case 'WAITING_ACTIVE': + (this._watchState = 'ACTIVE_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ); + break; + case 'ACTIVE_LOCK': + (this._watchState = 'ACTIVE_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ); + break; + case 'BACKGROUND': + (this._watchState = 'BACKGROUND_ERROR'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ); + break; + case 'ACTIVE_ERROR': + break; + default: + throw new Error(`Unexpected watchState ${this._watchState}`); + } + } + _onSuccess(e) { + if (this._map) { + if (this._isOutOfMapMaxBounds(e)) + return ( + this._setErrorState(), + this.fire(new t.Event('outofmaxbounds', e)), + this._updateMarker(), + void this._finish() + ); + if (this.options.trackUserLocation) + switch (((this._lastKnownPosition = e), this._watchState)) { + case 'WAITING_ACTIVE': + case 'ACTIVE_LOCK': + case 'ACTIVE_ERROR': + (this._watchState = 'ACTIVE_LOCK'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'BACKGROUND': + case 'BACKGROUND_ERROR': + (this._watchState = 'BACKGROUND'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ); + break; + default: + throw new Error(`Unexpected watchState ${this._watchState}`); + } + this.options.showUserLocation && + 'OFF' !== this._watchState && + this._updateMarker(e), + (this.options.trackUserLocation && + 'ACTIVE_LOCK' !== this._watchState) || + this._updateCamera(e), + this.options.showUserLocation && + this._dotElement.classList.remove( + 'maplibregl-user-location-dot-stale', + 'mapboxgl-user-location-dot-stale', + ), + this.fire(new t.Event('geolocate', e)), + this._finish(); + } + } + _updateCamera(e) { + const i = new t.LngLat(e.coords.longitude, e.coords.latitude), + o = e.coords.accuracy, + a = this._map.getBearing(), + r = t.extend({ bearing: a }, this.options.fitBoundsOptions); + this._map.fitBounds(i.toBounds(o), r, { geolocateSource: !0 }); + } + _updateMarker(e) { + if (e) { + const i = new t.LngLat(e.coords.longitude, e.coords.latitude); + this._accuracyCircleMarker.setLngLat(i).addTo(this._map), + this._userLocationDotMarker.setLngLat(i).addTo(this._map), + (this._accuracy = e.coords.accuracy), + this.options.showUserLocation && + this.options.showAccuracyCircle && + this._updateCircleRadius(); + } else + this._userLocationDotMarker.remove(), + this._accuracyCircleMarker.remove(); + } + _updateCircleRadius() { + const t = this._map._container.clientHeight / 2, + e = this._map.unproject([0, t]), + i = this._map.unproject([1, t]), + o = e.distanceTo(i), + a = Math.ceil((2 * this._accuracy) / o); + (this._circleElement.style.width = `${a}px`), + (this._circleElement.style.height = `${a}px`); + } + _onZoom() { + this.options.showUserLocation && + this.options.showAccuracyCircle && + this._updateCircleRadius(); + } + _onError(e) { + if (this._map) { + if (this.options.trackUserLocation) + if (1 === e.code) { + (this._watchState = 'OFF'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + (this._geolocateButton.disabled = !0); + const t = this._map._getUIString( + 'GeolocateControl.LocationNotAvailable', + ); + (this._geolocateButton.title = t), + this._geolocateButton.setAttribute('aria-label', t), + void 0 !== this._geolocationWatchID && this._clearWatch(); + } else { + if (3 === e.code && _a) return; + this._setErrorState(); + } + 'OFF' !== this._watchState && + this.options.showUserLocation && + this._dotElement.classList.add( + 'maplibregl-user-location-dot-stale', + 'mapboxgl-user-location-dot-stale', + ), + this.fire(new t.Event('error', e)), + this._finish(); + } + } + _finish() { + this._timeoutId && clearTimeout(this._timeoutId), + (this._timeoutId = void 0); + } + _setupUI(e) { + if ( + (this._container.addEventListener('contextmenu', (t) => + t.preventDefault(), + ), + (this._geolocateButton = r.create( + 'button', + 'maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate', + this._container, + )), + r + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._geolocateButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._geolocateButton.type = 'button'), + !1 === e) + ) { + t.warnOnce( + 'Geolocation support is not available so the GeolocateControl will be disabled.', + ); + const e = this._map._getUIString( + 'GeolocateControl.LocationNotAvailable', + ); + (this._geolocateButton.disabled = !0), + (this._geolocateButton.title = e), + this._geolocateButton.setAttribute('aria-label', e); + } else { + const t = this._map._getUIString('GeolocateControl.FindMyLocation'); + (this._geolocateButton.title = t), + this._geolocateButton.setAttribute('aria-label', t); + } + this.options.trackUserLocation && + (this._geolocateButton.setAttribute('aria-pressed', 'false'), + (this._watchState = 'OFF')), + this.options.showUserLocation && + ((this._dotElement = r.create( + 'div', + 'maplibregl-user-location-dot mapboxgl-user-location-dot', + )), + (this._userLocationDotMarker = new ha(this._dotElement)), + (this._circleElement = r.create( + 'div', + 'maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle', + )), + (this._accuracyCircleMarker = new ha({ + 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', (e) => { + e.geolocateSource || + 'ACTIVE_LOCK' !== this._watchState || + (e.originalEvent && 'resize' === e.originalEvent.type) || + ((this._watchState = 'BACKGROUND'), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this.fire(new t.Event('trackuserlocationend'))); + }); + } + trigger() { + if (!this._setup) + return ( + t.warnOnce('Geolocate control triggered before added to a map'), + !1 + ); + if (this.options.trackUserLocation) { + switch (this._watchState) { + case 'OFF': + (this._watchState = 'WAITING_ACTIVE'), + this.fire(new t.Event('trackuserlocationstart')); + break; + case 'WAITING_ACTIVE': + case 'ACTIVE_LOCK': + case 'ACTIVE_ERROR': + case 'BACKGROUND_ERROR': + ma--, + (_a = !1), + (this._watchState = 'OFF'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-active-error', + 'mapboxgl-ctrl-geolocate-active-error', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background-error', + 'mapboxgl-ctrl-geolocate-background-error', + ), + this.fire(new t.Event('trackuserlocationend')); + break; + case 'BACKGROUND': + (this._watchState = 'ACTIVE_LOCK'), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-background', + 'mapboxgl-ctrl-geolocate-background', + ), + this._lastKnownPosition && + this._updateCamera(this._lastKnownPosition), + this.fire(new t.Event('trackuserlocationstart')); + break; + default: + throw new Error(`Unexpected watchState ${this._watchState}`); + } + switch (this._watchState) { + case 'WAITING_ACTIVE': + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'ACTIVE_LOCK': + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-active', + 'mapboxgl-ctrl-geolocate-active', + ); + break; + case 'OFF': + break; + default: + throw new Error(`Unexpected watchState ${this._watchState}`); + } + if ( + 'OFF' === this._watchState && + void 0 !== this._geolocationWatchID + ) + this._clearWatch(); + else if (void 0 === this._geolocationWatchID) { + let t; + this._geolocateButton.classList.add( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.setAttribute('aria-pressed', 'true'), + ma++, + ma > 1 + ? ((t = { maximumAge: 6e5, timeout: 0 }), (_a = !0)) + : ((t = this.options.positionOptions), (_a = !1)), + (this._geolocationWatchID = + window.navigator.geolocation.watchPosition( + this._onSuccess, + this._onError, + t, + )); + } + } else + window.navigator.geolocation.getCurrentPosition( + this._onSuccess, + this._onError, + this.options.positionOptions, + ), + (this._timeoutId = setTimeout(this._finish, 1e4)); + return !0; + } + _clearWatch() { + window.navigator.geolocation.clearWatch(this._geolocationWatchID), + (this._geolocationWatchID = void 0), + this._geolocateButton.classList.remove( + 'maplibregl-ctrl-geolocate-waiting', + 'mapboxgl-ctrl-geolocate-waiting', + ), + this._geolocateButton.setAttribute('aria-pressed', 'false'), + this.options.showUserLocation && this._updateMarker(null); + } + }, + AttributionControl: ta, + LogoControl: ea, + ScaleControl: class { + constructor(e) { + (this.options = t.extend({}, pa, e)), + t.bindAll(['_onMove', 'setUnit'], this); + } + getDefaultPosition() { + return 'bottom-left'; + } + _onMove() { + fa(this._map, this._container, this.options); + } + onAdd(t) { + return ( + (this._map = t), + (this._container = r.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale', + t.getContainer(), + )), + this._map.on('move', this._onMove), + this._onMove(), + this._container + ); + } + onRemove() { + r.remove(this._container), + this._map.off('move', this._onMove), + (this._map = void 0); + } + setUnit(t) { + (this.options.unit = t), fa(this._map, this._container, this.options); + } + }, + FullscreenControl: class { + constructor(e) { + (this._fullscreen = !1), + e && + e.container && + (e.container instanceof HTMLElement + ? (this._container = e.container) + : t.warnOnce( + "Full screen control 'container' must be a DOM element.", + )), + t.bindAll(['_onClickFullscreen', '_changeIcon'], this), + 'onfullscreenchange' in document + ? (this._fullscreenchange = 'fullscreenchange') + : 'onmozfullscreenchange' in document + ? (this._fullscreenchange = 'mozfullscreenchange') + : 'onwebkitfullscreenchange' in document + ? (this._fullscreenchange = 'webkitfullscreenchange') + : 'onmsfullscreenchange' in document && + (this._fullscreenchange = 'MSFullscreenChange'); + } + onAdd(e) { + return ( + (this._map = e), + this._container || (this._container = this._map.getContainer()), + (this._controlContainer = r.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + this._checkFullscreenSupport() + ? this._setupUI() + : ((this._controlContainer.style.display = 'none'), + t.warnOnce('This device does not support fullscreen mode.')), + this._controlContainer + ); + } + onRemove() { + r.remove(this._controlContainer), + (this._map = null), + window.document.removeEventListener( + this._fullscreenchange, + this._changeIcon, + ); + } + _checkFullscreenSupport() { + return !!( + document.fullscreenEnabled || + document.mozFullScreenEnabled || + document.msFullscreenEnabled || + document.webkitFullscreenEnabled + ); + } + _setupUI() { + const t = (this._fullscreenButton = r.create( + 'button', + 'maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen', + this._controlContainer, + )); + r + .create('span', 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', t) + .setAttribute('aria-hidden', 'true'), + (t.type = 'button'), + this._updateTitle(), + this._fullscreenButton.addEventListener( + 'click', + this._onClickFullscreen, + ), + window.document.addEventListener( + this._fullscreenchange, + this._changeIcon, + ); + } + _updateTitle() { + const t = this._getTitle(); + this._fullscreenButton.setAttribute('aria-label', t), + (this._fullscreenButton.title = t); + } + _getTitle() { + return this._map._getUIString( + this._isFullscreen() + ? 'FullscreenControl.Exit' + : 'FullscreenControl.Enter', + ); + } + _isFullscreen() { + return this._fullscreen; + } + _changeIcon() { + ((window.document.fullscreenElement || + window.document.mozFullScreenElement || + window.document.webkitFullscreenElement || + window.document.msFullscreenElement) === + this._container) !== + this._fullscreen && + ((this._fullscreen = !this._fullscreen), + this._fullscreenButton.classList.toggle('maplibregl-ctrl-shrink'), + this._fullscreenButton.classList.toggle('mapboxgl-ctrl-shrink'), + this._fullscreenButton.classList.toggle( + 'maplibregl-ctrl-fullscreen', + ), + this._fullscreenButton.classList.toggle('mapboxgl-ctrl-fullscreen'), + this._updateTitle()); + } + _onClickFullscreen() { + this._isFullscreen() + ? window.document.exitFullscreen + ? window.document.exitFullscreen() + : window.document.mozCancelFullScreen + ? window.document.mozCancelFullScreen() + : window.document.msExitFullscreen + ? window.document.msExitFullscreen() + : window.document.webkitCancelFullScreen && + window.document.webkitCancelFullScreen() + : this._container.requestFullscreen + ? this._container.requestFullscreen() + : this._container.mozRequestFullScreen + ? this._container.mozRequestFullScreen() + : this._container.msRequestFullscreen + ? this._container.msRequestFullscreen() + : this._container.webkitRequestFullscreen && + this._container.webkitRequestFullscreen(); + } + }, + TerrainControl: class { + constructor(e) { + (this.options = e), + t.bindAll(['_toggleTerrain', '_updateTerrainIcon'], this); + } + onAdd(t) { + return ( + (this._map = t), + (this._container = r.create( + 'div', + 'maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group', + )), + (this._terrainButton = r.create( + 'button', + 'maplibregl-ctrl-terrain mapboxgl-ctrl-terrain', + this._container, + )), + r + .create( + 'span', + 'maplibregl-ctrl-icon mapboxgl-ctrl-icon', + this._terrainButton, + ) + .setAttribute('aria-hidden', 'true'), + (this._terrainButton.type = 'button'), + this._terrainButton.addEventListener('click', this._toggleTerrain), + this._updateTerrainIcon(), + this._map.on('terrain', this._updateTerrainIcon), + this._container + ); + } + onRemove() { + r.remove(this._container), + this._map.off('terrain', this._updateTerrainIcon), + (this._map = void 0); + } + _toggleTerrain() { + this._map.getTerrain() + ? this._map.setTerrain(null) + : this._map.setTerrain(this.options), + this._updateTerrainIcon(); + } + _updateTerrainIcon() { + this._terrainButton.classList.remove( + 'maplibregl-ctrl-terrain', + 'mapboxgl-ctrl-terrain', + ), + this._terrainButton.classList.remove( + 'maplibregl-ctrl-terrain-enabled', + 'mapboxgl-ctrl-terrain-enabled', + ), + this._map.style.terrain + ? (this._terrainButton.classList.add( + 'maplibregl-ctrl-terrain-enabled', + 'mapboxgl-ctrl-terrain-enabled', + ), + (this._terrainButton.title = this._map._getUIString( + 'TerrainControl.disableTerrain', + ))) + : (this._terrainButton.classList.add( + 'maplibregl-ctrl-terrain', + 'mapboxgl-ctrl-terrain', + ), + (this._terrainButton.title = this._map._getUIString( + 'TerrainControl.enableTerrain', + ))); + } + }, + Popup: class extends t.Evented { + constructor(e) { + super(), + (this.options = t.extend(Object.create(xa), e)), + t.bindAll( + [ + '_update', + '_onClose', + 'remove', + '_onMouseMove', + '_onMouseUp', + '_onDrag', + ], + this, + ); + } + addTo(e) { + return ( + this._map && this.remove(), + (this._map = e), + this.options.closeOnClick && this._map.on('click', this._onClose), + this.options.closeOnMove && this._map.on('move', this._onClose), + this._map.on('remove', this.remove), + this._update(), + this._focusFirstElement(), + this._trackPointer + ? (this._map.on('mousemove', this._onMouseMove), + this._map.on('mouseup', this._onMouseUp), + this._container && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.add( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )) + : this._map.on('move', this._update), + this.fire(new t.Event('open')), + this + ); + } + isOpen() { + return !!this._map; + } + remove() { + return ( + this._content && r.remove(this._content), + this._container && + (r.remove(this._container), delete this._container), + this._map && + (this._map.off('move', this._update), + this._map.off('move', this._onClose), + this._map.off('click', this._onClose), + this._map.off('remove', this.remove), + this._map.off('mousemove', this._onMouseMove), + this._map.off('mouseup', this._onMouseUp), + this._map.off('drag', this._onDrag), + delete this._map), + this.fire(new t.Event('close')), + this + ); + } + getLngLat() { + return this._lngLat; + } + setLngLat(e) { + return ( + (this._lngLat = t.LngLat.convert(e)), + (this._pos = null), + (this._trackPointer = !1), + this._update(), + this._map && + (this._map.on('move', this._update), + this._map.off('mousemove', this._onMouseMove), + this._container && + this._container.classList.remove( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.remove( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )), + this + ); + } + trackPointer() { + return ( + (this._trackPointer = !0), + (this._pos = null), + this._update(), + this._map && + (this._map.off('move', this._update), + this._map.on('mousemove', this._onMouseMove), + this._map.on('drag', this._onDrag), + this._container && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + ), + this._map._canvasContainer.classList.add( + 'maplibregl-track-pointer', + 'mapboxgl-track-pointer', + )), + this + ); + } + getElement() { + return this._container; + } + setText(t) { + return this.setDOMContent(document.createTextNode(t)); + } + setHTML(t) { + const e = document.createDocumentFragment(), + i = document.createElement('body'); + let o; + for (i.innerHTML = t; (o = i.firstChild), o; ) e.appendChild(o); + return this.setDOMContent(e); + } + getMaxWidth() { + return this._container && this._container.style.maxWidth; + } + setMaxWidth(t) { + return (this.options.maxWidth = t), this._update(), this; + } + setDOMContent(t) { + if (this._content) + for (; this._content.hasChildNodes(); ) + this._content.firstChild && + this._content.removeChild(this._content.firstChild); + else + this._content = r.create( + 'div', + 'maplibregl-popup-content mapboxgl-popup-content', + this._container, + ); + return ( + this._content.appendChild(t), + this._createCloseButton(), + this._update(), + this._focusFirstElement(), + this + ); + } + addClassName(t) { + this._container && this._container.classList.add(t); + } + removeClassName(t) { + this._container && this._container.classList.remove(t); + } + setOffset(t) { + return (this.options.offset = t), this._update(), this; + } + toggleClassName(t) { + if (this._container) return this._container.classList.toggle(t); + } + _createCloseButton() { + this.options.closeButton && + ((this._closeButton = r.create( + 'button', + 'maplibregl-popup-close-button mapboxgl-popup-close-button', + this._content, + )), + (this._closeButton.type = 'button'), + this._closeButton.setAttribute('aria-label', 'Close popup'), + (this._closeButton.innerHTML = '×'), + this._closeButton.addEventListener('click', this._onClose)); + } + _onMouseUp(t) { + this._update(t.point); + } + _onMouseMove(t) { + this._update(t.point); + } + _onDrag(t) { + this._update(t.point); + } + _update(t) { + if ( + !this._map || + (!this._lngLat && !this._trackPointer) || + !this._content + ) + return; + if ( + (this._container || + ((this._container = r.create( + 'div', + 'maplibregl-popup mapboxgl-popup', + this._map.getContainer(), + )), + (this._tip = r.create( + 'div', + 'maplibregl-popup-tip mapboxgl-popup-tip', + this._container, + )), + this._container.appendChild(this._content), + this.options.className && + this.options.className + .split(' ') + .forEach((t) => this._container.classList.add(t)), + this._trackPointer && + this._container.classList.add( + 'maplibregl-popup-track-pointer', + 'mapboxgl-popup-track-pointer', + )), + this.options.maxWidth && + this._container.style.maxWidth !== this.options.maxWidth && + (this._container.style.maxWidth = this.options.maxWidth), + this._map.transform.renderWorldCopies && + !this._trackPointer && + (this._lngLat = na(this._lngLat, this._pos, this._map.transform)), + this._trackPointer && !t) + ) + return; + const e = (this._pos = + this._trackPointer && t ? t : this._map.project(this._lngLat)); + let i = this.options.anchor; + const o = ya(this.options.offset); + if (!i) { + const t = this._container.offsetWidth, + a = this._container.offsetHeight; + let r; + (r = + e.y + o.bottom.y < a + ? ['top'] + : e.y > this._map.transform.height - a + ? ['bottom'] + : []), + e.x < t / 2 + ? r.push('left') + : e.x > this._map.transform.width - t / 2 && r.push('right'), + (i = 0 === r.length ? 'bottom' : r.join('-')); + } + const a = e.add(o[i]).round(); + r.setTransform( + this._container, + `${la[i]} translate(${a.x}px,${a.y}px)`, + ), + ca(this._container, i, 'popup'); + } + _focusFirstElement() { + if (!this.options.focusAfterOpen || !this._container) return; + const t = this._container.querySelector(va); + t && t.focus(); + } + _onClose() { + this.remove(); + } + }, + Marker: ha, + Style: ee, + LngLat: t.LngLat, + LngLatBounds: t.LngLatBounds, + Point: t.pointGeometry, + MercatorCoordinate: t.MercatorCoordinate, + Evented: t.Evented, + AJAXError: t.AJAXError, + config: t.config, + CanvasSource: P, + GeoJSONSource: C, + ImageSource: D, + RasterDEMTileSource: I, + RasterTileSource: T, + VectorTileSource: w, + VideoSource: z, + prewarm: function () { + j().acquire(G); + }, + clearPrewarmedResources: function () { + const t = q; + t && + (t.isPreloaded() && 1 === t.numActive() + ? (t.release(G), (q = 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 version() { + return '2.4.0'; + }, + get workerCount() { + return Z.workerCount; + }, + set workerCount(t) { + Z.workerCount = t; + }, + get maxParallelImageRequests() { + return t.config.MAX_PARALLEL_IMAGE_REQUESTS; + }, + set maxParallelImageRequests(e) { + t.config.MAX_PARALLEL_IMAGE_REQUESTS = e; + }, + clearStorage(e) { + t.clearTileCache(e); + }, + workerUrl: '', + addProtocol(e, i) { + t.config.REGISTERED_PROTOCOLS[e] = i; + }, + removeProtocol(e) { + delete t.config.REGISTERED_PROTOCOLS[e]; + }, + }; + return ( + Jo.extend(ba, { + isSafari: t.isSafari, + getPerformanceMetrics: t.PerformanceUtils.getPerformanceMetrics, + }), + ba + ); + }); + + // + + var maplibregl$1 = maplibregl; + + return maplibregl$1; +}); //# sourceMappingURL=maplibre-gl.js.map