tangram-core 0.3.0__cp310-cp310-manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tangram_core/App.vue +441 -0
- tangram_core/CommandPalette.vue +200 -0
- tangram_core/HighlightText.vue +32 -0
- tangram_core/__Timeline.vue +300 -0
- tangram_core/__init__.py +5 -0
- tangram_core/__main__.py +331 -0
- tangram_core/_core.cpython-310-aarch64-linux-gnu.so +0 -0
- tangram_core/_core.pyi +38 -0
- tangram_core/api.ts +652 -0
- tangram_core/backend.py +458 -0
- tangram_core/components.ts +2 -0
- tangram_core/config.py +167 -0
- tangram_core/dist-frontend/aggregation-layers.js +521 -0
- tangram_core/dist-frontend/aggregation-layers.js.map +1 -0
- tangram_core/dist-frontend/assets/_commonjsHelpers-CqkleIqs.js +2 -0
- tangram_core/dist-frontend/assets/_commonjsHelpers-CqkleIqs.js.map +1 -0
- tangram_core/dist-frontend/assets/array-utils-flat-BBMak426.js +11 -0
- tangram_core/dist-frontend/assets/array-utils-flat-BBMak426.js.map +1 -0
- tangram_core/dist-frontend/assets/assert-cyW4mg7q.js +3 -0
- tangram_core/dist-frontend/assets/assert-cyW4mg7q.js.map +1 -0
- tangram_core/dist-frontend/assets/b612-latin-400-italic-DePNXA0a.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-italic-a-4GLPtl.woff2 +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-normal-CC98FVm_.woff2 +0 -0
- tangram_core/dist-frontend/assets/b612-latin-400-normal-JbZ7xwUX.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-700-normal-B_Snq1wd.woff +0 -0
- tangram_core/dist-frontend/assets/b612-latin-700-normal-BinQrnoB.woff2 +0 -0
- tangram_core/dist-frontend/assets/clip-extension-D-rbmFPj.js +26 -0
- tangram_core/dist-frontend/assets/clip-extension-D-rbmFPj.js.map +1 -0
- tangram_core/dist-frontend/assets/color-CUNNsFV-.js +17 -0
- tangram_core/dist-frontend/assets/color-CUNNsFV-.js.map +1 -0
- tangram_core/dist-frontend/assets/cube-geometry-v0HQ793i.js +2 -0
- tangram_core/dist-frontend/assets/cube-geometry-v0HQ793i.js.map +1 -0
- tangram_core/dist-frontend/assets/deep-equal-BTW2ZN6S.js +2 -0
- tangram_core/dist-frontend/assets/deep-equal-BTW2ZN6S.js.map +1 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-CIXGjOdo.js +2 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-CIXGjOdo.js.map +1 -0
- tangram_core/dist-frontend/assets/geojson-layer-DgMOQ4Qu.js +1010 -0
- tangram_core/dist-frontend/assets/geojson-layer-DgMOQ4Qu.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-view-Day_n1iB.js +94 -0
- tangram_core/dist-frontend/assets/globe-view-Day_n1iB.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-viewport-tqhQW7C4.js +2 -0
- tangram_core/dist-frontend/assets/globe-viewport-tqhQW7C4.js.map +1 -0
- tangram_core/dist-frontend/assets/image-loader-hHJsndO6.js +2 -0
- tangram_core/dist-frontend/assets/image-loader-hHJsndO6.js.map +1 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-400-normal-DTZQ6lD6.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-400-normal-HYADljCo.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-700-normal-ByjKuJjN.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-700-normal-DzgUY3Rl.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-400-normal-BaHVOdFB.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-400-normal-yvPjCxxx.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-700-normal-D0Kpgs_9.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-latin-ext-700-normal-Dlt-daqV.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-400-normal-ByiM2lek.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-400-normal-DfC_iMic.woff2 +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-700-normal-DLCFFAUf.woff +0 -0
- tangram_core/dist-frontend/assets/inconsolata-vietnamese-700-normal-DuasYmn8.woff2 +0 -0
- tangram_core/dist-frontend/assets/index-CcogpxdD.js +824 -0
- tangram_core/dist-frontend/assets/index-CcogpxdD.js.map +1 -0
- tangram_core/dist-frontend/assets/index-SSLdizTv.css +1 -0
- tangram_core/dist-frontend/assets/layer-DPcO4AXQ.js +555 -0
- tangram_core/dist-frontend/assets/layer-DPcO4AXQ.js.map +1 -0
- tangram_core/dist-frontend/assets/layer-extension-CYwTXf73.js +2 -0
- tangram_core/dist-frontend/assets/layer-extension-CYwTXf73.js.map +1 -0
- tangram_core/dist-frontend/assets/mesh-layers-wiqredoy.js +1123 -0
- tangram_core/dist-frontend/assets/mesh-layers-wiqredoy.js.map +1 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-B4nCj5tn.js +2 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-B4nCj5tn.js.map +1 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-C-3k0wbN.js +2 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-C-3k0wbN.js.map +1 -0
- tangram_core/dist-frontend/assets/project-BTjD2Imj.js +760 -0
- tangram_core/dist-frontend/assets/project-BTjD2Imj.js.map +1 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-italic-4qS3_zkX.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-italic-CDK-EZBY.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-normal-Bgns473E.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-400-normal-_T2aQlWs.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-500-normal-CvEVpWxD.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-500-normal-s4PklZE0.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-700-normal-9RN-Z7cI.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-700-normal-BGMkBBYx.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-italic-C7erd-g8.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-italic-DR5R5TWx.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-normal-DGo1Ayjq.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-400-normal-WtM1l1qc.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-500-normal-C8FNIdXm.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-500-normal-TLDmfi3Q.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-700-normal-CTXjXnze.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-cyrillic-ext-700-normal-CWPRiRXS.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-italic-CR6qj4Z4.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-italic-DHRaIs10.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-normal-D5vBSIyg.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-400-normal-FabMgVmk.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-500-normal-BIN62cw9.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-500-normal-Hsn-wDIp.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-700-normal-89Up2Xly.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-greek-700-normal-DWMOA2VK.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-italic-D_BR-3LG.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-italic-om57GXsO.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-normal-BICmKrXV.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-400-normal-D2e7XwB1.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-500-normal-3p2daRJW.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-500-normal-Dc9bsamC.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-700-normal-BOl6B_hI.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-700-normal-DRbp0YnP.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-italic-BXrkWnoY.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-italic-Bhem1d5z.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-normal-DT8nEsYA.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-400-normal-OHaX69iP.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-500-normal-CcSTXKtO.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-500-normal-JgPl2bDS.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-700-normal-B004qtqu.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-latin-ext-700-normal-O6H_RRvN.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-italic-BwUYFJ2t.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-italic-DV8QogUk.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-normal-0o1laQ-g.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-400-normal-CPsdS8_S.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-500-normal-G9shSJ2z.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-500-normal-TFWhjk13.woff2 +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-700-normal-BtNeb9D6.woff +0 -0
- tangram_core/dist-frontend/assets/roboto-condensed-vietnamese-700-normal-D35V1G0s.woff2 +0 -0
- tangram_core/dist-frontend/assets/shader-Cbdysp2j.js +843 -0
- tangram_core/dist-frontend/assets/shader-Cbdysp2j.js.map +1 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DJFl_7Ca.js +392 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DJFl_7Ca.js.map +1 -0
- tangram_core/dist-frontend/assets/tesselator-CENyUZ2p.js +2 -0
- tangram_core/dist-frontend/assets/tesselator-CENyUZ2p.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-utTNOsNf.js +7 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-utTNOsNf.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-device-BYRB-GQX.js +3 -0
- tangram_core/dist-frontend/assets/webgl-device-BYRB-GQX.js.map +1 -0
- tangram_core/dist-frontend/assets/widget-BjgEeHAL.js +2 -0
- tangram_core/dist-frontend/assets/widget-BjgEeHAL.js.map +1 -0
- tangram_core/dist-frontend/core.js +60 -0
- tangram_core/dist-frontend/core.js.map +1 -0
- tangram_core/dist-frontend/extensions.js +609 -0
- tangram_core/dist-frontend/extensions.js.map +1 -0
- tangram_core/dist-frontend/favicon.ico +0 -0
- tangram_core/dist-frontend/favicon.png +0 -0
- tangram_core/dist-frontend/geo-layers.js +115 -0
- tangram_core/dist-frontend/geo-layers.js.map +1 -0
- tangram_core/dist-frontend/index.html +39 -0
- tangram_core/dist-frontend/json.js +3 -0
- tangram_core/dist-frontend/json.js.map +1 -0
- tangram_core/dist-frontend/layers.js +268 -0
- tangram_core/dist-frontend/layers.js.map +1 -0
- tangram_core/dist-frontend/mapbox.js +2 -0
- tangram_core/dist-frontend/mapbox.js.map +1 -0
- tangram_core/dist-frontend/mesh-layers.js +2 -0
- tangram_core/dist-frontend/mesh-layers.js.map +1 -0
- tangram_core/dist-frontend/widgets.js +3 -0
- tangram_core/dist-frontend/widgets.js.map +1 -0
- tangram_core/main.ts +28 -0
- tangram_core/package.json +62 -0
- tangram_core/plugin.py +109 -0
- tangram_core/plugin.ts +47 -0
- tangram_core/redis.py +89 -0
- tangram_core/user.css +114 -0
- tangram_core/utils.ts +143 -0
- tangram_core/vite-plugin-tangram.mjs +155 -0
- tangram_core-0.3.0.dist-info/METADATA +101 -0
- tangram_core-0.3.0.dist-info/RECORD +162 -0
- tangram_core-0.3.0.dist-info/WHEEL +4 -0
- tangram_core-0.3.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
import{watch as nl,reactive as dy,ref as Yi,shallowRef as Za,computed as Nd,defineComponent as hm,inject as py,onMounted as dm,onUnmounted as pm,createElementBlock as ji,openBlock as fi,withModifiers as kd,createElementVNode as sr,createCommentVNode as qa,withDirectives as fm,withKeys as Dd,vModelText as fy,Fragment as th,renderList as ih,normalizeStyle as mm,normalizeClass as gm,createBlock as rh,resolveDynamicComponent as nh,mergeProps as my,getCurrentInstance as gy,toDisplayString as om,createVNode as _y,createTextVNode as yy,vShow as vy,createApp as xy}from"vue";import{MapboxOverlay as by}from"@deck.gl/mapbox";import wy,{run as Ty}from"rs1090-wasm";(function(){const S=document.createElement("link").relList;if(S&&S.supports&&S.supports("modulepreload"))return;for(const Y of document.querySelectorAll('link[rel="modulepreload"]'))B(Y);new MutationObserver(Y=>{for(const le of Y)if(le.type==="childList")for(const M of le.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&B(M)}).observe(document,{childList:!0,subtree:!0});function F(Y){const le={};return Y.integrity&&(le.integrity=Y.integrity),Y.referrerPolicy&&(le.referrerPolicy=Y.referrerPolicy),Y.crossOrigin==="use-credentials"?le.credentials="include":Y.crossOrigin==="anonymous"?le.credentials="omit":le.credentials="same-origin",le}function B(Y){if(Y.ep)return;Y.ep=!0;const le=F(Y);fetch(Y.href,le)}})();const Sy="/favicon.png";function Py(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}var sh={exports:{}};var My=sh.exports,lm;function Iy(){return lm||(lm=1,(function(I,S){(function(F,B){I.exports=B()})(My,(function(){var F={},B={};function Y(M,l,_e){if(B[M]=_e,M==="index"){var Oe="var sharedModule = {}; ("+B.shared+")(sharedModule); ("+B.worker+")(sharedModule);",qe={};return B.shared(qe),B.index(F,qe),typeof window<"u"&&F.setWorkerUrl(window.URL.createObjectURL(new Blob([Oe],{type:"text/javascript"}))),F}}Y("shared",["exports"],(function(M){function l(r,e,i,s){return new(i||(i=Promise))((function(o,u){function h(y){try{g(s.next(y))}catch(x){u(x)}}function f(y){try{g(s.throw(y))}catch(x){u(x)}}function g(y){var x;y.done?o(y.value):(x=y.value,x instanceof i?x:new i((function(w){w(x)}))).then(h,f)}g((s=s.apply(r,e||[])).next())}))}function _e(r,e){this.x=r,this.y=e}function Oe(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var qe,De;typeof SuppressedError=="function"&&SuppressedError,_e.prototype={clone(){return new _e(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),o=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:_e},_e.convert=function(r){if(r instanceof _e)return r;if(Array.isArray(r))return new _e(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new _e(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Re=(function(){if(De)return qe;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return De=1,qe=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var u=this.sampleCurveX(s)-e;if(Math.abs(u)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=u/h}var f=0,g=1;for(s=e,o=0;o<20&&(u=this.sampleCurveX(s),!(Math.abs(u-e)<i));o++)e>u?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},qe})(),Ze=Oe(Re);let yt,Xe;function de(){return yt==null&&(yt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),yt}function vt(){if(Xe==null&&(Xe=!1,de())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const o=4*s;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){Xe=!0;break}}}return Xe||!1}var rt=1e-6,Je=typeof Float32Array<"u"?Float32Array:Array;function ki(){var r=new Je(9);return Je!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Di(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function rn(){var r=new Je(3);return Je!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Ii(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function nn(r,e,i){var s=new Je(3);return s[0]=r,s[1]=e,s[2]=i,s}function Ki(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function ar(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function ci(r,e,i){var s=e[0],o=e[1],u=e[2],h=i[0],f=i[1],g=i[2];return r[0]=o*g-u*f,r[1]=u*h-s*g,r[2]=s*f-o*h,r}var or,gr=Ii;function Vn(r,e,i){var s=e[0],o=e[1],u=e[2],h=e[3];return r[0]=i[0]*s+i[4]*o+i[8]*u+i[12]*h,r[1]=i[1]*s+i[5]*o+i[9]*u+i[13]*h,r[2]=i[2]*s+i[6]*o+i[10]*u+i[14]*h,r[3]=i[3]*s+i[7]*o+i[11]*u+i[15]*h,r}function $r(){var r=new Je(4);return Je!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ir(r,e,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",u=Math.PI/360;e*=u,s*=u,i*=u;var h=Math.sin(e),f=Math.cos(e),g=Math.sin(i),y=Math.cos(i),x=Math.sin(s),w=Math.cos(s);switch(o){case"xyz":r[0]=h*y*w+f*g*x,r[1]=f*g*w-h*y*x,r[2]=f*y*x+h*g*w,r[3]=f*y*w-h*g*x;break;case"xzy":r[0]=h*y*w-f*g*x,r[1]=f*g*w-h*y*x,r[2]=f*y*x+h*g*w,r[3]=f*y*w+h*g*x;break;case"yxz":r[0]=h*y*w+f*g*x,r[1]=f*g*w-h*y*x,r[2]=f*y*x-h*g*w,r[3]=f*y*w+h*g*x;break;case"yzx":r[0]=h*y*w+f*g*x,r[1]=f*g*w+h*y*x,r[2]=f*y*x-h*g*w,r[3]=f*y*w-h*g*x;break;case"zxy":r[0]=h*y*w-f*g*x,r[1]=f*g*w+h*y*x,r[2]=f*y*x+h*g*w,r[3]=f*y*w-h*g*x;break;case"zyx":r[0]=h*y*w-f*g*x,r[1]=f*g*w+h*y*x,r[2]=f*y*x-h*g*w,r[3]=f*y*w+h*g*x;break;default:throw new Error("Unknown angle order "+o)}return r}function _i(){var r=new Je(2);return Je!=Float32Array&&(r[0]=0,r[1]=0),r}function qr(r,e){var i=new Je(2);return i[0]=r,i[1]=e,i}rn(),or=new Je(4),Je!=Float32Array&&(or[0]=0,or[1]=0,or[2]=0,or[3]=0),rn(),nn(1,0,0),nn(0,1,0),$r(),$r(),ki(),_i();const ht=8192;function _n(r,e,i){return e*(ht/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function Er(r,e){return(r%e+e)%e}function Zr(r,e,i){return r*(1-i)+e*i}function _r(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Wr(r,e,i,s){const o=new Ze(r,e,i,s);return u=>o.solve(u)}const ti=Wr(.25,.1,.25,1);function Ni(r,e,i){return Math.min(i,Math.max(e,r))}function lr(r,e,i){const s=i-e,o=((r-e)%s+s)%s+e;return o===e?i:o}function yi(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let Hr=1;function cr(r,e,i){const s={};for(const o in r)s[o]=e.call(this,r[o],o,r);return s}function yn(r,e,i){const s={};for(const o in r)e.call(this,r[o],o,r)&&(s[o]=r[o]);return s}function Ji(r){return Array.isArray(r)?r.map(Ji):typeof r=="object"&&r?cr(r,Ji):r}const vn={};function vi(r){vn[r]||(typeof console<"u"&&console.warn(r),vn[r]=!0)}function yr(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Xr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Wt=null;function xn(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Nn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ps(r,e,i,s,o){return l(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(r,{timestamp:0});try{const h=u?.format;if(!h||!h.startsWith("BGR")&&!h.startsWith("RGB"))throw new Error(`Unrecognized format ${h}`);const f=h.startsWith("BGR"),g=new Uint8ClampedArray(s*o*4);if(yield u.copyTo(g,(function(y,x,w,P,E){const z=4*Math.max(-x,0),k=(Math.max(0,w)-w)*P*4+z,R=4*P,N=Math.max(0,x),X=Math.max(0,w);return{rect:{x:N,y:X,width:Math.min(y.width,x+P)-N,height:Math.min(y.height,w+E)-X},layout:[{offset:k,stride:R}]}})(r,e,i,s,o)),f)for(let y=0;y<g.length;y+=4){const x=g[y];g[y]=g[y+2],g[y+2]=x}return g}finally{u.close()}}))}let bn,Cr;function fs(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function ms(r){return r*Math.PI/180}function Qi(r){return r/Math.PI*180}const ue={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},j={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},O="AbortError";class G extends Error{constructor(e=O){super(e instanceof Error?e.message:e),this.name=O,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function re(r){return r.name===O}const se={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function pe(r){return se.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const ce="global-dispatcher";class ae extends Error{constructor(e,i,s,o){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=o}}const xe=()=>Xr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Ce=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=pe(r.url);if(s)return s(r,e);if(Xr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:ce},e)}if(!(/^file:/.test(i=r.url)||/^file:/.test(xe())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,o){return l(this,void 0,void 0,(function*(){const u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:xe(),signal:o.signal});let h,f;s.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{h=yield fetch(u)}catch(y){throw re(y)?y:new ae(0,y.message,s.url,new Blob)}if(!h.ok){const y=yield h.blob();throw new ae(h.status,h.statusText,s.url,y)}f=s.type==="arrayBuffer"||s.type==="image"?h.arrayBuffer():s.type==="json"?h.json():h.text();const g=yield f;return o.signal.throwIfAborted(),{data:g,cacheControl:h.headers.get("Cache-Control"),expires:h.headers.get("Expires")}}))})(r,e);if(Xr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:ce},e)}var i;return(function(s,o){return new Promise(((u,h)=>{var f;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const y in s.headers)g.setRequestHeader(y,s.headers[y]);s.type==="json"&&(g.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{h(new Error(g.statusText))},g.onload=()=>{if(!o.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let y=g.response;if(s.type==="json")try{y=JSON.parse(g.response)}catch(x){return void h(x)}u({data:y,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const y=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});h(new ae(g.status,g.statusText,s.url,y))}},o.signal.addEventListener("abort",(()=>{g.abort(),h(new G(o.signal.reason))})),g.send(s.body)}))})(r,e)};function Pe(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Ne(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function We(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class et{constructor(e,i={}){yi(this,i),this.type=e}}class St extends et{constructor(e,i={}){super("error",yi({error:e},i))}}class gt{on(e,i){return this._listeners=this._listeners||{},Ne(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return We(e,i,this._listeners),We(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Ne(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){typeof e=="string"&&(e=new et(e,i||{}));const s=e.type;if(this.listens(s)){e.target=this;const o=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)We(s,f,this._oneTimeListeners),f.call(this,e);const h=this._eventedParent;h&&(yi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof St&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var me={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},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:"expression_name",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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Mt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ei(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Mt.forEach((s=>{s in e&&(i[s]=e[s])})),i}function tt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!tt(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!tt(r[i],e[i]))return!1;return!0}return r===e}function wt(r,e){r.push(e)}function Ci(r,e,i){wt(i,{command:"addSource",args:[r,e[r]]})}function Lt(r,e,i){wt(e,{command:"removeSource",args:[r]}),i[r]=!0}function Ht(r,e,i,s){Lt(r,i,s),Ci(r,e,i)}function It(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!tt(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!tt(r[i][s],e[i][s]))return!1;return!0}function ui(r,e,i,s,o,u){r=r||{},e=e||{};for(const h in r)Object.prototype.hasOwnProperty.call(r,h)&&(tt(r[h],e[h])||i.push({command:u,args:[s,h,e[h],o]}));for(const h in e)Object.prototype.hasOwnProperty.call(e,h)&&!Object.prototype.hasOwnProperty.call(r,h)&&(tt(r[h],e[h])||i.push({command:u,args:[s,h,e[h],o]}))}function Xs(r){return r.id}function Ys(r,e){return r[e.id]=e,r}class Ae{constructor(e,i,s,o){this.message=(e?`${e}: `:"")+s,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function Ui(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class Gi extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Wa{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,o]of i)this.bindings[s]=o}concat(e){return new Wa(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const vr={kind:"null"},je={kind:"number"},at={kind:"string"},ot={kind:"boolean"},ur={kind:"color"},Ha={kind:"projectionDefinition"},sn={kind:"object"},nt={kind:"value"},Ks={kind:"collator"},Js={kind:"formatted"},Xa={kind:"padding"},gs={kind:"colorArray"},Qs={kind:"numberArray"},_s={kind:"resolvedImage"},ea={kind:"variableAnchorOffsetCollection"};function $i(r,e){return{kind:"array",itemType:r,N:e}}function Tt(r){if(r.kind==="array"){const e=Tt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ya=[vr,je,at,ot,ur,Ha,Js,sn,$i(nt),Xa,Qs,gs,_s,ea];function ys(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ys(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Ya)if(!ys(i,e))return null}}return`Expected ${Tt(r)} but found ${Tt(e)} instead.`}function ta(r,e){return e.some((i=>i.kind===r.kind))}function Un(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Ar(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const Sc=.96422,Gn=.82521,Ka=4/29,Xt=6/29,Pc=3*Xt*Xt,Mc=Xt*Xt*Xt,ia=Math.PI/180,Ic=180/Math.PI;function Ec(r){return(r%=360)<0&&(r+=360),r}function Cc([r,e,i,s]){let o,u;const h=sl((.2225045*(r=Ja(r))+.7168786*(e=Ja(e))+.0606169*(i=Ja(i)))/1);r===e&&e===i?o=u=h:(o=sl((.4360747*r+.3850649*e+.1430804*i)/Sc),u=sl((.0139322*r+.0971045*e+.7141733*i)/Gn));const f=116*h-16;return[f<0?0:f,500*(o-h),200*(h-u),s]}function Ja(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function sl(r){return r>Mc?Math.pow(r,1/3):r/Pc+Ka}function al([r,e,i,s]){let o=(r+16)/116,u=isNaN(e)?o:o+e/500,h=isNaN(i)?o:o-i/200;return o=1*ll(o),u=Sc*ll(u),h=Gn*ll(h),[ol(3.1338561*u-1.6168667*o-.4906146*h),ol(-.9787684*u+1.9161415*o+.033454*h),ol(.0719453*u-.2289914*o+1.4052427*h),s]}function ol(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function ll(r){return r>Xt?r*r*r:Pc*(r-Ka)}const lh=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function ra(r,e){return lh(r,e)?r[e]:void 0}function Qa(r){return parseInt(r.padEnd(2,r),16)/255}function Ac(r,e){return vs(e?r/100:r,0,1)}function vs(r,e,i){return Math.min(Math.max(e,r),i)}function cl(r){return!r.some(Number.isNaN)}const na={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function wn(r,e,i){return r+i*(e-r)}function xs(r,e,i){return r.map(((s,o)=>wn(s,e[o],i)))}class lt{constructor(e,i,s,o=1,u=!0){this.r=e,this.g=i,this.b=s,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,s,o]))}static parse(e){if(e instanceof lt)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=ra(na,s);if(o){const[h,f,g]=o;return[h/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const h=s.length<6?1:2;let f=1;return[Qa(s.slice(f,f+=h)),Qa(s.slice(f,f+=h)),Qa(s.slice(f,f+=h)),Qa(s.slice(f,f+h)||"ff")]}if(s.startsWith("rgb")){const h=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[f,g,y,x,w,P,E,z,k,R,N,X]=h,U=[x||" ",E||" ",R].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const $=[y,P,k].join(""),J=$==="%%%"?100:$===""?255:0;if(J){const te=[vs(+g/J,0,1),vs(+w/J,0,1),vs(+z/J,0,1),N?Ac(+N,X):1];if(cl(te))return te}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[h,f,g,y,x,w,P,E,z]=u,k=[g||" ",x||" ",P].join("");if(k===" "||k===" /"||k===",,"||k===",,,"){const R=[+f,vs(+y,0,100),vs(+w,0,100),E?Ac(+E,z):1];if(cl(R))return(function([N,X,U,$]){function J(te){const he=(te+N/30)%12,Se=X*Math.min(U,1-U);return U-Se*Math.max(-1,Math.min(he-3,9-he,1))}return N=Ec(N),X/=100,U/=100,[J(0),J(8),J(4),$]})(R)}}})(e);return i?new lt(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,i/u,s/u,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,o,u]=Cc(e),h=Math.sqrt(s*s+o*o);return[Math.round(1e4*h)?Ec(Math.atan2(o,s)*Ic):NaN,h,i,u]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Cc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,o]=this.rgb;return`rgba(${[e,i,s].map((u=>Math.round(255*u))).join(",")},${o})`}static interpolate(e,i,s,o="rgb"){switch(o){case"rgb":{const[u,h,f,g]=xs(e.rgb,i.rgb,s);return new lt(u,h,f,g,!1)}case"hcl":{const[u,h,f,g]=e.hcl,[y,x,w,P]=i.hcl;let E,z;if(isNaN(u)||isNaN(y))isNaN(u)?isNaN(y)?E=NaN:(E=y,f!==1&&f!==0||(z=x)):(E=u,w!==1&&w!==0||(z=h));else{let U=y-u;y>u&&U>180?U-=360:y<u&&u-y>180&&(U+=360),E=u+s*U}const[k,R,N,X]=(function([U,$,J,te]){return U=isNaN(U)?0:U*ia,al([J,Math.cos(U)*$,Math.sin(U)*$,te])})([E,z??wn(h,x,s),wn(f,w,s),wn(g,P,s)]);return new lt(k,R,N,X,!1)}case"lab":{const[u,h,f,g]=al(xs(e.lab,i.lab,s));return new lt(u,h,f,g,!1)}}}}lt.black=new lt(0,0,0,1),lt.white=new lt(1,1,1,1),lt.transparent=new lt(0,0,0,0),lt.red=new lt(1,0,0,1);class ul{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ch=["bottom","center","top"];class hl{constructor(e,i,s,o,u,h){this.text=e,this.image=i,this.scale=s,this.fontStack=o,this.textColor=u,this.verticalAlign=h}}class er{constructor(e){this.sections=e}static fromString(e){return new er([new hl(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof er?e:er.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Ri{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ri)return e;if(typeof e=="number")return new Ri([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ri(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Ri(xs(e.values,i.values,s))}}class $t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof $t)return e;if(typeof e=="number")return new $t([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new $t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new $t(xs(e.values,i.values,s))}}class Qe{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Qe)return e;if(typeof e=="string"){const s=lt.parse(e);return s?new Qe([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const o=lt.parse(s);if(!o)return;i.push(o)}return new Qe(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,o="rgb"){const u=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let h=0;h<e.values.length;h++)u.push(lt.interpolate(e.values[h],i.values[h],s,o));return new Qe(u)}}class Et extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Tn=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class qi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof qi)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],o=e[i+1];if(typeof s!="string"||!Tn.has(s)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new qi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const o=e.values,u=i.values;if(o.length!==u.length)throw new Et(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const h=[];for(let f=0;f<o.length;f+=2){if(o[f]!==u[f])throw new Et(`Cannot interpolate values containing mismatched anchors. from[${f}]: ${o[f]}, to[${f}]: ${u[f]}`);h.push(o[f]);const[g,y]=o[f+1],[x,w]=u[f+1];h.push([wn(g,x,s),wn(y,w,s)])}return new qi(h)}}class hr{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new hr({name:e,available:!1}):null}}class Zi{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new Zi(e,i,s)}static parse(e){return e instanceof Zi?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Zi(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Zi(e.from,e.to,e.transition):typeof e=="string"?new Zi(e,e,1):void 0}}function bs(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Sn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Zi||r instanceof lt||r instanceof ul||r instanceof er||r instanceof Ri||r instanceof $t||r instanceof Qe||r instanceof qi||r instanceof hr)return!0;if(Array.isArray(r)){for(const e of r)if(!Sn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Sn(r[e]))return!1;return!0}return!1}function ii(r){if(r===null)return vr;if(typeof r=="string")return at;if(typeof r=="boolean")return ot;if(typeof r=="number")return je;if(r instanceof lt)return ur;if(r instanceof Zi)return Ha;if(r instanceof ul)return Ks;if(r instanceof er)return Js;if(r instanceof Ri)return Xa;if(r instanceof $t)return Qs;if(r instanceof Qe)return gs;if(r instanceof qi)return ea;if(r instanceof hr)return _s;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const o=ii(s);if(i){if(i===o)continue;i=nt;break}i=o}return $i(i||nt,e)}return sn}function $n(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof lt||r instanceof Zi||r instanceof er||r instanceof Ri||r instanceof $t||r instanceof Qe||r instanceof qi||r instanceof hr?r.toString():JSON.stringify(r)}class Yr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Sn(e[1]))return i.error("invalid value");const s=e[1];let o=ii(s);const u=i.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new Yr(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const eo={string:at,number:je,boolean:ot,object:sn};class tr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,o=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const y=e[1];if(typeof y!="string"||!(y in eo)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=eo[y],o++}else f=nt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],o++}s=$i(f,g)}else{if(!eo[u])throw new Error(`Types doesn't contain name = ${u}`);s=eo[u]}const h=[];for(;o<e.length;o++){const f=i.parse(e[o],o,nt);if(!f)return null;h.push(f)}return new tr(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!ys(this.type,ii(s)))return s;if(i===this.args.length-1)throw new Et(`Expected value to be of type ${Tt(this.type)}, but found ${Tt(ii(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const qn={"to-boolean":ot,"to-color":ur,"to-number":je,"to-string":at};class an{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!qn[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const o=qn[s],u=[];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,nt);if(!f)return null;u.push(f)}return new an(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const o of this.args){if(i=o.evaluate(e),s=null,i instanceof lt)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:bs(i[0],i[1],i[2],i[3]),!s))return new lt(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Et(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const o=Ri.parse(i);if(o)return o}throw new Et(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=$t.parse(i);if(o)return o}throw new Et(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=Qe.parse(i);if(o)return o}throw new Et(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const o=qi.parse(i);if(o)return o}throw new Et(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new Et(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return er.fromString($n(this.args[0].evaluate(e)));case"resolvedImage":return hr.fromString($n(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return $n(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const zc=["Unknown","Point","LineString","Polygon"];class dl{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?zc[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(e){let i=this._parseColorCache.get(e);return i||(i=lt.parse(e),this._parseColorCache.set(e,i)),i}}class Zn{constructor(e,i,s=[],o,u=new Wa,h=[]){this.registry=e,this.path=s,this.key=s.map((f=>`[${f}]`)).join(""),this.scope=u,this.errors=h,this.expectedType=o,this._isConstant=i}parse(e,i,s,o,u={}){return i?this.concat(i,s,o)._parse(e,u):this._parse(e,u)}_parse(e,i){function s(o,u,h){return h==="assert"?new tr(u,[o]):h==="coerce"?new an(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let h=u.parse(e,this);if(!h)return null;if(this.expectedType){const f=this.expectedType,g=h.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value"){if(f.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(f.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(f.kind)&&["value","number","array"].includes(g.kind)||f.kind==="colorArray"&&["value","string","array"].includes(g.kind)||f.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))h=s(h,f,i.typeAnnotation||"coerce");else if(this.checkSubtype(f,g))return null}else h=s(h,f,i.typeAnnotation||"assert")}if(!(h instanceof Yr)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){const f=new dl;try{h=new Yr(h.type,h.evaluate(f))}catch(g){return this.error(g.message),null}}return h}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s){const o=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Zn(this.registry,this._isConstant,o,i||null,u,this.errors)}error(e,...i){const s=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new Gi(s,e))}checkSubtype(e,i){const s=ys(e,i);return s&&this.error(s),s}}class Ct{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;s.push([h,f])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return o?new Ct(s,o):null}outputDefined(){return this.result.outputDefined()}}class ws{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new ws(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class pt{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,je),o=i.parse(e[2],2,$i(i.expectedType||nt));return s&&o?new pt(o.type.itemType,s,o):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Et(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Et(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Et(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class st{constructor(e,i){this.type=ot,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,nt),o=i.parse(e[2],2,nt);return s&&o?ta(s.type,[ot,at,je,vr,nt])?new st(s,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!Un(i,["boolean","string","number","null"]))throw new Et(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ii(i))} instead.`);if(!Un(s,["string","array"]))throw new Et(`Expected second argument to be of type array or string, but found ${Tt(ii(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ts{constructor(e,i,s){this.type=je,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,nt),o=i.parse(e[2],2,nt);if(!s||!o)return null;if(!ta(s.type,[ot,at,je,vr,nt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,je);return u?new Ts(s,o,u):null}return new Ts(s,o)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!Un(i,["boolean","string","number","null"]))throw new Et(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(ii(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),Un(s,["string"])){const u=s.indexOf(i,o);return u===-1?-1:[...s.slice(0,u)].length}if(Un(s,["array"]))return s.indexOf(i,o);throw new Et(`Expected second argument to be of type array or string, but found ${Tt(ii(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ft{constructor(e,i,s,o,u,h){this.inputType=e,this.type=i,this.input=s,this.cases=o,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const u={},h=[];for(let y=2;y<e.length-1;y+=2){let x=e[y];const w=e[y+1];Array.isArray(x)||(x=[x]);const P=i.concat(y);if(x.length===0)return P.error("Expected at least one branch label.");for(const z of x){if(typeof z!="number"&&typeof z!="string")return P.error("Branch labels must be numbers or strings.");if(typeof z=="number"&&Math.abs(z)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return P.error("Numeric branch labels must be integer values.");if(s){if(P.checkSubtype(s,ii(z)))return null}else s=ii(z);if(u[String(z)]!==void 0)return P.error("Branch labels must be unique.");u[String(z)]=h.length}const E=i.parse(w,y,o);if(!E)return null;o=o||E.type,h.push(E)}const f=i.parse(e[1],1,nt);if(!f)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?f.type.kind!=="value"&&i.concat(1).checkSubtype(s,f.type)?null:new ft(s,o,f,u,h,g):null}evaluate(e){const i=this.input.evaluate(e);return(ii(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class sa{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const o=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,ot);if(!f)return null;const g=i.parse(e[h+1],h+1,s);if(!g)return null;o.push([f,g]),s=s||g.type}const u=i.parse(e[e.length-1],e.length-1,s);if(!u)return null;if(!s)throw new Error("Can't infer output type");return new sa(s,o,u)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class xr{constructor(e,i,s,o){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,nt),o=i.parse(e[2],2,je);if(!s||!o)return null;if(!ta(s.type,[$i(nt),at,nt]))return i.error(`Expected first argument to be of type array or string, but found ${Tt(s.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,je);return u?new xr(s.type,s,o,u):null}return new xr(s.type,s,o)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),Un(i,["string"]))return[...i].slice(s,o).join("");if(Un(i,["array"]))return i.slice(s,o);throw new Et(`Expected first argument to be of type array or string, but found ${Tt(ii(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ss(r,e){const i=r.length-1;let s,o,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),s=r[f],o=r[f+1],s<=e){if(f===i||e<o)return f;u=f+1}else{if(!(s>e))throw new Et("Input is not a number.");h=f-1}return 0}class Pn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,u]of s)this.labels.push(o),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,je);if(!s)return null;const o=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],g=e[h+1],y=h,x=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',y);if(o.length&&o[o.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',y);const w=i.parse(g,x,u);if(!w)return null;u=u||w.type,o.push([f,w])}return new Pn(u,s,o)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const u=i.length;return o>=i[u-1]?s[u-1].evaluate(e):s[Ss(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function kc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var aa,pl,uh=(function(){if(pl)return aa;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return pl=1,aa=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var u=this.sampleCurveX(s)-e;if(Math.abs(u)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=u/h}var f=0,g=1;for(s=e,o=0;o<20&&(u=this.sampleCurveX(s),!(Math.abs(u-e)<i));o++)e>u?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},aa})(),Dc=kc(uh);class Wi{constructor(e,i,s,o,u){this.type=e,this.operator=i,this.interpolation=s,this.input=o,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,s,o){let u=0;if(e.name==="exponential")u=Kr(i,e.base,s,o);else if(e.name==="linear")u=Kr(i,1,s,o);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new Dc(h[0],h[1],h[2],h[3]).solve(Kr(i,1,s,o))}return u}static parse(e,i){let[s,o,u,...h]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const y=o[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:y}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const y=o.slice(1);if(y.length!==4||y.some((x=>typeof x!="number"||x<0||x>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:y}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,je),!u)return null;const f=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==gs?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=ur;for(let y=0;y<h.length;y+=2){const x=h[y],w=h[y+1],P=y+3,E=y+4;if(typeof x!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(f.length&&f[f.length-1][0]>=x)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const z=i.parse(w,E,g);if(!z)return null;g=g||z.type,f.push([x,z])}return Ar(g,je)||Ar(g,Ha)||Ar(g,ur)||Ar(g,Xa)||Ar(g,Qs)||Ar(g,gs)||Ar(g,ea)||Ar(g,$i(je))?new Wi(g,s,o,u,f):i.error(`Type ${Tt(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const u=i.length;if(o>=i[u-1])return s[u-1].evaluate(e);const h=Ss(i,o),f=Wi.interpolationFactor(this.interpolation,o,i[h],i[h+1]),g=s[h].evaluate(e),y=s[h+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wn(g,y,f);case"color":return lt.interpolate(g,y,f);case"padding":return Ri.interpolate(g,y,f);case"colorArray":return Qe.interpolate(g,y,f);case"numberArray":return $t.interpolate(g,y,f);case"variableAnchorOffsetCollection":return qi.interpolate(g,y,f);case"array":return xs(g,y,f);case"projectionDefinition":return Zi.interpolate(g,y,f)}case"interpolate-hcl":switch(this.type.kind){case"color":return lt.interpolate(g,y,f,"hcl");case"colorArray":return Qe.interpolate(g,y,f,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return lt.interpolate(g,y,f,"lab");case"colorArray":return Qe.interpolate(g,y,f,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Kr(r,e,i,s){const o=s-i,u=r-i;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}const jt={color:lt.interpolate,number:wn,padding:Ri.interpolate,numberArray:$t.interpolate,colorArray:Qe.interpolate,variableAnchorOffsetCollection:qi.interpolate,array:xs};class Wn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const o=i.expectedType;o&&o.kind!=="value"&&(s=o);const u=[];for(const f of e.slice(1)){const g=i.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const h=o&&u.some((f=>ys(o,f.type)));return new Wn(h?nt:s,u)}evaluate(e){let i,s=null,o=0;for(const u of this.args)if(o++,s=u.evaluate(e),s&&s instanceof hr&&!s.available&&(i||(i=s.name),s=null,o===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function fl(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function oa(r,e,i,s){return s.compare(e,i)===0}function Yt(r,e,i){const s=r!=="=="&&r!=="!=";return class _m{constructor(u,h,f){this.type=ot,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let g=h.parse(u[1],1,nt);if(!g)return null;if(!fl(f,g.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${Tt(g.type)}'.`);let y=h.parse(u[2],2,nt);if(!y)return null;if(!fl(f,y.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${Tt(y.type)}'.`);if(g.type.kind!==y.type.kind&&g.type.kind!=="value"&&y.type.kind!=="value")return h.error(`Cannot compare types '${Tt(g.type)}' and '${Tt(y.type)}'.`);s&&(g.type.kind==="value"&&y.type.kind!=="value"?g=new tr(y.type,[g]):g.type.kind!=="value"&&y.type.kind==="value"&&(y=new tr(g.type,[y])));let x=null;if(u.length===4){if(g.type.kind!=="string"&&y.type.kind!=="string"&&g.type.kind!=="value"&&y.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(x=h.parse(u[3],3,Ks),!x)return null}return new _m(g,y,x)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=ii(h),y=ii(f);if(g.kind!==y.kind||g.kind!=="string"&&g.kind!=="number")throw new Et(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${y.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=ii(h),y=ii(f);if(g.kind!=="string"||y.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Rc=Yt("==",(function(r,e,i){return e===i}),oa),ml=Yt("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!oa(0,e,i,s)})),Lc=Yt("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),hh=Yt(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Ps=Yt("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),to=Yt(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class Ms{constructor(e,i,s){this.type=Ks,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const o=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,ot);if(!o)return null;const u=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,ot);if(!u)return null;let h=null;return s.locale&&(h=i.parse(s.locale,1,at),!h)?null:new Ms(o,u,h)}evaluate(e){return new ul(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class gl{constructor(e,i,s,o,u){this.type=at,this.number=e,this.locale=i,this.currency=s,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,je);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=i.parse(o.locale,1,at),!u))return null;let h=null;if(o.currency&&(h=i.parse(o.currency,1,at),!h))return null;let f=null;if(o["min-fraction-digits"]&&(f=i.parse(o["min-fraction-digits"],1,je),!f))return null;let g=null;return o["max-fraction-digits"]&&(g=i.parse(o["max-fraction-digits"],1,je),!g)?null:new gl(s,u,h,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class la{constructor(e){this.type=Js,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const o=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=i.parse(f["font-scale"],1,je),!g))return null;let y=null;if(f["text-font"]&&(y=i.parse(f["text-font"],1,$i(at)),!y))return null;let x=null;if(f["text-color"]&&(x=i.parse(f["text-color"],1,ur),!x))return null;let w=null;if(f["vertical-align"]){if(typeof f["vertical-align"]=="string"&&!ch.includes(f["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${f["vertical-align"]}' instead.`);if(w=i.parse(f["vertical-align"],1,at),!w)return null}const P=o[o.length-1];P.scale=g,P.font=y,P.textColor=x,P.verticalAlign=w}else{const g=i.parse(e[h],1,nt);if(!g)return null;const y=g.type.kind;if(y!=="string"&&y!=="value"&&y!=="null"&&y!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new la(o)}evaluate(e){return new er(this.sections.map((i=>{const s=i.content.evaluate(e);return ii(s)===_s?new hl("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new hl($n(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class Is{constructor(e){this.type=_s,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,at);return s?new Is(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=hr.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Es{constructor(e){this.type=je,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Tt(s.type)} instead.`):new Es(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Et(`Expected value to be of type string or array, but found ${Tt(ii(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const hi=8192;function Fc(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*hi),Math.round(s*o*hi)]}function Cs(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/hi+e.x)/i,360*o-180),(s=(r[1]/hi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function ca(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Hn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function dh(r,e,i){const s=r[0]-e[0],o=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return s*h-u*o==0&&s*u<=0&&o*h<=0}function io(r,e,i,s){return(o=[s[0]-i[0],s[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*u[0]!=0&&!(!_l(r,e,i,s)||!_l(i,s,r,e));var o,u}function ph(r,e,i){for(const s of i)for(let o=0;o<s.length-1;++o)if(io(r,e,s[o],s[o+1]))return!0;return!1}function As(r,e,i=!1){let s=!1;for(const f of e)for(let g=0;g<f.length-1;g++){if(dh(r,f[g],f[g+1]))return i;(u=f[g])[1]>(o=r)[1]!=(h=f[g+1])[1]>o[1]&&o[0]<(h[0]-u[0])*(o[1]-u[1])/(h[1]-u[1])+u[0]&&(s=!s)}var o,u,h;return s}function ro(r,e){for(const i of e)if(As(r,i))return!0;return!1}function Bc(r,e){for(const i of r)if(!As(i,e))return!1;for(let i=0;i<r.length-1;++i)if(ph(r[i],r[i+1],e))return!1;return!0}function Oc(r,e){for(const i of e)if(Bc(r,i))return!0;return!1}function _l(r,e,i,s){const o=s[0]-i[0],u=s[1]-i[1],h=(r[0]-i[0])*u-o*(r[1]-i[1]),f=(e[0]-i[0])*u-o*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function yl(r,e,i){const s=[];for(let o=0;o<r.length;o++){const u=[];for(let h=0;h<r[o].length;h++){const f=Fc(r[o][h],i);ca(e,f),u.push(f)}s.push(u)}return s}function vl(r,e,i){const s=[];for(let o=0;o<r.length;o++){const u=yl(r[o],e,i);s.push(u)}return s}function jc(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const o=.5*s;let u=r[0]-i[0]>o?-s:i[0]-r[0]>o?s:0;u===0&&(u=r[0]-i[2]>o?-s:i[2]-r[0]>o?s:0),r[0]+=u}ca(e,r)}function Vc(r,e,i,s){const o=Math.pow(2,s.z)*hi,u=[s.x*hi,s.y*hi],h=[];for(const f of r)for(const g of f){const y=[g.x+u[0],g.y+u[1]];jc(y,e,i,o),h.push(y)}return h}function Nc(r,e,i,s){const o=Math.pow(2,s.z)*hi,u=[s.x*hi,s.y*hi],h=[];for(const g of r){const y=[];for(const x of g){const w=[x.x+u[0],x.y+u[1]];ca(e,w),y.push(w)}h.push(y)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of h)for(const y of g)jc(y,e,i,o)}var f;return h}class Xn{constructor(e,i){this.type=ot,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Sn(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const o=[];for(const u of s.features){const{type:h,coordinates:f}=u.geometry;h==="Polygon"&&o.push(f),h==="MultiPolygon"&&o.push(...f)}if(o.length)return new Xn(s,{type:"MultiPolygon",coordinates:o})}else if(s.type==="Feature"){const o=s.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Xn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Xn(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const f=yl(s.coordinates,u,h),g=Vc(i.geometry(),o,u,h);if(!Hn(o,u))return!1;for(const y of g)if(!As(y,f))return!1}if(s.type==="MultiPolygon"){const f=vl(s.coordinates,u,h),g=Vc(i.geometry(),o,u,h);if(!Hn(o,u))return!1;for(const y of g)if(!ro(y,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const f=yl(s.coordinates,u,h),g=Nc(i.geometry(),o,u,h);if(!Hn(o,u))return!1;for(const y of g)if(!Bc(y,f))return!1}if(s.type==="MultiPolygon"){const f=vl(s.coordinates,u,h),g=Nc(i.geometry(),o,u,h);if(!Hn(o,u))return!1;for(const y of g)if(!Oc(y,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Uc=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const o=r-1>>1,u=e[o];if(i(s,u)>=0)break;e[r]=u,r=o}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,o=e[r];for(;r<s;){let u=1+(r<<1);const h=u+1;if(h<this.length&&i(e[h],e[u])<0&&(u=h),i(e[u],o)>=0)break;e[r]=e[u],r=u}e[r]=o}};function xl(r,e,i=0,s=r.length-1,o=Gc){for(;s>i;){if(s-i>600){const g=s-i+1,y=e-i+1,x=Math.log(g),w=.5*Math.exp(2*x/3),P=.5*Math.sqrt(x*w*(g-w)/g)*(y-g/2<0?-1:1);xl(r,e,Math.max(i,Math.floor(e-y*w/g+P)),Math.min(s,Math.floor(e+(g-y)*w/g+P)),o)}const u=r[e];let h=i,f=s;for(zs(r,i,e),o(r[s],u)>0&&zs(r,i,s);h<f;){for(zs(r,h,f),h++,f--;o(r[h],u)<0;)h++;for(;o(r[f],u)>0;)f--}o(r[i],u)===0?zs(r,i,f):(f++,zs(r,f,s)),f<=e&&(i=f+1),e<=f&&(s=f-1)}}function zs(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Gc(r,e){return r<e?-1:r>e?1:0}function no(r,e){if(r.length<=1)return[r];const i=[];let s,o;for(const u of r){const h=mh(u);h!==0&&(u.area=Math.abs(h),o===void 0&&(o=h<0),o===h<0?(s&&i.push(s),s=[u]):s.push(u))}if(s&&i.push(s),e>1)for(let u=0;u<i.length;u++)i[u].length<=e||(xl(i[u],e,1,i[u].length-1,fh),i[u]=i[u].slice(0,e));return i}function fh(r,e){return e.area-r.area}function mh(r){let e=0;for(let i,s,o=0,u=r.length,h=u-1;o<u;h=o++)i=r[o],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}const $c=1/298.257223563,ua=$c*(2-$c),qc=Math.PI/180;class bl{constructor(e){const i=6378.137*qc*1e3,s=Math.cos(e*qc),o=1/(1-ua*(1-s*s)),u=Math.sqrt(o);this.kx=i*u*s,this.ky=i*u*o*(1-ua)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+o*o)}pointOnLine(e,i){let s,o,u,h,f=1/0;for(let g=0;g<e.length-1;g++){let y=e[g][0],x=e[g][1],w=this.wrap(e[g+1][0]-y)*this.kx,P=(e[g+1][1]-x)*this.ky,E=0;w===0&&P===0||(E=(this.wrap(i[0]-y)*this.kx*w+(i[1]-x)*this.ky*P)/(w*w+P*P),E>1?(y=e[g+1][0],x=e[g+1][1]):E>0&&(y+=w/this.kx*E,x+=P/this.ky*E)),w=this.wrap(i[0]-y)*this.kx,P=(i[1]-x)*this.ky;const z=w*w+P*P;z<f&&(f=z,s=y,o=x,u=g,h=E)}return{point:[s,o],index:u,t:Math.max(0,Math.min(1,h))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Zc(r,e){return e[0]-r[0]}function so(r){return r[1]-r[0]+1}function zr(r,e){return r[1]>=r[0]&&r[1]<e}function ao(r,e){if(r[0]>r[1])return[null,null];const i=so(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function wl(r,e){if(!zr(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)ca(i,r[s]);return i}function Tl(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)ca(e,s);return e}function Sl(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function oo(r,e,i){if(!Sl(r)||!Sl(e))return NaN;let s=0,o=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[s,o])}function Yn(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function Pl(r,e,i,s,o){const u=Math.min(Yn(r,[i,s],o),Yn(e,[i,s],o)),h=Math.min(Yn(i,[r,e],o),Yn(s,[r,e],o));return Math.min(u,h)}function gh(r,e,i,s,o){if(!zr(e,r.length)||!zr(s,i.length))return 1/0;let u=1/0;for(let h=e[0];h<e[1];++h){const f=r[h],g=r[h+1];for(let y=s[0];y<s[1];++y){const x=i[y],w=i[y+1];if(io(f,g,x,w))return 0;u=Math.min(u,Pl(f,g,x,w,o))}}return u}function Wc(r,e,i,s,o){if(!zr(e,r.length)||!zr(s,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=s[0];f<=s[1];++f)if(u=Math.min(u,o.distance(r[h],i[f])),u===0)return u;return u}function _h(r,e,i){if(As(r,e,!0))return 0;let s=1/0;for(const o of e){const u=o[0],h=o[o.length-1];if(u!==h&&(s=Math.min(s,Yn(r,[h,u],i)),s===0))return s;const f=i.pointOnLine(o,r);if(s=Math.min(s,i.distance(r,f.point)),s===0)return s}return s}function yh(r,e,i,s){if(!zr(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(As(r[u],i,!0))return 0;let o=1/0;for(let u=e[0];u<e[1];++u){const h=r[u],f=r[u+1];for(const g of i)for(let y=0,x=g.length,w=x-1;y<x;w=y++){const P=g[w],E=g[y];if(io(h,f,P,E))return 0;o=Math.min(o,Pl(h,f,P,E,s))}}return o}function Hc(r,e){for(const i of r)for(const s of i)if(As(s,e,!0))return!0;return!1}function vh(r,e,i,s=1/0){const o=Tl(r),u=Tl(e);if(s!==1/0&&oo(o,u,i)>=s)return s;if(Hn(o,u)){if(Hc(r,e))return 0}else if(Hc(e,r))return 0;let h=1/0;for(const f of r)for(let g=0,y=f.length,x=y-1;g<y;x=g++){const w=f[x],P=f[g];for(const E of e)for(let z=0,k=E.length,R=k-1;z<k;R=z++){const N=E[R],X=E[z];if(io(w,P,N,X))return 0;h=Math.min(h,Pl(w,P,N,X,i))}}return h}function _t(r,e,i,s,o,u){if(!u)return;const h=oo(wl(s,u),o,i);h<e&&r.push([h,u,[0,0]])}function lo(r,e,i,s,o,u,h){if(!u||!h)return;const f=oo(wl(s,u),wl(o,h),i);f<e&&r.push([f,u,h])}function co(r,e,i,s,o=1/0){let u=Math.min(s.distance(r[0],i[0][0]),o);if(u===0)return u;const h=new Uc([[0,[0,r.length-1],[0,0]]],Zc),f=Tl(i);for(;h.length>0;){const g=h.pop();if(g[0]>=u)continue;const y=g[1],x=e?50:100;if(so(y)<=x){if(!zr(y,r.length))return NaN;if(e){const w=yh(r,y,i,s);if(isNaN(w)||w===0)return w;u=Math.min(u,w)}else for(let w=y[0];w<=y[1];++w){const P=_h(r[w],i,s);if(u=Math.min(u,P),u===0)return 0}}else{const w=ao(y,e);_t(h,u,s,r,f,w[0]),_t(h,u,s,r,f,w[1])}}return u}function uo(r,e,i,s,o,u=1/0){let h=Math.min(u,o.distance(r[0],i[0]));if(h===0)return h;const f=new Uc([[0,[0,r.length-1],[0,i.length-1]]],Zc);for(;f.length>0;){const g=f.pop();if(g[0]>=h)continue;const y=g[1],x=g[2],w=e?50:100,P=s?50:100;if(so(y)<=w&&so(x)<=P){if(!zr(y,r.length)&&zr(x,i.length))return NaN;let E;if(e&&s)E=gh(r,y,i,x,o),h=Math.min(h,E);else if(e&&!s){const z=r.slice(y[0],y[1]+1);for(let k=x[0];k<=x[1];++k)if(E=Yn(i[k],z,o),h=Math.min(h,E),h===0)return h}else if(!e&&s){const z=i.slice(x[0],x[1]+1);for(let k=y[0];k<=y[1];++k)if(E=Yn(r[k],z,o),h=Math.min(h,E),h===0)return h}else E=Wc(r,y,i,x,o),h=Math.min(h,E)}else{const E=ao(y,e),z=ao(x,s);lo(f,h,o,r,i,E[0],z[0]),lo(f,h,o,r,i,E[0],z[1]),lo(f,h,o,r,i,E[1],z[0]),lo(f,h,o,r,i,E[1],z[1])}}return h}function Ml(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class Kn{constructor(e,i){this.type=je,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Sn(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new Kn(s,s.features.map((o=>Ml(o.geometry))).flat());if(s.type==="Feature")return new Kn(s,Ml(s.geometry));if("type"in s&&"coordinates"in s)return new Kn(s,Ml(s))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=i.geometry(),u=o.flat().map((g=>Cs([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new bl(u[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,uo(u,!1,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,uo(u,!1,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,co(u,!1,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=i.geometry(),u=o.flat().map((g=>Cs([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new bl(u[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,uo(u,!0,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,uo(u,!0,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,co(u,!0,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const u=no(o,0).map((g=>g.map((y=>y.map((x=>Cs([x.x,x.y],i.canonical))))))),h=new bl(u[0][0][0][1]);let f=1/0;for(const g of s)for(const y of u){switch(g.type){case"Point":f=Math.min(f,co([g.coordinates],!1,y,h,f));break;case"LineString":f=Math.min(f,co(g.coordinates,!0,y,h,f));break;case"Polygon":f=Math.min(f,vh(y,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ha{constructor(e){this.type=nt,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ha(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?ra(s,this.key):null}eachChild(){}outputDefined(){return!1}}const ks={"==":Rc,"!=":ml,">":hh,"<":Lc,">=":to,"<=":Ps,array:tr,at:pt,boolean:tr,case:sa,coalesce:Wn,collator:Ms,format:la,image:Is,in:st,"index-of":Ts,interpolate:Wi,"interpolate-hcl":Wi,"interpolate-lab":Wi,length:Es,let:Ct,literal:Yr,match:ft,number:tr,"number-format":gl,object:tr,slice:xr,step:Pn,string:tr,"to-boolean":an,"to-color":an,"to-number":an,"to-string":an,var:ws,within:Xn,distance:Kn,"global-state":ha};class br{constructor(e,i,s,o){this.name=e,this.type=i,this._evaluate=s,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],o=br.definitions[s];if(!o)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,h=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=h.filter((([y])=>!Array.isArray(y)||y.length===e.length-1));let g=null;for(const[y,x]of f){g=new Zn(i.registry,ho,i.path,null,i.scope);const w=[];let P=!1;for(let E=1;E<e.length;E++){const z=e[E],k=Array.isArray(y)?y[E-1]:y.type,R=g.parse(z,1+w.length,k);if(!R){P=!0;break}w.push(R)}if(!P)if(Array.isArray(y)&&y.length!==w.length)g.error(`Expected ${y.length} arguments, but found ${w.length} instead.`);else{for(let E=0;E<w.length;E++){const z=Array.isArray(y)?y[E]:y.type,k=w[E];g.concat(E+1).checkSubtype(z,k.type)}if(g.errors.length===0)return new br(s,u,x,w)}}if(f.length===1)i.errors.push(...g.errors);else{const y=(f.length?f:h).map((([w])=>{return P=w,Array.isArray(P)?`(${P.map(Tt).join(", ")})`:`(${Tt(P.type)}...)`;var P})).join(" | "),x=[];for(let w=1;w<e.length;w++){const P=i.parse(e[w],1+x.length);if(!P)return null;x.push(Tt(P.type))}i.error(`Expected arguments of type ${y}, but found (${x.join(", ")}) instead.`)}return null}static register(e,i){br.definitions=i;for(const s in i)e[s]=br}}function Xc(r,[e,i,s,o]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const u=o?o.evaluate(r):1,h=bs(e,i,s,u);if(h)throw new Et(h);return new lt(e/255,i/255,s/255,u,!1)}function Yc(r,e){return r in e}function Il(r,e){const i=e[r];return i===void 0?null:i}function Jn(r){return{type:r}}function ho(r){if(r instanceof ws)return ho(r.boundExpression);if(r instanceof br&&r.name==="error"||r instanceof Ms||r instanceof Xn||r instanceof Kn||r instanceof ha)return!1;const e=r instanceof an||r instanceof tr;let i=!0;return r.eachChild((s=>{i=e?i&&ho(s):i&&s instanceof Yr})),!!i&&po(r)&&fo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function po(r){if(r instanceof br&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Xn||r instanceof Kn)return!1;let e=!0;return r.eachChild((i=>{e&&!po(i)&&(e=!1)})),e}function da(r){if(r instanceof br&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!da(i)&&(e=!1)})),e}function fo(r,e){if(r instanceof br&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!fo(s,e)&&(i=!1)})),i}function Kc(r){return{result:"success",value:r}}function Ds(r){return{result:"error",value:r}}function Rs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Jc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function El(r){return!!r.expression&&r.expression.interpolated}function ct(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function mo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&ii(r)===sn}function xh(r){return r}function Qc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),o=r.type||(El(e)?"exponential":"interval"),u=(function(x){switch(x.type){case"color":return lt.parse;case"padding":return Ri.parse;case"numberArray":return $t.parse;case"colorArray":return Qe.parse;default:return null}})(e);if(u&&((r=Ui({},r)).stops&&(r.stops=r.stops.map((x=>[x[0],u(x[1])]))),r.default=u(r.default?r.default:e.default)),r.colorSpace&&(h=r.colorSpace)!=="rgb"&&h!=="hcl"&&h!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var h;const f=(function(x){switch(x){case"exponential":return eu;case"interval":return wh;case"categorical":return bh;case"identity":return Th;default:throw new Error(`Unknown function type "${x}"`)}})(o);let g,y;if(o==="categorical"){g=Object.create(null);for(const x of r.stops)g[x[0]]=x[1];y=typeof r.stops[0][0]}if(i){const x={},w=[];for(let z=0;z<r.stops.length;z++){const k=r.stops[z],R=k[0].zoom;x[R]===void 0&&(x[R]={zoom:R,type:r.type,property:r.property,default:r.default,stops:[]},w.push(R)),x[R].stops.push([k[0].value,k[1]])}const P=[];for(const z of w)P.push([x[z].zoom,Qc(x[z],e)]);const E={name:"linear"};return{kind:"composite",interpolationType:E,interpolationFactor:Wi.interpolationFactor.bind(void 0,E),zoomStops:P.map((z=>z[0])),evaluate:({zoom:z},k)=>eu({stops:P,base:r.base},e,z).evaluate(z,k)}}if(s){const x=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Wi.interpolationFactor.bind(void 0,x),zoomStops:r.stops.map((w=>w[0])),evaluate:({zoom:w})=>f(r,e,w,g,y)}}return{kind:"source",evaluate(x,w){const P=w&&w.properties?w.properties[r.property]:void 0;return P===void 0?pa(r.default,e.default):f(r,e,P,g,y)}}}function pa(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function bh(r,e,i,s,o){return pa(typeof i===o?s[i]:void 0,r.default,e.default)}function wh(r,e,i){if(ct(i)!=="number")return pa(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const o=Ss(r.stops.map((u=>u[0])),i);return r.stops[o][1]}function eu(r,e,i){const s=r.base!==void 0?r.base:1;if(ct(i)!=="number")return pa(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const u=Ss(r.stops.map((x=>x[0])),i),h=(function(x,w,P,E){const z=E-P,k=x-P;return z===0?0:w===1?k/z:(Math.pow(w,k)-1)/(Math.pow(w,z)-1)})(i,s,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],g=r.stops[u+1][1],y=jt[e.type]||xh;return typeof f.evaluate=="function"?{evaluate(...x){const w=f.evaluate.apply(void 0,x),P=g.evaluate.apply(void 0,x);if(w!==void 0&&P!==void 0)return y(w,P,h,r.colorSpace)}}:y(f,g,h,r.colorSpace)}function Th(r,e,i){switch(e.type){case"color":i=lt.parse(i);break;case"formatted":i=er.fromString(i.toString());break;case"resolvedImage":i=hr.fromString(i.toString());break;case"padding":i=Ri.parse(i);break;case"colorArray":i=Qe.parse(i);break;case"numberArray":i=$t.parse(i);break;default:ct(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return pa(i,r.default,e.default)}br.register(ks,{error:[{kind:"error"},[at],(r,[e])=>{throw new Et(e.evaluate(r))}],typeof:[at,[nt],(r,[e])=>Tt(ii(e.evaluate(r)))],"to-rgba":[$i(je,4),[ur],(r,[e])=>{const[i,s,o,u]=e.evaluate(r).rgb;return[255*i,255*s,255*o,u]}],rgb:[ur,[je,je,je],Xc],rgba:[ur,[je,je,je,je],Xc],has:{type:ot,overloads:[[[at],(r,[e])=>Yc(e.evaluate(r),r.properties())],[[at,sn],(r,[e,i])=>Yc(e.evaluate(r),i.evaluate(r))]]},get:{type:nt,overloads:[[[at],(r,[e])=>Il(e.evaluate(r),r.properties())],[[at,sn],(r,[e,i])=>Il(e.evaluate(r),i.evaluate(r))]]},"feature-state":[nt,[at],(r,[e])=>Il(e.evaluate(r),r.featureState||{})],properties:[sn,[],r=>r.properties()],"geometry-type":[at,[],r=>r.geometryType()],id:[nt,[],r=>r.id()],zoom:[je,[],r=>r.globals.zoom],"heatmap-density":[je,[],r=>r.globals.heatmapDensity||0],elevation:[je,[],r=>r.globals.elevation||0],"line-progress":[je,[],r=>r.globals.lineProgress||0],accumulated:[nt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[je,Jn(je),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[je,Jn(je),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:je,overloads:[[[je,je],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[je],(r,[e])=>-e.evaluate(r)]]},"/":[je,[je,je],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[je,[je,je],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[je,[],()=>Math.LN2],pi:[je,[],()=>Math.PI],e:[je,[],()=>Math.E],"^":[je,[je,je],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[je,[je],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[je,[je],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[je,[je],(r,[e])=>Math.log(e.evaluate(r))],log2:[je,[je],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[je,[je],(r,[e])=>Math.sin(e.evaluate(r))],cos:[je,[je],(r,[e])=>Math.cos(e.evaluate(r))],tan:[je,[je],(r,[e])=>Math.tan(e.evaluate(r))],asin:[je,[je],(r,[e])=>Math.asin(e.evaluate(r))],acos:[je,[je],(r,[e])=>Math.acos(e.evaluate(r))],atan:[je,[je],(r,[e])=>Math.atan(e.evaluate(r))],min:[je,Jn(je),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[je,Jn(je),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[je,[je],(r,[e])=>Math.abs(e.evaluate(r))],round:[je,[je],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[je,[je],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[je,[je],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[ot,[at,nt],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[ot,[nt],(r,[e])=>r.id()===e.value],"filter-type-==":[ot,[at],(r,[e])=>r.geometryType()===e.value],"filter-<":[ot,[at,nt],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<o}],"filter-id-<":[ot,[nt],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[ot,[at,nt],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>o}],"filter-id->":[ot,[nt],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[ot,[at,nt],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[ot,[nt],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[ot,[at,nt],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[ot,[nt],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[ot,[nt],(r,[e])=>e.value in r.properties()],"filter-has-id":[ot,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[ot,[$i(at)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[ot,[$i(nt)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[ot,[at,$i(nt)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[ot,[at,$i(nt)],(r,[e,i])=>(function(s,o,u,h){for(;u<=h;){const f=u+h>>1;if(o[f]===s)return!0;o[f]>s?h=f-1:u=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ot,overloads:[[[ot,ot],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Jn(ot),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:ot,overloads:[[[ot,ot],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Jn(ot),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[ot,[ot],(r,[e])=>!e.evaluate(r)],"is-supported-script":[ot,[at],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[at,[at],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[at,[at],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[at,Jn(nt),(r,e)=>e.map((i=>$n(i.evaluate(r)))).join("")],"resolved-locale":[at,[Ks],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Cl{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new dl,this._defaultValue=i?(function(o){if(o.type==="color"&&mo(o.default))return new lt(0,0,0,0);switch(o.type){case"color":return lt.parse(o.default)||null;case"padding":return Ri.parse(o.default)||null;case"numberArray":return $t.parse(o.default)||null;case"colorArray":return Qe.parse(o.default)||null;case"variableAnchorOffsetCollection":return qi.parse(o.default)||null;case"projectionDefinition":return Zi.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,u,h){return this._globalState&&(e=Qn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,o,u,h){this._globalState&&(e=Qn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Et(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ls(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ks}function fa(r,e,i){const s=new Zn(ks,ho,[],e?(function(u){const h={color:ur,string:at,number:je,enum:at,boolean:ot,formatted:Js,padding:Xa,numberArray:Qs,colorArray:gs,projectionDefinition:Ha,resolvedImage:_s,variableAnchorOffsetCollection:ea};return u.type==="array"?$i(h[u.value]||nt,u.length):h[u.type]})(e):void 0),o=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Kc(new Cl(o,e,i)):Ds(s.errors)}class go{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!da(i.expression),this.globalStateRefs=Mn(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,u,h){return this._globalState&&(e=Qn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,u,h)}evaluate(e,i,s,o,u,h){return this._globalState&&(e=Qn(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,u,h)}}class Al{constructor(e,i,s,o,u){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!da(i.expression),this.globalStateRefs=Mn(i.expression),this.interpolationType=o,this._globalState=u}evaluateWithoutErrorHandling(e,i,s,o,u,h){return this._globalState&&(e=Qn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,u,h)}evaluate(e,i,s,o,u,h){return this._globalState&&(e=Qn(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,u,h)}interpolationFactor(e,i,s){return this.interpolationType?Wi.interpolationFactor(this.interpolationType,e,i,s):0}}function zl(r,e,i){const s=fa(r,e,i);if(s.result==="error")return s;const o=s.value.expression,u=po(o);if(!u&&!Rs(e))return Ds([new Gi("","data expressions not supported")]);const h=fo(o,["zoom"]);if(!h&&!Jc(e))return Ds([new Gi("","zoom expressions not supported")]);const f=yo(o);return f||h?f instanceof Gi?Ds([f]):f instanceof Wi&&!El(e)?Ds([new Gi("",'"interpolate" expressions cannot be used with this property')]):Kc(f?new Al(u?"camera":"composite",s.value,f.labels,f instanceof Wi?f.interpolation:void 0,i):new go(u?"constant":"source",s.value,i)):Ds([new Gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class _o{constructor(e,i){this._parameters=e,this._specification=i,Ui(this,Qc(this._parameters,this._specification))}static deserialize(e){return new _o(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function yo(r){let e=null;if(r instanceof Ct)e=yo(r.result);else if(r instanceof Wn){for(const i of r.args)if(e=yo(i),e)break}else(r instanceof Pn||r instanceof Wi)&&r.input instanceof br&&r.input.name==="zoom"&&(e=r);return e instanceof Gi||r.eachChild((i=>{const s=yo(i);s instanceof Gi?e=s:!e&&s?e=new Gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new Gi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Mn(r,e=new Set){return r instanceof ha&&e.add(r.key),r.eachChild((i=>{Mn(i,e)})),e}function Qn(r,e){const{zoom:i,heatmapDensity:s,elevation:o,lineProgress:u,isSupportedScript:h,accumulated:f}=r??{};return{zoom:i,heatmapDensity:s,elevation:o,lineProgress:u,isSupportedScript:h,accumulated:f,globalState:e}}function kl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!kl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Sh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ma(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};kl(r)||(r=ga(r));const i=fa(r,Sh,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,o,u)=>i.value.evaluate(s,o,{},u),needGeometry:tu(r),getGlobalStateRefs:()=>Mn(i.value.expression)}}function Ph(r,e){return r<e?-1:r>e?1:0}function tu(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(tu(r[e]))return!0;return!1}function ga(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?vo(r[1],r[2],"=="):e==="!="?_a(vo(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?vo(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(ga))):e==="all"?["all"].concat(r.slice(1).map(ga)):e==="none"?["all"].concat(r.slice(1).map(ga).map(_a)):e==="in"?iu(r[1],r.slice(2)):e==="!in"?_a(iu(r[1],r.slice(2))):e==="has"?ru(r[1]):e!=="!has"||_a(ru(r[1]));var i}function vo(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function iu(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(Ph)]]:["filter-in-small",r,["literal",e]]}}function ru(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function _a(r){return["!",r]}function xo(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const u of r)o+=`${xo(u)},`;return`${o}]`}const i=Object.keys(r).sort();let s="{";for(let o=0;o<i.length;o++)s+=`${JSON.stringify(i[o])}:${xo(r[i[o]])},`;return`${s}}`}function nu(r){let e="";for(const i of Mt)e+=`/${xo(r[i])}`;return e}function su(r){const e=r.value;return e?[new Ae(r.key,e,"constants have been deprecated as of v8")]:[]}function ri(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function es(r){if(Array.isArray(r))return r.map(es);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=es(r[i]);return e}return ri(r)}function dr(r){const e=r.key,i=r.value,s=r.valueSpec||{},o=r.objectElementValidators||{},u=r.style,h=r.styleSpec,f=r.validateSpec;let g=[];const y=ct(i);if(y!=="object")return[new Ae(e,i,`object expected, ${y} found`)];for(const x in i){const w=x.split(".")[0],P=ra(s,w)||s["*"];let E;if(ra(o,w))E=o[w];else if(ra(s,w)){if(i[x]===void 0)continue;E=f}else if(o["*"])E=o["*"];else{if(!s["*"]){g.push(new Ae(e,i[x],`unknown property "${x}"`));continue}E=f}g=g.concat(E({key:(e&&`${e}.`)+x,value:i[x],valueSpec:P,style:u,styleSpec:h,object:i,objectKey:x,validateSpec:f},i))}for(const x in s)o[x]||s[x].required&&s[x].default===void 0&&i[x]===void 0&&g.push(new Ae(e,i,`missing required property "${x}"`));return g}function bo(r){const e=r.value,i=r.valueSpec,s=r.style,o=r.styleSpec,u=r.key,h=r.arrayElementValidator||r.validateSpec;if(ct(e)!=="array")return[new Ae(u,e,`array expected, ${ct(e)} found`)];if(i.length&&e.length!==i.length)return[new Ae(u,e,`array length ${i.length} expected, length ${e.length} found`)];let f={type:i.value,values:i.values};o.$version<7&&(f.function=i.function),ct(i.value)==="object"&&(f=i.value);let g=[];for(let y=0;y<e.length;y++)g=g.concat(h({array:e,arrayIndex:y,value:e[y],valueSpec:f,validateSpec:r.validateSpec,style:s,styleSpec:o,key:`${u}[${y}]`}));return g}function ya(r){const e=r.key,i=r.value,s=r.valueSpec;let o=ct(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new Ae(e,i,`number expected, ${o} found`)]:"minimum"in s&&i<s.minimum?[new Ae(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new Ae(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function wo(r){const e=r.valueSpec,i=ri(r.value.type);let s,o,u,h={};const f=i!=="categorical"&&r.value.property===void 0,g=!f,y=ct(r.value.stops)==="array"&&ct(r.value.stops[0])==="array"&&ct(r.value.stops[0][0])==="object",x=dr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(E){if(i==="identity")return[new Ae(E.key,E.value,'identity function may not have a "stops" property')];let z=[];const k=E.value;return z=z.concat(bo({key:E.key,value:k,valueSpec:E.valueSpec,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,arrayElementValidator:w})),ct(k)==="array"&&k.length===0&&z.push(new Ae(E.key,k,"array must have at least one stop")),z},default:function(E){return E.validateSpec({key:E.key,value:E.value,valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec})}}});return i==="identity"&&f&&x.push(new Ae(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||x.push(new Ae(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!El(r.valueSpec)&&x.push(new Ae(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Rs(r.valueSpec)?x.push(new Ae(r.key,r.value,"property functions not supported")):f&&!Jc(r.valueSpec)&&x.push(new Ae(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!y||r.value.property!==void 0||x.push(new Ae(r.key,r.value,'"property" property is required')),x;function w(E){let z=[];const k=E.value,R=E.key;if(ct(k)!=="array")return[new Ae(R,k,`array expected, ${ct(k)} found`)];if(k.length!==2)return[new Ae(R,k,`array length 2 expected, length ${k.length} found`)];if(y){if(ct(k[0])!=="object")return[new Ae(R,k,`object expected, ${ct(k[0])} found`)];if(k[0].zoom===void 0)return[new Ae(R,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new Ae(R,k,"object stop key must have value")];if(u&&u>ri(k[0].zoom))return[new Ae(R,k[0].zoom,"stop zoom values must appear in ascending order")];ri(k[0].zoom)!==u&&(u=ri(k[0].zoom),o=void 0,h={}),z=z.concat(dr({key:`${R}[0]`,value:k[0],valueSpec:{zoom:{}},validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,objectElementValidators:{zoom:ya,value:P}}))}else z=z.concat(P({key:`${R}[0]`,value:k[0],validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec},k));return Ls(es(k[1]))?z.concat([new Ae(`${R}[1]`,k[1],"expressions are not allowed in function stops.")]):z.concat(E.validateSpec({key:`${R}[1]`,value:k[1],valueSpec:e,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec}))}function P(E,z){const k=ct(E.value),R=ri(E.value),N=E.value!==null?E.value:z;if(s){if(k!==s)return[new Ae(E.key,N,`${k} stop domain type must match previous stop domain type ${s}`)]}else s=k;if(k!=="number"&&k!=="string"&&k!=="boolean")return[new Ae(E.key,N,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&i!=="categorical"){let X=`number expected, ${k} found`;return Rs(e)&&i===void 0&&(X+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(E.key,N,X)]}return i!=="categorical"||k!=="number"||isFinite(R)&&Math.floor(R)===R?i!=="categorical"&&k==="number"&&o!==void 0&&R<o?[new Ae(E.key,N,"stop domain values must appear in ascending order")]:(o=R,i==="categorical"&&R in h?[new Ae(E.key,N,"stop domain values must be unique")]:(h[R]=!0,[])):[new Ae(E.key,N,`integer expected, found ${R}`)]}}function In(r){const e=(r.expressionContext==="property"?zl:fa)(es(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new Ae(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new Ae(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!da(i))return[new Ae(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!da(i))return[new Ae(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!fo(i,["zoom","feature-state"]))return[new Ae(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!po(i))return[new Ae(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function va(r){const e=r.key,i=r.value,s=ct(i);return s!=="string"?[new Ae(e,i,`color expected, ${s} found`)]:lt.parse(String(i))?[]:[new Ae(e,i,`color expected, "${i}" found`)]}function ts(r){const e=r.key,i=r.value,s=r.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(ri(i))===-1&&o.push(new Ae(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(ri(i))===-1&&o.push(new Ae(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function Fs(r){return kl(es(r.value))?In(Ui({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):au(r)}function au(r){const e=r.value,i=r.key;if(ct(e)!=="array")return[new Ae(i,e,`array expected, ${ct(e)} found`)];const s=r.styleSpec;let o,u=[];if(e.length<1)return[new Ae(i,e,"filter array must have at least 1 element")];switch(u=u.concat(ts({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),ri(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ri(e[1])==="$type"&&u.push(new Ae(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new Ae(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=ct(e[1]),o!=="string"&&u.push(new Ae(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let h=2;h<e.length;h++)o=ct(e[h]),ri(e[1])==="$type"?u=u.concat(ts({key:`${i}[${h}]`,value:e[h],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new Ae(`${i}[${h}]`,e[h],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let h=1;h<e.length;h++)u=u.concat(au({key:`${i}[${h}]`,value:e[h],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=ct(e[1]),e.length!==2?u.push(new Ae(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new Ae(`${i}[1]`,e[1],`string expected, ${o} found`))}return u}function ou(r,e){const i=r.key,s=r.validateSpec,o=r.style,u=r.styleSpec,h=r.value,f=r.objectKey,g=u[`${e}_${r.layerType}`];if(!g)return[];const y=f.match(/^(.*)-transition$/);if(e==="paint"&&y&&g[y[1]]&&g[y[1]].transition)return s({key:i,value:h,valueSpec:u.transition,style:o,styleSpec:u});const x=r.valueSpec||g[f];if(!x)return[new Ae(i,h,`unknown property "${f}"`)];let w;if(ct(h)==="string"&&Rs(x)&&!x.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new Ae(i,h,`"${f}" does not support interpolation syntax
|
|
2
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const P=[];return r.layerType==="symbol"&&f==="text-font"&&mo(es(h))&&ri(h.type)==="identity"&&P.push(new Ae(i,h,'"text-font" does not support identity functions')),P.concat(s({key:r.key,value:h,valueSpec:x,style:o,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function lu(r){return ou(r,"paint")}function cu(r){return ou(r,"layout")}function uu(r){let e=[];const i=r.value,s=r.key,o=r.style,u=r.styleSpec;if(ct(i)!=="object")return[new Ae(s,i,`object expected, ${ct(i)} found`)];i.type||i.ref||e.push(new Ae(s,i,'either "type" or "ref" is required'));let h=ri(i.type);const f=ri(i.ref);if(i.id){const g=ri(i.id);for(let y=0;y<r.arrayIndex;y++){const x=o.layers[y];ri(x.id)===g&&e.push(new Ae(s,i.id,`duplicate layer id "${i.id}", previously used at line ${x.id.__line__}`))}}if("ref"in i){let g;["type","source","source-layer","filter","layout"].forEach((y=>{y in i&&e.push(new Ae(s,i[y],`"${y}" is prohibited for ref layers`))})),o.layers.forEach((y=>{ri(y.id)===f&&(g=y)})),g?g.ref?e.push(new Ae(s,i.ref,"ref cannot reference another ref layer")):h=ri(g.type):e.push(new Ae(s,i.ref,`ref layer "${f}" not found`))}else if(h!=="background")if(i.source){const g=o.sources&&o.sources[i.source],y=g&&ri(g.type);g?y==="vector"&&h==="raster"?e.push(new Ae(s,i.source,`layer "${i.id}" requires a raster source`)):y!=="raster-dem"&&h==="hillshade"||y!=="raster-dem"&&h==="color-relief"?e.push(new Ae(s,i.source,`layer "${i.id}" requires a raster-dem source`)):y==="raster"&&h!=="raster"?e.push(new Ae(s,i.source,`layer "${i.id}" requires a vector source`)):y!=="vector"||i["source-layer"]?y==="raster-dem"&&h!=="hillshade"&&h!=="color-relief"?e.push(new Ae(s,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):h!=="line"||!i.paint||!i.paint["line-gradient"]||y==="geojson"&&g.lineMetrics||e.push(new Ae(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ae(s,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new Ae(s,i.source,`source "${i.source}" not found`))}else e.push(new Ae(s,i,'missing required property "source"'));return e=e.concat(dr({key:s,value:i,valueSpec:u.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${s}.type`,value:i.type,valueSpec:u.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:i,objectKey:"type"}),filter:Fs,layout:g=>dr({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>cu(Ui({layerType:h},y))}}),paint:g=>dr({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>lu(Ui({layerType:h},y))}})}})),e}function En(r){const e=r.value,i=r.key,s=ct(e);return s!=="string"?[new Ae(i,e,`string expected, ${s} found`)]:[]}const Dl={promoteId:function({key:r,value:e}){if(ct(e)==="string")return En({key:r,value:e});{const i=[];for(const s in e)i.push(...En({key:`${r}.${s}`,value:e[s]}));return i}}};function Rl(r){const e=r.value,i=r.key,s=r.styleSpec,o=r.style,u=r.validateSpec;if(!e.type)return[new Ae(i,e,'"type" is required')];const h=ri(e.type);let f;switch(h){case"vector":case"raster":return f=dr({key:i,value:e,valueSpec:s[`source_${h.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:Dl,validateSpec:u}),f;case"raster-dem":return f=(function(g){var y;const x=(y=g.sourceName)!==null&&y!==void 0?y:"",w=g.value,P=g.styleSpec,E=P.source_raster_dem,z=g.style;let k=[];const R=ct(w);if(w===void 0)return k;if(R!=="object")return k.push(new Ae("source_raster_dem",w,`object expected, ${R} found`)),k;const N=ri(w.encoding)==="custom",X=["redFactor","greenFactor","blueFactor","baseShift"],U=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const $ in w)!N&&X.includes($)?k.push(new Ae($,w[$],`In "${x}": "${$}" is only valid when "encoding" is set to "custom". ${U} encoding found`)):E[$]?k=k.concat(g.validateSpec({key:$,value:w[$],valueSpec:E[$],validateSpec:g.validateSpec,style:z,styleSpec:P})):k.push(new Ae($,w[$],`unknown property "${$}"`));return k})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:u}),f;case"geojson":if(f=dr({key:i,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:u,objectElementValidators:Dl}),e.cluster)for(const g in e.clusterProperties){const[y,x]=e.clusterProperties[g],w=typeof y=="string"?[y,["accumulated"],["get",g]]:y;f.push(...In({key:`${i}.${g}.map`,value:x,expressionContext:"cluster-map"})),f.push(...In({key:`${i}.${g}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return f;case"video":return dr({key:i,value:e,valueSpec:s.source_video,style:o,validateSpec:u,styleSpec:s});case"image":return dr({key:i,value:e,valueSpec:s.source_image,style:o,validateSpec:u,styleSpec:s});case"canvas":return[new Ae(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ts({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function xa(r){const e=r.value,i=r.styleSpec,s=i.light,o=r.style;let u=[];const h=ct(e);if(e===void 0)return u;if(h!=="object")return u=u.concat([new Ae("light",e,`object expected, ${h} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:f,value:e[f],valueSpec:i.transition,validateSpec:r.validateSpec,style:o,styleSpec:i}):s[f]?r.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Ae(f,e[f],`unknown property "${f}"`)])}return u}function hu(r){const e=r.value,i=r.styleSpec,s=i.sky,o=r.style,u=ct(e);if(e===void 0)return[];if(u!=="object")return[new Ae("sky",e,`object expected, ${u} found`)];let h=[];for(const f in e)h=h.concat(s[f]?r.validateSpec({key:f,value:e[f],valueSpec:s[f],style:o,styleSpec:i}):[new Ae(f,e[f],`unknown property "${f}"`)]);return h}function Ll(r){const e=r.value,i=r.styleSpec,s=i.terrain,o=r.style;let u=[];const h=ct(e);if(e===void 0)return u;if(h!=="object")return u=u.concat([new Ae("terrain",e,`object expected, ${h} found`)]),u;for(const f in e)u=u.concat(s[f]?r.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Ae(f,e[f],`unknown property "${f}"`)]);return u}function Fl(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const o=[],u=[];for(const h in i)i[h].id&&o.includes(i[h].id)&&e.push(new Ae(s,i,`all the sprites' ids must be unique, but ${i[h].id} is duplicated`)),o.push(i[h].id),i[h].url&&u.includes(i[h].url)&&e.push(new Ae(s,i,`all the sprites' URLs must be unique, but ${i[h].url} is duplicated`)),u.push(i[h].url),e=e.concat(dr({key:`${s}[${h}]`,value:i[h],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return En({key:s,value:i})}function du(r){return!!r&&r.constructor===Object}function Bl(r){return du(r.value)?[]:[new Ae(r.key,r.value,`object expected, ${ct(r.value)} found`)]}const Ol={"*":()=>[],array:bo,boolean:function(r){const e=r.value,i=r.key,s=ct(e);return s!=="boolean"?[new Ae(i,e,`boolean expected, ${s} found`)]:[]},number:ya,color:va,constants:su,enum:ts,filter:Fs,function:wo,layer:uu,object:dr,source:Rl,light:xa,sky:hu,terrain:Ll,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,o=r.style,u=ct(e);if(e===void 0)return[];if(u!=="object")return[new Ae("projection",e,`object expected, ${u} found`)];let h=[];for(const f in e)h=h.concat(s[f]?r.validateSpec({key:f,value:e[f],valueSpec:s[f],style:o,styleSpec:i}):[new Ae(f,e[f],`unknown property "${f}"`)]);return h},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=ct(i);return s!=="array"||(function(o){return Array.isArray(o)&&o.length===3&&typeof o[0]=="string"&&typeof o[1]=="string"&&typeof o[2]=="number"})(i)||(function(o){return!!["interpolate","step","literal"].includes(o[0])})(i)?["array","string"].includes(s)?[]:[new Ae(e,i,`projection expected, invalid type "${s}" found`)]:[new Ae(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:En,formatted:function(r){return En(r).length===0?[]:In(r)},resolvedImage:function(r){return En(r).length===0?[]:In(r)},padding:function(r){const e=r.key,i=r.value;if(ct(i)==="array"){if(i.length<1||i.length>4)return[new Ae(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let o=[];for(let u=0;u<i.length;u++)o=o.concat(r.validateSpec({key:`${e}[${u}]`,value:i[u],validateSpec:r.validateSpec,valueSpec:s}));return o}return ya({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(ct(i)==="array"){const s={type:"number"};if(i.length<1)return[new Ae(e,i,"array length at least 1 expected, length 0 found")];let o=[];for(let u=0;u<i.length;u++)o=o.concat(r.validateSpec({key:`${e}[${u}]`,value:i[u],validateSpec:r.validateSpec,valueSpec:s}));return o}return ya({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(ct(i)==="array"){if(i.length<1)return[new Ae(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let o=0;o<i.length;o++)s=s.concat(va({key:`${e}[${o}]`,value:i[o]}));return s}return va({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=ct(i),o=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new Ae(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let h=0;h<i.length;h+=2)u=u.concat(ts({key:`${e}[${h}]`,value:i[h],valueSpec:o.layout_symbol["text-anchor"]})),u=u.concat(bo({key:`${e}[${h+1}]`,value:i[h+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:o}));return u},sprite:Fl,state:Bl,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,o=r.styleSpec,u=r.style;if(!du(i))return[new Ae(e,i,`object expected, ${ct(i)} found`)];const h=[];for(const f in i){const g=i[f],y=ct(g);if(y==="string")h.push(...En({key:`${e}.${f}`,value:g}));else if(y==="array"){const x={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[w,P]of g.entries())h.push(...dr({key:`${e}.${f}[${w}]`,value:P,valueSpec:x,styleSpec:o,style:u,validateSpec:s}))}else h.push(new Ae(`${e}.${f}`,g,`string or array expected, ${y} found`))}return h}};function Cn(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=Cn,i.expression&&mo(ri(e))?wo(r):i.expression&&Ls(es(e))?In(r):i.type&&Ol[i.type]?Ol[i.type](r):dr(Ui({},r,{valueSpec:i.type?s[i.type]:i}))}function pu(r){const e=r.value,i=r.key,s=En(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Ae(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Ae(i,e,'"glyphs" url must include a "{range}" token'))),s}function wr(r,e=me){let i=[];return i=i.concat(Cn({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Cn,objectElementValidators:{glyphs:pu,"*":()=>[]}})),r.constants&&(i=i.concat(su({key:"constants",value:r.constants}))),fu(i)}function kr(r){return function(e){return r(Object.assign({},e,{validateSpec:Cn}))}}function fu(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function Dr(r){return function(...e){return fu(r.apply(this,e))}}wr.source=Dr(kr(Rl)),wr.sprite=Dr(kr(Fl)),wr.glyphs=Dr(kr(pu)),wr.light=Dr(kr(xa)),wr.sky=Dr(kr(hu)),wr.terrain=Dr(kr(Ll)),wr.state=Dr(kr(Bl)),wr.layer=Dr(kr(uu)),wr.filter=Dr(kr(Fs)),wr.paintProperty=Dr(kr(lu)),wr.layoutProperty=Dr(kr(cu));const Mh={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ba{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=fa(e,Mh,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=Mn(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const wa=me,xi=wr,Ta=xi.light,mu=xi.sky,Ih=xi.paintProperty,Eh=xi.layoutProperty;function Bs(r,e){let i=!1;if(e&&e.length)for(const s of e)r.fire(new St(new Error(s.message))),i=!0;return i}class Os{constructor(e,i,s){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const h=new Int32Array(this.arrayBuffer);e=h[0],this.d=(i=h[1])+2*(s=h[2]);for(let g=0;g<this.d*this.d;g++){const y=h[3+g],x=h[3+g+1];o.push(y===x?null:h.subarray(y,x))}const f=h[3+o.length+1];this.keys=h.subarray(h[3+o.length],f),this.bboxes=h.subarray(f),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let h=0;h<this.d*this.d;h++)o.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=s,this.scale=i/e,this.uid=0;const u=s/i*e;this.min=-u,this.max=e+u}insert(e,i,s,o,u){this._forEachCell(i,s,o,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,o,u,h){this.cells[u].push(h)}query(e,i,s,o,u){const h=this.min,f=this.max;if(e<=h&&i<=h&&f<=s&&f<=o&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,i,s,o,this._queryCell,g,{},u),g}}_queryCell(e,i,s,o,u,h,f,g){const y=this.cells[u];if(y!==null){const x=this.keys,w=this.bboxes;for(let P=0;P<y.length;P++){const E=y[P];if(f[E]===void 0){const z=4*E;(g?g(w[z+0],w[z+1],w[z+2],w[z+3]):e<=w[z+2]&&i<=w[z+3]&&s>=w[z+0]&&o>=w[z+1])?(f[E]=!0,h.push(x[E])):f[E]=!1}}}}_forEachCell(e,i,s,o,u,h,f,g){const y=this._convertToCellCoord(e),x=this._convertToCellCoord(i),w=this._convertToCellCoord(s),P=this._convertToCellCoord(o);for(let E=y;E<=w;E++)for(let z=x;z<=P;z++){const k=this.d*z+E;if((!g||g(this._convertFromCellCoord(E),this._convertFromCellCoord(z),this._convertFromCellCoord(E+1),this._convertFromCellCoord(z+1)))&&u.call(this,e,i,s,o,k,h,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,i=3+this.cells.length+1+1;let s=0;for(let h=0;h<this.cells.length;h++)s+=this.cells[h].length;const o=new Int32Array(i+s+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let u=i;for(let h=0;h<e.length;h++){const f=e[h];o[3+h]=u,o.set(f,u),u+=f.length}return o[3+e.length]=u,o.set(this.keys,u),u+=this.keys.length,o[3+e.length+1]=u,o.set(this.bboxes,u),u+=this.bboxes.length,o.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new Os(e.buffer)}}const Rr={};function Ge(r,e,i={}){if(Rr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),Rr[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Ge("Object",Object),Ge("Set",Set),Ge("TransferableGridIndex",Os),Ge("Color",lt),Ge("Error",Error),Ge("AJAXError",ae),Ge("ResolvedImage",hr),Ge("StylePropertyFunction",_o),Ge("StyleExpression",Cl,{omit:["_evaluator"]}),Ge("ZoomDependentExpression",Al),Ge("ZoomConstantExpression",go),Ge("CompoundExpression",br,{omit:["_evaluate"]});for(const r in ks)ks[r]._classRegistryKey||Ge(`Expression_${r}`,ks[r]);function To(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function jl(r){return r.$name||r.constructor._classRegistryKey}function js(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=jl(e);return!(!i||i==="Object")})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||To(r)||xn(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Sa(r,e){if(js(r))return(To(r)||xn(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const u=[];for(const h of r)u.push(Sa(h,e));return u}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=jl(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Rr[i])throw new Error(`${i} is not registered.`);const{klass:s}=Rr[i],o=s.serialize?s.serialize(r,e):{};if(s.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in r){if(!r.hasOwnProperty(u)||Rr[i].omit.indexOf(u)>=0)continue;const h=r[u];o[u]=Rr[i].shallow.indexOf(u)>=0?h:Sa(h,e)}r instanceof Error&&(o.message=r.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(o.$name=i),o}function Pa(r){if(js(r))return r;if(Array.isArray(r))return r.map(Pa);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=jl(r)||"Object";if(!Rr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Rr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const o of Object.keys(r)){if(o==="$name")continue;const u=r[o];s[o]=Rr[e].shallow.indexOf(o)>=0?u:Pa(u)}return s}class Vl{constructor(){this.first=!0}update(e,i){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function Ma(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function Nl(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function gu(r){return/\s/u.test(String.fromCodePoint(r))}function Vs(r){for(const e of r)if(Nl(e.codePointAt(0)))return!0;return!1}function Ch(r){for(const e of r)if(!_u(e.codePointAt(0)))return!1;return!0}function So(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const Po=So(["Arab","Dupl","Mong","Ougr","Syrc"]);function _u(r){return!Po.test(String.fromCodePoint(r))}function Ul(r){return!(Nl(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const yu=So(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Gl(r){return yu.test(String.fromCodePoint(r))}function $l(r,e){return!(!e&&Gl(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function vu(r){for(const e of r)if(Gl(e.codePointAt(0)))return!0;return!1}const An=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(An.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return l(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise((u=>{this.loadScriptResolve=u}));e(i);const o=new Promise((u=>setTimeout((()=>u()),this.TIMEOUT)));if(yield Promise.race([s,o]),this.isParsed()){const u={pluginStatus:"loaded",pluginURL:i};return this.setState(u),u}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class Pt{constructor(e,i){this.isSupportedScript=Ah,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Vl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Vl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function Ah(r){return(function(e,i){for(const s of e)if(!$l(s.codePointAt(0),i))return!1;return!0})(r,An.getRTLTextPluginStatus()==="loaded")}const Ia="-transition";class Mo{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(o,u,h){if(mo(o))return new _o(o,u);if(Ls(o)){const f=zl(o,u,h);if(f.result==="error")throw new Error(f.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return f.value}{let f=o;return u.type==="color"&&typeof o=="string"?f=lt.parse(o):u.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?u.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?u.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?u.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?f=qi.parse(o):u.type==="projectionDefinition"&&typeof o=="string"&&(f=Zi.parse(o)):f=Qe.parse(o):f=$t.parse(o):f=Ri.parse(o),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>f}}})(i===void 0?e.specification.default:i,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class Io{constructor(e,i){this.property=e,this.value=new Mo(e,void 0,i)}transitioned(e,i){return new xu(this.property,this.value,i,yi({},e.transition,this.transition),e.now)}untransitioned(){return new xu(this.property,this.value,null,{},0)}}class ql{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}getValue(e){return Ji(this._values[e].value.value)}setValue(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Io(this._values[e].property,this._globalState)),this._values[e].value=new Mo(this._values[e].property,i===null?void 0:Ji(i),this._globalState)}getTransition(e){return Ji(this._values[e].transition)}setTransition(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Io(this._values[e].property,this._globalState)),this._values[e].transition=Ji(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const o=this.getTransition(i);o!==void 0&&(e[`${i}${Ia}`]=o)}return e}transitioned(e,i){const s=new bu(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,i._values[o]);return s}untransitioned(){const e=new bu(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class xu{constructor(e,i,s,o,u){this.property=e,this.value=i,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const o=e.now||0,u=this.value.possiblyEvaluate(e,i,s),h=this.prior;if(h){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o<this.begin)return h.possiblyEvaluate(e,i,s);{const f=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),u,_r(f))}}return u}}class bu{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const o=new Ea(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,i,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class wu{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Ji(this._values[e].value)}setValue(e,i){this._values[e]=new Mo(this._values[e].property,i===null?void 0:Ji(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const o=new Ea(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,i,s);return o}}class Lr{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,o){return this.property.evaluate(this.value,this.parameters,e,i,s,o)}}class Ea{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class He{constructor(e){this.specification=e}possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,s){const o=jt[this.specification.type];return o?o(e,i,s):e}}class Ke{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,o){return new Lr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,o)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Lr(this,{kind:"constant",value:void 0},e.parameters);const o=jt[this.specification.type];if(o){const u=o(e.value.value,i.value.value,s);return new Lr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,i,s,o,u,h){return e.kind==="constant"?e.value:e.evaluate(i,s,o,u,h)}}class Ca extends Ke{possiblyEvaluate(e,i,s,o){if(e.value===void 0)return new Lr(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const u=e.expression.evaluate(i,null,{},s,o),h=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(h,h,h,i);return new Lr(this,{kind:"constant",value:f},i)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new Lr(this,{kind:"constant",value:u},i)}return new Lr(this,e.expression,i)}evaluate(e,i,s,o,u,h){if(e.kind==="source"){const f=e.evaluate(i,s,o,u,h);return this._calculate(f,f,f,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,o),e.evaluate({zoom:Math.floor(i.zoom)},s,o),e.evaluate({zoom:Math.floor(i.zoom)+1},s,o),i):e.value}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class Eo{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(i,null,{},s,o);return this._calculate(u,u,u,i)}return this._calculate(e.expression.evaluate(new Pt(Math.floor(i.zoom-1),i)),e.expression.evaluate(new Pt(Math.floor(i.zoom),i)),e.expression.evaluate(new Pt(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class Co{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){return!!e.expression.evaluate(i,null,{},s,o)}interpolate(){return!1}}class Hi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const s=e[i];s.specification.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new Mo(s,void 0,void 0),u=this.defaultTransitionablePropertyValues[i]=new Io(s,void 0);this.defaultTransitioningPropertyValues[i]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate({})}}}Ge("DataDrivenProperty",Ke),Ge("DataConstantProperty",He),Ge("CrossFadedDataDrivenProperty",Ca),Ge("CrossFadedProperty",Eo),Ge("ColorRampProperty",Co);class Tr extends gt{constructor(e,i,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(o,u){return new ba(o,u)})(this.visibility,s),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=ma(e.filter,s)),i.layout&&(this._unevaluatedLayout=new wu(i.layout,s)),i.paint)){this._transitionablePaint=new ql(i.paint,s);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ea(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=ma(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const o of s.getGlobalStateRefs())e.add(o)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const o=this._transitionablePaint._values[s].value;for(const u of o.getGlobalStateRefs()){const h=(e=i.get(u))!==null&&e!==void 0?e:[];h.push({name:s,value:o.value}),i.set(u,h)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){if(i==null||!this._validate(Eh,`layers.${this.id}.layout.${e}`,e,i,s))return e==="visibility"?(this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){return e.endsWith(Ia)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){if(i!=null&&this._validate(Ih,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(Ia))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",h=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||h||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),yn(e,((i,s)=>!(i===void 0||s==="layout"&&!Object.keys(i).length||s==="paint"&&!Object.keys(i).length)))}_validate(e,i,s,o,u={}){return(!u||u.validate!==!1)&&Bs(this,e.call(xi,{key:i,layerType:this.type,objectKey:s,value:o,styleSpec:me,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Lr&&Rs(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Zl;var Tu={get paint(){return Zl=Zl||new Hi({"raster-opacity":new He(me.paint_raster["raster-opacity"]),"raster-hue-rotate":new He(me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new He(me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new He(me.paint_raster["raster-brightness-max"]),"raster-saturation":new He(me.paint_raster["raster-saturation"]),"raster-contrast":new He(me.paint_raster["raster-contrast"]),"raster-resampling":new He(me.paint_raster["raster-resampling"]),"raster-fade-duration":new He(me.paint_raster["raster-fade-duration"])})}};class zh extends Tr{constructor(e,i){super(e,Tu,i)}}const kh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Aa{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class qt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ni(r,e=1){let i=0,s=0;return{members:r.map((o=>{const u=kh[o.type].BYTES_PER_ELEMENT,h=i=is(i,Math.max(e,u)),f=o.components||1;return s=Math.max(s,u),i+=u*f,{name:o.name,type:o.type,components:f,offset:h}})),size:is(i,Math.max(s,e)),alignment:e}}function is(r,e){return Math.ceil(r/e)*e}class za extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=s,e}}za.prototype.bytesPerElement=4,Ge("StructArrayLayout2i4",za);class Ao extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=o,e}}Ao.prototype.bytesPerElement=6,Ge("StructArrayLayout3i6",Ao);class Wl extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,o)}emplace(e,i,s,o,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=o,this.int16[h+3]=u,e}}Wl.prototype.bytesPerElement=8,Ge("StructArrayLayout4i8",Wl);class zo extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,o,u,h)}emplace(e,i,s,o,u,h,f){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=f,e}}zo.prototype.bytesPerElement=12,Ge("StructArrayLayout2i4i12",zo);class Hl extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,o,u,h)}emplace(e,i,s,o,u,h,f){const g=4*e,y=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[y+4]=o,this.uint8[y+5]=u,this.uint8[y+6]=h,this.uint8[y+7]=f,e}}Hl.prototype.bytesPerElement=8,Ge("StructArrayLayout2i4ub8",Hl);class ka extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=s,e}}ka.prototype.bytesPerElement=8,Ge("StructArrayLayout2f8",ka);class on extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h,f,g,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,o,u,h,f,g,y,x)}emplace(e,i,s,o,u,h,f,g,y,x,w){const P=10*e;return this.uint16[P+0]=i,this.uint16[P+1]=s,this.uint16[P+2]=o,this.uint16[P+3]=u,this.uint16[P+4]=h,this.uint16[P+5]=f,this.uint16[P+6]=g,this.uint16[P+7]=y,this.uint16[P+8]=x,this.uint16[P+9]=w,e}}on.prototype.bytesPerElement=20,Ge("StructArrayLayout10ui20",on);class ko extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h,f,g){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,s,o,u,h,f,g)}emplace(e,i,s,o,u,h,f,g,y){const x=8*e;return this.uint16[x+0]=i,this.uint16[x+1]=s,this.uint16[x+2]=o,this.uint16[x+3]=u,this.uint16[x+4]=h,this.uint16[x+5]=f,this.uint16[x+6]=g,this.uint16[x+7]=y,e}}ko.prototype.bytesPerElement=16,Ge("StructArrayLayout8ui16",ko);class Da extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h,f,g,y,x,w,P){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,s,o,u,h,f,g,y,x,w,P)}emplace(e,i,s,o,u,h,f,g,y,x,w,P,E){const z=12*e;return this.int16[z+0]=i,this.int16[z+1]=s,this.int16[z+2]=o,this.int16[z+3]=u,this.uint16[z+4]=h,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=y,this.int16[z+8]=x,this.int16[z+9]=w,this.int16[z+10]=P,this.int16[z+11]=E,e}}Da.prototype.bytesPerElement=24,Ge("StructArrayLayout4i4ui4i24",Da);class Do extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=o,e}}Do.prototype.bytesPerElement=12,Ge("StructArrayLayout3f12",Do);class Ra extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Ra.prototype.bytesPerElement=4,Ge("StructArrayLayout1ul4",Ra);class Xl extends qt{_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(e,i,s,o,u,h,f,g,y){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,s,o,u,h,f,g,y)}emplace(e,i,s,o,u,h,f,g,y,x){const w=10*e,P=5*e;return this.int16[w+0]=i,this.int16[w+1]=s,this.int16[w+2]=o,this.int16[w+3]=u,this.int16[w+4]=h,this.int16[w+5]=f,this.uint32[P+3]=g,this.uint16[w+8]=y,this.uint16[w+9]=x,e}}Xl.prototype.bytesPerElement=20,Ge("StructArrayLayout6i1ul2ui20",Xl);class Ns extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,o,u,h)}emplace(e,i,s,o,u,h,f){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=f,e}}Ns.prototype.bytesPerElement=12,Ge("StructArrayLayout2i2i2i12",Ns);class rs extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,o,u)}emplace(e,i,s,o,u,h){const f=4*e,g=8*e;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=o,this.int16[g+6]=u,this.int16[g+7]=h,e}}rs.prototype.bytesPerElement=16,Ge("StructArrayLayout2f1f2i16",rs);class Yl extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,s,o,u,h)}emplace(e,i,s,o,u,h,f){const g=16*e,y=4*e,x=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[y+1]=o,this.float32[y+2]=u,this.int16[x+6]=h,this.int16[x+7]=f,e}}Yl.prototype.bytesPerElement=16,Ge("StructArrayLayout2ub2f2i16",Yl);class La extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=o,e}}La.prototype.bytesPerElement=6,Ge("StructArrayLayout3ui6",La);class ns extends qt{_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(e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N){const X=this.length;return this.resize(X+1),this.emplace(X,e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N)}emplace(e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N,X){const U=24*e,$=12*e,J=48*e;return this.int16[U+0]=i,this.int16[U+1]=s,this.uint16[U+2]=o,this.uint16[U+3]=u,this.uint32[$+2]=h,this.uint32[$+3]=f,this.uint32[$+4]=g,this.uint16[U+10]=y,this.uint16[U+11]=x,this.uint16[U+12]=w,this.float32[$+7]=P,this.float32[$+8]=E,this.uint8[J+36]=z,this.uint8[J+37]=k,this.uint8[J+38]=R,this.uint32[$+10]=N,this.int16[U+22]=X,e}}ns.prototype.bytesPerElement=48,Ge("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ns);class Kl extends qt{_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(e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N,X,U,$,J,te,he,Se,we,Me,Le,Ee){const Te=this.length;return this.resize(Te+1),this.emplace(Te,e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N,X,U,$,J,te,he,Se,we,Me,Le,Ee)}emplace(e,i,s,o,u,h,f,g,y,x,w,P,E,z,k,R,N,X,U,$,J,te,he,Se,we,Me,Le,Ee,Te){const ve=32*e,Ue=16*e;return this.int16[ve+0]=i,this.int16[ve+1]=s,this.int16[ve+2]=o,this.int16[ve+3]=u,this.int16[ve+4]=h,this.int16[ve+5]=f,this.int16[ve+6]=g,this.int16[ve+7]=y,this.uint16[ve+8]=x,this.uint16[ve+9]=w,this.uint16[ve+10]=P,this.uint16[ve+11]=E,this.uint16[ve+12]=z,this.uint16[ve+13]=k,this.uint16[ve+14]=R,this.uint16[ve+15]=N,this.uint16[ve+16]=X,this.uint16[ve+17]=U,this.uint16[ve+18]=$,this.uint16[ve+19]=J,this.uint16[ve+20]=te,this.uint16[ve+21]=he,this.uint16[ve+22]=Se,this.uint32[Ue+12]=we,this.float32[Ue+13]=Me,this.float32[Ue+14]=Le,this.uint16[ve+30]=Ee,this.uint16[ve+31]=Te,e}}Kl.prototype.bytesPerElement=64,Ge("StructArrayLayout8i15ui1ul2f2ui64",Kl);class Ro extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Ro.prototype.bytesPerElement=4,Ge("StructArrayLayout1f4",Ro);class Lo extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const u=3*e;return this.uint16[6*e+0]=i,this.float32[u+1]=s,this.float32[u+2]=o,e}}Lo.prototype.bytesPerElement=12,Ge("StructArrayLayout1ui2f12",Lo);class Jl extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const u=4*e;return this.uint32[2*e+0]=i,this.uint16[u+2]=s,this.uint16[u+3]=o,e}}Jl.prototype.bytesPerElement=8,Ge("StructArrayLayout1ul2ui8",Jl);class d extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=s,e}}d.prototype.bytesPerElement=4,Ge("StructArrayLayout2ui4",d);class t extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}t.prototype.bytesPerElement=2,Ge("StructArrayLayout1ui2",t);class n extends qt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,o)}emplace(e,i,s,o,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=o,this.float32[h+3]=u,e}}n.prototype.bytesPerElement=16,Ge("StructArrayLayout4f16",n);class a extends Aa{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 _e(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends Xl{get(e){return new a(this,e)}}Ge("CollisionBoxArray",c);class p extends Aa{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class m extends ns{get(e){return new p(this,e)}}Ge("PlacedSymbolArray",m);class _ extends Aa{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}_.prototype.size=64;class v extends Kl{get(e){return new _(this,e)}}Ge("SymbolInstanceArray",v);class b extends Ro{getoffsetX(e){return this.float32[1*e+0]}}Ge("GlyphOffsetArray",b);class T extends Ao{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ge("SymbolLineVertexArray",T);class A extends Aa{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}A.prototype.size=12;class C extends Lo{get(e){return new A(this,e)}}Ge("TextAnchorOffsetArray",C);class D extends Aa{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]}}D.prototype.size=8;class V extends Jl{get(e){return new D(this,e)}}Ge("FeatureIndexArray",V);class q extends za{}class W extends za{}class Z extends za{}class K extends zo{}class ie extends Hl{}class H extends ka{}class ee extends on{}class ne extends ko{}class Q extends Da{}class oe extends Do{}class be extends Ra{}class fe extends Ns{}class ge extends Yl{}class ye extends La{}class ze extends d{}const ke=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ie}=ke;class Fe{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,o){const u=this.segments[this.segments.length-1];return e>Fe.MAX_VERTEX_ARRAY_LENGTH&&vi(`Max vertices per segment is ${Fe.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Fe.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!u||u.vertexLength+e>Fe.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o?this.createNewSegment(i,s,o):u}createNewSegment(e,i,s){const o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(o.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(o),o}getOrCreateLatestSegment(e,i,s){return this.prepareSegment(0,e,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,o){return new Fe([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function it(r,e){return 256*(r=Ni(Math.floor(r),0,255))+Ni(Math.floor(e),0,255)}Fe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ge("SegmentVector",Fe);const bt=ni([{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"}]),Ft=ni([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var At,Vt,zt,Kt={exports:{}},Nt={exports:{}},bi={exports:{}},oi=(function(){if(zt)return Kt.exports;zt=1;var r=(At||(At=1,Nt.exports=function(i,s){var o,u,h,f,g,y,x,w;for(u=i.length-(o=3&i.length),h=s,g=3432918353,y=461845907,w=0;w<u;)x=255&i.charCodeAt(w)|(255&i.charCodeAt(++w))<<8|(255&i.charCodeAt(++w))<<16|(255&i.charCodeAt(++w))<<24,++w,h=27492+(65535&(f=5*(65535&(h=(h^=x=(65535&(x=(x=(65535&x)*g+(((x>>>16)*g&65535)<<16)&4294967295)<<15|x>>>17))*y+(((x>>>16)*y&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(x=0,o){case 3:x^=(255&i.charCodeAt(w+2))<<16;case 2:x^=(255&i.charCodeAt(w+1))<<8;case 1:h^=x=(65535&(x=(x=(65535&(x^=255&i.charCodeAt(w)))*g+(((x>>>16)*g&65535)<<16)&4294967295)<<15|x>>>17))*y+(((x>>>16)*y&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),Nt.exports),e=(Vt||(Vt=1,bi.exports=function(i,s){for(var o,u=i.length,h=s^u,f=0;u>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(o>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),bi.exports);return Kt.exports=r,Kt.exports.murmur3=r,Kt.exports.murmur2=e,Kt.exports})(),si=Oe(oi);class Ai{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,o){this.ids.push(zn(e)),this.positions.push(i,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=zn(e);let s=0,o=this.ids.length-1;for(;s<o;){const h=s+o>>1;this.ids[h]>=i?o=h:s=h+1}const u=[];for(;this.ids[s]===i;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,i){const s=new Float64Array(e.ids),o=new Uint32Array(e.positions);return ln(s,o,0,s.length-1),i&&i.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const i=new Ai;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function zn(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:si(String(r))}function ln(r,e,i,s){for(;i<s;){const o=r[i+s>>1];let u=i-1,h=s+1;for(;;){do u++;while(r[u]<o);do h--;while(r[h]>o);if(u>=h)break;Jr(r,u,h),Jr(e,3*u,3*h),Jr(e,3*u+1,3*h+1),Jr(e,3*u+2,3*h+2)}h-i<s-h?(ln(r,e,i,h),i=h+1):(ln(r,e,h+1,s),s=h)}}function Jr(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Ge("FeaturePositionMap",Ai);class ir{constructor(e,i){this.gl=e.gl,this.location=i}}class ss extends ir{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Fa extends ir{constructor(e,i){super(e,i),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class as extends ir{constructor(e,i){super(e,i),this.current=lt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Sr=new Float32Array(16);function Qr(r){return[it(255*r.r,255*r.g),it(255*r.b,255*r.a)]}class Fr{constructor(e,i,s){this.value=e,this.uniformNames=i.map((o=>`u_${o}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new as(e,i):new ss(e,i)}}class Br{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,s,o){let u=null;o==="u_pattern_to"?u=this.patternTo:o==="u_pattern_from"?u=this.patternFrom:o==="u_dasharray_to"?u=this.dashTo:o==="u_dasharray_from"?u=this.dashFrom:o==="u_pixel_ratio_to"?u=this.pixelRatioTo:o==="u_pixel_ratio_from"&&(u=this.pixelRatioFrom),u!==null&&e.set(u)}getBinding(e,i,s){return s.substr(0,9)==="u_pattern"||s.substr(0,12)==="u_dasharray_"?new Fa(e,i):new ss(e,i)}}class Dt{constructor(e,i,s,o){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,i,s){const o=this.paintVertexArray.length,u=this.expression.evaluate(new Pt(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(o,e,u)}updatePaintArray(e,i,s,o,u){const h=this.expression.evaluate(new Pt(0,u),s,o);this._setPaintValue(e,i,h)}_setPaintValue(e,i,s){if(this.type==="color"){const o=Qr(s);for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o[0],o[1])}else{for(let o=e;o<i;o++)this.paintVertexArray.emplace(o,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class kt{constructor(e,i,s,o,u,h){this.expression=e,this.uniformNames=i.map((f=>`u_${f}_t`)),this.type=s,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=i.map((f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new h}populatePaintArray(e,i,s){const o=this.expression.evaluate(new Pt(this.zoom,s),i,{},s.canonical,[],s.formattedSection),u=this.expression.evaluate(new Pt(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,o,u)}updatePaintArray(e,i,s,o,u){const h=this.expression.evaluate(new Pt(this.zoom,u),s,o),f=this.expression.evaluate(new Pt(this.zoom+1,u),s,o);this._setPaintValue(e,i,h,f)}_setPaintValue(e,i,s,o){if(this.type==="color"){const u=Qr(s),h=Qr(o);for(let f=e;f<i;f++)this.paintVertexArray.emplace(f,u[0],u[1],h[0],h[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,s,o);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=Ni(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,i,s){return new ss(e,i)}}class mi{constructor(e,i,s,o,u,h){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=o,this.layerId=h,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,i,s){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,o,u){this._setPaintValues(e,i,this.getPositionIds(s),u)}_setPaintValues(e,i,s,o){const u=this.getPositions(o);if(!u||!s)return;const h=u[s.min],f=u[s.mid],g=u[s.max];if(h&&f&&g)for(let y=e;y<i;y++)this.emplace(this.zoomInPaintVertexArray,y,f,h),this.emplace(this.zoomOutPaintVertexArray,y,f,g)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class gi extends mi{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return bt.members}emplace(e,i,s,o){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],s.pixelRatio,o.pixelRatio)}}class Su extends mi{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return Ft.members}emplace(e,i,s,o){e.emplace(i,0,s.y,s.height,s.width,0,o.y,o.height,o.width)}}class Pu{constructor(e,i,s){this.binders={},this._buffers=[];const o=[];for(const u in e.paint._values){if(!s(u))continue;const h=e.paint.get(u);if(!(h instanceof Lr&&Rs(h.property.specification)))continue;const f=Dh(u,e.type),g=h.value,y=h.property.specification.type,x=h.property.useIntegerZoom,w=h.property.specification["property-type"],P=w==="cross-faded"||w==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=P?new Br(g.value,f):new Fr(g.value,f,y),o.push(`/u_${u}`);else if(g.kind==="source"||P){const E=Mu(u,y,"source");this.binders[u]=P?u==="line-dasharray"?new Su(g,y,x,i,E,e.id):new gi(g,y,x,i,E,e.id):new Dt(g,f,y,E),o.push(`/a_${u}`)}else{const E=Mu(u,y,"composite");this.binders[u]=new kt(g,f,y,x,i,E),o.push(`/z_${u}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Dt||i instanceof kt?i.maxValue:0}populatePaintArrays(e,i,s){for(const o in this.binders){const u=this.binders[o];(u instanceof Dt||u instanceof kt||u instanceof mi)&&u.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof Br&&o.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof Br&&o.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,o,u){let h=!1;for(const f in e){const g=i.getPositions(f);for(const y of g){const x=s.feature(y.index);for(const w in this.binders){const P=this.binders[w];if((P instanceof Dt||P instanceof kt||P instanceof mi)&&P.expression.isStateDependent===!0){const E=o.paint.get(w);P.expression=E.value,P.updatePaintArray(y.start,y.end,x,e[f],u),h=!0}}}}return h}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Fr||s instanceof Br)&&e.push(...s.uniformNames.map((o=>`#define HAS_UNIFORM_${o}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Dt||s instanceof kt)for(let o=0;o<s.paintVertexAttributes.length;o++)e.push(s.paintVertexAttributes[o].name);else if(s instanceof mi){const o=s.getVertexAttributes();for(const u of o)e.push(u.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Fr||s instanceof Br||s instanceof kt)for(const o of s.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const o in this.binders){const u=this.binders[o];if(u instanceof Fr||u instanceof Br||u instanceof kt){for(const h of u.uniformNames)if(i[h]){const f=u.getBinding(e,i[h],h);s.push({name:h,property:o,binding:f})}}}return s}setUniforms(e,i,s,o){for(const{name:u,property:h,binding:f}of i)this.binders[h].setUniform(f,o,s.get(h),u)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof mi){const o=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(s instanceof Dt||s instanceof kt)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof Dt||s instanceof kt||s instanceof mi)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Dt||i instanceof kt||i instanceof mi)&&i.destroy()}}}class os{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Pu(o,i,s);this.needsUpload=!1,this._featureMap=new Ai,this._bufferOffset=0}populatePaintArrays(e,i,s,o){for(const u in this.programConfigurations)this.programConfigurations[u].populatePaintArrays(e,i,o);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,o){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,i,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Dh(r,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-dasharray":["dasharray_to","dasharray_from"],"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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Mu(r,e,i){const s={color:{source:ka,composite:n},number:{source:Ro,composite:ka}},o=(function(u){return{"line-pattern":{source:ee,composite:ee},"fill-pattern":{source:ee,composite:ee},"fill-extrusion-pattern":{source:ee,composite:ee},"line-dasharray":{source:ne,composite:ne}}[u]})(r);return o&&o[i]||s[e][i]}Ge("ConstantBinder",Fr),Ge("CrossFadedConstantBinder",Br),Ge("SourceExpressionBinder",Dt),Ge("CrossFadedPatternBinder",gi),Ge("CrossFadedDasharrayBinder",Su),Ge("CompositeExpressionBinder",kt),Ge("ProgramConfiguration",Pu,{omit:["_buffers"]}),Ge("ProgramConfigurationSet",os);const Ql=Math.pow(2,14)-1,kn=-Ql-1;function Dn(r){const e=ht/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const o=i[s];for(let u=0;u<o.length;u++){const h=o[u],f=Math.round(h.x*e),g=Math.round(h.y*e);h.x=Ni(f,kn,Ql),h.y=Ni(g,kn,Ql),(f<h.x||f>h.x+1||g<h.y||g>h.y+1)&&vi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Rn(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Dn(r):[]}}const ec=-32768;function tc(r,e,i,s,o){r.emplaceBack(ec+8*e+s,ec+8*i+o)}class Fo{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new W,this.indexArray=new ye,this.segments=new Fe,this.programConfigurations=new os(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const o=this.layers[0],u=[];let h=null,f=!1,g=o.type==="heatmap";if(o.type==="circle"){const x=o;h=x.layout.get("circle-sort-key"),f=!h.isConstant(),g=g||x.paint.get("circle-pitch-alignment")==="map"}const y=g?i.subdivisionGranularity.circle:1;for(const{feature:x,id:w,index:P,sourceLayerIndex:E}of e){const z=this.layers[0]._featureFilter.needGeometry,k=Rn(x,z);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),k,s))continue;const R=f?h.evaluate(k,{},s):void 0,N={id:w,properties:x.properties,type:x.type,sourceLayerIndex:E,index:P,geometry:z?k.geometry:Dn(x),patterns:{},sortKey:R};u.push(N)}f&&u.sort(((x,w)=>x.sortKey-w.sortKey));for(const x of u){const{geometry:w,index:P,sourceLayerIndex:E}=x,z=e[P].feature;this.addFeature(x,w,P,s,y),i.featureIndex.insert(z,w,P,E,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ie),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,o,u=1){let h;switch(u){case 1:h=[0,7];break;case 3:h=[0,2,5,7];break;case 5:h=[0,1,3,4,6,7];break;case 7:h=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${u}; valid values are 1, 3, 5, 7.`)}const f=h.length;for(const g of i)for(const y of g){const x=y.x,w=y.y;if(x<0||x>=ht||w<0||w>=ht)continue;const P=this.segments.prepareSegment(f*f,this.layoutVertexArray,this.indexArray,e.sortKey),E=P.vertexLength;for(let z=0;z<f;z++)for(let k=0;k<f;k++)tc(this.layoutVertexArray,x,w,h[k],h[z]);for(let z=0;z<f-1;z++)for(let k=0;k<f-1;k++){const R=E+z*f+k,N=E+(z+1)*f+k;this.indexArray.emplaceBack(R,N+1,R+1),this.indexArray.emplaceBack(R,N,N+1)}P.vertexLength+=f*f,P.primitiveLength+=(f-1)*(f-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:o})}}function Bo(r,e){for(let i=0;i<r.length;i++)if(Oo(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Oo(r,e[i]))return!0;return!!Rh(r,e)}function Iu(r,e,i){return!!Oo(r,e)||!!Lh(e,r,i)}function Xd(r,e){if(r.length===1)return Kd(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let o=0;o<s.length;o++)if(Oo(r,s[o]))return!0}for(let i=0;i<r.length;i++)if(Kd(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Rh(r,e[i]))return!0;return!1}function Um(r,e,i){if(r.length>1){if(Rh(r,e))return!0;for(let s=0;s<e.length;s++)if(Lh(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Lh(r[s],e,i))return!0;return!1}function Rh(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],o=r[i+1];for(let u=0;u<e.length-1;u++)if(Gm(s,o,e[u],e[u+1]))return!0}return!1}function Gm(r,e,i,s){return yr(r,i,s)!==yr(e,i,s)&&yr(r,e,i)!==yr(r,e,s)}function Lh(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let o=1;o<e.length;o++)if(Yd(r,e[o-1],e[o])<s)return!0;return!1}function Yd(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const o=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function Kd(r,e){let i,s,o,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,g=i.length-1;f<i.length;g=f++)s=i[f],o=i[g],s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(u=!u)}return u}function Oo(r,e){let i=!1;for(let s=0,o=r.length-1;s<r.length;o=s++){const u=r[s],h=r[o];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function $m(r,e,i){const s=i[0],o=i[2];if(r.x<s.x&&e.x<s.x||r.x>o.x&&e.x>o.x||r.y<s.y&&e.y<s.y||r.y>o.y&&e.y>o.y)return!1;const u=yr(r,e,i[0]);return u!==yr(r,e,i[1])||u!==yr(r,e,i[2])||u!==yr(r,e,i[3])}function jo(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Eu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Cu(r,e,i,s,o){if(!e[0]&&!e[1])return r;const u=_e.convert(e)._mult(o);i==="viewport"&&u._rotate(-s);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function qm(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],o=e.at(-1);(i===0||o&&!s.equals(o))&&e.push(s)}return e}function Zm({queryGeometry:r,size:e},i){return Iu(r,i,e)}function Wm({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},u){return Iu(r,u,e*(i.projectTileCoordinates(u.x,u.y,s,o).signedDistanceFromCamera/i.cameraToCenterDistance))}function Hm({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},u){const h=i.projectTileCoordinates(u.x,u.y,s,o).signedDistanceFromCamera,f=e*(i.cameraToCenterDistance/h);return Iu(r,Fh(u,i,s,o),f)}function Xm({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},u){return Iu(r,Fh(u,i,s,o),e)}function Jd({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o,pitchAlignment:u="map",pitchScale:h="map"},f){const g=u==="map"?h==="map"?Zm:Wm:h==="map"?Hm:Xm,y={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o};for(const x of f)for(const w of x)if(g(y,w))return!0;return!1}function Fh(r,e,i,s){const o=e.projectTileCoordinates(r.x,r.y,i,s).point;return new _e((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let Qd,ep;Ge("CircleBucket",Fo,{omit:["layers"]});var Ym={get paint(){return ep=ep||new Hi({"circle-radius":new Ke(me.paint_circle["circle-radius"]),"circle-color":new Ke(me.paint_circle["circle-color"]),"circle-blur":new Ke(me.paint_circle["circle-blur"]),"circle-opacity":new Ke(me.paint_circle["circle-opacity"]),"circle-translate":new He(me.paint_circle["circle-translate"]),"circle-translate-anchor":new He(me.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new He(me.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new He(me.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ke(me.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ke(me.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ke(me.paint_circle["circle-stroke-opacity"])})},get layout(){return Qd=Qd||new Hi({"circle-sort-key":new Ke(me.layout_circle["circle-sort-key"])})}};class Km extends Tr{constructor(e,i){super(e,Ym,i)}createBucket(e){return new Fo(e)}queryRadius(e){const i=e;return jo("circle-radius",this,i)+jo("circle-stroke-width",this,i)+Eu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:u,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){const y=Cu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-u.bearingInRadians,h),x=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),w=this.paint.get("circle-pitch-scale"),P=this.paint.get("circle-pitch-alignment");let E,z;return P==="map"?(E=y,z=x*h):(E=(function(k,R,N,X){return k.map((U=>Fh(U,R,N,X)))})(y,u,f,g),z=x),Jd({queryGeometry:E,size:z,transform:u,unwrappedTileID:f,getElevation:g,pitchAlignment:P,pitchScale:w},o)}}class tp extends Fo{}let ip;Ge("HeatmapBucket",tp,{omit:["layers"]});var Jm={get paint(){return ip=ip||new Hi({"heatmap-radius":new Ke(me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ke(me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new He(me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Co(me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new He(me.paint_heatmap["heatmap-opacity"])})}};function Bh(r,{width:e,height:i},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*s}`)}else o=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=o,r}function rp(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const o=Bh({},{width:e,height:i},s);Oh(r,o,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},s),r.width=e,r.height=i,r.data=o.data}function Oh(r,e,i,s,o,u){if(o.width===0||o.height===0)return e;if(o.width>r.width||o.height>r.height||i.x>r.width-o.width||i.y>r.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const h=r.data,f=e.data;if(h===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<o.height;g++){const y=((i.y+g)*r.width+i.x)*u,x=((s.y+g)*e.width+s.x)*u;for(let w=0;w<o.width*u;w++)f[x+w]=h[y+w]}return e}class ic{constructor(e,i){Bh(this,e,1,i)}resize(e){rp(this,e,1)}clone(){return new ic({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,u){Oh(e,i,s,o,u,1)}}class pr{constructor(e,i){Bh(this,e,4,i)}resize(e){rp(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new pr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,u){Oh(e,i,s,o,u,4)}setPixel(e,i,s){const o=4*(e*this.width+i);this.data[o+0]=Math.round(255*s.r/s.a),this.data[o+1]=Math.round(255*s.g/s.a),this.data[o+2]=Math.round(255*s.b/s.a),this.data[o+3]=Math.round(255*s.a)}}function np(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,o=r.image||new pr({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const u=(h,f,g)=>{e[r.evaluationKey]=g;const y=r.expression.evaluate(e);o.setPixel(h/4/i,f/4,y)};if(r.clips)for(let h=0,f=0;h<s;++h,f+=4*i)for(let g=0,y=0;g<i;g++,y+=4){const x=g/(i-1),{start:w,end:P}=r.clips[h];u(f,y,w*(1-x)+P*x)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return o}Ge("AlphaImage",ic),Ge("RGBAImage",pr);const jh="big-fb";class Qm extends Tr{createBucket(e){return new tp(e)}constructor(e,i){super(e,Jm,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=np({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(jh)&&this.heatmapFbos.delete(jh)}queryRadius(e){return jo("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:u,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){return Jd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*h,transform:u,unwrappedTileID:f,getElevation:g},o)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let sp;var eg={get paint(){return sp=sp||new Hi({"hillshade-illumination-direction":new He(me.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new He(me.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new He(me.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new He(me.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new He(me.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new He(me.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new He(me.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new He(me.paint_hillshade["hillshade-method"])})}};class tg extends Tr{constructor(e,i){super(e,eg,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,o=this.paint.get("hillshade-shadow-color").values;const u=Math.max(e.length,i.length,s.length,o.length);e=e.concat(Array(u-e.length).fill(e.at(-1))),i=i.concat(Array(u-i.length).fill(i.at(-1))),s=s.concat(Array(u-s.length).fill(s.at(-1))),o=o.concat(Array(u-o.length).fill(o.at(-1)));const h=i.map(ms);return{directionRadians:e.map(ms),altitudeRadians:h,shadowColor:o,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let ap;var ig={get paint(){return ap=ap||new Hi({"color-relief-opacity":new He(me["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Co(me["paint_color-relief"]["color-relief-color"])})}};class Vh{constructor(e,i,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,s){const{width:o,height:u}=e,h=!(this.size&&this.size[0]===o&&this.size[1]===u||s),{context:f}=this,{gl:g}=f;if(this.useMipmap=!!(i&&i.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA&&(!i||i.premultiply!==!1)),h)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||xn(e)?g.texImage2D(g.TEXTURE_2D,0,this.format,this.format,g.UNSIGNED_BYTE,e):g.texImage2D(g.TEXTURE_2D,0,this.format,o,u,0,this.format,g.UNSIGNED_BYTE,e.data);else{const{x:y,y:x}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||xn(e)?g.texSubImage2D(g.TEXTURE_2D,0,y,x,g.RGBA,g.UNSIGNED_BYTE,e):g.texSubImage2D(g.TEXTURE_2D,0,y,x,o,u,g.RGBA,g.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),f.pixelStoreUnpackFlipY.setDefault(),f.pixelStoreUnpack.setDefault(),f.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),s!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class op{constructor(e,i,s,o=1,u=1,h=1,f=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void vi(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=u,this.blueFactor=h,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let y=0;y<g;y++)this.data[this._idx(-1,y)]=this.data[this._idx(0,y)],this.data[this._idx(g,y)]=this.data[this._idx(g-1,y)],this.data[this._idx(y,-1)]=this.data[this._idx(y,0)],this.data[this._idx(y,g)]=this.data[this._idx(y,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let y=0;y<g;y++)for(let x=0;x<g;x++){const w=this.get(y,x);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(e,i){const s=new Uint8Array(this.data.buffer),o=4*this._idx(e,i);return this.unpack(s[o],s[o+1],s[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,s){return e*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return lp(e,this.getUnpackVector())}getPixels(){return new pr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,u=i*this.dim+this.dim,h=s*this.dim,f=s*this.dim+this.dim;switch(i){case-1:o=u-1;break;case 1:u=o+1}switch(s){case-1:h=f-1;break;case 1:f=h+1}const g=-i*this.dim,y=-s*this.dim;for(let x=h;x<f;x++)for(let w=o;w<u;w++)this.data[this._idx(w,x)]=e.data[this._idx(w+g,x+y)]}}function lp(r,e){const i=e[0],s=e[1],o=e[2],u=e[3],h=Math.min(i,s,o),f=Math.round((r+u)/h);return{r:Math.floor(f*h/i)%256,g:Math.floor(f*h/s)%256,b:Math.floor(f*h/o)%256}}Ge("DEMData",op);class rg extends Tr{constructor(e,i){super(e,ig,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof go&&s._styleExpression.expression instanceof Wi){this.colorRampExpression=s;const h=s._styleExpression.expression;i.elevationStops=h.labels,i.colorStops=[];for(const f of i.elevationStops)i.colorStops.push(h.evaluate({globals:{elevation:f}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[lt.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const o={elevationStops:[],colorStops:[]},u=(i.elevationStops.length-1)/(e-1);for(let h=0;h<i.elevationStops.length-.5;h+=u)o.elevationStops.push(i.elevationStops[Math.round(h)]),o.colorStops.push(i.colorStops[Math.round(h)]);return vi(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),o}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const o=this._createColorRamp(i),u=new pr({width:o.colorStops.length,height:1}),h=new pr({width:o.colorStops.length,height:1});for(let f=0;f<o.elevationStops.length;f++){const g=lp(o.elevationStops[f],s);h.setPixel(0,f,new lt(g.r/255,g.g/255,g.b/255,1)),u.setPixel(0,f,o.colorStops[f])}return this.colorRampTextures={elevationTexture:new Vh(e,h,e.gl.RGBA),colorTexture:new Vh(e,u,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const ng=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:sg}=ng;function Au(r,e,i){const s=i.patternDependencies;let o=!1;for(const u of e){const h=u.paint.get(`${r}-pattern`);h.isConstant()||(o=!0);const f=h.constantOr(null);f&&(o=!0,s[f.to]=!0,s[f.from]=!0)}return o}function Nh(r,e,i,s,o){const{zoom:u}=s,h=o.patternDependencies;for(const f of e){const g=f.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let y=g.evaluate({zoom:u-1},i,{},o.availableImages),x=g.evaluate({zoom:u},i,{},o.availableImages),w=g.evaluate({zoom:u+1},i,{},o.availableImages);y=y&&y.name?y.name:y,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,h[y]=!0,h[x]=!0,h[w]=!0,i.patterns[f.id]={min:y,mid:x,max:w}}}return i}function cp(r,e,i,s,o){let u;if(o===(function(h,f,g,y){let x=0;for(let w=f,P=g-y;w<g;w+=y)x+=(h[P]-h[w])*(h[w+1]+h[P+1]),P=w;return x})(r,e,i,s)>0)for(let h=e;h<i;h+=s)u=pp(h/s|0,r[h],r[h+1],u);else for(let h=i-s;h>=e;h-=s)u=pp(h/s|0,r[h],r[h+1],u);return u&&Vo(u,u.next)&&(ac(u),u=u.next),u}function Ba(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Vo(s,s.next)&&li(s.prev,s,s.next)!==0)s=s.next;else{if(ac(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function rc(r,e,i,s,o,u,h){if(!r)return;!h&&u&&(function(g,y,x,w){let P=g;do P.z===0&&(P.z=Uh(P.x,P.y,y,x,w)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==g);P.prevZ.nextZ=null,P.prevZ=null,(function(E){let z,k=1;do{let R,N=E;E=null;let X=null;for(z=0;N;){z++;let U=N,$=0;for(let te=0;te<k&&($++,U=U.nextZ,U);te++);let J=k;for(;$>0||J>0&&U;)$!==0&&(J===0||!U||N.z<=U.z)?(R=N,N=N.nextZ,$--):(R=U,U=U.nextZ,J--),X?X.nextZ=R:E=R,R.prevZ=X,X=R;N=U}X.nextZ=null,k*=2}while(z>1)})(P)})(r,s,o,u);let f=r;for(;r.prev!==r.next;){const g=r.prev,y=r.next;if(u?og(r,s,o,u):ag(r))e.push(g.i,r.i,y.i),ac(r),r=y.next,f=y.next;else if((r=y)===f){h?h===1?rc(r=lg(Ba(r),e),e,i,s,o,u,2):h===2&&cg(r,e,i,s,o,u):rc(Ba(r),e,i,s,o,u,1);break}}}function ag(r){const e=r.prev,i=r,s=r.next;if(li(e,i,s)>=0)return!1;const o=e.x,u=i.x,h=s.x,f=e.y,g=i.y,y=s.y,x=Math.min(o,u,h),w=Math.min(f,g,y),P=Math.max(o,u,h),E=Math.max(f,g,y);let z=s.next;for(;z!==e;){if(z.x>=x&&z.x<=P&&z.y>=w&&z.y<=E&&nc(o,f,u,g,h,y,z.x,z.y)&&li(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function og(r,e,i,s){const o=r.prev,u=r,h=r.next;if(li(o,u,h)>=0)return!1;const f=o.x,g=u.x,y=h.x,x=o.y,w=u.y,P=h.y,E=Math.min(f,g,y),z=Math.min(x,w,P),k=Math.max(f,g,y),R=Math.max(x,w,P),N=Uh(E,z,e,i,s),X=Uh(k,R,e,i,s);let U=r.prevZ,$=r.nextZ;for(;U&&U.z>=N&&$&&$.z<=X;){if(U.x>=E&&U.x<=k&&U.y>=z&&U.y<=R&&U!==o&&U!==h&&nc(f,x,g,w,y,P,U.x,U.y)&&li(U.prev,U,U.next)>=0||(U=U.prevZ,$.x>=E&&$.x<=k&&$.y>=z&&$.y<=R&&$!==o&&$!==h&&nc(f,x,g,w,y,P,$.x,$.y)&&li($.prev,$,$.next)>=0))return!1;$=$.nextZ}for(;U&&U.z>=N;){if(U.x>=E&&U.x<=k&&U.y>=z&&U.y<=R&&U!==o&&U!==h&&nc(f,x,g,w,y,P,U.x,U.y)&&li(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;$&&$.z<=X;){if($.x>=E&&$.x<=k&&$.y>=z&&$.y<=R&&$!==o&&$!==h&&nc(f,x,g,w,y,P,$.x,$.y)&&li($.prev,$,$.next)>=0)return!1;$=$.nextZ}return!0}function lg(r,e){let i=r;do{const s=i.prev,o=i.next.next;!Vo(s,o)&&hp(s,i,i.next,o)&&sc(s,o)&&sc(o,s)&&(e.push(s.i,i.i,o.i),ac(i),ac(i.next),i=r=o),i=i.next}while(i!==r);return Ba(i)}function cg(r,e,i,s,o,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&fg(h,f)){let g=dp(h,f);return h=Ba(h,h.next),g=Ba(g,g.next),rc(h,e,i,s,o,u,0),void rc(g,e,i,s,o,u,0)}f=f.next}h=h.next}while(h!==r)}function ug(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function hg(r,e){const i=(function(o,u){let h=u;const f=o.x,g=o.y;let y,x=-1/0;if(Vo(o,h))return h;do{if(Vo(o,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const k=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(k<=f&&k>x&&(x=k,y=h.x<h.next.x?h:h.next,k===f))return y}h=h.next}while(h!==u);if(!y)return null;const w=y,P=y.x,E=y.y;let z=1/0;h=y;do{if(f>=h.x&&h.x>=P&&f!==h.x&&up(g<E?f:x,g,P,E,g<E?x:f,g,h.x,h.y)){const k=Math.abs(g-h.y)/(f-h.x);sc(h,o)&&(k<z||k===z&&(h.x>y.x||h.x===y.x&&dg(y,h)))&&(y=h,z=k)}h=h.next}while(h!==w);return y})(r,e);if(!i)return e;const s=dp(i,r);return Ba(s,s.next),Ba(i,i.next)}function dg(r,e){return li(r.prev,r,e.prev)<0&&li(e.next,r,r.next)<0}function Uh(r,e,i,s,o){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function pg(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function up(r,e,i,s,o,u,h,f){return(o-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(s-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(o-h)*(s-f)}function nc(r,e,i,s,o,u,h,f){return!(r===h&&e===f)&&up(r,e,i,s,o,u,h,f)}function fg(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==s.i&&o.next.i!==s.i&&hp(o,o.next,i,s))return!0;o=o.next}while(o!==i);return!1})(r,e)&&(sc(r,e)&&sc(e,r)&&(function(i,s){let o=i,u=!1;const h=(i.x+s.x)/2,f=(i.y+s.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&h<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==i);return u})(r,e)&&(li(r.prev,r,e.prev)||li(r,e.prev,e))||Vo(r,e)&&li(r.prev,r,r.next)>0&&li(e.prev,e,e.next)>0)}function li(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Vo(r,e){return r.x===e.x&&r.y===e.y}function hp(r,e,i,s){const o=ku(li(r,e,i)),u=ku(li(r,e,s)),h=ku(li(i,s,r)),f=ku(li(i,s,e));return o!==u&&h!==f||!(o!==0||!zu(r,i,e))||!(u!==0||!zu(r,s,e))||!(h!==0||!zu(i,r,s))||!(f!==0||!zu(i,e,s))}function zu(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function ku(r){return r>0?1:r<0?-1:0}function sc(r,e){return li(r.prev,r,r.next)<0?li(r,e,r.next)>=0&&li(r,r.prev,e)>=0:li(r,e,r.prev)<0||li(r,r.next,e)<0}function dp(r,e){const i=Gh(r.i,r.x,r.y),s=Gh(e.i,e.x,e.y),o=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=o,o.prev=i,s.next=i,i.prev=s,u.next=s,s.prev=u,s}function pp(r,e,i,s){const o=Gh(r,e,i);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function ac(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Gh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class No{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Du{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Du.noSubdivision=new Du({fill:new No(0,0),line:new No(0,0),tile:new No(0,0),stencil:new No(0,0),circle:1}),Ge("SubdivisionGranularityExpression",No),Ge("SubdivisionGranularitySetting",Du);const Uo=-32768,oc=32767;class mg{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=ht/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(e),o=0|Math.round(i),u=this._getKey(s,o);if(this._vertexDictionary.has(u))return this._vertexDictionary.get(u);const h=this._vertexBuffer.length/2;return this._vertexDictionary.set(u,h),this._vertexBuffer.push(s,o),h}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(o,u){const h=[];for(let f=0;f<u.length;f+=3){const g=u[f],y=u[f+1],x=u[f+2],w=o[2*g],P=o[2*g+1];(o[2*y]-w)*(o[2*x+1]-P)-(o[2*y+1]-P)*(o[2*x]-w)>0?(h.push(g),h.push(x),h.push(y)):(h.push(g),h.push(y),h.push(x))}return h})(this._vertexBuffer,e);const i=[],s=e.length;for(let o=0;o<s;o+=3){const u=[e[o+0],e[o+1],e[o+2]],h=[this._vertexBuffer[2*e[o+0]+0],this._vertexBuffer[2*e[o+0]+1],this._vertexBuffer[2*e[o+1]+0],this._vertexBuffer[2*e[o+1]+1],this._vertexBuffer[2*e[o+2]+0],this._vertexBuffer[2*e[o+2]+1]];let f=1/0,g=1/0,y=-1/0,x=-1/0;for(let k=0;k<3;k++){const R=h[2*k],N=h[2*k+1];f=Math.min(f,R),y=Math.max(y,R),g=Math.min(g,N),x=Math.max(x,N)}if(f===y||g===x)continue;const w=Math.floor(f/this._granularityCellSize),P=Math.ceil(y/this._granularityCellSize),E=Math.floor(g/this._granularityCellSize),z=Math.ceil(x/this._granularityCellSize);if(w!==P||E!==z)for(let k=E;k<z;k++){const R=this._scanlineGenerateVertexRingForCellRow(k,h,u);gg(this._vertexBuffer,R,i)}else i.push(...u)}return i}_scanlineGenerateVertexRingForCellRow(e,i,s){const o=e*this._granularityCellSize,u=o+this._granularityCellSize,h=[];for(let f=0;f<3;f++){const g=i[2*f],y=i[2*f+1],x=i[2*(f+1)%6],w=i[(2*(f+1)+1)%6],P=i[2*(f+2)%6],E=i[(2*(f+2)+1)%6],z=x-g,k=w-y,R=z===0,N=k===0,X=(o-y)/k,U=(u-y)/k,$=Math.min(X,U),J=Math.max(X,U);if(!N&&($>=1||J<=0)||N&&(y<o||y>u)){w>=o&&w<=u&&h.push(s[(f+1)%3]);continue}!N&&$>0&&h.push(this._vertexToIndex(g+z*$,y+k*$));const te=g+z*Math.max($,0),he=g+z*Math.min(J,1);R||this._generateIntraEdgeVertices(h,g,y,x,w,te,he),!N&&J<1&&h.push(this._vertexToIndex(g+z*J,y+k*J)),(N||w>=o&&w<=u)&&h.push(s[(f+1)%3]),!N&&(w<=o||w>=u)&&this._generateInterEdgeVertices(h,g,y,x,w,P,E,he,o,u)}return h}_generateIntraEdgeVertices(e,i,s,o,u,h,f){const g=o-i,y=u-s,x=y===0,w=x?Math.min(i,o):Math.min(h,f),P=x?Math.max(i,o):Math.max(h,f),E=Math.floor(w/this._granularityCellSize)+1,z=Math.ceil(P/this._granularityCellSize)-1;if(x?i<o:h<f)for(let k=E;k<=z;k++){const R=k*this._granularityCellSize;e.push(this._vertexToIndex(R,s+y*(R-i)/g))}else for(let k=z;k>=E;k--){const R=k*this._granularityCellSize;e.push(this._vertexToIndex(R,s+y*(R-i)/g))}}_generateInterEdgeVertices(e,i,s,o,u,h,f,g,y,x){const w=u-s,P=h-o,E=f-u,z=(y-u)/E,k=(x-u)/E,R=Math.min(z,k),N=Math.max(z,k),X=o+P*R;let U=Math.floor(Math.min(X,g)/this._granularityCellSize)+1,$=Math.ceil(Math.max(X,g)/this._granularityCellSize)-1,J=g<X;const te=E===0;if(te&&(f===y||f===x))return;if(te||R>=1||N<=0){const Se=s-f,we=h+(i-h)*Math.min((y-f)/Se,(x-f)/Se);U=Math.floor(Math.min(we,g)/this._granularityCellSize)+1,$=Math.ceil(Math.max(we,g)/this._granularityCellSize)-1,J=g<we}const he=w>0?x:y;if(J)for(let Se=U;Se<=$;Se++)e.push(this._vertexToIndex(Se*this._granularityCellSize,he));else for(let Se=$;Se>=U;Se--)e.push(this._vertexToIndex(Se*this._granularityCellSize,he))}_generateOutline(e){const i=[];for(const s of e){const o=Oa(s,this._granularity,!0),u=this._pointArrayToIndices(o),h=[];for(let f=1;f<u.length;f++)h.push(u[f-1]),h.push(u[f]);i.push(h)}return i}_handlePoles(e){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(e,i,s)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const s=e[i+1];s===Uo&&(e[i+1]=-32767),s===oc&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,o,u,h){o>u!=(h===Uo)?(e.push(i),e.push(s),e.push(this._vertexToIndex(o,h)),e.push(s),e.push(this._vertexToIndex(u,h)),e.push(this._vertexToIndex(o,h))):(e.push(s),e.push(i),e.push(this._vertexToIndex(o,h)),e.push(this._vertexToIndex(u,h)),e.push(s),e.push(this._vertexToIndex(o,h)))}_fillPoles(e,i,s){const o=this._vertexBuffer,u=ht,h=e.length;for(let f=2;f<h;f+=3){const g=e[f-2],y=e[f-1],x=e[f],w=o[2*g],P=o[2*g+1],E=o[2*y],z=o[2*y+1],k=o[2*x],R=o[2*x+1];i&&(P===0&&z===0&&this._generatePoleQuad(e,g,y,w,E,Uo),z===0&&R===0&&this._generatePoleQuad(e,y,x,E,k,Uo),R===0&&P===0&&this._generatePoleQuad(e,x,g,k,w,Uo)),s&&(P===u&&z===u&&this._generatePoleQuad(e,g,y,w,E,oc),z===u&&R===u&&this._generatePoleQuad(e,y,x,E,k,oc),R===u&&P===u&&this._generatePoleQuad(e,x,g,k,w,oc))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:o}=(function(f){const g=[],y=[];for(const x of f)if(x.length!==0){x!==f[0]&&g.push(y.length/2);for(let w=0;w<x.length;w++)y.push(x[w].x),y.push(x[w].y)}return{flattened:y,holeIndices:g}})(e);let u;this._initializeVertices(s);try{const f=(function(y,x,w=2){const P=x&&x.length,E=P?x[0]*w:y.length;let z=cp(y,0,E,w,!0);const k=[];if(!z||z.next===z.prev)return k;let R,N,X;if(P&&(z=(function(U,$,J,te){const he=[];for(let Se=0,we=$.length;Se<we;Se++){const Me=cp(U,$[Se]*te,Se<we-1?$[Se+1]*te:U.length,te,!1);Me===Me.next&&(Me.steiner=!0),he.push(pg(Me))}he.sort(ug);for(let Se=0;Se<he.length;Se++)J=hg(he[Se],J);return J})(y,x,z,w)),y.length>80*w){R=y[0],N=y[1];let U=R,$=N;for(let J=w;J<E;J+=w){const te=y[J],he=y[J+1];te<R&&(R=te),he<N&&(N=he),te>U&&(U=te),he>$&&($=he)}X=Math.max(U-R,$-N),X=X!==0?32767/X:0}return rc(z,k,w,R,N,X,0),k})(s,o),g=this._convertIndices(s,f);u=this._subdivideTrianglesScanline(g)}catch(f){console.error(f)}let h=[];return i&&(h=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(u),{verticesFlattened:this._vertexBuffer,indicesTriangles:u,indicesLineList:h}}_convertIndices(e,i){const s=[];for(let o=0;o<i.length;o++)s.push(this._vertexToIndex(e[2*i[o]],e[2*i[o]+1]));return s}_pointArrayToIndices(e){const i=[];for(let s=0;s<e.length;s++){const o=e[s];i.push(this._vertexToIndex(o.x,o.y))}return i}}function fp(r,e,i,s=!0){return new mg(i,e).subdividePolygonInternal(r,s)}function Oa(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],o=r[r.length-1],u=i&&(s.x!==o.x||s.y!==o.y);if(e<2)return u?[...r,r[0]]:[...r];const h=Math.floor(ht/e),f=[];f.push(new _e(r[0].x,r[0].y));const g=r.length,y=u?g:g-1;for(let x=0;x<y;x++){const w=r[x],P=x<g-1?r[x+1]:r[0],E=w.x,z=w.y,k=P.x,R=P.y,N=E!==k,X=z!==R;if(!N&&!X)continue;const U=k-E,$=R-z,J=Math.abs(U),te=Math.abs($);let he=E,Se=z;for(;;){const Me=U>0?(Math.floor(he/h)+1)*h:(Math.ceil(he/h)-1)*h,Le=$>0?(Math.floor(Se/h)+1)*h:(Math.ceil(Se/h)-1)*h,Ee=Math.abs(he-Me),Te=Math.abs(Se-Le),ve=Math.abs(he-k),Ue=Math.abs(Se-R),Ve=N?Ee/J:Number.POSITIVE_INFINITY,$e=X?Te/te:Number.POSITIVE_INFINITY;if((ve<=Ee||!N)&&(Ue<=Te||!X))break;if(Ve<$e&&N||!X){he=Me,Se+=$*Ve;const Be=new _e(he,Math.round(Se));f[f.length-1].x===Be.x&&f[f.length-1].y===Be.y||f.push(Be)}else{he+=U*$e,Se=Le;const Be=new _e(Math.round(he),Se);f[f.length-1].x===Be.x&&f[f.length-1].y===Be.y||f.push(Be)}}const we=new _e(k,R);f[f.length-1].x===we.x&&f[f.length-1].y===we.y||f.push(we)}return f}function gg(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,o=r[2*e[0]];for(let g=1;g<e.length;g++){const y=r[2*e[g]];y<o&&(o=y,s=g)}const u=e.length;let h=s,f=(h+1)%u;for(;;){const g=h-1>=0?h-1:u-1,y=(f+1)%u,x=r[2*e[g]],w=r[2*e[y]],P=r[2*e[h]],E=r[2*e[h]+1],z=r[2*e[f]+1];let k=!1;if(x<w)k=!0;else if(x>w)k=!1;else{const R=z-E,N=-(r[2*e[f]]-P),X=E<z?1:-1;((x-P)*R+(r[2*e[g]+1]-E)*N)*X>((w-P)*R+(r[2*e[y]+1]-E)*N)*X&&(k=!0)}if(k){const R=e[g],N=e[h],X=e[f];R!==N&&R!==X&&N!==X&&i.push(X,N,R),h--,h<0&&(h=u-1)}else{const R=e[y],N=e[h],X=e[f];R!==N&&R!==X&&N!==X&&i.push(X,N,R),f++,f>=u&&(f=0)}if(g===y)break}}function mp(r,e,i,s,o,u,h,f,g){const y=o.length/2,x=h&&f&&g;if(y<Fe.MAX_VERTEX_ARRAY_LENGTH){const w=e.prepareSegment(y,i,s),P=w.vertexLength;for(let k=0;k<u.length;k+=3)s.emplaceBack(P+u[k],P+u[k+1],P+u[k+2]);let E,z;w.vertexLength+=y,w.primitiveLength+=u.length/3,x&&(z=h.prepareSegment(y,i,f),E=z.vertexLength,z.vertexLength+=y);for(let k=0;k<o.length;k+=2)r(o[k],o[k+1]);if(x)for(let k=0;k<g.length;k++){const R=g[k];for(let N=1;N<R.length;N+=2)f.emplaceBack(E+R[N-1],E+R[N]);z.primitiveLength+=R.length/2}}else(function(w,P,E,z,k,R){const N=[];for(let te=0;te<z.length/2;te++)N.push(-1);const X={count:0};let U=0,$=w.getOrCreateLatestSegment(P,E),J=$.vertexLength;for(let te=2;te<k.length;te+=3){const he=k[te-2],Se=k[te-1],we=k[te];let Me=N[he]<U,Le=N[Se]<U,Ee=N[we]<U;$.vertexLength+((Me?1:0)+(Le?1:0)+(Ee?1:0))>Fe.MAX_VERTEX_ARRAY_LENGTH&&($=w.createNewSegment(P,E),U=X.count,Me=!0,Le=!0,Ee=!0,J=0);const Te=lc(N,z,R,X,he,Me,$),ve=lc(N,z,R,X,Se,Le,$),Ue=lc(N,z,R,X,we,Ee,$);E.emplaceBack(J+Te-U,J+ve-U,J+Ue-U),$.primitiveLength++}})(e,i,s,o,u,r),x&&(function(w,P,E,z,k,R){const N=[];for(let te=0;te<z.length/2;te++)N.push(-1);const X={count:0};let U=0,$=w.getOrCreateLatestSegment(P,E),J=$.vertexLength;for(let te=0;te<k.length;te++){const he=k[te];for(let Se=1;Se<k[te].length;Se+=2){const we=he[Se-1],Me=he[Se];let Le=N[we]<U,Ee=N[Me]<U;$.vertexLength+((Le?1:0)+(Ee?1:0))>Fe.MAX_VERTEX_ARRAY_LENGTH&&($=w.createNewSegment(P,E),U=X.count,Le=!0,Ee=!0,J=0);const Te=lc(N,z,R,X,we,Le,$),ve=lc(N,z,R,X,Me,Ee,$);E.emplaceBack(J+Te-U,J+ve-U),$.primitiveLength++}}})(h,i,f,o,g,r),e.forceNewSegmentOnNextPrepare(),h?.forceNewSegmentOnNextPrepare()}function lc(r,e,i,s,o,u,h){if(u){const f=s.count;return i(e[2*o],e[2*o+1]),r[o]=s.count,s.count++,h.vertexLength++,f}return r[o]}class $h{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Z,this.indexArray=new ye,this.indexArray2=new ze,this.programConfigurations=new os(e.layers,e.zoom),this.segments=new Fe,this.segments2=new Fe,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=Au("fill",this.layers,i);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:x}of e){const w=this.layers[0]._featureFilter.needGeometry,P=Rn(f,w);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),P,s))continue;const E=u?o.evaluate(P,{},s,i.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:y,geometry:w?P.geometry:Dn(f),patterns:{},sortKey:E};h.push(z)}u&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:x}=f;if(this.hasDependencies){const w=Nh("fill",this.layers,f,{zoom:this.zoom},i);this.patternFeatures.push(w)}else this.addFeature(f,g,y,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[y].feature,g,y,x,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,i,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sg),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,i,s,o,u,h){for(const f of no(i,500)){const g=fp(f,o,h.fill.getGranularityForZoomLevel(o.z)),y=this.layoutVertexArray;mp(((x,w)=>{y.emplaceBack(x,w)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:u,canonical:o})}}let gp,_p;Ge("FillBucket",$h,{omit:["layers","patternFeatures"]});var _g={get paint(){return _p=_p||new Hi({"fill-antialias":new He(me.paint_fill["fill-antialias"]),"fill-opacity":new Ke(me.paint_fill["fill-opacity"]),"fill-color":new Ke(me.paint_fill["fill-color"]),"fill-outline-color":new Ke(me.paint_fill["fill-outline-color"]),"fill-translate":new He(me.paint_fill["fill-translate"]),"fill-translate-anchor":new He(me.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ca(me.paint_fill["fill-pattern"])})},get layout(){return gp=gp||new Hi({"fill-sort-key":new Ke(me.layout_fill["fill-sort-key"])})}};class yg extends Tr{constructor(e,i){super(e,_g,i)}recalculate(e,i){super.recalculate(e,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new $h(e)}queryRadius(){return Eu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:o}){return Xd(Cu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,o),i)}isTileClipped(){return!0}}const vg=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),xg=ni([{name:"a_centroid",components:2,type:"Int16"}],4),{members:bg}=vg;class cc{constructor(e,i,s,o,u){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=o,this._values=u,e.readFields(wg,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let o,u=1,h=0,f=0,g=0;for(;e.pos<i;){if(h<=0){const y=e.readVarint();u=7&y,h=y>>3}if(h--,u===1||u===2)f+=e.readSVarint(),g+=e.readSVarint(),u===1&&(o&&s.push(o),o=[]),o&&o.push(new _e(f,g));else{if(u!==7)throw new Error(`unknown command ${u}`);o&&o.push(o[0].clone())}}return o&&s.push(o),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,o=0,u=0,h=0,f=1/0,g=-1/0,y=1/0,x=-1/0;for(;e.pos<i;){if(o<=0){const w=e.readVarint();s=7&w,o=w>>3}if(o--,s===1||s===2)u+=e.readSVarint(),h+=e.readSVarint(),u<f&&(f=u),u>g&&(g=u),h<y&&(y=h),h>x&&(x=h);else if(s!==7)throw new Error(`unknown command ${s}`)}return[f,y,g,x]}toGeoJSON(e,i,s){const o=this.extent*Math.pow(2,s),u=this.extent*e,h=this.extent*i,f=this.loadGeometry();function g(P){return[360*(P.x+u)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(P.y+h)/o)*Math.PI))-90]}function y(P){return P.map(g)}let x;if(this.type===1){const P=[];for(const z of f)P.push(z[0]);const E=y(P);x=P.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){const P=f.map(y);x=P.length===1?{type:"LineString",coordinates:P[0]}:{type:"MultiLineString",coordinates:P}}else{if(this.type!==3)throw new Error("unknown feature type");{const P=yp(f),E=[];for(const z of P)E.push(z.map(y));x=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}const w={type:"Feature",geometry:x,properties:this.properties};return this.id!=null&&(w.id=this.id),w}}function wg(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,o){const u=s.readVarint()+s.pos;for(;s.pos<u;){const h=o._keys[s.readVarint()],f=o._values[s.readVarint()];o.properties[h]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function yp(r){const e=r.length;if(e<=1)return[r];const i=[];let s,o;for(let u=0;u<e;u++){const h=Tg(r[u]);h!==0&&(o===void 0&&(o=h<0),o===h<0?(s&&i.push(s),s=[r[u]]):s&&s.push(r[u]))}return s&&i.push(s),i}function Tg(r){let e=0;for(let i,s,o=0,u=r.length,h=u-1;o<u;h=o++)i=r[o],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}cc.types=["Unknown","Point","LineString","Polygon"];class Sg{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Pg,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new cc(this._pbf,i,this.extent,this._keys,this._values)}}function Pg(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(s){let o=null;const u=s.readVarint()+s.pos;for(;s.pos<u;){const h=s.readVarint()>>3;o=h===1?s.readString():h===2?s.readFloat():h===3?s.readDouble():h===4?s.readVarint64():h===5?s.readVarint():h===6?s.readSVarint():h===7?s.readBoolean():null}if(o==null)throw new Error("unknown feature value");return o})(i))}class vp{constructor(e,i){this.layers=e.readFields(Mg,{},i)}}function Mg(r,e,i){if(r===3){const s=new Sg(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const qh=Math.pow(2,13);function uc(r,e,i,s,o,u,h,f){r.emplaceBack(e,i,2*Math.floor(s*qh)+h,o*qh*2,u*qh*2,Math.round(f))}class Zh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new K,this.centroidVertexArray=new q,this.indexArray=new ye,this.programConfigurations=new os(e.layers,e.zoom),this.segments=new Fe,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=Au("fill-extrusion",this.layers,i);for(const{feature:o,id:u,index:h,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,y=Rn(o,g);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),y,s))continue;const x={id:u,sourceLayerIndex:f,index:h,geometry:g?y.geometry:Dn(o),properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Nh("fill-extrusion",this.layers,x,{zoom:this.zoom},i)):this.addFeature(x,x.geometry,h,s,{},i.subdivisionGranularity),i.featureIndex.insert(o,x.geometry,h,f,this.index,!0)}}addFeatures(e,i,s){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,i,s,e.subdivisionGranularity)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bg),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,xg.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,i,s,o,u,h){for(const f of no(i,500)){const g={x:0,y:0,sampleCount:0},y=this.layoutVertexArray.length;this.processPolygon(g,o,e,f,h);const x=this.layoutVertexArray.length-y,w=Math.floor(g.x/g.sampleCount),P=Math.floor(g.y/g.sampleCount);for(let E=0;E<x;E++)this.centroidVertexArray.emplaceBack(w,P)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:u,canonical:o})}processPolygon(e,i,s,o,u){if(o.length<1||xp(o[0]))return;for(const w of o)w.length!==0&&Ig(e,w);const h={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},f=u.fill.getGranularityForZoomLevel(i.z),g=cc.types[s.type]==="Polygon";for(const w of o){if(w.length===0||xp(w))continue;const P=Oa(w,f,g);this._generateSideFaces(P,h)}if(!g)return;const y=fp(o,i,f,!1),x=this.layoutVertexArray;mp(((w,P)=>{uc(x,w,P,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let o=1;o<e.length;o++){const u=e[o],h=e[o-1];if(Eg(u,h))continue;i.segment.vertexLength+4>Fe.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const f=u.sub(h)._perp()._unit(),g=h.dist(u);s+g>32768&&(s=0),uc(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,0,s),uc(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,1,s),s+=g,uc(this.layoutVertexArray,h.x,h.y,f.x,f.y,0,0,s),uc(this.layoutVertexArray,h.x,h.y,f.x,f.y,0,1,s);const y=i.segment.vertexLength;this.indexArray.emplaceBack(y,y+2,y+1),this.indexArray.emplaceBack(y+1,y+2,y+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function Ig(r,e){for(let i=0;i<e.length;i++){const s=e[i];i===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function Eg(r,e){return r.x===e.x&&(r.x<0||r.x>ht)||r.y===e.y&&(r.y<0||r.y>ht)}function xp(r){return r.every((e=>e.x<0))||r.every((e=>e.x>ht))||r.every((e=>e.y<0))||r.every((e=>e.y>ht))}let bp;Ge("FillExtrusionBucket",Zh,{omit:["layers","features"]});var Cg={get paint(){return bp=bp||new Hi({"fill-extrusion-opacity":new He(me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ke(me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new He(me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new He(me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ca(me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ke(me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ke(me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new He(me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ag extends Tr{constructor(e,i){super(e,Cg,i)}createBucket(e){return new Zh(e)}queryRadius(){return Eu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:u,pixelsToTileUnits:h,pixelPosMatrix:f}){const g=Cu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-u.bearingInRadians,h),y=this.paint.get("fill-extrusion-height").evaluate(i,s),x=this.paint.get("fill-extrusion-base").evaluate(i,s),w=(function(E,z){const k=[];for(const R of E){const N=[R.x,R.y,0,1];Vn(N,N,z),k.push(new _e(N[0]/N[3],N[1]/N[3]))}return k})(g,f),P=(function(E,z,k,R){const N=[],X=[],U=R[8]*z,$=R[9]*z,J=R[10]*z,te=R[11]*z,he=R[8]*k,Se=R[9]*k,we=R[10]*k,Me=R[11]*k;for(const Le of E){const Ee=[],Te=[];for(const ve of Le){const Ue=ve.x,Ve=ve.y,$e=R[0]*Ue+R[4]*Ve+R[12],Be=R[1]*Ue+R[5]*Ve+R[13],Ye=R[2]*Ue+R[6]*Ve+R[14],mt=R[3]*Ue+R[7]*Ve+R[15],ut=Ye+J,Ut=mt+te,Bi=$e+he,di=Be+Se,Gt=Ye+we,Bt=mt+Me,xt=new _e(($e+U)/Ut,(Be+$)/Ut);xt.z=ut/Ut,Ee.push(xt);const Jt=new _e(Bi/Bt,di/Bt);Jt.z=Gt/Bt,Te.push(Jt)}N.push(Ee),X.push(Te)}return[N,X]})(o,x,y,f);return(function(E,z,k){let R=1/0;Xd(k,z)&&(R=wp(k,z[0]));for(let N=0;N<z.length;N++){const X=z[N],U=E[N];for(let $=0;$<X.length-1;$++){const J=X[$],te=[J,X[$+1],U[$+1],U[$],J];Bo(k,te)&&(R=Math.min(R,wp(k,te)))}}return R!==1/0&&R})(P[0],P[1],w)}}function hc(r,e){return r.x*e.x+r.y*e.y}function wp(r,e){if(r.length===1){let i=0;const s=e[i++];let o;for(;!o||s.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=o.sub(s),g=u.sub(s),y=h.sub(s),x=hc(f,f),w=hc(f,g),P=hc(g,g),E=hc(y,f),z=hc(y,g),k=x*P-w*w,R=(P*E-w*z)/k,N=(x*z-w*E)/k,X=s.z*(1-R-N)+o.z*R+u.z*N;if(isFinite(X))return X}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const zg=ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:kg}=zg,Dg=ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Rg}=Dg,Lg=Math.cos(Math.PI/180*37.5),Tp=Math.pow(2,14)/.5;class Wh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new ie,this.layoutVertexArray2=new H,this.indexArray=new ye,this.programConfigurations=new os(e.layers,e.zoom),this.segments=new Fe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=Au("line",this.layers,i)||this.hasLineDasharray(this.layers);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:x}of e){const w=this.layers[0]._featureFilter.needGeometry,P=Rn(f,w);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),P,s))continue;const E=u?o.evaluate(P,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:y,geometry:w?P.geometry:Dn(f),patterns:{},dashes:{},sortKey:E};h.push(z)}u&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:x}=f;this.hasDependencies?(Au("line",this.layers,i)?Nh("line",this.layers,f,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,f,this.zoom,i),this.patternFeatures.push(f)):this.addFeature(f,g,y,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[y].feature,g,y,x,this.index)}}update(e,i,s,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:o})}addFeatures(e,i,s,o){for(const u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,i,s,o,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Rg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kg),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,o,u,h,f){const g=this.layers[0].layout,y=g.get("line-join").evaluate(e,{}),x=g.get("line-cap"),w=g.get("line-miter-limit"),P=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,y,x,w,P,o,f);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:u,dashPositions:h,canonical:o})}addLine(e,i,s,o,u,h,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Oa(e,f?g.line.getGranularityForZoomLevel(f.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let U=0;U<e.length-1;U++)this.totalDistance+=e[U].dist(e[U+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=cc.types[i.type]==="Polygon";let x=e.length;for(;x>=2&&e[x-1].equals(e[x-2]);)x--;let w=0;for(;w<x-1&&e[w].equals(e[w+1]);)w++;if(x<(y?3:2))return;s==="bevel"&&(u=1.05);const P=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*x,this.layoutVertexArray,this.indexArray);let z,k,R,N,X;this.e1=this.e2=-1,y&&(z=e[x-2],X=e[w].sub(z)._unit()._perp());for(let U=w;U<x;U++){if(R=U===x-1?y?e[w+1]:void 0:e[U+1],R&&e[U].equals(R))continue;X&&(N=X),z&&(k=z),z=e[U],X=R?R.sub(z)._unit()._perp():N,N=N||X;let $=N.add(X);$.x===0&&$.y===0||$._unit();const J=N.x*X.x+N.y*X.y,te=$.x*X.x+$.y*X.y,he=te!==0?1/te:1/0,Se=2*Math.sqrt(2-2*te),we=te<Lg&&k&&R,Me=N.x*X.y-N.y*X.x>0;if(we&&U>w){const Te=z.dist(k);if(Te>2*P){const ve=z.sub(z.sub(k)._mult(P/Te)._round());this.updateDistance(k,ve),this.addCurrentVertex(ve,N,0,0,E),k=ve}}const Le=k&&R;let Ee=Le?s:y?"butt":o;if(Le&&Ee==="round"&&(he<h?Ee="miter":he<=2&&(Ee="fakeround")),Ee==="miter"&&he>u&&(Ee="bevel"),Ee==="bevel"&&(he>2&&(Ee="flipbevel"),he<u&&(Ee="miter")),k&&this.updateDistance(k,z),Ee==="miter")$._mult(he),this.addCurrentVertex(z,$,0,0,E);else if(Ee==="flipbevel"){if(he>100)$=X.mult(-1);else{const Te=he*N.add(X).mag()/N.sub(X).mag();$._perp()._mult(Te*(Me?-1:1))}this.addCurrentVertex(z,$,0,0,E),this.addCurrentVertex(z,$.mult(-1),0,0,E)}else if(Ee==="bevel"||Ee==="fakeround"){const Te=-Math.sqrt(he*he-1),ve=Me?Te:0,Ue=Me?0:Te;if(k&&this.addCurrentVertex(z,N,ve,Ue,E),Ee==="fakeround"){const Ve=Math.round(180*Se/Math.PI/20);for(let $e=1;$e<Ve;$e++){let Be=$e/Ve;if(Be!==.5){const mt=Be-.5;Be+=Be*mt*(Be-1)*((1.0904+J*(J*(3.55645-1.43519*J)-3.2452))*mt*mt+(.848013+J*(.215638*J-1.06021)))}const Ye=X.sub(N)._mult(Be)._add(N)._unit()._mult(Me?-1:1);this.addHalfVertex(z,Ye.x,Ye.y,!1,Me,0,E)}}R&&this.addCurrentVertex(z,X,-ve,-Ue,E)}else if(Ee==="butt")this.addCurrentVertex(z,$,0,0,E);else if(Ee==="square"){const Te=k?1:-1;this.addCurrentVertex(z,$,Te,Te,E)}else Ee==="round"&&(k&&(this.addCurrentVertex(z,N,0,0,E),this.addCurrentVertex(z,N,1,1,E,!0)),R&&(this.addCurrentVertex(z,X,-1,-1,E,!0),this.addCurrentVertex(z,X,0,0,E)));if(we&&U<x-1){const Te=z.dist(R);if(Te>2*P){const ve=z.add(R.sub(z)._mult(P/Te)._round());this.updateDistance(z,ve),this.addCurrentVertex(ve,X,0,0,E),z=ve}}}}addCurrentVertex(e,i,s,o,u,h=!1){const f=i.y*o-i.x,g=-i.y-i.x*o;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,h,!1,s,u),this.addHalfVertex(e,f,g,h,!0,-o,u),this.distance>Tp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,o,u,h))}addHalfVertex({x:e,y:i},s,o,u,h,f,g){const y=.5*(this.lineClips?this.scaledDistance*(Tp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&y)<<2,y>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const x=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,x,this.e2),g.primitiveLength++),h?this.e2=x:this.e1=x}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,i,s,o){for(const u of e){const h=u.paint.get("line-dasharray");if(!h||h.value.kind==="constant")continue;const f=u.layout.get("line-cap")==="round",g={dasharray:h.value.evaluate({zoom:s-1},i,{}),round:f},y={dasharray:h.value.evaluate({zoom:s},i,{}),round:f},x={dasharray:h.value.evaluate({zoom:s+1},i,{}),round:f},w=`${g.dasharray.join(",")},${g.round}`,P=`${y.dasharray.join(",")},${y.round}`,E=`${x.dasharray.join(",")},${x.round}`;o.dashDependencies[w]=g,o.dashDependencies[P]=y,o.dashDependencies[E]=x,i.dashes[u.id]={min:w,mid:P,max:E}}}}let Sp,Pp;Ge("LineBucket",Wh,{omit:["layers","patternFeatures"]});var Mp={get paint(){return Pp=Pp||new Hi({"line-opacity":new Ke(me.paint_line["line-opacity"]),"line-color":new Ke(me.paint_line["line-color"]),"line-translate":new He(me.paint_line["line-translate"]),"line-translate-anchor":new He(me.paint_line["line-translate-anchor"]),"line-width":new Ke(me.paint_line["line-width"]),"line-gap-width":new Ke(me.paint_line["line-gap-width"]),"line-offset":new Ke(me.paint_line["line-offset"]),"line-blur":new Ke(me.paint_line["line-blur"]),"line-dasharray":new Ca(me.paint_line["line-dasharray"]),"line-pattern":new Ca(me.paint_line["line-pattern"]),"line-gradient":new Co(me.paint_line["line-gradient"])})},get layout(){return Sp=Sp||new Hi({"line-cap":new He(me.layout_line["line-cap"]),"line-join":new Ke(me.layout_line["line-join"]),"line-miter-limit":new He(me.layout_line["line-miter-limit"]),"line-round-limit":new He(me.layout_line["line-round-limit"]),"line-sort-key":new Ke(me.layout_line["line-sort-key"])})}};class Fg extends Ke{possiblyEvaluate(e,i){return i=new Pt(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,o){return i=yi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,o)}}let Ru;class Bg extends Tr{constructor(e,i){super(e,Mp,i),this.gradientVersion=0,Ru||(Ru=new Fg(Mp.paint.properties["line-width"].specification),Ru.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof Pn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=Ru.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Wh(e)}queryRadius(e){const i=e,s=Ip(jo("line-width",this,i),jo("line-gap-width",this,i)),o=jo("line-offset",this,i);return s/2+Math.abs(o)+Eu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:u,pixelsToTileUnits:h}){const f=Cu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-u.bearingInRadians,h),g=h/2*Ip(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),y=this.paint.get("line-offset").evaluate(i,s);return y&&(o=(function(x,w){const P=[];for(let E=0;E<x.length;E++){const z=qm(x[E]),k=[];for(let R=0;R<z.length;R++){const N=z[R],X=z[R-1],U=z[R+1],$=R===0?new _e(0,0):N.sub(X)._unit()._perp(),J=R===z.length-1?new _e(0,0):U.sub(N)._unit()._perp(),te=$._add(J)._unit(),he=te.x*J.x+te.y*J.y;he!==0&&te._mult(1/he),k.push(te._mult(w)._add(N))}P.push(k)}return P})(o,y*h)),(function(x,w,P){for(let E=0;E<w.length;E++){const z=w[E];if(x.length>=3){for(let k=0;k<z.length;k++)if(Oo(x,z[k]))return!0}if(Um(x,z,P))return!0}return!1})(f,o,g)}isTileClipped(){return!0}}function Ip(r,e){return e>0?e+2*r:r}const Og=ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),jg=ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vg=ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ni([{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 Ep=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ng=ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ug(r,e,i){return r.sections.forEach((s=>{s.text=(function(o,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),An.applyArabicShaping&&(o=An.applyArabicShaping(o)),o})(s.text,e,i)})),r}ni([{name:"triangle",components:3,type:"Uint16"}]),ni([{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"}]),ni([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ni([{type:"Float32",name:"offsetX"}]),ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ni([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var wi=24;const dc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Gg={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},$g={40:!0};function Cp(r,e,i,s,o,u){if("fontStack"in e){const h=i[e.fontStack],f=h&&h[r];return f?f.metrics.advance*e.scale+o:0}{const h=s[e.imageName];return h?h.displaySize[0]*e.scale*wi/u+o:0}}function Ap(r,e,i,s){const o=Math.pow(r-e,2);return s?r<e?o/2:2*o:o+Math.abs(i)*i}function qg(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function zp(r,e,i,s,o,u){let h=null,f=Ap(e,i,o,u);for(const g of s){const y=Ap(e-g.x,i,o,u)+g.badness;y<=f&&(h=g,f=y)}return{index:r,x:e,priorBreak:h,badness:f}}function kp(r){return r?kp(r.priorBreak).concat(r.index):[]}class Go{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new Go;for(let o=0;o<e.sections.length;o++){const u=e.sections[o];u.image?s.addImageSection(u):s.addTextSection(u,i)}return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let i="",s={premature:!0,value:void 0};const o=e[Symbol.iterator]();let u=o.next();const h=e[Symbol.iterator]();h.next();let f=h.next();for(;!u.done;)i+=!f.done&&Ul(f.value.codePointAt(0))&&!dc[f.value]||!s.premature&&Ul(s.value.codePointAt(0))&&!dc[s.value]||!dc[u.value]?u.value:dc[u.value],s={value:u.value,premature:!1},u=o.next(),f=h.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,s=this.text.match(/\S\s*$/),o=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-o),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-o)}substring(e,i){const s=[...this.text].slice(e,i).join(""),o=this.sectionIndex.slice(e,i);return new Go(s,this.sections,o)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,s=0;for(let o=0;o<this.length();o++){const u=this.getSection(o);if("imageName"in u){const h=e[u.imageName];if(!h)continue;const f=h.displaySize;i=Math.max(i,f[0]),s=Math.max(s,f[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void vi("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):vi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,s,o,u){const h=[],f=this.determineAverageLineWidth(e,i,s,o,u),g=this.hasZeroWidthSpaces();let y=0,x=0;const w=this.text[Symbol.iterator]();let P=w.next();const E=this.text[Symbol.iterator]();E.next();let z=E.next();const k=this.text[Symbol.iterator]();k.next(),k.next();let R=k.next();for(;!P.done;){const N=this.getSection(x),X=P.value.codePointAt(0);if(gu(X)||(y+=Cp(X,N,s,o,e,u)),!z.done){const U=Ma(X),$=z.value.codePointAt(0);(Gg[X]||U||"imageName"in N||!R.done&&$g[$])&&h.push(zp(x+1,y,f,h,qg(X,$,U&&g),!1))}x++,P=w.next(),z=E.next(),R=k.next()}return kp(zp(this.length(),y,f,h,0,!0))}determineAverageLineWidth(e,i,s,o,u){let h=0,f=0;for(const g of this.text){const y=this.getSection(f);h+=Cp(g.codePointAt(0),y,s,o,e,u),f++}return h/Math.max(1,Math.ceil(h/i))}}const Hh=4294967296,Dp=1/Hh,Rp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class Lu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,i,s=this.length){for(;this.pos<s;){const o=this.readVarint(),u=o>>3,h=this.pos;this.type=7&o,e(u,i,this),this.pos===h&&this.skip(o)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Hh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Hh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let s,o;return o=i[this.pos++],s=127&o,o<128?s:(o=i[this.pos++],s|=(127&o)<<7,o<128?s:(o=i[this.pos++],s|=(127&o)<<14,o<128?s:(o=i[this.pos++],s|=(127&o)<<21,o<128?s:(o=i[this.pos],s|=(15&o)<<28,(function(u,h,f){const g=f.buf;let y,x;if(x=g[f.pos++],y=(112&x)>>4,x<128||(x=g[f.pos++],y|=(127&x)<<3,x<128)||(x=g[f.pos++],y|=(127&x)<<10,x<128)||(x=g[f.pos++],y|=(127&x)<<17,x<128)||(x=g[f.pos++],y|=(127&x)<<24,x<128)||(x=g[f.pos++],y|=(1&x)<<31,x<128))return $o(u,y,h);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&Rp?Rp.decode(this.buf.subarray(i,e)):(function(s,o,u){let h="",f=o;for(;f<u;){const g=s[f];let y,x,w,P=null,E=g>239?4:g>223?3:g>191?2:1;if(f+E>u)break;E===1?g<128&&(P=g):E===2?(y=s[f+1],(192&y)==128&&(P=(31&g)<<6|63&y,P<=127&&(P=null))):E===3?(y=s[f+1],x=s[f+2],(192&y)==128&&(192&x)==128&&(P=(15&g)<<12|(63&y)<<6|63&x,(P<=2047||P>=55296&&P<=57343)&&(P=null))):E===4&&(y=s[f+1],x=s[f+2],w=s[f+3],(192&y)==128&&(192&x)==128&&(192&w)==128&&(P=(15&g)<<18|(63&y)<<12|(63&x)<<6|63&w,(P<=65535||P>=1114112)&&(P=null))),P===null?(P=65533,E=1):P>65535&&(P-=65536,h+=String.fromCharCode(P>>>10&1023|55296),P=56320|1023&P),h+=String.fromCharCode(P),f+=E}return h})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Dp),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Dp),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let o,u;if(i>=0?(o=i%4294967296|0,u=i/4294967296|0):(o=~(-i%4294967296),u=~(-i/4294967296),4294967295^o?o=o+1|0:(o=0,u=u+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(h,f,g){g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,g.buf[g.pos]=127&(h>>>=7)})(o,0,s),(function(h,f){const g=(7&h)<<4;f.buf[f.pos++]|=g|((h>>>=3)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h)))))})(u,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const i=this.pos;this.pos=(function(o,u,h){for(let f,g,y=0;y<u.length;y++){if(f=u.charCodeAt(y),f>55295&&f<57344){if(!g){f>56319||y+1===u.length?(o[h++]=239,o[h++]=191,o[h++]=189):g=f;continue}if(f<56320){o[h++]=239,o[h++]=191,o[h++]=189,g=f;continue}f=g-55296<<10|f-56320|65536,g=null}else g&&(o[h++]=239,o[h++]=191,o[h++]=189,g=null);f<128?o[h++]=f:(f<2048?o[h++]=f>>6|192:(f<65536?o[h++]=f>>12|224:(o[h++]=f>>18|240,o[h++]=f>>12&63|128),o[h++]=f>>6&63|128),o[h++]=63&f|128)}return h})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&Lp(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const i=e.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,i){this.pos++;const s=this.pos;e(i,this);const o=this.pos-s;o>=128&&Lp(s,o,this),this.pos=s-1,this.writeVarint(o),this.pos+=o}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,Zg,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,Wg,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,Yg,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,Hg,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,Xg,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,Kg,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,Jg,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,Qg,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,e_,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function $o(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Lp(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let o=i.pos-1;o>=r;o--)i.buf[o+s]=i.buf[o]}function Zg(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function Wg(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function Hg(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function Xg(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function Yg(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function Kg(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function Jg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function Qg(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function e_(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function t_(r,e,i){r===1&&i.readMessage(i_,e)}function i_(r,e,i){if(r===3){const{id:s,bitmap:o,width:u,height:h,left:f,top:g,advance:y}=i.readMessage(r_,{});e.push({id:s,bitmap:new ic({width:u+6,height:h+6},o),metrics:{width:u,height:h,left:f,top:g,advance:y}})}}function r_(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function Fp(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort(((h,f)=>f.h-h.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,u=0;for(const h of r)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(h.w>g.w||h.h>g.h)){if(h.x=g.x,h.y=g.y,u=Math.max(u,h.y+h.h),o=Math.max(o,h.x+h.w),h.w===g.w&&h.h===g.h){const y=s.pop();y&&f<s.length&&(s[f]=y)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(s.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:o,h:u,fill:e/(o*u)||0}}class Xh{constructor(e,{pixelRatio:i,version:s,stretchX:o,stretchY:u,content:h,textFitWidth:f,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=u,this.content=h,this.version=s,this.textFitWidth=f,this.textFitHeight=g}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 Bp{constructor(e,i){const s={},o={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,s,u),this.addImages(i,o,u);const{w:h,h:f}=Fp(u),g=new pr({width:h||1,height:f||1});for(const y in e){const x=e[y],w=s[y].paddedRect;pr.copy(x.data,g,{x:0,y:0},{x:w.x+1,y:w.y+1},x.data)}for(const y in i){const x=i[y],w=o[y].paddedRect,P=w.x+1,E=w.y+1,z=x.data.width,k=x.data.height;pr.copy(x.data,g,{x:0,y:0},{x:P,y:E},x.data),pr.copy(x.data,g,{x:0,y:k-1},{x:P,y:E-1},{width:z,height:1}),pr.copy(x.data,g,{x:0,y:0},{x:P,y:E+k},{width:z,height:1}),pr.copy(x.data,g,{x:z-1,y:0},{x:P-1,y:E},{width:1,height:k}),pr.copy(x.data,g,{x:0,y:0},{x:P+z,y:E},{width:1,height:k})}this.image=g,this.iconPositions=s,this.patternPositions=o}addImages(e,i,s){for(const o in e){const u=e[o],h={x:0,y:0,w:u.data.width+2,h:u.data.height+2};s.push(h),i[o]=new Xh(h,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),i)}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,u]=e.tl;s.update(i.data,void 0,{x:o,y:u})}}var Us;function Fu(r,e,i,s,o,u,h,f,g,y,x,w,P,E,z){const k=Go.fromFeature(r,o);let R;w===M.az.vertical&&k.verticalizePunctuation();let N=k.determineLineBreaks(y,u,e,s,E);const{processBidirectionalText:X,processStyledBidirectionalText:U}=An;if(X&&k.sections.length===1){R=[],N=N.map((he=>k.toCodeUnitIndex(he)));const te=X(k.toString(),N);for(const he of te){const Se=[...he].map((()=>0));R.push(new Go(he,k.sections,Se))}}else if(U){R=[],N=N.map((we=>k.toCodeUnitIndex(we)));let te=0;const he=[];for(const we of k.text)he.push(...Array(we.length).fill(k.sectionIndex[te])),te++;const Se=U(k.text,he,N);for(const we of Se){const Me=[];let Le="";for(const Ee of we[0])Me.push(we[1][Le.length]),Le+=Ee;R.push(new Go(we[0],k.sections,Me))}}else R=(function(te,he){const Se=[];let we=0;for(const Me of he)Se.push(te.substring(we,Me)),we=Me;return we<te.length()&&Se.push(te.substring(we,te.length())),Se})(k,N);const $=[],J={positionedLines:$,text:k.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(te,he,Se,we,Me,Le,Ee,Te,ve,Ue,Ve,$e){let Be=0,Ye=0,mt=0,ut=0;const Ut=Te==="right"?1:Te==="left"?0:.5,Bi=wi/$e;let di=0;for(const xt of Me){xt.trim();const Jt=xt.getMaxScale(),ai={positionedGlyphs:[],lineOffset:0};te.positionedLines[di]=ai;const Rt=ai.positionedGlyphs;let fr=0;if(!xt.length()){Ye+=Le,++di;continue}const Oi=n_(we,xt,Bi);let mr=0;for(const Pi of xt.text){const Zt=xt.getSection(mr),pi=Pi.codePointAt(0),Qt=s_(ve,Ve,pi),Mi={glyph:pi,imageName:null,x:Be,y:Ye+-17,vertical:Qt,scale:1,fontStack:"",sectionIndex:xt.getSectionIndex(mr),metrics:null,rect:null};let us;if("fontStack"in Zt){if(us=a_(Zt,pi,Qt,Oi,he,Se),!us)continue;Mi.fontStack=Zt.fontStack}else{if(te.iconsInText=!0,Zt.scale*=Bi,us=o_(Zt,Qt,Jt,Oi,we),!us)continue;fr=Math.max(fr,us.imageOffset),Mi.imageName=Zt.imageName}const{rect:hn,metrics:vc,baselineOffset:Ws}=us;Mi.y+=Ws,Mi.scale=Zt.scale,Mi.metrics=vc,Mi.rect=hn,Rt.push(Mi),Qt?(te.verticalizable=!0,Be+=("imageName"in Zt?vc.advance:wi)*Zt.scale+Ue):Be+=vc.advance*Zt.scale+Ue,mr++}Rt.length!==0&&(mt=Math.max(Be-Ue,mt),l_(Rt,0,Rt.length-1,Ut)),Be=0,ai.lineOffset=Math.max(fr,(Jt-1)*wi);const en=Le*Jt+fr;Ye+=en,ut=Math.max(en,ut),++di}const{horizontalAlign:Gt,verticalAlign:Bt}=Yh(Ee);(function(xt,Jt,ai,Rt,fr,Oi,mr,en,Pi){const Zt=(Jt-ai)*fr;let pi=0;pi=Oi!==mr?-en*Rt- -17:-Rt*Pi*mr+.5*mr;for(const Qt of xt)for(const Mi of Qt.positionedGlyphs)Mi.x+=Zt,Mi.y+=pi})(te.positionedLines,Ut,Gt,Bt,mt,ut,Le,Ye,Me.length),te.top+=-Bt*Ye,te.bottom=te.top+Ye,te.left+=-Gt*mt,te.right=te.left+mt})(J,e,i,s,R,h,f,g,w,y,P,z),!(function(te){for(const he of te)if(he.positionedGlyphs.length!==0)return!1;return!0})($)&&J}function Yh(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function n_(r,e,i){const s=e.getMaxScale()*wi,{maxImageWidth:o,maxImageHeight:u}=e.getMaxImageSize(r),h=Math.max(s,u*i);return{verticalLineContentWidth:Math.max(s,o*i),horizontalLineContentHeight:h}}function Op(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function s_(r,e,i){return!(r===M.az.horizontal||!e&&!Nl(i)||e&&(gu(i)||(s=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function a_(r,e,i,s,o,u){const h=u[r.fontStack],f=(function(y,x,w,P){if(y&&y.rect)return y;const E=x[w.fontStack],z=E&&E[P];return z?{rect:null,metrics:z.metrics}:null})(h&&h[e],o,r,e);if(f===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*wi;else{const y=Op(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*wi)*y}return{rect:f.rect,metrics:f.metrics,baselineOffset:g}}function o_(r,e,i,s,o){const u=o[r.imageName];if(!u)return null;const h=u.paddedRect,f=u.displaySize,g={width:f[0],height:f[1],left:1,top:-3,advance:e?f[1]:f[0]};let y;if(e)y=s.verticalLineContentWidth-f[1]*r.scale;else{const x=Op(r.verticalAlign);y=(s.horizontalLineContentHeight-f[1]*r.scale)*x}return{rect:h,metrics:g,baselineOffset:y,imageOffset:(e?f[0]:f[1])*r.scale-wi*i}}function l_(r,e,i,s){if(s===0)return;const o=r[i],u=(r[i].x+o.metrics.advance*o.scale)*s;for(let h=e;h<=i;h++)r[h].x-=u}function c_(r,e,i){const{horizontalAlign:s,verticalAlign:o}=Yh(i),u=e[0]-r.displaySize[0]*s,h=e[1]-r.displaySize[1]*o;return{image:r,top:h,bottom:h+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function jp(r){var e,i;let s=r.left,o=r.top,u=r.right-s,h=r.bottom-o;const f=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",y=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&u/h<y||f==="proportional"){const x=Math.ceil(h*y);s*=x/u,u=x}}else if(f==="proportional"&&g==="stretchOnly"&&y!==0&&u/h>y){const x=Math.ceil(u/y);o*=x/h,h=x}return{x1:s,y1:o,x2:s+u,y2:o+h}}function Vp(r,e,i,s,o,u){const h=r.image;let f;if(h.content){const R=h.content,N=h.pixelRatio||1;f=[R[0]/N,R[1]/N,h.displaySize[0]-R[2]/N,h.displaySize[1]-R[3]/N]}const g=e.left*u,y=e.right*u;let x,w,P,E;i==="width"||i==="both"?(E=o[0]+g-s[3],w=o[0]+y+s[1]):(E=o[0]+(g+y-h.displaySize[0])/2,w=E+h.displaySize[0]);const z=e.top*u,k=e.bottom*u;return i==="height"||i==="both"?(x=o[1]+z-s[0],P=o[1]+k+s[2]):(x=o[1]+(z+k-h.displaySize[1])/2,P=x+h.displaySize[1]),{image:h,top:x,right:w,bottom:P,left:E,collisionPadding:f}}Ge("ImagePosition",Xh),Ge("ImageAtlas",Bp),M.az=void 0,(Us=M.az||(M.az={}))[Us.none=0]="none",Us[Us.horizontal=1]="horizontal",Us[Us.vertical=2]="vertical",Us[Us.horizontalOnly=3]="horizontalOnly";const ls=128,Gs=32640;function Np(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Pt(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:o}=i;let u=0;for(;u<s.length&&s[u]<=r;)u++;u=Math.max(0,u-1);let h=u;for(;h<s.length&&s[h]<r+1;)h++;h=Math.min(s.length-1,h);const f=s[u],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:o}:{kind:"camera",minZoom:f,maxZoom:g,minSize:i.evaluate(new Pt(f)),maxSize:i.evaluate(new Pt(g)),interpolationType:o}}}function Kh(r,e,i){let s="never";const o=r.get(e);return o?s=o:r.get(i)&&(s="always"),s}const u_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Bu(r,e,i,s,o,u,h,f,g,y,x,w,P){const E=f?Math.min(Gs,Math.round(f[0])):0,z=f?Math.min(Gs,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*o),u,h,(E<<1)+(g?1:0),z,16*y,16*x,256*w,256*P)}function Jh(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function h_(r){for(const e of r.sections)if(vu(e.text))return!0;return!1}class Qh{constructor(e){this.layoutVertexArray=new Q,this.indexArray=new ye,this.programConfigurations=e,this.segments=new Fe,this.dynamicLayoutVertexArray=new oe,this.opacityVertexArray=new be,this.hasVisibleVertices=!1,this.placedSymbolArray=new m}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,o){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Og.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,jg.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,u_,!0),this.opacityVertexBuffer.itemSize=1),(s||o)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ge("SymbolBuffers",Qh);class ed{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Fe,this.collisionVertexArray=new ge}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Vg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ge("CollisionBuffers",ed);class qo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((h=>h.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Np(this.zoom,i["text-size"]),this.iconSizeData=Np(this.zoom,i["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=Kh(s,"text-overlap","text-allow-overlap")!=="never"||Kh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((h=>M.az[h]))),this.stateDependentLayerIds=this.layers.filter((h=>h.isStateDependent())).map((h=>h.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Qh(new os(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Qh(new os(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new b,this.lineVertexArray=new T,this.symbolInstances=new v,this.textAnchorOffsets=new C}calculateGlyphDependencies(e,i,s,o,u){for(const h of e)if(i[h.codePointAt(0)]=!0,(s||o)&&u){const f=dc[h];f&&(i[f.codePointAt(0)]=!0)}}populate(e,i,s){const o=this.layers[0],u=o.layout,h=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),y=(f.value.kind!=="constant"||f.value.value instanceof er&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(h.value.kind!=="constant"||h.value.value.length>0),x=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!y&&!x)return;const P=i.iconDependencies,E=i.glyphDependencies,z=i.availableImages,k=new Pt(this.zoom);for(const{feature:R,id:N,index:X,sourceLayerIndex:U}of e){const $=o._featureFilter.needGeometry,J=Rn(R,$);if(!o._featureFilter.filter(k,J,s))continue;let te,he;if($||(J.geometry=Dn(R)),y){const we=o.getValueAndResolveTokens("text-field",J,s,z),Me=er.factory(we),Le=this.hasRTLText=this.hasRTLText||h_(Me);(!Le||An.getRTLTextPluginStatus()==="unavailable"||Le&&An.isParsed())&&(te=Ug(Me,o,J))}if(x){const we=o.getValueAndResolveTokens("icon-image",J,s,z);he=we instanceof hr?we:hr.fromString(we)}if(!te&&!he)continue;const Se=this.sortFeaturesByKey?w.evaluate(J,{},s):void 0;if(this.features.push({id:N,text:te,icon:he,index:X,sourceLayerIndex:U,geometry:J.geometry,properties:R.properties,type:cc.types[R.type],sortKey:Se}),he&&(P[he.name]=!0),te){const we=h.evaluate(J,{},s).join(","),Me=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(M.az.vertical)>=0;for(const Le of te.sections)if(Le.image)P[Le.image.name]=!0;else{const Ee=Vs(te.toString()),Te=Le.fontStack||we,ve=E[Te]=E[Te]||{};this.calculateGlyphDependencies(Le.text,ve,Me,this.allowVerticalPlacement,Ee)}}}u.get("symbol-placement")==="line"&&(this.features=(function(R){const N={},X={},U=[];let $=0;function J(we){U.push(R[we]),$++}function te(we,Me,Le){const Ee=X[we];return delete X[we],X[Me]=Ee,U[Ee].geometry[0].pop(),U[Ee].geometry[0]=U[Ee].geometry[0].concat(Le[0]),Ee}function he(we,Me,Le){const Ee=N[Me];return delete N[Me],N[we]=Ee,U[Ee].geometry[0].shift(),U[Ee].geometry[0]=Le[0].concat(U[Ee].geometry[0]),Ee}function Se(we,Me,Le){const Ee=Le?Me[0][Me[0].length-1]:Me[0][0];return`${we}:${Ee.x}:${Ee.y}`}for(let we=0;we<R.length;we++){const Me=R[we],Le=Me.geometry,Ee=Me.text?Me.text.toString():null;if(!Ee){J(we);continue}const Te=Se(Ee,Le),ve=Se(Ee,Le,!0);if(Te in X&&ve in N&&X[Te]!==N[ve]){const Ue=he(Te,ve,Le),Ve=te(Te,ve,U[Ue].geometry);delete N[Te],delete X[ve],X[Se(Ee,U[Ve].geometry,!0)]=Ve,U[Ue].geometry=null}else Te in X?te(Te,ve,Le):ve in N?he(Te,ve,Le):(J(we),N[Te]=$-1,X[ve]=$-1)}return U.filter((we=>we.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((R,N)=>R.sortKey-N.sortKey))}update(e,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(i[e.segment+1]),u=e.dist(i[e.segment]);const h={};for(let f=e.segment+1;f<i.length;f++)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:o},f<i.length-1&&(o+=i[f+1].dist(i[f]));for(let f=e.segment||0;f>=0;f--)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=i[f-1].dist(i[f]));for(let f=0;f<i.length;f++){const g=h[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,o,u,h,f,g,y,x,w,P){const E=e.indexArray,z=e.layoutVertexArray,k=e.segments.prepareSegment(4*i.length,z,E,this.canOverlap?h.sortKey:void 0),R=this.glyphOffsetArray.length,N=k.vertexLength,X=this.allowVerticalPlacement&&f===M.az.vertical?Math.PI/2:0,U=h.text&&h.text.sections;for(let $=0;$<i.length;$++){const{tl:J,tr:te,bl:he,br:Se,tex:we,pixelOffsetTL:Me,pixelOffsetBR:Le,minFontScaleX:Ee,minFontScaleY:Te,glyphOffset:ve,isSDF:Ue,sectionIndex:Ve}=i[$],$e=k.vertexLength,Be=ve[1];Bu(z,g.x,g.y,J.x,Be+J.y,we.x,we.y,s,Ue,Me.x,Me.y,Ee,Te),Bu(z,g.x,g.y,te.x,Be+te.y,we.x+we.w,we.y,s,Ue,Le.x,Me.y,Ee,Te),Bu(z,g.x,g.y,he.x,Be+he.y,we.x,we.y+we.h,s,Ue,Me.x,Le.y,Ee,Te),Bu(z,g.x,g.y,Se.x,Be+Se.y,we.x+we.w,we.y+we.h,s,Ue,Le.x,Le.y,Ee,Te),Jh(e.dynamicLayoutVertexArray,g,X),E.emplaceBack($e,$e+2,$e+1),E.emplaceBack($e+1,$e+2,$e+3),k.vertexLength+=4,k.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ve[0]),$!==i.length-1&&Ve===i[$+1].sectionIndex||e.programConfigurations.populatePaintArrays(z.length,h,h.index,{imagePositions:{},canonical:P,formattedSection:U&&U[Ve]})}e.placedSymbolArray.emplaceBack(g.x,g.y,R,this.glyphOffsetArray.length-R,N,y,x,g.segment,s?s[0]:0,s?s[1]:0,o[0],o[1],f,0,!1,0,w)}_addCollisionDebugVertex(e,i,s,o,u,h){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,o,u,Math.round(h.x),Math.round(h.y))}addCollisionDebugVertices(e,i,s,o,u,h,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),y=g.vertexLength,x=u.layoutVertexArray,w=u.collisionVertexArray,P=f.anchorX,E=f.anchorY;this._addCollisionDebugVertex(x,w,h,P,E,new _e(e,i)),this._addCollisionDebugVertex(x,w,h,P,E,new _e(s,i)),this._addCollisionDebugVertex(x,w,h,P,E,new _e(s,o)),this._addCollisionDebugVertex(x,w,h,P,E,new _e(e,o)),g.vertexLength+=4;const z=u.indexArray;z.emplaceBack(y,y+1),z.emplaceBack(y+1,y+2),z.emplaceBack(y+2,y+3),z.emplaceBack(y+3,y),g.primitiveLength+=4}addDebugCollisionBoxes(e,i,s,o){for(let u=e;u<i;u++){const h=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(h.x1,h.y1,h.x2,h.y2,o?this.textCollisionBox:this.iconCollisionBox,h.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ed(fe,Ep.members,ze),this.iconCollisionBox=new ed(fe,Ep.members,ze);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,s,o,u,h,f,g,y){const x={};for(let w=i;w<s;w++){const P=e.get(w);x.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},x.textFeatureIndex=P.featureIndex;break}for(let w=o;w<u;w++){const P=e.get(w);x.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},x.verticalTextFeatureIndex=P.featureIndex;break}for(let w=h;w<f;w++){const P=e.get(w);x.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},x.iconFeatureIndex=P.featureIndex;break}for(let w=g;w<y;w++){const P=e.get(w);x.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},x.verticalIconFeatureIndex=P.featureIndex;break}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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(e,i){const s=e.placedSymbolArray.get(i),o=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;u<o;u+=4)e.indexArray.emplaceBack(u,u+2,u+1),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),o=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const g=this.symbolInstances.get(f);o.push(0|Math.round(i*g.anchorX+s*g.anchorY)),u.push(g.featureIndex)}return h.sort(((f,g)=>o[f]-o[g]||u[g]-u[f])),h}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((o,u,h)=>{o>=0&&h.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Up,Gp;Ge("SymbolBucket",qo,{omit:["layers","collisionBoxArray","features","compareText"]}),qo.MAX_GLYPHS=65535,qo.addDynamicAttributes=Jh;var td={get paint(){return Gp=Gp||new Hi({"icon-opacity":new Ke(me.paint_symbol["icon-opacity"]),"icon-color":new Ke(me.paint_symbol["icon-color"]),"icon-halo-color":new Ke(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ke(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ke(me.paint_symbol["icon-halo-blur"]),"icon-translate":new He(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new He(me.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ke(me.paint_symbol["text-opacity"]),"text-color":new Ke(me.paint_symbol["text-color"],{runtimeType:ur,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ke(me.paint_symbol["text-halo-color"]),"text-halo-width":new Ke(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Ke(me.paint_symbol["text-halo-blur"]),"text-translate":new He(me.paint_symbol["text-translate"]),"text-translate-anchor":new He(me.paint_symbol["text-translate-anchor"])})},get layout(){return Up=Up||new Hi({"symbol-placement":new He(me.layout_symbol["symbol-placement"]),"symbol-spacing":new He(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new He(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ke(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new He(me.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new He(me.layout_symbol["icon-allow-overlap"]),"icon-overlap":new He(me.layout_symbol["icon-overlap"]),"icon-ignore-placement":new He(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new He(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new He(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ke(me.layout_symbol["icon-size"]),"icon-text-fit":new He(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new He(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ke(me.layout_symbol["icon-image"]),"icon-rotate":new Ke(me.layout_symbol["icon-rotate"]),"icon-padding":new Ke(me.layout_symbol["icon-padding"]),"icon-keep-upright":new He(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Ke(me.layout_symbol["icon-offset"]),"icon-anchor":new Ke(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new He(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new He(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new He(me.layout_symbol["text-rotation-alignment"]),"text-field":new Ke(me.layout_symbol["text-field"]),"text-font":new Ke(me.layout_symbol["text-font"]),"text-size":new Ke(me.layout_symbol["text-size"]),"text-max-width":new Ke(me.layout_symbol["text-max-width"]),"text-line-height":new He(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Ke(me.layout_symbol["text-letter-spacing"]),"text-justify":new Ke(me.layout_symbol["text-justify"]),"text-radial-offset":new Ke(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new He(me.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ke(me.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ke(me.layout_symbol["text-anchor"]),"text-max-angle":new He(me.layout_symbol["text-max-angle"]),"text-writing-mode":new He(me.layout_symbol["text-writing-mode"]),"text-rotate":new Ke(me.layout_symbol["text-rotate"]),"text-padding":new He(me.layout_symbol["text-padding"]),"text-keep-upright":new He(me.layout_symbol["text-keep-upright"]),"text-transform":new Ke(me.layout_symbol["text-transform"]),"text-offset":new Ke(me.layout_symbol["text-offset"]),"text-allow-overlap":new He(me.layout_symbol["text-allow-overlap"]),"text-overlap":new He(me.layout_symbol["text-overlap"]),"text-ignore-placement":new He(me.layout_symbol["text-ignore-placement"]),"text-optional":new He(me.layout_symbol["text-optional"])})}};class $p{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:vr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ge("FormatSectionOverride",$p,{omit:["defaultValue"]});class Ou extends Tr{constructor(e,i){super(e,td,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const o=[];for(const u of s)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,o){const u=this.layout.get(e).evaluate(i,{},s,o),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Ls(h.value)||!u?u:(function(f,g){return g.replace(/{([^{}]+)}/g,((y,x)=>f&&x in f?String(f[x]):""))})(i.properties,u)}createBucket(e){return new qo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of td.paint.overridableProperties){if(!Ou.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new $p(i),o=new Cl(s,i.property.specification);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new go("source",o):new Al("composite",o,i.value.zoomStops),this.paint._values[e]=new Lr(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Ou.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),o=td.paint.properties[i];let u=!1;const h=f=>{for(const g of f)if(o.overrides&&o.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof er)h(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const f=y=>{u||(y instanceof Yr&&ii(y.value)===Js?h(y.value.sections):y instanceof la?h(y.sections):y.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let qp;var d_={get paint(){return qp=qp||new Hi({"background-color":new He(me.paint_background["background-color"]),"background-pattern":new Eo(me.paint_background["background-pattern"]),"background-opacity":new He(me.paint_background["background-opacity"])})}};class p_ extends Tr{constructor(e,i){super(e,d_,i)}}class f_ extends Tr{constructor(e,i){super(e,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class m_{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const g_={once:!0},id=63710088e-1;class $s{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $s(lr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,o=e.lat*i,u=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return id*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof $s)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new $s(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new $s(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Zp=2*Math.PI*id;function Wp(r){return Zp*Math.cos(r*Math.PI/180)}function Hp(r){return(180+r)/360}function Xp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Yp(r,e){return r/Wp(e)}function Kp(r){return 360*r-180}function ju(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Jp(r,e){return r*Wp(ju(e))}class pc{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=$s.convert(e);return new pc(Hp(s.lng),Xp(s.lat),Yp(i,s.lat))}toLngLat(){return new $s(Kp(this.x),ju(this.y))}toAltitude(){return Jp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Zp*(e=ju(this.y),1/Math.cos(e*Math.PI/180));var e}}function Qp(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class rd{constructor(e,i,s){if(!(function(o,u,h){return!(o<0||o>25||h<0||h>=Math.pow(2,o)||u<0||u>=Math.pow(2,o))})(e,i,s))throw new Error(`x=${i}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=s,this.key=Zo(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,s){const o=(function(h,f,g){var y=Qp(256*h,256*(f=Math.pow(2,g)-f-1),g),x=Qp(256*(h+1),256*(f+1),g);return y[0]+","+y[1]+","+x[0]+","+x[1]})(this.x,this.y,this.z),u=(function(h,f,g){let y,x="";for(let w=h;w>0;w--)y=1<<w-1,x+=(f&y?1:0)+(g&y?2:0);return x})(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new _e((e.x*i-this.x)*ht,(e.y*i-this.y)*ht)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ef{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Zo(e,i.z,i.z,i.x,i.y)}}class Or{constructor(e,i,s,o,u){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=i,this.canonical=new rd(s,+o,+u),this.key=Zo(i,e,s,o,u)}clone(){return new Or(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new Or(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Or(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?Zo(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):Zo(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Or(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,o=2*this.canonical.y;return[new Or(i,this.wrap,i,s,o),new Or(i,this.wrap,i,s+1,o),new Or(i,this.wrap,i,s,o+1),new Or(i,this.wrap,i,s+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Or(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Or(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ef(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new pc(e.x-this.wrap,e.y))}}function Zo(r,e,i,s,o){(r*=2)<0&&(r=-1*r-1);const u=1<<i;return(u*u*r+u*o+s).toString(36)+i.toString(36)+e.toString(36)}function nd(r,e){return e?r.properties[e]:r.id}function __(r,e){const i={id:r.id};if(e.removeAllProperties&&(delete r.removeProperties,delete r.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const s of e.removeProperties){const o=r.addOrUpdateProperties.findIndex((u=>u.key===s));o>-1&&r.addOrUpdateProperties.splice(o,1)}return(r.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(r.removeProperties||e.removeProperties)&&(i.removeProperties=[...r.removeProperties||[],...e.removeProperties||[]]),(r.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...r.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(r.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||r.newGeometry),i}function tf(r){var e,i;if(!r)return{};const s={};return s.removeAll=r.removeAll,s.remove=new Set(r.remove||[]),s.add=new Map((e=r.add)===null||e===void 0?void 0:e.map((o=>[o.id,o]))),s.update=new Map((i=r.update)===null||i===void 0?void 0:i.map((o=>[o.id,o]))),s}Ge("CanonicalTileID",rd),Ge("OverscaledTileID",Or,{omit:["terrainRttPosMatrix32f"]});class ja{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const i=new ja;return i.extend(e(new _e(this.minX,this.minY))),i.extend(e(new _e(this.maxX,this.minY))),i.extend(e(new _e(this.minX,this.maxY))),i.extend(e(new _e(this.maxX,this.maxY))),i}static fromPoints(e){const i=new ja;for(const s of e)i.extend(s);return i}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class rf{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class nf{constructor(e,i,s,o,u){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=o,this._z=i,this.properties=e.properties,this.id=u}projectPoint(e,i,s,o){return[360*(e.x+i)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/o)*Math.PI))-90]}projectLine(e,i,s,o){return e.map((u=>this.projectPoint(u,i,s,o)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),s=e.extent*this._x,o=e.extent*this._y,u=e.loadGeometry();switch(e.type){case 1:{const h=[];for(const g of u)h.push(g[0]);const f=this.projectLine(h,s,o,i);this._geometry=h.length===1?{type:"Point",coordinates:f[0]}:{type:"MultiPoint",coordinates:f};break}case 2:{const h=u.map((f=>this.projectLine(f,s,o,i)));this._geometry=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h};break}case 3:{const h=yp(u),f=[];for(const g of h)f.push(g.map((y=>this.projectLine(y,s,o,i))));this._geometry=f.length===1?{type:"Polygon",coordinates:f[0]}:{type:"MultiPolygon",coordinates:f};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class Wo{_name;dataBuffer;nullabilityBuffer;_size;constructor(e,i,s){this._name=e,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Vu extends Wo{}class sd extends Vu{getValueFromBuffer(e){return this.dataBuffer[e]}}class ad extends Vu{getValueFromBuffer(e){return this.dataBuffer[e]}}class sf extends Wo{delta;constructor(e,i,s,o){super(e,i,o),this.delta=s}}class od extends sf{constructor(e,i,s,o){super(e,Int32Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class ld extends Wo{constructor(e,i,s){super(e,Int32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class y_{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(e,i,s,o,u=4096){this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=o,this._extent=u}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let i=0;for(;i<this.numFeatures;){let s;this.idVector&&(s=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));const o=e?.next().value,u={};for(const h of this.propertyVectors){if(!h)continue;const f=h.name,g=h.getValue(i);g!==null&&(u[f]=g)}i++,yield{id:s,geometry:o,properties:u}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let o;this.idVector&&(o=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(s)):this.idVector.getValue(s));const u={coordinates:i[s],type:this.geometryVector.geometryType(s)},h={};for(const f of this.propertyVectors){if(!f)continue;const g=f.name,y=f.getValue(s);y!==null&&(h[g]=y)}e.push({id:o,geometry:u,properties:h})}return e}containsMaxSaveIntegerValues(e){return e instanceof sd||e instanceof ld&&e instanceof od||e instanceof ad}}class v_{value;constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var dt,cs,Li,cn,Va,Pr,Ti,Si,af,jr;function zi(r,e,i){const s=new Int32Array(i);let o=0,u=e.get();for(let h=0;h<s.length;h++){let f=r[u++],g=127&f;f<128||(f=r[u++],g|=(127&f)<<7,f<128||(f=r[u++],g|=(127&f)<<14,f<128||(f=r[u++],g|=(127&f)<<21,f<128||(f=r[u++],g|=(15&f)<<28)))),s[o++]=g}return e.set(u),s}function Nu(r,e,i){const s=new BigInt64Array(i);for(let o=0;o<s.length;o++)s[o]=b_(r,e);return s}function x_(r,e){let i,s;return s=r[e.get()],e.increment(),i=127&s,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<7,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<14,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<21,s<128?i:(s=r[e.get()],i|=(15&s)<<28,(function(o,u,h){let f,g;if(g=u[h.get()],h.increment(),f=(112&g)>>4,g<128||(g=u[h.get()],h.increment(),f|=(127&g)<<3,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<10,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<17,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<24,g<128)||(g=u[h.get()],h.increment(),f|=(1&g)<<31,g<128))return 4294967296*f+(o>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function of(r,e,i,s){throw new Error("FastPFor is not implemented yet.")}function Na(r){return r>>>1^-(1&r)}function Ho(r){return r>>1n^-(1n&r)}function b_(r,e){let i=0n,s=0,o=e.get();for(;o<r.length;){const u=r[o++];if(i|=BigInt(127&u)<<BigInt(s),!(128&u))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(o),i}function lf(r,e,i){const s=new Int32Array(i);let o=0;for(let u=0;u<e;u++){const h=r[u];s.fill(r[u+e],o,o+h),o+=h}return s}function cf(r,e,i){const s=new BigInt64Array(i);let o=0;for(let u=0;u<e;u++){const h=Number(r[u]);s.fill(r[u+e],o,o+h),o+=h}return s}function uf(r,e,i){const s=new Float64Array(i);let o=0;for(let u=0;u<e;u++){const h=r[u];s.fill(r[u+e],o,o+h),o+=h}return s}function cd(r){const e=r.length/4*4;let i=1;if(e>=4)for(let s=r[0];i<e-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!=r.length;)r[i]+=r[i-1],++i}function hf(r){r[0]=r[0]>>>1^-(1&r[0]),r[1]=r[1]>>>1^-(1&r[1]);const e=r.length/4*4;let i=2;if(e>=4)for(;i<e-4;i+=4){const s=r[i],o=r[i+1],u=r[i+2],h=r[i+3];r[i]=(s>>>1^-(1&s))+r[i-2],r[i+1]=(o>>>1^-(1&o))+r[i-1],r[i+2]=(u>>>1^-(1&u))+r[i],r[i+3]=(h>>>1^-(1&h))+r[i+1]}for(;i!=r.length;i+=2)r[i]=(r[i]>>>1^-(1&r[i]))+r[i-2],r[i+1]=(r[i+1]>>>1^-(1&r[i+1]))+r[i-1]}(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(dt||(dt={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(cs||(cs={})),(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(Li||(Li={}));class ud{_dictionaryType;_offsetType;_lengthType;constructor(e,i,s){this._dictionaryType=e,this._offsetType=i,this._lengthType=s}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function rr(r,e){const i=(function(s,o){const u=s[o.get()],h=Object.values(Li)[u>>4];let f=null;switch(h){case Li.DATA:f=new ud(Object.values(cn)[15&u]);break;case Li.OFFSET:f=new ud(null,Object.values(Va)[15&u]);break;case Li.LENGTH:f=new ud(null,null,Object.values(Pr)[15&u])}o.increment();const g=s[o.get()],y=Object.values(dt)[g>>5],x=Object.values(dt)[g>>2&7],w=Object.values(cs)[3&g];o.increment();const P=zi(s,o,2),E=P[0];return{physicalStreamType:h,logicalStreamType:f,logicalLevelTechnique1:y,logicalLevelTechnique2:x,physicalLevelTechnique:w,numValues:E,byteLength:P[1],decompressedCount:E}})(r,e);return i.logicalLevelTechnique1===dt.MORTON?(function(s,o,u){const h=zi(o,u,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:h[0],coordinateShift:h[1]}})(i,r,e):dt.RLE!==i.logicalLevelTechnique1&&dt.RLE!==i.logicalLevelTechnique2||cs.NONE===i.physicalLevelTechnique?i:(function(s,o,u){const h=zi(o,u,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:h[1],runs:h[0],numRleValues:h[1]}})(i,r,e)}(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(cn||(cn={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(Va||(Va={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Pr||(Pr={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(Ti||(Ti={}));class un{values;_size;constructor(e,i){this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const s=Math.floor(e/8);this.values[s]=this.values[s]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function nr(r,e,i,s,o){return(function(u,h,f){switch(h.logicalLevelTechnique1){case dt.DELTA:return h.logicalLevelTechnique2===dt.RLE?(function(g,y,x){const w=new Int32Array(x);let P=0,E=0;for(let z=0;z<y;z++){const k=g[z],R=Na(g[z+y]);for(let N=0;N<k;N++)E+=R,w[P++]=E}return w})(u,h.runs,h.numRleValues):((function(g){g[0]=g[0]>>>1^-(1&g[0]);const y=g.length/4*4;let x=1;if(y>=4)for(;x<y-4;x+=4){const w=g[x],P=g[x+1],E=g[x+2],z=g[x+3];g[x]=(w>>>1^-(1&w))+g[x-1],g[x+1]=(P>>>1^-(1&P))+g[x],g[x+2]=(E>>>1^-(1&E))+g[x+1],g[x+3]=(z>>>1^-(1&z))+g[x+2]}for(;x!=g.length;++x)g[x]=(g[x]>>>1^-(1&g[x]))+g[x-1]})(u),u);case dt.RLE:return(function(g,y,x){return x?(function(w,P,E){const z=new Int32Array(E);let k=0;for(let R=0;R<P;R++){const N=w[R];let X=w[R+P];X=X>>>1^-(1&X),z.fill(X,k,k+N),k+=N}return z})(g,y.runs,y.numRleValues):lf(g,y.runs,y.numRleValues)})(u,h,f);case dt.MORTON:return cd(u),u;case dt.COMPONENTWISE_DELTA:return hf(u),u;case dt.NONE:return f&&(function(g){for(let y=0;y<g.length;y++){const x=g[y];g[y]=x>>>1^-(1&x)}})(u),u;default:throw new Error(`The specified Logical level technique is not supported: ${h.logicalLevelTechnique1}`)}})(Uu(r,e,i),i,s)}function qs(r,e,i){return(function(s,o){if(o.logicalLevelTechnique1===dt.DELTA&&o.logicalLevelTechnique2===dt.NONE)return(function(h){const f=new Int32Array(h.length+1);f[0]=0,f[1]=Na(h[0]);let g=f[1],y=2;for(;y!=f.length;++y){const x=h[y-1];g+=x>>>1^-(1&x),f[y]=f[y-1]+g}return f})(s);if(o.logicalLevelTechnique1===dt.RLE&&o.logicalLevelTechnique2===dt.NONE)return(function(h,f,g){const y=new Int32Array(g+1);y[0]=0;let x=1,w=y[0];for(let P=0;P<f;P++){const E=h[P],z=h[P+f];for(let k=x;k<x+E;k++)y[k]=z+w,w=y[k];x+=E}return y})(s,o.runs,o.numRleValues);if(o.logicalLevelTechnique1===dt.NONE&&o.logicalLevelTechnique2===dt.NONE){(function(h){let f=0;for(let g=0;g<h.length;g++)h[g]+=f,f=h[g]})(s);const u=new Int32Array(o.numValues+1);return u[0]=0,u.set(s,1),u}if(o.logicalLevelTechnique1===dt.DELTA&&o.logicalLevelTechnique2===dt.RLE){const u=(function(h,f,g){const y=new Int32Array(g+1);y[0]=0;let x=1,w=y[0];for(let P=0;P<f;P++){const E=h[P];let z=h[P+f];z=z>>>1^-(1&z);for(let k=x;k<x+E;k++)y[k]=z+w,w=y[k];x+=E}return y})(s,o.runs,o.numRleValues);return cd(u),u}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(Uu(r,e,i),i)}function Uu(r,e,i){const s=i.physicalLevelTechnique;if(s===cs.FAST_PFOR)return of();if(s===cs.VARINT)return zi(r,e,i.numValues);if(s===cs.NONE){const o=e.get();e.add(i.byteLength);const u=r.subarray(o,e.get());return new Int32Array(u)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function hd(r,e,i,s){const o=Uu(r,e,i);if(o.length===1){const u=o[0];return s?Na(u):u}return s?(function(u){return Na(u[1])})(o):(function(u){return u[1]})(o)}function df(r,e,i){return(function(s){if(s.length==2){const o=Na(s[1]);return[o,o]}return[Na(s[2]),Na(s[3])]})(Uu(r,e,i))}function pf(r,e,i){return(function(s){if(s.length==2){const o=Ho(s[1]);return[o,o]}return[Ho(s[2]),Ho(s[3])]})(Nu(r,e,i.numValues))}function ff(r,e,i,s){return(function(o,u,h){switch(u.logicalLevelTechnique1){case dt.DELTA:return u.logicalLevelTechnique2===dt.RLE?(function(f,g,y){const x=new BigInt64Array(y);let w=0,P=0n;for(let E=0;E<g;E++){const z=Number(f[E]),k=Ho(f[E+g]);for(let R=0;R<z;R++)P+=k,x[w++]=P}return x})(o,u.runs,u.numRleValues):((function(f){f[0]=f[0]>>1n^-(1n&f[0]);const g=f.length/4*4;let y=1;if(g>=4)for(;y<g-4;y+=4){const x=f[y],w=f[y+1],P=f[y+2],E=f[y+3];f[y]=(x>>1n^-(1n&x))+f[y-1],f[y+1]=(w>>1n^-(1n&w))+f[y],f[y+2]=(P>>1n^-(1n&P))+f[y+1],f[y+3]=(E>>1n^-(1n&E))+f[y+2]}for(;y!=f.length;++y)f[y]=(f[y]>>1n^-(1n&f[y]))+f[y-1]})(o),o);case dt.RLE:return(function(f,g,y){return y?(function(x,w,P){const E=new BigInt64Array(P);let z=0;for(let k=0;k<w;k++){const R=Number(x[k]);let N=x[k+w];N=N>>1n^-(1n&N),E.fill(N,z,z+R),z+=R}return E})(f,g.runs,g.numRleValues):cf(f,g.runs,g.numRleValues)})(o,u,h);case dt.NONE:return h&&(function(f){for(let g=0;g<f.length;g++){const y=f[g];f[g]=y>>1n^-(1n&y)}})(o),o;default:throw new Error(`The specified Logical level technique is not supported: ${u.logicalLevelTechnique1}`)}})(Nu(r,e,i.numValues),i,s)}function mf(r,e,i,s){const o=Nu(r,e,i.numValues);if(o.length===1){const u=o[0];return s?Ho(u):u}return s?(function(u){return Ho(u[1])})(o):(function(u){return u[1]})(o)}function dd(r,e,i,s,o){return(function(u,h,f,g){switch(h.logicalLevelTechnique1){case dt.DELTA:return h.logicalLevelTechnique2===dt.RLE&&(u=lf(u,h.runs,h.numRleValues)),(function(y,x){const w=new Int32Array(y.size());let P=0;y.get(0)?(w[0]=y.get(0)?x[0]>>>1^-(1&x[0]):0,P=1):w[0]=0;let E=1;for(;E!=w.length;++E)w[E]=y.get(E)?w[E-1]+(x[P]>>>1^-(1&x[P++])):w[E-1];return w})(g,u);case dt.RLE:return(function(y,x,w,P){const E=x;return w?(function(z,k,R){const N=new Int32Array(z.size());let X=0;for(let U=0;U<R;U++){const $=k[U];let J=k[U+R];J=J>>>1^-(1&J);for(let te=X;te<X+$;te++)z.get(te)?N[te]=J:(N[te]=0,X++);X+=$}return N})(P,y,E.runs):(function(z,k,R){const N=new Int32Array(z.size());let X=0;for(let U=0;U<R;U++){const $=k[U],J=k[U+R];for(let te=X;te<X+$;te++)z.get(te)?N[te]=J:(N[te]=0,X++);X+=$}return N})(P,y,E.runs)})(u,h,f,g);case dt.MORTON:return cd(u),u;case dt.COMPONENTWISE_DELTA:return hf(u),u;case dt.NONE:return u=f?(function(y,x){const w=new Int32Array(y.size());let P=0,E=0;for(;E!=w.length;++E)if(y.get(E)){const z=x[P++];w[E]=z>>>1^-(1&z)}else w[E]=0;return w})(g,u):(function(y,x){const w=new Int32Array(y.size());let P=0,E=0;for(;E!=w.length;++E)w[E]=y.get(E)?x[P++]:0;return w})(g,u),u;default:throw new Error("The specified Logical level technique is not supported")}})(i.physicalLevelTechnique===cs.FAST_PFOR?of():zi(r,e,i.numValues),i,s,o)}function Gu(r,e,i,s){const o=r.logicalLevelTechnique1;if(o===dt.RLE)return r.runs===1?Ti.CONST:Ti.FLAT;const u=e instanceof un?e.size():e;if(o===dt.DELTA&&r.logicalLevelTechnique2===dt.RLE){const h=r.runs,f=2;if(r.numRleValues!==u)return Ti.FLAT;if(h===1)return Ti.SEQUENCE;if(h===2){const g=s.get();let y;if(r.physicalLevelTechnique===cs.VARINT)y=zi(i,s,4);else{const x=s.get();y=new Int32Array(i.buffer,i.byteOffset+x,4)}if(s.set(g),y[2]===f&&y[3]===f)return Ti.SEQUENCE}}return r.numValues===1?Ti.CONST:Ti.FLAT}class gf extends Vu{getValueFromBuffer(e){return this.dataBuffer[e]}}class _f extends sf{constructor(e,i,s,o){super(e,BigInt64Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Xo{_geometryOffsets;_partOffsets;_ringOffsets;constructor(e,i,s){this._geometryOffsets=e,this._partOffsets=i,this._ringOffsets=s}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function pd(r,e,i){return{x:yf(r,e)-i,y:yf(r>>1,e)-i}}function yf(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(Si||(Si={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(af||(af={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(jr||(jr={}));class w_{createPoint(e){return[[e]]}createMultiPoint(e){return e.map((i=>[i]))}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,i){return[e].concat(i)}createMultiPolygon(e){return e.flat()}}function vf(r){const e=new Array(r.numGeometries);let i=1,s=1,o=1,u=0;const h=new w_;let f=0,g=0;const y=r.mortonSettings,x=r.topologyVector,w=x.geometryOffsets,P=x.partOffsets,E=x.ringOffsets,z=r.vertexOffsets,k=r.containsPolygonGeometry(),R=r.vertexBuffer;for(let N=0;N<r.numGeometries;N++){const X=r.geometryType(N);if(X===Si.POINT){if(z&&z.length!==0)if(r.vertexBufferType===jr.VEC_2){const U=2*z[g++],$=new _e(R[U],R[U+1]);e[u++]=h.createPoint($)}else{const U=pd(R[z[g++]],y.numBits,y.coordinateShift),$=new _e(U.x,U.y);e[u++]=h.createPoint($)}else{const U=new _e(R[f++],R[f++]);e[u++]=h.createPoint(U)}w&&o++,P&&i++,E&&s++}else if(X===Si.MULTIPOINT){const U=w[o]-w[o-1];o++;const $=new Array(U);if(z&&z.length!==0){for(let J=0;J<U;J++){const te=2*z[g++];$[J]=new _e(R[te],R[te+1])}e[u++]=h.createMultiPoint($)}else{for(let J=0;J<U;J++){const te=R[f++],he=R[f++];$[J]=new _e(te,he)}e[u++]=h.createMultiPoint($)}}else if(X===Si.LINESTRING){let U,$=0;k?($=E[s]-E[s-1],s++):$=P[i]-P[i-1],i++,z&&z.length!==0?(U=r.vertexBufferType===jr.VEC_2?md(R,z,g,$,!1):gd(R,z,g,$,!1,y),g+=$):(U=fd(R,f,$,!1),f+=2*$),e[u++]=h.createLineString(U),w&&o++}else if(X===Si.POLYGON){const U=P[i]-P[i-1];i++;const $=new Array(U-1);let J=E[s]-E[s-1];if(s++,z&&z.length!==0){const te=r.vertexBufferType===jr.VEC_2?qu(R,z,g,J):Zu(R,z,g,J,0,y);g+=J;for(let he=0;he<$.length;he++)J=E[s]-E[s-1],s++,$[he]=r.vertexBufferType===jr.VEC_2?qu(R,z,g,J):Zu(R,z,g,J,0,y),g+=J;e[u++]=h.createPolygon(te,$)}else{const te=$u(R,f,J);f+=2*J;for(let he=0;he<$.length;he++)J=E[s]-E[s-1],s++,$[he]=$u(R,f,J),f+=2*J;e[u++]=h.createPolygon(te,$)}w&&o++}else if(X===Si.MULTILINESTRING){const U=w[o]-w[o-1];o++;const $=new Array(U);if(z&&z.length!==0){for(let J=0;J<U;J++){let te=0;k?(te=E[s]-E[s-1],s++):te=P[i]-P[i-1],i++;const he=r.vertexBufferType===jr.VEC_2?md(R,z,g,te,!1):gd(R,z,g,te,!1,y);$[J]=he,g+=te}e[u++]=h.createMultiLineString($)}else{for(let J=0;J<U;J++){let te=0;k?(te=E[s]-E[s-1],s++):te=P[i]-P[i-1],i++,$[J]=fd(R,f,te,!1),f+=2*te}e[u++]=h.createMultiLineString($)}}else{if(X!==Si.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const U=w[o]-w[o-1];o++;const $=new Array(U);let J=0;if(z&&z.length!==0){for(let te=0;te<U;te++){const he=P[i]-P[i-1];i++;const Se=new Array(he-1);J=E[s]-E[s-1],s++;const we=r.vertexBufferType===jr.VEC_2?qu(R,z,g,J):Zu(R,z,g,J,0,y);g+=J;for(let Me=0;Me<Se.length;Me++)J=E[s]-E[s-1],s++,Se[Me]=r.vertexBufferType===jr.VEC_2?qu(R,z,g,J):Zu(R,z,g,J,0,y),g+=J;$[te]=h.createPolygon(we,Se)}e[u++]=h.createMultiPolygon($)}else{for(let te=0;te<U;te++){const he=P[i]-P[i-1];i++;const Se=new Array(he-1);J=E[s]-E[s-1],s++;const we=$u(R,f,J);f+=2*J;for(let Me=0;Me<Se.length;Me++){const Le=E[s]-E[s-1];s++,Se[Me]=$u(R,f,Le),f+=2*Le}$[te]=h.createPolygon(we,Se)}e[u++]=h.createMultiPolygon($)}}}}return e}function $u(r,e,i){return fd(r,e,i,!0)}function qu(r,e,i,s){return md(r,e,i,s,!0)}function Zu(r,e,i,s,o,u){return gd(r,e,i,s,!0,u)}function fd(r,e,i,s){const o=new Array(s?i+1:i);for(let u=0;u<2*i;u+=2)o[u/2]=new _e(r[e+u],r[e+u+1]);return s&&(o[o.length-1]=o[0]),o}function md(r,e,i,s,o){const u=new Array(o?s+1:s);for(let h=0;h<2*s;h+=2){const f=2*e[i+h/2];u[h/2]=new _e(r[f],r[f+1])}return o&&(u[u.length-1]=u[0]),u}function gd(r,e,i,s,o,u){const h=new Array(o?s+1:s);for(let f=0;f<s;f++){const g=pd(r[e[i+f]],u.numBits,u.coordinateShift);h[f]=new _e(g.x,g.y)}return o&&(h[h.length-1]=h[0]),h}class xf{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(e,i,s,o,u){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=o,this._mortonSettings=u}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=vf(this);let i=0;for(;i<this.numGeometries;)yield{coordinates:e[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=pd(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return vf(this)}get mortonSettings(){return this._mortonSettings}}class bf extends xf{_numGeometries;_geometryType;constructor(e,i,s,o,u,h,f){super(s,o,u,h,f),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Si.POLYGON||this._geometryType===Si.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class wf extends xf{_geometryTypes;constructor(e,i,s,o,u,h){super(e,s,o,u,h),this._geometryTypes=i}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Si.POLYGON||this.geometryType(e)===Si.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Tf{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(e,i,s,o){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=o}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,o=i.ringOffsets,u=i.geometryOffsets;let h=0,f=1,g=1,y=1;for(let x=0;x<this.numGeometries;x++)switch(this.geometryType(x)){case Si.POLYGON:{const w=s[f]-s[f-1];f++;const P=[];for(let E=0;E<w;E++){const z=o[g]-o[g-1];g++;const k=[];for(let R=0;R<z;R++){const N=this._vertexBuffer[h++],X=this._vertexBuffer[h++];k.push(new _e(N,X))}k.length>0&&k.push(k[0]),P.push(k)}e[x]=P,u&&y++}break;case Si.MULTIPOLYGON:{const w=u[y]-u[y-1];y++;const P=[];for(let E=0;E<w;E++){const z=s[f]-s[f-1];f++;for(let k=0;k<z;k++){const R=o[g]-o[g-1];g++;const N=[];for(let X=0;X<R;X++){const U=this._vertexBuffer[h++],$=this._vertexBuffer[h++];N.push(new _e(U,$))}N.length>0&&N.push(N[0]),P.push(N)}}e[x]=P}}return e}[Symbol.iterator](){return null}}function Sf(r,e,i,s,o,u){return new T_(r,e,i,s,o,u)}class T_ extends Tf{_numGeometries;_geometryType;constructor(e,i,s,o,u,h){super(s,o,u,h),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function Pf(r,e,i,s,o){return new S_(r,e,i,s,o)}class S_ extends Tf{_geometryTypes;constructor(e,i,s,o,u){super(i,s,o,u),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function P_(r,e,i,s,o){const u=rr(r,i);let h=null,f=null,g=null,y=null,x=null,w=null,P=null,E=null;if(Gu(u,s,r,i)===Ti.CONST){const k=hd(r,i,u,!1);for(let R=0;R<e-1;R++){const N=rr(r,i);switch(N.physicalStreamType){case Li.LENGTH:switch(N.logicalStreamType.lengthType){case Pr.GEOMETRIES:h=qs(r,i,N);break;case Pr.PARTS:f=qs(r,i,N);break;case Pr.RINGS:g=qs(r,i,N);break;case Pr.TRIANGLES:P=qs(r,i,N)}break;case Li.OFFSET:switch(N.logicalStreamType.offsetType){case Va.VERTEX:y=nr(r,i,N,!1);break;case Va.INDEX:E=nr(r,i,N,!1)}break;case Li.DATA:cn.VERTEX===N.logicalStreamType.dictionaryType?x=nr(r,i,N,!0):(w={numBits:N.numBits,coordinateShift:N.coordinateShift},x=nr(r,i,N,!1))}}return E!==null?h!=null||f!=null?Sf(s,k,P,E,x,new Xo(h,f,g)):Sf(s,k,P,E,x):w===null?(function(R,N,X,U,$){return new bf(R,N,jr.VEC_2,X,U,$)})(s,k,new Xo(h,f,g),y,x):(function(R,N,X,U,$,J){return new bf(R,N,jr.MORTON,X,U,$,J)})(s,k,new Xo(h,f,g),y,x,w)}const z=nr(r,i,u,!1);for(let k=0;k<e-1;k++){const R=rr(r,i);switch(R.physicalStreamType){case Li.LENGTH:switch(R.logicalStreamType.lengthType){case Pr.GEOMETRIES:h=nr(r,i,R,!1);break;case Pr.PARTS:f=nr(r,i,R,!1);break;case Pr.RINGS:g=nr(r,i,R,!1);break;case Pr.TRIANGLES:P=qs(r,i,R)}break;case Li.OFFSET:switch(R.logicalStreamType.offsetType){case Va.VERTEX:y=nr(r,i,R,!1);break;case Va.INDEX:E=nr(r,i,R,!1)}break;case Li.DATA:cn.VERTEX===R.logicalStreamType.dictionaryType?x=nr(r,i,R,!0):(w={numBits:R.numBits,coordinateShift:R.coordinateShift},x=nr(r,i,R,!1))}}return E!==null&&f===null?Pf(z,P,E,x):(h!==null?(h=_d(z,h,2),f!==null&&g!==null?(f=Mf(z,h,f,!1),g=(function(k,R,N,X){const U=new Int32Array(N[N.length-1]+1);let $=0;U[0]=$;let J=1,te=1,he=0;for(let Se=0;Se<k.length;Se++){const we=k[Se],Me=R[Se+1]-R[Se];if(we!==0&&we!==3)for(let Le=0;Le<Me;Le++){const Ee=N[J]-N[J-1];J++;for(let Te=0;Te<Ee;Te++)$=U[te++]=$+X[he++]}else for(let Le=0;Le<Me;Le++)U[te++]=++$,J++}return U})(z,h,f,g)):f!==null&&(f=(function(k,R,N){const X=new Int32Array(R[R.length-1]+1);let U=0;X[0]=U;let $=1,J=0;for(let te=0;te<k.length;te++){const he=k[te],Se=R[te+1]-R[te];if(he===4||he===1)for(let we=0;we<Se;we++)U=X[$++]=U+N[J++];else for(let we=0;we<Se;we++)X[$++]=++U}return X})(z,h,f))):f!==null&&g!==null?(f=_d(z,f,1),g=Mf(z,f,g,!0)):f!==null&&(f=_d(z,f,0)),E!==null?Pf(z,P,E,x,new Xo(h,f,g)):w===null?(function(k,R,N,X){return new wf(jr.VEC_2,k,R,N,X)})(z,new Xo(h,f,g),y,x):(function(k,R,N,X,U){return new wf(jr.MORTON,k,R,N,X,U)})(z,new Xo(h,f,g),y,x,w))}function _d(r,e,i){const s=new Int32Array(r.length+1);let o=0;s[0]=o;let u=0;for(let h=0;h<r.length;h++)o=s[h+1]=o+(r[h]>i?e[u++]:1);return s}function Mf(r,e,i,s){const o=new Int32Array(e[e.length-1]+1);let u=0;o[0]=u;let h=1,f=0;for(let g=0;g<r.length;g++){const y=r[g],x=e[g+1]-e[g];if(y===5||y===2||s&&(y===4||y===1))for(let w=0;w<x;w++)u=o[h++]=u+i[f++];else for(let w=0;w<x;w++)o[h++]=++u}return o}class M_ extends Wo{dataVector;constructor(e,i,s){super(e,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class I_ extends Vu{getValueFromBuffer(e){return this.dataBuffer[e]}}class If extends Wo{constructor(e,i,s){super(e,BigInt64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function fc(r,e,i){return Ef(r,Math.ceil(e/8),i)}function Ef(r,e,i){const s=new Uint8Array(e);let o=0;for(;o<e;){const u=r[i.increment()];if(u<=127){const h=u+3,f=r[i.increment()],g=o+h;s.fill(f,o,g),o=g}else{const h=256-u;for(let f=0;f<h;f++)s[o++]=r[i.increment()]}}return s}const E_=new TextDecoder;function yd(r,e,i){return i-e>=12?E_.decode(r.subarray(e,i)):(function(s,o,u){let h="",f=o;for(;f<u;){const g=s[f];let y,x,w,P=null,E=g>239?4:g>223?3:g>191?2:1;if(f+E>u)break;E===1?g<128&&(P=g):E===2?(y=s[f+1],(192&y)==128&&(P=(31&g)<<6|63&y,P<=127&&(P=null))):E===3?(y=s[f+1],x=s[f+2],(192&y)==128&&(192&x)==128&&(P=(15&g)<<12|(63&y)<<6|63&x,(P<=2047||P>=55296&&P<=57343)&&(P=null))):E===4&&(y=s[f+1],x=s[f+2],w=s[f+3],(192&y)==128&&(192&x)==128&&(192&w)==128&&(P=(15&g)<<18|(63&y)<<12|(63&x)<<6|63&w,(P<=65535||P>=1114112)&&(P=null))),P===null?(P=65533,E=1):P>65535&&(P-=65536,h+=String.fromCharCode(P>>>10&1023|55296),P=56320|1023&P),h+=String.fromCharCode(P),f+=E}return h})(r,e,i)}class vd extends Wo{offsetBuffer;constructor(e,i,s,o){super(e,s,o),this.offsetBuffer=i}}class Cf extends vd{textEncoder;constructor(e,i,s,o){super(e,i,s,o??i.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(e){return yd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Yo extends vd{indexBuffer;textEncoder;constructor(e,i,s,o,u){super(e,s,o,u??i.length),this.indexBuffer=i,this.indexBuffer=i,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const i=this.indexBuffer[e];return yd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class Af extends vd{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(e,i,s,o,u,h,f){super(e,s,o,f),this.indexBuffer=i,this.symbolOffsetBuffer=u,this.symbolTableBuffer=h,this.textEncoder=new TextEncoder}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=(function(s,o,u){const h=[],f=new Array(o.length).fill(0);for(let g=1;g<o.length;g++)f[g]=f[g-1]+o[g-1];for(let g=0;g<u.length;g++)if(u[g]===255)h.push(u[++g]);else{const y=o[u[g]],x=f[u[g]];for(let w=0;w<y;w++)h.push(s[x+w])}return new Uint8Array(h)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return yd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let s=e[0];for(let o=1;o<e.length;o++){const u=e[o];i[o-1]=u-s,s=u}return i}}function C_(r,e,i,s,o,u){return i.type==="scalarType"?(function(h,f,g,y,x,w){let P=null,E=0;if(h===0)return null;if(w.nullable){const k=rr(f,g);E=k.numValues;const R=g.get(),N=fc(f,E,g);g.set(R+k.byteLength),P=new un(N,k.numValues)}const z=P??y;switch(x.physicalType){case 4:case 3:return(function(k,R,N,X,U){const $=rr(k,R),J=Gu($,U,k,R),te=X.physicalType===3;if(J===Ti.FLAT){const he=mc(U)?dd(k,R,$,te,U):nr(k,R,$,te);return new sd(N.name,he,U)}if(J===Ti.SEQUENCE){const he=df(k,R,$);return new od(N.name,he[0],he[1],$.numRleValues)}{const he=hd(k,R,$,te);return new ld(N.name,he,U)}})(f,g,w,x,z);case 9:return(function(k,R,N,X,U){let $=null,J=null,te=null,he=null,Se=null,we=null,Me=null,Le=null;for(let Ee=0;Ee<X;Ee++){const Te=rr(R,N);if(Te.byteLength!==0)switch(Te.physicalStreamType){case Li.PRESENT:{const ve=fc(R,Te.numValues,N);we=new un(ve,Te.numValues);break}case Li.OFFSET:J=U!=null||we!=null?dd(R,N,Te,!1,U??we):nr(R,N,Te,!1);break;case Li.LENGTH:{const ve=qs(R,N,Te);Pr.DICTIONARY===Te.logicalStreamType.lengthType?$=ve:Pr.SYMBOL===Te.logicalStreamType.lengthType?he=ve:Me=ve;break}case Li.DATA:{const ve=R.subarray(N.get(),N.get()+Te.byteLength);N.add(Te.byteLength);const Ue=Te.logicalStreamType.dictionaryType;cn.FSST===Ue?Se=ve:cn.SINGLE===Ue||cn.SHARED===Ue?te=ve:cn.NONE===Ue&&(Le=ve);break}}}return(function(Ee,Te,ve,Ue,Ve,$e,Be){return Te?new Af(Ee,ve,Ue,Ve,$e,Te,Be):null})(k,Se,J,$,te,he,U??we)??(function(Ee,Te,ve,Ue,Ve){return Te?Ve?new Yo(Ee,ve,Ue,Te,Ve):new Yo(Ee,ve,Ue,Te):null})(k,te,J,$,U??we)??(function(Ee,Te,ve,Ue,Ve){if(!Te||!ve)return null;if(Ue)return Ve?new Yo(Ee,Ue,Te,ve,Ve):new Yo(Ee,Ue,Te,ve);if(Ve&&Ve.size()!==Te.length-1){const $e=new Int32Array(Ve.size());let Be=0;for(let Ye=0;Ye<Ve.size();Ye++)$e[Ye]=Ve.get(Ye)?Be++:0;return new Yo(Ee,$e,Te,ve,Ve)}return Ve?new Cf(Ee,Te,ve,Ve):new Cf(Ee,Te,ve)})(k,Me,Le,J,U??we)})(w.name,f,g,w.nullable?h-1:h,P);case 0:return(function(k,R,N,X,U){const $=rr(k,R),J=$.numValues,te=R.get(),he=mc(U)?(function(we,Me,Le,Ee){const Te=Ef(we,Math.ceil(Me/8),Le),ve=new un(Te,Me),Ue=Ee.size(),Ve=new un(new Uint8Array(Ue),Ue);let $e=0;for(let Be=0;Be<Ee.size();Be++){const Ye=!!Ee.get(Be)&&ve.get($e++);Ve.set(Be,Ye)}return Ve.getBuffer()})(k,J,R,U):fc(k,J,R);R.set(te+$.byteLength);const Se=new un(he,J);return new M_(N.name,Se,U)})(f,g,w,0,z);case 6:case 5:return(function(k,R,N,X,U){const $=rr(k,R),J=Gu($,X,k,R),te=U.physicalType===5;if(J===Ti.FLAT){const he=mc(X)?(function(Se,we,Me,Le,Ee){return(function(Te,ve,Ue,Ve){switch(ve.logicalLevelTechnique1){case dt.DELTA:return ve.logicalLevelTechnique2===dt.RLE&&(Te=cf(Te,ve.runs,ve.numRleValues)),(function($e,Be){const Ye=new BigInt64Array($e.size());let mt=0;$e.get(0)?(Ye[0]=$e.get(0)?Be[0]>>1n^-(1n&Be[0]):0n,mt=1):Ye[0]=0n;let ut=1;for(;ut!=Ye.length;++ut)Ye[ut]=$e.get(ut)?Ye[ut-1]+(Be[mt]>>1n^-(1n&Be[mt++])):Ye[ut-1];return Ye})(Ve,Te);case dt.RLE:return(function($e,Be,Ye,mt){const ut=Be;return Ye?(function(Ut,Bi,di){const Gt=new BigInt64Array(Ut.size());let Bt=0;for(let xt=0;xt<di;xt++){const Jt=Number(Bi[xt]);let ai=Bi[xt+di];ai=ai>>1n^-(1n&ai);for(let Rt=Bt;Rt<Bt+Jt;Rt++)Ut.get(Rt)?Gt[Rt]=ai:(Gt[Rt]=0n,Bt++);Bt+=Jt}return Gt})(mt,$e,ut.runs):(function(Ut,Bi,di){const Gt=new BigInt64Array(Ut.size());let Bt=0;for(let xt=0;xt<di;xt++){const Jt=Number(Bi[xt]),ai=Bi[xt+di];for(let Rt=Bt;Rt<Bt+Jt;Rt++)Ut.get(Rt)?Gt[Rt]=ai:(Gt[Rt]=0n,Bt++);Bt+=Jt}return Gt})(mt,$e,ut.runs)})(Te,ve,Ue,Ve);case dt.NONE:return Te=Ue?(function($e,Be){const Ye=new BigInt64Array($e.size());let mt=0,ut=0;for(;ut!=Ye.length;++ut)if($e.get(ut)){const Ut=Be[mt++];Ye[ut]=Ut>>1n^-(1n&Ut)}else Ye[ut]=0n;return Ye})(Ve,Te):(function($e,Be){const Ye=new BigInt64Array($e.size());let mt=0,ut=0;for(;ut!=Ye.length;++ut)Ye[ut]=$e.get(ut)?Be[mt++]:0n;return Ye})(Ve,Te),Te;default:throw new Error("The specified Logical level technique is not supported")}})(Nu(Se,we,Me.numValues),Me,Le,Ee)})(k,R,$,te,X):ff(k,R,$,te);return new gf(N.name,he,X)}if(J===Ti.SEQUENCE){const he=pf(k,R,$);return new _f(N.name,he[0],he[1],$.numRleValues)}{const he=mf(k,R,$,te);return new If(N.name,he,X)}})(f,g,w,z,x);case 7:return(function(k,R,N,X){const U=rr(k,R),$=mc(X)?(function(J,te,he,Se){const we=te.get(),Me=we+Se*Float32Array.BYTES_PER_ELEMENT,Le=new Uint8Array(J.subarray(we,Me)).buffer,Ee=new Float32Array(Le);te.set(Me);const Te=he.size(),ve=new Float32Array(Te);let Ue=0;for(let Ve=0;Ve<Te;Ve++)ve[Ve]=he.get(Ve)?Ee[Ue++]:0;return ve})(k,R,X,U.numValues):(function(J,te,he){const Se=te.get(),we=Se+he*Float32Array.BYTES_PER_ELEMENT,Me=new Uint8Array(J.subarray(Se,we)).buffer,Le=new Float32Array(Me);return te.set(we),Le})(k,R,U.numValues);return new I_(N.name,$,X)})(f,g,w,z);case 8:return(function(k,R,N,X){const U=rr(k,R),$=mc(X)?(function(J,te,he,Se){const we=te.get(),Me=we+Se*Float64Array.BYTES_PER_ELEMENT,Le=new Uint8Array(J.subarray(we,Me)).buffer,Ee=new Float64Array(Le);te.set(Me);const Te=he.size(),ve=new Float64Array(Te);let Ue=0;for(let Ve=0;Ve<Te;Ve++)ve[Ve]=he.get(Ve)?Ee[Ue++]:0;return ve})(k,R,X,U.numValues):(function(J,te,he){const Se=te.get(),we=Se+he*Float64Array.BYTES_PER_ELEMENT,Me=new Uint8Array(J.subarray(Se,we)).buffer,Le=new Float64Array(Me);return te.set(we),Le})(k,R,U.numValues);return new ad(N.name,$,X)})(f,g,w,z);default:throw new Error(`The specified data type for the field is currently not supported: ${x}`)}})(s,r,e,o,i.scalarType,i):s!=1?null:(function(h,f,g,y){let x=null,w=null,P=null,E=null,z=!1;for(;!z;){const X=rr(h,f);switch(X.physicalStreamType){case Li.LENGTH:Pr.DICTIONARY===X.logicalStreamType.lengthType?x=qs(h,f,X):P=qs(h,f,X);break;case Li.DATA:cn.SINGLE===X.logicalStreamType.dictionaryType||cn.SHARED===X.logicalStreamType.dictionaryType?(w=h.subarray(f.get(),f.get()+X.byteLength),z=!0):E=h.subarray(f.get(),f.get()+X.byteLength),f.add(X.byteLength)}}const k=g.complexType.children,R=[];let N=0;for(const X of k){const U=zi(h,f,1)[0];if(U==0)continue;const $=`${g.name}${X.name==="default"?"":":"+X.name}`;if(U!==2||X.type!=="scalarField"||X.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const J=rr(h,f),te=fc(h,J.numValues,f),he=rr(h,f),Se=he.decompressedCount!==y?dd(h,f,he,!1,new un(te,J.numValues)):nr(h,f,he,!1);R[N++]=E?new Af($,Se,x,w,P,E,new un(te,J.numValues)):new Yo($,Se,x,w,new un(te,J.numValues))}return R})(r,e,i,o)}function mc(r){return r instanceof un}function A_(r){if(r.name==="id")return!1;if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}const z_=new TextDecoder;function zf(r,e){const i=zi(r,e,1)[0];if(i===0)return"";const s=e.get(),o=r.subarray(s,s+i);return e.add(i),z_.decode(o)}function kf(r,e){const i=zi(r,e,1)[0]>>>0,s=!!(4&i),o=!!(2&i),u=zi(r,e,1)[0]>>>0,h={};if(1&i&&(h.nullable=!0),o){const f={};if(s?(f.type="logicalType",f.logicalType=u):(f.type="physicalType",f.physicalType=u),8&i){const g=zi(r,e,1)[0]>>>0;f.children=new Array(g);for(let y=0;y<g;y++)f.children[y]=kf(r,e)}h.type="complexField",h.complexField=f}else{const f={};s?(f.type="logicalType",f.logicalType=u):(f.type="physicalType",f.physicalType=u),h.type="scalarField",h.scalarField=f}return h}function k_(r,e){const i=zi(r,e,1)[0]>>>0,s=(function(o){switch(o){case 0:case 1:case 2:case 3:{const u={};u.nullable=!!(1&o),u.columnScope=0;const h={};return h.physicalType=o>1?6:4,h.type="physicalType",u.scalarType=h,u.type="scalarType",u}case 4:{const u={nullable:!1,columnScope:0},h={type:"physicalType",physicalType:0};return u.type="complexType",u.complexType=h,u}case 30:{const u={nullable:!1,columnScope:0},h={type:"physicalType",physicalType:1};return u.type="complexType",u.complexType=h,u}default:return(function(u){let h=null;switch(u){case 10:case 11:h=0;break;case 12:case 13:h=1;break;case 14:case 15:h=2;break;case 16:case 17:h=3;break;case 18:case 19:h=4;break;case 20:case 21:h=5;break;case 22:case 23:h=6;break;case 24:case 25:h=7;break;case 26:case 27:h=8;break;case 28:case 29:h=9;break;default:return null}const f={};f.nullable=!!(1&u),f.columnScope=0;const g={type:"physicalType"};return g.physicalType=h,f.type="scalarType",f.scalarType=g,f})(o)}})(i);if(!s)throw new Error(`Unsupported column type code: ${i}`);if((function(o){return o>=10})(i)?s.name=zf(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),(function(o){return o===30})(i)){const o=zi(r,e,1)[0]>>>0,u=s.complexType;u.children=new Array(o);for(let h=0;h<o;h++)u.children[h]=kf(r,e)}return s}function D_(r,e){const i={featureTables:[]},s={};s.name=zf(r,e);const o=zi(r,e,1)[0]>>>0,u=zi(r,e,1)[0]>>>0;s.columns=new Array(u);for(let h=0;h<u;h++)s.columns[h]=k_(r,e);return i.featureTables.push(s),[i,o]}function R_(r,e,i,s,o,u,h=!1){const f=e.scalarType.physicalType,g=Gu(o,u,r,i);if(f===4)switch(g){case Ti.FLAT:{const y=nr(r,i,o,!1);return new sd(s,y,u)}case Ti.SEQUENCE:{const y=df(r,i,o);return new od(s,y[0],y[1],o.numRleValues)}case Ti.CONST:{const y=hd(r,i,o,!1);return new ld(s,y,u)}}else switch(g){case Ti.FLAT:{if(h){const x=(function(w,P,E,z){const k=(function(R,N,X){const U=new Float64Array(N);for(let $=0;$<N;$++)U[$]=x_(R,X);return U})(w,E.numValues,P);return(function(R,N,X){switch(N.logicalLevelTechnique1){case dt.DELTA:return N.logicalLevelTechnique2===dt.RLE&&(R=uf(R,N.runs,N.numRleValues)),(function(U){U[0]=U[0]%2==1?(U[0]+1)/-2:U[0]/2;const $=U.length/4*4;let J=1;if($>=4)for(;J<$-4;J+=4){const te=U[J],he=U[J+1],Se=U[J+2],we=U[J+3];U[J]=(te%2==1?(te+1)/-2:te/2)+U[J-1],U[J+1]=(he%2==1?(he+1)/-2:he/2)+U[J],U[J+2]=(Se%2==1?(Se+1)/-2:Se/2)+U[J+1],U[J+3]=(we%2==1?(we+1)/-2:we/2)+U[J+2]}for(;J!=U.length;++J)U[J]=(U[J]%2==1?(U[J]+1)/-2:U[J]/2)+U[J-1]})(R),R;case dt.RLE:return(function(U,$,J){return uf(U,$.runs,$.numRleValues)})(R,N);case dt.NONE:return R;default:throw new Error(`The specified Logical level technique is not supported: ${N.logicalLevelTechnique1}`)}})(k,E)})(r,i,o);return new ad(s,x,u)}const y=ff(r,i,o,!1);return new gf(s,y,u)}case Ti.SEQUENCE:{const y=pf(r,i,o);return new _f(s,y[0],y[1],o.numRleValues)}case Ti.CONST:{const y=mf(r,i,o,!1);return new If(s,y,u)}}throw new Error("Vector type not supported for id column.")}class L_{constructor(e,i){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case Si.POINT:case Si.MULTIPOINT:this.type=1;break;case Si.LINESTRING:case Si.MULTILINESTRING:this.type=2;break;case Si.POLYGON:case Si.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const o of i)s.push(new _e(o.x,o.y));e.push(s)}return e}}class F_{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new L_(this.features[e],this.extent)}}class Df{constructor(e){this.layers={};const i=(function(s,o,u=!0){const h=new v_(0),f=[];for(;h.get()<s.length;){const g=zi(s,h,1)[0]>>>0,y=h.get()+g;if(y>s.length)throw new Error(`Block overruns tile: ${y} > ${s.length}`);if(zi(s,h,1)[0]>>>0!=1){h.set(y);continue}const x=D_(s,h),w=x[1],P=x[0].featureTables[0];let E=null,z=null;const k=[];let R=0;for(const X of P.columns){const U=X.name;if(U==="id"){let $=null;if(X.nullable){const te=rr(s,h),he=h.get(),Se=fc(s,te.numValues,h);h.set(he+te.byteLength),$=new un(Se,te.numValues)}const J=rr(s,h);R=J.decompressedCount,E=R_(s,X,h,U,J,$??R,u)}else if(U==="geometry"){const $=zi(s,h,1)[0];if(R===0){const J=h.get();R=rr(s,h).decompressedCount,h.set(J)}z=P_(s,$,h,R)}else{const $=A_(X)?zi(s,h,1)[0]:1;if($===0&&X.type==="scalarType")continue;const J=C_(s,h,X,$,R);if(J)if(Array.isArray(J))for(const te of J)k.push(te);else k.push(J)}}const N=new y_(P.name,z,E,k,w);f.push(N),h.set(y)}return f})(new Uint8Array(e));this.layers=i.reduce(((s,o)=>Object.assign(Object.assign({},s),{[o.name]:new F_(o)})),{})}}class B_{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const s of i){const o=[];for(const u of s)o.push(new _e(u[0],u[1]));e.push(o)}return e}}const gc="_geojsonTileLayer";function O_(r,e){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const i={keys:[],values:[],keycache:{},valuecache:{}};for(let u=0;u<r.length;u++)i.feature=r.feature(u),e.writeMessage(2,j_,i);const s=i.keys;for(const u of s)e.writeStringField(3,u);const o=i.values;for(const u of o)e.writeMessage(4,U_,u)}function j_(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,V_,r),e.writeVarintField(3,i.type),e.writeMessage(4,N_,i)}function V_(r,e){for(const i in r.feature?.properties){let s=r.feature.properties[i],o=r.keycache[i];if(s==null)continue;o===void 0&&(r.keys.push(i),o=r.keys.length-1,r.keycache[i]=o),e.writeVarint(o),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=JSON.stringify(s));const u=typeof s+":"+s;let h=r.valuecache[u];h===void 0&&(r.values.push(s),h=r.values.length-1,r.valuecache[u]=h),e.writeVarint(h)}}function xd(r,e){return(e<<3)+(7&r)}function Rf(r){return r<<1^r>>31}function N_(r,e){const i=r.loadGeometry(),s=r.type;let o=0,u=0;for(const h of i){let f=1;s===1&&(f=h.length),e.writeVarint(xd(1,f));const g=s===3?h.length-1:h.length;for(let y=0;y<g;y++){y===1&&s!==1&&e.writeVarint(xd(2,g-1));const x=h[y].x-o,w=h[y].y-u;e.writeVarint(Rf(x)),e.writeVarint(Rf(w)),o+=x,u+=w}r.type===3&&e.writeVarint(xd(7,1))}}function U_(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class Lf{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Os(ht,16,0),this.grid3D=new Os(ht,16,0),this.featureIndexArray=new V,this.promoteId=i}insert(e,i,s,o,u,h){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,u);const g=h?this.grid3D:this.grid;for(let y=0;y<i.length;y++){const x=i[y],w=[1/0,1/0,-1/0,-1/0];for(let P=0;P<x.length;P++){const E=x[P];w[0]=Math.min(w[0],E.x),w[1]=Math.min(w[1],E.y),w[2]=Math.max(w[2],E.x),w[3]=Math.max(w[3],E.y)}w[0]<ht&&w[1]<ht&&w[2]>=0&&w[3]>=0&&g.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new vp(new Lu(this.rawTileData)).layers:new Df(this.rawTileData).layers,this.sourceLayerCoder=new rf(this.vtLayers?Object.keys(this.vtLayers).sort():[gc])),this.vtLayers}query(e,i,s,o){this.loadVTLayers();const u=e.params,h=ht/e.tileSize/e.scale,f=ma(u.filter,u.globalState),g=e.queryGeometry,y=e.queryPadding*h,x=ja.fromPoints(g),w=this.grid.query(x.minX-y,x.minY-y,x.maxX+y,x.maxY+y),P=ja.fromPoints(e.cameraQueryGeometry).expandBy(y),E=this.grid3D.query(P.minX,P.minY,P.maxX,P.maxY,((R,N,X,U)=>(function($,J,te,he,Se){for(const Me of $)if(J<=Me.x&&te<=Me.y&&he>=Me.x&&Se>=Me.y)return!0;const we=[new _e(J,te),new _e(J,Se),new _e(he,Se),new _e(he,te)];if($.length>2){for(const Me of we)if(Oo($,Me))return!0}for(let Me=0;Me<$.length-1;Me++)if($m($[Me],$[Me+1],we))return!0;return!1})(e.cameraQueryGeometry,R-y,N-y,X+y,U+y)));for(const R of E)w.push(R);w.sort(G_);const z={};let k;for(let R=0;R<w.length;R++){const N=w[R];if(N===k)continue;k=N;const X=this.featureIndexArray.get(N);let U=null;this.loadMatchingFeature(z,X.bucketIndex,X.sourceLayerIndex,X.featureIndex,f,u.layers,u.availableImages,i,s,o,(($,J,te)=>(U||(U=Dn($)),J.queryIntersectsFeature({queryGeometry:g,feature:$,featureState:te,geometry:U,zoom:this.z,transform:e.transform,pixelsToTileUnits:h,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return z}loadMatchingFeature(e,i,s,o,u,h,f,g,y,x,w){const P=this.bucketLayerIDs[i];if(h&&!P.some((R=>h.has(R))))return;const E=this.sourceLayerCoder.decode(s),z=this.vtLayers[E].feature(o);if(u.needGeometry){const R=Rn(z,!0);if(!u.filter(new Pt(this.tileID.overscaledZ),R,this.tileID.canonical))return}else if(!u.filter(new Pt(this.tileID.overscaledZ),z))return;const k=this.getId(z,E);for(let R=0;R<P.length;R++){const N=P[R];if(h&&!h.has(N))continue;const X=g[N];if(!X)continue;let U={};k&&x&&(U=x.getState(X.sourceLayer||gc,k));const $=yi({},y[N]);$.paint=Ff($.paint,X.paint,z,U,f),$.layout=Ff($.layout,X.layout,z,U,f);const J=!w||w(z,X,U);if(!J)continue;const te=new nf(z,this.z,this.x,this.y,k);te.layer=$;let he=e[N];he===void 0&&(he=e[N]=[]),he.push({featureIndex:o,feature:te,intersectionZ:J})}}lookupSymbolFeatures(e,i,s,o,u,h,f,g){const y={};this.loadVTLayers();const x=ma(u.filterSpec,u.globalState);for(const w of e)this.loadMatchingFeature(y,s,o,w,x,h,f,g,i);return y}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){var s;let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof o=="boolean"&&(o=Number(o)),o===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(o=Number(e.properties.cluster_id))),o}}function Ff(r,e,i,s,o){return cr(r,((u,h)=>{const f=e instanceof Ea?e.get(h):null;return f&&f.evaluate?f.evaluate(i,s,o):f}))}function G_(r,e){return e-r}function Bf(r,e,i,s,o){const u=[];for(let h=0;h<r.length;h++){const f=r[h];let g;for(let y=0;y<f.length-1;y++){let x=f[y],w=f[y+1];x.x<e&&w.x<e||(x.x<e?x=new _e(e,x.y+(e-x.x)/(w.x-x.x)*(w.y-x.y))._round():w.x<e&&(w=new _e(e,x.y+(e-x.x)/(w.x-x.x)*(w.y-x.y))._round()),x.y<i&&w.y<i||(x.y<i?x=new _e(x.x+(i-x.y)/(w.y-x.y)*(w.x-x.x),i)._round():w.y<i&&(w=new _e(x.x+(i-x.y)/(w.y-x.y)*(w.x-x.x),i)._round()),x.x>=s&&w.x>=s||(x.x>=s?x=new _e(s,x.y+(s-x.x)/(w.x-x.x)*(w.y-x.y))._round():w.x>=s&&(w=new _e(s,x.y+(s-x.x)/(w.x-x.x)*(w.y-x.y))._round()),x.y>=o&&w.y>=o||(x.y>=o?x=new _e(x.x+(o-x.y)/(w.y-x.y)*(w.x-x.x),o)._round():w.y>=o&&(w=new _e(x.x+(o-x.y)/(w.y-x.y)*(w.x-x.x),o)._round()),g&&x.equals(g[g.length-1])||(g=[x],u.push(g)),g.push(w)))))}}return u}function Of(r,e,i,s,o){switch(e){case 1:return(function(u,h,f,g){const y=[];for(const x of u)for(const w of x){const P=g===0?w.x:w.y;P>=h&&P<=f&&y.push([w])}return y})(r,i,s,o);case 2:return jf(r,i,s,o,!1);case 3:return jf(r,i,s,o,!0)}return[]}function $_(r,e,i,s,o){const u=s===0?q_:Z_;let h=[];const f=[];for(let x=0;x<r.length-1;x++){const w=r[x],P=r[x+1],E=s===0?w.x:w.y,z=s===0?P.x:P.y;let k=!1;E<e?z>e&&h.push(u(w,P,e)):E>i?z<i&&h.push(u(w,P,i)):h.push(w),z<e&&E>=e&&(h.push(u(w,P,e)),k=!0),z>i&&E<=i&&(h.push(u(w,P,i)),k=!0),!o&&k&&(f.push(h),h=[])}const g=r.length-1,y=s===0?r[g].x:r[g].y;return y>=e&&y<=i&&h.push(r[g]),o&&h.length>0&&!h[0].equals(h[h.length-1])&&h.push(new _e(h[0].x,h[0].y)),h.length>0&&f.push(h),f}function jf(r,e,i,s,o){const u=[];for(const h of r){const f=$_(h,e,i,s,o);f.length>0&&u.push(...f)}return u}function q_(r,e,i){return new _e(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function Z_(r,e,i){return new _e(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Ge("FeatureIndex",Lf,{omit:["rawTileData","sourceLayerCoder"]});class Zs extends _e{constructor(e,i,s,o){super(e,i),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new Zs(this.x,this.y,this.angle,this.segment)}}function Vf(r,e,i,s,o){if(e.segment===void 0||i===0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const g=[];let y=0;for(;f<i/2;){const x=r[h],w=r[h+1];if(!w)return!1;let P=r[h-1].angleTo(x)-x.angleTo(w);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:P}),y+=P;f-g[0].distance>s;)y-=g.shift().angleDelta;if(y>o)return!1;h++,f+=x.dist(w)}return!0}function Nf(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Uf(r,e,i){return r?.6*e*i:0}function Gf(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function W_(r,e,i,s,o,u){const h=Uf(i,o,u),f=Gf(i,s)*u;let g=0;const y=Nf(r)/2;for(let x=0;x<r.length-1;x++){const w=r[x],P=r[x+1],E=w.dist(P);if(g+E>y){const z=(y-g)/E,k=jt.number(w.x,P.x,z),R=jt.number(w.y,P.y,z),N=new Zs(k,R,P.angleTo(w),x);return N._round(),!h||Vf(r,N,f,h,e)?N:void 0}g+=E}}function H_(r,e,i,s,o,u,h,f,g){const y=Uf(s,u,h),x=Gf(s,o),w=x*h,P=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-w<e/4&&(e=w+e/4),$f(r,P?e/2*f%e:(x/2+2*u)*h*f%e,e,y,i,w,P,!1,g)}function $f(r,e,i,s,o,u,h,f,g){const y=u/2,x=Nf(r);let w=0,P=e-i,E=[];for(let z=0;z<r.length-1;z++){const k=r[z],R=r[z+1],N=k.dist(R),X=R.angleTo(k);for(;P+i<w+N;){P+=i;const U=(P-w)/N,$=jt.number(k.x,R.x,U),J=jt.number(k.y,R.y,U);if($>=0&&$<g&&J>=0&&J<g&&P-y>=0&&P+y<=x){const te=new Zs($,J,X,z);te._round(),s&&!Vf(r,te,u,s,o)||E.push(te)}}w+=N}return f||E.length||h||(E=$f(r,w/2,i,s,o,u,h,!0,g)),E}function qf(r,e,i,s){const o=[],u=r.image,h=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2;let y={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const x=u.stretchX||[[0,f]],w=u.stretchY||[[0,g]],P=(ve,Ue)=>ve+Ue[1]-Ue[0],E=x.reduce(P,0),z=w.reduce(P,0),k=f-E,R=g-z;let N=0,X=E,U=0,$=z,J=0,te=k,he=0,Se=R;if(u.content&&s){const ve=u.content,Ue=ve[2]-ve[0],Ve=ve[3]-ve[1];(u.textFitWidth||u.textFitHeight)&&(y=jp(r)),N=Wu(x,0,ve[0]),U=Wu(w,0,ve[1]),X=Wu(x,ve[0],ve[2]),$=Wu(w,ve[1],ve[3]),J=ve[0]-N,he=ve[1]-U,te=Ue-X,Se=Ve-$}const we=y.x1,Me=y.y1,Le=y.x2-we,Ee=y.y2-Me,Te=(ve,Ue,Ve,$e)=>{const Be=Hu(ve.stretch-N,X,Le,we),Ye=Xu(ve.fixed-J,te,ve.stretch,E),mt=Hu(Ue.stretch-U,$,Ee,Me),ut=Xu(Ue.fixed-he,Se,Ue.stretch,z),Ut=Hu(Ve.stretch-N,X,Le,we),Bi=Xu(Ve.fixed-J,te,Ve.stretch,E),di=Hu($e.stretch-U,$,Ee,Me),Gt=Xu($e.fixed-he,Se,$e.stretch,z),Bt=new _e(Be,mt),xt=new _e(Ut,mt),Jt=new _e(Ut,di),ai=new _e(Be,di),Rt=new _e(Ye/h,ut/h),fr=new _e(Bi/h,Gt/h),Oi=e*Math.PI/180;if(Oi){const Pi=Math.sin(Oi),Zt=Math.cos(Oi),pi=[Zt,-Pi,Pi,Zt];Bt._matMult(pi),xt._matMult(pi),ai._matMult(pi),Jt._matMult(pi)}const mr=ve.stretch+ve.fixed,en=Ue.stretch+Ue.fixed;return{tl:Bt,tr:xt,bl:ai,br:Jt,tex:{x:u.paddedRect.x+1+mr,y:u.paddedRect.y+1+en,w:Ve.stretch+Ve.fixed-mr,h:$e.stretch+$e.fixed-en},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Rt,pixelOffsetBR:fr,minFontScaleX:te/h/Le,minFontScaleY:Se/h/Ee,isSDF:i}};if(s&&(u.stretchX||u.stretchY)){const ve=Zf(x,k,E),Ue=Zf(w,R,z);for(let Ve=0;Ve<ve.length-1;Ve++){const $e=ve[Ve],Be=ve[Ve+1];for(let Ye=0;Ye<Ue.length-1;Ye++)o.push(Te($e,Ue[Ye],Be,Ue[Ye+1]))}}else o.push(Te({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return o}function Wu(r,e,i){let s=0;for(const o of r)s+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return s}function Zf(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[o,u]of r){const h=s[s.length-1];s.push({fixed:o-h.stretch,stretch:h.stretch}),s.push({fixed:o-h.stretch,stretch:h.stretch+(u-o)})}return s.push({fixed:e+1,stretch:i}),s}function Hu(r,e,i,s){return r/e*i+s}function Xu(r,e,i,s){return r-e*i/s}Ge("Anchor",Zs);class Yu{constructor(e,i,s,o,u,h,f,g,y,x){var w;if(this.boxStartIndex=e.length,y){let P=h.top,E=h.bottom;const z=h.collisionPadding;z&&(P-=z[1],E+=z[3]);let k=E-P;k>0&&(k=Math.max(10,k),this.circleDiameter=k)}else{const P=!((w=h.image)===null||w===void 0)&&w.content&&(h.image.textFitWidth||h.image.textFitHeight)?jp(h):{x1:h.left,y1:h.top,x2:h.right,y2:h.bottom};P.y1=P.y1*f-g[0],P.y2=P.y2*f+g[2],P.x1=P.x1*f-g[3],P.x2=P.x2*f+g[1];const E=h.collisionPadding;if(E&&(P.x1-=E[0]*f,P.y1-=E[1]*f,P.x2+=E[2]*f,P.y2+=E[3]*f),x){const z=new _e(P.x1,P.y1),k=new _e(P.x2,P.y1),R=new _e(P.x1,P.y2),N=new _e(P.x2,P.y2),X=x*Math.PI/180;z._rotate(X),k._rotate(X),R._rotate(X),N._rotate(X),P.x1=Math.min(z.x,k.x,R.x,N.x),P.x2=Math.max(z.x,k.x,R.x,N.x),P.y1=Math.min(z.y,k.y,R.y,N.y),P.y2=Math.max(z.y,k.y,R.y,N.y)}e.emplaceBack(i.x,i.y,P.x1,P.y1,P.x2,P.y2,s,o,u)}this.boxEndIndex=e.length}}class X_{constructor(e=[],i=(s,o)=>s<o?-1:s>o?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(s(o,h)>=0)break;i[e]=h,e=u}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,u=i[e];for(;e<o;){let h=1+(e<<1);const f=h+1;if(f<this.length&&s(i[f],i[h])<0&&(h=f),s(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}function Y_(r,e=1,i=!1){const s=ja.fromPoints(r[0]),o=Math.min(s.width(),s.height());let u=o/2;const h=new X_([],K_),{minX:f,minY:g,maxX:y,maxY:x}=s;if(o===0)return new _e(f,g);for(let E=f;E<y;E+=o)for(let z=g;z<x;z+=o)h.push(new Ko(E+u,z+u,u,r));let w=(function(E){let z=0,k=0,R=0;const N=E[0];for(let X=0,U=N.length,$=U-1;X<U;$=X++){const J=N[X],te=N[$],he=J.x*te.y-te.x*J.y;k+=(J.x+te.x)*he,R+=(J.y+te.y)*he,z+=3*he}return new Ko(k/z,R/z,0,E)})(r),P=h.length;for(;h.length;){const E=h.pop();(E.d>w.d||!w.d)&&(w=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,P)),E.max-w.d<=e||(u=E.h/2,h.push(new Ko(E.p.x-u,E.p.y-u,u,r)),h.push(new Ko(E.p.x+u,E.p.y-u,u,r)),h.push(new Ko(E.p.x-u,E.p.y+u,u,r)),h.push(new Ko(E.p.x+u,E.p.y+u,u,r)),P+=4)}return i&&(console.log(`num probes: ${P}`),console.log(`best distance: ${w.d}`)),w.p}function K_(r,e){return e.max-r.max}function Ko(r,e,i,s){this.p=new _e(r,e),this.h=i,this.d=(function(o,u){let h=!1,f=1/0;for(let g=0;g<u.length;g++){const y=u[g];for(let x=0,w=y.length,P=w-1;x<w;P=x++){const E=y[x],z=y[P];E.y>o.y!=z.y>o.y&&o.x<(z.x-E.x)*(o.y-E.y)/(z.y-E.y)+E.x&&(h=!h),f=Math.min(f,Yd(o,E,z))}}return(h?1:-1)*Math.sqrt(f)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Fi;M.aP=void 0,(Fi=M.aP||(M.aP={}))[Fi.center=1]="center",Fi[Fi.left=2]="left",Fi[Fi.right=3]="right",Fi[Fi.top=4]="top",Fi[Fi.bottom=5]="bottom",Fi[Fi["top-left"]=6]="top-left",Fi[Fi["top-right"]=7]="top-right",Fi[Fi["bottom-left"]=8]="bottom-left",Fi[Fi["bottom-right"]=9]="bottom-right";const bd=Number.POSITIVE_INFINITY;function Wf(r,e){return e[1]!==bd?(function(i,s,o){let u=0,h=0;switch(s=Math.abs(s),o=Math.abs(o),i){case"top-right":case"top-left":case"top":h=o-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-o}switch(i){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,h]})(r,e[0],e[1]):(function(i,s){let o=0,u=0;s<0&&(s=0);const h=s/Math.SQRT2;switch(i){case"top-right":case"top-left":u=h-7;break;case"bottom-right":case"bottom-left":u=7-h;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(i){case"top-right":case"bottom-right":o=-h;break;case"top-left":case"bottom-left":o=h;break;case"left":o=s;break;case"right":o=-s}return[o,u]})(r,e[0])}function Hf(r,e,i){var s;const o=r.layout,u=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(u){const f=u.values,g=[];for(let y=0;y<f.length;y+=2){const x=g[y]=f[y],w=f[y+1].map((P=>P*wi));x.startsWith("top")?w[1]-=7:x.startsWith("bottom")&&(w[1]+=7),g[y+1]=w}return new qi(g)}const h=o.get("text-variable-anchor");if(h){let f;f=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},i)*wi,bd]:o.get("text-offset").evaluate(e,{},i).map((y=>y*wi));const g=[];for(const y of h)g.push(y,Wf(y,f));return new qi(g)}return null}function wd(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function J_(r,e,i,s,o,u,h,f,g,y,x,w){let P=u.textMaxSize.evaluate(e,{});P===void 0&&(P=h);const E=r.layers[0].layout,z=E.get("icon-offset").evaluate(e,{},x),k=Yf(i.horizontal),R=h/24,N=r.tilePixelRatio*R,X=r.tilePixelRatio*P/24,U=r.tilePixelRatio*f,$=r.tilePixelRatio*E.get("symbol-spacing"),J=E.get("text-padding")*r.tilePixelRatio,te=(function(Ve,$e,Be,Ye=1){const mt=Ve.get("icon-padding").evaluate($e,{},Be),ut=mt&&mt.values;return[ut[0]*Ye,ut[1]*Ye,ut[2]*Ye,ut[3]*Ye]})(E,e,x,r.tilePixelRatio),he=E.get("text-max-angle")/180*Math.PI,Se=E.get("text-rotation-alignment")!=="viewport"&&E.get("symbol-placement")!=="point",we=E.get("icon-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point",Me=E.get("symbol-placement"),Le=$/2,Ee=E.get("icon-text-fit");let Te;s&&Ee!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(Te=Vp(s,i.vertical,Ee,E.get("icon-text-fit-padding"),z,R)),k&&(s=Vp(s,k,Ee,E.get("icon-text-fit-padding"),z,R)));const ve=x?w.line.getGranularityForZoomLevel(x.z):1,Ue=(Ve,$e)=>{$e.x<0||$e.x>=ht||$e.y<0||$e.y>=ht||(function(Be,Ye,mt,ut,Ut,Bi,di,Gt,Bt,xt,Jt,ai,Rt,fr,Oi,mr,en,Pi,Zt,pi,Qt,Mi,us,hn,vc){const Ws=Be.addToLineVertexArray(Ye,mt);let Ua,Jo,Qo,el,em=0,tm=0,im=0,rm=0,Ad=-1,zd=-1;const hs={};let nm=si("");if(Be.allowVerticalPlacement&&ut.vertical){const Xi=Gt.layout.get("text-rotate").evaluate(Qt,{},hn)+90;Qo=new Yu(Bt,Ye,xt,Jt,ai,ut.vertical,Rt,fr,Oi,Xi),di&&(el=new Yu(Bt,Ye,xt,Jt,ai,di,en,Pi,Oi,Xi))}if(Ut){const Xi=Gt.layout.get("icon-rotate").evaluate(Qt,{}),Vr=Gt.layout.get("icon-text-fit")!=="none",Ga=qf(Ut,Xi,us,Vr),pn=di?qf(di,Xi,us,Vr):void 0;Jo=new Yu(Bt,Ye,xt,Jt,ai,Ut,en,Pi,!1,Xi),em=4*Ga.length;const $a=Be.iconSizeData;let Ln=null;$a.kind==="source"?(Ln=[ls*Gt.layout.get("icon-size").evaluate(Qt,{})],Ln[0]>Gs&&vi(`${Be.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):$a.kind==="composite"&&(Ln=[ls*Mi.compositeIconSizes[0].evaluate(Qt,{},hn),ls*Mi.compositeIconSizes[1].evaluate(Qt,{},hn)],(Ln[0]>Gs||Ln[1]>Gs)&&vi(`${Be.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Be.addSymbols(Be.icon,Ga,Ln,pi,Zt,Qt,M.az.none,Ye,Ws.lineStartIndex,Ws.lineLength,-1,hn),Ad=Be.icon.placedSymbolArray.length-1,pn&&(tm=4*pn.length,Be.addSymbols(Be.icon,pn,Ln,pi,Zt,Qt,M.az.vertical,Ye,Ws.lineStartIndex,Ws.lineLength,-1,hn),zd=Be.icon.placedSymbolArray.length-1)}const sm=Object.keys(ut.horizontal);for(const Xi of sm){const Vr=ut.horizontal[Xi];if(!Ua){nm=si(Vr.text);const pn=Gt.layout.get("text-rotate").evaluate(Qt,{},hn);Ua=new Yu(Bt,Ye,xt,Jt,ai,Vr,Rt,fr,Oi,pn)}const Ga=Vr.positionedLines.length===1;if(im+=Xf(Be,Ye,Vr,Bi,Gt,Oi,Qt,mr,Ws,ut.vertical?M.az.horizontal:M.az.horizontalOnly,Ga?sm:[Xi],hs,Ad,Mi,hn),Ga)break}ut.vertical&&(rm+=Xf(Be,Ye,ut.vertical,Bi,Gt,Oi,Qt,mr,Ws,M.az.vertical,["vertical"],hs,zd,Mi,hn));const ty=Ua?Ua.boxStartIndex:Be.collisionBoxArray.length,iy=Ua?Ua.boxEndIndex:Be.collisionBoxArray.length,ry=Qo?Qo.boxStartIndex:Be.collisionBoxArray.length,ny=Qo?Qo.boxEndIndex:Be.collisionBoxArray.length,sy=Jo?Jo.boxStartIndex:Be.collisionBoxArray.length,ay=Jo?Jo.boxEndIndex:Be.collisionBoxArray.length,oy=el?el.boxStartIndex:Be.collisionBoxArray.length,ly=el?el.boxEndIndex:Be.collisionBoxArray.length;let dn=-1;const Ju=(Xi,Vr)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,Vr):Vr;dn=Ju(Ua,dn),dn=Ju(Qo,dn),dn=Ju(Jo,dn),dn=Ju(el,dn);const am=dn>-1?1:0;am&&(dn*=vc/wi),Be.glyphOffsetArray.length>=qo.MAX_GLYPHS&&vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Qt.sortKey!==void 0&&Be.addToSortKeyRanges(Be.symbolInstances.length,Qt.sortKey);const cy=Hf(Gt,Qt,hn),[uy,hy]=(function(Xi,Vr){const Ga=Xi.length,pn=Vr?.values;if(pn?.length>0)for(let $a=0;$a<pn.length;$a+=2){const Ln=pn[$a+1];Xi.emplaceBack(M.aP[pn[$a]],Ln[0],Ln[1])}return[Ga,Xi.length]})(Be.textAnchorOffsets,cy);Be.symbolInstances.emplaceBack(Ye.x,Ye.y,hs.right>=0?hs.right:-1,hs.center>=0?hs.center:-1,hs.left>=0?hs.left:-1,hs.vertical||-1,Ad,zd,nm,ty,iy,ry,ny,sy,ay,oy,ly,xt,im,rm,em,tm,am,0,Rt,dn,uy,hy)})(r,$e,Ve,i,s,o,Te,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,N,[J,J,J,J],Se,g,U,te,we,z,e,u,y,x,h)};if(Me==="line")for(const Ve of Bf(e.geometry,0,0,ht,ht)){const $e=Oa(Ve,ve),Be=H_($e,$,he,i.vertical||k,s,24,X,r.overscaling,ht);for(const Ye of Be)k&&Q_(r,k.text,Le,Ye)||Ue($e,Ye)}else if(Me==="line-center"){for(const Ve of e.geometry)if(Ve.length>1){const $e=Oa(Ve,ve),Be=W_($e,he,i.vertical||k,s,24,X);Be&&Ue($e,Be)}}else if(e.type==="Polygon")for(const Ve of no(e.geometry,0)){const $e=Y_(Ve,16);Ue(Oa(Ve[0],ve,!0),new Zs($e.x,$e.y,0))}else if(e.type==="LineString")for(const Ve of e.geometry){const $e=Oa(Ve,ve);Ue($e,new Zs($e[0].x,$e[0].y,0))}else if(e.type==="Point")for(const Ve of e.geometry)for(const $e of Ve)Ue([$e],new Zs($e.x,$e.y,0))}function Xf(r,e,i,s,o,u,h,f,g,y,x,w,P,E,z){const k=(function(X,U,$,J,te,he,Se,we){const Me=J.layout.get("text-rotate").evaluate(he,{})*Math.PI/180,Le=[];for(const Ee of U.positionedLines)for(const Te of Ee.positionedGlyphs){if(!Te.rect)continue;const ve=Te.rect||{};let Ue=4,Ve=!0,$e=1,Be=0;const Ye=(te||we)&&Te.vertical,mt=Te.metrics.advance*Te.scale/2;if(we&&U.verticalizable&&(Be=Ee.lineOffset/2-(Te.imageName?-(wi-Te.metrics.width*Te.scale)/2:(Te.scale-1)*wi)),Te.imageName){const Pi=Se[Te.imageName];Ve=Pi.sdf,$e=Pi.pixelRatio,Ue=1/$e}const ut=te?[Te.x+mt,Te.y]:[0,0];let Ut=te?[0,0]:[Te.x+mt+$[0],Te.y+$[1]-Be],Bi=[0,0];Ye&&(Bi=Ut,Ut=[0,0]);const di=Te.metrics.isDoubleResolution?2:1,Gt=(Te.metrics.left-Ue)*Te.scale-mt+Ut[0],Bt=(-Te.metrics.top-Ue)*Te.scale+Ut[1],xt=Gt+ve.w/di*Te.scale/$e,Jt=Bt+ve.h/di*Te.scale/$e,ai=new _e(Gt,Bt),Rt=new _e(xt,Bt),fr=new _e(Gt,Jt),Oi=new _e(xt,Jt);if(Ye){const Pi=new _e(-mt,mt- -17),Zt=-Math.PI/2,pi=12-mt,Qt=new _e(22-pi,-(Te.imageName?pi:0)),Mi=new _e(...Bi);ai._rotateAround(Zt,Pi)._add(Qt)._add(Mi),Rt._rotateAround(Zt,Pi)._add(Qt)._add(Mi),fr._rotateAround(Zt,Pi)._add(Qt)._add(Mi),Oi._rotateAround(Zt,Pi)._add(Qt)._add(Mi)}if(Me){const Pi=Math.sin(Me),Zt=Math.cos(Me),pi=[Zt,-Pi,Pi,Zt];ai._matMult(pi),Rt._matMult(pi),fr._matMult(pi),Oi._matMult(pi)}const mr=new _e(0,0),en=new _e(0,0);Le.push({tl:ai,tr:Rt,bl:fr,br:Oi,tex:ve,writingMode:U.writingMode,glyphOffset:ut,sectionIndex:Te.sectionIndex,isSDF:Ve,pixelOffsetTL:mr,pixelOffsetBR:en,minFontScaleX:0,minFontScaleY:0})}return Le})(0,i,f,o,u,h,s,r.allowVerticalPlacement),R=r.textSizeData;let N=null;R.kind==="source"?(N=[ls*o.layout.get("text-size").evaluate(h,{})],N[0]>Gs&&vi(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):R.kind==="composite"&&(N=[ls*E.compositeTextSizes[0].evaluate(h,{},z),ls*E.compositeTextSizes[1].evaluate(h,{},z)],(N[0]>Gs||N[1]>Gs)&&vi(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,k,N,f,u,h,y,e,g.lineStartIndex,g.lineLength,P,z);for(const X of x)w[X]=r.text.placedSymbolArray.length-1;return 4*k.length}function Yf(r){for(const e in r)return r[e];return null}function Q_(r,e,i,s){const o=r.compareText;if(e in o){const u=o[e];for(let h=u.length-1;h>=0;h--)if(s.dist(u[h])<i)return!0}else o[e]=[];return o[e].push(s),!1}const Kf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Td{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=s>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=Kf[15&s];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Td(f,h,u,e)}constructor(e,i=64,s=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Kf.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Sd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,g=[0,u.length-1,0],y=[];for(;g.length;){const x=g.pop()||0,w=g.pop()||0,P=g.pop()||0;if(w-P<=f){for(let R=P;R<=w;R++){const N=h[2*R],X=h[2*R+1];N>=e&&N<=s&&X>=i&&X<=o&&y.push(u[R])}continue}const E=P+w>>1,z=h[2*E],k=h[2*E+1];z>=e&&z<=s&&k>=i&&k<=o&&y.push(u[E]),(x===0?e<=z:i<=k)&&(g.push(P),g.push(E-1),g.push(1-x)),(x===0?s>=z:o>=k)&&(g.push(E+1),g.push(w),g.push(1-x))}return y}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:h}=this,f=[0,o.length-1,0],g=[],y=s*s;for(;f.length;){const x=f.pop()||0,w=f.pop()||0,P=f.pop()||0;if(w-P<=h){for(let R=P;R<=w;R++)Qf(u[2*R],u[2*R+1],e,i)<=y&&g.push(o[R]);continue}const E=P+w>>1,z=u[2*E],k=u[2*E+1];Qf(z,k,e,i)<=y&&g.push(o[E]),(x===0?e-s<=z:i-s<=k)&&(f.push(P),f.push(E-1),f.push(1-x)),(x===0?e+s>=z:i+s>=k)&&(f.push(E+1),f.push(w),f.push(1-x))}return g}}function Sd(r,e,i,s,o,u){if(o-s<=i)return;const h=s+o>>1;Jf(r,e,h,s,o,u),Sd(r,e,i,s,h-1,1-u),Sd(r,e,i,h+1,o,1-u)}function Jf(r,e,i,s,o,u){for(;o>s;){if(o-s>600){const y=o-s+1,x=i-s+1,w=Math.log(y),P=.5*Math.exp(2*w/3),E=.5*Math.sqrt(w*P*(y-P)/y)*(x-y/2<0?-1:1);Jf(r,e,i,Math.max(s,Math.floor(i-x*P/y+E)),Math.min(o,Math.floor(i+(y-x)*P/y+E)),u)}const h=e[2*i+u];let f=s,g=o;for(_c(r,e,s,i),e[2*o+u]>h&&_c(r,e,s,o);f<g;){for(_c(r,e,f,g),f++,g--;e[2*f+u]<h;)f++;for(;e[2*g+u]>h;)g--}e[2*s+u]===h?_c(r,e,s,g):(g++,_c(r,e,g,o)),g<=i&&(s=g+1),i<=g&&(o=g-1)}}function _c(r,e,i,s){Pd(r,i,s),Pd(e,2*i,2*s),Pd(e,2*i+1,2*s+1)}function Pd(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Qf(r,e,i,s){const o=r-i,u=e-s;return o*o+u*u}var Md;M.cH=void 0,(Md=M.cH||(M.cH={})).create="create",Md.load="load",Md.fullLoad="fullLoad";let Ku=null,yc=[];const Id=1e3/60,Ed="loadTime",Cd="fullLoadTime",ey={mark(r){performance.mark(r)},frame(r){const e=r;Ku!=null&&yc.push(e-Ku),Ku=e},clearMetrics(){Ku=null,yc=[],performance.clearMeasures(Ed),performance.clearMeasures(Cd);for(const r in M.cH)performance.clearMarks(M.cH[r])},getPerformanceMetrics(){performance.measure(Ed,M.cH.create,M.cH.load),performance.measure(Cd,M.cH.create,M.cH.fullLoad);const r=performance.getEntriesByName(Ed)[0].duration,e=performance.getEntriesByName(Cd)[0].duration,i=yc.length,s=1/(yc.reduce(((u,h)=>u+h),0)/i/1e3),o=yc.filter((u=>u>Id)).reduce(((u,h)=>u+(h-Id)/Id),0);return{loadTime:r,fullLoadTime:e,fps:s,percentDroppedFrames:o/(i+o)*100,totalFrames:i}}};M.$=de,M.A=Je,M.B=Bs,M.C=xi,M.D=He,M.E=gt,M.F=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},M.G=jt,M.H=Pt,M.I=Xh,M.J=mu,M.K=function(r){if(Wt==null){const e=r.navigator?r.navigator.userAgent:null;Wt=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Wt},M.L=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new m_((()=>this.process())),this.subscription=fs(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Xr(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,s)=>{const o=Math.round(1e18*Math.random()).toString(36).substring(0,10),u=e?fs(e.signal,"abort",(()=>{u?.unsubscribe(),delete this.resolveRejects[o];const g={id:o,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),g_):null;this.resolveRejects[o]={resolve:g=>{u?.unsubscribe(),i(g)},reject:g=>{u?.unsubscribe(),s(g)}};const h=[],f=Object.assign(Object.assign({},r),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Sa(r.data,h)});this.target.postMessage(f,{transfer:h})}))}receive(r){const e=r.data,i=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const s=this.abortControllers[i];return delete this.abortControllers[i],void(s&&s.abort())}if(Xr(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return l(this,void 0,void 0,(function*(){if(e.type==="<response>"){const o=this.resolveRejects[r];return delete this.resolveRejects[r],o?void(e.error?o.reject(Pa(e.error)):o.resolve(Pa(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=Pa(e.data),s=new AbortController;this.abortControllers[r]=s;try{const o=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,o)}catch(o){this.completeTask(r,o)}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const o={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Sa(e):null,data:Sa(i,s)};this.target.postMessage(o,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},M.M=ce,M.N=function(){var r=new Je(16);return Je!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},M.O=function(r,e,i){var s,o,u,h,f,g,y,x,w,P,E,z,k=i[0],R=i[1],N=i[2];return e===r?(r[12]=e[0]*k+e[4]*R+e[8]*N+e[12],r[13]=e[1]*k+e[5]*R+e[9]*N+e[13],r[14]=e[2]*k+e[6]*R+e[10]*N+e[14],r[15]=e[3]*k+e[7]*R+e[11]*N+e[15]):(o=e[1],u=e[2],h=e[3],f=e[4],g=e[5],y=e[6],x=e[7],w=e[8],P=e[9],E=e[10],z=e[11],r[0]=s=e[0],r[1]=o,r[2]=u,r[3]=h,r[4]=f,r[5]=g,r[6]=y,r[7]=x,r[8]=w,r[9]=P,r[10]=E,r[11]=z,r[12]=s*k+f*R+w*N+e[12],r[13]=o*k+g*R+P*N+e[13],r[14]=u*k+y*R+E*N+e[14],r[15]=h*k+x*R+z*N+e[15]),r},M.P=_e,M.Q=function(r,e,i){var s=i[0],o=i[1],u=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},M.R=pr,M.S=function(r,e,i){var s=e[0],o=e[1],u=e[2],h=e[3],f=e[4],g=e[5],y=e[6],x=e[7],w=e[8],P=e[9],E=e[10],z=e[11],k=e[12],R=e[13],N=e[14],X=e[15],U=i[0],$=i[1],J=i[2],te=i[3];return r[0]=U*s+$*f+J*w+te*k,r[1]=U*o+$*g+J*P+te*R,r[2]=U*u+$*y+J*E+te*N,r[3]=U*h+$*x+J*z+te*X,r[4]=(U=i[4])*s+($=i[5])*f+(J=i[6])*w+(te=i[7])*k,r[5]=U*o+$*g+J*P+te*R,r[6]=U*u+$*y+J*E+te*N,r[7]=U*h+$*x+J*z+te*X,r[8]=(U=i[8])*s+($=i[9])*f+(J=i[10])*w+(te=i[11])*k,r[9]=U*o+$*g+J*P+te*R,r[10]=U*u+$*y+J*E+te*N,r[11]=U*h+$*x+J*z+te*X,r[12]=(U=i[12])*s+($=i[13])*f+(J=i[14])*w+(te=i[15])*k,r[13]=U*o+$*g+J*P+te*R,r[14]=U*u+$*y+J*E+te*N,r[15]=U*h+$*x+J*z+te*X,r},M.T=Vh,M.U=function(r,e){const i={};for(let s=0;s<e.length;s++){const o=e[s];o in r&&(i[o]=r[o])}return i},M.V=$s,M.W=lr,M.X=Xp,M.Y=Hp,M.Z=re,M._=l,M.a=G,M.a$=ar,M.a0=vt,M.a1=ps,M.a2=Or,M.a3=Kp,M.a4=ju,M.a5=ht,M.a6=function(r,e,i){if(!r)return e||{};if(!e)return r||{};const s=tf(r),o=tf(e);(function(h,f){f.removeAll&&(h.add.clear(),h.update.clear(),h.remove.clear(),f.remove.clear());for(const g of f.remove)h.add.delete(g),h.update.delete(g);for(const[g,y]of f.update){const x=h.update.get(g);x&&(f.update.set(g,__(x,y)),h.update.delete(g))}})(s,o);const u={};if((s.removeAll||o.removeAll)&&(u.removeAll=!0),u.remove=new Set([...s.remove,...o.remove]),u.add=new Map([...s.add,...o.add]),u.update=new Map([...s.update,...o.update]),u.remove.size&&u.add.size)for(const h of u.add.keys())u.remove.delete(h);return(function(h){const f={};return h.removeAll&&(f.removeAll=h.removeAll),h.remove&&(f.remove=Array.from(h.remove)),h.add&&(f.add=Array.from(h.add.values())),h.update&&(f.update=Array.from(h.update.values())),f})(u)},M.a7=function(r,e){const i=new Map;if(r==null||r.type==null)return i;if(r.type==="Feature"){const s=nd(r,e);return s==null?void 0:(i.set(s,r),i)}if(r.type==="FeatureCollection"){const s=new Set;for(const o of r.features){const u=nd(o,e);if(u==null||s.has(u))return;s.add(u),i.set(u,o)}return i}},M.a8=function(r,e,i){var s,o;const u=[];if(e.removeAll)r.clear();else if(e.remove)for(const h of e.remove){const f=r.get(h);f&&(u.push(f.geometry),r.delete(h))}if(e.add)for(const h of e.add){const f=nd(h,i);if(f==null)continue;const g=r.get(f);g&&u.push(g.geometry),u.push(h.geometry),r.set(f,h)}if(e.update)for(const h of e.update){const f=r.get(h.id);if(!f)continue;const g=!!h.newGeometry,y=h.removeAllProperties||((s=h.removeProperties)===null||s===void 0?void 0:s.length)>0||((o=h.addOrUpdateProperties)===null||o===void 0?void 0:o.length)>0;if(!g&&!y)continue;u.push(f.geometry);const x=Object.assign({},f);if(r.set(h.id,x),g&&(u.push(h.newGeometry),x.geometry=h.newGeometry),y){if(x.properties=h.removeAllProperties?{}:Object.assign({},x.properties||{}),h.removeProperties)for(const w of h.removeProperties)delete x.properties[w];if(h.addOrUpdateProperties)for(const{key:w,value:P}of h.addOrUpdateProperties)x.properties[w]=P}}return u},M.a9=pc,M.aA=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:o}){return r.kind==="source"?s/ls:r.kind==="composite"?jt.number(s/ls,o/ls,i):e},M.aB=function(r,e){var i=e[0],s=e[1],o=e[2],u=e[3],h=e[4],f=e[5],g=e[6],y=e[7],x=e[8],w=e[9],P=e[10],E=e[11],z=e[12],k=e[13],R=e[14],N=e[15],X=i*f-s*h,U=i*g-o*h,$=i*y-u*h,J=s*g-o*f,te=s*y-u*f,he=o*y-u*g,Se=x*k-w*z,we=x*R-P*z,Me=x*N-E*z,Le=w*R-P*k,Ee=w*N-E*k,Te=P*N-E*R,ve=X*Te-U*Ee+$*Le+J*Me-te*we+he*Se;return ve?(r[0]=(f*Te-g*Ee+y*Le)*(ve=1/ve),r[1]=(o*Ee-s*Te-u*Le)*ve,r[2]=(k*he-R*te+N*J)*ve,r[3]=(P*te-w*he-E*J)*ve,r[4]=(g*Me-h*Te-y*we)*ve,r[5]=(i*Te-o*Me+u*we)*ve,r[6]=(R*$-z*he-N*U)*ve,r[7]=(x*he-P*$+E*U)*ve,r[8]=(h*Ee-f*Me+y*Se)*ve,r[9]=(s*Me-i*Ee-u*Se)*ve,r[10]=(z*te-k*$+N*X)*ve,r[11]=(w*$-x*te-E*X)*ve,r[12]=(f*we-h*Le-g*Se)*ve,r[13]=(i*Le-s*we+o*Se)*ve,r[14]=(k*U-z*J-R*X)*ve,r[15]=(x*J-w*U+P*X)*ve,r):null},M.aC=_i,M.aD=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},M.aE=function(r){return r[0]=0,r[1]=0,r},M.aF=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},M.aG=Jh,M.aH=Vn,M.aI=function(r,e,i,s){const o=e.y-r.y,u=e.x-r.x,h=s.y-i.y,f=s.x-i.x,g=h*u-f*o;if(g===0)return null;const y=(f*(r.y-i.y)-h*(r.x-i.x))/g;return new _e(r.x+y*u,r.y+y*o)},M.aJ=Bf,M.aK=Bo,M.aL=function(r){let e=1/0,i=1/0,s=-1/0,o=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y);return[e,i,s,o]},M.aM=wi,M.aN=_n,M.aO=function(r,e,i,s,o=!1){if(!i[0]&&!i[1])return[0,0];const u=o?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(u){const h=Math.sin(u),f=Math.cos(u);i=[i[0]*f-i[1]*h,i[0]*h+i[1]*f]}return[o?i[0]:_n(e,i[0],r.zoom),o?i[1]:_n(e,i[1],r.zoom)]},M.aQ=Kh,M.aR=wd,M.aS=Yh,M.aT=Td,M.aU=ni,M.aV=Du,M.aW=q,M.aX=Fe,M.aY=ye,M.aZ=Qi,M.a_=Jp,M.aa=ja,M.ab=25,M.ac=rd,M.ad=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const o=window.document.createElement("source");Pe(s)||(e.crossOrigin="Anonymous"),o.src=s,e.appendChild(o)}}))},M.ae=Ae,M.af=function(){return Hr++},M.ag=c,M.ah=qo,M.ai=gc,M.aj=ma,M.ak=Rn,M.al=nf,M.am=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,o,u)=>{const h=o||u;return e[s]=!h||h.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},M.an=Ni,M.ao=85.051129,M.ap=ms,M.aq=function(r){return Math.pow(2,r)},M.ar=Di,M.as=Yp,M.at=function(r){return Math.log(r)/Math.LN2},M.au=function(r){var e=r[0],i=r[1];return e*e+i*i},M.av=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,s=-1/0,o=1/0,u=-1/0;const h=[];for(const g of r){const{x:y,y:x,z:w}=g.canonical,P=Math.pow(2,e-w),E=y*P,z=x*P;h.push({id:g,x:E,y:z}),E<i&&(i=E),E>s&&(s=E),z<o&&(o=z),z>u&&(u=z)}const f=new Set;for(const g of h)g.x!==i&&g.x!==s&&g.y!==o&&g.y!==u||f.add(g.id);return f},M.aw=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},M.ax=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const o={value:e,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout((()=>{this.remove(r,o)}),i)),this.data[s].push(o),this.order.push(s),this.order.length>this.max){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,s=e===void 0?0:this.data[i].indexOf(e),o=this.data[i][s];return this.data[i].splice(s,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||e.push(s);for(const i of e)this.remove(i.value.tileID,i)}},M.ay=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:o,minZoom:u,maxZoom:h}=r,f=o?Ni(Wi.interpolationFactor(o,e,u,h),0,1):0;r.kind==="camera"?s=jt.number(r.minSize,r.maxSize,f):i=f}return{uSizeT:i,uSize:s}},M.b=xn,M.b$=as,M.b0=Ki,M.b1=function(r){var e=new Je(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},M.b2=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},M.b3=function(r,e){var i=e[0],s=e[1],o=e[2],u=i*i+s*s+o*o;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r},M.b4=ci,M.b5=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},M.b6=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},M.b7=Ii,M.b8=function(r,e,i){const s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},M.b9=gr,M.bA=function(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r},M.bB=Ir,M.bC=function(r,e,i){var s=i[0],o=i[1],u=i[2],h=i[3],f=e[0],g=e[1],y=e[2],x=o*y-u*g,w=u*f-s*y,P=s*g-o*f;return r[0]=f+h*(x+=x)+o*(P+=P)-u*(w+=w),r[1]=g+h*w+u*x-s*P,r[2]=y+h*P+s*w-o*x,r},M.bD=function(r,e,i){const s=(function(g){var y=g[3],x=g[4],w=g[5],P=g[6],E=g[7],z=g[8];return g[0]*(z*x-w*E)+g[1]*(-z*y+w*P)+g[2]*(E*y-x*P)})([r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]]);if(s===0)return null;const o=ci([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),u=ci([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),h=ci([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),f=ar([],o,-r[3]);return Ki(f,f,ar([],u,-e[3])),Ki(f,f,ar([],h,-i[3])),ar(f,f,1/s),f},M.bE=id,M.bF=function(){return new Float64Array(4)},M.bG=function(r,e,i,s){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[0]*Math.cos(s)-o[1]*Math.sin(s),u[1]=o[0]*Math.sin(s)+o[1]*Math.cos(s),u[2]=o[2],r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},M.bH=function(r,e,i,s){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[0],u[1]=o[1]*Math.cos(s)-o[2]*Math.sin(s),u[2]=o[1]*Math.sin(s)+o[2]*Math.cos(s),r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},M.bI=function(r,e,i,s){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[2]*Math.sin(s)+o[0]*Math.cos(s),u[1]=o[1],u[2]=o[2]*Math.cos(s)-o[0]*Math.sin(s),r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},M.bJ=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),u=e[0],h=e[1],f=e[2],g=e[3],y=e[8],x=e[9],w=e[10],P=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*o-y*s,r[1]=h*o-x*s,r[2]=f*o-w*s,r[3]=g*o-P*s,r[8]=u*s+y*o,r[9]=h*s+x*o,r[10]=f*s+w*o,r[11]=g*s+P*o,r},M.bK=function(r,e){const i=Er(r,360),s=Er(e,360),o=s-i,u=s>i?o-360:o+360;return Math.abs(o)<Math.abs(u)?o:u},M.bL=function(r){return r[0]=0,r[1]=0,r[2]=0,r},M.bM=function(r,e,i,s){const o=Math.sqrt(r*r+e*e),u=Math.sqrt(i*i+s*s);r/=o,e/=o,i/=u,s/=u;const h=Math.acos(r*i+e*s);return-e*i+r*s>0?h:-h},M.bN=function(r,e){const i=Er(r,2*Math.PI),s=Er(e,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},M.bO=function(){const r={},e=me.$version;for(const i in me.$root){const s=me.$root[i];if(s.required){let o=null;o=i==="version"?e:s.type==="array"?[]:{},o!=null&&(r[i]=o)}}return r},M.bP=xe,M.bQ=Vl,M.bR=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],i[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const s in e)if(!r(e[s],i[s]))return!1;return!0}return e===i},M.bS=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=Ei(r[i],e[r[i].ref]));return r},M.bT=function(r,e){if(r.type==="custom")return new f_(r,e);switch(r.type){case"background":return new p_(r,e);case"circle":return new Km(r,e);case"color-relief":return new rg(r,e);case"fill":return new yg(r,e);case"fill-extrusion":return new Ag(r,e);case"heatmap":return new Qm(r,e);case"hillshade":return new tg(r,e);case"line":return new Bg(r,e);case"raster":return new zh(r,e);case"symbol":return new Ou(r,e)}},M.bU=r=>r.type==="raster",M.bV=Ji,M.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!tt(r.version,e.version))return[{command:"setStyle",args:[e]}];tt(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),tt(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),tt(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),tt(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),tt(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),tt(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),tt(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),tt(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),tt(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),tt(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),tt(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),tt(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),tt(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),tt(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},o=[];(function(h,f,g,y){let x;for(x in f=f||{},h=h||{})Object.prototype.hasOwnProperty.call(h,x)&&(Object.prototype.hasOwnProperty.call(f,x)||Lt(x,g,y));for(x in f)Object.prototype.hasOwnProperty.call(f,x)&&(Object.prototype.hasOwnProperty.call(h,x)?tt(h[x],f[x])||(h[x].type==="geojson"&&f[x].type==="geojson"&&It(h,f,x)?wt(g,{command:"setGeoJSONSourceData",args:[x,f[x].data]}):Ht(x,f,g,y)):Ci(x,f,g))})(r.sources,e.sources,o,s);const u=[];r.layers&&r.layers.forEach((h=>{"source"in h&&s[h.source]?i.push({command:"removeLayer",args:[h.id]}):u.push(h)})),i=i.concat(o),(function(h,f,g){f=f||[];const y=(h=h||[]).map(Xs),x=f.map(Xs),w=h.reduce(Ys,{}),P=f.reduce(Ys,{}),E=y.slice(),z=Object.create(null);let k,R,N,X,U;for(let $=0,J=0;$<y.length;$++)k=y[$],Object.prototype.hasOwnProperty.call(P,k)?J++:(wt(g,{command:"removeLayer",args:[k]}),E.splice(E.indexOf(k,J),1));for(let $=0,J=0;$<x.length;$++)k=x[x.length-1-$],E[E.length-1-$]!==k&&(Object.prototype.hasOwnProperty.call(w,k)?(wt(g,{command:"removeLayer",args:[k]}),E.splice(E.lastIndexOf(k,E.length-J),1)):J++,X=E[E.length-$],wt(g,{command:"addLayer",args:[P[k],X]}),E.splice(E.length-$,0,k),z[k]=!0);for(let $=0;$<x.length;$++)if(k=x[$],R=w[k],N=P[k],!z[k]&&!tt(R,N))if(tt(R.source,N.source)&&tt(R["source-layer"],N["source-layer"])&&tt(R.type,N.type)){for(U in ui(R.layout,N.layout,g,k,null,"setLayoutProperty"),ui(R.paint,N.paint,g,k,null,"setPaintProperty"),tt(R.filter,N.filter)||wt(g,{command:"setFilter",args:[k,N.filter]}),tt(R.minzoom,N.minzoom)&&tt(R.maxzoom,N.maxzoom)||wt(g,{command:"setLayerZoomRange",args:[k,N.minzoom,N.maxzoom]}),R)Object.prototype.hasOwnProperty.call(R,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?ui(R[U],N[U],g,k,U.slice(6),"setPaintProperty"):tt(R[U],N[U])||wt(g,{command:"setLayerProperty",args:[k,U,N[U]]}));for(U in N)Object.prototype.hasOwnProperty.call(N,U)&&!Object.prototype.hasOwnProperty.call(R,U)&&U!=="layout"&&U!=="paint"&&U!=="filter"&&U!=="metadata"&&U!=="minzoom"&&U!=="maxzoom"&&(U.indexOf("paint.")===0?ui(R[U],N[U],g,k,U.slice(6),"setPaintProperty"):tt(R[U],N[U])||wt(g,{command:"setLayerProperty",args:[k,U,N[U]]}))}else wt(g,{command:"removeLayer",args:[k]}),X=E[E.lastIndexOf(k)+1],wt(g,{command:"addLayer",args:[N,X]})})(u,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},M.bX=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},M.bY=cr,M.bZ=yn,M.b_=class extends ir{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},M.ba=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},M.bb=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},M.bc=ef,M.bd=Zo,M.be=function(r,e,i,s,o){var u=1/Math.tan(e/2);if(r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,o!=null&&o!==1/0){var h=1/(s-o);r[10]=(o+s)*h,r[14]=2*o*s*h}else r[10]=-1,r[14]=-2*s;return r},M.bf=function(r){var e=new Je(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},M.bg=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),u=e[0],h=e[1],f=e[2],g=e[3],y=e[4],x=e[5],w=e[6],P=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*o+y*s,r[1]=h*o+x*s,r[2]=f*o+w*s,r[3]=g*o+P*s,r[4]=y*o-u*s,r[5]=x*o-h*s,r[6]=w*o-f*s,r[7]=P*o-g*s,r},M.bh=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),u=e[4],h=e[5],f=e[6],g=e[7],y=e[8],x=e[9],w=e[10],P=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*o+y*s,r[5]=h*o+x*s,r[6]=f*o+w*s,r[7]=g*o+P*s,r[8]=y*o-u*s,r[9]=x*o-h*s,r[10]=w*o-f*s,r[11]=P*o-g*s,r},M.bi=function(){const r=new Float32Array(16);return Di(r),r},M.bj=function(){const r=new Float64Array(16);return Di(r),r},M.bk=function(){return new Float64Array(16)},M.bl=function(r,e,i){const s=new Float64Array(4);return Ir(s,r,e-90,i),s},M.bm=function(r,e,i,s){var o,u,h,f,g,y=e[0],x=e[1],w=e[2],P=e[3],E=i[0],z=i[1],k=i[2],R=i[3];return(u=y*E+x*z+w*k+P*R)<0&&(u=-u,E=-E,z=-z,k=-k,R=-R),1-u>rt?(o=Math.acos(u),h=Math.sin(o),f=Math.sin((1-s)*o)/h,g=Math.sin(s*o)/h):(f=1-s,g=s),r[0]=f*y+g*E,r[1]=f*x+g*z,r[2]=f*w+g*k,r[3]=f*P+g*R,r},M.bn=function(r){const e=new Float64Array(9);(function(u,h){var f=h[0],g=h[1],y=h[2],x=h[3],w=f+f,P=g+g,E=y+y,z=f*w,k=g*w,R=g*P,N=y*w,X=y*P,U=y*E,$=x*w,J=x*P,te=x*E;u[0]=1-R-U,u[3]=k-te,u[6]=N+J,u[1]=k+te,u[4]=1-z-U,u[7]=X-$,u[2]=N-J,u[5]=X+$,u[8]=1-z-R})(e,r);const i=Qi(-Math.asin(Ni(e[2],-1,1)));let s,o;return Math.hypot(e[5],e[8])<.001?(s=0,o=-Qi(Math.atan2(e[3],e[4]))):(s=Qi(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),o=Qi(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:s,pitch:i+90,bearing:o}},M.bo=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},M.bp=lt,M.bq=ss,M.br=Uo,M.bs=oc,M.bt=No,M.bu=Zr,M.bv=_r,M.bw=Zi,M.bx=function(r,e,i,s,o){return Zr(s,o,Ni((r-e)/(i-e),0,1))},M.by=Er,M.bz=function(){return new Float64Array(3)},M.c=se,M.c$=function(r,e,i,s,o){return l(this,void 0,void 0,(function*(){if(vt())try{return yield ps(r,e,i,s,o)}catch{}return(function(u,h,f,g,y){const x=u.width,w=u.height;bn&&Cr||(bn=new OffscreenCanvas(x,w),Cr=bn.getContext("2d",{willReadFrequently:!0})),bn.width=x,bn.height=w,Cr.drawImage(u,0,0,x,w);const P=Cr.getImageData(h,f,g,y);return Cr.clearRect(0,0,x,w),P.data})(r,e,i,s,o)}))},M.c0=class extends ir{constructor(r,e){super(r,e),this.current=Sr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},M.c1=Fa,M.c2=class extends ir{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},M.c3=class extends ir{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},M.c4=ki,M.c5=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},M.c6=function(r,e,i){var s=e[0],o=e[1],u=e[2];return r[0]=s*i[0]+o*i[3]+u*i[6],r[1]=s*i[1]+o*i[4]+u*i[7],r[2]=s*i[2]+o*i[5]+u*i[8],r},M.c7=function(r,e,i,s,o,u,h){var f=1/(e-i),g=1/(s-o),y=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*y,r[11]=0,r[12]=(e+i)*f,r[13]=(o+s)*g,r[14]=(h+u)*y,r[15]=1,r},M.c8=class extends ir{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},M.c9=class extends ir{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},M.cA=function(r,e){return ue[e]&&"touches"in r},M.cB=function(r){return ue[r]||j[r]},M.cC=function(r,e,i){var s=e[0],o=e[1];return r[0]=i[0]*s+i[4]*o+i[12],r[1]=i[1]*s+i[5]*o+i[13],r},M.cD=function(r,e){const{x:i,y:s}=pc.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},M.cE=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},M.cF=class extends Ao{},M.cG=ey,M.cI=ae,M.cJ=function(r,e){se.REGISTERED_PROTOCOLS[r]=e},M.cK=function(r){delete se.REGISTERED_PROTOCOLS[r]},M.cL=function(r,e){const i={};for(let o=0;o<r.length;o++){const u=e&&e[r[o].id]||nu(r[o]);e&&(e[r[o].id]=u);let h=i[u];h||(h=i[u]=[]),h.push(r[o])}const s=[];for(const o in i)s.push(i[o]);return s},M.cM=Ge,M.cN=rf,M.cO=Lf,M.cP=Bp,M.cQ=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=ht/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const e=r.bucket.layers[0],i=e.layout,s=e._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new Pt(r.bucket.zoom+1),r.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Pt(r.bucket.zoom+1),r.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Pt(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:y,maxZoom:x}=r.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Pt(y),r.canonical),s["text-size"].possiblyEvaluate(new Pt(x),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:y,maxZoom:x}=r.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Pt(y),r.canonical),s["icon-size"].possiblyEvaluate(new Pt(x),r.canonical)]}const u=i.get("text-line-height")*wi,h=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",f=i.get("text-keep-upright"),g=i.get("text-size");for(const y of r.bucket.features){const x=i.get("text-font").evaluate(y,{},r.canonical).join(","),w=g.evaluate(y,{},r.canonical),P=o.layoutTextSize.evaluate(y,{},r.canonical),E=o.layoutIconSize.evaluate(y,{},r.canonical),z={horizontal:{},vertical:void 0},k=y.text;let R,N=[0,0];if(k){const $=k.toString(),J=i.get("text-letter-spacing").evaluate(y,{},r.canonical)*wi,te=Ch($)?J:0,he=i.get("text-anchor").evaluate(y,{},r.canonical),Se=Hf(e,y,r.canonical);if(!Se){const Ee=i.get("text-radial-offset").evaluate(y,{},r.canonical);N=Ee?Wf(he,[Ee*wi,bd]):i.get("text-offset").evaluate(y,{},r.canonical).map((Te=>Te*wi))}let we=h?"center":i.get("text-justify").evaluate(y,{},r.canonical);const Me=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(y,{},r.canonical)*wi:1/0,Le=()=>{r.bucket.allowVerticalPlacement&&Vs($)&&(z.vertical=Fu(k,r.glyphMap,r.glyphPositions,r.imagePositions,x,Me,u,he,"left",te,N,M.az.vertical,!0,P,w))};if(!h&&Se){const Ee=new Set;if(we==="auto")for(let ve=0;ve<Se.values.length;ve+=2)Ee.add(wd(Se.values[ve]));else Ee.add(we);let Te=!1;for(const ve of Ee)if(!z.horizontal[ve])if(Te)z.horizontal[ve]=z.horizontal[0];else{const Ue=Fu(k,r.glyphMap,r.glyphPositions,r.imagePositions,x,Me,u,"center",ve,te,N,M.az.horizontal,!1,P,w);Ue&&(z.horizontal[ve]=Ue,Te=Ue.positionedLines.length===1)}Le()}else{we==="auto"&&(we=wd(he));const Ee=Fu(k,r.glyphMap,r.glyphPositions,r.imagePositions,x,Me,u,he,we,te,N,M.az.horizontal,!1,P,w);Ee&&(z.horizontal[we]=Ee),Le(),Vs($)&&h&&f&&(z.vertical=Fu(k,r.glyphMap,r.glyphPositions,r.imagePositions,x,Me,u,he,we,te,N,M.az.vertical,!1,P,w))}}let X=!1;if(y.icon&&y.icon.name){const $=r.imageMap[y.icon.name];$&&(R=c_(r.imagePositions[y.icon.name],i.get("icon-offset").evaluate(y,{},r.canonical),i.get("icon-anchor").evaluate(y,{},r.canonical)),X=!!$.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=X:r.bucket.sdfIcons!==X&&vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),($.pixelRatio!==r.bucket.pixelRatio||i.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const U=Yf(z.horizontal)||z.vertical;r.bucket.iconsInText=!!U&&U.iconsInText,(U||R)&&J_(r.bucket,y,z,R,r.imageMap,o,P,E,N,X,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},M.cR=$h,M.cS=Zh,M.cT=Wh,M.cU=function(r){const e=new Lu;return(function(i,s){for(const o in i.layers)s.writeMessage(3,O_,i.layers[o])})(r,e),e.finish()},M.cV=function(r,e,i,s,o,u){let h=Of(r,e,i,o,0);return h=Of(h,e,s,u,1),h},M.cW=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},M.cX=vp,M.cY=Lu,M.cZ=Df,M.c_=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},M.ca=class extends rs{},M.cb=Ng,M.cc=class extends La{},M.cd=jh,M.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},M.cf=np,M.cg=function(r,e,i){var s=e[0],o=e[1],u=e[2],h=i[3]*s+i[7]*o+i[11]*u+i[15];return r[0]=(i[0]*s+i[4]*o+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*o+i[9]*u+i[13])/h,r[2]=(i[2]*s+i[6]*o+i[10]*u+i[14])/h,r},M.ch=class extends Wl{},M.ci=class extends t{},M.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},M.ck=function(r,e){var i=r[0],s=r[1],o=r[2],u=r[3],h=r[4],f=r[5],g=r[6],y=r[7],x=r[8],w=r[9],P=r[10],E=r[11],z=r[12],k=r[13],R=r[14],N=r[15],X=e[0],U=e[1],$=e[2],J=e[3],te=e[4],he=e[5],Se=e[6],we=e[7],Me=e[8],Le=e[9],Ee=e[10],Te=e[11],ve=e[12],Ue=e[13],Ve=e[14],$e=e[15];return Math.abs(i-X)<=rt*Math.max(1,Math.abs(i),Math.abs(X))&&Math.abs(s-U)<=rt*Math.max(1,Math.abs(s),Math.abs(U))&&Math.abs(o-$)<=rt*Math.max(1,Math.abs(o),Math.abs($))&&Math.abs(u-J)<=rt*Math.max(1,Math.abs(u),Math.abs(J))&&Math.abs(h-te)<=rt*Math.max(1,Math.abs(h),Math.abs(te))&&Math.abs(f-he)<=rt*Math.max(1,Math.abs(f),Math.abs(he))&&Math.abs(g-Se)<=rt*Math.max(1,Math.abs(g),Math.abs(Se))&&Math.abs(y-we)<=rt*Math.max(1,Math.abs(y),Math.abs(we))&&Math.abs(x-Me)<=rt*Math.max(1,Math.abs(x),Math.abs(Me))&&Math.abs(w-Le)<=rt*Math.max(1,Math.abs(w),Math.abs(Le))&&Math.abs(P-Ee)<=rt*Math.max(1,Math.abs(P),Math.abs(Ee))&&Math.abs(E-Te)<=rt*Math.max(1,Math.abs(E),Math.abs(Te))&&Math.abs(z-ve)<=rt*Math.max(1,Math.abs(z),Math.abs(ve))&&Math.abs(k-Ue)<=rt*Math.max(1,Math.abs(k),Math.abs(Ue))&&Math.abs(R-Ve)<=rt*Math.max(1,Math.abs(R),Math.abs(Ve))&&Math.abs(N-$e)<=rt*Math.max(1,Math.abs(N),Math.abs($e))},M.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},M.cm=r=>r.type==="symbol",M.cn=r=>r.type==="circle",M.co=r=>r.type==="heatmap",M.cp=r=>r.type==="line",M.cq=r=>r.type==="fill",M.cr=r=>r.type==="fill-extrusion",M.cs=r=>r.type==="hillshade",M.ct=r=>r.type==="color-relief",M.cu=r=>r.type==="background",M.cv=r=>r.type==="custom",M.cw=Wr,M.cx=function(r,e,i){const s=qr(e.x-i.x,e.y-i.y),o=qr(r.x-i.x,r.y-i.y),u=Math.atan2(s[0]*o[1]-s[1]*o[0],(function(h,f){return h[0]*f[0]+h[1]*f[1]})(s,o));return Qi(u)},M.cy=ti,M.cz=function(r,e){return j[e]&&(r instanceof MouseEvent||r instanceof WheelEvent)},M.d=Pe,M.d0=op,M.d1=Oe,M.d2=class{constructor(r,e){this.layers={[gc]:this},this.name=gc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new B_(this.features[r],this.extent)}},M.d3=fa,M.d4=An,M.e=yi,M.f=r=>l(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),M.g=pe,M.h=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=Nn}))},s.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const o=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(o):Nn})),M.i=Xr,M.j=(r,e)=>Ce(yi(r,{type:"json"}),e),M.k=St,M.l=et,M.m=Ce,M.n=(r,e)=>Ce(yi(r,{type:"arrayBuffer"}),e),M.o=function(r){return new Lu(r).readFields(t_,[])},M.p=Fp,M.q=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},M.r=ic,M.s=fs,M.t=Hi,M.u=me,M.v=wa,M.w=vi,M.x=ql,M.y=Ta,M.z=Ia})),Y("worker",["./shared"],(function(M){class l{constructor(j,O){this.keyCache={},j&&this.replace(j,O)}replace(j,O){this._layerConfigs={},this._layers={},this.update(j,[],O)}update(j,O,G){for(const se of j){this._layerConfigs[se.id]=se;const pe=this._layers[se.id]=M.bT(se,G);pe._featureFilter=M.aj(pe.filter,G),this.keyCache[se.id]&&delete this.keyCache[se.id]}for(const se of O)delete this.keyCache[se],delete this._layerConfigs[se],delete this._layers[se];this.familiesBySource={};const re=M.cL(Object.values(this._layerConfigs),this.keyCache);for(const se of re){const pe=se.map((Ne=>this._layers[Ne.id])),ce=pe[0];if(ce.isHidden())continue;const ae=ce.source||"";let xe=this.familiesBySource[ae];xe||(xe=this.familiesBySource[ae]={});const Ce=ce.sourceLayer||M.ai;let Pe=xe[Ce];Pe||(Pe=xe[Ce]=[]),Pe.push(pe)}}}class _e{constructor(j){const O={},G=[];for(const ce in j){const ae=j[ce],xe=O[ce]={};for(const Ce in ae){const Pe=ae[+Ce];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const Ne={x:0,y:0,w:Pe.bitmap.width+2,h:Pe.bitmap.height+2};G.push(Ne),xe[Ce]={rect:Ne,metrics:Pe.metrics}}}const{w:re,h:se}=M.p(G),pe=new M.r({width:re||1,height:se||1});for(const ce in j){const ae=j[ce];for(const xe in ae){const Ce=ae[+xe];if(!Ce||Ce.bitmap.width===0||Ce.bitmap.height===0)continue;const Pe=O[ce][xe].rect;M.r.copy(Ce.bitmap,pe,{x:0,y:0},{x:Pe.x+1,y:Pe.y+1},Ce.bitmap)}}this.image=pe,this.positions=O}}M.cM("GlyphAtlas",_e);class Oe{constructor(j){this.tileID=new M.a2(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.uid=j.uid,this.zoom=j.zoom,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.collectResourceTiming,this.returnDependencies=!!j.returnDependencies,this.promoteId=j.promoteId,this.inFlightDependencies=[]}parse(j,O,G,re,se){return M._(this,void 0,void 0,(function*(){this.status="parsing",this.data=j,this.collisionBoxArray=new M.ag;const pe=new M.cN(Object.keys(j.layers).sort()),ce=new M.cO(this.tileID,this.promoteId);ce.bucketLayerIDs=[];const ae={},xe={featureIndex:ce,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:G,subdivisionGranularity:se},Ce=O.familiesBySource[this.source];for(const It in Ce){const ui=j.layers[It];if(!ui)continue;ui.version===1&&M.w(`Vector tile source "${this.source}" layer "${It}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Xs=pe.encode(It),Ys=[];for(let Ae=0;Ae<ui.length;Ae++){const Ui=ui.feature(Ae),Gi=ce.getId(Ui,It);Ys.push({feature:Ui,id:Gi,index:Ae,sourceLayerIndex:Xs})}for(const Ae of Ce[It]){const Ui=Ae[0];Ui.source!==this.source&&M.w(`layer.source = ${Ui.source} does not equal this.source = ${this.source}`),Ui.isHidden(this.zoom,!0)||(qe(Ae,this.zoom,G),(ae[Ui.id]=Ui.createBucket({index:ce.bucketLayerIDs.length,layers:Ae,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Xs,sourceID:this.source})).populate(Ys,xe,this.tileID.canonical),ce.bucketLayerIDs.push(Ae.map((Gi=>Gi.id))))}}const Pe=M.bY(xe.glyphDependencies,(It=>Object.keys(It).map(Number)));this.inFlightDependencies.forEach((It=>It?.abort())),this.inFlightDependencies=[];let Ne=Promise.resolve({});if(Object.keys(Pe).length){const It=new AbortController;this.inFlightDependencies.push(It),Ne=re.sendAsync({type:"GG",data:{stacks:Pe,source:this.source,tileID:this.tileID,type:"glyphs"}},It)}const We=Object.keys(xe.iconDependencies);let et=Promise.resolve({});if(We.length){const It=new AbortController;this.inFlightDependencies.push(It),et=re.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},It)}const St=Object.keys(xe.patternDependencies);let gt=Promise.resolve({});if(St.length){const It=new AbortController;this.inFlightDependencies.push(It),gt=re.sendAsync({type:"GI",data:{icons:St,source:this.source,tileID:this.tileID,type:"patterns"}},It)}const me=xe.dashDependencies;let Mt=Promise.resolve({});if(Object.keys(me).length){const It=new AbortController;this.inFlightDependencies.push(It),Mt=re.sendAsync({type:"GDA",data:{dashes:me}},It)}const[Ei,tt,wt,Ci]=yield Promise.all([Ne,et,gt,Mt]),Lt=new _e(Ei),Ht=new M.cP(tt,wt);for(const It in ae){const ui=ae[It];ui instanceof M.ah?(qe(ui.layers,this.zoom,G),M.cQ({bucket:ui,glyphMap:Ei,glyphPositions:Lt.positions,imageMap:tt,imagePositions:Ht.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:xe.subdivisionGranularity})):ui.hasDependencies&&(ui instanceof M.cR||ui instanceof M.cS||ui instanceof M.cT)&&(qe(ui.layers,this.zoom,G),ui.addFeatures(xe,this.tileID.canonical,Ht.patternPositions,Ci))}return this.status="done",{buckets:Object.values(ae).filter((It=>!It.isEmpty())),featureIndex:ce,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Lt.image,imageAtlas:Ht,dashPositions:Ci,glyphMap:this.returnDependencies?Ei:null,iconMap:this.returnDependencies?tt:null,glyphPositions:this.returnDependencies?Lt.positions:null}}))}}function qe(ue,j,O){const G=new M.H(j);for(const re of ue)re.recalculate(G,O)}class De{constructor(j,O,G,re,se){this.type=j,this.properties=G||{},this.extent=se,this.pointsArray=O,this.id=re}loadGeometry(){return this.pointsArray.map((j=>j.map((O=>new M.P(O.x,O.y)))))}}class Re{constructor(j,O,G){this.version=2,this._myFeatures=j,this.name=O,this.length=j.length,this.extent=G}feature(j){return this._myFeatures[j]}}class Ze{constructor(){this.layers={}}addLayer(j){this.layers[j.name]=j}}function yt(ue){let j=M.cU(ue);return j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),{vectorTile:ue,rawData:j.buffer}}function Xe(ue,j,O){const{extent:G}=ue,re=Math.pow(2,O.z-j.z),se=(O.x-j.x*re)*G,pe=(O.y-j.y*re)*G,ce=[];for(let ae=0;ae<ue.length;ae++){const xe=ue.feature(ae);let Ce=xe.loadGeometry();for(const Ne of Ce)for(const We of Ne)We.x=We.x*re-se,We.y=We.y*re-pe;const Pe=128;Ce=M.cV(Ce,xe.type,-Pe,-Pe,G+Pe,G+Pe),Ce.length!==0&&ce.push(new De(xe.type,Ce,xe.properties,xe.id,G))}return new Re(ce,ue.name,G)}class de{constructor(j,O,G){this.actor=j,this.layerIndex=O,this.availableImages=G,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new M.cW(1e3)}loadVectorTile(j,O){return M._(this,void 0,void 0,(function*(){const G=yield M.n(j.request,O);try{return{vectorTile:j.encoding!=="mlt"?new M.cX(new M.cY(G.data)):new M.cZ(G.data),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(re){const se=new Uint8Array(G.data);let pe=`Unable to parse the tile at ${j.request.url}, `;throw pe+=se[0]===31&&se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${re.message}`,new Error(pe)}}))}loadTile(j){return M._(this,void 0,void 0,(function*(){const{uid:O,overzoomParameters:G}=j;G&&(j.request=G.overzoomRequest);const re=!!(j&&j.request&&j.request.collectResourceTiming)&&new M.c_(j.request),se=new Oe(j);this.loading[O]=se;const pe=new AbortController;se.abort=pe;try{const ce=yield this.loadVectorTile(j,pe);if(delete this.loading[O],!ce)return null;if(G){const Ne=this._getOverzoomTile(j,ce.vectorTile);ce.rawData=Ne.rawData,ce.vectorTile=Ne.vectorTile}const ae=ce.rawData,xe={};ce.expires&&(xe.expires=ce.expires),ce.cacheControl&&(xe.cacheControl=ce.cacheControl);const Ce={};if(re){const Ne=re.finish();Ne&&(Ce.resourceTiming=JSON.parse(JSON.stringify(Ne)))}se.vectorTile=ce.vectorTile;const Pe=se.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity);this.loaded[O]=se,this.fetching[O]={rawTileData:ae,cacheControl:xe,resourceTiming:Ce};try{const Ne=yield Pe;return M.e({rawTileData:ae.slice(0),encoding:j.encoding},Ne,xe,Ce)}finally{delete this.fetching[O]}}catch(ce){throw delete this.loading[O],se.status="done",this.loaded[O]=se,ce}}))}_getOverzoomTile(j,O){const{tileID:G,source:re,overzoomParameters:se}=j,{maxZoomTileID:pe}=se,ce=`${pe.key}_${G.key}`,ae=this.overzoomedTileResultCache.get(ce);if(ae)return ae;const xe=new Ze,Ce=this.layerIndex.familiesBySource[re];for(const Ne in Ce){const We=O.layers[Ne];if(!We)continue;const et=Xe(We,pe,G.canonical);et.length>0&&xe.addLayer(et)}const Pe=yt(xe);return this.overzoomedTileResultCache.set(ce,Pe),Pe}reloadTile(j){return M._(this,void 0,void 0,(function*(){const O=j.uid;if(!this.loaded||!this.loaded[O])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[O];if(G.showCollisionBoxes=j.showCollisionBoxes,G.status==="parsing"){const re=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity);let se;if(this.fetching[O]){const{rawTileData:pe,cacheControl:ce,resourceTiming:ae}=this.fetching[O];delete this.fetching[O],se=M.e({rawTileData:pe.slice(0),encoding:j.encoding},re,ce,ae)}else se=re;return se}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity)}))}abortTile(j){return M._(this,void 0,void 0,(function*(){const O=this.loading,G=j.uid;O&&O[G]&&O[G].abort&&(O[G].abort.abort(),delete O[G])}))}removeTile(j){return M._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[j.uid]&&delete this.loaded[j.uid]}))}}class vt{constructor(){this.loaded={}}loadTile(j){return M._(this,void 0,void 0,(function*(){const{uid:O,encoding:G,rawImageData:re,redFactor:se,greenFactor:pe,blueFactor:ce,baseShift:ae}=j,xe=re.width+2,Ce=re.height+2,Pe=M.b(re)?new M.R({width:xe,height:Ce},yield M.c$(re,-1,-1,xe,Ce)):re,Ne=new M.d0(O,Pe,G,se,pe,ce,ae);return this.loaded=this.loaded||{},this.loaded[O]=Ne,Ne}))}removeTile(j){const O=this.loaded,G=j.uid;O&&O[G]&&delete O[G]}}var rt,Je,ki=(function(){if(Je)return rt;function ue(O,G){if(O.length!==0){j(O[0],G);for(var re=1;re<O.length;re++)j(O[re],!G)}}function j(O,G){for(var re=0,se=0,pe=0,ce=O.length,ae=ce-1;pe<ce;ae=pe++){var xe=(O[pe][0]-O[ae][0])*(O[ae][1]+O[pe][1]),Ce=re+xe;se+=Math.abs(re)>=Math.abs(xe)?re-Ce+xe:xe-Ce+re,re=Ce}re+se>=0!=!!G&&O.reverse()}return Je=1,rt=function O(G,re){var se,pe=G&&G.type;if(pe==="FeatureCollection")for(se=0;se<G.features.length;se++)O(G.features[se],re);else if(pe==="GeometryCollection")for(se=0;se<G.geometries.length;se++)O(G.geometries[se],re);else if(pe==="Feature")O(G.geometry,re);else if(pe==="Polygon")ue(G.coordinates,re);else if(pe==="MultiPolygon")for(se=0;se<G.coordinates.length;se++)ue(G.coordinates[se],re);return G}})(),Di=M.d1(ki);const rn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ue=>ue},Ii=Math.fround||(nn=new Float32Array(1),ue=>(nn[0]=+ue,nn[0]));var nn;class Ki{constructor(j){this.options=Object.assign(Object.create(rn),j),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(j){const{log:O,minZoom:G,maxZoom:re}=this.options;O&&console.time("total time");const se=`prepare ${j.length} points`;O&&console.time(se),this.points=j;const pe=[];for(let ae=0;ae<j.length;ae++){const xe=j[ae];if(!xe.geometry)continue;const[Ce,Pe]=xe.geometry.coordinates,Ne=Ii(or(Ce)),We=Ii(gr(Pe));pe.push(Ne,We,1/0,ae,-1,1),this.options.reduce&&pe.push(0)}let ce=this.trees[re+1]=this._createTree(pe);O&&console.timeEnd(se);for(let ae=re;ae>=G;ae--){const xe=+Date.now();ce=this.trees[ae]=this._createTree(this._cluster(ce,ae)),O&&console.log("z%d: %d clusters in %dms",ae,ce.numItems,+Date.now()-xe)}return O&&console.timeEnd("total time"),this}getClusters(j,O){let G=((j[0]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,j[1]));let se=j[2]===180?180:((j[2]+180)%360+360)%360-180;const pe=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)G=-180,se=180;else if(G>se){const Pe=this.getClusters([G,re,180,pe],O),Ne=this.getClusters([-180,re,se,pe],O);return Pe.concat(Ne)}const ce=this.trees[this._limitZoom(O)],ae=ce.range(or(G),gr(pe),or(se),gr(re)),xe=ce.data,Ce=[];for(const Pe of ae){const Ne=this.stride*Pe;Ce.push(xe[Ne+5]>1?ar(xe,Ne,this.clusterProps):this.points[xe[Ne+3]])}return Ce}getChildren(j){const O=this._getOriginId(j),G=this._getOriginZoom(j),re="No cluster with the specified id.",se=this.trees[G];if(!se)throw new Error(re);const pe=se.data;if(O*this.stride>=pe.length)throw new Error(re);const ce=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ae=se.within(pe[O*this.stride],pe[O*this.stride+1],ce),xe=[];for(const Ce of ae){const Pe=Ce*this.stride;pe[Pe+4]===j&&xe.push(pe[Pe+5]>1?ar(pe,Pe,this.clusterProps):this.points[pe[Pe+3]])}if(xe.length===0)throw new Error(re);return xe}getLeaves(j,O,G){const re=[];return this._appendLeaves(re,j,O=O||10,G=G||0,0),re}getTile(j,O,G){const re=this.trees[this._limitZoom(j)],se=Math.pow(2,j),{extent:pe,radius:ce}=this.options,ae=ce/pe,xe=(G-ae)/se,Ce=(G+1+ae)/se,Pe={features:[]};return this._addTileFeatures(re.range((O-ae)/se,xe,(O+1+ae)/se,Ce),re.data,O,G,se,Pe),O===0&&this._addTileFeatures(re.range(1-ae/se,xe,1,Ce),re.data,se,G,se,Pe),O===se-1&&this._addTileFeatures(re.range(0,xe,ae/se,Ce),re.data,-1,G,se,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(j){let O=this._getOriginZoom(j)-1;for(;O<=this.options.maxZoom;){const G=this.getChildren(j);if(O++,G.length!==1)break;j=G[0].properties.cluster_id}return O}_appendLeaves(j,O,G,re,se){const pe=this.getChildren(O);for(const ce of pe){const ae=ce.properties;if(ae&&ae.cluster?se+ae.point_count<=re?se+=ae.point_count:se=this._appendLeaves(j,ae.cluster_id,G,re,se):se<re?se++:j.push(ce),j.length===G)break}return se}_createTree(j){const O=new M.aT(j.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<j.length;G+=this.stride)O.add(j[G],j[G+1]);return O.finish(),O.data=j,O}_addTileFeatures(j,O,G,re,se,pe){for(const ce of j){const ae=ce*this.stride,xe=O[ae+5]>1;let Ce,Pe,Ne;if(xe)Ce=ci(O,ae,this.clusterProps),Pe=O[ae],Ne=O[ae+1];else{const St=this.points[O[ae+3]];Ce=St.properties;const[gt,me]=St.geometry.coordinates;Pe=or(gt),Ne=gr(me)}const We={type:1,geometry:[[Math.round(this.options.extent*(Pe*se-G)),Math.round(this.options.extent*(Ne*se-re))]],tags:Ce};let et;et=xe||this.options.generateId?O[ae+3]:this.points[O[ae+3]].id,et!==void 0&&(We.id=et),pe.features.push(We)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,O){const{radius:G,extent:re,reduce:se,minPoints:pe}=this.options,ce=G/(re*Math.pow(2,O)),ae=j.data,xe=[],Ce=this.stride;for(let Pe=0;Pe<ae.length;Pe+=Ce){if(ae[Pe+2]<=O)continue;ae[Pe+2]=O;const Ne=ae[Pe],We=ae[Pe+1],et=j.within(ae[Pe],ae[Pe+1],ce),St=ae[Pe+5];let gt=St;for(const me of et){const Mt=me*Ce;ae[Mt+2]>O&&(gt+=ae[Mt+5])}if(gt>St&>>=pe){let me,Mt=Ne*St,Ei=We*St,tt=-1;const wt=(Pe/Ce<<5)+(O+1)+this.points.length;for(const Ci of et){const Lt=Ci*Ce;if(ae[Lt+2]<=O)continue;ae[Lt+2]=O;const Ht=ae[Lt+5];Mt+=ae[Lt]*Ht,Ei+=ae[Lt+1]*Ht,ae[Lt+4]=wt,se&&(me||(me=this._map(ae,Pe,!0),tt=this.clusterProps.length,this.clusterProps.push(me)),se(me,this._map(ae,Lt)))}ae[Pe+4]=wt,xe.push(Mt/gt,Ei/gt,1/0,wt,-1,gt),se&&xe.push(tt)}else{for(let me=0;me<Ce;me++)xe.push(ae[Pe+me]);if(gt>1)for(const me of et){const Mt=me*Ce;if(!(ae[Mt+2]<=O)){ae[Mt+2]=O;for(let Ei=0;Ei<Ce;Ei++)xe.push(ae[Mt+Ei])}}}}return xe}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,O,G){if(j[O+5]>1){const pe=this.clusterProps[j[O+6]];return G?Object.assign({},pe):pe}const re=this.points[j[O+3]].properties,se=this.options.map(re);return G&&se===re?Object.assign({},se):se}}function ar(ue,j,O){return{type:"Feature",id:ue[j+3],properties:ci(ue,j,O),geometry:{type:"Point",coordinates:[(G=ue[j],360*(G-.5)),Vn(ue[j+1])]}};var G}function ci(ue,j,O){const G=ue[j+5],re=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,se=ue[j+6],pe=se===-1?{}:Object.assign({},O[se]);return Object.assign(pe,{cluster:!0,cluster_id:ue[j+3],point_count:G,point_count_abbreviated:re})}function or(ue){return ue/360+.5}function gr(ue){const j=Math.sin(ue*Math.PI/180),O=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return O<0?0:O>1?1:O}function Vn(ue){const j=(180-360*ue)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function $r(ue,j,O,G){let re=G;const se=j+(O-j>>1);let pe,ce=O-j;const ae=ue[j],xe=ue[j+1],Ce=ue[O],Pe=ue[O+1];for(let Ne=j+3;Ne<O;Ne+=3){const We=Ir(ue[Ne],ue[Ne+1],ae,xe,Ce,Pe);if(We>re)pe=Ne,re=We;else if(We===re){const et=Math.abs(Ne-se);et<ce&&(pe=Ne,ce=et)}}re>G&&(pe-j>3&&$r(ue,j,pe,G),ue[pe+2]=re,O-pe>3&&$r(ue,pe,O,G))}function Ir(ue,j,O,G,re,se){let pe=re-O,ce=se-G;if(pe!==0||ce!==0){const ae=((ue-O)*pe+(j-G)*ce)/(pe*pe+ce*ce);ae>1?(O=re,G=se):ae>0&&(O+=pe*ae,G+=ce*ae)}return pe=ue-O,ce=j-G,pe*pe+ce*ce}function _i(ue,j,O,G){const re={id:ue??null,type:j,geometry:O,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(j==="Point"||j==="MultiPoint"||j==="LineString")qr(re,O);else if(j==="Polygon")qr(re,O[0]);else if(j==="MultiLineString")for(const se of O)qr(re,se);else if(j==="MultiPolygon")for(const se of O)qr(re,se[0]);return re}function qr(ue,j){for(let O=0;O<j.length;O+=3)ue.minX=Math.min(ue.minX,j[O]),ue.minY=Math.min(ue.minY,j[O+1]),ue.maxX=Math.max(ue.maxX,j[O]),ue.maxY=Math.max(ue.maxY,j[O+1])}function ht(ue,j,O,G){if(!j.geometry)return;const re=j.geometry.coordinates;if(re&&re.length===0)return;const se=j.geometry.type,pe=Math.pow(O.tolerance/((1<<O.maxZoom)*O.extent),2);let ce=[],ae=j.id;if(O.promoteId?ae=j.properties[O.promoteId]:O.generateId&&(ae=G||0),se==="Point")_n(re,ce);else if(se==="MultiPoint")for(const xe of re)_n(xe,ce);else if(se==="LineString")Er(re,ce,pe,!1);else if(se==="MultiLineString"){if(O.lineMetrics){for(const xe of re)ce=[],Er(xe,ce,pe,!1),ue.push(_i(ae,"LineString",ce,j.properties));return}Zr(re,ce,pe,!1)}else if(se==="Polygon")Zr(re,ce,pe,!0);else{if(se!=="MultiPolygon"){if(se==="GeometryCollection"){for(const xe of j.geometry.geometries)ht(ue,{id:ae,geometry:xe,properties:j.properties},O,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const xe of re){const Ce=[];Zr(xe,Ce,pe,!0),ce.push(Ce)}}ue.push(_i(ae,se,ce,j.properties))}function _n(ue,j){j.push(_r(ue[0]),Wr(ue[1]),0)}function Er(ue,j,O,G){let re,se,pe=0;for(let ae=0;ae<ue.length;ae++){const xe=_r(ue[ae][0]),Ce=Wr(ue[ae][1]);j.push(xe,Ce,0),ae>0&&(pe+=G?(re*Ce-xe*se)/2:Math.sqrt(Math.pow(xe-re,2)+Math.pow(Ce-se,2))),re=xe,se=Ce}const ce=j.length-3;j[2]=1,$r(j,0,ce,O),j[ce+2]=1,j.size=Math.abs(pe),j.start=0,j.end=j.size}function Zr(ue,j,O,G){for(let re=0;re<ue.length;re++){const se=[];Er(ue[re],se,O,G),j.push(se)}}function _r(ue){return ue/360+.5}function Wr(ue){const j=Math.sin(ue*Math.PI/180),O=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return O<0?0:O>1?1:O}function ti(ue,j,O,G,re,se,pe,ce){if(G/=j,se>=(O/=j)&&pe<G)return ue;if(pe<O||se>=G)return null;const ae=[];for(const xe of ue){const Ce=xe.geometry;let Pe=xe.type;const Ne=re===0?xe.minX:xe.minY,We=re===0?xe.maxX:xe.maxY;if(Ne>=O&&We<G){ae.push(xe);continue}if(We<O||Ne>=G)continue;let et=[];if(Pe==="Point"||Pe==="MultiPoint")Ni(Ce,et,O,G,re);else if(Pe==="LineString")lr(Ce,et,O,G,re,!1,ce.lineMetrics);else if(Pe==="MultiLineString")Hr(Ce,et,O,G,re,!1);else if(Pe==="Polygon")Hr(Ce,et,O,G,re,!0);else if(Pe==="MultiPolygon")for(const St of Ce){const gt=[];Hr(St,gt,O,G,re,!0),gt.length&&et.push(gt)}if(et.length){if(ce.lineMetrics&&Pe==="LineString"){for(const St of et)ae.push(_i(xe.id,Pe,St,xe.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(et.length===1?(Pe="LineString",et=et[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=et.length===3?"Point":"MultiPoint"),ae.push(_i(xe.id,Pe,et,xe.tags))}}return ae.length?ae:null}function Ni(ue,j,O,G,re){for(let se=0;se<ue.length;se+=3){const pe=ue[se+re];pe>=O&&pe<=G&&cr(j,ue[se],ue[se+1],ue[se+2])}}function lr(ue,j,O,G,re,se,pe){let ce=yi(ue);const ae=re===0?yn:Ji;let xe,Ce,Pe=ue.start;for(let gt=0;gt<ue.length-3;gt+=3){const me=ue[gt],Mt=ue[gt+1],Ei=ue[gt+2],tt=ue[gt+3],wt=ue[gt+4],Ci=re===0?me:Mt,Lt=re===0?tt:wt;let Ht=!1;pe&&(xe=Math.sqrt(Math.pow(me-tt,2)+Math.pow(Mt-wt,2))),Ci<O?Lt>O&&(Ce=ae(ce,me,Mt,tt,wt,O),pe&&(ce.start=Pe+xe*Ce)):Ci>G?Lt<G&&(Ce=ae(ce,me,Mt,tt,wt,G),pe&&(ce.start=Pe+xe*Ce)):cr(ce,me,Mt,Ei),Lt<O&&Ci>=O&&(Ce=ae(ce,me,Mt,tt,wt,O),Ht=!0),Lt>G&&Ci<=G&&(Ce=ae(ce,me,Mt,tt,wt,G),Ht=!0),!se&&Ht&&(pe&&(ce.end=Pe+xe*Ce),j.push(ce),ce=yi(ue)),pe&&(Pe+=xe)}let Ne=ue.length-3;const We=ue[Ne],et=ue[Ne+1],St=re===0?We:et;St>=O&&St<=G&&cr(ce,We,et,ue[Ne+2]),Ne=ce.length-3,se&&Ne>=3&&(ce[Ne]!==ce[0]||ce[Ne+1]!==ce[1])&&cr(ce,ce[0],ce[1],ce[2]),ce.length&&j.push(ce)}function yi(ue){const j=[];return j.size=ue.size,j.start=ue.start,j.end=ue.end,j}function Hr(ue,j,O,G,re,se){for(const pe of ue)lr(pe,j,O,G,re,se,!1)}function cr(ue,j,O,G){ue.push(j,O,G)}function yn(ue,j,O,G,re,se){const pe=(se-j)/(G-j);return cr(ue,se,O+(re-O)*pe,1),pe}function Ji(ue,j,O,G,re,se){const pe=(se-O)/(re-O);return cr(ue,j+(G-j)*pe,se,1),pe}function vn(ue,j){const O=[];for(let G=0;G<ue.length;G++){const re=ue[G],se=re.type;let pe;if(se==="Point"||se==="MultiPoint"||se==="LineString")pe=vi(re.geometry,j);else if(se==="MultiLineString"||se==="Polygon"){pe=[];for(const ce of re.geometry)pe.push(vi(ce,j))}else if(se==="MultiPolygon"){pe=[];for(const ce of re.geometry){const ae=[];for(const xe of ce)ae.push(vi(xe,j));pe.push(ae)}}O.push(_i(re.id,se,pe,re.tags))}return O}function vi(ue,j){const O=[];O.size=ue.size,ue.start!==void 0&&(O.start=ue.start,O.end=ue.end);for(let G=0;G<ue.length;G+=3)O.push(ue[G]+j,ue[G+1],ue[G+2]);return O}function yr(ue,j){if(ue.transformed)return ue;const O=1<<ue.z,G=ue.x,re=ue.y;for(const se of ue.features){const pe=se.geometry,ce=se.type;if(se.geometry=[],ce===1)for(let ae=0;ae<pe.length;ae+=2)se.geometry.push(Xr(pe[ae],pe[ae+1],j,O,G,re));else for(let ae=0;ae<pe.length;ae++){const xe=[];for(let Ce=0;Ce<pe[ae].length;Ce+=2)xe.push(Xr(pe[ae][Ce],pe[ae][Ce+1],j,O,G,re));se.geometry.push(xe)}}return ue.transformed=!0,ue}function Xr(ue,j,O,G,re,se){return[Math.round(O*(ue*G-re)),Math.round(O*(j*G-se))]}function Wt(ue,j,O,G,re){const se=j===re.maxZoom?0:re.tolerance/((1<<j)*re.extent),pe={features:[],numPoints:0,numSimplified:0,numFeatures:ue.length,source:null,x:O,y:G,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ce of ue)xn(pe,ce,se,re);return pe}function xn(ue,j,O,G){const re=j.geometry,se=j.type,pe=[];if(ue.minX=Math.min(ue.minX,j.minX),ue.minY=Math.min(ue.minY,j.minY),ue.maxX=Math.max(ue.maxX,j.maxX),ue.maxY=Math.max(ue.maxY,j.maxY),se==="Point"||se==="MultiPoint")for(let ce=0;ce<re.length;ce+=3)pe.push(re[ce],re[ce+1]),ue.numPoints++,ue.numSimplified++;else if(se==="LineString")Nn(pe,re,ue,O,!1,!1);else if(se==="MultiLineString"||se==="Polygon")for(let ce=0;ce<re.length;ce++)Nn(pe,re[ce],ue,O,se==="Polygon",ce===0);else if(se==="MultiPolygon")for(let ce=0;ce<re.length;ce++){const ae=re[ce];for(let xe=0;xe<ae.length;xe++)Nn(pe,ae[xe],ue,O,!0,xe===0)}if(pe.length){let ce=j.tags||null;if(se==="LineString"&&G.lineMetrics){ce={};for(const xe in j.tags)ce[xe]=j.tags[xe];ce.mapbox_clip_start=re.start/re.size,ce.mapbox_clip_end=re.end/re.size}const ae={geometry:pe,type:se==="Polygon"||se==="MultiPolygon"?3:se==="LineString"||se==="MultiLineString"?2:1,tags:ce};j.id!==null&&(ae.id=j.id),ue.features.push(ae)}}function Nn(ue,j,O,G,re,se){const pe=G*G;if(G>0&&j.size<(re?pe:G))return void(O.numPoints+=j.length/3);const ce=[];for(let ae=0;ae<j.length;ae+=3)(G===0||j[ae+2]>pe)&&(O.numSimplified++,ce.push(j[ae],j[ae+1])),O.numPoints++;re&&(function(ae,xe){let Ce=0;for(let Pe=0,Ne=ae.length,We=Ne-2;Pe<Ne;We=Pe,Pe+=2)Ce+=(ae[Pe]-ae[We])*(ae[Pe+1]+ae[We+1]);if(Ce>0===xe)for(let Pe=0,Ne=ae.length;Pe<Ne/2;Pe+=2){const We=ae[Pe],et=ae[Pe+1];ae[Pe]=ae[Ne-2-Pe],ae[Pe+1]=ae[Ne-1-Pe],ae[Ne-2-Pe]=We,ae[Ne-1-Pe]=et}})(ce,se),ue.push(ce)}const ps={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class bn{constructor(j,O){const G=(O=this.options=(function(se,pe){for(const ce in pe)se[ce]=pe[ce];return se})(Object.create(ps),O)).debug;if(G&&console.time("preprocess data"),O.maxZoom<0||O.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(O.promoteId&&O.generateId)throw new Error("promoteId and generateId cannot be used together.");let re=(function(se,pe){const ce=[];if(se.type==="FeatureCollection")for(let ae=0;ae<se.features.length;ae++)ht(ce,se.features[ae],pe,ae);else ht(ce,se.type==="Feature"?se:{geometry:se},pe);return ce})(j,O);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",O.indexMaxZoom,O.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),re=(function(se,pe){const ce=pe.buffer/pe.extent;let ae=se;const xe=ti(se,1,-1-ce,ce,0,-1,2,pe),Ce=ti(se,1,1-ce,2+ce,0,-1,2,pe);return(xe||Ce)&&(ae=ti(se,1,-ce,1+ce,0,-1,2,pe)||[],xe&&(ae=vn(xe,1).concat(ae)),Ce&&(ae=ae.concat(vn(Ce,-1)))),ae})(re,O),re.length&&this.splitTile(re,0,0,0),G&&(re.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)))}splitTile(j,O,G,re,se,pe,ce){const ae=[j,O,G,re],xe=this.options,Ce=xe.debug;for(;ae.length;){re=ae.pop(),G=ae.pop(),O=ae.pop(),j=ae.pop();const Pe=1<<O,Ne=Cr(O,G,re);let We=this.tiles[Ne];if(!We&&(Ce>1&&console.time("creation"),We=this.tiles[Ne]=Wt(j,O,G,re,xe),this.tileCoords.push({z:O,x:G,y:re}),Ce)){Ce>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",O,G,re,We.numFeatures,We.numPoints,We.numSimplified),console.timeEnd("creation"));const Ht=`z${O}`;this.stats[Ht]=(this.stats[Ht]||0)+1,this.total++}if(We.source=j,se==null){if(O===xe.indexMaxZoom||We.numPoints<=xe.indexMaxPoints)continue}else{if(O===xe.maxZoom||O===se)continue;if(se!=null){const Ht=se-O;if(G!==pe>>Ht||re!==ce>>Ht)continue}}if(We.source=null,j.length===0)continue;Ce>1&&console.time("clipping");const et=.5*xe.buffer/xe.extent,St=.5-et,gt=.5+et,me=1+et;let Mt=null,Ei=null,tt=null,wt=null,Ci=ti(j,Pe,G-et,G+gt,0,We.minX,We.maxX,xe),Lt=ti(j,Pe,G+St,G+me,0,We.minX,We.maxX,xe);j=null,Ci&&(Mt=ti(Ci,Pe,re-et,re+gt,1,We.minY,We.maxY,xe),Ei=ti(Ci,Pe,re+St,re+me,1,We.minY,We.maxY,xe),Ci=null),Lt&&(tt=ti(Lt,Pe,re-et,re+gt,1,We.minY,We.maxY,xe),wt=ti(Lt,Pe,re+St,re+me,1,We.minY,We.maxY,xe),Lt=null),Ce>1&&console.timeEnd("clipping"),ae.push(Mt||[],O+1,2*G,2*re),ae.push(Ei||[],O+1,2*G,2*re+1),ae.push(tt||[],O+1,2*G+1,2*re),ae.push(wt||[],O+1,2*G+1,2*re+1)}}getTile(j,O,G){j=+j,O=+O,G=+G;const re=this.options,{extent:se,debug:pe}=re;if(j<0||j>24)return null;const ce=1<<j,ae=Cr(j,O=O+ce&ce-1,G);if(this.tiles[ae])return yr(this.tiles[ae],se);pe>1&&console.log("drilling down to z%d-%d-%d",j,O,G);let xe,Ce=j,Pe=O,Ne=G;for(;!xe&&Ce>0;)Ce--,Pe>>=1,Ne>>=1,xe=this.tiles[Cr(Ce,Pe,Ne)];return xe&&xe.source?(pe>1&&(console.log("found parent tile z%d-%d-%d",Ce,Pe,Ne),console.time("drilling down")),this.splitTile(xe.source,Ce,Pe,Ne,j,O,G),pe>1&&console.timeEnd("drilling down"),this.tiles[ae]?yr(this.tiles[ae],se):null):null}}function Cr(ue,j,O){return 32*((1<<ue)*O+j)+ue}class fs extends de{constructor(j,O,G,re=ms){super(j,O,G),this._dataUpdateable=new Map,this._createGeoJSONIndex=re}loadVectorTile(j,O){return M._(this,void 0,void 0,(function*(){const G=j.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const re=this._geoJSONIndex.getTile(G.z,G.x,G.y);return re?yt(new M.d2(re.features,{version:2,extent:M.a5})):null}))}loadData(j){return M._(this,void 0,void 0,(function*(){var O;(O=this._pendingRequest)===null||O===void 0||O.abort();const G=this._startPerformance(j);this._pendingRequest=new AbortController;try{(!this._pendingData||j.request||j.data||j.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(j,this._pendingRequest));const re=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(re,j),this.loaded={};const se={};return j.request&&(se.data=re),this._finishPerformance(G,j,se),se}catch(re){if(delete this._pendingRequest,M.Z(re))return{abandoned:!0};throw re}}))}_startPerformance(j){var O;if(!((O=j?.request)===null||O===void 0)&&O.collectResourceTiming)return new M.c_(j.request)}_finishPerformance(j,O,G){if(!j)return;const re=j.finish();re&&(G.resourceTiming={},G.resourceTiming[O.source]=JSON.parse(JSON.stringify(re)))}getData(){return M._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(j){const O=this.loaded;return O&&O[j.uid]?super.reloadTile(j):this.loadTile(j)}loadAndProcessGeoJSON(j,O){return M._(this,void 0,void 0,(function*(){let G;if(j.request?G=yield this.loadGeoJSONFromUrl(j.request,j.promoteId,O):j.data?G=this._loadGeoJSONFromObject(j.data,j.promoteId):j.dataDiff&&(G=this._loadGeoJSONFromDiff(j.dataDiff,j.promoteId,j.source)),delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`);return Di(G,!0),j.filter&&(G=this._filterGeoJSON(G,j.filter)),G}))}loadGeoJSONFromUrl(j,O,G){return M._(this,void 0,void 0,(function*(){const re=yield M.j(j,G);return this._dataUpdateable=M.a7(re.data,O),re.data}))}_loadGeoJSONFromObject(j,O){return this._dataUpdateable=M.a7(j,O),j}_loadGeoJSONFromDiff(j,O,G){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G}`);M.a8(this._dataUpdateable,j,O);const re=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(re)}_filterGeoJSON(j,O){const G=M.d3(O,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map((se=>`${se.key}: ${se.message}`)).join(", "));const re=j.features.filter((se=>G.value.evaluate({zoom:0},se)));return this._toFeatureCollection(re)}_toFeatureCollection(j){return{type:"FeatureCollection",features:j}}removeSource(j){return M._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(j){return this._geoJSONIndex.getClusterExpansionZoom(j.clusterId)}getClusterChildren(j){return this._geoJSONIndex.getChildren(j.clusterId)}getClusterLeaves(j){return this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset)}}function ms(ue,j){return j.cluster?new Ki((function({superclusterOptions:O,clusterProperties:G}){if(!G||!O)return O;const re={},se={},pe={accumulated:null,zoom:0},ce={properties:null},ae=Object.keys(G);for(const xe of ae){const[Ce,Pe]=G[xe],Ne=M.d3(Pe),We=M.d3(typeof Ce=="string"?[Ce,["accumulated"],["get",xe]]:Ce);re[xe]=Ne.value,se[xe]=We.value}return O.map=xe=>{ce.properties=xe;const Ce={};for(const Pe of ae)Ce[Pe]=re[Pe].evaluate(pe,ce);return Ce},O.reduce=(xe,Ce)=>{ce.properties=Ce;for(const Pe of ae)pe.accumulated=xe[Pe],xe[Pe]=se[Pe].evaluate(pe,ce)},O})(j)).load(ue.features):(function(O,G){return new bn(O,G)})(ue,j.geojsonVtOptions)}class Qi{constructor(j){this.self=j,this.actor=new M.L(j),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(O,G)=>{if(this.externalWorkerSourceTypes[O])throw new Error(`Worker source with name "${O}" already registered.`);this.externalWorkerSourceTypes[O]=G},this.self.addProtocol=M.cJ,this.self.removeProtocol=M.cK,this.self.registerRTLTextPlugin=O=>{M.d4.setMethods(O)},this.actor.registerMessageHandler("LDT",((O,G)=>this._getDEMWorkerSource(O,G.source).loadTile(G))),this.actor.registerMessageHandler("RDT",((O,G)=>M._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(O,G.source).removeTile(G)})))),this.actor.registerMessageHandler("GCEZ",((O,G)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(O,G.type,G.source).getClusterExpansionZoom(G)})))),this.actor.registerMessageHandler("GCC",((O,G)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(O,G.type,G.source).getClusterChildren(G)})))),this.actor.registerMessageHandler("GCL",((O,G)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(O,G.type,G.source).getClusterLeaves(G)})))),this.actor.registerMessageHandler("LD",((O,G)=>this._getWorkerSource(O,G.type,G.source).loadData(G))),this.actor.registerMessageHandler("GD",((O,G)=>this._getWorkerSource(O,G.type,G.source).getData())),this.actor.registerMessageHandler("LT",((O,G)=>this._getWorkerSource(O,G.type,G.source).loadTile(G))),this.actor.registerMessageHandler("RT",((O,G)=>this._getWorkerSource(O,G.type,G.source).reloadTile(G))),this.actor.registerMessageHandler("AT",((O,G)=>this._getWorkerSource(O,G.type,G.source).abortTile(G))),this.actor.registerMessageHandler("RMT",((O,G)=>this._getWorkerSource(O,G.type,G.source).removeTile(G))),this.actor.registerMessageHandler("RS",((O,G)=>M._(this,void 0,void 0,(function*(){if(!this.workerSources[O]||!this.workerSources[O][G.type]||!this.workerSources[O][G.type][G.source])return;const re=this.workerSources[O][G.type][G.source];delete this.workerSources[O][G.type][G.source],re.removeSource!==void 0&&re.removeSource(G)})))),this.actor.registerMessageHandler("RM",(O=>M._(this,void 0,void 0,(function*(){delete this.layerIndexes[O],delete this.availableImages[O],delete this.workerSources[O],delete this.demWorkerSources[O],this.globalStates.delete(O)})))),this.actor.registerMessageHandler("SR",((O,G)=>M._(this,void 0,void 0,(function*(){this.referrer=G})))),this.actor.registerMessageHandler("SRPS",((O,G)=>this._syncRTLPluginState(O,G))),this.actor.registerMessageHandler("IS",((O,G)=>M._(this,void 0,void 0,(function*(){this.self.importScripts(G)})))),this.actor.registerMessageHandler("SI",((O,G)=>this._setImages(O,G))),this.actor.registerMessageHandler("UL",((O,G)=>M._(this,void 0,void 0,(function*(){this._getLayerIndex(O).update(G.layers,G.removedIds,this._getGlobalState(O))})))),this.actor.registerMessageHandler("UGS",((O,G)=>M._(this,void 0,void 0,(function*(){const re=this._getGlobalState(O);for(const se in G)re[se]=G[se]})))),this.actor.registerMessageHandler("SL",((O,G)=>M._(this,void 0,void 0,(function*(){this._getLayerIndex(O).replace(G,this._getGlobalState(O))}))))}_getGlobalState(j){let O=this.globalStates.get(j);return O||(O={},this.globalStates.set(j,O)),O}_setImages(j,O){return M._(this,void 0,void 0,(function*(){this.availableImages[j]=O;for(const G in this.workerSources[j]){const re=this.workerSources[j][G];for(const se in re)re[se].availableImages=O}}))}_syncRTLPluginState(j,O){return M._(this,void 0,void 0,(function*(){return yield M.d4.syncState(O,this.self.importScripts)}))}_getAvailableImages(j){let O=this.availableImages[j];return O||(O=[]),O}_getLayerIndex(j){let O=this.layerIndexes[j];return O||(O=this.layerIndexes[j]=new l),O}_getWorkerSource(j,O,G){if(this.workerSources[j]||(this.workerSources[j]={}),this.workerSources[j][O]||(this.workerSources[j][O]={}),!this.workerSources[j][O][G]){const re={sendAsync:(se,pe)=>(se.targetMapId=j,this.actor.sendAsync(se,pe))};switch(O){case"vector":this.workerSources[j][O][G]=new de(re,this._getLayerIndex(j),this._getAvailableImages(j));break;case"geojson":this.workerSources[j][O][G]=new fs(re,this._getLayerIndex(j),this._getAvailableImages(j));break;default:this.workerSources[j][O][G]=new this.externalWorkerSourceTypes[O](re,this._getLayerIndex(j),this._getAvailableImages(j))}}return this.workerSources[j][O][G]}_getDEMWorkerSource(j,O){return this.demWorkerSources[j]||(this.demWorkerSources[j]={}),this.demWorkerSources[j][O]||(this.demWorkerSources[j][O]=new vt),this.demWorkerSources[j][O]}}return M.i(self)&&(self.worker=new Qi(self)),Qi})),Y("index",["exports","./shared"],(function(M,l){var _e="5.16.0";function Oe(){var d=new l.A(4);return l.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}let qe,De,Re;const Ze={frame(d,t,n){const a=requestAnimationFrame((p=>{c(),t(p)})),{unsubscribe:c}=l.s(d.signal,"abort",(()=>{c(),cancelAnimationFrame(a),n(new l.a(d.signal.reason))}),!1)},frameAsync(d){return new Promise(((t,n)=>{this.frame(d,t,n)}))},getImageData(d,t=0){return this.getImageCanvasContext(d).getImageData(-t,-t,d.width+2*t,d.height+2*t)},getImageCanvasContext(d){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=d.width,t.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>(qe||(qe=document.createElement("a")),qe.href=d,qe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Re!==void 0?Re:!!matchMedia&&(De==null&&(De=matchMedia("(prefers-reduced-motion: reduce)")),De.matches)},set prefersReducedMotion(d){Re=d}},yt=new class{constructor(){this._realTime=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:this._realTime()}setNow(d){this._frozenAt=d}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function Xe(){return yt.getCurrentTime()}class de{static testProp(t){if(!de.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in de.docStyle)return t[n];return t[0]}static create(t,n,a){const c=window.document.createElement(t);return n!==void 0&&(c.className=n),a&&a.appendChild(c),c}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){de.docStyle&&de.selectProp&&(de.userSelect=de.docStyle[de.selectProp],de.docStyle[de.selectProp]="none")}static enableDrag(){de.docStyle&&de.selectProp&&(de.docStyle[de.selectProp]=de.userSelect)}static setTransform(t,n){t.style[de.transformProp]=n}static addEventListener(t,n,a,c={}){t.addEventListener(n,a,"passive"in c?c:c.capture)}static removeEventListener(t,n,a,c={}){t.removeEventListener(n,a,"passive"in c?c:c.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",de.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",de.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",de.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,a){const c=n.boundingClientRect;return new l.P((a.clientX-c.left)/n.x-t.clientLeft,(a.clientY-c.top)/n.y-t.clientTop)}static mousePos(t,n){const a=de.getScale(t);return de.getPoint(t,a,n)}static touchPos(t,n){const a=[],c=de.getScale(t);for(let p=0;p<n.length;p++)a.push(de.getPoint(t,c,n[p]));return a}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),a=n.querySelectorAll("script");for(const c of a)c.remove();return de.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const a=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!a.includes("javascript:")&&!a.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const a of n)de.removeAttributes(a),de.clean(a)}static removeAttributes(t){for(const{name:n,value:a}of t.attributes)de.isPossiblyDangerous(n,a)&&t.removeAttribute(n)}}de.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,de.selectProp=de.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),de.transformProp=de.testProp(["transform","WebkitTransform"]);const vt={supported:!1,testSupport:function(d){!ki&&Je&&(Di?rn(d):rt=d)}};let rt,Je,ki=!1,Di=!1;function rn(d){const t=d.createTexture();d.bindTexture(d.TEXTURE_2D,t);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,Je),d.isContextLost())return;vt.supported=!0}catch{}d.deleteTexture(t),ki=!0}var Ii;typeof document<"u"&&(Je=document.createElement("img"),Je.onload=()=>{rt&&rn(rt),rt=null,Di=!0},Je.onerror=()=>{ki=!0,rt=null},Je.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(d){let t,n,a,c;d.resetRequestQueue=()=>{t=[],n=0,a=0,c={}},d.addThrottleControl=v=>{const b=a++;return c[b]=v,b},d.removeThrottleControl=v=>{delete c[v],m()},d.getImage=(v,b,T=!0)=>new Promise(((A,C)=>{vt.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),l.e(v,{type:"image"}),t.push({abortController:b,requestParameters:v,supportImageRefresh:T,state:"queued",onError:D=>{C(D)},onSuccess:D=>{A(D)}}),m()}));const p=v=>l._(this,void 0,void 0,(function*(){v.state="running";const{requestParameters:b,supportImageRefresh:T,onError:A,onSuccess:C,abortController:D}=v,V=T===!1&&!l.i(self)&&!l.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce(((Z,K)=>Z&&K==="accept"),!0));n++;const q=V?_(b,D):l.m(b,D);try{const Z=yield q;delete v.abortController,v.state="completed",Z.data instanceof HTMLImageElement||l.b(Z.data)?C(Z):Z.data&&C({data:yield(W=Z.data,typeof createImageBitmap=="function"?l.f(W):l.h(W)),cacheControl:Z.cacheControl,expires:Z.expires})}catch(Z){delete v.abortController,A(Z)}finally{n--,m()}var W})),m=()=>{const v=(()=>{for(const b of Object.keys(c))if(c[b]())return!0;return!1})()?l.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<v&&t.length>0;b++){const T=t.shift();T.abortController.signal.aborted?b--:p(T)}},_=(v,b)=>new Promise(((T,A)=>{const C=new Image,D=v.url,V=v.credentials;V&&V==="include"?C.crossOrigin="use-credentials":(V&&V==="same-origin"||!l.d(D))&&(C.crossOrigin="anonymous"),b.signal.addEventListener("abort",(()=>{C.src="",A(new l.a(b.signal.reason))})),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,T({data:C})},C.onerror=()=>{C.onerror=C.onload=null,b.signal.aborted||A(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."))},C.src=D}))})(Ii||(Ii={})),Ii.resetRequestQueue();class nn{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Ki(d){const t=[];if(typeof d=="string")t.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:a,url:c}of d){const p=`${a}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:a,url:c}))}}return t}function ar(d,t,n){try{const a=new URL(d);return a.pathname+=`${t}${n}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${d}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ci(d){const{userImage:t}=d;return!!(t&&t.render&&t.render())&&(d.data.replace(new Uint8Array(t.data.buffer)),!0)}class or extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new l.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new l.k(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new l.k(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new l.k(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]<a||c[1]<c[0]||n<c[1])return!1;a=c[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,c=a&&a.width||n.data.width,p=a&&a.height||n.data.height;return!(t[0]<0||c<t[0]||t[1]<0||p<t[1]||t[2]<0||c<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,a=!0){const c=this.getImage(t);if(a&&(c.data.width!==n.data.width||c.data.height!==n.data.height))throw new Error(`size mismatch between old image (${c.data.width}x${c.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=c.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,a)=>{let c=!0;if(!this.isLoaded())for(const p of t)this.images[p]||(c=!1);this.isLoaded()||c?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}))}_getImagesForIds(t){const n={};for(const a of t){let c=this.getImage(a);c||(this.fire(new l.l("styleimagemissing",{id:a})),c=this.getImage(a)),c?n[a]={data:c.data.clone(),pixelRatio:c.pixelRatio,sdf:c.sdf,version:c.version,stretchX:c.stretchX,stretchY:c.stretchY,content:c.content,textFitWidth:c.textFitWidth,textFitHeight:c.textFitHeight,hasRenderCallback:!!(c.userImage&&c.userImage.render)}:l.w(`Image "${a}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const c={w:a.data.width+2,h:a.data.height+2,x:0,y:0},p=new l.I(c,a);this.patterns[t]={bin:c,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:a}=l.p(t),c=this.atlasImage;c.resize({width:n||1,height:a||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],_=m.x+1,v=m.y+1,b=this.getImage(p).data,T=b.width,A=b.height;l.R.copy(b,c,{x:0,y:0},{x:_,y:v},{width:T,height:A}),l.R.copy(b,c,{x:0,y:A-1},{x:_,y:v-1},{width:T,height:1}),l.R.copy(b,c,{x:0,y:0},{x:_,y:v+A},{width:T,height:1}),l.R.copy(b,c,{x:T-1,y:0},{x:_-1,y:v},{width:1,height:A}),l.R.copy(b,c,{x:0,y:0},{x:_+T,y:v},{width:1,height:A})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||l.w(`Image with ID: "${n}" was not found`),ci(a)&&this.updateImage(n,a)}}cloneImages(){const t={};for(const n in this.images){const a=this.images[n];t[n]=Object.assign(Object.assign({},a),{data:a.data?a.data.clone():null})}return t}}const gr=1e20;function Vn(d,t,n,a,c,p,m,_,v){for(let b=t;b<t+a;b++)$r(d,n*p+b,p,c,m,_,v);for(let b=n;b<n+c;b++)$r(d,b*p+t,1,a,m,_,v)}function $r(d,t,n,a,c,p,m){p[0]=0,m[0]=-gr,m[1]=gr,c[0]=d[t];for(let _=1,v=0,b=0;_<a;_++){c[_]=d[t+_*n];const T=_*_;do{const A=p[v];b=(c[_]-c[A]+T-A*A)/(_-A)/2}while(b<=m[v]&&--v>-1);v++,p[v]=_,m[v]=b,m[v+1]=gr}for(let _=0,v=0;_<a;_++){for(;m[v+1]<_;)v++;const b=p[v],T=_-b;d[t+_*n]=c[b]+T*T}}const Ir=l.v.layout_symbol["text-font"].default.join(",");class _i{constructor(t,n,a){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=a}setURL(t){this.url=t}getGlyphs(t){return l._(this,void 0,void 0,(function*(){const n=[];for(const p in t)for(const m of t[p])n.push(this._getAndCacheGlyphsPromise(p,m));const a=yield Promise.all(n),c={};for(const{stack:p,id:m,glyph:_}of a)c[p]||(c[p]={}),c[p][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return c}))}_getAndCacheGlyphsPromise(t,n){return l._(this,void 0,void 0,(function*(){let a=this.entries[t];a||(a=this.entries[t]={glyphs:{},requests:{},ranges:{}});let c=a.glyphs[n];return c!==void 0?{stack:t,id:n,glyph:c}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(c=a.glyphs[n]=this._drawGlyph(a,t,n),{stack:t,id:n,glyph:c}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return l._(this,void 0,void 0,(function*(){const a=this.entries[t],c=Math.floor(n/256);if(a.ranges[c])return{stack:t,id:n,glyph:null};if(!a.requests[c]){const p=_i.loadGlyphRange(t,c,this.url,this.requestManager);a.requests[c]=p}try{const p=yield a.requests[c];for(const m in p)a.glyphs[+m]=p[+m];return a.ranges[c]=!0,{stack:t,id:n,glyph:p[n]||null}}catch(p){const m=a.glyphs[n]=this._drawGlyph(a,t,n);return this._warnOnMissingGlyphRange(m,c,n,p),{stack:t,id:n,glyph:m}}}))}_warnOnMissingGlyphRange(t,n,a,c){const p=256*n,m=p+255,_=a.toString(16).padStart(4,"0").toUpperCase();l.w(`Unable to load glyph range ${n}, ${p}-${m}. Rendering codepoint U+${_} locally instead. ${c}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&l.q(t)}_drawGlyph(t,n,a){const c=n===Ir&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(a),p=c?"ideographTinySDF":"tinySDF";t[p]||(t[p]=this._createTinySDF(c?this.localIdeographFontFamily:n));const m=t[p].draw(String.fromCodePoint(a)),_=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(a));return{id:a,bitmap:new l.r({width:m.width||60,height:m.height||60},m.data),metrics:{width:_?0:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:_?0:m.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const a=n.map((c=>/[-\w]+/.test(c)?c:`'${CSS.escape(c)}'`)).join(",");return new _i.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let a;for(const[c,p]of Object.entries(n))new RegExp(`\\b${c}\\b`,"i").test(t)&&(a=`${p}`);return a}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}_i.loadGlyphRange=function(d,t,n,a){return l._(this,void 0,void 0,(function*(){const c=256*t,p=c+255,m=a.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${c}-${p}`),"Glyphs"),_=yield l.n(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${t}, ${c}-${p}`);const v={};for(const b of l.o(_.data))v[b.id]=b;return v}))},_i.TinySDF=class{constructor({fontSize:d=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal",lang:_=null}={}){this.buffer=t,this.cutoff=a,this.radius=n,this.lang=_;const v=this.size=d+4*t,b=this._createCanvas(v),T=this.ctx=b.getContext("2d",{willReadFrequently:!0});T.font=`${m} ${p} ${d}px ${c}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(v*v),this.gridInner=new Float64Array(v*v),this.f=new Float64Array(v),this.z=new Float64Array(v+1),this.v=new Uint16Array(v)}_createCanvas(d){const t=document.createElement("canvas");return t.width=t.height=d,t}draw(d){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(d),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),v=Math.min(this.size-this.buffer,m+Math.ceil(a)),b=_+2*this.buffer,T=v+2*this.buffer,A=Math.max(b*T,0),C=new Uint8ClampedArray(A),D={data:C,width:b,height:T,glyphWidth:_,glyphHeight:v,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||v===0)return D;const{ctx:V,buffer:q,gridInner:W,gridOuter:Z}=this;this.lang&&(V.lang=this.lang),V.clearRect(q,q,_,v),V.fillText(d,q,q+m);const K=V.getImageData(q,q,_,v);Z.fill(gr,0,A),W.fill(0,0,A);for(let ie=0;ie<v;ie++)for(let H=0;H<_;H++){const ee=K.data[4*(ie*_+H)+3]/255;if(ee===0)continue;const ne=(ie+q)*b+H+q;if(ee===1)Z[ne]=0,W[ne]=gr;else{const Q=.5-ee;Z[ne]=Q>0?Q*Q:0,W[ne]=Q<0?Q*Q:0}}Vn(Z,0,0,b,T,b,this.f,this.v,this.z),Vn(W,q,q,_,v,b,this.f,this.v,this.z);for(let ie=0;ie<A;ie++){const H=Math.sqrt(Z[ie])-Math.sqrt(W[ie]);C[ie]=Math.round(255-255*(H/this.radius+this.cutoff))}return D}};class qr{constructor(){this.specification=l.u.light.position}possiblyEvaluate(t,n){return l.F(t.expression.evaluate(n))}interpolate(t,n,a){return{x:l.G.number(t.x,n.x,a),y:l.G.number(t.y,n.y,a),z:l.G.number(t.z,n.z,a)}}}let ht;class _n extends l.E{constructor(t){super(),ht=ht||new l.t({anchor:new l.D(l.u.light.anchor),position:new qr,color:new l.D(l.u.light.color),intensity:new l.D(l.u.light.intensity)}),this._transitionable=new l.x(ht,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.y,t,n))for(const a in t){const c=t[a];a.endsWith(l.z)?this._transitionable.setTransition(a.slice(0,-l.z.length),c):this._transitionable.setValue(a,c)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&l.B(this,t.call(l.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.u}))}}const Er=new l.t({"sky-color":new l.D(l.u.sky["sky-color"]),"horizon-color":new l.D(l.u.sky["horizon-color"]),"fog-color":new l.D(l.u.sky["fog-color"]),"fog-ground-blend":new l.D(l.u.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.u.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.u.sky["atmosphere-blend"])});class Zr extends l.E{constructor(t){super(),this._transitionable=new l.x(Er,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.H(0))}setSky(t,n={}){if(!this._validate(l.J,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in t){const c=t[a];a.endsWith(l.z)?this._transitionable.setTransition(a.slice(0,-l.z.length),c):this._transitionable.setValue(a,c)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a={}){return a?.validate!==!1&&l.B(this,t.call(l.C,l.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class _r{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const c=[];let p=t.length%2==1?-t[t.length-1]*a:0,m=t[0]*a,_=!0;c.push({left:p,right:m,isDash:_,zeroLength:t[0]===0});let v=t[0];for(let b=1;b<t.length;b++){_=!_;const T=t[b];p=v*a,v+=T,m=v*a,c.push({left:p,right:m,isDash:_,zeroLength:T===0})}return c}addRoundDash(t,n,a){const c=n/2;for(let p=-a;p<=a;p++){const m=this.width*(this.nextRow+a+p);let _=0,v=t[_];for(let b=0;b<this.width;b++){b/v.right>1&&(v=t[++_]);const T=Math.abs(b-v.left),A=Math.abs(b-v.right),C=Math.min(T,A);let D;const V=p/a*(c+1);if(v.isDash){const q=c-Math.abs(V);D=Math.sqrt(C*C+q*q)}else D=c-Math.sqrt(C*C+V*V);this.data[m+b]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const v=t[_],b=t[_+1];v.zeroLength?t.splice(_,1):b&&b.isDash===v.isDash&&(b.left=v.left,t.splice(_,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++p]);const v=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(v,b);this.data[c+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return l.w("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,v=this.getDashRanges(t,this.width,_);n?this.addRoundDash(v,_,a):this.addRegularDash(v)}const m={y:this.nextRow+a,height:2*a,width:p};return this.nextRow+=c,this.dirty=!0,m}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const Wr="maplibre_preloaded_worker_pool";class ti{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ti.workerCount;)this.workers.push(new Worker(l.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Wr]}numActive(){return Object.keys(this.active).length}}const Ni=Math.floor(Ze.hardwareConcurrency/2);let lr,yi;function Hr(){return lr||(lr=new ti),lr}ti.workerCount=l.K(globalThis)?Math.max(Math.min(Ni,3),1):1;class cr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const a=this.workerPool.acquire(n);for(let c=0;c<a.length;c++){const p=new l.L(a[c],n);p.name=`Worker ${c}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const a=[];for(const c of this.actors)a.push(c.sendAsync({type:t,data:n}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const a of this.actors)a.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function yn(){return yi||(yi=new cr(Hr(),l.M),yi.registerMessageHandler("GR",((d,t,n)=>l.m(t,n)))),yi}function Ji(d,t){const n=l.N();return l.O(n,n,[1,1,0]),l.Q(n,n,[.5*d.width,.5*d.height,1]),d.calculatePosMatrix?l.S(n,n,d.calculatePosMatrix(t.toUnwrapped())):n}function vn(d,t,n,a,c,p,m){var _;const v=(function(C,D,V){if(C)for(const q of C){const W=D[q];if(W&&W.source===V&&W.type==="fill-extrusion")return!0}else for(const q in D){const W=D[q];if(W.source===V&&W.type==="fill-extrusion")return!0}return!1})((_=c?.layers)!==null&&_!==void 0?_:null,t,d.id),b=p.maxPitchScaleFactor(),T=d.tilesIn(a,b,v);T.sort(vi);const A=[];for(const C of T)A.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(t,n,d.getState(),C.queryGeometry,C.cameraQueryGeometry,C.scale,c,p,b,Ji(p,C.tileID),m?(D,V)=>m(C.tileID,D,V):void 0)});return(function(C,D){for(const V in C)for(const q of C[V])yr(q,D);return C})((function(C){const D={},V={};for(const q of C){const W=q.queryResults,Z=q.wrappedTileID,K=V[Z]=V[Z]||{};for(const ie in W){const H=W[ie],ee=K[ie]=K[ie]||{},ne=D[ie]=D[ie]||[];for(const Q of H)ee[Q.featureIndex]||(ee[Q.featureIndex]=!0,ne.push(Q))}}return D})(A),d)}function vi(d,t){const n=d.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function yr(d,t){const n=d.feature,a=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a}function Xr(d,t,n){return l._(this,void 0,void 0,(function*(){let a=d;if(d.url?a=(yield l.j(t.transformRequest(d.url,"Source"),n)).data:yield Ze.frameAsync(n),!a)return null;const c=l.U(l.e(a,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(c.vectorLayerIds=a.vector_layers.map((p=>p.id))),c}))}class Wt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?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 l.V?new l.V(t.lng,t.lat):l.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof l.V?new l.V(t.lng,t.lat):l.V.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,p;if(t instanceof l.V)c=t,p=t;else{if(!(t instanceof Wt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Wt.convert(t)):this.extend(l.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(l.V.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new l.V(c.lng,c.lat),this._ne=new l.V(p.lng,p.lat)),this}getCenter(){return new l.V((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 l.V(this.getWest(),this.getNorth())}getSouthEast(){return new l.V(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:n,lat:a}=l.V.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}intersects(t){if(!((t=Wt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),a=Math.abs(t.getEast()-t.getWest());if(n>=360||a>=360)return!0;const c=l.W(this.getWest(),-180,180),p=l.W(this.getEast(),-180,180),m=l.W(t.getWest(),-180,180),_=l.W(t.getEast(),-180,180),v=c>=p,b=m>=_;return!(!v||!b)||(v?_>=c||m<=p:b?p>=m||c<=_:m<=p&&_>=c)}static convert(t){return t instanceof Wt?t:t&&new Wt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new Wt(new l.V(t.lng-c,t.lat-a),new l.V(t.lng+c,t.lat+a))}adjustAntiMeridian(){const t=new l.V(this._sw.lng,this._sw.lat),n=new l.V(this._ne.lng,this._ne.lat);return new Wt(t,t.lng>n.lng?new l.V(n.lng+360,n.lat):n)}}class xn{constructor(t,n,a){this.bounds=Wt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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(t){const n=Math.pow(2,t.z),a=Math.floor(l.Y(this.bounds.getWest())*n),c=Math.floor(l.X(this.bounds.getNorth())*n),p=Math.ceil(l.Y(this.bounds.getEast())*n),m=Math.ceil(l.X(this.bounds.getSouth())*n);return t.x>=a&&t.x<p&&t.y>=c&&t.y<m}}class Nn extends l.E{constructor(t,n,a,c){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=l.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(c)}load(){return l._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new l.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Xr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(l.e(this,t),t.bounds&&(this.tileBounds=new xn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new l.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,l.Z(t)||this.fire(new l.k(t))}}))}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(t){return l._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(t)};a.request.collectResourceTiming=this._collectResourceTiming;let c="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((p,m)=>{t.reloadPromise={resolve:p,reject:m}}))}else t.actor=this.dispatcher.getActor(),c="LT";t.abortController=new AbortController;try{const p=yield t.actor.sendAsync({type:c,data:a},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,p)}catch(p){if(delete t.abortController,t.aborted)return;if(p&&p.status!==404)throw p;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,a=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:this.map._requestManager.transformRequest(a,"Tile")}}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class ps extends l.E{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},n),l.e(this,l.U(n,["url","scheme","tileSize"]))}load(){return l._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new l.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Xr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,n&&(l.e(this,n),n.bounds&&(this.tileBounds=new xn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,l.Z(n)||this.fire(new l.k(n))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return l.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return l._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const a=yield Ii.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const c=this.map.painter.context,p=c.gl,m=a.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new l.T(c,m,p.RGBA,{useMipmap:!0}),t.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class bn extends ps{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return l._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const c=yield Ii.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c&&c.data){const p=c.data;this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const m=l.b(p)&&l.$()?p:yield this.readImageNow(p),_={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const v=yield t.actor.sendAsync({type:"LDT",data:_});t.dem=v,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(c){if(delete t.abortController,t.aborted)t.state="unloaded";else if(c)throw t.state="errored",c}}))}readImageNow(t){return l._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&l.a0()){const n=t.width+2,a=t.height+2;try{return new l.R({width:n,height:a},yield l.a1(t,-1,-1,n,a))}catch{}}return Ze.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,_=n.x+1===a?t.wrap+1:t.wrap,v={};return v[new l.a2(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},v[new l.a2(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(v[new l.a2(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},v[new l.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},v[new l.a2(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<a&&(v[new l.a2(t.overscaledZ,p,n.z,c,n.y+1).key]={backfilled:!1},v[new l.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},v[new l.a2(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),v}unloadTile(t){return l._(this,void 0,void 0,(function*(){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&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Cr(d){return d.type==="GeometryCollection"?d.geometries.map((t=>t.coordinates)).flat(1/0):d.coordinates.flat(1/0)}function fs(d){const t=new Wt;let n;switch(d.type){case"FeatureCollection":n=d.features.map((a=>Cr(a.geometry))).flat(1/0);break;case"Feature":n=Cr(d.geometry);break;default:n=Cr(d)}if(n.length==0)return t;for(let a=0;a<n.length-1;a+=2)t.extend([n[a],n[a+1]]);return t}class ms extends l.E{constructor(t,n,a,c){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=a.getActor(),this.setEventedParent(c),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=l.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:l.a5,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.a5,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(l.a5/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||l.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return l._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const a=this._updateWorkerData();return n?a:this}updateData(t,n){this._pendingWorkerUpdate.diff=l.a6(this._pendingWorkerUpdate.diff,t);const a=this._updateWorkerData();return n?a:this}getData(){return l._(this,void 0,void 0,(function*(){const t=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getBounds(){return l._(this,void 0,void 0,(function*(){return fs(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:a}})}_updateWorkerData(){return l._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void l.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n}=this._pendingWorkerUpdate,a=l.e({type:this.type},this.workerOptions);t!==void 0?(typeof t=="string"?(a.request=this.map._requestManager.transformRequest(Ze.resolveURL(t),"Source"),a.request.collectResourceTiming=this._collectResourceTiming):a.data=t,this._pendingWorkerUpdate.data=void 0):n&&(a.dataDiff=n,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new l.l("dataloading",{dataType:"source"}));try{const c=yield this.actor.sendAsync({type:"LD",data:a});if(this._isUpdatingWorker=!1,this._removed||c.abandoned)return void this.fire(new l.l("dataabort",{dataType:"source"}));c.data&&(this._data={geojson:c.data});const p=this._applyDiffToSource(n),m=this._getShouldReloadTileOptions(p);let _=null;c.resourceTiming&&c.resourceTiming[this.id]&&(_=c.resourceTiming[this.id].slice(0));const v={dataType:"source"};this._collectResourceTiming&&_&&_.length>0&&l.e(v,{resourceTiming:_}),this.fire(new l.l("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new l.l("data",Object.assign(Object.assign({},v),{sourceDataType:"content",shouldReloadTileOptions:m})))}catch(c){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new l.l("dataabort",{dataType:"source"}));this.fire(new l.k(c))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const c=l.a7(this._data.geojson,n);if(!c)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:c}}if(!this._data.updateable)return;const a=l.a8(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:a}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>fs(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:a,extent:c}=this.workerOptions.geojsonVtOptions,p=(function({x:m,y:_,z:v},b=0){const T=l.a3((m-b)/Math.pow(2,v)),A=l.a4((_+1+b)/Math.pow(2,v)),C=l.a3((m+1+b)/Math.pow(2,v)),D=l.a4((_-b)/Math.pow(2,v));return new Wt([T,A],[C,D])})(t.tileID.canonical,a/c);for(const m of n)if(p.intersects(m))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return l._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const a={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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const c=yield this.actor.sendAsync({type:n,data:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(c,this.map.painter,n==="RT")}))}abortTile(t){return l._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return l._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Qi extends l.E{constructor(t,n,a,c){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t){return l._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new l.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ii.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,l.Z(n)||this.fire(new l.k(n))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(l.a9.fromLngLat);var a;return this.tileID=(function(c){const p=l.aa.fromPoints(c),m=p.width(),_=p.height(),v=Math.max(m,_),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),T=Math.pow(2,b);return new l.ac(b,Math.floor((p.minX+p.maxX)/2*T),Math.floor((p.minY+p.maxY)/2*T))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((c=>this.tileID.getTilePoint(c)._round())),this.flippedWindingOrder=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new l.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new l.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new l.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return l._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:a,maxX:c,maxY:p}=l.aa.fromPoints(t),m={};for(let _=0;_<=l.ab;_++){const v=Math.pow(2,_),b=Math.floor(n*v),T=Math.floor(a*v),A=Math.floor(c*v),C=Math.floor(p*v),D=(b%v+v)%v,V=A%v,q=Math.floor(b/v),W=Math.floor(A/v);m[_]={minWrap:q,maxWrap:W,minTileXWrapped:D,maxTileXWrapped:V,minTileY:T,maxTileY:C}}return m}}class ue extends Qi{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){return l._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield l.ad(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new l.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.k(new l.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new l.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new l.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class j extends Qi{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((p=>!Array.isArray(p)||p.length!==2||p.some((m=>typeof m!="number"))))||this.fire(new l.k(new l.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.k(new l.ae(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.k(new l.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.k(new l.ae(`sources.${t}`,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 l.k(new l.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return l._(this,void 0,void 0,(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 l.k(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 t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new l.T(n,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new l.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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 O={},G=d=>{switch(d){case"geojson":return ms;case"image":return Qi;case"raster":return ps;case"raster-dem":return bn;case"vector":return Nn;case"video":return ue;case"canvas":return j}return O[d]},re="RTLPluginLoaded";class se extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=yn()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return l._(this,arguments,void 0,(function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ze.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return l._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.l(re))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let pe=null;function ce(){return pe||(pe=new se),pe}var ae,xe;(function(d){d[d.Base=0]="Base",d[d.Parent=1]="Parent"})(ae||(ae={})),(function(d){d[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming"})(xe||(xe={}));class Ce{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=l.af(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:a,fadeEndTime:c}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=a,this.fadeEndTime=c}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=Xe(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(c,p){const m={};if(!p)return m;for(const _ of c){const v=_.layerIds.map((b=>p.getLayer(b))).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map((b=>v.filter((T=>T.id===b))[0])));for(const b of v)m[b.id]=_}}return m})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.ah){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof l.ah&&p.hasRTLText){this.hasRTLText=!0,ce().lazyLoad();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new l.ag}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.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new l.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,_,v,b,T,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:v,params:_,queryPadding:this.queryPadding*b,getElevation:A},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c[l.ai]||c[p];if(!m)return;const _=l.aj(n?.filter,n?.globalState),{z:v,x:b,y:T}=this.tileID.canonical,A={z:v,x:b,y:T};for(let C=0;C<m.length;C++){const D=m.feature(C);if(_.needGeometry){const W=l.ak(D,!0);if(!_.filter(new l.H(this.tileID.overscaledZ),W,this.tileID.canonical))continue}else if(!_.filter(new l.H(this.tileID.overscaledZ),D))continue;const V=a.getId(D,p),q=new l.al(D,v,b,T,V);q.tile=A,t.push(q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=l.am(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let c=!1;if(this.expirationTime>a)c=!1;else if(n)if(this.expirationTime<n)c=!0;else{const p=this.expirationTime-n;p?this.expirationTime=a+Math.max(p,3e4):c=!0}else c=!0;c?(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,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const c in this.buckets){if(!n.style.hasLayer(c))continue;const p=this.buckets[c],m=p.layers[0].sourceLayer||l.ai,_=a[m],v=t[m];if(!_||!v||Object.keys(v).length===0)continue;p.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const b=n&&n.style&&n.style.getLayer(c);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(p)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Xe()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=Xe()+t}setDependencies(t,n){const a={};for(const c of n)a[c]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const c=this.dependencies[a];if(c){for(const p of n)if(c[p])return!0}}return!1}}class Pe{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},l.e(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=l.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),l.e(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const _ of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][_];p[m]=this.state[c][m]}a[c]=a[c]||{},l.e(a[c],p)}this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0&&t.setFeatureState(a,n)}}const Ne=89.25;function We(d,t){const n=l.an(t.lat,-l.ao,l.ao);return new l.P(l.Y(t.lng)*d,l.X(n)*d)}function et(d,t){return new l.a9(t.x/d,t.y/d).toLngLat()}function St(d){return d.cameraToCenterDistance*Math.min(.85*Math.tan(l.ap(90-d.pitch)),Math.tan(l.ap(Ne-d.pitch)))}function gt(d,t){const n=d.canonical,a=t/l.aq(n.z),c=n.x+Math.pow(2,n.z)*d.wrap,p=l.ar(new Float64Array(16));return l.O(p,p,[c*a,n.y*a,0]),l.Q(p,p,[a/l.a5,a/l.a5,1]),p}function me(d,t,n,a,c){const p=l.a9.fromLngLat(d,t),m=c*l.as(1,d.lat),{x:_,y:v,z:b}=Mt(n,a);return new l.a9(p.x+m*-_,p.y+m*-v,p.z+m*-b)}function Mt(d,t){const n=l.ap(d),a=l.ap(t),c=Math.cos(-n),p=Math.sin(n);return{x:p*Math.sin(a),y:-p*Math.cos(a),z:c}}function Ei(d,t,n){const a=t.intersectsFrustum(d);if(!n||a===0)return a;const c=t.intersectsPlane(n);return c===0?0:a===2&&c===2?2:1}function tt(d,t,n){let a=0;const c=(n-t)/10;for(let p=0;p<10;p++)a+=c*Math.pow(Math.cos(t+(p+.5)/10*(n-t)),d);return a}function wt(d,t){return function(n,a,c,p,m){const _=2*((d-1)/l.at(Math.cos(l.ap(Ne-m))/Math.cos(l.ap(Ne)))-1),v=Math.acos(c/p),b=2*tt(_-1,0,l.ap(m/2)),T=Math.min(l.ap(Ne),v+l.ap(m/2)),A=tt(_-1,Math.min(T,v-l.ap(m/2)),T),C=Math.atan(a/c),D=Math.hypot(a,c);let V=n;return V+=l.at(p/D/Math.max(.5,Math.cos(l.ap(m/2)))),V+=_*l.at(Math.cos(C))/2,V-=l.at(Math.max(1,A/b/t))/2,V}}const Ci=wt(9.314,3);function Lt(d,t){const n=(t.roundZoom?Math.round:Math.floor)(d.zoom+l.at(d.tileSize/t.tileSize));return Math.max(0,n)}function Ht(d,t){const n=d.getCameraFrustum(),a=d.getClippingPlane(),c=d.screenPointToMercatorCoordinate(d.getCameraPoint()),p=l.a9.fromLngLat(d.center,d.elevation);c.z=p.z+Math.cos(d.pitchInRadians)*d.cameraToCenterDistance/d.worldSize;const m=d.getCoveringTilesDetailsProvider(),_=m.allowVariableZoom(d,t),v=Lt(d,t),b=t.minzoom||0,T=t.maxzoom!==void 0?t.maxzoom:d.maxZoom,A=Math.min(Math.max(0,v),T),C=Math.pow(2,A),D=[C*c.x,C*c.y,0],V=[C*p.x,C*p.y,0],q=Math.hypot(p.x-c.x,p.y-c.y),W=Math.abs(p.z-c.z),Z=Math.hypot(q,W),K=ee=>({zoom:0,x:0,y:0,wrap:ee,fullyVisible:!1}),ie=[],H=[];if(d.renderWorldCopies&&m.allowWorldCopies())for(let ee=1;ee<=3;ee++)ie.push(K(-ee)),ie.push(K(ee));for(ie.push(K(0));ie.length>0;){const ee=ie.pop(),ne=ee.x,Q=ee.y;let oe=ee.fullyVisible;const be={x:ne,y:Q,z:ee.zoom},fe=m.getTileBoundingVolume(be,ee.wrap,d.elevation,t);if(!oe){const ke=Ei(n,fe,a);if(ke===0)continue;oe=ke===2}const ge=m.distanceToTile2d(c.x,c.y,be,fe);let ye=v;_&&(ye=(t.calculateTileZoom||Ci)(d.zoom+l.at(d.tileSize/t.tileSize),ge,W,Z,d.fov)),ye=(t.roundZoom?Math.round:Math.floor)(ye),ye=Math.max(0,ye);const ze=Math.min(ye,T);if(ee.wrap=m.getWrap(p,be,ee.wrap),ee.zoom>=ze){if(ee.zoom<b)continue;const ke=A-ee.zoom,Ie=D[0]-.5-(ne<<ke),Fe=D[1]-.5-(Q<<ke),it=t.reparseOverscaled?Math.max(ee.zoom,ye):ee.zoom;H.push({tileID:new l.a2(ee.zoom===T?it:ee.zoom,ee.wrap,ee.zoom,ne,Q),distanceSq:l.au([V[0]-.5-ne,V[1]-.5-Q]),tileDistanceToCamera:Math.sqrt(Ie*Ie+Fe*Fe)})}else for(let ke=0;ke<4;ke++)ie.push({zoom:ee.zoom+1,x:(ne<<1)+ke%2,y:(Q<<1)+(ke>>1),wrap:ee.wrap,fullyVisible:oe})}return H.sort(((ee,ne)=>ee.distanceSq-ne.distanceSq)).map((ee=>ee.tileID))}const It=l.aa.fromPoints([new l.P(0,0),new l.P(l.a5,l.a5)]);function ui(d){return d==="raster"||d==="image"||d==="video"}function Xs(d,t,n,a,c,p,m){if(!t.hasData())return!1;const{tileID:_,fadingRole:v,fadingDirection:b,fadingParentID:T}=t;if(v===ae.Base&&b===xe.Incoming&&T)return n[T.key]=T,!0;const A=Math.max(_.overscaledZ-c,p);for(let C=_.overscaledZ-1;C>=A;C--){const D=_.scaledTo(C),V=d.getLoadedTile(D);if(V)return t.setCrossFadeLogic({fadingRole:ae.Base,fadingDirection:xe.Incoming,fadingParentID:V.tileID,fadeEndTime:a+m}),V.setCrossFadeLogic({fadingRole:ae.Parent,fadingDirection:xe.Departing,fadeEndTime:a+m}),n[D.key]=D,!0}return!1}function Ys(d,t,n,a,c,p){if(!t.hasData())return!1;const m=t.tileID.children(c);let _=Ae(d,t,m,n,a,c,p);if(_)return!0;for(const v of m)Ae(d,t,v.children(c),n,a,c,p)&&(_=!0);return _}function Ae(d,t,n,a,c,p,m){if(n[0].overscaledZ>=p)return!1;let _=!1;for(const v of n){const b=d.getLoadedTile(v);if(!b)continue;const{fadingRole:T,fadingDirection:A,fadingParentID:C}=b;T===ae.Base&&A===xe.Departing&&C||(b.setCrossFadeLogic({fadingRole:ae.Base,fadingDirection:xe.Departing,fadingParentID:t.tileID,fadeEndTime:c+m}),t.setCrossFadeLogic({fadingRole:ae.Parent,fadingDirection:xe.Incoming,fadeEndTime:c+m})),a[v.key]=v,_=!0}return _}function Ui(d,t,n,a){const c=d.tileID;return!!d.selfFading||!d.hasData()&&!!t.has(c)&&(d.setSelfFadeLogic(n+a),!0)}function Gi(d,t){var n;d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let a=t.tileID.canonical.x-d.tileID.canonical.x;const c=t.tileID.canonical.y-d.tileID.canonical.y,p=Math.pow(2,d.tileID.canonical.z),m=t.tileID.key;a===0&&c===0||Math.abs(c)>1||(Math.abs(a)>1&&(Math.abs(a+p)===1?a+=p:Math.abs(a-p)===1&&(a-=p)),t.dem&&d.dem&&(d.dem.backfillBorder(t.dem,a,c),!((n=d.neighboringTiles)===null||n===void 0)&&n[m]&&(d.neighboringTiles[m].backfilled=!0)))}class Wa{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const a in this._tiles){const c=this._tiles[a];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+t),n[c.tileID.key]=c}this._tiles=n}setFeatureState(t,n){for(const a in this._tiles)this._tiles[a].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(l.aw).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n?.hasData()?n:null}isIdRenderable(t,n=!1){var a;return(a=this.getTileById(t))===null||a===void 0?void 0:a.isRenderable(n)}getRenderableIds(t=0,n){const a=[];for(const c of this.getAllIds())this.isIdRenderable(c,n)&&a.push(this.getTileById(c));return n?a.sort(((c,p)=>{const m=c.tileID,_=p.tileID,v=new l.P(m.canonical.x,m.canonical.y)._rotate(-t),b=new l.P(_.canonical.x,_.canonical.y)._rotate(-t);return m.overscaledZ-_.overscaledZ||b.y-v.y||b.x-v.x})).map((c=>c.tileID.key)):a.map((c=>c.tileID)).sort(l.aw).map((c=>c.key))}}class vr extends l.E{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",(c=>this._dataHandler(c))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((c,p,m,_)=>{const v=new(G(p.type))(c,p,m,_);if(v.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${v.id}`);return v})(t,n,a,this),this._inViewTiles=new Wa,this._outOfViewCache=new l.ax(0,(c=>this._unloadTile(c))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Pe,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const n of this._inViewTiles.getAllTiles())n.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Wa}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}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,n,a){return l._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,a)}catch(c){t.state="errored",c.status!==404?this._source.fire(new l.k(c,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new l.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const a=this.getLoadedTile(t.scaledTo(n));if(a)return this._inViewTiles.isIdRenderable(a.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const a of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(a);n&&!this._source.shouldReloadTile(c,n)||(t?this._reloadTile(a,"expired"):c.state!=="errored"&&this._reloadTile(a,"reloading"))}}}_reloadTile(t,n){return l._(this,void 0,void 0,(function*(){const a=this._inViewTiles.getTileById(t);a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,t,n))}))}_tileLoaded(t,n,a){t.timeAdded=Xe(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&(function(c,p){var m,_;const v=p.getRenderableIds();for(const b of v){if(!c.neighboringTiles||!c.neighboringTiles[b])continue;const T=p.getTileById(b);c.neighboringTiles[b].backfilled||Gi(c,T),!((_=(m=T.neighboringTiles)===null||m===void 0?void 0:m[c.tileID.key])===null||_===void 0)&&_.backfilled||Gi(T,c)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.l("data",{dataType:"source",tile:t,coord:t.tileID}))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const a=this._getLoadedDescendents(n),c=new Set;for(const p of n){const m=a[p.key];if(!m?.length){c.add(p);continue}const _=p.overscaledZ+vr.maxOverzooming,v=m.filter((A=>A.tileID.overscaledZ<=_));if(!v.length){c.add(p);continue}const b=Math.min(...v.map((A=>A.tileID.overscaledZ))),T=v.filter((A=>A.tileID.overscaledZ===b)).map((A=>A.tileID));for(const A of T)t[A.key]=A;this._areDescendentsComplete(T,b,p.overscaledZ)||c.add(p)}return c}_getLoadedDescendents(t){var n;const a={};for(const c of this._inViewTiles.getAllTiles().filter((p=>p.hasData())))for(const p of t)c.tileID.isChildOf(p)&&(a[n=p.key]||(a[n]=[])).push(c);return a}_areDescendentsComplete(t,n,a){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-a)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?l.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._outOfViewCache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let a;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((v=>new l.a2(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y))):(a=Ht(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter((v=>this._source.hasTile(v))))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));const c=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,c&&this.fire(new l.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const p=Lt(t,this._source),m=this._updateRetainedTiles(a,p),_=ui(this._source.type);_&&this._rasterFadeDuration>0&&!n&&(function(v,b,T,A,C,D,V){const q=Xe(),W=l.av(b);for(const Z of b){const K=v.getTileById(Z.key);K.fadingDirection!==xe.Departing&&K.fadeOpacity!==0||K.resetFadeLogic(),Xs(v,K,T,q,A,C,V)||Ys(v,K,T,q,D,V)||Ui(K,W,q,V)||K.resetFadeLogic()}})(this._inViewTiles,a,m,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),_?this._cleanUpRasterTiles(m):this._cleanUpVectorTiles(m)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);t[n]?a.clearSymbolFadeHold():a.hasSymbolBuckets?a.holdingForSymbolFade()?a.symbolFadeFinished()&&this._removeTile(n):a.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const a of t)if(a.canonical.z>this._source.minzoom){const c=a.scaledTo(a.canonical.z-1);n.push(c);const p=a.scaledTo(Math.max(this._source.minzoom,Math.min(a.canonical.z,5)));n.push(p)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var a;const c=new Set;for(const b of t)this._addTile(b).hasData()||c.add(b);const p=t.reduce(((b,T)=>(b[T.key]=T,b)),{}),m=this._retainLoadedChildren(p,c),_={},v=Math.max(n-vr.maxUnderzooming,this._source.minzoom);for(const b of m){let T=this._inViewTiles.getTileById(b.key),A=T?.wasRequested();for(let C=b.overscaledZ-1;C>=v;--C){const D=b.scaledTo(C);if(_[D.key])break;if(_[D.key]=!0,T=this.getTile(D),!T&&A&&(T=this._addTile(D)),T){const V=T.hasData();if((V||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||A)&&(p[D.key]=D),A=T.wasRequested(),V)break}}}return p}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const a=n;return n||(n=new Ce(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),a||this._source.fire(new l.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),a))}_clearTileReloadTimer(t){const n=this._timers[t];n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||a.state=="errored")&&t.some((c=>c.equals(a.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=p.getCoveringTilesDetailsProvider().allowWorldCopies(),_=a?p.getCameraQueryGeometry(t):t,v=D=>p.screenPointToMercatorCoordinate(D,this.terrain),b=this.transformBbox(t,v,!m),T=this.transformBbox(_,v,!m),A=this.getIds(),C=l.aa.fromPoints(T);for(let D=0;D<A.length;D++){const V=this._inViewTiles.getTileById(A[D]);if(V.holdingForSymbolFade())continue;const q=m?[V.tileID]:[V.tileID.unwrapTo(-1),V.tileID.unwrapTo(0)],W=Math.pow(2,p.zoom-V.tileID.overscaledZ),Z=n*V.queryPadding*l.a5/V.tileSize/W;for(const K of q){const ie=C.map((H=>K.getTilePoint(new l.a9(H.x,H.y))));if(ie.expandBy(Z),ie.intersects(It)){const H=b.map((ne=>K.getTilePoint(ne))),ee=T.map((ne=>K.getTilePoint(ne)));c.push({tile:V,tileID:m?K:K.unwrapTo(0),queryGeometry:H,cameraQueryGeometry:ee,scale:W})}}}return c}transformBbox(t,n,a){let c=t.map(n);if(a){const p=l.aa.fromPoints(t);p.shrinkBy(.001*Math.min(p.width(),p.height()));const m=p.map(n);l.aa.fromPoints(c).covers(m)||(c=c.map((_=>_.x>.5?new l.a9(_.x-1,_.y,_.z):_)))}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((a=>this._inViewTiles.getTileById(a).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||!(!ui(this._source.type)||!(function(t,n){if(n<=0)return!1;const a=Xe();for(const c of t.getAllTiles())if(c.fadeEndTime>=a)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,a){this._state.updateState(t=t||l.ai,n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||l.ai,n,a)}getFeatureState(t,n){return this._state.getState(t=t||l.ai,n)}setDependencies(t,n,a){const c=this._inViewTiles.getTileById(t);c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(a).hasDependency(t,n)&&this._reloadTile(a,"reloading");this._outOfViewCache.filter((a=>!a.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}vr.maxUnderzooming=10,vr.maxOverzooming=3;class je{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.an(t,0,1);let n=1,a=this._distances[n];const c=t*this.paddedLength+this.padding;for(;a<c&&n<this._distances.length;)a=this._distances[++n];const p=n-1,m=this._distances[p],_=a-m,v=_>0?(c-m)/_:0;return this.points[p].mult(1-v).add(this.points[n].mult(v))}}function at(d,t){let n=!0;return d==="always"||d!=="never"&&t!=="never"||(n=!1),n}class ot{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;m<this.xCellCount*this.yCellCount;m++)c.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,c,p){this._forEachCell(n,a,c,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(p)}insertCircle(t,n,a,c){this._forEachCell(n-c,a-c,n+c,a+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(c)}_insertBoxCell(t,n,a,c,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,a,c,p,m){this.circleCells[p].push(m)}_query(t,n,a,c,p,m,_){if(a<0||t>this.width||c<0||n>this.height)return[];const v=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let b=0;b<this.boxKeys.length;b++)v.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],A=this.circles[3*b+1],C=this.circles[3*b+2];v.push({key:this.circleKeys[b],x1:T-C,y1:A-C,x2:T+C,y2:A+C})}}else this._forEachCell(t,n,a,c,this._queryCell,v,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},_);return v}query(t,n,a,c){return this._query(t,n,a,c,!1,null)}hitTest(t,n,a,c,p,m){return this._query(t,n,a,c,!0,p,m).length>0}hitTestCircle(t,n,a,c,p){const m=t-a,_=t+a,v=n-a,b=n+a;if(_<0||m>this.width||b<0||v>this.height)return!1;const T=[];return this._forEachCell(m,v,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,a,c,p,m,_,v){const{seenUids:b,hitTest:T,overlapMode:A}=_,C=this.boxCells[p];if(C!==null){const V=this.bboxes;for(const q of C)if(!b.box[q]){b.box[q]=!0;const W=4*q,Z=this.boxKeys[q];if(t<=V[W+2]&&n<=V[W+3]&&a>=V[W+0]&&c>=V[W+1]&&(!v||v(Z))&&(!T||!at(A,Z.overlapMode))&&(m.push({key:Z,x1:V[W],y1:V[W+1],x2:V[W+2],y2:V[W+3]}),T))return!0}}const D=this.circleCells[p];if(D!==null){const V=this.circles;for(const q of D)if(!b.circle[q]){b.circle[q]=!0;const W=3*q,Z=this.circleKeys[q];if(this._circleAndRectCollide(V[W],V[W+1],V[W+2],t,n,a,c)&&(!v||v(Z))&&(!T||!at(A,Z.overlapMode))){const K=V[W],ie=V[W+1],H=V[W+2];if(m.push({key:Z,x1:K-H,y1:ie-H,x2:K+H,y2:ie+H}),T)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,_,v){const{circle:b,seenUids:T,overlapMode:A}=_,C=this.boxCells[p];if(C!==null){const V=this.bboxes;for(const q of C)if(!T.box[q]){T.box[q]=!0;const W=4*q,Z=this.boxKeys[q];if(this._circleAndRectCollide(b.x,b.y,b.radius,V[W+0],V[W+1],V[W+2],V[W+3])&&(!v||v(Z))&&!at(A,Z.overlapMode))return m.push(!0),!0}}const D=this.circleCells[p];if(D!==null){const V=this.circles;for(const q of D)if(!T.circle[q]){T.circle[q]=!0;const W=3*q,Z=this.circleKeys[q];if(this._circlesCollide(V[W],V[W+1],V[W+2],b.x,b.y,b.radius)&&(!v||v(Z))&&!at(A,Z.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,_,v){const b=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),A=this._convertToXCellCoord(a),C=this._convertToYCellCoord(c);for(let D=b;D<=A;D++)for(let V=T;V<=C;V++)if(p.call(this,t,n,a,c,this.xCellCount*V+D,m,_,v))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,n,a,c,p,m){const _=c-t,v=p-n,b=a+m;return b*b>_*_+v*v}_circleAndRectCollide(t,n,a,c,p,m,_){const v=(m-c)/2,b=Math.abs(t-(c+v));if(b>v+a)return!1;const T=(_-p)/2,A=Math.abs(n-(p+T));if(A>T+a)return!1;if(b<=v||A<=T)return!0;const C=b-v,D=A-T;return C*C+D*D<=a*a}}function ur(d,t,n){const a=l.N();if(!d){const{vecSouth:A,vecEast:C}=sn(t),D=Oe();D[0]=C[0],D[1]=C[1],D[2]=A[0],D[3]=A[1],c=D,(T=(m=(p=D)[0])*(b=p[3])-(v=p[2])*(_=p[1]))&&(c[0]=b*(T=1/T),c[1]=-_*T,c[2]=-v*T,c[3]=m*T),a[0]=D[0],a[1]=D[1],a[4]=D[2],a[5]=D[3]}var c,p,m,_,v,b,T;return l.Q(a,a,[1/n,1/n,1]),a}function Ha(d,t,n,a){if(d){const c=l.N();if(!t){const{vecSouth:p,vecEast:m}=sn(n);c[0]=m[0],c[1]=m[1],c[4]=p[0],c[5]=p[1]}return l.Q(c,c,[a,a,1]),c}return n.pixelsToClipSpaceMatrix}function sn(d){const t=Math.cos(d.rollInRadians),n=Math.sin(d.rollInRadians),a=Math.cos(d.pitchInRadians),c=Math.cos(d.bearingInRadians),p=Math.sin(d.bearingInRadians),m=l.aC();m[0]=-c*a*n-p*t,m[1]=-p*a*n+c*t;const _=l.aD(m);_<1e-9?l.aE(m):l.aF(m,m,1/_);const v=l.aC();v[0]=c*a*t-p*n,v[1]=p*a*t+c*n;const b=l.aD(v);return b<1e-9?l.aE(v):l.aF(v,v,1/b),{vecEast:v,vecSouth:m}}function nt(d,t,n,a){let c;a?(c=[d,t,a(d,t),1],l.aH(c,c,n)):(c=[d,t,0,1],Ka(c,c,n));const p=c[3];return{point:new l.P(c[0]/p,c[1]/p),signedDistanceFromCamera:p,isOccluded:!1}}function Ks(d,t){return .5+d/t*.5}function Js(d,t){return d.x>=-t[0]&&d.x<=t[0]&&d.y>=-t[1]&&d.y<=t[1]}function Xa(d,t,n,a,c,p,m,_,v,b,T,A,C){const D=n?d.textSizeData:d.iconSizeData,V=l.ay(D,t.transform.zoom),q=[256/t.width*2+1,256/t.height*2+1],W=n?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;W.clear();const Z=d.lineVertexArray,K=n?d.text.placedSymbolArray:d.icon.placedSymbolArray,ie=t.transform.width/t.transform.height;let H=!1;for(let ee=0;ee<K.length;ee++){const ne=K.get(ee);if(ne.hidden||ne.writingMode===l.az.vertical&&!H){Gn(ne.numGlyphs,W);continue}H=!1;const Q=new l.P(ne.anchorX,ne.anchorY),oe={getElevation:C,pitchedLabelPlaneMatrix:a,lineVertexArray:Z,pitchWithMap:p,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:Q,unwrappedTileID:v,width:b,height:T,translation:A},be=ys(ne.anchorX,ne.anchorY,oe);if(!Js(be.point,q)){Gn(ne.numGlyphs,W);continue}const fe=Ks(t.transform.cameraToCenterDistance,be.signedDistanceFromCamera),ge=l.aA(D,V,ne),ye=p?ge*t.transform.getPitchedTextCorrection(ne.anchorX,ne.anchorY,v)/fe:ge*fe,ze=_s({projectionContext:oe,pitchedLabelPlaneMatrixInverse:c,symbol:ne,fontSize:ye,flip:!1,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:W,aspectRatio:ie,rotateToLine:_});H=ze.useVertical,(ze.notEnoughRoom||H||ze.needsFlipping&&_s({projectionContext:oe,pitchedLabelPlaneMatrixInverse:c,symbol:ne,fontSize:ye,flip:!0,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:W,aspectRatio:ie,rotateToLine:_}).notEnoughRoom)&&Gn(ne.numGlyphs,W)}n?d.text.dynamicLayoutVertexBuffer.updateData(W):d.icon.dynamicLayoutVertexBuffer.updateData(W)}function gs(d,t,n,a,c,p,m,_){const v=p.glyphStartIndex+p.numGlyphs,b=p.lineStartIndex,T=p.lineStartIndex+p.lineLength,A=t.getoffsetX(p.glyphStartIndex),C=t.getoffsetX(v-1),D=Ar(d*A,n,a,c,p.segment,b,T,_,m);if(!D)return null;const V=Ar(d*C,n,a,c,p.segment,b,T,_,m);return V?_.projectionCache.anyProjectionOccluded?null:{first:D,last:V}:null}function Qs(d,t,n,a){return d===l.az.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(d===l.az.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function _s(d){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:c,flip:p,keepUpright:m,glyphOffsetArray:_,dynamicLayoutVertexArray:v,aspectRatio:b,rotateToLine:T}=d,A=c/24,C=a.lineOffsetX*A,D=a.lineOffsetY*A;let V;if(a.numGlyphs>1){const q=a.glyphStartIndex+a.numGlyphs,W=a.lineStartIndex,Z=a.lineStartIndex+a.lineLength,K=gs(A,_,C,D,p,a,T,t);if(!K)return{notEnoughRoom:!0};const ie=Ya(K.first.point.x,K.first.point.y,t,n),H=Ya(K.last.point.x,K.last.point.y,t,n);if(m&&!p){const ee=Qs(a.writingMode,ie,H,b);if(ee)return ee}V=[K.first];for(let ee=a.glyphStartIndex+1;ee<q-1;ee++){const ne=Ar(A*_.getoffsetX(ee),C,D,p,a.segment,W,Z,t,T);if(!ne)return{notEnoughRoom:!0};V.push(ne)}V.push(K.last)}else{if(m&&!p){const W=Tt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,Z=a.lineStartIndex+a.segment+1,K=new l.P(t.lineVertexArray.getx(Z),t.lineVertexArray.gety(Z)),ie=Tt(K.x,K.y,t),H=ie.signedDistanceFromCamera>0?ie.point:ea(t.tileAnchorPoint,K,W,1,t),ee=Ya(W.x,W.y,t,n),ne=Ya(H.x,H.y,t,n),Q=Qs(a.writingMode,ee,ne,b);if(Q)return Q}const q=Ar(A*_.getoffsetX(a.glyphStartIndex),C,D,p,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,t,T);if(!q||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};V=[q]}for(const q of V)l.aG(v,q.point,q.angle);return{}}function ea(d,t,n,a,c){const p=d.add(d.sub(t)._unit()),m=Tt(p.x,p.y,c).point,_=n.sub(m);return n.add(_._mult(a/_.mag()))}function $i(d,t,n){const a=t.projectionCache;if(a.projections[d])return a.projections[d];const c=new l.P(t.lineVertexArray.getx(d),t.lineVertexArray.gety(d)),p=Tt(c.x,c.y,t);if(p.signedDistanceFromCamera>0)return a.projections[d]=p.point,a.anyProjectionOccluded=a.anyProjectionOccluded||p.isOccluded,p.point;const m=d-n.direction;return ea(n.distanceFromAnchor===0?t.tileAnchorPoint:new l.P(t.lineVertexArray.getx(m),t.lineVertexArray.gety(m)),c,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function Tt(d,t,n){const a=d+n.translation[0],c=t+n.translation[1];let p;return n.pitchWithMap?(p=nt(a,c,n.pitchedLabelPlaneMatrix,n.getElevation),p.isOccluded=!1):(p=n.transform.projectTileCoordinates(a,c,n.unwrappedTileID,n.getElevation),p.point.x=(.5*p.point.x+.5)*n.width,p.point.y=(.5*-p.point.y+.5)*n.height),p}function Ya(d,t,n,a){if(n.pitchWithMap){const c=[d,t,0,1];return l.aH(c,c,a),n.transform.projectTileCoordinates(c[0]/c[3],c[1]/c[3],n.unwrappedTileID,n.getElevation).point}return{x:d/n.width*2-1,y:1-t/n.height*2}}function ys(d,t,n){return n.transform.projectTileCoordinates(d,t,n.unwrappedTileID,n.getElevation)}function ta(d,t,n){return d._unit()._perp()._mult(t*n)}function Un(d,t,n,a,c,p,m,_,v){if(_.projectionCache.offsets[d])return _.projectionCache.offsets[d];const b=n.add(t);if(d+v.direction<a||d+v.direction>=c)return _.projectionCache.offsets[d]=b,b;const T=$i(d+v.direction,_,v),A=ta(T.sub(n),m,v.direction),C=n.add(A),D=T.add(A);return _.projectionCache.offsets[d]=l.aI(p,b,C,D)||b,_.projectionCache.offsets[d]}function Ar(d,t,n,a,c,p,m,_,v){const b=a?d-t:d+t;let T=b>0?1:-1,A=0;a&&(T*=-1,A=Math.PI),T<0&&(A+=Math.PI);let C,D=T>0?p+c:p+c+1;_.projectionCache.cachedAnchorPoint?C=_.projectionCache.cachedAnchorPoint:(C=Tt(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=C);let V,q,W=C,Z=C,K=0,ie=0;const H=Math.abs(b),ee=[];let ne;for(;K+ie<=H;){if(D+=T,D<p||D>=m)return null;K+=ie,Z=W,q=V;const be={absOffsetX:H,direction:T,distanceFromAnchor:K,previousVertex:Z};if(W=$i(D,_,be),n===0)ee.push(Z),ne=W.sub(Z);else{let fe;const ge=W.sub(Z);fe=ge.mag()===0?ta($i(D+T,_,be).sub(W),n,T):ta(ge,n,T),q||(q=Z.add(fe)),V=Un(D,fe,W,p,m,q,n,_,be),ee.push(q),ne=V.sub(q)}ie=ne.mag()}const Q=ne._mult((H-K)/ie)._add(q||Z),oe=A+Math.atan2(W.y-Z.y,W.x-Z.x);return ee.push(Q),{point:Q,angle:v?oe:0,path:ee}}const Sc=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Gn(d,t){for(let n=0;n<d;n++){const a=t.length;t.resize(a+4),t.float32.set(Sc,3*a)}}function Ka(d,t,n){const a=t[0],c=t[1];return d[0]=n[0]*a+n[4]*c+n[12],d[1]=n[1]*a+n[5]*c+n[13],d[3]=n[3]*a+n[7]*c+n[15],d}const Xt=100;class Pc{constructor(t,n=new ot(t.width+200,t.height+200,25),a=new ot(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Xt,this.screenBottomBoundary=t.height+Xt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,c,p,m,_,v,b,T,A,C){const D=this.projectAndGetPerspectiveRatio(t.anchorPointX+v[0],t.anchorPointY+v[1],p,T,C),V=a*D.perspectiveRatio;let q;if(m||_)q=this._projectCollisionBox(t,V,c,p,m,_,v,D,T,A,C);else{const ne=D.x+(A?A.x*V:0),Q=D.y+(A?A.y*V:0);q={allPointsOccluded:!1,box:[ne+t.x1*V,Q+t.y1*V,ne+t.x2*V,Q+t.y2*V]}}const[W,Z,K,ie]=q.box,H=m?q.allPointsOccluded:D.isOccluded;let ee=H;return ee||(ee=D.perspectiveRatio<this.perspectiveRatioCutoff),ee||(ee=!this.isInsideGrid(W,Z,K,ie)),ee||n!=="always"&&this.grid.hitTest(W,Z,K,ie,n,b)?{box:[W,Z,K,ie],placeable:!1,offscreen:!1,occluded:H}:{box:[W,Z,K,ie],placeable:!0,offscreen:this.isOffscreen(W,Z,K,ie),occluded:H}}placeCollisionCircles(t,n,a,c,p,m,_,v,b,T,A,C,D,V){const q=[],W=new l.P(n.anchorX,n.anchorY),Z=this.getPerspectiveRatio(W.x,W.y,m,V),K=(b?p*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,m)/Z:p*Z)/l.aM,ie={getElevation:V,pitchedLabelPlaneMatrix:_,lineVertexArray:a,pitchWithMap:b,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:W,unwrappedTileID:m,width:this.transform.width,height:this.transform.height,translation:D},H=gs(K,c,n.lineOffsetX*K,n.lineOffsetY*K,!1,n,!1,ie);let ee=!1,ne=!1,Q=!0;if(H){const oe=.5*A*Z+C,be=new l.P(-100,-100),fe=new l.P(this.screenRightBoundary,this.screenBottomBoundary),ge=new je,ye=H.first,ze=H.last;let ke=[];for(let it=ye.path.length-1;it>=1;it--)ke.push(ye.path[it]);for(let it=1;it<ze.path.length;it++)ke.push(ze.path[it]);const Ie=2.5*oe;if(b){const it=this.projectPathToScreenSpace(ke,ie);ke=it.some((bt=>bt.signedDistanceFromCamera<=0))?[]:it.map((bt=>bt.point))}let Fe=[];if(ke.length>0){const it=ke[0].clone(),bt=ke[0].clone();for(let Ft=1;Ft<ke.length;Ft++)it.x=Math.min(it.x,ke[Ft].x),it.y=Math.min(it.y,ke[Ft].y),bt.x=Math.max(bt.x,ke[Ft].x),bt.y=Math.max(bt.y,ke[Ft].y);Fe=it.x>=be.x&&bt.x<=fe.x&&it.y>=be.y&&bt.y<=fe.y?[ke]:bt.x<be.x||it.x>fe.x||bt.y<be.y||it.y>fe.y?[]:l.aJ([ke],be.x,be.y,fe.x,fe.y)}for(const it of Fe){ge.reset(it,.25*oe);let bt=0;bt=ge.length<=.5*oe?1:Math.ceil(ge.paddedLength/Ie)+1;for(let Ft=0;Ft<bt;Ft++){const At=Ft/Math.max(bt-1,1),Vt=ge.lerp(At),zt=Vt.x+Xt,Kt=Vt.y+Xt;q.push(zt,Kt,oe,0);const Nt=zt-oe,bi=Kt-oe,oi=zt+oe,si=Kt+oe;if(Q=Q&&this.isOffscreen(Nt,bi,oi,si),ne=ne||this.isInsideGrid(Nt,bi,oi,si),t!=="always"&&this.grid.hitTestCircle(zt,Kt,oe,t,T)&&(ee=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ee}}}}return{circles:!v&&ee||!ne||Z<this.perspectiveRatioCutoff?[]:q,offscreen:Q,collisionDetected:ee}}projectPathToScreenSpace(t,n){const a=(function(c,p){const m=l.N();return l.aB(m,p.pitchedLabelPlaneMatrix),c.map((_=>{const v=nt(_.x,_.y,m,p.getElevation),b=p.transform.projectTileCoordinates(v.point.x,v.point.y,p.unwrappedTileID,p.getElevation);return b.point.x=(.5*b.point.x+.5)*p.width,b.point.y=(.5*-b.point.y+.5)*p.height,b}))})(t,n);return(function(c){let p=0,m=0,_=0,v=0;for(let b=0;b<c.length;b++)c[b].isOccluded?(_=b+1,v=0):(v++,v>m&&(m=v,p=_));return c.slice(p,p+m)})(a)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],a=new l.aa;for(const A of t){const C=new l.P(A.x+Xt,A.y+Xt);a.extend(C),n.push(C)}const{minX:c,minY:p,maxX:m,maxY:_}=a,v=this.grid.query(c,p,m,_).concat(this.ignoredGrid.query(c,p,m,_)),b={},T={};for(const A of v){const C=A.key;if(b[C.bucketInstanceId]===void 0&&(b[C.bucketInstanceId]={}),b[C.bucketInstanceId][C.featureIndex])continue;const D=[new l.P(A.x1,A.y1),new l.P(A.x2,A.y1),new l.P(A.x2,A.y2),new l.P(A.x1,A.y2)];l.aK(n,D)&&(b[C.bucketInstanceId][C.featureIndex]=!0,T[C.bucketInstanceId]===void 0&&(T[C.bucketInstanceId]=[]),T[C.bucketInstanceId].push(C.featureIndex))}return T}insertCollisionBox(t,n,a,c,p,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,c,p,m){const _=a?this.ignoredGrid:this.grid,v={bucketInstanceId:c,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let b=0;b<t.length;b+=4)_.insertCircle(v,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,n,a,c,p){if(p){let m;c?(m=[t,n,c(t,n),1],l.aH(m,m,p)):(m=[t,n,0,1],Ka(m,m,p));const _=m[3];return{x:(m[0]/_+1)/2*this.transform.width+Xt,y:(-m[1]/_+1)/2*this.transform.height+Xt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const m=this.transform.projectTileCoordinates(t,n,a,c);return{x:(m.point.x+1)/2*this.transform.width+Xt,y:(1-m.point.y)/2*this.transform.height+Xt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,a,c){const p=this.transform.projectTileCoordinates(t,n,a,c);return .5+this.transform.cameraToCenterDistance/p.signedDistanceFromCamera*.5}isOffscreen(t,n,a,c){return a<Xt||t>=this.screenRightBoundary||c<Xt||n>this.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t<this.gridRightBoundary&&c>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.ar([]);return l.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,a,c,p,m,_,v,b,T,A){let C=1,D=0,V=0,q=1;const W=t.anchorPointX+_[0],Z=t.anchorPointY+_[1];if(m&&!p){const ke=this.projectAndGetPerspectiveRatio(W+1,Z,c,b,A),Ie=ke.x-v.x,Fe=Math.atan((ke.y-v.y)/Ie)+(Ie<0?Math.PI:0),it=Math.sin(Fe),bt=Math.cos(Fe);C=bt,D=it,V=-it,q=bt}else if(!m&&p){const ke=sn(this.transform);C=ke.vecEast[0],D=ke.vecEast[1],V=ke.vecSouth[0],q=ke.vecSouth[1]}let K=v.x,ie=v.y,H=n;p&&(K=W,ie=Z,H=Math.pow(2,-(this.transform.zoom-a.overscaledZ)),H*=this.transform.getPitchedTextCorrection(W,Z,c),T||(H*=l.an(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),T&&(K+=C*T.x*H+V*T.y*H,ie+=D*T.x*H+q*T.y*H);const ee=t.x1*H,ne=t.x2*H,Q=(ee+ne)/2,oe=t.y1*H,be=t.y2*H,fe=(oe+be)/2,ge=[{offsetX:ee,offsetY:oe},{offsetX:Q,offsetY:oe},{offsetX:ne,offsetY:oe},{offsetX:ne,offsetY:fe},{offsetX:ne,offsetY:be},{offsetX:Q,offsetY:be},{offsetX:ee,offsetY:be},{offsetX:ee,offsetY:fe}];let ye=[];for(const{offsetX:ke,offsetY:Ie}of ge)ye.push(new l.P(K+C*ke+V*Ie,ie+D*ke+q*Ie));let ze=!1;if(p){const ke=ye.map((Ie=>this.projectAndGetPerspectiveRatio(Ie.x,Ie.y,c,b,A)));ze=ke.some((Ie=>!Ie.isOccluded)),ye=ke.map((Ie=>new l.P(Ie.x,Ie.y)))}else ze=!0;return{box:l.aL(ye),allPointsOccluded:!ze}}}class Mc{constructor(t,n,a,c){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):c&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class ia{constructor(t,n,a,c,p){this.text=new Mc(t?t.text:null,n,a,p),this.icon=new Mc(t?t.icon:null,n,c,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ic{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class Ec{constructor(t,n,a,c,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=c,this.tileID=p}}class Cc{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function Ja(d,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=l.aS(d);return new l.P(-(p-.5)*t+a[0]*c,-(m-.5)*n+a[1]*c)}class sl{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Pc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Cc(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(a,c)=>n.getElevation(t,a,c):null}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=a.collisionBoxArray,v=p.layers[0].layout,b=p.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),A=a.tileSize/l.a5,C=a.tileID.toUnwrapped(),D=v.get("text-rotation-alignment")==="map",V=l.aN(a,1,this.transform.zoom),q=l.aO(this.collisionIndex.transform,a,b.get("text-translate"),b.get("text-translate-anchor")),W=l.aO(this.collisionIndex.transform,a,b.get("icon-translate"),b.get("icon-translate-anchor")),Z=ur(D,this.transform,V);this.retainedQueryData[p.bucketInstanceId]=new Ec(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const K={bucket:p,layout:v,translationText:q,translationIcon:W,unwrappedTileID:C,pitchedLabelPlaneMatrix:Z,scale:T,textPixelRatio:A,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:l.ay(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const ie of p.sortKeyRanges){const{sortKey:H,symbolInstanceStart:ee,symbolInstanceEnd:ne}=ie;t.push({sortKey:H,symbolInstanceStart:ee,symbolInstanceEnd:ne,parameters:K})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:K})}attemptAnchorPlacement(t,n,a,c,p,m,_,v,b,T,A,C,D,V,q,W,Z,K,ie,H){const ee=l.aP[t.textAnchor],ne=[t.textOffset0,t.textOffset1],Q=Ja(ee,a,c,ne,p),oe=this.collisionIndex.placeCollisionBox(n,C,v,b,T,_,m,W,A.predicate,ie,Q,H);if((!K||this.collisionIndex.placeCollisionBox(K,C,v,b,T,_,m,Z,A.predicate,ie,Q,H).placeable)&&oe.placeable){let be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID].text&&(be=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:ne,width:a,height:c,anchor:ee,textBoxScale:p,prevAnchor:be},this.markUsedJustification(V,ee,D,q),V.allowVerticalPlacement&&(this.markUsedOrientation(V,q,D),this.placedOrientations[D.crossTileID]=q),{shift:Q,placedGlyphBoxes:oe}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,translationText:m,translationIcon:_,unwrappedTileID:v,pitchedLabelPlaneMatrix:b,textPixelRatio:T,holdingForFade:A,collisionBoxArray:C,partiallyEvaluatedTextSize:D,collisionGroup:V}=t.parameters,q=p.get("text-optional"),W=p.get("icon-optional"),Z=l.aQ(p,"text-overlap","text-allow-overlap"),K=Z==="always",ie=l.aQ(p,"icon-overlap","icon-allow-overlap"),H=ie==="always",ee=p.get("text-rotation-alignment")==="map",ne=p.get("text-pitch-alignment")==="map",Q=p.get("icon-text-fit")!=="none",oe=p.get("symbol-z-order")==="viewport-y",be=K&&(H||!c.hasIconData()||W),fe=H&&(K||!c.hasTextData()||q);!c.collisionArrays&&C&&c.deserializeCollisionBoxes(C);const ge=this.retainedQueryData[c.bucketInstanceId].tileID,ye=this._getTerrainElevationFunc(ge),ze=this.transform.getFastPathSimpleProjectionMatrix(ge),ke=(Ie,Fe,it)=>{var bt,Ft;if(n[Ie.crossTileID])return;if(A)return void(this.placements[Ie.crossTileID]=new Ic(!1,!1,!1));let At=!1,Vt=!1,zt=!0,Kt=null,Nt={box:null,placeable:!1,offscreen:null,occluded:!1},bi={placeable:!1},oi=null,si=null,Ai=null,zn=0,ln=0,Jr=0;Fe.textFeatureIndex?zn=Fe.textFeatureIndex:Ie.useRuntimeCollisionCircles&&(zn=Ie.featureIndex),Fe.verticalTextFeatureIndex&&(ln=Fe.verticalTextFeatureIndex);const ir=Fe.textBox;if(ir){const Sr=Dt=>{let kt=l.az.horizontal;if(c.allowVerticalPlacement&&!Dt&&this.prevPlacement){const mi=this.prevPlacement.placedOrientations[Ie.crossTileID];mi&&(this.placedOrientations[Ie.crossTileID]=mi,kt=mi,this.markUsedOrientation(c,kt,Ie))}return kt},Qr=(Dt,kt)=>{if(c.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Fe.verticalTextBox){for(const mi of c.writingModes)if(mi===l.az.vertical?(Nt=kt(),bi=Nt):Nt=Dt(),Nt&&Nt.placeable)break}else Nt=Dt()},Fr=Ie.textAnchorOffsetStartIndex,Br=Ie.textAnchorOffsetEndIndex;if(Br===Fr){const Dt=(kt,mi)=>{const gi=this.collisionIndex.placeCollisionBox(kt,Z,T,ge,v,ne,ee,m,V.predicate,ye,void 0,ze);return gi&&gi.placeable&&(this.markUsedOrientation(c,mi,Ie),this.placedOrientations[Ie.crossTileID]=mi),gi};Qr((()=>Dt(ir,l.az.horizontal)),(()=>{const kt=Fe.verticalTextBox;return c.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&kt?Dt(kt,l.az.vertical):{box:null,offscreen:null}})),Sr(Nt&&Nt.placeable)}else{let Dt=l.aP[(Ft=(bt=this.prevPlacement)===null||bt===void 0?void 0:bt.variableOffsets[Ie.crossTileID])===null||Ft===void 0?void 0:Ft.anchor];const kt=(gi,Su,Pu)=>{const os=gi.x2-gi.x1,Dh=gi.y2-gi.y1,Mu=Ie.textBoxScale,Ql=Q&&ie==="never"?Su:null;let kn=null,Dn=Z==="never"?1:2,Rn="never";Dt&&Dn++;for(let ec=0;ec<Dn;ec++){for(let tc=Fr;tc<Br;tc++){const Fo=c.textAnchorOffsets.get(tc);if(Dt&&Fo.textAnchor!==Dt)continue;const Bo=this.attemptAnchorPlacement(Fo,gi,os,Dh,Mu,ee,ne,T,ge,v,V,Rn,Ie,c,Pu,m,_,Ql,ye);if(Bo&&(kn=Bo.placedGlyphBoxes,kn&&kn.placeable))return At=!0,Kt=Bo.shift,kn}Dt?Dt=null:Rn=Z}return a&&!kn&&(kn={box:this.collisionIndex.placeCollisionBox(ir,"always",T,ge,v,ne,ee,m,V.predicate,ye,void 0,ze).box,offscreen:!1,placeable:!1,occluded:!1}),kn};Qr((()=>kt(ir,Fe.iconBox,l.az.horizontal)),(()=>{const gi=Fe.verticalTextBox;return c.allowVerticalPlacement&&(!Nt||!Nt.placeable)&&Ie.numVerticalGlyphVertices>0&&gi?kt(gi,Fe.verticalIconBox,l.az.vertical):{box:null,occluded:!0,offscreen:null}})),Nt&&(At=Nt.placeable,zt=Nt.offscreen);const mi=Sr(Nt&&Nt.placeable);if(!At&&this.prevPlacement){const gi=this.prevPlacement.variableOffsets[Ie.crossTileID];gi&&(this.variableOffsets[Ie.crossTileID]=gi,this.markUsedJustification(c,gi.anchor,Ie,mi))}}}if(oi=Nt,At=oi&&oi.placeable,zt=oi&&oi.offscreen,Ie.useRuntimeCollisionCircles&&Ie.centerJustifiedTextSymbolIndex>=0){const Sr=c.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),Qr=l.aA(c.textSizeData,D,Sr),Fr=p.get("text-padding");si=this.collisionIndex.placeCollisionCircles(Z,Sr,c.lineVertexArray,c.glyphOffsetArray,Qr,v,b,a,ne,V.predicate,Ie.collisionCircleDiameter,Fr,m,ye),si.circles.length&&si.collisionDetected&&!a&&l.w("Collisions detected, but collision boxes are not shown"),At=K||si.circles.length>0&&!si.collisionDetected,zt=zt&&si.offscreen}if(Fe.iconFeatureIndex&&(Jr=Fe.iconFeatureIndex),Fe.iconBox){const Sr=Qr=>this.collisionIndex.placeCollisionBox(Qr,ie,T,ge,v,ne,ee,_,V.predicate,ye,Q&&Kt?Kt:void 0,ze);bi&&bi.placeable&&Fe.verticalIconBox?(Ai=Sr(Fe.verticalIconBox),Vt=Ai.placeable):(Ai=Sr(Fe.iconBox),Vt=Ai.placeable),zt=zt&&Ai.offscreen}const ss=q||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,Fa=W||Ie.numIconVertices===0;ss||Fa?Fa?ss||(Vt=Vt&&At):At=Vt&&At:Vt=At=Vt&&At;const as=Vt&&Ai.placeable;if(At&&oi.placeable&&this.collisionIndex.insertCollisionBox(oi.box,Z,p.get("text-ignore-placement"),c.bucketInstanceId,bi&&bi.placeable&&ln?ln:zn,V.ID),as&&this.collisionIndex.insertCollisionBox(Ai.box,ie,p.get("icon-ignore-placement"),c.bucketInstanceId,Jr,V.ID),si&&At&&this.collisionIndex.insertCollisionCircles(si.circles,Z,p.get("text-ignore-placement"),c.bucketInstanceId,zn,V.ID),a&&this.storeCollisionData(c.bucketInstanceId,it,Fe,oi,Ai,si),Ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(c.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ie.crossTileID]=new Ic((At||be)&&!oi?.occluded,(Vt||fe)&&!Ai?.occluded,zt||c.justReloaded),n[Ie.crossTileID]=!0};if(oe){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=c.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Fe=Ie.length-1;Fe>=0;--Fe){const it=Ie[Fe];ke(c.symbolInstances.get(it),c.collisionArrays[it],it)}}else for(let Ie=t.symbolInstanceStart;Ie<t.symbolInstanceEnd;Ie++)ke(c.symbolInstances.get(Ie),c.collisionArrays[Ie],Ie);c.justReloaded=!1}storeCollisionData(t,n,a,c,p,m){if(a.textBox||a.iconBox){let _,v;this.collisionBoxArrays.has(t)?_=this.collisionBoxArrays.get(t):(_=new Map,this.collisionBoxArrays.set(t,_)),_.has(n)?v=_.get(n):(v={text:null,icon:null},_.set(n,v)),a.textBox&&(v.text=c.box),a.iconBox&&(v.icon=p.box)}if(m){let _=this.collisionCircleArrays[t];_===void 0&&(_=this.collisionCircleArrays[t]=[]);for(let v=0;v<m.circles.length;v+=4)_.push(m.circles[v+0]-Xt),_.push(m.circles[v+1]-Xt),_.push(m.circles[v+2]),_.push(m.collisionDetected?1:0)}}markUsedJustification(t,n,a,c){let p;p=c===l.az.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[l.aR(n)];const m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===l.az.horizontal||n===l.az.horizontalOnly?n:0,p=n===l.az.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const v in this.placements){const b=this.placements[v],T=p[v];T?(this.opacities[v]=new ia(T,c,b.text,b.icon),a=a||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[v]=new ia(null,c,b.text,b.icon,b.skipFade),a=a||b.text||b.icon)}for(const v in p){const b=p[v];if(!this.opacities[v]){const T=new ia(b,c,!1,!1);T.isHidden()||(this.opacities[v]=T,a=a||b.text.placed||b.icon.placed)}}for(const v in m)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=m[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,c.tileID,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a,c){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const p=t.layers[0],m=p.layout,_=new ia(null,0,!1,!1,!0),v=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=p._unevaluatedLayout.hasValue("text-variable-anchor")||p._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=m.get("text-rotation-alignment")==="map",C=m.get("text-pitch-alignment")==="map",D=m.get("icon-text-fit")!=="none",V=new ia(null,0,v&&(b||!t.hasIconData()||m.get("icon-optional")),b&&(v||!t.hasTextData()||m.get("text-optional")),!0);!t.collisionArrays&&c&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(c);const q=(Z,K,ie)=>{for(let H=0;H<K/4;H++)Z.opacityVertexArray.emplaceBack(ie);Z.hasVisibleVertices=Z.hasVisibleVertices||ie!==na},W=this.collisionBoxArrays.get(t.bucketInstanceId);for(let Z=0;Z<t.symbolInstances.length;Z++){const K=t.symbolInstances.get(Z),{numHorizontalGlyphVertices:ie,numVerticalGlyphVertices:H,crossTileID:ee}=K;let ne=this.opacities[ee];a[ee]?ne=_:ne||(ne=V,this.opacities[ee]=ne),a[ee]=!0;const Q=K.numIconVertices>0,oe=this.placedOrientations[K.crossTileID],be=oe===l.az.vertical,fe=oe===l.az.horizontal||oe===l.az.horizontalOnly;if(ie>0||H>0){const ye=cl(ne.text);q(t.text,ie,be?na:ye),q(t.text,H,fe?na:ye);const ze=ne.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach((Fe=>{Fe>=0&&(t.text.placedSymbolArray.get(Fe).hidden=ze||be?1:0)})),K.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=ze||fe?1:0);const ke=this.variableOffsets[K.crossTileID];ke&&this.markUsedJustification(t,ke.anchor,K,oe);const Ie=this.placedOrientations[K.crossTileID];Ie&&(this.markUsedJustification(t,"left",K,Ie),this.markUsedOrientation(t,Ie,K))}if(Q){const ye=cl(ne.icon),ze=!(D&&K.verticalPlacedIconSymbolIndex&&be);K.placedIconSymbolIndex>=0&&(q(t.icon,K.numIconVertices,ze?ye:na),t.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=ne.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(q(t.icon,K.numVerticalIconVertices,ze?na:ye),t.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=ne.icon.isHidden())}const ge=W&&W.has(Z)?W.get(Z):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ye=t.collisionArrays[Z];if(ye){let ze=new l.P(0,0);if(ye.textBox||ye.verticalTextBox){let ke=!0;if(T){const Ie=this.variableOffsets[ee];Ie?(ze=Ja(Ie.anchor,Ie.width,Ie.height,Ie.textOffset,Ie.textBoxScale),A&&ze._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):ke=!1}if(ye.textBox||ye.verticalTextBox){let Ie;ye.textBox&&(Ie=be),ye.verticalTextBox&&(Ie=fe),al(t.textCollisionBox.collisionVertexArray,ne.text.placed,!ke||Ie,ge.text,ze.x,ze.y)}}if(ye.iconBox||ye.verticalIconBox){const ke=!!(!fe&&ye.verticalIconBox);let Ie;ye.iconBox&&(Ie=ke),ye.verticalIconBox&&(Ie=!ke),al(t.iconCollisionBox.collisionVertexArray,ne.icon.placed,Ie,ge.icon,D?ze.x:0,D?ze.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?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,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function al(d,t,n,a,c,p){a&&a.length!==0||(a=[0,0,0,0]);const m=a[0]-Xt,_=a[1]-Xt,v=a[2]-Xt,b=a[3]-Xt;d.emplaceBack(t?1:0,n?1:0,c||0,p||0,m,_),d.emplaceBack(t?1:0,n?1:0,c||0,p||0,v,_),d.emplaceBack(t?1:0,n?1:0,c||0,p||0,v,b),d.emplaceBack(t?1:0,n?1:0,c||0,p||0,m,b)}const ol=Math.pow(2,25),ll=Math.pow(2,24),lh=Math.pow(2,17),ra=Math.pow(2,16),Qa=Math.pow(2,9),Ac=Math.pow(2,8),vs=Math.pow(2,1);function cl(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const t=d.placed?1:0,n=Math.floor(127*d.opacity);return n*ol+t*ll+n*lh+t*ra+n*Qa+t*Ac+n*vs+t}const na=0;class wn{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,c,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((_,v)=>_.sortKey-v.sortKey)));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,p())return!0;return!1}}class xs{constructor(t,n,a,c,p,m,_,v){this.placement=new sl(t,n,m,_,v),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const c=Xe(),p=()=>!this._forceFullPlacement&&Xe()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new wn(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const lt=512/l.a5/2;class ul{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),_=m.key,v=c.get(_);v?v.push(m):c.set(_,[m])}for(const[p,m]of c){const _={positions:m.map((v=>({x:Math.floor(v.anchorX*lt),y:Math.floor(v.anchorY*lt)}))),crossTileIDs:m.map((v=>v.crossTileID))};if(_.positions.length>128){const v=new l.aT(_.positions.length,16,Uint16Array);for(const{x:b,y:T}of _.positions)v.add(b,T);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[p]=_}}getScaledCoordinates(t,n){const{x:a,y:c,z:p}=this.tileID.canonical,{x:m,y:_,z:v}=n.canonical,b=lt/Math.pow(2,v-p),T=(_*l.a5+t.anchorY)*b,A=c*l.a5*lt;return{x:Math.floor((m*l.a5+t.anchorX)*b-a*l.a5*lt),y:Math.floor(T-A)}}findMatches(t,n,a){const c=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const v=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(v.x-c,v.y-c,v.x+c,v.y+c).sort();for(const T of b){const A=_.crossTileIDs[T];if(!a[A]){a[A]=!0,m.crossTileID=A;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const T=_.positions[b],A=_.crossTileIDs[b];if(Math.abs(T.x-v.x)<=c&&Math.abs(T.y-v.y)<=c&&!a[A]){a[A]=!0,m.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class ch{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class hl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],p={};for(const m in c){const _=c[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const c=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in m){const v=m[_];v.tileID.isChildOf(t)&&v.findMatches(n.symbolInstances,t,c)}else{const _=m[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,c)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=a.generate(),c[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ul(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const c of a)delete this.usedCrossTileIDs[t][c]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const c=this.indexes[a];for(const p in c)t[c[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,c[p]),delete c[p],n=!0)}return n}}class er{constructor(){this.layerIndexes={},this.crossTileIDs=new ch,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let c=this.layerIndexes[t.id];c===void 0&&(c=this.layerIndexes[t.id]=new hl);let p=!1;const m={};c.handleWrapJump(a);for(const _ of n){const v=_.getBucket(t);v&&t.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(_.tileID,v,this.crossTileIDs)&&(p=!0),m[v.bucketInstanceId]=!0)}return c.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach((a=>{n[a]=!0}));for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}var Ri="void main() {fragColor=vec4(1.0);}";const $t={prelude:Qe(`#ifdef GL_ES
|
|
3
|
+
precision mediump float;
|
|
4
|
+
#else
|
|
5
|
+
#if !defined(lowp)
|
|
6
|
+
#define lowp
|
|
7
|
+
#endif
|
|
8
|
+
#if !defined(mediump)
|
|
9
|
+
#define mediump
|
|
10
|
+
#endif
|
|
11
|
+
#if !defined(highp)
|
|
12
|
+
#define highp
|
|
13
|
+
#endif
|
|
14
|
+
#endif
|
|
15
|
+
out highp vec4 fragColor;`,`#ifdef GL_ES
|
|
16
|
+
precision highp float;
|
|
17
|
+
#else
|
|
18
|
+
#if !defined(lowp)
|
|
19
|
+
#define lowp
|
|
20
|
+
#endif
|
|
21
|
+
#if !defined(mediump)
|
|
22
|
+
#define mediump
|
|
23
|
+
#endif
|
|
24
|
+
#if !defined(highp)
|
|
25
|
+
#define highp
|
|
26
|
+
#endif
|
|
27
|
+
#endif
|
|
28
|
+
vec2 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
|
|
29
|
+
);}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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
|
|
30
|
+
);}
|
|
31
|
+
#ifdef TERRAIN3D
|
|
32
|
+
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
33
|
+
#endif
|
|
34
|
+
const 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) {
|
|
35
|
+
#ifdef TERRAIN3D
|
|
36
|
+
highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
37
|
+
#else
|
|
38
|
+
return 1.0;
|
|
39
|
+
#endif
|
|
40
|
+
}float calculate_visibility(vec4 pos) {
|
|
41
|
+
#ifdef TERRAIN3D
|
|
42
|
+
vec3 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;
|
|
43
|
+
#else
|
|
44
|
+
return 1.0;
|
|
45
|
+
#endif
|
|
46
|
+
}float ele(vec2 pos) {
|
|
47
|
+
#ifdef TERRAIN3D
|
|
48
|
+
vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
49
|
+
#else
|
|
50
|
+
return 0.0;
|
|
51
|
+
#endif
|
|
52
|
+
}float get_elevation(vec2 pos) {
|
|
53
|
+
#ifdef TERRAIN3D
|
|
54
|
+
#ifdef GLOBE
|
|
55
|
+
if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
|
|
56
|
+
#endif
|
|
57
|
+
vec2 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_exaggeration;
|
|
58
|
+
#else
|
|
59
|
+
return 0.0;
|
|
60
|
+
#endif
|
|
61
|
+
}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Qe("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Qe("",`#define GLOBE_RADIUS 6371008.8
|
|
62
|
+
uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
|
|
63
|
+
);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
|
|
64
|
+
if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
|
|
65
|
+
);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Qe(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
|
|
66
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
67
|
+
fragColor=vec4(1.0);
|
|
68
|
+
#endif
|
|
69
|
+
}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Qe(`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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
70
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
71
|
+
fragColor=vec4(1.0);
|
|
72
|
+
#endif
|
|
73
|
+
}`,"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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:Qe(`in vec3 v_data;in float v_visibility;
|
|
74
|
+
#pragma mapbox: define highp vec4 color
|
|
75
|
+
#pragma mapbox: define mediump float radius
|
|
76
|
+
#pragma mapbox: define lowp float blur
|
|
77
|
+
#pragma mapbox: define lowp float opacity
|
|
78
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
79
|
+
#pragma mapbox: define mediump float stroke_width
|
|
80
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
81
|
+
void main() {
|
|
82
|
+
#pragma mapbox: initialize highp vec4 color
|
|
83
|
+
#pragma mapbox: initialize mediump float radius
|
|
84
|
+
#pragma mapbox: initialize lowp float blur
|
|
85
|
+
#pragma mapbox: initialize lowp float opacity
|
|
86
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
87
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
88
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
89
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
|
|
90
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
91
|
+
fragColor=vec4(1.0);
|
|
92
|
+
#endif
|
|
93
|
+
}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
|
|
94
|
+
#pragma mapbox: define highp vec4 color
|
|
95
|
+
#pragma mapbox: define mediump float radius
|
|
96
|
+
#pragma mapbox: define lowp float blur
|
|
97
|
+
#pragma mapbox: define lowp float opacity
|
|
98
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
99
|
+
#pragma mapbox: define mediump float stroke_width
|
|
100
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
101
|
+
void main(void) {
|
|
102
|
+
#pragma mapbox: initialize highp vec4 color
|
|
103
|
+
#pragma mapbox: initialize mediump float radius
|
|
104
|
+
#pragma mapbox: initialize lowp float blur
|
|
105
|
+
#pragma mapbox: initialize lowp float opacity
|
|
106
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
107
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
108
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
109
|
+
vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
|
|
110
|
+
#ifdef GLOBE
|
|
111
|
+
vec3 center_vector=projectToSphere(circle_center);
|
|
112
|
+
#endif
|
|
113
|
+
float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
|
|
114
|
+
#ifdef GLOBE
|
|
115
|
+
vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
|
|
116
|
+
#else
|
|
117
|
+
vec4 projected_center=projectTileWithElevation(circle_center,ele);
|
|
118
|
+
#endif
|
|
119
|
+
corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
|
|
120
|
+
#ifdef GLOBE
|
|
121
|
+
vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
|
|
122
|
+
#else
|
|
123
|
+
gl_Position=projectTileWithElevation(corner_position,ele);
|
|
124
|
+
#endif
|
|
125
|
+
} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Qe(Ri,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Qe(`uniform highp float u_intensity;in vec2 v_extrude;
|
|
126
|
+
#pragma mapbox: define highp float weight
|
|
127
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
128
|
+
void main() {
|
|
129
|
+
#pragma mapbox: initialize highp float weight
|
|
130
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
|
|
131
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
132
|
+
fragColor=vec4(1.0);
|
|
133
|
+
#endif
|
|
134
|
+
}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
|
|
135
|
+
#pragma mapbox: define highp float weight
|
|
136
|
+
#pragma mapbox: define mediump float radius
|
|
137
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
138
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
139
|
+
void main(void) {
|
|
140
|
+
#pragma mapbox: initialize highp float weight
|
|
141
|
+
#pragma mapbox: initialize mediump float radius
|
|
142
|
+
vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
|
|
143
|
+
#ifdef GLOBE
|
|
144
|
+
vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
|
|
145
|
+
#else
|
|
146
|
+
gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
|
|
147
|
+
#endif
|
|
148
|
+
}`),heatmapTexture:Qe(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
|
|
149
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
150
|
+
fragColor=vec4(0.0);
|
|
151
|
+
#endif
|
|
152
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:Qe("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Qe("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Qe(`#ifdef GL_ES
|
|
153
|
+
precision highp float;
|
|
154
|
+
#endif
|
|
155
|
+
uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
|
|
156
|
+
{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
|
|
157
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
158
|
+
fragColor=vec4(1.0);
|
|
159
|
+
#endif
|
|
160
|
+
}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Qe("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Qe(Ri,`in vec2 a_pos;void main() {
|
|
161
|
+
#ifdef GLOBE
|
|
162
|
+
gl_Position=projectTileFor3D(a_pos,0.0);
|
|
163
|
+
#else
|
|
164
|
+
gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
|
|
165
|
+
#endif
|
|
166
|
+
}`),fill:Qe(`#pragma mapbox: define highp vec4 color
|
|
167
|
+
#pragma mapbox: define lowp float opacity
|
|
168
|
+
void main() {
|
|
169
|
+
#pragma mapbox: initialize highp vec4 color
|
|
170
|
+
#pragma mapbox: initialize lowp float opacity
|
|
171
|
+
fragColor=color*opacity;
|
|
172
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
173
|
+
fragColor=vec4(1.0);
|
|
174
|
+
#endif
|
|
175
|
+
}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
|
|
176
|
+
#pragma mapbox: define highp vec4 color
|
|
177
|
+
#pragma mapbox: define lowp float opacity
|
|
178
|
+
void main() {
|
|
179
|
+
#pragma mapbox: initialize highp vec4 color
|
|
180
|
+
#pragma mapbox: initialize lowp float opacity
|
|
181
|
+
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Qe(`in vec2 v_pos;
|
|
182
|
+
#ifdef GLOBE
|
|
183
|
+
in float v_depth;
|
|
184
|
+
#endif
|
|
185
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
186
|
+
#pragma mapbox: define lowp float opacity
|
|
187
|
+
void main() {
|
|
188
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
189
|
+
#pragma mapbox: initialize lowp float opacity
|
|
190
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
|
|
191
|
+
#ifdef GLOBE
|
|
192
|
+
if (v_depth > 1.0) {discard;}
|
|
193
|
+
#endif
|
|
194
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
195
|
+
fragColor=vec4(1.0);
|
|
196
|
+
#endif
|
|
197
|
+
}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
|
|
198
|
+
#ifdef GLOBE
|
|
199
|
+
out float v_depth;
|
|
200
|
+
#endif
|
|
201
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
202
|
+
#pragma mapbox: define lowp float opacity
|
|
203
|
+
void main() {
|
|
204
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
205
|
+
#pragma mapbox: initialize lowp float opacity
|
|
206
|
+
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
207
|
+
#ifdef GLOBE
|
|
208
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
209
|
+
#endif
|
|
210
|
+
}`),fillOutlinePattern:Qe(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
|
|
211
|
+
#ifdef GLOBE
|
|
212
|
+
in float v_depth;
|
|
213
|
+
#endif
|
|
214
|
+
#pragma mapbox: define lowp float opacity
|
|
215
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
216
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
217
|
+
void main() {
|
|
218
|
+
#pragma mapbox: initialize lowp float opacity
|
|
219
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
220
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
221
|
+
vec2 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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
222
|
+
#ifdef GLOBE
|
|
223
|
+
if (v_depth > 1.0) {discard;}
|
|
224
|
+
#endif
|
|
225
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
226
|
+
fragColor=vec4(1.0);
|
|
227
|
+
#endif
|
|
228
|
+
}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
|
|
229
|
+
#ifdef GLOBE
|
|
230
|
+
out float v_depth;
|
|
231
|
+
#endif
|
|
232
|
+
#pragma mapbox: define lowp float opacity
|
|
233
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
234
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
235
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
236
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
237
|
+
void main() {
|
|
238
|
+
#pragma mapbox: initialize lowp float opacity
|
|
239
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
240
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
241
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
242
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
243
|
+
vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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;
|
|
244
|
+
#ifdef GLOBE
|
|
245
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
246
|
+
#endif
|
|
247
|
+
}`),fillPattern:Qe(`#ifdef GL_ES
|
|
248
|
+
precision highp float;
|
|
249
|
+
#endif
|
|
250
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
|
|
251
|
+
#pragma mapbox: define lowp float opacity
|
|
252
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
253
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
254
|
+
void main() {
|
|
255
|
+
#pragma mapbox: initialize lowp float opacity
|
|
256
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
257
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
258
|
+
vec2 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
|
|
259
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
260
|
+
fragColor=vec4(1.0);
|
|
261
|
+
#endif
|
|
262
|
+
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
|
|
263
|
+
#pragma mapbox: define lowp float opacity
|
|
264
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
265
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
266
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
267
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
268
|
+
void main() {
|
|
269
|
+
#pragma mapbox: initialize lowp float opacity
|
|
270
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
271
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
272
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
273
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
274
|
+
vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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:Qe(`in vec4 v_color;void main() {fragColor=v_color;
|
|
275
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
276
|
+
fragColor=vec4(1.0);
|
|
277
|
+
#endif
|
|
278
|
+
}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
|
|
279
|
+
#ifdef TERRAIN3D
|
|
280
|
+
in vec2 a_centroid;
|
|
281
|
+
#endif
|
|
282
|
+
out vec4 v_color;
|
|
283
|
+
#pragma mapbox: define highp float base
|
|
284
|
+
#pragma mapbox: define highp float height
|
|
285
|
+
#pragma mapbox: define highp vec4 color
|
|
286
|
+
void main() {
|
|
287
|
+
#pragma mapbox: initialize highp float base
|
|
288
|
+
#pragma mapbox: initialize highp float height
|
|
289
|
+
#pragma mapbox: initialize highp vec4 color
|
|
290
|
+
vec3 normal=a_normal_ed.xyz;
|
|
291
|
+
#ifdef TERRAIN3D
|
|
292
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
293
|
+
#else
|
|
294
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
295
|
+
#endif
|
|
296
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
297
|
+
#ifdef GLOBE
|
|
298
|
+
vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
299
|
+
#else
|
|
300
|
+
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
301
|
+
#endif
|
|
302
|
+
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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
|
|
303
|
+
#ifdef GLOBE
|
|
304
|
+
mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
|
|
305
|
+
#endif
|
|
306
|
+
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:Qe(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
|
|
307
|
+
#pragma mapbox: define lowp float base
|
|
308
|
+
#pragma mapbox: define lowp float height
|
|
309
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
310
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
311
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
312
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
313
|
+
void main() {
|
|
314
|
+
#pragma mapbox: initialize lowp float base
|
|
315
|
+
#pragma mapbox: initialize lowp float height
|
|
316
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
317
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
318
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
319
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
320
|
+
vec2 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
|
|
321
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
322
|
+
fragColor=vec4(1.0);
|
|
323
|
+
#endif
|
|
324
|
+
}`,`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
|
|
325
|
+
#ifdef TERRAIN3D
|
|
326
|
+
in vec2 a_centroid;
|
|
327
|
+
#endif
|
|
328
|
+
#ifdef GLOBE
|
|
329
|
+
out vec3 v_sphere_pos;
|
|
330
|
+
#endif
|
|
331
|
+
out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
|
|
332
|
+
#pragma mapbox: define lowp float base
|
|
333
|
+
#pragma mapbox: define lowp float height
|
|
334
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
335
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
336
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
337
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
338
|
+
void main() {
|
|
339
|
+
#pragma mapbox: initialize lowp float base
|
|
340
|
+
#pragma mapbox: initialize lowp float height
|
|
341
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
342
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
343
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
344
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
345
|
+
vec2 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;
|
|
346
|
+
#ifdef TERRAIN3D
|
|
347
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
348
|
+
#else
|
|
349
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
350
|
+
#endif
|
|
351
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
352
|
+
#ifdef GLOBE
|
|
353
|
+
vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
354
|
+
#else
|
|
355
|
+
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
356
|
+
#endif
|
|
357
|
+
vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
358
|
+
? a_pos
|
|
359
|
+
: vec2(edgedistance,elevation*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:Qe(`#ifdef GL_ES
|
|
360
|
+
precision highp float;
|
|
361
|
+
#endif
|
|
362
|
+
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
|
|
363
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
364
|
+
fragColor=vec4(1.0);
|
|
365
|
+
#endif
|
|
366
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:Qe(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
|
|
367
|
+
#define PI 3.141592653589793
|
|
368
|
+
#define STANDARD 0
|
|
369
|
+
#define COMBINED 1
|
|
370
|
+
#define IGOR 2
|
|
371
|
+
#define MULTIDIRECTIONAL 3
|
|
372
|
+
#define BASIC 4
|
|
373
|
+
float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
|
|
374
|
+
{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
|
|
375
|
+
{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
|
|
376
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
377
|
+
fragColor=vec4(1.0);
|
|
378
|
+
#endif
|
|
379
|
+
}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Qe(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
|
|
380
|
+
#ifdef GLOBE
|
|
381
|
+
in float v_depth;
|
|
382
|
+
#endif
|
|
383
|
+
#pragma mapbox: define highp vec4 color
|
|
384
|
+
#pragma mapbox: define lowp float blur
|
|
385
|
+
#pragma mapbox: define lowp float opacity
|
|
386
|
+
void main() {
|
|
387
|
+
#pragma mapbox: initialize highp vec4 color
|
|
388
|
+
#pragma mapbox: initialize lowp float blur
|
|
389
|
+
#pragma mapbox: initialize lowp float opacity
|
|
390
|
+
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);fragColor=color*(alpha*opacity);
|
|
391
|
+
#ifdef GLOBE
|
|
392
|
+
if (v_depth > 1.0) {discard;}
|
|
393
|
+
#endif
|
|
394
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
395
|
+
fragColor=vec4(1.0);
|
|
396
|
+
#endif
|
|
397
|
+
}`,`
|
|
398
|
+
#define scale 0.015873016
|
|
399
|
+
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
|
|
400
|
+
#ifdef GLOBE
|
|
401
|
+
out float v_depth;
|
|
402
|
+
#endif
|
|
403
|
+
#pragma mapbox: define highp vec4 color
|
|
404
|
+
#pragma mapbox: define lowp float blur
|
|
405
|
+
#pragma mapbox: define lowp float opacity
|
|
406
|
+
#pragma mapbox: define mediump float gapwidth
|
|
407
|
+
#pragma mapbox: define lowp float offset
|
|
408
|
+
#pragma mapbox: define mediump float width
|
|
409
|
+
void main() {
|
|
410
|
+
#pragma mapbox: initialize highp vec4 color
|
|
411
|
+
#pragma mapbox: initialize lowp float blur
|
|
412
|
+
#pragma mapbox: initialize lowp float opacity
|
|
413
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
414
|
+
#pragma mapbox: initialize lowp float offset
|
|
415
|
+
#pragma mapbox: initialize mediump float width
|
|
416
|
+
float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
417
|
+
#ifdef GLOBE
|
|
418
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
419
|
+
#endif
|
|
420
|
+
#ifdef TERRAIN3D
|
|
421
|
+
v_gamma_scale=1.0;
|
|
422
|
+
#else
|
|
423
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
424
|
+
#endif
|
|
425
|
+
v_width2=vec2(outset,inset);}`),lineGradient:Qe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
|
|
426
|
+
#ifdef GLOBE
|
|
427
|
+
in float v_depth;
|
|
428
|
+
#endif
|
|
429
|
+
#pragma mapbox: define lowp float blur
|
|
430
|
+
#pragma mapbox: define lowp float opacity
|
|
431
|
+
void main() {
|
|
432
|
+
#pragma mapbox: initialize lowp float blur
|
|
433
|
+
#pragma mapbox: initialize lowp float opacity
|
|
434
|
+
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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
|
|
435
|
+
#ifdef GLOBE
|
|
436
|
+
if (v_depth > 1.0) {discard;}
|
|
437
|
+
#endif
|
|
438
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
439
|
+
fragColor=vec4(1.0);
|
|
440
|
+
#endif
|
|
441
|
+
}`,`
|
|
442
|
+
#define scale 0.015873016
|
|
443
|
+
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
|
|
444
|
+
#ifdef GLOBE
|
|
445
|
+
out float v_depth;
|
|
446
|
+
#endif
|
|
447
|
+
#pragma mapbox: define lowp float blur
|
|
448
|
+
#pragma mapbox: define lowp float opacity
|
|
449
|
+
#pragma mapbox: define mediump float gapwidth
|
|
450
|
+
#pragma mapbox: define lowp float offset
|
|
451
|
+
#pragma mapbox: define mediump float width
|
|
452
|
+
void main() {
|
|
453
|
+
#pragma mapbox: initialize lowp float blur
|
|
454
|
+
#pragma mapbox: initialize lowp float opacity
|
|
455
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
456
|
+
#pragma mapbox: initialize lowp float offset
|
|
457
|
+
#pragma mapbox: initialize mediump float width
|
|
458
|
+
float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
459
|
+
#ifdef GLOBE
|
|
460
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
461
|
+
#endif
|
|
462
|
+
#ifdef TERRAIN3D
|
|
463
|
+
v_gamma_scale=1.0;
|
|
464
|
+
#else
|
|
465
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
466
|
+
#endif
|
|
467
|
+
v_width2=vec2(outset,inset);}`),linePattern:Qe(`#ifdef GL_ES
|
|
468
|
+
precision highp float;
|
|
469
|
+
#endif
|
|
470
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
|
|
471
|
+
#ifdef GLOBE
|
|
472
|
+
in float v_depth;
|
|
473
|
+
#endif
|
|
474
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
475
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
476
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
477
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
478
|
+
#pragma mapbox: define lowp float blur
|
|
479
|
+
#pragma mapbox: define lowp float opacity
|
|
480
|
+
void main() {
|
|
481
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
482
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
483
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
484
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
485
|
+
#pragma mapbox: initialize lowp float blur
|
|
486
|
+
#pragma mapbox: initialize lowp float opacity
|
|
487
|
+
vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
|
|
488
|
+
#ifdef GLOBE
|
|
489
|
+
if (v_depth > 1.0) {discard;}
|
|
490
|
+
#endif
|
|
491
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
492
|
+
fragColor=vec4(1.0);
|
|
493
|
+
#endif
|
|
494
|
+
}`,`
|
|
495
|
+
#define scale 0.015873016
|
|
496
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
497
|
+
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
|
|
498
|
+
#ifdef GLOBE
|
|
499
|
+
out float v_depth;
|
|
500
|
+
#endif
|
|
501
|
+
#pragma mapbox: define lowp float blur
|
|
502
|
+
#pragma mapbox: define lowp float opacity
|
|
503
|
+
#pragma mapbox: define lowp float offset
|
|
504
|
+
#pragma mapbox: define mediump float gapwidth
|
|
505
|
+
#pragma mapbox: define mediump float width
|
|
506
|
+
#pragma mapbox: define lowp float floorwidth
|
|
507
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
508
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
509
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
510
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
511
|
+
void main() {
|
|
512
|
+
#pragma mapbox: initialize lowp float blur
|
|
513
|
+
#pragma mapbox: initialize lowp float opacity
|
|
514
|
+
#pragma mapbox: initialize lowp float offset
|
|
515
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
516
|
+
#pragma mapbox: initialize mediump float width
|
|
517
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
518
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
519
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
520
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
521
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
522
|
+
float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
523
|
+
#ifdef GLOBE
|
|
524
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
525
|
+
#endif
|
|
526
|
+
#ifdef TERRAIN3D
|
|
527
|
+
v_gamma_scale=1.0;
|
|
528
|
+
#else
|
|
529
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
530
|
+
#endif
|
|
531
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Qe(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
|
|
532
|
+
#ifdef GLOBE
|
|
533
|
+
in float v_depth;
|
|
534
|
+
#endif
|
|
535
|
+
#pragma mapbox: define highp vec4 color
|
|
536
|
+
#pragma mapbox: define lowp float blur
|
|
537
|
+
#pragma mapbox: define lowp float opacity
|
|
538
|
+
#pragma mapbox: define mediump float width
|
|
539
|
+
#pragma mapbox: define lowp float floorwidth
|
|
540
|
+
#pragma mapbox: define mediump vec4 dasharray_from
|
|
541
|
+
#pragma mapbox: define mediump vec4 dasharray_to
|
|
542
|
+
void main() {
|
|
543
|
+
#pragma mapbox: initialize highp vec4 color
|
|
544
|
+
#pragma mapbox: initialize lowp float blur
|
|
545
|
+
#pragma mapbox: initialize lowp float opacity
|
|
546
|
+
#pragma mapbox: initialize mediump float width
|
|
547
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
548
|
+
#pragma mapbox: initialize mediump vec4 dasharray_from
|
|
549
|
+
#pragma mapbox: initialize mediump vec4 dasharray_to
|
|
550
|
+
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 sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
|
|
551
|
+
#ifdef GLOBE
|
|
552
|
+
if (v_depth > 1.0) {discard;}
|
|
553
|
+
#endif
|
|
554
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
555
|
+
fragColor=vec4(1.0);
|
|
556
|
+
#endif
|
|
557
|
+
}`,`
|
|
558
|
+
#define scale 0.015873016
|
|
559
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
560
|
+
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
|
|
561
|
+
#ifdef GLOBE
|
|
562
|
+
out float v_depth;
|
|
563
|
+
#endif
|
|
564
|
+
#pragma mapbox: define highp vec4 color
|
|
565
|
+
#pragma mapbox: define lowp float blur
|
|
566
|
+
#pragma mapbox: define lowp float opacity
|
|
567
|
+
#pragma mapbox: define mediump float gapwidth
|
|
568
|
+
#pragma mapbox: define lowp float offset
|
|
569
|
+
#pragma mapbox: define mediump float width
|
|
570
|
+
#pragma mapbox: define lowp float floorwidth
|
|
571
|
+
#pragma mapbox: define mediump vec4 dasharray_from
|
|
572
|
+
#pragma mapbox: define mediump vec4 dasharray_to
|
|
573
|
+
void main() {
|
|
574
|
+
#pragma mapbox: initialize highp vec4 color
|
|
575
|
+
#pragma mapbox: initialize lowp float blur
|
|
576
|
+
#pragma mapbox: initialize lowp float opacity
|
|
577
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
578
|
+
#pragma mapbox: initialize lowp float offset
|
|
579
|
+
#pragma mapbox: initialize mediump float width
|
|
580
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
581
|
+
#pragma mapbox: initialize mediump vec4 dasharray_from
|
|
582
|
+
#pragma mapbox: initialize mediump vec4 dasharray_to
|
|
583
|
+
float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
584
|
+
#ifdef GLOBE
|
|
585
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
586
|
+
#endif
|
|
587
|
+
#ifdef TERRAIN3D
|
|
588
|
+
v_gamma_scale=1.0;
|
|
589
|
+
#else
|
|
590
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
591
|
+
#endif
|
|
592
|
+
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Qe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
|
|
593
|
+
#ifdef GLOBE
|
|
594
|
+
in float v_depth;
|
|
595
|
+
#endif
|
|
596
|
+
#pragma mapbox: define lowp float blur
|
|
597
|
+
#pragma mapbox: define lowp float opacity
|
|
598
|
+
#pragma mapbox: define mediump float width
|
|
599
|
+
#pragma mapbox: define lowp float floorwidth
|
|
600
|
+
#pragma mapbox: define mediump vec4 dasharray_from
|
|
601
|
+
#pragma mapbox: define mediump vec4 dasharray_to
|
|
602
|
+
void main() {
|
|
603
|
+
#pragma mapbox: initialize lowp float blur
|
|
604
|
+
#pragma mapbox: initialize lowp float opacity
|
|
605
|
+
#pragma mapbox: initialize mediump float width
|
|
606
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
607
|
+
#pragma mapbox: initialize mediump vec4 dasharray_from
|
|
608
|
+
#pragma mapbox: initialize mediump vec4 dasharray_to
|
|
609
|
+
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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
|
|
610
|
+
#ifdef GLOBE
|
|
611
|
+
if (v_depth > 1.0) {discard;}
|
|
612
|
+
#endif
|
|
613
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
614
|
+
fragColor=vec4(1.0);
|
|
615
|
+
#endif
|
|
616
|
+
}`,`
|
|
617
|
+
#define scale 0.015873016
|
|
618
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
619
|
+
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
|
|
620
|
+
#ifdef GLOBE
|
|
621
|
+
out float v_depth;
|
|
622
|
+
#endif
|
|
623
|
+
#pragma mapbox: define lowp float blur
|
|
624
|
+
#pragma mapbox: define lowp float opacity
|
|
625
|
+
#pragma mapbox: define mediump float gapwidth
|
|
626
|
+
#pragma mapbox: define lowp float offset
|
|
627
|
+
#pragma mapbox: define mediump float width
|
|
628
|
+
#pragma mapbox: define lowp float floorwidth
|
|
629
|
+
#pragma mapbox: define mediump vec4 dasharray_from
|
|
630
|
+
#pragma mapbox: define mediump vec4 dasharray_to
|
|
631
|
+
void main() {
|
|
632
|
+
#pragma mapbox: initialize lowp float blur
|
|
633
|
+
#pragma mapbox: initialize lowp float opacity
|
|
634
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
635
|
+
#pragma mapbox: initialize lowp float offset
|
|
636
|
+
#pragma mapbox: initialize mediump float width
|
|
637
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
638
|
+
#pragma mapbox: initialize mediump vec4 dasharray_from
|
|
639
|
+
#pragma mapbox: initialize mediump vec4 dasharray_to
|
|
640
|
+
float 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;float texel_height=1.0/u_image_height;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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
641
|
+
#ifdef GLOBE
|
|
642
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
643
|
+
#endif
|
|
644
|
+
#ifdef TERRAIN3D
|
|
645
|
+
v_gamma_scale=1.0;
|
|
646
|
+
#else
|
|
647
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
648
|
+
#endif
|
|
649
|
+
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:Qe(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
650
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
651
|
+
fragColor=vec4(1.0);
|
|
652
|
+
#endif
|
|
653
|
+
}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
|
|
654
|
+
#ifdef GLOBE
|
|
655
|
+
if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
|
|
656
|
+
#endif
|
|
657
|
+
v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Qe(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
|
|
658
|
+
#pragma mapbox: define lowp float opacity
|
|
659
|
+
void main() {
|
|
660
|
+
#pragma mapbox: initialize lowp float opacity
|
|
661
|
+
lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
|
|
662
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
663
|
+
fragColor=vec4(1.0);
|
|
664
|
+
#endif
|
|
665
|
+
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
|
|
666
|
+
#pragma mapbox: define lowp float opacity
|
|
667
|
+
void main() {
|
|
668
|
+
#pragma mapbox: initialize lowp float opacity
|
|
669
|
+
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
670
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
671
|
+
u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
672
|
+
#ifdef GLOBE
|
|
673
|
+
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
674
|
+
#endif
|
|
675
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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:Qe(`#define SDF_PX 8.0
|
|
676
|
+
uniform 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;in vec2 v_data0;in vec3 v_data1;
|
|
677
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
678
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
679
|
+
#pragma mapbox: define lowp float opacity
|
|
680
|
+
#pragma mapbox: define lowp float halo_width
|
|
681
|
+
#pragma mapbox: define lowp float halo_blur
|
|
682
|
+
void main() {
|
|
683
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
684
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
685
|
+
#pragma mapbox: initialize lowp float opacity
|
|
686
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
687
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
688
|
+
float 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 inner_edge=(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);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
|
|
689
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
690
|
+
fragColor=vec4(1.0);
|
|
691
|
+
#endif
|
|
692
|
+
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
|
|
693
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
694
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
695
|
+
#pragma mapbox: define lowp float opacity
|
|
696
|
+
#pragma mapbox: define lowp float halo_width
|
|
697
|
+
#pragma mapbox: define lowp float halo_blur
|
|
698
|
+
void main() {
|
|
699
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
700
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
701
|
+
#pragma mapbox: initialize lowp float opacity
|
|
702
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
703
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
704
|
+
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
705
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
706
|
+
u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
707
|
+
#ifdef GLOBE
|
|
708
|
+
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
709
|
+
#endif
|
|
710
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Qe(`#define SDF_PX 8.0
|
|
711
|
+
#define SDF 1.0
|
|
712
|
+
#define ICON 0.0
|
|
713
|
+
uniform 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;in vec4 v_data0;in vec4 v_data1;
|
|
714
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
715
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
716
|
+
#pragma mapbox: define lowp float opacity
|
|
717
|
+
#pragma mapbox: define lowp float halo_width
|
|
718
|
+
#pragma mapbox: define lowp float halo_blur
|
|
719
|
+
void main() {
|
|
720
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
721
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
722
|
+
#pragma mapbox: initialize lowp float opacity
|
|
723
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
724
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
725
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
|
|
726
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
727
|
+
fragColor=vec4(1.0);
|
|
728
|
+
#endif
|
|
729
|
+
return;}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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
|
|
730
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
731
|
+
fragColor=vec4(1.0);
|
|
732
|
+
#endif
|
|
733
|
+
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
|
|
734
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
735
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
736
|
+
#pragma mapbox: define lowp float opacity
|
|
737
|
+
#pragma mapbox: define lowp float halo_width
|
|
738
|
+
#pragma mapbox: define lowp float halo_blur
|
|
739
|
+
void main() {
|
|
740
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
741
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
742
|
+
#pragma mapbox: initialize lowp float opacity
|
|
743
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
744
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
745
|
+
vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
746
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
747
|
+
u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
748
|
+
#ifdef GLOBE
|
|
749
|
+
if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
750
|
+
#endif
|
|
751
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Qe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Qe("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Qe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Qe("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Qe(`#ifdef GL_ES
|
|
752
|
+
precision highp float;
|
|
753
|
+
#endif
|
|
754
|
+
in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
|
|
755
|
+
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Qe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Qe(d,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/in ([\w]+) ([\w]+)/g),c=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,_={};return{fragmentSource:d=d.replace(n,((v,b,T,A,C)=>(_[C]=!0,b==="define"?`
|
|
756
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
757
|
+
in ${T} ${A} ${C};
|
|
758
|
+
#else
|
|
759
|
+
uniform ${T} ${A} u_${C};
|
|
760
|
+
#endif
|
|
761
|
+
`:`
|
|
762
|
+
#ifdef HAS_UNIFORM_u_${C}
|
|
763
|
+
${T} ${A} ${C} = u_${C};
|
|
764
|
+
#endif
|
|
765
|
+
`))),vertexSource:t=t.replace(n,((v,b,T,A,C)=>{const D=A==="float"?"vec2":"vec4",V=C.match(/color/)?"color":D;return _[C]?b==="define"?`
|
|
766
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
767
|
+
uniform lowp float u_${C}_t;
|
|
768
|
+
in ${T} ${D} a_${C};
|
|
769
|
+
out ${T} ${A} ${C};
|
|
770
|
+
#else
|
|
771
|
+
uniform ${T} ${A} u_${C};
|
|
772
|
+
#endif
|
|
773
|
+
`:V==="vec4"?`
|
|
774
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
775
|
+
${C} = a_${C};
|
|
776
|
+
#else
|
|
777
|
+
${T} ${A} ${C} = u_${C};
|
|
778
|
+
#endif
|
|
779
|
+
`:`
|
|
780
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
781
|
+
${C} = unpack_mix_${V}(a_${C}, u_${C}_t);
|
|
782
|
+
#else
|
|
783
|
+
${T} ${A} ${C} = u_${C};
|
|
784
|
+
#endif
|
|
785
|
+
`:b==="define"?`
|
|
786
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
787
|
+
uniform lowp float u_${C}_t;
|
|
788
|
+
in ${T} ${D} a_${C};
|
|
789
|
+
#else
|
|
790
|
+
uniform ${T} ${A} u_${C};
|
|
791
|
+
#endif
|
|
792
|
+
`:V==="vec4"?`
|
|
793
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
794
|
+
${T} ${A} ${C} = a_${C};
|
|
795
|
+
#else
|
|
796
|
+
${T} ${A} ${C} = u_${C};
|
|
797
|
+
#endif
|
|
798
|
+
`:`
|
|
799
|
+
#ifndef HAS_UNIFORM_u_${C}
|
|
800
|
+
${T} ${A} ${C} = unpack_mix_${V}(a_${C}, u_${C}_t);
|
|
801
|
+
#else
|
|
802
|
+
${T} ${A} ${C} = u_${C};
|
|
803
|
+
#endif
|
|
804
|
+
`})),staticAttributes:a,staticUniforms:m}}class Et{constructor(t,n,a){this.vertexBuffer=t,this.indexBuffer=n,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Tn=l.aU([{name:"a_pos",type:"Int16",components:2}]);const qi="#define PROJECTION_MERCATOR",hr="mercator";class Zi{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return hr}get shaderDefine(){return qi}get shaderPreludeCode(){return $t.projectionMercator}get vertexShaderPreludeCode(){return $t.projectionMercator.vertexSource}get subdivisionGranularity(){return l.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,a,c,p){if(this._cachedMesh)return this._cachedMesh;const m=new l.aW;m.emplaceBack(0,0),m.emplaceBack(l.a5,0),m.emplaceBack(0,l.a5),m.emplaceBack(l.a5,l.a5);const _=t.createVertexBuffer(m,Tn.members),v=l.aX.simpleSegment(0,0,4,2),b=new l.aY;b.emplaceBack(1,0,2),b.emplaceBack(1,2,3);const T=t.createIndexBuffer(b);return this._cachedMesh=new Et(_,T,v),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class bs{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=l.G.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.G.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=l.G.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=l.G.number(t.right,n.right,a)),this}getCenter(t,n){const a=l.an((this.left+t-this.right)/2,0,t),c=l.an((this.top+n-this.bottom)/2,0,n);return new l.P(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new bs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Sn(d,t){if(!d.renderWorldCopies||d.lngRange)return;const n=t.lng-d.center.lng;t.lng+=n>180?-360:n<-180?360:0}function ii(d){return Math.max(0,Math.floor(d))}class $n{constructor(t,n){var a;this.applyConstrain=(c,p)=>this._constrainOverride!==null?this._constrainOverride(c,p):this._callbacks.defaultConstrain(c,p),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=(a=n?.constrainOverride)!==null&&a!==void 0?a:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new l.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=ii(this._zoom),this._scale=l.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new bs,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,a){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=ii(this._zoom),this._scale=l.aq(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new bs(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!a&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=l.W(t,-180,180)*Math.PI/180;var a,c,p,m,_,v,b,T,A;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=Oe(),a=this._rotationMatrix,p=-this._bearingInRadians,m=(c=this._rotationMatrix)[0],_=c[1],v=c[2],b=c[3],T=Math.sin(p),A=Math.cos(p),a[0]=m*A+v*T,a[1]=_*A+b*T,a[2]=m*-T+v*A,a[3]=_*-T+b*A)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=l.an(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return l.aZ(this._fovInRadians)}setFov(t){t=l.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=l.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=l.aq(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this.constrainInternal(),this._calcMatrices()}resize(t,n,a=!0){this._width=t,this._height=n,a&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Wt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-l.ao,l.ao])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:a,minY:c,maxX:p,maxY:m}=l.aa.fromPoints(n).extend(t);return[new l.P(a,c),new l.P(p,c),new l.P(p,m),new l.P(a,m),new l.P(a,c)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:a}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(a),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=l.ar(new Float64Array(16));l.Q(t,t,[this._width/2,-this._height/2,1]),l.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=l.ar(new Float64Array(16)),l.Q(t,t,[1,-1,1]),l.O(t,t,[-1,-1,0]),l.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,a,c){const p=a!==void 0?a:this.bearing,m=c=c!==void 0?c:this.pitch,{distanceToCenter:_,clampedElevation:v}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,m),{x:b,y:T}=Mt(m,p),A=l.a9.fromLngLat(t,n);let C,D,V=l.a_(1,A.y),q=0;do{if(q+=1,q>10)break;D=_/V,C=new l.a9(A.x+b*D,A.y+T*D),V=1/C.meterInMercatorCoordinateUnits()}while(Math.abs(_-D*V)>1e-12);return{center:C.toLngLat(),elevation:v,zoom:l.at(this.height/2/Math.tan(this.fovInRadians/2)/D/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,a=l.as(1,this.center.lat)*this.worldSize,c=l.a9.fromLngLat(this.center,this.elevation),p=c.x/n,m=c.y/n,_=c.z/n,v=this.pitch,b=this.bearing,{x:T,y:A,z:C}=Mt(v,b),D=this.cameraToCenterDistance,V=p+D*-T,q=m+D*-A,W=_+D*C,{distanceToCenter:Z,clampedElevation:K}=this._distanceToCenterFromAltElevationPitch(W/a,t,v),ie=Z*a,H=new l.a9((V+T*ie)*n,(q+A*ie)*n,0).toLngLat(),ee=l.as(1,H.lat),ne=l.at(this.height/2/Math.tan(this.fovInRadians/2)/Z/ee/this.tileSize);this._elevation=K,this._center=H,this.setZoom(ne)}_distanceToCenterFromAltElevationPitch(t,n,a){const c=-Math.cos(l.ap(a)),p=t-n;let m,_=n;return c*p>=0||Math.abs(c)<.1?(m=1e4,_=t+m*c):m=-p/c,{distanceToCenter:m,clampedElevation:_}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=l.as(1,this.center.lat)*this.worldSize;return me(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/l.a5,1/n/l.a5]}}class Yr{constructor(t,n){this.min=t,this.max=n,this.center=l.a$([],l.b0([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=l.b1(this.min),c=l.b1(this.max);for(let p=0;p<n.length;p++)a[p]=n[p]?this.min[p]:this.center[p],c[p]=n[p]?this.center[p]:this.max[p];return c[2]=this.max[2],new Yr(a,c)}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]}intersectsFrustum(t){let n=!0;for(let a=0;a<t.planes.length;a++){const c=this.intersectsPlane(t.planes[a]);if(c===0)return 0;c===1&&(n=!1)}return n?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let n=t[3],a=t[3];for(let c=0;c<3;c++)t[c]>0?(n+=t[c]*this.min[c],a+=t[c]*this.max[c]):(a+=t[c]*this.min[c],n+=t[c]*this.max[c]);return n>=0?2:a<0?0:1}}class eo{distanceToTile2d(t,n,a,c){const p=c.distanceX([t,n]),m=c.distanceY([t,n]);return Math.hypot(p,m)}getWrap(t,n,a){return a}getTileBoundingVolume(t,n,a,c){var p,m;let _=0,v=0;if(c?.terrain){const T=new l.a2(t.z,n,t.z,t.x,t.y),A=c.terrain.getMinMaxElevation(T);_=(p=A.minElevation)!==null&&p!==void 0?p:Math.min(0,a),v=(m=A.maxElevation)!==null&&m!==void 0?m:Math.max(0,a)}const b=1<<t.z;return new Yr([n+t.x/b,t.y/b,_],[n+(t.x+1)/b,(t.y+1)/b,v])}allowVariableZoom(t,n){const a=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,c=l.an(78.5-a/2,0,60);return!!n.terrain||t.pitch>c}allowWorldCopies(){return!0}prepareNextFrame(){}}class tr{constructor(t,n,a){this.points=t,this.planes=n,this.aabb=a}static fromInvProjectionMatrix(t,n=1,a=0,c,p){const m=p?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,a),v=[[-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((C=>(function(D,V,q,W){const Z=l.aH([],D,V),K=1/Z[3]/q*W;return l.b6(Z,Z,[K,K,1/Z[3],K])})(C,t,n,_)));c&&(function(C,D,V,q){const W=q?4:0,Z=q?0:4;let K=0;const ie=[],H=[];for(let Q=0;Q<4;Q++){const oe=l.b2([],C[Q+Z],C[Q+W]),be=l.b7(oe);l.a$(oe,oe,1/be),ie.push(be),H.push(oe)}for(let Q=0;Q<4;Q++){const oe=l.b8(C[Q+W],H[Q],V);K=oe!==null&&oe>=0?Math.max(K,oe):Math.max(K,ie[Q])}const ee=(function(Q,oe){const be=l.b2([],Q[oe[0]],Q[oe[1]]),fe=l.b2([],Q[oe[2]],Q[oe[1]]),ge=[0,0,0,0];return l.b3(ge,l.b4([],be,fe)),ge[3]=-l.b5(ge,Q[oe[0]]),ge})(C,D),ne=(function(Q,oe){const be=l.b9(Q),fe=l.ba([],Q,1/be),ge=l.b2([],oe,l.a$([],fe,l.b5(oe,fe))),ye=l.b9(ge);if(ye>0){const ze=Math.sqrt(1-fe[3]*fe[3]),ke=l.a$([],fe,-fe[3]),Ie=l.b0([],ke,l.a$([],ge,ze/ye));return l.bb(oe,Ie)}return null})(V,ee);if(ne!==null){const Q=ne/l.b5(H[0],ee);K=Math.min(K,Q)}for(let Q=0;Q<4;Q++){const oe=Math.min(K,ie[Q]);C[Q+Z]=[C[Q+W][0]+H[Q][0]*oe,C[Q+W][1]+H[Q][1]*oe,C[Q+W][2]+H[Q][2]*oe,1]}})(v,m[0],c,p);const b=m.map((C=>{const D=l.b2([],v[C[0]],v[C[1]]),V=l.b2([],v[C[2]],v[C[1]]),q=l.b3([],l.b4([],D,V)),W=-l.b5(q,v[C[1]]);return q.concat(W)})),T=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],A=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const C of v)for(let D=0;D<3;D++)T[D]=Math.min(T[D],C[D]),A[D]=Math.max(A[D],C[D]);return new tr(v,b,new Yr(T,A))}}class qn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,a)=>{a=l.an(+a,this.minZoom,this.maxZoom);const c={center:new l.V(n.lng,n.lat),zoom:a};let p=this._helper._lngRange;if(!this._helper._renderWorldCopies&&p===null){const H=179.9999999999;p=[-H,H]}const m=this.tileSize*l.aq(c.zoom);let _=0,v=m,b=0,T=m,A=0,C=0;const{x:D,y:V}=this.size;if(this._helper._latRange){const H=this._helper._latRange;_=l.X(H[1])*m,v=l.X(H[0])*m,v-_<V&&(A=V/(v-_))}p&&(b=l.W(l.Y(p[0])*m,0,m),T=l.W(l.Y(p[1])*m,0,m),T<b&&(T+=m),T-b<D&&(C=D/(T-b)));const{x:q,y:W}=We(m,n);let Z,K;const ie=Math.max(C||0,A||0);if(ie){const H=new l.P(C?(T+b)/2:q,A?(v+_)/2:W);return c.center=et(m,H).wrap(),c.zoom+=l.at(ie),c}if(this._helper._latRange){const H=V/2;W-H<_&&(K=_+H),W+H>v&&(K=v-H)}if(p){const H=(b+T)/2;let ee=q;this._helper._renderWorldCopies&&(ee=l.W(q,H-m/2,H+m/2));const ne=D/2;ee-ne<b&&(Z=b+ne),ee+ne>T&&(Z=T-ne)}if(Z!==void 0||K!==void 0){const H=new l.P(Z??q,K??W);c.center=et(m,H).wrap()}return c},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new eo}clone(){const t=new qn;return t.apply(this,!1),t}apply(t,n,a){this._helper.apply(t,n,a)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const n=[new l.bc(0,t)];if(this._helper._renderWorldCopies){const a=this.screenPointToMercatorCoordinate(new l.P(0,0)),c=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,0)),p=this.screenPointToMercatorCoordinate(new l.P(this._helper._width,this._helper._height)),m=this.screenPointToMercatorCoordinate(new l.P(0,this._helper._height)),_=Math.floor(Math.min(a.x,c.x,p.x,m.x)),v=Math.floor(Math.max(a.x,c.x,p.x,m.x)),b=1;for(let T=_-b;T<=v+b;T++)T!==0&&n.push(new l.bc(T,t))}return n}getCameraFrustum(){return tr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),a=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(t,n){const a=l.as(this.elevation,this.center.lat),c=this.screenPointToMercatorCoordinateAtZ(n,a),p=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),m=l.a9.fromLngLat(t),_=new l.a9(m.x-(c.x-p.x),m.y-(c.y-p.y));this.setCenter(_?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(l.a9.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(l.a9.fromLngLat(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a!=null)return a}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const a=n||0,c=[t.x,t.y,0,1],p=[t.x,t.y,1,1];l.aH(c,c,this._pixelMatrixInverse),l.aH(p,p,this._pixelMatrixInverse);const m=c[3],_=p[3],v=c[1]/m,b=p[1]/_,T=c[2]/m,A=p[2]/_,C=T===A?0:(a-T)/(A-T);return new l.a9(l.G.number(c[0]/m,p[0]/_,C)/this.worldSize,l.G.number(v,b,C)/this.worldSize,a)}coordinatePoint(t,n=0,a=this._pixelMatrix){const c=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.aH(c,c,a),new l.P(c[0]/c[3],c[1]/c[3])}getBounds(){const t=Math.max(0,this._helper._height/2-St(this));return new Wt().extend(this.screenPointToLocation(new l.P(0,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,t))).extend(this.screenPointToLocation(new l.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new l.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-St(this)}calculatePosMatrix(t,n=!1,a){var c;const p=(c=t.key)!==null&&c!==void 0?c:l.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),m=n?this._alignedPosMatrixCache:this._posMatrixCache;if(m.has(p)){const b=m.get(p);return a?b.f32:b.f64}const _=gt(t,this.worldSize);l.S(_,n?this._alignedProjMatrix:this._viewProjMatrix,_);const v={f64:_,f32:new Float32Array(_)};return m.set(p,v),a?v.f32:v.f64}calculateFogMatrix(t){const n=t.key,a=this._fogMatrixCacheF32;if(a.has(n))return a.get(n);const c=gt(t,this.worldSize);return l.S(c,this._fogMatrix,c),a.set(n,new Float32Array(c)),a.get(n)}calculateCenterFromCameraLngLatAlt(t,n,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,c)}_calculateNearFarZIfNeeded(t,n,a){if(!this._helper.autoCalculateNearFarZ)return;const c=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),p=t-c*this._helper._pixelPerMeter/Math.cos(n),m=c<0?p:t,_=Math.PI/2+this.pitchInRadians,v=l.ap(this.fov)*(Math.abs(Math.cos(l.ap(this.roll)))*this.height+Math.abs(Math.sin(l.ap(this.roll)))*this.width)/this.height*(.5+a.y/this.height),b=Math.sin(v)*m/Math.sin(l.an(Math.PI-_-v,.01,Math.PI-.01)),T=St(this),A=Math.atan(T/this._helper.cameraToCenterDistance),C=l.ap(.75),D=A>C?2*A*(.5+a.y/(2*T)):C,V=Math.sin(D)*m/Math.sin(l.an(Math.PI-_-D,.01,Math.PI-.01)),q=Math.min(b,V);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*q+m),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=We(this.worldSize,this.center),a=n.x,c=n.y;this._helper._pixelPerMeter=l.as(1,this.center.lat)*this.worldSize;const p=l.ap(Math.min(this.pitch,Ne)),m=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(p));let _;this._calculateNearFarZIfNeeded(m,p,t),_=new Float64Array(16),l.be(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),l.aB(this._invProjMatrix,_),_[8]=2*-t.x/this._helper._width,_[9]=2*t.y/this._helper._height,this._projectionMatrix=l.bf(_),l.Q(_,_,[1,-1,1]),l.O(_,_,[0,0,-this._helper.cameraToCenterDistance]),l.bg(_,_,-this.rollInRadians),l.bh(_,_,this.pitchInRadians),l.bg(_,_,-this.bearingInRadians),l.O(_,_,[-a,-c,0]),this._mercatorMatrix=l.Q([],_,[this.worldSize,this.worldSize,this.worldSize]),l.Q(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=l.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),l.O(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=l.aB([],_);const v=[0,0,-1,1];l.aH(v,v,this._invViewProjMatrix),this._cameraPosition=[v[0]/v[3],v[1]/v[3],v[2]/v[3]],this._fogMatrix=new Float64Array(16),l.be(this._fogMatrix,this.fovInRadians,this.width/this.height,m,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,l.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),l.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),l.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),l.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),l.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),l.O(this._fogMatrix,this._fogMatrix,[-a,-c,0]),l.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),l.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=l.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const b=this._helper._width%2/2,T=this._helper._height%2/2,A=Math.cos(this.bearingInRadians),C=Math.sin(-this.bearingInRadians),D=a-Math.round(a)+A*b+C*T,V=c-Math.round(c)+A*T+C*b,q=new Float64Array(_);if(l.O(q,q,[D>.5?D-1:D,V>.5?V-1:V,0]),this._alignedProjMatrix=q,_=l.aB(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new l.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.aH(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=l.as(1,this.center.lat)*this.worldSize;return me(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const a=l.a9.fromLngLat(t),c=[a.x*this.worldSize,a.y*this.worldSize,n,1];return l.aH(c,c,this._viewProjMatrix),c[2]/c[3]}getProjectionData(t){const{overscaledTileID:n,aligned:a,applyTerrainMatrix:c}=t,p=this._helper.getMercatorTileCoordinates(n),m=n?this.calculatePosMatrix(n,a,!0):null;let _;return _=n&&n.terrainRttPosMatrix32f&&c?n.terrainRttPosMatrix32f:m||l.bi(),{mainMatrix:_,tileMercatorCoords:p,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,a){return 1}transformLightDirection(t){return l.b1(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,a,c){const p=this.calculatePosMatrix(a);let m;c?(m=[t,n,c(t,n),1],l.aH(m,m,p)):(m=[t,n,0,1],Ka(m,m,p));const _=m[3];return{point:new l.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const a=l.a9.fromLngLat(t,n),c=a.meterInMercatorCoordinateUnits(),p=l.bj();return l.O(p,p,[a.x,a.y,a.z]),l.bg(p,p,Math.PI),l.bh(p,p,Math.PI/2),l.Q(p,p,[-c,c,c]),p}getProjectionDataForCustomLayer(t=!0){const n=new l.a2(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),c=gt(n,this.worldSize);l.S(c,this._viewProjMatrix,c),a.tileMercatorCoords=[0,0,1,1];const p=[l.a5,l.a5,this.worldSize/this._helper.pixelsPerMeter],m=l.bk();return l.Q(m,c,p),a.fallbackMatrix=m,a.mainMatrix=m,a}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function an(){l.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function zc(d){if(d.useSlerp)if(d.k<1){const t=l.bl(d.startEulerAngles.roll,d.startEulerAngles.pitch,d.startEulerAngles.bearing),n=l.bl(d.endEulerAngles.roll,d.endEulerAngles.pitch,d.endEulerAngles.bearing),a=new Float64Array(4);l.bm(a,t,n,d.k);const c=l.bn(a);d.tr.setRoll(c.roll),d.tr.setPitch(c.pitch),d.tr.setBearing(c.bearing)}else d.tr.setRoll(d.endEulerAngles.roll),d.tr.setPitch(d.endEulerAngles.pitch),d.tr.setBearing(d.endEulerAngles.bearing);else d.tr.setRoll(l.G.number(d.startEulerAngles.roll,d.endEulerAngles.roll,d.k)),d.tr.setPitch(l.G.number(d.startEulerAngles.pitch,d.endEulerAngles.pitch,d.k)),d.tr.setBearing(l.G.number(d.startEulerAngles.bearing,d.endEulerAngles.bearing,d.k))}function dl(d,t,n,a,c){const p=c.padding,m=We(c.worldSize,n.getNorthWest()),_=We(c.worldSize,n.getNorthEast()),v=We(c.worldSize,n.getSouthEast()),b=We(c.worldSize,n.getSouthWest()),T=l.ap(-a),A=m.rotate(T),C=_.rotate(T),D=v.rotate(T),V=b.rotate(T),q=new l.P(Math.max(A.x,C.x,V.x,D.x),Math.max(A.y,C.y,V.y,D.y)),W=new l.P(Math.min(A.x,C.x,V.x,D.x),Math.min(A.y,C.y,V.y,D.y)),Z=q.sub(W),K=(c.width-(p.left+p.right+t.left+t.right))/Z.x,ie=(c.height-(p.top+p.bottom+t.top+t.bottom))/Z.y;if(ie<0||K<0)return void an();const H=Math.min(l.at(c.scale*Math.min(K,ie)),d.maxZoom),ee=l.P.convert(d.offset),ne=new l.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(l.ap(a)),Q=ee.add(ne).mult(c.scale/l.aq(H));return{center:et(c.worldSize,m.add(v).div(2).sub(Q)),zoom:H,bearing:a}}class Zn{get useGlobeControls(){return!1}handlePanInertia(t,n){const a=t.mag(),c=Math.abs(St(n));return{easingOffset:t.mult(Math.min(.75*c/a,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,a){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(a,t.around)}cameraForBoxAndBearing(t,n,a,c,p){return dl(t,n,a,c,p)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(l.V.convert(n.center))}handleEaseTo(t,n){const a=t.zoom,c=t.padding,p={roll:t.roll,pitch:t.pitch,bearing:t.bearing},m={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},_=n.zoom!==void 0,v=!t.isPaddingEqual(n.padding);let b=!1;const T=_?+n.zoom:t.zoom;let A=t.centerPoint.add(n.offsetAsPoint);const C=t.screenPointToLocation(A),{center:D,zoom:V}=t.applyConstrain(l.V.convert(n.center||C),T??a);Sn(t,D);const q=We(t.worldSize,C),W=We(t.worldSize,D).sub(q),Z=l.aq(V-a);return b=V!==a,{easeFunc:K=>{if(b&&t.setZoom(l.G.number(a,V,K)),l.bo(p,m)||zc({startEulerAngles:p,endEulerAngles:m,tr:t,k:K,useSlerp:p.roll!=m.roll}),v&&(t.interpolatePadding(c,n.padding,K),A=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const ie=l.aq(t.zoom-a),H=V>a?Math.min(2,Z):Math.max(.5,Z),ee=Math.pow(H,1-K),ne=et(t.worldSize,q.add(W.mult(K*ee)).mult(ie));t.setLocationAtPoint(t.renderWorldCopies?ne.wrap():ne,A)}},isZooming:b,elevationCenter:D}}handleFlyTo(t,n){const a=n.zoom!==void 0,c=t.zoom,p=t.applyConstrain(l.V.convert(n.center||n.locationAtOffset),a?+n.zoom:c),m=p.center,_=p.zoom;Sn(t,m);const v=We(t.worldSize,n.locationAtOffset),b=We(t.worldSize,m).sub(v),T=b.mag(),A=l.aq(_-c);let C;if(n.minZoom!==void 0){const D=Math.min(+n.minZoom,c,_),V=t.applyConstrain(m,D).zoom;C=l.aq(V-c)}return{easeFunc:(D,V,q,W)=>{t.setZoom(D===1?_:c+l.at(V));const Z=D===1?m:et(t.worldSize,v.add(b.mult(q)).mult(V));t.setLocationAtPoint(t.renderWorldCopies?Z.wrap():Z,W)},scaleOfZoom:A,targetCenter:m,scaleOfMinZoom:C,pixelPathLength:T}}}class Ct{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}Ct.Replace=[1,0],Ct.disabled=new Ct(Ct.Replace,l.bp.transparent,[!1,!1,!1,!1]),Ct.unblended=new Ct(Ct.Replace,l.bp.transparent,[!0,!0,!0,!0]),Ct.alphaBlended=new Ct([1,771],l.bp.transparent,[!0,!0,!0,!0]);const ws=2305;class pt{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}pt.disabled=new pt(!1,1029,ws),pt.backCCW=new pt(!0,1029,ws),pt.frontCCW=new pt(!0,1028,ws);class st{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}st.ReadOnly=!1,st.ReadWrite=!0,st.disabled=new st(519,st.ReadOnly,[0,1]);const Ts=7680;class ft{constructor(t,n,a,c,p,m){this.test=t,this.ref=n,this.mask=a,this.fail=c,this.depthFail=p,this.pass=m}}ft.disabled=new ft({func:519,mask:0},0,0,Ts,Ts,Ts);const sa=new WeakMap;function xr(d){var t;if(sa.has(d))return sa.get(d);{const n=(t=d.getParameter(d.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return sa.set(d,n),n}}class Ss{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,a=n.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const c=new l.aW;c.emplaceBack(-1,-1),c.emplaceBack(2,-1),c.emplaceBack(-1,2);const p=new l.aY;p.emplaceBack(0,1,2),this._fullscreenTriangle=new Et(n.createVertexBuffer(c,Tn.members),n.createIndexBuffer(p),l.aX.simpleSegment(0,0,c.length,p.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(a.TEXTURE1);const m=a.createTexture();a.bindTexture(a.TEXTURE_2D,m),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(m),xr(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const a=this._cachedRenderContext.context,c=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:l.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,c.TRIANGLES,st.disabled,ft.disabled,Ct.unblended,pt.disabled,((p,m)=>({u_input:p,u_output_expected:m}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&xr(c)){c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.readBuffer(c.COLOR_ATTACHMENT0),c.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null);const p=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:p}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&xr(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return l.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Ss._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const Pn=l.a5/128;function kc(d,t){const n=d.granularity!==void 0?Math.max(d.granularity,1):1,a=n+(d.generateBorders?2:0),c=n+(d.extendToNorthPole||d.generateBorders?1:0)+(d.extendToSouthPole||d.generateBorders?1:0),p=a+1,m=c+1,_=d.generateBorders?-1:0,v=d.generateBorders||d.extendToNorthPole?-1:0,b=n+(d.generateBorders?1:0),T=n+(d.generateBorders||d.extendToSouthPole?1:0),A=p*m,C=a*c*6,D=p*m>65536;if(D&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const V=D||t==="32bit",q=new Int16Array(2*A);let W=0;for(let ie=v;ie<=T;ie++)for(let H=_;H<=b;H++){let ee=H/n*l.a5;H===-1&&(ee=-Pn),H===n+1&&(ee=l.a5+Pn);let ne=ie/n*l.a5;ie===-1&&(ne=d.extendToNorthPole?l.br:-Pn),ie===n+1&&(ne=d.extendToSouthPole?l.bs:l.a5+Pn),q[W++]=ee,q[W++]=ne}const Z=V?new Uint32Array(C):new Uint16Array(C);let K=0;for(let ie=0;ie<c;ie++)for(let H=0;H<a;H++){const ee=H+1+ie*p,ne=H+(ie+1)*p,Q=H+1+(ie+1)*p;Z[K++]=H+ie*p,Z[K++]=ne,Z[K++]=ee,Z[K++]=ee,Z[K++]=ne,Z[K++]=Q}return{vertices:q.buffer.slice(0),indices:Z.buffer.slice(0),uses32bitIndices:V}}const aa=new l.aV({fill:new l.bt(128,2),line:new l.bt(512,0),tile:new l.bt(128,32),stencil:new l.bt(128,1),circle:3});class pl{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return $t.projectionGlobe}get vertexShaderPreludeCode(){return $t.projectionMercator.vertexSource}get subdivisionGranularity(){return aa}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Ss(t));const n=l.X(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,c=this._errorMeasurement.updateErrorLoop(n,a),p=Xe();c!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=c,this._errorMeasurementLastChangeTime=p);const m=Math.min(Math.max((p-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=l.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,l.bv(m))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,a,c,p){const m=(p==="stencil"?aa.stencil:aa.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:m,generateBorders:a,extendToNorthPole:n.y===0&&c,extendToSouthPole:n.y===(1<<n.z)-1&&c})}_getMesh(t,n){const a=this._getMeshKey(n);if(a in this._tileMeshCache)return this._tileMeshCache[a];const c=(function(p,m){const _=kc(m,"16bit"),v=l.aW.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),b=l.aY.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new Et(p.createVertexBuffer(v,Tn.members),p.createIndexBuffer(b),l.aX.simpleSegment(0,0,v.length,b.length))})(t,n);return this._tileMeshCache[a]=c,c}recalculate(t){}hasTransition(){const t=Xe();let n=!1;return n=n||(t-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const uh=new l.t({type:new l.D(l.u.projection.type)});class Dc extends l.E{constructor(t){super(),this._transitionable=new l.x(uh,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.H(0)),this._mercatorProjection=new Zi,this._verticalPerspectiveProjection=new pl}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof l.bw){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,a,c,p){return this.currentProjection.getMeshFromTileID(t,n,a,c,p)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Wi(d){const t=Wn(d.worldSize,d.center.lat);return 2*Math.PI*t}function Kr(d,t,n,a,c){const p=1/(1<<c),m=t/l.a5*p+a*p,_=l.by((d/l.a5*p+n*p)*Math.PI*2+Math.PI,2*Math.PI),v=2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI,b=Math.cos(v),T=new Float64Array(3);return T[0]=Math.sin(_)*b,T[1]=Math.sin(v),T[2]=Math.cos(_)*b,T}function jt(d){return(function(t,n){const a=Math.cos(n),c=new Float64Array(3);return c[0]=Math.sin(t)*a,c[1]=Math.sin(n),c[2]=Math.cos(t)*a,c})(d.lng*Math.PI/180,d.lat*Math.PI/180)}function Wn(d,t){return d/(2*Math.PI)/Math.cos(t*Math.PI/180)}function fl(d){const t=Math.asin(d[1])/Math.PI*180,n=Math.sqrt(d[0]*d[0]+d[2]*d[2]);if(n>1e-6){const a=d[0]/n,c=Math.acos(d[2]/n),p=(a>0?c:-c)/Math.PI*180;return new l.V(l.W(p,-180,180),t)}return new l.V(0,t)}function oa(d){return Math.cos(d*Math.PI/180)}function Yt(d,t){const n=oa(d),a=oa(t);return l.at(a/n)}function Rc(d,t){const n=d.rotate(t.bearingInRadians),a=t.zoom+Yt(t.center.lat,0),c=l.bu(1/oa(t.center.lat),1/oa(Math.min(Math.abs(t.center.lat),60)),l.bx(a,7,3,0,1)),p=360/Wi({worldSize:t.worldSize,center:{lat:t.center.lat}});return new l.V(t.center.lng-n.x*p*c,l.an(t.center.lat+n.y*p,-l.ao,l.ao))}function ml(d){const t=.5*d,n=Math.sin(t),a=Math.cos(t);return Math.log(n+a)-Math.log(a-n)}function Lc(d,t,n,a){const c=d.lat+n*a;if(Math.abs(n)>1){const p=(Math.sign(d.lat+n)!==Math.sign(d.lat)?-Math.abs(d.lat):Math.abs(d.lat))*Math.PI/180,m=Math.abs(d.lat+n)*Math.PI/180,_=ml(p+a*(m-p)),v=ml(p),b=ml(m);return new l.V(d.lng+t*((_-v)/(b-v)),c)}return new l.V(d.lng+t*a,c)}class hh{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,a,c){const p=`${t.z}_${t.x}_${t.y}_${c?.terrain?"t":""}`,m=this._cache.get(p);if(m)return m;const _=this._cachePrevious.get(p);if(_)return this._cache.set(p,_),_;const v=this._boundingVolumeFactory(t,n,a,c);return this._cache.set(p,v),this._hadAnyChanges=!0,v}}class Ps{constructor(t,n,a,c){this.min=a,this.max=c,this.points=t,this.planes=n}static fromAabb(t,n){const a=[];for(let c=0;c<8;c++)a.push([1&~c?t[0]:n[0],(c>>1&1)==1?n[1]:t[1],(c>>2&1)==1?n[2]:t[2]]);return new Ps(a,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,a){const c=l.bB([],a[0],a[1],a[2]),p=l.bC([],[n[0],0,0],c),m=l.bC([],[0,n[1],0],c),_=l.bC([],[0,0,n[2]],c),v=[...t],b=[...t];for(let A=0;A<8;A++)for(let C=0;C<3;C++){const D=t[C]+p[C]*(1&~A?-1:1)+m[C]*((A>>1&1)==1?1:-1)+_[C]*((A>>2&1)==1?1:-1);v[C]=Math.min(v[C],D),b[C]=Math.max(b[C],D)}const T=[];for(let A=0;A<8;A++){const C=[...t];l.b0(C,C,l.a$([],p,1&~A?-1:1)),l.b0(C,C,l.a$([],m,(A>>1&1)==1?1:-1)),l.b0(C,C,l.a$([],_,(A>>2&1)==1?1:-1)),T.push(C)}return new Ps(T,[[...p,-l.b5(p,T[0])],[...m,-l.b5(m,T[0])],[..._,-l.b5(_,T[0])],[-p[0],-p[1],-p[2],-l.b5(p,T[7])],[-m[0],-m[1],-m[2],-l.b5(m,T[7])],[-_[0],-_[1],-_[2],-l.b5(_,T[7])]],v,b)}intersectsFrustum(t){let n=!0;const a=this.points.length,c=this.planes.length,p=t.planes.length,m=t.points.length;for(let _=0;_<p;_++){const v=t.planes[_];let b=0;for(let T=0;T<a;T++){const A=this.points[T];v[0]*A[0]+v[1]*A[1]+v[2]*A[2]+v[3]>=0&&b++}if(b===0)return 0;b<a&&(n=!1)}if(n)return 2;for(let _=0;_<c;_++){const v=this.planes[_];let b=0;for(let T=0;T<m;T++){const A=t.points[T];v[0]*A[0]+v[1]*A[1]+v[2]*A[2]+v[3]>=0&&b++}if(b===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let a=0;for(let c=0;c<n;c++){const p=this.points[c];t[0]*p[0]+t[1]*p[1]+t[2]*p[2]+t[3]>=0&&a++}return a===n?2:a===0?0:1}}function to(d,t,n){const a=d-t;return a<0?-a:Math.max(0,a-n)}function Ms(d,t,n,a,c){const p=d-n;let m;return m=p<0?Math.min(-p,1+p-c):p>1?Math.min(Math.max(p-c,0),1-p):0,Math.max(m,to(t,a,c))}class gl{constructor(){this._boundingVolumeCache=new hh(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,a,c){const p=1<<a.z,m=1/p,_=a.x/p,v=a.y/p;let b=2;return b=Math.min(b,Ms(t,n,_,v,m)),b=Math.min(b,Ms(t,n,_+.5,-v-m,m)),b=Math.min(b,Ms(t,n,_+.5,2-v-m,m)),b}getWrap(t,n,a){const c=1<<n.z,p=1/c,m=n.x/c,_=to(t.x,m,p),v=to(t.x,m-1,p),b=to(t.x,m+1,p),T=Math.min(_,v,b);return T===b?1:T===v?-1:0}allowVariableZoom(t,n){return Lt(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,a,c){return this._boundingVolumeCache.getTileBoundingVolume(t,n,a,c)}_computeTileBoundingVolume(t,n,a,c){var p,m;let _=0,v=0;if(c?.terrain){const b=new l.a2(t.z,n,t.z,t.x,t.y),T=c.terrain.getMinMaxElevation(b);_=(p=T.minElevation)!==null&&p!==void 0?p:Math.min(0,a),v=(m=T.maxElevation)!==null&&m!==void 0?m:Math.max(0,a)}if(_/=l.bE,v/=l.bE,_+=1,v+=1,t.z<=0)return Ps.fromAabb([-v,-v,-v],[v,v,v]);if(t.z===1)return Ps.fromAabb([t.x===0?-v:0,t.y===0?0:-v,-v],[t.x===0?0:v,t.y===0?v:0,v]);{const b=[Kr(0,0,t.x,t.y,t.z),Kr(l.a5,0,t.x,t.y,t.z),Kr(l.a5,l.a5,t.x,t.y,t.z),Kr(0,l.a5,t.x,t.y,t.z)],T=[];for(const ge of b)T.push(l.a$([],ge,v));if(v!==_)for(const ge of b)T.push(l.a$([],ge,_));t.y===0&&T.push([0,1,0]),t.y===(1<<t.z)-1&&T.push([0,-1,0]);const A=[1,1,1],C=[-1,-1,-1];for(const ge of T)for(let ye=0;ye<3;ye++)A[ye]=Math.min(A[ye],ge[ye]),C[ye]=Math.max(C[ye],ge[ye]);const D=Kr(l.a5/2,l.a5/2,t.x,t.y,t.z),V=l.b4([],[0,1,0],D);l.b3(V,V);const q=l.b4([],D,V);l.b3(q,q);const W=l.b4([],b[2],b[1]);l.b3(W,W);const Z=l.b4([],b[0],b[3]);l.b3(Z,Z),T.push(l.a$([],D,v)),t.y>=(1<<t.z)/2&&T.push(l.a$([],Kr(l.a5/2,0,t.x,t.y,t.z),v)),t.y<(1<<t.z)/2&&T.push(l.a$([],Kr(l.a5/2,l.a5,t.x,t.y,t.z),v));const K=la(D,T),ie=la(q,T),H=[-D[0],-D[1],-D[2],K.max],ee=[D[0],D[1],D[2],-K.min],ne=[-q[0],-q[1],-q[2],ie.max],Q=[q[0],q[1],q[2],-ie.min],oe=[...W,0],be=[...Z,0],fe=[];return t.y===0?fe.push(l.bD(be,oe,H),l.bD(be,oe,ee)):fe.push(l.bD(ne,oe,H),l.bD(ne,oe,ee),l.bD(ne,be,H),l.bD(ne,be,ee)),t.y===(1<<t.z)-1?fe.push(l.bD(be,oe,H),l.bD(be,oe,ee)):fe.push(l.bD(Q,oe,H),l.bD(Q,oe,ee),l.bD(Q,be,H),l.bD(Q,be,ee)),new Ps(fe,[H,ee,ne,Q,oe,be],A,C)}}}function la(d,t){let n=1/0,a=-1/0;for(const c of t){const p=l.b5(d,c);n=Math.min(n,p),a=Math.max(a,p)}return{min:n,max:a}}class Is{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=l.bF(),this._projectionMatrix=l.bj(),this._globeViewProjMatrix32f=l.bi(),this._globeViewProjMatrixNoCorrection=l.bj(),this._globeViewProjMatrixNoCorrectionInverted=l.bj(),this._globeProjMatrixInverted=l.bj(),this._cameraPosition=l.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,a)=>{const c=l.an(n.lat,-l.ao,l.ao),p=l.an(+a,this.minZoom+Yt(0,c),this.maxZoom);return{center:new l.V(n.lng,c),zoom:p}},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new gl}clone(){const t=new Is;return t.apply(this,!1),t}apply(t,n,a){this._globeLatitudeErrorCorrectionRadians=a||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=l.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:n,applyGlobeMatrix:a}=t,c=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:c,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,a=this.cameraToCenterDistance/t,c=Math.sin(n)*a,p=Math.cos(n)*a+1,m=1/Math.sqrt(c*c+p*p)*1;let _=-c,v=p;const b=Math.sqrt(_*_+v*v);_/=b,v/=b;const T=[0,_,v];l.bG(T,T,[0,0,0],-this.bearingInRadians),l.bH(T,T,[0,0,0],-1*this.center.lat*Math.PI/180),l.bI(T,T,[0,0,0],this.center.lng*Math.PI/180);const A=1/l.b7(T);return l.a$(T,T,A),[...T,-m*A]}isLocationOccluded(t){return!this.isSurfacePointVisible(jt(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,c=Math.cos(a),p=[Math.sin(n)*c,Math.sin(a),Math.cos(n)*c],m=[p[2],0,-p[0]],_=[0,0,0];l.b4(_,m,p),l.b3(m,m),l.b3(_,_);const v=[0,0,0];return l.b3(v,[m[0]*t[0]+_[0]*t[1]+p[0]*t[2],m[1]*t[0]+_[1]*t[1]+p[1]*t[2],m[2]*t[0]+_[2]*t[1]+p[2]*t[2]]),v}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,n,a){const c=(function(_,v,b){const T=1/(1<<b.z);return new l.a9(_/l.a5*T+b.x*T,v/l.a5*T+b.y*T)})(t,n,a.canonical),p=(m=c.y,[l.by(c.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI]);var m;return this.getCircleRadiusCorrection()/Math.cos(p[1])}projectTileCoordinates(t,n,a,c){const p=a.canonical,m=Kr(t,n,p.x,p.y,p.z),_=1+(c?c(t,n):0)/l.bE,v=[m[0]*_,m[1]*_,m[2]*_,1];l.aH(v,v,this._globeViewProjMatrixNoCorrection);const b=this._cachedClippingPlane,T=b[0]*m[0]+b[1]*m[1]+b[2]*m[2]+b[3]<0;return{point:new l.P(v[0]/v[3],v[1]/v[3]),signedDistanceFromCamera:v[3],isOccluded:T}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=Wn(this.worldSize,this.center.lat),n=l.bk(),a=l.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),l.be(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const c=this.centerOffset;n[8]=2*-c.x/this._helper._width,n[9]=2*c.y/this._helper._height,this._projectionMatrix=l.bf(n),this._globeProjMatrixInverted=l.bk(),l.aB(this._globeProjMatrixInverted,n),l.O(n,n,[0,0,-this.cameraToCenterDistance]),l.bg(n,n,this.rollInRadians),l.bh(n,n,-this.pitchInRadians),l.bg(n,n,this.bearingInRadians),l.O(n,n,[0,0,-t]);const p=l.bz();p[0]=t,p[1]=t,p[2]=t,l.bh(a,n,this.center.lat*Math.PI/180),l.bJ(a,a,-this.center.lng*Math.PI/180),l.Q(a,a,p),this._globeViewProjMatrixNoCorrection=a,l.bh(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),l.bJ(n,n,-this.center.lng*Math.PI/180),l.Q(n,n,p),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=l.bk(),l.aB(this._globeViewProjMatrixNoCorrectionInverted,a);const m=l.bz();this._cameraPosition=l.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,l.bG(this._cameraPosition,this._cameraPosition,m,-this.rollInRadians),l.bH(this._cameraPosition,this._cameraPosition,m,this.pitchInRadians),l.bG(this._cameraPosition,this._cameraPosition,m,-this.bearingInRadians),l.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),l.bH(this._cameraPosition,this._cameraPosition,m,-this.center.lat*Math.PI/180),l.bI(this._cameraPosition,this._cameraPosition,m,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const _=l.bf(this._globeViewProjMatrixNoCorrectionInverted);l.Q(_,_,[1,1,-1]),this._cachedFrustum=tr.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){l.w("calculateFogMatrix is not supported on globe projection.");const n=l.bk();return l.ar(n),n}getVisibleUnwrappedCoordinates(t){return[new l.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&l.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const a=jt(t);l.a$(a,a,1+n/l.bE);const c=l.bF();return l.aH(c,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),c[2]/c[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,a=[new l.P(0,0),new l.P(t,0),new l.P(this.width,0),new l.P(this.width,n),new l.P(this.width,this.height),new l.P(t,this.height),new l.P(0,this.height),new l.P(0,n)],c=[];for(const A of a)c.push(this.unprojectScreenPoint(A));let p=0,m=0,_=0,v=0;const b=this.center;for(const A of c){const C=l.bK(b.lng,A.lng),D=l.bK(b.lat,A.lat);C<m&&(m=C),C>p&&(p=C),D<v&&(v=D),D>_&&(_=D)}const T=[b.lng+m,b.lat+v,b.lng+p,b.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(T[3]=90,T[0]=-180,T[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(T[1]=-90,T[0]=-180,T[2]=180),new Wt(T)}calculateCenterFromCameraLngLatAlt(t,n,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,c)}setLocationAtPoint(t,n){const a=jt(this.unprojectScreenPoint(n)),c=jt(t),p=l.bz();l.bL(p);const m=l.bz();l.bI(m,a,p,-this.center.lng*Math.PI/180),l.bH(m,m,p,this.center.lat*Math.PI/180);const _=c[0]*c[0]+c[2]*c[2],v=m[0]*m[0];if(_<v)return;const b=Math.sqrt(_-v),T=-b,A=l.bM(c[0],c[2],m[0],b),C=l.bM(c[0],c[2],m[0],T),D=l.bz();l.bI(D,c,p,-A);const V=l.bM(D[1],D[2],m[1],m[2]),q=l.bz();l.bI(q,c,p,-C);const W=l.bM(q[1],q[2],m[1],m[2]),Z=.5*Math.PI,K=V>=-Z&&V<=Z,ie=W>=-Z&&W<=Z;let H,ee;if(K&&ie){const be=this.center.lng*Math.PI/180,fe=this.center.lat*Math.PI/180;l.bN(A,be)+l.bN(V,fe)<l.bN(C,be)+l.bN(W,fe)?(H=A,ee=V):(H=C,ee=W)}else if(K)H=A,ee=V;else{if(!ie)return;H=C,ee=W}const ne=H/Math.PI*180,Q=ee/Math.PI*180,oe=this.center.lat;this.setCenter(new l.V(ne,l.an(Q,-90,90))),this.setZoom(this.zoom+Yt(oe,this.center.lat))}locationToScreenPoint(t,n){const a=jt(t);if(n){const c=n.getElevationForLngLatZoom(t,this._helper._tileZoom);l.a$(a,a,1+c/l.bE)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(t){const n=l.bF();return l.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new l.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a)return a}return l.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}isPointOnMapSurface(t,n){const a=this._cameraPosition,c=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(a,c)}getRayDirectionFromPixel(t){const n=l.bF();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,l.aH(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const a=l.bz();a[0]=n[0]-this._cameraPosition[0],a[1]=n[1]-this._cameraPosition[1],a[2]=n[2]-this._cameraPosition[2];const c=l.bz();return l.b3(c,a),c}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=l.bF();return l.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const a=l.b5(t,n),c=l.bz(),p=l.bz();l.a$(p,n,a),l.b2(c,t,p);const m=1-l.b5(c,c);if(m<0)return null;const _=l.b5(t,t)-1,v=-a+(a<0?1:-1)*Math.sqrt(m),b=_/v,T=v;return{tMin:Math.min(b,T),tMax:Math.max(b,T)}}unprojectScreenPoint(t){const n=this._cameraPosition,a=this.getRayDirectionFromPixel(t),c=this.rayPlanetIntersection(n,a);if(c){const T=l.bz();l.b0(T,n,[a[0]*c.tMin,a[1]*c.tMin,a[2]*c.tMin]);const A=l.bz();return l.b3(A,T),fl(A)}const p=this._cachedClippingPlane,m=p[0]*a[0]+p[1]*a[1]+p[2]*a[2],_=-l.bb(p,n)/m,v=l.bz();if(_>0)l.b0(v,n,[a[0]*_,a[1]*_,a[2]*_]);else{const T=l.bz();l.b0(T,n,[2*a[0],2*a[1],2*a[2]]);const A=l.bb(this._cachedClippingPlane,T);l.b2(v,T,[this._cachedClippingPlane[0]*A,this._cachedClippingPlane[1]*A,this._cachedClippingPlane[2]*A])}const b=(function(T){const A=l.bz();return A[0]=T[0]*-T[3],A[1]=T[1]*-T[3],A[2]=T[2]*-T[3],{center:A,radius:Math.sqrt(1-T[3]*T[3])}})(p);return fl((function(T,A,C){const D=l.bz();l.b2(D,C,T);const V=l.bz();return l.bA(V,T,D,A/l.b9(D)),V})(b.center,b.radius,v))}getMatrixForModel(t,n){const a=l.V.convert(t),c=1/l.bE,p=l.bj();return l.bJ(p,p,a.lng/180*Math.PI),l.bh(p,p,-a.lat/180*Math.PI),l.O(p,p,[0,0,1+n/l.bE]),l.bh(p,p,.5*Math.PI),l.Q(p,p,[c,c,c]),p}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new l.a2(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class Es{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,a)=>this.currentTransform.defaultConstrain(n,a),this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._globeness=1,this._mercatorTransform=new qn,this._verticalPerspectiveTransform=new Is}clone(){const t=new Es;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const n=this._mercatorTransform.getProjectionData(t),a=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:n.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return l.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return l.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,a){const c=this._mercatorTransform.getPitchedTextCorrection(t,n,a),p=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,a);return l.bu(c,p,this._globeness)}projectTileCoordinates(t,n,a,c){return this.currentTransform.projectTileCoordinates(t,n,a,c)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,a,c){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,c)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return a.fallbackMatrix=n.mainMatrix,a}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class hi{get useGlobeControls(){return!0}handlePanInertia(t,n){const a=Rc(t,n);return Math.abs(a.lng-n.center.lng)>180&&(a.lng=n.center.lng+179.5*Math.sign(a.lng-n.center.lng)),{easingCenter:a,easingOffset:new l.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const a=t.around,c=n.screenPointToLocation(a);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const p=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const m=n.zoom-p;if(m===0)return;const _=l.bK(n.center.lng,c.lng),v=_/(Math.abs(_/180)+1),b=l.bK(n.center.lat,c.lat),T=n.getRayDirectionFromPixel(a),A=n.cameraPosition,C=-1*l.b5(A,T),D=l.bz();l.b0(D,A,[T[0]*C,T[1]*C,T[2]*C]);const V=l.b7(D)-1,q=Math.exp(.5*-Math.max(V-.3,0)),W=Wn(n.worldSize,n.center.lat)/Math.min(n.width,n.height),Z=l.bx(W,.9,.5,1,.25),K=(1-l.aq(-m))*Math.min(q,Z),ie=n.center.lat,H=n.zoom,ee=new l.V(n.center.lng+v*K,l.an(n.center.lat+b*K,-l.ao,l.ao));n.setLocationAtPoint(c,a);const ne=n.center,Q=l.bx(Math.abs(_),45,85,0,1),oe=l.bx(W,.75,.35,0,1),be=Math.pow(Math.max(Q,oe),.25),fe=l.bK(ne.lng,ee.lng),ge=l.bK(ne.lat,ee.lat);n.setCenter(new l.V(ne.lng+fe*be,ne.lat+ge*be).wrap()),n.setZoom(H+Yt(ie,n.center.lat))}handleMapControlsPan(t,n,a){if(!t.panDelta)return;const c=n.center.lat,p=n.zoom;n.setCenter(Rc(t.panDelta,n).wrap()),n.setZoom(p+Yt(c,n.center.lat))}cameraForBoxAndBearing(t,n,a,c,p){const m=dl(t,n,a,c,p),_=n.left/p.width*2-1,v=(p.width-n.right)/p.width*2-1,b=n.top/p.height*-2+1,T=(p.height-n.bottom)/p.height*-2+1,A=l.bK(a.getWest(),a.getEast())<0,C=A?a.getEast():a.getWest(),D=A?a.getWest():a.getEast(),V=Math.max(a.getNorth(),a.getSouth()),q=Math.min(a.getNorth(),a.getSouth()),W=C+.5*l.bK(C,D),Z=V+.5*l.bK(V,q),K=p.clone();K.setCenter(m.center),K.setBearing(m.bearing),K.setPitch(0),K.setRoll(0),K.setZoom(m.zoom);const ie=K.modelViewProjectionMatrix,H=[jt(a.getNorthWest()),jt(a.getNorthEast()),jt(a.getSouthWest()),jt(a.getSouthEast()),jt(new l.V(D,Z)),jt(new l.V(C,Z)),jt(new l.V(W,V)),jt(new l.V(W,q))],ee=jt(m.center);let ne=Number.POSITIVE_INFINITY;for(const Q of H)_<0&&(ne=hi.getLesserNonNegativeNonNull(ne,hi.solveVectorScale(Q,ee,ie,"x",_))),v>0&&(ne=hi.getLesserNonNegativeNonNull(ne,hi.solveVectorScale(Q,ee,ie,"x",v))),b>0&&(ne=hi.getLesserNonNegativeNonNull(ne,hi.solveVectorScale(Q,ee,ie,"y",b))),T<0&&(ne=hi.getLesserNonNegativeNonNull(ne,hi.solveVectorScale(Q,ee,ie,"y",T)));if(Number.isFinite(ne)&&ne!==0)return m.zoom=K.zoom+l.at(ne),m;an()}handleJumpToCenterZoom(t,n){const a=t.center.lat,c=t.applyConstrain(n.center?l.V.convert(n.center):t.center,t.zoom).center;t.setCenter(c.wrap());const p=n.zoom!==void 0?+n.zoom:t.zoom+Yt(a,c.lat);t.zoom!==p&&t.setZoom(p)}handleEaseTo(t,n){const a=t.zoom,c=t.center,p=t.padding,m={roll:t.roll,pitch:t.pitch,bearing:t.bearing},_={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},v=n.zoom!==void 0,b=!t.isPaddingEqual(n.padding);let T=!1;const A=n.center?l.V.convert(n.center):c,C=t.applyConstrain(A,a).center;Sn(t,C);const D=t.clone();D.setCenter(C),D.setZoom(v?+n.zoom:a+Yt(c.lat,A.lat)),D.setBearing(n.bearing);const V=new l.P(l.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),l.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));D.setLocationAtPoint(C,V);const q=(n.offset&&n.offsetAsPoint.mag())>0?D.center:C,W=v?+n.zoom:a+Yt(c.lat,q.lat),Z=a+Yt(c.lat,0),K=W+Yt(q.lat,0),ie=l.bK(c.lng,q.lng),H=l.bK(c.lat,q.lat),ee=l.aq(K-Z);return T=W!==a,{easeFunc:ne=>{if(l.bo(m,_)||zc({startEulerAngles:m,endEulerAngles:_,tr:t,k:ne,useSlerp:m.roll!=_.roll}),b&&t.interpolatePadding(p,n.padding,ne),n.around)l.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const Q=K>Z?Math.min(2,ee):Math.max(.5,ee),oe=Math.pow(Q,1-ne),be=Lc(c,ie,H,ne*oe);t.setCenter(be.wrap())}if(T){const Q=l.G.number(Z,K,ne)+Yt(0,t.center.lat);t.setZoom(Q)}},isZooming:T,elevationCenter:q}}handleFlyTo(t,n){const a=n.zoom!==void 0,c=t.center,p=t.zoom,m=t.padding,_=!t.isPaddingEqual(n.padding),v=t.applyConstrain(l.V.convert(n.center||n.locationAtOffset),p).center,b=a?+n.zoom:t.zoom+Yt(t.center.lat,v.lat),T=t.clone();T.setCenter(v),T.setZoom(b),T.setBearing(n.bearing);const A=new l.P(l.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),l.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));T.setLocationAtPoint(v,A);const C=T.center;Sn(t,C);const D=(function(H,ee,ne){const Q=jt(ee),oe=jt(ne),be=l.b5(Q,oe),fe=Math.acos(be),ge=Wi(H);return fe/(2*Math.PI)*ge})(t,c,C),V=p+Yt(c.lat,0),q=b+Yt(C.lat,0),W=l.aq(q-V);let Z;if(typeof n.minZoom=="number"){const H=+n.minZoom+Yt(C.lat,0),ee=Math.min(H,V,q)+Yt(0,C.lat),ne=t.applyConstrain(C,ee).zoom+Yt(C.lat,0);Z=l.aq(ne-V)}const K=l.bK(c.lng,C.lng),ie=l.bK(c.lat,C.lat);return{easeFunc:(H,ee,ne,Q)=>{const oe=Lc(c,K,ie,ne);_&&t.interpolatePadding(m,n.padding,H);const be=H===1?C:oe;t.setCenter(be.wrap());const fe=V+l.at(ee);t.setZoom(H===1?b:fe+Yt(0,be.lat))},scaleOfZoom:W,targetCenter:C,scaleOfMinZoom:Z,pixelPathLength:D}}static solveVectorScale(t,n,a,c,p){const m=c==="x"?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],_=[a[3],a[7],a[11],a[15]],v=t[0]*m[0]+t[1]*m[1]+t[2]*m[2],b=t[0]*_[0]+t[1]*_[1]+t[2]*_[2],T=n[0]*m[0]+n[1]*m[1]+n[2]*m[2],A=n[0]*_[0]+n[1]*_[1]+n[2]*_[2];return T+p*b===v+p*A||_[3]*(v-T)+m[3]*(A-b)+v*A==T*b?null:(T+m[3]-p*A-p*_[3])/(T-v-p*A+p*b)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class Fc{constructor(t){this._globe=t,this._mercatorCameraHelper=new Zn,this._verticalPerspectiveCameraHelper=new hi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,a){this.currentHelper.handleMapControlsPan(t,n,a)}cameraForBoxAndBearing(t,n,a,c,p){return this.currentHelper.cameraForBoxAndBearing(t,n,a,c,p)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Cs=(d,t)=>l.B(d,t&&t.filter((n=>n.identifier!=="source.canvas"))),ca=l.bO();class Hn extends l.E{constructor(t,n={}){var a,c;super(),this._rtlPluginLoaded=()=>{for(const m in this.tileManagers){const _=this.tileManagers[m].getSource().type;_!=="vector"&&_!=="geojson"||this.tileManagers[m].reload()}},this.map=t,this.dispatcher=new cr(Hr(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((m,_)=>this.getGlyphs(m,_))),this.dispatcher.registerMessageHandler("GI",((m,_)=>this.getImages(m,_))),this.dispatcher.registerMessageHandler("GDA",((m,_)=>this.getDashes(m,_))),this.imageManager=new or,this.imageManager.setEventedParent(this);const p=((a=t._container)===null||a===void 0?void 0:a.lang)||typeof document<"u"&&((c=document.documentElement)===null||c===void 0?void 0:c.lang)||void 0;this.glyphManager=new _i(t._requestManager,n.localIdeographFontFamily,p),this.lineAtlas=new _r(256,512),this.crossTileSymbolIndex=new er,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",l.bP()),ce().on(re,this._rtlPluginLoaded),this.on("data",(m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const _=this.tileManagers[m.sourceId];if(!_)return;const v=_.getSource();if(v&&v.vectorLayerIds)for(const b in this._layers){const T=this._layers[b];T.source===v.id&&this._validateLayer(T)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new l.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var a,c,p;this._checkLoaded();const m=n===null?(p=(c=(a=this.stylesheet.state)===null||a===void 0?void 0:a[t])===null||c===void 0?void 0:c.default)!==null&&p!==void 0?p:null:n;if(l.bR(m,this._globalState[t]))return this;this._globalState[t]=m,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const a in t)!l.bR(this._globalState[a],t[a].default)&&(n.push(a),this._globalState[a]=t[a].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,a={};for(const c of t){a[c]=this._globalState[c];for(const p in this._layers){const m=this._layers[p],_=m.getLayoutAffectingGlobalStateRefs(),v=m.getPaintAffectingGlobalStateRefs(),b=m.getVisibilityAffectingGlobalStateRefs();if(_.has(c)&&n.add(m.source),v.has(c))for(const{name:T,value:A}of v.get(c))this._updatePaintProperty(m,T,A);b?.has(c)&&(m.recalculateVisibility(),this._updateLayer(m))}}this.dispatcher.broadcast("UGS",a);for(const c in this.tileManagers)n.has(c)&&(this._reloadSource(c),this._changed=!0)}loadURL(t,n={},a){this.fire(new l.l("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const p=this._loadStyleRequest;l.j(c,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,n,a)})).catch((m=>{this._loadStyleRequest=null,m&&!p.signal.aborted&&this.fire(new l.k(m))}))}loadJSON(t,n={},a){this.fire(new l.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ze.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,a)})).catch((()=>{}))}loadEmpty(){this.fire(new l.l("dataloading",{dataType:"style"})),this._load(ca,{validate:!1})}_load(t,n,a){var c,p;let m=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Cs(this,l.C(m))){m=Object.assign({},m),this._loaded=!0,this.stylesheet=m;for(const _ in m.sources)this.addSource(_,m.sources[_],{validate:!1});m.sprite?this._loadSprite(m.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(m.glyphs),this._createLayers(),this.light=new _n(this.stylesheet.light),this._setProjectionInternal(((c=this.stylesheet.projection)===null||c===void 0?void 0:c.type)||"mercator"),this.sky=new Zr(this.stylesheet.sky),this.map.setTerrain((p=this.stylesheet.terrain)!==null&&p!==void 0?p:null),this.fire(new l.l("data",{dataType:"style"})),this.fire(new l.l("style.load"))}}_createLayers(){var t,n,a;const c=l.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",c),this._order=c.map((p=>p.id)),this._layers={},this._serializedLayers=null;for(const p of c){const m=l.bT(p,this._globalState);if(m.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=m,l.bU(m)&&this.tileManagers[m.source]){const _=(a=(n=p.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&a!==void 0?a:m.paint.get("raster-fade-duration");this.tileManagers[m.source].setRasterFadeDuration(_)}}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1);const c=new AbortController;let p;this._spriteRequest=c,(function(m,_,v,b){return l._(this,void 0,void 0,(function*(){const T=Ki(m),A=v>1?"@2x":"",C={},D={};for(const{id:V,url:q}of T){const W=_.transformRequest(ar(q,A,".json"),"SpriteJSON");C[V]=l.j(W,b);const Z=_.transformRequest(ar(q,A,".png"),"SpriteImage");D[V]=Ii.getImage(Z,b)}return yield Promise.all([...Object.values(C),...Object.values(D)]),(function(V,q){return l._(this,void 0,void 0,(function*(){const W={};for(const Z in V){W[Z]={};const K=Ze.getImageCanvasContext((yield q[Z]).data),ie=(yield V[Z]).data;for(const H in ie){const{width:ee,height:ne,x:Q,y:oe,sdf:be,pixelRatio:fe,stretchX:ge,stretchY:ye,content:ze,textFitWidth:ke,textFitHeight:Ie}=ie[H];W[Z][H]={data:null,pixelRatio:fe,sdf:be,stretchX:ge,stretchY:ye,content:ze,textFitWidth:ke,textFitHeight:Ie,spriteData:{width:ee,height:ne,x:Q,y:oe,context:K}}}}return W}))})(C,D)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((m=>{if(this._spriteRequest=null,m)for(const _ in m){this._spritesImagesIds[_]=[];const v=this._spritesImagesIds[_]?this._spritesImagesIds[_].filter((b=>!(b in m))):[];for(const b of v)this.imageManager.removeImage(b),this._changedImages[b]=!0;for(const b in m[_]){const T=_==="default"?b:`${_}:${b}`;this._spritesImagesIds[_].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,m[_][b],!1):this.imageManager.addImage(T,m[_][b]),n&&(this._changedImages[T]=!0)}}})).catch((m=>{this._spriteRequest=null,p=m,c.signal.aborted||this.fire(new l.k(p))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.l("data",{dataType:"style"})),a&&a(p)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.l("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new l.k(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const a=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?l.bV(a):a);const c=[];for(const p of t)if(a[p]){const m=n?l.bV(a[p]):a[p];c.push(m)}return c}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){var t,n,a;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((a=this.projection)===null||a===void 0)&&a.hasTransition())return!0;for(const c in this.tileManagers)if(this.tileManagers[c].hasTransition())return!0;for(const c in this._layers)if(this._layers[c].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.tileManagers){const p=this.tileManagers[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.tileManagers[p.source].used=!0)}for(const c in a){const p=this.tileManagers[c];!!a[c]!=!!p.used&&p.fire(new l.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new l.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var a;this._checkLoaded();const c=this.serialize();if(t=n.transformStyle?n.transformStyle(c,t):t,((a=n.validate)===null||a===void 0||a)&&Cs(this,l.C(t)))return!1;(t=l.bV(t)).layers=l.bS(t.layers);const p=l.bW(c,t),m=this._getOperationsToPerform(p);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=t,this._serializedLayers=null,this.fire(new l.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],a=[];for(const c of t)switch(c.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,c.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,c.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,c.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,c.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,c.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,c.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,c.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,c.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,c.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,c.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,c.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,c.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,c.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,c.args)));break;case"setProjection":this.setProjection.apply(this,c.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,c.args)));break;case"setTransition":n.push((()=>{}));break;default:a.push(c.command)}return{operations:n,unimplemented:a}}addImage(t,n){if(this.getImage(t))return this.fire(new l.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(l.C.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.tileManagers[t]=new vr(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,(()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t}))),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new l.k(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new l.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.tileManagers[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new l.k(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Cs(this,l.bX(t)))return;p=l.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(c,t.source),t=l.bV(t),t=l.e(t,{source:c})),this._validate(l.C.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=l.bT(t,this._globalState),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new l.k(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const _=this._removedLayers[c];delete this._removedLayers[c],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.tileManagers[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new l.k(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.k(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new l.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!l.bR(c.filter,n))return n==null?(c.setFilter(void 0),void this._updateLayer(c)):void(this._validate(l.C.filter,`layers.${c.id}.filter`,n,null,a)||(c.setFilter(l.bV(n)),this._updateLayer(c)))}else this.fire(new l.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.bV(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.bR(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new l.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new l.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?l.bR(p.getPaintProperty(n),a)||this._updatePaintProperty(p,n,a,c):this.fire(new l.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,a,c={}){t.setPaintProperty(n,a,c)&&this._updateLayer(t),l.bU(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(a),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.tileManagers[a];if(p===void 0)return void this.fire(new l.k(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new l.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new l.k(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new l.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.tileManagers[a];if(c===void 0)return void this.fire(new l.k(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.k(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new l.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.tileManagers[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new l.k(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new l.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=l.bY(this.tileManagers,(p=>p.serialize())),n=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,c=this.stylesheet;return l.bZ({version:c.version,name:c.name,metadata:c.metadata,light:c.light,sky:c.sky,center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,sprite:c.sprite,glyphs:c.glyphs,transition:c.transition,projection:c.projection,sources:t,layers:n,terrain:a},(p=>p!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){a[_]=m;for(const v of t){const b=v[_];if(b)for(const T of b)c.push(T)}}}c.sort(((m,_)=>_.intersectionZ-m.intersectionZ));const p=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let v=c.length-1;v>=0;v--){const b=c[v].feature;if(a[b.layer.id]<m)break;p.push(b),c.pop()}else for(const v of t){const b=v[_];if(b)for(const T of b)p.push(T.feature)}}return p}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(l.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const c={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new l.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const b of n.layers){const T=this._layers[b];if(!T)return this.fire(new l.k(new Error(`The layer '${b}' does not exist in the map's style and cannot be queried for features.`))),[];c[T.source]=!0}}const p=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers(),_=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,v=Object.assign(Object.assign({},n),{layers:_,globalState:this._globalState});for(const b in this.tileManagers)n.layers&&!c[b]||p.push(vn(this.tileManagers[b],this._layers,m,t,v,a,this.map.terrain?(T,A,C)=>this.map.terrain.getElevation(T,A,C):void 0));return this.placement&&p.push((function(b,T,A,C,D,V,q){const W={},Z=V.queryRenderedSymbols(C),K=[];for(const ie of Object.keys(Z).map(Number))K.push(q[ie]);K.sort(vi);for(const ie of K){const H=ie.featureIndex.lookupSymbolFeatures(Z[ie.bucketInstanceId],T,ie.bucketIndex,ie.sourceLayerIndex,{filterSpec:D.filter,globalState:D.globalState},D.layers,D.availableImages,b);for(const ee in H){const ne=W[ee]=W[ee]||[],Q=H[ee];Q.sort(((oe,be)=>{const fe=ie.featureSortOrder;if(fe){const ge=fe.indexOf(oe.featureIndex);return fe.indexOf(be.featureIndex)-ge}return be.featureIndex-oe.featureIndex}));for(const oe of Q)ne.push(oe)}}return(function(ie,H,ee){for(const ne in ie)for(const Q of ie[ne])yr(Q,ee[H[ne].source]);return ie})(W,b,A)})(this._layers,m,this.tileManagers,t,v,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n?.filter&&this._validate(l.C.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.tileManagers[t];return a?(function(c,p){const m=c.getRenderableIds().map((b=>c.getTileByID(b))),_=[],v={};for(let b=0;b<m.length;b++){const T=m[b],A=T.tileID.canonical.key;v[A]||(v[A]=!0,T.querySourceFeatures(_,p))}return _})(a,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let c=!1;for(const m in t)if(!l.bR(t[m],a[m])){c=!0;break}if(!c)return;const p={now:Xe(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const a=this.getSky();let c=!1;if(!t&&!a)return;if(t&&!a)c=!0;else if(!t&&a)c=!0;else for(const m in t)if(!l.bR(t[m],a[m])){c=!0;break}if(!c)return;const p={now:Xe(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(p)}_setProjectionInternal(t){const n=(function(a,c){const p={constrainOverride:c};if(Array.isArray(a)){const m=new Dc({type:a});return{projection:m,transform:new Es(p),cameraHelper:new Fc(m)}}switch(a){case"mercator":return{projection:new Zi,transform:new qn(p),cameraHelper:new Zn};case"globe":{const m=new Dc({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:m,transform:new Es(p),cameraHelper:new Fc(m)}}case"vertical-perspective":return{projection:new pl,transform:new Is(p),cameraHelper:new hi};default:return l.w(`Unknown projection name: ${a}. Falling back to mercator projection.`),{projection:new Zi,transform:new qn(p),cameraHelper:new Zn}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const a in this.tileManagers)this.tileManagers[a].reload()}_validate(t,n,a,c,p={}){return(!p||p.validate!==!1)&&Cs(this,t.call(l.C,l.e({key:n,style:this.serialize(),value:a,styleSpec:l.u},c)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ce().off(re,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const a=this.tileManagers[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,a,c,p=!1){let m=!1,_=!1;const v={};for(const b of this._order){const T=this._layers[b];if(T.type!=="symbol")continue;if(!v[T.source]){const C=this.tileManagers[T.source];v[T.source]=C.getRenderableIds(!0).map((D=>C.getTileByID(D))).sort(((D,V)=>V.tileID.overscaledZ-D.tileID.overscaledZ||(D.tileID.isLessThan(V.tileID)?-1:1)))}const A=this.crossTileSymbolIndex.addLayer(T,v[T.source],t.center.lng);m=m||A}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Xe(),t.zoom))&&(this.pauseablePlacement=new xs(t,this.map.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,v),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Xe()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const b of this._order){const T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,v[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Xe())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return l._(this,void 0,void 0,(function*(){const a=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,n.icons),a}))}getGlyphs(t,n){return l._(this,void 0,void 0,(function*(){const a=yield this.glyphManager.getGlyphs(n.stacks),c=this.tileManagers[n.source];return c&&c.setDependencies(n.tileID.key,n.type,[""]),a}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(l.C.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return l._(this,void 0,void 0,(function*(){const a={};for(const[c,p]of Object.entries(n.dashes))a[c]=this.lineAtlas.getDash(p.dasharray,p.round);return a}))}addSprite(t,n,a={},c){this._checkLoaded();const p=[{id:t,url:n}],m=[...Ki(this.stylesheet.sprite),...p];this._validate(l.C.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Ki(this.stylesheet.sprite);if(n.find((a=>a.id===t))){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex((a=>a.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.l("data",{dataType:"style"}))}else this.fire(new l.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ki(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(l.C.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var dh=l.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class io{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,p,m,_,v,b){this.context=t;let T=this.boundPaintVertexBuffers.length!==c.length;for(let A=0;!T&&A<c.length;A++)this.boundPaintVertexBuffers[A]!==c[A]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==a||T||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,a,c,p,m,_,v,b):(t.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),v&&v.bind(),b&&b.bind())}freshBind(t,n,a,c,p,m,_,v){const b=t.numAttributes,T=this.context,A=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=c,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=v,n.enableAttributes(A,t);for(const C of a)C.enableAttributes(A,t);m&&m.enableAttributes(A,t),_&&_.enableAttributes(A,t),v&&v.enableAttributes(A,t),n.bind(),n.setVertexAttribPointers(A,t,p);for(const C of a)C.bind(),C.setVertexAttribPointers(A,t,p);m&&(m.bind(),m.setVertexAttribPointers(A,t,p)),c&&c.bind(),_&&(_.bind(),_.setVertexAttribPointers(A,t,p)),v&&(v.bind(),v.setVertexAttribPointers(A,t,p)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ph=(d,t,n,a,c)=>({u_texture:0,u_ele_delta:d,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):l.bp.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:c?0:n?n.calculateFogBlendOpacity(a):0,u_horizon_color:n?n.properties.get("horizon-color"):l.bp.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:c?1:0}),As={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function ro(d){const t=[];for(let n=0;n<d.length;n++){if(d[n]===null)continue;const a=d[n].split(" ");t.push(a.pop())}return t}class Bc{constructor(t,n,a,c,p,m,_,v,b=[]){const T=t.gl;this.program=T.createProgram();const A=ro(n.staticAttributes),C=a?a.getBinderAttributes():[],D=A.concat(C),V=$t.prelude.staticUniforms?ro($t.prelude.staticUniforms):[],q=_.staticUniforms?ro(_.staticUniforms):[],W=n.staticUniforms?ro(n.staticUniforms):[],Z=a?a.getBinderUniforms():[],K=V.concat(q).concat(W).concat(Z),ie=[];for(const fe of K)ie.indexOf(fe)<0&&ie.push(fe);const H=a?a.defines():[];xr(T)&&H.unshift("#version 300 es"),p&&H.push("#define OVERDRAW_INSPECTOR;"),m&&H.push("#define TERRAIN3D;"),v&&H.push(v),b&&H.push(...b);let ee=H.concat($t.prelude.fragmentSource,_.fragmentSource,n.fragmentSource).join(`
|
|
805
|
+
`),ne=H.concat($t.prelude.vertexSource,_.vertexSource,n.vertexSource).join(`
|
|
806
|
+
`);xr(T)||(ee=(function(fe){return fe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(ee),ne=(function(fe){return fe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(ne));const Q=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(Q,ee),T.compileShader(Q),!T.getShaderParameter(Q,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(Q)}`);T.attachShader(this.program,Q);const oe=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(oe,ne),T.compileShader(oe),!T.getShaderParameter(oe,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(oe)}`);T.attachShader(this.program,oe),this.attributes={};const be={};this.numAttributes=D.length;for(let fe=0;fe<this.numAttributes;fe++)D[fe]&&(T.bindAttribLocation(this.program,fe,D[fe]),this.attributes[D[fe]]=fe);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(oe),T.deleteShader(Q);for(let fe=0;fe<ie.length;fe++){const ge=ie[fe];if(ge&&!be[ge]){const ye=T.getUniformLocation(this.program,ge);ye&&(be[ge]=ye)}}this.fixedUniforms=c(t,be),this.terrainUniforms=((fe,ge)=>({u_depth:new l.b_(fe,ge.u_depth),u_terrain:new l.b_(fe,ge.u_terrain),u_terrain_dim:new l.bq(fe,ge.u_terrain_dim),u_terrain_matrix:new l.c0(fe,ge.u_terrain_matrix),u_terrain_unpack:new l.c1(fe,ge.u_terrain_unpack),u_terrain_exaggeration:new l.bq(fe,ge.u_terrain_exaggeration)}))(t,be),this.projectionUniforms=((fe,ge)=>({u_projection_matrix:new l.c0(fe,ge.u_projection_matrix),u_projection_tile_mercator_coords:new l.c1(fe,ge.u_projection_tile_mercator_coords),u_projection_clipping_plane:new l.c1(fe,ge.u_projection_clipping_plane),u_projection_transition:new l.bq(fe,ge.u_projection_transition),u_projection_fallback_matrix:new l.c0(fe,ge.u_projection_fallback_matrix)}))(t,be),this.binderUniforms=a?a.getUniforms(t,be):[]}draw(t,n,a,c,p,m,_,v,b,T,A,C,D,V,q,W,Z,K,ie){const H=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(m),v){t.activeTexture.set(H.TEXTURE2),H.bindTexture(H.TEXTURE_2D,v.depthTexture),t.activeTexture.set(H.TEXTURE3),H.bindTexture(H.TEXTURE_2D,v.texture);for(const ne in this.terrainUniforms)this.terrainUniforms[ne].set(v[ne])}if(b)for(const ne in b)this.projectionUniforms[As[ne]].set(b[ne]);if(_)for(const ne in this.fixedUniforms)this.fixedUniforms[ne].set(_[ne]);W&&W.setUniforms(t,this.binderUniforms,V,{zoom:q});let ee=0;switch(n){case H.LINES:ee=2;break;case H.TRIANGLES:ee=3;break;case H.LINE_STRIP:ee=1}for(const ne of D.get()){const Q=ne.vaos||(ne.vaos={});(Q[T]||(Q[T]=new io)).bind(t,this,A,W?W.getPaintVertexBuffers():[],C,ne.vertexOffset,Z,K,ie),H.drawElements(n,ne.primitiveLength*ee,H.UNSIGNED_SHORT,ne.primitiveOffset*ee*2)}}}function Oc(d,t,n){const a=1/l.aN(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const _l=(d,t,n,a)=>{const c=d.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],_=l.c4();c.properties.get("anchor")==="viewport"&&l.c5(_,d.transform.bearingInRadians),l.c6(m,m,_);const v=d.transform.transformLightDirection(m),b=c.properties.get("color");return{u_lightpos:m,u_lightpos_globe:v,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:a}},yl=(d,t,n,a,c,p,m)=>l.e(_l(d,t,n,a),Oc(p,d,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),vl=(d,t,n,a)=>l.e(Oc(t,d,n),{u_fill_translate:a}),jc=(d,t)=>({u_world:d,u_fill_translate:t}),Vc=(d,t,n,a,c)=>l.e(vl(d,t,n,c),{u_world:a}),Nc=(d,t,n,a,c)=>{const p=d.transform;let m,_,v=0;if(n.paint.get("circle-pitch-alignment")==="map"){const b=l.aN(t,1,p.zoom);m=!0,_=[b,b],v=b/(l.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*c}else m=!1,_=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+m,u_device_pixel_ratio:d.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:v,u_translate:a}},Xn=d=>({u_pixel_extrude_scale:[1/d.width,1/d.height]}),Uc=d=>({u_viewport_size:[d.width,d.height]}),xl=(d,t=1)=>({u_color:d,u_overlay:0,u_overlay_scale:t}),zs=(d,t,n,a)=>{const c=l.aN(d,1,t)/(l.a5*Math.pow(2,d.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:l.aN(d,1,t),u_intensity:n,u_globe_extrude_scale:c}},Gc=(d,t,n,a)=>{const c=l.N();l.c7(c,0,d.width,d.height,0,0,1);const p=d.context.gl;return{u_matrix:c,u_world:[p.drawingBufferWidth,p.drawingBufferHeight],u_image:n,u_color_ramp:a,u_opacity:t.paint.get("heatmap-opacity")}},no=(d,t,n)=>{const a=n.paint.get("hillshade-accent-color");let c;switch(n.paint.get("hillshade-method")){case"basic":c=4;break;case"combined":c=1;break;case"igor":c=2;break;case"multidirectional":c=3;break;default:c=0}const p=n.getIlluminationProperties();for(let m=0;m<p.directionRadians.length;m++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(p.directionRadians[m]+=d.transform.bearingInRadians);return{u_image:0,u_latrange:mh(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:p.altitudeRadians,u_azimuths:p.directionRadians,u_accent:a,u_method:c,u_highlights:p.highlightColor,u_shadows:p.shadowColor}},fh=(d,t)=>{const n=t.stride,a=l.N();return l.c7(a,0,l.a5,-l.a5,0,0,1),l.O(a,a,[0,-l.a5,0]),{u_matrix:a,u_image:1,u_dimension:[n,n],u_zoom:d.overscaledZ,u_unpack:t.getUnpackVector()}};function mh(d,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new l.a9(0,a/n).toLngLat().lat,new l.a9(0,(a+1)/n).toLngLat().lat]}const $c=(d,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:d.paint.get("color-relief-opacity")}),ua=(d,t,n,a)=>{const c=d.transform;return{u_translation:ao(d,t,n),u_ratio:a/l.aN(t,1,c.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},qc=(d,t,n,a,c)=>l.e(ua(d,t,n,a),{u_image:0,u_image_height:c}),bl=(d,t,n,a,c)=>{const p=d.transform,m=zr(t,p);return{u_translation:ao(d,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:a/l.aN(t,1,p.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[m,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Zc=(d,t,n,a,c)=>{const p=zr(t,d.transform);return l.e(ua(d,t,n,a),{u_tileratio:p,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image:0,u_mix:c.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})},so=(d,t,n,a,c,p)=>{const m=zr(t,d.transform);return l.e(ua(d,t,n,a),{u_image:0,u_image_height:p,u_tileratio:m,u_crossfade_from:c.fromScale,u_crossfade_to:c.toScale,u_image_dash:1,u_mix:c.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})};function zr(d,t){return 1/l.aN(d,1,t.tileZoom)}function ao(d,t,n){return l.aO(d.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const wl=(d,t,n,a,c)=>{return{u_tl_parent:d,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.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:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=a.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:Tl(a.paint.get("raster-hue-rotate")),u_coords_top:[c[0].x,c[0].y,c[1].x,c[1].y],u_coords_bottom:[c[3].x,c[3].y,c[2].x,c[2].y]};var p,m};function Tl(d){d*=Math.PI/180;const t=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Sl=(d,t,n,a,c,p,m,_,v,b,T,A,C)=>{const D=m.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:D.width/D.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:v,u_is_text:+T,u_pitch_with_map:+a,u_is_along_line:c,u_is_variable_anchor:p,u_texsize:A,u_texture:0,u_translation:b,u_pitched_scale:C}},oo=(d,t,n,a,c,p,m,_,v,b,T,A,C,D)=>{const V=m.transform;return l.e(Sl(d,t,n,a,c,p,m,_,v,b,T,A,D),{u_gamma_scale:a?Math.cos(V.pitch*Math.PI/180)*V.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},Yn=(d,t,n,a,c,p,m,_,v,b,T,A,C)=>l.e(oo(d,t,n,a,c,p,m,_,v,b,!0,T,0,C),{u_texsize_icon:A,u_texture_icon:1}),Pl=(d,t)=>({u_opacity:d,u_color:t}),gh=(d,t,n,a,c)=>l.e((function(p,m,_,v){const b=_.imageManager.getPattern(p.from.toString()),T=_.imageManager.getPattern(p.to.toString()),{width:A,height:C}=_.imageManager.getPixelSize(),D=Math.pow(2,v.tileID.overscaledZ),V=v.tileSize*Math.pow(2,_.transform.tileZoom)/D,q=V*(v.tileID.canonical.x+v.tileID.wrap*D),W=V*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:b.tl,u_pattern_br_a:b.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[A,C],u_mix:m.t,u_pattern_size_a:b.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:m.fromScale,u_scale_b:m.toScale,u_tile_units_to_pixels:1/l.aN(v,1,_.transform.tileZoom),u_pixel_coord_upper:[q>>16,W>>16],u_pixel_coord_lower:[65535&q,65535&W]}})(n,c,t,a),{u_opacity:d}),Wc=(d,t)=>{},_h={fillExtrusion:(d,t)=>({u_lightpos:new l.c2(d,t.u_lightpos),u_lightpos_globe:new l.c2(d,t.u_lightpos_globe),u_lightintensity:new l.bq(d,t.u_lightintensity),u_lightcolor:new l.c2(d,t.u_lightcolor),u_vertical_gradient:new l.bq(d,t.u_vertical_gradient),u_opacity:new l.bq(d,t.u_opacity),u_fill_translate:new l.c3(d,t.u_fill_translate)}),fillExtrusionPattern:(d,t)=>({u_lightpos:new l.c2(d,t.u_lightpos),u_lightpos_globe:new l.c2(d,t.u_lightpos_globe),u_lightintensity:new l.bq(d,t.u_lightintensity),u_lightcolor:new l.c2(d,t.u_lightcolor),u_vertical_gradient:new l.bq(d,t.u_vertical_gradient),u_height_factor:new l.bq(d,t.u_height_factor),u_opacity:new l.bq(d,t.u_opacity),u_fill_translate:new l.c3(d,t.u_fill_translate),u_image:new l.b_(d,t.u_image),u_texsize:new l.c3(d,t.u_texsize),u_pixel_coord_upper:new l.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(d,t.u_pixel_coord_lower),u_scale:new l.c2(d,t.u_scale),u_fade:new l.bq(d,t.u_fade)}),fill:(d,t)=>({u_fill_translate:new l.c3(d,t.u_fill_translate)}),fillPattern:(d,t)=>({u_image:new l.b_(d,t.u_image),u_texsize:new l.c3(d,t.u_texsize),u_pixel_coord_upper:new l.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(d,t.u_pixel_coord_lower),u_scale:new l.c2(d,t.u_scale),u_fade:new l.bq(d,t.u_fade),u_fill_translate:new l.c3(d,t.u_fill_translate)}),fillOutline:(d,t)=>({u_world:new l.c3(d,t.u_world),u_fill_translate:new l.c3(d,t.u_fill_translate)}),fillOutlinePattern:(d,t)=>({u_world:new l.c3(d,t.u_world),u_image:new l.b_(d,t.u_image),u_texsize:new l.c3(d,t.u_texsize),u_pixel_coord_upper:new l.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(d,t.u_pixel_coord_lower),u_scale:new l.c2(d,t.u_scale),u_fade:new l.bq(d,t.u_fade),u_fill_translate:new l.c3(d,t.u_fill_translate)}),circle:(d,t)=>({u_camera_to_center_distance:new l.bq(d,t.u_camera_to_center_distance),u_scale_with_map:new l.b_(d,t.u_scale_with_map),u_pitch_with_map:new l.b_(d,t.u_pitch_with_map),u_extrude_scale:new l.c3(d,t.u_extrude_scale),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_globe_extrude_scale:new l.bq(d,t.u_globe_extrude_scale),u_translate:new l.c3(d,t.u_translate)}),collisionBox:(d,t)=>({u_pixel_extrude_scale:new l.c3(d,t.u_pixel_extrude_scale)}),collisionCircle:(d,t)=>({u_viewport_size:new l.c3(d,t.u_viewport_size)}),debug:(d,t)=>({u_color:new l.b$(d,t.u_color),u_overlay:new l.b_(d,t.u_overlay),u_overlay_scale:new l.bq(d,t.u_overlay_scale)}),depth:Wc,clippingMask:Wc,heatmap:(d,t)=>({u_extrude_scale:new l.bq(d,t.u_extrude_scale),u_intensity:new l.bq(d,t.u_intensity),u_globe_extrude_scale:new l.bq(d,t.u_globe_extrude_scale)}),heatmapTexture:(d,t)=>({u_matrix:new l.c0(d,t.u_matrix),u_world:new l.c3(d,t.u_world),u_image:new l.b_(d,t.u_image),u_color_ramp:new l.b_(d,t.u_color_ramp),u_opacity:new l.bq(d,t.u_opacity)}),hillshade:(d,t)=>({u_image:new l.b_(d,t.u_image),u_latrange:new l.c3(d,t.u_latrange),u_exaggeration:new l.bq(d,t.u_exaggeration),u_altitudes:new l.c9(d,t.u_altitudes),u_azimuths:new l.c9(d,t.u_azimuths),u_accent:new l.b$(d,t.u_accent),u_method:new l.b_(d,t.u_method),u_shadows:new l.c8(d,t.u_shadows),u_highlights:new l.c8(d,t.u_highlights)}),hillshadePrepare:(d,t)=>({u_matrix:new l.c0(d,t.u_matrix),u_image:new l.b_(d,t.u_image),u_dimension:new l.c3(d,t.u_dimension),u_zoom:new l.bq(d,t.u_zoom),u_unpack:new l.c1(d,t.u_unpack)}),colorRelief:(d,t)=>({u_image:new l.b_(d,t.u_image),u_unpack:new l.c1(d,t.u_unpack),u_dimension:new l.c3(d,t.u_dimension),u_elevation_stops:new l.b_(d,t.u_elevation_stops),u_color_stops:new l.b_(d,t.u_color_stops),u_color_ramp_size:new l.b_(d,t.u_color_ramp_size),u_opacity:new l.bq(d,t.u_opacity)}),line:(d,t)=>({u_translation:new l.c3(d,t.u_translation),u_ratio:new l.bq(d,t.u_ratio),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(d,t.u_units_to_pixels)}),lineGradient:(d,t)=>({u_translation:new l.c3(d,t.u_translation),u_ratio:new l.bq(d,t.u_ratio),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(d,t.u_units_to_pixels),u_image:new l.b_(d,t.u_image),u_image_height:new l.bq(d,t.u_image_height)}),linePattern:(d,t)=>({u_translation:new l.c3(d,t.u_translation),u_texsize:new l.c3(d,t.u_texsize),u_ratio:new l.bq(d,t.u_ratio),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_image:new l.b_(d,t.u_image),u_units_to_pixels:new l.c3(d,t.u_units_to_pixels),u_scale:new l.c2(d,t.u_scale),u_fade:new l.bq(d,t.u_fade)}),lineSDF:(d,t)=>({u_translation:new l.c3(d,t.u_translation),u_ratio:new l.bq(d,t.u_ratio),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(d,t.u_units_to_pixels),u_image:new l.b_(d,t.u_image),u_mix:new l.bq(d,t.u_mix),u_tileratio:new l.bq(d,t.u_tileratio),u_crossfade_from:new l.bq(d,t.u_crossfade_from),u_crossfade_to:new l.bq(d,t.u_crossfade_to),u_lineatlas_width:new l.bq(d,t.u_lineatlas_width),u_lineatlas_height:new l.bq(d,t.u_lineatlas_height)}),lineGradientSDF:(d,t)=>({u_translation:new l.c3(d,t.u_translation),u_ratio:new l.bq(d,t.u_ratio),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new l.c3(d,t.u_units_to_pixels),u_image:new l.b_(d,t.u_image),u_image_height:new l.bq(d,t.u_image_height),u_tileratio:new l.bq(d,t.u_tileratio),u_crossfade_from:new l.bq(d,t.u_crossfade_from),u_crossfade_to:new l.bq(d,t.u_crossfade_to),u_image_dash:new l.b_(d,t.u_image_dash),u_mix:new l.bq(d,t.u_mix),u_lineatlas_width:new l.bq(d,t.u_lineatlas_width),u_lineatlas_height:new l.bq(d,t.u_lineatlas_height)}),raster:(d,t)=>({u_tl_parent:new l.c3(d,t.u_tl_parent),u_scale_parent:new l.bq(d,t.u_scale_parent),u_buffer_scale:new l.bq(d,t.u_buffer_scale),u_fade_t:new l.bq(d,t.u_fade_t),u_opacity:new l.bq(d,t.u_opacity),u_image0:new l.b_(d,t.u_image0),u_image1:new l.b_(d,t.u_image1),u_brightness_low:new l.bq(d,t.u_brightness_low),u_brightness_high:new l.bq(d,t.u_brightness_high),u_saturation_factor:new l.bq(d,t.u_saturation_factor),u_contrast_factor:new l.bq(d,t.u_contrast_factor),u_spin_weights:new l.c2(d,t.u_spin_weights),u_coords_top:new l.c1(d,t.u_coords_top),u_coords_bottom:new l.c1(d,t.u_coords_bottom)}),symbolIcon:(d,t)=>({u_is_size_zoom_constant:new l.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(d,t.u_is_size_feature_constant),u_size_t:new l.bq(d,t.u_size_t),u_size:new l.bq(d,t.u_size),u_camera_to_center_distance:new l.bq(d,t.u_camera_to_center_distance),u_pitch:new l.bq(d,t.u_pitch),u_rotate_symbol:new l.b_(d,t.u_rotate_symbol),u_aspect_ratio:new l.bq(d,t.u_aspect_ratio),u_fade_change:new l.bq(d,t.u_fade_change),u_label_plane_matrix:new l.c0(d,t.u_label_plane_matrix),u_coord_matrix:new l.c0(d,t.u_coord_matrix),u_is_text:new l.b_(d,t.u_is_text),u_pitch_with_map:new l.b_(d,t.u_pitch_with_map),u_is_along_line:new l.b_(d,t.u_is_along_line),u_is_variable_anchor:new l.b_(d,t.u_is_variable_anchor),u_texsize:new l.c3(d,t.u_texsize),u_texture:new l.b_(d,t.u_texture),u_translation:new l.c3(d,t.u_translation),u_pitched_scale:new l.bq(d,t.u_pitched_scale)}),symbolSDF:(d,t)=>({u_is_size_zoom_constant:new l.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(d,t.u_is_size_feature_constant),u_size_t:new l.bq(d,t.u_size_t),u_size:new l.bq(d,t.u_size),u_camera_to_center_distance:new l.bq(d,t.u_camera_to_center_distance),u_pitch:new l.bq(d,t.u_pitch),u_rotate_symbol:new l.b_(d,t.u_rotate_symbol),u_aspect_ratio:new l.bq(d,t.u_aspect_ratio),u_fade_change:new l.bq(d,t.u_fade_change),u_label_plane_matrix:new l.c0(d,t.u_label_plane_matrix),u_coord_matrix:new l.c0(d,t.u_coord_matrix),u_is_text:new l.b_(d,t.u_is_text),u_pitch_with_map:new l.b_(d,t.u_pitch_with_map),u_is_along_line:new l.b_(d,t.u_is_along_line),u_is_variable_anchor:new l.b_(d,t.u_is_variable_anchor),u_texsize:new l.c3(d,t.u_texsize),u_texture:new l.b_(d,t.u_texture),u_gamma_scale:new l.bq(d,t.u_gamma_scale),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_is_halo:new l.b_(d,t.u_is_halo),u_translation:new l.c3(d,t.u_translation),u_pitched_scale:new l.bq(d,t.u_pitched_scale)}),symbolTextAndIcon:(d,t)=>({u_is_size_zoom_constant:new l.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.b_(d,t.u_is_size_feature_constant),u_size_t:new l.bq(d,t.u_size_t),u_size:new l.bq(d,t.u_size),u_camera_to_center_distance:new l.bq(d,t.u_camera_to_center_distance),u_pitch:new l.bq(d,t.u_pitch),u_rotate_symbol:new l.b_(d,t.u_rotate_symbol),u_aspect_ratio:new l.bq(d,t.u_aspect_ratio),u_fade_change:new l.bq(d,t.u_fade_change),u_label_plane_matrix:new l.c0(d,t.u_label_plane_matrix),u_coord_matrix:new l.c0(d,t.u_coord_matrix),u_is_text:new l.b_(d,t.u_is_text),u_pitch_with_map:new l.b_(d,t.u_pitch_with_map),u_is_along_line:new l.b_(d,t.u_is_along_line),u_is_variable_anchor:new l.b_(d,t.u_is_variable_anchor),u_texsize:new l.c3(d,t.u_texsize),u_texsize_icon:new l.c3(d,t.u_texsize_icon),u_texture:new l.b_(d,t.u_texture),u_texture_icon:new l.b_(d,t.u_texture_icon),u_gamma_scale:new l.bq(d,t.u_gamma_scale),u_device_pixel_ratio:new l.bq(d,t.u_device_pixel_ratio),u_is_halo:new l.b_(d,t.u_is_halo),u_translation:new l.c3(d,t.u_translation),u_pitched_scale:new l.bq(d,t.u_pitched_scale)}),background:(d,t)=>({u_opacity:new l.bq(d,t.u_opacity),u_color:new l.b$(d,t.u_color)}),backgroundPattern:(d,t)=>({u_opacity:new l.bq(d,t.u_opacity),u_image:new l.b_(d,t.u_image),u_pattern_tl_a:new l.c3(d,t.u_pattern_tl_a),u_pattern_br_a:new l.c3(d,t.u_pattern_br_a),u_pattern_tl_b:new l.c3(d,t.u_pattern_tl_b),u_pattern_br_b:new l.c3(d,t.u_pattern_br_b),u_texsize:new l.c3(d,t.u_texsize),u_mix:new l.bq(d,t.u_mix),u_pattern_size_a:new l.c3(d,t.u_pattern_size_a),u_pattern_size_b:new l.c3(d,t.u_pattern_size_b),u_scale_a:new l.bq(d,t.u_scale_a),u_scale_b:new l.bq(d,t.u_scale_b),u_pixel_coord_upper:new l.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.c3(d,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.bq(d,t.u_tile_units_to_pixels)}),terrain:(d,t)=>({u_texture:new l.b_(d,t.u_texture),u_ele_delta:new l.bq(d,t.u_ele_delta),u_fog_matrix:new l.c0(d,t.u_fog_matrix),u_fog_color:new l.b$(d,t.u_fog_color),u_fog_ground_blend:new l.bq(d,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new l.bq(d,t.u_fog_ground_blend_opacity),u_horizon_color:new l.b$(d,t.u_horizon_color),u_horizon_fog_blend:new l.bq(d,t.u_horizon_fog_blend),u_is_globe_mode:new l.bq(d,t.u_is_globe_mode)}),terrainDepth:(d,t)=>({u_ele_delta:new l.bq(d,t.u_ele_delta)}),terrainCoords:(d,t)=>({u_texture:new l.b_(d,t.u_texture),u_terrain_coords_id:new l.bq(d,t.u_terrain_coords_id),u_ele_delta:new l.bq(d,t.u_ele_delta)}),projectionErrorMeasurement:(d,t)=>({u_input:new l.bq(d,t.u_input),u_output_expected:new l.bq(d,t.u_output_expected)}),atmosphere:(d,t)=>({u_sun_pos:new l.c2(d,t.u_sun_pos),u_atmosphere_blend:new l.bq(d,t.u_atmosphere_blend),u_globe_position:new l.c2(d,t.u_globe_position),u_globe_radius:new l.bq(d,t.u_globe_radius),u_inv_proj_matrix:new l.c0(d,t.u_inv_proj_matrix)}),sky:(d,t)=>({u_sky_color:new l.b$(d,t.u_sky_color),u_horizon_color:new l.b$(d,t.u_horizon_color),u_horizon:new l.c3(d,t.u_horizon),u_horizon_normal:new l.c3(d,t.u_horizon_normal),u_sky_horizon_blend:new l.bq(d,t.u_sky_horizon_blend),u_sky_blend:new l.bq(d,t.u_sky_blend)})};class yh{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Hc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class vh{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const c=n.attributes[this.attributes[a].name];c!==void 0&&t.enableVertexAttribArray(c)}}setVertexAttribPointers(t,n,a){for(let c=0;c<this.attributes.length;c++){const p=this.attributes[c],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Hc[p.type]],!1,this.itemSize,p.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _t{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 lo extends _t{getDefault(){return l.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class co extends _t{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class uo extends _t{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ml extends _t{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Kn extends _t{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ha extends _t{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ks extends _t{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class br extends _t{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Xc extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Yc extends _t{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Il extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Jn extends _t{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ho extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class po extends _t{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class da extends _t{getDefault(){return l.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class fo extends _t{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Kc extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Ds extends _t{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Rs extends _t{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Jc extends _t{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class El extends _t{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ct extends _t{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class mo extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class xh extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Qc extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class pa extends _t{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class bh extends _t{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class wh extends _t{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const a=this.gl;xr(a)?a.bindVertexArray(t):(n=a.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class eu extends _t{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Th extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Cl extends _t{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ls extends _t{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class fa extends Ls{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class go extends Ls{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Al extends Ls{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const zl="Framebuffer is not complete";class _o{constructor(t,n,a,c,p){this.context=t,this.width=n,this.height=a;const m=t.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new fa(t,_),c)this.depthAttachment=p?new Al(t,_):new go(t,_);else if(p)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error(zl)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class yo{constructor(t){var n,a;if(this.gl=t,this.clearColor=new lo(this),this.clearDepth=new co(this),this.clearStencil=new uo(this),this.colorMask=new Ml(this),this.depthMask=new Kn(this),this.stencilMask=new ha(this),this.stencilFunc=new ks(this),this.stencilOp=new br(this),this.stencilTest=new Xc(this),this.depthRange=new Yc(this),this.depthTest=new Il(this),this.depthFunc=new Jn(this),this.blend=new ho(this),this.blendFunc=new po(this),this.blendColor=new da(this),this.blendEquation=new fo(this),this.cullFace=new Kc(this),this.cullFaceSide=new Ds(this),this.frontFace=new Rs(this),this.program=new Jc(this),this.activeTexture=new El(this),this.viewport=new ct(this),this.bindFramebuffer=new mo(this),this.bindRenderbuffer=new xh(this),this.bindTexture=new Qc(this),this.bindVertexBuffer=new pa(this),this.bindElementBuffer=new bh(this),this.bindVertexArray=new wh(this),this.pixelStoreUnpack=new eu(this),this.pixelStoreUnpackPremultiplyAlpha=new Th(this),this.pixelStoreUnpackFlipY=new Cl(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.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),xr(t)){this.HALF_FLOAT=t.HALF_FLOAT;const c=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:c?.RGBA16F_EXT,this.RGB16F=(a=t.RGB16F)!==null&&a!==void 0?a:c?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const c=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=c?.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new yh(this,t,n)}createVertexBuffer(t,n,a){return new vh(this,t,n,a)}createRenderbuffer(t,n,a){const c=this.gl,p=c.createRenderbuffer();return this.bindRenderbuffer.set(p),c.renderbufferStorage(c.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,a,c){return new _o(this,t,n,a,c)}clear({color:t,depth:n,stencil:a}){const c=this.gl;let p=0;t&&(p|=c.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a!==void 0&&(p|=c.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),c.clear(p)}setCullFace(t){t.enable===!1?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){l.bR(t.blendFunction,Ct.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return xr(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return xr(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Mn;function Qn(d,t,n,a,c){const p=d.context,m=d.transform,_=p.gl,v=d.useProgram("collisionBox"),b=[];let T=0,A=0;for(let Z=0;Z<a.length;Z++){const K=a[Z],ie=t.getTile(K).getBucket(n);if(!ie)continue;const H=c?ie.textCollisionBox:ie.iconCollisionBox,ee=ie.collisionCircleArray;ee.length>0&&(b.push({circleArray:ee,circleOffset:A,coord:K}),T+=ee.length/4,A=T),H&&v.draw(p,_.LINES,st.disabled,ft.disabled,d.colorModeForRenderPass(),pt.disabled,Xn(d.transform),d.style.map.terrain&&d.style.map.terrain.getTerrainData(K),m.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,null,d.transform.zoom,null,null,H.collisionVertexBuffer)}if(!c||!b.length)return;const C=d.useProgram("collisionCircle"),D=new l.ca;D.resize(4*T),D._trim();let V=0;for(const Z of b)for(let K=0;K<Z.circleArray.length/4;K++){const ie=4*K,H=Z.circleArray[ie+0],ee=Z.circleArray[ie+1],ne=Z.circleArray[ie+2],Q=Z.circleArray[ie+3];D.emplace(V++,H,ee,ne,Q,0),D.emplace(V++,H,ee,ne,Q,1),D.emplace(V++,H,ee,ne,Q,2),D.emplace(V++,H,ee,ne,Q,3)}(!Mn||Mn.length<2*T)&&(Mn=(function(Z){const K=2*Z,ie=new l.cc;ie.resize(K),ie._trim();for(let H=0;H<K;H++){const ee=6*H;ie.uint16[ee+0]=4*H+0,ie.uint16[ee+1]=4*H+1,ie.uint16[ee+2]=4*H+2,ie.uint16[ee+3]=4*H+2,ie.uint16[ee+4]=4*H+3,ie.uint16[ee+5]=4*H+0}return ie})(T));const q=p.createIndexBuffer(Mn,!0),W=p.createVertexBuffer(D,l.cb.members,!0);for(const Z of b){const K=Uc(d.transform);C.draw(p,_.TRIANGLES,st.disabled,ft.disabled,d.colorModeForRenderPass(),pt.disabled,K,d.style.map.terrain&&d.style.map.terrain.getTerrainData(Z.coord),null,n.id,W,q,l.aX.simpleSegment(0,2*Z.circleOffset,Z.circleArray.length,Z.circleArray.length/2),null,d.transform.zoom,null,null,null)}W.destroy(),q.destroy()}const kl=l.ar(new Float32Array(16));function Sh(d,t,n,a,c,p){const{horizontalAlign:m,verticalAlign:_}=l.aS(d);return new l.P((-(m-.5)*t/c+a[0])*p,(-(_-.5)*n/c+a[1])*p)}function ma(d,t,n,a,c,p){const m=t.tileAnchorPoint.add(new l.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let _=a.mult(p);n||(_=_.rotate(-c));const v=m.add(_);return nt(v.x,v.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const _=Tt(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(d),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return d.add(a.rotate(v))}return d.add(a)}function Ph(d,t,n,a,c,p,m,_,v,b,T,A){const C=d.text.placedSymbolArray,D=d.text.dynamicLayoutVertexArray,V=d.icon.dynamicLayoutVertexArray,q={};D.clear();for(let W=0;W<C.length;W++){const Z=C.get(W),K=Z.hidden||!Z.crossTileID||d.allowVerticalPlacement&&!Z.placedOrientation?null:a[Z.crossTileID];if(K){const ie=new l.P(Z.anchorX,Z.anchorY),H={getElevation:A,width:c.width,height:c.height,pitchedLabelPlaneMatrix:p,pitchWithMap:n,transform:c,tileAnchorPoint:ie,translation:b,unwrappedTileID:T},ee=n?ys(ie.x,ie.y,H):Tt(ie.x,ie.y,H),ne=Ks(c.cameraToCenterDistance,ee.signedDistanceFromCamera);let Q=l.aA(d.textSizeData,_,Z)*ne/l.aM;n&&(Q*=d.tilePixelRatio/m);const{width:oe,height:be,anchor:fe,textOffset:ge,textBoxScale:ye}=K,ze=Sh(fe,oe,be,ge,ye,Q),ke=c.getPitchedTextCorrection(ie.x+b[0],ie.y+b[1],T),Ie=ma(ee.point,H,t,ze,-c.bearingInRadians,ke),Fe=d.allowVerticalPlacement&&Z.placedOrientation===l.az.vertical?Math.PI/2:0;for(let it=0;it<Z.numGlyphs;it++)l.aG(D,Ie,Fe);v&&Z.associatedIconIndex>=0&&(q[Z.associatedIconIndex]={shiftedAnchor:Ie,angle:Fe})}else Gn(Z.numGlyphs,D)}if(v){V.clear();const W=d.icon.placedSymbolArray;for(let Z=0;Z<W.length;Z++){const K=W.get(Z);if(K.hidden)Gn(K.numGlyphs,V);else{const ie=q[Z];if(ie)for(let H=0;H<K.numGlyphs;H++)l.aG(V,ie.shiftedAnchor,ie.angle);else Gn(K.numGlyphs,V)}}d.icon.dynamicLayoutVertexBuffer.updateData(V)}d.text.dynamicLayoutVertexBuffer.updateData(D)}function tu(d,t,n){return n.iconsInText&&t?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function ga(d,t,n,a,c,p,m,_,v,b,T,A,C){const D=d.context,V=D.gl,q=d.transform,W=_==="map",Z=v==="map",K=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",ie=W&&!Z&&!K,H=!n.layout.get("symbol-sort-key").isConstant();let ee=!1;const ne=d.getDepthModeForSublayer(0,st.ReadOnly),Q=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),oe=[],be=q.getCircleRadiusCorrection();for(const fe of a){const ge=t.getTile(fe),ye=ge.getBucket(n);if(!ye)continue;const ze=c?ye.text:ye.icon;if(!ze||!ze.segments.get().length||!ze.hasVisibleVertices)continue;const ke=ze.programConfigurations.get(n.id),Ie=c||ye.sdfIcons,Fe=c?ye.textSizeData:ye.iconSizeData,it=Z||q.pitch!==0,bt=d.useProgram(tu(Ie,c,ye),ke),Ft=l.ay(Fe,q.zoom),At=d.style.map.terrain&&d.style.map.terrain.getTerrainData(fe);let Vt,zt,Kt,Nt,bi=[0,0],oi=null;if(c)zt=ge.glyphAtlasTexture,Kt=V.LINEAR,Vt=ge.glyphAtlasTexture.size,ye.iconsInText&&(bi=ge.imageAtlasTexture.size,oi=ge.imageAtlasTexture,Nt=it||d.options.rotating||d.options.zooming||Fe.kind==="composite"||Fe.kind==="camera"?V.LINEAR:V.NEAREST);else{const Dt=n.layout.get("icon-size").constantOr(0)!==1||ye.iconsNeedLinear;zt=ge.imageAtlasTexture,Kt=Ie||d.options.rotating||d.options.zooming||Dt||it?V.LINEAR:V.NEAREST,Vt=ge.imageAtlasTexture.size}const si=l.aN(ge,1,d.transform.zoom),Ai=ur(W,d.transform,si),zn=l.N();l.aB(zn,Ai);const ln=Ha(Z,W,d.transform,si),Jr=l.aO(q,ge,p,m),ir=q.getProjectionData({overscaledTileID:fe,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),ss=Q&&ye.hasTextData(),Fa=n.layout.get("icon-text-fit")!=="none"&&ss&&ye.hasIconData();if(K){const Dt=d.style.map.terrain?(mi,gi)=>d.style.map.terrain.getElevation(fe,mi,gi):null,kt=n.layout.get("text-rotation-alignment")==="map";Xa(ye,d,c,Ai,zn,Z,b,kt,fe.toUnwrapped(),q.width,q.height,Jr,Dt)}const as=c&&Q||Fa,Sr=K||as?kl:Z?Ai:d.transform.clipSpaceToPixelsMatrix,Qr=Ie&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Fr;Fr=Ie?ye.iconsInText?Yn(Fe.kind,Ft,ie,Z,K,as,d,Sr,ln,Jr,Vt,bi,be):oo(Fe.kind,Ft,ie,Z,K,as,d,Sr,ln,Jr,c,Vt,0,be):Sl(Fe.kind,Ft,ie,Z,K,as,d,Sr,ln,Jr,c,Vt,be);const Br={program:bt,buffers:ze,uniformValues:Fr,projectionData:ir,atlasTexture:zt,atlasTextureIcon:oi,atlasInterpolation:Kt,atlasInterpolationIcon:Nt,isSDF:Ie,hasHalo:Qr};if(H&&ye.canOverlap){ee=!0;const Dt=ze.segments.get();for(const kt of Dt)oe.push({segments:new l.aX([kt]),sortKey:kt.sortKey,state:Br,terrainData:At})}else oe.push({segments:ze.segments,sortKey:0,state:Br,terrainData:At})}ee&&oe.sort(((fe,ge)=>fe.sortKey-ge.sortKey));for(const fe of oe){const ge=fe.state;if(D.activeTexture.set(V.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,V.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(D.activeTexture.set(V.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),ge.isSDF){const ye=ge.uniformValues;ge.hasHalo&&(ye.u_is_halo=1,vo(ge.buffers,fe.segments,n,d,ge.program,ne,T,A,ye,ge.projectionData,fe.terrainData)),ye.u_is_halo=0}vo(ge.buffers,fe.segments,n,d,ge.program,ne,T,A,ge.uniformValues,ge.projectionData,fe.terrainData)}}function vo(d,t,n,a,c,p,m,_,v,b,T){const A=a.context;c.draw(A,A.gl.TRIANGLES,p,m,_,pt.backCCW,v,T,b,n.id,d.layoutVertexBuffer,d.indexBuffer,t,n.paint,a.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function iu(d,t,n,a,c){const p=d.context,m=p.gl,_=ft.disabled,v=new Ct([m.ONE,m.ONE],l.bp.transparent,[!0,!0,!0,!0]),b=t.getBucket(n);if(!b)return;const T=a.key;let A=n.heatmapFbos.get(T);A||(A=_a(p,t.tileSize,t.tileSize),n.heatmapFbos.set(T,A)),p.bindFramebuffer.set(A.framebuffer),p.viewport.set([0,0,t.tileSize,t.tileSize]),p.clear({color:l.bp.transparent});const C=b.programConfigurations.get(n.id),D=d.useProgram("heatmap",C,!c),V=d.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=d.style.map.terrain.getTerrainData(a);D.draw(p,m.TRIANGLES,st.disabled,_,v,pt.disabled,zs(t,d.transform.zoom,n.paint.get("heatmap-intensity"),1),q,V,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,d.transform.zoom,C)}function ru(d,t,n,a,c){const p=d.context,m=p.gl,_=d.transform;p.setColorMode(d.colorModeForRenderPass());const v=xo(p,t),b=n.key,T=t.heatmapFbos.get(b);if(!T)return;p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,T.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),v.bind(m.LINEAR,m.CLAMP_TO_EDGE);const A=_.getProjectionData({overscaledTileID:n,applyTerrainMatrix:c,applyGlobeMatrix:!a});d.useProgram("heatmapTexture").draw(p,m.TRIANGLES,st.disabled,ft.disabled,d.colorModeForRenderPass(),pt.disabled,Gc(d,t,0,1),null,A,t.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments,t.paint,_.zoom),T.destroy(),t.heatmapFbos.delete(b)}function _a(d,t,n){var a,c;const p=d.gl,m=p.createTexture();p.bindTexture(p.TEXTURE_2D,m),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.LINEAR);const _=(a=d.HALF_FLOAT)!==null&&a!==void 0?a:p.UNSIGNED_BYTE,v=(c=d.RGBA16F)!==null&&c!==void 0?c:p.RGBA;p.texImage2D(p.TEXTURE_2D,0,v,t,n,0,p.RGBA,_,null);const b=d.createFramebuffer(t,n,!1,!1);return b.colorAttachment.set(m),b}function xo(d,t){return t.colorRampTexture||(t.colorRampTexture=new l.T(d,t.colorRamp,d.gl.RGBA)),t.colorRampTexture}function nu(d,t,n,a,c,p,m,_){let v=256;if(c.stepInterpolant){const b=t.getSource().maxzoom,T=m.canonical.z===b?Math.ceil(1<<d.transform.maxZoom-m.canonical.z):1;v=l.an(l.ce(p.maxLineLength/l.a5*1024*T),256,n.maxTextureSize)}return _.gradient=l.cf({expression:c.gradientExpression(),evaluationKey:"lineProgress",resolution:v,image:_.gradient||void 0,clips:p.lineClipsArray}),_.texture?_.texture.update(_.gradient):_.texture=new l.T(n,_.gradient,a.RGBA),_.version=c.gradientVersion,_.texture}function su(d,t,n,a,c){d.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),a.updatePaintBuffers(c)}function ri(d,t,n,a,c,p){(c||d.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),d.lineAtlas.bind(t)),a.updatePaintBuffers(p)}function es(d,t,n,a,c,p,m){const _=p.gradients[c.id];let v=_.texture;c.gradientVersion!==_.version&&(v=nu(d,t,n,a,c,p,m,_)),n.activeTexture.set(a.TEXTURE0),v.bind(c.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}function dr(d,t,n,a,c,p,m,_,v){const b=p.gradients[c.id];let T=b.texture;c.gradientVersion!==b.version&&(T=nu(d,t,n,a,c,p,m,b)),n.activeTexture.set(a.TEXTURE0),T.bind(c.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),n.activeTexture.set(a.TEXTURE1),d.lineAtlas.bind(n),_.updatePaintBuffers(v)}function bo(d,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=c.getPaintProperty(t);m=p[v],_=p[v]}m&&_&&d.setConstantPatternPositions(m,_)}function ya(d,t,n,a,c,p,m,_){const v=d.context.gl,b="fill-pattern",T=n.paint.get(b),A=T&&T.constantOr(1),C=n.getCrossfadeParameters();let D,V,q,W,Z;const K=d.transform,ie=n.paint.get("fill-translate"),H=n.paint.get("fill-translate-anchor");m?(V=A&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",D=v.LINES):(V=A?"fillPattern":"fill",D=v.TRIANGLES);const ee=T.constantOr(null);for(const ne of a){const Q=t.getTile(ne);if(A&&!Q.patternsLoaded())continue;const oe=Q.getBucket(n);if(!oe)continue;const be=oe.programConfigurations.get(n.id),fe=d.useProgram(V,be),ge=d.style.map.terrain&&d.style.map.terrain.getTerrainData(ne);A&&(d.context.activeTexture.set(v.TEXTURE0),Q.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),be.updatePaintBuffers(C)),bo(be,b,ee,Q,n);const ye=K.getProjectionData({overscaledTileID:ne,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),ze=l.aO(K,Q,ie,H);if(m){W=oe.indexBuffer2,Z=oe.segments2;const Ie=[v.drawingBufferWidth,v.drawingBufferHeight];q=V==="fillOutlinePattern"&&A?Vc(d,C,Q,Ie,ze):jc(Ie,ze)}else W=oe.indexBuffer,Z=oe.segments,q=A?vl(d,C,Q,ze):{u_fill_translate:ze};const ke=d.stencilModeForClipping(ne);fe.draw(d.context,D,c,ke,p,pt.backCCW,q,ge,ye,n.id,oe.layoutVertexBuffer,W,Z,n.paint,d.transform.zoom,be)}}function wo(d,t,n,a,c,p,m,_){const v=d.context,b=v.gl,T="fill-extrusion-pattern",A=n.paint.get(T),C=A.constantOr(1),D=n.getCrossfadeParameters(),V=n.paint.get("fill-extrusion-opacity"),q=A.constantOr(null),W=d.transform;for(const Z of a){const K=t.getTile(Z),ie=K.getBucket(n);if(!ie)continue;const H=d.style.map.terrain&&d.style.map.terrain.getTerrainData(Z),ee=ie.programConfigurations.get(n.id),ne=d.useProgram(C?"fillExtrusionPattern":"fillExtrusion",ee);C&&(d.context.activeTexture.set(b.TEXTURE0),K.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),ee.updatePaintBuffers(D));const Q=W.getProjectionData({overscaledTileID:Z,applyGlobeMatrix:!_,applyTerrainMatrix:!0});bo(ee,T,q,K,n);const oe=l.aO(W,K,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),be=n.paint.get("fill-extrusion-vertical-gradient"),fe=C?yl(d,be,V,oe,Z,D,K):_l(d,be,V,oe);ne.draw(v,v.gl.TRIANGLES,c,p,m,pt.backCCW,fe,H,Q,n.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,n.paint,d.transform.zoom,ee,d.style.map.terrain&&ie.centroidVertexBuffer)}}function In(d,t,n,a,c,p,m,_,v){var b;const T=d.style.projection,A=d.context,C=d.transform,D=A.gl,V=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],q=d.useProgram("hillshade",null,!1,V),W=!d.options.moving;for(const Z of a){const K=t.getTile(Z),ie=K.fbo;if(!ie)continue;const H=T.getMeshFromTileID(A,Z.canonical,_,!0,"raster"),ee=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(Z);A.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,ie.colorAttachment.get());const ne=C.getProjectionData({overscaledTileID:Z,aligned:W,applyGlobeMatrix:!v,applyTerrainMatrix:!0});q.draw(A,D.TRIANGLES,p,c[Z.overscaledZ],m,pt.backCCW,no(d,K,n),ee,ne,n.id,H.vertexBuffer,H.indexBuffer,H.segments)}}function va(d,t,n,a,c,p,m,_,v){var b;const T=d.style.projection,A=d.context,C=d.transform,D=A.gl,V=d.useProgram("colorRelief"),q=!d.options.moving;let W=!0,Z=0;for(const K of a){const ie=t.getTile(K),H=ie.dem;if(W){const fe=D.getParameter(D.MAX_TEXTURE_SIZE),{elevationTexture:ge,colorTexture:ye}=n.getColorRampTextures(A,fe,H.getUnpackVector());A.activeTexture.set(D.TEXTURE1),ge.bind(D.NEAREST,D.CLAMP_TO_EDGE),A.activeTexture.set(D.TEXTURE4),ye.bind(D.LINEAR,D.CLAMP_TO_EDGE),W=!1,Z=ge.size[0]}if(!H||!H.data)continue;const ee=H.stride,ne=H.getPixels();if(A.activeTexture.set(D.TEXTURE0),A.pixelStoreUnpackPremultiplyAlpha.set(!1),ie.demTexture=ie.demTexture||d.getTileTexture(ee),ie.demTexture){const fe=ie.demTexture;fe.update(ne,{premultiply:!1}),fe.bind(D.LINEAR,D.CLAMP_TO_EDGE)}else ie.demTexture=new l.T(A,ne,D.RGBA,{premultiply:!1}),ie.demTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE);const Q=T.getMeshFromTileID(A,K.canonical,_,!0,"raster"),oe=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(K),be=C.getProjectionData({overscaledTileID:K,aligned:q,applyGlobeMatrix:!v,applyTerrainMatrix:!0});V.draw(A,D.TRIANGLES,p,c[K.overscaledZ],m,pt.backCCW,$c(n,ie.dem,Z),oe,be,n.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const ts=[new l.P(0,0),new l.P(l.a5,0),new l.P(l.a5,l.a5),new l.P(0,l.a5)];function Fs(d,t,n,a,c,p,m,_,v=!1,b=!1){const T=a[a.length-1].overscaledZ,A=d.context,C=A.gl,D=d.useProgram("raster"),V=d.transform,q=d.style.projection,W=d.colorModeForRenderPass(),Z=!d.options.moving,K=n.paint.get("raster-opacity"),ie=n.paint.get("raster-resampling"),H=n.paint.get("raster-fade-duration"),ee=!!d.style.map.terrain;for(const ne of a){const Q=d.getDepthModeForSublayer(ne.overscaledZ-T,K===1?st.ReadWrite:st.ReadOnly,C.LESS),oe=t.getTile(ne),be=ie==="nearest"?C.NEAREST:C.LINEAR;A.activeTexture.set(C.TEXTURE0),oe.texture.bind(be,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(C.TEXTURE1);const{parentTile:fe,parentScaleBy:ge,parentTopLeft:ye,fadeValues:ze}=au(oe,t,H,ee);oe.fadeOpacity=ze.tileOpacity,fe?(fe.fadeOpacity=ze.parentTileOpacity,fe.texture.bind(be,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST)):oe.texture.bind(be,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),oe.texture.useMipmap&&A.extTextureFilterAnisotropic&&d.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ke=d.style.map.terrain&&d.style.map.terrain.getTerrainData(ne),Ie=V.getProjectionData({overscaledTileID:ne,aligned:Z,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),Fe=wl(ye,ge,ze.fadeMix,n,_),it=q.getMeshFromTileID(A,ne.canonical,p,m,"raster");D.draw(A,C.TRIANGLES,Q,c?c[ne.overscaledZ]:ft.disabled,W,v?pt.frontCCW:pt.backCCW,Fe,ke,Ie,n.id,it.vertexBuffer,it.indexBuffer,it.segments)}}function au(d,t,n,a){const c={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||a)return c;if(d.fadingParentID){const p=t.getLoadedTile(d.fadingParentID);if(!p)return c;const m=Math.pow(2,p.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*m%1,d.tileID.canonical.y*m%1],v=(function(b,T,A){const C=Xe(),D=(C-T.timeAdded)/A,V=b.fadingDirection===xe.Incoming,q=l.an((C-b.timeAdded)/A,0,1),W=l.an(1-D,0,1),Z=V?q:W;return{tileOpacity:Z,parentTileOpacity:V?W:q,fadeMix:{opacity:1,mix:1-Z}}})(d,p,n);return{parentTile:p,parentScaleBy:m,parentTopLeft:_,fadeValues:v}}if(d.selfFading){const p=(function(m,_){const v=(Xe()-m.timeAdded)/_,b=l.an(v,0,1);return{tileOpacity:b,fadeMix:{opacity:b,mix:0}}})(d,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:p}}return c}const ou=new l.bp(1,0,0,1),lu=new l.bp(0,1,0,1),cu=new l.bp(0,0,1,1),uu=new l.bp(1,0,1,1),En=new l.bp(0,1,1,1);function Dl(d,t,n,a){xa(d,0,t+n/2,d.transform.width,n,a)}function Rl(d,t,n,a){xa(d,t-n/2,0,n,d.transform.height,a)}function xa(d,t,n,a,c,p){const m=d.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*d.pixelRatio,n*d.pixelRatio,a*d.pixelRatio,c*d.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function hu(d,t,n){const a=d.context,c=a.gl,p=d.useProgram("debug"),m=st.disabled,_=ft.disabled,v=d.colorModeForRenderPass(),b="$debug",T=d.style.map.terrain&&d.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const A=t.getTileByID(n.key).latestRawTileData,C=Math.floor((A&&A.byteLength||0)/1024),D=t.getTile(n).tileSize,V=512/Math.min(D,512)*(n.overscaledZ/d.transform.zoom)*.5;let q=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(q+=` => ${n.overscaledZ}`),(function(Z,K){Z.initDebugOverlayCanvas();const ie=Z.debugOverlayCanvas,H=Z.context.gl,ee=Z.debugOverlayCanvas.getContext("2d");ee.clearRect(0,0,ie.width,ie.height),ee.shadowColor="white",ee.shadowBlur=2,ee.lineWidth=1.5,ee.strokeStyle="white",ee.textBaseline="top",ee.font="bold 36px Open Sans, sans-serif",ee.fillText(K,5,5),ee.strokeText(K,5,5),Z.debugOverlayTexture.update(ie),Z.debugOverlayTexture.bind(H.LINEAR,H.CLAMP_TO_EDGE)})(d,`${q} ${C}kB`);const W=d.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(a,c.TRIANGLES,m,_,Ct.alphaBlended,pt.disabled,xl(l.bp.transparent,V),null,W,b,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),p.draw(a,c.LINE_STRIP,m,_,v,pt.disabled,xl(l.bp.red),T,W,b,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function Ll(d,t,n,a){const{isRenderingGlobe:c}=a,p=d.context,m=p.gl,_=d.transform,v=d.colorModeForRenderPass(),b=d.getDepthModeFor3D(),T=d.useProgram("terrain");p.bindFramebuffer.set(null),p.viewport.set([0,0,d.width,d.height]);for(const A of n){const C=t.getTerrainMesh(A.tileID),D=d.renderToTexture.getTexture(A),V=t.getTerrainData(A.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D.texture);const q=t.getMeshFrameDelta(_.zoom),W=_.calculateFogMatrix(A.tileID.toUnwrapped()),Z=ph(q,W,d.style.sky,_.pitch,c),K=_.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});T.draw(p,m.TRIANGLES,b,ft.disabled,v,pt.backCCW,Z,V,K,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}function Fl(d,t){if(!t.mesh){const n=new l.aW;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const a=new l.aY;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),t.mesh=new Et(d.createVertexBuffer(n,Tn.members),d.createIndexBuffer(a),l.aX.simpleSegment(0,0,n.length,a.length))}return t.mesh}class du{constructor(t,n){this.context=new yo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=vr.maxOverzooming+vr.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new er}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style._order)this.style._layers[c].resize()}setup(){const t=this.context,n=new l.aW;n.emplaceBack(0,0),n.emplaceBack(l.a5,0),n.emplaceBack(0,l.a5),n.emplaceBack(l.a5,l.a5),this.tileExtentBuffer=t.createVertexBuffer(n,Tn.members),this.tileExtentSegments=l.aX.simpleSegment(0,0,4,2);const a=new l.aW;a.emplaceBack(0,0),a.emplaceBack(l.a5,0),a.emplaceBack(0,l.a5),a.emplaceBack(l.a5,l.a5),this.debugBuffer=t.createVertexBuffer(a,Tn.members),this.debugSegments=l.aX.simpleSegment(0,0,4,5);const c=new l.ch;c.emplaceBack(0,0,0,0),c.emplaceBack(l.a5,0,l.a5,0),c.emplaceBack(0,l.a5,0,l.a5),c.emplaceBack(l.a5,l.a5,l.a5,l.a5),this.rasterBoundsBuffer=t.createVertexBuffer(c,dh.members),this.rasterBoundsSegments=l.aX.simpleSegment(0,0,4,2);const p=new l.aW;p.emplaceBack(0,0),p.emplaceBack(l.a5,0),p.emplaceBack(0,l.a5),p.emplaceBack(l.a5,l.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(p,Tn.members),this.rasterBoundsSegmentsPosOnly=l.aX.simpleSegment(0,0,4,5);const m=new l.aW;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(m,Tn.members),this.viewportSegments=l.aX.simpleSegment(0,0,4,2);const _=new l.ci;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(_);const v=new l.aY;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(v);const b=this.context.gl;this.stencilClearMode=new ft({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.tileExtentMesh=new Et(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=l.N();l.c7(a,0,this.width,this.height,0,0,1),l.Q(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const c={mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,st.disabled,this.stencilClearMode,Ct.disabled,pt.disabled,null,null,c,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,a){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const c=this.context;c.setColorMode(Ct.disabled),c.setDepthMode(st.disabled);const p={};for(const m of n)p[m.key]=this.nextStencilID++;this._renderTileMasks(p,n,a,!0),this._renderTileMasks(p,n,a,!1),this._tileClippingMaskIDs=p}_renderTileMasks(t,n,a,c){const p=this.context,m=p.gl,_=this.style.projection,v=this.transform,b=this.useProgram("clippingMask");for(const T of n){const A=t[T.key],C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T),D=_.getMeshFromTileID(this.context,T.canonical,c,!0,"stencil"),V=v.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!a,applyTerrainMatrix:!0});b.draw(p,m.TRIANGLES,st.disabled,new ft({func:m.ALWAYS,mask:0},A,255,m.KEEP,m.KEEP,m.REPLACE),Ct.disabled,a?pt.disabled:pt.backCCW,null,C,V,"$clipping",D.vertexBuffer,D.indexBuffer,D.segments)}}_renderTilesDepthBuffer(){const t=this.context,n=t.gl,a=this.style.projection,c=this.transform,p=this.useProgram("depth"),m=this.getDepthModeFor3D(),_=Ht(c,{tileSize:c.tileSize});for(const v of _){const b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),T=a.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),A=c.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(t,n.TRIANGLES,m,ft.disabled,Ct.disabled,pt.backCCW,null,b,A,"$clipping",T.vertexBuffer,T.indexBuffer,T.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new ft({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new ft({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,a=t.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+c]=new ft({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,a]}return[{[c]:ft.disabled},a]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,a=t.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(this.clearStencil(),p>1){const m={},_={};for(let v=0;v<p;v++)m[v+c]=new ft({func:n.GREATER,mask:255},p+1+v,255,n.KEEP,n.KEEP,n.REPLACE),_[v+c]=new ft({func:n.GREATER,mask:255},1+v,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*p+1,[m,_,a]}return this.nextStencilID=3,[{[c]:new ft({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[c]:new ft({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ct([t.CONSTANT_COLOR,t.ONE],new l.bp(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ct.unblended:Ct.alphaBlended}getDepthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return st.disabled;const c=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new st(a||this.context.gl.LEQUAL,n,[c,c])}getDepthModeFor3D(){return new st(this.context.gl.LEQUAL,st.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var a,c;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Xe()),this.imageManager.beginFrame();const p=this.style._order,m=this.style.tileManagers,_={},v={},b={},T={isRenderingToTexture:!1,isRenderingGlobe:((a=t.projection)===null||a===void 0?void 0:a.transitionState)>0};for(const C in m){const D=m[C];D.used&&D.prepare(this.context),_[C]=D.getVisibleCoordinates(!1),v[C]=_[C].slice().reverse(),b[C]=D.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let C=0;C<p.length;C++)if(this.style._layers[p[C]].is3D()){this.opaquePassCutoff=C;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const C of p){const D=this.style._layers[C];if(!D.hasOffscreenPass()||D.isHidden(this.transform.zoom))continue;const V=v[D.source];(D.type==="custom"||V.length)&&this.renderLayer(this,m[D.source],D,V,T)}if((c=this.style.projection)===null||c===void 0||c.updateGPUdependent({context:this.context,useProgram:C=>this.useProgram(C)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.bp.black:l.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(C,D){const V=C.context,q=V.gl,W=((ne,Q,oe)=>{const be=Math.cos(Q.rollInRadians),fe=Math.sin(Q.rollInRadians),ge=St(Q),ye=Q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:ne.properties.get("sky-color"),u_horizon_color:ne.properties.get("horizon-color"),u_horizon:[(Q.width/2-ge*fe)*oe,(Q.height/2+ge*be)*oe],u_horizon_normal:[-fe,be],u_sky_horizon_blend:ne.properties.get("sky-horizon-blend")*Q.height/2*oe,u_sky_blend:ye}})(D,C.style.map.transform,C.pixelRatio),Z=new st(q.LEQUAL,st.ReadWrite,[0,1]),K=ft.disabled,ie=C.colorModeForRenderPass(),H=C.useProgram("sky"),ee=Fl(V,D);H.draw(V,q.TRIANGLES,Z,K,ie,pt.disabled,W,null,void 0,"sky",ee.vertexBuffer,ee.indexBuffer,ee.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const C=this.style._layers[p[this.currentLayer]],D=m[C.source],V=_[C.source];this._renderTileClippingMasks(C,V,!1),this.renderLayer(this,D,C,V,T)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const C=this.style._layers[p[this.currentLayer]],D=m[C.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(C,T))continue;this.opaquePassEnabledForLayer()||A||(A=!0,T.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const V=(C.type==="symbol"?b:v)[C.source];this._renderTileClippingMasks(C,_[C.source],!!this.renderToTexture),this.renderLayer(this,D,C,V,T)}if(T.isRenderingGlobe&&(function(C,D,V){const q=C.context,W=q.gl,Z=C.useProgram("atmosphere"),K=new st(W.LEQUAL,st.ReadOnly,[0,1]),ie=C.transform,H=(function(ye,ze){const ke=ye.properties.get("position"),Ie=[-ke.x,-ke.y,-ke.z],Fe=l.ar(new Float64Array(16));return ye.properties.get("anchor")==="map"&&(l.bg(Fe,Fe,ze.rollInRadians),l.bh(Fe,Fe,-ze.pitchInRadians),l.bg(Fe,Fe,ze.bearingInRadians),l.bh(Fe,Fe,ze.center.lat*Math.PI/180),l.bJ(Fe,Fe,-ze.center.lng*Math.PI/180)),l.cg(Ie,Ie,Fe),Ie})(V,C.transform),ee=ie.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ne=D.properties.get("atmosphere-blend")*ee.projectionTransition;if(ne===0)return;const Q=Wn(ie.worldSize,ie.center.lat),oe=ie.inverseProjectionMatrix,be=new Float64Array(4);be[3]=1,l.aH(be,be,ie.modelViewProjectionMatrix),be[0]/=be[3],be[1]/=be[3],be[2]/=be[3],be[3]=1,l.aH(be,be,oe),be[0]/=be[3],be[1]/=be[3],be[2]/=be[3],be[3]=1;const fe=((ye,ze,ke,Ie,Fe)=>({u_sun_pos:ye,u_atmosphere_blend:ze,u_globe_position:ke,u_globe_radius:Ie,u_inv_proj_matrix:Fe}))(H,ne,[be[0],be[1],be[2]],Q,oe),ge=Fl(q,D);Z.draw(q,W.TRIANGLES,K,ft.disabled,Ct.alphaBlended,pt.disabled,fe,null,null,"atmosphere",ge.vertexBuffer,ge.indexBuffer,ge.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const C=(function(D,V){let q=null;const W=Object.values(D._layers).flatMap((H=>H.source&&!H.isHidden(V)?[D.tileManagers[H.source]]:[])),Z=W.filter((H=>H.getSource().type==="vector")),K=W.filter((H=>H.getSource().type!=="vector")),ie=H=>{(!q||q.getSource().maxzoom<H.getSource().maxzoom)&&(q=H)};return Z.forEach((H=>ie(H))),q||K.forEach((H=>ie(H))),q})(this.style,this.transform.zoom);C&&(function(D,V,q){for(let W=0;W<q.length;W++)hu(D,V,q[W])})(this,C,C.getVisibleCoordinates())}this.options.showPadding&&(function(C){const D=C.transform.padding;Dl(C,C.transform.height-(D.top||0),3,ou),Dl(C,D.bottom||0,3,lu),Rl(C,D.left||0,3,cu),Rl(C,C.transform.width-(D.right||0),3,uu);const V=C.transform.centerPoint;(function(q,W,Z,K){xa(q,W-1,Z-10,2,20,K),xa(q,W-10,Z-1,20,2,K)})(C,V.x,C.transform.height-V.y,En)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let c=this.terrainFacilitator.dirty;c||(c=t?!l.cj(n,a):!l.ck(n,a)),c||(c=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),c&&(l.cl(n,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(p,m){const _=p.context,v=_.gl,b=p.transform,T=Ct.unblended,A=new st(v.LEQUAL,st.ReadWrite,[0,1]),C=m.tileManager.getRenderableTiles(),D=p.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:l.bp.transparent,depth:1});for(const V of C){const q=m.getTerrainMesh(V.tileID),W=m.getTerrainData(V.tileID),Z=b.getProjectionData({overscaledTileID:V.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:m.getMeshFrameDelta(b.zoom)};D.draw(_,v.TRIANGLES,A,ft.disabled,T,pt.backCCW,K,W,Z,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain),(function(p,m){const _=p.context,v=_.gl,b=p.transform,T=Ct.unblended,A=new st(v.LEQUAL,st.ReadWrite,[0,1]),C=m.getCoordsTexture(),D=m.tileManager.getRenderableTiles(),V=p.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:l.bp.transparent,depth:1}),m.coordsIndex=[];for(const q of D){const W=m.getTerrainMesh(q.tileID),Z=m.getTerrainData(q.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,C.texture);const K={u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(b.zoom)},ie=b.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});V.draw(_,v.TRIANGLES,A,ft.disabled,T,pt.backCCW,K,Z,ie,"terrain",W.vertexBuffer,W.indexBuffer,W.segments),m.coordsIndex.push(q.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain))}renderLayer(t,n,a,c,p){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(c||[]).length)&&(this.id=a.id,l.cm(a)?(function(m,_,v,b,T,A){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:C}=A,D=ft.disabled,V=m.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(q,W,Z,K,ie,H,ee,ne,Q){const oe=W.transform,be=W.style.map.terrain,fe=ie==="map",ge=H==="map";for(const ye of q){const ze=K.getTile(ye),ke=ze.getBucket(Z);if(!ke||!ke.text||!ke.text.segments.get().length)continue;const Ie=l.ay(ke.textSizeData,oe.zoom),Fe=l.aN(ze,1,W.transform.zoom),it=ur(fe,W.transform,Fe),bt=Z.layout.get("icon-text-fit")!=="none"&&ke.hasIconData();if(Ie){const Ft=Math.pow(2,oe.zoom-ze.tileID.overscaledZ),At=be?(Vt,zt)=>be.getElevation(ye,Vt,zt):null;Ph(ke,fe,ge,Q,oe,it,Ft,Ie,bt,l.aO(oe,ze,ee,ne),ye.toUnwrapped(),At)}}})(b,m,v,_,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),T),v.paint.get("icon-opacity").constantOr(1)!==0&&ga(m,_,v,b,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),D,V,C),v.paint.get("text-opacity").constantOr(1)!==0&&ga(m,_,v,b,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),D,V,C),_.map.showCollisionBoxes&&(Qn(m,_,v,b,!0),Qn(m,_,v,b,!1))})(t,n,a,c,this.style.placement.variableOffsets,p):l.cn(a)?(function(m,_,v,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:A}=T,C=v.paint.get("circle-opacity"),D=v.paint.get("circle-stroke-width"),V=v.paint.get("circle-stroke-opacity"),q=!v.layout.get("circle-sort-key").isConstant();if(C.constantOr(1)===0&&(D.constantOr(1)===0||V.constantOr(1)===0))return;const W=m.context,Z=W.gl,K=m.transform,ie=m.getDepthModeForSublayer(0,st.ReadOnly),H=ft.disabled,ee=m.colorModeForRenderPass(),ne=[],Q=K.getCircleRadiusCorrection();for(let oe=0;oe<b.length;oe++){const be=b[oe],fe=_.getTile(be),ge=fe.getBucket(v);if(!ge)continue;const ye=v.paint.get("circle-translate"),ze=v.paint.get("circle-translate-anchor"),ke=l.aO(K,fe,ye,ze),Ie=ge.programConfigurations.get(v.id),Fe=m.useProgram("circle",Ie),it=ge.layoutVertexBuffer,bt=ge.indexBuffer,Ft=m.style.map.terrain&&m.style.map.terrain.getTerrainData(be),At={programConfiguration:Ie,program:Fe,layoutVertexBuffer:it,indexBuffer:bt,uniformValues:Nc(m,fe,v,ke,Q),terrainData:Ft,projectionData:K.getProjectionData({overscaledTileID:be,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(q){const Vt=ge.segments.get();for(const zt of Vt)ne.push({segments:new l.aX([zt]),sortKey:zt.sortKey,state:At})}else ne.push({segments:ge.segments,sortKey:0,state:At})}q&&ne.sort(((oe,be)=>oe.sortKey-be.sortKey));for(const oe of ne){const{programConfiguration:be,program:fe,layoutVertexBuffer:ge,indexBuffer:ye,uniformValues:ze,terrainData:ke,projectionData:Ie}=oe.state;fe.draw(W,Z.TRIANGLES,ie,H,ee,pt.backCCW,ze,ke,Ie,v.id,ge,ye,oe.segments,v.paint,m.transform.zoom,be)}})(t,n,a,c,p):l.co(a)?(function(m,_,v,b,T){if(v.paint.get("heatmap-opacity")===0)return;const A=m.context,{isRenderingToTexture:C,isRenderingGlobe:D}=T;if(m.style.map.terrain){for(const V of b){const q=_.getTile(V);_.hasRenderableParent(V)||(m.renderPass==="offscreen"?iu(m,q,v,V,D):m.renderPass==="translucent"&&ru(m,v,V,C,D))}A.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?(function(V,q,W,Z){const K=V.context,ie=K.gl,H=V.transform,ee=ft.disabled,ne=new Ct([ie.ONE,ie.ONE],l.bp.transparent,[!0,!0,!0,!0]);(function(Q,oe,be){const fe=Q.gl;Q.activeTexture.set(fe.TEXTURE1),Q.viewport.set([0,0,oe.width/4,oe.height/4]);let ge=be.heatmapFbos.get(l.cd);ge?(fe.bindTexture(fe.TEXTURE_2D,ge.colorAttachment.get()),Q.bindFramebuffer.set(ge.framebuffer)):(ge=_a(Q,oe.width/4,oe.height/4),be.heatmapFbos.set(l.cd,ge))})(K,V,W),K.clear({color:l.bp.transparent});for(let Q=0;Q<Z.length;Q++){const oe=Z[Q];if(q.hasRenderableParent(oe))continue;const be=q.getTile(oe),fe=be.getBucket(W);if(!fe)continue;const ge=fe.programConfigurations.get(W.id),ye=V.useProgram("heatmap",ge),ze=H.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),ke=H.getCircleRadiusCorrection();ye.draw(K,ie.TRIANGLES,st.disabled,ee,ne,pt.backCCW,zs(be,H.zoom,W.paint.get("heatmap-intensity"),ke),null,ze,W.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,W.paint,H.zoom,ge)}K.viewport.set([0,0,V.width,V.height])})(m,_,v,b):m.renderPass==="translucent"&&(function(V,q){const W=V.context,Z=W.gl;W.setColorMode(V.colorModeForRenderPass());const K=q.heatmapFbos.get(l.cd);K&&(W.activeTexture.set(Z.TEXTURE0),Z.bindTexture(Z.TEXTURE_2D,K.colorAttachment.get()),W.activeTexture.set(Z.TEXTURE1),xo(W,q).bind(Z.LINEAR,Z.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(W,Z.TRIANGLES,st.disabled,ft.disabled,V.colorModeForRenderPass(),pt.disabled,Gc(V,q,0,1),null,null,q.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,q.paint,V.transform.zoom))})(m,v)})(t,n,a,c,p):l.cp(a)?(function(m,_,v,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:A}=T,C=v.paint.get("line-opacity"),D=v.paint.get("line-width");if(C.constantOr(1)===0||D.constantOr(1)===0)return;const V=m.getDepthModeForSublayer(0,st.ReadOnly),q=m.colorModeForRenderPass(),W=v.paint.get("line-dasharray"),Z=W.constantOr(1),K=v.paint.get("line-pattern"),ie=K.constantOr(1),H=v.paint.get("line-gradient"),ee=v.getCrossfadeParameters();let ne;ne=ie?"linePattern":Z&&H?"lineGradientSDF":Z?"lineSDF":H?"lineGradient":"line";const Q=m.context,oe=Q.gl,be=m.transform;let fe=!0;for(const ge of b){const ye=_.getTile(ge);if(ie&&!ye.patternsLoaded())continue;const ze=ye.getBucket(v);if(!ze)continue;const ke=ze.programConfigurations.get(v.id),Ie=m.context.program.get(),Fe=m.useProgram(ne,ke),it=fe||Fe.program!==Ie,bt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ge),Ft=K.constantOr(null),At=W&&W.constantOr(null);if(Ft&&ye.imageAtlas){const bi=ye.imageAtlas,oi=bi.patternPositions[Ft.to.toString()],si=bi.patternPositions[Ft.from.toString()];oi&&si&&ke.setConstantPatternPositions(oi,si)}else if(At){const bi=v.layout.get("line-cap")==="round",oi=m.lineAtlas.getDash(At.to,bi),si=m.lineAtlas.getDash(At.from,bi);ke.setConstantDashPositions(oi,si)}const Vt=be.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),zt=be.getPixelScale();let Kt;ie?(Kt=bl(m,ye,v,zt,ee),su(Q,oe,ye,ke,ee)):Z&&H?(Kt=so(m,ye,v,zt,ee,ze.lineClipsArray.length),dr(m,_,Q,oe,v,ze,ge,ke,ee)):Z?(Kt=Zc(m,ye,v,zt,ee),ri(m,Q,oe,ke,it,ee)):H?(Kt=qc(m,ye,v,zt,ze.lineClipsArray.length),es(m,_,Q,oe,v,ze,ge)):Kt=ua(m,ye,v,zt);const Nt=m.stencilModeForClipping(ge);Fe.draw(Q,oe.TRIANGLES,V,Nt,q,pt.disabled,Kt,bt,Vt,v.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,v.paint,m.transform.zoom,ke,ze.layoutVertexBuffer2),fe=!1}})(t,n,a,c,p):l.cq(a)?(function(m,_,v,b,T){const A=v.paint.get("fill-color"),C=v.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const{isRenderingToTexture:D}=T,V=m.colorModeForRenderPass(),q=v.paint.get("fill-pattern"),W=m.opaquePassEnabledForLayer()&&!q.constantOr(1)&&A.constantOr(l.bp.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===W){const Z=m.getDepthModeForSublayer(1,m.renderPass==="opaque"?st.ReadWrite:st.ReadOnly);ya(m,_,v,b,Z,V,!1,D)}if(m.renderPass==="translucent"&&v.paint.get("fill-antialias")){const Z=m.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,st.ReadOnly);ya(m,_,v,b,Z,V,!0,D)}})(t,n,a,c,p):l.cr(a)?(function(m,_,v,b,T){const A=v.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:C}=T;if(m.renderPass==="translucent"){const D=new st(m.context.gl.LEQUAL,st.ReadWrite,m.depthRangeFor3D);if(A!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))wo(m,_,v,b,D,ft.disabled,Ct.disabled,C),wo(m,_,v,b,D,m.stencilModeFor3D(),m.colorModeForRenderPass(),C);else{const V=m.colorModeForRenderPass();wo(m,_,v,b,D,ft.disabled,V,C)}}})(t,n,a,c,p):l.cs(a)?(function(m,_,v,b,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const{isRenderingToTexture:A}=T,C=m.context,D=m.style.projection.useSubdivision,V=m.getDepthModeForSublayer(0,st.ReadOnly),q=m.colorModeForRenderPass();if(m.renderPass==="offscreen")(function(W,Z,K,ie,H,ee,ne){const Q=W.context,oe=Q.gl;for(const be of K){const fe=Z.getTile(be),ge=fe.dem;if(!ge||!ge.data||!fe.needsHillshadePrepare)continue;const ye=ge.dim,ze=ge.stride,ke=ge.getPixels();if(Q.activeTexture.set(oe.TEXTURE1),Q.pixelStoreUnpackPremultiplyAlpha.set(!1),fe.demTexture=fe.demTexture||W.getTileTexture(ze),fe.demTexture){const Fe=fe.demTexture;Fe.update(ke,{premultiply:!1}),Fe.bind(oe.NEAREST,oe.CLAMP_TO_EDGE)}else fe.demTexture=new l.T(Q,ke,oe.RGBA,{premultiply:!1}),fe.demTexture.bind(oe.NEAREST,oe.CLAMP_TO_EDGE);Q.activeTexture.set(oe.TEXTURE0);let Ie=fe.fbo;if(!Ie){const Fe=new l.T(Q,{width:ye,height:ye,data:null},oe.RGBA);Fe.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),Ie=fe.fbo=Q.createFramebuffer(ye,ye,!0,!1),Ie.colorAttachment.set(Fe.texture)}Q.bindFramebuffer.set(Ie.framebuffer),Q.viewport.set([0,0,ye,ye]),W.useProgram("hillshadePrepare").draw(Q,oe.TRIANGLES,H,ee,ne,pt.disabled,fh(fe.tileID,ge),null,null,ie.id,W.rasterBoundsBuffer,W.quadTriangleIndexBuffer,W.rasterBoundsSegments),fe.needsHillshadePrepare=!1}})(m,_,b,v,V,ft.disabled,q),C.viewport.set([0,0,m.width,m.height]);else if(m.renderPass==="translucent")if(D){const[W,Z,K]=m.stencilConfigForOverlapTwoPass(b);In(m,_,v,K,W,V,q,!1,A),In(m,_,v,K,Z,V,q,!0,A)}else{const[W,Z]=m.getStencilConfigForOverlapAndUpdateStencilID(b);In(m,_,v,Z,W,V,q,!1,A)}})(t,n,a,c,p):l.ct(a)?(function(m,_,v,b,T){if(m.renderPass!=="translucent"||!b.length)return;const{isRenderingToTexture:A}=T,C=m.style.projection.useSubdivision,D=m.getDepthModeForSublayer(0,st.ReadOnly),V=m.colorModeForRenderPass();if(C){const[q,W,Z]=m.stencilConfigForOverlapTwoPass(b);va(m,_,v,Z,q,D,V,!1,A),va(m,_,v,Z,W,D,V,!0,A)}else{const[q,W]=m.getStencilConfigForOverlapAndUpdateStencilID(b);va(m,_,v,W,q,D,V,!1,A)}})(t,n,a,c,p):l.bU(a)?(function(m,_,v,b,T){if(m.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!b.length)return;const{isRenderingToTexture:A}=T,C=_.getSource(),D=m.style.projection.useSubdivision;if(C instanceof Qi)Fs(m,_,v,b,null,!1,!1,C.tileCoords,C.flippedWindingOrder,A);else if(D){const[V,q,W]=m.stencilConfigForOverlapTwoPass(b);Fs(m,_,v,W,V,!1,!0,ts,!1,A),Fs(m,_,v,W,q,!0,!0,ts,!1,A)}else{const[V,q]=m.getStencilConfigForOverlapAndUpdateStencilID(b);Fs(m,_,v,q,V,!1,!0,ts,!1,A)}})(t,n,a,c,p):l.cu(a)?(function(m,_,v,b,T){const A=v.paint.get("background-color"),C=v.paint.get("background-opacity");if(C===0)return;const{isRenderingToTexture:D}=T,V=m.context,q=V.gl,W=m.style.projection,Z=m.transform,K=Z.tileSize,ie=v.paint.get("background-pattern");if(m.isPatternMissing(ie))return;const H=!ie&&A.a===1&&C===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==H)return;const ee=ft.disabled,ne=m.getDepthModeForSublayer(0,H==="opaque"?st.ReadWrite:st.ReadOnly),Q=m.colorModeForRenderPass(),oe=m.useProgram(ie?"backgroundPattern":"background"),be=b||Ht(Z,{tileSize:K,terrain:m.style.map.terrain});ie&&(V.activeTexture.set(q.TEXTURE0),m.imageManager.bind(m.context));const fe=v.getCrossfadeParameters();for(const ge of be){const ye=Z.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!D,applyTerrainMatrix:!0}),ze=ie?gh(C,m,ie,{tileID:ge,tileSize:K},fe):Pl(C,A),ke=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ge),Ie=W.getMeshFromTileID(V,ge.canonical,!1,!0,"raster");oe.draw(V,q.TRIANGLES,ne,ee,Q,pt.backCCW,ze,ke,ye,v.id,Ie.vertexBuffer,Ie.indexBuffer,Ie.segments)}})(t,0,a,c,p):l.cv(a)&&(function(m,_,v,b){const{isRenderingGlobe:T}=b,A=m.context,C=v.implementation,D=m.style.projection,V=m.transform,q=V.getProjectionDataForCustomLayer(T),W={farZ:V.farZ,nearZ:V.nearZ,fov:V.fov*Math.PI/180,modelViewProjectionMatrix:V.modelViewProjectionMatrix,projectionMatrix:V.projectionMatrix,shaderData:{variantName:D.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
807
|
+
uniform mat4 u_projection_matrix;
|
|
808
|
+
${D.shaderPreludeCode.vertexSource}`,define:D.shaderDefine},defaultProjectionData:q},Z=C.renderingMode?C.renderingMode:"2d";if(m.renderPass==="offscreen"){const K=C.prerender;K&&(m.setCustomLayerDefaults(),A.setColorMode(m.colorModeForRenderPass()),K.call(C,A.gl,W),A.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),A.setColorMode(m.colorModeForRenderPass()),A.setStencilMode(ft.disabled);const K=Z==="3d"?m.getDepthModeFor3D():m.getDepthModeForSublayer(0,st.ReadOnly);A.setDepthMode(K),C.render(A.gl,W),A.setDirty(),m.setBaseState(),A.bindFramebuffer.set(null)}})(t,0,a,p))}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n,a=!1,c=[]){this.cache=this.cache||{};const p=!!this.style.map.terrain,m=this.style.projection,_=a?$t.projectionMercator:m.shaderPreludeCode,v=a?qi:m.shaderDefine,b=t+(n?n.cacheKey:"")+`/${a?hr:m.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"")+(c?`/${c.join("/")}`:"");return this.cache[b]||(this.cache[b]=new Bc(this.context,$t[t],n,_h[t],this._showOverdrawInspector,p,_,v,c)),this.cache[b]}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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const a in this._tileTextures){const c=this._tileTextures[a];if(c)for(const p of c)p.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const a in this.cache){const c=this.cache[a];c&&c.program&&this.context.gl.deleteProgram(c.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Bl(d,t){let n,a=!1,c=null,p=null;const m=()=>{c=null,a&&(d.apply(p,n),c=setTimeout(m,t),a=!1)};return(..._)=>(a=!0,p=this,n=_,c||m(),c)}class Ol{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map((c=>c.split("="))).forEach((c=>{c[0]===this._hashName&&(a=c)})),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const a=n.join("/");let c=a;c.split("&").length>0&&(c=c.split("&")[0]),this._hashName&&(c=`${this._hashName}=${a}`);let p=window.location.hash.replace(c,"");p.startsWith("#&")?p=p.slice(0,1)+p.slice(2):p==="#"&&(p="");let m=window.location.href.replace(/(#.+)?$/,p);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Bl(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}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()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,v=this._map.getBearing(),b=this._map.getPitch();let T="";if(T+=t?`/${m}/${_}/${a}`:`${a}/${_}/${m}`,(v||b)&&(T+="/"+Math.round(10*v)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){const A=this._hashName;let C=!1;const D=window.location.hash.slice(1).split("&").map((V=>{const q=V.split("=")[0];return q===A?(C=!0,`${q}=${T}`):V})).filter((V=>V));return C||D.push(`${A}=${T}`),`#${D.join("&")}`}return`#${T}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new l.V(+t[2],+t[1])}catch{return!1}const n=+t[0],a=+(t[3]||0),c=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&a>=-180&&a<=180&&c>=this._map.getMinPitch()&&c<=this._map.getMaxPitch()}}const Cn={linearity:.3,easing:l.cw(0,0,.3,1)},pu=l.e({deceleration:2500,maxSpeed:1400},Cn),wr=l.e({deceleration:20,maxSpeed:1400},Cn),kr=l.e({deceleration:1e3,maxSpeed:360},Cn),fu=l.e({deceleration:1e3,maxSpeed:90},Cn),Dr=l.e({deceleration:1e3,maxSpeed:360},Cn);class Mh{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Xe(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=Xe();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,n.roll+=p.rollDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=wa(n.pan.mag(),a,l.e({},pu,t||{})),m=n.pan.mult(p.amount/n.pan.mag()),_=this._map.cameraHelper.handlePanInertia(m,this._map.transform);c.center=_.easingCenter,c.offset=_.easingOffset,ba(c,p)}if(n.zoom){const p=wa(n.zoom,a,wr);c.zoom=this._map.transform.zoom+p.amount,ba(c,p)}if(n.bearing){const p=wa(n.bearing,a,kr);c.bearing=this._map.transform.bearing+l.an(p.amount,-179,179),ba(c,p)}if(n.pitch){const p=wa(n.pitch,a,fu);c.pitch=this._map.transform.pitch+p.amount,ba(c,p)}if(n.roll){const p=wa(n.roll,a,Dr);c.roll=this._map.transform.roll+l.an(p.amount,-179,179),ba(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),l.e(c,{noMoveStart:!0})}}function ba(d,t){(!d.duration||d.duration<t.duration)&&(d.duration=t.duration,d.easing=t.easing)}function wa(d,t,n){const{maxSpeed:a,linearity:c,deceleration:p}=n,m=l.an(d*c/(t/1e3),-a,a),_=Math.abs(m)/(p*c);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class xi extends l.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,c={}){a=a instanceof MouseEvent?a:new MouseEvent(t,a);const p=de.mousePos(n.getCanvas(),a),m=n.unproject(p);super(t,l.e({point:p,lngLat:m,originalEvent:a},c)),this._defaultPrevented=!1,this.target=n}}class Ta extends l.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const c=t==="touchend"?a.changedTouches:a.touches,p=de.touchPos(n.getCanvasContainer(),c),m=p.map((v=>n.unproject(v))),_=p.reduce(((v,b,T,A)=>v.add(b.div(A.length))),new l.P(0,0));super(t,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:a}),this._defaultPrevented=!1}}class mu extends l.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class Ih{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new mu(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new xi(t.type,this._map,t))}mouseup(t){this._map.fire(new xi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new xi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new xi(t.type,this._map,t))}mouseover(t){this._map.fire(new xi(t.type,this._map,t))}mouseout(t){this._map.fire(new xi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ta(t.type,this._map,t))}touchmove(t){this._map.fire(new Ta(t.type,this._map,t))}touchend(t){this._map.fire(new Ta(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ta(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Eh{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new xi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new xi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bs{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(l.P.convert(t),this._map.terrain)}}class Os{constructor(t,n){this._map=t,this._tr=new Bs(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(de.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const c=this._startPos;this._lastPos=a,this._box||(this._box=de.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(c.x,a.x),m=Math.max(c.x,a.x),_=Math.min(c.y,a.y),v=Math.max(c.y,a.y);de.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=v-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,c=n;if(this.reset(),de.suppressClick(),a.x!==c.x||a.y!==c.y)return this._map.fire(new l.l("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(de.remove(this._box),this._box=null),de.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.l(t,{originalEvent:n}))}}function Rr(d,t){if(d.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${t.length}`);const n={};for(let a=0;a<d.length;a++)n[d[a].identifier]=t[a];return n}class Ge{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=(function(c){const p=new l.P(0,0);for(const m of c)p._add(m);return p.div(c.length)})(n),this.touches=Rr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=Rr(a,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class To{constructor(t){this.singleTap=new Ge(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class jl{constructor(t){this._tr=new Bs(t),this._zoomIn=new To({numTouches:1,numTaps:2}),this._zoomOut=new To({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a),m=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{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}}class js{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=Array.isArray(n)?n[0]:n;return!this._moved&&c.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=c,this._move(a,c))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&de.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Sa=0,Pa=2,Vl={[Sa]:1,[Pa]:2};class Ma{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=de.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,a){const c=Vl[a];return n.buttons===void 0||(n.buttons&c)!==c})(t,this._eventButton)}isValidEndEvent(t){return de.mouseButton(t)===this._eventButton}}class Nl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class gu{constructor(t=new Ma({checkCorrectEvent:()=>!0}),n=new Nl){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,a){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?a(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const Vs=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=t=>{t.preventDefault()}};class Ch{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._active){if(!this._shouldBePrevented(a.length))return t.preventDefault(),this._calculateTransform(t,n,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const c=Rr(a,n),p=new l.P(0,0),m=new l.P(0,0);let _=0;for(const b in c){const T=c[b],A=this._touches[b];A&&(p._add(T),m._add(T.sub(A)),_++,c[b]=T)}if(this._touches=c,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class So{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[c,p]=this._firstTwoTouches,m=Po(a,n,c),_=Po(a,n,p);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[c,p]=this._firstTwoTouches,m=Po(a,n,c),_=Po(a,n,p);m&&_||(this._active&&de.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Po(d,t,n){for(let a=0;a<d.length;a++)if(d[a].identifier===n)return t[a]}function _u(d,t){return Math.log(d/t)/Math.LN2}class Ul extends So{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(_u(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:_u(this._distance,a),pinchAround:n}}}function yu(d,t){return 180*d.angleWith(t)/Math.PI}class Gl extends So{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,n,a){const c=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:yu(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=yu(t,this._startVector);return Math.abs(a)<n}}function $l(d){return Math.abs(d.y)>Math.abs(d.x)}class vu extends So{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,$l(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return $l(t)&&$l(n)&&m}}const An={panStep:100,bearingStep:15,pitchStep:10};class Pt{constructor(t){this._tr=new Bs(t);const n=An;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ah,zoom:n?Math.round(v.zoom)+n*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+a*this._bearingStep,pitch:v.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:v.center},{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 Ah(d){return d*(2-d)}const Ia=4.000244140625,Mo=1/450;class Io{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new Bs(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Mo}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=Xe(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%Ia==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){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 n=de.mousePos(this._map.getCanvas(),t),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(l.V.convert(a.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ia?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const b=typeof this._targetZoom!="number"?t.scale:l.aq(this._targetZoom);this._targetZoom=t.applyConstrain(t.getCameraLngLat(),l.at(b*v)).zoom,this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,a=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&c){const _=Xe()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),b=c(v);p=l.G.number(a,n,b),v<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=p,{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.cy;if(this._prevEase){const a=this._prevEase,c=(Xe()-a.start)/a.duration,p=a.easing(c+.01)-a.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=l.cw(m,_,.25,1)}return this._prevEase={start:Xe(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ql{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 xu{constructor(t){this._tr=new Bs(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bu{constructor(){this._tap=new To({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const c=n[0],p=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(c)<30;p&&m?a.length>0&&(this._swipePoint=c,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const c=this._tap.touchend(t,n,a);c&&(this._tapTime=t.timeStamp,this._tapPoint=c)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wu{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Lr{constructor(t,n,a,c){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=a,this._mouseRoll=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ea{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,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")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class He{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=de.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),c=document.createElement("div");c.className="maplibregl-desktop-message",c.textContent=n,this._container.appendChild(c);const p=document.createElement("div");p.className="maplibregl-mobile-message",p.textContent=a,this._container.appendChild(p),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(de.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new l.l("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ke=d=>d.zoom||d.drag||d.roll||d.pitch||d.rotate;class Ca extends l.l{}function Eo(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta||d.rollDelta}class Co{constructor(t,n){this.handleWindowEvent=c=>{this.handleEvent(c,`${c.type}Window`)},this.handleEvent=(c,p)=>{if(c.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=c.type==="renderFrame"?void 0:c,_={needsRenderFrame:!1},v={},b={};for(const{handlerName:C,handler:D,allowed:V}of this._handlers){if(!D.isEnabled())continue;let q;if(this._blockedByActive(b,V,C))D.reset();else if(D[p||c.type]){if(l.cz(c,p||c.type)){const W=de.mousePos(this._map.getCanvas(),c);q=D[p||c.type](c,W)}else if(l.cA(c,p||c.type)){const W=this._getMapTouches(c.touches),Z=de.touchPos(this._map.getCanvas(),W);q=D[p||c.type](c,Z,W)}else l.cB(p||c.type)||(q=D[p||c.type](c));this.mergeHandlerResult(_,v,q,C,m),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||D.isActive())&&(b[C]=D)}const T={};for(const C in this._previousActiveHandlers)b[C]||(T[C]=m);this._previousActiveHandlers=b,(Object.keys(T).length||Eo(_))&&(this._changes.push([_,v,T]),this._triggerRenderFrame()),(Object.keys(b).length||Eo(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Mh(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)de.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)de.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new Ih(n,t));const c=n.boxZoom=new Os(n,t);this._add("boxZoom",c),t.interactive&&t.boxZoom&&c.enable();const p=n.cooperativeGestures=new He(n,t.cooperativeGestures);this._add("cooperativeGestures",p),t.cooperativeGestures&&p.enable();const m=new jl(n),_=new xu(n);n.doubleClickZoom=new ql(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new bu;this._add("tapDragZoom",v);const b=n.touchPitch=new vu(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const T=()=>n.project(n.getCenter()),A=(function({enable:H,clickTolerance:ee,aroundCenter:ne=!0,minPixelCenterThreshold:Q=100,rotateDegreesPerPixelMoved:oe=.8},be){const fe=new Ma({checkCorrectEvent:ge=>de.mouseButton(ge)===0&&ge.ctrlKey||de.mouseButton(ge)===2&&!ge.ctrlKey});return new js({clickTolerance:ee,move:(ge,ye)=>{const ze=be();if(ne&&Math.abs(ze.y-ge.y)>Q)return{bearingDelta:l.cx(new l.P(ge.x,ye.y),ye,ze)};let ke=(ye.x-ge.x)*oe;return ne&&ye.y<ze.y&&(ke=-ke),{bearingDelta:ke}},moveStateManager:fe,enable:H,assignEvents:Vs})})(t,T),C=(function({enable:H,clickTolerance:ee,pitchDegreesPerPixelMoved:ne=-.5}){const Q=new Ma({checkCorrectEvent:oe=>de.mouseButton(oe)===0&&oe.ctrlKey||de.mouseButton(oe)===2});return new js({clickTolerance:ee,move:(oe,be)=>({pitchDelta:(be.y-oe.y)*ne}),moveStateManager:Q,enable:H,assignEvents:Vs})})(t),D=(function({enable:H,clickTolerance:ee,rollDegreesPerPixelMoved:ne=.3},Q){const oe=new Ma({checkCorrectEvent:be=>de.mouseButton(be)===2&&be.ctrlKey});return new js({clickTolerance:ee,move:(be,fe)=>{const ge=Q();let ye=(fe.x-be.x)*ne;return fe.y<ge.y&&(ye=-ye),{rollDelta:ye}},moveStateManager:oe,enable:H,assignEvents:Vs})})(t,T);n.dragRotate=new Lr(t,A,C,D),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",C,["mouseRotate","mouseRoll"]),this._add("mouseRoll",D,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const V=(function({enable:H,clickTolerance:ee}){const ne=new Ma({checkCorrectEvent:Q=>de.mouseButton(Q)===0&&!Q.ctrlKey});return new js({clickTolerance:ee,move:(Q,oe)=>({around:oe,panDelta:oe.sub(Q)}),activateOnStart:!0,moveStateManager:ne,enable:H,assignEvents:Vs})})(t),q=new Ch(t,n);n.dragPan=new wu(a,V,q),this._add("mousePan",V),this._add("touchPan",q,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const W=new Gl,Z=new Ul;n.touchZoomRotate=new Ea(a,Z,W,v),this._add("touchRotate",W,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new Eh(n));const K=n.scrollZoom=new Io(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",K,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const ie=n.keyboard=new Pt(n);this._add("keyboard",ie),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!Ke(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,c,p){if(!a)return;l.e(t,a);const m={handlerName:c,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.rollDelta!==void 0&&(n.roll=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[c,p,m]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new l.P(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.rollDelta&&(t.rollDelta=(t.rollDelta||0)+c.rollDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),l.e(n,p),l.e(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(Eo(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);c._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:b,pitchDelta:T,rollDelta:A,around:C,pinchAround:D}=t;D!==void 0&&(C=D),C=C||c.transform.centerPoint,m&&!p.isPointOnMapSurface(C)&&(C=p.centerPoint);const V={panDelta:_,zoomDelta:v,rollDelta:A,pitchDelta:T,bearingDelta:b,around:C};this._map.cameraHelper.useGlobeControls&&!p.isPointOnMapSurface(C)&&(C=p.centerPoint);const q=C.distSqr(p.centerPoint)<.01?p.center:p.screenPointToLocation(_?C.sub(_):C);this._handleMapControls({terrain:m,tr:p,deltasForHelper:V,preZoomAroundLoc:q,combinedEventsInProgress:n,panDelta:_}),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:a,preZoomAroundLoc:c,combinedEventsInProgress:p,panDelta:m}){const _=this._map.cameraHelper;if(_.handleMapControlsRollPitchBearingZoom(a,n),t)return _.useGlobeControls?(this._terrainMovement||!p.drag&&!p.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void _.handleMapControlsPan(a,n,c)):this._terrainMovement||!p.drag&&!p.zoom?void(p.drag&&this._terrainMovement&&m?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(m))):_.handleMapControlsPan(a,n,c)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void _.handleMapControlsPan(a,n,c));_.handleMapControlsPan(a,n,c)}_fireEvents(t,n,a){const c=Ke(this._eventsInProgress),p=Ke(t),m={};for(const A in t){const{originalEvent:C}=t[A];this._eventsInProgress[A]||(m[`${A}start`]=C),this._eventsInProgress[A]=t[A]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const A in m)this._fireEvent(A,m[A]);p&&this._fireEvent("move",p.originalEvent);for(const A in t){const{originalEvent:C}=t[A];this._fireEvent(A,C)}const _={};let v;for(const A in this._eventsInProgress){const{handlerName:C,originalEvent:D}=this._eventsInProgress[A];this._handlersById[C].isActive()||(delete this._eventsInProgress[A],v=n[C]||D,_[`${A}end`]=v)}for(const A in _)this._fireEvent(A,_[A]);const b=Ke(this._eventsInProgress),T=(c||p)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(a&&T){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;!A||!A.essential&&Ze.prefersReducedMotion?(this._map.fire(new l.l("moveend",{originalEvent:v})),C(this._map.getBearing())&&this._map.resetNorth()):(C(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.l(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Ca("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Hi extends l.E{constructor(t,n,a){super(),this._renderFrameCallback=()=>{const c=Math.min((Xe()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(c)),c<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=a.bearingSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new l.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,a){return t=l.P.convert(t).mult(-1),this.panTo(this.transform.center,l.e({offset:t},n),a)}panTo(t,n,a){return this.easeTo(l.e({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(l.e({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new l.l("movestart",n)).fire(new l.l("move",n)).fire(new l.l("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(l.e({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,l.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Wt.convert(t).adjustAntiMeridian();const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,c){const p={top:0,bottom:0,right:0,left:0};if(typeof(c=l.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},c)).padding=="number"){const b=c.padding;c.padding={top:b,bottom:b,right:b,left:b}}const m=l.e(p,c.padding);c.padding=m;const _=this.transform,v=new Wt(t,n);return this.cameraHelper.cameraForBoxAndBearing(c,m,v,a,_)}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,c,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(l.P.convert(t)),this.transform.screenPointToLocation(l.P.convert(n)),a,c),c,p)}_fitInternal(t,n,a){return t?(delete(n=l.e(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop();const a=this._getTransformForUpdate();let c=!1,p=!1,m=!1;const _=a.zoom;this.cameraHelper.handleJumpToCenterZoom(a,t);const v=a.zoom!==_;return"elevation"in t&&a.elevation!==+t.elevation&&a.setElevation(+t.elevation),"bearing"in t&&a.bearing!==+t.bearing&&(c=!0,a.setBearing(+t.bearing)),"pitch"in t&&a.pitch!==+t.pitch&&(p=!0,a.setPitch(+t.pitch)),"roll"in t&&a.roll!==+t.roll&&(m=!0,a.setRoll(+t.roll)),t.padding==null||a.isPaddingEqual(t.padding)||a.setPadding(t.padding),this._applyUpdatedTransform(a),this.fire(new l.l("movestart",n)).fire(new l.l("move",n)),v&&this.fire(new l.l("zoomstart",n)).fire(new l.l("zoom",n)).fire(new l.l("zoomend",n)),c&&this.fire(new l.l("rotatestart",n)).fire(new l.l("rotate",n)).fire(new l.l("rotateend",n)),p&&this.fire(new l.l("pitchstart",n)).fire(new l.l("pitch",n)).fire(new l.l("pitchend",n)),m&&this.fire(new l.l("rollstart",n)).fire(new l.l("roll",n)).fire(new l.l("rollend",n)),this.fire(new l.l("moveend",n))}calculateCameraOptionsFromTo(t,n,a,c=0){const p=l.a9.fromLngLat(t,n),m=l.a9.fromLngLat(a,c),_=m.x-p.x,v=m.y-p.y,b=m.z-p.z,T=Math.hypot(_,v,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,v),C=l.at(this.transform.cameraToCenterDistance/T/this.transform.tileSize),D=180*Math.atan2(_,-v)/Math.PI;let V=180*Math.acos(A/T)/Math.PI;return V=b<0?90-V:90+V,{center:m.toLngLat(),elevation:c,zoom:C,pitch:V,bearing:D}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,a,c,p){const m=this.transform.calculateCenterFromCameraLngLatAlt(t,n,a,c);return{center:m.center,elevation:m.elevation,zoom:m.zoom,bearing:a,pitch:c,roll:p}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.e({offset:[0,0],duration:500,easing:l.cy},t)).animate===!1||!t.essential&&Ze.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),c=this.getBearing(),p=a.pitch,m=a.roll,_="bearing"in t?this._normalizeBearing(t.bearing,c):c,v="pitch"in t?+t.pitch:p,b="roll"in t?this._normalizeBearing(t.roll,m):m,T="padding"in t?t.padding:a.padding,A=l.P.convert(t.offset);let C,D;t.around&&(C=l.V.convert(t.around),D=a.locationToScreenPoint(C));const V={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(a,{bearing:_,pitch:v,roll:b,padding:T,around:C,aroundPoint:D,offsetAsPoint:A,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||c!==_,this._pitching=this._pitching||v!==p,this._rolling=this._rolling||b!==m,this._padding=!a.isPaddingEqual(T),this._zooming=this._zooming||q.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,V),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease((W=>{q.easeFunc(W),this.terrain&&!t.freezeElevation&&this._updateElevation(W),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(W=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,W)}),t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new l.l("movestart",t)),this._zooming&&!a.zooming&&this.fire(new l.l("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new l.l("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new l.l("pitchstart",t)),this._rolling&&!a.rolling&&this.fire(new l.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(l.G.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),a=t.getCameraAltitude(),c=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(a<c){const p=this.calculateCameraOptionsFromTo(n,c,t.center,t.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((c=>this._elevateCameraIfInsideTerrain(c))),this.transformCameraUpdate&&n.push((c=>this.transformCameraUpdate(c))),!n.length)return;const a=t.clone();for(const c of n){const p=a.clone(),{center:m,zoom:_,roll:v,pitch:b,bearing:T,elevation:A}=c(p);m&&p.setCenter(m),A!==void 0&&p.setElevation(A),_!==void 0&&p.setZoom(_),v!==void 0&&p.setRoll(v),b!==void 0&&p.setPitch(b),T!==void 0&&p.setBearing(T),a.apply(p,!1)}this.transform.apply(a,!1)}_fireMoveEvents(t){this.fire(new l.l("move",t)),this._zooming&&this.fire(new l.l("zoom",t)),this._rotating&&this.fire(new l.l("rotate",t)),this._pitching&&this.fire(new l.l("pitch",t)),this._rolling&&this.fire(new l.l("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,p=this._pitching,m=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new l.l("zoomend",t)),c&&this.fire(new l.l("rotateend",t)),p&&this.fire(new l.l("pitchend",t)),m&&this.fire(new l.l("rollend",t)),this.fire(new l.l("moveend",t))}flyTo(t,n){if(!t.essential&&Ze.prefersReducedMotion){const ye=l.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(ye,n)}this.stop(),t=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.cy},t);const a=this._getTransformForUpdate(),c=a.bearing,p=a.pitch,m=a.roll,_=a.padding,v="bearing"in t?this._normalizeBearing(t.bearing,c):c,b="pitch"in t?+t.pitch:p,T="roll"in t?this._normalizeBearing(t.roll,m):m,A="padding"in t?t.padding:a.padding,C=l.P.convert(t.offset);let D=a.centerPoint.add(C);const V=a.screenPointToLocation(D),q=this.cameraHelper.handleFlyTo(a,{bearing:v,pitch:b,roll:T,padding:A,locationAtOffset:V,offsetAsPoint:C,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let W=t.curve;const Z=Math.max(a.width,a.height),K=Z/q.scaleOfZoom,ie=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&(W=Math.sqrt(Z/q.scaleOfMinZoom/ie*2));const H=W*W;function ee(ye){const ze=(K*K-Z*Z+(ye?-1:1)*H*H*ie*ie)/(2*(ye?K:Z)*H*ie);return Math.log(Math.sqrt(ze*ze+1)-ze)}function ne(ye){return(Math.exp(ye)-Math.exp(-ye))/2}function Q(ye){return(Math.exp(ye)+Math.exp(-ye))/2}const oe=ee(!1);let be=function(ye){return Q(oe)/Q(oe+W*ye)},fe=function(ye){return Z*((Q(oe)*(ne(ze=oe+W*ye)/Q(ze))-ne(oe))/H)/ie;var ze},ge=(ee(!0)-oe)/W;if(Math.abs(ie)<2e-6||!isFinite(ge)){if(Math.abs(Z-K)<1e-6)return this.easeTo(t,n);const ye=K<Z?-1:1;ge=Math.abs(Math.log(K/Z))/W,fe=()=>0,be=ze=>Math.exp(ye*W*ze)}return t.duration="duration"in t?+t.duration:1e3*ge/("screenSpeed"in t?+t.screenSpeed/W:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=c!==v,this._pitching=b!==p,this._rolling=T!==m,this._padding=!a.isPaddingEqual(A),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease((ye=>{const ze=ye*ge,ke=1/be(ze),Ie=fe(ze);this._rotating&&a.setBearing(l.G.number(c,v,ye)),this._pitching&&a.setPitch(l.G.number(p,b,ye)),this._rolling&&a.setRoll(l.G.number(m,T,ye)),this._padding&&(a.interpolatePadding(_,A,ye),D=a.centerPoint.add(C)),q.easeFunc(ye,ke,Ie,D),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,n)}return t||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=Xe(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=l.W(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(l.V.convert(t),this.transform):null}}const Tr={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Zl{constructor(t=Tr){this._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")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=de.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=de.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=de.create("div","maplibregl-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(){de.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,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((c=>typeof c!="string"?"":c))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.tileManagers;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter((c=>String(c).trim())),t.sort(((c,p)=>c.length-p.length)),t=t.filter(((c,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(c)>=0)return!1;return!0}));const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=de.sanitize(a),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Tu{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=de.create("div","maplibregl-ctrl");const n=de.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){de.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class zh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var kh=l.aU([{name:"a_pos3d",type:"Int16",components:3}]);class Aa extends l.E{constructor(t){super(),this._lastTilesetChange=Xe(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of Ht(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.terrainRttPosMatrix32f=new Float64Array(16),l.c7(c.terrainRttPosMatrix32f,0,l.a5,l.a5,0,0,1),this._tiles[c.key]=new Ce(c,this.tileSize),this._lastTilesetChange=Xe());for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID,p=t.clone(),m=l.bk();if(c.canonical.equals(t.canonical))l.c7(m,0,l.a5,l.a5,0,0,1);else if(c.canonical.isChildOf(t.canonical)){const _=c.canonical.z-t.canonical.z,v=c.canonical.x-(c.canonical.x>>_<<_),b=c.canonical.y-(c.canonical.y>>_<<_),T=l.a5>>_;l.c7(m,0,T,T,0,0,1),l.O(m,m,[-v*T,-b*T,0])}else{if(!t.canonical.isChildOf(c.canonical))continue;{const _=t.canonical.z-c.canonical.z,v=t.canonical.x-(t.canonical.x>>_<<_),b=t.canonical.y-(t.canonical.y>>_<<_),T=l.a5>>_;l.c7(m,0,l.a5,l.a5,0,0,1),l.O(m,m,[v*T,b*T,0]),l.Q(m,m,[1/2**_,1/2**_,0])}}p.terrainRttPosMatrix32f=new Float32Array(m),n[a]=p}return n}_getTerrainCoordsForTileRanges(t,n){const a={};for(const c of this._renderableTilesKeys){const p=this._tiles[c].tileID;if(!this._isWithinTileRanges(p,n))continue;const m=t.clone(),_=l.bk();if(p.canonical.z===t.canonical.z){const v=t.canonical.x-p.canonical.x+t.wrap*(1<<t.canonical.z),b=t.canonical.y-p.canonical.y;l.c7(_,0,l.a5,l.a5,0,0,1),l.O(_,_,[v*l.a5,b*l.a5,0])}else if(p.canonical.z>t.canonical.z){const v=p.canonical.z-t.canonical.z,b=p.canonical.x-(p.canonical.x>>v<<v)+t.wrap*(1<<p.canonical.z),T=p.canonical.y-(p.canonical.y>>v<<v),A=t.canonical.x-(p.canonical.x>>v),C=t.canonical.y-(p.canonical.y>>v),D=l.a5>>v;l.c7(_,0,D,D,0,0,1),l.O(_,_,[-b*D+A*l.a5,-T*D+C*l.a5,0])}else{const v=t.canonical.z-p.canonical.z,b=t.canonical.x-(t.canonical.x>>v<<v)+t.wrap*(1<<t.canonical.z),T=t.canonical.y-(t.canonical.y>>v<<v),A=(t.canonical.x>>v)-p.canonical.x,C=(t.canonical.y>>v)-p.canonical.y,D=l.a5<<v;l.c7(_,0,D,D,0,0,1),l.O(_,_,[b*l.a5+A*D,T*l.a5+C*D,0])}m.terrainRttPosMatrix32f=new Float32Array(_),a[c]=m}return a}getSourceTile(t,n){const a=this.tileManager._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c<a.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(c).key);let p=this.findTileInCaches(this._sourceTileCache[t.key]);if(!p?.dem&&n)for(;c>=a.minzoom&&!p?.dem;)p=this.findTileInCaches(t.scaledTo(c--).key);return p}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const a=n[t.canonical.z];return!!a&&(t.wrap>a.minWrap||t.wrap<a.maxWrap||t.canonical.x>=a.minTileXWrapped&&t.canonical.x<=a.maxTileXWrapped&&t.canonical.y>=a.minTileY&&t.canonical.y<=a.maxTileY)}}class qt{constructor(t,n,a){this._meshCache={},this.painter=t,this.tileManager=new Aa(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=l.a5){var p;if(!(n>=0&&n<c&&a>=0&&a<c))return 0;const m=this.getTerrainData(t),_=(p=m.tile)===null||p===void 0?void 0:p.dem;if(!_)return 0;const v=l.cC([],[n/c*l.a5,a/c*l.a5],m.u_terrain_matrix),b=[v[0]*_.dim,v[1]*_.dim],T=Math.floor(b[0]),A=Math.floor(b[1]),C=b[0]-T,D=b[1]-A;return _.get(T,A)*(1-C)*(1-D)+_.get(T+1,A)*C*(1-D)+_.get(T,A+1)*(1-C)*D+_.get(T+1,A+1)*C*D}getElevationForLngLatZoom(t,n){if(!l.cD(n,t.wrap()))return 0;const{tileID:a,mercatorX:c,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(a,c%l.a5,p%l.a5,l.a5)}getElevationForLngLat(t,n){const a=Ht(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let c=0;for(const p of a)p.canonical.z>c&&(c=Math.min(p.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,c)}getElevation(t,n,a,c=l.a5){return this.getDEMElevation(t,n,a,c)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const c=this.painter.context,p=new l.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l.T(c,p,c.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l.T(c,new l.R({width:1,height:1}),c.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.ar([])}const n=this.tileManager.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const c=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new l.T(c,n.dem.getPixels(),c.gl.RGBA,{premultiply:!1}),n.demTexture.bind(c.gl.NEAREST,c.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n.toString()+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const c=this.tileManager.getSource().maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),v=l.cE(new Float64Array(16),[1/(l.a5<<p),1/(l.a5<<p),0]);l.O(v,v,[m*l.a5,_*l.a5,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,c=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===c||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l.T(n.context,{width:a,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new l.T(n.context,{width:a,height:c,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(a,c,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,c))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&p,n[m+2]=_>>8<<4|p>>8,n[m+3]=0;const a=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new l.T(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),a=this.painter.context,c=a.gl,p=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(p,_-m-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],A=T&&this.tileManager.getTileByID(T);if(!A)return null;const C=this._coordsTextureSize,D=(1<<A.tileID.canonical.z)*C;return new l.a9((A.tileID.canonical.x*C+v)/D+A.tileID.wrap,(A.tileID.canonical.y*C+b)/D,this.getElevation(A.tileID,v,b,C))}depthAtPoint(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const a=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,c=a&&t.canonical.y===0,p=a&&t.canonical.y===(1<<t.canonical.z)-1,m=`m_${c?"n":""}_${p?"s":""}`;if(this._meshCache[m])return this._meshCache[m];const _=this.painter.context,v=new l.cF,b=new l.aY,T=this.meshSize,A=l.a5/T,C=T*T;for(let Q=0;Q<=T;Q++)for(let oe=0;oe<=T;oe++)v.emplaceBack(oe*A,Q*A,0);for(let Q=0;Q<C;Q+=T+1)for(let oe=0;oe<T;oe++)b.emplaceBack(oe+Q,T+oe+Q+1,T+oe+Q+2),b.emplaceBack(oe+Q,T+oe+Q+2,oe+Q+1);const D=v.length,V=D+(T+1),q=(T+1)*T,W=c?l.br:0,Z=c?0:1,K=p?l.bs:l.a5,ie=p?0:1;for(let Q=0;Q<=T;Q++)v.emplaceBack(Q*A,W,Z);for(let Q=0;Q<=T;Q++)v.emplaceBack(Q*A,K,ie);for(let Q=0;Q<T;Q++)b.emplaceBack(q+Q,V+Q,V+Q+1),b.emplaceBack(q+Q,V+Q+1,q+Q+1),b.emplaceBack(0+Q,D+Q+1,D+Q),b.emplaceBack(0+Q,0+Q+1,D+Q+1);const H=v.length,ee=H+2*(T+1);for(const Q of[0,1])for(let oe=0;oe<=T;oe++)for(const be of[0,1])v.emplaceBack(Q*l.a5,oe*A,be);for(let Q=0;Q<2*T;Q+=2)b.emplaceBack(H+Q,H+Q+1,H+Q+3),b.emplaceBack(H+Q,H+Q+3,H+Q+2),b.emplaceBack(ee+Q,ee+Q+3,ee+Q+1),b.emplaceBack(ee+Q,ee+Q+2,ee+Q+3);const ne=new Et(_.createVertexBuffer(v,kh.members),_.createIndexBuffer(b),l.aX.simpleSegment(0,0,v.length,b.length));return this._meshCache[m]=ne,ne}getMeshFrameDelta(t){return 2*Math.PI*l.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var a;if(!l.cD(n,t.wrap()))return 0;const{tileID:c}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(a=this.getMinMaxElevation(c).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(t,n){const a=l.a9.fromLngLat(t.wrap()),c=(1<<n)*l.a5,p=a.x*c,m=a.y*c,_=Math.floor(p/l.a5),v=Math.floor(m/l.a5);return{tileID:new l.a2(n,0,n,_,v),mercatorX:p,mercatorY:m}}}class ni{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new l.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const is={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class za{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new ni(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((a=>!t._layers[a].isHidden(n))),this._coordsAscending={};for(const a in t.tileManagers){this._coordsAscending[a]={};const c=t.tileManagers[a].getVisibleCoordinates(),p=t.tileManagers[a].getSource(),m=p instanceof Qi?p.terrainTileRanges:null;for(const _ of c){const v=this.terrain.tileManager.getTerrainCoords(_,m);for(const b in v)this._coordsAscending[a][b]||(this._coordsAscending[a][b]=[]),this._coordsAscending[a][b].push(v[b])}}this._coordsAscendingStr={};for(const a of t._order){const c=t._layers[a],p=c.source;if(is[c.type]&&!this._coordsAscendingStr[p]){this._coordsAscendingStr[p]={};for(const m in this._coordsAscending[p])this._coordsAscendingStr[p][m]=this._coordsAscending[p][m].map((_=>_.key)).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsAscendingStr){const p=this._coordsAscendingStr[c][a.tileID.key];p&&p!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const a=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),c=t.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(is[c]&&(this._prevType&&is[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!m))return!0;if(is[this._prevType]||is[c]&&m){this._prevType=c;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const b of this._renderableTiles){if(this.pool.isFull()&&(Ll(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(b),b.rtt[_]){const A=this.pool.getObjectForId(b.rtt[_].id);if(A.stamp===b.rtt[_].stamp){this.pool.useObject(A);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),b.rtt[_]={id:T.id,stamp:T.stamp},p.context.bindFramebuffer.set(T.fbo.framebuffer),p.context.clear({color:l.bp.transparent,stencil:0}),p.currentStencilSource=void 0;for(let A=0;A<v.length;A++){const C=p.style._layers[v[A]],D=C.source?this._coordsAscending[C.source][b.tileID.key]:[b.tileID];p.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),p._renderTileClippingMasks(C,D,!0),p.renderLayer(p,p.style.tileManagers[C.source],C,D,a),C.source&&(b.rttCoords[C.source]=this._coordsAscendingStr[C.source][b.tileID.key])}}return Ll(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),is[c]}return!1}}const Ao={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Wl=_e,zo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Tr,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:l.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},Hl={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class ka{constructor(t,n,a=!1){this.mousedown=p=>{this.startMove(p,de.mousePos(this.element,p)),de.addEventListener(window,"mousemove",this.mousemove),de.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=p=>{this.move(p,de.mousePos(this.element,p))},this.mouseup=p=>{this._rotatePitchHandler.dragEnd(p),this.offTemp()},this.touchstart=p=>{p.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=de.touchPos(this.element,p.targetTouches)[0],this.startMove(p,this._startPos),de.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),de.addEventListener(window,"touchend",this.touchend))},this.touchmove=p=>{p.targetTouches.length!==1?this.reset():(this._lastPos=de.touchPos(this.element,p.targetTouches)[0],this.move(p,this._lastPos))},this.touchend=p=>{p.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const c=new gu;this._rotatePitchHandler=new js({clickTolerance:3,move:(p,m)=>{const _=n.getBoundingClientRect(),v=new l.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:l.cx(new l.P(p.x,m.y),m,v),pitchDelta:a?-.5*(m.y-p.y):void 0}},moveStateManager:c,enable:!0,assignEvents:()=>{}}),this.map=t,de.addEventListener(n,"mousedown",this.mousedown),de.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),de.addEventListener(n,"touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),de.disableDrag()}move(t,n){const a=this.map,{bearingDelta:c,pitchDelta:p}=this._rotatePitchHandler.dragMove(t,n)||{};c&&a.setBearing(a.getBearing()+c),p&&a.setPitch(a.getPitch()+p)}off(){const t=this.element;de.removeEventListener(t,"mousedown",this.mousedown),de.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),de.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),de.removeEventListener(window,"touchend",this.touchend),de.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){de.enableDrag(),de.removeEventListener(window,"mousemove",this.mousemove),de.removeEventListener(window,"mouseup",this.mouseup),de.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),de.removeEventListener(window,"touchend",this.touchend)}}let on;function ko(d,t,n,a=!1){if(a||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return d?.wrap();const c=new l.V(d.lng,d.lat);if(d=new l.V(d.lng,d.lat),t){const p=new l.V(d.lng-360,d.lat),m=new l.V(d.lng+360,d.lat),_=n.locationToScreenPoint(d).distSqr(t);n.locationToScreenPoint(p).distSqr(t)<_?d=p:n.locationToScreenPoint(m).distSqr(t)<_&&(d=m)}for(;Math.abs(d.lng-n.center.lng)>180;){const p=n.locationToScreenPoint(d);if(p.x>=0&&p.y>=0&&p.x<=n.width&&p.y<=n.height)break;d.lng>n.center.lng?d.lng-=360:d.lng+=360}return d.lng!==c.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(d))?d:c}const Da={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Do(d,t,n){const a=d.classList;for(const c in Da)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class Ra extends l.E{constructor(t){if(super(),this._onKeyPress=n=>{const a=n.code,c=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&c!==32&&c!==13||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,c=this._element;this._popup&&(a===c||c.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=ko(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),de.setTransform(this._element,`${Da[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${c}`),Ze.frameAsync(new AbortController).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.l("dragstart"))),this.fire(new l.l("drag")))},this._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),this._state==="active"&&this.fire(new l.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=l.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=de.create("div");const n=de.createNS("http://www.w3.org/2000/svg","svg"),a=41,c=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${c}px`),n.setAttributeNS(null,"viewBox",`0 0 ${c} ${a}`);const p=de.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"stroke","none"),p.setAttributeNS(null,"stroke-width","1"),p.setAttributeNS(null,"fill","none"),p.setAttributeNS(null,"fill-rule","evenodd");const m=de.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=de.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 Z of v){const K=de.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",Z.rx),K.setAttributeNS(null,"ry",Z.ry),_.appendChild(K)}const b=de.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const T=de.createNS("http://www.w3.org/2000/svg","path");T.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"),b.appendChild(T);const A=de.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const C=de.createNS("http://www.w3.org/2000/svg","path");C.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"),A.appendChild(C);const D=de.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(6.0, 7.0)"),D.setAttributeNS(null,"fill","#FFFFFF");const V=de.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=de.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const W=de.createNS("http://www.w3.org/2000/svg","circle");W.setAttributeNS(null,"fill","#FFFFFF"),W.setAttributeNS(null,"cx","5.5"),W.setAttributeNS(null,"cy","5.5"),W.setAttributeNS(null,"r","5.4999962"),V.appendChild(q),V.appendChild(W),m.appendChild(_),m.appendChild(b),m.appendChild(A),m.appendChild(D),m.appendChild(V),n.appendChild(m),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",c*this._scale+"px"),this._element.appendChild(n),this._offset=l.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),Do(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),de.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.V.convert(t),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 c=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,a;const c=(n=this._map)===null||n===void 0?void 0:n.terrain,p=this._map.transform.isLocationOccluded(this._lngLat);if(!c||p){const D=p?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==D&&(this._element.style.opacity=D))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),v=m.terrain.getElevationForLngLat(this._lngLat,m.transform);if(m.transform.lngLatToCameraDepth(this._lngLat,v)-_<.006)return void(this._element.style.opacity=this._opacity);const b=-this._offset.y/m.transform.pixelsPerMeter,T=Math.sin(m.getPitch()*Math.PI/180)*b,A=m.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),C=m.transform.lngLatToCameraDepth(this._lngLat,v+T)-A>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=l.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}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&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Xl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ns=0,rs=!1;const Yl={maxWidth:100,unit:"metric"};function La(d,t,n){const a=n&&n.maxWidth||100,c=d._container.clientHeight/2,p=d._container.clientWidth/2,m=d.unproject([p-a/2,c]),_=d.unproject([p+a/2,c]),v=Math.round(d.project(_).x-d.project(m).x),b=Math.min(a,v,d._container.clientWidth),T=m.distanceTo(_);if(n&&n.unit==="imperial"){const A=3.2808*T;A>5280?ns(t,b,A/5280,d._getUIString("ScaleControl.Miles")):ns(t,b,A,d._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?ns(t,b,T/1852,d._getUIString("ScaleControl.NauticalMiles")):T>=1e3?ns(t,b,T/1e3,d._getUIString("ScaleControl.Kilometers")):ns(t,b,T,d._getUIString("ScaleControl.Meters"))}function ns(d,t,n,a){const c=(function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:(function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b})(_),m*_})(n);d.style.width=t*(c/n)+"px",d.innerHTML=`${c} ${a}`}const Kl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Ro=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lo(d){if(d){if(typeof d=="number"){const t=Math.round(Math.abs(d)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,d),"top-left":new l.P(t,t),"top-right":new l.P(-t,t),bottom:new l.P(0,-d),"bottom-left":new l.P(t,-t),"bottom-right":new l.P(-t,-t),left:new l.P(d,0),right:new l.P(-d,0)}}if(d instanceof l.P||Array.isArray(d)){const t=l.P.convert(d);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.P.convert(d.center||[0,0]),top:l.P.convert(d.top||[0,0]),"top-left":l.P.convert(d["top-left"]||[0,0]),"top-right":l.P.convert(d["top-right"]||[0,0]),bottom:l.P.convert(d.bottom||[0,0]),"bottom-left":l.P.convert(d["bottom-left"]||[0,0]),"bottom-right":l.P.convert(d["bottom-right"]||[0,0]),left:l.P.convert(d.left||[0,0]),right:l.P.convert(d.right||[0,0])}}return Lo(new l.P(0,0))}const Jl=_e;M.AJAXError=l.cI,M.Event=l.l,M.Evented=l.E,M.LngLat=l.V,M.MercatorCoordinate=l.a9,M.Point=l.P,M.addProtocol=l.cJ,M.config=l.c,M.removeProtocol=l.cK,M.AttributionControl=Zl,M.BoxZoomHandler=Os,M.CanvasSource=j,M.CooperativeGesturesHandler=He,M.DoubleClickZoomHandler=ql,M.DragPanHandler=wu,M.DragRotateHandler=Lr,M.EdgeInsets=bs,M.FullscreenControl=class extends l.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n?.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:l.w("Full screen control 'container' must be a DOM element.")),"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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=de.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){de.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=de.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);de.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){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._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},M.GeoJSONSource=ms,M.GeolocateControl=class extends l.E{constructor(d){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new l.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new l.V(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,c=this._map.getBearing(),p=l.e({bearing:c},this.options.fitBoundsOptions),m=Wt.fromLngLat(n,a);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new l.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&rs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=de.create("button","maplibregl-ctrl-geolocate",this._container),de.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=de.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ra({element:this._dotElement}),this._circleElement=de.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ra({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(n=>{const a=n?.[0]instanceof ResizeObserverEntry;n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.l("trackuserlocationend")),this.fire(new l.l("userlocationlostfocus")))}))}},this.options=l.e({},Xl,d)}onAdd(d){return this._map=d,this._container=de.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return l._(this,arguments,void 0,(function*(t=!1){if(on!==void 0&&!t)return on;if(window.navigator.permissions===void 0)return on=!!window.navigator.geolocation,on;try{on=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{on=!!window.navigator.geolocation}return on}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),de.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Ns=0,rs=!1}_isOutOfMapMaxBounds(d){const t=this._map.getMaxBounds(),n=d.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const d=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&d))return;const t=this._map.project(d),n=this._map.unproject([t.x+100,t.y]),a=d.distanceTo(n)/100,c=2*this._accuracy/a;this._circleElement.style.width=`${c.toFixed(2)}px`,this._circleElement.style.height=`${c.toFixed(2)}px`}trigger(){if(!this._setup)return l.w("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 l.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ns--,rs=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.l("trackuserlocationstart")),this.fire(new l.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ns++,Ns>1?(d={maximumAge:6e5,timeout:0},rs=!0):(d=this.options.positionOptions,rs=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},M.GlobeControl=class{constructor(){this._toggleProjection=()=>{var d;const t=(d=this._map.getProjection())===null||d===void 0?void 0:d.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var d;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((d=this._map.getProjection())===null||d===void 0?void 0:d.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(d){return this._map=d,this._container=de.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=de.create("button","maplibregl-ctrl-globe",this._container),de.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){de.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},M.Hash=Ol,M.ImageSource=Qi,M.KeyboardHandler=Pt,M.LngLatBounds=Wt,M.LogoControl=Tu,M.Map=class extends Hi{constructor(d){var t,n;l.cG.mark(l.cH.create);const a=Object.assign(Object.assign(Object.assign({},zo),d),{canvasContextAttributes:Object.assign(Object.assign({},zo.canvasContextAttributes),d.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const c=new qn,p=new Zn;if(a.minZoom!==void 0&&c.setMinZoom(a.minZoom),a.maxZoom!==void 0&&c.setMaxZoom(a.maxZoom),a.minPitch!==void 0&&c.setMinPitch(a.minPitch),a.maxPitch!==void 0&&c.setMaxPitch(a.maxPitch),a.renderWorldCopies!==void 0&&c.setRenderWorldCopies(a.renderWorldCopies),a.transformConstrain!==null&&c.setConstrainOverride(a.transformConstrain),super(c,p,{bearingSnap:a.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new zh,this._controls=[],this._mapId=l.af(),this._lostContextStyle={style:null,images:null},this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const v of Object.values(this.style._layers))if(v.type==="custom"&&console.warn(`Custom layer with id '${v.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),v._listeners)for(const[b]of Object.entries(v._listeners))console.warn(`Custom layer with id '${v.id}' had event listeners for event '${b}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new l.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new l.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._bearingSnap=a.bearingSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ao),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=a.transformCameraUpdate,this.transformConstrain=a.transformConstrain,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,a.reduceMotion!==void 0&&(Ze.prefersReducedMotion=a.reduceMotion),this._imageQueueHandle=Ii.addThrottleControl((()=>this.isMoving())),this._requestManager=new nn(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),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)})),this.once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const v=Bl((b=>{this._trackResize&&!this._removed&&(this.resize(b),this.redraw())}),50);this._resizeObserver=new ResizeObserver((b=>{_?v(b):_=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Co(this,a),this._hash=a.hash&&new Ol(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,l.e({},a.fitBoundsOptions,{duration:0}))));const m=typeof a.style=="string"||((n=(t=a.style)===null||t===void 0?void 0:t.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,m),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new Zl(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new Tu,a.logoPosition),this.on("style.load",(()=>{if(m||this._resizeTransform(),this.transform.unmodified){const _=l.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}})),this.on("data",(_=>{this._update(_.dataType==="style"),this.fire(new l.l(`${_.dataType}data`,_))})),this.on("dataloading",(_=>{this.fire(new l.l(`${_.dataType}dataloading`,_))})),this.on("dataabort",(_=>{this.fire(new l.l("sourcedataabort",_))}))}_getMapId(){return this._mapId}setGlobalStateProperty(d,t){return this.style.setGlobalStateProperty(d,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(d,t){if(t===void 0&&(t=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new l.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=d.onAdd(this);this._controls.push(d);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new l.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(d);return t>-1&&this._controls.splice(t,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}coveringTiles(d){return Ht(this.transform,d)}calculateCameraOptionsFromTo(d,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(d,t,n,a)}resize(d,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new l.l("movestart",d)).fire(new l.l("move",d))),this.fire(new l.l("resize",d)),n&&this.fire(new l.l("moveend",d)),this}_resizeInternal(d=!0){const[t,n]=this._containerDimensions(),a=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,a),this.painter.resize(t,n,a),this.painter.overLimit()){const c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];const p=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,p),this.painter.resize(t,n,p)}this._resizeTransform(d)}_resizeTransform(d=!0){var t;const[n,a]=this._containerDimensions();this.transform.resize(n,a,d),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,a,d)}_getClampedPixelRatio(d,t){const{0:n,1:a}=this._maxCanvasSize,c=this.getPixelRatio(),p=d*c,m=t*c;return Math.min(p>n?n/p:1,m>a?a/m:1)*c}getPixelRatio(){var d;return(d=this._overridePixelRatio)!==null&&d!==void 0?d:devicePixelRatio}setPixelRatio(d){this._overridePixelRatio=d,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(Wt.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom){const t=this._getTransformForUpdate();return t.setMinZoom(d),this._applyUpdatedTransform(t),this._update(),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom){const t=this._getTransformForUpdate();return t.setMaxZoom(d),this._applyUpdatedTransform(t),this._update(),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch)return this.transform.setMinPitch(d),this._update(),this.getPitch()<d&&this.setPitch(d),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(d>=this.transform.minPitch)return this.transform.setMaxPitch(d),this._update(),this.getPitch()>d&&this.setPitch(d),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.setRenderWorldCopies(d),this._update()}setTransformConstrain(d){return this.transform.setConstrainOverride(d),this._update()}project(d){return this.transform.locationToScreenPoint(l.V.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.screenPointToLocation(l.P.convert(d),this.terrain)}isMoving(){var d;return this._moving||((d=this.handlers)===null||d===void 0?void 0:d.isMoving())}isZooming(){var d;return this._zooming||((d=this.handlers)===null||d===void 0?void 0:d.isZooming())}isRotating(){var d;return this._rotating||((d=this.handlers)===null||d===void 0?void 0:d.isRotating())}_createDelegatedListener(d,t,n){if(d==="mouseenter"||d==="mouseover"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:p=>{const m=t.filter((v=>this.getLayer(v))),_=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];_.length?a||(a=!0,n.call(this,new xi(d,this,p.originalEvent,{features:_}))):a=!1},mouseout:()=>{a=!1}}}}if(d==="mouseleave"||d==="mouseout"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:m=>{const _=t.filter((v=>this.getLayer(v)));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?a=!0:a&&(a=!1,n.call(this,new xi(d,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new xi(d,this,m.originalEvent)))}}}}{const a=c=>{const p=t.filter((_=>this.getLayer(_))),m=p.length!==0?this.queryRenderedFeatures(c.point,{layers:p}):[];m.length&&(c.features=m,n.call(this,c),delete c.features)};return{layers:t,listener:n,delegates:{[d]:a}}}}_saveDelegatedListener(d,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(t)}_removeDelegatedListener(d,t,n){if(!this._delegatedListeners||!this._delegatedListeners[d])return;const a=this._delegatedListeners[d];for(let c=0;c<a.length;c++){const p=a[c];if(p.listener===n&&p.layers.length===t.length&&p.layers.every((m=>t.includes(m)))){for(const m in p.delegates)this.off(m,p.delegates[m]);return void a.splice(c,1)}}}on(d,t,n){if(n===void 0)return super.on(d,t);const a=typeof t=="string"?[t]:t,c=this._createDelegatedListener(d,a,n);this._saveDelegatedListener(d,c);for(const p in c.delegates)this.on(p,c.delegates[p]);return{unsubscribe:()=>{this._removeDelegatedListener(d,a,n)}}}once(d,t,n){if(n===void 0)return super.once(d,t);const a=typeof t=="string"?[t]:t,c=this._createDelegatedListener(d,a,n);for(const p in c.delegates){const m=c.delegates[p];c.delegates[p]=(..._)=>{this._removeDelegatedListener(d,a,n),m(..._)}}this._saveDelegatedListener(d,c);for(const p in c.delegates)this.once(p,c.delegates[p]);return this}off(d,t,n){return n===void 0?super.off(d,t):(this._removeDelegatedListener(d,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(d,t){if(!this.style)return[];let n;const a=d instanceof l.P||Array.isArray(d),c=a?d:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:d)||{},c instanceof l.P||typeof c[0]=="number")n=[l.P.convert(c)];else{const p=l.P.convert(c[0]),m=l.P.convert(c[1]);n=[p,new l.P(m.x,p.y),m,new l.P(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(d,t){return this.style.querySourceFeatures(d,t)}setStyle(d,t){return(t=l.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(d,t))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const t=this._locale[d];if(t==null)throw new Error(`Missing UI string '${d}'`);return t}_updateStyle(d,t){var n,a;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(d,t)));const c=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new Hn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,t,c):this.style.loadJSON(d,t,c),this):((a=(n=this.style)===null||n===void 0?void 0:n.projection)===null||a===void 0||a.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Hn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,t){if(typeof d=="string"){const n=this._requestManager.transformRequest(d,"Style");l.j(n,new AbortController).then((a=>{this._updateDiff(a.data,t)})).catch((a=>{a&&this.fire(new l.k(a))}))}else typeof d=="object"&&this._updateDiff(d,t)}_updateDiff(d,t){try{this.style.setState(d,t)&&this._update(!0)}catch(n){l.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(d,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(d,t){return this._lazyInitEmptyStyle(),this.style.addSource(d,t),this._update(!0)}isSourceLoaded(d){const t=this.style&&this.style.tileManagers[d];if(t!==void 0)return t.loaded();this.fire(new l.k(new Error(`There is no tile manager with ID '${d}'`)))}setTerrain(d){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),d){const t=this.style.tileManagers[d.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===d.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===d.source&&l.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new qt(this.painter,t,d),this.painter.renderToTexture=new za(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var a;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==d.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((a=n.source)===null||a===void 0?void 0:a.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new l.l("terrain",{terrain:d})),this}getTerrain(){var d,t;return(t=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const d=this.style&&this.style.tileManagers;for(const t of Object.values(d))if(!t.areTilesLoaded())return!1;return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}setSourceTileLodParams(d,t,n){if(n){const a=this.getSource(n);if(!a)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);a.calculateTileZoom=wt(Math.max(1,d),Math.max(1,t))}else for(const a in this.style.tileManagers)this.style.tileManagers[a].getSource().calculateTileZoom=wt(Math.max(1,d),Math.max(1,t));return this._update(!0),this}refreshTiles(d,t){const n=this.style.tileManagers[d];if(!n)throw new Error(`There is no tile manager with ID "${d}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((a=>new l.ac(a.z,a.x,a.y))))}addImage(d,t,n={}){const{pixelRatio:a=1,sdf:c=!1,stretchX:p,stretchY:m,content:_,textFitWidth:v,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||l.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new l.k(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:T,height:A,data:C}=t,D=t;return this.style.addImage(d,{data:new l.R({width:T,height:A},new Uint8Array(C)),pixelRatio:a,stretchX:p,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:c,version:0,userImage:D}),D.onAdd&&D.onAdd(this,d),this}}{const{width:T,height:A,data:C}=Ze.getImageData(t);this.style.addImage(d,{data:new l.R({width:T,height:A},C),pixelRatio:a,stretchX:p,stretchY:m,content:_,textFitWidth:v,textFitHeight:b,sdf:c,version:0})}}updateImage(d,t){const n=this.style.getImage(d);if(!n)return this.fire(new l.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||l.b(t)?Ze.getImageData(t):t,{width:c,height:p,data:m}=a;if(c===void 0||p===void 0)return this.fire(new l.k(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(c!==n.data.width||p!==n.data.height)return this.fire(new l.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||l.b(t));return n.data.replace(m,_),this.style.updateImage(d,n),this}getImage(d){return this.style.getImage(d)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new l.k(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return Ii.getImage(this._requestManager.transformRequest(d,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(d,t){return this._lazyInitEmptyStyle(),this.style.addLayer(d,t),this._update(!0)}moveLayer(d,t){return this.style.moveLayer(d,t),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(d,t,n){return this.style.setLayerZoomRange(d,t,n),this._update(!0)}setFilter(d,t,n={}){return this.style.setFilter(d,t,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,t,n,a={}){return this.style.setPaintProperty(d,t,n,a),this._update(!0)}getPaintProperty(d,t){return this.style.getPaintProperty(d,t)}setLayoutProperty(d,t,n,a={}){return this.style.setLayoutProperty(d,t,n,a),this._update(!0)}getLayoutProperty(d,t){return this.style.getLayoutProperty(d,t)}setGlyphs(d,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,t,n,(a=>{a||this._update(!0)})),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,t,(n=>{n||this._update(!0)})),this}setLight(d,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(d,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,t){return this.style.setFeatureState(d,t),this._update()}removeFeatureState(d,t){return this.style.removeFeatureState(d,t),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,t=0;return this._container&&(d=this._container.clientWidth||400,t=this._container.clientHeight||300),[d,t]}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const t=this._canvasContainer=de.create("div","maplibregl-canvas-container",d);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=de.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const c=this._controlContainer=de.create("div","maplibregl-control-container",d),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{p[m]=de.create("div",`maplibregl-ctrl-${m} `,c)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,t,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const d=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{t={requestedAttributes:d},a&&(t.statusMessage=a.statusMessage,t.type=a.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,d):this._canvas.getContext("webgl2",d)||this._canvas.getContext("webgl",d),!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new du(n,this.transform),vt.testSupport(n)}migrateProjection(d,t){super.migrateProjection(d,t),this.painter.transform=d,this.fire(new l.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(d){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){var t,n,a,c,p;const m=this._idleTriggered?this._fadeDuration:0,_=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,C=Xe();this.style.zoomHistory.update(A,C);const D=new l.H(A,{now:C,fadeDuration:m,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),V=D.crossFadingFactor();V===1&&V===this._crossFadingFactor||(v=!0,this._crossFadingFactor=V),this.style.update(D)}const b=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==_;(a=this.style.projection)===null||a===void 0||a.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((c=this.style.projection)===null||c===void 0?void 0:c.transitionState,(p=this.style.projection)===null||p===void 0?void 0:p.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||b)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,b),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,showPadding:this.showPadding}),this.fire(new l.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.cG.mark(l.cH.load),this.fire(new l.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const T=this._sourcesDirty||this._styleDirty||this._placementDirty;return T||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.l("idle")),!this._loaded||this._fullyLoaded||T||(this._fullyLoaded=!0,l.cG.mark(l.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var d;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ii.removeThrottleControl(this._imageQueueHandle),(d=this._resizeObserver)===null||d===void 0||d.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),de.remove(this._canvasContainer),de.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),l.cG.clearMetrics(),this._removed=!0,this.fire(new l.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ze.frame(this._frameRequest,(d=>{l.cG.frame(d),this._frameRequest=null;try{this._render(d)}catch(t){if(!l.Z(t)&&!(function(n){return n.message===zl})(t))throw t}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get version(){return Wl}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(d){return this._lazyInitEmptyStyle(),this.style.setProjection(d),this._update(!0)}},M.MapMouseEvent=xi,M.MapTouchEvent=Ta,M.MapWheelEvent=mu,M.Marker=Ra,M.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=l.e({},Hl,d),this._container=de.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),de.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),de.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=de.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(d){return this._map=d,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ka(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){de.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(d,t){const n=de.create("button",d,this._container);return n.type="button",n.addEventListener("click",t),n}},M.Popup=class extends l.E{constructor(d){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&de.remove(this._content),this._container&&(de.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=de.create("div","maplibregl-popup",this._map.getContainer()),this._tip=de.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ko(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor;const c=Lo(this.options.offset);if(!a){const m=this._container.offsetWidth,_=this._container.offsetHeight,v=(function(T){var A,C,D,V;return T?{top:(A=T.top)!==null&&A!==void 0?A:0,right:(C=T.right)!==null&&C!==void 0?C:0,bottom:(D=T.bottom)!==null&&D!==void 0?D:0,left:(V=T.left)!==null&&V!==void 0?V:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let b;b=n.y+c.bottom.y<_+v.top?["top"]:n.y>this._map.transform.height-_-v.bottom?["bottom"]:[],n.x<m/2+v.left?b.push("left"):n.x>this._map.transform.width-m/2-v.right&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let p=n.add(c[a]);this.options.subpixelPositioning||(p=p.round()),de.setTransform(this._container,`${Da[a]} translate(${p.x}px,${p.y}px)`),Do(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Kl),d)}addTo(d){return this._map&&this.remove(),this._map=d,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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=l.V.convert(d),this._pos=null,this._flatPos=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"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=d;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=de.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}setPadding(d){this.options.padding=d,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=de.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(Ro);d&&d.focus()}},M.RasterDEMTileSource=bn,M.RasterTileSource=ps,M.ScaleControl=class{constructor(d){this._onMove=()=>{La(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,La(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Yl),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=de.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){de.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},M.ScrollZoomHandler=Io,M.Style=Hn,M.TerrainControl=class{constructor(d){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=d}onAdd(d){return this._map=d,this._container=de.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=de.create("button","maplibregl-ctrl-terrain",this._container),de.create("span","maplibregl-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(){de.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},M.TwoFingersTouchPitchHandler=vu,M.TwoFingersTouchRotateHandler=Gl,M.TwoFingersTouchZoomHandler=Ul,M.TwoFingersTouchZoomRotateHandler=Ea,M.VectorTileSource=Nn,M.VideoSource=ue,M.addSourceType=(d,t)=>l._(void 0,void 0,void 0,(function*(){if(G(d))throw new Error(`A source type called "${d}" already exists.`);((n,a)=>{O[n]=a})(d,t)})),M.clearPrewarmedResources=function(){const d=lr;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(Wr),lr=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()"))},M.createTileMesh=kc,M.getMaxParallelImageRequests=function(){return l.c.MAX_PARALLEL_IMAGE_REQUESTS},M.getRTLTextPluginStatus=function(){return ce().getRTLTextPluginStatus()},M.getVersion=function(){return Jl},M.getWorkerCount=function(){return ti.workerCount},M.getWorkerUrl=function(){return l.c.WORKER_URL},M.importScriptInWorkers=function(d){return yn().broadcast("IS",d)},M.isTimeFrozen=function(){return yt.isFrozen()},M.now=Xe,M.prewarm=function(){Hr().acquire(Wr)},M.restoreNow=function(){yt.restoreNow()},M.setMaxParallelImageRequests=function(d){l.c.MAX_PARALLEL_IMAGE_REQUESTS=d},M.setNow=function(d){yt.setNow(d)},M.setRTLTextPlugin=function(d,t){return ce().setRTLTextPlugin(d,t)},M.setWorkerCount=function(d){ti.workerCount=d},M.setWorkerUrl=function(d){l.c.WORKER_URL=d}}));var le=F;return le}))})(sh)),sh.exports}var Ey=Iy();const cm=Py(Ey);var bc=I=>typeof I=="function"?I:function(){return I},Cy=typeof self<"u"?self:null,tl=typeof window<"u"?window:null,Bn=Cy||tl||globalThis,Ay="2.0.0",On={connecting:0,open:1,closing:2,closed:3},zy=1e4,ky=1e3,Nr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ds={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Bd={longpoll:"longpoll",websocket:"websocket"},Dy={complete:4},Od="base64url.bearer.phx.",Qu=class{constructor(I,S,F,B){this.channel=I,this.event=S,this.payload=F||function(){return{}},this.receivedResp=null,this.timeout=B,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(I){this.timeout=I,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(I,S){return this.hasReceived(I)&&S(this.receivedResp.response),this.recHooks.push({status:I,callback:S}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:I,response:S,_ref:F}){this.recHooks.filter(B=>B.status===I).forEach(B=>B.callback(S))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,I=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=I,this.matchReceive(I)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(I){return this.receivedResp&&this.receivedResp.status===I}trigger(I,S){this.channel.trigger(this.refEvent,{status:I,response:S})}},ym=class{constructor(I,S){this.callback=I,this.timerCalc=S,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Ry=class{constructor(I,S,F){this.state=Nr.closed,this.topic=I,this.params=bc(S||{}),this.socket=F,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Qu(this,ds.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new ym(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Nr.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(B=>B.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Nr.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Nr.closed,this.socket.remove(this)}),this.onError(B=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,B),this.isJoining()&&this.joinPush.reset(),this.state=Nr.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Qu(this,ds.leave,bc({}),this.timeout).send(),this.state=Nr.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ds.reply,(B,Y)=>{this.trigger(this.replyEventName(Y),B)})}join(I=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=I,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(I){this.on(ds.close,I)}onError(I){return this.on(ds.error,S=>I(S))}on(I,S){let F=this.bindingRef++;return this.bindings.push({event:I,ref:F,callback:S}),F}off(I,S){this.bindings=this.bindings.filter(F=>!(F.event===I&&(typeof S>"u"||S===F.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(I,S,F=this.timeout){if(S=S||{},!this.joinedOnce)throw new Error(`tried to push '${I}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let B=new Qu(this,I,function(){return S},F);return this.canPush()?B.send():(B.startTimeout(),this.pushBuffer.push(B)),B}leave(I=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Nr.leaving;let S=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ds.close,"leave")},F=new Qu(this,ds.leave,bc({}),I);return F.receive("ok",()=>S()).receive("timeout",()=>S()),F.send(),this.canPush()||F.trigger("ok",{}),F}onMessage(I,S,F){return S}isMember(I,S,F,B){return this.topic!==I?!1:B&&B!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:I,event:S,payload:F,joinRef:B}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(I=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Nr.joining,this.joinPush.resend(I))}trigger(I,S,F,B){let Y=this.onMessage(I,S,F,B);if(S&&!Y)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let le=this.bindings.filter(M=>M.event===I);for(let M=0;M<le.length;M++)le[M].callback(Y,F,B||this.joinRef())}replyEventName(I){return`chan_reply_${I}`}isClosed(){return this.state===Nr.closed}isErrored(){return this.state===Nr.errored}isJoined(){return this.state===Nr.joined}isJoining(){return this.state===Nr.joining}isLeaving(){return this.state===Nr.leaving}},ah=class{static request(I,S,F,B,Y,le,M){if(Bn.XDomainRequest){let l=new Bn.XDomainRequest;return this.xdomainRequest(l,I,S,B,Y,le,M)}else if(Bn.XMLHttpRequest){let l=new Bn.XMLHttpRequest;return this.xhrRequest(l,I,S,F,B,Y,le,M)}else{if(Bn.fetch&&Bn.AbortController)return this.fetchRequest(I,S,F,B,Y,le,M);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(I,S,F,B,Y,le,M){let l={method:I,headers:F,body:B},_e=null;return Y&&(_e=new AbortController,setTimeout(()=>_e.abort(),Y),l.signal=_e.signal),Bn.fetch(S,l).then(Oe=>Oe.text()).then(Oe=>this.parseJSON(Oe)).then(Oe=>M&&M(Oe)).catch(Oe=>{Oe.name==="AbortError"&&le?le():M&&M(null)}),_e}static xdomainRequest(I,S,F,B,Y,le,M){return I.timeout=Y,I.open(S,F),I.onload=()=>{let l=this.parseJSON(I.responseText);M&&M(l)},le&&(I.ontimeout=le),I.onprogress=()=>{},I.send(B),I}static xhrRequest(I,S,F,B,Y,le,M,l){I.open(S,F,!0),I.timeout=le;for(let[_e,Oe]of Object.entries(B))I.setRequestHeader(_e,Oe);return I.onerror=()=>l&&l(null),I.onreadystatechange=()=>{if(I.readyState===Dy.complete&&l){let _e=this.parseJSON(I.responseText);l(_e)}},M&&(I.ontimeout=M),I.send(Y),I}static parseJSON(I){if(!I||I==="")return null;try{return JSON.parse(I)}catch{return console&&console.log("failed to parse JSON response",I),null}}static serialize(I,S){let F=[];for(var B in I){if(!Object.prototype.hasOwnProperty.call(I,B))continue;let Y=S?`${S}[${B}]`:B,le=I[B];typeof le=="object"?F.push(this.serialize(le,Y)):F.push(encodeURIComponent(Y)+"="+encodeURIComponent(le))}return F.join("&")}static appendParams(I,S){if(Object.keys(S).length===0)return I;let F=I.match(/\?/)?"&":"?";return`${I}${F}${this.serialize(S)}`}},Ly=I=>{let S="",F=new Uint8Array(I),B=F.byteLength;for(let Y=0;Y<B;Y++)S+=String.fromCharCode(F[Y]);return btoa(S)},xc=class{constructor(I,S){S&&S.length===2&&S[1].startsWith(Od)&&(this.authToken=atob(S[1].slice(Od.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(I),this.readyState=On.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(I){return I.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Bd.websocket),"$1/"+Bd.longpoll)}endpointURL(){return ah.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(I,S,F){this.close(I,S,F),this.readyState=On.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===On.open||this.readyState===On.connecting}poll(){const I={Accept:"application/json"};this.authToken&&(I["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",I,null,()=>this.ontimeout(),S=>{if(S){var{status:F,token:B,messages:Y}=S;if(F===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=B}else F=0;switch(F){case 200:Y.forEach(le=>{setTimeout(()=>this.onmessage({data:le}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=On.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${F}`)}})}send(I){typeof I!="string"&&(I=Ly(I)),this.currentBatch?this.currentBatch.push(I):this.awaitingBatchAck?this.batchBuffer.push(I):(this.currentBatch=[I],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(I){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},I.join(`
|
|
809
|
+
`),()=>this.onerror("timeout"),S=>{this.awaitingBatchAck=!1,!S||S.status!==200?(this.onerror(S&&S.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(I,S,F){for(let Y of this.reqs)Y.abort();this.readyState=On.closed;let B=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:I,reason:S,wasClean:F});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",B)):this.onclose(B)}ajax(I,S,F,B,Y){let le,M=()=>{this.reqs.delete(le),B()};le=ah.request(I,this.endpointURL(),S,F,this.timeout,M,l=>{this.reqs.delete(le),this.isActive()&&Y(l)}),this.reqs.add(le)}},eh={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(I,S){if(I.payload.constructor===ArrayBuffer)return S(this.binaryEncode(I));{let F=[I.join_ref,I.ref,I.topic,I.event,I.payload];return S(JSON.stringify(F))}},decode(I,S){if(I.constructor===ArrayBuffer)return S(this.binaryDecode(I));{let[F,B,Y,le,M]=JSON.parse(I);return S({join_ref:F,ref:B,topic:Y,event:le,payload:M})}},binaryEncode(I){let{join_ref:S,ref:F,event:B,topic:Y,payload:le}=I,M=this.META_LENGTH+S.length+F.length+Y.length+B.length,l=new ArrayBuffer(this.HEADER_LENGTH+M),_e=new DataView(l),Oe=0;_e.setUint8(Oe++,this.KINDS.push),_e.setUint8(Oe++,S.length),_e.setUint8(Oe++,F.length),_e.setUint8(Oe++,Y.length),_e.setUint8(Oe++,B.length),Array.from(S,De=>_e.setUint8(Oe++,De.charCodeAt(0))),Array.from(F,De=>_e.setUint8(Oe++,De.charCodeAt(0))),Array.from(Y,De=>_e.setUint8(Oe++,De.charCodeAt(0))),Array.from(B,De=>_e.setUint8(Oe++,De.charCodeAt(0)));var qe=new Uint8Array(l.byteLength+le.byteLength);return qe.set(new Uint8Array(l),0),qe.set(new Uint8Array(le),l.byteLength),qe.buffer},binaryDecode(I){let S=new DataView(I),F=S.getUint8(0),B=new TextDecoder;switch(F){case this.KINDS.push:return this.decodePush(I,S,B);case this.KINDS.reply:return this.decodeReply(I,S,B);case this.KINDS.broadcast:return this.decodeBroadcast(I,S,B)}},decodePush(I,S,F){let B=S.getUint8(1),Y=S.getUint8(2),le=S.getUint8(3),M=this.HEADER_LENGTH+this.META_LENGTH-1,l=F.decode(I.slice(M,M+B));M=M+B;let _e=F.decode(I.slice(M,M+Y));M=M+Y;let Oe=F.decode(I.slice(M,M+le));M=M+le;let qe=I.slice(M,I.byteLength);return{join_ref:l,ref:null,topic:_e,event:Oe,payload:qe}},decodeReply(I,S,F){let B=S.getUint8(1),Y=S.getUint8(2),le=S.getUint8(3),M=S.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,_e=F.decode(I.slice(l,l+B));l=l+B;let Oe=F.decode(I.slice(l,l+Y));l=l+Y;let qe=F.decode(I.slice(l,l+le));l=l+le;let De=F.decode(I.slice(l,l+M));l=l+M;let Re=I.slice(l,I.byteLength),Ze={status:De,response:Re};return{join_ref:_e,ref:Oe,topic:qe,event:ds.reply,payload:Ze}},decodeBroadcast(I,S,F){let B=S.getUint8(1),Y=S.getUint8(2),le=this.HEADER_LENGTH+2,M=F.decode(I.slice(le,le+B));le=le+B;let l=F.decode(I.slice(le,le+Y));le=le+Y;let _e=I.slice(le,I.byteLength);return{join_ref:null,ref:null,topic:M,event:l,payload:_e}}},Fy=class{constructor(I,S={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=S.timeout||zy,this.transport=S.transport||Bn.WebSocket||xc,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=S.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=S.sessionStorage||Bn&&Bn.sessionStorage,this.establishedConnections=0,this.defaultEncoder=eh.encode.bind(eh),this.defaultDecoder=eh.decode.bind(eh),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=S.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==xc?(this.encode=S.encode||this.defaultEncoder,this.decode=S.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let F=null;tl&&tl.addEventListener&&(tl.addEventListener("pagehide",B=>{this.conn&&(this.disconnect(),F=this.connectClock)}),tl.addEventListener("pageshow",B=>{F===this.connectClock&&(F=null,this.connect())}),tl.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=S.heartbeatIntervalMs||3e4,this.rejoinAfterMs=B=>S.rejoinAfterMs?S.rejoinAfterMs(B):[1e3,2e3,5e3][B-1]||1e4,this.reconnectAfterMs=B=>S.reconnectAfterMs?S.reconnectAfterMs(B):[10,50,100,150,200,250,500,1e3,2e3][B-1]||5e3,this.logger=S.logger||null,!this.logger&&S.debug&&(this.logger=(B,Y,le)=>{console.log(`${B}: ${Y}`,le)}),this.longpollerTimeout=S.longpollerTimeout||2e4,this.params=bc(S.params||{}),this.endPoint=`${I}/${Bd.websocket}`,this.vsn=S.vsn||Ay,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ym(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=S.authToken}getLongPollTransport(){return xc}replaceTransport(I){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=I}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let I=ah.appendParams(ah.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return I.charAt(0)!=="/"?I:I.charAt(1)==="/"?`${this.protocol()}:${I}`:`${this.protocol()}://${location.host}${I}`}disconnect(I,S,F){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,I&&I()},S,F)}connect(I){I&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=bc(I)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==xc?this.connectWithFallback(xc,this.longPollFallbackMs):this.transportConnect())}log(I,S,F){this.logger&&this.logger(I,S,F)}hasLogger(){return this.logger!==null}onOpen(I){let S=this.makeRef();return this.stateChangeCallbacks.open.push([S,I]),S}onClose(I){let S=this.makeRef();return this.stateChangeCallbacks.close.push([S,I]),S}onError(I){let S=this.makeRef();return this.stateChangeCallbacks.error.push([S,I]),S}onMessage(I){let S=this.makeRef();return this.stateChangeCallbacks.message.push([S,I]),S}ping(I){if(!this.isConnected())return!1;let S=this.makeRef(),F=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:S});let B=this.onMessage(Y=>{Y.ref===S&&(this.off([B]),I(Date.now()-F))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1;let I;this.authToken&&(I=["phoenix",`${Od}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),I),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=S=>this.onConnError(S),this.conn.onmessage=S=>this.onConnMessage(S),this.conn.onclose=S=>this.onConnClose(S)}getSession(I){return this.sessionStore&&this.sessionStore.getItem(I)}storeSession(I,S){this.sessionStore&&this.sessionStore.setItem(I,S)}connectWithFallback(I,S=2500){clearTimeout(this.fallbackTimer);let F=!1,B=!0,Y,le,M=l=>{this.log("transport",`falling back to ${I.name}...`,l),this.off([Y,le]),B=!1,this.replaceTransport(I),this.transportConnect()};if(this.getSession(`phx:fallback:${I.name}`))return M("memorized");this.fallbackTimer=setTimeout(M,S),le=this.onError(l=>{this.log("transport","error",l),B&&!F&&(clearTimeout(this.fallbackTimer),M(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(F=!0,!B)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${I.name}`,"true"),this.log("transport",`established ${I.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(M,S),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,I])=>I())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),ky,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(I,S,F){if(!this.conn)return I&&I();let B=this.connectClock;this.waitForBufferDone(()=>{B===this.connectClock&&(this.conn&&(S?this.conn.close(S,F||""):this.conn.close()),this.waitForSocketClosed(()=>{B===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),I&&I())}))})}waitForBufferDone(I,S=1){if(S===5||!this.conn||!this.conn.bufferedAmount){I();return}setTimeout(()=>{this.waitForBufferDone(I,S+1)},150*S)}waitForSocketClosed(I,S=1){if(S===5||!this.conn||this.conn.readyState===On.closed){I();return}setTimeout(()=>{this.waitForSocketClosed(I,S+1)},150*S)}onConnClose(I){this.conn&&(this.conn.onclose=()=>{});let S=I&&I.code;this.hasLogger()&&this.log("transport","close",I),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&S!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,F])=>F(I))}onConnError(I){this.hasLogger()&&this.log("transport",I);let S=this.transport,F=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,B])=>{B(I,S,F)}),(S===this.transport||F>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(I=>{I.isErrored()||I.isLeaving()||I.isClosed()||I.trigger(ds.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case On.connecting:return"connecting";case On.open:return"open";case On.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(I){this.off(I.stateChangeRefs),this.channels=this.channels.filter(S=>S!==I)}off(I){for(let S in this.stateChangeCallbacks)this.stateChangeCallbacks[S]=this.stateChangeCallbacks[S].filter(([F])=>I.indexOf(F)===-1)}channel(I,S={}){let F=new Ry(I,S,this);return this.channels.push(F),F}push(I){if(this.hasLogger()){let{topic:S,event:F,payload:B,ref:Y,join_ref:le}=I;this.log("push",`${S} ${F} (${le}, ${Y})`,B)}this.isConnected()?this.encode(I,S=>this.conn.send(S)):this.sendBuffer.push(()=>this.encode(I,S=>this.conn.send(S)))}makeRef(){let I=this.ref+1;return I===this.ref?this.ref=0:this.ref=I,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(I=>I()),this.sendBuffer=[])}onConnMessage(I){this.decode(I.data,S=>{let{topic:F,event:B,payload:Y,ref:le,join_ref:M}=S;le&&le===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${Y.status||""} ${F} ${B} ${le&&"("+le+")"||""}`,Y);for(let l=0;l<this.channels.length;l++){const _e=this.channels[l];_e.isMember(F,B,Y,M)&&_e.trigger(B,Y,le,M)}for(let l=0;l<this.stateChangeCallbacks.message.length;l++){let[,_e]=this.stateChangeCallbacks.message[l];_e(S)}})}leaveOpenTopic(I){let S=this.channels.find(F=>F.topic===I&&(F.isJoined()||F.isJoining()));S&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${I}"`),S.leave())}};class Rd extends Error{constructor(S="this function is not yet implemented."){super(S),this.name="NotImplementedError"}}class By{now=Yi(new Date);isPlaying=Yi(!1);constructor(){}dispose(){}play(){throw new Rd}pause(){throw new Rd}seek(S){throw new Rd}}class Oy{app;widgets=dy({TopBar:[],SideBar:[],MapOverlay:[]});constructor(S){this.app=S}registerWidget(S,F,B,Y={}){this.app.component(S,B);const{priority:le=0,title:M,relevantFor:l}=Y,Oe={id:S,priority:F==="MapOverlay"?0:le,title:M,relevantFor:l,isCollapsed:!1};return this.widgets[F].push(Oe),this.widgets[F].sort((qe,De)=>De.priority-qe.priority),{dispose:()=>{const qe=this.widgets[F],De=qe.findIndex(Re=>Re.id===S);De>-1&&qe.splice(De,1)}}}}class jy{tangramApi;constructor(S){this.tangramApi=S}map=Za(null);overlay=Za(null);layers=Za([]);isReady=Nd(()=>!!this.map.value);center=Yi({lng:0,lat:0});zoom=Yi(0);pitch=Yi(0);bearing=Yi(0);bounds=Yi(null);updateState=()=>{if(!this.map.value)return;const S=this.map.value;this.center.value=S.getCenter(),this.zoom.value=S.getZoom(),this.pitch.value=S.getPitch(),this.bearing.value=S.getBearing(),this.bounds.value=S.getBounds()};initialize=S=>{this.map.value=S,this.overlay.value=new by({interleaved:!1,onHover:B=>{const Y=this.map.value?.getCanvas();Y&&(Y.style.cursor=B.object?"pointer":"")},onClick:B=>{B.object||this.tangramApi.state.clearSelection()}}),this.map.value.addControl(this.overlay.value),nl(this.layers,B=>{this.overlay.value?.setProps({layers:B})},{deep:!0});const F=()=>{this.updateState(),this.map.value?.off("load",F)};this.map.value.on("load",F),this.map.value.on("moveend",this.updateState),this.map.value.on("zoomend",this.updateState),this.map.value.on("pitchend",this.updateState),this.map.value.on("rotateend",this.updateState)};dispose=()=>{this.map.value?.remove(),this.map.value=null};getMapInstance=()=>{if(!this.map.value)throw new Error("map not initialized");return this.map.value};addLayer(S){return this.layers.value=[...this.layers.value,S],{dispose:()=>{this.layers.value=this.layers.value.filter(F=>F!==S)}}}setLayer(S){const F=this.layers.value.findIndex(B=>B.id===S.id);if(F>=0){const B=[...this.layers.value];B[F]=S,this.layers.value=B}else this.layers.value=[...this.layers.value,S];return{dispose:()=>{this.layers.value=this.layers.value.filter(B=>B.id!==S.id)}}}}class Vy{entitiesByType=new Map;totalCounts=Yi(new Map);activeEntities=Za(new Map);registerEntityType=S=>{this.entitiesByType.has(S)||this.entitiesByType.set(S,Za(new Map))};getEntitiesByType=S=>(this.entitiesByType.has(S)||this.entitiesByType.set(S,Za(new Map)),this.entitiesByType.get(S));replaceAllEntitiesByType=(S,F)=>{let B=this.entitiesByType.get(S);B||(B=Za(new Map),this.entitiesByType.set(S,B));const Y=new Map;for(const l of F)Y.set(l.id,l);B.value=Y;const le=new Map(this.activeEntities.value);let M=!1;for(const[l,_e]of le)if(_e.type===S){const Oe=Y.get(l);Oe&&(le.set(l,Oe),M=!0)}M&&(this.activeEntities.value=le)};selectEntity=(S,F=!0)=>{if(F){const B=new Map;B.set(S.id,S),this.activeEntities.value=B}else{const B=new Map(this.activeEntities.value);B.set(S.id,S),this.activeEntities.value=B}};deselectEntity=S=>{const F=new Map(this.activeEntities.value);F.delete(S)&&(this.activeEntities.value=F)};clearSelection=()=>{this.activeEntities.value.size>0&&(this.activeEntities.value=new Map)};setTotalCount=(S,F)=>{const B=new Map(this.totalCounts.value);B.set(S,F),this.totalCounts.value=B}}class Ny{socket=null;channels=new Map;channelConfig;connectionPromise=null;connectionId=null;joinPromises=new Map;constructor(S){this.channelConfig=S.channel}getConnectionId(){return this.connectionId}async ensureConnected(){if(await this.connect(),!this.connectionId)throw new Error("connection id unavailable after connect");return this.connectionId}async fetchToken(S){const F=`${this.channelConfig.url}/token`,B={channel:S};this.connectionId&&(B.id=this.connectionId);const Y=await fetch(F,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!Y.ok)throw new Error(`failed to fetch token: ${Y.statusText}`);return Y.json()}connect(){return this.connectionPromise||(this.connectionPromise=(async()=>{try{if(this.socket?.isConnected())return;const{id:S,token:F}=await this.fetchToken("system");this.connectionId=S;const B=this.channelConfig.url.replace(/^http/,"ws");this.socket=new Fy(B,{params:{userToken:F}}),await new Promise((Y,le)=>{this.socket.connect(),this.socket.onOpen(()=>{console.log("ws connected"),Y()}),this.socket.onError(M=>{console.error("ws connection error:",M),this.connectionPromise=null,le(M)})})}catch(S){throw this.connectionPromise=null,S}})()),this.connectionPromise}async getChannel(S){if(await this.connect(),!this.socket)throw new Error("socket connection failed");if(this.joinPromises.has(S))return this.joinPromises.get(S);if(this.channels.has(S)){const B=this.channels.get(S);if(B.state==="joined")return B}const F=(async()=>{try{let B=this.channels.get(S);if(!B){const{token:Y}=await this.fetchToken(S);B=this.socket.channel(S,{token:Y}),this.channels.set(S,B)}return B.state==="joined"||await new Promise((Y,le)=>{B.join().receive("ok",()=>Y()).receive("error",M=>le(M)).receive("timeout",()=>le("channel join timeout"))}),B}catch(B){throw this.channels.delete(S),B}})();this.joinPromises.set(S,F);try{return await F}finally{this.joinPromises.delete(S)}}parseTopicEvent(S){const F=S.split(":");if(F.length<2)throw new Error(`invalid topic:event format: ${S}`);const B=F.pop();return[F.join(":"),B]}async subscribe(S,F){const[B,Y]=this.parseTopicEvent(S),le=await this.getChannel(B),M=le.on(Y,F);return{dispose:()=>le.off(Y,M)}}async publish(S,F){const[B,Y]=this.parseTopicEvent(S);(await this.getChannel(B)).push(Y,F)}async request(S,F,B=5e3){const[Y,le]=this.parseTopicEvent(S),M=await this.getChannel(Y),l=`${le}_result`,_e=crypto.randomUUID();return new Promise((Oe,qe)=>{const De=setTimeout(()=>{Ze(),qe(new Error("request timeout"))},B),Re=M.on(l,yt=>{yt.request_id===_e&&(Ze(),Oe(yt.data))}),Ze=()=>{clearTimeout(De),M.off(l,Re)};M.push(le,{...F,request_id:_e})})}}class Uy{providers=new Map;registerProvider(S){return this.providers.set(S.id,S),{dispose:()=>{this.providers.delete(S.id)}}}async search(S,F,B){await Promise.all(Array.from(this.providers.values()).map(async Y=>{try{const le=await Y.search(S,F);!F.aborted&&le.length>0&&B(le)}catch(le){F.aborted||console.error(`search error in ${Y.id}:`,le)}}))}}class Ud{constructor(S,F){this.app=S,this.config=F,this.realtime=new Ny(F),this.ui=new Oy(this.app),this.time=new By,this.map=new jy(this),this.state=new Vy,this.search=new Uy,this.setupViewUpdates()}time;ui;map;state;realtime;search;config;setupViewUpdates(){const S=()=>{const F=this.realtime.getConnectionId();if(!F)return;const B=this.map.bounds.value;if(!B)return;const Y=Array.from(this.state.activeEntities.value.values()).map(M=>({id:M.id,typeName:M.type})),le={connectionId:F,northEastLat:B.getNorthEast().lat,northEastLng:B.getNorthEast().lng,southWestLat:B.getSouthWest().lat,southWestLng:B.getSouthWest().lng,selectedEntities:Y};this.realtime.publish("system:bound-box",le)};nl(this.map.bounds,S,{deep:!0}),nl(this.state.activeEntities,S,{deep:!0})}static async create(S){const F=await fetch("/config").then(B=>{if(!B.ok)throw new Error("failed to fetch `/config`!");return B.json()});return new Ud(S,F)}getVueApp(){return this.app}}async function Gy(I,S){S?.({stage:"manifest"});const F=await fetch("/manifest.json").then(B=>B.json());for(const[B,Y]of Object.entries(F.plugins)){const le=Y;if(S?.({stage:"plugin",pluginName:B}),le.style){const l=document.createElement("link");l.rel="stylesheet",l.href=`/plugins/${B}/${le.style}`,document.head.appendChild(l)}const M=`/plugins/${B}/${le.main}`;try{const l=await import(M);l.install&&l.install(I,le.config)}catch(l){console.error(`failed to load plugin "${B}":`,l)}}S?.({stage:"done"})}var $y=Object.defineProperty,jn=(I,S)=>$y(I,"name",{value:S,configurable:!0});function Mr(I,S){let F="script";return I==="name"?F="script":I==="name2"?F="script2":I==="name3"&&(F="script3"),[["coalesce",["get",`pgf:${I}`],["get",I]],{"text-font":["case",["==",["get",F],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[S||"Noto Sans Regular"]]]}]}jn(Mr,"get_name_block");function Fn(I,S,F){let B="name";return F==="name"?B="":F==="name2"?B="2":F==="name3"&&(B="3"),S==="Latin"?["has",`script${B}`]:I==="ja"?["all",["!=",["get",`script${B}`],"Han"],["!=",["get",`script${B}`],"Hiragana"],["!=",["get",`script${B}`],"Katakana"],["!=",["get",`script${B}`],"Mixed-Japanese"]]:["!=",["get",`script${B}`],S]}jn(Fn,"is_not_in_target_script");function gn(I){return I==="Devanagari"?{"text-font":["literal",["Noto Sans Devanagari Regular v1"]]}:{}}jn(gn,"get_font_formatting");function Gd(I){let S=qy.find(F=>F.lang===I);return S===void 0?"Latin":S.script}jn(Gd,"get_default_script");function vm(I,S){let F=S||Gd(I),B;return F==="Devanagari"?B="pgf:":B="",["format",["coalesce",["get",`${B}name:${I}`],["get","name:en"]],gn(F)]}jn(vm,"get_country_name");function mn(I,S,F){let B=S||Gd(I),Y;return B==="Devanagari"?Y="pgf:":Y="",["case",["all",["any",["has","name"],["has","pgf:name"]],["!",["any",["has","name2"],["has","pgf:name2"]]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",Fn(I,B,"name"),["case",["any",["is-supported-script",["get","name"]],["has","pgf:name"]],["format",["coalesce",["get",`${Y}name:${I}`],["get","name:en"]],gn(B),`
|
|
810
|
+
`,{},["case",["all",["!",["has",`${Y}name:${I}`]],["has","name:en"],["!",["has","script"]]],"",["coalesce",["get","pgf:name"],["get","name"]]],{"text-font":["case",["==",["get","script"],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[F||"Noto Sans Regular"]]]}],["get","name:en"]],["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name"],["get","name"]],gn(B)]],["all",["any",["has","name"],["has","pgf:name"]],["any",["has","name2"],["has","pgf:name2"]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",["all",Fn(I,B,"name"),Fn(I,B,"name2")],["format",["get",`${Y}name:${I}`],gn(B),`
|
|
811
|
+
`,{},...Mr("name",F),`
|
|
812
|
+
`,{},...Mr("name2",F)],["case",Fn(I,B,"name2"),["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name"],["get","name"]],gn(B),`
|
|
813
|
+
`,{},...Mr("name2",F)],["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name2"],["get","name2"]],gn(B),`
|
|
814
|
+
`,{},...Mr("name",F)]]],["case",["all",Fn(I,B,"name"),Fn(I,B,"name2"),Fn(I,B,"name3")],["format",["get",`${Y}name:${I}`],gn(B),`
|
|
815
|
+
`,{},...Mr("name",F),`
|
|
816
|
+
`,{},...Mr("name2",F),`
|
|
817
|
+
`,{},...Mr("name3",F)],["case",["!",Fn(I,B,"name")],["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name"],["get","name"]],gn(B),`
|
|
818
|
+
`,{},...Mr("name2",F),`
|
|
819
|
+
`,{},...Mr("name3",F)],["!",Fn(I,B,"name2")],["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name2"],["get","name2"]],gn(B),`
|
|
820
|
+
`,{},...Mr("name",F),`
|
|
821
|
+
`,{},...Mr("name3",F)],["format",["coalesce",["get",`${Y}name:${I}`],["get","pgf:name3"],["get","name3"]],gn(B),`
|
|
822
|
+
`,{},...Mr("name",F),`
|
|
823
|
+
`,{},...Mr("name2",F)]]]]}jn(mn,"get_multiline_name");var qy=[{lang:"ar",full_name:"Arabic",script:"Arabic"},{lang:"cs",full_name:"Czech",script:"Latin"},{lang:"bg",full_name:"Bulgarian",script:"Cyrillic"},{lang:"da",full_name:"Danish",script:"Latin"},{lang:"de",full_name:"German",script:"Latin"},{lang:"el",full_name:"Greek",script:"Greek"},{lang:"en",full_name:"English",script:"Latin"},{lang:"es",full_name:"Spanish",script:"Latin"},{lang:"et",full_name:"Estonian",script:"Latin"},{lang:"fa",full_name:"Persian",script:"Arabic"},{lang:"fi",full_name:"Finnish",script:"Latin"},{lang:"fr",full_name:"French",script:"Latin"},{lang:"ga",full_name:"Irish",script:"Latin"},{lang:"he",full_name:"Hebrew",script:"Hebrew"},{lang:"hi",full_name:"Hindi",script:"Devanagari"},{lang:"hr",full_name:"Croatian",script:"Latin"},{lang:"hu",full_name:"Hungarian",script:"Latin"},{lang:"id",full_name:"Indonesian",script:"Latin"},{lang:"it",full_name:"Italian",script:"Latin"},{lang:"ja",full_name:"Japanese",script:""},{lang:"ko",full_name:"Korean",script:"Hangul"},{lang:"lt",full_name:"Lithuanian",script:"Latin"},{lang:"lv",full_name:"Latvian",script:"Latin"},{lang:"ne",full_name:"Nepali",script:"Devanagari"},{lang:"nl",full_name:"Dutch",script:"Latin"},{lang:"no",full_name:"Norwegian",script:"Latin"},{lang:"mr",full_name:"Marathi",script:"Devanagari"},{lang:"mt",full_name:"Maltese",script:"Latin"},{lang:"pl",full_name:"Polish",script:"Latin"},{lang:"pt",full_name:"Portuguese",script:"Latin"},{lang:"ro",full_name:"Romanian",script:"Latin"},{lang:"ru",full_name:"Russian",script:"Cyrillic"},{lang:"sk",full_name:"Slovak",script:"Latin"},{lang:"sl",full_name:"Slovenian",script:"Latin"},{lang:"sv",full_name:"Swedish",script:"Latin"},{lang:"tr",full_name:"Turkish",script:"Latin"},{lang:"uk",full_name:"Ukrainian",script:"Cyrillic"},{lang:"ur",full_name:"Urdu",script:"Arabic"},{lang:"vi",full_name:"Vietnamese",script:"Latin"},{lang:"zh-Hans",full_name:"Chinese (Simplified)",script:"Han"},{lang:"zh-Hant",full_name:"Chinese (Traditional)",script:"Han"}];function xm(I,S){return[{id:"background",type:"background",paint:{"background-color":S.background}},{id:"earth",type:"fill",filter:["==","$type","Polygon"],source:I,"source-layer":"earth",paint:{"fill-color":S.earth}},...S.landcover?[{id:"landcover",type:"fill",source:I,"source-layer":"landcover",paint:{"fill-color":["match",["get","kind"],"grassland",S.landcover.grassland,"barren",S.landcover.barren,"urban_area",S.landcover.urban_area,"farmland",S.landcover.farmland,"glacier",S.landcover.glacier,"scrub",S.landcover.scrub,S.landcover.forest],"fill-opacity":["interpolate",["linear"],["zoom"],5,1,7,0]}}]:[],{id:"landuse_park",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course","wood","nature_reserve","forest","scrub","grassland","grass","military","naval_base","airfield"],paint:{"fill-opacity":["interpolate",["linear"],["zoom"],6,0,11,1],"fill-color":["case",["in",["get","kind"],["literal",["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"]]],S.park_b,["in",["get","kind"],["literal",["wood","nature_reserve","forest"]]],S.wood_b,["in",["get","kind"],["literal",["scrub","grassland","grass"]]],S.scrub_b,["in",["get","kind"],["literal",["glacier"]]],S.glacier,["in",["get","kind"],["literal",["sand"]]],S.sand,["in",["get","kind"],["literal",["military","naval_base","airfield"]]],S.zoo,S.earth]}},{id:"landuse_urban_green",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","allotments","village_green","playground"],paint:{"fill-color":S.park_b,"fill-opacity":.7}},{id:"landuse_hospital",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","hospital"],paint:{"fill-color":S.hospital}},{id:"landuse_industrial",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","industrial"],paint:{"fill-color":S.industrial}},{id:"landuse_school",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","school","university","college"],paint:{"fill-color":S.school}},{id:"landuse_beach",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","beach"],paint:{"fill-color":S.beach}},{id:"landuse_zoo",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","zoo"],paint:{"fill-color":S.zoo}},{id:"landuse_aerodrome",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","aerodrome"],paint:{"fill-color":S.aerodrome}},{id:"roads_runway",type:"line",source:I,"source-layer":"roads",filter:["==","kind_detail","runway"],paint:{"line-color":S.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],10,0,12,4,18,30]}},{id:"roads_taxiway",type:"line",source:I,"source-layer":"roads",minzoom:13,filter:["==","kind_detail","taxiway"],paint:{"line-color":S.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,15,6]}},{id:"landuse_runway",type:"fill",source:I,"source-layer":"landuse",filter:["any",["in","kind","runway","taxiway"]],paint:{"fill-color":S.runway}},{id:"water",type:"fill",filter:["==","$type","Polygon"],source:I,"source-layer":"water",paint:{"fill-color":S.water}},{id:"water_stream",type:"line",source:I,"source-layer":"water",minzoom:14,filter:["in","kind","stream"],paint:{"line-color":S.water,"line-width":.5}},{id:"water_river",type:"line",source:I,"source-layer":"water",minzoom:9,filter:["in","kind","river"],paint:{"line-color":S.water,"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1,18,12]}},{id:"landuse_pedestrian",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","pedestrian","dam"],paint:{"fill-color":S.pedestrian}},{id:"landuse_pier",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","pier"],paint:{"fill-color":S.pier}},{id:"roads_tunnels_other_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":S.tunnel_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":S.tunnel_minor_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_link_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":S.tunnel_link_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_major_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.tunnel_major_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_tunnels_highway_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.tunnel_highway_casing,"line-dasharray":[6,.5],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_tunnels_other",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":S.tunnel_other,"line-dasharray":[4.5,.5],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":S.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_tunnels_link",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":S.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_tunnels_major",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","major_road"]],paint:{"line-color":S.tunnel_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_tunnels_highway",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==",["get","kind"],"highway"],["!",["has","is_link"]]],paint:{"line-color":S.tunnel_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"buildings",type:"fill",source:I,"source-layer":"buildings",filter:["in","kind","building","building_part"],paint:{"fill-color":S.buildings,"fill-opacity":.5}},{id:"roads_pier",type:"line",source:I,"source-layer":"roads",filter:["==","kind_detail","pier"],paint:{"line-color":S.pier,"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,.5,20,16]}},{id:"roads_minor_service_casing",type:"line",source:I,"source-layer":"roads",minzoom:13,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":S.minor_service_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}},{id:"roads_minor_casing",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":S.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_link_casing",type:"line",source:I,"source-layer":"roads",minzoom:13,filter:["has","is_link"],paint:{"line-color":S.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1.5]}},{id:"roads_major_casing_late",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.major_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_highway_casing_late",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.highway_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_other",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["in","kind","other","path"],["!=","kind_detail","pier"]],paint:{"line-color":S.other,"line-dasharray":[3,1],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_link",type:"line",source:I,"source-layer":"roads",filter:["has","is_link"],paint:{"line-color":S.link,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_minor_service",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":S.minor_service,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8]}},{id:"roads_minor",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":["interpolate",["exponential",1.6],["zoom"],11,S.minor_a,16,S.minor_b],"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_major_casing_early",type:"line",source:I,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.major_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_major",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_highway_casing_early",type:"line",source:I,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.highway_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1]}},{id:"roads_highway",type:"line",source:I,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"roads_rail",type:"line",source:I,"source-layer":"roads",filter:["==","kind","rail"],paint:{"line-dasharray":[.3,.75],"line-opacity":.5,"line-color":S.railway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,.15,18,9]}},{id:"boundaries_country",type:"line",source:I,"source-layer":"boundaries",filter:["<=","kind_detail",2],paint:{"line-color":S.boundaries,"line-width":.7,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"boundaries",type:"line",source:I,"source-layer":"boundaries",filter:[">","kind_detail",2],paint:{"line-color":S.boundaries,"line-width":.4,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"roads_bridges_other_casing",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":S.bridges_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_link_casing",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":S.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1.5]}},{id:"roads_bridges_minor_casing",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":S.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}},{id:"roads_bridges_major_casing",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.bridges_major_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,10],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1.5]}},{id:"roads_bridges_other",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":S.bridges_other,"line-dasharray":[2,1],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_minor",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":S.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_bridges_link",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":S.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_bridges_major",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":S.bridges_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_bridges_highway_casing",type:"line",source:I,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.bridges_highway_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_bridges_highway",type:"line",source:I,"source-layer":"roads",filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":S.bridges_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}}]}jn(xm,"nolabels_layers");function bm(I,S,F,B){return[{id:"address_label",type:"symbol",source:I,"source-layer":"buildings",minzoom:18,filter:["==","kind","address"],layout:{"symbol-placement":"point","text-font":[S.italic||"Noto Sans Italic"],"text-field":["get","addr_housenumber"],"text-size":12},paint:{"text-color":S.address_label,"text-halo-color":S.address_label_halo,"text-halo-width":1}},{id:"water_waterway_label",type:"symbol",source:I,"source-layer":"water",minzoom:13,filter:["in","kind","river","stream"],layout:{"symbol-placement":"line","text-font":[S.italic||"Noto Sans Italic"],"text-field":mn(F,B,S.regular),"text-size":12,"text-letter-spacing":.2},paint:{"text-color":S.ocean_label,"text-halo-color":S.water,"text-halo-width":1}},{id:"roads_oneway",type:"symbol",source:I,"source-layer":"roads",minzoom:16,filter:["==",["get","oneway"],"yes"],layout:{"symbol-placement":"line","icon-image":"arrow","icon-rotate":90,"symbol-spacing":100}},{id:"roads_labels_minor",type:"symbol",source:I,"source-layer":"roads",minzoom:15,filter:["in","kind","minor_road","other","path"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[S.regular||"Noto Sans Regular"],"text-field":mn(F,B,S.regular),"text-size":12},paint:{"text-color":S.roads_label_minor,"text-halo-color":S.roads_label_minor_halo,"text-halo-width":1}},{id:"water_label_ocean",type:"symbol",source:I,"source-layer":"water",filter:["in","kind","sea","ocean","bay","strait","fjord"],layout:{"text-font":[S.italic||"Noto Sans Italic"],"text-field":mn(F,B,S.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,10,12],"text-letter-spacing":.1,"text-max-width":9,"text-transform":"uppercase"},paint:{"text-color":S.ocean_label,"text-halo-width":1,"text-halo-color":S.water}},{id:"earth_label_islands",type:"symbol",source:I,"source-layer":"earth",filter:["in","kind","island"],layout:{"text-font":[S.italic||"Noto Sans Italic"],"text-field":mn(F,B,S.regular),"text-size":10,"text-letter-spacing":.1,"text-max-width":8},paint:{"text-color":S.subplace_label,"text-halo-color":S.subplace_label_halo,"text-halo-width":1}},{id:"water_label_lakes",type:"symbol",source:I,"source-layer":"water",filter:["in","kind","lake","water"],layout:{"text-font":[S.italic||"Noto Sans Italic"],"text-field":mn(F,B,S.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,6,12,10,12],"text-letter-spacing":.1,"text-max-width":9},paint:{"text-color":S.ocean_label,"text-halo-color":S.water,"text-halo-width":1}},{id:"roads_shields",type:"symbol",source:I,"source-layer":"roads",filter:["all",["in",["get","kind"],["literal",["highway","major_road"]]],["has","shield_text"],["<=",["length",["get","shield_text"]],5]],layout:{"icon-image":["match",["get","network"],"US:I",["concat","US:I-",["length",["get","shield_text"]],"char"],"NL:S-road",["concat","NL:S-road-",["length",["get","shield_text"]],"char"],["concat","generic_shield-",["length",["get","shield_text"]],"char"]],"text-field":["get","shield_text"],"text-font":[S.bold||"Noto Sans Medium"],"text-size":8,"icon-size":.8,"symbol-placement":"line","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport"},paint:{"text-color":S.roads_label_major}},{id:"roads_labels_major",type:"symbol",source:I,"source-layer":"roads",minzoom:11,filter:["in","kind","highway","major_road"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[S.regular||"Noto Sans Regular"],"text-field":mn(F,B,S.regular),"text-size":12},paint:{"text-color":S.roads_label_major,"text-halo-color":S.roads_label_major_halo,"text-halo-width":1}},...S.pois?[{id:"pois",type:"symbol",source:I,"source-layer":"pois",filter:["all",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench","aerodrome","station","bus_stop","ferry_terminal","stadium","university","library","school","animal","toilets","drinking_water","post_office","building","townhall","restaurant","fast_food","cafe","bar","supermarket","convenience","books","beauty","electronics","clothes","attraction","museum","theatre","artwork"]]],[">=",["zoom"],["+",["get","min_zoom"],0]]],layout:{"icon-image":["match",["get","kind"],"station","train_station",["get","kind"]],"text-font":[S.regular||"Noto Sans Regular"],"text-justify":"auto","text-field":mn(F,B,S.regular),"text-size":["interpolate",["linear"],["zoom"],17,10,19,16],"text-max-width":8,"text-offset":[1.1,0],"text-variable-anchor":["left","right"]},paint:{"text-color":["case",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench"]]],S.pois.green,["in",["get","kind"],["literal",["aerodrome","station","bus_stop","ferry_terminal"]]],S.pois.lapis,["in",["get","kind"],["literal",["stadium","university","library","school","animal","toilets","drinking_water","post_office","building","townhall"]]],S.pois.slategray,["in",["get","kind"],["literal",["supermarket","convenience","books","beauty","electronics","clothes"]]],S.pois.blue,["in",["get","kind"],["literal",["restaurant","fast_food","cafe","bar"]]],S.pois.tangerine,["in",["get","kind"],["literal",["attraction","museum","theatre","artwork"]]],S.pois.pink,S.earth],"text-halo-color":S.earth,"text-halo-width":1}}]:[],{id:"places_subplace",type:"symbol",source:I,"source-layer":"places",filter:["in","kind","neighbourhood","macrohood"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":mn(F,B,S.regular),"text-font":[S.regular||"Noto Sans Regular"],"text-max-width":7,"text-letter-spacing":.1,"text-padding":["interpolate",["linear"],["zoom"],5,2,8,4,12,18,15,20],"text-size":["interpolate",["exponential",1.2],["zoom"],11,8,14,14,18,24],"text-transform":"uppercase"},paint:{"text-color":S.subplace_label,"text-halo-color":S.subplace_label_halo,"text-halo-width":1}},{id:"places_region",type:"symbol",source:I,"source-layer":"places",filter:["==","kind","region"],layout:{"symbol-sort-key":["get","sort_key"],"text-field":["step",["zoom"],["coalesce",["get","ref:en"],["get","ref"]],6,mn(F,B,S.regular)],"text-font":[S.regular||"Noto Sans Regular"],"text-size":["interpolate",["linear"],["zoom"],3,11,7,16],"text-radial-offset":.2,"text-anchor":"center","text-transform":"uppercase"},paint:{"text-color":S.state_label,"text-halo-color":S.state_label_halo,"text-halo-width":1}},{id:"places_locality",type:"symbol",source:I,"source-layer":"places",filter:["==","kind","locality"],layout:{"icon-image":["step",["zoom"],["case",["==",["get","capital"],"yes"],"capital","townspot"],8,""],"icon-size":.7,"text-field":mn(F,B,S.regular),"text-font":["case",["<=",["get","min_zoom"],5],["literal",[S.bold||"Noto Sans Medium"]],["literal",[S.regular||"Noto Sans Regular"]]],"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-padding":["interpolate",["linear"],["zoom"],5,3,8,7,12,11],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],13],8,[">=",["get","population_rank"],13],13,0],4,["case",["<",["get","population_rank"],13],10,[">=",["get","population_rank"],13],15,0],6,["case",["<",["get","population_rank"],12],11,[">=",["get","population_rank"],12],17,0],8,["case",["<",["get","population_rank"],11],11,[">=",["get","population_rank"],11],18,0],10,["case",["<",["get","population_rank"],9],12,[">=",["get","population_rank"],9],20,0],15,["case",["<",["get","population_rank"],8],12,[">=",["get","population_rank"],8],22,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,0,8,4,10,8,12,6,22,2],"text-justify":"auto","text-variable-anchor":["step",["zoom"],["literal",["bottom","left","right","top"]],8,["literal",["center"]]],"text-radial-offset":.3},paint:{"text-color":S.city_label,"text-halo-color":S.city_label_halo,"text-halo-width":1}},{id:"places_country",type:"symbol",source:I,"source-layer":"places",filter:["==","kind","country"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":vm(F,B),"text-font":[S.bold||"Noto Sans Medium"],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],10],8,[">=",["get","population_rank"],10],12,0],6,["case",["<",["get","population_rank"],8],10,[">=",["get","population_rank"],8],18,0],8,["case",["<",["get","population_rank"],7],11,[">=",["get","population_rank"],7],20,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,2,14,2,16,20,17,2,22,2],"text-transform":"uppercase"},paint:{"text-color":S.country_label,"text-halo-color":S.earth,"text-halo-width":1}}]}jn(bm,"labels_layers");var Zy={background:"#cccccc",earth:"#e2dfda",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_casing:"#e0e0e0",link_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#728dd4",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3",address_label:"#91888b",address_label_halo:"#ffffff",pois:{blue:"#1A8CBD",green:"#20834D",lapis:"#315BCF",pink:"#EF56BA",red:"#F2567A",slategray:"#6A5B8F",tangerine:"#CB6704",turquoise:"#00C3D4"},landcover:{grassland:"rgba(210, 239, 207, 1)",barren:"rgba(255, 243, 215, 1)",urban_area:"rgba(230, 230, 230, 1)",farmland:"rgba(216, 239, 210, 1)",glacier:"rgba(255, 255, 255, 1)",scrub:"rgba(234, 239, 210, 1)",forest:"rgba(196, 231, 210, 1)"}},Wy={background:"#34373d",earth:"#1f1f1f",park_a:"#1c2421",park_b:"#192a24",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#31353f",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c",address_label:"#525252",address_label_halo:"#1f1f1f",pois:{blue:"#4299BB",green:"#30C573",lapis:"#2B5CEA",pink:"#EF56BA",red:"#F2567A",slategray:"#93939F",tangerine:"#F19B6E",turquoise:"#00C3D4"},landcover:{grassland:"rgba(30, 41, 31, 1)",barren:"rgba(38, 38, 36, 1)",urban_area:"rgba(28, 28, 28, 1)",farmland:"rgba(31, 36, 32, 1)",glacier:"rgba(43, 43, 43, 1)",scrub:"rgba(34, 36, 30, 1)",forest:"rgba(28, 41, 37, 1)"}},Hy={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boundaries:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8",address_label:"#adadad",address_label_halo:"#ffffff"},Xy={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585",address_label:"#999999",address_label_halo:"#e0e0e0"},Yy={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070",address_label:"#525252",address_label_halo:"#141414"};function wm(I){switch(I){case"light":return Zy;case"dark":return Wy;case"white":return Hy;case"grayscale":return Xy;case"black":return Yy}throw new Error("Flavor not found")}jn(wm,"namedFlavor");function Tm(I,S,F){let B=[];return F!=null&&F.labelsOnly||(B=xm(I,S)),F!=null&&F.lang&&(B=B.concat(bm(I,S,F.lang))),B}jn(Tm,"layers");var Gr=Uint8Array,rl=Uint16Array,Ky=Int32Array,Sm=new Gr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pm=new Gr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Jy=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mm=function(I,S){for(var F=new rl(31),B=0;B<31;++B)F[B]=S+=1<<I[B-1];for(var Y=new Ky(F[30]),B=1;B<30;++B)for(var le=F[B];le<F[B+1];++le)Y[le]=le-F[B]<<5|B;return{b:F,r:Y}},Im=Mm(Sm,2),Em=Im.b,Qy=Im.r;Em[28]=258,Qy[258]=28;var ev=Mm(Pm,0),tv=ev.b,jd=new rl(32768);for(var ei=0;ei<32768;++ei){var Hs=(ei&43690)>>1|(ei&21845)<<1;Hs=(Hs&52428)>>2|(Hs&13107)<<2,Hs=(Hs&61680)>>4|(Hs&3855)<<4,jd[ei]=((Hs&65280)>>8|(Hs&255)<<8)>>1}var wc=(function(I,S,F){for(var B=I.length,Y=0,le=new rl(S);Y<B;++Y)I[Y]&&++le[I[Y]-1];var M=new rl(S);for(Y=1;Y<S;++Y)M[Y]=M[Y-1]+le[Y-1]<<1;var l;if(F){l=new rl(1<<S);var _e=15-S;for(Y=0;Y<B;++Y)if(I[Y])for(var Oe=Y<<4|I[Y],qe=S-I[Y],De=M[I[Y]-1]++<<qe,Re=De|(1<<qe)-1;De<=Re;++De)l[jd[De]>>_e]=Oe}else for(l=new rl(B),Y=0;Y<B;++Y)I[Y]&&(l[Y]=jd[M[I[Y]-1]++]>>15-I[Y]);return l}),Tc=new Gr(288);for(var ei=0;ei<144;++ei)Tc[ei]=8;for(var ei=144;ei<256;++ei)Tc[ei]=9;for(var ei=256;ei<280;++ei)Tc[ei]=7;for(var ei=280;ei<288;++ei)Tc[ei]=8;var Cm=new Gr(32);for(var ei=0;ei<32;++ei)Cm[ei]=5;var iv=wc(Tc,9,1),rv=wc(Cm,5,1),Ld=function(I){for(var S=I[0],F=1;F<I.length;++F)I[F]>S&&(S=I[F]);return S},fn=function(I,S,F){var B=S/8|0;return(I[B]|I[B+1]<<8)>>(S&7)&F},Fd=function(I,S){var F=S/8|0;return(I[F]|I[F+1]<<8|I[F+2]<<16)>>(S&7)},nv=function(I){return(I+7)/8|0},sv=function(I,S,F){return(F==null||F>I.length)&&(F=I.length),new Gr(I.subarray(S,F))},av=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ur=function(I,S,F){var B=new Error(S||av[I]);if(B.code=I,Error.captureStackTrace&&Error.captureStackTrace(B,Ur),!F)throw B;return B},$d=function(I,S,F,B){var Y=I.length,le=0;if(!Y||S.f&&!S.l)return F||new Gr(0);var M=!F,l=M||S.i!=2,_e=S.i;M&&(F=new Gr(Y*3));var Oe=function(yn){var Ji=F.length;if(yn>Ji){var vn=new Gr(Math.max(Ji*2,yn));vn.set(F),F=vn}},qe=S.f||0,De=S.p||0,Re=S.b||0,Ze=S.l,yt=S.d,Xe=S.m,de=S.n,vt=Y*8;do{if(!Ze){qe=fn(I,De,1);var rt=fn(I,De+1,3);if(De+=3,rt)if(rt==1)Ze=iv,yt=rv,Xe=9,de=5;else if(rt==2){var rn=fn(I,De,31)+257,Ii=fn(I,De+10,15)+4,nn=rn+fn(I,De+5,31)+1;De+=14;for(var Ki=new Gr(nn),ar=new Gr(19),ci=0;ci<Ii;++ci)ar[Jy[ci]]=fn(I,De+ci*3,7);De+=Ii*3;for(var or=Ld(ar),gr=(1<<or)-1,Vn=wc(ar,or,1),ci=0;ci<nn;){var $r=Vn[fn(I,De,gr)];De+=$r&15;var Je=$r>>4;if(Je<16)Ki[ci++]=Je;else{var Ir=0,_i=0;for(Je==16?(_i=3+fn(I,De,3),De+=2,Ir=Ki[ci-1]):Je==17?(_i=3+fn(I,De,7),De+=3):Je==18&&(_i=11+fn(I,De,127),De+=7);_i--;)Ki[ci++]=Ir}}var qr=Ki.subarray(0,rn),ht=Ki.subarray(rn);Xe=Ld(qr),de=Ld(ht),Ze=wc(qr,Xe,1),yt=wc(ht,de,1)}else Ur(1);else{var Je=nv(De)+4,ki=I[Je-4]|I[Je-3]<<8,Di=Je+ki;if(Di>Y){_e&&Ur(0);break}l&&Oe(Re+ki),F.set(I.subarray(Je,Di),Re),S.b=Re+=ki,S.p=De=Di*8,S.f=qe;continue}if(De>vt){_e&&Ur(0);break}}l&&Oe(Re+131072);for(var _n=(1<<Xe)-1,Er=(1<<de)-1,Zr=De;;Zr=De){var Ir=Ze[Fd(I,De)&_n],_r=Ir>>4;if(De+=Ir&15,De>vt){_e&&Ur(0);break}if(Ir||Ur(2),_r<256)F[Re++]=_r;else if(_r==256){Zr=De,Ze=null;break}else{var Wr=_r-254;if(_r>264){var ci=_r-257,ti=Sm[ci];Wr=fn(I,De,(1<<ti)-1)+Em[ci],De+=ti}var Ni=yt[Fd(I,De)&Er],lr=Ni>>4;Ni||Ur(3),De+=Ni&15;var ht=tv[lr];if(lr>3){var ti=Pm[lr];ht+=Fd(I,De)&(1<<ti)-1,De+=ti}if(De>vt){_e&&Ur(0);break}l&&Oe(Re+131072);var yi=Re+Wr;if(Re<ht){var Hr=le-ht,cr=Math.min(ht,yi);for(Hr+Re<0&&Ur(3);Re<cr;++Re)F[Re]=B[Hr+Re]}for(;Re<yi;++Re)F[Re]=F[Re-ht]}}S.l=Ze,S.p=Zr,S.b=Re,S.f=qe,Ze&&(qe=1,S.m=Xe,S.d=yt,S.n=de)}while(!qe);return Re!=F.length&&M?sv(F,0,Re):F.subarray(0,Re)},ov=new Gr(0),lv=function(I){(I[0]!=31||I[1]!=139||I[2]!=8)&&Ur(6,"invalid gzip data");var S=I[3],F=10;S&4&&(F+=(I[10]|I[11]<<8)+2);for(var B=(S>>3&1)+(S>>4&1);B>0;B-=!I[F++]);return F+(S&2)},cv=function(I){var S=I.length;return(I[S-4]|I[S-3]<<8|I[S-2]<<16|I[S-1]<<24)>>>0},uv=function(I,S){return((I[0]&15)!=8||I[0]>>4>7||(I[0]<<8|I[1])%31)&&Ur(6,"invalid zlib data"),(I[1]>>5&1)==1&&Ur(6,"invalid zlib data: "+(I[1]&32?"need":"unexpected")+" dictionary"),(I[1]>>3&4)+2};function hv(I,S){return $d(I,{i:2},S,S)}function dv(I,S){var F=lv(I);return F+8>I.length&&Ur(6,"invalid gzip data"),$d(I.subarray(F,-8),{i:2},new Gr(cv(I)),S)}function pv(I,S){return $d(I.subarray(uv(I),-4),{i:2},S,S)}function fv(I,S){return I[0]==31&&I[1]==139&&I[2]==8?dv(I,S):(I[0]&15)!=8||I[0]>>4>7||(I[0]<<8|I[1])%31?hv(I,S):pv(I,S)}var mv=typeof TextDecoder<"u"&&new TextDecoder,gv=0;try{mv.decode(ov,{stream:!0}),gv=1}catch{}var _v=Object.defineProperty,yv=Math.pow,Ot=(I,S)=>_v(I,"name",{value:S,configurable:!0}),Vi=(I,S,F)=>new Promise((B,Y)=>{var le=_e=>{try{l(F.next(_e))}catch(Oe){Y(Oe)}},M=_e=>{try{l(F.throw(_e))}catch(Oe){Y(Oe)}},l=_e=>_e.done?B(_e.value):Promise.resolve(_e.value).then(le,M);l((F=F.apply(I,S)).next())});Ot((I,S)=>{let F=!1,B="",Y=L.GridLayer.extend({createTile:Ot((le,M)=>{let l=document.createElement("img"),_e=new AbortController,Oe=_e.signal;return l.cancel=()=>{_e.abort()},F||(I.getHeader().then(qe=>{qe.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):qe.tileType===2?B="image/png":qe.tileType===3?B="image/jpeg":qe.tileType===4?B="image/webp":qe.tileType===5&&(B="image/avif")}),F=!0),I.getZxy(le.z,le.x,le.y,Oe).then(qe=>{if(qe){let De=new Blob([qe.data],{type:B}),Re=window.URL.createObjectURL(De);l.src=Re}else l.style.display="none";l.cancel=void 0,M(void 0,l)}).catch(qe=>{if(qe.name!=="AbortError")throw qe}),l},"createTile"),_removeTile:Ot(function(le){let M=this._tiles[le];M&&(M.el.cancel&&M.el.cancel(),M.el.width=0,M.el.height=0,M.el.deleted=!0,L.DomUtil.remove(M.el),delete this._tiles[le],this.fire("tileunload",{tile:M.el,coords:this._keyToTileCoords(le)}))},"_removeTile")});return new Y(S)},"leafletRasterLayer");var vv=Ot(I=>(S,F)=>{if(F instanceof AbortController)return I(S,F);let B=new AbortController;return I(S,B).then(Y=>F(void 0,Y.data,Y.cacheControl||"",Y.expires||""),Y=>F(Y)).catch(Y=>F(Y)),{cancel:Ot(()=>B.abort(),"cancel")}},"v3compat"),Am=class{constructor(S){this.tilev4=Ot((F,B)=>Vi(this,null,function*(){if(F.type==="json"){let Ze=F.url.substr(10),yt=this.tiles.get(Ze);if(yt||(yt=new um(Ze),this.tiles.set(Ze,yt)),this.metadata){let de=yield yt.getTileJson(F.url);return B.signal.throwIfAborted(),{data:de}}let Xe=yield yt.getHeader();return B.signal.throwIfAborted(),(Xe.minLon>=Xe.maxLon||Xe.minLat>=Xe.maxLat)&&console.error(`Bounds of PMTiles archive ${Xe.minLon},${Xe.minLat},${Xe.maxLon},${Xe.maxLat} are not valid.`),{data:{tiles:[`${F.url}/{z}/{x}/{y}`],minzoom:Xe.minZoom,maxzoom:Xe.maxZoom,bounds:[Xe.minLon,Xe.minLat,Xe.maxLon,Xe.maxLat]}}}let Y=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),le=F.url.match(Y);if(!le)throw new Error("Invalid PMTiles protocol URL");let M=le[1],l=this.tiles.get(M);l||(l=new um(M),this.tiles.set(M,l));let _e=le[2],Oe=le[3],qe=le[4],De=yield l.getHeader(),Re=yield l?.getZxy(+_e,+Oe,+qe,B.signal);if(B.signal.throwIfAborted(),Re)return{data:new Uint8Array(Re.data),cacheControl:Re.cacheControl,expires:Re.expires};if(De.tileType===1){if(this.errorOnMissingTile)throw new Error("Tile not found.");return{data:new Uint8Array}}return{data:null}}),"tilev4"),this.tile=vv(this.tilev4),this.tiles=new Map,this.metadata=S?.metadata||!1,this.errorOnMissingTile=S?.errorOnMissingTile||!1}add(S){this.tiles.set(S.source.getKey(),S)}get(S){return this.tiles.get(S)}};Ot(Am,"Protocol");var xv=Am;function zm(I,S){return(S>>>0)*4294967296+(I>>>0)}Ot(zm,"toNum");function km(I,S){let F=S.buf,B=F[S.pos++],Y=(B&112)>>4;if(B<128||(B=F[S.pos++],Y|=(B&127)<<3,B<128)||(B=F[S.pos++],Y|=(B&127)<<10,B<128)||(B=F[S.pos++],Y|=(B&127)<<17,B<128)||(B=F[S.pos++],Y|=(B&127)<<24,B<128)||(B=F[S.pos++],Y|=(B&1)<<31,B<128))return zm(I,Y);throw new Error("Expected varint not more than 10 bytes")}Ot(km,"readVarintRemainder");function il(I){let S=I.buf,F=S[I.pos++],B=F&127;return F<128||(F=S[I.pos++],B|=(F&127)<<7,F<128)||(F=S[I.pos++],B|=(F&127)<<14,F<128)||(F=S[I.pos++],B|=(F&127)<<21,F<128)?B:(F=S[I.pos],B|=(F&15)<<28,km(B,I))}Ot(il,"readVarint");function qd(I,S,F,B,Y){return Y===0?B!==0?[I-1-F,I-1-S]:[F,S]:[S,F]}Ot(qd,"rotate");function Dm(I,S,F){if(I>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");if(S>=1<<I||F>=1<<I)throw new Error("tile x/y outside zoom level bounds");let B=((1<<I)*(1<<I)-1)/3,Y=I-1,[le,M]=[S,F];for(let l=1<<Y;l>0;l>>=1){let _e=le&l,Oe=M&l;B+=(3*_e^Oe)*(1<<Y),[le,M]=qd(l,le,M,_e,Oe),Y--}return B}Ot(Dm,"zxyToTileId");function Rm(I){let S=3*I+1;return S<4294967296?31-Math.clz32(S):63-Math.clz32(S/4294967296)}Ot(Rm,"tileIdToZ");function bv(I){let S=Rm(I)>>1;if(S>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");let F=((1<<S)*(1<<S)-1)/3,B=I-F,Y=0,le=0,M=1<<S;for(let l=1;l<M;l<<=1){let _e=l&B/2,Oe=l&(B^_e);[Y,le]=qd(l,Y,le,_e,Oe),B=B/2,Y+=_e,le+=Oe}return[S,Y,le]}Ot(bv,"tileIdToZxy");var wv=(I=>(I[I.Unknown=0]="Unknown",I[I.None=1]="None",I[I.Gzip=2]="Gzip",I[I.Brotli=3]="Brotli",I[I.Zstd=4]="Zstd",I))(wv||{});function oh(I,S){return Vi(this,null,function*(){if(S===1||S===0)return I;if(S===2){if(typeof globalThis.DecompressionStream>"u")return fv(new Uint8Array(I));let F=new Response(I).body;if(!F)throw new Error("Failed to read response stream");let B=F.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(B).arrayBuffer()}throw new Error("Compression method not supported")})}Ot(oh,"defaultDecompress");var Tv=(I=>(I[I.Unknown=0]="Unknown",I[I.Mvt=1]="Mvt",I[I.Png=2]="Png",I[I.Jpeg=3]="Jpeg",I[I.Webp=4]="Webp",I[I.Avif=5]="Avif",I))(Tv||{});function Lm(I){return I===1?".mvt":I===2?".png":I===3?".jpg":I===4?".webp":I===5?".avif":""}Ot(Lm,"tileTypeExt");var Sv=127;function Fm(I,S){let F=0,B=I.length-1;for(;F<=B;){let Y=B+F>>1,le=S-I[Y].tileId;if(le>0)F=Y+1;else if(le<0)B=Y-1;else return I[Y]}return B>=0&&(I[B].runLength===0||S-I[B].tileId<I[B].runLength)?I[B]:null}Ot(Fm,"findTile");var Pv=class{constructor(S){this.file=S}getKey(){return this.file.name}getBytes(S,F){return Vi(this,null,function*(){return{data:yield this.file.slice(S,S+F).arrayBuffer()}})}};Ot(Pv,"FileSource");var Bm=class{constructor(S,F=new Headers){var B,Y;this.url=S,this.customHeaders=F,this.mustReload=!1;let le="";"navigator"in globalThis&&(le=(Y=(B=globalThis.navigator)==null?void 0:B.userAgent)!=null?Y:"");let M=le.indexOf("Windows")>-1,l=/Chrome|Chromium|Edg|OPR|Brave/.test(le);this.chromeWindowsNoCache=!1,M&&l&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(S){this.customHeaders=S}getBytes(S,F,B,Y){return Vi(this,null,function*(){let le,M;B?M=B:(le=new AbortController,M=le.signal);let l=new Headers(this.customHeaders);l.set("range",`bytes=${S}-${S+F-1}`);let _e;this.mustReload?_e="reload":this.chromeWindowsNoCache&&(_e="no-store");let Oe=yield fetch(this.url,{signal:M,cache:_e,headers:l});if(S===0&&Oe.status===416){let Re=Oe.headers.get("Content-Range");if(!Re||!Re.startsWith("bytes */"))throw new Error("Missing content-length on 416 response");let Ze=+Re.substr(8);Oe=yield fetch(this.url,{signal:M,cache:"reload",headers:{range:`bytes=0-${Ze-1}`}})}let qe=Oe.headers.get("Etag");if(qe!=null&&qe.startsWith("W/")&&(qe=null),Oe.status===416||Y&&qe&&qe!==Y)throw this.mustReload=!0,new Vd(`Server returned non-matching ETag ${Y} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(Oe.status>=300)throw new Error(`Bad response code: ${Oe.status}`);let De=Oe.headers.get("Content-Length");if(Oe.status===200&&(!De||+De>F))throw le&&le.abort(),new Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield Oe.arrayBuffer(),etag:qe||void 0,cacheControl:Oe.headers.get("Cache-Control")||void 0,expires:Oe.headers.get("Expires")||void 0}})}};Ot(Bm,"FetchSource");var Mv=Bm;function tn(I,S){let F=I.getUint32(S+4,!0),B=I.getUint32(S+0,!0);return F*yv(2,32)+B}Ot(tn,"getUint64");function Om(I,S){let F=new DataView(I),B=F.getUint8(7);if(B>3)throw new Error(`Archive is spec version ${B} but this library supports up to spec version 3`);return{specVersion:B,rootDirectoryOffset:tn(F,8),rootDirectoryLength:tn(F,16),jsonMetadataOffset:tn(F,24),jsonMetadataLength:tn(F,32),leafDirectoryOffset:tn(F,40),leafDirectoryLength:tn(F,48),tileDataOffset:tn(F,56),tileDataLength:tn(F,64),numAddressedTiles:tn(F,72),numTileEntries:tn(F,80),numTileContents:tn(F,88),clustered:F.getUint8(96)===1,internalCompression:F.getUint8(97),tileCompression:F.getUint8(98),tileType:F.getUint8(99),minZoom:F.getUint8(100),maxZoom:F.getUint8(101),minLon:F.getInt32(102,!0)/1e7,minLat:F.getInt32(106,!0)/1e7,maxLon:F.getInt32(110,!0)/1e7,maxLat:F.getInt32(114,!0)/1e7,centerZoom:F.getUint8(118),centerLon:F.getInt32(119,!0)/1e7,centerLat:F.getInt32(123,!0)/1e7,etag:S}}Ot(Om,"bytesToHeader");function Zd(I){let S={buf:new Uint8Array(I),pos:0},F=il(S),B=[],Y=0;for(let le=0;le<F;le++){let M=il(S);B.push({tileId:Y+M,offset:0,length:0,runLength:1}),Y+=M}for(let le=0;le<F;le++)B[le].runLength=il(S);for(let le=0;le<F;le++)B[le].length=il(S);for(let le=0;le<F;le++){let M=il(S);M===0&&le>0?B[le].offset=B[le-1].offset+B[le-1].length:B[le].offset=M-1}return B}Ot(Zd,"deserializeIndex");var jm=class extends Error{};Ot(jm,"EtagMismatch");var Vd=jm;function Wd(I,S){return Vi(this,null,function*(){let F=yield I.getBytes(0,16384);if(new DataView(F.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");let B=F.data.slice(0,Sv),Y=Om(B,F.etag),le=F.data.slice(Y.rootDirectoryOffset,Y.rootDirectoryOffset+Y.rootDirectoryLength),M=`${I.getKey()}|${Y.etag||""}|${Y.rootDirectoryOffset}|${Y.rootDirectoryLength}`,l=Zd(yield S(le,Y.internalCompression));return[Y,[M,l.length,l]]})}Ot(Wd,"getHeaderAndRoot");function Hd(I,S,F,B,Y){return Vi(this,null,function*(){let le=yield I.getBytes(F,B,void 0,Y.etag),M=yield S(le.data,Y.internalCompression),l=Zd(M);if(l.length===0)throw new Error("Empty directory is invalid");return l})}Ot(Hd,"getDirectory");var Iv=class{constructor(S=100,F=!0,B=oh){this.cache=new Map,this.maxCacheEntries=S,this.counter=1,this.decompress=B}getHeader(S){return Vi(this,null,function*(){let F=S.getKey(),B=this.cache.get(F);if(B)return B.lastUsed=this.counter++,B.data;let Y=yield Wd(S,this.decompress);return Y[1]&&this.cache.set(Y[1][0],{lastUsed:this.counter++,data:Y[1][2]}),this.cache.set(F,{lastUsed:this.counter++,data:Y[0]}),this.prune(),Y[0]})}getDirectory(S,F,B,Y){return Vi(this,null,function*(){let le=`${S.getKey()}|${Y.etag||""}|${F}|${B}`,M=this.cache.get(le);if(M)return M.lastUsed=this.counter++,M.data;let l=yield Hd(S,this.decompress,F,B,Y);return this.cache.set(le,{lastUsed:this.counter++,data:l}),this.prune(),l})}prune(){if(this.cache.size>this.maxCacheEntries){let S=1/0,F;this.cache.forEach((B,Y)=>{B.lastUsed<S&&(S=B.lastUsed,F=Y)}),F&&this.cache.delete(F)}}invalidate(S){return Vi(this,null,function*(){this.cache.delete(S.getKey())})}};Ot(Iv,"ResolvedValueCache");var Vm=class{constructor(S=100,F=!0,B=oh){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=S,this.counter=1,this.decompress=B}getHeader(S){return Vi(this,null,function*(){let F=S.getKey(),B=this.cache.get(F);if(B)return B.lastUsed=this.counter++,yield B.data;let Y=new Promise((le,M)=>{Wd(S,this.decompress).then(l=>{l[1]&&this.cache.set(l[1][0],{lastUsed:this.counter++,data:Promise.resolve(l[1][2])}),le(l[0]),this.prune()}).catch(l=>{M(l)})});return this.cache.set(F,{lastUsed:this.counter++,data:Y}),Y})}getDirectory(S,F,B,Y){return Vi(this,null,function*(){let le=`${S.getKey()}|${Y.etag||""}|${F}|${B}`,M=this.cache.get(le);if(M)return M.lastUsed=this.counter++,yield M.data;let l=new Promise((_e,Oe)=>{Hd(S,this.decompress,F,B,Y).then(qe=>{_e(qe),this.prune()}).catch(qe=>{Oe(qe)})});return this.cache.set(le,{lastUsed:this.counter++,data:l}),l})}prune(){if(this.cache.size>=this.maxCacheEntries){let S=1/0,F;this.cache.forEach((B,Y)=>{B.lastUsed<S&&(S=B.lastUsed,F=Y)}),F&&this.cache.delete(F)}}invalidate(S){return Vi(this,null,function*(){let F=S.getKey();if(this.invalidations.get(F))return yield this.invalidations.get(F);this.cache.delete(S.getKey());let B=new Promise((Y,le)=>{this.getHeader(S).then(M=>{Y(),this.invalidations.delete(F)}).catch(M=>{le(M)})});this.invalidations.set(F,B)})}};Ot(Vm,"SharedPromiseCache");var Ev=Vm,Nm=class{constructor(S,F,B){typeof S=="string"?this.source=new Mv(S):this.source=S,B?this.decompress=B:this.decompress=oh,F?this.cache=F:this.cache=new Ev}getHeader(){return Vi(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(S,F,B,Y){return Vi(this,null,function*(){let le=Dm(S,F,B),M=yield this.cache.getHeader(this.source);if(S<M.minZoom||S>M.maxZoom)return;let l=M.rootDirectoryOffset,_e=M.rootDirectoryLength;for(let Oe=0;Oe<=3;Oe++){let qe=yield this.cache.getDirectory(this.source,l,_e,M),De=Fm(qe,le);if(De){if(De.runLength>0){let Re=yield this.source.getBytes(M.tileDataOffset+De.offset,De.length,Y,M.etag);return{data:yield this.decompress(Re.data,M.tileCompression),cacheControl:Re.cacheControl,expires:Re.expires}}l=M.leafDirectoryOffset+De.offset,_e=De.length}else return}throw new Error("Maximum directory depth exceeded")})}getZxy(S,F,B,Y){return Vi(this,null,function*(){try{return yield this.getZxyAttempt(S,F,B,Y)}catch(le){if(le instanceof Vd)return this.cache.invalidate(this.source),yield this.getZxyAttempt(S,F,B,Y);throw le}})}getMetadataAttempt(){return Vi(this,null,function*(){let S=yield this.cache.getHeader(this.source),F=yield this.source.getBytes(S.jsonMetadataOffset,S.jsonMetadataLength,void 0,S.etag),B=yield this.decompress(F.data,S.internalCompression),Y=new TextDecoder("utf-8");return JSON.parse(Y.decode(B))})}getMetadata(){return Vi(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(S){if(S instanceof Vd)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw S}})}getTileJson(S){return Vi(this,null,function*(){let F=yield this.getHeader(),B=yield this.getMetadata(),Y=Lm(F.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${S}/{z}/{x}/{y}${Y}`],vector_layers:B.vector_layers,attribution:B.attribution,description:B.description,name:B.name,version:B.version,bounds:[F.minLon,F.minLat,F.maxLon,F.maxLat],center:[F.centerLon,F.centerLat,F.centerZoom],minzoom:F.minZoom,maxzoom:F.maxZoom}})}};Ot(Nm,"PMTiles");var um=Nm;const Cv={class:"search-box"},Av={key:0,class:"results-list"},zv=["onClick","onMouseenter"],kv=hm({__name:"CommandPalette",setup(I){const S=py("tangramApi"),F=Yi(""),B=Yi([]),Y=Yi(0),le=Yi(!1),M=Yi(null);let l=null,_e=null;const Oe=Nd(()=>{const vt=[],rt=(Je,ki)=>{for(const Di of Je)vt.push({...Di,depth:ki}),Di.children&&rt(Di.children,ki+1)};return rt(B.value,0),vt}),qe=()=>{le.value=!1,B.value=[]},De=vt=>{Oe.value.length!==0&&(Y.value=(Y.value+vt+Oe.value.length)%Oe.value.length)},Re=vt=>{vt.onSelect&&(vt.onSelect(),qe(),F.value="")},Ze=()=>{Oe.value.length>0&&Re(Oe.value[Y.value])},yt=()=>{S&&(l&&l.abort(),l=new AbortController,B.value=[],!(!F.value.trim()||F.value.length<2)&&(le.value=!0,S.search.search(F.value,l.signal,vt=>{B.value=[...B.value,...vt].sort((rt,Je)=>(Je.score||0)-(rt.score||0)),Y.value=0})))};nl(F,()=>{_e&&clearTimeout(_e),_e=setTimeout(yt,150)});const Xe=vt=>{vt.key==="p"&&(vt.ctrlKey||vt.metaKey)&&(vt.preventDefault(),M.value?.focus()),vt.key==="Escape"&&(M.value?.blur(),qe())},de=()=>qe();return dm(()=>{window.addEventListener("keydown",Xe),window.addEventListener("click",de)}),pm(()=>{window.removeEventListener("keydown",Xe),window.removeEventListener("click",de)}),(vt,rt)=>(fi(),ji("div",{class:"palette-widget",onClick:rt[4]||(rt[4]=kd(()=>{},["stop"]))},[sr("div",Cv,[fm(sr("input",{ref_key:"inputRef",ref:M,"onUpdate:modelValue":rt[0]||(rt[0]=Je=>F.value=Je),type:"text",placeholder:"Search (Ctrl+P)...",class:"search-input",onKeydown:[rt[1]||(rt[1]=Dd(kd(Je=>De(1),["prevent"]),["down"])),rt[2]||(rt[2]=Dd(kd(Je=>De(-1),["prevent"]),["up"])),Dd(Ze,["enter"])],onFocus:rt[3]||(rt[3]=Je=>le.value=!0)},null,544),[[fy,F.value]])]),le.value&&Oe.value.length?(fi(),ji("ul",Av,[(fi(!0),ji(th,null,ih(Oe.value,(Je,ki)=>(fi(),ji("li",{key:Je.id,class:gm(["result-item",{selected:ki===Y.value,"is-child":Je.depth>0}]),style:mm({paddingLeft:`${Je.depth*16+12}px`}),onClick:Di=>Re(Je),onMouseenter:Di=>Y.value=ki},[(fi(),rh(nh(Je.component),my({ref_for:!0},Je.props,{query:F.value}),null,16,["query"]))],46,zv))),128))])):qa("",!0)]))}}),Dv=(I,S)=>{const F=I.__vccOpts||I;for(const[B,Y]of S)F[B]=Y;return F},Rv=Dv(kv,[["__scopeId","data-v-d9634238"]]),Lv={key:0,class:"loading-container"},Fv={key:0,class:"loading-detail"},Bv={key:1},Ov={key:2,class:"main-container"},jv={class:"navbar",role:"navigation"},Vv={key:0,class:"sidebar-container"},Nv=["onClick"],Uv={class:"sidebar-body"},Gv={key:1,class:"map-controls"},$v=hm({__name:"App",setup(I){const S=gy().appContext.app,F=Yi("loading"),B=Yi(""),Y=Yi(null),le=Yi(null);let M;const l=Nd(()=>{if(!Y.value)return[];const De=Y.value.state.activeEntities,Re=new Set;if(De)for(const Ze of De.values())Re.add(Ze.type);return Y.value.ui.widgets.SideBar.filter(Ze=>Ze.relevantFor?(Array.isArray(Ze.relevantFor)?Ze.relevantFor:[Ze.relevantFor]).some(Xe=>Re.has(Xe)):!0)}),_e=De=>{De.isCollapsed=!De.isCollapsed};nl(()=>Y.value?.state.activeEntities.value,De=>{if(!Y.value||!De)return;const Re=new Set;for(const Ze of De.values())Re.add(Ze.type);for(const Ze of Y.value.ui.widgets.SideBar)Ze.relevantFor&&(Array.isArray(Ze.relevantFor)?Ze.relevantFor:[Ze.relevantFor]).some(Xe=>Re.has(Xe))&&(Ze.isCollapsed=!1)},{deep:!0}),dm(async()=>{try{const De=await Ud.create(S);S.provide("tangramApi",De),await Gy(De,Re=>{Re.stage==="manifest"?B.value="fetching plugin manifest":Re.stage==="plugin"&&Re.pluginName?B.value=`loading plugin: ${Re.pluginName}`:Re.stage==="done"&&(B.value="starting user interface")}),Y.value=De,F.value="ready"}catch(De){console.error("failed to initialise tangram api:",De),F.value="error"}}),nl(le,De=>{if(De&&Y.value&&!M){const Re=Y.value.config.map,Ze=new xv;if(cm.addProtocol("pmtiles",Ze.tile),typeof Re.style=="object"){const yt=de=>{if(Array.isArray(de))return de.map(yt);if(typeof de=="string"){if(de.includes("#ROOT#")){const vt=window.location.origin+window.location.pathname.replace(/\/[^\/]*$/,"/");return de.replace(/#ROOT#/g,vt)}return de}return de!==null&&typeof de=="object"?Object.entries(de).reduce((vt,[rt,Je])=>(Je!=null&&(vt[rt]=yt(Je)),vt),{}):de},Xe=yt(Re.style);Xe.layers||(Xe.layers=Tm("protomaps",wm("light"),{lang:Re.lang})),Re.style=Xe}M=new cm.Map({container:De,style:Re.style,center:[Re.center_lon,Re.center_lat],zoom:Re.zoom,pitch:Re.pitch,bearing:Re.bearing,attributionControl:!1,minZoom:Re.min_zoom,maxZoom:Re.max_zoom,maxPitch:Re.allow_pitch?Re.max_pitch:0,dragRotate:Re.allow_bearing,touchZoomRotate:Re.allow_bearing,pitchWithRotate:Re.allow_pitch}),Y.value.map.initialize(M)}});const Oe=()=>{Y.value?.map.getMapInstance().easeTo({bearing:0})},qe=()=>{Y.value?.map.getMapInstance().easeTo({pitch:0})};return pm(()=>{Y.value?.map.dispose(),M&&(M.remove(),M=void 0)}),(De,Re)=>F.value==="loading"?(fi(),ji("div",Lv,[Re[0]||(Re[0]=sr("div",null,"initialising tangram…",-1)),B.value?(fi(),ji("div",Fv,om(B.value),1)):qa("",!0)])):F.value==="error"?(fi(),ji("div",Bv," error: could not connect to the tangram backend. ")):F.value==="ready"&&Y.value?(fi(),ji("div",Ov,[sr("div",jv,[Re[1]||(Re[1]=sr("div",{class:"navbar-brand"},[sr("img",{src:Sy,alt:"tangram",class:"navbar-logo"}),sr("span",{class:"navbar-title"},"tangram")],-1)),Re[2]||(Re[2]=sr("div",{class:"navbar-spacer"},null,-1)),(fi(!0),ji(th,null,ih(Y.value.ui.widgets.TopBar,Ze=>(fi(),rh(nh(Ze.id),{key:Ze.id}))),128))]),sr("div",{ref_key:"mapContainer",ref:le,class:"map-container"},[_y(Rv),l.value.length>0?(fi(),ji("div",Vv,[(fi(!0),ji(th,null,ih(l.value,Ze=>(fi(),ji("div",{key:Ze.id,class:"sidebar-section"},[sr("div",{class:"sidebar-header",onClick:yt=>_e(Ze)},[(fi(),ji("svg",{class:gm(["caret",{open:!Ze.isCollapsed}]),viewBox:"0 0 24 24",width:"16",height:"16"},[...Re[3]||(Re[3]=[sr("path",{d:"M8 5v14l11-7z",fill:"currentColor"},null,-1)])],2)),yy(" "+om(Ze.title||Ze.id),1)],8,Nv),fm(sr("div",Uv,[(fi(),rh(nh(Ze.id)))],512),[[vy,!Ze.isCollapsed]])]))),128))])):qa("",!0),(fi(!0),ji(th,null,ih(Y.value.ui.widgets.MapOverlay,Ze=>(fi(),rh(nh(Ze.id),{key:Ze.id}))),128)),Y.value&&Y.value.map.isReady?(fi(),ji("div",Gv,[Y.value.config.map.allow_bearing&&Math.abs(Y.value.map.bearing)>.1?(fi(),ji("button",{key:0,class:"map-btn",title:"Reset Bearing (North)",onClick:Oe},[(fi(),ji("svg",{viewBox:"0 0 100 100",class:"compass-icon",style:mm({transform:`rotate(${-Y.value.map.bearing}deg)`})},[...Re[4]||(Re[4]=[sr("path",{d:"M50 15 L65 50 L50 50 Z",fill:"#e74c3c"},null,-1),sr("path",{d:"M50 15 L35 50 L50 50 Z",fill:"#c0392b"},null,-1),sr("path",{d:"M50 85 L65 50 L50 50 Z",fill:"#ecf0f1"},null,-1),sr("path",{d:"M50 85 L35 50 L50 50 Z",fill:"#bdc3c7"},null,-1)])],4))])):qa("",!0),Y.value.config.map.allow_pitch&&Y.value.map.pitch>.1?(fi(),ji("button",{key:1,class:"map-btn",title:"Reset Pitch (2D)",onClick:qe}," 2D ")):qa("",!0)])):qa("",!0)],512)])):qa("",!0)}});(async()=>(await wy("/rs1090_wasm_bg.wasm"),Ty(),xy($v).mount("#app")))();
|
|
824
|
+
//# sourceMappingURL=index-CcogpxdD.js.map
|