tangram-core 0.2.0__cp313-cp313-win_amd64.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 +335 -0
- tangram_core/__init__.py +5 -0
- tangram_core/__main__.py +141 -0
- tangram_core/_core.cp313-win_amd64.pyd +0 -0
- tangram_core/_core.pyi +38 -0
- tangram_core/api.ts +456 -0
- tangram_core/backend.py +335 -0
- tangram_core/colour.ts +71 -0
- tangram_core/config.py +122 -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-wyE8tIYR.js +11 -0
- tangram_core/dist-frontend/assets/array-utils-flat-wyE8tIYR.js.map +1 -0
- tangram_core/dist-frontend/assets/assert-hrfsarFU.js +3 -0
- tangram_core/dist-frontend/assets/assert-hrfsarFU.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-DTCP51Ak.js +26 -0
- tangram_core/dist-frontend/assets/clip-extension-DTCP51Ak.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-CzJ_uBWa.js +2 -0
- tangram_core/dist-frontend/assets/cube-geometry-CzJ_uBWa.js.map +1 -0
- tangram_core/dist-frontend/assets/deep-equal-uriyKJca.js +2 -0
- tangram_core/dist-frontend/assets/deep-equal-uriyKJca.js.map +1 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-DlKiy9_S.js +2 -0
- tangram_core/dist-frontend/assets/fly-to-interpolator-DlKiy9_S.js.map +1 -0
- tangram_core/dist-frontend/assets/geojson-layer-CLhXLxdI.js +1010 -0
- tangram_core/dist-frontend/assets/geojson-layer-CLhXLxdI.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-view-DKhftlA1.js +94 -0
- tangram_core/dist-frontend/assets/globe-view-DKhftlA1.js.map +1 -0
- tangram_core/dist-frontend/assets/globe-viewport-CPES4D4P.js +2 -0
- tangram_core/dist-frontend/assets/globe-viewport-CPES4D4P.js.map +1 -0
- tangram_core/dist-frontend/assets/image-loader-ClbNCMXW.js +2 -0
- tangram_core/dist-frontend/assets/image-loader-ClbNCMXW.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-UPPakSLR.css +1 -0
- tangram_core/dist-frontend/assets/index-r8T0kY2p.js +821 -0
- tangram_core/dist-frontend/assets/index-r8T0kY2p.js.map +1 -0
- tangram_core/dist-frontend/assets/layer-DO63TrsS.js +555 -0
- tangram_core/dist-frontend/assets/layer-DO63TrsS.js.map +1 -0
- tangram_core/dist-frontend/assets/layer-extension-CZ3zsHuN.js +2 -0
- tangram_core/dist-frontend/assets/layer-extension-CZ3zsHuN.js.map +1 -0
- tangram_core/dist-frontend/assets/mesh-layers-BSECKarm.js +1123 -0
- tangram_core/dist-frontend/assets/mesh-layers-BSECKarm.js.map +1 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-CzZmHDEZ.js +2 -0
- tangram_core/dist-frontend/assets/orthographic-viewport-CzZmHDEZ.js.map +1 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-xhWsgZtf.js +2 -0
- tangram_core/dist-frontend/assets/pick-layers-pass-xhWsgZtf.js.map +1 -0
- tangram_core/dist-frontend/assets/project-CrvReKGW.js +760 -0
- tangram_core/dist-frontend/assets/project-CrvReKGW.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-BJmsOfPx.js +843 -0
- tangram_core/dist-frontend/assets/shader-BJmsOfPx.js.map +1 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DiarVGxh.js +392 -0
- tangram_core/dist-frontend/assets/solid-polygon-layer-DiarVGxh.js.map +1 -0
- tangram_core/dist-frontend/assets/tesselator-49Dw9L5A.js +2 -0
- tangram_core/dist-frontend/assets/tesselator-49Dw9L5A.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-CZl8qVFg.js +7 -0
- tangram_core/dist-frontend/assets/webgl-developer-tools-CZl8qVFg.js.map +1 -0
- tangram_core/dist-frontend/assets/webgl-device-BY0-CUP6.js +3 -0
- tangram_core/dist-frontend/assets/webgl-device-BY0-CUP6.js.map +1 -0
- tangram_core/dist-frontend/assets/widget-BbOeHGj0.js +2 -0
- tangram_core/dist-frontend/assets/widget-BbOeHGj0.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/font-awesome.min.css +4 -0
- tangram_core/dist-frontend/fonts/FontAwesome.otf +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.eot +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.svg +2671 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.ttf +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.woff +0 -0
- tangram_core/dist-frontend/fonts/fontawesome-webfont.woff2 +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 +38 -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/lit-html.js +7 -0
- tangram_core/dist-frontend/lit-html.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/maplibre-gl.js +59 -0
- tangram_core/dist-frontend/maplibre-gl.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/rs1090_wasm.js +813 -0
- tangram_core/dist-frontend/rs1090_wasm_bg.wasm +0 -0
- tangram_core/dist-frontend/vue.esm-browser.prod.js +13 -0
- tangram_core/dist-frontend/widgets.js +3 -0
- tangram_core/dist-frontend/widgets.js.map +1 -0
- tangram_core/main.ts +16 -0
- tangram_core/plugin.py +70 -0
- tangram_core/plugin.ts +41 -0
- tangram_core/redis.py +89 -0
- tangram_core/user.css +114 -0
- tangram_core/vite-plugin-tangram.mjs +88 -0
- tangram_core-0.2.0.dist-info/METADATA +37 -0
- tangram_core-0.2.0.dist-info/RECORD +171 -0
- tangram_core-0.2.0.dist-info/WHEEL +4 -0
- tangram_core-0.2.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
import{reactive as j_,ref as Dr,shallowRef as $a,computed as Jf,watch as zd,defineComponent as N_,getCurrentInstance as V_,onMounted as U_,onUnmounted as G_,createElementBlock as Ga,createCommentVNode as Hf,openBlock as jn,createElementVNode as dr,toDisplayString as $_,Fragment as Md,renderList as Id,createBlock as Ed,resolveDynamicComponent as Cd,normalizeClass as Z_,createApp as q_}from"vue";import{MapboxOverlay as W_}from"@deck.gl/mapbox";(function(){const P=document.createElement("link").relList;if(P&&P.supports&&P.supports("modulepreload"))return;for(const et of document.querySelectorAll('link[rel="modulepreload"]'))N(et);new MutationObserver(et=>{for(const ht of et)if(ht.type==="childList")for(const M of ht.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&N(M)}).observe(document,{childList:!0,subtree:!0});function O(et){const ht={};return et.integrity&&(ht.integrity=et.integrity),et.referrerPolicy&&(ht.referrerPolicy=et.referrerPolicy),et.crossOrigin==="use-credentials"?ht.credentials="include":et.crossOrigin==="anonymous"?ht.credentials="omit":ht.credentials="same-origin",ht}function N(et){if(et.ep)return;et.ep=!0;const ht=O(et);fetch(et.href,ht)}})();const H_="/favicon.png";function X_(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}var eh={exports:{}};var Y_=eh.exports,Xf;function K_(){return Xf||(Xf=1,(function(I,P){(function(O,N){I.exports=N()})(Y_,(function(){var O={},N={};function et(M,c,dt){if(N[M]=dt,M==="index"){var Rt="var sharedModule = {}; ("+N.shared+")(sharedModule); ("+N.worker+")(sharedModule);",$t={};return N.shared($t),N.index(O,$t),typeof window<"u"&&O.setWorkerUrl(window.URL.createObjectURL(new Blob([Rt],{type:"text/javascript"}))),O}}et("shared",["exports"],(function(M){function c(r,t,i,s){return new(i||(i=Promise))((function(a,l){function h(y){try{g(s.next(y))}catch(v){l(v)}}function f(y){try{g(s.throw(y))}catch(v){l(v)}}function g(y){var v;y.done?a(y.value):(v=y.value,v instanceof i?v:new i((function(w){w(v)}))).then(h,f)}g((s=s.apply(r,t||[])).next())}))}function dt(r,t){this.x=r,this.y=t}function Rt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $t,Bt;typeof SuppressedError=="function"&&SuppressedError,dt.prototype={clone(){return new dt(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,t){return this.clone()._rotateAround(r,t)},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 t=r.x-this.x,i=r.y-this.y;return t*t+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,t){return Math.atan2(this.x*t-this.y*r,this.x*r+this.y*t)},_matMult(r){const t=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=t,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 t=Math.cos(r),i=Math.sin(r),s=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=s,this},_rotateAround(r,t){const i=Math.cos(r),s=Math.sin(r),a=t.y+s*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-s*(this.y-t.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:dt},dt.convert=function(r){if(r instanceof dt)return r;if(Array.isArray(r))return new dt(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new dt(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Yt=(function(){if(Bt)return $t;function r(t,i,s,a){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=s,this.p2y=a}return Bt=1,$t=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,a=0;a<8;a++){var l=this.sampleCurveX(s)-t;if(Math.abs(l)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=l/h}var f=0,g=1;for(s=t,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-t)<i));a++)t>l?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},$t})(),ce=Rt(Yt);let Xe,qt;function xt(){return Xe==null&&(Xe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Xe}function fr(){if(qt==null&&(qt=!1,xt())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<25;s++){const a=4*s;t.fillStyle=`rgb(${a},${a+1},${a+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}const i=t.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){qt=!0;break}}}return qt||!1}var ve=1e-6,de=typeof Float32Array<"u"?Float32Array:Array;function Rr(){var r=new de(9);return de!=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 Lr(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 Jr(){var r=new de(3);return de!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function _i(r){var t=r[0],i=r[1],s=r[2];return Math.sqrt(t*t+i*i+s*s)}function $n(r,t,i){var s=new de(3);return s[0]=r,s[1]=t,s[2]=i,s}function zi(r,t,i){return r[0]=t[0]+i[0],r[1]=t[1]+i[1],r[2]=t[2]+i[2],r}function rr(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r[2]=t[2]*i,r}function Qe(r,t,i){var s=t[0],a=t[1],l=t[2],h=i[0],f=i[1],g=i[2];return r[0]=a*g-l*f,r[1]=l*h-s*g,r[2]=s*f-a*h,r}var mr,Qr=_i;function Zn(r,t,i){var s=t[0],a=t[1],l=t[2],h=t[3];return r[0]=i[0]*s+i[4]*a+i[8]*l+i[12]*h,r[1]=i[1]*s+i[5]*a+i[9]*l+i[13]*h,r[2]=i[2]*s+i[6]*a+i[10]*l+i[14]*h,r[3]=i[3]*s+i[7]*a+i[11]*l+i[15]*h,r}function xn(){var r=new de(4);return de!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function nr(r,t,i,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;t*=l,s*=l,i*=l;var h=Math.sin(t),f=Math.cos(t),g=Math.sin(i),y=Math.cos(i),v=Math.sin(s),w=Math.cos(s);switch(a){case"xyz":r[0]=h*y*w+f*g*v,r[1]=f*g*w-h*y*v,r[2]=f*y*v+h*g*w,r[3]=f*y*w-h*g*v;break;case"xzy":r[0]=h*y*w-f*g*v,r[1]=f*g*w-h*y*v,r[2]=f*y*v+h*g*w,r[3]=f*y*w+h*g*v;break;case"yxz":r[0]=h*y*w+f*g*v,r[1]=f*g*w-h*y*v,r[2]=f*y*v-h*g*w,r[3]=f*y*w+h*g*v;break;case"yzx":r[0]=h*y*w+f*g*v,r[1]=f*g*w+h*y*v,r[2]=f*y*v-h*g*w,r[3]=f*y*w-h*g*v;break;case"zxy":r[0]=h*y*w-f*g*v,r[1]=f*g*w+h*y*v,r[2]=f*y*v+h*g*w,r[3]=f*y*w-h*g*v;break;case"zyx":r[0]=h*y*w-f*g*v,r[1]=f*g*w+h*y*v,r[2]=f*y*v-h*g*w,r[3]=f*y*w+h*g*v;break;default:throw new Error("Unknown angle order "+a)}return r}function wi(){var r=new de(2);return de!=Float32Array&&(r[0]=0,r[1]=0),r}function qn(r,t){var i=new de(2);return i[0]=r,i[1]=t,i}Jr(),mr=new de(4),de!=Float32Array&&(mr[0]=0,mr[1]=0,mr[2]=0,mr[3]=0),Jr(),$n(1,0,0),$n(0,1,0),xn(),xn(),Rr(),wi();const le=8192;function vn(r,t,i){return t*(le/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function sr(r,t){return(r%t+t)%t}function gr(r,t,i){return r*(1-i)+t*i}function _r(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,i=t*r;return 4*(r<.5?i:3*(r-t)+i-.75)}function yr(r,t,i,s){const a=new ce(r,t,i,s);return l=>a.solve(l)}const Ui=yr(.25,.1,.25,1);function oi(r,t,i){return Math.min(i,Math.max(t,r))}function Ri(r,t,i){const s=i-t,a=((r-t)%s+s)%s+t;return a===t?i:a}function li(r,...t){for(const i of t)for(const s in i)r[s]=i[s];return r}let tn=1;function Fr(r,t,i){const s={};for(const a in r)s[a]=t.call(this,r[a],a,r);return s}function Br(r,t,i){const s={};for(const a in r)t.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function Li(r){return Array.isArray(r)?r.map(Li):typeof r=="object"&&r?Fr(r,Li):r}const bn={};function Re(r){bn[r]||(typeof console<"u"&&console.warn(r),bn[r]=!0)}function xr(r,t,i){return(i.y-r.y)*(t.x-r.x)>(t.y-r.y)*(i.x-r.x)}function Or(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Le=null;function jr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function vs(r,t,i,s,a){return c(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const h=l?.format;if(!h||!h.startsWith("BGR")&&!h.startsWith("RGB"))throw new Error(`Unrecognized format ${h}`);const f=h.startsWith("BGR"),g=new Uint8ClampedArray(s*a*4);if(yield l.copyTo(g,(function(y,v,w,S,E){const C=4*Math.max(-v,0),D=(Math.max(0,w)-w)*S*4+C,R=4*S,V=Math.max(0,v),X=Math.max(0,w);return{rect:{x:V,y:X,width:Math.min(y.width,v+S)-V,height:Math.min(y.height,w+E)-X},layout:[{offset:D,stride:R}]}})(r,t,i,s,a)),f)for(let y=0;y<g.length;y+=4){const v=g[y];g[y]=g[y+2],g[y+2]=v}return g}finally{l.close()}}))}let wn,Vr;function Tn(r,t,i,s){return r.addEventListener(t,i,s),{unsubscribe:()=>{r.removeEventListener(t,i,s)}}}function Wn(r){return r*Math.PI/180}function Gi(r){return r/Math.PI*180}const Qs={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ta={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Hn="AbortError";function bs(){return new Error(Hn)}const Sn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ws(r){return Sn.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Xn="global-dispatcher";class vr extends Error{constructor(t,i,s,a){super(`AJAXError: ${i} (${t}): ${s}`),this.status=t,this.statusText=i,this.url=s,this.body=a}}const Ki=()=>Or(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,at=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=ws(r.url);if(s)return s(r,t);if(Or(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Xn},t)}if(!(/^file:/.test(i=r.url)||/^file:/.test(Ki())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,a){return c(this,void 0,void 0,(function*(){const l=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Ki(),signal:a.signal});let h,f;s.type!=="json"||l.headers.has("Accept")||l.headers.set("Accept","application/json");try{h=yield fetch(l)}catch(y){throw new vr(0,y.message,s.url,new Blob)}if(!h.ok){const y=yield h.blob();throw new vr(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;if(a.signal.aborted)throw bs();return{data:g,cacheControl:h.headers.get("Cache-Control"),expires:h.headers.get("Expires")}}))})(r,t);if(Or(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Xn},t)}var i;return(function(s,a){return new Promise(((l,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(!a.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(v){return void h(v)}l({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 vr(g.status,g.statusText,s.url,y))}},a.signal.addEventListener("abort",(()=>{g.abort(),h(bs())})),g.send(s.body)}))})(r,t)};function F(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function B(r,t,i){i[r]&&i[r].indexOf(t)!==-1||(i[r]=i[r]||[],i[r].push(t))}function U(r,t,i){if(i&&i[r]){const s=i[r].indexOf(t);s!==-1&&i[r].splice(s,1)}}class J{constructor(t,i={}){li(this,i),this.type=t}}class tt extends J{constructor(t,i={}){super("error",li({error:t},i))}}class ut{on(t,i){return this._listeners=this._listeners||{},B(t,i,this._listeners),{unsubscribe:()=>{this.off(t,i)}}}off(t,i){return U(t,i,this._listeners),U(t,i,this._oneTimeListeners),this}once(t,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},B(t,i,this._oneTimeListeners),this):new Promise((s=>this.once(t,s)))}fire(t,i){typeof t=="string"&&(t=new J(t,i||{}));const s=t.type;if(this.listens(s)){t.target=this;const a=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of a)f.call(this,t);const l=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of l)U(s,f,this._oneTimeListeners),f.call(this,t);const h=this._eventedParent;h&&(li(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(t))}else t instanceof tt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,i){return this._eventedParent=t,this._eventedParentData=i,this}}var W={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},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:"array",value:"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:"*"},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","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},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"}}};const ct=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yt(r,t){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return ct.forEach((s=>{s in t&&(i[s]=t[s])})),i}function vt(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let i=0;i<r.length;i++)if(!vt(r[i],t[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const i in r)if(!vt(r[i],t[i]))return!1;return!0}return r===t}function bt(r,t){r.push(t)}function Ft(r,t,i){bt(i,{command:"addSource",args:[r,t[r]]})}function Zt(r,t,i){bt(t,{command:"removeSource",args:[r]}),i[r]=!0}function te(r,t,i,s){Zt(r,i,s),Ft(r,t,i)}function Ve(r,t,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!vt(r[i][s],t[i][s]))return!1;for(s in t[i])if(Object.prototype.hasOwnProperty.call(t[i],s)&&s!=="data"&&!vt(r[i][s],t[i][s]))return!1;return!0}function ne(r,t,i,s,a,l){r=r||{},t=t||{};for(const h in r)Object.prototype.hasOwnProperty.call(r,h)&&(vt(r[h],t[h])||i.push({command:l,args:[s,h,t[h],a]}));for(const h in t)Object.prototype.hasOwnProperty.call(t,h)&&!Object.prototype.hasOwnProperty.call(r,h)&&(vt(r[h],t[h])||i.push({command:l,args:[s,h,t[h],a]}))}function fe(r){return r.id}function be(r,t){return r[t.id]=t,r}class It{constructor(t,i,s,a){this.message=(t?`${t}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function Ee(r,...t){for(const i of t)for(const s in i)r[s]=i[s];return r}class we extends Error{constructor(t,i){super(i),this.message=i,this.key=t}}class ti{constructor(t,i=[]){this.parent=t,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(t){return new ti(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Te={kind:"null"},Ct={kind:"number"},Nt={kind:"string"},Xt={kind:"boolean"},$i={kind:"color"},Yn={kind:"projectionDefinition"},hi={kind:"object"},Kt={kind:"value"},en={kind:"collator"},Ts={kind:"formatted"},Ss={kind:"padding"},br={kind:"colorArray"},Kn={kind:"numberArray"},Ps={kind:"resolvedImage"},Ms={kind:"variableAnchorOffsetCollection"};function Ji(r,t){return{kind:"array",itemType:r,N:t}}function Se(r){if(r.kind==="array"){const t=Se(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const nh=[Te,Ct,Nt,Xt,$i,Yn,Ts,hi,Ji(Kt),Ss,Kn,br,Ps,Ms];function Ur(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ur(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const i of nh)if(!Ur(i,t))return null}}return`Expected ${Se(r)} but found ${Se(t)} instead.`}function ea(r,t){return t.some((i=>i.kind===r.kind))}function Fe(r,t){return t.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function Pn(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Ko=.96422,Is=.82521,Jo=4/29,Es=6/29,wc=3*Es*Es,Tc=Es*Es*Es,sh=Math.PI/180,Sc=180/Math.PI;function Pc(r){return(r%=360)<0&&(r+=360),r}function Mc([r,t,i,s]){let a,l;const h=tl((.2225045*(r=Qo(r))+.7168786*(t=Qo(t))+.0606169*(i=Qo(i)))/1);r===t&&t===i?a=l=h:(a=tl((.4360747*r+.3850649*t+.1430804*i)/Ko),l=tl((.0139322*r+.0971045*t+.7141733*i)/Is));const f=116*h-16;return[f<0?0:f,500*(a-h),200*(h-l),s]}function Qo(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function tl(r){return r>Tc?Math.pow(r,1/3):r/wc+Jo}function Ic([r,t,i,s]){let a=(r+16)/116,l=isNaN(t)?a:a+t/500,h=isNaN(i)?a:a-i/200;return a=1*il(a),l=Ko*il(l),h=Is*il(h),[el(3.1338561*l-1.6168667*a-.4906146*h),el(-.9787684*l+1.9161415*a+.033454*h),el(.0719453*l-.2289914*a+1.4052427*h),s]}function el(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function il(r){return r>Es?r*r*r:wc*(r-Jo)}const Ec=Object.hasOwn||function(r,t){return Object.prototype.hasOwnProperty.call(r,t)};function rn(r,t){return Ec(r,t)?r[t]:void 0}function Za(r){return parseInt(r.padEnd(2,r),16)/255}function Cc(r,t){return Gr(t?r/100:r,0,1)}function Gr(r,t,i){return Math.min(Math.max(t,r),i)}function Ac(r){return!r.some(Number.isNaN)}const ah={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 Mn(r,t,i){return r+i*(t-r)}function Jn(r,t,i){return r.map(((s,a)=>Mn(s,t[a],i)))}class se{constructor(t,i,s,a=1,l=!0){this.r=t,this.g=i,this.b=s,this.a=a,l||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,s,a]))}static parse(t){if(t instanceof se)return t;if(typeof t!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const a=rn(ah,s);if(a){const[h,f,g]=a;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[Za(s.slice(f,f+=h)),Za(s.slice(f,f+=h)),Za(s.slice(f,f+=h)),Za(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,v,w,S,E,C,D,R,V,X]=h,G=[v||" ",E||" ",R].join("");if(G===" "||G===" /"||G===",,"||G===",,,"){const q=[y,S,D].join(""),st=q==="%%%"?100:q===""?255:0;if(st){const ot=[Gr(+g/st,0,1),Gr(+w/st,0,1),Gr(+C/st,0,1),V?Cc(+V,X):1];if(Ac(ot))return ot}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[h,f,g,y,v,w,S,E,C]=l,D=[g||" ",v||" ",S].join("");if(D===" "||D===" /"||D===",,"||D===",,,"){const R=[+f,Gr(+y,0,100),Gr(+w,0,100),E?Cc(+E,C):1];if(Ac(R))return(function([V,X,G,q]){function st(ot){const mt=(ot+V/30)%12,Pt=X*Math.min(G,1-G);return G-Pt*Math.max(-1,Math.min(mt-3,9-mt,1))}return V=Pc(V),X/=100,G/=100,[st(0),st(8),st(4),q]})(R)}}})(t);return i?new se(...i,!1):void 0}get rgb(){const{r:t,g:i,b:s,a}=this,l=a||1/0;return this.overwriteGetter("rgb",[t/l,i/l,s/l,a])}get hcl(){return this.overwriteGetter("hcl",(function(t){const[i,s,a,l]=Mc(t),h=Math.sqrt(s*s+a*a);return[Math.round(1e4*h)?Pc(Math.atan2(a,s)*Sc):NaN,h,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Mc(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){const[t,i,s,a]=this.rgb;return`rgba(${[t,i,s].map((l=>Math.round(255*l))).join(",")},${a})`}static interpolate(t,i,s,a="rgb"){switch(a){case"rgb":{const[l,h,f,g]=Jn(t.rgb,i.rgb,s);return new se(l,h,f,g,!1)}case"hcl":{const[l,h,f,g]=t.hcl,[y,v,w,S]=i.hcl;let E,C;if(isNaN(l)||isNaN(y))isNaN(l)?isNaN(y)?E=NaN:(E=y,f!==1&&f!==0||(C=v)):(E=l,w!==1&&w!==0||(C=h));else{let G=y-l;y>l&&G>180?G-=360:y<l&&l-y>180&&(G+=360),E=l+s*G}const[D,R,V,X]=(function([G,q,st,ot]){return G=isNaN(G)?0:G*sh,Ic([st,Math.cos(G)*q,Math.sin(G)*q,ot])})([E,C??Mn(h,v,s),Mn(f,w,s),Mn(g,S,s)]);return new se(D,R,V,X,!1)}case"lab":{const[l,h,f,g]=Ic(Jn(t.lab,i.lab,s));return new se(l,h,f,g,!1)}}}}se.black=new se(0,0,0,1),se.white=new se(1,1,1,1),se.transparent=new se(0,0,0,0),se.red=new se(1,0,0,1);class ar{constructor(t,i,s){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ue=["bottom","center","top"];class In{constructor(t,i,s,a,l,h){this.text=t,this.image=i,this.scale=s,this.fontStack=a,this.textColor=l,this.verticalAlign=h}}class ei{constructor(t){this.sections=t}static fromString(t){return new ei([new In(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t=>t.text.length!==0||t.image&&t.image.name.length!==0))}static factory(t){return t instanceof ei?t:ei.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t=>t.text)).join("")}}class Ti{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ti)return t;if(typeof t=="number")return new Ti([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Ti(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){return new Ti(Jn(t.values,i.values,s))}}class Si{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Si)return t;if(typeof t=="number")return new Si([t]);if(Array.isArray(t)){for(const i of t)if(typeof i!="number")return;return new Si(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){return new Si(Jn(t.values,i.values,s))}}class ci{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ci)return t;if(typeof t=="string"){const s=se.parse(t);return s?new ci([s]):void 0}if(!Array.isArray(t))return;const i=[];for(const s of t){if(typeof s!="string")return;const a=se.parse(s);if(!a)return;i.push(a)}return new ci(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s,a="rgb"){const l=[];if(t.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let h=0;h<t.values.length;h++)l.push(se.interpolate(t.values[h],i.values[h],s,a));return new ci(l)}}class Pe extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const qa=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Fi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Fi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let i=0;i<t.length;i+=2){const s=t[i],a=t[i+1];if(typeof s!="string"||!qa.has(s)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new Fi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,s){const a=t.values,l=i.values;if(a.length!==l.length)throw new Pe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`);const h=[];for(let f=0;f<a.length;f+=2){if(a[f]!==l[f])throw new Pe(`Cannot interpolate values containing mismatched anchors. from[${f}]: ${a[f]}, to[${f}]: ${l[f]}`);h.push(a[f]);const[g,y]=a[f+1],[v,w]=l[f+1];h.push([Mn(g,v,s),Mn(y,w,s)])}return new Fi(h)}}class Zi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Zi({name:t,available:!1}):null}}class Pi{constructor(t,i,s){this.from=t,this.to=i,this.transition=s}static interpolate(t,i,s){return new Pi(t,i,s)}static parse(t){return t instanceof Pi?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Pi(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Pi(t.from,t.to,t.transition):typeof t=="string"?new Pi(t,t,1):void 0}}function kc(r,t,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,t,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,t,i,s]:[r,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function En(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Pi||r instanceof se||r instanceof ar||r instanceof ei||r instanceof Ti||r instanceof Si||r instanceof ci||r instanceof Fi||r instanceof Zi)return!0;if(Array.isArray(r)){for(const t of r)if(!En(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!En(r[t]))return!1;return!0}return!1}function Ce(r){if(r===null)return Te;if(typeof r=="string")return Nt;if(typeof r=="boolean")return Xt;if(typeof r=="number")return Ct;if(r instanceof se)return $i;if(r instanceof Pi)return Yn;if(r instanceof ar)return en;if(r instanceof ei)return Ts;if(r instanceof Ti)return Ss;if(r instanceof Si)return Kn;if(r instanceof ci)return br;if(r instanceof Fi)return Ms;if(r instanceof Zi)return Ps;if(Array.isArray(r)){const t=r.length;let i;for(const s of r){const a=Ce(s);if(i){if(i===a)continue;i=Kt;break}i=a}return Ji(i||Kt,t)}return hi}function Cs(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof se||r instanceof Pi||r instanceof ei||r instanceof Ti||r instanceof Si||r instanceof ci||r instanceof Fi||r instanceof Zi?r.toString():JSON.stringify(r)}class Cn{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!En(t[1]))return i.error("invalid value");const s=t[1];let a=Ce(s);const l=i.expectedType;return a.kind!=="array"||a.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(a=l),new Cn(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ia={string:Nt,number:Ct,boolean:Xt,object:hi};class qi{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let s,a=1;const l=t[0];if(l==="array"){let f,g;if(t.length>2){const y=t[1];if(typeof y!="string"||!(y in ia)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=ia[y],a++}else f=Kt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=t[2],a++}s=Ji(f,g)}else{if(!ia[l])throw new Error(`Types doesn't contain name = ${l}`);s=ia[l]}const h=[];for(;a<t.length;a++){const f=i.parse(t[a],a,Kt);if(!f)return null;h.push(f)}return new qi(s,h)}evaluate(t){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(t);if(!Ur(this.type,Ce(s)))return s;if(i===this.args.length-1)throw new Pe(`Expected value to be of type ${Se(this.type)}, but found ${Se(Ce(s))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Ae={"to-boolean":Xt,"to-color":$i,"to-number":Ct,"to-string":Nt};class $r{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");const s=t[0];if(!Ae[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return i.error("Expected one argument.");const a=Ae[s],l=[];for(let h=1;h<t.length;h++){const f=i.parse(t[h],h,Kt);if(!f)return null;l.push(f)}return new $r(a,l)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,s;for(const a of this.args){if(i=a.evaluate(t),s=null,i instanceof se)return i;if(typeof i=="string"){const l=t.parseColor(i);if(l)return l}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.`:kc(i[0],i[1],i[2],i[3]),!s))return new se(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Pe(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(t);const a=Ti.parse(i);if(a)return a}throw new Pe(`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(t);const a=Si.parse(i);if(a)return a}throw new Pe(`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(t);const a=ci.parse(i);if(a)return a}throw new Pe(`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(t);const a=Fi.parse(i);if(a)return a}throw new Pe(`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(t),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new Pe(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return ei.fromString(Cs(this.args[0].evaluate(t)));case"resolvedImage":return Zi.fromString(Cs(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Cs(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const pe=["Unknown","Point","LineString","Polygon"];class ie{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"?pe[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let i=this._parseColorCache.get(t);return i||(i=se.parse(t),this._parseColorCache.set(t,i)),i}}class As{constructor(t,i,s=[],a,l=new ti,h=[]){this.registry=t,this.path=s,this.key=s.map((f=>`[${f}]`)).join(""),this.scope=l,this.errors=h,this.expectedType=a,this._isConstant=i}parse(t,i,s,a,l={}){return i?this.concat(i,s,a)._parse(t,l):this._parse(t,l)}_parse(t,i){function s(a,l,h){return h==="assert"?new qi(l,[a]):h==="coerce"?new $r(l,[a]):a}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=t[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[a];if(l){let h=l.parse(t,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 Cn)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){const f=new ie;try{h=new Cn(h.type,h.evaluate(f))}catch(g){return this.error(g.message),null}}return h}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,i,s){const a=typeof t=="number"?this.path.concat(t):this.path,l=s?this.scope.concat(s):this.scope;return new As(this.registry,this._isConstant,a,i||null,l,this.errors)}error(t,...i){const s=`${this.key}${i.map((a=>`[${a}]`)).join("")}`;this.errors.push(new we(s,t))}checkSubtype(t,i){const s=Ur(t,i);return s&&this.error(s),s}}class he{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const s=[];for(let l=1;l<t.length-1;l+=2){const h=t[l];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,l);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const f=i.parse(t[l+1],l+1);if(!f)return null;s.push([h,f])}const a=i.parse(t[t.length-1],t.length-1,i.expectedType,s);return a?new he(s,a):null}outputDefined(){return this.result.outputDefined()}}class ks{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=t[1];return i.scope.has(s)?new ks(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(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class wr{constructor(t,i,s){this.type=t,this.index=i,this.input=s}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Ct),a=i.parse(t[2],2,Ji(i.expectedType||Kt));return s&&a?new wr(a.type.itemType,s,a):null}evaluate(t){const i=this.index.evaluate(t),s=this.input.evaluate(t);if(i<0)throw new Pe(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Pe(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Pe(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ra{constructor(t,i){this.type=Xt,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Kt),a=i.parse(t[2],2,Kt);return s&&a?ea(s.type,[Xt,Nt,Ct,Te,Kt])?new ra(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Se(s.type)} instead`):null}evaluate(t){const i=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!Fe(i,["boolean","string","number","null"]))throw new Pe(`Expected first argument to be of type boolean, string, number or null, but found ${Se(Ce(i))} instead.`);if(!Fe(s,["string","array"]))throw new Pe(`Expected second argument to be of type array or string, but found ${Se(Ce(s))} instead.`);return s.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Qn{constructor(t,i,s){this.type=Ct,this.needle=t,this.haystack=i,this.fromIndex=s}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Kt),a=i.parse(t[2],2,Kt);if(!s||!a)return null;if(!ea(s.type,[Xt,Nt,Ct,Te,Kt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Se(s.type)} instead`);if(t.length===4){const l=i.parse(t[3],3,Ct);return l?new Qn(s,a,l):null}return new Qn(s,a)}evaluate(t){const i=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!Fe(i,["boolean","string","number","null"]))throw new Pe(`Expected first argument to be of type boolean, string, number or null, but found ${Se(Ce(i))} instead.`);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),Fe(s,["string"])){const l=s.indexOf(i,a);return l===-1?-1:[...s.slice(0,l)].length}if(Fe(s,["array"]))return s.indexOf(i,a);throw new Pe(`Expected second argument to be of type array or string, but found ${Se(Ce(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Wa{constructor(t,i,s,a,l,h){this.inputType=t,this.type=i,this.input=s,this.cases=a,this.outputs=l,this.otherwise=h}static parse(t,i){if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");let s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const l={},h=[];for(let y=2;y<t.length-1;y+=2){let v=t[y];const w=t[y+1];Array.isArray(v)||(v=[v]);const S=i.concat(y);if(v.length===0)return S.error("Expected at least one branch label.");for(const C of v){if(typeof C!="number"&&typeof C!="string")return S.error("Branch labels must be numbers or strings.");if(typeof C=="number"&&Math.abs(C)>Number.MAX_SAFE_INTEGER)return S.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof C=="number"&&Math.floor(C)!==C)return S.error("Numeric branch labels must be integer values.");if(s){if(S.checkSubtype(s,Ce(C)))return null}else s=Ce(C);if(l[String(C)]!==void 0)return S.error("Branch labels must be unique.");l[String(C)]=h.length}const E=i.parse(w,y,a);if(!E)return null;a=a||E.type,h.push(E)}const f=i.parse(t[1],1,Kt);if(!f)return null;const g=i.parse(t[t.length-1],t.length-1,a);return g?f.type.kind!=="value"&&i.concat(1).checkSubtype(s,f.type)?null:new Wa(s,a,f,l,h,g):null}evaluate(t){const i=this.input.evaluate(t);return(Ce(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class na{constructor(t,i,s){this.type=t,this.branches=i,this.otherwise=s}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let h=1;h<t.length-1;h+=2){const f=i.parse(t[h],h,Xt);if(!f)return null;const g=i.parse(t[h+1],h+1,s);if(!g)return null;a.push([f,g]),s=s||g.type}const l=i.parse(t[t.length-1],t.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new na(s,a,l)}evaluate(t){for(const[i,s]of this.branches)if(i.evaluate(t))return s.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[i,s]of this.branches)t(i),t(s);t(this.otherwise)}outputDefined(){return this.branches.every((([t,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class sa{constructor(t,i,s,a){this.type=t,this.input=i,this.beginIndex=s,this.endIndex=a}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const s=i.parse(t[1],1,Kt),a=i.parse(t[2],2,Ct);if(!s||!a)return null;if(!ea(s.type,[Ji(Kt),Nt,Kt]))return i.error(`Expected first argument to be of type array or string, but found ${Se(s.type)} instead`);if(t.length===4){const l=i.parse(t[3],3,Ct);return l?new sa(s.type,s,a,l):null}return new sa(s.type,s,a)}evaluate(t){const i=this.input.evaluate(t),s=this.beginIndex.evaluate(t);let a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),Fe(i,["string"]))return[...i].slice(s,a).join("");if(Fe(i,["array"]))return i.slice(s,a);throw new Pe(`Expected first argument to be of type array or string, but found ${Se(Ce(i))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ha(r,t){const i=r.length-1;let s,a,l=0,h=i,f=0;for(;l<=h;)if(f=Math.floor((l+h)/2),s=r[f],a=r[f+1],s<=t){if(f===i||t<a)return f;l=f+1}else{if(!(s>t))throw new Pe("Input is not a number.");h=f-1}return 0}class Ds{constructor(t,i,s){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(const[a,l]of s)this.labels.push(a),this.outputs.push(l)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(t[1],1,Ct);if(!s)return null;const a=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let h=1;h<t.length;h+=2){const f=h===1?-1/0:t[h],g=t[h+1],y=h,v=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(a.length&&a[a.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,v,l);if(!w)return null;l=l||w.type,a.push([f,w])}return new Ds(l,s,a)}evaluate(t){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(t);const a=this.input.evaluate(t);if(a<=i[0])return s[0].evaluate(t);const l=i.length;return a>=i[l-1]?s[l-1].evaluate(t):s[Ha(i,a)].evaluate(t)}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Dc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zr,yi,Xa=(function(){if(yi)return Zr;function r(t,i,s,a){this.cx=3*t,this.bx=3*(s-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=s,this.p2y=a}return yi=1,Zr=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var s=t,a=0;a<8;a++){var l=this.sampleCurveX(s)-t;if(Math.abs(l)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=l/h}var f=0,g=1;for(s=t,a=0;a<20&&(l=this.sampleCurveX(s),!(Math.abs(l-t)<i));a++)t>l?f=s:g=s,s=.5*(g-f)+f;return s},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},Zr})(),zc=Dc(Xa);class xi{constructor(t,i,s,a,l){this.type=t,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of l)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(t,i,s,a){let l=0;if(t.name==="exponential")l=ii(i,t.base,s,a);else if(t.name==="linear")l=ii(i,1,s,a);else if(t.name==="cubic-bezier"){const h=t.controlPoints;l=new zc(h[0],h[1],h[2],h[3]).solve(ii(i,1,s,a))}return l}static parse(t,i){let[s,a,l,...h]=t;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const y=a[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:y}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const y=a.slice(1);if(y.length!==4||y.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:y}}}if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,Ct),!l)return null;const f=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==br?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=$i;for(let y=0;y<h.length;y+=2){const v=h[y],w=h[y+1],S=y+3,E=y+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',S);const C=i.parse(w,E,g);if(!C)return null;g=g||C.type,f.push([v,C])}return Pn(g,Ct)||Pn(g,Yn)||Pn(g,$i)||Pn(g,Ss)||Pn(g,Kn)||Pn(g,br)||Pn(g,Ms)||Pn(g,Ji(Ct))?new xi(g,s,a,l,f):i.error(`Type ${Se(g)} is not interpolatable.`)}evaluate(t){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(t);const a=this.input.evaluate(t);if(a<=i[0])return s[0].evaluate(t);const l=i.length;if(a>=i[l-1])return s[l-1].evaluate(t);const h=Ha(i,a),f=xi.interpolationFactor(this.interpolation,a,i[h],i[h+1]),g=s[h].evaluate(t),y=s[h+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Mn(g,y,f);case"color":return se.interpolate(g,y,f);case"padding":return Ti.interpolate(g,y,f);case"colorArray":return ci.interpolate(g,y,f);case"numberArray":return Si.interpolate(g,y,f);case"variableAnchorOffsetCollection":return Fi.interpolate(g,y,f);case"array":return Jn(g,y,f);case"projectionDefinition":return Pi.interpolate(g,y,f)}case"interpolate-hcl":switch(this.type.kind){case"color":return se.interpolate(g,y,f,"hcl");case"colorArray":return ci.interpolate(g,y,f,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return se.interpolate(g,y,f,"lab");case"colorArray":return ci.interpolate(g,y,f,"lab")}}}eachChild(t){t(this.input);for(const i of this.outputs)t(i)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ii(r,t,i,s){const a=s-i,l=r-i;return a===0?0:t===1?l/a:(Math.pow(t,l)-1)/(Math.pow(t,a)-1)}const Tr={color:se.interpolate,number:Mn,padding:Ti.interpolate,numberArray:Si.interpolate,colorArray:ci.interpolate,variableAnchorOffsetCollection:Fi.interpolate,array:Jn};class zs{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const l=[];for(const f of t.slice(1)){const g=i.parse(f,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,l.push(g)}if(!s)throw new Error("No output type");const h=a&&l.some((f=>Ur(a,f.type)));return new zs(h?Kt:s,l)}evaluate(t){let i,s=null,a=0;for(const l of this.args)if(a++,s=l.evaluate(t),s&&s instanceof Zi&&!s.available&&(i||(i=s.name),s=null,a===this.args.length&&(s=i)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function rl(r,t){return r==="=="||r==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Rc(r,t,i,s){return s.compare(t,i)===0}function Sr(r,t,i){const s=r!=="=="&&r!=="!=";return class Qf{constructor(l,h,f){this.type=Xt,this.lhs=l,this.rhs=h,this.collator=f,this.hasUntypedArgument=l.type.kind==="value"||h.type.kind==="value"}static parse(l,h){if(l.length!==3&&l.length!==4)return h.error("Expected two or three arguments.");const f=l[0];let g=h.parse(l[1],1,Kt);if(!g)return null;if(!rl(f,g.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${Se(g.type)}'.`);let y=h.parse(l[2],2,Kt);if(!y)return null;if(!rl(f,y.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${Se(y.type)}'.`);if(g.type.kind!==y.type.kind&&g.type.kind!=="value"&&y.type.kind!=="value")return h.error(`Cannot compare types '${Se(g.type)}' and '${Se(y.type)}'.`);s&&(g.type.kind==="value"&&y.type.kind!=="value"?g=new qi(y.type,[g]):g.type.kind!=="value"&&y.type.kind==="value"&&(y=new qi(g.type,[y])));let v=null;if(l.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(v=h.parse(l[3],3,en),!v)return null}return new Qf(g,y,v)}evaluate(l){const h=this.lhs.evaluate(l),f=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=Ce(h),y=Ce(f);if(g.kind!==y.kind||g.kind!=="string"&&g.kind!=="number")throw new Pe(`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=Ce(h),y=Ce(f);if(g.kind!=="string"||y.kind!=="string")return t(l,h,f)}return this.collator?i(l,h,f,this.collator.evaluate(l)):t(l,h,f)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const Ya=Sr("==",(function(r,t,i){return t===i}),Rc),nl=Sr("!=",(function(r,t,i){return t!==i}),(function(r,t,i,s){return!Rc(0,t,i,s)})),oh=Sr("<",(function(r,t,i){return t<i}),(function(r,t,i,s){return s.compare(t,i)<0})),Lc=Sr(">",(function(r,t,i){return t>i}),(function(r,t,i,s){return s.compare(t,i)>0})),Ka=Sr("<=",(function(r,t,i){return t<=i}),(function(r,t,i,s){return s.compare(t,i)<=0})),Ja=Sr(">=",(function(r,t,i){return t>=i}),(function(r,t,i,s){return s.compare(t,i)>=0}));class Wi{constructor(t,i,s){this.type=en,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");const s=t[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Xt);if(!a)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Xt);if(!l)return null;let h=null;return s.locale&&(h=i.parse(s.locale,1,Nt),!h)?null:new Wi(a,l,h)}evaluate(t){return new ar(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Qa{constructor(t,i,s,a,l){this.type=Nt,this.number=t,this.locale=i,this.currency=s,this.minFractionDigits=a,this.maxFractionDigits=l}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");const s=i.parse(t[1],1,Ct);if(!s)return null;const a=t[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let l=null;if(a.locale&&(l=i.parse(a.locale,1,Nt),!l))return null;let h=null;if(a.currency&&(h=i.parse(a.currency,1,Nt),!h))return null;let f=null;if(a["min-fraction-digits"]&&(f=i.parse(a["min-fraction-digits"],1,Ct),!f))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parse(a["max-fraction-digits"],1,Ct),!g)?null:new Qa(s,l,h,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class ts{constructor(t){this.type=Ts,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");const s=t[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let l=!1;for(let h=1;h<=t.length-1;++h){const f=t[h];if(l&&typeof f=="object"&&!Array.isArray(f)){l=!1;let g=null;if(f["font-scale"]&&(g=i.parse(f["font-scale"],1,Ct),!g))return null;let y=null;if(f["text-font"]&&(y=i.parse(f["text-font"],1,Ji(Nt)),!y))return null;let v=null;if(f["text-color"]&&(v=i.parse(f["text-color"],1,$i),!v))return null;let w=null;if(f["vertical-align"]){if(typeof f["vertical-align"]=="string"&&!ue.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,Nt),!w)return null}const S=a[a.length-1];S.scale=g,S.font=y,S.textColor=v,S.verticalAlign=w}else{const g=i.parse(t[h],1,Kt);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'.");l=!0,a.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new ts(a)}evaluate(t){return new ei(this.sections.map((i=>{const s=i.content.evaluate(t);return Ce(s)===Ps?new In("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new In(Cs(s),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}}class sl{constructor(t){this.type=Ps,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");const s=i.parse(t[1],1,Nt);return s?new sl(s):i.error("No image name provided.")}evaluate(t){const i=this.input.evaluate(t),s=Zi.fromString(i);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(i)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class aa{constructor(t){this.type=Ct,this.input=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=i.parse(t[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 ${Se(s.type)} instead.`):new aa(s):null}evaluate(t){const i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Pe(`Expected value to be of type string or array, but found ${Se(Ce(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const qr=8192;function lh(r,t){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,t.z);return[Math.round(i*a*qr),Math.round(s*a*qr)]}function al(r,t){const i=Math.pow(2,t.z);return[(a=(r[0]/qr+t.x)/i,360*a-180),(s=(r[1]/qr+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,a}function oa(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function An(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function ch(r,t,i){const s=r[0]-t[0],a=r[1]-t[1],l=r[0]-i[0],h=r[1]-i[1];return s*h-l*a==0&&s*l<=0&&a*h<=0}function la(r,t,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(l=[t[0]-r[0],t[1]-r[1]])[1]-a[1]*l[0]!=0&&!(!jc(r,t,i,s)||!jc(i,s,r,t));var a,l}function Fc(r,t,i){for(const s of i)for(let a=0;a<s.length-1;++a)if(la(r,t,s[a],s[a+1]))return!0;return!1}function Rs(r,t,i=!1){let s=!1;for(const f of t)for(let g=0;g<f.length-1;g++){if(ch(r,f[g],f[g+1]))return i;(l=f[g])[1]>(a=r)[1]!=(h=f[g+1])[1]>a[1]&&a[0]<(h[0]-l[0])*(a[1]-l[1])/(h[1]-l[1])+l[0]&&(s=!s)}var a,l,h;return s}function Bc(r,t){for(const i of t)if(Rs(r,i))return!0;return!1}function Oc(r,t){for(const i of r)if(!Rs(i,t))return!1;for(let i=0;i<r.length-1;++i)if(Fc(r[i],r[i+1],t))return!1;return!0}function uh(r,t){for(const i of t)if(Oc(r,i))return!0;return!1}function jc(r,t,i,s){const a=s[0]-i[0],l=s[1]-i[1],h=(r[0]-i[0])*l-a*(r[1]-i[1]),f=(t[0]-i[0])*l-a*(t[1]-i[1]);return h>0&&f<0||h<0&&f>0}function ol(r,t,i){const s=[];for(let a=0;a<r.length;a++){const l=[];for(let h=0;h<r[a].length;h++){const f=lh(r[a][h],i);oa(t,f),l.push(f)}s.push(l)}return s}function Nc(r,t,i){const s=[];for(let a=0;a<r.length;a++){const l=ol(r[a],t,i);s.push(l)}return s}function ll(r,t,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let l=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;l===0&&(l=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=l}oa(t,r)}function cl(r,t,i,s){const a=Math.pow(2,s.z)*qr,l=[s.x*qr,s.y*qr],h=[];for(const f of r)for(const g of f){const y=[g.x+l[0],g.y+l[1]];ll(y,t,i,a),h.push(y)}return h}function ul(r,t,i,s){const a=Math.pow(2,s.z)*qr,l=[s.x*qr,s.y*qr],h=[];for(const g of r){const y=[];for(const v of g){const w=[v.x+l[0],v.y+l[1]];oa(t,w),y.push(w)}h.push(y)}if(t[2]-t[0]<=a/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of h)for(const y of g)ll(y,t,i,a)}var f;return h}class es{constructor(t,i){this.type=Xt,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(En(t[1])){const s=t[1];if(s.type==="FeatureCollection"){const a=[];for(const l of s.features){const{type:h,coordinates:f}=l.geometry;h==="Polygon"&&a.push(f),h==="MultiPolygon"&&a.push(...f)}if(a.length)return new es(s,{type:"MultiPolygon",coordinates:a})}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new es(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new es(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const f=ol(s.coordinates,l,h),g=cl(i.geometry(),a,l,h);if(!An(a,l))return!1;for(const y of g)if(!Rs(y,f))return!1}if(s.type==="MultiPolygon"){const f=Nc(s.coordinates,l,h),g=cl(i.geometry(),a,l,h);if(!An(a,l))return!1;for(const y of g)if(!Bc(y,f))return!1}return!0})(t,this.geometries);if(t.geometryType()==="LineString")return(function(i,s){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const f=ol(s.coordinates,l,h),g=ul(i.geometry(),a,l,h);if(!An(a,l))return!1;for(const y of g)if(!Oc(y,f))return!1}if(s.type==="MultiPolygon"){const f=Nc(s.coordinates,l,h),g=ul(i.geometry(),a,l,h);if(!An(a,l))return!1;for(const y of g)if(!uh(y,f))return!1}return!0})(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Vc=class{constructor(r=[],t=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,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],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:i}=this,s=t[r];for(;r>0;){const a=r-1>>1,l=t[a];if(i(s,l)>=0)break;t[r]=l,r=a}t[r]=s}_down(r){const{data:t,compare:i}=this,s=this.length>>1,a=t[r];for(;r<s;){let l=1+(r<<1);const h=l+1;if(h<this.length&&i(t[h],t[l])<0&&(l=h),i(t[l],a)>=0)break;t[r]=t[l],r=l}t[r]=a}};function Uc(r,t,i=0,s=r.length-1,a=to){for(;s>i;){if(s-i>600){const g=s-i+1,y=t-i+1,v=Math.log(g),w=.5*Math.exp(2*v/3),S=.5*Math.sqrt(v*w*(g-w)/g)*(y-g/2<0?-1:1);Uc(r,t,Math.max(i,Math.floor(t-y*w/g+S)),Math.min(s,Math.floor(t+(g-y)*w/g+S)),a)}const l=r[t];let h=i,f=s;for(ca(r,i,t),a(r[s],l)>0&&ca(r,i,s);h<f;){for(ca(r,h,f),h++,f--;a(r[h],l)<0;)h++;for(;a(r[f],l)>0;)f--}a(r[i],l)===0?ca(r,i,f):(f++,ca(r,f,s)),f<=t&&(i=f+1),t<=f&&(s=f-1)}}function ca(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}function to(r,t){return r<t?-1:r>t?1:0}function ua(r,t){if(r.length<=1)return[r];const i=[];let s,a;for(const l of r){const h=dh(l);h!==0&&(l.area=Math.abs(h),a===void 0&&(a=h<0),a===h<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),t>1)for(let l=0;l<i.length;l++)i[l].length<=t||(Uc(i[l],t,1,i[l].length-1,hh),i[l]=i[l].slice(0,t));return i}function hh(r,t){return t.area-r.area}function dh(r){let t=0;for(let i,s,a=0,l=r.length,h=l-1;a<l;h=a++)i=r[a],s=r[h],t+=(s.x-i.x)*(i.y+s.y);return t}const Gc=1/298.257223563,eo=Gc*(2-Gc),hl=Math.PI/180;class dl{constructor(t){const i=6378.137*hl*1e3,s=Math.cos(t*hl),a=1/(1-eo*(1-s*s)),l=Math.sqrt(a);this.kx=i*l*s,this.ky=i*l*a*(1-eo)}distance(t,i){const s=this.wrap(t[0]-i[0])*this.kx,a=(t[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}pointOnLine(t,i){let s,a,l,h,f=1/0;for(let g=0;g<t.length-1;g++){let y=t[g][0],v=t[g][1],w=this.wrap(t[g+1][0]-y)*this.kx,S=(t[g+1][1]-v)*this.ky,E=0;w===0&&S===0||(E=(this.wrap(i[0]-y)*this.kx*w+(i[1]-v)*this.ky*S)/(w*w+S*S),E>1?(y=t[g+1][0],v=t[g+1][1]):E>0&&(y+=w/this.kx*E,v+=S/this.ky*E)),w=this.wrap(i[0]-y)*this.kx,S=(i[1]-v)*this.ky;const C=w*w+S*S;C<f&&(f=C,s=y,a=v,l=g,h=E)}return{point:[s,a],index:l,t:Math.max(0,Math.min(1,h))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function $c(r,t){return t[0]-r[0]}function ha(r){return r[1]-r[0]+1}function Wr(r,t){return r[1]>=r[0]&&r[1]<t}function pl(r,t){if(r[0]>r[1])return[null,null];const i=ha(r);if(t){if(i===2)return[r,null];const a=Math.floor(i/2);return[[r[0],r[0]+a],[r[0]+a,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 fl(r,t){if(!Wr(t,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)oa(i,r[s]);return i}function ml(r){const t=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)oa(t,s);return t}function gl(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function _l(r,t,i){if(!gl(r)||!gl(t))return NaN;let s=0,a=0;return r[2]<t[0]&&(s=t[0]-r[2]),r[0]>t[2]&&(s=r[0]-t[2]),r[1]>t[3]&&(a=r[1]-t[3]),r[3]<t[1]&&(a=t[1]-r[3]),i.distance([0,0],[s,a])}function is(r,t,i){const s=i.pointOnLine(t,r);return i.distance(r,s.point)}function yl(r,t,i,s,a){const l=Math.min(is(r,[i,s],a),is(t,[i,s],a)),h=Math.min(is(i,[r,t],a),is(s,[r,t],a));return Math.min(l,h)}function ph(r,t,i,s,a){if(!Wr(t,r.length)||!Wr(s,i.length))return 1/0;let l=1/0;for(let h=t[0];h<t[1];++h){const f=r[h],g=r[h+1];for(let y=s[0];y<s[1];++y){const v=i[y],w=i[y+1];if(la(f,g,v,w))return 0;l=Math.min(l,yl(f,g,v,w,a))}}return l}function me(r,t,i,s,a){if(!Wr(t,r.length)||!Wr(s,i.length))return NaN;let l=1/0;for(let h=t[0];h<=t[1];++h)for(let f=s[0];f<=s[1];++f)if(l=Math.min(l,a.distance(r[h],i[f])),l===0)return l;return l}function fh(r,t,i){if(Rs(r,t,!0))return 0;let s=1/0;for(const a of t){const l=a[0],h=a[a.length-1];if(l!==h&&(s=Math.min(s,is(r,[h,l],i)),s===0))return s;const f=i.pointOnLine(a,r);if(s=Math.min(s,i.distance(r,f.point)),s===0)return s}return s}function mh(r,t,i,s){if(!Wr(t,r.length))return NaN;for(let l=t[0];l<=t[1];++l)if(Rs(r[l],i,!0))return 0;let a=1/0;for(let l=t[0];l<t[1];++l){const h=r[l],f=r[l+1];for(const g of i)for(let y=0,v=g.length,w=v-1;y<v;w=y++){const S=g[w],E=g[y];if(la(h,f,S,E))return 0;a=Math.min(a,yl(h,f,S,E,s))}}return a}function Zc(r,t){for(const i of r)for(const s of i)if(Rs(s,t,!0))return!0;return!1}function gh(r,t,i,s=1/0){const a=ml(r),l=ml(t);if(s!==1/0&&_l(a,l,i)>=s)return s;if(An(a,l)){if(Zc(r,t))return 0}else if(Zc(t,r))return 0;let h=1/0;for(const f of r)for(let g=0,y=f.length,v=y-1;g<y;v=g++){const w=f[v],S=f[g];for(const E of t)for(let C=0,D=E.length,R=D-1;C<D;R=C++){const V=E[R],X=E[C];if(la(w,S,V,X))return 0;h=Math.min(h,yl(w,S,V,X,i))}}return h}function qc(r,t,i,s,a,l){if(!l)return;const h=_l(fl(s,l),a,i);h<t&&r.push([h,l,[0,0]])}function io(r,t,i,s,a,l,h){if(!l||!h)return;const f=_l(fl(s,l),fl(a,h),i);f<t&&r.push([f,l,h])}function ro(r,t,i,s,a=1/0){let l=Math.min(s.distance(r[0],i[0][0]),a);if(l===0)return l;const h=new Vc([[0,[0,r.length-1],[0,0]]],$c),f=ml(i);for(;h.length>0;){const g=h.pop();if(g[0]>=l)continue;const y=g[1],v=t?50:100;if(ha(y)<=v){if(!Wr(y,r.length))return NaN;if(t){const w=mh(r,y,i,s);if(isNaN(w)||w===0)return w;l=Math.min(l,w)}else for(let w=y[0];w<=y[1];++w){const S=fh(r[w],i,s);if(l=Math.min(l,S),l===0)return 0}}else{const w=pl(y,t);qc(h,l,s,r,f,w[0]),qc(h,l,s,r,f,w[1])}}return l}function no(r,t,i,s,a,l=1/0){let h=Math.min(l,a.distance(r[0],i[0]));if(h===0)return h;const f=new Vc([[0,[0,r.length-1],[0,i.length-1]]],$c);for(;f.length>0;){const g=f.pop();if(g[0]>=h)continue;const y=g[1],v=g[2],w=t?50:100,S=s?50:100;if(ha(y)<=w&&ha(v)<=S){if(!Wr(y,r.length)&&Wr(v,i.length))return NaN;let E;if(t&&s)E=ph(r,y,i,v,a),h=Math.min(h,E);else if(t&&!s){const C=r.slice(y[0],y[1]+1);for(let D=v[0];D<=v[1];++D)if(E=is(i[D],C,a),h=Math.min(h,E),h===0)return h}else if(!t&&s){const C=i.slice(v[0],v[1]+1);for(let D=y[0];D<=y[1];++D)if(E=is(r[D],C,a),h=Math.min(h,E),h===0)return h}else E=me(r,y,i,v,a),h=Math.min(h,E)}else{const E=pl(y,t),C=pl(v,s);io(f,h,a,r,i,E[0],C[0]),io(f,h,a,r,i,E[0],C[1]),io(f,h,a,r,i,E[1],C[0]),io(f,h,a,r,i,E[1],C[1])}}return h}function xl(r){return r.type==="MultiPolygon"?r.coordinates.map((t=>({type:"Polygon",coordinates:t}))):r.type==="MultiLineString"?r.coordinates.map((t=>({type:"LineString",coordinates:t}))):r.type==="MultiPoint"?r.coordinates.map((t=>({type:"Point",coordinates:t}))):[r]}class rs{constructor(t,i){this.type=Ct,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(En(t[1])){const s=t[1];if(s.type==="FeatureCollection")return new rs(s,s.features.map((a=>xl(a.geometry))).flat());if(s.type==="Feature")return new rs(s,xl(s.geometry));if("type"in s&&"coordinates"in s)return new rs(s,xl(s))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(i,s){const a=i.geometry(),l=a.flat().map((g=>al([g.x,g.y],i.canonical)));if(a.length===0)return NaN;const h=new dl(l[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,no(l,!1,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,no(l,!1,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,ro(l,!1,g.coordinates,h,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="LineString")return(function(i,s){const a=i.geometry(),l=a.flat().map((g=>al([g.x,g.y],i.canonical)));if(a.length===0)return NaN;const h=new dl(l[0][1]);let f=1/0;for(const g of s){switch(g.type){case"Point":f=Math.min(f,no(l,!0,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,no(l,!0,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,ro(l,!0,g.coordinates,h,f))}if(f===0)return f}return f})(t,this.geometries);if(t.geometryType()==="Polygon")return(function(i,s){const a=i.geometry();if(a.length===0||a[0].length===0)return NaN;const l=ua(a,0).map((g=>g.map((y=>y.map((v=>al([v.x,v.y],i.canonical))))))),h=new dl(l[0][0][0][1]);let f=1/0;for(const g of s)for(const y of l){switch(g.type){case"Point":f=Math.min(f,ro([g.coordinates],!1,y,h,f));break;case"LineString":f=Math.min(f,ro(g.coordinates,!0,y,h,f));break;case"Polygon":f=Math.min(f,gh(y,g.coordinates,h,f))}if(f===0)return f}return f})(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class da{constructor(t){this.type=Kt,this.key=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);const s=t[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 t[1]} instead.`):new da(s)}evaluate(t){var i;const s=(i=t.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?rn(s,this.key):null}eachChild(){}outputDefined(){return!1}}const Ls={"==":Ya,"!=":nl,">":Lc,"<":oh,">=":Ja,"<=":Ka,array:qi,at:wr,boolean:qi,case:na,coalesce:zs,collator:Wi,format:ts,image:sl,in:ra,"index-of":Qn,interpolate:xi,"interpolate-hcl":xi,"interpolate-lab":xi,length:aa,let:he,literal:Cn,match:Wa,number:qi,"number-format":Qa,object:qi,slice:sa,step:Ds,string:qi,"to-boolean":$r,"to-color":$r,"to-number":$r,"to-string":$r,var:ks,within:es,distance:rs,"global-state":da};class or{constructor(t,i,s,a){this.name=t,this.type=i,this._evaluate=s,this.args=a}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){const s=t[0],a=or.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=h.filter((([y])=>!Array.isArray(y)||y.length===t.length-1));let g=null;for(const[y,v]of f){g=new As(i.registry,so,i.path,null,i.scope);const w=[];let S=!1;for(let E=1;E<t.length;E++){const C=t[E],D=Array.isArray(y)?y[E-1]:y.type,R=g.parse(C,1+w.length,D);if(!R){S=!0;break}w.push(R)}if(!S)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 C=Array.isArray(y)?y[E]:y.type,D=w[E];g.concat(E+1).checkSubtype(C,D.type)}if(g.errors.length===0)return new or(s,l,v,w)}}if(f.length===1)i.errors.push(...g.errors);else{const y=(f.length?f:h).map((([w])=>{return S=w,Array.isArray(S)?`(${S.map(Se).join(", ")})`:`(${Se(S.type)}...)`;var S})).join(" | "),v=[];for(let w=1;w<t.length;w++){const S=i.parse(t[w],1+v.length);if(!S)return null;v.push(Se(S.type))}i.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(t,i){or.definitions=i;for(const s in i)t[s]=or}}function Wc(r,[t,i,s,a]){t=t.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=a?a.evaluate(r):1,h=kc(t,i,s,l);if(h)throw new Pe(h);return new se(t/255,i/255,s/255,l,!1)}function Hc(r,t){return r in t}function vl(r,t){const i=t[r];return i===void 0?null:i}function ns(r){return{type:r}}function so(r){if(r instanceof ks)return so(r.boundExpression);if(r instanceof or&&r.name==="error"||r instanceof Wi||r instanceof es||r instanceof rs||r instanceof da)return!1;const t=r instanceof $r||r instanceof qi;let i=!0;return r.eachChild((s=>{i=t?i&&so(s):i&&s instanceof Cn})),!!i&&ao(r)&&oo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function ao(r){if(r instanceof or&&(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 es||r instanceof rs)return!1;let t=!0;return r.eachChild((i=>{t&&!ao(i)&&(t=!1)})),t}function pa(r){if(r instanceof or&&r.name==="feature-state")return!1;let t=!0;return r.eachChild((i=>{t&&!pa(i)&&(t=!1)})),t}function oo(r,t){if(r instanceof or&&t.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!oo(s,t)&&(i=!1)})),i}function Xc(r){return{result:"success",value:r}}function Fs(r){return{result:"error",value:r}}function Bs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Yc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function bl(r){return!!r.expression&&r.expression.interpolated}function ae(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function lo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Ce(r)===hi}function _h(r){return r}function Kc(r,t){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),a=r.type||(bl(t)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return se.parse;case"padding":return Ti.parse;case"numberArray":return Si.parse;case"colorArray":return ci.parse;default:return null}})(t);if(l&&((r=Ee({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[1])]))),r.default=l(r.default?r.default:t.default)),r.colorSpace&&(h=r.colorSpace)!=="rgb"&&h!=="hcl"&&h!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var h;const f=(function(v){switch(v){case"exponential":return Jc;case"interval":return yh;case"categorical":return wl;case"identity":return xh;default:throw new Error(`Unknown function type "${v}"`)}})(a);let g,y;if(a==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];y=typeof r.stops[0][0]}if(i){const v={},w=[];for(let C=0;C<r.stops.length;C++){const D=r.stops[C],R=D[0].zoom;v[R]===void 0&&(v[R]={zoom:R,type:r.type,property:r.property,default:r.default,stops:[]},w.push(R)),v[R].stops.push([D[0].value,D[1]])}const S=[];for(const C of w)S.push([v[C].zoom,Kc(v[C],t)]);const E={name:"linear"};return{kind:"composite",interpolationType:E,interpolationFactor:xi.interpolationFactor.bind(void 0,E),zoomStops:S.map((C=>C[0])),evaluate:({zoom:C},D)=>Jc({stops:S,base:r.base},t,C).evaluate(C,D)}}if(s){const v=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:xi.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((w=>w[0])),evaluate:({zoom:w})=>f(r,t,w,g,y)}}return{kind:"source",evaluate(v,w){const S=w&&w.properties?w.properties[r.property]:void 0;return S===void 0?fa(r.default,t.default):f(r,t,S,g,y)}}}function fa(r,t,i){return r!==void 0?r:t!==void 0?t:i!==void 0?i:void 0}function wl(r,t,i,s,a){return fa(typeof i===a?s[i]:void 0,r.default,t.default)}function yh(r,t,i){if(ae(i)!=="number")return fa(r.default,t.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 a=Ha(r.stops.map((l=>l[0])),i);return r.stops[a][1]}function Jc(r,t,i){const s=r.base!==void 0?r.base:1;if(ae(i)!=="number")return fa(r.default,t.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const l=Ha(r.stops.map((v=>v[0])),i),h=(function(v,w,S,E){const C=E-S,D=v-S;return C===0?0:w===1?D/C:(Math.pow(w,D)-1)/(Math.pow(w,C)-1)})(i,s,r.stops[l][0],r.stops[l+1][0]),f=r.stops[l][1],g=r.stops[l+1][1],y=Tr[t.type]||_h;return typeof f.evaluate=="function"?{evaluate(...v){const w=f.evaluate.apply(void 0,v),S=g.evaluate.apply(void 0,v);if(w!==void 0&&S!==void 0)return y(w,S,h,r.colorSpace)}}:y(f,g,h,r.colorSpace)}function xh(r,t,i){switch(t.type){case"color":i=se.parse(i);break;case"formatted":i=ei.fromString(i.toString());break;case"resolvedImage":i=Zi.fromString(i.toString());break;case"padding":i=Ti.parse(i);break;case"colorArray":i=ci.parse(i);break;case"numberArray":i=Si.parse(i);break;default:ae(i)===t.type||t.type==="enum"&&t.values[i]||(i=void 0)}return fa(i,r.default,t.default)}or.register(Ls,{error:[{kind:"error"},[Nt],(r,[t])=>{throw new Pe(t.evaluate(r))}],typeof:[Nt,[Kt],(r,[t])=>Se(Ce(t.evaluate(r)))],"to-rgba":[Ji(Ct,4),[$i],(r,[t])=>{const[i,s,a,l]=t.evaluate(r).rgb;return[255*i,255*s,255*a,l]}],rgb:[$i,[Ct,Ct,Ct],Wc],rgba:[$i,[Ct,Ct,Ct,Ct],Wc],has:{type:Xt,overloads:[[[Nt],(r,[t])=>Hc(t.evaluate(r),r.properties())],[[Nt,hi],(r,[t,i])=>Hc(t.evaluate(r),i.evaluate(r))]]},get:{type:Kt,overloads:[[[Nt],(r,[t])=>vl(t.evaluate(r),r.properties())],[[Nt,hi],(r,[t,i])=>vl(t.evaluate(r),i.evaluate(r))]]},"feature-state":[Kt,[Nt],(r,[t])=>vl(t.evaluate(r),r.featureState||{})],properties:[hi,[],r=>r.properties()],"geometry-type":[Nt,[],r=>r.geometryType()],id:[Kt,[],r=>r.id()],zoom:[Ct,[],r=>r.globals.zoom],"heatmap-density":[Ct,[],r=>r.globals.heatmapDensity||0],elevation:[Ct,[],r=>r.globals.elevation||0],"line-progress":[Ct,[],r=>r.globals.lineProgress||0],accumulated:[Kt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ct,ns(Ct),(r,t)=>{let i=0;for(const s of t)i+=s.evaluate(r);return i}],"*":[Ct,ns(Ct),(r,t)=>{let i=1;for(const s of t)i*=s.evaluate(r);return i}],"-":{type:Ct,overloads:[[[Ct,Ct],(r,[t,i])=>t.evaluate(r)-i.evaluate(r)],[[Ct],(r,[t])=>-t.evaluate(r)]]},"/":[Ct,[Ct,Ct],(r,[t,i])=>t.evaluate(r)/i.evaluate(r)],"%":[Ct,[Ct,Ct],(r,[t,i])=>t.evaluate(r)%i.evaluate(r)],ln2:[Ct,[],()=>Math.LN2],pi:[Ct,[],()=>Math.PI],e:[Ct,[],()=>Math.E],"^":[Ct,[Ct,Ct],(r,[t,i])=>Math.pow(t.evaluate(r),i.evaluate(r))],sqrt:[Ct,[Ct],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Ct,[Ct],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Ct,[Ct],(r,[t])=>Math.log(t.evaluate(r))],log2:[Ct,[Ct],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Ct,[Ct],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Ct,[Ct],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Ct,[Ct],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Ct,[Ct],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Ct,[Ct],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Ct,[Ct],(r,[t])=>Math.atan(t.evaluate(r))],min:[Ct,ns(Ct),(r,t)=>Math.min(...t.map((i=>i.evaluate(r))))],max:[Ct,ns(Ct),(r,t)=>Math.max(...t.map((i=>i.evaluate(r))))],abs:[Ct,[Ct],(r,[t])=>Math.abs(t.evaluate(r))],round:[Ct,[Ct],(r,[t])=>{const i=t.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[Ct,[Ct],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Ct,[Ct],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[Xt,[Nt,Kt],(r,[t,i])=>r.properties()[t.value]===i.value],"filter-id-==":[Xt,[Kt],(r,[t])=>r.id()===t.value],"filter-type-==":[Xt,[Nt],(r,[t])=>r.geometryType()===t.value],"filter-<":[Xt,[Nt,Kt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[Xt,[Kt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i<s}],"filter->":[Xt,[Nt,Kt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[Xt,[Kt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i>s}],"filter-<=":[Xt,[Nt,Kt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[Xt,[Kt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i<=s}],"filter->=":[Xt,[Nt,Kt],(r,[t,i])=>{const s=r.properties()[t.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[Xt,[Kt],(r,[t])=>{const i=r.id(),s=t.value;return typeof i==typeof s&&i>=s}],"filter-has":[Xt,[Kt],(r,[t])=>t.value in r.properties()],"filter-has-id":[Xt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Xt,[Ji(Nt)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[Xt,[Ji(Kt)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[Xt,[Nt,Ji(Kt)],(r,[t,i])=>i.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[Xt,[Nt,Ji(Kt)],(r,[t,i])=>(function(s,a,l,h){for(;l<=h;){const f=l+h>>1;if(a[f]===s)return!0;a[f]>s?h=f-1:l=f+1}return!1})(r.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Xt,overloads:[[[Xt,Xt],(r,[t,i])=>t.evaluate(r)&&i.evaluate(r)],[ns(Xt),(r,t)=>{for(const i of t)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Xt,overloads:[[[Xt,Xt],(r,[t,i])=>t.evaluate(r)||i.evaluate(r)],[ns(Xt),(r,t)=>{for(const i of t)if(i.evaluate(r))return!0;return!1}]]},"!":[Xt,[Xt],(r,[t])=>!t.evaluate(r)],"is-supported-script":[Xt,[Nt],(r,[t])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(t.evaluate(r))}],upcase:[Nt,[Nt],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[Nt,[Nt],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[Nt,ns(Kt),(r,t)=>t.map((i=>Cs(i.evaluate(r)))).join("")],"resolved-locale":[Nt,[en],(r,[t])=>t.evaluate(r).resolvedLocale()]});class co{constructor(t,i,s){this.expression=t,this._warningHistory={},this._evaluator=new ie,this._defaultValue=i?(function(a){if(a.type==="color"&&lo(a.default))return new se(0,0,0,0);switch(a.type){case"color":return se.parse(a.default)||null;case"padding":return Ti.parse(a.default)||null;case"numberArray":return Si.parse(a.default)||null;case"colorArray":return ci.parse(a.default)||null;case"variableAnchorOffsetCollection":return Fi.parse(a.default)||null;case"projectionDefinition":return Pi.parse(a.default)||null;default:return a.default===void 0?null:a.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(t,i,s,a,l,h){return this._globalState&&(t=Os(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(t,i,s,a,l,h){this._globalState&&(t=Os(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a,this._evaluator.availableImages=l||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 Pe(`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 uo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ls}function ho(r,t,i){const s=new As(Ls,so,[],t?(function(l){const h={color:$i,string:Nt,number:Ct,enum:Nt,boolean:Xt,formatted:Ts,padding:Ss,numberArray:Kn,colorArray:br,projectionDefinition:Yn,resolvedImage:Ps,variableAnchorOffsetCollection:Ms};return l.type==="array"?Ji(h[l.value]||Kt,l.length):h[l.type]})(t):void 0),a=s.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Xc(new co(a,t,i)):Fs(s.errors)}class ss{constructor(t,i,s){this.kind=t,this._styleExpression=i,this.isStateDependent=t!=="constant"&&!pa(i.expression),this.globalStateRefs=go(i.expression),this._globalState=s}evaluateWithoutErrorHandling(t,i,s,a,l,h){return this._globalState&&(t=Os(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,s,a,l,h)}evaluate(t,i,s,a,l,h){return this._globalState&&(t=Os(t,this._globalState)),this._styleExpression.evaluate(t,i,s,a,l,h)}}class po{constructor(t,i,s,a,l){this.kind=t,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=t!=="camera"&&!pa(i.expression),this.globalStateRefs=go(i.expression),this.interpolationType=a,this._globalState=l}evaluateWithoutErrorHandling(t,i,s,a,l,h){return this._globalState&&(t=Os(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,s,a,l,h)}evaluate(t,i,s,a,l,h){return this._globalState&&(t=Os(t,this._globalState)),this._styleExpression.evaluate(t,i,s,a,l,h)}interpolationFactor(t,i,s){return this.interpolationType?xi.interpolationFactor(this.interpolationType,t,i,s):0}}function Qc(r,t,i){const s=ho(r,t,i);if(s.result==="error")return s;const a=s.value.expression,l=ao(a);if(!l&&!Bs(t))return Fs([new we("","data expressions not supported")]);const h=oo(a,["zoom"]);if(!h&&!Yc(t))return Fs([new we("","zoom expressions not supported")]);const f=mo(a);return f||h?f instanceof we?Fs([f]):f instanceof xi&&!bl(t)?Fs([new we("",'"interpolate" expressions cannot be used with this property')]):Xc(f?new po(l?"camera":"composite",s.value,f.labels,f instanceof xi?f.interpolation:void 0,i):new ss(l?"constant":"source",s.value,i)):Fs([new we("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class fo{constructor(t,i){this._parameters=t,this._specification=i,Ee(this,Kc(this._parameters,this._specification))}static deserialize(t){return new fo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function mo(r){let t=null;if(r instanceof he)t=mo(r.result);else if(r instanceof zs){for(const i of r.args)if(t=mo(i),t)break}else(r instanceof Ds||r instanceof xi)&&r.input instanceof or&&r.input.name==="zoom"&&(t=r);return t instanceof we||r.eachChild((i=>{const s=mo(i);s instanceof we?t=s:!t&&s?t=new we("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new we("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function go(r,t=new Set){return r instanceof da&&t.add(r.key),r.eachChild((i=>{go(i,t)})),t}function Os(r,t){const{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:h,accumulated:f}=r??{};return{zoom:i,heatmapDensity:s,elevation:a,lineProgress:l,isSupportedScript:h,accumulated:f,globalState:t}}function _o(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 t of r.slice(1))if(!_o(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const tu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ma(r,t){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};_o(r)||(r=ga(r));const i=ho(r,tu,t);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,a,l)=>i.value.evaluate(s,a,{},l),needGeometry:Tl(r),getGlobalStateRefs:()=>go(i.value.expression)}}function vh(r,t){return r<t?-1:r>t?1:0}function Tl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(Tl(r[t]))return!0;return!1}function ga(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?yo(r[1],r[2],"=="):t==="!="?xo(yo(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?yo(r[1],r[2],t):t==="any"?(i=r.slice(1),["any"].concat(i.map(ga))):t==="all"?["all"].concat(r.slice(1).map(ga)):t==="none"?["all"].concat(r.slice(1).map(ga).map(xo)):t==="in"?eu(r[1],r.slice(2)):t==="!in"?xo(eu(r[1],r.slice(2))):t==="has"?iu(r[1]):t!=="!has"||xo(iu(r[1]));var i}function yo(r,t,i){switch(r){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,r,t]}}function eu(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((i=>typeof i!=typeof t[0]))?["filter-in-large",r,["literal",t.sort(vh)]]:["filter-in-small",r,["literal",t]]}}function iu(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function xo(r){return["!",r]}function Sl(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let a="[";for(const l of r)a+=`${Sl(l)},`;return`${a}]`}const i=Object.keys(r).sort();let s="{";for(let a=0;a<i.length;a++)s+=`${JSON.stringify(i[a])}:${Sl(r[i[a]])},`;return`${s}}`}function ru(r){let t="";for(const i of ct)t+=`/${Sl(r[i])}`;return t}function Pl(r){const t=r.value;return t?[new It(r.key,t,"constants have been deprecated as of v8")]:[]}function Be(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function nn(r){if(Array.isArray(r))return r.map(nn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const i in r)t[i]=nn(r[i]);return t}return Be(r)}function Hi(r){const t=r.key,i=r.value,s=r.valueSpec||{},a=r.objectElementValidators||{},l=r.style,h=r.styleSpec,f=r.validateSpec;let g=[];const y=ae(i);if(y!=="object")return[new It(t,i,`object expected, ${y} found`)];for(const v in i){const w=v.split(".")[0],S=rn(s,w)||s["*"];let E;if(rn(a,w))E=a[w];else if(rn(s,w))E=f;else if(a["*"])E=a["*"];else{if(!s["*"]){g.push(new It(t,i[v],`unknown property "${v}"`));continue}E=f}g=g.concat(E({key:(t&&`${t}.`)+v,value:i[v],valueSpec:S,style:l,styleSpec:h,object:i,objectKey:v,validateSpec:f},i))}for(const v in s)a[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new It(t,i,`missing required property "${v}"`));return g}function _a(r){const t=r.value,i=r.valueSpec,s=r.style,a=r.styleSpec,l=r.key,h=r.arrayElementValidator||r.validateSpec;if(ae(t)!=="array")return[new It(l,t,`array expected, ${ae(t)} found`)];if(i.length&&t.length!==i.length)return[new It(l,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new It(l,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let f={type:i.value,values:i.values};a.$version<7&&(f.function=i.function),ae(i.value)==="object"&&(f=i.value);let g=[];for(let y=0;y<t.length;y++)g=g.concat(h({array:t,arrayIndex:y,value:t[y],valueSpec:f,validateSpec:r.validateSpec,style:s,styleSpec:a,key:`${l}[${y}]`}));return g}function as(r){const t=r.key,i=r.value,s=r.valueSpec;let a=ae(i);return a==="number"&&i!=i&&(a="NaN"),a!=="number"?[new It(t,i,`number expected, ${a} found`)]:"minimum"in s&&i<s.minimum?[new It(t,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new It(t,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function nu(r){const t=r.valueSpec,i=Be(r.value.type);let s,a,l,h={};const f=i!=="categorical"&&r.value.property===void 0,g=!f,y=ae(r.value.stops)==="array"&&ae(r.value.stops[0])==="array"&&ae(r.value.stops[0][0])==="object",v=Hi({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 It(E.key,E.value,'identity function may not have a "stops" property')];let C=[];const D=E.value;return C=C.concat(_a({key:E.key,value:D,valueSpec:E.valueSpec,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,arrayElementValidator:w})),ae(D)==="array"&&D.length===0&&C.push(new It(E.key,D,"array must have at least one stop")),C},default:function(E){return E.validateSpec({key:E.key,value:E.value,valueSpec:t,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec})}}});return i==="identity"&&f&&v.push(new It(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new It(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!bl(r.valueSpec)&&v.push(new It(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Bs(r.valueSpec)?v.push(new It(r.key,r.value,"property functions not supported")):f&&!Yc(r.valueSpec)&&v.push(new It(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!y||r.value.property!==void 0||v.push(new It(r.key,r.value,'"property" property is required')),v;function w(E){let C=[];const D=E.value,R=E.key;if(ae(D)!=="array")return[new It(R,D,`array expected, ${ae(D)} found`)];if(D.length!==2)return[new It(R,D,`array length 2 expected, length ${D.length} found`)];if(y){if(ae(D[0])!=="object")return[new It(R,D,`object expected, ${ae(D[0])} found`)];if(D[0].zoom===void 0)return[new It(R,D,"object stop key must have zoom")];if(D[0].value===void 0)return[new It(R,D,"object stop key must have value")];if(l&&l>Be(D[0].zoom))return[new It(R,D[0].zoom,"stop zoom values must appear in ascending order")];Be(D[0].zoom)!==l&&(l=Be(D[0].zoom),a=void 0,h={}),C=C.concat(Hi({key:`${R}[0]`,value:D[0],valueSpec:{zoom:{}},validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec,objectElementValidators:{zoom:as,value:S}}))}else C=C.concat(S({key:`${R}[0]`,value:D[0],validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec},D));return uo(nn(D[1]))?C.concat([new It(`${R}[1]`,D[1],"expressions are not allowed in function stops.")]):C.concat(E.validateSpec({key:`${R}[1]`,value:D[1],valueSpec:t,validateSpec:E.validateSpec,style:E.style,styleSpec:E.styleSpec}))}function S(E,C){const D=ae(E.value),R=Be(E.value),V=E.value!==null?E.value:C;if(s){if(D!==s)return[new It(E.key,V,`${D} stop domain type must match previous stop domain type ${s}`)]}else s=D;if(D!=="number"&&D!=="string"&&D!=="boolean")return[new It(E.key,V,"stop domain value must be a number, string, or boolean")];if(D!=="number"&&i!=="categorical"){let X=`number expected, ${D} found`;return Bs(t)&&i===void 0&&(X+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new It(E.key,V,X)]}return i!=="categorical"||D!=="number"||isFinite(R)&&Math.floor(R)===R?i!=="categorical"&&D==="number"&&a!==void 0&&R<a?[new It(E.key,V,"stop domain values must appear in ascending order")]:(a=R,i==="categorical"&&R in h?[new It(E.key,V,"stop domain values must be unique")]:(h[R]=!0,[])):[new It(E.key,V,`integer expected, found ${R}`)]}}function js(r){const t=(r.expressionContext==="property"?Qc:ho)(nn(r.value),r.valueSpec);if(t.result==="error")return t.value.map((s=>new It(`${r.key}${s.key}`,r.value,s.message)));const i=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new It(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"&&!pa(i))return[new It(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!pa(i))return[new It(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!oo(i,["zoom","feature-state"]))return[new It(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!ao(i))return[new It(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ml(r){const t=r.key,i=r.value,s=ae(i);return s!=="string"?[new It(t,i,`color expected, ${s} found`)]:se.parse(String(i))?[]:[new It(t,i,`color expected, "${i}" found`)]}function ya(r){const t=r.key,i=r.value,s=r.valueSpec,a=[];return Array.isArray(s.values)?s.values.indexOf(Be(i))===-1&&a.push(new It(t,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(Be(i))===-1&&a.push(new It(t,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function Il(r){return _o(nn(r.value))?js(Ee({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):su(r)}function su(r){const t=r.value,i=r.key;if(ae(t)!=="array")return[new It(i,t,`array expected, ${ae(t)} found`)];const s=r.styleSpec;let a,l=[];if(t.length<1)return[new It(i,t,"filter array must have at least 1 element")];switch(l=l.concat(ya({key:`${i}[0]`,value:t[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),Be(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Be(t[1])==="$type"&&l.push(new It(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&l.push(new It(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=ae(t[1]),a!=="string"&&l.push(new It(`${i}[1]`,t[1],`string expected, ${a} found`)));for(let h=2;h<t.length;h++)a=ae(t[h]),Be(t[1])==="$type"?l=l.concat(ya({key:`${i}[${h}]`,value:t[h],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&l.push(new It(`${i}[${h}]`,t[h],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let h=1;h<t.length;h++)l=l.concat(su({key:`${i}[${h}]`,value:t[h],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":a=ae(t[1]),t.length!==2?l.push(new It(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):a!=="string"&&l.push(new It(`${i}[1]`,t[1],`string expected, ${a} found`))}return l}function El(r,t){const i=r.key,s=r.validateSpec,a=r.style,l=r.styleSpec,h=r.value,f=r.objectKey,g=l[`${t}_${r.layerType}`];if(!g)return[];const y=f.match(/^(.*)-transition$/);if(t==="paint"&&y&&g[y[1]]&&g[y[1]].transition)return s({key:i,value:h,valueSpec:l.transition,style:a,styleSpec:l});const v=r.valueSpec||g[f];if(!v)return[new It(i,h,`unknown property "${f}"`)];let w;if(ae(h)==="string"&&Bs(v)&&!v.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new It(i,h,`"${f}" does not support interpolation syntax
|
|
2
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const S=[];return r.layerType==="symbol"&&f==="text-font"&&lo(nn(h))&&Be(h.type)==="identity"&&S.push(new It(i,h,'"text-font" does not support identity functions')),S.concat(s({key:r.key,value:h,valueSpec:v,style:a,styleSpec:l,expressionContext:"property",propertyType:t,propertyKey:f}))}function Cl(r){return El(r,"paint")}function xa(r){return El(r,"layout")}function au(r){let t=[];const i=r.value,s=r.key,a=r.style,l=r.styleSpec;if(ae(i)!=="object")return[new It(s,i,`object expected, ${ae(i)} found`)];i.type||i.ref||t.push(new It(s,i,'either "type" or "ref" is required'));let h=Be(i.type);const f=Be(i.ref);if(i.id){const g=Be(i.id);for(let y=0;y<r.arrayIndex;y++){const v=a.layers[y];Be(v.id)===g&&t.push(new It(s,i.id,`duplicate layer id "${i.id}", previously used at line ${v.id.__line__}`))}}if("ref"in i){let g;["type","source","source-layer","filter","layout"].forEach((y=>{y in i&&t.push(new It(s,i[y],`"${y}" is prohibited for ref layers`))})),a.layers.forEach((y=>{Be(y.id)===f&&(g=y)})),g?g.ref?t.push(new It(s,i.ref,"ref cannot reference another ref layer")):h=Be(g.type):t.push(new It(s,i.ref,`ref layer "${f}" not found`))}else if(h!=="background")if(i.source){const g=a.sources&&a.sources[i.source],y=g&&Be(g.type);g?y==="vector"&&h==="raster"?t.push(new It(s,i.source,`layer "${i.id}" requires a raster source`)):y!=="raster-dem"&&h==="hillshade"||y!=="raster-dem"&&h==="color-relief"?t.push(new It(s,i.source,`layer "${i.id}" requires a raster-dem source`)):y==="raster"&&h!=="raster"?t.push(new It(s,i.source,`layer "${i.id}" requires a vector source`)):y!=="vector"||i["source-layer"]?y==="raster-dem"&&h!=="hillshade"&&h!=="color-relief"?t.push(new It(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||t.push(new It(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new It(s,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new It(s,i.source,`source "${i.source}" not found`))}else t.push(new It(s,i,'missing required property "source"'));return t=t.concat(Hi({key:s,value:i,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${s}.type`,value:i.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:i,objectKey:"type"}),filter:Il,layout:g=>Hi({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>xa(Ee({layerType:h},y))}}),paint:g=>Hi({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>Cl(Ee({layerType:h},y))}})}})),t}function kn(r){const t=r.value,i=r.key,s=ae(t);return s!=="string"?[new It(i,t,`string expected, ${s} found`)]:[]}const Al={promoteId:function({key:r,value:t}){if(ae(t)==="string")return kn({key:r,value:t});{const i=[];for(const s in t)i.push(...kn({key:`${r}.${s}`,value:t[s]}));return i}}};function ou(r){const t=r.value,i=r.key,s=r.styleSpec,a=r.style,l=r.validateSpec;if(!t.type)return[new It(i,t,'"type" is required')];const h=Be(t.type);let f;switch(h){case"vector":case"raster":return f=Hi({key:i,value:t,valueSpec:s[`source_${h.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:Al,validateSpec:l}),f;case"raster-dem":return f=(function(g){var y;const v=(y=g.sourceName)!==null&&y!==void 0?y:"",w=g.value,S=g.styleSpec,E=S.source_raster_dem,C=g.style;let D=[];const R=ae(w);if(w===void 0)return D;if(R!=="object")return D.push(new It("source_raster_dem",w,`object expected, ${R} found`)),D;const V=Be(w.encoding)==="custom",X=["redFactor","greenFactor","blueFactor","baseShift"],G=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const q in w)!V&&X.includes(q)?D.push(new It(q,w[q],`In "${v}": "${q}" is only valid when "encoding" is set to "custom". ${G} encoding found`)):E[q]?D=D.concat(g.validateSpec({key:q,value:w[q],valueSpec:E[q],validateSpec:g.validateSpec,style:C,styleSpec:S})):D.push(new It(q,w[q],`unknown property "${q}"`));return D})({sourceName:i,value:t,style:r.style,styleSpec:s,validateSpec:l}),f;case"geojson":if(f=Hi({key:i,value:t,valueSpec:s.source_geojson,style:a,styleSpec:s,validateSpec:l,objectElementValidators:Al}),t.cluster)for(const g in t.clusterProperties){const[y,v]=t.clusterProperties[g],w=typeof y=="string"?[y,["accumulated"],["get",g]]:y;f.push(...js({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),f.push(...js({key:`${i}.${g}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return f;case"video":return Hi({key:i,value:t,valueSpec:s.source_video,style:a,validateSpec:l,styleSpec:s});case"image":return Hi({key:i,value:t,valueSpec:s.source_image,style:a,validateSpec:l,styleSpec:s});case"canvas":return[new It(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ya({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function kl(r){const t=r.value,i=r.styleSpec,s=i.light,a=r.style;let l=[];const h=ae(t);if(t===void 0)return l;if(h!=="object")return l=l.concat([new It("light",t,`object expected, ${h} found`)]),l;for(const f in t){const g=f.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:f,value:t[f],valueSpec:i.transition,validateSpec:r.validateSpec,style:a,styleSpec:i}):s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new It(f,t[f],`unknown property "${f}"`)])}return l}function Dl(r){const t=r.value,i=r.styleSpec,s=i.sky,a=r.style,l=ae(t);if(t===void 0)return[];if(l!=="object")return[new It("sky",t,`object expected, ${l} found`)];let h=[];for(const f in t)h=h.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],style:a,styleSpec:i}):[new It(f,t[f],`unknown property "${f}"`)]);return h}function Ns(r){const t=r.value,i=r.styleSpec,s=i.terrain,a=r.style;let l=[];const h=ae(t);if(t===void 0)return l;if(h!=="object")return l=l.concat([new It("terrain",t,`object expected, ${h} found`)]),l;for(const f in t)l=l.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:r.validateSpec,style:a,styleSpec:i}):[new It(f,t[f],`unknown property "${f}"`)]);return l}function lu(r){let t=[];const i=r.value,s=r.key;if(Array.isArray(i)){const a=[],l=[];for(const h in i)i[h].id&&a.includes(i[h].id)&&t.push(new It(s,i,`all the sprites' ids must be unique, but ${i[h].id} is duplicated`)),a.push(i[h].id),i[h].url&&l.includes(i[h].url)&&t.push(new It(s,i,`all the sprites' URLs must be unique, but ${i[h].url} is duplicated`)),l.push(i[h].url),t=t.concat(Hi({key:`${s}[${h}]`,value:i[h],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return kn({key:s,value:i})}function cu(r){return t=r.value,t&&t.constructor===Object?[]:[new It(r.key,r.value,`object expected, ${ae(r.value)} found`)];var t}const uu={"*":()=>[],array:_a,boolean:function(r){const t=r.value,i=r.key,s=ae(t);return s!=="boolean"?[new It(i,t,`boolean expected, ${s} found`)]:[]},number:as,color:Ml,constants:Pl,enum:ya,filter:Il,function:nu,layer:au,object:Hi,source:ou,light:kl,sky:Dl,terrain:Ns,projection:function(r){const t=r.value,i=r.styleSpec,s=i.projection,a=r.style,l=ae(t);if(t===void 0)return[];if(l!=="object")return[new It("projection",t,`object expected, ${l} found`)];let h=[];for(const f in t)h=h.concat(s[f]?r.validateSpec({key:f,value:t[f],valueSpec:s[f],style:a,styleSpec:i}):[new It(f,t[f],`unknown property "${f}"`)]);return h},projectionDefinition:function(r){const t=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=ae(i);return s!=="array"||(function(a){return Array.isArray(a)&&a.length===3&&typeof a[0]=="string"&&typeof a[1]=="string"&&typeof a[2]=="number"})(i)||(function(a){return!!["interpolate","step","literal"].includes(a[0])})(i)?["array","string"].includes(s)?[]:[new It(t,i,`projection expected, invalid type "${s}" found`)]:[new It(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:kn,formatted:function(r){return kn(r).length===0?[]:js(r)},resolvedImage:function(r){return kn(r).length===0?[]:js(r)},padding:function(r){const t=r.key,i=r.value;if(ae(i)==="array"){if(i.length<1||i.length>4)return[new It(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${t}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return as({key:t,value:i,valueSpec:{}})},numberArray:function(r){const t=r.key,i=r.value;if(ae(i)==="array"){const s={type:"number"};if(i.length<1)return[new It(t,i,"array length at least 1 expected, length 0 found")];let a=[];for(let l=0;l<i.length;l++)a=a.concat(r.validateSpec({key:`${t}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return a}return as({key:t,value:i,valueSpec:{}})},colorArray:function(r){const t=r.key,i=r.value;if(ae(i)==="array"){if(i.length<1)return[new It(t,i,"array length at least 1 expected, length 0 found")];let s=[];for(let a=0;a<i.length;a++)s=s.concat(Ml({key:`${t}[${a}]`,value:i[a]}));return s}return Ml({key:t,value:i})},variableAnchorOffsetCollection:function(r){const t=r.key,i=r.value,s=ae(i),a=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new It(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let h=0;h<i.length;h+=2)l=l.concat(ya({key:`${t}[${h}]`,value:i[h],valueSpec:a.layout_symbol["text-anchor"]})),l=l.concat(_a({key:`${t}[${h+1}]`,value:i[h+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:a}));return l},sprite:lu,state:cu};function vo(r){const t=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=vo,i.expression&&lo(Be(t))?nu(r):i.expression&&uo(nn(t))?js(r):i.type&&uu[i.type]?uu[i.type](r):Hi(Ee({},r,{valueSpec:i.type?s[i.type]:i}))}function hu(r){const t=r.value,i=r.key,s=kn(r);return s.length||(t.indexOf("{fontstack}")===-1&&s.push(new It(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&s.push(new It(i,t,'"glyphs" url must include a "{range}" token'))),s}function lr(r,t=W){let i=[];return i=i.concat(vo({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:vo,objectElementValidators:{glyphs:hu,"*":()=>[]}})),r.constants&&(i=i.concat(Pl({key:"constants",value:r.constants}))),Vs(i)}function Bi(r){return function(t){return r(Object.assign({},t,{validateSpec:vo}))}}function Vs(r){return[].concat(r).sort(((t,i)=>t.line-i.line))}function Ue(r){return function(...t){return Vs(r.apply(this,t))}}lr.source=Ue(Bi(ou)),lr.sprite=Ue(Bi(lu)),lr.glyphs=Ue(Bi(hu)),lr.light=Ue(Bi(kl)),lr.sky=Ue(Bi(Dl)),lr.terrain=Ue(Bi(Ns)),lr.state=Ue(Bi(cu)),lr.layer=Ue(Bi(au)),lr.filter=Ue(Bi(Il)),lr.paintProperty=Ue(Bi(Cl)),lr.layoutProperty=Ue(Bi(xa));const va=W,os=lr,bh=os.light,wh=os.sky,ba=os.paintProperty,du=os.layoutProperty;function bo(r,t){let i=!1;if(t&&t.length)for(const s of t)r.fire(new tt(new Error(s.message))),i=!0;return i}class wa{constructor(t,i,s){const a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const h=new Int32Array(this.arrayBuffer);t=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],v=h[3+g+1];a.push(y===v?null:h.subarray(y,v))}const f=h[3+a.length+1];this.keys=h.subarray(h[3+a.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++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=s,this.scale=i/t,this.uid=0;const l=s/i*t;this.min=-l,this.max=t+l}insert(t,i,s,a,l){this._forEachCell(i,s,a,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,s,a,l,h){this.cells[l].push(h)}query(t,i,s,a,l){const h=this.min,f=this.max;if(t<=h&&i<=h&&f<=s&&f<=a&&!l)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(t,i,s,a,this._queryCell,g,{},l),g}}_queryCell(t,i,s,a,l,h,f,g){const y=this.cells[l];if(y!==null){const v=this.keys,w=this.bboxes;for(let S=0;S<y.length;S++){const E=y[S];if(f[E]===void 0){const C=4*E;(g?g(w[C+0],w[C+1],w[C+2],w[C+3]):t<=w[C+2]&&i<=w[C+3]&&s>=w[C+0]&&a>=w[C+1])?(f[E]=!0,h.push(v[E])):f[E]=!1}}}}_forEachCell(t,i,s,a,l,h,f,g){const y=this._convertToCellCoord(t),v=this._convertToCellCoord(i),w=this._convertToCellCoord(s),S=this._convertToCellCoord(a);for(let E=y;E<=w;E++)for(let C=v;C<=S;C++){const D=this.d*C+E;if((!g||g(this._convertFromCellCoord(E),this._convertFromCellCoord(C),this._convertFromCellCoord(E+1),this._convertFromCellCoord(C+1)))&&l.call(this,t,i,s,a,D,h,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,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 a=new Int32Array(i+s+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let l=i;for(let h=0;h<t.length;h++){const f=t[h];a[3+h]=l,a.set(f,l),l+=f.length}return a[3+t.length]=l,a.set(this.keys,l),l+=this.keys.length,a[3+t.length+1]=l,a.set(this.bboxes,l),l+=this.bboxes.length,a.buffer}static serialize(t,i){const s=t.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(t){return new wa(t.buffer)}}const Pr={};function Lt(r,t,i={}){if(Pr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),Pr[r]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}Lt("Object",Object),Lt("Set",Set),Lt("TransferableGridIndex",wa),Lt("Color",se),Lt("Error",Error),Lt("AJAXError",vr),Lt("ResolvedImage",Zi),Lt("StylePropertyFunction",fo),Lt("StyleExpression",co,{omit:["_evaluator"]}),Lt("ZoomDependentExpression",po),Lt("ZoomConstantExpression",ss),Lt("CompoundExpression",or,{omit:["_evaluate"]});for(const r in Ls)Ls[r]._classRegistryKey||Lt(`Expression_${r}`,Ls[r]);function Us(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function zl(r){return r.$name||r.constructor._classRegistryKey}function pu(r){return!(function(t){if(t===null||typeof t!="object")return!1;const i=zl(t);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||Us(r)||jr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Ta(r,t){if(pu(r))return(Us(r)||jr(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const h of r)l.push(Ta(h,t));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=zl(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Pr[i])throw new Error(`${i} is not registered.`);const{klass:s}=Pr[i],a=s.serialize?s.serialize(r,t):{};if(s.serialize){if(t&&a===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||Pr[i].omit.indexOf(l)>=0)continue;const h=r[l];a[l]=Pr[i].shallow.indexOf(l)>=0?h:Ta(h,t)}r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function sn(r){if(pu(r))return r;if(Array.isArray(r))return r.map(sn);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=zl(r)||"Object";if(!Pr[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=Pr[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r)){if(a==="$name")continue;const l=r[a];s[a]=Pr[t].shallow.indexOf(a)>=0?l:sn(l)}return s}class Rl{constructor(){this.first=!0}update(t,i){const s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=s,!0))}}function Th(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 Gs(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 fu(r){return/\s/u.test(String.fromCodePoint(r))}function Sa(r){for(const t of r)if(Gs(t.codePointAt(0)))return!0;return!1}function wo(r){for(const t of r)if(!gu(t.codePointAt(0)))return!1;return!0}function Ll(r){const t=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(t.join("|"),"u")}const mu=Ll(["Arab","Dupl","Mong","Ougr","Syrc"]);function gu(r){return!mu.test(String.fromCodePoint(r))}function Fl(r){return!(Gs(r)||(t=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(t))));var t}const Bl=Ll(["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 Ol(r){return Bl.test(String.fromCodePoint(r))}function Sh(r,t){return!(!t&&Ol(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function _u(r){for(const t of r)if(Ol(t.codePointAt(0)))return!0;return!1}const Dn=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(Dn.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,t){return c(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((l=>{this.loadScriptResolve=l}));t(i);const a=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([s,a]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class ge{constructor(t,i){this.isSupportedScript=Ph,this.zoom=t,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Rl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Rl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,i=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function Ph(r){return(function(t,i){for(const s of t)if(!Sh(s.codePointAt(0),i))return!1;return!0})(r,Dn.getRTLTextPluginStatus()==="loaded")}const Pa="-transition";class Ma{constructor(t,i,s){this.property=t,this.value=i,this.expression=(function(a,l,h){if(lo(a))return new fo(a,l);if(uo(a)){const f=Qc(a,l,h);if(f.result==="error")throw new Error(f.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return f.value}{let f=a;return l.type==="color"&&typeof a=="string"?f=se.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?l.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?f=Fi.parse(a):l.type==="projectionDefinition"&&typeof a=="string"&&(f=Pi.parse(a)):f=ci.parse(a):f=Si.parse(a):f=Ti.parse(a),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>f}}})(i===void 0?t.specification.default:i,t.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,i,s){return this.property.possiblyEvaluate(this,t,i,s)}}class jl{constructor(t,i){this.property=t,this.value=new Ma(t,void 0,i)}transitioned(t,i){return new Nl(this.property,this.value,i,li({},t.transition,this.transition),t.now)}untransitioned(){return new Nl(this.property,this.value,null,{},0)}}class yu{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i}getValue(t){return Li(this._values[t].value.value)}setValue(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new jl(this._values[t].property,this._globalState)),this._values[t].value=new Ma(this._values[t].property,i===null?void 0:Li(i),this._globalState)}getTransition(t){return Li(this._values[t].transition)}setTransition(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new jl(this._values[t].property,this._globalState)),this._values[t].transition=Li(i)||void 0}serialize(){const t={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(t[i]=s);const a=this.getTransition(i);a!==void 0&&(t[`${i}${Pa}`]=a)}return t}transitioned(t,i){const s=new Vl(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(t,i._values[a]);return s}untransitioned(){const t=new Vl(this._properties);for(const i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}}class Nl{constructor(t,i,s,a,l){this.property=t,this.value=i,this.begin=l+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(t,i,s){const a=t.now||0,l=this.value.possiblyEvaluate(t,i,s),h=this.prior;if(h){if(a>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(a<this.begin)return h.possiblyEvaluate(t,i,s);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(t,i,s),l,_r(f))}}return l}}class Vl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,s){const a=new ls(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(t,i,s);return a}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class xu{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Li(this._values[t].value)}setValue(t,i){this._values[t]=new Ma(this._values[t].property,i===null?void 0:Li(i),this._globalState)}serialize(){const t={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(t[i]=s)}return t}possiblyEvaluate(t,i,s){const a=new ls(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(t,i,s);return a}}class Mr{constructor(t,i,s){this.property=t,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,i,s,a){return this.property.evaluate(this.value,this.parameters,t,i,s,a)}}class ls{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Vt{constructor(t){this.specification=t}possiblyEvaluate(t,i){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(i)}interpolate(t,i,s){const a=Tr[this.specification.type];return a?a(t,i,s):t}}class Wt{constructor(t,i){this.specification=t,this.overrides=i}possiblyEvaluate(t,i,s,a){return new Mr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(i,null,{},s,a)}:t.expression,i)}interpolate(t,i,s){if(t.value.kind!=="constant"||i.value.kind!=="constant")return t;if(t.value.value===void 0||i.value.value===void 0)return new Mr(this,{kind:"constant",value:void 0},t.parameters);const a=Tr[this.specification.type];if(a){const l=a(t.value.value,i.value.value,s);return new Mr(this,{kind:"constant",value:l},t.parameters)}return t}evaluate(t,i,s,a,l,h){return t.kind==="constant"?t.value:t.evaluate(i,s,a,l,h)}}class Ia extends Wt{possiblyEvaluate(t,i,s,a){if(t.value===void 0)return new Mr(this,{kind:"constant",value:void 0},i);if(t.expression.kind==="constant"){const l=t.expression.evaluate(i,null,{},s,a),h=t.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,f=this._calculate(h,h,h,i);return new Mr(this,{kind:"constant",value:f},i)}if(t.expression.kind==="camera"){const l=this._calculate(t.expression.evaluate({zoom:i.zoom-1}),t.expression.evaluate({zoom:i.zoom}),t.expression.evaluate({zoom:i.zoom+1}),i);return new Mr(this,{kind:"constant",value:l},i)}return new Mr(this,t.expression,i)}evaluate(t,i,s,a,l,h){if(t.kind==="source"){const f=t.evaluate(i,s,a,l,h);return this._calculate(f,f,f,i)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(i.zoom)-1},s,a),t.evaluate({zoom:Math.floor(i.zoom)},s,a),t.evaluate({zoom:Math.floor(i.zoom)+1},s,a),i):t.value}_calculate(t,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:s,to:i}}interpolate(t){return t}}class vu{constructor(t){this.specification=t}possiblyEvaluate(t,i,s,a){if(t.value!==void 0){if(t.expression.kind==="constant"){const l=t.expression.evaluate(i,null,{},s,a);return this._calculate(l,l,l,i)}return this._calculate(t.expression.evaluate(new ge(Math.floor(i.zoom-1),i)),t.expression.evaluate(new ge(Math.floor(i.zoom),i)),t.expression.evaluate(new ge(Math.floor(i.zoom+1),i)),i)}}_calculate(t,i,s,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:s,to:i}}interpolate(t){return t}}class Ea{constructor(t){this.specification=t}possiblyEvaluate(t,i,s,a){return!!t.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class Mi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in t){const s=t[i];s.specification.overridable&&this.overridableProperties.push(i);const a=this.defaultPropertyValues[i]=new Ma(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new jl(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}}Lt("DataDrivenProperty",Wt),Lt("DataConstantProperty",Vt),Lt("CrossFadedDataDrivenProperty",Ia),Lt("CrossFadedProperty",vu),Lt("ColorRampProperty",Ea);class cr extends ut{constructor(t,i,s){if(super(),this.id=t.id,this.type=t.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=ma(t.filter,s)),i.layout&&(this._unevaluatedLayout=new xu(i.layout,s)),i.paint)){this._transitionablePaint=new yu(i.paint,s);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ls(i.paint)}}setFilter(t){this.filter=t,this._featureFilter=ma(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const a of s.getGlobalStateRefs())t.add(a)}for(const i of this._featureFilter.getGlobalStateRefs())t.add(i);return t}getPaintAffectingGlobalStateRefs(){var t;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const a=this._transitionablePaint._values[s].value;for(const l of a.getGlobalStateRefs()){const h=(t=i.get(l))!==null&&t!==void 0?t:[];h.push({name:s,value:a.value}),i.set(l,h)}}return i}setLayoutProperty(t,i,s={}){i!=null&&this._validate(du,`layers.${this.id}.layout.${t}`,t,i,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,i):this.visibility=i)}getPaintProperty(t){return t.endsWith(Pa)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,i,s={}){if(i!=null&&this._validate(ba,`layers.${this.id}.paint.${t}`,t,i,s))return!1;if(t.endsWith(Pa))return this._transitionablePaint.setTransition(t.slice(0,-11),i||void 0),!1;{const a=this._transitionablePaint._values[t],l=a.property.specification["property-type"]==="cross-faded-data-driven",h=a.value.isDataDriven(),f=a.value;this._transitionablePaint.setValue(t,i),this._handleSpecialPaintPropertyUpdate(t);const g=this._transitionablePaint._values[t].value;return g.isDataDriven()||h||l||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,i,s){return!1}isHidden(t,i=!1){return!!(this.minzoom&&t<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,i){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Br(t,((i,s)=>!(i===void 0||s==="layout"&&!Object.keys(i).length||s==="paint"&&!Object.keys(i).length)))}_validate(t,i,s,a,l={}){return(!l||l.validate!==!1)&&bo(this,t.call(os,{key:i,layerType:this.type,objectKey:s,value:a,styleSpec:W,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const i=this.paint.get(t);if(i instanceof Mr&&Bs(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let bu;var Mh={get paint(){return bu=bu||new Mi({"raster-opacity":new Vt(W.paint_raster["raster-opacity"]),"raster-hue-rotate":new Vt(W.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Vt(W.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Vt(W.paint_raster["raster-brightness-max"]),"raster-saturation":new Vt(W.paint_raster["raster-saturation"]),"raster-contrast":new Vt(W.paint_raster["raster-contrast"]),"raster-resampling":new Vt(W.paint_raster["raster-resampling"]),"raster-fade-duration":new Vt(W.paint_raster["raster-fade-duration"])})}};class Ih extends cr{constructor(t,i){super(t,Mh,i)}}const Eh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ca{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _e{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&&(t.isTransferred=!0,i.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function qe(r,t=1){let i=0,s=0;return{members:r.map((a=>{const l=Eh[a.type].BYTES_PER_ELEMENT,h=i=wu(i,Math.max(t,l)),f=a.components||1;return s=Math.max(s,l),i+=l*f,{name:a.name,type:a.type,components:f,offset:h}})),size:wu(i,Math.max(s,t)),alignment:t}}function wu(r,t){return Math.ceil(r/t)*t}class Aa extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.int16[a+0]=i,this.int16[a+1]=s,t}}Aa.prototype.bytesPerElement=4,Lt("StructArrayLayout2i4",Aa);class ka extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=a,t}}ka.prototype.bytesPerElement=6,Lt("StructArrayLayout3i6",ka);class Ul extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,s,a)}emplace(t,i,s,a,l){const h=4*t;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,this.int16[h+3]=l,t}}Ul.prototype.bytesPerElement=8,Lt("StructArrayLayout4i8",Ul);class Gl extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,h)}emplace(t,i,s,a,l,h,f){const g=6*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=h,this.int16[g+5]=f,t}}Gl.prototype.bytesPerElement=12,Lt("StructArrayLayout2i4i12",Gl);class an extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,h)}emplace(t,i,s,a,l,h,f){const g=4*t,y=8*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[y+4]=a,this.uint8[y+5]=l,this.uint8[y+6]=h,this.uint8[y+7]=f,t}}an.prototype.bytesPerElement=8,Lt("StructArrayLayout2i4ub8",an);class $s extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.float32[a+0]=i,this.float32[a+1]=s,t}}$s.prototype.bytesPerElement=8,Lt("StructArrayLayout2f8",$s);class Da extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g,y,v){const w=this.length;return this.resize(w+1),this.emplace(w,t,i,s,a,l,h,f,g,y,v)}emplace(t,i,s,a,l,h,f,g,y,v,w){const S=10*t;return this.uint16[S+0]=i,this.uint16[S+1]=s,this.uint16[S+2]=a,this.uint16[S+3]=l,this.uint16[S+4]=h,this.uint16[S+5]=f,this.uint16[S+6]=g,this.uint16[S+7]=y,this.uint16[S+8]=v,this.uint16[S+9]=w,t}}Da.prototype.bytesPerElement=20,Lt("StructArrayLayout10ui20",Da);class To extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g){const y=this.length;return this.resize(y+1),this.emplace(y,t,i,s,a,l,h,f,g)}emplace(t,i,s,a,l,h,f,g,y){const v=8*t;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=a,this.uint16[v+3]=l,this.uint16[v+4]=h,this.uint16[v+5]=f,this.uint16[v+6]=g,this.uint16[v+7]=y,t}}To.prototype.bytesPerElement=16,Lt("StructArrayLayout8ui16",To);class za extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g,y,v,w,S){const E=this.length;return this.resize(E+1),this.emplace(E,t,i,s,a,l,h,f,g,y,v,w,S)}emplace(t,i,s,a,l,h,f,g,y,v,w,S,E){const C=12*t;return this.int16[C+0]=i,this.int16[C+1]=s,this.int16[C+2]=a,this.int16[C+3]=l,this.uint16[C+4]=h,this.uint16[C+5]=f,this.uint16[C+6]=g,this.uint16[C+7]=y,this.int16[C+8]=v,this.int16[C+9]=w,this.int16[C+10]=S,this.int16[C+11]=E,t}}za.prototype.bytesPerElement=24,Lt("StructArrayLayout4i4ui4i24",za);class $l extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,t}}$l.prototype.bytesPerElement=12,Lt("StructArrayLayout3f12",$l);class Zs extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint32[1*t+0]=i,t}}Zs.prototype.bytesPerElement=4,Lt("StructArrayLayout1ul4",Zs);class cs extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g,y){const v=this.length;return this.resize(v+1),this.emplace(v,t,i,s,a,l,h,f,g,y)}emplace(t,i,s,a,l,h,f,g,y,v){const w=10*t,S=5*t;return this.int16[w+0]=i,this.int16[w+1]=s,this.int16[w+2]=a,this.int16[w+3]=l,this.int16[w+4]=h,this.int16[w+5]=f,this.uint32[S+3]=g,this.uint16[w+8]=y,this.uint16[w+9]=v,t}}cs.prototype.bytesPerElement=20,Lt("StructArrayLayout6i1ul2ui20",cs);class Zl extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,h)}emplace(t,i,s,a,l,h,f){const g=6*t;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+3]=l,this.int16[g+4]=h,this.int16[g+5]=f,t}}Zl.prototype.bytesPerElement=12,Lt("StructArrayLayout2i2i2i12",Zl);class So extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,i,s,a,l)}emplace(t,i,s,a,l,h){const f=4*t,g=8*t;return this.float32[f+0]=i,this.float32[f+1]=s,this.float32[f+2]=a,this.int16[g+6]=l,this.int16[g+7]=h,t}}So.prototype.bytesPerElement=16,Lt("StructArrayLayout2f1f2i16",So);class us extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h){const f=this.length;return this.resize(f+1),this.emplace(f,t,i,s,a,l,h)}emplace(t,i,s,a,l,h,f){const g=16*t,y=4*t,v=8*t;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[y+1]=a,this.float32[y+2]=l,this.int16[v+6]=h,this.int16[v+7]=f,t}}us.prototype.bytesPerElement=16,Lt("StructArrayLayout2ub2f2i16",us);class Po extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=a,t}}Po.prototype.bytesPerElement=6,Lt("StructArrayLayout3ui6",Po);class ql extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V){const X=this.length;return this.resize(X+1),this.emplace(X,t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V)}emplace(t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V,X){const G=24*t,q=12*t,st=48*t;return this.int16[G+0]=i,this.int16[G+1]=s,this.uint16[G+2]=a,this.uint16[G+3]=l,this.uint32[q+2]=h,this.uint32[q+3]=f,this.uint32[q+4]=g,this.uint16[G+10]=y,this.uint16[G+11]=v,this.uint16[G+12]=w,this.float32[q+7]=S,this.float32[q+8]=E,this.uint8[st+36]=C,this.uint8[st+37]=D,this.uint8[st+38]=R,this.uint32[q+10]=V,this.int16[G+22]=X,t}}ql.prototype.bytesPerElement=48,Lt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ql);class Mo extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V,X,G,q,st,ot,mt,Pt,wt,Mt,zt,At){const kt=this.length;return this.resize(kt+1),this.emplace(kt,t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V,X,G,q,st,ot,mt,Pt,wt,Mt,zt,At)}emplace(t,i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V,X,G,q,st,ot,mt,Pt,wt,Mt,zt,At,kt){const Tt=32*t,Ut=16*t;return this.int16[Tt+0]=i,this.int16[Tt+1]=s,this.int16[Tt+2]=a,this.int16[Tt+3]=l,this.int16[Tt+4]=h,this.int16[Tt+5]=f,this.int16[Tt+6]=g,this.int16[Tt+7]=y,this.uint16[Tt+8]=v,this.uint16[Tt+9]=w,this.uint16[Tt+10]=S,this.uint16[Tt+11]=E,this.uint16[Tt+12]=C,this.uint16[Tt+13]=D,this.uint16[Tt+14]=R,this.uint16[Tt+15]=V,this.uint16[Tt+16]=X,this.uint16[Tt+17]=G,this.uint16[Tt+18]=q,this.uint16[Tt+19]=st,this.uint16[Tt+20]=ot,this.uint16[Tt+21]=mt,this.uint16[Tt+22]=Pt,this.uint32[Ut+12]=wt,this.float32[Ut+13]=Mt,this.float32[Ut+14]=zt,this.uint16[Tt+30]=At,this.uint16[Tt+31]=kt,t}}Mo.prototype.bytesPerElement=64,Lt("StructArrayLayout8i15ui1ul2f2ui64",Mo);class Io extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.float32[1*t+0]=i,t}}Io.prototype.bytesPerElement=4,Lt("StructArrayLayout1f4",Io);class d extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=3*t;return this.uint16[6*t+0]=i,this.float32[l+1]=s,this.float32[l+2]=a,t}}d.prototype.bytesPerElement=12,Lt("StructArrayLayout1ui2f12",d);class e extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,i,s)}emplace(t,i,s,a){const l=4*t;return this.uint32[2*t+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=a,t}}e.prototype.bytesPerElement=8,Lt("StructArrayLayout1ul2ui8",e);class n extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,i)}emplace(t,i,s){const a=2*t;return this.uint16[a+0]=i,this.uint16[a+1]=s,t}}n.prototype.bytesPerElement=4,Lt("StructArrayLayout2ui4",n);class o extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint16[1*t+0]=i,t}}o.prototype.bytesPerElement=2,Lt("StructArrayLayout1ui2",o);class u extends _e{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,i,s,a)}emplace(t,i,s,a,l){const h=4*t;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,this.float32[h+3]=l,t}}u.prototype.bytesPerElement=16,Lt("StructArrayLayout4f16",u);class p extends Ca{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 dt(this.anchorPointX,this.anchorPointY)}}p.prototype.size=20;class m extends cs{get(t){return new p(this,t)}}Lt("CollisionBoxArray",m);class _ extends Ca{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}_.prototype.size=48;class x extends ql{get(t){return new _(this,t)}}Lt("PlacedSymbolArray",x);class b extends Ca{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get 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]}}b.prototype.size=64;class T extends Mo{get(t){return new b(this,t)}}Lt("SymbolInstanceArray",T);class k extends Io{getoffsetX(t){return this.float32[1*t+0]}}Lt("GlyphOffsetArray",k);class A extends ka{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Lt("SymbolLineVertexArray",A);class z extends Ca{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]}}z.prototype.size=12;class j extends d{get(t){return new z(this,t)}}Lt("TextAnchorOffsetArray",j);class $ extends Ca{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]}}$.prototype.size=8;class Z extends e{get(t){return new $(this,t)}}Lt("FeatureIndexArray",Z);class H extends Aa{}class K extends Aa{}class it extends Aa{}class Y extends Gl{}class rt extends an{}class nt extends $s{}class Q extends Da{}class lt extends To{}class _t extends za{}class pt extends $l{}class ft extends Zs{}class gt extends Zl{}class Dt extends us{}class Et extends Po{}class St extends n{}const jt=qe([{name:"a_pos",components:2,type:"Int16"}],4),{members:Qt}=jt;class Jt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,s,a){const l=this.segments[this.segments.length-1];return t>Jt.MAX_VERTEX_ARRAY_LENGTH&&Re(`Max vertices per segment is ${Jt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Jt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+t>Jt.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==a?this.createNewSegment(i,s,a):l}createNewSegment(t,i,s){const a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(a.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,s){return this.prepareSegment(0,t,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,s,a){return new Jt([{vertexOffset:t,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function Me(r,t){return 256*(r=oi(Math.floor(r),0,255))+oi(Math.floor(t),0,255)}Jt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Lt("SegmentVector",Jt);const Ie=qe([{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"}]),Oe=qe([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var ye,ri,De,Ye={exports:{}},We={exports:{}},Ke={exports:{}},Xi=(function(){if(De)return Ye.exports;De=1;var r=(ye||(ye=1,We.exports=function(i,s){var a,l,h,f,g,y,v,w;for(l=i.length-(a=3&i.length),h=s,g=3432918353,y=461845907,w=0;w<l;)v=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^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(w+2))<<16;case 2:v^=(255&i.charCodeAt(w+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(w)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>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}),We.exports),t=(ri||(ri=1,Ke.exports=function(i,s){for(var a,l=i.length,h=s^l,f=0;l>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),l-=4,++f;switch(l){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}),Ke.exports);return Ye.exports=r,Ye.exports.murmur3=r,Ye.exports.murmur2=t,Ye.exports})(),on=Rt(Xi);class Hr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,s,a){this.ids.push(zn(t)),this.positions.push(i,s,a)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=zn(t);let s=0,a=this.ids.length-1;for(;s<a;){const h=s+a>>1;this.ids[h]>=i?a=h:s=h+1}const l=[];for(;this.ids[s]===i;)l.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return l}static serialize(t,i){const s=new Float64Array(t.ids),a=new Uint32Array(t.positions);return Rn(s,a,0,s.length-1),i&&i.push(s.buffer,a.buffer),{ids:s,positions:a}}static deserialize(t){const i=new Hr;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}function zn(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:on(String(r))}function Rn(r,t,i,s){for(;i<s;){const a=r[i+s>>1];let l=i-1,h=s+1;for(;;){do l++;while(r[l]<a);do h--;while(r[h]>a);if(l>=h)break;hs(r,l,h),hs(t,3*l,3*h),hs(t,3*l+1,3*h+1),hs(t,3*l+2,3*h+2)}h-i<s-h?(Rn(r,t,i,h),i=h+1):(Rn(r,t,h+1,s),s=h)}}function hs(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}Lt("FeaturePositionMap",Hr);class ur{constructor(t,i){this.gl=t.gl,this.location=i}}class ln extends ur{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Qi extends ur{constructor(t,i){super(t,i),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class cn extends ur{constructor(t,i){super(t,i),this.current=se.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ds=new Float32Array(16);function ps(r){return[Me(255*r.r,255*r.g),Me(255*r.b,255*r.a)]}class Ge{constructor(t,i,s){this.value=t,this.uniformNames=i.map((a=>`u_${a}`)),this.type=s}setUniform(t,i,s){t.set(s.constantOr(this.value))}getBinding(t,i,s){return this.type==="color"?new cn(t,i):new ln(t,i)}}class je{constructor(t,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,i){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t,i,s,a){let l=null;a==="u_pattern_to"?l=this.patternTo:a==="u_pattern_from"?l=this.patternFrom:a==="u_dasharray_to"?l=this.dashTo:a==="u_dasharray_from"?l=this.dashFrom:a==="u_pixel_ratio_to"?l=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&t.set(l)}getBinding(t,i,s){return s.substr(0,9)==="u_pattern"||s.substr(0,12)==="u_dasharray_"?new Qi(t,i):new ln(t,i)}}class ni{constructor(t,i,s,a){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((l=>({name:`a_${l}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new a}populatePaintArray(t,i,s){const a=this.paintVertexArray.length,l=this.expression.evaluate(new ge(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,l)}updatePaintArray(t,i,s,a,l){const h=this.expression.evaluate(new ge(0,l),s,a);this._setPaintValue(t,i,h)}_setPaintValue(t,i,s){if(this.type==="color"){const a=ps(s);for(let l=t;l<i;l++)this.paintVertexArray.emplace(l,a[0],a[1])}else{for(let a=t;a<i;a++)this.paintVertexArray.emplace(a,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class xe{constructor(t,i,s,a,l,h){this.expression=t,this.uniformNames=i.map((f=>`u_${f}_t`)),this.type=s,this.useIntegerZoom=a,this.zoom=l,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(t,i,s){const a=this.expression.evaluate(new ge(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new ge(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),h=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(h,t,a,l)}updatePaintArray(t,i,s,a,l){const h=this.expression.evaluate(new ge(this.zoom,l),s,a),f=this.expression.evaluate(new ge(this.zoom+1,l),s,a);this._setPaintValue(t,i,h,f)}_setPaintValue(t,i,s,a){if(this.type==="color"){const l=ps(s),h=ps(a);for(let f=t;f<i;f++)this.paintVertexArray.emplace(f,l[0],l[1],h[0],h[1])}else{for(let l=t;l<i;l++)this.paintVertexArray.emplace(l,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=oi(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,i,s){return new ln(t,i)}}class Ln{constructor(t,i,s,a,l,h){this.expression=t,this.type=i,this.useIntegerZoom=s,this.zoom=a,this.layerId=h,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(t,i,s){const a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(i),s)}updatePaintArray(t,i,s,a,l){this._setPaintValues(t,i,this.getPositionIds(s),l)}_setPaintValues(t,i,s,a){const l=this.getPositions(a);if(!l||!s)return;const h=l[s.min],f=l[s.mid],g=l[s.max];if(h&&f&&g)for(let y=t;y<i;y++)this.emplace(this.zoomInPaintVertexArray,y,f,h),this.emplace(this.zoomOutPaintVertexArray,y,f,g)}upload(t){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Tu extends Ln{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns&&t.patterns[this.layerId]}getVertexAttributes(){return Ie.members}emplace(t,i,s,a){t.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],s.pixelRatio,a.pixelRatio)}}class Su extends Ln{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes&&t.dashes[this.layerId]}getVertexAttributes(){return Oe.members}emplace(t,i,s,a){t.emplace(i,0,s.y,s.height,s.width,0,a.y,a.height,a.width)}}class Pu{constructor(t,i,s){this.binders={},this._buffers=[];const a=[];for(const l in t.paint._values){if(!s(l))continue;const h=t.paint.get(l);if(!(h instanceof Mr&&Bs(h.property.specification)))continue;const f=Ch(l,t.type),g=h.value,y=h.property.specification.type,v=h.property.useIntegerZoom,w=h.property.specification["property-type"],S=w==="cross-faded"||w==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=S?new je(g.value,f):new Ge(g.value,f,y),a.push(`/u_${l}`);else if(g.kind==="source"||S){const E=Fn(l,y,"source");this.binders[l]=S?l==="line-dasharray"?new Su(g,y,v,i,E,t.id):new Tu(g,y,v,i,E,t.id):new ni(g,f,y,E),a.push(`/a_${l}`)}else{const E=Fn(l,y,"composite");this.binders[l]=new xe(g,f,y,v,i,E),a.push(`/z_${l}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){const i=this.binders[t];return i instanceof ni||i instanceof xe?i.maxValue:0}populatePaintArrays(t,i,s){for(const a in this.binders){const l=this.binders[a];(l instanceof ni||l instanceof xe||l instanceof Ln)&&l.populatePaintArray(t,i,s)}}setConstantPatternPositions(t,i){for(const s in this.binders){const a=this.binders[s];a instanceof je&&a.setConstantPatternPositions(t,i)}}setConstantDashPositions(t,i){for(const s in this.binders){const a=this.binders[s];a instanceof je&&a.setConstantDashPositions(t,i)}}updatePaintArrays(t,i,s,a,l){let h=!1;for(const f in t){const g=i.getPositions(f);for(const y of g){const v=s.feature(y.index);for(const w in this.binders){const S=this.binders[w];if((S instanceof ni||S instanceof xe||S instanceof Ln)&&S.expression.isStateDependent===!0){const E=a.paint.get(w);S.expression=E.value,S.updatePaintArray(y.start,y.end,v,t[f],l),h=!0}}}}return h}defines(){const t=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Ge||s instanceof je)&&t.push(...s.uniformNames.map((a=>`#define HAS_UNIFORM_${a}`)))}return t}getBinderAttributes(){const t=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ni||s instanceof xe)for(let a=0;a<s.paintVertexAttributes.length;a++)t.push(s.paintVertexAttributes[a].name);else if(s instanceof Ln){const a=s.getVertexAttributes();for(const l of a)t.push(l.name)}}return t}getBinderUniforms(){const t=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Ge||s instanceof je||s instanceof xe)for(const a of s.uniformNames)t.push(a)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,i){const s=[];for(const a in this.binders){const l=this.binders[a];if(l instanceof Ge||l instanceof je||l instanceof xe){for(const h of l.uniformNames)if(i[h]){const f=l.getBinding(t,i[h],h);s.push({name:h,property:a,binding:f})}}}return s}setUniforms(t,i,s,a){for(const{name:l,property:h,binding:f}of i)this.binders[h].setUniform(f,a,s.get(h),l)}updatePaintBuffers(t){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(t&&s instanceof Ln){const a=t.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(s instanceof ni||s instanceof xe)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(t){for(const i in this.binders){const s=this.binders[i];(s instanceof ni||s instanceof xe||s instanceof Ln)&&s.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const i=this.binders[t];(i instanceof ni||i instanceof xe||i instanceof Ln)&&i.destroy()}}}class fs{constructor(t,i,s=()=>!0){this.programConfigurations={};for(const a of t)this.programConfigurations[a.id]=new Pu(a,i,s);this.needsUpload=!1,this._featureMap=new Hr,this._bufferOffset=0}populatePaintArrays(t,i,s,a){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(t,i,a);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,s,a){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(t,this._featureMap,i,l,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ch(r,t){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(`${t}-`,"").replace(/-/g,"_")]}function Fn(r,t,i){const s={color:{source:$s,composite:u},number:{source:Io,composite:$s}},a=(function(l){return{"line-pattern":{source:Q,composite:Q},"fill-pattern":{source:Q,composite:Q},"fill-extrusion-pattern":{source:Q,composite:Q},"line-dasharray":{source:lt,composite:lt}}[l]})(r);return a&&a[i]||s[t][i]}Lt("ConstantBinder",Ge),Lt("CrossFadedConstantBinder",je),Lt("SourceExpressionBinder",ni),Lt("CrossFadedPatternBinder",Tu),Lt("CrossFadedDasharrayBinder",Su),Lt("CompositeExpressionBinder",xe),Lt("ProgramConfiguration",Pu,{omit:["_buffers"]}),Lt("ProgramConfigurationSet",fs);const Eo=Math.pow(2,14)-1,Wl=-Eo-1;function Bn(r){const t=le/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const a=i[s];for(let l=0;l<a.length;l++){const h=a[l],f=Math.round(h.x*t),g=Math.round(h.y*t);h.x=oi(f,Wl,Eo),h.y=oi(g,Wl,Eo),(f<h.x||f>h.x+1||g<h.y||g>h.y+1)&&Re("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function un(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?Bn(r):[]}}const Hl=-32768;function Xl(r,t,i,s,a){r.emplaceBack(Hl+8*t+s,Hl+8*i+a)}class Ah{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new K,this.indexArray=new Et,this.segments=new Jt,this.programConfigurations=new fs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(t,i,s){const a=this.layers[0],l=[];let h=null,f=!1,g=a.type==="heatmap";if(a.type==="circle"){const v=a;h=v.layout.get("circle-sort-key"),f=!h.isConstant(),g=g||v.paint.get("circle-pitch-alignment")==="map"}const y=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:w,index:S,sourceLayerIndex:E}of t){const C=this.layers[0]._featureFilter.needGeometry,D=un(v,C);if(!this.layers[0]._featureFilter.filter(new ge(this.zoom),D,s))continue;const R=f?h.evaluate(D,{},s):void 0,V={id:w,properties:v.properties,type:v.type,sourceLayerIndex:E,index:S,geometry:C?D.geometry:Bn(v),patterns:{},sortKey:R};l.push(V)}f&&l.sort(((v,w)=>v.sortKey-w.sortKey));for(const v of l){const{geometry:w,index:S,sourceLayerIndex:E}=v,C=t[S].feature;this.addFeature(v,w,S,s,y),i.featureIndex.insert(C,w,S,E,this.index)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Qt),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,i,s,a,l=1){let h;switch(l){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: ${l}; valid values are 1, 3, 5, 7.`)}const f=h.length;for(const g of i)for(const y of g){const v=y.x,w=y.y;if(v<0||v>=le||w<0||w>=le)continue;const S=this.segments.prepareSegment(f*f,this.layoutVertexArray,this.indexArray,t.sortKey),E=S.vertexLength;for(let C=0;C<f;C++)for(let D=0;D<f;D++)Xl(this.layoutVertexArray,v,w,h[D],h[C]);for(let C=0;C<f-1;C++)for(let D=0;D<f-1;D++){const R=E+C*f+D,V=E+(C+1)*f+D;this.indexArray.emplaceBack(R,V+1,R+1),this.indexArray.emplaceBack(R,V,V+1)}S.vertexLength+=f*f,S.primitiveLength+=(f-1)*(f-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:{},canonical:a})}}function Zd(r,t){for(let i=0;i<r.length;i++)if(Co(t,r[i]))return!0;for(let i=0;i<t.length;i++)if(Co(r,t[i]))return!0;return!!kh(r,t)}function Mu(r,t,i){return!!Co(r,t)||!!Dh(t,r,i)}function qd(r,t){if(r.length===1)return Hd(t,r[0]);for(let i=0;i<t.length;i++){const s=t[i];for(let a=0;a<s.length;a++)if(Co(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(Hd(t,r[i]))return!0;for(let i=0;i<t.length;i++)if(kh(r,t[i]))return!0;return!1}function Sm(r,t,i){if(r.length>1){if(kh(r,t))return!0;for(let s=0;s<t.length;s++)if(Dh(t[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Dh(r[s],t,i))return!0;return!1}function kh(r,t){if(r.length===0||t.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let l=0;l<t.length-1;l++)if(Pm(s,a,t[l],t[l+1]))return!0}return!1}function Pm(r,t,i,s){return xr(r,i,s)!==xr(t,i,s)&&xr(r,t,i)!==xr(r,t,s)}function Dh(r,t,i){const s=i*i;if(t.length===1)return r.distSqr(t[0])<s;for(let a=1;a<t.length;a++)if(Wd(r,t[a-1],t[a])<s)return!0;return!1}function Wd(r,t,i){const s=t.distSqr(i);if(s===0)return r.distSqr(t);const a=((r.x-t.x)*(i.x-t.x)+(r.y-t.y)*(i.y-t.y))/s;return r.distSqr(a<0?t:a>1?i:i.sub(t)._mult(a)._add(t))}function Hd(r,t){let i,s,a,l=!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],a=i[g],s.y>t.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(l=!l)}return l}function Co(r,t){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const l=r[s],h=r[a];l.y>t.y!=h.y>t.y&&t.x<(h.x-l.x)*(t.y-l.y)/(h.y-l.y)+l.x&&(i=!i)}return i}function Mm(r,t,i){const s=i[0],a=i[2];if(r.x<s.x&&t.x<s.x||r.x>a.x&&t.x>a.x||r.y<s.y&&t.y<s.y||r.y>a.y&&t.y>a.y)return!1;const l=xr(r,t,i[0]);return l!==xr(r,t,i[1])||l!==xr(r,t,i[2])||l!==xr(r,t,i[3])}function Ao(r,t,i){const s=t.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(t.id).getMaxValue(r)}function Iu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Eu(r,t,i,s,a){if(!t[0]&&!t[1])return r;const l=dt.convert(t)._mult(a);i==="viewport"&&l._rotate(-s);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(l));return h}function Im({queryGeometry:r,size:t},i){return Mu(r,i,t)}function Em({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){return Mu(r,l,t*(i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera/i.cameraToCenterDistance))}function Cm({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){const h=i.projectTileCoordinates(l.x,l.y,s,a).signedDistanceFromCamera,f=t*(i.cameraToCenterDistance/h);return Mu(r,zh(l,i,s,a),f)}function Am({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a},l){return Mu(r,zh(l,i,s,a),t)}function Xd({queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a,pitchAlignment:l="map",pitchScale:h="map"},f){const g=l==="map"?h==="map"?Im:Em:h==="map"?Cm:Am,y={queryGeometry:r,size:t,transform:i,unwrappedTileID:s,getElevation:a};for(const v of f)for(const w of v)if(g(y,w))return!0;return!1}function zh(r,t,i,s){const a=t.projectTileCoordinates(r.x,r.y,i,s).point;return new dt((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}let Yd,Kd;Lt("CircleBucket",Ah,{omit:["layers"]});var km={get paint(){return Kd=Kd||new Mi({"circle-radius":new Wt(W.paint_circle["circle-radius"]),"circle-color":new Wt(W.paint_circle["circle-color"]),"circle-blur":new Wt(W.paint_circle["circle-blur"]),"circle-opacity":new Wt(W.paint_circle["circle-opacity"]),"circle-translate":new Vt(W.paint_circle["circle-translate"]),"circle-translate-anchor":new Vt(W.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Vt(W.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Vt(W.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wt(W.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wt(W.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wt(W.paint_circle["circle-stroke-opacity"])})},get layout(){return Yd=Yd||new Mi({"circle-sort-key":new Wt(W.layout_circle["circle-sort-key"])})}};class Dm extends cr{constructor(t,i){super(t,km,i)}createBucket(t){return new Ah(t)}queryRadius(t){const i=t;return Ao("circle-radius",this,i)+Ao("circle-stroke-width",this,i)+Iu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){const y=Eu(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,h),v=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),w=this.paint.get("circle-pitch-scale"),S=this.paint.get("circle-pitch-alignment");let E,C;return S==="map"?(E=y,C=v*h):(E=(function(D,R,V,X){return D.map((G=>zh(G,R,V,X)))})(y,l,f,g),C=v),Xd({queryGeometry:E,size:C,transform:l,unwrappedTileID:f,getElevation:g,pitchAlignment:S,pitchScale:w},a)}}class Jd extends Ah{}let Qd;Lt("HeatmapBucket",Jd,{omit:["layers"]});var zm={get paint(){return Qd=Qd||new Mi({"heatmap-radius":new Wt(W.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wt(W.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Vt(W.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ea(W.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Vt(W.paint_heatmap["heatmap-opacity"])})}};function Rh(r,{width:t,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*i*s)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${t*i*s}`)}else a=new Uint8Array(t*i*s);return r.width=t,r.height=i,r.data=a,r}function tp(r,{width:t,height:i},s){if(t===r.width&&i===r.height)return;const a=Rh({},{width:t,height:i},s);Lh(r,a,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,i)},s),r.width=t,r.height=i,r.data=a.data}function Lh(r,t,i,s,a,l){if(a.width===0||a.height===0)return t;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||s.x>t.width-a.width||s.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const h=r.data,f=t.data;if(h===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<a.height;g++){const y=((i.y+g)*r.width+i.x)*l,v=((s.y+g)*t.width+s.x)*l;for(let w=0;w<a.width*l;w++)f[v+w]=h[y+w]}return t}class Yl{constructor(t,i){Rh(this,t,1,i)}resize(t){tp(this,t,1)}clone(){return new Yl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,s,a,l){Lh(t,i,s,a,l,1)}}class tr{constructor(t,i){Rh(this,t,4,i)}resize(t){tp(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new tr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,s,a,l){Lh(t,i,s,a,l,4)}setPixel(t,i,s){const a=4*(t*this.width+i);this.data[a+0]=Math.round(255*s.r/s.a),this.data[a+1]=Math.round(255*s.g/s.a),this.data[a+2]=Math.round(255*s.b/s.a),this.data[a+3]=Math.round(255*s.a)}}function ep(r){const t={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new tr({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(h,f,g)=>{t[r.evaluationKey]=g;const y=r.expression.evaluate(t);a.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 v=g/(i-1),{start:w,end:S}=r.clips[h];l(f,y,w*(1-v)+S*v)}else for(let h=0,f=0;h<i;h++,f+=4)l(0,f,h/(i-1));return a}Lt("AlphaImage",Yl),Lt("RGBAImage",tr);const Fh="big-fb";class Rm extends cr{createBucket(t){return new Jd(t)}constructor(t,i){super(t,zm,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ep({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Fh)&&this.heatmapFbos.delete(Fh)}queryRadius(t){return Ao("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){return Xd({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(i,s)*h,transform:l,unwrappedTileID:f,getElevation:g},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let ip;var Lm={get paint(){return ip=ip||new Mi({"hillshade-illumination-direction":new Vt(W.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Vt(W.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Vt(W.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Vt(W.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Vt(W.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Vt(W.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Vt(W.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Vt(W.paint_hillshade["hillshade-method"])})}};class Fm extends cr{constructor(t,i){super(t,Lm,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values;const l=Math.max(t.length,i.length,s.length,a.length);t=t.concat(Array(l-t.length).fill(t.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1))),a=a.concat(Array(l-a.length).fill(a.at(-1)));const h=i.map(Wn);return{directionRadians:t.map(Wn),altitudeRadians:h,shadowColor:a,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let rp;var Bm={get paint(){return rp=rp||new Mi({"color-relief-opacity":new Vt(W["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ea(W["paint_color-relief"]["color-relief-color"])})}};class Bh{constructor(t,i,s,a){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(i,a)}update(t,i,s){const{width:a,height:l}=t,h=!(this.size&&this.size[0]===a&&this.size[1]===l||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=[a,l],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||jr(t)?g.texImage2D(g.TEXTURE_2D,0,this.format,this.format,g.UNSIGNED_BYTE,t):g.texImage2D(g.TEXTURE_2D,0,this.format,a,l,0,this.format,g.UNSIGNED_BYTE,t.data);else{const{x:y,y:v}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||jr(t)?g.texSubImage2D(g.TEXTURE_2D,0,y,v,g.RGBA,g.UNSIGNED_BYTE,t):g.texSubImage2D(g.TEXTURE_2D,0,y,v,a,l,g.RGBA,g.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),f.pixelStoreUnpackFlipY.setDefault(),f.pixelStoreUnpack.setDefault(),f.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,i,s){const{context:a}=this,{gl:l}=a;l.bindTexture(l.TEXTURE_2D,this.texture),s!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=l.LINEAR),t!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,t),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,s||t),this.filter=t),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.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:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class np{constructor(t,i,s,a=1,l=1,h=1,f=0){if(this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void Re(`"${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=a,this.greenFactor=l,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 v=0;v<g;v++){const w=this.get(y,v);w>this.max&&(this.max=w),w<this.min&&(this.min=w)}}get(t,i){const s=new Uint8Array(this.data.buffer),a=4*this._idx(t,i);return this.unpack(s[a],s[a+1],s[a+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-1||t>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(t+1)}unpack(t,i,s){return t*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(t){return sp(t,this.getUnpackVector())}getPixels(){return new tr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,i,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,l=i*this.dim+this.dim,h=s*this.dim,f=s*this.dim+this.dim;switch(i){case-1:a=l-1;break;case 1:l=a+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 v=h;v<f;v++)for(let w=a;w<l;w++)this.data[this._idx(w,v)]=t.data[this._idx(w+g,v+y)]}}function sp(r,t){const i=t[0],s=t[1],a=t[2],l=t[3],h=Math.min(i,s,a),f=Math.round((r+l)/h);return{r:Math.floor(f*h/i)%256,g:Math.floor(f*h/s)%256,b:Math.floor(f*h/a)%256}}Lt("DEMData",np);class Om extends cr{constructor(t,i){super(t,Bm,i)}_createColorRamp(t){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof ss&&s._styleExpression.expression instanceof xi){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=[se.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t)return i;const a={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(t-1);for(let h=0;h<i.elevationStops.length-.5;h+=l)a.elevationStops.push(i.elevationStops[Math.round(h)]),a.colorStops.push(i.colorStops[Math.round(h)]);return Re(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const a=this._createColorRamp(i),l=new tr({width:a.colorStops.length,height:1}),h=new tr({width:a.colorStops.length,height:1});for(let f=0;f<a.elevationStops.length;f++){const g=sp(a.elevationStops[f],s);h.setPixel(0,f,new se(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,f,a.colorStops[f])}return this.colorRampTextures={elevationTexture:new Bh(t,h,t.gl.RGBA),colorTexture:new Bh(t,l,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const jm=qe([{name:"a_pos",components:2,type:"Int16"}],4),{members:Nm}=jm;function Cu(r,t,i){const s=i.patternDependencies;let a=!1;for(const l of t){const h=l.paint.get(`${r}-pattern`);h.isConstant()||(a=!0);const f=h.constantOr(null);f&&(a=!0,s[f.to]=!0,s[f.from]=!0)}return a}function Oh(r,t,i,s,a){const{zoom:l}=s,h=a.patternDependencies;for(const f of t){const g=f.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let y=g.evaluate({zoom:l-1},i,{},a.availableImages),v=g.evaluate({zoom:l},i,{},a.availableImages),w=g.evaluate({zoom:l+1},i,{},a.availableImages);y=y&&y.name?y.name:y,v=v&&v.name?v.name:v,w=w&&w.name?w.name:w,h[y]=!0,h[v]=!0,h[w]=!0,i.patterns[f.id]={min:y,mid:v,max:w}}}return i}function ap(r,t,i,s,a){let l;if(a===(function(h,f,g,y){let v=0;for(let w=f,S=g-y;w<g;w+=y)v+=(h[S]-h[w])*(h[w+1]+h[S+1]),S=w;return v})(r,t,i,s)>0)for(let h=t;h<i;h+=s)l=up(h/s|0,r[h],r[h+1],l);else for(let h=i-s;h>=t;h-=s)l=up(h/s|0,r[h],r[h+1],l);return l&&ko(l,l.next)&&(tc(l),l=l.next),l}function Ra(r,t){if(!r)return r;t||(t=r);let i,s=r;do if(i=!1,s.steiner||!ko(s,s.next)&&Je(s.prev,s,s.next)!==0)s=s.next;else{if(tc(s),s=t=s.prev,s===s.next)break;i=!0}while(i||s!==t);return t}function Kl(r,t,i,s,a,l,h){if(!r)return;!h&&l&&(function(g,y,v,w){let S=g;do S.z===0&&(S.z=jh(S.x,S.y,y,v,w)),S.prevZ=S.prev,S.nextZ=S.next,S=S.next;while(S!==g);S.prevZ.nextZ=null,S.prevZ=null,(function(E){let C,D=1;do{let R,V=E;E=null;let X=null;for(C=0;V;){C++;let G=V,q=0;for(let ot=0;ot<D&&(q++,G=G.nextZ,G);ot++);let st=D;for(;q>0||st>0&&G;)q!==0&&(st===0||!G||V.z<=G.z)?(R=V,V=V.nextZ,q--):(R=G,G=G.nextZ,st--),X?X.nextZ=R:E=R,R.prevZ=X,X=R;V=G}X.nextZ=null,D*=2}while(C>1)})(S)})(r,s,a,l);let f=r;for(;r.prev!==r.next;){const g=r.prev,y=r.next;if(l?Um(r,s,a,l):Vm(r))t.push(g.i,r.i,y.i),tc(r),r=y.next,f=y.next;else if((r=y)===f){h?h===1?Kl(r=Gm(Ra(r),t),t,i,s,a,l,2):h===2&&$m(r,t,i,s,a,l):Kl(Ra(r),t,i,s,a,l,1);break}}}function Vm(r){const t=r.prev,i=r,s=r.next;if(Je(t,i,s)>=0)return!1;const a=t.x,l=i.x,h=s.x,f=t.y,g=i.y,y=s.y,v=Math.min(a,l,h),w=Math.min(f,g,y),S=Math.max(a,l,h),E=Math.max(f,g,y);let C=s.next;for(;C!==t;){if(C.x>=v&&C.x<=S&&C.y>=w&&C.y<=E&&Jl(a,f,l,g,h,y,C.x,C.y)&&Je(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function Um(r,t,i,s){const a=r.prev,l=r,h=r.next;if(Je(a,l,h)>=0)return!1;const f=a.x,g=l.x,y=h.x,v=a.y,w=l.y,S=h.y,E=Math.min(f,g,y),C=Math.min(v,w,S),D=Math.max(f,g,y),R=Math.max(v,w,S),V=jh(E,C,t,i,s),X=jh(D,R,t,i,s);let G=r.prevZ,q=r.nextZ;for(;G&&G.z>=V&&q&&q.z<=X;){if(G.x>=E&&G.x<=D&&G.y>=C&&G.y<=R&&G!==a&&G!==h&&Jl(f,v,g,w,y,S,G.x,G.y)&&Je(G.prev,G,G.next)>=0||(G=G.prevZ,q.x>=E&&q.x<=D&&q.y>=C&&q.y<=R&&q!==a&&q!==h&&Jl(f,v,g,w,y,S,q.x,q.y)&&Je(q.prev,q,q.next)>=0))return!1;q=q.nextZ}for(;G&&G.z>=V;){if(G.x>=E&&G.x<=D&&G.y>=C&&G.y<=R&&G!==a&&G!==h&&Jl(f,v,g,w,y,S,G.x,G.y)&&Je(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;q&&q.z<=X;){if(q.x>=E&&q.x<=D&&q.y>=C&&q.y<=R&&q!==a&&q!==h&&Jl(f,v,g,w,y,S,q.x,q.y)&&Je(q.prev,q,q.next)>=0)return!1;q=q.nextZ}return!0}function Gm(r,t){let i=r;do{const s=i.prev,a=i.next.next;!ko(s,a)&&lp(s,i,i.next,a)&&Ql(s,a)&&Ql(a,s)&&(t.push(s.i,i.i,a.i),tc(i),tc(i.next),i=r=a),i=i.next}while(i!==r);return Ra(i)}function $m(r,t,i,s,a,l){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&Xm(h,f)){let g=cp(h,f);return h=Ra(h,h.next),g=Ra(g,g.next),Kl(h,t,i,s,a,l,0),void Kl(g,t,i,s,a,l,0)}f=f.next}h=h.next}while(h!==r)}function Zm(r,t){let i=r.x-t.x;return i===0&&(i=r.y-t.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function qm(r,t){const i=(function(a,l){let h=l;const f=a.x,g=a.y;let y,v=-1/0;if(ko(a,h))return h;do{if(ko(a,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const D=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(D<=f&&D>v&&(v=D,y=h.x<h.next.x?h:h.next,D===f))return y}h=h.next}while(h!==l);if(!y)return null;const w=y,S=y.x,E=y.y;let C=1/0;h=y;do{if(f>=h.x&&h.x>=S&&f!==h.x&&op(g<E?f:v,g,S,E,g<E?v:f,g,h.x,h.y)){const D=Math.abs(g-h.y)/(f-h.x);Ql(h,a)&&(D<C||D===C&&(h.x>y.x||h.x===y.x&&Wm(y,h)))&&(y=h,C=D)}h=h.next}while(h!==w);return y})(r,t);if(!i)return t;const s=cp(i,r);return Ra(s,s.next),Ra(i,i.next)}function Wm(r,t){return Je(r.prev,r,t.prev)<0&&Je(t.next,r,r.next)<0}function jh(r,t,i,s,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Hm(r){let t=r,i=r;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==r);return i}function op(r,t,i,s,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(s-f)>=(i-h)*(t-f)&&(i-h)*(l-f)>=(a-h)*(s-f)}function Jl(r,t,i,s,a,l,h,f){return!(r===h&&t===f)&&op(r,t,i,s,a,l,h,f)}function Xm(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!(function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&lp(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1})(r,t)&&(Ql(r,t)&&Ql(t,r)&&(function(i,s){let a=i,l=!1;const h=(i.x+s.x)/2,f=(i.y+s.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(l=!l),a=a.next;while(a!==i);return l})(r,t)&&(Je(r.prev,r,t.prev)||Je(r,t.prev,t))||ko(r,t)&&Je(r.prev,r,r.next)>0&&Je(t.prev,t,t.next)>0)}function Je(r,t,i){return(t.y-r.y)*(i.x-t.x)-(t.x-r.x)*(i.y-t.y)}function ko(r,t){return r.x===t.x&&r.y===t.y}function lp(r,t,i,s){const a=ku(Je(r,t,i)),l=ku(Je(r,t,s)),h=ku(Je(i,s,r)),f=ku(Je(i,s,t));return a!==l&&h!==f||!(a!==0||!Au(r,i,t))||!(l!==0||!Au(r,s,t))||!(h!==0||!Au(i,r,s))||!(f!==0||!Au(i,t,s))}function Au(r,t,i){return t.x<=Math.max(r.x,i.x)&&t.x>=Math.min(r.x,i.x)&&t.y<=Math.max(r.y,i.y)&&t.y>=Math.min(r.y,i.y)}function ku(r){return r>0?1:r<0?-1:0}function Ql(r,t){return Je(r.prev,r,r.next)<0?Je(r,t,r.next)>=0&&Je(r,r.prev,t)>=0:Je(r,t,r.prev)<0||Je(r,r.next,t)<0}function cp(r,t){const i=Nh(r.i,r.x,r.y),s=Nh(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function up(r,t,i,s){const a=Nh(r,t,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function tc(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 Nh(r,t,i){return{i:r,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Do{constructor(t,i){if(i>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=i}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Du{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Du.noSubdivision=new Du({fill:new Do(0,0),line:new Do(0,0),tile:new Do(0,0),stencil:new Do(0,0),circle:1}),Lt("SubdivisionGranularityExpression",Do),Lt("SubdivisionGranularitySetting",Du);const zo=-32768,ec=32767;class Ym{constructor(t,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=le/t,this._canonical=i}_getKey(t,i){return(t+=32768)<<16|i+32768}_vertexToIndex(t,i){if(t<-32768||i<-32768||t>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(t),a=0|Math.round(i),l=this._getKey(s,a);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const h=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,h),this._vertexBuffer.push(s,a),h}_subdivideTrianglesScanline(t){if(this._granularity<2)return(function(a,l){const h=[];for(let f=0;f<l.length;f+=3){const g=l[f],y=l[f+1],v=l[f+2],w=a[2*g],S=a[2*g+1];(a[2*y]-w)*(a[2*v+1]-S)-(a[2*y+1]-S)*(a[2*v]-w)>0?(h.push(g),h.push(v),h.push(y)):(h.push(g),h.push(y),h.push(v))}return h})(this._vertexBuffer,t);const i=[],s=t.length;for(let a=0;a<s;a+=3){const l=[t[a+0],t[a+1],t[a+2]],h=[this._vertexBuffer[2*t[a+0]+0],this._vertexBuffer[2*t[a+0]+1],this._vertexBuffer[2*t[a+1]+0],this._vertexBuffer[2*t[a+1]+1],this._vertexBuffer[2*t[a+2]+0],this._vertexBuffer[2*t[a+2]+1]];let f=1/0,g=1/0,y=-1/0,v=-1/0;for(let D=0;D<3;D++){const R=h[2*D],V=h[2*D+1];f=Math.min(f,R),y=Math.max(y,R),g=Math.min(g,V),v=Math.max(v,V)}if(f===y||g===v)continue;const w=Math.floor(f/this._granularityCellSize),S=Math.ceil(y/this._granularityCellSize),E=Math.floor(g/this._granularityCellSize),C=Math.ceil(v/this._granularityCellSize);if(w!==S||E!==C)for(let D=E;D<C;D++){const R=this._scanlineGenerateVertexRingForCellRow(D,h,l);Km(this._vertexBuffer,R,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(t,i,s){const a=t*this._granularityCellSize,l=a+this._granularityCellSize,h=[];for(let f=0;f<3;f++){const g=i[2*f],y=i[2*f+1],v=i[2*(f+1)%6],w=i[(2*(f+1)+1)%6],S=i[2*(f+2)%6],E=i[(2*(f+2)+1)%6],C=v-g,D=w-y,R=C===0,V=D===0,X=(a-y)/D,G=(l-y)/D,q=Math.min(X,G),st=Math.max(X,G);if(!V&&(q>=1||st<=0)||V&&(y<a||y>l)){w>=a&&w<=l&&h.push(s[(f+1)%3]);continue}!V&&q>0&&h.push(this._vertexToIndex(g+C*q,y+D*q));const ot=g+C*Math.max(q,0),mt=g+C*Math.min(st,1);R||this._generateIntraEdgeVertices(h,g,y,v,w,ot,mt),!V&&st<1&&h.push(this._vertexToIndex(g+C*st,y+D*st)),(V||w>=a&&w<=l)&&h.push(s[(f+1)%3]),!V&&(w<=a||w>=l)&&this._generateInterEdgeVertices(h,g,y,v,w,S,E,mt,a,l)}return h}_generateIntraEdgeVertices(t,i,s,a,l,h,f){const g=a-i,y=l-s,v=y===0,w=v?Math.min(i,a):Math.min(h,f),S=v?Math.max(i,a):Math.max(h,f),E=Math.floor(w/this._granularityCellSize)+1,C=Math.ceil(S/this._granularityCellSize)-1;if(v?i<a:h<f)for(let D=E;D<=C;D++){const R=D*this._granularityCellSize;t.push(this._vertexToIndex(R,s+y*(R-i)/g))}else for(let D=C;D>=E;D--){const R=D*this._granularityCellSize;t.push(this._vertexToIndex(R,s+y*(R-i)/g))}}_generateInterEdgeVertices(t,i,s,a,l,h,f,g,y,v){const w=l-s,S=h-a,E=f-l,C=(y-l)/E,D=(v-l)/E,R=Math.min(C,D),V=Math.max(C,D),X=a+S*R;let G=Math.floor(Math.min(X,g)/this._granularityCellSize)+1,q=Math.ceil(Math.max(X,g)/this._granularityCellSize)-1,st=g<X;const ot=E===0;if(ot&&(f===y||f===v))return;if(ot||R>=1||V<=0){const Pt=s-f,wt=h+(i-h)*Math.min((y-f)/Pt,(v-f)/Pt);G=Math.floor(Math.min(wt,g)/this._granularityCellSize)+1,q=Math.ceil(Math.max(wt,g)/this._granularityCellSize)-1,st=g<wt}const mt=w>0?v:y;if(st)for(let Pt=G;Pt<=q;Pt++)t.push(this._vertexToIndex(Pt*this._granularityCellSize,mt));else for(let Pt=q;Pt>=G;Pt--)t.push(this._vertexToIndex(Pt*this._granularityCellSize,mt))}_generateOutline(t){const i=[];for(const s of t){const a=La(s,this._granularity,!0),l=this._pointArrayToIndices(a),h=[];for(let f=1;f<l.length;f++)h.push(l[f-1]),h.push(l[f]);i.push(h)}return i}_handlePoles(t){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(t,i,s)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let i=0;i<t.length;i+=2){const s=t[i+1];s===zo&&(t[i+1]=-32767),s===ec&&(t[i+1]=32766)}}_generatePoleQuad(t,i,s,a,l,h){a>l!=(h===zo)?(t.push(i),t.push(s),t.push(this._vertexToIndex(a,h)),t.push(s),t.push(this._vertexToIndex(l,h)),t.push(this._vertexToIndex(a,h))):(t.push(s),t.push(i),t.push(this._vertexToIndex(a,h)),t.push(this._vertexToIndex(l,h)),t.push(s),t.push(this._vertexToIndex(a,h)))}_fillPoles(t,i,s){const a=this._vertexBuffer,l=le,h=t.length;for(let f=2;f<h;f+=3){const g=t[f-2],y=t[f-1],v=t[f],w=a[2*g],S=a[2*g+1],E=a[2*y],C=a[2*y+1],D=a[2*v],R=a[2*v+1];i&&(S===0&&C===0&&this._generatePoleQuad(t,g,y,w,E,zo),C===0&&R===0&&this._generatePoleQuad(t,y,v,E,D,zo),R===0&&S===0&&this._generatePoleQuad(t,v,g,D,w,zo)),s&&(S===l&&C===l&&this._generatePoleQuad(t,g,y,w,E,ec),C===l&&R===l&&this._generatePoleQuad(t,y,v,E,D,ec),R===l&&S===l&&this._generatePoleQuad(t,v,g,D,w,ec))}}_initializeVertices(t){for(let i=0;i<t.length;i+=2)this._vertexToIndex(t[i],t[i+1])}subdividePolygonInternal(t,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:a}=(function(f){const g=[],y=[];for(const v of f)if(v.length!==0){v!==f[0]&&g.push(y.length/2);for(let w=0;w<v.length;w++)y.push(v[w].x),y.push(v[w].y)}return{flattened:y,holeIndices:g}})(t);let l;this._initializeVertices(s);try{const f=(function(y,v,w=2){const S=v&&v.length,E=S?v[0]*w:y.length;let C=ap(y,0,E,w,!0);const D=[];if(!C||C.next===C.prev)return D;let R,V,X;if(S&&(C=(function(G,q,st,ot){const mt=[];for(let Pt=0,wt=q.length;Pt<wt;Pt++){const Mt=ap(G,q[Pt]*ot,Pt<wt-1?q[Pt+1]*ot:G.length,ot,!1);Mt===Mt.next&&(Mt.steiner=!0),mt.push(Hm(Mt))}mt.sort(Zm);for(let Pt=0;Pt<mt.length;Pt++)st=qm(mt[Pt],st);return st})(y,v,C,w)),y.length>80*w){R=y[0],V=y[1];let G=R,q=V;for(let st=w;st<E;st+=w){const ot=y[st],mt=y[st+1];ot<R&&(R=ot),mt<V&&(V=mt),ot>G&&(G=ot),mt>q&&(q=mt)}X=Math.max(G-R,q-V),X=X!==0?32767/X:0}return Kl(C,D,w,R,V,X,0),D})(s,a),g=this._convertIndices(s,f);l=this._subdivideTrianglesScanline(g)}catch(f){console.error(f)}let h=[];return i&&(h=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:h}}_convertIndices(t,i){const s=[];for(let a=0;a<i.length;a++)s.push(this._vertexToIndex(t[2*i[a]],t[2*i[a]+1]));return s}_pointArrayToIndices(t){const i=[];for(let s=0;s<t.length;s++){const a=t[s];i.push(this._vertexToIndex(a.x,a.y))}return i}}function hp(r,t,i,s=!0){return new Ym(i,t).subdividePolygonInternal(r,s)}function La(r,t,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],a=r[r.length-1],l=i&&(s.x!==a.x||s.y!==a.y);if(t<2)return l?[...r,r[0]]:[...r];const h=Math.floor(le/t),f=[];f.push(new dt(r[0].x,r[0].y));const g=r.length,y=l?g:g-1;for(let v=0;v<y;v++){const w=r[v],S=v<g-1?r[v+1]:r[0],E=w.x,C=w.y,D=S.x,R=S.y,V=E!==D,X=C!==R;if(!V&&!X)continue;const G=D-E,q=R-C,st=Math.abs(G),ot=Math.abs(q);let mt=E,Pt=C;for(;;){const Mt=G>0?(Math.floor(mt/h)+1)*h:(Math.ceil(mt/h)-1)*h,zt=q>0?(Math.floor(Pt/h)+1)*h:(Math.ceil(Pt/h)-1)*h,At=Math.abs(mt-Mt),kt=Math.abs(Pt-zt),Tt=Math.abs(mt-D),Ut=Math.abs(Pt-R),Gt=V?At/st:Number.POSITIVE_INFINITY,Ht=X?kt/ot:Number.POSITIVE_INFINITY;if((Tt<=At||!V)&&(Ut<=kt||!X))break;if(Gt<Ht&&V||!X){mt=Mt,Pt+=q*Gt;const Ot=new dt(mt,Math.round(Pt));f[f.length-1].x===Ot.x&&f[f.length-1].y===Ot.y||f.push(Ot)}else{mt+=G*Ht,Pt=zt;const Ot=new dt(Math.round(mt),Pt);f[f.length-1].x===Ot.x&&f[f.length-1].y===Ot.y||f.push(Ot)}}const wt=new dt(D,R);f[f.length-1].x===wt.x&&f[f.length-1].y===wt.y||f.push(wt)}return f}function Km(r,t,i){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,a=r[2*t[0]];for(let g=1;g<t.length;g++){const y=r[2*t[g]];y<a&&(a=y,s=g)}const l=t.length;let h=s,f=(h+1)%l;for(;;){const g=h-1>=0?h-1:l-1,y=(f+1)%l,v=r[2*t[g]],w=r[2*t[y]],S=r[2*t[h]],E=r[2*t[h]+1],C=r[2*t[f]+1];let D=!1;if(v<w)D=!0;else if(v>w)D=!1;else{const R=C-E,V=-(r[2*t[f]]-S),X=E<C?1:-1;((v-S)*R+(r[2*t[g]+1]-E)*V)*X>((w-S)*R+(r[2*t[y]+1]-E)*V)*X&&(D=!0)}if(D){const R=t[g],V=t[h],X=t[f];R!==V&&R!==X&&V!==X&&i.push(X,V,R),h--,h<0&&(h=l-1)}else{const R=t[y],V=t[h],X=t[f];R!==V&&R!==X&&V!==X&&i.push(X,V,R),f++,f>=l&&(f=0)}if(g===y)break}}function dp(r,t,i,s,a,l,h,f,g){const y=a.length/2,v=h&&f&&g;if(y<Jt.MAX_VERTEX_ARRAY_LENGTH){const w=t.prepareSegment(y,i,s),S=w.vertexLength;for(let D=0;D<l.length;D+=3)s.emplaceBack(S+l[D],S+l[D+1],S+l[D+2]);let E,C;w.vertexLength+=y,w.primitiveLength+=l.length/3,v&&(C=h.prepareSegment(y,i,f),E=C.vertexLength,C.vertexLength+=y);for(let D=0;D<a.length;D+=2)r(a[D],a[D+1]);if(v)for(let D=0;D<g.length;D++){const R=g[D];for(let V=1;V<R.length;V+=2)f.emplaceBack(E+R[V-1],E+R[V]);C.primitiveLength+=R.length/2}}else(function(w,S,E,C,D,R){const V=[];for(let ot=0;ot<C.length/2;ot++)V.push(-1);const X={count:0};let G=0,q=w.getOrCreateLatestSegment(S,E),st=q.vertexLength;for(let ot=2;ot<D.length;ot+=3){const mt=D[ot-2],Pt=D[ot-1],wt=D[ot];let Mt=V[mt]<G,zt=V[Pt]<G,At=V[wt]<G;q.vertexLength+((Mt?1:0)+(zt?1:0)+(At?1:0))>Jt.MAX_VERTEX_ARRAY_LENGTH&&(q=w.createNewSegment(S,E),G=X.count,Mt=!0,zt=!0,At=!0,st=0);const kt=ic(V,C,R,X,mt,Mt,q),Tt=ic(V,C,R,X,Pt,zt,q),Ut=ic(V,C,R,X,wt,At,q);E.emplaceBack(st+kt-G,st+Tt-G,st+Ut-G),q.primitiveLength++}})(t,i,s,a,l,r),v&&(function(w,S,E,C,D,R){const V=[];for(let ot=0;ot<C.length/2;ot++)V.push(-1);const X={count:0};let G=0,q=w.getOrCreateLatestSegment(S,E),st=q.vertexLength;for(let ot=0;ot<D.length;ot++){const mt=D[ot];for(let Pt=1;Pt<D[ot].length;Pt+=2){const wt=mt[Pt-1],Mt=mt[Pt];let zt=V[wt]<G,At=V[Mt]<G;q.vertexLength+((zt?1:0)+(At?1:0))>Jt.MAX_VERTEX_ARRAY_LENGTH&&(q=w.createNewSegment(S,E),G=X.count,zt=!0,At=!0,st=0);const kt=ic(V,C,R,X,wt,zt,q),Tt=ic(V,C,R,X,Mt,At,q);E.emplaceBack(st+kt-G,st+Tt-G),q.primitiveLength++}}})(h,i,f,a,g,r),t.forceNewSegmentOnNextPrepare(),h?.forceNewSegmentOnNextPrepare()}function ic(r,t,i,s,a,l,h){if(l){const f=s.count;return i(t[2*a],t[2*a+1]),r[a]=s.count,s.count++,h.vertexLength++,f}return r[a]}class Vh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new it,this.indexArray=new Et,this.indexArray2=new St,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new Jt,this.segments2=new Jt,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(t,i,s){this.hasDependencies=Cu("fill",this.layers,i);const a=this.layers[0].layout.get("fill-sort-key"),l=!a.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,S=un(f,w);if(!this.layers[0]._featureFilter.filter(new ge(this.zoom),S,s))continue;const E=l?a.evaluate(S,{},s,i.availableImages):void 0,C={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:w?S.geometry:Bn(f),patterns:{},sortKey:E};h.push(C)}l&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:v}=f;if(this.hasDependencies){const w=Oh("fill",this.layers,f,{zoom:this.zoom},i);this.patternFeatures.push(w)}else this.addFeature(f,g,y,s,{},i.subdivisionGranularity);i.featureIndex.insert(t[y].feature,g,y,v,this.index)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(t,i,s){for(const a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,i,s,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nm),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,i,s,a,l,h){for(const f of ua(i,500)){const g=hp(f,a,h.fill.getGranularityForZoomLevel(a.z)),y=this.layoutVertexArray;dp(((v,w)=>{y.emplaceBack(v,w)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,canonical:a})}}let pp,fp;Lt("FillBucket",Vh,{omit:["layers","patternFeatures"]});var Jm={get paint(){return fp=fp||new Mi({"fill-antialias":new Vt(W.paint_fill["fill-antialias"]),"fill-opacity":new Wt(W.paint_fill["fill-opacity"]),"fill-color":new Wt(W.paint_fill["fill-color"]),"fill-outline-color":new Wt(W.paint_fill["fill-outline-color"]),"fill-translate":new Vt(W.paint_fill["fill-translate"]),"fill-translate-anchor":new Vt(W.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ia(W.paint_fill["fill-pattern"])})},get layout(){return pp=pp||new Mi({"fill-sort-key":new Wt(W.layout_fill["fill-sort-key"])})}};class Qm extends cr{constructor(t,i){super(t,Jm,i)}recalculate(t,i){super.recalculate(t,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(t){return new Vh(t)}queryRadius(){return Iu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:i,transform:s,pixelsToTileUnits:a}){return qd(Eu(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,a),i)}isTileClipped(){return!0}}const tg=qe([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),eg=qe([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ig}=tg;class Ro{constructor(t,i,s,a,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=a,this._values=l,t.readFields(rg,this,i)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const i=t.readVarint()+t.pos,s=[];let a,l=1,h=0,f=0,g=0;for(;t.pos<i;){if(h<=0){const y=t.readVarint();l=7&y,h=y>>3}if(h--,l===1||l===2)f+=t.readSVarint(),g+=t.readSVarint(),l===1&&(a&&s.push(a),a=[]),a&&a.push(new dt(f,g));else{if(l!==7)throw new Error(`unknown command ${l}`);a&&a.push(a[0].clone())}}return a&&s.push(a),s}bbox(){const t=this._pbf;t.pos=this._geometry;const i=t.readVarint()+t.pos;let s=1,a=0,l=0,h=0,f=1/0,g=-1/0,y=1/0,v=-1/0;for(;t.pos<i;){if(a<=0){const w=t.readVarint();s=7&w,a=w>>3}if(a--,s===1||s===2)l+=t.readSVarint(),h+=t.readSVarint(),l<f&&(f=l),l>g&&(g=l),h<y&&(y=h),h>v&&(v=h);else if(s!==7)throw new Error(`unknown command ${s}`)}return[f,y,g,v]}toGeoJSON(t,i,s){const a=this.extent*Math.pow(2,s),l=this.extent*t,h=this.extent*i,f=this.loadGeometry();function g(S){return[360*(S.x+l)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(S.y+h)/a)*Math.PI))-90]}function y(S){return S.map(g)}let v;if(this.type===1){const S=[];for(const C of f)S.push(C[0]);const E=y(S);v=S.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){const S=f.map(y);v=S.length===1?{type:"LineString",coordinates:S[0]}:{type:"MultiLineString",coordinates:S}}else{if(this.type!==3)throw new Error("unknown feature type");{const S=(function(C){const D=C.length;if(D<=1)return[C];const R=[];let V,X;for(let G=0;G<D;G++){const q=ng(C[G]);q!==0&&(X===void 0&&(X=q<0),X===q<0?(V&&R.push(V),V=[C[G]]):V&&V.push(C[G]))}return V&&R.push(V),R})(f),E=[];for(const C of S)E.push(C.map(y));v=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}const w={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(w.id=this.id),w}}function rg(r,t,i){r===1?t.id=i.readVarint():r===2?(function(s,a){const l=s.readVarint()+s.pos;for(;s.pos<l;){const h=a._keys[s.readVarint()],f=a._values[s.readVarint()];a.properties[h]=f}})(i,t):r===3?t.type=i.readVarint():r===4&&(t._geometry=i.pos)}function ng(r){let t=0;for(let i,s,a=0,l=r.length,h=l-1;a<l;h=a++)i=r[a],s=r[h],t+=(s.x-i.x)*(i.y+s.y);return t}Ro.types=["Unknown","Point","LineString","Polygon"];class mp{constructor(t,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(sg,this,i),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const i=this._pbf.readVarint()+this._pbf.pos;return new Ro(this._pbf,i,this.extent,this._keys,this._values)}}function sg(r,t,i){r===15?t.version=i.readVarint():r===1?t.name=i.readString():r===5?t.extent=i.readVarint():r===2?t._features.push(i.pos):r===3?t._keys.push(i.readString()):r===4&&t._values.push((function(s){let a=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const h=s.readVarint()>>3;a=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(a==null)throw new Error("unknown feature value");return a})(i))}class gp{constructor(t,i){this.layers=t.readFields(ag,{},i)}}function ag(r,t,i){if(r===3){const s=new mp(i,i.readVarint()+i.pos);s.length&&(t[s.name]=s)}}const Uh=Math.pow(2,13);function rc(r,t,i,s,a,l,h,f){r.emplaceBack(t,i,2*Math.floor(s*Uh)+h,a*Uh*2,l*Uh*2,Math.round(f))}class Gh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Y,this.centroidVertexArray=new H,this.indexArray=new Et,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new Jt,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(t,i,s){this.features=[],this.hasDependencies=Cu("fill-extrusion",this.layers,i);for(const{feature:a,id:l,index:h,sourceLayerIndex:f}of t){const g=this.layers[0]._featureFilter.needGeometry,y=un(a,g);if(!this.layers[0]._featureFilter.filter(new ge(this.zoom),y,s))continue;const v={id:l,sourceLayerIndex:f,index:h,geometry:g?y.geometry:Bn(a),properties:a.properties,type:a.type,patterns:{}};this.hasDependencies?this.features.push(Oh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,h,s,{},i.subdivisionGranularity),i.featureIndex.insert(a,v.geometry,h,f,this.index,!0)}}addFeatures(t,i,s){for(const a of this.features){const{geometry:l}=a;this.addFeature(a,l,a.index,i,s,t.subdivisionGranularity)}}update(t,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ig),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,eg.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,i,s,a,l,h){for(const f of ua(i,500)){const g={x:0,y:0,sampleCount:0},y=this.layoutVertexArray.length;this.processPolygon(g,a,t,f,h);const v=this.layoutVertexArray.length-y,w=Math.floor(g.x/g.sampleCount),S=Math.floor(g.y/g.sampleCount);for(let E=0;E<v;E++)this.centroidVertexArray.emplaceBack(w,S)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,canonical:a})}processPolygon(t,i,s,a,l){if(a.length<1||_p(a[0]))return;for(const w of a)w.length!==0&&og(t,w);const h={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},f=l.fill.getGranularityForZoomLevel(i.z),g=Ro.types[s.type]==="Polygon";for(const w of a){if(w.length===0||_p(w))continue;const S=La(w,f,g);this._generateSideFaces(S,h)}if(!g)return;const y=hp(a,i,f,!1),v=this.layoutVertexArray;dp(((w,S)=>{rc(v,w,S,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles)}_generateSideFaces(t,i){let s=0;for(let a=1;a<t.length;a++){const l=t[a],h=t[a-1];if(lg(l,h))continue;i.segment.vertexLength+4>Jt.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const f=l.sub(h)._perp()._unit(),g=h.dist(l);s+g>32768&&(s=0),rc(this.layoutVertexArray,l.x,l.y,f.x,f.y,0,0,s),rc(this.layoutVertexArray,l.x,l.y,f.x,f.y,0,1,s),s+=g,rc(this.layoutVertexArray,h.x,h.y,f.x,f.y,0,0,s),rc(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 og(r,t){for(let i=0;i<t.length;i++){const s=t[i];i===t.length-1&&t[0].x===s.x&&t[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function lg(r,t){return r.x===t.x&&(r.x<0||r.x>le)||r.y===t.y&&(r.y<0||r.y>le)}function _p(r){return r.every((t=>t.x<0))||r.every((t=>t.x>le))||r.every((t=>t.y<0))||r.every((t=>t.y>le))}let yp;Lt("FillExtrusionBucket",Gh,{omit:["layers","features"]});var cg={get paint(){return yp=yp||new Mi({"fill-extrusion-opacity":new Vt(W["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wt(W["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Vt(W["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Vt(W["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ia(W["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wt(W["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wt(W["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Vt(W["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ug extends cr{constructor(t,i){super(t,cg,i)}createBucket(t){return new Gh(t)}queryRadius(){return Iu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:h,pixelPosMatrix:f}){const g=Eu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,h),y=this.paint.get("fill-extrusion-height").evaluate(i,s),v=this.paint.get("fill-extrusion-base").evaluate(i,s),w=(function(E,C){const D=[];for(const R of E){const V=[R.x,R.y,0,1];Zn(V,V,C),D.push(new dt(V[0]/V[3],V[1]/V[3]))}return D})(g,f),S=(function(E,C,D,R){const V=[],X=[],G=R[8]*C,q=R[9]*C,st=R[10]*C,ot=R[11]*C,mt=R[8]*D,Pt=R[9]*D,wt=R[10]*D,Mt=R[11]*D;for(const zt of E){const At=[],kt=[];for(const Tt of zt){const Ut=Tt.x,Gt=Tt.y,Ht=R[0]*Ut+R[4]*Gt+R[12],Ot=R[1]*Ut+R[5]*Gt+R[13],re=R[2]*Ut+R[6]*Gt+R[14],ze=R[3]*Ut+R[7]*Gt+R[15],si=re+st,Ci=ze+ot,Xr=Ht+mt,Yi=Ot+Pt,vi=re+wt,Ai=ze+Mt,He=new dt((Ht+G)/Ci,(Ot+q)/Ci);He.z=si/Ci,At.push(He);const bi=new dt(Xr/Ai,Yi/Ai);bi.z=vi/Ai,kt.push(bi)}V.push(At),X.push(kt)}return[V,X]})(a,v,y,f);return(function(E,C,D){let R=1/0;qd(D,C)&&(R=xp(D,C[0]));for(let V=0;V<C.length;V++){const X=C[V],G=E[V];for(let q=0;q<X.length-1;q++){const st=X[q],ot=[st,X[q+1],G[q+1],G[q],st];Zd(D,ot)&&(R=Math.min(R,xp(D,ot)))}}return R!==1/0&&R})(S[0],S[1],w)}}function nc(r,t){return r.x*t.x+r.y*t.y}function xp(r,t){if(r.length===1){let i=0;const s=t[i++];let a;for(;!a||s.equals(a);)if(a=t[i++],!a)return 1/0;for(;i<t.length;i++){const l=t[i],h=r[0],f=a.sub(s),g=l.sub(s),y=h.sub(s),v=nc(f,f),w=nc(f,g),S=nc(g,g),E=nc(y,f),C=nc(y,g),D=v*S-w*w,R=(S*E-w*C)/D,V=(v*C-w*E)/D,X=s.z*(1-R-V)+a.z*R+l.z*V;if(isFinite(X))return X}return 1/0}{let i=1/0;for(const s of t)i=Math.min(i,s.z);return i}}const hg=qe([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dg}=hg,pg=qe([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fg}=pg,mg=Math.cos(Math.PI/180*37.5),vp=Math.pow(2,14)/.5;class $h{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new rt,this.layoutVertexArray2=new nt,this.indexArray=new Et,this.programConfigurations=new fs(t.layers,t.zoom),this.segments=new Jt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(t,i,s){this.hasDependencies=Cu("line",this.layers,i)||this.hasLineDasharray(this.layers);const a=this.layers[0].layout.get("line-sort-key"),l=!a.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of t){const w=this.layers[0]._featureFilter.needGeometry,S=un(f,w);if(!this.layers[0]._featureFilter.filter(new ge(this.zoom),S,s))continue;const E=l?a.evaluate(S,{},s):void 0,C={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:w?S.geometry:Bn(f),patterns:{},dashes:{},sortKey:E};h.push(C)}l&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:v}=f;this.hasDependencies?(Cu("line",this.layers,i)?Oh("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(t[y].feature,g,y,v,this.index)}}update(t,i,s,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:s,dashPositions:a})}addFeatures(t,i,s,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,fg)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dg),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,i,s,a,l,h,f){const g=this.layers[0].layout,y=g.get("line-join").evaluate(t,{}),v=g.get("line-cap"),w=g.get("line-miter-limit"),S=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const E of i)this.addLine(E,t,y,v,w,S,a,f);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{imagePositions:l,dashPositions:h,canonical:a})}addLine(t,i,s,a,l,h,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=La(t,f?g.line.getGranularityForZoomLevel(f.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let G=0;G<t.length-1;G++)this.totalDistance+=t[G].dist(t[G+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=Ro.types[i.type]==="Polygon";let v=t.length;for(;v>=2&&t[v-1].equals(t[v-2]);)v--;let w=0;for(;w<v-1&&t[w].equals(t[w+1]);)w++;if(v<(y?3:2))return;s==="bevel"&&(l=1.05);const S=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let C,D,R,V,X;this.e1=this.e2=-1,y&&(C=t[v-2],X=t[w].sub(C)._unit()._perp());for(let G=w;G<v;G++){if(R=G===v-1?y?t[w+1]:void 0:t[G+1],R&&t[G].equals(R))continue;X&&(V=X),C&&(D=C),C=t[G],X=R?R.sub(C)._unit()._perp():V,V=V||X;let q=V.add(X);q.x===0&&q.y===0||q._unit();const st=V.x*X.x+V.y*X.y,ot=q.x*X.x+q.y*X.y,mt=ot!==0?1/ot:1/0,Pt=2*Math.sqrt(2-2*ot),wt=ot<mg&&D&&R,Mt=V.x*X.y-V.y*X.x>0;if(wt&&G>w){const kt=C.dist(D);if(kt>2*S){const Tt=C.sub(C.sub(D)._mult(S/kt)._round());this.updateDistance(D,Tt),this.addCurrentVertex(Tt,V,0,0,E),D=Tt}}const zt=D&&R;let At=zt?s:y?"butt":a;if(zt&&At==="round"&&(mt<h?At="miter":mt<=2&&(At="fakeround")),At==="miter"&&mt>l&&(At="bevel"),At==="bevel"&&(mt>2&&(At="flipbevel"),mt<l&&(At="miter")),D&&this.updateDistance(D,C),At==="miter")q._mult(mt),this.addCurrentVertex(C,q,0,0,E);else if(At==="flipbevel"){if(mt>100)q=X.mult(-1);else{const kt=mt*V.add(X).mag()/V.sub(X).mag();q._perp()._mult(kt*(Mt?-1:1))}this.addCurrentVertex(C,q,0,0,E),this.addCurrentVertex(C,q.mult(-1),0,0,E)}else if(At==="bevel"||At==="fakeround"){const kt=-Math.sqrt(mt*mt-1),Tt=Mt?kt:0,Ut=Mt?0:kt;if(D&&this.addCurrentVertex(C,V,Tt,Ut,E),At==="fakeround"){const Gt=Math.round(180*Pt/Math.PI/20);for(let Ht=1;Ht<Gt;Ht++){let Ot=Ht/Gt;if(Ot!==.5){const ze=Ot-.5;Ot+=Ot*ze*(Ot-1)*((1.0904+st*(st*(3.55645-1.43519*st)-3.2452))*ze*ze+(.848013+st*(.215638*st-1.06021)))}const re=X.sub(V)._mult(Ot)._add(V)._unit()._mult(Mt?-1:1);this.addHalfVertex(C,re.x,re.y,!1,Mt,0,E)}}R&&this.addCurrentVertex(C,X,-Tt,-Ut,E)}else if(At==="butt")this.addCurrentVertex(C,q,0,0,E);else if(At==="square"){const kt=D?1:-1;this.addCurrentVertex(C,q,kt,kt,E)}else At==="round"&&(D&&(this.addCurrentVertex(C,V,0,0,E),this.addCurrentVertex(C,V,1,1,E,!0)),R&&(this.addCurrentVertex(C,X,-1,-1,E,!0),this.addCurrentVertex(C,X,0,0,E)));if(wt&&G<v-1){const kt=C.dist(R);if(kt>2*S){const Tt=C.add(R.sub(C)._mult(S/kt)._round());this.updateDistance(C,Tt),this.addCurrentVertex(Tt,X,0,0,E),C=Tt}}}}addCurrentVertex(t,i,s,a,l,h=!1){const f=i.y*a-i.x,g=-i.y-i.x*a;this.addHalfVertex(t,i.x+i.y*s,i.y-i.x*s,h,!1,s,l),this.addHalfVertex(t,f,g,h,!0,-a,l),this.distance>vp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,i,s,a,l,h))}addHalfVertex({x:t,y:i},s,a,l,h,f,g){const y=.5*(this.lineClips?this.scaledDistance*(vp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(l?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*a)+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 v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),h?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,i){this.distance+=t.dist(i),this.updateScaledDistance()}hasLineDasharray(t){for(const i of t){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(t,i,s,a){for(const l of t){const h=l.paint.get("line-dasharray");if(!h||h.value.kind==="constant")continue;const f=l.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},v={dasharray:h.value.evaluate({zoom:s+1},i,{}),round:f},w=`${g.dasharray.join(",")},${g.round}`,S=`${y.dasharray.join(",")},${y.round}`,E=`${v.dasharray.join(",")},${v.round}`;a.dashDependencies[w]=g,a.dashDependencies[S]=y,a.dashDependencies[E]=v,i.dashes[l.id]={min:w,mid:S,max:E}}}}let bp,wp;Lt("LineBucket",$h,{omit:["layers","patternFeatures"]});var Tp={get paint(){return wp=wp||new Mi({"line-opacity":new Wt(W.paint_line["line-opacity"]),"line-color":new Wt(W.paint_line["line-color"]),"line-translate":new Vt(W.paint_line["line-translate"]),"line-translate-anchor":new Vt(W.paint_line["line-translate-anchor"]),"line-width":new Wt(W.paint_line["line-width"]),"line-gap-width":new Wt(W.paint_line["line-gap-width"]),"line-offset":new Wt(W.paint_line["line-offset"]),"line-blur":new Wt(W.paint_line["line-blur"]),"line-dasharray":new Ia(W.paint_line["line-dasharray"]),"line-pattern":new Ia(W.paint_line["line-pattern"]),"line-gradient":new Ea(W.paint_line["line-gradient"])})},get layout(){return bp=bp||new Mi({"line-cap":new Vt(W.layout_line["line-cap"]),"line-join":new Wt(W.layout_line["line-join"]),"line-miter-limit":new Vt(W.layout_line["line-miter-limit"]),"line-round-limit":new Vt(W.layout_line["line-round-limit"]),"line-sort-key":new Wt(W.layout_line["line-sort-key"])})}};class gg extends Wt{possiblyEvaluate(t,i){return i=new ge(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(t,i)}evaluate(t,i,s,a){return i=li({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(t,i,s,a)}}let zu;class _g extends cr{constructor(t,i){super(t,Tp,i),this.gradientVersion=0,zu||(zu=new gg(Tp.paint.properties["line-width"].specification),zu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof Ds,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,i){super.recalculate(t,i),this.paint._values["line-floorwidth"]=zu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new $h(t)}queryRadius(t){const i=t,s=Sp(Ao("line-width",this,i),Ao("line-gap-width",this,i)),a=Ao("line-offset",this,i);return s/2+Math.abs(a)+Iu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:s,geometry:a,transform:l,pixelsToTileUnits:h}){const f=Eu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,h),g=h/2*Sp(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&&(a=(function(v,w){const S=[];for(let E=0;E<v.length;E++){const C=v[E],D=[];for(let R=0;R<C.length;R++){const V=C[R-1],X=C[R],G=C[R+1],q=R===0?new dt(0,0):X.sub(V)._unit()._perp(),st=R===C.length-1?new dt(0,0):G.sub(X)._unit()._perp(),ot=q._add(st)._unit(),mt=ot.x*st.x+ot.y*st.y;mt!==0&&ot._mult(1/mt),D.push(ot._mult(w)._add(X))}S.push(D)}return S})(a,y*h)),(function(v,w,S){for(let E=0;E<w.length;E++){const C=w[E];if(v.length>=3){for(let D=0;D<C.length;D++)if(Co(v,C[D]))return!0}if(Sm(v,C,S))return!0}return!1})(f,a,g)}isTileClipped(){return!0}}function Sp(r,t){return t>0?t+2*r:r}const yg=qe([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),xg=qe([{name:"a_projected_pos",components:3,type:"Float32"}],4);qe([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const vg=qe([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);qe([{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 Pp=qe([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bg=qe([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wg(r,t,i){return r.sections.forEach((s=>{s.text=(function(a,l,h){const f=l.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),Dn.applyArabicShaping&&(a=Dn.applyArabicShaping(a)),a})(s.text,t,i)})),r}qe([{name:"triangle",components:3,type:"Uint16"}]),qe([{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"}]),qe([{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"}]),qe([{type:"Float32",name:"offsetX"}]),qe([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),qe([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var di=24;const sc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Tg={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},Sg={40:!0};function Mp(r,t,i,s,a,l){if("fontStack"in t){const h=i[t.fontStack],f=h&&h[r];return f?f.metrics.advance*t.scale+a:0}{const h=s[t.imageName];return h?h.displaySize[0]*t.scale*di/l+a:0}}function Ip(r,t,i,s){const a=Math.pow(r-t,2);return s?r<t?a/2:2*a:a+Math.abs(i)*i}function Pg(r,t,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),t!==41&&t!==65289||(s+=50),s}function Ep(r,t,i,s,a,l){let h=null,f=Ip(t,i,a,l);for(const g of s){const y=Ip(t-g.x,i,a,l)+g.badness;y<=f&&(h=g,f=y)}return{index:r,x:t,priorBreak:h,badness:f}}function Cp(r){return r?Cp(r.priorBreak).concat(r.index):[]}class Lo{constructor(t="",i=[],s=[]){this.text=t,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(t,i){const s=new Lo;for(let a=0;a<t.sections.length;a++){const l=t.sections[a];l.image?s.addImageSection(l):s.addTextSection(l,i)}return s}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=(function(t){let i="",s={premature:!0,value:void 0};const a=t[Symbol.iterator]();let l=a.next();const h=t[Symbol.iterator]();h.next();let f=h.next();for(;!l.done;)i+=!f.done&&Fl(f.value.codePointAt(0))&&!sc[f.value]||!s.premature&&Fl(s.value.codePointAt(0))&&!sc[s.value]||!sc[l.value]?l.value:sc[l.value],s={value:l.value,premature:!1},l=a.next(),f=h.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const t=this.text.match(/^\s*/),i=t?t[0].length:0,s=this.text.match(/\S\s*$/),a=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-a),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-a)}substring(t,i){const s=[...this.text].slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new Lo(s,this.sections,a)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,i)=>Math.max(t,this.sections[i].scale)),0)}getMaxImageSize(t){let i=0,s=0;for(let a=0;a<this.length();a++){const l=this.getSection(a);if("imageName"in l){const h=t[l.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(t,i){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...t.text].map((()=>s)))}addImageSection(t){const i=t.image?t.image.name:"";if(i.length===0)return void Re("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):Re("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,s,a,l){const h=[],f=this.determineAverageLineWidth(t,i,s,a,l),g=this.hasZeroWidthSpaces();let y=0,v=0;const w=this.text[Symbol.iterator]();let S=w.next();const E=this.text[Symbol.iterator]();E.next();let C=E.next();const D=this.text[Symbol.iterator]();D.next(),D.next();let R=D.next();for(;!S.done;){const V=this.getSection(v),X=S.value.codePointAt(0);if(fu(X)||(y+=Mp(X,V,s,a,t,l)),!C.done){const G=Th(X),q=C.value.codePointAt(0);(Tg[X]||G||"imageName"in V||!R.done&&Sg[q])&&h.push(Ep(v+1,y,f,h,Pg(X,q,G&&g),!1))}v++,S=w.next(),C=E.next(),R=D.next()}return Cp(Ep(this.length(),y,f,h,0,!0))}determineAverageLineWidth(t,i,s,a,l){let h=0,f=0;for(const g of this.text){const y=this.getSection(f);h+=Mp(g.codePointAt(0),y,s,a,t,l),f++}return h/Math.max(1,Math.ceil(h/i))}}const Zh=4294967296,Ap=1/Zh,kp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class qh{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,i,s=this.length){for(;this.pos<s;){const a=this.readVarint(),l=a>>3,h=this.pos;this.type=7&a,t(l,i,this),this.pos===h&&this.skip(a)}return i}readMessage(t,i){return this.readFields(t,i,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Zh;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Zh;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const i=this.buf;let s,a;return a=i[this.pos++],s=127&a,a<128?s:(a=i[this.pos++],s|=(127&a)<<7,a<128?s:(a=i[this.pos++],s|=(127&a)<<14,a<128?s:(a=i[this.pos++],s|=(127&a)<<21,a<128?s:(a=i[this.pos],s|=(15&a)<<28,(function(l,h,f){const g=f.buf;let y,v;if(v=g[f.pos++],y=(112&v)>>4,v<128||(v=g[f.pos++],y|=(127&v)<<3,v<128)||(v=g[f.pos++],y|=(127&v)<<10,v<128)||(v=g[f.pos++],y|=(127&v)<<17,v<128)||(v=g[f.pos++],y|=(127&v)<<24,v<128)||(v=g[f.pos++],y|=(1&v)<<31,v<128))return Fo(l,y,h);throw new Error("Expected varint not more than 10 bytes")})(s,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,i=this.pos;return this.pos=t,t-i>=12&&kp?kp.decode(this.buf.subarray(i,t)):(function(s,a,l){let h="",f=a;for(;f<l;){const g=s[f];let y,v,w,S=null,E=g>239?4:g>223?3:g>191?2:1;if(f+E>l)break;E===1?g<128&&(S=g):E===2?(y=s[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):E===3?(y=s[f+1],v=s[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):E===4&&(y=s[f+1],v=s[f+2],w=s[f+3],(192&y)==128&&(192&v)==128&&(192&w)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&w,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,E=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),f+=E}return h})(this.buf,i,t)}readBytes(){const t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i}readPackedVarint(t=[],i){const s=this.readPackedEnd();for(;this.pos<s;)t.push(this.readVarint(i));return t}readPackedSVarint(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(t){const i=7&t;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(t,i){this.writeVarint(t<<3|i)}realloc(t){let i=this.length||16;for(;i<this.pos+t;)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(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Ap),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Ap),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?(function(i,s){let a,l;if(i>=0?(a=i%4294967296|0,l=i/4294967296|0):(a=~(-i%4294967296),l=~(-i/4294967296),4294967295^a?a=a+1|0:(a=0,l=l+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)})(a,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)))))})(l,s)})(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const i=this.pos;this.pos=(function(a,l,h){for(let f,g,y=0;y<l.length;y++){if(f=l.charCodeAt(y),f>55295&&f<57344){if(!g){f>56319||y+1===l.length?(a[h++]=239,a[h++]=191,a[h++]=189):g=f;continue}if(f<56320){a[h++]=239,a[h++]=191,a[h++]=189,g=f;continue}f=g-55296<<10|f-56320|65536,g=null}else g&&(a[h++]=239,a[h++]=191,a[h++]=189,g=null);f<128?a[h++]=f:(f<2048?a[h++]=f>>6|192:(f<65536?a[h++]=f>>12|224:(a[h++]=f>>18|240,a[h++]=f>>12&63|128),a[h++]=f>>6&63|128),a[h++]=63&f|128)}return h})(this.buf,t,this.pos);const s=this.pos-i;s>=128&&Dp(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const i=t.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=t[s]}writeRawMessage(t,i){this.pos++;const s=this.pos;t(i,this);const a=this.pos-s;a>=128&&Dp(s,a,this),this.pos=s-1,this.writeVarint(a),this.pos+=a}writeMessage(t,i,s){this.writeTag(t,2),this.writeRawMessage(i,s)}writePackedVarint(t,i){i.length&&this.writeMessage(t,Mg,i)}writePackedSVarint(t,i){i.length&&this.writeMessage(t,Ig,i)}writePackedBoolean(t,i){i.length&&this.writeMessage(t,Ag,i)}writePackedFloat(t,i){i.length&&this.writeMessage(t,Eg,i)}writePackedDouble(t,i){i.length&&this.writeMessage(t,Cg,i)}writePackedFixed32(t,i){i.length&&this.writeMessage(t,kg,i)}writePackedSFixed32(t,i){i.length&&this.writeMessage(t,Dg,i)}writePackedFixed64(t,i){i.length&&this.writeMessage(t,zg,i)}writePackedSFixed64(t,i){i.length&&this.writeMessage(t,Rg,i)}writeBytesField(t,i){this.writeTag(t,2),this.writeBytes(i)}writeFixed32Field(t,i){this.writeTag(t,5),this.writeFixed32(i)}writeSFixed32Field(t,i){this.writeTag(t,5),this.writeSFixed32(i)}writeFixed64Field(t,i){this.writeTag(t,1),this.writeFixed64(i)}writeSFixed64Field(t,i){this.writeTag(t,1),this.writeSFixed64(i)}writeVarintField(t,i){this.writeTag(t,0),this.writeVarint(i)}writeSVarintField(t,i){this.writeTag(t,0),this.writeSVarint(i)}writeStringField(t,i){this.writeTag(t,2),this.writeString(i)}writeFloatField(t,i){this.writeTag(t,5),this.writeFloat(i)}writeDoubleField(t,i){this.writeTag(t,1),this.writeDouble(i)}writeBooleanField(t,i){this.writeVarintField(t,+i)}}function Fo(r,t,i){return i?4294967296*t+(r>>>0):4294967296*(t>>>0)+(r>>>0)}function Dp(r,t,i){const s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(s);for(let a=i.pos-1;a>=r;a--)i.buf[a+s]=i.buf[a]}function Mg(r,t){for(let i=0;i<r.length;i++)t.writeVarint(r[i])}function Ig(r,t){for(let i=0;i<r.length;i++)t.writeSVarint(r[i])}function Eg(r,t){for(let i=0;i<r.length;i++)t.writeFloat(r[i])}function Cg(r,t){for(let i=0;i<r.length;i++)t.writeDouble(r[i])}function Ag(r,t){for(let i=0;i<r.length;i++)t.writeBoolean(r[i])}function kg(r,t){for(let i=0;i<r.length;i++)t.writeFixed32(r[i])}function Dg(r,t){for(let i=0;i<r.length;i++)t.writeSFixed32(r[i])}function zg(r,t){for(let i=0;i<r.length;i++)t.writeFixed64(r[i])}function Rg(r,t){for(let i=0;i<r.length;i++)t.writeSFixed64(r[i])}function Lg(r,t,i){r===1&&i.readMessage(Fg,t)}function Fg(r,t,i){if(r===3){const{id:s,bitmap:a,width:l,height:h,left:f,top:g,advance:y}=i.readMessage(Bg,{});t.push({id:s,bitmap:new Yl({width:l+6,height:h+6},a),metrics:{width:l,height:h,left:f,top:g,advance:y}})}}function Bg(r,t,i){r===1?t.id=i.readVarint():r===2?t.bitmap=i.readBytes():r===3?t.width=i.readVarint():r===4?t.height=i.readVarint():r===5?t.left=i.readSVarint():r===6?t.top=i.readSVarint():r===7&&(t.advance=i.readVarint())}function zp(r){let t=0,i=0;for(const h of r)t+=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(t/.95)),i),h:1/0}];let a=0,l=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,l=Math.max(l,h.y+h.h),a=Math.max(a,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:a,h:l,fill:t/(a*l)||0}}class Wh{constructor(t,{pixelRatio:i,version:s,stretchX:a,stretchY:l,content:h,textFitWidth:f,textFitHeight:g}){this.paddedRect=t,this.pixelRatio=i,this.stretchX=a,this.stretchY=l,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 Rp{constructor(t,i){const s={},a={};this.haveRenderCallbacks=[];const l=[];this.addImages(t,s,l),this.addImages(i,a,l);const{w:h,h:f}=zp(l),g=new tr({width:h||1,height:f||1});for(const y in t){const v=t[y],w=s[y].paddedRect;tr.copy(v.data,g,{x:0,y:0},{x:w.x+1,y:w.y+1},v.data)}for(const y in i){const v=i[y],w=a[y].paddedRect,S=w.x+1,E=w.y+1,C=v.data.width,D=v.data.height;tr.copy(v.data,g,{x:0,y:0},{x:S,y:E},v.data),tr.copy(v.data,g,{x:0,y:D-1},{x:S,y:E-1},{width:C,height:1}),tr.copy(v.data,g,{x:0,y:0},{x:S,y:E+D},{width:C,height:1}),tr.copy(v.data,g,{x:C-1,y:0},{x:S-1,y:E},{width:1,height:D}),tr.copy(v.data,g,{x:0,y:0},{x:S+C,y:E},{width:1,height:D})}this.image=g,this.iconPositions=s,this.patternPositions=a}addImages(t,i,s){for(const a in t){const l=t[a],h={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(h),i[a]=new Wh(h,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(t,i){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in t.updatedImages)this.patchUpdatedImage(this.iconPositions[s],t.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],t.getImage(s),i)}patchUpdatedImage(t,i,s){if(!t||!i||t.version===i.version)return;t.version=i.version;const[a,l]=t.tl;s.update(i.data,void 0,{x:a,y:l})}}var qs;function Ru(r,t,i,s,a,l,h,f,g,y,v,w,S,E,C){const D=Lo.fromFeature(r,a);let R;w===M.ay.vertical&&D.verticalizePunctuation();let V=D.determineLineBreaks(y,l,t,s,E);const{processBidirectionalText:X,processStyledBidirectionalText:G}=Dn;if(X&&D.sections.length===1){R=[],V=V.map((mt=>D.toCodeUnitIndex(mt)));const ot=X(D.toString(),V);for(const mt of ot){const Pt=[...mt].map((()=>0));R.push(new Lo(mt,D.sections,Pt))}}else if(G){R=[],V=V.map((wt=>D.toCodeUnitIndex(wt)));let ot=0;const mt=[];for(const wt of D.text)mt.push(...Array(wt.length).fill(D.sectionIndex[ot])),ot++;const Pt=G(D.text,mt,V);for(const wt of Pt){const Mt=[];let zt="";for(const At of wt[0])Mt.push(wt[1][zt.length]),zt+=At;R.push(new Lo(wt[0],D.sections,Mt))}}else R=(function(ot,mt){const Pt=[];let wt=0;for(const Mt of mt)Pt.push(ot.substring(wt,Mt)),wt=Mt;return wt<ot.length()&&Pt.push(ot.substring(wt,ot.length())),Pt})(D,V);const q=[],st={positionedLines:q,text:D.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:w,iconsInText:!1,verticalizable:!1};return(function(ot,mt,Pt,wt,Mt,zt,At,kt,Tt,Ut,Gt,Ht){let Ot=0,re=0,ze=0,si=0;const Ci=kt==="right"?1:kt==="left"?0:.5,Xr=di/Ht;let Yi=0;for(const He of Mt){He.trim();const bi=He.getMaxScale(),ji={positionedGlyphs:[],lineOffset:0};ot.positionedLines[Yi]=ji;const Ni=ji.positionedGlyphs;let er=0;if(!He.length()){re+=zt,++Yi;continue}const ki=Og(wt,He,Xr);let ir=0;for(const mi of He.text){const Ne=He.getSection(ir),ai=mi.codePointAt(0),$e=jg(Tt,Gt,ai),gi={glyph:ai,imageName:null,x:Ot,y:re+-17,vertical:$e,scale:1,fontStack:"",sectionIndex:He.getSectionIndex(ir),metrics:null,rect:null};let _s;if("fontStack"in Ne){if(_s=Ng(Ne,ai,$e,ki,mt,Pt),!_s)continue;gi.fontStack=Ne.fontStack}else{if(ot.iconsInText=!0,Ne.scale*=Xr,_s=Vg(Ne,$e,bi,ki,wt),!_s)continue;er=Math.max(er,_s.imageOffset),gi.imageName=Ne.imageName}const{rect:pn,metrics:gc,baselineOffset:Ks}=_s;gi.y+=Ks,gi.scale=Ne.scale,gi.metrics=gc,gi.rect=pn,Ni.push(gi),$e?(ot.verticalizable=!0,Ot+=("imageName"in Ne?gc.advance:di)*Ne.scale+Ut):Ot+=gc.advance*Ne.scale+Ut,ir++}Ni.length!==0&&(ze=Math.max(Ot-Ut,ze),Ug(Ni,0,Ni.length-1,Ci)),Ot=0,ji.lineOffset=Math.max(er,(bi-1)*di);const Yr=zt*bi+er;re+=Yr,si=Math.max(Yr,si),++Yi}const{horizontalAlign:vi,verticalAlign:Ai}=Hh(At);(function(He,bi,ji,Ni,er,ki,ir,Yr,mi){const Ne=(bi-ji)*er;let ai=0;ai=ki!==ir?-Yr*Ni- -17:-Ni*mi*ir+.5*ir;for(const $e of He)for(const gi of $e.positionedGlyphs)gi.x+=Ne,gi.y+=ai})(ot.positionedLines,Ci,vi,Ai,ze,si,zt,re,Mt.length),ot.top+=-Ai*re,ot.bottom=ot.top+re,ot.left+=-vi*ze,ot.right=ot.left+ze})(st,t,i,s,R,h,f,g,w,y,S,C),!(function(ot){for(const mt of ot)if(mt.positionedGlyphs.length!==0)return!1;return!0})(q)&&st}function Hh(r){let t=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=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:t,verticalAlign:i}}function Og(r,t,i){const s=t.getMaxScale()*di,{maxImageWidth:a,maxImageHeight:l}=t.getMaxImageSize(r),h=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,a*i),horizontalLineContentHeight:h}}function Lp(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function jg(r,t,i){return!(r===M.ay.horizontal||!t&&!Gs(i)||t&&(fu(i)||(s=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function Ng(r,t,i,s,a,l){const h=l[r.fontStack],f=(function(y,v,w,S){if(y&&y.rect)return y;const E=v[w.fontStack],C=E&&E[S];return C?{rect:null,metrics:C.metrics}:null})(h&&h[t],a,r,t);if(f===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*di;else{const y=Lp(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*di)*y}return{rect:f.rect,metrics:f.metrics,baselineOffset:g}}function Vg(r,t,i,s,a){const l=a[r.imageName];if(!l)return null;const h=l.paddedRect,f=l.displaySize,g={width:f[0],height:f[1],left:1,top:-3,advance:t?f[1]:f[0]};let y;if(t)y=s.verticalLineContentWidth-f[1]*r.scale;else{const v=Lp(r.verticalAlign);y=(s.horizontalLineContentHeight-f[1]*r.scale)*v}return{rect:h,metrics:g,baselineOffset:y,imageOffset:(t?f[0]:f[1])*r.scale-di*i}}function Ug(r,t,i,s){if(s===0)return;const a=r[i],l=(r[i].x+a.metrics.advance*a.scale)*s;for(let h=t;h<=i;h++)r[h].x-=l}function Gg(r,t,i){const{horizontalAlign:s,verticalAlign:a}=Hh(i),l=t[0]-r.displaySize[0]*s,h=t[1]-r.displaySize[1]*a;return{image:r,top:h,bottom:h+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function Fp(r){var t,i;let s=r.left,a=r.top,l=r.right-s,h=r.bottom-a;const f=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"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"&&l/h<y||f==="proportional"){const v=Math.ceil(h*y);s*=v/l,l=v}}else if(f==="proportional"&&g==="stretchOnly"&&y!==0&&l/h>y){const v=Math.ceil(l/y);a*=v/h,h=v}return{x1:s,y1:a,x2:s+l,y2:a+h}}function Bp(r,t,i,s,a,l){const h=r.image;let f;if(h.content){const R=h.content,V=h.pixelRatio||1;f=[R[0]/V,R[1]/V,h.displaySize[0]-R[2]/V,h.displaySize[1]-R[3]/V]}const g=t.left*l,y=t.right*l;let v,w,S,E;i==="width"||i==="both"?(E=a[0]+g-s[3],w=a[0]+y+s[1]):(E=a[0]+(g+y-h.displaySize[0])/2,w=E+h.displaySize[0]);const C=t.top*l,D=t.bottom*l;return i==="height"||i==="both"?(v=a[1]+C-s[0],S=a[1]+D+s[2]):(v=a[1]+(C+D-h.displaySize[1])/2,S=v+h.displaySize[1]),{image:h,top:v,right:w,bottom:S,left:E,collisionPadding:f}}Lt("ImagePosition",Wh),Lt("ImageAtlas",Rp),M.ay=void 0,(qs=M.ay||(M.ay={}))[qs.none=0]="none",qs[qs.horizontal=1]="horizontal",qs[qs.vertical=2]="vertical",qs[qs.horizontalOnly=3]="horizontalOnly";const ms=128,Ws=32640;function Op(r,t){const{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new ge(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:a}=i;let l=0;for(;l<s.length&&s[l]<=r;)l++;l=Math.max(0,l-1);let h=l;for(;h<s.length&&s[h]<r+1;)h++;h=Math.min(s.length-1,h);const f=s[l],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:a}:{kind:"camera",minZoom:f,maxZoom:g,minSize:i.evaluate(new ge(f)),maxSize:i.evaluate(new ge(g)),interpolationType:a}}}function Xh(r,t,i){let s="never";const a=r.get(t);return a?s=a:r.get(i)&&(s="always"),s}const $g=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Lu(r,t,i,s,a,l,h,f,g,y,v,w,S){const E=f?Math.min(Ws,Math.round(f[0])):0,C=f?Math.min(Ws,Math.round(f[1])):0;r.emplaceBack(t,i,Math.round(32*s),Math.round(32*a),l,h,(E<<1)+(g?1:0),C,16*y,16*v,256*w,256*S)}function Yh(r,t,i){r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i),r.emplaceBack(t.x,t.y,i)}function Zg(r){for(const t of r.sections)if(_u(t.text))return!0;return!1}class Kh{constructor(t){this.layoutVertexArray=new _t,this.indexArray=new Et,this.programConfigurations=t,this.segments=new Jt,this.dynamicLayoutVertexArray=new pt,this.opacityVertexArray=new ft,this.hasVisibleVertices=!1,this.placedSymbolArray=new x}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,i,s,a){this.isEmpty()||(s&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,yg.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,xg.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,$g,!0),this.opacityVertexBuffer.itemSize=1),(s||a)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Lt("SymbolBuffers",Kh);class Jh{constructor(t,i,s){this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Jt,this.collisionVertexArray=new Dt}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,vg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Lt("CollisionBuffers",Jh);class Bo{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((h=>h.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Op(this.zoom,i["text-size"]),this.iconSizeData=Op(this.zoom,i["icon-size"]);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=Xh(s,"text-overlap","text-allow-overlap")!=="never"||Xh(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!a.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((h=>M.ay[h]))),this.stateDependentLayerIds=this.layers.filter((h=>h.isStateDependent())).map((h=>h.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Kh(new fs(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Kh(new fs(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new k,this.lineVertexArray=new A,this.symbolInstances=new T,this.textAnchorOffsets=new j}calculateGlyphDependencies(t,i,s,a,l){for(const h of t)if(i[h.codePointAt(0)]=!0,(s||a)&&l){const f=sc[h];f&&(i[f.codePointAt(0)]=!0)}}populate(t,i,s){const a=this.layers[0],l=a.layout,h=l.get("text-font"),f=l.get("text-field"),g=l.get("icon-image"),y=(f.value.kind!=="constant"||f.value.value instanceof ei&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(h.value.kind!=="constant"||h.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,w=l.get("symbol-sort-key");if(this.features=[],!y&&!v)return;const S=i.iconDependencies,E=i.glyphDependencies,C=i.availableImages,D=new ge(this.zoom);for(const{feature:R,id:V,index:X,sourceLayerIndex:G}of t){const q=a._featureFilter.needGeometry,st=un(R,q);if(!a._featureFilter.filter(D,st,s))continue;let ot,mt;if(q||(st.geometry=Bn(R)),y){const wt=a.getValueAndResolveTokens("text-field",st,s,C),Mt=ei.factory(wt),zt=this.hasRTLText=this.hasRTLText||Zg(Mt);(!zt||Dn.getRTLTextPluginStatus()==="unavailable"||zt&&Dn.isParsed())&&(ot=wg(Mt,a,st))}if(v){const wt=a.getValueAndResolveTokens("icon-image",st,s,C);mt=wt instanceof Zi?wt:Zi.fromString(wt)}if(!ot&&!mt)continue;const Pt=this.sortFeaturesByKey?w.evaluate(st,{},s):void 0;if(this.features.push({id:V,text:ot,icon:mt,index:X,sourceLayerIndex:G,geometry:st.geometry,properties:R.properties,type:Ro.types[R.type],sortKey:Pt}),mt&&(S[mt.name]=!0),ot){const wt=h.evaluate(st,{},s).join(","),Mt=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(M.ay.vertical)>=0;for(const zt of ot.sections)if(zt.image)S[zt.image.name]=!0;else{const At=Sa(ot.toString()),kt=zt.fontStack||wt,Tt=E[kt]=E[kt]||{};this.calculateGlyphDependencies(zt.text,Tt,Mt,this.allowVerticalPlacement,At)}}}l.get("symbol-placement")==="line"&&(this.features=(function(R){const V={},X={},G=[];let q=0;function st(wt){G.push(R[wt]),q++}function ot(wt,Mt,zt){const At=X[wt];return delete X[wt],X[Mt]=At,G[At].geometry[0].pop(),G[At].geometry[0]=G[At].geometry[0].concat(zt[0]),At}function mt(wt,Mt,zt){const At=V[Mt];return delete V[Mt],V[wt]=At,G[At].geometry[0].shift(),G[At].geometry[0]=zt[0].concat(G[At].geometry[0]),At}function Pt(wt,Mt,zt){const At=zt?Mt[0][Mt[0].length-1]:Mt[0][0];return`${wt}:${At.x}:${At.y}`}for(let wt=0;wt<R.length;wt++){const Mt=R[wt],zt=Mt.geometry,At=Mt.text?Mt.text.toString():null;if(!At){st(wt);continue}const kt=Pt(At,zt),Tt=Pt(At,zt,!0);if(kt in X&&Tt in V&&X[kt]!==V[Tt]){const Ut=mt(kt,Tt,zt),Gt=ot(kt,Tt,G[Ut].geometry);delete V[kt],delete X[Tt],X[Pt(At,G[Gt].geometry,!0)]=Gt,G[Ut].geometry=null}else kt in X?ot(kt,Tt,zt):Tt in V?mt(kt,Tt,zt):(st(wt),V[kt]=q-1,X[Tt]=q-1)}return G.filter((wt=>wt.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((R,V)=>R.sortKey-V.sortKey))}update(t,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(t,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(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,i){const s=this.lineVertexArray.length;if(t.segment!==void 0){let a=t.dist(i[t.segment+1]),l=t.dist(i[t.segment]);const h={};for(let f=t.segment+1;f<i.length;f++)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:a},f<i.length-1&&(a+=i[f+1].dist(i[f]));for(let f=t.segment||0;f>=0;f--)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:l},f>0&&(l+=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(t,i,s,a,l,h,f,g,y,v,w,S){const E=t.indexArray,C=t.layoutVertexArray,D=t.segments.prepareSegment(4*i.length,C,E,this.canOverlap?h.sortKey:void 0),R=this.glyphOffsetArray.length,V=D.vertexLength,X=this.allowVerticalPlacement&&f===M.ay.vertical?Math.PI/2:0,G=h.text&&h.text.sections;for(let q=0;q<i.length;q++){const{tl:st,tr:ot,bl:mt,br:Pt,tex:wt,pixelOffsetTL:Mt,pixelOffsetBR:zt,minFontScaleX:At,minFontScaleY:kt,glyphOffset:Tt,isSDF:Ut,sectionIndex:Gt}=i[q],Ht=D.vertexLength,Ot=Tt[1];Lu(C,g.x,g.y,st.x,Ot+st.y,wt.x,wt.y,s,Ut,Mt.x,Mt.y,At,kt),Lu(C,g.x,g.y,ot.x,Ot+ot.y,wt.x+wt.w,wt.y,s,Ut,zt.x,Mt.y,At,kt),Lu(C,g.x,g.y,mt.x,Ot+mt.y,wt.x,wt.y+wt.h,s,Ut,Mt.x,zt.y,At,kt),Lu(C,g.x,g.y,Pt.x,Ot+Pt.y,wt.x+wt.w,wt.y+wt.h,s,Ut,zt.x,zt.y,At,kt),Yh(t.dynamicLayoutVertexArray,g,X),E.emplaceBack(Ht,Ht+2,Ht+1),E.emplaceBack(Ht+1,Ht+2,Ht+3),D.vertexLength+=4,D.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Tt[0]),q!==i.length-1&&Gt===i[q+1].sectionIndex||t.programConfigurations.populatePaintArrays(C.length,h,h.index,{imagePositions:{},canonical:S,formattedSection:G&&G[Gt]})}t.placedSymbolArray.emplaceBack(g.x,g.y,R,this.glyphOffsetArray.length-R,V,y,v,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],f,0,!1,0,w)}_addCollisionDebugVertex(t,i,s,a,l,h){return i.emplaceBack(0,0),t.emplaceBack(s.x,s.y,a,l,Math.round(h.x),Math.round(h.y))}addCollisionDebugVertices(t,i,s,a,l,h,f){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),y=g.vertexLength,v=l.layoutVertexArray,w=l.collisionVertexArray,S=f.anchorX,E=f.anchorY;this._addCollisionDebugVertex(v,w,h,S,E,new dt(t,i)),this._addCollisionDebugVertex(v,w,h,S,E,new dt(s,i)),this._addCollisionDebugVertex(v,w,h,S,E,new dt(s,a)),this._addCollisionDebugVertex(v,w,h,S,E,new dt(t,a)),g.vertexLength+=4;const C=l.indexArray;C.emplaceBack(y,y+1),C.emplaceBack(y+1,y+2),C.emplaceBack(y+2,y+3),C.emplaceBack(y+3,y),g.primitiveLength+=4}addDebugCollisionBoxes(t,i,s,a){for(let l=t;l<i;l++){const h=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(h.x1,h.y1,h.x2,h.y2,a?this.textCollisionBox:this.iconCollisionBox,h.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Jh(gt,Pp.members,St),this.iconCollisionBox=new Jh(gt,Pp.members,St);for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);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(t,i,s,a,l,h,f,g,y){const v={};for(let w=i;w<s;w++){const S=t.get(w);v.textBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.textFeatureIndex=S.featureIndex;break}for(let w=a;w<l;w++){const S=t.get(w);v.verticalTextBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalTextFeatureIndex=S.featureIndex;break}for(let w=h;w<f;w++){const S=t.get(w);v.iconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.iconFeatureIndex=S.featureIndex;break}for(let w=g;w<y;w++){const S=t.get(w);v.verticalIconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalIconFeatureIndex=S.featureIndex;break}return v}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,i){const s=t.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<a;l+=4)t.indexArray.emplaceBack(l,l+2,l+1),t.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(t),s=Math.cos(t),a=[],l=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const g=this.symbolInstances.get(f);a.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return h.sort(((f,g)=>a[f]-a[g]||l[g]-l[f])),h}addToSortKeyRanges(t,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((a,l,h)=>{a>=0&&h.indexOf(a)===l&&this.addIndicesForPlacedSymbol(this.text,a)})),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 jp,Np;Lt("SymbolBucket",Bo,{omit:["layers","collisionBoxArray","features","compareText"]}),Bo.MAX_GLYPHS=65535,Bo.addDynamicAttributes=Yh;var Qh={get paint(){return Np=Np||new Mi({"icon-opacity":new Wt(W.paint_symbol["icon-opacity"]),"icon-color":new Wt(W.paint_symbol["icon-color"]),"icon-halo-color":new Wt(W.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wt(W.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wt(W.paint_symbol["icon-halo-blur"]),"icon-translate":new Vt(W.paint_symbol["icon-translate"]),"icon-translate-anchor":new Vt(W.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wt(W.paint_symbol["text-opacity"]),"text-color":new Wt(W.paint_symbol["text-color"],{runtimeType:$i,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Wt(W.paint_symbol["text-halo-color"]),"text-halo-width":new Wt(W.paint_symbol["text-halo-width"]),"text-halo-blur":new Wt(W.paint_symbol["text-halo-blur"]),"text-translate":new Vt(W.paint_symbol["text-translate"]),"text-translate-anchor":new Vt(W.paint_symbol["text-translate-anchor"])})},get layout(){return jp=jp||new Mi({"symbol-placement":new Vt(W.layout_symbol["symbol-placement"]),"symbol-spacing":new Vt(W.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Vt(W.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wt(W.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Vt(W.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Vt(W.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Vt(W.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Vt(W.layout_symbol["icon-ignore-placement"]),"icon-optional":new Vt(W.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Vt(W.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wt(W.layout_symbol["icon-size"]),"icon-text-fit":new Vt(W.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Vt(W.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wt(W.layout_symbol["icon-image"]),"icon-rotate":new Wt(W.layout_symbol["icon-rotate"]),"icon-padding":new Wt(W.layout_symbol["icon-padding"]),"icon-keep-upright":new Vt(W.layout_symbol["icon-keep-upright"]),"icon-offset":new Wt(W.layout_symbol["icon-offset"]),"icon-anchor":new Wt(W.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Vt(W.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Vt(W.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Vt(W.layout_symbol["text-rotation-alignment"]),"text-field":new Wt(W.layout_symbol["text-field"]),"text-font":new Wt(W.layout_symbol["text-font"]),"text-size":new Wt(W.layout_symbol["text-size"]),"text-max-width":new Wt(W.layout_symbol["text-max-width"]),"text-line-height":new Vt(W.layout_symbol["text-line-height"]),"text-letter-spacing":new Wt(W.layout_symbol["text-letter-spacing"]),"text-justify":new Wt(W.layout_symbol["text-justify"]),"text-radial-offset":new Wt(W.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Vt(W.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Wt(W.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Wt(W.layout_symbol["text-anchor"]),"text-max-angle":new Vt(W.layout_symbol["text-max-angle"]),"text-writing-mode":new Vt(W.layout_symbol["text-writing-mode"]),"text-rotate":new Wt(W.layout_symbol["text-rotate"]),"text-padding":new Vt(W.layout_symbol["text-padding"]),"text-keep-upright":new Vt(W.layout_symbol["text-keep-upright"]),"text-transform":new Wt(W.layout_symbol["text-transform"]),"text-offset":new Wt(W.layout_symbol["text-offset"]),"text-allow-overlap":new Vt(W.layout_symbol["text-allow-overlap"]),"text-overlap":new Vt(W.layout_symbol["text-overlap"]),"text-ignore-placement":new Vt(W.layout_symbol["text-ignore-placement"]),"text-optional":new Vt(W.layout_symbol["text-optional"])})}};class Vp{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Te,this.defaultValue=t}evaluate(t){if(t.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(t.formattedSection))return i.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Lt("FormatSectionOverride",Vp,{omit:["defaultValue"]});class Fu extends cr{constructor(t,i){super(t,Qh,i)}recalculate(t,i){if(super.recalculate(t,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 a=[];for(const l of s)a.indexOf(l)<0&&a.push(l);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,s,a){const l=this.layout.get(t).evaluate(i,{},s,a),h=this._unevaluatedLayout._values[t];return h.isDataDriven()||uo(h.value)||!l?l:(function(f,g){return g.replace(/{([^{}]+)}/g,((y,v)=>f&&v in f?String(f[v]):""))})(i.properties,l)}createBucket(t){return new Bo(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Qh.paint.overridableProperties){if(!Fu.hasPaintOverride(this.layout,t))continue;const i=this.paint.get(t),s=new Vp(i),a=new co(s,i.property.specification);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new ss("source",a):new po("composite",a,i.value.zoomStops),this.paint._values[t]=new Mr(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Fu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){const s=t.get("text-field"),a=Qh.paint.properties[i];let l=!1;const h=f=>{for(const g of f)if(a.overrides&&a.overrides.hasOverride(g))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof ei)h(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const f=y=>{l||(y instanceof Cn&&Ce(y.value)===Ts?h(y.value.sections):y instanceof ts?h(y.sections):y.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return l}}let Up;var qg={get paint(){return Up=Up||new Mi({"background-color":new Vt(W.paint_background["background-color"]),"background-pattern":new vu(W.paint_background["background-pattern"]),"background-opacity":new Vt(W.paint_background["background-opacity"])})}};class Wg extends cr{constructor(t,i){super(t,qg,i)}}class Hg extends cr{constructor(t,i){super(t,{},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=t}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 Xg{constructor(t){this._methodToThrottle=t,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 Yg={once:!0},td=63710088e-1;class Hs{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Hs(Ri(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const i=Math.PI/180,s=this.lat*i,a=t.lat*i,l=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((t.lng-this.lng)*i);return td*Math.acos(Math.min(l,1))}static convert(t){if(t instanceof Hs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Hs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Hs(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Gp=2*Math.PI*td;function $p(r){return Gp*Math.cos(r*Math.PI/180)}function Zp(r){return(180+r)/360}function qp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Wp(r,t){return r/$p(t)}function Hp(r){return 360*r-180}function Bu(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Xp(r,t){return r*$p(Bu(t))}class ac{constructor(t,i,s=0){this.x=+t,this.y=+i,this.z=+s}static fromLngLat(t,i=0){const s=Hs.convert(t);return new ac(Zp(s.lng),qp(s.lat),Wp(i,s.lat))}toLngLat(){return new Hs(Hp(this.x),Bu(this.y))}toAltitude(){return Xp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Gp*(t=Bu(this.y),1/Math.cos(t*Math.PI/180));var t}}function Yp(r,t,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class ed{constructor(t,i,s){if(!(function(a,l,h){return!(a<0||a>25||h<0||h>=Math.pow(2,a)||l<0||l>=Math.pow(2,a))})(t,i,s))throw new Error(`x=${i}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=i,this.y=s,this.key=Oo(0,t,t,i,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,i,s){const a=(h=this.y,f=this.z,g=Yp(256*(l=this.x),256*(h=Math.pow(2,f)-h-1),f),y=Yp(256*(l+1),256*(h+1),f),g[0]+","+g[1]+","+y[0]+","+y[1]);var l,h,f,g,y;const v=(function(w,S,E){let C,D="";for(let R=w;R>0;R--)C=1<<R-1,D+=(S&C?1:0)+(E&C?2:0);return D})(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,a)}isChildOf(t){const i=this.z-t.z;return i>0&&t.x===this.x>>i&&t.y===this.y>>i}getTilePoint(t){const i=Math.pow(2,this.z);return new dt((t.x*i-this.x)*le,(t.y*i-this.y)*le)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Kp{constructor(t,i){this.wrap=t,this.canonical=i,this.key=Oo(t,i.z,i.z,i.x,i.y)}}class Ir{constructor(t,i,s,a,l){if(this.terrainRttPosMatrix32f=null,t<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=i,this.canonical=new ed(s,+a,+l),this.key=Oo(i,t,s,a,l)}clone(){return new Ir(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?new Ir(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ir(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?Oo(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):Oo(this.wrap*+i,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-t.canonical.z;return!(i<0)&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new Ir(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,a=2*this.canonical.y;return[new Ir(i,this.wrap,i,s,a),new Ir(i,this.wrap,i,s+1,a),new Ir(i,this.wrap,i,s,a+1),new Ir(i,this.wrap,i,s+1,a+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Ir(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Ir(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Kp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ac(t.x-this.wrap,t.y))}}function Oo(r,t,i,s,a){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*a+s).toString(36)+i.toString(36)+t.toString(36)}function oc(r,t){return t?r.properties[t]:r.id}function Kg(r,t){const i={id:r.id};if(t.removeAllProperties&&(delete r.removeProperties,delete r.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const s of t.removeProperties){const a=r.addOrUpdateProperties.findIndex((l=>l.key===s));a>-1&&r.addOrUpdateProperties.splice(a,1)}return(r.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(r.removeProperties||t.removeProperties)&&(i.removeProperties=[...r.removeProperties||[],...t.removeProperties||[]]),(r.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...r.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(r.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||r.newGeometry),i}function Jp(r){var t,i;if(!r)return{};const s={};return s.removeAll=r.removeAll,s.remove=new Set(r.remove||[]),s.add=new Map((t=r.add)===null||t===void 0?void 0:t.map((a=>[a.id,a]))),s.update=new Map((i=r.update)===null||i===void 0?void 0:i.map((a=>[a.id,a]))),s}Lt("CanonicalTileID",ed),Lt("OverscaledTileID",Ir,{omit:["terrainRttPosMatrix32f"]});class Qp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let i=0;i<t.length;i++){const s=t[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class tf{constructor(t,i,s,a,l){this.type="Feature",this._vectorTileFeature=t,t._z=i,t._x=s,t._y=a,this.properties=t.properties,this.id=l}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&(t[i]=this[i]);return t}}class jo{_name;dataBuffer;nullabilityBuffer;_size;constructor(t,i,s){this._name=t,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer&&this.nullabilityBuffer.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Ou extends jo{}class id extends Ou{getValueFromBuffer(t){return this.dataBuffer[t]}}class rd extends Ou{getValueFromBuffer(t){return this.dataBuffer[t]}}class ef extends jo{delta;constructor(t,i,s,a){super(t,i,a),this.delta=s}}class nd extends ef{constructor(t,i,s,a){super(t,Int32Array.of(i),s,a)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class sd extends jo{constructor(t,i,s){super(t,Int32Array.of(i),s)}getValueFromBuffer(t){return this.dataBuffer[0]}}class Jg{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(t,i,s,a,l=4096){this._name=t,this._geometryVector=i,this._idVector=s,this._propertyVectors=a,this._extent=l}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(t)}*[Symbol.iterator](){const t=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 a=t?.next().value,l={};for(const h of this.propertyVectors){if(!h)continue;const f=h.name,g=h.getValue(i);g!==null&&(l[f]=g)}i++,yield{id:s,geometry:a,properties:l}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const t=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let a;this.idVector&&(a=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(s)):this.idVector.getValue(s));const l={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)}t.push({id:a,geometry:l,properties:h})}return t}containsMaxSaveIntegerValues(t){return t instanceof id||t instanceof sd&&t instanceof nd||t instanceof rd}}class Qg{value;constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}var Ii,oe,gs,hn,Fa,hr,pi,fi,rf,Er;(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(Ii||(Ii={}));class ad{_dictionaryType;_offsetType;_lengthType;constructor(t,i,s){this._dictionaryType=t,this._offsetType=i,this._lengthType=s}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function ui(r,t,i){const s=new Int32Array(i);let a=0,l=t.get();for(let h=0;h<s.length;h++){let f=r[l++],g=127&f;f<128||(f=r[l++],g|=(127&f)<<7,f<128||(f=r[l++],g|=(127&f)<<14,f<128||(f=r[l++],g|=(127&f)<<21,f<128||(f=r[l++],g|=(15&f)<<28)))),s[a++]=g}return t.set(l),s}function ju(r,t,i){const s=new BigInt64Array(i);for(let a=0;a<s.length;a++)s[a]=e_(r,t);return s}function t_(r,t){let i,s;return s=r[t.get()],t.increment(),i=127&s,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<7,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<14,s<128?i:(s=r[t.get()],t.increment(),i|=(127&s)<<21,s<128?i:(s=r[t.get()],i|=(15&s)<<28,(function(a,l,h){let f,g;if(g=l[h.get()],h.increment(),f=(112&g)>>4,g<128||(g=l[h.get()],h.increment(),f|=(127&g)<<3,g<128)||(g=l[h.get()],h.increment(),f|=(127&g)<<10,g<128)||(g=l[h.get()],h.increment(),f|=(127&g)<<17,g<128)||(g=l[h.get()],h.increment(),f|=(127&g)<<24,g<128)||(g=l[h.get()],h.increment(),f|=(1&g)<<31,g<128))return 4294967296*f+(a>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,t)))))}function nf(r,t,i,s){throw new Error("FastPFor is not implemented yet.")}function Ba(r){return r>>>1^-(1&r)}function No(r){return r>>1n^-(1n&r)}function e_(r,t){let i=0n,s=0,a=t.get();for(;a<r.length;){const l=r[a++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return t.set(a),i}function sf(r,t,i){const s=new Int32Array(i);let a=0;for(let l=0;l<t;l++){const h=r[l];s.fill(r[l+t],a,a+h),a+=h}return s}function af(r,t,i){const s=new BigInt64Array(i);let a=0;for(let l=0;l<t;l++){const h=Number(r[l]);s.fill(r[l+t],a,a+h),a+=h}return s}function of(r,t,i){const s=new Float64Array(i);let a=0;for(let l=0;l<t;l++){const h=r[l];s.fill(r[l+t],a,a+h),a+=h}return s}function od(r){const t=r.length/4*4;let i=1;if(t>=4)for(let s=r[0];i<t-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 lf(r){r[0]=r[0]>>>1^-(1&r[0]),r[1]=r[1]>>>1^-(1&r[1]);const t=r.length/4*4;let i=2;if(t>=4)for(;i<t-4;i+=4){const s=r[i],a=r[i+1],l=r[i+2],h=r[i+3];r[i]=(s>>>1^-(1&s))+r[i-2],r[i+1]=(a>>>1^-(1&a))+r[i-1],r[i+2]=(l>>>1^-(1&l))+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 Xs(r,t,i){return Math.min(i,Math.max(t,r))}(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(oe||(oe={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(gs||(gs={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(hn||(hn={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(Fa||(Fa={})),(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"})(hr||(hr={}));class Oa{_physicalStreamType;_logicalStreamType;_logicalLevelTechnique1;_logicalLevelTechnique2;_physicalLevelTechnique;_numValues;_byteLength;constructor(t,i,s,a,l,h,f){this._physicalStreamType=t,this._logicalStreamType=i,this._logicalLevelTechnique1=s,this._logicalLevelTechnique2=a,this._physicalLevelTechnique=l,this._numValues=h,this._byteLength=f}static decode(t,i){const s=t[i.get()],a=Object.values(Ii)[s>>4];let l=null;switch(a){case Ii.DATA:l=new ad(Object.values(hn)[15&s]);break;case Ii.OFFSET:l=new ad(null,Object.values(Fa)[15&s]);break;case Ii.LENGTH:l=new ad(null,null,Object.values(hr)[15&s])}i.increment();const h=t[i.get()],f=Object.values(oe)[h>>5],g=Object.values(oe)[h>>2&7],y=Object.values(gs)[3&h];i.increment();const v=ui(t,i,2);return new Oa(a,l,f,g,y,v[0],v[1])}get physicalStreamType(){return this._physicalStreamType}get logicalStreamType(){return this._logicalStreamType}get logicalLevelTechnique1(){return this._logicalLevelTechnique1}get logicalLevelTechnique2(){return this._logicalLevelTechnique2}get physicalLevelTechnique(){return this._physicalLevelTechnique}get numValues(){return this._numValues}get byteLength(){return this._byteLength}getDecompressedCount(){return this._numValues}}class Nu extends Oa{num_bits;coordinate_shift;constructor(t,i,s,a,l,h,f,g,y){super(t,i,s,a,l,h,f),this.num_bits=g,this.coordinate_shift=y}static decode(t,i){const s=Oa.decode(t,i),a=ui(t,i,2);return new Nu(s.physicalStreamType,s.logicalStreamType,s.logicalLevelTechnique1,s.logicalLevelTechnique2,s.physicalLevelTechnique,s.numValues,s.byteLength,a[0],a[1])}static decodePartial(t,i,s){const a=ui(i,s,2);return new Nu(t.physicalStreamType,t.logicalStreamType,t.logicalLevelTechnique1,t.logicalLevelTechnique2,t.physicalLevelTechnique,t.numValues,t.byteLength,a[0],a[1])}numBits(){return this.num_bits}coordinateShift(){return this.coordinate_shift}}class lc extends Oa{_runs;_numRleValues;constructor(t,i,s,a,l,h,f,g,y){super(t,i,s,a,l,h,f),this._runs=g,this._numRleValues=y}static decode(t,i){const s=Oa.decode(t,i),a=ui(t,i,2);return new lc(s.physicalStreamType,s.logicalStreamType,s.logicalLevelTechnique1,s.logicalLevelTechnique2,s.physicalLevelTechnique,s.numValues,s.byteLength,a[0],a[1])}static decodePartial(t,i,s){const a=ui(i,s,2);return new lc(t.physicalStreamType,t.logicalStreamType,t.logicalLevelTechnique1,t.logicalLevelTechnique2,t.physicalLevelTechnique,t.numValues,t.byteLength,a[0],a[1])}get runs(){return this._runs}get numRleValues(){return this._numRleValues}getDecompressedCount(){return this._numRleValues}}class Oi{static decode(t,i){const s=Oa.decode(t,i);return s.logicalLevelTechnique1===oe.MORTON?Nu.decodePartial(s,t,i):oe.RLE!==s.logicalLevelTechnique1&&oe.RLE!==s.logicalLevelTechnique2||gs.NONE===s.physicalLevelTechnique?s:lc.decodePartial(s,t,i)}}(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"})(pi||(pi={}));class dn{values;_size;constructor(t,i){this.values=t,this._size=i}get(t){const i=Math.floor(t/8);return(this.values[i]>>t%8&1)==1}set(t,i){const s=Math.floor(t/8);this.values[s]=this.values[s]|(i?1:0)<<t%8}getInt(t){const i=Math.floor(t/8);return this.values[i]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}class ee{constructor(){}static decodeIntStream(t,i,s,a,l){const h=ee.decodePhysicalLevelTechnique(t,i,s);return this.decodeIntBuffer(h,s,a,l)}static decodeLengthStreamToOffsetBuffer(t,i,s){const a=ee.decodePhysicalLevelTechnique(t,i,s);return this.decodeLengthToOffsetBuffer(a,s)}static decodePhysicalLevelTechnique(t,i,s){const a=s.physicalLevelTechnique;if(a===gs.FAST_PFOR)return nf();if(a===gs.VARINT)return ui(t,i,s.numValues);if(a===gs.NONE){const l=i.get();i.add(s.byteLength);const h=t.subarray(l,i.get());return new Int32Array(h)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}static decodeConstIntStream(t,i,s,a){const l=ee.decodePhysicalLevelTechnique(t,i,s);if(l.length===1){const h=l[0];return a?Ba(h):h}return a?(function(h){return Ba(h[1])})(l):(function(h){return h[1]})(l)}static decodeSequenceIntStream(t,i,s){return(function(a){if(a.length==2){const l=Ba(a[1]);return[l,l]}return[Ba(a[2]),Ba(a[3])]})(ee.decodePhysicalLevelTechnique(t,i,s))}static decodeSequenceLongStream(t,i,s){return(function(a){if(a.length==2){const l=No(a[1]);return[l,l]}return[No(a[2]),No(a[3])]})(ju(t,i,s.numValues))}static decodeLongStream(t,i,s,a){const l=ju(t,i,s.numValues);return this.decodeLongBuffer(l,s,a)}static decodeLongFloat64Stream(t,i,s,a){const l=(function(h,f,g){const y=new Float64Array(f);for(let v=0;v<f;v++)y[v]=t_(h,g);return y})(t,s.numValues,i);return this.decodeFloat64Buffer(l,s,a)}static decodeConstLongStream(t,i,s,a){const l=ju(t,i,s.numValues);if(l.length===1){const h=l[0];return a?No(h):h}return a?(function(h){return No(h[1])})(l):(function(h){return h[1]})(l)}static decodeIntBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case oe.DELTA:return i.logicalLevelTechnique2===oe.RLE?(function(l,h,f){const g=new Int32Array(f);let y=0,v=0;for(let w=0;w<h;w++){const S=l[w],E=Ba(l[w+h]);for(let C=0;C<S;C++)v+=E,g[y++]=v}return g})(t,i.runs,i.numRleValues):((function(l){l[0]=l[0]>>>1^-(1&l[0]);const h=l.length/4*4;let f=1;if(h>=4)for(;f<h-4;f+=4){const g=l[f],y=l[f+1],v=l[f+2],w=l[f+3];l[f]=(g>>>1^-(1&g))+l[f-1],l[f+1]=(y>>>1^-(1&y))+l[f],l[f+2]=(v>>>1^-(1&v))+l[f+1],l[f+3]=(w>>>1^-(1&w))+l[f+2]}for(;f!=l.length;++f)l[f]=(l[f]>>>1^-(1&l[f]))+l[f-1]})(t),t);case oe.RLE:return(function(l,h,f){return f?(function(g,y,v){const w=new Int32Array(v);let S=0;for(let E=0;E<y;E++){const C=g[E];let D=g[E+y];D=D>>>1^-(1&D),w.fill(D,S,S+C),S+=C}return w})(l,h.runs,h.numRleValues):sf(l,h.runs,h.numRleValues)})(t,i,s);case oe.MORTON:return od(t),t;case oe.COMPONENTWISE_DELTA:return a?((function(l,h,f,g){let y=l[0]>>>1^-(1&l[0]),v=l[1]>>>1^-(1&l[1]);l[0]=Xs(Math.round(y*h),f,g),l[1]=Xs(Math.round(v*h),f,g);const w=l.length/16;let S=2;if(w>=4)for(;S<w-4;S+=4){const E=l[S],C=l[S+1],D=(E>>>1^-(1&E))+y,R=(C>>>1^-(1&C))+v;l[S]=Xs(Math.round(D*h),f,g),l[S+1]=Xs(Math.round(R*h),f,g);const V=l[S+2],X=l[S+3];y=(V>>>1^-(1&V))+D,v=(X>>>1^-(1&X))+R,l[S+2]=Xs(Math.round(y*h),f,g),l[S+3]=Xs(Math.round(v*h),f,g)}for(;S!=l.length;S+=2)y+=l[S]>>>1^-(1&l[S]),v+=l[S+1]>>>1^-(1&l[S+1]),l[S]=Xs(Math.round(y*h),f,g),l[S+1]=Xs(Math.round(v*h),f,g)})(t,a.scale,a.min,a.max),t):(lf(t),t);case oe.NONE:return s&&(function(l){for(let h=0;h<l.length;h++){const f=l[h];l[h]=f>>>1^-(1&f)}})(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeLongBuffer(t,i,s){switch(i.logicalLevelTechnique1){case oe.DELTA:return i.logicalLevelTechnique2===oe.RLE?(function(a,l,h){const f=new BigInt64Array(h);let g=0,y=0n;for(let v=0;v<l;v++){const w=Number(a[v]),S=No(a[v+l]);for(let E=0;E<w;E++)y+=S,f[g++]=y}return f})(t,i.runs,i.numRleValues):((function(a){a[0]=a[0]>>1n^-(1n&a[0]);const l=a.length/4*4;let h=1;if(l>=4)for(;h<l-4;h+=4){const f=a[h],g=a[h+1],y=a[h+2],v=a[h+3];a[h]=(f>>1n^-(1n&f))+a[h-1],a[h+1]=(g>>1n^-(1n&g))+a[h],a[h+2]=(y>>1n^-(1n&y))+a[h+1],a[h+3]=(v>>1n^-(1n&v))+a[h+2]}for(;h!=a.length;++h)a[h]=(a[h]>>1n^-(1n&a[h]))+a[h-1]})(t),t);case oe.RLE:return(function(a,l,h){return h?(function(f,g,y){const v=new BigInt64Array(y);let w=0;for(let S=0;S<g;S++){const E=Number(f[S]);let C=f[S+g];C=C>>1n^-(1n&C),v.fill(C,w,w+E),w+=E}return v})(a,l.runs,l.numRleValues):af(a,l.runs,l.numRleValues)})(t,i,s);case oe.NONE:return s&&(function(a){for(let l=0;l<a.length;l++){const h=a[l];a[l]=h>>1n^-(1n&h)}})(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeFloat64Buffer(t,i,s){switch(i.logicalLevelTechnique1){case oe.DELTA:return i.logicalLevelTechnique2===oe.RLE&&(t=of(t,i.runs,i.numRleValues)),(function(a){a[0]=a[0]%2==1?(a[0]+1)/-2:a[0]/2;const l=a.length/4*4;let h=1;if(l>=4)for(;h<l-4;h+=4){const f=a[h],g=a[h+1],y=a[h+2],v=a[h+3];a[h]=(f%2==1?(f+1)/-2:f/2)+a[h-1],a[h+1]=(g%2==1?(g+1)/-2:g/2)+a[h],a[h+2]=(y%2==1?(y+1)/-2:y/2)+a[h+1],a[h+3]=(v%2==1?(v+1)/-2:v/2)+a[h+2]}for(;h!=a.length;++h)a[h]=(a[h]%2==1?(a[h]+1)/-2:a[h]/2)+a[h-1]})(t),t;case oe.RLE:return(function(a,l,h){return h?(function(f,g,y){const v=new Float64Array(y);let w=0;for(let S=0;S<g;S++){const E=f[S];let C=f[S+g];C=C%2==1?(C+1)/-2:C/2,v.fill(C,w,w+E),w+=E}return v})(a,l.runs,l.numRleValues):of(a,l.runs,l.numRleValues)})(t,i,s);case oe.NONE:return s&&(function(a){for(let l=0;l<a.length;l++){const h=a[l];a[l]=h%2==1?(h+1)/-2:h/2}})(t),t;default:throw new Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}static decodeLengthToOffsetBuffer(t,i){if(i.logicalLevelTechnique1===oe.DELTA&&i.logicalLevelTechnique2===oe.NONE)return(function(s){const a=new Int32Array(s.length+1);a[0]=0,a[1]=Ba(s[0]);let l=a[1],h=2;for(;h!=a.length;++h){const f=s[h-1];l+=f>>>1^-(1&f),a[h]=a[h-1]+l}return a})(t);if(i.logicalLevelTechnique1===oe.RLE&&i.logicalLevelTechnique2===oe.NONE)return(function(s,a,l){const h=new Int32Array(l+1);h[0]=0;let f=1,g=h[0];for(let y=0;y<a;y++){const v=s[y],w=s[y+a];for(let S=f;S<f+v;S++)h[S]=w+g,g=h[S];f+=v}return h})(t,i.runs,i.numRleValues);if(i.logicalLevelTechnique1===oe.NONE&&i.logicalLevelTechnique2===oe.NONE){(function(a){let l=0;for(let h=0;h<a.length;h++)a[h]+=l,l=a[h]})(t);const s=new Int32Array(i.numValues+1);return s[0]=0,s.set(t,1),s}if(i.logicalLevelTechnique1===oe.DELTA&&i.logicalLevelTechnique2===oe.RLE){const s=(function(a,l,h){const f=new Int32Array(h+1);f[0]=0;let g=1,y=f[0];for(let v=0;v<l;v++){const w=a[v];let S=a[v+l];S=S>>>1^-(1&S);for(let E=g;E<g+w;E++)f[E]=S+y,y=f[E];g+=w}return f})(t,i.runs,i.numRleValues);return od(s),s}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}static decodeNullableIntStream(t,i,s,a,l){const h=s.physicalLevelTechnique===gs.FAST_PFOR?nf():ui(t,i,s.numValues);return this.decodeNullableIntBuffer(h,s,a,l)}static decodeNullableLongStream(t,i,s,a,l){const h=ju(t,i,s.numValues);return this.decodeNullableLongBuffer(h,s,a,l)}static decodeNullableIntBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case oe.DELTA:return i.logicalLevelTechnique2===oe.RLE&&(t=sf(t,i.runs,i.numRleValues)),(function(l,h){const f=new Int32Array(l.size());let g=0;l.get(0)?(f[0]=l.get(0)?h[0]>>>1^-(1&h[0]):0,g=1):f[0]=0;let y=1;for(;y!=f.length;++y)f[y]=l.get(y)?f[y-1]+(h[g]>>>1^-(1&h[g++])):f[y-1];return f})(a,t);case oe.RLE:return(function(l,h,f,g){const y=h;return f?(function(v,w,S){const E=new Int32Array(v.size());let C=0;for(let D=0;D<S;D++){const R=w[D];let V=w[D+S];V=V>>>1^-(1&V);for(let X=C;X<C+R;X++)v.get(X)?E[X]=V:(E[X]=0,C++);C+=R}return E})(g,l,y.runs):(function(v,w,S){const E=new Int32Array(v.size());let C=0;for(let D=0;D<S;D++){const R=w[D],V=w[D+S];for(let X=C;X<C+R;X++)v.get(X)?E[X]=V:(E[X]=0,C++);C+=R}return E})(g,l,y.runs)})(t,i,s,a);case oe.MORTON:return od(t),t;case oe.COMPONENTWISE_DELTA:return lf(t),t;case oe.NONE:return t=s?(function(l,h){const f=new Int32Array(l.size());let g=0,y=0;for(;y!=f.length;++y)if(l.get(y)){const v=h[g++];f[y]=v>>>1^-(1&v)}else f[y]=0;return f})(a,t):(function(l,h){const f=new Int32Array(l.size());let g=0,y=0;for(;y!=f.length;++y)f[y]=l.get(y)?h[g++]:0;return f})(a,t),t;default:throw new Error("The specified Logical level technique is not supported")}}static decodeNullableLongBuffer(t,i,s,a){switch(i.logicalLevelTechnique1){case oe.DELTA:return i.logicalLevelTechnique2===oe.RLE&&(t=af(t,i.runs,i.numRleValues)),(function(l,h){const f=new BigInt64Array(l.size());let g=0;l.get(0)?(f[0]=l.get(0)?h[0]>>1n^-(1n&h[0]):0n,g=1):f[0]=0n;let y=1;for(;y!=f.length;++y)f[y]=l.get(y)?f[y-1]+(h[g]>>1n^-(1n&h[g++])):f[y-1];return f})(a,t);case oe.RLE:return(function(l,h,f,g){const y=h;return f?(function(v,w,S){const E=new BigInt64Array(v.size());let C=0;for(let D=0;D<S;D++){const R=Number(w[D]);let V=w[D+S];V=V>>1n^-(1n&V);for(let X=C;X<C+R;X++)v.get(X)?E[X]=V:(E[X]=0n,C++);C+=R}return E})(g,l,y.runs):(function(v,w,S){const E=new BigInt64Array(v.size());let C=0;for(let D=0;D<S;D++){const R=Number(w[D]),V=w[D+S];for(let X=C;X<C+R;X++)v.get(X)?E[X]=V:(E[X]=0n,C++);C+=R}return E})(g,l,y.runs)})(t,i,s,a);case oe.NONE:return t=s?(function(l,h){const f=new BigInt64Array(l.size());let g=0,y=0;for(;y!=f.length;++y)if(l.get(y)){const v=h[g++];f[y]=v>>1n^-(1n&v)}else f[y]=0n;return f})(a,t):(function(l,h){const f=new BigInt64Array(l.size());let g=0,y=0;for(;y!=f.length;++y)f[y]=l.get(y)?h[g++]:0n;return f})(a,t),t;default:throw new Error("The specified Logical level technique is not supported")}}static getVectorType(t,i,s,a){const l=t.logicalLevelTechnique1;if(l===oe.RLE)return t.runs===1?pi.CONST:pi.FLAT;const h=i instanceof dn?i.size():i;if(l===oe.DELTA&&t.logicalLevelTechnique2===oe.RLE){const f=t.runs,g=2;if(t.numRleValues!==h)return pi.FLAT;if(f===1)return pi.SEQUENCE;if(f===2){const y=a.get();let v;if(t.physicalLevelTechnique===gs.VARINT)v=ui(s,a,4);else{const w=a.get();v=new Int32Array(s.buffer,s.byteOffset+w,4)}if(a.set(y),v[2]===g&&v[3]===g)return pi.SEQUENCE}}return t.numValues===1?pi.CONST:pi.FLAT}}class cf extends Ou{getValueFromBuffer(t){return this.dataBuffer[t]}}class uf extends ef{constructor(t,i,s,a){super(t,BigInt64Array.of(i),s,a)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}class Vo{_geometryOffsets;_partOffsets;_ringOffsets;constructor(t,i,s){this._geometryOffsets=t,this._partOffsets=i,this._ringOffsets=s}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}class i_{tileExtent;_numBits;_coordinateShift;minBound;maxBound;constructor(t,i){this._coordinateShift=t<0?Math.abs(t):0,this.tileExtent=i+this._coordinateShift,this._numBits=Math.ceil(Math.log2(this.tileExtent)),this.minBound=t,this.maxBound=i}validateCoordinates(t){if(t.x<this.minBound||t.y<this.minBound||t.x>this.maxBound||t.y>this.maxBound)throw new Error("The specified tile buffer size is currently not supported.")}numBits(){return this._numBits}coordinateShift(){return this._coordinateShift}}class Uo extends i_{encode(t){this.validateCoordinates(t);const i=t.x+this._coordinateShift,s=t.y+this._coordinateShift;let a=0;for(let l=0;l<this._numBits;l++)a|=(i&1<<l)<<l|(s&1<<l)<<l+1;return a}decode(t){return{x:this.decodeMorton(t)-this._coordinateShift,y:this.decodeMorton(t>>1)-this._coordinateShift}}decodeMorton(t){let i=0;for(let s=0;s<this._numBits;s++)i|=(t&1<<2*s)>>s;return i}static decode(t,i,s){return{x:Uo.decodeMorton(t,i)-s,y:Uo.decodeMorton(t>>1,i)-s}}static decodeMorton(t,i){let s=0;for(let a=0;a<i;a++)s|=(t&1<<2*a)>>a;return s}}(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"})(fi||(fi={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(rf||(rf={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(Er||(Er={}));class r_{createPoint(t){return[[t]]}createMultiPoint(t){return t.map((i=>[i]))}createLineString(t){return[t]}createMultiLineString(t){return t}createPolygon(t,i){return[t,...i]}createMultiPolygon(t){return t.flat()}}function hf(r){const t=new Array(r.numGeometries);let i=1,s=1,a=1,l=0;const h=new r_;let f=0,g=0;const y=r.mortonSettings,v=r.topologyVector,w=v.geometryOffsets,S=v.partOffsets,E=v.ringOffsets,C=r.vertexOffsets,D=r.containsPolygonGeometry(),R=r.vertexBuffer;for(let V=0;V<r.numGeometries;V++){const X=r.geometryType(V);if(X===fi.POINT){if(C&&C.length!==0)if(r.vertexBufferType===Er.VEC_2){const G=2*C[g++],q=new dt(R[G],R[G+1]);t[l++]=h.createPoint(q)}else{const G=C[g++],q=Uo.decode(R[G],y.numBits,y.coordinateShift),st=new dt(q.x,q.y);t[l++]=h.createPoint(st)}else{const G=new dt(R[f++],R[f++]);t[l++]=h.createPoint(G)}w&&a++,S&&i++,E&&s++}else if(X===fi.MULTIPOINT){const G=w[a]-w[a-1];a++;const q=new Array(G);if(C&&C.length!==0){for(let st=0;st<G;st++){const ot=2*C[g++];q[st]=new dt(R[ot],R[ot+1])}t[l++]=h.createMultiPoint(q)}else{for(let st=0;st<G;st++){const ot=R[f++],mt=R[f++];q[st]=new dt(ot,mt)}t[l++]=h.createMultiPoint(q)}}else if(X===fi.LINESTRING){let G,q=0;D?(q=E[s]-E[s-1],s++):q=S[i]-S[i-1],i++,C&&C.length!==0?(G=r.vertexBufferType===Er.VEC_2?cd(R,C,g,q,!1):ud(R,C,g,q,!1,y),g+=q):(G=ld(R,f,q,!1),f+=2*q),t[l++]=h.createLineString(G),w&&a++}else if(X===fi.POLYGON){const G=S[i]-S[i-1];i++;const q=new Array(G-1);let st=E[s]-E[s-1];if(s++,C&&C.length!==0){const ot=r.vertexBufferType===Er.VEC_2?Uu(R,C,g,st):Gu(R,C,g,st,0,y);g+=st;for(let mt=0;mt<q.length;mt++)st=E[s]-E[s-1],s++,q[mt]=r.vertexBufferType===Er.VEC_2?Uu(R,C,g,st):Gu(R,C,g,st,0,y),g+=st;t[l++]=h.createPolygon(ot,q)}else{const ot=Vu(R,f,st);f+=2*st;for(let mt=0;mt<q.length;mt++)st=E[s]-E[s-1],s++,q[mt]=Vu(R,f,st),f+=2*st;t[l++]=h.createPolygon(ot,q)}w&&a++}else if(X===fi.MULTILINESTRING){const G=w[a]-w[a-1];a++;const q=new Array(G);if(C&&C.length!==0){for(let st=0;st<G;st++){let ot=0;D?(ot=E[s]-E[s-1],s++):ot=S[i]-S[i-1],i++;const mt=r.vertexBufferType===Er.VEC_2?cd(R,C,g,ot,!1):ud(R,C,g,ot,!1,y);q[st]=mt,g+=ot}t[l++]=h.createMultiLineString(q)}else{for(let st=0;st<G;st++){let ot=0;D?(ot=E[s]-E[s-1],s++):ot=S[i]-S[i-1],i++,q[st]=ld(R,f,ot,!1),f+=2*ot}t[l++]=h.createMultiLineString(q)}}else{if(X!==fi.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const G=w[a]-w[a-1];a++;const q=new Array(G);let st=0;if(C&&C.length!==0){for(let ot=0;ot<G;ot++){const mt=S[i]-S[i-1];i++;const Pt=new Array(mt-1);st=E[s]-E[s-1],s++;const wt=r.vertexBufferType===Er.VEC_2?Uu(R,C,g,st):Gu(R,C,g,st,0,y);g+=st;for(let Mt=0;Mt<Pt.length;Mt++)st=E[s]-E[s-1],s++,Pt[Mt]=r.vertexBufferType===Er.VEC_2?Uu(R,C,g,st):Gu(R,C,g,st,0,y),g+=st;q[ot]=h.createPolygon(wt,Pt)}t[l++]=h.createMultiPolygon(q)}else{for(let ot=0;ot<G;ot++){const mt=S[i]-S[i-1];i++;const Pt=new Array(mt-1);st=E[s]-E[s-1],s++;const wt=Vu(R,f,st);f+=2*st;for(let Mt=0;Mt<Pt.length;Mt++){const zt=E[s]-E[s-1];s++,Pt[Mt]=Vu(R,f,zt),f+=2*zt}q[ot]=h.createPolygon(wt,Pt)}t[l++]=h.createMultiPolygon(q)}}}}return t}function Vu(r,t,i){return ld(r,t,i,!0)}function Uu(r,t,i,s){return cd(r,t,i,s,!0)}function Gu(r,t,i,s,a,l){return ud(r,t,i,s,!0,l)}function ld(r,t,i,s){const a=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)a[l/2]=new dt(r[t+l],r[t+l+1]);return s&&(a[a.length-1]=a[0]),a}function cd(r,t,i,s,a){const l=new Array(a?s+1:s);for(let h=0;h<2*s;h+=2){const f=2*t[i+h/2];l[h/2]=new dt(r[f],r[f+1])}return a&&(l[l.length-1]=l[0]),l}function ud(r,t,i,s,a,l){const h=new Array(a?s+1:s);for(let f=0;f<s;f++){const g=Uo.decode(r[t[i+f]],l.numBits,l.coordinateShift);h[f]=new dt(g.x,g.y)}return a&&(h[h.length-1]=h[0]),h}class df{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(t,i,s,a,l){this._vertexBufferType=t,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=a,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const t=hf(this);let i=0;for(;i<this.numGeometries;)yield{coordinates:t[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(t){const i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){const s=Uo.decode(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return hf(this)}get mortonSettings(){return this._mortonSettings}}class cc extends df{_numGeometries;_geometryType;constructor(t,i,s,a,l,h,f){super(s,a,l,h,f),this._numGeometries=t,this._geometryType=i}static createMortonEncoded(t,i,s,a,l,h){return new cc(t,i,Er.MORTON,s,a,l,h)}static create(t,i,s,a,l){return new cc(t,i,Er.VEC_2,s,a,l)}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===fi.POLYGON||this._geometryType===fi.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class uc extends df{_geometryTypes;constructor(t,i,s,a,l,h){super(t,s,a,l,h),this._geometryTypes=i}static createMortonEncoded(t,i,s,a,l){return new uc(Er.MORTON,t,i,s,a,l)}static create(t,i,s,a){return new uc(Er.VEC_2,t,i,s,a)}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===fi.POLYGON||this.geometryType(t)===fi.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class pf{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(t,i,s,a){this._triangleOffsets=t,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=a}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 t=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,a=i.ringOffsets,l=i.geometryOffsets;let h=0,f=1,g=1,y=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case fi.POLYGON:{const w=s[f]-s[f-1];f++;const S=[];for(let E=0;E<w;E++){const C=a[g]-a[g-1];g++;const D=[];for(let R=0;R<C;R++){const V=this._vertexBuffer[h++],X=this._vertexBuffer[h++];D.push(new dt(V,X))}D.length>0&&D.push(D[0]),S.push(D)}t[v]=S,l&&y++}break;case fi.MULTIPOLYGON:{const w=l[y]-l[y-1];y++;const S=[];for(let E=0;E<w;E++){const C=s[f]-s[f-1];f++;for(let D=0;D<C;D++){const R=a[g]-a[g-1];g++;const V=[];for(let X=0;X<R;X++){const G=this._vertexBuffer[h++],q=this._vertexBuffer[h++];V.push(new dt(G,q))}V.length>0&&V.push(V[0]),S.push(V)}}t[v]=S}}return t}[Symbol.iterator](){return null}}class $u extends pf{_numGeometries;_geometryType;constructor(t,i,s,a,l,h){super(s,a,l,h),this._numGeometries=t,this._geometryType=i}static create(t,i,s,a,l,h){return new $u(t,i,s,a,l,h)}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class Zu extends pf{_geometryTypes;constructor(t,i,s,a,l){super(i,s,a,l),this._geometryTypes=t}static create(t,i,s,a,l){return new Zu(t,i,s,a,l)}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function n_(r,t,i,s,a){const l=Oi.decode(r,i);let h=null,f=null,g=null,y=null,v=null,w=null,S=null,E=null;if(ee.getVectorType(l,s,r,i)===pi.CONST){const D=ee.decodeConstIntStream(r,i,l,!1);for(let R=0;R<t-1;R++){const V=Oi.decode(r,i);switch(V.physicalStreamType){case Ii.LENGTH:switch(V.logicalStreamType.lengthType){case hr.GEOMETRIES:h=ee.decodeLengthStreamToOffsetBuffer(r,i,V);break;case hr.PARTS:f=ee.decodeLengthStreamToOffsetBuffer(r,i,V);break;case hr.RINGS:g=ee.decodeLengthStreamToOffsetBuffer(r,i,V);break;case hr.TRIANGLES:S=ee.decodeLengthStreamToOffsetBuffer(r,i,V)}break;case Ii.OFFSET:switch(V.logicalStreamType.offsetType){case Fa.VERTEX:y=ee.decodeIntStream(r,i,V,!1);break;case Fa.INDEX:E=ee.decodeIntStream(r,i,V,!1)}break;case Ii.DATA:if(hn.VERTEX===V.logicalStreamType.dictionaryType)v=ee.decodeIntStream(r,i,V,!0,a);else{const X=V;w={numBits:X.numBits(),coordinateShift:X.coordinateShift()},v=ee.decodeIntStream(r,i,V,!1,a)}}}if(E!==null){if(h!=null||f!=null){const R=new Vo(h,f,g);return $u.create(s,D,S,E,v,R)}return $u.create(s,D,S,E,v)}return w===null?cc.create(s,D,new Vo(h,f,g),y,v):cc.createMortonEncoded(s,D,new Vo(h,f,g),y,v,w)}const C=ee.decodeIntStream(r,i,l,!1);for(let D=0;D<t-1;D++){const R=Oi.decode(r,i);switch(R.physicalStreamType){case Ii.LENGTH:switch(R.logicalStreamType.lengthType){case hr.GEOMETRIES:h=ee.decodeIntStream(r,i,R,!1);break;case hr.PARTS:f=ee.decodeIntStream(r,i,R,!1);break;case hr.RINGS:g=ee.decodeIntStream(r,i,R,!1);break;case hr.TRIANGLES:S=ee.decodeLengthStreamToOffsetBuffer(r,i,R)}break;case Ii.OFFSET:switch(R.logicalStreamType.offsetType){case Fa.VERTEX:y=ee.decodeIntStream(r,i,R,!1);break;case Fa.INDEX:E=ee.decodeIntStream(r,i,R,!1)}break;case Ii.DATA:if(hn.VERTEX===R.logicalStreamType.dictionaryType)v=ee.decodeIntStream(r,i,R,!0,a);else{const V=R;w={numBits:V.numBits(),coordinateShift:V.coordinateShift()},v=ee.decodeIntStream(r,i,R,!1,a)}}}return E!==null&&f===null?Zu.create(C,S,E,v):(h!==null?(h=hd(C,h,2),f!==null&&g!==null?(f=ff(C,h,f,!1),g=(function(D,R,V,X){const G=new Int32Array(V[V.length-1]+1);let q=0;G[0]=q;let st=1,ot=1,mt=0;for(let Pt=0;Pt<D.length;Pt++){const wt=D[Pt],Mt=R[Pt+1]-R[Pt];if(wt!==0&&wt!==3)for(let zt=0;zt<Mt;zt++){const At=V[st]-V[st-1];st++;for(let kt=0;kt<At;kt++)q=G[ot++]=q+X[mt++]}else for(let zt=0;zt<Mt;zt++)G[ot++]=++q,st++}return G})(C,h,f,g)):f!==null&&(f=(function(D,R,V){const X=new Int32Array(R[R.length-1]+1);let G=0;X[0]=G;let q=1,st=0;for(let ot=0;ot<D.length;ot++){const mt=D[ot],Pt=R[ot+1]-R[ot];if(mt===4||mt===1)for(let wt=0;wt<Pt;wt++)G=X[q++]=G+V[st++];else for(let wt=0;wt<Pt;wt++)X[q++]=++G}return X})(C,h,f))):f!==null&&g!==null?(f=hd(C,f,1),g=ff(C,f,g,!0)):f!==null&&(f=hd(C,f,0)),E!==null?Zu.create(C,S,E,v,new Vo(h,f,g)):w===null?uc.create(C,new Vo(h,f,g),y,v):uc.createMortonEncoded(C,new Vo(h,f,g),y,v,w))}function hd(r,t,i){const s=new Int32Array(r.length+1);let a=0;s[0]=a;let l=0;for(let h=0;h<r.length;h++)a=s[h+1]=a+(r[h]>i?t[l++]:1);return s}function ff(r,t,i,s){const a=new Int32Array(t[t.length-1]+1);let l=0;a[0]=l;let h=1,f=0;for(let g=0;g<r.length;g++){const y=r[g],v=t[g+1]-t[g];if(y===5||y===2||s&&(y===4||y===1))for(let w=0;w<v;w++)l=a[h++]=l+i[f++];else for(let w=0;w<v;w++)a[h++]=++l}return a}class s_ extends jo{dataVector;constructor(t,i,s){super(t,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(t){return this.dataVector.get(t)}}class a_ extends Ou{getValueFromBuffer(t){return this.dataBuffer[t]}}class mf extends jo{constructor(t,i,s){super(t,BigInt64Array.of(i),s)}getValueFromBuffer(t){return this.dataBuffer[0]}}function o_(r,t,i){for(let s=0;s<r;s++){const a=Oi.decode(t,i);i.add(a.byteLength)}}function hc(r,t,i){return gf(r,Math.ceil(t/8),i)}function gf(r,t,i){const s=new Uint8Array(t);let a=0;for(;a<t;){const l=r[i.increment()];if(l<=127){const h=l+3,f=r[i.increment()],g=a+h;s.fill(f,a,g),a=g}else{const h=256-l;for(let f=0;f<h;f++)s[a++]=r[i.increment()]}}return s}const l_=new TextDecoder;function dd(r,t,i){return i-t>=12?l_.decode(r.subarray(t,i)):(function(s,a,l){let h="",f=a;for(;f<l;){const g=s[f];let y,v,w,S=null,E=g>239?4:g>223?3:g>191?2:1;if(f+E>l)break;E===1?g<128&&(S=g):E===2?(y=s[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):E===3?(y=s[f+1],v=s[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):E===4&&(y=s[f+1],v=s[f+2],w=s[f+3],(192&y)==128&&(192&v)==128&&(192&w)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&w,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,E=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),f+=E}return h})(r,t,i)}class pd extends jo{offsetBuffer;constructor(t,i,s,a){super(t,s,a),this.offsetBuffer=i}}class _f extends pd{textEncoder;constructor(t,i,s,a){super(t,i,s,a??i.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(t){return dd(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class Go extends pd{indexBuffer;textEncoder;constructor(t,i,s,a,l){super(t,s,a,l??i.length),this.indexBuffer=i,this.indexBuffer=i,this.textEncoder=new TextEncoder}getValueFromBuffer(t){const i=this.indexBuffer[t];return dd(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class yf extends pd{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(t,i,s,a,l,h,f){super(t,s,a,f),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=h,this.textEncoder=new TextEncoder}getValueFromBuffer(t){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=(function(s,a,l){const h=[],f=new Array(a.length).fill(0);for(let g=1;g<a.length;g++)f[g]=f[g-1]+a[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)h.push(l[++g]);else{const y=a[l[g]],v=f[l[g]];for(let w=0;w<y;w++)h.push(s[v+w])}return new Uint8Array(h)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[t];return dd(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(t){const i=new Uint32Array(t.length-1);let s=t[0];for(let a=1;a<t.length;a++){const l=t[a];i[a-1]=l-s,s=l}return i}}class dc{static ROOT_COLUMN_NAME="default";static NESTED_COLUMN_SEPARATOR=":";constructor(){}static decode(t,i,s,a,l){let h=null,f=null,g=null,y=null,v=null,w=null,S=null,E=null;for(let C=0;C<a;C++){const D=Oi.decode(i,s);if(D.byteLength!==0)switch(D.physicalStreamType){case Ii.PRESENT:{const R=hc(i,D.numValues,s);w=new dn(R,D.numValues);break}case Ii.OFFSET:f=l!=null||w!=null?ee.decodeNullableIntStream(i,s,D,!1,l??w):ee.decodeIntStream(i,s,D,!1);break;case Ii.LENGTH:{const R=ee.decodeLengthStreamToOffsetBuffer(i,s,D);hr.DICTIONARY===D.logicalStreamType.lengthType?h=R:hr.SYMBOL===D.logicalStreamType.lengthType?y=R:S=R;break}case Ii.DATA:{const R=i.subarray(s.get(),s.get()+D.byteLength);s.add(D.byteLength);const V=D.logicalStreamType.dictionaryType;hn.FSST===V?v=R:hn.SINGLE===V||hn.SHARED===V?g=R:hn.NONE===V&&(E=R);break}}}return this.decodeFsstDictionaryVector(t,v,f,h,g,y,l??w)??this.decodeDictionaryVector(t,g,f,h,l??w)??this.decodePlainStringVector(t,S,E,f,l??w)}static decodeFsstDictionaryVector(t,i,s,a,l,h,f){return i?new yf(t,s,a,l,h,i,f):null}static decodeDictionaryVector(t,i,s,a,l){return i?l?new Go(t,s,a,i,l):new Go(t,s,a,i):null}static decodePlainStringVector(t,i,s,a,l){if(!i||!s)return null;if(a)return l?new Go(t,a,i,s,l):new Go(t,a,i,s);if(l&&l.size()!==i.length-1){const h=new Int32Array(l.size());let f=0;for(let g=0;g<l.size();g++)h[g]=l.get(g)?f++:0;return new Go(t,h,i,s,l)}return l?new _f(t,i,s,l):new _f(t,i,s)}static decodeSharedDictionary(t,i,s,a,l){let h=null,f=null,g=null,y=null,v=!1;for(;!v;){const C=Oi.decode(t,i);switch(C.physicalStreamType){case Ii.LENGTH:hr.DICTIONARY===C.logicalStreamType.lengthType?h=ee.decodeLengthStreamToOffsetBuffer(t,i,C):g=ee.decodeLengthStreamToOffsetBuffer(t,i,C);break;case Ii.DATA:hn.SINGLE===C.logicalStreamType.dictionaryType||hn.SHARED===C.logicalStreamType.dictionaryType?(f=t.subarray(i.get(),i.get()+C.byteLength),v=!0):y=t.subarray(i.get(),i.get()+C.byteLength),i.add(C.byteLength)}}const w=s.complexType.children,S=[];let E=0;for(const C of w){const D=ui(t,i,1)[0];if(D==0)continue;const R=`${s.name}${C.name===dc.ROOT_COLUMN_NAME?"":dc.NESTED_COLUMN_SEPARATOR+C.name}`;if(l&&!l.has(R)){o_(D,t,i);continue}if(D!==2||C.type!=="scalarField"||C.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const V=Oi.decode(t,i),X=hc(t,V.numValues,i),G=Oi.decode(t,i),q=(G instanceof lc?G.numRleValues:G.numValues)!==a?ee.decodeNullableIntStream(t,i,G,!1,new dn(X,V.numValues)):ee.decodeIntStream(t,i,G,!1);S[E++]=y?new yf(R,q,h,f,g,y,new dn(X,V.numValues)):new Go(R,q,h,f,new dn(X,V.numValues))}return S}}function c_(r,t,i,s,a,l){return i.type==="scalarType"?(function(h,f,g,y,v,w){let S=null,E=0;if(h===0)return null;if(w.nullable){const D=Oi.decode(f,g);E=D.numValues;const R=g.get(),V=hc(f,E,g);g.set(R+D.byteLength),S=new dn(V,D.numValues)}const C=S??y;switch(v.physicalType){case 4:case 3:return(function(D,R,V,X,G){const q=Oi.decode(D,R),st=ee.getVectorType(q,G,D,R),ot=X.physicalType===3;if(st===pi.FLAT){const mt=pc(G)?ee.decodeNullableIntStream(D,R,q,ot,G):ee.decodeIntStream(D,R,q,ot);return new id(V.name,mt,G)}if(st===pi.SEQUENCE){const mt=ee.decodeSequenceIntStream(D,R,q);return new nd(V.name,mt[0],mt[1],q.numRleValues)}{const mt=ee.decodeConstIntStream(D,R,q,ot);return new sd(V.name,mt,G)}})(f,g,w,v,C);case 9:return dc.decode(w.name,f,g,w.nullable?h-1:h,S);case 0:return(function(D,R,V,X,G){const q=Oi.decode(D,R),st=q.numValues,ot=R.get(),mt=pc(G)?(function(wt,Mt,zt,At){const kt=gf(wt,Math.ceil(Mt/8),zt),Tt=new dn(kt,Mt),Ut=At.size(),Gt=new dn(new Uint8Array(Ut),Ut);let Ht=0;for(let Ot=0;Ot<At.size();Ot++){const re=!!At.get(Ot)&&Tt.get(Ht++);Gt.set(Ot,re)}return Gt.getBuffer()})(D,st,R,G):hc(D,st,R);R.set(ot+q.byteLength);const Pt=new dn(mt,st);return new s_(V.name,Pt,G)})(f,g,w,0,C);case 6:case 5:return(function(D,R,V,X,G){const q=Oi.decode(D,R),st=ee.getVectorType(q,X,D,R),ot=G.physicalType===5;if(st===pi.FLAT){const mt=pc(X)?ee.decodeNullableLongStream(D,R,q,ot,X):ee.decodeLongStream(D,R,q,ot);return new cf(V.name,mt,X)}if(st===pi.SEQUENCE){const mt=ee.decodeSequenceLongStream(D,R,q);return new uf(V.name,mt[0],mt[1],q.numRleValues)}{const mt=ee.decodeConstLongStream(D,R,q,ot);return new mf(V.name,mt,X)}})(f,g,w,C,v);case 7:return(function(D,R,V,X){const G=Oi.decode(D,R),q=pc(X)?(function(st,ot,mt,Pt){const wt=ot.get(),Mt=wt+Pt*Float32Array.BYTES_PER_ELEMENT,zt=new Uint8Array(st.subarray(wt,Mt)).buffer,At=new Float32Array(zt);ot.set(Mt);const kt=mt.size(),Tt=new Float32Array(kt);let Ut=0;for(let Gt=0;Gt<kt;Gt++)Tt[Gt]=mt.get(Gt)?At[Ut++]:0;return Tt})(D,R,X,G.numValues):(function(st,ot,mt){const Pt=ot.get(),wt=Pt+mt*Float32Array.BYTES_PER_ELEMENT,Mt=new Uint8Array(st.subarray(Pt,wt)).buffer,zt=new Float32Array(Mt);return ot.set(wt),zt})(D,R,G.numValues);return new a_(V.name,q,X)})(f,g,w,C);case 8:return(function(D,R,V,X){const G=Oi.decode(D,R),q=pc(X)?(function(st,ot,mt,Pt){const wt=ot.get(),Mt=wt+Pt*Float64Array.BYTES_PER_ELEMENT,zt=new Uint8Array(st.subarray(wt,Mt)).buffer,At=new Float64Array(zt);ot.set(Mt);const kt=mt.size(),Tt=new Float64Array(kt);let Ut=0;for(let Gt=0;Gt<kt;Gt++)Tt[Gt]=mt.get(Gt)?At[Ut++]:0;return Tt})(D,R,X,G.numValues):(function(st,ot,mt){const Pt=ot.get(),wt=Pt+mt*Float64Array.BYTES_PER_ELEMENT,Mt=new Uint8Array(st.subarray(Pt,wt)).buffer,zt=new Float64Array(Mt);return ot.set(wt),zt})(D,R,G.numValues);return new rd(V.name,q,X)})(f,g,w,C);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(s,r,t,a,i.scalarType,i):s!=1?null:dc.decodeSharedDictionary(r,t,i,a,l)}function pc(r){return r instanceof dn}class qu{static decodeColumnType(t){switch(t){case 0:case 1:case 2:case 3:{const i={};i.nullable=!!(1&t),i.columnScope=0;const s={};return s.physicalType=t>1?6:4,s.type="physicalType",i.scalarType=s,i.type="scalarType",i}case 4:{const i={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:0};return i.type="complexType",i.complexType=s,i}case 30:{const i={nullable:!1,columnScope:0},s={type:"physicalType",physicalType:1};return i.type="complexType",i.complexType=s,i}default:return this.mapScalarType(t)}}static columnTypeHasName(t){return t>=10}static columnTypeHasChildren(t){return t===30}static hasStreamCount(t){if(t.name==="id")return!1;if(t.type==="scalarType"){const i=t.scalarType;if(i.type==="physicalType")switch(i.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(i.type==="logicalType")return!1}else if(t.type==="complexType"){const i=t.complexType;if(i.type==="physicalType")switch(i.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}static mapScalarType(t){let i=null;switch(t){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const s={};s.nullable=!!(1&t),s.columnScope=0;const a={type:"physicalType"};return a.physicalType=i,s.type="scalarType",s.scalarType=a,s}}const u_=new TextDecoder;function xf(r,t){const i=ui(r,t,1)[0];if(i===0)return"";const s=t.get(),a=r.subarray(s,s+i);return t.add(i),u_.decode(a)}function vf(r,t){const i=ui(r,t,1)[0]>>>0,s=!!(4&i),a=!!(2&i),l=ui(r,t,1)[0]>>>0,h={};if(1&i&&(h.nullable=!0),a){const f={};if(s?(f.type="logicalType",f.logicalType=l):(f.type="physicalType",f.physicalType=l),8&i){const g=ui(r,t,1)[0]>>>0;f.children=new Array(g);for(let y=0;y<g;y++)f.children[y]=vf(r,t)}h.type="complexField",h.complexField=f}else{const f={};s?(f.type="logicalType",f.logicalType=l):(f.type="physicalType",f.physicalType=l),h.type="scalarField",h.scalarField=f}return h}function h_(r,t){const i=ui(r,t,1)[0]>>>0,s=qu.decodeColumnType(i);if(!s)throw new Error(`Unsupported column type code: ${i}`);if(qu.columnTypeHasName(i)?s.name=xf(r,t):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),qu.columnTypeHasChildren(i)){const a=ui(r,t,1)[0]>>>0,l=s.complexType;l.children=new Array(a);for(let h=0;h<a;h++)l.children[h]=vf(r,t)}return s}function d_(r,t){const i={featureTables:[]},s={};s.name=xf(r,t);const a=ui(r,t,1)[0]>>>0,l=ui(r,t,1)[0]>>>0;s.columns=new Array(l);for(let h=0;h<l;h++)s.columns[h]=h_(r,t);return i.featureTables.push(s),[i,a]}function p_(r,t,i,s,a,l,h=!1){const f=t.scalarType.physicalType,g=ee.getVectorType(a,l,r,i);if(f===4)switch(g){case pi.FLAT:{const y=ee.decodeIntStream(r,i,a,!1);return new id(s,y,l)}case pi.SEQUENCE:{const y=ee.decodeSequenceIntStream(r,i,a);return new nd(s,y[0],y[1],a.numRleValues)}case pi.CONST:{const y=ee.decodeConstIntStream(r,i,a,!1);return new sd(s,y,l)}}else switch(g){case pi.FLAT:{if(h){const v=ee.decodeLongFloat64Stream(r,i,a,!1);return new rd(s,v,l)}const y=ee.decodeLongStream(r,i,a,!1);return new cf(s,y,l)}case pi.SEQUENCE:{const y=ee.decodeSequenceLongStream(r,i,a);return new uf(s,y[0],y[1],a.numRleValues)}case pi.CONST:{const y=ee.decodeConstLongStream(r,i,a,!1);return new mf(s,y,l)}}throw new Error("Vector type not supported for id column.")}class f_{constructor(t,i){var s;switch(this._featureData=t,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case fi.POINT:case fi.MULTIPOINT:this.type=1;break;case fi.LINESTRING:case fi.MULTILINESTRING:this.type=2;break;case fi.POLYGON:case fi.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}projectPoint(t,i,s,a){return[360*(t.x+i)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/a)*Math.PI))-90]}projectLine(t,i,s,a){return t.map((l=>this.projectPoint(l,i,s,a)))}toGeoJSON(t,i,s){const a=this.extent*Math.pow(2,s),l=this.extent*t,h=this.extent*i,f=this.loadGeometry();let g;switch(this.type){case 1:{const v=[];for(const S of f)v.push(S[0]);const w=this.projectLine(v,l,h,a);g=v.length===1?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w};break}case 2:{const v=f.map((w=>this.projectLine(w,l,h,a)));g=v.length===1?{type:"LineString",coordinates:v[0]}:{type:"MultiLineString",coordinates:v};break}case 3:{const v=ua(f),w=[];for(const S of v)w.push(S.map((E=>this.projectLine(E,l,h,a))));g=w.length===1?{type:"Polygon",coordinates:w[0]}:{type:"MultiPolygon",coordinates:w};break}default:throw new Error(`unknown feature type: ${this.type}`)}const y={type:"Feature",geometry:g,properties:this.properties};return this.id!=null&&(y.id=this.id),y}loadGeometry(){const t=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const a of i)s.push(new dt(a.x,a.y));t.push(s)}return t}bbox(){return[0,0,0,0]}}class m_{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new f_(this.features[t],this.extent)}}class bf{constructor(t){this.layers={};const i=(function(s,a,l=!0){const h=new Qg(0),f=[];for(;h.get()<s.length;){const g=ui(s,h,1)[0]>>>0,y=h.get()+g;if(y>s.length)throw new Error(`Block overruns tile: ${y} > ${s.length}`);if(ui(s,h,1)[0]>>>0!=1){h.set(y);continue}const v=d_(s,h),w=v[1],S=v[0].featureTables[0];let E=null,C=null;const D=[];let R=0;for(const X of S.columns){const G=X.name;if(G==="id"){let q=null;if(X.nullable){const ot=Oi.decode(s,h),mt=h.get(),Pt=hc(s,ot.numValues,h);h.set(mt+ot.byteLength),q=new dn(Pt,ot.numValues)}const st=Oi.decode(s,h);R=st.getDecompressedCount(),E=p_(s,X,h,G,st,q??R,l)}else if(G==="geometry"){const q=ui(s,h,1)[0];if(R===0){const st=h.get();R=Oi.decode(s,h).getDecompressedCount(),h.set(st)}C=n_(s,q,h,R,a)}else{const q=qu.hasStreamCount(X)?ui(s,h,1)[0]:1;if(q===0&&X.type==="scalarType")continue;const st=c_(s,h,X,q,R,void 0);st&&(Array.isArray(st)?D.push(...st):D.push(st))}}const V=new Jg(S.name,C,E,D,w);f.push(V),h.set(y)}return f})(new Uint8Array(t));this.layers=i.reduce(((s,a)=>Object.assign(Object.assign({},s),{[a.name]:new m_(a)})),{})}}class ja{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(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(t){return this.expandBy(-t)}map(t){const i=new ja;return i.extend(t(new dt(this.minX,this.minY))),i.extend(t(new dt(this.maxX,this.minY))),i.extend(t(new dt(this.minX,this.maxY))),i.extend(t(new dt(this.maxX,this.maxY))),i}static fromPoints(t){const i=new ja;for(const s of t)i.extend(s);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}const fd="_geojsonTileLayer";class wf{constructor(t,i){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new wa(le,16,0),this.grid3D=new wa(le,16,0),this.featureIndexArray=new Z,this.promoteId=i}insert(t,i,s,a,l,h){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,l);const g=h?this.grid3D:this.grid;for(let y=0;y<i.length;y++){const v=i[y],w=[1/0,1/0,-1/0,-1/0];for(let S=0;S<v.length;S++){const E=v[S];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]<le&&w[1]<le&&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 gp(new qh(this.rawTileData)).layers:new bf(this.rawTileData).layers,this.sourceLayerCoder=new Qp(this.vtLayers?Object.keys(this.vtLayers).sort():[fd])),this.vtLayers}query(t,i,s,a){this.loadVTLayers();const l=t.params,h=le/t.tileSize/t.scale,f=ma(l.filter,l.globalState),g=t.queryGeometry,y=t.queryPadding*h,v=ja.fromPoints(g),w=this.grid.query(v.minX-y,v.minY-y,v.maxX+y,v.maxY+y),S=ja.fromPoints(t.cameraQueryGeometry).expandBy(y),E=this.grid3D.query(S.minX,S.minY,S.maxX,S.maxY,((R,V,X,G)=>(function(q,st,ot,mt,Pt){for(const Mt of q)if(st<=Mt.x&&ot<=Mt.y&&mt>=Mt.x&&Pt>=Mt.y)return!0;const wt=[new dt(st,ot),new dt(st,Pt),new dt(mt,Pt),new dt(mt,ot)];if(q.length>2){for(const Mt of wt)if(Co(q,Mt))return!0}for(let Mt=0;Mt<q.length-1;Mt++)if(Mm(q[Mt],q[Mt+1],wt))return!0;return!1})(t.cameraQueryGeometry,R-y,V-y,X+y,G+y)));for(const R of E)w.push(R);w.sort(g_);const C={};let D;for(let R=0;R<w.length;R++){const V=w[R];if(V===D)continue;D=V;const X=this.featureIndexArray.get(V);let G=null;this.loadMatchingFeature(C,X.bucketIndex,X.sourceLayerIndex,X.featureIndex,f,l.layers,l.availableImages,i,s,a,((q,st,ot)=>(G||(G=Bn(q)),st.queryIntersectsFeature({queryGeometry:g,feature:q,featureState:ot,geometry:G,zoom:this.z,transform:t.transform,pixelsToTileUnits:h,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return C}loadMatchingFeature(t,i,s,a,l,h,f,g,y,v,w){const S=this.bucketLayerIDs[i];if(h&&!S.some((R=>h.has(R))))return;const E=this.sourceLayerCoder.decode(s),C=this.vtLayers[E].feature(a);if(l.needGeometry){const R=un(C,!0);if(!l.filter(new ge(this.tileID.overscaledZ),R,this.tileID.canonical))return}else if(!l.filter(new ge(this.tileID.overscaledZ),C))return;const D=this.getId(C,E);for(let R=0;R<S.length;R++){const V=S[R];if(h&&!h.has(V))continue;const X=g[V];if(!X)continue;let G={};D&&v&&(G=v.getState(X.sourceLayer||fd,D));const q=li({},y[V]);q.paint=Tf(q.paint,X.paint,C,G,f),q.layout=Tf(q.layout,X.layout,C,G,f);const st=!w||w(C,X,G);if(!st)continue;const ot=new tf(C,this.z,this.x,this.y,D);ot.layer=q;let mt=t[V];mt===void 0&&(mt=t[V]=[]),mt.push({featureIndex:a,feature:ot,intersectionZ:st})}}lookupSymbolFeatures(t,i,s,a,l,h,f,g){const y={};this.loadVTLayers();const v=ma(l.filterSpec,l.globalState);for(const w of t)this.loadMatchingFeature(y,s,a,w,v,h,f,g,i);return y}hasLayer(t){for(const i of this.bucketLayerIDs)for(const s of i)if(t===s)return!0;return!1}getId(t,i){var s;let a=t.id;return this.promoteId&&(a=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof a=="boolean"&&(a=Number(a)),a===void 0&&(!((s=t.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(a=Number(t.properties.cluster_id))),a}}function Tf(r,t,i,s,a){return Fr(r,((l,h)=>{const f=t instanceof ls?t.get(h):null;return f&&f.evaluate?f.evaluate(i,s,a):f}))}function g_(r,t){return t-r}function Sf(r,t,i,s,a){const l=[];for(let h=0;h<r.length;h++){const f=r[h];let g;for(let y=0;y<f.length-1;y++){let v=f[y],w=f[y+1];v.x<t&&w.x<t||(v.x<t?v=new dt(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x<t&&(w=new dt(t,v.y+(t-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y<i&&w.y<i||(v.y<i?v=new dt(v.x+(i-v.y)/(w.y-v.y)*(w.x-v.x),i)._round():w.y<i&&(w=new dt(v.x+(i-v.y)/(w.y-v.y)*(w.x-v.x),i)._round()),v.x>=s&&w.x>=s||(v.x>=s?v=new dt(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=s&&(w=new dt(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=a&&w.y>=a||(v.y>=a?v=new dt(v.x+(a-v.y)/(w.y-v.y)*(w.x-v.x),a)._round():w.y>=a&&(w=new dt(v.x+(a-v.y)/(w.y-v.y)*(w.x-v.x),a)._round()),g&&v.equals(g[g.length-1])||(g=[v],l.push(g)),g.push(w)))))}}return l}function Pf(r,t,i,s,a){switch(t){case 1:return(function(l,h,f,g){const y=[];for(const v of l)for(const w of v){const S=g===0?w.x:w.y;S>=h&&S<=f&&y.push([w])}return y})(r,i,s,a);case 2:return Mf(r,i,s,a,!1);case 3:return Mf(r,i,s,a,!0)}return[]}function __(r,t,i,s,a){const l=s===0?y_:x_;let h=[];const f=[];for(let v=0;v<r.length-1;v++){const w=r[v],S=r[v+1],E=s===0?w.x:w.y,C=s===0?S.x:S.y;let D=!1;E<t?C>t&&h.push(l(w,S,t)):E>i?C<i&&h.push(l(w,S,i)):h.push(w),C<t&&E>=t&&(h.push(l(w,S,t)),D=!0),C>i&&E<=i&&(h.push(l(w,S,i)),D=!0),!a&&D&&(f.push(h),h=[])}const g=r.length-1,y=s===0?r[g].x:r[g].y;return y>=t&&y<=i&&h.push(r[g]),a&&h.length>0&&!h[0].equals(h[h.length-1])&&h.push(new dt(h[0].x,h[0].y)),h.length>0&&f.push(h),f}function Mf(r,t,i,s,a){const l=[];for(const h of r){const f=__(h,t,i,s,a);f.length>0&&l.push(...f)}return l}function y_(r,t,i){return new dt(i,r.y+(i-r.x)/(t.x-r.x)*(t.y-r.y))}function x_(r,t,i){return new dt(r.x+(i-r.y)/(t.y-r.y)*(t.x-r.x),i)}Lt("FeatureIndex",wf,{omit:["rawTileData","sourceLayerCoder"]});class Ys extends dt{constructor(t,i,s,a){super(t,i),this.angle=s,a!==void 0&&(this.segment=a)}clone(){return new Ys(this.x,this.y,this.angle,this.segment)}}function If(r,t,i,s,a){if(t.segment===void 0||i===0)return!0;let l=t,h=t.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(l),l=r[h]}f+=r[h].dist(r[h+1]),h++;const g=[];let y=0;for(;f<i/2;){const v=r[h],w=r[h+1];if(!w)return!1;let S=r[h-1].angleTo(v)-v.angleTo(w);for(S=Math.abs((S+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:S}),y+=S;f-g[0].distance>s;)y-=g.shift().angleDelta;if(y>a)return!1;h++,f+=v.dist(w)}return!0}function Ef(r){let t=0;for(let i=0;i<r.length-1;i++)t+=r[i].dist(r[i+1]);return t}function Cf(r,t,i){return r?.6*t*i:0}function Af(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function v_(r,t,i,s,a,l){const h=Cf(i,a,l),f=Af(i,s)*l;let g=0;const y=Ef(r)/2;for(let v=0;v<r.length-1;v++){const w=r[v],S=r[v+1],E=w.dist(S);if(g+E>y){const C=(y-g)/E,D=Tr.number(w.x,S.x,C),R=Tr.number(w.y,S.y,C),V=new Ys(D,R,S.angleTo(w),v);return V._round(),!h||If(r,V,f,h,t)?V:void 0}g+=E}}function b_(r,t,i,s,a,l,h,f,g){const y=Cf(s,l,h),v=Af(s,a),w=v*h,S=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return t-w<t/4&&(t=w+t/4),kf(r,S?t/2*f%t:(v/2+2*l)*h*f%t,t,y,i,w,S,!1,g)}function kf(r,t,i,s,a,l,h,f,g){const y=l/2,v=Ef(r);let w=0,S=t-i,E=[];for(let C=0;C<r.length-1;C++){const D=r[C],R=r[C+1],V=D.dist(R),X=R.angleTo(D);for(;S+i<w+V;){S+=i;const G=(S-w)/V,q=Tr.number(D.x,R.x,G),st=Tr.number(D.y,R.y,G);if(q>=0&&q<g&&st>=0&&st<g&&S-y>=0&&S+y<=v){const ot=new Ys(q,st,X,C);ot._round(),s&&!If(r,ot,l,s,a)||E.push(ot)}}w+=V}return f||E.length||h||(E=kf(r,w/2,i,s,a,l,h,!0,g)),E}function Df(r,t,i,s){const a=[],l=r.image,h=l.pixelRatio,f=l.paddedRect.w-2,g=l.paddedRect.h-2;let y={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,f]],w=l.stretchY||[[0,g]],S=(Tt,Ut)=>Tt+Ut[1]-Ut[0],E=v.reduce(S,0),C=w.reduce(S,0),D=f-E,R=g-C;let V=0,X=E,G=0,q=C,st=0,ot=D,mt=0,Pt=R;if(l.content&&s){const Tt=l.content,Ut=Tt[2]-Tt[0],Gt=Tt[3]-Tt[1];(l.textFitWidth||l.textFitHeight)&&(y=Fp(r)),V=Wu(v,0,Tt[0]),G=Wu(w,0,Tt[1]),X=Wu(v,Tt[0],Tt[2]),q=Wu(w,Tt[1],Tt[3]),st=Tt[0]-V,mt=Tt[1]-G,ot=Ut-X,Pt=Gt-q}const wt=y.x1,Mt=y.y1,zt=y.x2-wt,At=y.y2-Mt,kt=(Tt,Ut,Gt,Ht)=>{const Ot=Hu(Tt.stretch-V,X,zt,wt),re=Xu(Tt.fixed-st,ot,Tt.stretch,E),ze=Hu(Ut.stretch-G,q,At,Mt),si=Xu(Ut.fixed-mt,Pt,Ut.stretch,C),Ci=Hu(Gt.stretch-V,X,zt,wt),Xr=Xu(Gt.fixed-st,ot,Gt.stretch,E),Yi=Hu(Ht.stretch-G,q,At,Mt),vi=Xu(Ht.fixed-mt,Pt,Ht.stretch,C),Ai=new dt(Ot,ze),He=new dt(Ci,ze),bi=new dt(Ci,Yi),ji=new dt(Ot,Yi),Ni=new dt(re/h,si/h),er=new dt(Xr/h,vi/h),ki=t*Math.PI/180;if(ki){const mi=Math.sin(ki),Ne=Math.cos(ki),ai=[Ne,-mi,mi,Ne];Ai._matMult(ai),He._matMult(ai),ji._matMult(ai),bi._matMult(ai)}const ir=Tt.stretch+Tt.fixed,Yr=Ut.stretch+Ut.fixed;return{tl:Ai,tr:He,bl:ji,br:bi,tex:{x:l.paddedRect.x+1+ir,y:l.paddedRect.y+1+Yr,w:Gt.stretch+Gt.fixed-ir,h:Ht.stretch+Ht.fixed-Yr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ni,pixelOffsetBR:er,minFontScaleX:ot/h/zt,minFontScaleY:Pt/h/At,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const Tt=zf(v,D,E),Ut=zf(w,R,C);for(let Gt=0;Gt<Tt.length-1;Gt++){const Ht=Tt[Gt],Ot=Tt[Gt+1];for(let re=0;re<Ut.length-1;re++)a.push(kt(Ht,Ut[re],Ot,Ut[re+1]))}}else a.push(kt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return a}function Wu(r,t,i){let s=0;for(const a of r)s+=Math.max(t,Math.min(i,a[1]))-Math.max(t,Math.min(i,a[0]));return s}function zf(r,t,i){const s=[{fixed:-1,stretch:0}];for(const[a,l]of r){const h=s[s.length-1];s.push({fixed:a-h.stretch,stretch:h.stretch}),s.push({fixed:a-h.stretch,stretch:h.stretch+(l-a)})}return s.push({fixed:t+1,stretch:i}),s}function Hu(r,t,i,s){return r/t*i+s}function Xu(r,t,i,s){return r-t*i/s}Lt("Anchor",Ys);class Yu{constructor(t,i,s,a,l,h,f,g,y,v){var w;if(this.boxStartIndex=t.length,y){let S=h.top,E=h.bottom;const C=h.collisionPadding;C&&(S-=C[1],E+=C[3]);let D=E-S;D>0&&(D=Math.max(10,D),this.circleDiameter=D)}else{const S=!((w=h.image)===null||w===void 0)&&w.content&&(h.image.textFitWidth||h.image.textFitHeight)?Fp(h):{x1:h.left,y1:h.top,x2:h.right,y2:h.bottom};S.y1=S.y1*f-g[0],S.y2=S.y2*f+g[2],S.x1=S.x1*f-g[3],S.x2=S.x2*f+g[1];const E=h.collisionPadding;if(E&&(S.x1-=E[0]*f,S.y1-=E[1]*f,S.x2+=E[2]*f,S.y2+=E[3]*f),v){const C=new dt(S.x1,S.y1),D=new dt(S.x2,S.y1),R=new dt(S.x1,S.y2),V=new dt(S.x2,S.y2),X=v*Math.PI/180;C._rotate(X),D._rotate(X),R._rotate(X),V._rotate(X),S.x1=Math.min(C.x,D.x,R.x,V.x),S.x2=Math.max(C.x,D.x,R.x,V.x),S.y1=Math.min(C.y,D.y,R.y,V.y),S.y2=Math.max(C.y,D.y,R.y,V.y)}t.emplaceBack(i.x,i.y,S.x1,S.y1,S.x2,S.y2,s,a,l)}this.boxEndIndex=t.length}}class w_{constructor(t=[],i=(s,a)=>s<a?-1:s>a?1:0){if(this.data=t,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(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:i,compare:s}=this,a=i[t];for(;t>0;){const l=t-1>>1,h=i[l];if(s(a,h)>=0)break;i[t]=h,t=l}i[t]=a}_down(t){const{data:i,compare:s}=this,a=this.length>>1,l=i[t];for(;t<a;){let h=1+(t<<1);const f=h+1;if(f<this.length&&s(i[f],i[h])<0&&(h=f),s(i[h],l)>=0)break;i[t]=i[h],t=h}i[t]=l}}function T_(r,t=1,i=!1){const s=ja.fromPoints(r[0]),a=Math.min(s.width(),s.height());let l=a/2;const h=new w_([],S_),{minX:f,minY:g,maxX:y,maxY:v}=s;if(a===0)return new dt(f,g);for(let E=f;E<y;E+=a)for(let C=g;C<v;C+=a)h.push(new $o(E+l,C+l,l,r));let w=(function(E){let C=0,D=0,R=0;const V=E[0];for(let X=0,G=V.length,q=G-1;X<G;q=X++){const st=V[X],ot=V[q],mt=st.x*ot.y-ot.x*st.y;D+=(st.x+ot.x)*mt,R+=(st.y+ot.y)*mt,C+=3*mt}return new $o(D/C,R/C,0,E)})(r),S=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,S)),E.max-w.d<=t||(l=E.h/2,h.push(new $o(E.p.x-l,E.p.y-l,l,r)),h.push(new $o(E.p.x+l,E.p.y-l,l,r)),h.push(new $o(E.p.x-l,E.p.y+l,l,r)),h.push(new $o(E.p.x+l,E.p.y+l,l,r)),S+=4)}return i&&(console.log(`num probes: ${S}`),console.log(`best distance: ${w.d}`)),w.p}function S_(r,t){return t.max-r.max}function $o(r,t,i,s){this.p=new dt(r,t),this.h=i,this.d=(function(a,l){let h=!1,f=1/0;for(let g=0;g<l.length;g++){const y=l[g];for(let v=0,w=y.length,S=w-1;v<w;S=v++){const E=y[v],C=y[S];E.y>a.y!=C.y>a.y&&a.x<(C.x-E.x)*(a.y-E.y)/(C.y-E.y)+E.x&&(h=!h),f=Math.min(f,Wd(a,E,C))}}return(h?1:-1)*Math.sqrt(f)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Ei;M.aO=void 0,(Ei=M.aO||(M.aO={}))[Ei.center=1]="center",Ei[Ei.left=2]="left",Ei[Ei.right=3]="right",Ei[Ei.top=4]="top",Ei[Ei.bottom=5]="bottom",Ei[Ei["top-left"]=6]="top-left",Ei[Ei["top-right"]=7]="top-right",Ei[Ei["bottom-left"]=8]="bottom-left",Ei[Ei["bottom-right"]=9]="bottom-right";const md=Number.POSITIVE_INFINITY;function Rf(r,t){return t[1]!==md?(function(i,s,a){let l=0,h=0;switch(s=Math.abs(s),a=Math.abs(a),i){case"top-right":case"top-left":case"top":h=a-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-a}switch(i){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,h]})(r,t[0],t[1]):(function(i,s){let a=0,l=0;s<0&&(s=0);const h=s/Math.SQRT2;switch(i){case"top-right":case"top-left":l=h-7;break;case"bottom-right":case"bottom-left":l=7-h;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(i){case"top-right":case"bottom-right":a=-h;break;case"top-left":case"bottom-left":a=h;break;case"left":a=s;break;case"right":a=-s}return[a,l]})(r,t[0])}function Lf(r,t,i){var s;const a=r.layout,l=(s=a.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},i);if(l){const f=l.values,g=[];for(let y=0;y<f.length;y+=2){const v=g[y]=f[y],w=f[y+1].map((S=>S*di));v.startsWith("top")?w[1]-=7:v.startsWith("bottom")&&(w[1]+=7),g[y+1]=w}return new Fi(g)}const h=a.get("text-variable-anchor");if(h){let f;f=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[a.get("text-radial-offset").evaluate(t,{},i)*di,md]:a.get("text-offset").evaluate(t,{},i).map((y=>y*di));const g=[];for(const y of h)g.push(y,Rf(y,f));return new Fi(g)}return null}function gd(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 P_(r,t,i,s,a,l,h,f,g,y,v,w){let S=l.textMaxSize.evaluate(t,{});S===void 0&&(S=h);const E=r.layers[0].layout,C=E.get("icon-offset").evaluate(t,{},v),D=Bf(i.horizontal),R=h/24,V=r.tilePixelRatio*R,X=r.tilePixelRatio*S/24,G=r.tilePixelRatio*f,q=r.tilePixelRatio*E.get("symbol-spacing"),st=E.get("text-padding")*r.tilePixelRatio,ot=(function(Gt,Ht,Ot,re=1){const ze=Gt.get("icon-padding").evaluate(Ht,{},Ot),si=ze&&ze.values;return[si[0]*re,si[1]*re,si[2]*re,si[3]*re]})(E,t,v,r.tilePixelRatio),mt=E.get("text-max-angle")/180*Math.PI,Pt=E.get("text-rotation-alignment")!=="viewport"&&E.get("symbol-placement")!=="point",wt=E.get("icon-rotation-alignment")==="map"&&E.get("symbol-placement")!=="point",Mt=E.get("symbol-placement"),zt=q/2,At=E.get("icon-text-fit");let kt;s&&At!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(kt=Bp(s,i.vertical,At,E.get("icon-text-fit-padding"),C,R)),D&&(s=Bp(s,D,At,E.get("icon-text-fit-padding"),C,R)));const Tt=v?w.line.getGranularityForZoomLevel(v.z):1,Ut=(Gt,Ht)=>{Ht.x<0||Ht.x>=le||Ht.y<0||Ht.y>=le||(function(Ot,re,ze,si,Ci,Xr,Yi,vi,Ai,He,bi,ji,Ni,er,ki,ir,Yr,mi,Ne,ai,$e,gi,_s,pn,gc){const Ks=Ot.addToLineVertexArray(re,ze);let Na,Zo,qo,Wo,Vf=0,Uf=0,Gf=0,$f=0,Sd=-1,Pd=-1;const ys={};let Zf=on("");if(Ot.allowVerticalPlacement&&si.vertical){const Vi=vi.layout.get("text-rotate").evaluate($e,{},pn)+90;qo=new Yu(Ai,re,He,bi,ji,si.vertical,Ni,er,ki,Vi),Yi&&(Wo=new Yu(Ai,re,He,bi,ji,Yi,Yr,mi,ki,Vi))}if(Ci){const Vi=vi.layout.get("icon-rotate").evaluate($e,{}),Cr=vi.layout.get("icon-text-fit")!=="none",Va=Df(Ci,Vi,_s,Cr),mn=Yi?Df(Yi,Vi,_s,Cr):void 0;Zo=new Yu(Ai,re,He,bi,ji,Ci,Yr,mi,!1,Vi),Vf=4*Va.length;const Ua=Ot.iconSizeData;let On=null;Ua.kind==="source"?(On=[ms*vi.layout.get("icon-size").evaluate($e,{})],On[0]>Ws&&Re(`${Ot.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ua.kind==="composite"&&(On=[ms*gi.compositeIconSizes[0].evaluate($e,{},pn),ms*gi.compositeIconSizes[1].evaluate($e,{},pn)],(On[0]>Ws||On[1]>Ws)&&Re(`${Ot.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ot.addSymbols(Ot.icon,Va,On,ai,Ne,$e,M.ay.none,re,Ks.lineStartIndex,Ks.lineLength,-1,pn),Sd=Ot.icon.placedSymbolArray.length-1,mn&&(Uf=4*mn.length,Ot.addSymbols(Ot.icon,mn,On,ai,Ne,$e,M.ay.vertical,re,Ks.lineStartIndex,Ks.lineLength,-1,pn),Pd=Ot.icon.placedSymbolArray.length-1)}const qf=Object.keys(si.horizontal);for(const Vi of qf){const Cr=si.horizontal[Vi];if(!Na){Zf=on(Cr.text);const mn=vi.layout.get("text-rotate").evaluate($e,{},pn);Na=new Yu(Ai,re,He,bi,ji,Cr,Ni,er,ki,mn)}const Va=Cr.positionedLines.length===1;if(Gf+=Ff(Ot,re,Cr,Xr,vi,ki,$e,ir,Ks,si.vertical?M.ay.horizontal:M.ay.horizontalOnly,Va?qf:[Vi],ys,Sd,gi,pn),Va)break}si.vertical&&($f+=Ff(Ot,re,si.vertical,Xr,vi,ki,$e,ir,Ks,M.ay.vertical,["vertical"],ys,Pd,gi,pn));const E_=Na?Na.boxStartIndex:Ot.collisionBoxArray.length,C_=Na?Na.boxEndIndex:Ot.collisionBoxArray.length,A_=qo?qo.boxStartIndex:Ot.collisionBoxArray.length,k_=qo?qo.boxEndIndex:Ot.collisionBoxArray.length,D_=Zo?Zo.boxStartIndex:Ot.collisionBoxArray.length,z_=Zo?Zo.boxEndIndex:Ot.collisionBoxArray.length,R_=Wo?Wo.boxStartIndex:Ot.collisionBoxArray.length,L_=Wo?Wo.boxEndIndex:Ot.collisionBoxArray.length;let fn=-1;const Ju=(Vi,Cr)=>Vi&&Vi.circleDiameter?Math.max(Vi.circleDiameter,Cr):Cr;fn=Ju(Na,fn),fn=Ju(qo,fn),fn=Ju(Zo,fn),fn=Ju(Wo,fn);const Wf=fn>-1?1:0;Wf&&(fn*=gc/di),Ot.glyphOffsetArray.length>=Bo.MAX_GLYPHS&&Re("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$e.sortKey!==void 0&&Ot.addToSortKeyRanges(Ot.symbolInstances.length,$e.sortKey);const F_=Lf(vi,$e,pn),[B_,O_]=(function(Vi,Cr){const Va=Vi.length,mn=Cr?.values;if(mn?.length>0)for(let Ua=0;Ua<mn.length;Ua+=2){const On=mn[Ua+1];Vi.emplaceBack(M.aO[mn[Ua]],On[0],On[1])}return[Va,Vi.length]})(Ot.textAnchorOffsets,F_);Ot.symbolInstances.emplaceBack(re.x,re.y,ys.right>=0?ys.right:-1,ys.center>=0?ys.center:-1,ys.left>=0?ys.left:-1,ys.vertical||-1,Sd,Pd,Zf,E_,C_,A_,k_,D_,z_,R_,L_,He,Gf,$f,Vf,Uf,Wf,0,Ni,fn,B_,O_)})(r,Ht,Gt,i,s,a,kt,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,V,[st,st,st,st],Pt,g,G,ot,wt,C,t,l,y,v,h)};if(Mt==="line")for(const Gt of Sf(t.geometry,0,0,le,le)){const Ht=La(Gt,Tt),Ot=b_(Ht,q,mt,i.vertical||D,s,24,X,r.overscaling,le);for(const re of Ot)D&&M_(r,D.text,zt,re)||Ut(Ht,re)}else if(Mt==="line-center"){for(const Gt of t.geometry)if(Gt.length>1){const Ht=La(Gt,Tt),Ot=v_(Ht,mt,i.vertical||D,s,24,X);Ot&&Ut(Ht,Ot)}}else if(t.type==="Polygon")for(const Gt of ua(t.geometry,0)){const Ht=T_(Gt,16);Ut(La(Gt[0],Tt,!0),new Ys(Ht.x,Ht.y,0))}else if(t.type==="LineString")for(const Gt of t.geometry){const Ht=La(Gt,Tt);Ut(Ht,new Ys(Ht[0].x,Ht[0].y,0))}else if(t.type==="Point")for(const Gt of t.geometry)for(const Ht of Gt)Ut([Ht],new Ys(Ht.x,Ht.y,0))}function Ff(r,t,i,s,a,l,h,f,g,y,v,w,S,E,C){const D=(function(X,G,q,st,ot,mt,Pt,wt){const Mt=st.layout.get("text-rotate").evaluate(mt,{})*Math.PI/180,zt=[];for(const At of G.positionedLines)for(const kt of At.positionedGlyphs){if(!kt.rect)continue;const Tt=kt.rect||{};let Ut=4,Gt=!0,Ht=1,Ot=0;const re=(ot||wt)&&kt.vertical,ze=kt.metrics.advance*kt.scale/2;if(wt&&G.verticalizable&&(Ot=At.lineOffset/2-(kt.imageName?-(di-kt.metrics.width*kt.scale)/2:(kt.scale-1)*di)),kt.imageName){const mi=Pt[kt.imageName];Gt=mi.sdf,Ht=mi.pixelRatio,Ut=1/Ht}const si=ot?[kt.x+ze,kt.y]:[0,0];let Ci=ot?[0,0]:[kt.x+ze+q[0],kt.y+q[1]-Ot],Xr=[0,0];re&&(Xr=Ci,Ci=[0,0]);const Yi=kt.metrics.isDoubleResolution?2:1,vi=(kt.metrics.left-Ut)*kt.scale-ze+Ci[0],Ai=(-kt.metrics.top-Ut)*kt.scale+Ci[1],He=vi+Tt.w/Yi*kt.scale/Ht,bi=Ai+Tt.h/Yi*kt.scale/Ht,ji=new dt(vi,Ai),Ni=new dt(He,Ai),er=new dt(vi,bi),ki=new dt(He,bi);if(re){const mi=new dt(-ze,ze- -17),Ne=-Math.PI/2,ai=12-ze,$e=new dt(22-ai,-(kt.imageName?ai:0)),gi=new dt(...Xr);ji._rotateAround(Ne,mi)._add($e)._add(gi),Ni._rotateAround(Ne,mi)._add($e)._add(gi),er._rotateAround(Ne,mi)._add($e)._add(gi),ki._rotateAround(Ne,mi)._add($e)._add(gi)}if(Mt){const mi=Math.sin(Mt),Ne=Math.cos(Mt),ai=[Ne,-mi,mi,Ne];ji._matMult(ai),Ni._matMult(ai),er._matMult(ai),ki._matMult(ai)}const ir=new dt(0,0),Yr=new dt(0,0);zt.push({tl:ji,tr:Ni,bl:er,br:ki,tex:Tt,writingMode:G.writingMode,glyphOffset:si,sectionIndex:kt.sectionIndex,isSDF:Gt,pixelOffsetTL:ir,pixelOffsetBR:Yr,minFontScaleX:0,minFontScaleY:0})}return zt})(0,i,f,a,l,h,s,r.allowVerticalPlacement),R=r.textSizeData;let V=null;R.kind==="source"?(V=[ms*a.layout.get("text-size").evaluate(h,{})],V[0]>Ws&&Re(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):R.kind==="composite"&&(V=[ms*E.compositeTextSizes[0].evaluate(h,{},C),ms*E.compositeTextSizes[1].evaluate(h,{},C)],(V[0]>Ws||V[1]>Ws)&&Re(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,D,V,f,l,h,y,t,g.lineStartIndex,g.lineLength,S,C);for(const X of v)w[X]=r.text.placedSymbolArray.length-1;return 4*D.length}function Bf(r){for(const t in r)return r[t];return null}function M_(r,t,i,s){const a=r.compareText;if(t in a){const l=a[t];for(let h=l.length-1;h>=0;h--)if(s.dist(l[h])<i)return!0}else a[t]=[];return a[t].push(s),!1}const Of=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _d{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const l=Of[15&s];if(!l)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new _d(f,h,l,t)}constructor(t,i=64,s=Float64Array,a){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const l=Of.indexOf(this.ArrayType),h=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=i,s}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return yd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:f}=this,g=[0,l.length-1,0],y=[];for(;g.length;){const v=g.pop()||0,w=g.pop()||0,S=g.pop()||0;if(w-S<=f){for(let R=S;R<=w;R++){const V=h[2*R],X=h[2*R+1];V>=t&&V<=s&&X>=i&&X<=a&&y.push(l[R])}continue}const E=S+w>>1,C=h[2*E],D=h[2*E+1];C>=t&&C<=s&&D>=i&&D<=a&&y.push(l[E]),(v===0?t<=C:i<=D)&&(g.push(S),g.push(E-1),g.push(1-v)),(v===0?s>=C:a>=D)&&(g.push(E+1),g.push(w),g.push(1-v))}return y}within(t,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:l,nodeSize:h}=this,f=[0,a.length-1,0],g=[],y=s*s;for(;f.length;){const v=f.pop()||0,w=f.pop()||0,S=f.pop()||0;if(w-S<=h){for(let R=S;R<=w;R++)Nf(l[2*R],l[2*R+1],t,i)<=y&&g.push(a[R]);continue}const E=S+w>>1,C=l[2*E],D=l[2*E+1];Nf(C,D,t,i)<=y&&g.push(a[E]),(v===0?t-s<=C:i-s<=D)&&(f.push(S),f.push(E-1),f.push(1-v)),(v===0?t+s>=C:i+s>=D)&&(f.push(E+1),f.push(w),f.push(1-v))}return g}}function yd(r,t,i,s,a,l){if(a-s<=i)return;const h=s+a>>1;jf(r,t,h,s,a,l),yd(r,t,i,s,h-1,1-l),yd(r,t,i,h+1,a,1-l)}function jf(r,t,i,s,a,l){for(;a>s;){if(a-s>600){const y=a-s+1,v=i-s+1,w=Math.log(y),S=.5*Math.exp(2*w/3),E=.5*Math.sqrt(w*S*(y-S)/y)*(v-y/2<0?-1:1);jf(r,t,i,Math.max(s,Math.floor(i-v*S/y+E)),Math.min(a,Math.floor(i+(y-v)*S/y+E)),l)}const h=t[2*i+l];let f=s,g=a;for(fc(r,t,s,i),t[2*a+l]>h&&fc(r,t,s,a);f<g;){for(fc(r,t,f,g),f++,g--;t[2*f+l]<h;)f++;for(;t[2*g+l]>h;)g--}t[2*s+l]===h?fc(r,t,s,g):(g++,fc(r,t,g,a)),g<=i&&(s=g+1),i<=g&&(a=g-1)}}function fc(r,t,i,s){xd(r,i,s),xd(t,2*i,2*s),xd(t,2*i+1,2*s+1)}function xd(r,t,i){const s=r[t];r[t]=r[i],r[i]=s}function Nf(r,t,i,s){const a=r-i,l=t-s;return a*a+l*l}var vd;M.cG=void 0,(vd=M.cG||(M.cG={})).create="create",vd.load="load",vd.fullLoad="fullLoad";let Ku=null,mc=[];const bd=1e3/60,wd="loadTime",Td="fullLoadTime",I_={mark(r){performance.mark(r)},frame(r){const t=r;Ku!=null&&mc.push(t-Ku),Ku=t},clearMetrics(){Ku=null,mc=[],performance.clearMeasures(wd),performance.clearMeasures(Td);for(const r in M.cG)performance.clearMarks(M.cG[r])},getPerformanceMetrics(){performance.measure(wd,M.cG.create,M.cG.load),performance.measure(Td,M.cG.create,M.cG.fullLoad);const r=performance.getEntriesByName(wd)[0].duration,t=performance.getEntriesByName(Td)[0].duration,i=mc.length,s=1/(mc.reduce(((l,h)=>l+h),0)/i/1e3),a=mc.filter((l=>l>bd)).reduce(((l,h)=>l+(h-bd)/bd),0);return{loadTime:r,fullLoadTime:t,fps:s,percentDroppedFrames:a/(i+a)*100,totalFrames:i}}};M.$=fr,M.A=de,M.B=bo,M.C=os,M.D=Vt,M.E=ut,M.F=function([r,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(i),y:r*Math.sin(t)*Math.sin(i),z:r*Math.cos(i)}},M.G=Tr,M.H=ge,M.I=Wh,M.J=wh,M.K=function(r){if(Le==null){const t=r.navigator?r.navigator.userAgent:null;Le=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Le},M.L=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Xg((()=>this.process())),this.subscription=Tn(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Or(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,t){return new Promise(((i,s)=>{const a=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=t?Tn(t.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[a];const g={id:a,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),Yg):null;this.resolveRejects[a]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const h=[],f=Object.assign(Object.assign({},r),{id:a,sourceMapId:this.mapId,origin:location.origin,data:Ta(r.data,h)});this.target.postMessage(f,{transfer:h})}))}receive(r){const t=r.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];const s=this.abortControllers[i];return delete this.abortControllers[i],void(s&&s.abort())}if(Or(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return c(this,void 0,void 0,(function*(){if(t.type==="<response>"){const a=this.resolveRejects[r];return delete this.resolveRejects[r],a?void(t.error?a.reject(sn(t.error)):a.resolve(sn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=sn(t.data),s=new AbortController;this.abortControllers[r]=s;try{const a=yield this.messageHandlers[t.type](t.sourceMapId,i,s);this.completeTask(r,null,a)}catch(a){this.completeTask(r,a)}}))}completeTask(r,t,i){const s=[];delete this.abortControllers[r];const a={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Ta(t):null,data:Ta(i,s)};this.target.postMessage(a,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},M.M=Xn,M.N=function(){var r=new de(16);return de!=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,t,i){var s,a,l,h,f,g,y,v,w,S,E,C,D=i[0],R=i[1],V=i[2];return t===r?(r[12]=t[0]*D+t[4]*R+t[8]*V+t[12],r[13]=t[1]*D+t[5]*R+t[9]*V+t[13],r[14]=t[2]*D+t[6]*R+t[10]*V+t[14],r[15]=t[3]*D+t[7]*R+t[11]*V+t[15]):(a=t[1],l=t[2],h=t[3],f=t[4],g=t[5],y=t[6],v=t[7],w=t[8],S=t[9],E=t[10],C=t[11],r[0]=s=t[0],r[1]=a,r[2]=l,r[3]=h,r[4]=f,r[5]=g,r[6]=y,r[7]=v,r[8]=w,r[9]=S,r[10]=E,r[11]=C,r[12]=s*D+f*R+w*V+t[12],r[13]=a*D+g*R+S*V+t[13],r[14]=l*D+y*R+E*V+t[14],r[15]=h*D+v*R+C*V+t[15]),r},M.P=dt,M.Q=function(r,t,i){var s=i[0],a=i[1],l=i[2];return r[0]=t[0]*s,r[1]=t[1]*s,r[2]=t[2]*s,r[3]=t[3]*s,r[4]=t[4]*a,r[5]=t[5]*a,r[6]=t[6]*a,r[7]=t[7]*a,r[8]=t[8]*l,r[9]=t[9]*l,r[10]=t[10]*l,r[11]=t[11]*l,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},M.R=tr,M.S=function(r,t,i){var s=t[0],a=t[1],l=t[2],h=t[3],f=t[4],g=t[5],y=t[6],v=t[7],w=t[8],S=t[9],E=t[10],C=t[11],D=t[12],R=t[13],V=t[14],X=t[15],G=i[0],q=i[1],st=i[2],ot=i[3];return r[0]=G*s+q*f+st*w+ot*D,r[1]=G*a+q*g+st*S+ot*R,r[2]=G*l+q*y+st*E+ot*V,r[3]=G*h+q*v+st*C+ot*X,r[4]=(G=i[4])*s+(q=i[5])*f+(st=i[6])*w+(ot=i[7])*D,r[5]=G*a+q*g+st*S+ot*R,r[6]=G*l+q*y+st*E+ot*V,r[7]=G*h+q*v+st*C+ot*X,r[8]=(G=i[8])*s+(q=i[9])*f+(st=i[10])*w+(ot=i[11])*D,r[9]=G*a+q*g+st*S+ot*R,r[10]=G*l+q*y+st*E+ot*V,r[11]=G*h+q*v+st*C+ot*X,r[12]=(G=i[12])*s+(q=i[13])*f+(st=i[14])*w+(ot=i[15])*D,r[13]=G*a+q*g+st*S+ot*R,r[14]=G*l+q*y+st*E+ot*V,r[15]=G*h+q*v+st*C+ot*X,r},M.T=Bh,M.U=function(r,t){const i={};for(let s=0;s<t.length;s++){const a=t[s];a in r&&(i[a]=r[a])}return i},M.V=Hs,M.W=Ri,M.X=qp,M.Y=Zp,M.Z=xt,M._=c,M.a=Sn,M.a$=zi,M.a0=vs,M.a1=Ir,M.a2=Hp,M.a3=Bu,M.a4=le,M.a5=function(r,t,i){if(!r)return t||{};if(!t)return r||{};const s=Jp(r),a=Jp(t);(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 v=h.update.get(g);v&&(f.update.set(g,Kg(v,y)),h.update.delete(g))}})(s,a);const l={};if((s.removeAll||a.removeAll)&&(l.removeAll=!0),l.remove=new Set([...s.remove,...a.remove]),l.add=new Map([...s.add,...a.add]),l.update=new Map([...s.update,...a.update]),l.remove.size&&l.add.size)for(const h of l.add.keys())l.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})(l)},M.a6=function(r,t){if(r==null)return!0;if(r.type==="Feature")return oc(r,t)!=null;if(r.type==="FeatureCollection"){const i=new Set;for(const s of r.features){const a=oc(s,t);if(a==null||i.has(a))return!1;i.add(a)}return!0}return!1},M.a7=function(r,t){const i=new Map;if(r!=null)if(r.type==="Feature")i.set(oc(r,t),r);else for(const s of r.features)i.set(oc(s,t),s);return i},M.a8=function(r,t,i){var s,a;if(t.removeAll)r.clear();else if(t.remove)for(const l of t.remove)r.delete(l);if(t.add)for(const l of t.add){const h=oc(l,i);h!=null&&r.set(h,l)}if(t.update)for(const l of t.update){let h=r.get(l.id);if(!h)continue;const f=!!l.newGeometry,g=l.removeAllProperties||((s=l.removeProperties)===null||s===void 0?void 0:s.length)>0||((a=l.addOrUpdateProperties)===null||a===void 0?void 0:a.length)>0;if((f||g)&&(h=Object.assign({},h),r.set(l.id,h),f&&(h.geometry=l.newGeometry),g)){if(h.properties=l.removeAllProperties?{}:Object.assign({},h.properties||{}),l.removeProperties)for(const y of l.removeProperties)delete h.properties[y];if(l.addOrUpdateProperties)for(const{key:y,value:v}of l.addOrUpdateProperties)h.properties[y]=v}}},M.a9=fd,M.aA=function(r,t){var i=t[0],s=t[1],a=t[2],l=t[3],h=t[4],f=t[5],g=t[6],y=t[7],v=t[8],w=t[9],S=t[10],E=t[11],C=t[12],D=t[13],R=t[14],V=t[15],X=i*f-s*h,G=i*g-a*h,q=i*y-l*h,st=s*g-a*f,ot=s*y-l*f,mt=a*y-l*g,Pt=v*D-w*C,wt=v*R-S*C,Mt=v*V-E*C,zt=w*R-S*D,At=w*V-E*D,kt=S*V-E*R,Tt=X*kt-G*At+q*zt+st*Mt-ot*wt+mt*Pt;return Tt?(r[0]=(f*kt-g*At+y*zt)*(Tt=1/Tt),r[1]=(a*At-s*kt-l*zt)*Tt,r[2]=(D*mt-R*ot+V*st)*Tt,r[3]=(S*ot-w*mt-E*st)*Tt,r[4]=(g*Mt-h*kt-y*wt)*Tt,r[5]=(i*kt-a*Mt+l*wt)*Tt,r[6]=(R*q-C*mt-V*G)*Tt,r[7]=(v*mt-S*q+E*G)*Tt,r[8]=(h*At-f*Mt+y*Pt)*Tt,r[9]=(s*Mt-i*At-l*Pt)*Tt,r[10]=(C*ot-D*q+V*X)*Tt,r[11]=(w*q-v*ot-E*X)*Tt,r[12]=(f*wt-h*zt-g*Pt)*Tt,r[13]=(i*zt-s*wt+a*Pt)*Tt,r[14]=(D*G-C*st-R*X)*Tt,r[15]=(v*st-w*G+S*X)*Tt,r):null},M.aB=wi,M.aC=function(r){var t=r[0],i=r[1];return Math.sqrt(t*t+i*i)},M.aD=function(r){return r[0]=0,r[1]=0,r},M.aE=function(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r},M.aF=Yh,M.aG=Zn,M.aH=function(r,t,i,s){const a=t.y-r.y,l=t.x-r.x,h=s.y-i.y,f=s.x-i.x,g=h*l-f*a;if(g===0)return null;const y=(f*(r.y-i.y)-h*(r.x-i.x))/g;return new dt(r.x+y*l,r.y+y*a)},M.aI=Sf,M.aJ=Zd,M.aK=function(r){let t=1/0,i=1/0,s=-1/0,a=-1/0;for(const l of r)t=Math.min(t,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);return[t,i,s,a]},M.aL=di,M.aM=vn,M.aN=function(r,t,i,s,a=!1){if(!i[0]&&!i[1])return[0,0];const l=a?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const h=Math.sin(l),f=Math.cos(l);i=[i[0]*f-i[1]*h,i[0]*h+i[1]*f]}return[a?i[0]:vn(t,i[0],r.zoom),a?i[1]:vn(t,i[1],r.zoom)]},M.aP=Xh,M.aQ=gd,M.aR=Hh,M.aS=_d,M.aT=qe,M.aU=Du,M.aV=H,M.aW=Jt,M.aX=Et,M.aY=Gi,M.aZ=Xp,M.a_=rr,M.aa=ac,M.ab=ja,M.ac=25,M.ad=ed,M.ae=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((i=>{t.onloadstart=()=>{i(t)};for(const s of r){const a=window.document.createElement("source");F(s)||(t.crossOrigin="Anonymous"),a.src=s,t.appendChild(a)}}))},M.af=It,M.ag=function(){return tn++},M.ah=m,M.ai=Bo,M.aj=ma,M.ak=un,M.al=tf,M.am=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,a,l)=>{const h=a||l;return t[s]=!h||h.toLowerCase(),""})),t["max-age"]){const i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t},M.an=oi,M.ao=85.051129,M.ap=Wn,M.aq=function(r){return Math.pow(2,r)},M.ar=Lr,M.as=Wp,M.at=function(r){return Math.log(r)/Math.LN2},M.au=function(r){var t=r[0],i=r[1];return t*t+i*i},M.av=class{constructor(r,t){this.max=r,this.onRemove=t,this.reset()}reset(){for(const r in this.data)for(const t of this.data[r])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(r,t,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const a={value:t,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout((()=>{this.remove(r,a)}),i)),this.data[s].push(a),this.order.push(s),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}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 t=this.data[r].shift();return t.timeout&&clearTimeout(t.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),t.value}getByKey(r){const t=this.data[r];return t?t[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,t){if(!this.has(r))return this;const i=r.wrapped().key,s=t===void 0?0:this.data[i].indexOf(t),a=this.data[i][s];return this.data[i].splice(s,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(r){const t=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||t.push(s);for(const i of t)this.remove(i.value.tileID,i)}},M.aw=function(r){if(!r.length)return new Set;const t=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,s=-1/0,a=1/0,l=-1/0;const h=[];for(const g of r){const{x:y,y:v,z:w}=g.canonical,S=Math.pow(2,t-w),E=y*S,C=v*S;h.push({id:g,x:E,y:C}),E<i&&(i=E),E>s&&(s=E),C<a&&(a=C),C>l&&(l=C)}const f=new Set;for(const g of h)g.x!==i&&g.x!==s&&g.y!==a&&g.y!==l||f.add(g.id);return f},M.ax=function(r,t){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:a,minZoom:l,maxZoom:h}=r,f=a?oi(xi.interpolationFactor(a,t,l,h),0,1):0;r.kind==="camera"?s=Tr.number(r.minSize,r.maxSize,f):i=f}return{uSizeT:i,uSize:s}},M.az=function(r,{uSize:t,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/ms:r.kind==="composite"?Tr.number(s/ms,a/ms,i):t},M.b=jr,M.b$=class extends ur{constructor(r,t){super(r,t),this.current=ds}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 t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},M.b0=function(r){var t=new de(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},M.b1=function(r,t,i){return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],r},M.b2=function(r,t){var i=t[0],s=t[1],a=t[2],l=i*i+s*s+a*a;return l>0&&(l=1/Math.sqrt(l)),r[0]=t[0]*l,r[1]=t[1]*l,r[2]=t[2]*l,r},M.b3=Qe,M.b4=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},M.b5=function(r,t,i){return r[0]=t[0]*i[0],r[1]=t[1]*i[1],r[2]=t[2]*i[2],r[3]=t[3]*i[3],r},M.b6=_i,M.b7=function(r,t,i){const s=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},M.b8=Qr,M.b9=function(r,t,i){return r[0]=t[0]*i,r[1]=t[1]*i,r[2]=t[2]*i,r[3]=t[3]*i,r},M.bA=nr,M.bB=function(r,t,i){var s=i[0],a=i[1],l=i[2],h=i[3],f=t[0],g=t[1],y=t[2],v=a*y-l*g,w=l*f-s*y,S=s*g-a*f;return r[0]=f+h*(v+=v)+a*(S+=S)-l*(w+=w),r[1]=g+h*w+l*v-s*S,r[2]=y+h*S+s*w-a*v,r},M.bC=function(r,t,i){const s=(a=[r[0],r[1],r[2],t[0],t[1],t[2],i[0],i[1],i[2]])[0]*((v=a[8])*(h=a[4])-(f=a[5])*(y=a[7]))+a[1]*(-v*(l=a[3])+f*(g=a[6]))+a[2]*(y*l-h*g);var a,l,h,f,g,y,v;if(s===0)return null;const w=Qe([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),S=Qe([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),E=Qe([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),C=rr([],w,-r[3]);return zi(C,C,rr([],S,-t[3])),zi(C,C,rr([],E,-i[3])),rr(C,C,1/s),C},M.bD=td,M.bE=function(){return new Float64Array(4)},M.bF=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[0]*Math.cos(s)-a[1]*Math.sin(s),l[1]=a[0]*Math.sin(s)+a[1]*Math.cos(s),l[2]=a[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},M.bG=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[0],l[1]=a[1]*Math.cos(s)-a[2]*Math.sin(s),l[2]=a[1]*Math.sin(s)+a[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},M.bH=function(r,t,i,s){var a=[],l=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],l[0]=a[2]*Math.sin(s)+a[0]*Math.cos(s),l[1]=a[1],l[2]=a[2]*Math.cos(s)-a[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},M.bI=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[0],h=t[1],f=t[2],g=t[3],y=t[8],v=t[9],w=t[10],S=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=l*a-y*s,r[1]=h*a-v*s,r[2]=f*a-w*s,r[3]=g*a-S*s,r[8]=l*s+y*a,r[9]=h*s+v*a,r[10]=f*s+w*a,r[11]=g*s+S*a,r},M.bJ=function(r,t){const i=sr(r,360),s=sr(t,360),a=s-i,l=s>i?a-360:a+360;return Math.abs(a)<Math.abs(l)?a:l},M.bK=function(r){return r[0]=0,r[1]=0,r[2]=0,r},M.bL=function(r,t,i,s){const a=Math.sqrt(r*r+t*t),l=Math.sqrt(i*i+s*s);r/=a,t/=a,i/=l,s/=l;const h=Math.acos(r*i+t*s);return-t*i+r*s>0?h:-h},M.bM=function(r,t){const i=sr(r,2*Math.PI),s=sr(t,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.bN=function(){const r={},t=W.$version;for(const i in W.$root){const s=W.$root[i];if(s.required){let a=null;a=i==="version"?t:s.type==="array"?[]:{},a!=null&&(r[i]=a)}}return r},M.bO=Ki,M.bP=Rl,M.bQ=function r(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let s=0;s<t.length;s++)if(!r(t[s],i[s]))return!1;return!0}if(typeof t=="object"&&t!==null&&i!==null){if(typeof i!="object"||Object.keys(t).length!==Object.keys(i).length)return!1;for(const s in t)if(!r(t[s],i[s]))return!1;return!0}return t===i},M.bR=function(r){r=r.slice();const t=Object.create(null);for(let i=0;i<r.length;i++)t[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=yt(r[i],t[r[i].ref]));return r},M.bS=function(r,t){if(r.type==="custom")return new Hg(r,t);switch(r.type){case"background":return new Wg(r,t);case"circle":return new Dm(r,t);case"color-relief":return new Om(r,t);case"fill":return new Qm(r,t);case"fill-extrusion":return new ug(r,t);case"heatmap":return new Rm(r,t);case"hillshade":return new Fm(r,t);case"line":return new _g(r,t);case"raster":return new Ih(r,t);case"symbol":return new Fu(r,t)}},M.bT=r=>r.type==="raster",M.bU=Li,M.bV=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let i=[];try{if(!vt(r.version,t.version))return[{command:"setStyle",args:[t]}];vt(r.center,t.center)||i.push({command:"setCenter",args:[t.center]}),vt(r.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),vt(r.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),vt(r.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),vt(r.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),vt(r.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),vt(r.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),vt(r.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),vt(r.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),vt(r.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),vt(r.light,t.light)||i.push({command:"setLight",args:[t.light]}),vt(r.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),vt(r.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),vt(r.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const s={},a=[];(function(h,f,g,y){let v;for(v in f=f||{},h=h||{})Object.prototype.hasOwnProperty.call(h,v)&&(Object.prototype.hasOwnProperty.call(f,v)||Zt(v,g,y));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(h,v)?vt(h[v],f[v])||(h[v].type==="geojson"&&f[v].type==="geojson"&&Ve(h,f,v)?bt(g,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):te(v,f,g,y)):Ft(v,f,g))})(r.sources,t.sources,a,s);const l=[];r.layers&&r.layers.forEach((h=>{"source"in h&&s[h.source]?i.push({command:"removeLayer",args:[h.id]}):l.push(h)})),i=i.concat(a),(function(h,f,g){f=f||[];const y=(h=h||[]).map(fe),v=f.map(fe),w=h.reduce(be,{}),S=f.reduce(be,{}),E=y.slice(),C=Object.create(null);let D,R,V,X,G;for(let q=0,st=0;q<y.length;q++)D=y[q],Object.prototype.hasOwnProperty.call(S,D)?st++:(bt(g,{command:"removeLayer",args:[D]}),E.splice(E.indexOf(D,st),1));for(let q=0,st=0;q<v.length;q++)D=v[v.length-1-q],E[E.length-1-q]!==D&&(Object.prototype.hasOwnProperty.call(w,D)?(bt(g,{command:"removeLayer",args:[D]}),E.splice(E.lastIndexOf(D,E.length-st),1)):st++,X=E[E.length-q],bt(g,{command:"addLayer",args:[S[D],X]}),E.splice(E.length-q,0,D),C[D]=!0);for(let q=0;q<v.length;q++)if(D=v[q],R=w[D],V=S[D],!C[D]&&!vt(R,V))if(vt(R.source,V.source)&&vt(R["source-layer"],V["source-layer"])&&vt(R.type,V.type)){for(G in ne(R.layout,V.layout,g,D,null,"setLayoutProperty"),ne(R.paint,V.paint,g,D,null,"setPaintProperty"),vt(R.filter,V.filter)||bt(g,{command:"setFilter",args:[D,V.filter]}),vt(R.minzoom,V.minzoom)&&vt(R.maxzoom,V.maxzoom)||bt(g,{command:"setLayerZoomRange",args:[D,V.minzoom,V.maxzoom]}),R)Object.prototype.hasOwnProperty.call(R,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?ne(R[G],V[G],g,D,G.slice(6),"setPaintProperty"):vt(R[G],V[G])||bt(g,{command:"setLayerProperty",args:[D,G,V[G]]}));for(G in V)Object.prototype.hasOwnProperty.call(V,G)&&!Object.prototype.hasOwnProperty.call(R,G)&&G!=="layout"&&G!=="paint"&&G!=="filter"&&G!=="metadata"&&G!=="minzoom"&&G!=="maxzoom"&&(G.indexOf("paint.")===0?ne(R[G],V[G],g,D,G.slice(6),"setPaintProperty"):vt(R[G],V[G])||bt(g,{command:"setLayerProperty",args:[D,G,V[G]]}))}else bt(g,{command:"removeLayer",args:[D]}),X=E[E.lastIndexOf(D)+1],bt(g,{command:"addLayer",args:[V,X]})})(l,t.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[t]}]}return i},M.bW=function(r){const t=[],i=r.id;return i===void 0&&t.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},M.bX=Fr,M.bY=Br,M.bZ=class extends ur{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},M.b_=cn,M.ba=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},M.bb=Kp,M.bc=Oo,M.bd=function(r,t,i,s,a){var l=1/Math.tan(t/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var h=1/(s-a);r[10]=(a+s)*h,r[14]=2*a*s*h}else r[10]=-1,r[14]=-2*s;return r},M.be=function(r){var t=new de(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},M.bf=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[0],h=t[1],f=t[2],g=t[3],y=t[4],v=t[5],w=t[6],S=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=l*a+y*s,r[1]=h*a+v*s,r[2]=f*a+w*s,r[3]=g*a+S*s,r[4]=y*a-l*s,r[5]=v*a-h*s,r[6]=w*a-f*s,r[7]=S*a-g*s,r},M.bg=function(r,t,i){var s=Math.sin(i),a=Math.cos(i),l=t[4],h=t[5],f=t[6],g=t[7],y=t[8],v=t[9],w=t[10],S=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=l*a+y*s,r[5]=h*a+v*s,r[6]=f*a+w*s,r[7]=g*a+S*s,r[8]=y*a-l*s,r[9]=v*a-h*s,r[10]=w*a-f*s,r[11]=S*a-g*s,r},M.bh=function(){const r=new Float32Array(16);return Lr(r),r},M.bi=function(){const r=new Float64Array(16);return Lr(r),r},M.bj=function(){return new Float64Array(16)},M.bk=function(r,t,i){const s=new Float64Array(4);return nr(s,r,t-90,i),s},M.bl=function(r,t,i,s){var a,l,h,f,g,y=t[0],v=t[1],w=t[2],S=t[3],E=i[0],C=i[1],D=i[2],R=i[3];return(l=y*E+v*C+w*D+S*R)<0&&(l=-l,E=-E,C=-C,D=-D,R=-R),1-l>ve?(a=Math.acos(l),h=Math.sin(a),f=Math.sin((1-s)*a)/h,g=Math.sin(s*a)/h):(f=1-s,g=s),r[0]=f*y+g*E,r[1]=f*v+g*C,r[2]=f*w+g*D,r[3]=f*S+g*R,r},M.bm=function(r){const t=new Float64Array(9);var i,s,a,l,h,f,g,y,v,w,S,E,C,D,R,V,X,G;w=(a=(s=r)[0])*(g=a+a),S=(l=s[1])*g,C=(h=s[2])*g,D=h*(y=l+l),V=(f=s[3])*g,X=f*y,G=f*(v=h+h),(i=t)[0]=1-(E=l*y)-(R=h*v),i[3]=S-G,i[6]=C+X,i[1]=S+G,i[4]=1-w-R,i[7]=D-V,i[2]=C-X,i[5]=D+V,i[8]=1-w-E;const q=Gi(-Math.asin(oi(t[2],-1,1)));let st,ot;return Math.hypot(t[5],t[8])<.001?(st=0,ot=-Gi(Math.atan2(t[3],t[4]))):(st=Gi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),ot=Gi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:st,pitch:q+90,bearing:ot}},M.bn=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},M.bo=se,M.bp=ln,M.bq=zo,M.br=ec,M.bs=Do,M.bt=gr,M.bu=_r,M.bv=Pi,M.bw=function(r,t,i,s,a){return gr(s,a,oi((r-t)/(i-t),0,1))},M.bx=sr,M.by=function(){return new Float64Array(3)},M.bz=function(r,t,i,s){return r[0]=t[0]+i[0]*s,r[1]=t[1]+i[1]*s,r[2]=t[2]+i[2]*s,r},M.c=bs,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.c0=Qi,M.c1=class extends ur{constructor(r,t){super(r,t),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.c2=class extends ur{constructor(r,t){super(r,t),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.c3=Rr,M.c4=function(r,t){var i=Math.sin(t),s=Math.cos(t);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.c5=function(r,t,i){var s=t[0],a=t[1],l=t[2];return r[0]=s*i[0]+a*i[3]+l*i[6],r[1]=s*i[1]+a*i[4]+l*i[7],r[2]=s*i[2]+a*i[5]+l*i[8],r},M.c6=function(r,t,i,s,a,l,h){var f=1/(t-i),g=1/(s-a),y=1/(l-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]=(t+i)*f,r[13]=(a+s)*g,r[14]=(h+l)*y,r[15]=1,r},M.c7=class extends ur{constructor(r,t){super(r,t),this.current=new Array}set(r){if(r!=this.current){this.current=r;const t=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)t[4*i]=r[i].r,t[4*i+1]=r[i].g,t[4*i+2]=r[i].b,t[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,t)}}},M.c8=class extends ur{constructor(r,t){super(r,t),this.current=new Array}set(r){if(r!=this.current){this.current=r;const t=new Float32Array(r);this.gl.uniform1fv(this.location,t)}}},M.c9=class extends So{},M.cA=function(r){return Qs[r]||ta[r]},M.cB=function(r,t,i){var s=t[0],a=t[1];return r[0]=i[0]*s+i[4]*a+i[12],r[1]=i[1]*s+i[5]*a+i[13],r},M.cC=function(r,t){const{x:i,y:s}=ac.fromLngLat(t);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},M.cD=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},M.cE=class extends ka{},M.cF=I_,M.cH=function(r){return r.message===Hn},M.cI=vr,M.cJ=function(r,t){Sn.REGISTERED_PROTOCOLS[r]=t},M.cK=function(r){delete Sn.REGISTERED_PROTOCOLS[r]},M.cL=function(r,t){const i={};for(let a=0;a<r.length;a++){const l=t&&t[r[a].id]||ru(r[a]);t&&(t[r[a].id]=l);let h=i[l];h||(h=i[l]=[]),h.push(r[a])}const s=[];for(const a in i)s.push(i[a]);return s},M.cM=Lt,M.cN=Qp,M.cO=wf,M.cP=Rp,M.cQ=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=le/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],i=t.layout,s=t._unevaluatedLayout._values,a={layoutIconSize:s["icon-size"].possiblyEvaluate(new ge(r.bucket.zoom+1),r.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new ge(r.bucket.zoom+1),r.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new ge(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:y,maxZoom:v}=r.bucket.textSizeData;a.compositeTextSizes=[s["text-size"].possiblyEvaluate(new ge(y),r.canonical),s["text-size"].possiblyEvaluate(new ge(v),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:y,maxZoom:v}=r.bucket.iconSizeData;a.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new ge(y),r.canonical),s["icon-size"].possiblyEvaluate(new ge(v),r.canonical)]}const l=i.get("text-line-height")*di,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 v=i.get("text-font").evaluate(y,{},r.canonical).join(","),w=g.evaluate(y,{},r.canonical),S=a.layoutTextSize.evaluate(y,{},r.canonical),E=a.layoutIconSize.evaluate(y,{},r.canonical),C={horizontal:{},vertical:void 0},D=y.text;let R,V=[0,0];if(D){const q=D.toString(),st=i.get("text-letter-spacing").evaluate(y,{},r.canonical)*di,ot=wo(q)?st:0,mt=i.get("text-anchor").evaluate(y,{},r.canonical),Pt=Lf(t,y,r.canonical);if(!Pt){const At=i.get("text-radial-offset").evaluate(y,{},r.canonical);V=At?Rf(mt,[At*di,md]):i.get("text-offset").evaluate(y,{},r.canonical).map((kt=>kt*di))}let wt=h?"center":i.get("text-justify").evaluate(y,{},r.canonical);const Mt=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(y,{},r.canonical)*di:1/0,zt=()=>{r.bucket.allowVerticalPlacement&&Sa(q)&&(C.vertical=Ru(D,r.glyphMap,r.glyphPositions,r.imagePositions,v,Mt,l,mt,"left",ot,V,M.ay.vertical,!0,S,w))};if(!h&&Pt){const At=new Set;if(wt==="auto")for(let Tt=0;Tt<Pt.values.length;Tt+=2)At.add(gd(Pt.values[Tt]));else At.add(wt);let kt=!1;for(const Tt of At)if(!C.horizontal[Tt])if(kt)C.horizontal[Tt]=C.horizontal[0];else{const Ut=Ru(D,r.glyphMap,r.glyphPositions,r.imagePositions,v,Mt,l,"center",Tt,ot,V,M.ay.horizontal,!1,S,w);Ut&&(C.horizontal[Tt]=Ut,kt=Ut.positionedLines.length===1)}zt()}else{wt==="auto"&&(wt=gd(mt));const At=Ru(D,r.glyphMap,r.glyphPositions,r.imagePositions,v,Mt,l,mt,wt,ot,V,M.ay.horizontal,!1,S,w);At&&(C.horizontal[wt]=At),zt(),Sa(q)&&h&&f&&(C.vertical=Ru(D,r.glyphMap,r.glyphPositions,r.imagePositions,v,Mt,l,mt,wt,ot,V,M.ay.vertical,!1,S,w))}}let X=!1;if(y.icon&&y.icon.name){const q=r.imageMap[y.icon.name];q&&(R=Gg(r.imagePositions[y.icon.name],i.get("icon-offset").evaluate(y,{},r.canonical),i.get("icon-anchor").evaluate(y,{},r.canonical)),X=!!q.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=X:r.bucket.sdfIcons!==X&&Re("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(q.pixelRatio!==r.bucket.pixelRatio||i.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const G=Bf(C.horizontal)||C.vertical;r.bucket.iconsInText=!!G&&G.iconsInText,(G||R)&&P_(r.bucket,y,C,R,r.imageMap,a,S,E,V,X,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},M.cR=Vh,M.cS=Gh,M.cT=$h,M.cU=mp,M.cV=qh,M.cW=Ro,M.cX=function(r,t,i,s,a,l){let h=Pf(r,t,i,a,0);return h=Pf(h,t,s,l,1),h},M.cY=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const t=this.map.get(r);return t!==void 0&&(this.map.delete(r),this.map.set(r,t)),t}set(r,t){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,t)}clear(){this.map.clear()}},M.cZ=gp,M.c_=bf,M.ca=bg,M.cb=class extends Po{},M.cc=Fh,M.cd=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},M.ce=ep,M.cf=function(r,t,i){var s=t[0],a=t[1],l=t[2],h=i[3]*s+i[7]*a+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*l+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*a+i[9]*l+i[13])/h,r[2]=(i[2]*s+i[6]*a+i[10]*l+i[14])/h,r},M.cg=class extends Ul{},M.ch=class extends o{},M.ci=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},M.cj=function(r,t){var i=r[0],s=r[1],a=r[2],l=r[3],h=r[4],f=r[5],g=r[6],y=r[7],v=r[8],w=r[9],S=r[10],E=r[11],C=r[12],D=r[13],R=r[14],V=r[15],X=t[0],G=t[1],q=t[2],st=t[3],ot=t[4],mt=t[5],Pt=t[6],wt=t[7],Mt=t[8],zt=t[9],At=t[10],kt=t[11],Tt=t[12],Ut=t[13],Gt=t[14],Ht=t[15];return Math.abs(i-X)<=ve*Math.max(1,Math.abs(i),Math.abs(X))&&Math.abs(s-G)<=ve*Math.max(1,Math.abs(s),Math.abs(G))&&Math.abs(a-q)<=ve*Math.max(1,Math.abs(a),Math.abs(q))&&Math.abs(l-st)<=ve*Math.max(1,Math.abs(l),Math.abs(st))&&Math.abs(h-ot)<=ve*Math.max(1,Math.abs(h),Math.abs(ot))&&Math.abs(f-mt)<=ve*Math.max(1,Math.abs(f),Math.abs(mt))&&Math.abs(g-Pt)<=ve*Math.max(1,Math.abs(g),Math.abs(Pt))&&Math.abs(y-wt)<=ve*Math.max(1,Math.abs(y),Math.abs(wt))&&Math.abs(v-Mt)<=ve*Math.max(1,Math.abs(v),Math.abs(Mt))&&Math.abs(w-zt)<=ve*Math.max(1,Math.abs(w),Math.abs(zt))&&Math.abs(S-At)<=ve*Math.max(1,Math.abs(S),Math.abs(At))&&Math.abs(E-kt)<=ve*Math.max(1,Math.abs(E),Math.abs(kt))&&Math.abs(C-Tt)<=ve*Math.max(1,Math.abs(C),Math.abs(Tt))&&Math.abs(D-Ut)<=ve*Math.max(1,Math.abs(D),Math.abs(Ut))&&Math.abs(R-Gt)<=ve*Math.max(1,Math.abs(R),Math.abs(Gt))&&Math.abs(V-Ht)<=ve*Math.max(1,Math.abs(V),Math.abs(Ht))},M.ck=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},M.cl=r=>r.type==="symbol",M.cm=r=>r.type==="circle",M.cn=r=>r.type==="heatmap",M.co=r=>r.type==="line",M.cp=r=>r.type==="fill",M.cq=r=>r.type==="fill-extrusion",M.cr=r=>r.type==="hillshade",M.cs=r=>r.type==="color-relief",M.ct=r=>r.type==="background",M.cu=r=>r.type==="custom",M.cv=yr,M.cw=function(r,t,i){const s=qn(t.x-i.x,t.y-i.y),a=qn(r.x-i.x,r.y-i.y);var l,h;return Gi(Math.atan2(s[0]*a[1]-s[1]*a[0],(l=s)[0]*(h=a)[0]+l[1]*h[1]))},M.cx=Ui,M.cy=function(r,t){return ta[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},M.cz=function(r,t){return Qs[t]&&"touches"in r},M.d=F,M.d0=function(r,t,i,s,a){return c(this,void 0,void 0,(function*(){if(fr())try{return yield vs(r,t,i,s,a)}catch{}return(function(l,h,f,g,y){const v=l.width,w=l.height;wn&&Vr||(wn=new OffscreenCanvas(v,w),Vr=wn.getContext("2d",{willReadFrequently:!0})),wn.width=v,wn.height=w,Vr.drawImage(l,0,0,v,w);const S=Vr.getImageData(h,f,g,y);return Vr.clearRect(0,0,v,w),S.data})(r,t,i,s,a)}))},M.d1=np,M.d2=Rt,M.d3=ho,M.d4=Dn,M.e=li,M.f=r=>c(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}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=ws,M.h=r=>new Promise(((t,i)=>{const s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=Nr}))},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 a=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(a):Nr})),M.i=Or,M.j=(r,t)=>at(li(r,{type:"json"}),t),M.k=tt,M.l=J,M.m=at,M.n=(r,t)=>at(li(r,{type:"arrayBuffer"}),t),M.o=function(r){return new qh(r).readFields(Lg,[])},M.p=zp,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=Yl,M.s=Tn,M.t=Mi,M.u=W,M.v=va,M.w=Re,M.x=yu,M.y=bh,M.z=Pa})),et("worker",["./shared"],(function(M){class c{constructor(F,B){this.keyCache={},F&&this.replace(F,B)}replace(F,B){this._layerConfigs={},this._layers={},this.update(F,[],B)}update(F,B,U){for(const tt of F){this._layerConfigs[tt.id]=tt;const ut=this._layers[tt.id]=M.bS(tt,U);ut._featureFilter=M.aj(ut.filter,U),this.keyCache[tt.id]&&delete this.keyCache[tt.id]}for(const tt of B)delete this.keyCache[tt],delete this._layerConfigs[tt],delete this._layers[tt];this.familiesBySource={};const J=M.cL(Object.values(this._layerConfigs),this.keyCache);for(const tt of J){const ut=tt.map((Ft=>this._layers[Ft.id])),W=ut[0];if(W.visibility==="none")continue;const ct=W.source||"";let yt=this.familiesBySource[ct];yt||(yt=this.familiesBySource[ct]={});const vt=W.sourceLayer||M.a9;let bt=yt[vt];bt||(bt=yt[vt]=[]),bt.push(ut)}}}class dt{constructor(F){const B={},U=[];for(const W in F){const ct=F[W],yt=B[W]={};for(const vt in ct){const bt=ct[+vt];if(!bt||bt.bitmap.width===0||bt.bitmap.height===0)continue;const Ft={x:0,y:0,w:bt.bitmap.width+2,h:bt.bitmap.height+2};U.push(Ft),yt[vt]={rect:Ft,metrics:bt.metrics}}}const{w:J,h:tt}=M.p(U),ut=new M.r({width:J||1,height:tt||1});for(const W in F){const ct=F[W];for(const yt in ct){const vt=ct[+yt];if(!vt||vt.bitmap.width===0||vt.bitmap.height===0)continue;const bt=B[W][yt].rect;M.r.copy(vt.bitmap,ut,{x:0,y:0},{x:bt.x+1,y:bt.y+1},vt.bitmap)}}this.image=ut,this.positions=B}}M.cM("GlyphAtlas",dt);class Rt{constructor(F){this.tileID=new M.a1(F.tileID.overscaledZ,F.tileID.wrap,F.tileID.canonical.z,F.tileID.canonical.x,F.tileID.canonical.y),this.uid=F.uid,this.zoom=F.zoom,this.pixelRatio=F.pixelRatio,this.tileSize=F.tileSize,this.source=F.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=F.showCollisionBoxes,this.collectResourceTiming=!!F.collectResourceTiming,this.returnDependencies=!!F.returnDependencies,this.promoteId=F.promoteId,this.inFlightDependencies=[]}parse(F,B,U,J,tt){return M._(this,void 0,void 0,(function*(){this.status="parsing",this.data=F,this.collisionBoxArray=new M.ah;const ut=new M.cN(Object.keys(F.layers).sort()),W=new M.cO(this.tileID,this.promoteId);W.bucketLayerIDs=[];const ct={},yt={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:U,subdivisionGranularity:tt},vt=B.familiesBySource[this.source];for(const Nt in vt){const Xt=F.layers[Nt];if(!Xt)continue;Xt.version===1&&M.w(`Vector tile source "${this.source}" layer "${Nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $i=ut.encode(Nt),Yn=[];for(let hi=0;hi<Xt.length;hi++){const Kt=Xt.feature(hi),en=W.getId(Kt,Nt);Yn.push({feature:Kt,id:en,index:hi,sourceLayerIndex:$i})}for(const hi of vt[Nt]){const Kt=hi[0];Kt.source!==this.source&&M.w(`layer.source = ${Kt.source} does not equal this.source = ${this.source}`),Kt.isHidden(this.zoom,!0)||($t(hi,this.zoom,U),(ct[Kt.id]=Kt.createBucket({index:W.bucketLayerIDs.length,layers:hi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$i,sourceID:this.source})).populate(Yn,yt,this.tileID.canonical),W.bucketLayerIDs.push(hi.map((en=>en.id))))}}const bt=M.bX(yt.glyphDependencies,(Nt=>Object.keys(Nt).map(Number)));this.inFlightDependencies.forEach((Nt=>Nt?.abort())),this.inFlightDependencies=[];let Ft=Promise.resolve({});if(Object.keys(bt).length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),Ft=J.sendAsync({type:"GG",data:{stacks:bt,source:this.source,tileID:this.tileID,type:"glyphs"}},Nt)}const Zt=Object.keys(yt.iconDependencies);let te=Promise.resolve({});if(Zt.length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),te=J.sendAsync({type:"GI",data:{icons:Zt,source:this.source,tileID:this.tileID,type:"icons"}},Nt)}const Ve=Object.keys(yt.patternDependencies);let ne=Promise.resolve({});if(Ve.length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),ne=J.sendAsync({type:"GI",data:{icons:Ve,source:this.source,tileID:this.tileID,type:"patterns"}},Nt)}const fe=yt.dashDependencies;let be=Promise.resolve({});if(Object.keys(fe).length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),be=J.sendAsync({type:"GDA",data:{dashes:fe}},Nt)}const[It,Ee,we,ti]=yield Promise.all([Ft,te,ne,be]),Te=new dt(It),Ct=new M.cP(Ee,we);for(const Nt in ct){const Xt=ct[Nt];Xt instanceof M.ai?($t(Xt.layers,this.zoom,U),M.cQ({bucket:Xt,glyphMap:It,glyphPositions:Te.positions,imageMap:Ee,imagePositions:Ct.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:yt.subdivisionGranularity})):Xt.hasDependencies&&(Xt instanceof M.cR||Xt instanceof M.cS||Xt instanceof M.cT)&&($t(Xt.layers,this.zoom,U),Xt.addFeatures(yt,this.tileID.canonical,Ct.patternPositions,ti))}return this.status="done",{buckets:Object.values(ct).filter((Nt=>!Nt.isEmpty())),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Te.image,imageAtlas:Ct,dashPositions:ti,glyphMap:this.returnDependencies?It:null,iconMap:this.returnDependencies?Ee:null,glyphPositions:this.returnDependencies?Te.positions:null}}))}}function $t(at,F,B){const U=new M.H(F);for(const J of at)J.recalculate(U,B)}class Bt extends M.cW{constructor(F,B){super(new M.cV,0,B,[],[]),this.feature=F,this.type=F.type,this.properties=F.tags?F.tags:{},"id"in F&&(typeof F.id=="string"?this.id=parseInt(F.id,10):typeof F.id!="number"||isNaN(F.id)||(this.id=F.id))}loadGeometry(){const F=[],B=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const U of B){const J=[];for(const tt of U)J.push(new M.P(tt[0],tt[1]));F.push(J)}return F}}class Yt extends M.cU{constructor(F,B){super(new M.cV),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=B?B.version:1,this.extent=B?B.extent:4096,this.length=F.length,this.features=F}feature(F){return new Bt(this.features[F],this.extent)}}function ce(at,F){F.writeVarintField(15,at.version||1),F.writeStringField(1,at.name||""),F.writeVarintField(5,at.extent||4096);const B={keys:[],values:[],keycache:{},valuecache:{}};for(let tt=0;tt<at.length;tt++)B.feature=at.feature(tt),F.writeMessage(2,Xe,B);const U=B.keys;for(const tt of U)F.writeStringField(3,tt);const J=B.values;for(const tt of J)F.writeMessage(4,de,tt)}function Xe(at,F){if(!at.feature)return;const B=at.feature;B.id!==void 0&&F.writeVarintField(1,B.id),F.writeMessage(2,qt,at),F.writeVarintField(3,B.type),F.writeMessage(4,ve,B)}function qt(at,F){for(const B in at.feature?.properties){let U=at.feature.properties[B],J=at.keycache[B];if(U===null)continue;J===void 0&&(at.keys.push(B),J=at.keys.length-1,at.keycache[B]=J),F.writeVarint(J),typeof U!="string"&&typeof U!="boolean"&&typeof U!="number"&&(U=JSON.stringify(U));const tt=typeof U+":"+U;let ut=at.valuecache[tt];ut===void 0&&(at.values.push(U),ut=at.values.length-1,at.valuecache[tt]=ut),F.writeVarint(ut)}}function xt(at,F){return(F<<3)+(7&at)}function fr(at){return at<<1^at>>31}function ve(at,F){const B=at.loadGeometry(),U=at.type;let J=0,tt=0;for(const ut of B){let W=1;U===1&&(W=ut.length),F.writeVarint(xt(1,W));const ct=U===3?ut.length-1:ut.length;for(let yt=0;yt<ct;yt++){yt===1&&U!==1&&F.writeVarint(xt(2,ct-1));const vt=ut[yt].x-J,bt=ut[yt].y-tt;F.writeVarint(fr(vt)),F.writeVarint(fr(bt)),J+=vt,tt+=bt}at.type===3&&F.writeVarint(xt(7,1))}}function de(at,F){const B=typeof at;B==="string"?F.writeStringField(1,at):B==="boolean"?F.writeBooleanField(7,at):B==="number"&&(at%1!=0?F.writeDoubleField(3,at):at<0?F.writeSVarintField(6,at):F.writeVarintField(5,at))}class Rr extends M.cW{constructor(F,B,U,J,tt){super(new M.cV,0,tt,[],[]),this.type=F,this.properties=U||{},this.extent=tt,this.pointsArray=B,this.id=J}loadGeometry(){return this.pointsArray.map((F=>F.map((B=>new M.P(B.x,B.y)))))}}class Lr extends M.cU{constructor(F,B,U){super(new M.cV),this.version=2,this._myFeatures=F,this.name=B,this.length=F.length,this.extent=U}feature(F){return this._myFeatures[F]}}class Jr{constructor(){this.layers={}}addLayer(F){this.layers[F.name]=F}}function _i(at){let F=(function(B){const U=new M.cV;return(function(J,tt){for(const ut in J.layers)tt.writeMessage(3,ce,J.layers[ut])})(B,U),U.finish()})(at);return F.byteOffset===0&&F.byteLength===F.buffer.byteLength||(F=new Uint8Array(F)),{vectorTile:at,rawData:F.buffer}}function $n(at,F,B){const{extent:U}=at,J=Math.pow(2,B.z-F.z),tt=(B.x-F.x*J)*U,ut=(B.y-F.y*J)*U,W=[];for(let ct=0;ct<at.length;ct++){const yt=at.feature(ct);let vt=yt.loadGeometry();for(const Ft of vt)for(const Zt of Ft)Zt.x=Zt.x*J-tt,Zt.y=Zt.y*J-ut;const bt=128;vt=M.cX(vt,yt.type,-bt,-bt,U+bt,U+bt),vt.length!==0&&W.push(new Rr(yt.type,vt,yt.properties,yt.id,U))}return new Lr(W,at.name,U)}class zi{constructor(F,B,U){this.actor=F,this.layerIndex=B,this.availableImages=U,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new M.cY(1e3)}loadVectorTile(F,B){return M._(this,void 0,void 0,(function*(){const U=yield M.n(F.request,B);try{return{vectorTile:F.encoding!=="mlt"?new M.cZ(new M.cV(U.data)):new M.c_(U.data),rawData:U.data,cacheControl:U.cacheControl,expires:U.expires}}catch(J){const tt=new Uint8Array(U.data);let ut=`Unable to parse the tile at ${F.request.url}, `;throw ut+=tt[0]===31&&tt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(ut)}}))}loadTile(F){return M._(this,void 0,void 0,(function*(){const{uid:B,overzoomParameters:U}=F;U&&(F.request=U.overzoomRequest);const J=!!(F&&F.request&&F.request.collectResourceTiming)&&new M.c$(F.request),tt=new Rt(F);this.loading[B]=tt;const ut=new AbortController;tt.abort=ut;try{const W=yield this.loadVectorTile(F,ut);if(delete this.loading[B],!W)return null;if(U){const Ft=this._getOverzoomTile(F,W.vectorTile);W.rawData=Ft.rawData,W.vectorTile=Ft.vectorTile}const ct=W.rawData,yt={};W.expires&&(yt.expires=W.expires),W.cacheControl&&(yt.cacheControl=W.cacheControl);const vt={};if(J){const Ft=J.finish();Ft&&(vt.resourceTiming=JSON.parse(JSON.stringify(Ft)))}tt.vectorTile=W.vectorTile;const bt=tt.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,F.subdivisionGranularity);this.loaded[B]=tt,this.fetching[B]={rawTileData:ct,cacheControl:yt,resourceTiming:vt};try{const Ft=yield bt;return M.e({rawTileData:ct.slice(0),encoding:F.encoding},Ft,yt,vt)}finally{delete this.fetching[B]}}catch(W){throw delete this.loading[B],tt.status="done",this.loaded[B]=tt,W}}))}_getOverzoomTile(F,B){const{tileID:U,source:J,overzoomParameters:tt}=F,{maxZoomTileID:ut}=tt,W=`${ut.key}_${U.key}`,ct=this.overzoomedTileResultCache.get(W);if(ct)return ct;const yt=new Jr,vt=this.layerIndex.familiesBySource[J];for(const Ft in vt){const Zt=B.layers[Ft];if(!Zt)continue;const te=$n(Zt,ut,U.canonical);te.length>0&&yt.addLayer(te)}const bt=_i(yt);return this.overzoomedTileResultCache.set(W,bt),bt}reloadTile(F){return M._(this,void 0,void 0,(function*(){const B=F.uid;if(!this.loaded||!this.loaded[B])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const U=this.loaded[B];if(U.showCollisionBoxes=F.showCollisionBoxes,U.status==="parsing"){const J=yield U.parse(U.vectorTile,this.layerIndex,this.availableImages,this.actor,F.subdivisionGranularity);let tt;if(this.fetching[B]){const{rawTileData:ut,cacheControl:W,resourceTiming:ct}=this.fetching[B];delete this.fetching[B],tt=M.e({rawTileData:ut.slice(0),encoding:F.encoding},J,W,ct)}else tt=J;return tt}if(U.status==="done"&&U.vectorTile)return U.parse(U.vectorTile,this.layerIndex,this.availableImages,this.actor,F.subdivisionGranularity)}))}abortTile(F){return M._(this,void 0,void 0,(function*(){const B=this.loading,U=F.uid;B&&B[U]&&B[U].abort&&(B[U].abort.abort(),delete B[U])}))}removeTile(F){return M._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[F.uid]&&delete this.loaded[F.uid]}))}}class rr{constructor(){this.loaded={}}loadTile(F){return M._(this,void 0,void 0,(function*(){const{uid:B,encoding:U,rawImageData:J,redFactor:tt,greenFactor:ut,blueFactor:W,baseShift:ct}=F,yt=J.width+2,vt=J.height+2,bt=M.b(J)?new M.R({width:yt,height:vt},yield M.d0(J,-1,-1,yt,vt)):J,Ft=new M.d1(B,bt,U,tt,ut,W,ct);return this.loaded=this.loaded||{},this.loaded[B]=Ft,Ft}))}removeTile(F){const B=this.loaded,U=F.uid;B&&B[U]&&delete B[U]}}var Qe,mr,Qr=(function(){if(mr)return Qe;function at(B,U){if(B.length!==0){F(B[0],U);for(var J=1;J<B.length;J++)F(B[J],!U)}}function F(B,U){for(var J=0,tt=0,ut=0,W=B.length,ct=W-1;ut<W;ct=ut++){var yt=(B[ut][0]-B[ct][0])*(B[ct][1]+B[ut][1]),vt=J+yt;tt+=Math.abs(J)>=Math.abs(yt)?J-vt+yt:yt-vt+J,J=vt}J+tt>=0!=!!U&&B.reverse()}return mr=1,Qe=function B(U,J){var tt,ut=U&&U.type;if(ut==="FeatureCollection")for(tt=0;tt<U.features.length;tt++)B(U.features[tt],J);else if(ut==="GeometryCollection")for(tt=0;tt<U.geometries.length;tt++)B(U.geometries[tt],J);else if(ut==="Feature")B(U.geometry,J);else if(ut==="Polygon")at(U.coordinates,J);else if(ut==="MultiPolygon")for(tt=0;tt<U.coordinates.length;tt++)at(U.coordinates[tt],J);return U}})(),Zn=M.d2(Qr);const xn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:at=>at},nr=Math.fround||(wi=new Float32Array(1),at=>(wi[0]=+at,wi[0]));var wi;class qn{constructor(F){this.options=Object.assign(Object.create(xn),F),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(F){const{log:B,minZoom:U,maxZoom:J}=this.options;B&&console.time("total time");const tt=`prepare ${F.length} points`;B&&console.time(tt),this.points=F;const ut=[];for(let ct=0;ct<F.length;ct++){const yt=F[ct];if(!yt.geometry)continue;const[vt,bt]=yt.geometry.coordinates,Ft=nr(sr(vt)),Zt=nr(gr(bt));ut.push(Ft,Zt,1/0,ct,-1,1),this.options.reduce&&ut.push(0)}let W=this.trees[J+1]=this._createTree(ut);B&&console.timeEnd(tt);for(let ct=J;ct>=U;ct--){const yt=+Date.now();W=this.trees[ct]=this._createTree(this._cluster(W,ct)),B&&console.log("z%d: %d clusters in %dms",ct,W.numItems,+Date.now()-yt)}return B&&console.timeEnd("total time"),this}getClusters(F,B){let U=((F[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,F[1]));let tt=F[2]===180?180:((F[2]+180)%360+360)%360-180;const ut=Math.max(-90,Math.min(90,F[3]));if(F[2]-F[0]>=360)U=-180,tt=180;else if(U>tt){const bt=this.getClusters([U,J,180,ut],B),Ft=this.getClusters([-180,J,tt,ut],B);return bt.concat(Ft)}const W=this.trees[this._limitZoom(B)],ct=W.range(sr(U),gr(ut),sr(tt),gr(J)),yt=W.data,vt=[];for(const bt of ct){const Ft=this.stride*bt;vt.push(yt[Ft+5]>1?le(yt,Ft,this.clusterProps):this.points[yt[Ft+3]])}return vt}getChildren(F){const B=this._getOriginId(F),U=this._getOriginZoom(F),J="No cluster with the specified id.",tt=this.trees[U];if(!tt)throw new Error(J);const ut=tt.data;if(B*this.stride>=ut.length)throw new Error(J);const W=this.options.radius/(this.options.extent*Math.pow(2,U-1)),ct=tt.within(ut[B*this.stride],ut[B*this.stride+1],W),yt=[];for(const vt of ct){const bt=vt*this.stride;ut[bt+4]===F&&yt.push(ut[bt+5]>1?le(ut,bt,this.clusterProps):this.points[ut[bt+3]])}if(yt.length===0)throw new Error(J);return yt}getLeaves(F,B,U){const J=[];return this._appendLeaves(J,F,B=B||10,U=U||0,0),J}getTile(F,B,U){const J=this.trees[this._limitZoom(F)],tt=Math.pow(2,F),{extent:ut,radius:W}=this.options,ct=W/ut,yt=(U-ct)/tt,vt=(U+1+ct)/tt,bt={features:[]};return this._addTileFeatures(J.range((B-ct)/tt,yt,(B+1+ct)/tt,vt),J.data,B,U,tt,bt),B===0&&this._addTileFeatures(J.range(1-ct/tt,yt,1,vt),J.data,tt,U,tt,bt),B===tt-1&&this._addTileFeatures(J.range(0,yt,ct/tt,vt),J.data,-1,U,tt,bt),bt.features.length?bt:null}getClusterExpansionZoom(F){let B=this._getOriginZoom(F)-1;for(;B<=this.options.maxZoom;){const U=this.getChildren(F);if(B++,U.length!==1)break;F=U[0].properties.cluster_id}return B}_appendLeaves(F,B,U,J,tt){const ut=this.getChildren(B);for(const W of ut){const ct=W.properties;if(ct&&ct.cluster?tt+ct.point_count<=J?tt+=ct.point_count:tt=this._appendLeaves(F,ct.cluster_id,U,J,tt):tt<J?tt++:F.push(W),F.length===U)break}return tt}_createTree(F){const B=new M.aS(F.length/this.stride|0,this.options.nodeSize,Float32Array);for(let U=0;U<F.length;U+=this.stride)B.add(F[U],F[U+1]);return B.finish(),B.data=F,B}_addTileFeatures(F,B,U,J,tt,ut){for(const W of F){const ct=W*this.stride,yt=B[ct+5]>1;let vt,bt,Ft;if(yt)vt=vn(B,ct,this.clusterProps),bt=B[ct],Ft=B[ct+1];else{const Ve=this.points[B[ct+3]];vt=Ve.properties;const[ne,fe]=Ve.geometry.coordinates;bt=sr(ne),Ft=gr(fe)}const Zt={type:1,geometry:[[Math.round(this.options.extent*(bt*tt-U)),Math.round(this.options.extent*(Ft*tt-J))]],tags:vt};let te;te=yt||this.options.generateId?B[ct+3]:this.points[B[ct+3]].id,te!==void 0&&(Zt.id=te),ut.features.push(Zt)}}_limitZoom(F){return Math.max(this.options.minZoom,Math.min(Math.floor(+F),this.options.maxZoom+1))}_cluster(F,B){const{radius:U,extent:J,reduce:tt,minPoints:ut}=this.options,W=U/(J*Math.pow(2,B)),ct=F.data,yt=[],vt=this.stride;for(let bt=0;bt<ct.length;bt+=vt){if(ct[bt+2]<=B)continue;ct[bt+2]=B;const Ft=ct[bt],Zt=ct[bt+1],te=F.within(ct[bt],ct[bt+1],W),Ve=ct[bt+5];let ne=Ve;for(const fe of te){const be=fe*vt;ct[be+2]>B&&(ne+=ct[be+5])}if(ne>Ve&&ne>=ut){let fe,be=Ft*Ve,It=Zt*Ve,Ee=-1;const we=(bt/vt<<5)+(B+1)+this.points.length;for(const ti of te){const Te=ti*vt;if(ct[Te+2]<=B)continue;ct[Te+2]=B;const Ct=ct[Te+5];be+=ct[Te]*Ct,It+=ct[Te+1]*Ct,ct[Te+4]=we,tt&&(fe||(fe=this._map(ct,bt,!0),Ee=this.clusterProps.length,this.clusterProps.push(fe)),tt(fe,this._map(ct,Te)))}ct[bt+4]=we,yt.push(be/ne,It/ne,1/0,we,-1,ne),tt&&yt.push(Ee)}else{for(let fe=0;fe<vt;fe++)yt.push(ct[bt+fe]);if(ne>1)for(const fe of te){const be=fe*vt;if(!(ct[be+2]<=B)){ct[be+2]=B;for(let It=0;It<vt;It++)yt.push(ct[be+It])}}}}return yt}_getOriginId(F){return F-this.points.length>>5}_getOriginZoom(F){return(F-this.points.length)%32}_map(F,B,U){if(F[B+5]>1){const ut=this.clusterProps[F[B+6]];return U?Object.assign({},ut):ut}const J=this.points[F[B+3]].properties,tt=this.options.map(J);return U&&tt===J?Object.assign({},tt):tt}}function le(at,F,B){return{type:"Feature",id:at[F+3],properties:vn(at,F,B),geometry:{type:"Point",coordinates:[(U=at[F],360*(U-.5)),_r(at[F+1])]}};var U}function vn(at,F,B){const U=at[F+5],J=U>=1e4?`${Math.round(U/1e3)}k`:U>=1e3?Math.round(U/100)/10+"k":U,tt=at[F+6],ut=tt===-1?{}:Object.assign({},B[tt]);return Object.assign(ut,{cluster:!0,cluster_id:at[F+3],point_count:U,point_count_abbreviated:J})}function sr(at){return at/360+.5}function gr(at){const F=Math.sin(at*Math.PI/180),B=.5-.25*Math.log((1+F)/(1-F))/Math.PI;return B<0?0:B>1?1:B}function _r(at){const F=(180-360*at)*Math.PI/180;return 360*Math.atan(Math.exp(F))/Math.PI-90}function yr(at,F,B,U){let J=U;const tt=F+(B-F>>1);let ut,W=B-F;const ct=at[F],yt=at[F+1],vt=at[B],bt=at[B+1];for(let Ft=F+3;Ft<B;Ft+=3){const Zt=Ui(at[Ft],at[Ft+1],ct,yt,vt,bt);if(Zt>J)ut=Ft,J=Zt;else if(Zt===J){const te=Math.abs(Ft-tt);te<W&&(ut=Ft,W=te)}}J>U&&(ut-F>3&&yr(at,F,ut,U),at[ut+2]=J,B-ut>3&&yr(at,ut,B,U))}function Ui(at,F,B,U,J,tt){let ut=J-B,W=tt-U;if(ut!==0||W!==0){const ct=((at-B)*ut+(F-U)*W)/(ut*ut+W*W);ct>1?(B=J,U=tt):ct>0&&(B+=ut*ct,U+=W*ct)}return ut=at-B,W=F-U,ut*ut+W*W}function oi(at,F,B,U){const J={id:at??null,type:F,geometry:B,tags:U,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(F==="Point"||F==="MultiPoint"||F==="LineString")Ri(J,B);else if(F==="Polygon")Ri(J,B[0]);else if(F==="MultiLineString")for(const tt of B)Ri(J,tt);else if(F==="MultiPolygon")for(const tt of B)Ri(J,tt[0]);return J}function Ri(at,F){for(let B=0;B<F.length;B+=3)at.minX=Math.min(at.minX,F[B]),at.minY=Math.min(at.minY,F[B+1]),at.maxX=Math.max(at.maxX,F[B]),at.maxY=Math.max(at.maxY,F[B+1])}function li(at,F,B,U){if(!F.geometry)return;const J=F.geometry.coordinates;if(J&&J.length===0)return;const tt=F.geometry.type,ut=Math.pow(B.tolerance/((1<<B.maxZoom)*B.extent),2);let W=[],ct=F.id;if(B.promoteId?ct=F.properties[B.promoteId]:B.generateId&&(ct=U||0),tt==="Point")tn(J,W);else if(tt==="MultiPoint")for(const yt of J)tn(yt,W);else if(tt==="LineString")Fr(J,W,ut,!1);else if(tt==="MultiLineString"){if(B.lineMetrics){for(const yt of J)W=[],Fr(yt,W,ut,!1),at.push(oi(ct,"LineString",W,F.properties));return}Br(J,W,ut,!1)}else if(tt==="Polygon")Br(J,W,ut,!0);else{if(tt!=="MultiPolygon"){if(tt==="GeometryCollection"){for(const yt of F.geometry.geometries)li(at,{id:ct,geometry:yt,properties:F.properties},B,U);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const yt of J){const vt=[];Br(yt,vt,ut,!0),W.push(vt)}}at.push(oi(ct,tt,W,F.properties))}function tn(at,F){F.push(Li(at[0]),bn(at[1]),0)}function Fr(at,F,B,U){let J,tt,ut=0;for(let ct=0;ct<at.length;ct++){const yt=Li(at[ct][0]),vt=bn(at[ct][1]);F.push(yt,vt,0),ct>0&&(ut+=U?(J*vt-yt*tt)/2:Math.sqrt(Math.pow(yt-J,2)+Math.pow(vt-tt,2))),J=yt,tt=vt}const W=F.length-3;F[2]=1,yr(F,0,W,B),F[W+2]=1,F.size=Math.abs(ut),F.start=0,F.end=F.size}function Br(at,F,B,U){for(let J=0;J<at.length;J++){const tt=[];Fr(at[J],tt,B,U),F.push(tt)}}function Li(at){return at/360+.5}function bn(at){const F=Math.sin(at*Math.PI/180),B=.5-.25*Math.log((1+F)/(1-F))/Math.PI;return B<0?0:B>1?1:B}function Re(at,F,B,U,J,tt,ut,W){if(U/=F,tt>=(B/=F)&&ut<U)return at;if(ut<B||tt>=U)return null;const ct=[];for(const yt of at){const vt=yt.geometry;let bt=yt.type;const Ft=J===0?yt.minX:yt.minY,Zt=J===0?yt.maxX:yt.maxY;if(Ft>=B&&Zt<U){ct.push(yt);continue}if(Zt<B||Ft>=U)continue;let te=[];if(bt==="Point"||bt==="MultiPoint")xr(vt,te,B,U,J);else if(bt==="LineString")Or(vt,te,B,U,J,!1,W.lineMetrics);else if(bt==="MultiLineString")jr(vt,te,B,U,J,!1);else if(bt==="Polygon")jr(vt,te,B,U,J,!0);else if(bt==="MultiPolygon")for(const Ve of vt){const ne=[];jr(Ve,ne,B,U,J,!0),ne.length&&te.push(ne)}if(te.length){if(W.lineMetrics&&bt==="LineString"){for(const Ve of te)ct.push(oi(yt.id,bt,Ve,yt.tags));continue}bt!=="LineString"&&bt!=="MultiLineString"||(te.length===1?(bt="LineString",te=te[0]):bt="MultiLineString"),bt!=="Point"&&bt!=="MultiPoint"||(bt=te.length===3?"Point":"MultiPoint"),ct.push(oi(yt.id,bt,te,yt.tags))}}return ct.length?ct:null}function xr(at,F,B,U,J){for(let tt=0;tt<at.length;tt+=3){const ut=at[tt+J];ut>=B&&ut<=U&&Nr(F,at[tt],at[tt+1],at[tt+2])}}function Or(at,F,B,U,J,tt,ut){let W=Le(at);const ct=J===0?vs:wn;let yt,vt,bt=at.start;for(let ne=0;ne<at.length-3;ne+=3){const fe=at[ne],be=at[ne+1],It=at[ne+2],Ee=at[ne+3],we=at[ne+4],ti=J===0?fe:be,Te=J===0?Ee:we;let Ct=!1;ut&&(yt=Math.sqrt(Math.pow(fe-Ee,2)+Math.pow(be-we,2))),ti<B?Te>B&&(vt=ct(W,fe,be,Ee,we,B),ut&&(W.start=bt+yt*vt)):ti>U?Te<U&&(vt=ct(W,fe,be,Ee,we,U),ut&&(W.start=bt+yt*vt)):Nr(W,fe,be,It),Te<B&&ti>=B&&(vt=ct(W,fe,be,Ee,we,B),Ct=!0),Te>U&&ti<=U&&(vt=ct(W,fe,be,Ee,we,U),Ct=!0),!tt&&Ct&&(ut&&(W.end=bt+yt*vt),F.push(W),W=Le(at)),ut&&(bt+=yt)}let Ft=at.length-3;const Zt=at[Ft],te=at[Ft+1],Ve=J===0?Zt:te;Ve>=B&&Ve<=U&&Nr(W,Zt,te,at[Ft+2]),Ft=W.length-3,tt&&Ft>=3&&(W[Ft]!==W[0]||W[Ft+1]!==W[1])&&Nr(W,W[0],W[1],W[2]),W.length&&F.push(W)}function Le(at){const F=[];return F.size=at.size,F.start=at.start,F.end=at.end,F}function jr(at,F,B,U,J,tt){for(const ut of at)Or(ut,F,B,U,J,tt,!1)}function Nr(at,F,B,U){at.push(F,B,U)}function vs(at,F,B,U,J,tt){const ut=(tt-F)/(U-F);return Nr(at,tt,B+(J-B)*ut,1),ut}function wn(at,F,B,U,J,tt){const ut=(tt-B)/(J-B);return Nr(at,F+(U-F)*ut,tt,1),ut}function Vr(at,F){const B=[];for(let U=0;U<at.length;U++){const J=at[U],tt=J.type;let ut;if(tt==="Point"||tt==="MultiPoint"||tt==="LineString")ut=Tn(J.geometry,F);else if(tt==="MultiLineString"||tt==="Polygon"){ut=[];for(const W of J.geometry)ut.push(Tn(W,F))}else if(tt==="MultiPolygon"){ut=[];for(const W of J.geometry){const ct=[];for(const yt of W)ct.push(Tn(yt,F));ut.push(ct)}}B.push(oi(J.id,tt,ut,J.tags))}return B}function Tn(at,F){const B=[];B.size=at.size,at.start!==void 0&&(B.start=at.start,B.end=at.end);for(let U=0;U<at.length;U+=3)B.push(at[U]+F,at[U+1],at[U+2]);return B}function Wn(at,F){if(at.transformed)return at;const B=1<<at.z,U=at.x,J=at.y;for(const tt of at.features){const ut=tt.geometry,W=tt.type;if(tt.geometry=[],W===1)for(let ct=0;ct<ut.length;ct+=2)tt.geometry.push(Gi(ut[ct],ut[ct+1],F,B,U,J));else for(let ct=0;ct<ut.length;ct++){const yt=[];for(let vt=0;vt<ut[ct].length;vt+=2)yt.push(Gi(ut[ct][vt],ut[ct][vt+1],F,B,U,J));tt.geometry.push(yt)}}return at.transformed=!0,at}function Gi(at,F,B,U,J,tt){return[Math.round(B*(at*U-J)),Math.round(B*(F*U-tt))]}function Qs(at,F,B,U,J){const tt=F===J.maxZoom?0:J.tolerance/((1<<F)*J.extent),ut={features:[],numPoints:0,numSimplified:0,numFeatures:at.length,source:null,x:B,y:U,z:F,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const W of at)ta(ut,W,tt,J);return ut}function ta(at,F,B,U){const J=F.geometry,tt=F.type,ut=[];if(at.minX=Math.min(at.minX,F.minX),at.minY=Math.min(at.minY,F.minY),at.maxX=Math.max(at.maxX,F.maxX),at.maxY=Math.max(at.maxY,F.maxY),tt==="Point"||tt==="MultiPoint")for(let W=0;W<J.length;W+=3)ut.push(J[W],J[W+1]),at.numPoints++,at.numSimplified++;else if(tt==="LineString")Hn(ut,J,at,B,!1,!1);else if(tt==="MultiLineString"||tt==="Polygon")for(let W=0;W<J.length;W++)Hn(ut,J[W],at,B,tt==="Polygon",W===0);else if(tt==="MultiPolygon")for(let W=0;W<J.length;W++){const ct=J[W];for(let yt=0;yt<ct.length;yt++)Hn(ut,ct[yt],at,B,!0,yt===0)}if(ut.length){let W=F.tags||null;if(tt==="LineString"&&U.lineMetrics){W={};for(const yt in F.tags)W[yt]=F.tags[yt];W.mapbox_clip_start=J.start/J.size,W.mapbox_clip_end=J.end/J.size}const ct={geometry:ut,type:tt==="Polygon"||tt==="MultiPolygon"?3:tt==="LineString"||tt==="MultiLineString"?2:1,tags:W};F.id!==null&&(ct.id=F.id),at.features.push(ct)}}function Hn(at,F,B,U,J,tt){const ut=U*U;if(U>0&&F.size<(J?ut:U))return void(B.numPoints+=F.length/3);const W=[];for(let ct=0;ct<F.length;ct+=3)(U===0||F[ct+2]>ut)&&(B.numSimplified++,W.push(F[ct],F[ct+1])),B.numPoints++;J&&(function(ct,yt){let vt=0;for(let bt=0,Ft=ct.length,Zt=Ft-2;bt<Ft;Zt=bt,bt+=2)vt+=(ct[bt]-ct[Zt])*(ct[bt+1]+ct[Zt+1]);if(vt>0===yt)for(let bt=0,Ft=ct.length;bt<Ft/2;bt+=2){const Zt=ct[bt],te=ct[bt+1];ct[bt]=ct[Ft-2-bt],ct[bt+1]=ct[Ft-1-bt],ct[Ft-2-bt]=Zt,ct[Ft-1-bt]=te}})(W,tt),at.push(W)}const bs={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Sn{constructor(F,B){const U=(B=this.options=(function(tt,ut){for(const W in ut)tt[W]=ut[W];return tt})(Object.create(bs),B)).debug;if(U&&console.time("preprocess data"),B.maxZoom<0||B.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=(function(tt,ut){const W=[];if(tt.type==="FeatureCollection")for(let ct=0;ct<tt.features.length;ct++)li(W,tt.features[ct],ut,ct);else li(W,tt.type==="Feature"?tt:{geometry:tt},ut);return W})(F,B);this.tiles={},this.tileCoords=[],U&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",B.indexMaxZoom,B.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=(function(tt,ut){const W=ut.buffer/ut.extent;let ct=tt;const yt=Re(tt,1,-1-W,W,0,-1,2,ut),vt=Re(tt,1,1-W,2+W,0,-1,2,ut);return(yt||vt)&&(ct=Re(tt,1,-W,1+W,0,-1,2,ut)||[],yt&&(ct=Vr(yt,1).concat(ct)),vt&&(ct=ct.concat(Vr(vt,-1)))),ct})(J,B),J.length&&this.splitTile(J,0,0,0),U&&(J.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(F,B,U,J,tt,ut,W){const ct=[F,B,U,J],yt=this.options,vt=yt.debug;for(;ct.length;){J=ct.pop(),U=ct.pop(),B=ct.pop(),F=ct.pop();const bt=1<<B,Ft=ws(B,U,J);let Zt=this.tiles[Ft];if(!Zt&&(vt>1&&console.time("creation"),Zt=this.tiles[Ft]=Qs(F,B,U,J,yt),this.tileCoords.push({z:B,x:U,y:J}),vt)){vt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,U,J,Zt.numFeatures,Zt.numPoints,Zt.numSimplified),console.timeEnd("creation"));const Ct=`z${B}`;this.stats[Ct]=(this.stats[Ct]||0)+1,this.total++}if(Zt.source=F,tt==null){if(B===yt.indexMaxZoom||Zt.numPoints<=yt.indexMaxPoints)continue}else{if(B===yt.maxZoom||B===tt)continue;if(tt!=null){const Ct=tt-B;if(U!==ut>>Ct||J!==W>>Ct)continue}}if(Zt.source=null,F.length===0)continue;vt>1&&console.time("clipping");const te=.5*yt.buffer/yt.extent,Ve=.5-te,ne=.5+te,fe=1+te;let be=null,It=null,Ee=null,we=null,ti=Re(F,bt,U-te,U+ne,0,Zt.minX,Zt.maxX,yt),Te=Re(F,bt,U+Ve,U+fe,0,Zt.minX,Zt.maxX,yt);F=null,ti&&(be=Re(ti,bt,J-te,J+ne,1,Zt.minY,Zt.maxY,yt),It=Re(ti,bt,J+Ve,J+fe,1,Zt.minY,Zt.maxY,yt),ti=null),Te&&(Ee=Re(Te,bt,J-te,J+ne,1,Zt.minY,Zt.maxY,yt),we=Re(Te,bt,J+Ve,J+fe,1,Zt.minY,Zt.maxY,yt),Te=null),vt>1&&console.timeEnd("clipping"),ct.push(be||[],B+1,2*U,2*J),ct.push(It||[],B+1,2*U,2*J+1),ct.push(Ee||[],B+1,2*U+1,2*J),ct.push(we||[],B+1,2*U+1,2*J+1)}}getTile(F,B,U){F=+F,B=+B,U=+U;const J=this.options,{extent:tt,debug:ut}=J;if(F<0||F>24)return null;const W=1<<F,ct=ws(F,B=B+W&W-1,U);if(this.tiles[ct])return Wn(this.tiles[ct],tt);ut>1&&console.log("drilling down to z%d-%d-%d",F,B,U);let yt,vt=F,bt=B,Ft=U;for(;!yt&&vt>0;)vt--,bt>>=1,Ft>>=1,yt=this.tiles[ws(vt,bt,Ft)];return yt&&yt.source?(ut>1&&(console.log("found parent tile z%d-%d-%d",vt,bt,Ft),console.time("drilling down")),this.splitTile(yt.source,vt,bt,Ft,F,B,U),ut>1&&console.timeEnd("drilling down"),this.tiles[ct]?Wn(this.tiles[ct],tt):null):null}}function ws(at,F,B){return 32*((1<<at)*B+F)+at}class Xn extends zi{constructor(F,B,U,J=vr){super(F,B,U),this._dataUpdateable=new Map,this._createGeoJSONIndex=J}loadVectorTile(F,B){return M._(this,void 0,void 0,(function*(){const U=F.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(U.z,U.x,U.y);return J?_i(new Yt(J.features,{version:2,extent:M.a4})):null}))}loadData(F){return M._(this,void 0,void 0,(function*(){var B;(B=this._pendingRequest)===null||B===void 0||B.abort();const U=this._startPerformance(F);this._pendingRequest=new AbortController;try{(!this._pendingData||F.request||F.data||F.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(F,this._pendingRequest));const J=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(J,F),this.loaded={};const tt=F.dataDiff&&M.a6(J)?{applyDiff:!0}:{data:J};return this._finishPerformance(U,F,tt),tt}catch(J){if(delete this._pendingRequest,M.cH(J))return{abandoned:!0};throw J}}))}_startPerformance(F){var B;if(!((B=F?.request)===null||B===void 0)&&B.collectResourceTiming)return new M.c$(F.request)}_finishPerformance(F,B,U){if(!F)return;const J=F.finish();J&&(U.resourceTiming={},U.resourceTiming[B.source]=JSON.parse(JSON.stringify(J)))}getData(){return M._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(F){const B=this.loaded;return B&&B[F.uid]?super.reloadTile(F):this.loadTile(F)}loadAndProcessGeoJSON(F,B){return M._(this,void 0,void 0,(function*(){let U;if(F.request?U=yield this.loadGeoJSONFromUrl(F.request,F.promoteId,B):F.data?U=this._loadGeoJSONFromObject(F.data,F.promoteId):F.dataDiff&&(U=this._loadGeoJSONFromDiff(F.dataDiff,F.promoteId,F.source)),delete this._pendingRequest,typeof U!="object")throw new Error(`Input data given to '${F.source}' is not a valid GeoJSON object.`);return Zn(U,!0),F.filter&&(U=this._filterGeoJSON(U,F.filter)),U}))}loadGeoJSONFromUrl(F,B,U){return M._(this,void 0,void 0,(function*(){const J=yield M.j(F,U);return this._dataUpdateable=M.a6(J.data,B)?M.a7(J.data,B):void 0,J.data}))}_loadGeoJSONFromObject(F,B){return this._dataUpdateable=M.a6(F,B)?M.a7(F,B):void 0,F}_loadGeoJSONFromDiff(F,B,U){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${U}`);M.a8(this._dataUpdateable,F,B);const J=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(J)}_filterGeoJSON(F,B){const U=M.d3(B,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(U.result==="error")throw new Error(U.value.map((tt=>`${tt.key}: ${tt.message}`)).join(", "));const J=F.features.filter((tt=>U.value.evaluate({zoom:0},tt)));return this._toFeatureCollection(J)}_toFeatureCollection(F){return{type:"FeatureCollection",features:F}}removeSource(F){return M._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(F){return this._geoJSONIndex.getClusterExpansionZoom(F.clusterId)}getClusterChildren(F){return this._geoJSONIndex.getChildren(F.clusterId)}getClusterLeaves(F){return this._geoJSONIndex.getLeaves(F.clusterId,F.limit,F.offset)}}function vr(at,F){return F.cluster?new qn((function({superclusterOptions:B,clusterProperties:U}){if(!U||!B)return B;const J={},tt={},ut={accumulated:null,zoom:0},W={properties:null},ct=Object.keys(U);for(const yt of ct){const[vt,bt]=U[yt],Ft=M.d3(bt),Zt=M.d3(typeof vt=="string"?[vt,["accumulated"],["get",yt]]:vt);J[yt]=Ft.value,tt[yt]=Zt.value}return B.map=yt=>{W.properties=yt;const vt={};for(const bt of ct)vt[bt]=J[bt].evaluate(ut,W);return vt},B.reduce=(yt,vt)=>{W.properties=vt;for(const bt of ct)ut.accumulated=yt[bt],yt[bt]=tt[bt].evaluate(ut,W)},B})(F)).load(at.features):(function(B,U){return new Sn(B,U)})(at,F.geojsonVtOptions)}class Ki{constructor(F){this.self=F,this.actor=new M.L(F),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(B,U)=>{if(this.externalWorkerSourceTypes[B])throw new Error(`Worker source with name "${B}" already registered.`);this.externalWorkerSourceTypes[B]=U},this.self.addProtocol=M.cJ,this.self.removeProtocol=M.cK,this.self.registerRTLTextPlugin=B=>{M.d4.setMethods(B)},this.actor.registerMessageHandler("LDT",((B,U)=>this._getDEMWorkerSource(B,U.source).loadTile(U))),this.actor.registerMessageHandler("RDT",((B,U)=>M._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(B,U.source).removeTile(U)})))),this.actor.registerMessageHandler("GCEZ",((B,U)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(B,U.type,U.source).getClusterExpansionZoom(U)})))),this.actor.registerMessageHandler("GCC",((B,U)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(B,U.type,U.source).getClusterChildren(U)})))),this.actor.registerMessageHandler("GCL",((B,U)=>M._(this,void 0,void 0,(function*(){return this._getWorkerSource(B,U.type,U.source).getClusterLeaves(U)})))),this.actor.registerMessageHandler("LD",((B,U)=>this._getWorkerSource(B,U.type,U.source).loadData(U))),this.actor.registerMessageHandler("GD",((B,U)=>this._getWorkerSource(B,U.type,U.source).getData())),this.actor.registerMessageHandler("LT",((B,U)=>this._getWorkerSource(B,U.type,U.source).loadTile(U))),this.actor.registerMessageHandler("RT",((B,U)=>this._getWorkerSource(B,U.type,U.source).reloadTile(U))),this.actor.registerMessageHandler("AT",((B,U)=>this._getWorkerSource(B,U.type,U.source).abortTile(U))),this.actor.registerMessageHandler("RMT",((B,U)=>this._getWorkerSource(B,U.type,U.source).removeTile(U))),this.actor.registerMessageHandler("RS",((B,U)=>M._(this,void 0,void 0,(function*(){if(!this.workerSources[B]||!this.workerSources[B][U.type]||!this.workerSources[B][U.type][U.source])return;const J=this.workerSources[B][U.type][U.source];delete this.workerSources[B][U.type][U.source],J.removeSource!==void 0&&J.removeSource(U)})))),this.actor.registerMessageHandler("RM",(B=>M._(this,void 0,void 0,(function*(){delete this.layerIndexes[B],delete this.availableImages[B],delete this.workerSources[B],delete this.demWorkerSources[B],this.globalStates.delete(B)})))),this.actor.registerMessageHandler("SR",((B,U)=>M._(this,void 0,void 0,(function*(){this.referrer=U})))),this.actor.registerMessageHandler("SRPS",((B,U)=>this._syncRTLPluginState(B,U))),this.actor.registerMessageHandler("IS",((B,U)=>M._(this,void 0,void 0,(function*(){this.self.importScripts(U)})))),this.actor.registerMessageHandler("SI",((B,U)=>this._setImages(B,U))),this.actor.registerMessageHandler("UL",((B,U)=>M._(this,void 0,void 0,(function*(){this._getLayerIndex(B).update(U.layers,U.removedIds,this._getGlobalState(B))})))),this.actor.registerMessageHandler("UGS",((B,U)=>M._(this,void 0,void 0,(function*(){const J=this._getGlobalState(B);for(const tt in U)J[tt]=U[tt]})))),this.actor.registerMessageHandler("SL",((B,U)=>M._(this,void 0,void 0,(function*(){this._getLayerIndex(B).replace(U,this._getGlobalState(B))}))))}_getGlobalState(F){let B=this.globalStates.get(F);return B||(B={},this.globalStates.set(F,B)),B}_setImages(F,B){return M._(this,void 0,void 0,(function*(){this.availableImages[F]=B;for(const U in this.workerSources[F]){const J=this.workerSources[F][U];for(const tt in J)J[tt].availableImages=B}}))}_syncRTLPluginState(F,B){return M._(this,void 0,void 0,(function*(){return yield M.d4.syncState(B,this.self.importScripts)}))}_getAvailableImages(F){let B=this.availableImages[F];return B||(B=[]),B}_getLayerIndex(F){let B=this.layerIndexes[F];return B||(B=this.layerIndexes[F]=new c),B}_getWorkerSource(F,B,U){if(this.workerSources[F]||(this.workerSources[F]={}),this.workerSources[F][B]||(this.workerSources[F][B]={}),!this.workerSources[F][B][U]){const J={sendAsync:(tt,ut)=>(tt.targetMapId=F,this.actor.sendAsync(tt,ut))};switch(B){case"vector":this.workerSources[F][B][U]=new zi(J,this._getLayerIndex(F),this._getAvailableImages(F));break;case"geojson":this.workerSources[F][B][U]=new Xn(J,this._getLayerIndex(F),this._getAvailableImages(F));break;default:this.workerSources[F][B][U]=new this.externalWorkerSourceTypes[B](J,this._getLayerIndex(F),this._getAvailableImages(F))}}return this.workerSources[F][B][U]}_getDEMWorkerSource(F,B){return this.demWorkerSources[F]||(this.demWorkerSources[F]={}),this.demWorkerSources[F][B]||(this.demWorkerSources[F][B]=new rr),this.demWorkerSources[F][B]}}return M.i(self)&&(self.worker=new Ki(self)),Ki})),et("index",["exports","./shared"],(function(M,c){var dt="5.13.0";function Rt(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}let $t,Bt,Yt;const ce={frame(d,e,n){const o=requestAnimationFrame((p=>{u(),e(p)})),{unsubscribe:u}=c.s(d.signal,"abort",(()=>{u(),cancelAnimationFrame(o),n(c.c())}),!1)},frameAsync(d){return new Promise(((e,n)=>{this.frame(d,e,n)}))},getImageData(d,e=0){return this.getImageCanvasContext(d).getImageData(-e,-e,d.width+2*e,d.height+2*e)},getImageCanvasContext(d){const e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=d.width,e.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>($t||($t=document.createElement("a")),$t.href=d,$t.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Yt!==void 0?Yt:!!matchMedia&&(Bt==null&&(Bt=matchMedia("(prefers-reduced-motion: reduce)")),Bt.matches)},set prefersReducedMotion(d){Yt=d}},Xe=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 qt(){return Xe.getCurrentTime()}class xt{static testProp(e){if(!xt.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in xt.docStyle)return e[n];return e[0]}static create(e,n,o){const u=window.document.createElement(e);return n!==void 0&&(u.className=n),o&&o.appendChild(u),u}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){xt.docStyle&&xt.selectProp&&(xt.userSelect=xt.docStyle[xt.selectProp],xt.docStyle[xt.selectProp]="none")}static enableDrag(){xt.docStyle&&xt.selectProp&&(xt.docStyle[xt.selectProp]=xt.userSelect)}static setTransform(e,n){e.style[xt.transformProp]=n}static addEventListener(e,n,o,u={}){e.addEventListener(n,o,"passive"in u?u:u.capture)}static removeEventListener(e,n,o,u={}){e.removeEventListener(n,o,"passive"in u?u:u.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",xt.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",xt.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",xt.suppressClickInternal,!0)}),0)}static getScale(e){const n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,o){const u=n.boundingClientRect;return new c.P((o.clientX-u.left)/n.x-e.clientLeft,(o.clientY-u.top)/n.y-e.clientTop)}static mousePos(e,n){const o=xt.getScale(e);return xt.getPoint(e,o,n)}static touchPos(e,n){const o=[],u=xt.getScale(e);for(let p=0;p<n.length;p++)o.push(xt.getPoint(e,u,n[p]));return o}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const n=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),o=n.querySelectorAll("script");for(const u of o)u.remove();return xt.clean(n),n.innerHTML}static isPossiblyDangerous(e,n){const o=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!o.includes("javascript:")&&!o.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const n=e.children;for(const o of n)xt.removeAttributes(o),xt.clean(o)}static removeAttributes(e){for(const{name:n,value:o}of e.attributes)xt.isPossiblyDangerous(n,o)&&e.removeAttribute(n)}}xt.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,xt.selectProp=xt.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),xt.transformProp=xt.testProp(["transform","WebkitTransform"]);const fr={supported:!1,testSupport:function(d){!Rr&&de&&(Lr?Jr(d):ve=d)}};let ve,de,Rr=!1,Lr=!1;function Jr(d){const e=d.createTexture();d.bindTexture(d.TEXTURE_2D,e);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,de),d.isContextLost())return;fr.supported=!0}catch{}d.deleteTexture(e),Rr=!0}var _i;typeof document<"u"&&(de=document.createElement("img"),de.onload=()=>{ve&&Jr(ve),ve=null,Lr=!0},de.onerror=()=>{Rr=!0,ve=null},de.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(d){let e,n,o,u;d.resetRequestQueue=()=>{e=[],n=0,o=0,u={}},d.addThrottleControl=x=>{const b=o++;return u[b]=x,b},d.removeThrottleControl=x=>{delete u[x],m()},d.getImage=(x,b,T=!0)=>new Promise(((k,A)=>{fr.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),c.e(x,{type:"image"}),e.push({abortController:b,requestParameters:x,supportImageRefresh:T,state:"queued",onError:z=>{A(z)},onSuccess:z=>{k(z)}}),m()}));const p=x=>c._(this,void 0,void 0,(function*(){x.state="running";const{requestParameters:b,supportImageRefresh:T,onError:k,onSuccess:A,abortController:z}=x,j=T===!1&&!c.i(self)&&!c.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce(((H,K)=>H&&K==="accept"),!0));n++;const $=j?_(b,z):c.m(b,z);try{const H=yield $;delete x.abortController,x.state="completed",H.data instanceof HTMLImageElement||c.b(H.data)?A(H):H.data&&A({data:yield(Z=H.data,typeof createImageBitmap=="function"?c.f(Z):c.h(Z)),cacheControl:H.cacheControl,expires:H.expires})}catch(H){delete x.abortController,k(H)}finally{n--,m()}var Z})),m=()=>{const x=(()=>{for(const b of Object.keys(u))if(u[b]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b<x&&e.length>0;b++){const T=e.shift();T.abortController.signal.aborted?b--:p(T)}},_=(x,b)=>new Promise(((T,k)=>{const A=new Image,z=x.url,j=x.credentials;j&&j==="include"?A.crossOrigin="use-credentials":(j&&j==="same-origin"||!c.d(z))&&(A.crossOrigin="anonymous"),b.signal.addEventListener("abort",(()=>{A.src="",k(c.c())})),A.fetchPriority="high",A.onload=()=>{A.onerror=A.onload=null,T({data:A})},A.onerror=()=>{A.onerror=A.onload=null,b.signal.aborted||k(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."))},A.src=z}))})(_i||(_i={})),_i.resetRequestQueue();class $n{constructor(e){this._transformRequestFn=e??null}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function zi(d){const e=[];if(typeof d=="string")e.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:o,url:u}of d){const p=`${o}${u}`;n.indexOf(p)===-1&&(n.push(p),e.push({id:o,url:u}))}}return e}function rr(d,e,n){try{const o=new URL(d);return o.pathname+=`${e}${n}`,o.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 Qe(d){const{userImage:e}=d;return!!(e&&e.render&&e.render())&&(d.data.replace(new Uint8Array(e.data.buffer)),!0)}class mr extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:n,promiseResolve:o}of this.requestors)o(this._getImagesForIds(n));this.requestors=[]}}getImage(e){const n=this.images[e];if(n&&!n.data&&n.spriteData){const o=n.spriteData;n.data=new c.R({width:o.width,height:o.height},o.context.getImageData(o.x,o.y,o.width,o.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let o=!0;const u=n.data||n.spriteData;return this._validateStretch(n.stretchX,u&&u.width)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,u&&u.height)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "content" value`))),o=!1),o}_validateStretch(e,n){if(!e)return!0;let o=0;for(const u of e){if(u[0]<o||u[1]<u[0]||n<u[1])return!1;o=u[1]}return!0}_validateContent(e,n){if(!e)return!0;if(e.length!==4)return!1;const o=n.spriteData,u=o&&o.width||n.data.width,p=o&&o.height||n.data.height;return!(e[0]<0||u<e[0]||e[1]<0||p<e[1]||e[2]<0||u<e[2]||e[3]<0||p<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,n,o=!0){const u=this.getImage(e);if(o&&(u.data.width!==n.data.width||u.data.height!==n.data.height))throw new Error(`size mismatch between old image (${u.data.width}x${u.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=u.version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){const n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((n,o)=>{let u=!0;if(!this.isLoaded())for(const p of e)this.images[p]||(u=!1);this.isLoaded()||u?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})}))}_getImagesForIds(e){const n={};for(const o of e){let u=this.getImage(o);u||(this.fire(new c.l("styleimagemissing",{id:o})),u=this.getImage(o)),u?n[o]={data:u.data.clone(),pixelRatio:u.pixelRatio,sdf:u.sdf,version:u.version,stretchX:u.stretchX,stretchY:u.stretchY,content:u.content,textFitWidth:u.textFitWidth,textFitHeight:u.textFitHeight,hasRenderCallback:!!(u.userImage&&u.userImage.render)}:c.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){const n=this.patterns[e],o=this.getImage(e);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const u={w:o.data.width+2,h:o.data.height+2,x:0,y:0},p=new c.I(u,o);this.patterns[e]={bin:u,position:p}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new c.T(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const p in this.patterns)e.push(this.patterns[p].bin);const{w:n,h:o}=c.p(e),u=this.atlasImage;u.resize({width:n||1,height:o||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],_=m.x+1,x=m.y+1,b=this.getImage(p).data,T=b.width,k=b.height;c.R.copy(b,u,{x:0,y:0},{x:_,y:x},{width:T,height:k}),c.R.copy(b,u,{x:0,y:k-1},{x:_,y:x-1},{width:T,height:1}),c.R.copy(b,u,{x:0,y:0},{x:_,y:x+k},{width:T,height:1}),c.R.copy(b,u,{x:T-1,y:0},{x:_-1,y:x},{width:1,height:k}),c.R.copy(b,u,{x:0,y:0},{x:_+T,y:x},{width:1,height:k})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const o=this.getImage(n);o||c.w(`Image with ID: "${n}" was not found`),Qe(o)&&this.updateImage(n,o)}}cloneImages(){const e={};for(const n in this.images){const o=this.images[n];e[n]=Object.assign(Object.assign({},o),{data:o.data?o.data.clone():null})}return e}}const Qr=1e20;function Zn(d,e,n,o,u,p,m,_,x){for(let b=e;b<e+o;b++)xn(d,n*p+b,p,u,m,_,x);for(let b=n;b<n+u;b++)xn(d,b*p+e,1,o,m,_,x)}function xn(d,e,n,o,u,p,m){p[0]=0,m[0]=-Qr,m[1]=Qr,u[0]=d[e];for(let _=1,x=0,b=0;_<o;_++){u[_]=d[e+_*n];const T=_*_;do{const k=p[x];b=(u[_]-u[k]+T-k*k)/(_-k)/2}while(b<=m[x]&&--x>-1);x++,p[x]=_,m[x]=b,m[x+1]=Qr}for(let _=0,x=0;_<o;_++){for(;m[x+1]<_;)x++;const b=p[x],T=_-b;d[e+_*n]=u[b]+T*T}}const nr=c.v.layout_symbol["text-font"].default.join(",");class wi{constructor(e,n,o){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={},this.lang=o}setURL(e){this.url=e}getGlyphs(e){return c._(this,void 0,void 0,(function*(){const n=[];for(const p in e)for(const m of e[p])n.push(this._getAndCacheGlyphsPromise(p,m));const o=yield Promise.all(n),u={};for(const{stack:p,id:m,glyph:_}of o)u[p]||(u[p]={}),u[p][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return u}))}_getAndCacheGlyphsPromise(e,n){return c._(this,void 0,void 0,(function*(){let o=this.entries[e];o||(o=this.entries[e]={glyphs:{},requests:{},ranges:{}});let u=o.glyphs[n];return u!==void 0?{stack:e,id:n,glyph:u}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(u=o.glyphs[n]=this._drawGlyph(o,e,n),{stack:e,id:n,glyph:u}):yield this._downloadAndCacheRangePromise(e,n)}))}_downloadAndCacheRangePromise(e,n){return c._(this,void 0,void 0,(function*(){const o=this.entries[e],u=Math.floor(n/256);if(o.ranges[u])return{stack:e,id:n,glyph:null};if(!o.requests[u]){const p=wi.loadGlyphRange(e,u,this.url,this.requestManager);o.requests[u]=p}try{const p=yield o.requests[u];for(const m in p)o.glyphs[+m]=p[+m];return o.ranges[u]=!0,{stack:e,id:n,glyph:p[n]||null}}catch(p){const m=o.glyphs[n]=this._drawGlyph(o,e,n);return this._warnOnMissingGlyphRange(m,u,n,p),{stack:e,id:n,glyph:m}}}))}_warnOnMissingGlyphRange(e,n,o,u){const p=256*n,m=p+255,_=o.toString(16).padStart(4,"0").toUpperCase();c.w(`Unable to load glyph range ${n}, ${p}-${m}. Rendering codepoint U+${_} locally instead. ${u}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&c.q(e)}_drawGlyph(e,n,o){const u=n===nr&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(o),p=u?"ideographTinySDF":"tinySDF";e[p]||(e[p]=this._createTinySDF(u?this.localIdeographFontFamily:n));const m=e[p].draw(String.fromCodePoint(o));return{id:o,bitmap:new c.r({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){const n=e?e.split(","):[];n.push("sans-serif");const o=n.map((u=>/[-\w]+/.test(u)?u:`'${CSS.escape(u)}'`)).join(",");return new wi.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){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 o;for(const[u,p]of Object.entries(n))new RegExp(`\\b${u}\\b`,"i").test(e)&&(o=`${p}`);return o}destroy(){for(const e in this.entries){const n=this.entries[e];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}wi.loadGlyphRange=function(d,e,n,o){return c._(this,void 0,void 0,(function*(){const u=256*e,p=u+255,m=o.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${u}-${p}`),"Glyphs"),_=yield c.n(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${u}-${p}`);const x={};for(const b of c.o(_.data))x[b.id]=b;return x}))},wi.TinySDF=class{constructor({fontSize:d=24,buffer:e=3,radius:n=8,cutoff:o=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:m="normal",lang:_=null}={}){this.buffer=e,this.cutoff=o,this.radius=n,this.lang=_;const x=this.size=d+4*e,b=this._createCanvas(x),T=this.ctx=b.getContext("2d",{willReadFrequently:!0});T.font=`${m} ${p} ${d}px ${u}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(d){const e=document.createElement("canvas");return e.width=e.height=d,e}draw(d){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:u,actualBoundingBoxRight:p}=this.ctx.measureText(d),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-u))),x=Math.min(this.size-this.buffer,m+Math.ceil(o)),b=_+2*this.buffer,T=x+2*this.buffer,k=Math.max(b*T,0),A=new Uint8ClampedArray(k),z={data:A,width:b,height:T,glyphWidth:_,glyphHeight:x,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return z;const{ctx:j,buffer:$,gridInner:Z,gridOuter:H}=this;this.lang&&(j.lang=this.lang),j.clearRect($,$,_,x),j.fillText(d,$,$+m);const K=j.getImageData($,$,_,x);H.fill(Qr,0,k),Z.fill(0,0,k);for(let it=0;it<x;it++)for(let Y=0;Y<_;Y++){const rt=K.data[4*(it*_+Y)+3]/255;if(rt===0)continue;const nt=(it+$)*b+Y+$;if(rt===1)H[nt]=0,Z[nt]=Qr;else{const Q=.5-rt;H[nt]=Q>0?Q*Q:0,Z[nt]=Q<0?Q*Q:0}}Zn(H,0,0,b,T,b,this.f,this.v,this.z),Zn(Z,$,$,_,x,b,this.f,this.v,this.z);for(let it=0;it<k;it++){const Y=Math.sqrt(H[it])-Math.sqrt(Z[it]);A[it]=Math.round(255-255*(Y/this.radius+this.cutoff))}return z}};class qn{constructor(){this.specification=c.u.light.position}possiblyEvaluate(e,n){return c.F(e.expression.evaluate(n))}interpolate(e,n,o){return{x:c.G.number(e.x,n.x,o),y:c.G.number(e.y,n.y,o),z:c.G.number(e.z,n.z,o)}}}let le;class vn extends c.E{constructor(e){super(),le=le||new c.t({anchor:new c.D(c.u.light.anchor),position:new qn,color:new c.D(c.u.light.color),intensity:new c.D(c.u.light.intensity)}),this._transitionable=new c.x(le,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(c.y,e,n))for(const o in e){const u=e[o];o.endsWith(c.z)?this._transitionable.setTransition(o.slice(0,-c.z.length),u):this._transitionable.setValue(o,u)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o){return(!o||o.validate!==!1)&&c.B(this,e.call(c.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u}))}}const sr=new c.t({"sky-color":new c.D(c.u.sky["sky-color"]),"horizon-color":new c.D(c.u.sky["horizon-color"]),"fog-color":new c.D(c.u.sky["fog-color"]),"fog-ground-blend":new c.D(c.u.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.u.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.u.sky["atmosphere-blend"])});class gr extends c.E{constructor(e){super(),this._transitionable=new c.x(sr,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0))}setSky(e,n={}){if(!this._validate(c.J,e,n)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const o in e){const u=e[o];o.endsWith(c.z)?this._transitionable.setTransition(o.slice(0,-c.z.length),u):this._transitionable.setValue(o,u)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,o={}){return o?.validate!==!1&&c.B(this,e.call(c.C,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class _r{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){const o=e.join(",")+String(n);return this.dashEntry[o]||(this.dashEntry[o]=this.addDash(e,n)),this.dashEntry[o]}getDashRanges(e,n,o){const u=[];let p=e.length%2==1?-e[e.length-1]*o:0,m=e[0]*o,_=!0;u.push({left:p,right:m,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let b=1;b<e.length;b++){_=!_;const T=e[b];p=x*o,x+=T,m=x*o,u.push({left:p,right:m,isDash:_,zeroLength:T===0})}return u}addRoundDash(e,n,o){const u=n/2;for(let p=-o;p<=o;p++){const m=this.width*(this.nextRow+o+p);let _=0,x=e[_];for(let b=0;b<this.width;b++){b/x.right>1&&(x=e[++_]);const T=Math.abs(b-x.left),k=Math.abs(b-x.right),A=Math.min(T,k);let z;const j=p/o*(u+1);if(x.isDash){const $=u-Math.abs(j);z=Math.sqrt(A*A+$*$)}else z=u-Math.sqrt(A*A+j*j);this.data[m+b]=Math.max(0,Math.min(255,z+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],b=e[_+1];x.zeroLength?e.splice(_,1):b&&b.isDash===x.isDash&&(b.left=x.left,e.splice(_,1))}const n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const u=this.width*this.nextRow;let p=0,m=e[p];for(let _=0;_<this.width;_++){_/m.right>1&&(m=e[++p]);const x=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(x,b);this.data[u+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){const o=n?7:0,u=2*o+1;if(this.nextRow+u>this.height)return c.w("LineAtlas out of space"),null;let p=0;for(let _=0;_<e.length;_++)p+=e[_];if(p!==0){const _=this.width/p,x=this.getDashRanges(e,this.width,_);n?this.addRoundDash(x,_,o):this.addRegularDash(x)}const m={y:this.nextRow+o,height:2*o,width:p};return this.nextRow+=u,this.dirty=!0,m}bind(e){const n=e.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 yr="maplibre_preloaded_worker_pool";class Ui{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Ui.workerCount;)this.workers.push(new Worker(c.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[yr]}numActive(){return Object.keys(this.active).length}}const oi=Math.floor(ce.hardwareConcurrency/2);let Ri,li;function tn(){return Ri||(Ri=new Ui),Ri}Ui.workerCount=c.K(globalThis)?Math.max(Math.min(oi,3),1):1;class Fr{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;const o=this.workerPool.acquire(n);for(let u=0;u<o.length;u++){const p=new c.L(o[u],n);p.name=`Worker ${u}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n){const o=[];for(const u of this.actors)o.push(u.sendAsync({type:e,data:n}));return Promise.all(o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(const o of this.actors)o.registerMessageHandler(e,n)}unregisterMessageHandler(e){for(const n of this.actors)n.unregisterMessageHandler(e)}}function Br(){return li||(li=new Fr(tn(),c.M),li.registerMessageHandler("GR",((d,e,n)=>c.m(e,n)))),li}function Li(d,e){const n=c.N();return c.O(n,n,[1,1,0]),c.Q(n,n,[.5*d.width,.5*d.height,1]),d.calculatePosMatrix?c.S(n,n,d.calculatePosMatrix(e.toUnwrapped())):n}function bn(d,e,n,o,u,p,m){var _;const x=(function(A,z,j){if(A)for(const $ of A){const Z=z[$];if(Z&&Z.source===j&&Z.type==="fill-extrusion")return!0}else for(const $ in z){const Z=z[$];if(Z.source===j&&Z.type==="fill-extrusion")return!0}return!1})((_=u?.layers)!==null&&_!==void 0?_:null,e,d.id),b=p.maxPitchScaleFactor(),T=d.tilesIn(o,b,x);T.sort(Re);const k=[];for(const A of T)k.push({wrappedTileID:A.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(e,n,d.getState(),A.queryGeometry,A.cameraQueryGeometry,A.scale,u,p,b,Li(p,A.tileID),m?(z,j)=>m(A.tileID,z,j):void 0)});return(function(A,z){for(const j in A)for(const $ of A[j])xr($,z);return A})((function(A){const z={},j={};for(const $ of A){const Z=$.queryResults,H=$.wrappedTileID,K=j[H]=j[H]||{};for(const it in Z){const Y=Z[it],rt=K[it]=K[it]||{},nt=z[it]=z[it]||[];for(const Q of Y)rt[Q.featureIndex]||(rt[Q.featureIndex]=!0,nt.push(Q))}}return z})(k),d)}function Re(d,e){const n=d.tileID,o=e.tileID;return n.overscaledZ-o.overscaledZ||n.canonical.y-o.canonical.y||n.wrap-o.wrap||n.canonical.x-o.canonical.x}function xr(d,e){const n=d.feature,o=e.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}function Or(d,e,n){return c._(this,void 0,void 0,(function*(){let o=d;if(d.url?o=(yield c.j(e.transformRequest(d.url,"Source"),n)).data:yield ce.frameAsync(n),!o)return null;const u=c.U(c.e(o,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(u.vectorLayerIds=o.vector_layers.map((p=>p.id))),u}))}class Le{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof c.V?new c.V(e.lng,e.lat):c.V.convert(e),this}setSouthWest(e){return this._sw=e instanceof c.V?new c.V(e.lng,e.lat):c.V.convert(e),this}extend(e){const n=this._sw,o=this._ne;let u,p;if(e instanceof c.V)u=e,p=e;else{if(!(e instanceof Le))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Le.convert(e)):this.extend(c.V.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(c.V.convert(e)):this;if(u=e._sw,p=e._ne,!u||!p)return this}return n||o?(n.lng=Math.min(u.lng,n.lng),n.lat=Math.min(u.lat,n.lat),o.lng=Math.max(p.lng,o.lng),o.lat=Math.max(p.lat,o.lat)):(this._sw=new c.V(u.lng,u.lat),this._ne=new c.V(p.lng,p.lat)),this}getCenter(){return new c.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 c.V(this.getWest(),this.getNorth())}getSouthEast(){return new c.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(e){const{lng:n,lat:o}=c.V.convert(e);let u=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&u}intersects(e){if((e=Le.convert(e)).getNorth()<this.getSouth()||e.getSouth()>this.getNorth())return!1;const n=c.W(this.getWest(),-180,180),o=c.W(this.getEast(),-180,180),u=c.W(e.getWest(),-180,180),p=c.W(e.getEast(),-180,180),m=n>o,_=u>p;return!(!m||!_)||(m?p>=n||u<=o:_?o>=u||n<=p:!(u>o||p<n))}static convert(e){return e instanceof Le?e:e&&new Le(e)}static fromLngLat(e,n=0){const o=360*n/40075017,u=o/Math.cos(Math.PI/180*e.lat);return new Le(new c.V(e.lng-u,e.lat-o),new c.V(e.lng+u,e.lat+o))}adjustAntiMeridian(){const e=new c.V(this._sw.lng,this._sw.lat),n=new c.V(this._ne.lng,this._ne.lat);return new Le(e,e.lng>n.lng?new c.V(n.lng+360,n.lat):n)}}class jr{constructor(e,n,o){this.bounds=Le.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const n=Math.pow(2,e.z),o=Math.floor(c.Y(this.bounds.getWest())*n),u=Math.floor(c.X(this.bounds.getNorth())*n),p=Math.ceil(c.Y(this.bounds.getEast())*n),m=Math.ceil(c.X(this.bounds.getSouth())*n);return e.x>=o&&e.x<p&&e.y>=u&&e.y<m}}class Nr extends c.E{constructor(e,n,o,u){if(super(),this.id=e,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=c.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(u)}load(){return c._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Or(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),e&&(c.e(this,e),e.bounds&&(this.tileBounds=new jr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,this.fire(new c.k(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(e){return c._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};o.request.collectResourceTiming=this._collectResourceTiming;let u="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise(((p,m)=>{e.reloadPromise={resolve:p,reject:m}}))}else e.actor=this.dispatcher.getActor(),u="LT";e.abortController=new AbortController;try{const p=yield e.actor.sendAsync({type:u,data:o},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,p)}catch(p){if(delete e.abortController,e.aborted)return;if(p&&p.status!==404)throw p;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=e.tileID.scaledTo(this.maxzoom).canonical,o=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:this.map._requestManager.transformRequest(o,"Tile")}}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){const o=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(o.resolve).catch(o.reject)}}abortTile(e){return c._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return c._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class vs extends c.E{constructor(e,n,o,u){super(),this.id=e,this.dispatcher=o,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.U(n,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Or(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,n&&(c.e(this,n),n.bounds&&(this.tileBounds=new jr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,this.fire(new c.k(n))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return c.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return c._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const o=yield _i.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const u=this.map.painter.context,p=u.gl,m=o.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new c.T(u,m,p.RGBA,{useMipmap:!0}),e.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}}))}abortTile(e){return c._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return c._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class wn extends vs{constructor(e,n,o,u){super(e,n,o,u),this.type="raster-dem",this.maxzoom=22,this._options=c.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(e){return c._(this,void 0,void 0,(function*(){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const u=yield _i.getImage(o,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(u&&u.data){const p=u.data;this.map._refreshExpiredTiles&&(u.cacheControl||u.expires)&&e.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const m=c.b(p)&&c.Z()?p:yield this.readImageNow(p),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(u){if(delete e.abortController,e.aborted)e.state="unloaded";else if(u)throw e.state="errored",u}}))}readImageNow(e){return c._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&c.$()){const n=e.width+2,o=e.height+2;try{return new c.R({width:n,height:o},yield c.a0(e,-1,-1,n,o))}catch{}}return ce.getImageData(e,1)}))}_getNeighboringTiles(e){const n=e.canonical,o=Math.pow(2,n.z),u=(n.x-1+o)%o,p=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+o)%o,_=n.x+1===o?e.wrap+1:e.wrap,x={};return x[new c.a1(e.overscaledZ,p,n.z,u,n.y).key]={backfilled:!1},x[new c.a1(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(x[new c.a1(e.overscaledZ,p,n.z,u,n.y-1).key]={backfilled:!1},x[new c.a1(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},x[new c.a1(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<o&&(x[new c.a1(e.overscaledZ,p,n.z,u,n.y+1).key]={backfilled:!1},x[new c.a1(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},x[new c.a1(e.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),x}unloadTile(e){return c._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))}))}}function Vr(d){return d.type==="GeometryCollection"?d.geometries.map((e=>e.coordinates)).flat(1/0):d.coordinates.flat(1/0)}function Tn(d){const e=new Le;let n;switch(d.type){case"FeatureCollection":n=d.features.map((o=>Vr(o.geometry))).flat(1/0);break;case"Feature":n=Vr(d.geometry);break;default:n=Vr(d)}if(n.length==0)return e;for(let o=0;o<n.length-1;o+=2)e.extend([n[o],n[o+1]]);return e}class Wn extends c.E{constructor(e,n,o,u){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=o.getActor(),this.setEventedParent(u),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=c.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&&c.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=c.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:c.a4,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:c.a4,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(e){return e*(c.a4/this.tileSize)}_getClusterMaxZoom(e){const n=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||c.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${n}"`),n}load(){return c._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e,n){this._data=typeof e=="string"?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const o=this._updateWorkerData();return n?o:this}updateData(e,n){this._pendingWorkerUpdate.diff=c.a5(this._pendingWorkerUpdate.diff,e);const o=this._updateWorkerData();return n?o:this}getData(){return c._(this,void 0,void 0,(function*(){const e=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}getBounds(){return c._(this,void 0,void 0,(function*(){return Tn(yield this.getData())}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,n,o){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:n,offset:o}})}_updateWorkerData(){return c._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void c.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:n}=this._pendingWorkerUpdate,o=c.e({type:this.type},this.workerOptions);e?(typeof e=="string"?(o.request=this.map._requestManager.transformRequest(ce.resolveURL(e),"Source"),o.request.collectResourceTiming=this._collectResourceTiming):o.data=e,this._pendingWorkerUpdate.data=void 0):n&&(o.dataDiff=n,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new c.l("dataloading",{dataType:"source"}));try{const u=yield this.actor.sendAsync({type:"LD",data:o});if(this._isUpdatingWorker=!1,this._removed||u.abandoned)return void this.fire(new c.l("dataabort",{dataType:"source"}));u.applyDiff?this._applyDiff(n):this._data={geojson:u.data};let p=null;u.resourceTiming&&u.resourceTiming[this.id]&&(p=u.resourceTiming[this.id].slice(0));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&c.e(m,{resourceTiming:p}),this.fire(new c.l("data",Object.assign(Object.assign({},m),{sourceDataType:"metadata"}))),this.fire(new c.l("data",Object.assign(Object.assign({},m),{sourceDataType:"content",shouldReloadTileOptions:this._getShouldReloadTileOptions(n)})))}catch(u){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new c.l("dataabort",{dataType:"source"}));this.fire(new c.k(u))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyDiff(e){const n=typeof this.promoteId=="string"?this.promoteId:void 0;this._data.url||this._data.updateable||!c.a6(this._data.geojson,n)||(this._data={updateable:c.a7(this._data.geojson,n)}),e&&this._data.updateable?c.a8(this._data.updateable,e,n):c.w("Cannot apply GeoJSONSource#updateData due to internal error")}_getShouldReloadTileOptions(e){if(this._options.cluster||!e||e.removeAll)return;const{add:n=[],update:o=[],remove:u=[]}=e||{},p=new Set([...o.map((m=>m.id)),...u]);for(const m of p.values())if(typeof m!="number"&&this.promoteId==null)return void c.w(`GeoJSONSource "${this.id}": updateData is slower when using string GeoJSON feature IDs (e.g. "${m}"). Consider using promoteId or numeric IDs for better performance.`);return{nextBounds:[...o.map((m=>m.newGeometry)),...n.map((m=>m.geometry))].filter(Boolean).map((m=>Tn(m))),prevIds:p}}shouldReloadTile(e,{nextBounds:n,prevIds:o}){if(!e.latestFeatureIndex)return e.state!=="unloaded";const u=e.latestFeatureIndex.loadVTLayers();for(let x=0;x<e.latestFeatureIndex.featureIndexArray.length;x++){const b=e.latestFeatureIndex.featureIndexArray.get(x),T=u[c.a9].feature(b.featureIndex),k=e.latestFeatureIndex.getId(T,c.a9);if(o.has(k))return!0}const{buffer:p,extent:m}=this.workerOptions.geojsonVtOptions,_=(function({x,y:b,z:T},k=0){const A=c.a2((x-k)/Math.pow(2,T)),z=c.a3((b+1+k)/Math.pow(2,T)),j=c.a2((x+1+k)/Math.pow(2,T)),$=c.a3((b-k)/Math.pow(2,T));return new Le([A,z],[j,$])})(e.tileID.canonical,p/m);for(const x of n)if(_.intersects(x))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return c._(this,void 0,void 0,(function*(){const n=e.actor?"RT":"LT";e.actor=this.actor;const o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.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};e.abortController=new AbortController;const u=yield this.actor.sendAsync({type:n,data:o},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(u,this.map.painter,n==="RT")}))}abortTile(e){return c._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return c._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 c.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 Gi extends c.E{constructor(e,n,o,u){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=o,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(e){return c._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield _i.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new c.k(n))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const n=e.map(c.aa.fromLngLat);var o;return this.tileID=(function(u){const p=c.ab.fromPoints(u),m=p.width(),_=p.height(),x=Math.max(m,_),b=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),T=Math.pow(2,b);return new c.ad(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((u=>this.tileID.getTilePoint(u)._round())),this.flippedWindingOrder=((o=this.tileCoords)[1].x-o[0].x)*(o[2].y-o[0].y)-(o[1].y-o[0].y)*(o[2].x-o[0].x)<0,this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,n=e.gl;this.texture||(this.texture=new c.T(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,o=!0)}o&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return c._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:n,minY:o,maxX:u,maxY:p}=c.ab.fromPoints(e),m={};for(let _=0;_<=c.ac;_++){const x=Math.pow(2,_),b=Math.floor(n*x),T=Math.floor(o*x),k=Math.floor(u*x),A=Math.floor(p*x);m[_]={minTileX:b,minTileY:T,maxTileX:k,maxTileY:A}}return m}}class Qs extends Gi{constructor(e,n,o,u){super(e,n,o,u),this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield c.ae(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 c.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new c.k(new c.af(`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=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 e=this.map.painter.context,n=e.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 c.T(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let o=!1;for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,o=!0)}o&&this.fire(new c.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 ta extends Gi{constructor(e,n,o,u){super(e,n,o,u),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 c.k(new c.af(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.k(new c.af(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.k(new c.af(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.k(new c.af(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.k(new c.af(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(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 c.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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,o=n.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new c.T(n,this.canvas,o.RGBA,{premultiply:!0});let u=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,u=!0)}u&&this.fire(new c.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 e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Hn={},bs=d=>{switch(d){case"geojson":return Wn;case"image":return Gi;case"raster":return vs;case"raster-dem":return wn;case"vector":return Nr;case"video":return Qs;case"canvas":return ta}return Hn[d]},Sn="RTLPluginLoaded";class ws extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Br()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return c._(this,arguments,void 0,(function*(n,o=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ce.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!o)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return c._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.l(Sn))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Xn=null;function vr(){return Xn||(Xn=new ws),Xn}var Ki,at;(function(d){d[d.Base=0]="Base",d[d.Parent=1]="Parent"})(Ki||(Ki={})),(function(d){d[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming"})(at||(at={}));class F{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=c.ag(),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(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:n,fadingParentID:o,fadeEndTime:u}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=n,this.fadingParentID=o,this.fadeEndTime=u}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=qt(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,o){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=(function(u,p){const m={};if(!p)return m;for(const _ of u){const x=_.layerIds.map((b=>p.getLayer(b))).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map((b=>x.filter((T=>T.id===b))[0])));for(const b of x)m[b.id]=_}}return m})(e.buckets,n?.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof c.ai){if(this.hasSymbolBuckets=!0,!o)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof c.ai&&p.hasRTLText){this.hasRTLText=!0,vr().lazyLoad();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new c.ah}unloadVectorData(){for(const e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(const o in this.buckets){const u=this.buckets[o];u.uploadPending()&&u.upload(e)}const n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new c.T(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new c.T(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,o,u,p,m,_,x,b,T,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:x,params:_,queryPadding:this.queryPadding*b,getElevation:k},e,n,o):{}}querySourceFeatures(e,n){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const u=o.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=u[c.a9]||u[p];if(!m)return;const _=c.aj(n?.filter,n?.globalState),{z:x,x:b,y:T}=this.tileID.canonical,k={z:x,x:b,y:T};for(let A=0;A<m.length;A++){const z=m.feature(A);if(_.needGeometry){const Z=c.ak(z,!0);if(!_.filter(new c.H(this.tileID.overscaledZ),Z,this.tileID.canonical))continue}else if(!_.filter(new c.H(this.tileID.overscaledZ),z))continue;const j=o.getId(z,p),$=new c.al(z,x,b,T,j);$.tile=k,e.push($)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const n=this.expirationTime;if(e.cacheControl){const o=c.am(e.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const o=Date.now();let u=!1;if(this.expirationTime>o)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const p=this.expirationTime-n;p?this.expirationTime=o+Math.max(p,3e4):u=!0}else u=!0;u?(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(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const o=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const p=this.buckets[u],m=p.layers[0].sourceLayer||c.a9,_=o[m],x=e[m];if(!_||!x||Object.keys(x).length===0)continue;p.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const b=n&&n.style&&n.style.getLayer(u);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(p)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<qt()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=qt()+e}setDependencies(e,n){const o={};for(const u of n)o[u]=!0;this.dependencies[e]=o}hasDependency(e,n){for(const o of e){const u=this.dependencies[o];if(u){for(const p of n)if(u[p])return!0}}return!1}}class B{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,o){const u=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][u]=this.stateChanges[e][u]||{},c.e(this.stateChanges[e][u],o),this.deletedStates[e]===null){this.deletedStates[e]={};for(const p in this.state[e])p!==u&&(this.deletedStates[e][p]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][u]===null){this.deletedStates[e][u]={};for(const p in this.state[e][u])o[p]||(this.deletedStates[e][u][p]=null)}else for(const p in o)this.deletedStates[e]&&this.deletedStates[e][u]&&this.deletedStates[e][u][p]===null&&delete this.deletedStates[e][u][p]}removeFeatureState(e,n,o){if(this.deletedStates[e]===null)return;const u=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},o&&n!==void 0)this.deletedStates[e][u]!==null&&(this.deletedStates[e][u]=this.deletedStates[e][u]||{},this.deletedStates[e][u][o]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][u])for(o in this.deletedStates[e][u]={},this.stateChanges[e][u])this.deletedStates[e][u][o]=null;else this.deletedStates[e][u]=null;else this.deletedStates[e]=null}getState(e,n){const o=String(n),u=c.e({},(this.state[e]||{})[o],(this.stateChanges[e]||{})[o]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const p=this.deletedStates[e][n];if(p===null)return{};for(const m in p)delete u[m]}return u}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){const o={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const p={};for(const m in this.stateChanges[u])this.state[u][m]||(this.state[u][m]={}),c.e(this.state[u][m],this.stateChanges[u][m]),p[m]=this.state[u][m];o[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const m in this.state[u])p[m]={},this.state[u][m]={};else for(const m in this.deletedStates[u]){if(this.deletedStates[u][m]===null)this.state[u][m]={};else for(const _ of Object.keys(this.deletedStates[u][m]))delete this.state[u][m][_];p[m]=this.state[u][m]}o[u]=o[u]||{},c.e(o[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(const u in e)e[u].setFeatureState(o,n)}}const U=89.25;function J(d,e){const n=c.an(e.lat,-c.ao,c.ao);return new c.P(c.Y(e.lng)*d,c.X(n)*d)}function tt(d,e){return new c.aa(e.x/d,e.y/d).toLngLat()}function ut(d){return d.cameraToCenterDistance*Math.min(.85*Math.tan(c.ap(90-d.pitch)),Math.tan(c.ap(U-d.pitch)))}function W(d,e){const n=d.canonical,o=e/c.aq(n.z),u=n.x+Math.pow(2,n.z)*d.wrap,p=c.ar(new Float64Array(16));return c.O(p,p,[u*o,n.y*o,0]),c.Q(p,p,[o/c.a4,o/c.a4,1]),p}function ct(d,e,n,o,u){const p=c.aa.fromLngLat(d,e),m=u*c.as(1,d.lat),_=m*Math.cos(c.ap(n)),x=Math.sqrt(m*m-_*_),b=x*Math.sin(c.ap(-o)),T=x*Math.cos(c.ap(-o));return new c.aa(p.x+b,p.y+T,p.z+_)}function yt(d,e,n){const o=e.intersectsFrustum(d);if(!n||o===0)return o;const u=e.intersectsPlane(n);return u===0?0:o===2&&u===2?2:1}function vt(d,e,n){let o=0;const u=(n-e)/10;for(let p=0;p<10;p++)o+=u*Math.pow(Math.cos(e+(p+.5)/10*(n-e)),d);return o}function bt(d,e){return function(n,o,u,p,m){const _=2*((d-1)/c.at(Math.cos(c.ap(U-m))/Math.cos(c.ap(U)))-1),x=Math.acos(u/p),b=2*vt(_-1,0,c.ap(m/2)),T=Math.min(c.ap(U),x+c.ap(m/2)),k=vt(_-1,Math.min(T,x-c.ap(m/2)),T),A=Math.atan(o/u),z=Math.hypot(o,u);let j=n;return j+=c.at(p/z/Math.max(.5,Math.cos(c.ap(m/2)))),j+=_*c.at(Math.cos(A))/2,j-=c.at(Math.max(1,k/b/e))/2,j}}const Ft=bt(9.314,3);function Zt(d,e){const n=(e.roundZoom?Math.round:Math.floor)(d.zoom+c.at(d.tileSize/e.tileSize));return Math.max(0,n)}function te(d,e){const n=d.getCameraFrustum(),o=d.getClippingPlane(),u=d.screenPointToMercatorCoordinate(d.getCameraPoint()),p=c.aa.fromLngLat(d.center,d.elevation);u.z=p.z+Math.cos(d.pitchInRadians)*d.cameraToCenterDistance/d.worldSize;const m=d.getCoveringTilesDetailsProvider(),_=m.allowVariableZoom(d,e),x=Zt(d,e),b=e.minzoom||0,T=e.maxzoom!==void 0?e.maxzoom:d.maxZoom,k=Math.min(Math.max(0,x),T),A=Math.pow(2,k),z=[A*u.x,A*u.y,0],j=[A*p.x,A*p.y,0],$=Math.hypot(p.x-u.x,p.y-u.y),Z=Math.abs(p.z-u.z),H=Math.hypot($,Z),K=rt=>({zoom:0,x:0,y:0,wrap:rt,fullyVisible:!1}),it=[],Y=[];if(d.renderWorldCopies&&m.allowWorldCopies())for(let rt=1;rt<=3;rt++)it.push(K(-rt)),it.push(K(rt));for(it.push(K(0));it.length>0;){const rt=it.pop(),nt=rt.x,Q=rt.y;let lt=rt.fullyVisible;const _t={x:nt,y:Q,z:rt.zoom},pt=m.getTileBoundingVolume(_t,rt.wrap,d.elevation,e);if(!lt){const Et=yt(n,pt,o);if(Et===0)continue;lt=Et===2}const ft=m.distanceToTile2d(u.x,u.y,_t,pt);let gt=x;_&&(gt=(e.calculateTileZoom||Ft)(d.zoom+c.at(d.tileSize/e.tileSize),ft,Z,H,d.fov)),gt=(e.roundZoom?Math.round:Math.floor)(gt),gt=Math.max(0,gt);const Dt=Math.min(gt,T);if(rt.wrap=m.getWrap(p,_t,rt.wrap),rt.zoom>=Dt){if(rt.zoom<b)continue;const Et=k-rt.zoom,St=z[0]-.5-(nt<<Et),jt=z[1]-.5-(Q<<Et),Qt=e.reparseOverscaled?Math.max(rt.zoom,gt):rt.zoom;Y.push({tileID:new c.a1(rt.zoom===T?Qt:rt.zoom,rt.wrap,rt.zoom,nt,Q),distanceSq:c.au([j[0]-.5-nt,j[1]-.5-Q]),tileDistanceToCamera:Math.sqrt(St*St+jt*jt)})}else for(let Et=0;Et<4;Et++)it.push({zoom:rt.zoom+1,x:(nt<<1)+Et%2,y:(Q<<1)+(Et>>1),wrap:rt.wrap,fullyVisible:lt})}return Y.sort(((rt,nt)=>rt.distanceSq-nt.distanceSq)).map((rt=>rt.tileID))}const Ve=c.ab.fromPoints([new c.P(0,0),new c.P(c.a4,c.a4)]);class ne extends c.E{constructor(e,n,o){super(),this.id=e,this.dispatcher=o,this.on("data",(u=>this._dataHandler(u))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((u,p,m,_)=>{const x=new(bs(p.type))(u,p,m,_);if(x.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${x.id}`);return x})(e,n,o,this),this._tiles={},this._cache=new c.av(0,(u=>this._unloadTile(u))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new B,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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 e in this._tiles){const n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,o){return c._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,o)}catch(u){e.state="errored",u.status!==404?this._source.fire(new c.k(u,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new c.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const o=this._tiles[n];o.upload(e),o.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(fe).map((e=>e.key))}getRenderableIds(e){const n=[];for(const o in this._tiles)this._isIdRenderable(o,e)&&n.push(this._tiles[o]);return e?n.sort(((o,u)=>{const p=o.tileID,m=u.tileID,_=new c.P(p.canonical.x,p.canonical.y)._rotate(-this.transform.bearingInRadians),x=new c.P(m.canonical.x,m.canonical.y)._rotate(-this.transform.bearingInRadians);return p.overscaledZ-m.overscaledZ||x.y-_.y||x.x-_.x})).map((o=>o.tileID.key)):n.map((o=>o.tileID)).sort(fe).map((o=>o.key))}hasRenderableParent(e){const n=e.overscaledZ-1;if(n>=this._source.minzoom){const o=this.getLoadedTile(e.scaledTo(n));if(o)return this._isIdRenderable(o.tileID.key)}return!1}_isIdRenderable(e,n=!1){var o;return(o=this._tiles[e])===null||o===void 0?void 0:o.isRenderable(n)}reload(e,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)n&&this._source.shouldReloadTile&&!this._source.shouldReloadTile(this._tiles[o],n)||(e?this._reloadTile(o,"expired"):this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading"))}}_reloadTile(e,n){return c._(this,void 0,void 0,(function*(){const o=this._tiles[e];o&&(o.state!=="loading"&&(o.state=n),yield this._loadTile(o,e,n))}))}_tileLoaded(e,n,o){e.timeAdded=qt(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),o==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new c.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const p=n[u];if(e.neighboringTiles&&e.neighboringTiles[p]){const m=this.getTileByID(p);o(e,m),o(m,e)}}function o(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let m=p.tileID.canonical.x-u.tileID.canonical.x;const _=p.tileID.canonical.y-u.tileID.canonical.y,x=Math.pow(2,u.tileID.canonical.z),b=p.tileID.key;m===0&&_===0||Math.abs(_)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,m,_),u.neighboringTiles&&u.neighboringTiles[b]&&(u.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n){const o=this._getLoadedDescendents(n),u=new Set;for(const p of n){const m=o[p.key];if(!m?.length){u.add(p);continue}const _=p.overscaledZ+ne.maxOverzooming,x=m.filter((k=>k.tileID.overscaledZ<=_));if(!x.length){u.add(p);continue}const b=Math.min(...x.map((k=>k.tileID.overscaledZ))),T=x.filter((k=>k.tileID.overscaledZ===b)).map((k=>k.tileID));for(const k of T)e[k.key]=k;this._areDescendentsComplete(T,b,p.overscaledZ)||u.add(p)}return u}_getLoadedDescendents(e){var n;const o={};for(const u in this._tiles){const p=this._tiles[u];if(p.hasData())for(const m of e)p.tileID.isChildOf(m)&&(o[n=m.key]||(o[n]=[])).push(p)}return o}_areDescendentsComplete(e,n,o){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===n:Math.pow(4,n-o)===e.length}getLoadedTile(e){const n=this._tiles[e.key];return n?.hasData()?n:null}updateCacheSize(e){const n=Math.ceil(e.width/this._source.tileSize)+1,o=Math.ceil(e.height/this._source.tileSize)+1,u=Math.floor(n*o*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}handleWrapJump(e){const n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){const o={};for(const u in this._tiles){const p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),o[p.tileID.key]=p}this._tiles=o,this._resetTileReloadTimers()}}update(e,n){if(!this._sourceLoaded||this._paused)return;let o;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((x=>new c.a1(x.canonical.z,x.wrap,x.canonical.z,x.canonical.x,x.canonical.y))):(o=te(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?e.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&&(o=o.filter((x=>this._source.hasTile(x))))):o=[],this.usedForTerrain&&(o=this._addTerrainIdealTiles(o));const u=o.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,u&&this.fire(new c.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const p=Zt(e,this._source),m=this._updateRetainedTiles(o,p),_=be(this._source.type);_&&this._rasterFadeDuration>0&&!n&&this._updateFadingTiles(o,m),_?this._cleanUpRasterTiles(m):this._cleanUpVectorTiles(m)}_cleanUpRasterTiles(e){for(const n in this._tiles)e[n]||this._removeTile(n)}_cleanUpVectorTiles(e){for(const n in this._tiles){const o=this._tiles[n];e[n]?o.clearSymbolFadeHold():o.hasSymbolBuckets?o.holdingForSymbolFade()?o.symbolFadeFinished()&&this._removeTile(n):o.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(e){const n=[];for(const o of e)if(o.canonical.z>this._source.minzoom){const u=o.scaledTo(o.canonical.z-1);n.push(u);const p=o.scaledTo(Math.max(this._source.minzoom,Math.min(o.canonical.z,5)));n.push(p)}return e.concat(n)}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var o;const u=new Set;for(const b of e)this._addTile(b).hasData()||u.add(b);const p=e.reduce(((b,T)=>(b[T.key]=T,b)),{}),m=this._retainLoadedChildren(p,u),_={},x=Math.max(n-ne.maxUnderzooming,this._source.minzoom);for(const b of m){let T=this._tiles[b.key],k=T?.wasRequested();for(let A=b.overscaledZ-1;A>=x;--A){const z=b.scaledTo(A);if(_[z.key])break;if(_[z.key]=!0,T=this.getTile(z),!T&&k&&(T=this._addTile(z)),T){const j=T.hasData();if((j||!(!((o=this.map)===null||o===void 0)&&o.cancelPendingTileRequestsWhileZooming)||k)&&(p[z.key]=z),k=T.wasRequested(),j)break}}}return p}_updateFadingTiles(e,n){const o=qt(),u=c.aw(e);for(const p of e){const m=this._tiles[p.key];m.fadingDirection!==at.Departing&&m.fadeOpacity!==0||m.resetFadeLogic(),this._updateFadingAncestor(m,n,o)||this._updateFadingDescendents(m,n,o)||this._updateFadingEdge(m,u,o)||m.resetFadeLogic()}}_updateFadingAncestor(e,n,o){if(!e.hasData())return!1;const{tileID:u,fadingRole:p,fadingDirection:m,fadingParentID:_}=e;if(p===Ki.Base&&m===at.Incoming&&_)return n[_.key]=_,!0;const x=Math.max(u.overscaledZ-this._maxFadingAncestorLevels,this._source.minzoom);for(let b=u.overscaledZ-1;b>=x;b--){const T=u.scaledTo(b),k=this.getLoadedTile(T);if(k)return e.setCrossFadeLogic({fadingRole:Ki.Base,fadingDirection:at.Incoming,fadingParentID:k.tileID,fadeEndTime:o+this._rasterFadeDuration}),k.setCrossFadeLogic({fadingRole:Ki.Parent,fadingDirection:at.Departing,fadeEndTime:o+this._rasterFadeDuration}),n[T.key]=T,!0}return!1}_updateFadingDescendents(e,n,o){if(!e.hasData())return!1;const u=e.tileID.children(this._source.maxzoom);let p=this._updateFadingChildren(e,u,n,o);if(p)return!0;for(const m of u){const _=m.children(this._source.maxzoom);this._updateFadingChildren(e,_,n,o)&&(p=!0)}return p}_updateFadingChildren(e,n,o,u){if(n[0].overscaledZ>=this._source.maxzoom)return!1;let p=!1;for(const m of n){const _=this.getLoadedTile(m);if(!_)continue;const{fadingRole:x,fadingDirection:b,fadingParentID:T}=_;x===Ki.Base&&b===at.Departing&&T||(_.setCrossFadeLogic({fadingRole:Ki.Base,fadingDirection:at.Departing,fadingParentID:e.tileID,fadeEndTime:u+this._rasterFadeDuration}),e.setCrossFadeLogic({fadingRole:Ki.Parent,fadingDirection:at.Incoming,fadeEndTime:u+this._rasterFadeDuration})),o[m.key]=m,p=!0}return p}_updateFadingEdge(e,n,o){const u=e.tileID;return!!e.selfFading||!e.hasData()&&!!n.has(u)&&(e.setSelfFadeLogic(o+this._rasterFadeDuration),!0)}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(n.resetFadeLogic(),this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null));const o=n;return n||(n=new F(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,o||this._source.fire(new c.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){this._clearTileReloadTimer(e);const o=n.getExpiryTimeout();o&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),o))}_clearTileReloadTimer(e){const n=this._timers[e];n&&(clearTimeout(n),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}refreshTiles(e){for(const n in this._tiles)(this._isIdRenderable(n)||this._tiles[n].state=="errored")&&e.some((o=>o.equals(this._tiles[n].tileID.canonical)))&&this._reloadTile(n,"expired")}_removeTile(e){const n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._clearTileReloadTimer(e),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){e.dataType==="source"&&(e.sourceDataType!=="metadata"?e.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,o){const u=[],p=this.transform;if(!p)return u;const m=p.getCoveringTilesDetailsProvider().allowWorldCopies(),_=o?p.getCameraQueryGeometry(e):e,x=z=>p.screenPointToMercatorCoordinate(z,this.terrain),b=this.transformBbox(e,x,!m),T=this.transformBbox(_,x,!m),k=this.getIds(),A=c.ab.fromPoints(T);for(let z=0;z<k.length;z++){const j=this._tiles[k[z]];if(j.holdingForSymbolFade())continue;const $=m?[j.tileID]:[j.tileID.unwrapTo(-1),j.tileID.unwrapTo(0)],Z=Math.pow(2,p.zoom-j.tileID.overscaledZ),H=n*j.queryPadding*c.a4/j.tileSize/Z;for(const K of $){const it=A.map((Y=>K.getTilePoint(new c.aa(Y.x,Y.y))));if(it.expandBy(H),it.intersects(Ve)){const Y=b.map((nt=>K.getTilePoint(nt))),rt=T.map((nt=>K.getTilePoint(nt)));u.push({tile:j,tileID:m?K:K.unwrapTo(0),queryGeometry:Y,cameraQueryGeometry:rt,scale:Z})}}}return u}transformBbox(e,n,o){let u=e.map(n);if(o){const p=c.ab.fromPoints(e);p.shrinkBy(.001*Math.min(p.width(),p.height()));const m=p.map(n);c.ab.fromPoints(u).covers(m)||(u=u.map((_=>_.x>.5?new c.aa(_.x-1,_.y,_.z):_)))}return u}getVisibleCoordinates(e){const n=this.getRenderableIds(e).map((o=>this._tiles[o].tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){if(this._source.hasTransition())return!0;if(be(this._source.type)&&this._rasterFadeDuration>0){const e=qt();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,n,o){this._state.updateState(e=e||c.a9,n,o)}removeFeatureState(e,n,o){this._state.removeFeatureState(e=e||c.a9,n,o)}getFeatureState(e,n){return this._state.getState(e=e||c.a9,n)}setDependencies(e,n,o){const u=this._tiles[e];u&&u.setDependencies(n,o)}reloadTilesForDependencies(e,n){for(const o in this._tiles)this._tiles[o].hasDependency(e,n)&&this._reloadTile(o,"reloading");this._cache.filter((o=>!o.hasDependency(e,n)))}}function fe(d,e){const n=Math.abs(2*d.wrap)-+(d.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return d.overscaledZ-e.overscaledZ||o-n||e.canonical.y-d.canonical.y||e.canonical.x-d.canonical.x}function be(d){return d==="raster"||d==="image"||d==="video"}ne.maxUnderzooming=10,ne.maxOverzooming=3;class It{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let o=1;o<this.points.length;o++)this._distances[o]=this._distances[o-1]+this.points[o].dist(this.points[o-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(e){if(this.points.length===1)return this.points[0];e=c.an(e,0,1);let n=1,o=this._distances[n];const u=e*this.paddedLength+this.padding;for(;o<u&&n<this._distances.length;)o=this._distances[++n];const p=n-1,m=this._distances[p],_=o-m,x=_>0?(u-m)/_:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}function Ee(d,e){let n=!0;return d==="always"||d!=="never"&&e!=="never"||(n=!1),n}class we{constructor(e,n,o){const u=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(e/o),this.yCellCount=Math.ceil(n/o);for(let m=0;m<this.xCellCount*this.yCellCount;m++)u.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,o,u,p){this._forEachCell(n,o,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(p)}insertCircle(e,n,o,u){this._forEachCell(n-u,o-u,n+u,o+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(o),this.circles.push(u)}_insertBoxCell(e,n,o,u,p,m){this.boxCells[p].push(m)}_insertCircleCell(e,n,o,u,p,m){this.circleCells[p].push(m)}_query(e,n,o,u,p,m,_){if(o<0||e>this.width||u<0||n>this.height)return[];const x=[];if(e<=0&&n<=0&&this.width<=o&&this.height<=u){if(p)return[{key:null,x1:e,y1:n,x2:o,y2:u}];for(let b=0;b<this.boxKeys.length;b++)x.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],k=this.circles[3*b+1],A=this.circles[3*b+2];x.push({key:this.circleKeys[b],x1:T-A,y1:k-A,x2:T+A,y2:k+A})}}else this._forEachCell(e,n,o,u,this._queryCell,x,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},_);return x}query(e,n,o,u){return this._query(e,n,o,u,!1,null)}hitTest(e,n,o,u,p,m){return this._query(e,n,o,u,!0,p,m).length>0}hitTestCircle(e,n,o,u,p){const m=e-o,_=e+o,x=n-o,b=n+o;if(_<0||m>this.width||b<0||x>this.height)return!1;const T=[];return this._forEachCell(m,x,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:u,circle:{x:e,y:n,radius:o},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(e,n,o,u,p,m,_,x){const{seenUids:b,hitTest:T,overlapMode:k}=_,A=this.boxCells[p];if(A!==null){const j=this.bboxes;for(const $ of A)if(!b.box[$]){b.box[$]=!0;const Z=4*$,H=this.boxKeys[$];if(e<=j[Z+2]&&n<=j[Z+3]&&o>=j[Z+0]&&u>=j[Z+1]&&(!x||x(H))&&(!T||!Ee(k,H.overlapMode))&&(m.push({key:H,x1:j[Z],y1:j[Z+1],x2:j[Z+2],y2:j[Z+3]}),T))return!0}}const z=this.circleCells[p];if(z!==null){const j=this.circles;for(const $ of z)if(!b.circle[$]){b.circle[$]=!0;const Z=3*$,H=this.circleKeys[$];if(this._circleAndRectCollide(j[Z],j[Z+1],j[Z+2],e,n,o,u)&&(!x||x(H))&&(!T||!Ee(k,H.overlapMode))){const K=j[Z],it=j[Z+1],Y=j[Z+2];if(m.push({key:H,x1:K-Y,y1:it-Y,x2:K+Y,y2:it+Y}),T)return!0}}}return!1}_queryCellCircle(e,n,o,u,p,m,_,x){const{circle:b,seenUids:T,overlapMode:k}=_,A=this.boxCells[p];if(A!==null){const j=this.bboxes;for(const $ of A)if(!T.box[$]){T.box[$]=!0;const Z=4*$,H=this.boxKeys[$];if(this._circleAndRectCollide(b.x,b.y,b.radius,j[Z+0],j[Z+1],j[Z+2],j[Z+3])&&(!x||x(H))&&!Ee(k,H.overlapMode))return m.push(!0),!0}}const z=this.circleCells[p];if(z!==null){const j=this.circles;for(const $ of z)if(!T.circle[$]){T.circle[$]=!0;const Z=3*$,H=this.circleKeys[$];if(this._circlesCollide(j[Z],j[Z+1],j[Z+2],b.x,b.y,b.radius)&&(!x||x(H))&&!Ee(k,H.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,o,u,p,m,_,x){const b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),k=this._convertToXCellCoord(o),A=this._convertToYCellCoord(u);for(let z=b;z<=k;z++)for(let j=T;j<=A;j++)if(p.call(this,e,n,o,u,this.xCellCount*j+z,m,_,x))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,o,u,p,m){const _=u-e,x=p-n,b=o+m;return b*b>_*_+x*x}_circleAndRectCollide(e,n,o,u,p,m,_){const x=(m-u)/2,b=Math.abs(e-(u+x));if(b>x+o)return!1;const T=(_-p)/2,k=Math.abs(n-(p+T));if(k>T+o)return!1;if(b<=x||k<=T)return!0;const A=b-x,z=k-T;return A*A+z*z<=o*o}}function ti(d,e,n){const o=c.N();if(!d){const{vecSouth:k,vecEast:A}=Ct(e),z=Rt();z[0]=A[0],z[1]=A[1],z[2]=k[0],z[3]=k[1],u=z,(T=(m=(p=z)[0])*(b=p[3])-(x=p[2])*(_=p[1]))&&(u[0]=b*(T=1/T),u[1]=-_*T,u[2]=-x*T,u[3]=m*T),o[0]=z[0],o[1]=z[1],o[4]=z[2],o[5]=z[3]}var u,p,m,_,x,b,T;return c.Q(o,o,[1/n,1/n,1]),o}function Te(d,e,n,o){if(d){const u=c.N();if(!e){const{vecSouth:p,vecEast:m}=Ct(n);u[0]=m[0],u[1]=m[1],u[4]=p[0],u[5]=p[1]}return c.Q(u,u,[o,o,1]),u}return n.pixelsToClipSpaceMatrix}function Ct(d){const e=Math.cos(d.rollInRadians),n=Math.sin(d.rollInRadians),o=Math.cos(d.pitchInRadians),u=Math.cos(d.bearingInRadians),p=Math.sin(d.bearingInRadians),m=c.aB();m[0]=-u*o*n-p*e,m[1]=-p*o*n+u*e;const _=c.aC(m);_<1e-9?c.aD(m):c.aE(m,m,1/_);const x=c.aB();x[0]=u*o*e-p*n,x[1]=p*o*e+u*n;const b=c.aC(x);return b<1e-9?c.aD(x):c.aE(x,x,1/b),{vecEast:x,vecSouth:m}}function Nt(d,e,n,o){let u;o?(u=[d,e,o(d,e),1],c.aG(u,u,n)):(u=[d,e,0,1],ea(u,u,n));const p=u[3];return{point:new c.P(u[0]/p,u[1]/p),signedDistanceFromCamera:p,isOccluded:!1}}function Xt(d,e){return .5+d/e*.5}function $i(d,e){return d.x>=-e[0]&&d.x<=e[0]&&d.y>=-e[1]&&d.y<=e[1]}function Yn(d,e,n,o,u,p,m,_,x,b,T,k,A){const z=n?d.textSizeData:d.iconSizeData,j=c.ax(z,e.transform.zoom),$=[256/e.width*2+1,256/e.height*2+1],Z=n?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;Z.clear();const H=d.lineVertexArray,K=n?d.text.placedSymbolArray:d.icon.placedSymbolArray,it=e.transform.width/e.transform.height;let Y=!1;for(let rt=0;rt<K.length;rt++){const nt=K.get(rt);if(nt.hidden||nt.writingMode===c.ay.vertical&&!Y){Ur(nt.numGlyphs,Z);continue}Y=!1;const Q=new c.P(nt.anchorX,nt.anchorY),lt={getElevation:A,pitchedLabelPlaneMatrix:o,lineVertexArray:H,pitchWithMap:p,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:Q,unwrappedTileID:x,width:b,height:T,translation:k},_t=Ps(nt.anchorX,nt.anchorY,lt);if(!$i(_t.point,$)){Ur(nt.numGlyphs,Z);continue}const pt=Xt(e.transform.cameraToCenterDistance,_t.signedDistanceFromCamera),ft=c.az(z,j,nt),gt=p?ft*e.transform.getPitchedTextCorrection(nt.anchorX,nt.anchorY,x)/pt:ft*pt,Dt=en({projectionContext:lt,pitchedLabelPlaneMatrixInverse:u,symbol:nt,fontSize:gt,flip:!1,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:Z,aspectRatio:it,rotateToLine:_});Y=Dt.useVertical,(Dt.notEnoughRoom||Y||Dt.needsFlipping&&en({projectionContext:lt,pitchedLabelPlaneMatrixInverse:u,symbol:nt,fontSize:gt,flip:!0,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:Z,aspectRatio:it,rotateToLine:_}).notEnoughRoom)&&Ur(nt.numGlyphs,Z)}n?d.text.dynamicLayoutVertexBuffer.updateData(Z):d.icon.dynamicLayoutVertexBuffer.updateData(Z)}function hi(d,e,n,o,u,p,m,_){const x=p.glyphStartIndex+p.numGlyphs,b=p.lineStartIndex,T=p.lineStartIndex+p.lineLength,k=e.getoffsetX(p.glyphStartIndex),A=e.getoffsetX(x-1),z=Se(d*k,n,o,u,p.segment,b,T,_,m);if(!z)return null;const j=Se(d*A,n,o,u,p.segment,b,T,_,m);return j?_.projectionCache.anyProjectionOccluded?null:{first:z,last:j}:null}function Kt(d,e,n,o){return d===c.ay.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*o?{useVertical:!0}:(d===c.ay.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function en(d){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:n,symbol:o,fontSize:u,flip:p,keepUpright:m,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:b,rotateToLine:T}=d,k=u/24,A=o.lineOffsetX*k,z=o.lineOffsetY*k;let j;if(o.numGlyphs>1){const $=o.glyphStartIndex+o.numGlyphs,Z=o.lineStartIndex,H=o.lineStartIndex+o.lineLength,K=hi(k,_,A,z,p,o,T,e);if(!K)return{notEnoughRoom:!0};const it=Kn(K.first.point.x,K.first.point.y,e,n),Y=Kn(K.last.point.x,K.last.point.y,e,n);if(m&&!p){const rt=Kt(o.writingMode,it,Y,b);if(rt)return rt}j=[K.first];for(let rt=o.glyphStartIndex+1;rt<$-1;rt++){const nt=Se(k*_.getoffsetX(rt),A,z,p,o.segment,Z,H,e,T);if(!nt)return{notEnoughRoom:!0};j.push(nt)}j.push(K.last)}else{if(m&&!p){const Z=br(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,H=o.lineStartIndex+o.segment+1,K=new c.P(e.lineVertexArray.getx(H),e.lineVertexArray.gety(H)),it=br(K.x,K.y,e),Y=it.signedDistanceFromCamera>0?it.point:Ts(e.tileAnchorPoint,K,Z,1,e),rt=Kn(Z.x,Z.y,e,n),nt=Kn(Y.x,Y.y,e,n),Q=Kt(o.writingMode,rt,nt,b);if(Q)return Q}const $=Se(k*_.getoffsetX(o.glyphStartIndex),A,z,p,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,e,T);if(!$||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};j=[$]}for(const $ of j)c.aF(x,$.point,$.angle);return{}}function Ts(d,e,n,o,u){const p=d.add(d.sub(e)._unit()),m=br(p.x,p.y,u).point,_=n.sub(m);return n.add(_._mult(o/_.mag()))}function Ss(d,e,n){const o=e.projectionCache;if(o.projections[d])return o.projections[d];const u=new c.P(e.lineVertexArray.getx(d),e.lineVertexArray.gety(d)),p=br(u.x,u.y,e);if(p.signedDistanceFromCamera>0)return o.projections[d]=p.point,o.anyProjectionOccluded=o.anyProjectionOccluded||p.isOccluded,p.point;const m=d-n.direction;return Ts(n.distanceFromAnchor===0?e.tileAnchorPoint:new c.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),u,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function br(d,e,n){const o=d+n.translation[0],u=e+n.translation[1];let p;return n.pitchWithMap?(p=Nt(o,u,n.pitchedLabelPlaneMatrix,n.getElevation),p.isOccluded=!1):(p=n.transform.projectTileCoordinates(o,u,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 Kn(d,e,n,o){if(n.pitchWithMap){const u=[d,e,0,1];return c.aG(u,u,o),n.transform.projectTileCoordinates(u[0]/u[3],u[1]/u[3],n.unwrappedTileID,n.getElevation).point}return{x:d/n.width*2-1,y:1-e/n.height*2}}function Ps(d,e,n){return n.transform.projectTileCoordinates(d,e,n.unwrappedTileID,n.getElevation)}function Ms(d,e,n){return d._unit()._perp()._mult(e*n)}function Ji(d,e,n,o,u,p,m,_,x){if(_.projectionCache.offsets[d])return _.projectionCache.offsets[d];const b=n.add(e);if(d+x.direction<o||d+x.direction>=u)return _.projectionCache.offsets[d]=b,b;const T=Ss(d+x.direction,_,x),k=Ms(T.sub(n),m,x.direction),A=n.add(k),z=T.add(k);return _.projectionCache.offsets[d]=c.aH(p,b,A,z)||b,_.projectionCache.offsets[d]}function Se(d,e,n,o,u,p,m,_,x){const b=o?d-e:d+e;let T=b>0?1:-1,k=0;o&&(T*=-1,k=Math.PI),T<0&&(k+=Math.PI);let A,z=T>0?p+u:p+u+1;_.projectionCache.cachedAnchorPoint?A=_.projectionCache.cachedAnchorPoint:(A=br(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=A);let j,$,Z=A,H=A,K=0,it=0;const Y=Math.abs(b),rt=[];let nt;for(;K+it<=Y;){if(z+=T,z<p||z>=m)return null;K+=it,H=Z,$=j;const _t={absOffsetX:Y,direction:T,distanceFromAnchor:K,previousVertex:H};if(Z=Ss(z,_,_t),n===0)rt.push(H),nt=Z.sub(H);else{let pt;const ft=Z.sub(H);pt=ft.mag()===0?Ms(Ss(z+T,_,_t).sub(Z),n,T):Ms(ft,n,T),$||($=H.add(pt)),j=Ji(z,pt,Z,p,m,$,n,_,_t),rt.push($),nt=j.sub($)}it=nt.mag()}const Q=nt._mult((Y-K)/it)._add($||H),lt=k+Math.atan2(Z.y-H.y,Z.x-H.x);return rt.push(Q),{point:Q,angle:x?lt:0,path:rt}}const nh=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ur(d,e){for(let n=0;n<d;n++){const o=e.length;e.resize(o+4),e.float32.set(nh,3*o)}}function ea(d,e,n){const o=e[0],u=e[1];return d[0]=n[0]*o+n[4]*u+n[12],d[1]=n[1]*o+n[5]*u+n[13],d[3]=n[3]*o+n[7]*u+n[15],d}const Fe=100;class Pn{constructor(e,n=new we(e.width+200,e.height+200,25),o=new we(e.width+200,e.height+200,25)){this.transform=e,this.grid=n,this.ignoredGrid=o,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Fe,this.screenBottomBoundary=e.height+Fe,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,n,o,u,p,m,_,x,b,T,k,A){const z=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],p,T,A),j=o*z.perspectiveRatio;let $;if(m||_)$=this._projectCollisionBox(e,j,u,p,m,_,x,z,T,k,A);else{const nt=z.x+(k?k.x*j:0),Q=z.y+(k?k.y*j:0);$={allPointsOccluded:!1,box:[nt+e.x1*j,Q+e.y1*j,nt+e.x2*j,Q+e.y2*j]}}const[Z,H,K,it]=$.box,Y=m?$.allPointsOccluded:z.isOccluded;let rt=Y;return rt||(rt=z.perspectiveRatio<this.perspectiveRatioCutoff),rt||(rt=!this.isInsideGrid(Z,H,K,it)),rt||n!=="always"&&this.grid.hitTest(Z,H,K,it,n,b)?{box:[Z,H,K,it],placeable:!1,offscreen:!1,occluded:Y}:{box:[Z,H,K,it],placeable:!0,offscreen:this.isOffscreen(Z,H,K,it),occluded:Y}}placeCollisionCircles(e,n,o,u,p,m,_,x,b,T,k,A,z,j){const $=[],Z=new c.P(n.anchorX,n.anchorY),H=this.getPerspectiveRatio(Z.x,Z.y,m,j),K=(b?p*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,m)/H:p*H)/c.aL,it={getElevation:j,pitchedLabelPlaneMatrix:_,lineVertexArray:o,pitchWithMap:b,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:Z,unwrappedTileID:m,width:this.transform.width,height:this.transform.height,translation:z},Y=hi(K,u,n.lineOffsetX*K,n.lineOffsetY*K,!1,n,!1,it);let rt=!1,nt=!1,Q=!0;if(Y){const lt=.5*k*H+A,_t=new c.P(-100,-100),pt=new c.P(this.screenRightBoundary,this.screenBottomBoundary),ft=new It,gt=Y.first,Dt=Y.last;let Et=[];for(let Qt=gt.path.length-1;Qt>=1;Qt--)Et.push(gt.path[Qt]);for(let Qt=1;Qt<Dt.path.length;Qt++)Et.push(Dt.path[Qt]);const St=2.5*lt;if(b){const Qt=this.projectPathToScreenSpace(Et,it);Et=Qt.some((Jt=>Jt.signedDistanceFromCamera<=0))?[]:Qt.map((Jt=>Jt.point))}let jt=[];if(Et.length>0){const Qt=Et[0].clone(),Jt=Et[0].clone();for(let Me=1;Me<Et.length;Me++)Qt.x=Math.min(Qt.x,Et[Me].x),Qt.y=Math.min(Qt.y,Et[Me].y),Jt.x=Math.max(Jt.x,Et[Me].x),Jt.y=Math.max(Jt.y,Et[Me].y);jt=Qt.x>=_t.x&&Jt.x<=pt.x&&Qt.y>=_t.y&&Jt.y<=pt.y?[Et]:Jt.x<_t.x||Qt.x>pt.x||Jt.y<_t.y||Qt.y>pt.y?[]:c.aI([Et],_t.x,_t.y,pt.x,pt.y)}for(const Qt of jt){ft.reset(Qt,.25*lt);let Jt=0;Jt=ft.length<=.5*lt?1:Math.ceil(ft.paddedLength/St)+1;for(let Me=0;Me<Jt;Me++){const Ie=Me/Math.max(Jt-1,1),Oe=ft.lerp(Ie),ye=Oe.x+Fe,ri=Oe.y+Fe;$.push(ye,ri,lt,0);const De=ye-lt,Ye=ri-lt,We=ye+lt,Ke=ri+lt;if(Q=Q&&this.isOffscreen(De,Ye,We,Ke),nt=nt||this.isInsideGrid(De,Ye,We,Ke),e!=="always"&&this.grid.hitTestCircle(ye,ri,lt,e,T)&&(rt=!0,!x))return{circles:[],offscreen:!1,collisionDetected:rt}}}}return{circles:!x&&rt||!nt||H<this.perspectiveRatioCutoff?[]:$,offscreen:Q,collisionDetected:rt}}projectPathToScreenSpace(e,n){const o=(function(u,p){const m=c.N();return c.aA(m,p.pitchedLabelPlaneMatrix),u.map((_=>{const x=Nt(_.x,_.y,m,p.getElevation),b=p.transform.projectTileCoordinates(x.point.x,x.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}))})(e,n);return(function(u){let p=0,m=0,_=0,x=0;for(let b=0;b<u.length;b++)u[b].isOccluded?(_=b+1,x=0):(x++,x>m&&(m=x,p=_));return u.slice(p,p+m)})(o)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],o=new c.ab;for(const k of e){const A=new c.P(k.x+Fe,k.y+Fe);o.extend(A),n.push(A)}const{minX:u,minY:p,maxX:m,maxY:_}=o,x=this.grid.query(u,p,m,_).concat(this.ignoredGrid.query(u,p,m,_)),b={},T={};for(const k of x){const A=k.key;if(b[A.bucketInstanceId]===void 0&&(b[A.bucketInstanceId]={}),b[A.bucketInstanceId][A.featureIndex])continue;const z=[new c.P(k.x1,k.y1),new c.P(k.x2,k.y1),new c.P(k.x2,k.y2),new c.P(k.x1,k.y2)];c.aJ(n,z)&&(b[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(e,n,o,u,p,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,o,u,p,m){const _=o?this.ignoredGrid:this.grid,x={bucketInstanceId:u,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let b=0;b<e.length;b+=4)_.insertCircle(x,e[b],e[b+1],e[b+2])}projectAndGetPerspectiveRatio(e,n,o,u,p){if(p){let m;u?(m=[e,n,u(e,n),1],c.aG(m,m,p)):(m=[e,n,0,1],ea(m,m,p));const _=m[3];return{x:(m[0]/_+1)/2*this.transform.width+Fe,y:(-m[1]/_+1)/2*this.transform.height+Fe,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const m=this.transform.projectTileCoordinates(e,n,o,u);return{x:(m.point.x+1)/2*this.transform.width+Fe,y:(1-m.point.y)/2*this.transform.height+Fe,perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}}getPerspectiveRatio(e,n,o,u){const p=this.transform.projectTileCoordinates(e,n,o,u);return .5+this.transform.cameraToCenterDistance/p.signedDistanceFromCamera*.5}isOffscreen(e,n,o,u){return o<Fe||e>=this.screenRightBoundary||u<Fe||n>this.screenBottomBoundary}isInsideGrid(e,n,o,u){return o>=0&&e<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const e=c.ar([]);return c.O(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,o,u,p,m,_,x,b,T,k){let A=1,z=0,j=0,$=1;const Z=e.anchorPointX+_[0],H=e.anchorPointY+_[1];if(m&&!p){const Et=this.projectAndGetPerspectiveRatio(Z+1,H,u,b,k),St=Et.x-x.x,jt=Math.atan((Et.y-x.y)/St)+(St<0?Math.PI:0),Qt=Math.sin(jt),Jt=Math.cos(jt);A=Jt,z=Qt,j=-Qt,$=Jt}else if(!m&&p){const Et=Ct(this.transform);A=Et.vecEast[0],z=Et.vecEast[1],j=Et.vecSouth[0],$=Et.vecSouth[1]}let K=x.x,it=x.y,Y=n;p&&(K=Z,it=H,Y=Math.pow(2,-(this.transform.zoom-o.overscaledZ)),Y*=this.transform.getPitchedTextCorrection(Z,H,u),T||(Y*=c.an(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),T&&(K+=A*T.x*Y+j*T.y*Y,it+=z*T.x*Y+$*T.y*Y);const rt=e.x1*Y,nt=e.x2*Y,Q=(rt+nt)/2,lt=e.y1*Y,_t=e.y2*Y,pt=(lt+_t)/2,ft=[{offsetX:rt,offsetY:lt},{offsetX:Q,offsetY:lt},{offsetX:nt,offsetY:lt},{offsetX:nt,offsetY:pt},{offsetX:nt,offsetY:_t},{offsetX:Q,offsetY:_t},{offsetX:rt,offsetY:_t},{offsetX:rt,offsetY:pt}];let gt=[];for(const{offsetX:Et,offsetY:St}of ft)gt.push(new c.P(K+A*Et+j*St,it+z*Et+$*St));let Dt=!1;if(p){const Et=gt.map((St=>this.projectAndGetPerspectiveRatio(St.x,St.y,u,b,k)));Dt=Et.some((St=>!St.isOccluded)),gt=Et.map((St=>new c.P(St.x,St.y)))}else Dt=!0;return{box:c.aK(gt),allPointsOccluded:!Dt}}}class Ko{constructor(e,n,o,u){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):u&&o?1:0,this.placed=o}isHidden(){return this.opacity===0&&!this.placed}}class Is{constructor(e,n,o,u,p){this.text=new Ko(e?e.text:null,n,o,p),this.icon=new Ko(e?e.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Jo{constructor(e,n,o){this.text=e,this.icon=n,this.skipFade=o}}class Es{constructor(e,n,o,u,p){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=o,this.bucketIndex=u,this.tileID=p}}class wc{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:o=>o.collisionGroupID===n}}return this.collisionGroups[e]}}function Tc(d,e,n,o,u){const{horizontalAlign:p,verticalAlign:m}=c.aR(d);return new c.P(-(p-.5)*e+o[0]*u,-(m-.5)*n+o[1]*u)}class sh{constructor(e,n,o,u,p){this.transform=e.clone(),this.terrain=n,this.collisionIndex=new Pn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new wc(u),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const n=this.terrain;return n?(o,u)=>n.getElevation(e,o,u):null}getBucketParts(e,n,o,u){const p=o.getBucket(n),m=o.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=o.collisionBoxArray,x=p.layers[0].layout,b=p.layers[0].paint,T=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),k=o.tileSize/c.a4,A=o.tileID.toUnwrapped(),z=x.get("text-rotation-alignment")==="map",j=c.aM(o,1,this.transform.zoom),$=c.aN(this.collisionIndex.transform,o,b.get("text-translate"),b.get("text-translate-anchor")),Z=c.aN(this.collisionIndex.transform,o,b.get("icon-translate"),b.get("icon-translate-anchor")),H=ti(z,this.transform,j);this.retainedQueryData[p.bucketInstanceId]=new Es(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,o.tileID);const K={bucket:p,layout:x,translationText:$,translationIcon:Z,unwrappedTileID:A,pitchedLabelPlaneMatrix:H,scale:T,textPixelRatio:k,holdingForFade:o.holdingForSymbolFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.ax(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const it of p.sortKeyRanges){const{sortKey:Y,symbolInstanceStart:rt,symbolInstanceEnd:nt}=it;e.push({sortKey:Y,symbolInstanceStart:rt,symbolInstanceEnd:nt,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,n,o,u,p,m,_,x,b,T,k,A,z,j,$,Z,H,K,it,Y){const rt=c.aO[e.textAnchor],nt=[e.textOffset0,e.textOffset1],Q=Tc(rt,o,u,nt,p),lt=this.collisionIndex.placeCollisionBox(n,A,x,b,T,_,m,Z,k.predicate,it,Q,Y);if((!K||this.collisionIndex.placeCollisionBox(K,A,x,b,T,_,m,H,k.predicate,it,Q,Y).placeable)&<.placeable){let _t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(_t=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:nt,width:o,height:u,anchor:rt,textBoxScale:p,prevAnchor:_t},this.markUsedJustification(j,rt,z,$),j.allowVerticalPlacement&&(this.markUsedOrientation(j,$,z),this.placedOrientations[z.crossTileID]=$),{shift:Q,placedGlyphBoxes:lt}}}placeLayerBucketPart(e,n,o){const{bucket:u,layout:p,translationText:m,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:b,textPixelRatio:T,holdingForFade:k,collisionBoxArray:A,partiallyEvaluatedTextSize:z,collisionGroup:j}=e.parameters,$=p.get("text-optional"),Z=p.get("icon-optional"),H=c.aP(p,"text-overlap","text-allow-overlap"),K=H==="always",it=c.aP(p,"icon-overlap","icon-allow-overlap"),Y=it==="always",rt=p.get("text-rotation-alignment")==="map",nt=p.get("text-pitch-alignment")==="map",Q=p.get("icon-text-fit")!=="none",lt=p.get("symbol-z-order")==="viewport-y",_t=K&&(Y||!u.hasIconData()||Z),pt=Y&&(K||!u.hasTextData()||$);!u.collisionArrays&&A&&u.deserializeCollisionBoxes(A);const ft=this.retainedQueryData[u.bucketInstanceId].tileID,gt=this._getTerrainElevationFunc(ft),Dt=this.transform.getFastPathSimpleProjectionMatrix(ft),Et=(St,jt,Qt)=>{var Jt,Me;if(n[St.crossTileID])return;if(k)return void(this.placements[St.crossTileID]=new Jo(!1,!1,!1));let Ie=!1,Oe=!1,ye=!0,ri=null,De={box:null,placeable:!1,offscreen:null,occluded:!1},Ye={placeable:!1},We=null,Ke=null,Xi=null,on=0,Hr=0,zn=0;jt.textFeatureIndex?on=jt.textFeatureIndex:St.useRuntimeCollisionCircles&&(on=St.featureIndex),jt.verticalTextFeatureIndex&&(Hr=jt.verticalTextFeatureIndex);const Rn=jt.textBox;if(Rn){const Qi=Ge=>{let je=c.ay.horizontal;if(u.allowVerticalPlacement&&!Ge&&this.prevPlacement){const ni=this.prevPlacement.placedOrientations[St.crossTileID];ni&&(this.placedOrientations[St.crossTileID]=ni,je=ni,this.markUsedOrientation(u,je,St))}return je},cn=(Ge,je)=>{if(u.allowVerticalPlacement&&St.numVerticalGlyphVertices>0&&jt.verticalTextBox){for(const ni of u.writingModes)if(ni===c.ay.vertical?(De=je(),Ye=De):De=Ge(),De&&De.placeable)break}else De=Ge()},ds=St.textAnchorOffsetStartIndex,ps=St.textAnchorOffsetEndIndex;if(ps===ds){const Ge=(je,ni)=>{const xe=this.collisionIndex.placeCollisionBox(je,H,T,ft,x,nt,rt,m,j.predicate,gt,void 0,Dt);return xe&&xe.placeable&&(this.markUsedOrientation(u,ni,St),this.placedOrientations[St.crossTileID]=ni),xe};cn((()=>Ge(Rn,c.ay.horizontal)),(()=>{const je=jt.verticalTextBox;return u.allowVerticalPlacement&&St.numVerticalGlyphVertices>0&&je?Ge(je,c.ay.vertical):{box:null,offscreen:null}})),Qi(De&&De.placeable)}else{let Ge=c.aO[(Me=(Jt=this.prevPlacement)===null||Jt===void 0?void 0:Jt.variableOffsets[St.crossTileID])===null||Me===void 0?void 0:Me.anchor];const je=(xe,Ln,Tu)=>{const Su=xe.x2-xe.x1,Pu=xe.y2-xe.y1,fs=St.textBoxScale,Ch=Q&&it==="never"?Ln:null;let Fn=null,Eo=H==="never"?1:2,Wl="never";Ge&&Eo++;for(let Bn=0;Bn<Eo;Bn++){for(let un=ds;un<ps;un++){const Hl=u.textAnchorOffsets.get(un);if(Ge&&Hl.textAnchor!==Ge)continue;const Xl=this.attemptAnchorPlacement(Hl,xe,Su,Pu,fs,rt,nt,T,ft,x,j,Wl,St,u,Tu,m,_,Ch,gt);if(Xl&&(Fn=Xl.placedGlyphBoxes,Fn&&Fn.placeable))return Ie=!0,ri=Xl.shift,Fn}Ge?Ge=null:Wl=H}return o&&!Fn&&(Fn={box:this.collisionIndex.placeCollisionBox(Rn,"always",T,ft,x,nt,rt,m,j.predicate,gt,void 0,Dt).box,offscreen:!1,placeable:!1,occluded:!1}),Fn};cn((()=>je(Rn,jt.iconBox,c.ay.horizontal)),(()=>{const xe=jt.verticalTextBox;return u.allowVerticalPlacement&&(!De||!De.placeable)&&St.numVerticalGlyphVertices>0&&xe?je(xe,jt.verticalIconBox,c.ay.vertical):{box:null,occluded:!0,offscreen:null}})),De&&(Ie=De.placeable,ye=De.offscreen);const ni=Qi(De&&De.placeable);if(!Ie&&this.prevPlacement){const xe=this.prevPlacement.variableOffsets[St.crossTileID];xe&&(this.variableOffsets[St.crossTileID]=xe,this.markUsedJustification(u,xe.anchor,St,ni))}}}if(We=De,Ie=We&&We.placeable,ye=We&&We.offscreen,St.useRuntimeCollisionCircles&&St.centerJustifiedTextSymbolIndex>=0){const Qi=u.text.placedSymbolArray.get(St.centerJustifiedTextSymbolIndex),cn=c.az(u.textSizeData,z,Qi),ds=p.get("text-padding");Ke=this.collisionIndex.placeCollisionCircles(H,Qi,u.lineVertexArray,u.glyphOffsetArray,cn,x,b,o,nt,j.predicate,St.collisionCircleDiameter,ds,m,gt),Ke.circles.length&&Ke.collisionDetected&&!o&&c.w("Collisions detected, but collision boxes are not shown"),Ie=K||Ke.circles.length>0&&!Ke.collisionDetected,ye=ye&&Ke.offscreen}if(jt.iconFeatureIndex&&(zn=jt.iconFeatureIndex),jt.iconBox){const Qi=cn=>this.collisionIndex.placeCollisionBox(cn,it,T,ft,x,nt,rt,_,j.predicate,gt,Q&&ri?ri:void 0,Dt);Ye&&Ye.placeable&&jt.verticalIconBox?(Xi=Qi(jt.verticalIconBox),Oe=Xi.placeable):(Xi=Qi(jt.iconBox),Oe=Xi.placeable),ye=ye&&Xi.offscreen}const hs=$||St.numHorizontalGlyphVertices===0&&St.numVerticalGlyphVertices===0,ur=Z||St.numIconVertices===0;hs||ur?ur?hs||(Oe=Oe&&Ie):Ie=Oe&&Ie:Oe=Ie=Oe&&Ie;const ln=Oe&&Xi.placeable;if(Ie&&We.placeable&&this.collisionIndex.insertCollisionBox(We.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,Ye&&Ye.placeable&&Hr?Hr:on,j.ID),ln&&this.collisionIndex.insertCollisionBox(Xi.box,it,p.get("icon-ignore-placement"),u.bucketInstanceId,zn,j.ID),Ke&&Ie&&this.collisionIndex.insertCollisionCircles(Ke.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,on,j.ID),o&&this.storeCollisionData(u.bucketInstanceId,Qt,jt,We,Xi,Ke),St.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[St.crossTileID]=new Jo((Ie||_t)&&!We?.occluded,(Oe||pt)&&!Xi?.occluded,ye||u.justReloaded),n[St.crossTileID]=!0};if(lt){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const St=u.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let jt=St.length-1;jt>=0;--jt){const Qt=St[jt];Et(u.symbolInstances.get(Qt),u.collisionArrays[Qt],Qt)}}else for(let St=e.symbolInstanceStart;St<e.symbolInstanceEnd;St++)Et(u.symbolInstances.get(St),u.collisionArrays[St],St);u.justReloaded=!1}storeCollisionData(e,n,o,u,p,m){if(o.textBox||o.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(n)?x=_.get(n):(x={text:null,icon:null},_.set(n,x)),o.textBox&&(x.text=u.box),o.iconBox&&(x.icon=p.box)}if(m){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<m.circles.length;x+=4)_.push(m.circles[x+0]-Fe),_.push(m.circles[x+1]-Fe),_.push(m.circles[x+2]),_.push(m.collisionDetected?1:0)}}markUsedJustification(e,n,o,u){let p;p=u===c.ay.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[c.aQ(n)];const m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:o.crossTileID)}markUsedOrientation(e,n,o){const u=n===c.ay.horizontal||n===c.ay.horizontalOnly?n:0,p=n===c.ay.vertical?n:0,m=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const _ of m)e.text.placedSymbolArray.get(_).placedOrientation=u;o.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let o=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(e):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const x in this.placements){const b=this.placements[x],T=p[x];T?(this.opacities[x]=new Is(T,u,b.text,b.icon),o=o||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[x]=new Is(null,u,b.text,b.icon,b.skipFade),o=o||b.text||b.icon)}for(const x in p){const b=p[x];if(!this.opacities[x]){const T=new Is(b,u,!1,!1);T.isHidden()||(this.opacities[x]=T,o=o||b.text.placed||b.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");o?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){const o={};for(const u of n){const p=u.getBucket(e);p&&u.latestFeatureIndex&&e.id===p.layerIds[0]&&this.updateBucketOpacities(p,u.tileID,o,u.collisionBoxArray)}}updateBucketOpacities(e,n,o,u){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const p=e.layers[0],m=p.layout,_=new Is(null,0,!1,!1,!0),x=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"),k=m.get("text-rotation-alignment")==="map",A=m.get("text-pitch-alignment")==="map",z=m.get("icon-text-fit")!=="none",j=new Is(null,0,x&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(x||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&u&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(u);const $=(H,K,it)=>{for(let Y=0;Y<K/4;Y++)H.opacityVertexArray.emplaceBack(it);H.hasVisibleVertices=H.hasVisibleVertices||it!==rn},Z=this.collisionBoxArrays.get(e.bucketInstanceId);for(let H=0;H<e.symbolInstances.length;H++){const K=e.symbolInstances.get(H),{numHorizontalGlyphVertices:it,numVerticalGlyphVertices:Y,crossTileID:rt}=K;let nt=this.opacities[rt];o[rt]?nt=_:nt||(nt=j,this.opacities[rt]=nt),o[rt]=!0;const Q=K.numIconVertices>0,lt=this.placedOrientations[K.crossTileID],_t=lt===c.ay.vertical,pt=lt===c.ay.horizontal||lt===c.ay.horizontalOnly;if(it>0||Y>0){const gt=Ec(nt.text);$(e.text,it,_t?rn:gt),$(e.text,Y,pt?rn:gt);const Dt=nt.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach((jt=>{jt>=0&&(e.text.placedSymbolArray.get(jt).hidden=Dt||_t?1:0)})),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Dt||pt?1:0);const Et=this.variableOffsets[K.crossTileID];Et&&this.markUsedJustification(e,Et.anchor,K,lt);const St=this.placedOrientations[K.crossTileID];St&&(this.markUsedJustification(e,"left",K,St),this.markUsedOrientation(e,St,K))}if(Q){const gt=Ec(nt.icon),Dt=!(z&&K.verticalPlacedIconSymbolIndex&&_t);K.placedIconSymbolIndex>=0&&($(e.icon,K.numIconVertices,Dt?gt:rn),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=nt.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&($(e.icon,K.numVerticalIconVertices,Dt?rn:gt),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=nt.icon.isHidden())}const ft=Z&&Z.has(H)?Z.get(H):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const gt=e.collisionArrays[H];if(gt){let Dt=new c.P(0,0);if(gt.textBox||gt.verticalTextBox){let Et=!0;if(T){const St=this.variableOffsets[rt];St?(Dt=Tc(St.anchor,St.width,St.height,St.textOffset,St.textBoxScale),k&&Dt._rotate(A?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Et=!1}if(gt.textBox||gt.verticalTextBox){let St;gt.textBox&&(St=_t),gt.verticalTextBox&&(St=pt),Sc(e.textCollisionBox.collisionVertexArray,nt.text.placed,!Et||St,ft.text,Dt.x,Dt.y)}}if(gt.iconBox||gt.verticalIconBox){const Et=!!(!pt&>.verticalIconBox);let St;gt.iconBox&&(St=Et),gt.verticalIconBox&&(St=!Et),Sc(e.iconCollisionBox.collisionVertexArray,nt.icon.placed,St,ft.icon,z?Dt.x:0,z?Dt.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){const o=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*o>e}setStale(){this.stale=!0}}function Sc(d,e,n,o,u,p){o&&o.length!==0||(o=[0,0,0,0]);const m=o[0]-Fe,_=o[1]-Fe,x=o[2]-Fe,b=o[3]-Fe;d.emplaceBack(e?1:0,n?1:0,u||0,p||0,m,_),d.emplaceBack(e?1:0,n?1:0,u||0,p||0,x,_),d.emplaceBack(e?1:0,n?1:0,u||0,p||0,x,b),d.emplaceBack(e?1:0,n?1:0,u||0,p||0,m,b)}const Pc=Math.pow(2,25),Mc=Math.pow(2,24),Qo=Math.pow(2,17),tl=Math.pow(2,16),Ic=Math.pow(2,9),el=Math.pow(2,8),il=Math.pow(2,1);function Ec(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const e=d.placed?1:0,n=Math.floor(127*d.opacity);return n*Pc+e*Mc+n*Qo+e*tl+n*Ic+e*el+n*il+e}const rn=0;class Za{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,o,u,p){const m=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(m,u,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((_,x)=>_.sortKey-x.sortKey)));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,o),this._currentPartIndex++,p())return!0;return!1}}class Cc{constructor(e,n,o,u,p,m,_,x){this.placement=new sh(e,n,m,_,x),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(e,n,o){const u=qt(),p=()=>!this._forceFullPlacement&&qt()-u>2;for(;this._currentPlacementIndex>=0;){const m=n[e[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 Za(m)),this._inProgressLayer.continuePlacement(o[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Gr=512/c.a4/2;class Ac{constructor(e,n,o){this.tileID=e,this.bucketInstanceId=o,this._symbolsByKey={};const u=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),_=m.key,x=u.get(_);x?x.push(m):u.set(_,[m])}for(const[p,m]of u){const _={positions:m.map((x=>({x:Math.floor(x.anchorX*Gr),y:Math.floor(x.anchorY*Gr)}))),crossTileIDs:m.map((x=>x.crossTileID))};if(_.positions.length>128){const x=new c.aS(_.positions.length,16,Uint16Array);for(const{x:b,y:T}of _.positions)x.add(b,T);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[p]=_}}getScaledCoordinates(e,n){const{x:o,y:u,z:p}=this.tileID.canonical,{x:m,y:_,z:x}=n.canonical,b=Gr/Math.pow(2,x-p),T=(_*c.a4+e.anchorY)*b,k=u*c.a4*Gr;return{x:Math.floor((m*c.a4+e.anchorX)*b-o*c.a4*Gr),y:Math.floor(T-k)}}findMatches(e,n,o){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<e.length;p++){const m=e.get(p);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const x=this.getScaledCoordinates(m,n);if(_.index){const b=_.index.range(x.x-u,x.y-u,x.x+u,x.y+u).sort();for(const T of b){const k=_.crossTileIDs[T];if(!o[k]){o[k]=!0,m.crossTileID=k;break}}}else if(_.positions)for(let b=0;b<_.positions.length;b++){const T=_.positions[b],k=_.crossTileIDs[b];if(Math.abs(T.x-x.x)<=u&&Math.abs(T.y-x.y)<=u&&!o[k]){o[k]=!0,m.crossTileID=k;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class ah{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Mn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const n=Math.round((e-this.lng)/360);if(n!==0)for(const o in this.indexes){const u=this.indexes[o],p={};for(const m in u){const _=u[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[o]=p}this.lng=e}addBucket(e,n,o){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const u=this.usedCrossTileIDs[e.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>e.overscaledZ)for(const _ in m){const x=m[_];x.tileID.isChildOf(e)&&x.findMatches(n.symbolInstances,e,u)}else{const _=m[e.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,e,u)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=o.generate(),u[m.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ac(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(const o of n.getCrossTileIDsLists())for(const u of o)delete this.usedCrossTileIDs[e][u]}removeStaleBuckets(e){let n=!1;for(const o in this.indexes){const u=this.indexes[o];for(const p in u)e[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(o,u[p]),delete u[p],n=!0)}return n}}class Jn{constructor(){this.layerIndexes={},this.crossTileIDs=new ah,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,o){let u=this.layerIndexes[e.id];u===void 0&&(u=this.layerIndexes[e.id]=new Mn);let p=!1;const m={};u.handleWrapJump(o);for(const _ of n){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,x,this.crossTileIDs)&&(p=!0),m[x.bucketInstanceId]=!0)}return u.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(e){const n={};e.forEach((o=>{n[o]=!0}));for(const o in this.layerIndexes)n[o]||delete this.layerIndexes[o]}}var se="void main() {fragColor=vec4(1.0);}";const ar={prelude:ue(`#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:ue("","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:ue("",`#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:ue(`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:ue(`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:ue(`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:ue(se,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ue(`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:ue(`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:ue("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:ue("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:ue(`#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:ue("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:ue(se,`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:ue(`#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:ue(`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:ue(`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:ue(`#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:ue(`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:ue(`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:ue(`#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:ue(`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:ue(`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:ue(`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:ue(`#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:ue(`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:ue(`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:ue(`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:ue(`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:ue(`#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:ue(`#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:ue("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:ue("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:ue("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:ue("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:ue(`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
|
|
752
|
+
);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:ue("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 ue(d,e){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/in ([\w]+) ([\w]+)/g),u=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(u):u,_={};return{fragmentSource:d=d.replace(n,((x,b,T,k,A)=>(_[A]=!0,b==="define"?`
|
|
753
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
754
|
+
in ${T} ${k} ${A};
|
|
755
|
+
#else
|
|
756
|
+
uniform ${T} ${k} u_${A};
|
|
757
|
+
#endif
|
|
758
|
+
`:`
|
|
759
|
+
#ifdef HAS_UNIFORM_u_${A}
|
|
760
|
+
${T} ${k} ${A} = u_${A};
|
|
761
|
+
#endif
|
|
762
|
+
`))),vertexSource:e=e.replace(n,((x,b,T,k,A)=>{const z=k==="float"?"vec2":"vec4",j=A.match(/color/)?"color":z;return _[A]?b==="define"?`
|
|
763
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
764
|
+
uniform lowp float u_${A}_t;
|
|
765
|
+
in ${T} ${z} a_${A};
|
|
766
|
+
out ${T} ${k} ${A};
|
|
767
|
+
#else
|
|
768
|
+
uniform ${T} ${k} u_${A};
|
|
769
|
+
#endif
|
|
770
|
+
`:j==="vec4"?`
|
|
771
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
772
|
+
${A} = a_${A};
|
|
773
|
+
#else
|
|
774
|
+
${T} ${k} ${A} = u_${A};
|
|
775
|
+
#endif
|
|
776
|
+
`:`
|
|
777
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
778
|
+
${A} = unpack_mix_${j}(a_${A}, u_${A}_t);
|
|
779
|
+
#else
|
|
780
|
+
${T} ${k} ${A} = u_${A};
|
|
781
|
+
#endif
|
|
782
|
+
`:b==="define"?`
|
|
783
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
784
|
+
uniform lowp float u_${A}_t;
|
|
785
|
+
in ${T} ${z} a_${A};
|
|
786
|
+
#else
|
|
787
|
+
uniform ${T} ${k} u_${A};
|
|
788
|
+
#endif
|
|
789
|
+
`:j==="vec4"?`
|
|
790
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
791
|
+
${T} ${k} ${A} = a_${A};
|
|
792
|
+
#else
|
|
793
|
+
${T} ${k} ${A} = u_${A};
|
|
794
|
+
#endif
|
|
795
|
+
`:`
|
|
796
|
+
#ifndef HAS_UNIFORM_u_${A}
|
|
797
|
+
${T} ${k} ${A} = unpack_mix_${j}(a_${A}, u_${A}_t);
|
|
798
|
+
#else
|
|
799
|
+
${T} ${k} ${A} = u_${A};
|
|
800
|
+
#endif
|
|
801
|
+
`})),staticAttributes:o,staticUniforms:m}}class In{constructor(e,n,o){this.vertexBuffer=e,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ei=c.aT([{name:"a_pos",type:"Int16",components:2}]);const Ti="#define PROJECTION_MERCATOR",Si="mercator";class ci{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Si}get shaderDefine(){return Ti}get shaderPreludeCode(){return ar.projectionMercator}get vertexShaderPreludeCode(){return ar.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aU.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,n,o,u,p){if(this._cachedMesh)return this._cachedMesh;const m=new c.aV;m.emplaceBack(0,0),m.emplaceBack(c.a4,0),m.emplaceBack(0,c.a4),m.emplaceBack(c.a4,c.a4);const _=e.createVertexBuffer(m,ei.members),x=c.aW.simpleSegment(0,0,4,2),b=new c.aX;b.emplaceBack(1,0,2),b.emplaceBack(1,2,3);const T=e.createIndexBuffer(b);return this._cachedMesh=new In(_,T,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Pe{constructor(e=0,n=0,o=0,u=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=o,this.right=u}interpolate(e,n,o){return n.top!=null&&e.top!=null&&(this.top=c.G.number(e.top,n.top,o)),n.bottom!=null&&e.bottom!=null&&(this.bottom=c.G.number(e.bottom,n.bottom,o)),n.left!=null&&e.left!=null&&(this.left=c.G.number(e.left,n.left,o)),n.right!=null&&e.right!=null&&(this.right=c.G.number(e.right,n.right,o)),this}getCenter(e,n){const o=c.an((this.left+e-this.right)/2,0,e),u=c.an((this.top+n-this.bottom)/2,0,n);return new c.P(o,u)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Pe(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function qa(d,e){if(!d.renderWorldCopies||d.lngRange)return;const n=e.lng-d.center.lng;e.lng+=n>180?-360:n<-180?360:0}function Fi(d){return Math.max(0,Math.floor(d))}class Zi{constructor(e,n){var o;this.applyConstrain=(u,p)=>this._constrainOverride!==null?this._constrainOverride(u,p):this._callbacks.defaultConstrain(u,p),this._callbacks=e,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=(o=n?.constrainOverride)!==null&&o!==void 0?o:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Fi(this._zoom),this._scale=c.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Pe,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,n,o){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Fi(this._zoom),this._scale=c.aq(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Pe(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!o&&e.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}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(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,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 c.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const n=c.W(e,-180,180)*Math.PI/180;var o,u,p,m,_,x,b,T,k;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=Rt(),o=this._rotationMatrix,p=-this._bearingInRadians,m=(u=this._rotationMatrix)[0],_=u[1],x=u[2],b=u[3],T=Math.sin(p),k=Math.cos(p),o[0]=m*k+x*T,o[1]=_*k+b*T,o[2]=m*-T+x*k,o[3]=_*-T+b*k)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const n=c.an(e,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(e){const n=e/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return c.aY(this._fovInRadians)}setFov(e){e=c.an(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=c.ap(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const n=this.applyConstrain(this._center,e).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=c.aq(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,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(e,n){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,o){this._unmodified=!1,this._edgeInsets.interpolate(e,n,o),this.constrainInternal(),this._calcMatrices()}resize(e,n,o=!0){this._width=e,this._height=n,o&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Le([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-c.ao,c.ao])}getCameraQueryGeometry(e,n){if(n.length===1)return[n[0],e];{const{minX:o,minY:u,maxX:p,maxY:m}=c.ab.fromPoints(n).extend(e);return[new c.P(o,u),new c.P(p,u),new c.P(p,m),new c.P(o,m),new c.P(o,u)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:n,zoom:o}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(o),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=c.ar(new Float64Array(16));c.Q(e,e,[this._width/2,-this._height/2,1]),c.O(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=c.ar(new Float64Array(16)),c.Q(e,e,[1,-1,1]),c.O(e,e,[-1,-1,0]),c.Q(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,n,o,u){const p=o!==void 0?o:this.bearing,m=u=u!==void 0?u:this.pitch,_=c.aa.fromLngLat(e,n),x=-Math.cos(c.ap(m)),b=Math.sin(c.ap(m)),T=b*Math.sin(c.ap(p)),k=-b*Math.cos(c.ap(p));let A=this.elevation;const z=n-A;let j;x*z>=0||Math.abs(x)<.1?(j=1e4,A=n+j*x):j=-z/x;let $,Z,H=c.aZ(1,_.y),K=0;do{if(K+=1,K>10)break;Z=j/H,$=new c.aa(_.x+T*Z,_.y+k*Z),H=1/$.meterInMercatorCoordinateUnits()}while(Math.abs(j-Z*H)>1e-12);return{center:$.toLngLat(),elevation:A,zoom:c.at(this.height/2/Math.tan(this.fovInRadians/2)/Z/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const n=c.as(1,this.center.lat)*this.worldSize,o=this.cameraToCenterDistance/n,u=c.aa.fromLngLat(this.center,this.elevation),p=ct(this.center,this.elevation,this.pitch,this.bearing,o);this._elevation=e;const m=this.calculateCenterFromCameraLngLatAlt(p.toLngLat(),c.aZ(p.z,u.y),this.bearing,this.pitch);this._elevation=m.elevation,this._center=m.center,this.setZoom(m.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=c.as(1,this.center.lat)*this.worldSize;return ct(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const n=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/n,e.canonical.y/n,1/n/c.a4,1/n/c.a4]}}class Pi{constructor(e,n){this.min=e,this.max=n,this.center=c.a_([],c.a$([],this.min,this.max),.5)}quadrant(e){const n=[e%2==0,e<2],o=c.b0(this.min),u=c.b0(this.max);for(let p=0;p<n.length;p++)o[p]=n[p]?this.min[p]:this.center[p],u[p]=n[p]?this.center[p]:this.max[p];return u[2]=this.max[2],new Pi(o,u)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let n=!0;for(let o=0;o<e.planes.length;o++){const u=this.intersectsPlane(e.planes[o]);if(u===0)return 0;u===1&&(n=!1)}return n?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let n=e[3],o=e[3];for(let u=0;u<3;u++)e[u]>0?(n+=e[u]*this.min[u],o+=e[u]*this.max[u]):(o+=e[u]*this.min[u],n+=e[u]*this.max[u]);return n>=0?2:o<0?0:1}}class kc{distanceToTile2d(e,n,o,u){const p=u.distanceX([e,n]),m=u.distanceY([e,n]);return Math.hypot(p,m)}getWrap(e,n,o){return o}getTileBoundingVolume(e,n,o,u){var p,m;let _=0,x=0;if(u?.terrain){const T=new c.a1(e.z,n,e.z,e.x,e.y),k=u.terrain.getMinMaxElevation(T);_=(p=k.minElevation)!==null&&p!==void 0?p:Math.min(0,o),x=(m=k.maxElevation)!==null&&m!==void 0?m:Math.max(0,o)}const b=1<<e.z;return new Pi([n+e.x/b,e.y/b,_],[n+(e.x+1)/b,(e.y+1)/b,x])}allowVariableZoom(e,n){const o=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,u=c.an(78.5-o/2,0,60);return!!n.terrain||e.pitch>u}allowWorldCopies(){return!0}prepareNextFrame(){}}class En{constructor(e,n,o){this.points=e,this.planes=n,this.aabb=o}static fromInvProjectionMatrix(e,n=1,o=0,u,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,o),x=[[-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((A=>(function(z,j,$,Z){const H=c.aG([],z,j),K=1/H[3]/$*Z;return c.b5(H,H,[K,K,1/H[3],K])})(A,e,n,_)));u&&(function(A,z,j,$){const Z=$?4:0,H=$?0:4;let K=0;const it=[],Y=[];for(let Q=0;Q<4;Q++){const lt=c.b1([],A[Q+H],A[Q+Z]),_t=c.b6(lt);c.a_(lt,lt,1/_t),it.push(_t),Y.push(lt)}for(let Q=0;Q<4;Q++){const lt=c.b7(A[Q+Z],Y[Q],j);K=lt!==null&<>=0?Math.max(K,lt):Math.max(K,it[Q])}const rt=(function(Q,lt){const _t=c.b1([],Q[lt[0]],Q[lt[1]]),pt=c.b1([],Q[lt[2]],Q[lt[1]]),ft=[0,0,0,0];return c.b2(ft,c.b3([],_t,pt)),ft[3]=-c.b4(ft,Q[lt[0]]),ft})(A,z),nt=(function(Q,lt){const _t=c.b8(Q),pt=c.b9([],Q,1/_t),ft=c.b1([],lt,c.a_([],pt,c.b4(lt,pt))),gt=c.b8(ft);if(gt>0){const Dt=Math.sqrt(1-pt[3]*pt[3]),Et=c.a_([],pt,-pt[3]),St=c.a$([],Et,c.a_([],ft,Dt/gt));return c.ba(lt,St)}return null})(j,rt);if(nt!==null){const Q=nt/c.b4(Y[0],rt);K=Math.min(K,Q)}for(let Q=0;Q<4;Q++){const lt=Math.min(K,it[Q]);A[Q+H]=[A[Q+Z][0]+Y[Q][0]*lt,A[Q+Z][1]+Y[Q][1]*lt,A[Q+Z][2]+Y[Q][2]*lt,1]}})(x,m[0],u,p);const b=m.map((A=>{const z=c.b1([],x[A[0]],x[A[1]]),j=c.b1([],x[A[2]],x[A[1]]),$=c.b2([],c.b3([],z,j)),Z=-c.b4($,x[A[1]]);return $.concat(Z)})),T=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],k=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const A of x)for(let z=0;z<3;z++)T[z]=Math.min(T[z],A[z]),k[z]=Math.max(k[z],A[z]);return new En(x,b,new Pi(T,k))}}class Ce{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n,o=!0){this._helper.resize(e,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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(e,n){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,o)=>{o=c.an(+o,this.minZoom,this.maxZoom);const u={center:new c.V(n.lng,n.lat),zoom:o};let p=this._helper._lngRange;if(!this._helper._renderWorldCopies&&p===null){const Y=179.9999999999;p=[-Y,Y]}const m=this.tileSize*c.aq(u.zoom);let _=0,x=m,b=0,T=m,k=0,A=0;const{x:z,y:j}=this.size;if(this._helper._latRange){const Y=this._helper._latRange;_=c.X(Y[1])*m,x=c.X(Y[0])*m,x-_<j&&(k=j/(x-_))}p&&(b=c.W(c.Y(p[0])*m,0,m),T=c.W(c.Y(p[1])*m,0,m),T<b&&(T+=m),T-b<z&&(A=z/(T-b)));const{x:$,y:Z}=J(m,n);let H,K;const it=Math.max(A||0,k||0);if(it){const Y=new c.P(A?(T+b)/2:$,k?(x+_)/2:Z);return u.center=tt(m,Y).wrap(),u.zoom+=c.at(it),u}if(this._helper._latRange){const Y=j/2;Z-Y<_&&(K=_+Y),Z+Y>x&&(K=x-Y)}if(p){const Y=(b+T)/2;let rt=$;this._helper._renderWorldCopies&&(rt=c.W($,Y-m/2,Y+m/2));const nt=z/2;rt-nt<b&&(H=b+nt),rt+nt>T&&(H=T-nt)}if(H!==void 0||K!==void 0){const Y=new c.P(H??$,K??Z);u.center=tt(m,Y).wrap()}return u},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._coveringTilesDetailsProvider=new kc}clone(){const e=new Ce;return e.apply(this),e}apply(e,n,o){this._helper.apply(e,n,o)}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(e){const n=[new c.bb(0,e)];if(this._helper._renderWorldCopies){const o=this.screenPointToMercatorCoordinate(new c.P(0,0)),u=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),p=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),m=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),_=Math.floor(Math.min(o.x,u.x,p.x,m.x)),x=Math.floor(Math.max(o.x,u.x,p.x,m.x)),b=1;for(let T=_-b;T<=x+b;T++)T!==0&&n.push(new c.bb(T,e))}return n}getCameraFrustum(){return En.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const n=this.screenPointToLocation(this.centerPoint,e),o=e?e.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(o)}setLocationAtPoint(e,n){const o=c.as(this.elevation,this.center.lat),u=this.screenPointToMercatorCoordinateAtZ(n,o),p=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,o),m=c.aa.fromLngLat(e),_=new c.aa(m.x-(u.x-p.x),m.y-(u.y-p.y));this.setCenter(_?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,n){return n?this.coordinatePoint(c.aa.fromLngLat(e),n.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(c.aa.fromLngLat(e))}screenPointToLocation(e,n){var o;return(o=this.screenPointToMercatorCoordinate(e,n))===null||o===void 0?void 0:o.toLngLat()}screenPointToMercatorCoordinate(e,n){if(n){const o=n.pointCoordinate(e);if(o!=null)return o}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,n){const o=n||0,u=[e.x,e.y,0,1],p=[e.x,e.y,1,1];c.aG(u,u,this._pixelMatrixInverse),c.aG(p,p,this._pixelMatrixInverse);const m=u[3],_=p[3],x=u[1]/m,b=p[1]/_,T=u[2]/m,k=p[2]/_,A=T===k?0:(o-T)/(k-T);return new c.aa(c.G.number(u[0]/m,p[0]/_,A)/this.worldSize,c.G.number(x,b,A)/this.worldSize,o)}coordinatePoint(e,n=0,o=this._pixelMatrix){const u=[e.x*this.worldSize,e.y*this.worldSize,n,1];return c.aG(u,u,o),new c.P(u[0]/u[3],u[1]/u[3])}getBounds(){const e=Math.max(0,this._helper._height/2-ut(this));return new Le().extend(this.screenPointToLocation(new c.P(0,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(e,n){return n?n.pointCoordinate(e)!=null:e.y>this.height/2-ut(this)}calculatePosMatrix(e,n=!1,o){var u;const p=(u=e.key)!==null&&u!==void 0?u:c.bc(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),m=n?this._alignedPosMatrixCache:this._posMatrixCache;if(m.has(p)){const b=m.get(p);return o?b.f32:b.f64}const _=W(e,this.worldSize);c.S(_,n?this._alignedProjMatrix:this._viewProjMatrix,_);const x={f64:_,f32:new Float32Array(_)};return m.set(p,x),o?x.f32:x.f64}calculateFogMatrix(e){const n=e.key,o=this._fogMatrixCacheF32;if(o.has(n))return o.get(n);const u=W(e,this.worldSize);return c.S(u,this._fogMatrix,u),o.set(n,new Float32Array(u)),o.get(n)}calculateCenterFromCameraLngLatAlt(e,n,o,u){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,u)}_calculateNearFarZIfNeeded(e,n,o){if(!this._helper.autoCalculateNearFarZ)return;const u=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),p=e-u*this._helper._pixelPerMeter/Math.cos(n),m=u<0?p:e,_=Math.PI/2+this.pitchInRadians,x=c.ap(this.fov)*(Math.abs(Math.cos(c.ap(this.roll)))*this.height+Math.abs(Math.sin(c.ap(this.roll)))*this.width)/this.height*(.5+o.y/this.height),b=Math.sin(x)*m/Math.sin(c.an(Math.PI-_-x,.01,Math.PI-.01)),T=ut(this),k=Math.atan(T/this._helper.cameraToCenterDistance),A=c.ap(.75),z=k>A?2*k*(.5+o.y/(2*T)):A,j=Math.sin(z)*m/Math.sin(c.an(Math.PI-_-z,.01,Math.PI-.01)),$=Math.min(b,j);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*$+m),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,n=J(this.worldSize,this.center),o=n.x,u=n.y;this._helper._pixelPerMeter=c.as(1,this.center.lat)*this.worldSize;const p=c.ap(Math.min(this.pitch,U)),m=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(p));let _;this._calculateNearFarZIfNeeded(m,p,e),_=new Float64Array(16),c.bd(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.aA(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=c.be(_),c.Q(_,_,[1,-1,1]),c.O(_,_,[0,0,-this._helper.cameraToCenterDistance]),c.bf(_,_,-this.rollInRadians),c.bg(_,_,this.pitchInRadians),c.bf(_,_,-this.bearingInRadians),c.O(_,_,[-o,-u,0]),this._mercatorMatrix=c.Q([],_,[this.worldSize,this.worldSize,this.worldSize]),c.Q(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),c.O(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=c.aA([],_);const x=[0,0,-1,1];c.aG(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),c.bd(this._fogMatrix,this.fovInRadians,this.width/this.height,m,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,c.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.bf(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.bg(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.bf(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.O(this._fogMatrix,this._fogMatrix,[-o,-u,0]),c.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const b=this._helper._width%2/2,T=this._helper._height%2/2,k=Math.cos(this.bearingInRadians),A=Math.sin(-this.bearingInRadians),z=o-Math.round(o)+k*b+A*T,j=u-Math.round(u)+k*T+A*b,$=new Float64Array(_);if(c.O($,$,[z>.5?z-1:z,j>.5?j-1:j,0]),this._alignedProjMatrix=$,_=c.aA(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 e=this.screenPointToMercatorCoordinate(new c.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return c.aG(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=c.as(1,this.center.lat)*this.worldSize;return ct(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,n){const o=c.aa.fromLngLat(e),u=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.aG(u,u,this._viewProjMatrix),u[2]/u[3]}getProjectionData(e){const{overscaledTileID:n,aligned:o,applyTerrainMatrix:u}=e,p=this._helper.getMercatorTileCoordinates(n),m=n?this.calculatePosMatrix(n,o,!0):null;let _;return _=n&&n.terrainRttPosMatrix32f&&u?n.terrainRttPosMatrix32f:m||c.bh(),{mainMatrix:_,tileMercatorCoords:p,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,n,o){return 1}transformLightDirection(e){return c.b0(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,n,o,u){const p=this.calculatePosMatrix(o);let m;u?(m=[e,n,u(e,n),1],c.aG(m,m,p)):(m=[e,n,0,1],ea(m,m,p));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const n of e)this.calculatePosMatrix(n)}getMatrixForModel(e,n){const o=c.aa.fromLngLat(e,n),u=o.meterInMercatorCoordinateUnits(),p=c.bi();return c.O(p,p,[o.x,o.y,o.z]),c.bf(p,p,Math.PI),c.bg(p,p,Math.PI/2),c.Q(p,p,[-u,u,u]),p}getProjectionDataForCustomLayer(e=!0){const n=new c.a1(0,0,0,0,0),o=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:e}),u=W(n,this.worldSize);c.S(u,this._viewProjMatrix,u),o.tileMercatorCoords=[0,0,1,1];const p=[c.a4,c.a4,this.worldSize/this._helper.pixelsPerMeter],m=c.bj();return c.Q(m,u,p),o.fallbackMatrix=m,o.mainMatrix=m,o}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Cs(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Cn(d){if(d.useSlerp)if(d.k<1){const e=c.bk(d.startEulerAngles.roll,d.startEulerAngles.pitch,d.startEulerAngles.bearing),n=c.bk(d.endEulerAngles.roll,d.endEulerAngles.pitch,d.endEulerAngles.bearing),o=new Float64Array(4);c.bl(o,e,n,d.k);const u=c.bm(o);d.tr.setRoll(u.roll),d.tr.setPitch(u.pitch),d.tr.setBearing(u.bearing)}else d.tr.setRoll(d.endEulerAngles.roll),d.tr.setPitch(d.endEulerAngles.pitch),d.tr.setBearing(d.endEulerAngles.bearing);else d.tr.setRoll(c.G.number(d.startEulerAngles.roll,d.endEulerAngles.roll,d.k)),d.tr.setPitch(c.G.number(d.startEulerAngles.pitch,d.endEulerAngles.pitch,d.k)),d.tr.setBearing(c.G.number(d.startEulerAngles.bearing,d.endEulerAngles.bearing,d.k))}function ia(d,e,n,o,u){const p=u.padding,m=J(u.worldSize,n.getNorthWest()),_=J(u.worldSize,n.getNorthEast()),x=J(u.worldSize,n.getSouthEast()),b=J(u.worldSize,n.getSouthWest()),T=c.ap(-o),k=m.rotate(T),A=_.rotate(T),z=x.rotate(T),j=b.rotate(T),$=new c.P(Math.max(k.x,A.x,j.x,z.x),Math.max(k.y,A.y,j.y,z.y)),Z=new c.P(Math.min(k.x,A.x,j.x,z.x),Math.min(k.y,A.y,j.y,z.y)),H=$.sub(Z),K=(u.width-(p.left+p.right+e.left+e.right))/H.x,it=(u.height-(p.top+p.bottom+e.top+e.bottom))/H.y;if(it<0||K<0)return void Cs();const Y=Math.min(c.at(u.scale*Math.min(K,it)),d.maxZoom),rt=c.P.convert(d.offset),nt=new c.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(c.ap(o)),Q=rt.add(nt).mult(u.scale/c.aq(Y));return{center:tt(u.worldSize,m.add(x).div(2).sub(Q)),zoom:Y,bearing:o}}class qi{get useGlobeControls(){return!1}handlePanInertia(e,n){const o=e.mag(),u=Math.abs(ut(n));return{easingOffset:e.mult(Math.min(.75*u/o,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(e,n){e.bearingDelta&&n.setBearing(n.bearing+e.bearingDelta),e.pitchDelta&&n.setPitch(n.pitch+e.pitchDelta),e.rollDelta&&n.setRoll(n.roll+e.rollDelta),e.zoomDelta&&n.setZoom(n.zoom+e.zoomDelta)}handleMapControlsPan(e,n,o){e.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(o,e.around)}cameraForBoxAndBearing(e,n,o,u,p){return ia(e,n,o,u,p)}handleJumpToCenterZoom(e,n){e.zoom!==(n.zoom!==void 0?+n.zoom:e.zoom)&&e.setZoom(+n.zoom),n.center!==void 0&&e.setCenter(c.V.convert(n.center))}handleEaseTo(e,n){const o=e.zoom,u=e.padding,p={roll:e.roll,pitch:e.pitch,bearing:e.bearing},m={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},_=n.zoom!==void 0,x=!e.isPaddingEqual(n.padding);let b=!1;const T=_?+n.zoom:e.zoom;let k=e.centerPoint.add(n.offsetAsPoint);const A=e.screenPointToLocation(k),{center:z,zoom:j}=e.applyConstrain(c.V.convert(n.center||A),T??o);qa(e,z);const $=J(e.worldSize,A),Z=J(e.worldSize,z).sub($),H=c.aq(j-o);return b=j!==o,{easeFunc:K=>{if(b&&e.setZoom(c.G.number(o,j,K)),c.bn(p,m)||Cn({startEulerAngles:p,endEulerAngles:m,tr:e,k:K,useSlerp:p.roll!=m.roll}),x&&(e.interpolatePadding(u,n.padding,K),k=e.centerPoint.add(n.offsetAsPoint)),n.around)e.setLocationAtPoint(n.around,n.aroundPoint);else{const it=c.aq(e.zoom-o),Y=j>o?Math.min(2,H):Math.max(.5,H),rt=Math.pow(Y,1-K),nt=tt(e.worldSize,$.add(Z.mult(K*rt)).mult(it));e.setLocationAtPoint(e.renderWorldCopies?nt.wrap():nt,k)}},isZooming:b,elevationCenter:z}}handleFlyTo(e,n){const o=n.zoom!==void 0,u=e.zoom,p=e.applyConstrain(c.V.convert(n.center||n.locationAtOffset),o?+n.zoom:u),m=p.center,_=p.zoom;qa(e,m);const x=J(e.worldSize,n.locationAtOffset),b=J(e.worldSize,m).sub(x),T=b.mag(),k=c.aq(_-u);let A;if(n.minZoom!==void 0){const z=Math.min(+n.minZoom,u,_),j=e.applyConstrain(m,z).zoom;A=c.aq(j-u)}return{easeFunc:(z,j,$,Z)=>{e.setZoom(z===1?_:u+c.at(j));const H=z===1?m:tt(e.worldSize,x.add(b.mult($)).mult(j));e.setLocationAtPoint(e.renderWorldCopies?H.wrap():H,Z)},scaleOfZoom:k,targetCenter:m,scaleOfMinZoom:A,pixelPathLength:T}}}class Ae{constructor(e,n,o){this.blendFunction=e,this.blendColor=n,this.mask=o}}Ae.Replace=[1,0],Ae.disabled=new Ae(Ae.Replace,c.bo.transparent,[!1,!1,!1,!1]),Ae.unblended=new Ae(Ae.Replace,c.bo.transparent,[!0,!0,!0,!0]),Ae.alphaBlended=new Ae([1,771],c.bo.transparent,[!0,!0,!0,!0]);const $r=2305;class pe{constructor(e,n,o){this.enable=e,this.mode=n,this.frontFace=o}}pe.disabled=new pe(!1,1029,$r),pe.backCCW=new pe(!0,1029,$r),pe.frontCCW=new pe(!0,1028,$r);class ie{constructor(e,n,o){this.func=e,this.mask=n,this.range=o}}ie.ReadOnly=!1,ie.ReadWrite=!0,ie.disabled=new ie(519,ie.ReadOnly,[0,1]);const As=7680;class he{constructor(e,n,o,u,p,m){this.test=e,this.ref=n,this.mask=o,this.fail=u,this.depthFail=p,this.pass=m}}he.disabled=new he({func:519,mask:0},0,0,As,As,As);const ks=new WeakMap;function wr(d){var e;if(ks.has(d))return ks.get(d);{const n=(e=d.getParameter(d.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return ks.set(d,n),n}}class ra{get awaitingQuery(){return!!this._readbackQueue}constructor(e){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=e;const n=e.context,o=n.gl;this._texFormat=o.RGBA,this._texType=o.UNSIGNED_BYTE;const u=new c.aV;u.emplaceBack(-1,-1),u.emplaceBack(2,-1),u.emplaceBack(-1,2);const p=new c.aX;p.emplaceBack(0,1,2),this._fullscreenTriangle=new In(n.createVertexBuffer(u,ei.members),n.createIndexBuffer(p),c.aW.simpleSegment(0,0,u.length,p.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(o.TEXTURE1);const m=o.createTexture();o.bindTexture(o.TEXTURE_2D,m),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texImage2D(o.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),wr(o)&&(this._pbo=o.createBuffer(),o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.bufferData(o.PIXEL_PACK_BUFFER,4,o.STREAM_READ),o.bindBuffer(o.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,n){const o=this._updateCount;return this._readbackQueue?o>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():o>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,n=e.gl;e.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,n){const o=this._cachedRenderContext.context,u=o.gl;if(this._bindFramebuffer(),o.viewport.set([0,0,this._texWidth,this._texHeight]),o.clear({color:c.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o,u.TRIANGLES,ie.disabled,he.disabled,Ae.unblended,pe.disabled,((p,m)=>({u_input:p,u_output_expected:m}))(e,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&wr(u)){u.bindBuffer(u.PIXEL_PACK_BUFFER,this._pbo),u.readBuffer(u.COLOR_ATTACHMENT0),u.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null);const p=u.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0);u.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:p}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&wr(e)){const n=e.clientWaitSync(this._readbackQueue.sync,0,0);if(n===e.WAIT_FAILED)return c.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ra._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let n=0;return n+=e[0]/256,n+=e[1]/65536,n+=e[2]/16777216,e[3]<127&&(n=-n),n/128}}const Qn=c.a4/128;function Wa(d,e){const n=d.granularity!==void 0?Math.max(d.granularity,1):1,o=n+(d.generateBorders?2:0),u=n+(d.extendToNorthPole||d.generateBorders?1:0)+(d.extendToSouthPole||d.generateBorders?1:0),p=o+1,m=u+1,_=d.generateBorders?-1:0,x=d.generateBorders||d.extendToNorthPole?-1:0,b=n+(d.generateBorders?1:0),T=n+(d.generateBorders||d.extendToSouthPole?1:0),k=p*m,A=o*u*6,z=p*m>65536;if(z&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const j=z||e==="32bit",$=new Int16Array(2*k);let Z=0;for(let it=x;it<=T;it++)for(let Y=_;Y<=b;Y++){let rt=Y/n*c.a4;Y===-1&&(rt=-Qn),Y===n+1&&(rt=c.a4+Qn);let nt=it/n*c.a4;it===-1&&(nt=d.extendToNorthPole?c.bq:-Qn),it===n+1&&(nt=d.extendToSouthPole?c.br:c.a4+Qn),$[Z++]=rt,$[Z++]=nt}const H=j?new Uint32Array(A):new Uint16Array(A);let K=0;for(let it=0;it<u;it++)for(let Y=0;Y<o;Y++){const rt=Y+1+it*p,nt=Y+(it+1)*p,Q=Y+1+(it+1)*p;H[K++]=Y+it*p,H[K++]=nt,H[K++]=rt,H[K++]=rt,H[K++]=nt,H[K++]=Q}return{vertices:$.buffer.slice(0),indices:H.buffer.slice(0),uses32bitIndices:j}}const na=new c.aU({fill:new c.bs(128,2),line:new c.bs(512,0),tile:new c.bs(128,32),stencil:new c.bs(128,1),circle:3});class sa{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 ar.projectionGlobe}get vertexShaderPreludeCode(){return ar.projectionMercator.vertexSource}get subdivisionGranularity(){return na}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ra(e));const n=c.X(this._errorQueryLatitudeDegrees),o=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,u=this._errorMeasurement.updateErrorLoop(n,o),p=qt();u!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=u,this._errorMeasurementLastChangeTime=p);const m=Math.min(Math.max((p-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=c.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,c.bu(m))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,n,o,u,p){const m=(p==="stencil"?na.stencil:na.tile).getGranularityForZoomLevel(n.z);return this._getMesh(e,{granularity:m,generateBorders:o,extendToNorthPole:n.y===0&&u,extendToSouthPole:n.y===(1<<n.z)-1&&u})}_getMesh(e,n){const o=this._getMeshKey(n);if(o in this._tileMeshCache)return this._tileMeshCache[o];const u=(function(p,m){const _=Wa(m,"16bit"),x=c.aV.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),b=c.aX.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new In(p.createVertexBuffer(x,ei.members),p.createIndexBuffer(b),c.aW.simpleSegment(0,0,x.length,b.length))})(e,n);return this._tileMeshCache[o]=u,u}recalculate(e){}hasTransition(){const e=qt();let n=!1;return n=n||(e-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const Ha=new c.t({type:new c.D(c.u.projection.type)});class Ds extends c.E{constructor(e){super(),this._transitionable=new c.x(Ha,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0)),this._mercatorProjection=new ci,this._verticalPerspectiveProjection=new sa}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof c.bv){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.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(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,n,o,u,p){return this.currentProjection.getMeshFromTileID(e,n,o,u,p)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function Dc(d){const e=Xa(d.worldSize,d.center.lat);return 2*Math.PI*e}function Zr(d,e,n,o,u){const p=1/(1<<u),m=e/c.a4*p+o*p,_=c.bx((d/c.a4*p+n*p)*Math.PI*2+Math.PI,2*Math.PI),x=2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI,b=Math.cos(x),T=new Float64Array(3);return T[0]=Math.sin(_)*b,T[1]=Math.sin(x),T[2]=Math.cos(_)*b,T}function yi(d){return(function(e,n){const o=Math.cos(n),u=new Float64Array(3);return u[0]=Math.sin(e)*o,u[1]=Math.sin(n),u[2]=Math.cos(e)*o,u})(d.lng*Math.PI/180,d.lat*Math.PI/180)}function Xa(d,e){return d/(2*Math.PI)/Math.cos(e*Math.PI/180)}function zc(d){const e=Math.asin(d[1])/Math.PI*180,n=Math.sqrt(d[0]*d[0]+d[2]*d[2]);if(n>1e-6){const o=d[0]/n,u=Math.acos(d[2]/n),p=(o>0?u:-u)/Math.PI*180;return new c.V(c.W(p,-180,180),e)}return new c.V(0,e)}function xi(d){return Math.cos(d*Math.PI/180)}function ii(d,e){const n=xi(d),o=xi(e);return c.at(o/n)}function Tr(d,e){const n=d.rotate(e.bearingInRadians),o=e.zoom+ii(e.center.lat,0),u=c.bt(1/xi(e.center.lat),1/xi(Math.min(Math.abs(e.center.lat),60)),c.bw(o,7,3,0,1)),p=360/Dc({worldSize:e.worldSize,center:{lat:e.center.lat}});return new c.V(e.center.lng-n.x*p*u,c.an(e.center.lat+n.y*p,-c.ao,c.ao))}function zs(d){const e=.5*d,n=Math.sin(e),o=Math.cos(e);return Math.log(n+o)-Math.log(o-n)}function rl(d,e,n,o){const u=d.lat+n*o;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,_=zs(p+o*(m-p)),x=zs(p),b=zs(m);return new c.V(d.lng+e*((_-x)/(b-x)),u)}return new c.V(d.lng+e*o,u)}class Rc{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,n,o,u){const p=`${e.z}_${e.x}_${e.y}_${u?.terrain?"t":""}`,m=this._cache.get(p);if(m)return m;const _=this._cachePrevious.get(p);if(_)return this._cache.set(p,_),_;const x=this._boundingVolumeFactory(e,n,o,u);return this._cache.set(p,x),this._hadAnyChanges=!0,x}}class Sr{constructor(e,n,o,u){this.min=o,this.max=u,this.points=e,this.planes=n}static fromAabb(e,n){const o=[];for(let u=0;u<8;u++)o.push([1&~u?e[0]:n[0],(u>>1&1)==1?n[1]:e[1],(u>>2&1)==1?n[2]:e[2]]);return new Sr(o,[[-1,0,0,n[0]],[1,0,0,-e[0]],[0,-1,0,n[1]],[0,1,0,-e[1]],[0,0,-1,n[2]],[0,0,1,-e[2]]],e,n)}static fromCenterSizeAngles(e,n,o){const u=c.bA([],o[0],o[1],o[2]),p=c.bB([],[n[0],0,0],u),m=c.bB([],[0,n[1],0],u),_=c.bB([],[0,0,n[2]],u),x=[...e],b=[...e];for(let k=0;k<8;k++)for(let A=0;A<3;A++){const z=e[A]+p[A]*(1&~k?-1:1)+m[A]*((k>>1&1)==1?1:-1)+_[A]*((k>>2&1)==1?1:-1);x[A]=Math.min(x[A],z),b[A]=Math.max(b[A],z)}const T=[];for(let k=0;k<8;k++){const A=[...e];c.a$(A,A,c.a_([],p,1&~k?-1:1)),c.a$(A,A,c.a_([],m,(k>>1&1)==1?1:-1)),c.a$(A,A,c.a_([],_,(k>>2&1)==1?1:-1)),T.push(A)}return new Sr(T,[[...p,-c.b4(p,T[0])],[...m,-c.b4(m,T[0])],[..._,-c.b4(_,T[0])],[-p[0],-p[1],-p[2],-c.b4(p,T[7])],[-m[0],-m[1],-m[2],-c.b4(m,T[7])],[-_[0],-_[1],-_[2],-c.b4(_,T[7])]],x,b)}intersectsFrustum(e){let n=!0;const o=this.points.length,u=this.planes.length,p=e.planes.length,m=e.points.length;for(let _=0;_<p;_++){const x=e.planes[_];let b=0;for(let T=0;T<o;T++){const k=this.points[T];x[0]*k[0]+x[1]*k[1]+x[2]*k[2]+x[3]>=0&&b++}if(b===0)return 0;b<o&&(n=!1)}if(n)return 2;for(let _=0;_<u;_++){const x=this.planes[_];let b=0;for(let T=0;T<m;T++){const k=e.points[T];x[0]*k[0]+x[1]*k[1]+x[2]*k[2]+x[3]>=0&&b++}if(b===0)return 0}return 1}intersectsPlane(e){const n=this.points.length;let o=0;for(let u=0;u<n;u++){const p=this.points[u];e[0]*p[0]+e[1]*p[1]+e[2]*p[2]+e[3]>=0&&o++}return o===n?2:o===0?0:1}}function Ya(d,e,n){const o=d-e;return o<0?-o:Math.max(0,o-n)}function nl(d,e,n,o,u){const p=d-n;let m;return m=p<0?Math.min(-p,1+p-u):p>1?Math.min(Math.max(p-u,0),1-p):0,Math.max(m,Ya(e,o,u))}class oh{constructor(){this._boundingVolumeCache=new Rc(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,n,o,u){const p=1<<o.z,m=1/p,_=o.x/p,x=o.y/p;let b=2;return b=Math.min(b,nl(e,n,_,x,m)),b=Math.min(b,nl(e,n,_+.5,-x-m,m)),b=Math.min(b,nl(e,n,_+.5,2-x-m,m)),b}getWrap(e,n,o){const u=1<<n.z,p=1/u,m=n.x/u,_=Ya(e.x,m,p),x=Ya(e.x,m-1,p),b=Ya(e.x,m+1,p),T=Math.min(_,x,b);return T===b?1:T===x?-1:0}allowVariableZoom(e,n){return Zt(e,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,n,o,u){return this._boundingVolumeCache.getTileBoundingVolume(e,n,o,u)}_computeTileBoundingVolume(e,n,o,u){var p,m;let _=0,x=0;if(u?.terrain){const b=new c.a1(e.z,n,e.z,e.x,e.y),T=u.terrain.getMinMaxElevation(b);_=(p=T.minElevation)!==null&&p!==void 0?p:Math.min(0,o),x=(m=T.maxElevation)!==null&&m!==void 0?m:Math.max(0,o)}if(_/=c.bD,x/=c.bD,_+=1,x+=1,e.z<=0)return Sr.fromAabb([-x,-x,-x],[x,x,x]);if(e.z===1)return Sr.fromAabb([e.x===0?-x:0,e.y===0?0:-x,-x],[e.x===0?0:x,e.y===0?x:0,x]);{const b=[Zr(0,0,e.x,e.y,e.z),Zr(c.a4,0,e.x,e.y,e.z),Zr(c.a4,c.a4,e.x,e.y,e.z),Zr(0,c.a4,e.x,e.y,e.z)],T=[];for(const ft of b)T.push(c.a_([],ft,x));if(x!==_)for(const ft of b)T.push(c.a_([],ft,_));e.y===0&&T.push([0,1,0]),e.y===(1<<e.z)-1&&T.push([0,-1,0]);const k=[1,1,1],A=[-1,-1,-1];for(const ft of T)for(let gt=0;gt<3;gt++)k[gt]=Math.min(k[gt],ft[gt]),A[gt]=Math.max(A[gt],ft[gt]);const z=Zr(c.a4/2,c.a4/2,e.x,e.y,e.z),j=c.b3([],[0,1,0],z);c.b2(j,j);const $=c.b3([],z,j);c.b2($,$);const Z=c.b3([],b[2],b[1]);c.b2(Z,Z);const H=c.b3([],b[0],b[3]);c.b2(H,H),T.push(c.a_([],z,x)),e.y>=(1<<e.z)/2&&T.push(c.a_([],Zr(c.a4/2,0,e.x,e.y,e.z),x)),e.y<(1<<e.z)/2&&T.push(c.a_([],Zr(c.a4/2,c.a4,e.x,e.y,e.z),x));const K=Lc(z,T),it=Lc($,T),Y=[-z[0],-z[1],-z[2],K.max],rt=[z[0],z[1],z[2],-K.min],nt=[-$[0],-$[1],-$[2],it.max],Q=[$[0],$[1],$[2],-it.min],lt=[...Z,0],_t=[...H,0],pt=[];return e.y===0?pt.push(c.bC(_t,lt,Y),c.bC(_t,lt,rt)):pt.push(c.bC(nt,lt,Y),c.bC(nt,lt,rt),c.bC(nt,_t,Y),c.bC(nt,_t,rt)),e.y===(1<<e.z)-1?pt.push(c.bC(_t,lt,Y),c.bC(_t,lt,rt)):pt.push(c.bC(Q,lt,Y),c.bC(Q,lt,rt),c.bC(Q,_t,Y),c.bC(Q,_t,rt)),new Sr(pt,[Y,rt,nt,Q,lt,_t],k,A)}}}function Lc(d,e){let n=1/0,o=-1/0;for(const u of e){const p=c.b4(d,u);n=Math.min(n,p),o=Math.max(o,p)}return{min:n,max:o}}class Ka{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n){this._helper.resize(e,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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(e){}constructor(e){this._cachedClippingPlane=c.bE(),this._projectionMatrix=c.bi(),this._globeViewProjMatrix32f=c.bh(),this._globeViewProjMatrixNoCorrection=c.bi(),this._globeViewProjMatrixNoCorrectionInverted=c.bi(),this._globeProjMatrixInverted=c.bi(),this._cameraPosition=c.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,o)=>{const u=c.an(n.lat,-c.ao,c.ao),p=c.an(+o,this.minZoom+ii(0,u),this.maxZoom);return{center:new c.V(n.lng,u),zoom:p}},this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._coveringTilesDetailsProvider=new oh}clone(){const e=new Ka;return e.apply(this),e}apply(e,n){this._globeLatitudeErrorCorrectionRadians=n||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=c.by();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:n,applyGlobeMatrix:o}=e,u=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:u,clippingPlane:this._cachedClippingPlane,projectionTransition:o?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const n=this.pitchInRadians,o=this.cameraToCenterDistance/e,u=Math.sin(n)*o,p=Math.cos(n)*o+1,m=1/Math.sqrt(u*u+p*p)*1;let _=-u,x=p;const b=Math.sqrt(_*_+x*x);_/=b,x/=b;const T=[0,_,x];c.bF(T,T,[0,0,0],-this.bearingInRadians),c.bG(T,T,[0,0,0],-1*this.center.lat*Math.PI/180),c.bH(T,T,[0,0,0],this.center.lng*Math.PI/180);const k=1/c.b6(T);return c.a_(T,T,k),[...T,-m*k]}isLocationOccluded(e){return!this.isSurfacePointVisible(yi(e))}transformLightDirection(e){const n=this._helper._center.lng*Math.PI/180,o=this._helper._center.lat*Math.PI/180,u=Math.cos(o),p=[Math.sin(n)*u,Math.sin(o),Math.cos(n)*u],m=[p[2],0,-p[0]],_=[0,0,0];c.b3(_,m,p),c.b2(m,m),c.b2(_,_);const x=[0,0,0];return c.b2(x,[m[0]*e[0]+_[0]*e[1]+p[0]*e[2],m[1]*e[0]+_[1]*e[1]+p[1]*e[2],m[2]*e[0]+_[2]*e[1]+p[2]*e[2]]),x}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,n,o){const u=(function(_,x,b){const T=1/(1<<b.z);return new c.aa(_/c.a4*T+b.x*T,x/c.a4*T+b.y*T)})(e,n,o.canonical),p=(m=u.y,[c.bx(u.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(e,n,o,u){const p=o.canonical,m=Zr(e,n,p.x,p.y,p.z),_=1+(u?u(e,n):0)/c.bD,x=[m[0]*_,m[1]*_,m[2]*_,1];c.aG(x,x,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 c.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:T}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Xa(this.worldSize,this.center.lat),n=c.bj(),o=c.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),c.bd(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const u=this.centerOffset;n[8]=2*-u.x/this._helper._width,n[9]=2*u.y/this._helper._height,this._projectionMatrix=c.be(n),this._globeProjMatrixInverted=c.bj(),c.aA(this._globeProjMatrixInverted,n),c.O(n,n,[0,0,-this.cameraToCenterDistance]),c.bf(n,n,this.rollInRadians),c.bg(n,n,-this.pitchInRadians),c.bf(n,n,this.bearingInRadians),c.O(n,n,[0,0,-e]);const p=c.by();p[0]=e,p[1]=e,p[2]=e,c.bg(o,n,this.center.lat*Math.PI/180),c.bI(o,o,-this.center.lng*Math.PI/180),c.Q(o,o,p),this._globeViewProjMatrixNoCorrection=o,c.bg(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),c.bI(n,n,-this.center.lng*Math.PI/180),c.Q(n,n,p),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=c.bj(),c.aA(this._globeViewProjMatrixNoCorrectionInverted,o);const m=c.by();this._cameraPosition=c.by(),this._cameraPosition[2]=this.cameraToCenterDistance/e,c.bF(this._cameraPosition,this._cameraPosition,m,-this.rollInRadians),c.bG(this._cameraPosition,this._cameraPosition,m,this.pitchInRadians),c.bF(this._cameraPosition,this._cameraPosition,m,-this.bearingInRadians),c.a$(this._cameraPosition,this._cameraPosition,[0,0,1]),c.bG(this._cameraPosition,this._cameraPosition,m,-this.center.lat*Math.PI/180),c.bH(this._cameraPosition,this._cameraPosition,m,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=c.be(this._globeViewProjMatrixNoCorrectionInverted);c.Q(_,_,[1,1,-1]),this._cachedFrustum=En.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){c.w("calculateFogMatrix is not supported on globe projection.");const n=c.bj();return c.ar(n),n}getVisibleUnwrappedCoordinates(e){return[new c.bb(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&c.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(e,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const o=yi(e);c.a_(o,o,1+n/c.bD);const u=c.bE();return c.aG(u,[o[0],o[1],o[2],1],this._globeViewProjMatrixNoCorrection),u[2]/u[3]}populateCache(e){}getBounds(){const e=.5*this.width,n=.5*this.height,o=[new c.P(0,0),new c.P(e,0),new c.P(this.width,0),new c.P(this.width,n),new c.P(this.width,this.height),new c.P(e,this.height),new c.P(0,this.height),new c.P(0,n)],u=[];for(const k of o)u.push(this.unprojectScreenPoint(k));let p=0,m=0,_=0,x=0;const b=this.center;for(const k of u){const A=c.bJ(b.lng,k.lng),z=c.bJ(b.lat,k.lat);A<m&&(m=A),A>p&&(p=A),z<x&&(x=z),z>_&&(_=z)}const T=[b.lng+m,b.lat+x,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 Le(T)}calculateCenterFromCameraLngLatAlt(e,n,o,u){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,u)}setLocationAtPoint(e,n){const o=yi(this.unprojectScreenPoint(n)),u=yi(e),p=c.by();c.bK(p);const m=c.by();c.bH(m,o,p,-this.center.lng*Math.PI/180),c.bG(m,m,p,this.center.lat*Math.PI/180);const _=u[0]*u[0]+u[2]*u[2],x=m[0]*m[0];if(_<x)return;const b=Math.sqrt(_-x),T=-b,k=c.bL(u[0],u[2],m[0],b),A=c.bL(u[0],u[2],m[0],T),z=c.by();c.bH(z,u,p,-k);const j=c.bL(z[1],z[2],m[1],m[2]),$=c.by();c.bH($,u,p,-A);const Z=c.bL($[1],$[2],m[1],m[2]),H=.5*Math.PI,K=j>=-H&&j<=H,it=Z>=-H&&Z<=H;let Y,rt;if(K&&it){const _t=this.center.lng*Math.PI/180,pt=this.center.lat*Math.PI/180;c.bM(k,_t)+c.bM(j,pt)<c.bM(A,_t)+c.bM(Z,pt)?(Y=k,rt=j):(Y=A,rt=Z)}else if(K)Y=k,rt=j;else{if(!it)return;Y=A,rt=Z}const nt=Y/Math.PI*180,Q=rt/Math.PI*180,lt=this.center.lat;this.setCenter(new c.V(nt,c.an(Q,-90,90))),this.setZoom(this.zoom+ii(lt,this.center.lat))}locationToScreenPoint(e,n){const o=yi(e);if(n){const u=n.getElevationForLngLatZoom(e,this._helper._tileZoom);c.a_(o,o,1+u/c.bD)}return this._projectSurfacePointToScreen(o)}_projectSurfacePointToScreen(e){const n=c.bE();return c.aG(n,[...e,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new c.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,n){if(n){const o=n.pointCoordinate(e);if(o)return o}return c.aa.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,n){var o;return(o=this.screenPointToMercatorCoordinate(e,n))===null||o===void 0?void 0:o.toLngLat()}isPointOnMapSurface(e,n){const o=this._cameraPosition,u=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(o,u)}getRayDirectionFromPixel(e){const n=c.bE();n[0]=e.x/this.width*2-1,n[1]=-1*(e.y/this.height*2-1),n[2]=1,n[3]=1,c.aG(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const o=c.by();o[0]=n[0]-this._cameraPosition[0],o[1]=n[1]-this._cameraPosition[1],o[2]=n[2]-this._cameraPosition[2];const u=c.by();return c.b2(u,o),u}isSurfacePointVisible(e){const n=this._cachedClippingPlane;return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const n=c.bE();return c.aG(n,[...e,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(e,n){const o=c.b4(e,n),u=c.by(),p=c.by();c.a_(p,n,o),c.b1(u,e,p);const m=1-c.b4(u,u);if(m<0)return null;const _=c.b4(e,e)-1,x=-o+(o<0?1:-1)*Math.sqrt(m),b=_/x,T=x;return{tMin:Math.min(b,T),tMax:Math.max(b,T)}}unprojectScreenPoint(e){const n=this._cameraPosition,o=this.getRayDirectionFromPixel(e),u=this.rayPlanetIntersection(n,o);if(u){const T=c.by();c.a$(T,n,[o[0]*u.tMin,o[1]*u.tMin,o[2]*u.tMin]);const k=c.by();return c.b2(k,T),zc(k)}const p=this._cachedClippingPlane,m=p[0]*o[0]+p[1]*o[1]+p[2]*o[2],_=-c.ba(p,n)/m,x=c.by();if(_>0)c.a$(x,n,[o[0]*_,o[1]*_,o[2]*_]);else{const T=c.by();c.a$(T,n,[2*o[0],2*o[1],2*o[2]]);const k=c.ba(this._cachedClippingPlane,T);c.b1(x,T,[this._cachedClippingPlane[0]*k,this._cachedClippingPlane[1]*k,this._cachedClippingPlane[2]*k])}const b=(function(T){const k=c.by();return k[0]=T[0]*-T[3],k[1]=T[1]*-T[3],k[2]=T[2]*-T[3],{center:k,radius:Math.sqrt(1-T[3]*T[3])}})(p);return zc((function(T,k,A){const z=c.by();c.b1(z,A,T);const j=c.by();return c.bz(j,T,z,k/c.b8(z)),j})(b.center,b.radius,x))}getMatrixForModel(e,n){const o=c.V.convert(e),u=1/c.bD,p=c.bi();return c.bI(p,p,o.lng/180*Math.PI),c.bg(p,p,-o.lat/180*Math.PI),c.O(p,p,[0,0,1+n/c.bD]),c.bg(p,p,.5*Math.PI),c.Q(p,p,[u,u,u]),p}getProjectionDataForCustomLayer(e=!0){const n=this.getProjectionData({overscaledTileID:new c.a1(0,0,0,0,0),applyGlobeMatrix:e});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(e){}}class Ja{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,n,o){return this._helper.interpolatePadding(e,n,o)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,n,o=!0){this._helper.resize(e,n,o)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,n){this._helper.overrideNearFarZ(e,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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(e,n){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,o)=>this.currentTransform.defaultConstrain(n,o),this.applyConstrain=(n,o)=>this._helper.applyConstrain(n,o),this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,o)=>this.defaultConstrain(n,o)},e),this._globeness=1,this._mercatorTransform=new Ce,this._verticalPerspectiveTransform=new Ka}clone(){const e=new Ja;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,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(e){const n=this._mercatorTransform.getProjectionData(e),o=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?o.mainMatrix:n.mainMatrix,clippingPlane:o.clippingPlane,tileMercatorCoords:o.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return c.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,n,o){const u=this._mercatorTransform.getPitchedTextCorrection(e,n,o),p=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,n,o);return c.bt(u,p,this._globeness)}projectTileCoordinates(e,n,o,u){return this.currentTransform.projectTileCoordinates(e,n,o,u)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,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(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,n){return this.currentTransform.lngLatToCameraDepth(e,n)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,n,o,u){return this._helper.calculateCenterFromCameraLngLatAlt(e,n,o,u)}setLocationAtPoint(e,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,n),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,n),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,n){return this.currentTransform.locationToScreenPoint(e,n)}screenPointToMercatorCoordinate(e,n){return this.currentTransform.screenPointToMercatorCoordinate(e,n)}screenPointToLocation(e,n){return this.currentTransform.screenPointToLocation(e,n)}isPointOnMapSurface(e,n){return this.currentTransform.isPointOnMapSurface(e,n)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,n){return this.currentTransform.getMatrixForModel(e,n)}getProjectionDataForCustomLayer(e=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return n;const o=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return o.fallbackMatrix=n.mainMatrix,o}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Wi{get useGlobeControls(){return!0}handlePanInertia(e,n){const o=Tr(e,n);return Math.abs(o.lng-n.center.lng)>180&&(o.lng=n.center.lng+179.5*Math.sign(o.lng-n.center.lng)),{easingCenter:o,easingOffset:new c.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,n){const o=e.around,u=n.screenPointToLocation(o);e.bearingDelta&&n.setBearing(n.bearing+e.bearingDelta),e.pitchDelta&&n.setPitch(n.pitch+e.pitchDelta),e.rollDelta&&n.setRoll(n.roll+e.rollDelta);const p=n.zoom;e.zoomDelta&&n.setZoom(n.zoom+e.zoomDelta);const m=n.zoom-p;if(m===0)return;const _=c.bJ(n.center.lng,u.lng),x=_/(Math.abs(_/180)+1),b=c.bJ(n.center.lat,u.lat),T=n.getRayDirectionFromPixel(o),k=n.cameraPosition,A=-1*c.b4(k,T),z=c.by();c.a$(z,k,[T[0]*A,T[1]*A,T[2]*A]);const j=c.b6(z)-1,$=Math.exp(.5*-Math.max(j-.3,0)),Z=Xa(n.worldSize,n.center.lat)/Math.min(n.width,n.height),H=c.bw(Z,.9,.5,1,.25),K=(1-c.aq(-m))*Math.min($,H),it=n.center.lat,Y=n.zoom,rt=new c.V(n.center.lng+x*K,c.an(n.center.lat+b*K,-c.ao,c.ao));n.setLocationAtPoint(u,o);const nt=n.center,Q=c.bw(Math.abs(_),45,85,0,1),lt=c.bw(Z,.75,.35,0,1),_t=Math.pow(Math.max(Q,lt),.25),pt=c.bJ(nt.lng,rt.lng),ft=c.bJ(nt.lat,rt.lat);n.setCenter(new c.V(nt.lng+pt*_t,nt.lat+ft*_t).wrap()),n.setZoom(Y+ii(it,n.center.lat))}handleMapControlsPan(e,n,o){if(!e.panDelta)return;const u=n.center.lat,p=n.zoom;n.setCenter(Tr(e.panDelta,n).wrap()),n.setZoom(p+ii(u,n.center.lat))}cameraForBoxAndBearing(e,n,o,u,p){const m=ia(e,n,o,u,p),_=n.left/p.width*2-1,x=(p.width-n.right)/p.width*2-1,b=n.top/p.height*-2+1,T=(p.height-n.bottom)/p.height*-2+1,k=c.bJ(o.getWest(),o.getEast())<0,A=k?o.getEast():o.getWest(),z=k?o.getWest():o.getEast(),j=Math.max(o.getNorth(),o.getSouth()),$=Math.min(o.getNorth(),o.getSouth()),Z=A+.5*c.bJ(A,z),H=j+.5*c.bJ(j,$),K=p.clone();K.setCenter(m.center),K.setBearing(m.bearing),K.setPitch(0),K.setRoll(0),K.setZoom(m.zoom);const it=K.modelViewProjectionMatrix,Y=[yi(o.getNorthWest()),yi(o.getNorthEast()),yi(o.getSouthWest()),yi(o.getSouthEast()),yi(new c.V(z,H)),yi(new c.V(A,H)),yi(new c.V(Z,j)),yi(new c.V(Z,$))],rt=yi(m.center);let nt=Number.POSITIVE_INFINITY;for(const Q of Y)_<0&&(nt=Wi.getLesserNonNegativeNonNull(nt,Wi.solveVectorScale(Q,rt,it,"x",_))),x>0&&(nt=Wi.getLesserNonNegativeNonNull(nt,Wi.solveVectorScale(Q,rt,it,"x",x))),b>0&&(nt=Wi.getLesserNonNegativeNonNull(nt,Wi.solveVectorScale(Q,rt,it,"y",b))),T<0&&(nt=Wi.getLesserNonNegativeNonNull(nt,Wi.solveVectorScale(Q,rt,it,"y",T)));if(Number.isFinite(nt)&&nt!==0)return m.zoom=K.zoom+c.at(nt),m;Cs()}handleJumpToCenterZoom(e,n){const o=e.center.lat,u=e.applyConstrain(n.center?c.V.convert(n.center):e.center,e.zoom).center;e.setCenter(u.wrap());const p=n.zoom!==void 0?+n.zoom:e.zoom+ii(o,u.lat);e.zoom!==p&&e.setZoom(p)}handleEaseTo(e,n){const o=e.zoom,u=e.center,p=e.padding,m={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},x=n.zoom!==void 0,b=!e.isPaddingEqual(n.padding);let T=!1;const k=n.center?c.V.convert(n.center):u,A=e.applyConstrain(k,o).center;qa(e,A);const z=e.clone();z.setCenter(A),z.setZoom(x?+n.zoom:o+ii(u.lat,k.lat)),z.setBearing(n.bearing);const j=new c.P(c.an(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),c.an(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));z.setLocationAtPoint(A,j);const $=(n.offset&&n.offsetAsPoint.mag())>0?z.center:A,Z=x?+n.zoom:o+ii(u.lat,$.lat),H=o+ii(u.lat,0),K=Z+ii($.lat,0),it=c.bJ(u.lng,$.lng),Y=c.bJ(u.lat,$.lat),rt=c.aq(K-H);return T=Z!==o,{easeFunc:nt=>{if(c.bn(m,_)||Cn({startEulerAngles:m,endEulerAngles:_,tr:e,k:nt,useSlerp:m.roll!=_.roll}),b&&e.interpolatePadding(p,n.padding,nt),n.around)c.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(n.around,n.aroundPoint);else{const Q=K>H?Math.min(2,rt):Math.max(.5,rt),lt=Math.pow(Q,1-nt),_t=rl(u,it,Y,nt*lt);e.setCenter(_t.wrap())}if(T){const Q=c.G.number(H,K,nt)+ii(0,e.center.lat);e.setZoom(Q)}},isZooming:T,elevationCenter:$}}handleFlyTo(e,n){const o=n.zoom!==void 0,u=e.center,p=e.zoom,m=e.padding,_=!e.isPaddingEqual(n.padding),x=e.applyConstrain(c.V.convert(n.center||n.locationAtOffset),p).center,b=o?+n.zoom:e.zoom+ii(e.center.lat,x.lat),T=e.clone();T.setCenter(x),T.setZoom(b),T.setBearing(n.bearing);const k=new c.P(c.an(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),c.an(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));T.setLocationAtPoint(x,k);const A=T.center;qa(e,A);const z=(function(Y,rt,nt){const Q=yi(rt),lt=yi(nt),_t=c.b4(Q,lt),pt=Math.acos(_t),ft=Dc(Y);return pt/(2*Math.PI)*ft})(e,u,A),j=p+ii(u.lat,0),$=b+ii(A.lat,0),Z=c.aq($-j);let H;if(typeof n.minZoom=="number"){const Y=+n.minZoom+ii(A.lat,0),rt=Math.min(Y,j,$)+ii(0,A.lat),nt=e.applyConstrain(A,rt).zoom+ii(A.lat,0);H=c.aq(nt-j)}const K=c.bJ(u.lng,A.lng),it=c.bJ(u.lat,A.lat);return{easeFunc:(Y,rt,nt,Q)=>{const lt=rl(u,K,it,nt);_&&e.interpolatePadding(m,n.padding,Y);const _t=Y===1?A:lt;e.setCenter(_t.wrap());const pt=j+c.at(rt);e.setZoom(Y===1?b:pt+ii(0,_t.lat))},scaleOfZoom:Z,targetCenter:A,scaleOfMinZoom:H,pixelPathLength:z}}static solveVectorScale(e,n,o,u,p){const m=u==="x"?[o[0],o[4],o[8],o[12]]:[o[1],o[5],o[9],o[13]],_=[o[3],o[7],o[11],o[15]],x=e[0]*m[0]+e[1]*m[1]+e[2]*m[2],b=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],T=n[0]*m[0]+n[1]*m[1]+n[2]*m[2],k=n[0]*_[0]+n[1]*_[1]+n[2]*_[2];return T+p*b===x+p*k||_[3]*(x-T)+m[3]*(k-b)+x*k==T*b?null:(T+m[3]-p*k-p*_[3])/(T-x-p*k+p*b)}static getLesserNonNegativeNonNull(e,n){return n!==null&&n>=0&&n<e?n:e}}class Qa{constructor(e){this._globe=e,this._mercatorCameraHelper=new qi,this._verticalPerspectiveCameraHelper=new Wi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,n){return this.currentHelper.handlePanInertia(e,n)}handleMapControlsRollPitchBearingZoom(e,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,n)}handleMapControlsPan(e,n,o){this.currentHelper.handleMapControlsPan(e,n,o)}cameraForBoxAndBearing(e,n,o,u,p){return this.currentHelper.cameraForBoxAndBearing(e,n,o,u,p)}handleJumpToCenterZoom(e,n){this.currentHelper.handleJumpToCenterZoom(e,n)}handleEaseTo(e,n){return this.currentHelper.handleEaseTo(e,n)}handleFlyTo(e,n){return this.currentHelper.handleFlyTo(e,n)}}const ts=(d,e)=>c.B(d,e&&e.filter((n=>n.identifier!=="source.canvas"))),sl=c.bN();class aa extends c.E{constructor(e,n={}){var o,u;super(),this._rtlPluginLoaded=()=>{for(const m in this.tileManagers){const _=this.tileManagers[m].getSource().type;_!=="vector"&&_!=="geojson"||this.tileManagers[m].reload()}},this.map=e,this.dispatcher=new Fr(tn(),e._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 mr,this.imageManager.setEventedParent(this);const p=((o=e._container)===null||o===void 0?void 0:o.lang)||typeof document<"u"&&((u=document.documentElement)===null||u===void 0?void 0:u.lang)||void 0;this.glyphManager=new wi(e._requestManager,n.localIdeographFontFamily,p),this.lineAtlas=new _r(256,512),this.crossTileSymbolIndex=new Jn,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",c.bO()),vr().on(Sn,this._rtlPluginLoaded),this.on("data",(m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const _=this.tileManagers[m.sourceId];if(!_)return;const x=_.getSource();if(x&&x.vectorLayerIds)for(const b in this._layers){const T=this._layers[b];T.source===x.id&&this._validateLayer(T)}}))}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new c.bP,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(((e=this.crossTileSymbolIndex)===null||e===void 0?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,n){var o,u,p;this._checkLoaded();const m=n===null?(p=(u=(o=this.stylesheet.state)===null||o===void 0?void 0:o[e])===null||u===void 0?void 0:u.default)!==null&&p!==void 0?p:null:n;if(c.bQ(m,this._globalState[e]))return this;this._globalState[e]=m,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const n=[];for(const o in e)!c.bQ(this._globalState[o],e[o].default)&&(n.push(o),this._globalState[o]=e[o].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(e){if(e.length===0)return;const n=new Set,o={};for(const u of e){o[u]=this._globalState[u];for(const p in this._layers){const m=this._layers[p],_=m.getLayoutAffectingGlobalStateRefs(),x=m.getPaintAffectingGlobalStateRefs();if(_.has(u)&&n.add(m.source),x.has(u))for(const{name:b,value:T}of x.get(u))this._updatePaintProperty(m,b,T)}}this.dispatcher.broadcast("UGS",o);for(const u in this.tileManagers)n.has(u)&&(this._reloadSource(u),this._changed=!0)}loadURL(e,n={},o){this.fire(new c.l("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const u=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const p=this._loadStyleRequest;c.j(u,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,n,o)})).catch((m=>{this._loadStyleRequest=null,m&&!p.signal.aborted&&this.fire(new c.k(m))}))}loadJSON(e,n={},o){this.fire(new c.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ce.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,o)})).catch((()=>{}))}loadEmpty(){this.fire(new c.l("dataloading",{dataType:"style"})),this._load(sl,{validate:!1})}_load(e,n,o){var u,p;let m=n.transformStyle?n.transformStyle(o,e):e;if(!n.validate||!ts(this,c.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 vn(this.stylesheet.light),this._setProjectionInternal(((u=this.stylesheet.projection)===null||u===void 0?void 0:u.type)||"mercator"),this.sky=new gr(this.stylesheet.sky),this.map.setTerrain((p=this.stylesheet.terrain)!==null&&p!==void 0?p:null),this.fire(new c.l("data",{dataType:"style"})),this.fire(new c.l("style.load"))}}_createLayers(){var e,n,o;const u=c.bR(this.stylesheet.layers);this.setGlobalState((e=this.stylesheet.state)!==null&&e!==void 0?e:null),this.dispatcher.broadcast("SL",u),this._order=u.map((p=>p.id)),this._layers={},this._serializedLayers=null;for(const p of u){const m=c.bS(p,this._globalState);if(m.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=m,c.bT(m)&&this.tileManagers[m.source]){const _=(o=(n=p.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&o!==void 0?o:m.paint.get("raster-fade-duration");this.tileManagers[m.source].setRasterFadeDuration(_)}}}_loadSprite(e,n=!1,o=void 0){let u;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(p,m,_,x){return c._(this,void 0,void 0,(function*(){const b=zi(p),T=_>1?"@2x":"",k={},A={};for(const{id:z,url:j}of b){const $=m.transformRequest(rr(j,T,".json"),"SpriteJSON");k[z]=c.j($,x);const Z=m.transformRequest(rr(j,T,".png"),"SpriteImage");A[z]=_i.getImage(Z,x)}return yield Promise.all([...Object.values(k),...Object.values(A)]),(function(z,j){return c._(this,void 0,void 0,(function*(){const $={};for(const Z in z){$[Z]={};const H=ce.getImageCanvasContext((yield j[Z]).data),K=(yield z[Z]).data;for(const it in K){const{width:Y,height:rt,x:nt,y:Q,sdf:lt,pixelRatio:_t,stretchX:pt,stretchY:ft,content:gt,textFitWidth:Dt,textFitHeight:Et}=K[it];$[Z][it]={data:null,pixelRatio:_t,sdf:lt,stretchX:pt,stretchY:ft,content:gt,textFitWidth:Dt,textFitHeight:Et,spriteData:{width:Y,height:rt,x:nt,y:Q,context:H}}}}return $}))})(k,A)}))})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((p=>{if(this._spriteRequest=null,p)for(const m in p){this._spritesImagesIds[m]=[];const _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter((x=>!(x in p))):[];for(const x of _)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in p[m]){const b=m==="default"?x:`${m}:${x}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,p[m][x],!1):this.imageManager.addImage(b,p[m][x]),n&&(this._changedImages[b]=!0)}}})).catch((p=>{this._spriteRequest=null,u=p,this.fire(new c.k(u))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"})),o&&o(u)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}_validateLayer(e){const n=this.tileManagers[e.source];if(!n)return;const o=e.sourceLayer;if(!o)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(o)===-1)&&this.fire(new c.k(new Error(`Source layer "${o}" does not exist on source "${u.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){const o=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?c.bU(o):o);const u=[];for(const p of e)if(o[p]){const m=n?c.bU(o[p]):o[p];u.push(m)}return u}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const n=Object.keys(this._layers);for(const o of n){const u=this._layers[o];u.type!=="custom"&&(e[o]=u.serialize())}return e}hasTransitions(){var e,n,o;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((o=this.projection)===null||o===void 0)&&o.hasTransition())return!0;for(const u in this.tileManagers)if(this.tileManagers[u].hasTransition())return!0;for(const u in this._layers)if(this._layers[u].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const n=this._changed;if(n){const u=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,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(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const o={};for(const u in this.tileManagers){const p=this.tileManagers[u];o[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(e,this._availableImages),!p.isHidden(e.zoom)&&p.source&&(this.tileManagers[p.source].used=!0)}for(const u in o){const p=this.tileManagers[u];!!o[u]!=!!p.used&&p.fire(new c.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,n&&this.fire(new c.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var o;this._checkLoaded();const u=this.serialize();if(e=n.transformStyle?n.transformStyle(u,e):e,((o=n.validate)===null||o===void 0||o)&&ts(this,c.C(e)))return!1;(e=c.bU(e)).layers=c.bR(e.layers);const p=c.bV(u,e),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=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const n=[],o=[];for(const u of e)switch(u.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,u.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,u.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,u.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,u.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,u.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,u.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,u.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,u.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,u.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,u.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,u.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,u.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,u.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,u.args)));break;case"setProjection":this.setProjection.apply(this,u.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,u.args)));break;case"setTransition":n.push((()=>{}));break;default:o.push(u.command)}return{operations:n,unimplemented:o}}addImage(e,n){if(this.getImage(e))return this.fire(new c.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new c.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,o={}){if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw new Error(`Source "${e}" 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(c.C.source,`sources.${e}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.tileManagers[e]=new ne(e,n,this.dispatcher);u.style=this,u.setEventedParent(this,(()=>({isSourceLoaded:u.loaded(),source:u.serialize(),sourceId:e}))),u.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw new Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===e)return this.fire(new c.k(new Error(`Source "${e}" cannot be removed while layer "${o}" is using it.`)));const n=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],n.fire(new c.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const o=this.tileManagers[e].getSource();if(o.type!=="geojson")throw new Error(`geojsonSource.type is ${o.type}, which is !== 'geojson`);o.setData(n),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,n,o={}){this._checkLoaded();const u=e.id;if(this.getLayer(u))return void this.fire(new c.k(new Error(`Layer "${u}" already exists on this map.`)));let p;if(e.type==="custom"){if(ts(this,c.bW(e)))return;p=c.bS(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(u,e.source),e=c.bU(e),e=c.e(e,{source:u})),this._validate(c.C.layer,`layers.${u}`,e,{arrayIndex:-1},o))return;p=c.bS(e,this._globalState),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.k(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,u),this._layerOrderChanged=!0,this._layers[u]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.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(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new c.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const o=this._order.indexOf(e);this._order.splice(o,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new c.k(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(u,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new c.k(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);const o=this._order.indexOf(e);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,o){this._checkLoaded();const u=this.getLayer(e);u?u.minzoom===n&&u.maxzoom===o||(n!=null&&(u.minzoom=n),o!=null&&(u.maxzoom=o),this._updateLayer(u)):this.fire(new c.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,o={}){this._checkLoaded();const u=this.getLayer(e);if(u){if(!c.bQ(u.filter,n))return n==null?(u.setFilter(void 0),void this._updateLayer(u)):void(this._validate(c.C.filter,`layers.${u.id}.filter`,n,null,o)||(u.setFilter(c.bU(n)),this._updateLayer(u)))}else this.fire(new c.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return c.bU(this.getLayer(e).filter)}setLayoutProperty(e,n,o,u={}){this._checkLoaded();const p=this.getLayer(e);p?c.bQ(p.getLayoutProperty(n),o)||(p.setLayoutProperty(n,o,u),this._updateLayer(p)):this.fire(new c.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){const o=this.getLayer(e);if(o)return o.getLayoutProperty(n);this.fire(new c.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,o,u={}){this._checkLoaded();const p=this.getLayer(e);p?c.bQ(p.getPaintProperty(n),o)||this._updatePaintProperty(p,n,o,u):this.fire(new c.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,n,o,u={}){e.setPaintProperty(n,o,u)&&this._updateLayer(e),c.bT(e)&&n==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(o),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();const o=e.source,u=e.sourceLayer,p=this.tileManagers[o];if(p===void 0)return void this.fire(new c.k(new Error(`The source '${o}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&u?this.fire(new c.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||u?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),p.setFeatureState(u,e.id,n)):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();const o=e.source,u=this.tileManagers[o];if(u===void 0)return void this.fire(new c.k(new Error(`The source '${o}' does not exist in the map's style.`)));const p=u.getSource().type,m=p==="vector"?e.sourceLayer:void 0;p!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new c.k(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(m,e.id,n):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const n=e.source,o=e.sourceLayer,u=this.tileManagers[n];if(u!==void 0)return u.getSource().type!=="vector"||o?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),u.getFeatureState(o,e.id)):void this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=c.bX(this.tileManagers,(p=>p.serialize())),n=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,u=this.stylesheet;return c.bY({version:u.version,name:u.name,metadata:u.metadata,light:u.light,sky:u.sky,center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch,sprite:u.sprite,glyphs:u.glyphs,transition:u.transition,projection:u.projection,sources:e,layers:n,terrain:o},(p=>p!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const n=m=>this._layers[m].type==="fill-extrusion",o={},u=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){o[_]=m;for(const x of e){const b=x[_];if(b)for(const T of b)u.push(T)}}}u.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 x=u.length-1;x>=0;x--){const b=u[x].feature;if(o[b.layer.id]<m)break;p.push(b),u.pop()}else for(const x of e){const b=x[_];if(b)for(const T of b)p.push(T.feature)}}return p}queryRenderedFeatures(e,n,o){n&&n.filter&&this._validate(c.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new c.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 c.k(new Error(`The layer '${b}' does not exist in the map's style and cannot be queried for features.`))),[];u[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,x=Object.assign(Object.assign({},n),{layers:_,globalState:this._globalState});for(const b in this.tileManagers)n.layers&&!u[b]||p.push(bn(this.tileManagers[b],this._layers,m,e,x,o,this.map.terrain?(T,k,A)=>this.map.terrain.getElevation(T,k,A):void 0));return this.placement&&p.push((function(b,T,k,A,z,j,$){const Z={},H=j.queryRenderedSymbols(A),K=[];for(const it of Object.keys(H).map(Number))K.push($[it]);K.sort(Re);for(const it of K){const Y=it.featureIndex.lookupSymbolFeatures(H[it.bucketInstanceId],T,it.bucketIndex,it.sourceLayerIndex,{filterSpec:z.filter,globalState:z.globalState},z.layers,z.availableImages,b);for(const rt in Y){const nt=Z[rt]=Z[rt]||[],Q=Y[rt];Q.sort(((lt,_t)=>{const pt=it.featureSortOrder;if(pt){const ft=pt.indexOf(lt.featureIndex);return pt.indexOf(_t.featureIndex)-ft}return _t.featureIndex-lt.featureIndex}));for(const lt of Q)nt.push(lt)}}return(function(it,Y,rt){for(const nt in it)for(const Q of it[nt])xr(Q,rt[Y[nt].source]);return it})(Z,b,k)})(this._layers,m,this.tileManagers,e,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(e,n){n?.filter&&this._validate(c.C.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this.tileManagers[e];return o?(function(u,p){const m=u.getRenderableIds().map((b=>u.getTileByID(b))),_=[],x={};for(let b=0;b<m.length;b++){const T=m[b],k=T.tileID.canonical.key;x[k]||(x[k]=!0,T.querySourceFeatures(_,p))}return _})(o,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const o=this.light.getLight();let u=!1;for(const m in e)if(!c.bQ(e[m],o[m])){u=!0;break}if(!u)return;const p={now:qt(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(p)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,n={}){this._checkLoaded();const o=this.getSky();let u=!1;if(!e&&!o)return;if(e&&!o)u=!0;else if(!e&&o)u=!0;else for(const m in e)if(!c.bQ(e[m],o[m])){u=!0;break}if(!u)return;const p={now:qt(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(p)}_setProjectionInternal(e){const n=(function(o,u){const p={constrainOverride:u};if(Array.isArray(o)){const m=new Ds({type:o});return{projection:m,transform:new Ja(p),cameraHelper:new Qa(m)}}switch(o){case"mercator":return{projection:new ci,transform:new Ce(p),cameraHelper:new qi};case"globe":{const m=new Ds({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:m,transform:new Ja(p),cameraHelper:new Qa(m)}}case"vertical-perspective":return{projection:new sa,transform:new Ka(p),cameraHelper:new Wi};default:return c.w(`Unknown projection name: ${o}. Falling back to mercator projection.`),{projection:new ci,transform:new Ce(p),cameraHelper:new qi}}})(e,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const o in this.tileManagers)this.tileManagers[o].reload()}_validate(e,n,o,u,p={}){return(!p||p.validate!==!1)&&ts(this,e.call(c.C,c.e({key:n,style:this.serialize(),value:o,styleSpec:c.u},u)))}_remove(e=!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),vr().off(Sn,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const o=this.tileManagers[n];o.setEventedParent(null),o.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const n in this.tileManagers)this.tileManagers[n].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,n,o,u,p=!1){let m=!1,_=!1;const x={};for(const b of this._order){const T=this._layers[b];if(T.type!=="symbol")continue;if(!x[T.source]){const A=this.tileManagers[T.source];x[T.source]=A.getRenderableIds(!0).map((z=>A.getTileByID(z))).sort(((z,j)=>j.tileID.overscaledZ-z.tileID.overscaledZ||(z.tileID.isLessThan(j.tileID)?-1:1)))}const k=this.crossTileSymbolIndex.addLayer(T,x[T.source],e.center.lng);m=m||k}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||o===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(qt(),e.zoom))&&(this.pauseablePlacement=new Cc(e,this.map.terrain,this._order,p,n,o,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,x),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(qt()),_=!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,x[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(qt())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,n){return c._(this,void 0,void 0,(function*(){const o=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const u=this.tileManagers[n.source];return u&&u.setDependencies(n.tileID.key,n.type,n.icons),o}))}getGlyphs(e,n){return c._(this,void 0,void 0,(function*(){const o=yield this.glyphManager.getGlyphs(n.stacks),u=this.tileManagers[n.source];return u&&u.setDependencies(n.tileID.key,n.type,[""]),o}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(c.C.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,n){return c._(this,void 0,void 0,(function*(){const o={};for(const[u,p]of Object.entries(n.dashes))o[u]=this.lineAtlas.getDash(p.dasharray,p.round);return o}))}addSprite(e,n,o={},u){this._checkLoaded();const p=[{id:e,url:n}],m=[...zi(this.stylesheet.sprite),...p];this._validate(c.C.sprite,"sprite",m,null,o)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,u))}removeSprite(e){this._checkLoaded();const n=zi(this.stylesheet.sprite);if(n.find((o=>o.id===e))){if(this._spritesImagesIds[e])for(const o of this._spritesImagesIds[e])this.imageManager.removeImage(o),this._changedImages[o]=!0;n.splice(n.findIndex((o=>o.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}else this.fire(new c.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return zi(this.stylesheet.sprite)}setSprite(e,n={},o){this._checkLoaded(),e&&this._validate(c.C.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,o):(this._unloadSprite(),o&&o(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 e in this.tileManagers){const n=this.tileManagers[e];if(n.setEventedParent(null),n._tiles){for(const o in n._tiles)n._tiles[o].unloadVectorData();n._tiles={}}n._cache.reset(),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 e in this._layers){const n=this._layers[e];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 qr=c.aT([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class lh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,o,u,p,m,_,x,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==u.length;for(let k=0;!T&&k<u.length;k++)this.boundPaintVertexBuffers[k]!==u[k]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||T||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,u,p,m,_,x,b):(e.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),x&&x.bind(),b&&b.bind())}freshBind(e,n,o,u,p,m,_,x){const b=e.numAttributes,T=this.context,k=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,n.enableAttributes(k,e);for(const A of o)A.enableAttributes(k,e);m&&m.enableAttributes(k,e),_&&_.enableAttributes(k,e),x&&x.enableAttributes(k,e),n.bind(),n.setVertexAttribPointers(k,e,p);for(const A of o)A.bind(),A.setVertexAttribPointers(k,e,p);m&&(m.bind(),m.setVertexAttribPointers(k,e,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(k,e,p)),x&&(x.bind(),x.setVertexAttribPointers(k,e,p)),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const al=(d,e,n,o,u)=>({u_texture:0,u_ele_delta:d,u_fog_matrix:e,u_fog_color:n?n.properties.get("fog-color"):c.bo.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?0:n?n.calculateFogBlendOpacity(o):0,u_horizon_color:n?n.properties.get("horizon-color"):c.bo.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:u?1:0}),oa={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 An(d){const e=[];for(let n=0;n<d.length;n++){if(d[n]===null)continue;const o=d[n].split(" ");e.push(o.pop())}return e}class ch{constructor(e,n,o,u,p,m,_,x,b=[]){const T=e.gl;this.program=T.createProgram();const k=An(n.staticAttributes),A=o?o.getBinderAttributes():[],z=k.concat(A),j=ar.prelude.staticUniforms?An(ar.prelude.staticUniforms):[],$=_.staticUniforms?An(_.staticUniforms):[],Z=n.staticUniforms?An(n.staticUniforms):[],H=o?o.getBinderUniforms():[],K=j.concat($).concat(Z).concat(H),it=[];for(const pt of K)it.indexOf(pt)<0&&it.push(pt);const Y=o?o.defines():[];wr(T)&&Y.unshift("#version 300 es"),p&&Y.push("#define OVERDRAW_INSPECTOR;"),m&&Y.push("#define TERRAIN3D;"),x&&Y.push(x),b&&Y.push(...b);let rt=Y.concat(ar.prelude.fragmentSource,_.fragmentSource,n.fragmentSource).join(`
|
|
802
|
+
`),nt=Y.concat(ar.prelude.vertexSource,_.vertexSource,n.vertexSource).join(`
|
|
803
|
+
`);wr(T)||(rt=(function(pt){return pt.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(rt),nt=(function(pt){return pt.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(nt));const Q=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(Q,rt),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 lt=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(lt,nt),T.compileShader(lt),!T.getShaderParameter(lt,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(lt)}`);T.attachShader(this.program,lt),this.attributes={};const _t={};this.numAttributes=z.length;for(let pt=0;pt<this.numAttributes;pt++)z[pt]&&(T.bindAttribLocation(this.program,pt,z[pt]),this.attributes[z[pt]]=pt);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(lt),T.deleteShader(Q);for(let pt=0;pt<it.length;pt++){const ft=it[pt];if(ft&&!_t[ft]){const gt=T.getUniformLocation(this.program,ft);gt&&(_t[ft]=gt)}}this.fixedUniforms=u(e,_t),this.terrainUniforms=((pt,ft)=>({u_depth:new c.bZ(pt,ft.u_depth),u_terrain:new c.bZ(pt,ft.u_terrain),u_terrain_dim:new c.bp(pt,ft.u_terrain_dim),u_terrain_matrix:new c.b$(pt,ft.u_terrain_matrix),u_terrain_unpack:new c.c0(pt,ft.u_terrain_unpack),u_terrain_exaggeration:new c.bp(pt,ft.u_terrain_exaggeration)}))(e,_t),this.projectionUniforms=((pt,ft)=>({u_projection_matrix:new c.b$(pt,ft.u_projection_matrix),u_projection_tile_mercator_coords:new c.c0(pt,ft.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.c0(pt,ft.u_projection_clipping_plane),u_projection_transition:new c.bp(pt,ft.u_projection_transition),u_projection_fallback_matrix:new c.b$(pt,ft.u_projection_fallback_matrix)}))(e,_t),this.binderUniforms=o?o.getUniforms(e,_t):[]}draw(e,n,o,u,p,m,_,x,b,T,k,A,z,j,$,Z,H,K,it){const Y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(o),e.setStencilMode(u),e.setColorMode(p),e.setCullFace(m),x){e.activeTexture.set(Y.TEXTURE2),Y.bindTexture(Y.TEXTURE_2D,x.depthTexture),e.activeTexture.set(Y.TEXTURE3),Y.bindTexture(Y.TEXTURE_2D,x.texture);for(const nt in this.terrainUniforms)this.terrainUniforms[nt].set(x[nt])}if(b)for(const nt in b)this.projectionUniforms[oa[nt]].set(b[nt]);if(_)for(const nt in this.fixedUniforms)this.fixedUniforms[nt].set(_[nt]);Z&&Z.setUniforms(e,this.binderUniforms,j,{zoom:$});let rt=0;switch(n){case Y.LINES:rt=2;break;case Y.TRIANGLES:rt=3;break;case Y.LINE_STRIP:rt=1}for(const nt of z.get()){const Q=nt.vaos||(nt.vaos={});(Q[T]||(Q[T]=new lh)).bind(e,this,k,Z?Z.getPaintVertexBuffers():[],A,nt.vertexOffset,H,K,it),Y.drawElements(n,nt.primitiveLength*rt,Y.UNSIGNED_SHORT,nt.primitiveOffset*rt*2)}}}function la(d,e,n){const o=1/c.aM(n,1,e.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,e.transform.tileZoom)/u,m=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Fc=(d,e,n,o)=>{const u=d.style.light,p=u.properties.get("position"),m=[p.x,p.y,p.z],_=c.c3();u.properties.get("anchor")==="viewport"&&c.c4(_,d.transform.bearingInRadians),c.c5(m,m,_);const x=d.transform.transformLightDirection(m),b=u.properties.get("color");return{u_lightpos:m,u_lightpos_globe:x,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+e,u_opacity:n,u_fill_translate:o}},Rs=(d,e,n,o,u,p,m)=>c.e(Fc(d,e,n,o),la(p,d,m),{u_height_factor:-Math.pow(2,u.overscaledZ)/m.tileSize/8}),Bc=(d,e,n,o)=>c.e(la(e,d,n),{u_fill_translate:o}),Oc=(d,e)=>({u_world:d,u_fill_translate:e}),uh=(d,e,n,o,u)=>c.e(Bc(d,e,n,u),{u_world:o}),jc=(d,e,n,o,u)=>{const p=d.transform;let m,_,x=0;if(n.paint.get("circle-pitch-alignment")==="map"){const b=c.aM(e,1,p.zoom);m=!0,_=[b,b],x=b/(c.a4*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*u}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:x,u_translate:o}},ol=d=>({u_pixel_extrude_scale:[1/d.width,1/d.height]}),Nc=d=>({u_viewport_size:[d.width,d.height]}),ll=(d,e=1)=>({u_color:d,u_overlay:0,u_overlay_scale:e}),cl=(d,e,n,o)=>{const u=c.aM(d,1,e)/(c.a4*Math.pow(2,d.tileID.overscaledZ))*2*Math.PI*o;return{u_extrude_scale:c.aM(d,1,e),u_intensity:n,u_globe_extrude_scale:u}},ul=(d,e,n,o)=>{const u=c.N();c.c6(u,0,d.width,d.height,0,0,1);const p=d.context.gl;return{u_matrix:u,u_world:[p.drawingBufferWidth,p.drawingBufferHeight],u_image:n,u_color_ramp:o,u_opacity:e.paint.get("heatmap-opacity")}},es=(d,e,n)=>{const o=n.paint.get("hillshade-accent-color");let u;switch(n.paint.get("hillshade-method")){case"basic":u=4;break;case"combined":u=1;break;case"igor":u=2;break;case"multidirectional":u=3;break;default:u=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:Uc(0,e.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:p.altitudeRadians,u_azimuths:p.directionRadians,u_accent:o,u_method:u,u_highlights:p.highlightColor,u_shadows:p.shadowColor}},Vc=(d,e)=>{const n=e.stride,o=c.N();return c.c6(o,0,c.a4,-c.a4,0,0,1),c.O(o,o,[0,-c.a4,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:d.overscaledZ,u_unpack:e.getUnpackVector()}};function Uc(d,e){const n=Math.pow(2,e.canonical.z),o=e.canonical.y;return[new c.aa(0,o/n).toLngLat().lat,new c.aa(0,(o+1)/n).toLngLat().lat]}const ca=(d,e,n=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:d.paint.get("color-relief-opacity")}),to=(d,e,n,o)=>{const u=d.transform;return{u_translation:hl(d,e,n),u_ratio:o/c.aM(e,1,u.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},ua=(d,e,n,o,u)=>c.e(to(d,e,n,o),{u_image:0,u_image_height:u}),hh=(d,e,n,o,u)=>{const p=d.transform,m=eo(e,p);return{u_translation:hl(d,e,n),u_texsize:e.imageAtlasTexture.size,u_ratio:o/c.aM(e,1,p.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[m,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},dh=(d,e,n,o,u)=>{const p=eo(e,d.transform);return c.e(to(d,e,n,o),{u_tileratio:p,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image:0,u_mix:u.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})},Gc=(d,e,n,o,u,p)=>{const m=eo(e,d.transform);return c.e(to(d,e,n,o),{u_image:0,u_image_height:p,u_tileratio:m,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image_dash:1,u_mix:u.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})};function eo(d,e){return 1/c.aM(d,1,e.tileZoom)}function hl(d,e,n){return c.aN(d.transform,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const dl=(d,e,n,o,u)=>{return{u_tl_parent:d,u_scale_parent:e,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=o.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:$c(o.paint.get("raster-hue-rotate")),u_coords_top:[u[0].x,u[0].y,u[1].x,u[1].y],u_coords_bottom:[u[3].x,u[3].y,u[2].x,u[2].y]};var p,m};function $c(d){d*=Math.PI/180;const e=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const ha=(d,e,n,o,u,p,m,_,x,b,T,k,A)=>{const z=m.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:z.width/z.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+T,u_pitch_with_map:+o,u_is_along_line:u,u_is_variable_anchor:p,u_texsize:k,u_texture:0,u_translation:b,u_pitched_scale:A}},Wr=(d,e,n,o,u,p,m,_,x,b,T,k,A,z)=>{const j=m.transform;return c.e(ha(d,e,n,o,u,p,m,_,x,b,T,k,z),{u_gamma_scale:o?Math.cos(j.pitch*Math.PI/180)*j.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},pl=(d,e,n,o,u,p,m,_,x,b,T,k,A)=>c.e(Wr(d,e,n,o,u,p,m,_,x,b,!0,T,0,A),{u_texsize_icon:k,u_texture_icon:1}),fl=(d,e)=>({u_opacity:d,u_color:e}),ml=(d,e,n,o,u)=>c.e((function(p,m,_,x){const b=_.imageManager.getPattern(p.from.toString()),T=_.imageManager.getPattern(p.to.toString()),{width:k,height:A}=_.imageManager.getPixelSize(),z=Math.pow(2,x.tileID.overscaledZ),j=x.tileSize*Math.pow(2,_.transform.tileZoom)/z,$=j*(x.tileID.canonical.x+x.tileID.wrap*z),Z=j*x.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:[k,A],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/c.aM(x,1,_.transform.tileZoom),u_pixel_coord_upper:[$>>16,Z>>16],u_pixel_coord_lower:[65535&$,65535&Z]}})(n,u,e,o),{u_opacity:d}),gl=(d,e)=>{},_l={fillExtrusion:(d,e)=>({u_lightpos:new c.c1(d,e.u_lightpos),u_lightpos_globe:new c.c1(d,e.u_lightpos_globe),u_lightintensity:new c.bp(d,e.u_lightintensity),u_lightcolor:new c.c1(d,e.u_lightcolor),u_vertical_gradient:new c.bp(d,e.u_vertical_gradient),u_opacity:new c.bp(d,e.u_opacity),u_fill_translate:new c.c2(d,e.u_fill_translate)}),fillExtrusionPattern:(d,e)=>({u_lightpos:new c.c1(d,e.u_lightpos),u_lightpos_globe:new c.c1(d,e.u_lightpos_globe),u_lightintensity:new c.bp(d,e.u_lightintensity),u_lightcolor:new c.c1(d,e.u_lightcolor),u_vertical_gradient:new c.bp(d,e.u_vertical_gradient),u_height_factor:new c.bp(d,e.u_height_factor),u_opacity:new c.bp(d,e.u_opacity),u_fill_translate:new c.c2(d,e.u_fill_translate),u_image:new c.bZ(d,e.u_image),u_texsize:new c.c2(d,e.u_texsize),u_pixel_coord_upper:new c.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(d,e.u_pixel_coord_lower),u_scale:new c.c1(d,e.u_scale),u_fade:new c.bp(d,e.u_fade)}),fill:(d,e)=>({u_fill_translate:new c.c2(d,e.u_fill_translate)}),fillPattern:(d,e)=>({u_image:new c.bZ(d,e.u_image),u_texsize:new c.c2(d,e.u_texsize),u_pixel_coord_upper:new c.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(d,e.u_pixel_coord_lower),u_scale:new c.c1(d,e.u_scale),u_fade:new c.bp(d,e.u_fade),u_fill_translate:new c.c2(d,e.u_fill_translate)}),fillOutline:(d,e)=>({u_world:new c.c2(d,e.u_world),u_fill_translate:new c.c2(d,e.u_fill_translate)}),fillOutlinePattern:(d,e)=>({u_world:new c.c2(d,e.u_world),u_image:new c.bZ(d,e.u_image),u_texsize:new c.c2(d,e.u_texsize),u_pixel_coord_upper:new c.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(d,e.u_pixel_coord_lower),u_scale:new c.c1(d,e.u_scale),u_fade:new c.bp(d,e.u_fade),u_fill_translate:new c.c2(d,e.u_fill_translate)}),circle:(d,e)=>({u_camera_to_center_distance:new c.bp(d,e.u_camera_to_center_distance),u_scale_with_map:new c.bZ(d,e.u_scale_with_map),u_pitch_with_map:new c.bZ(d,e.u_pitch_with_map),u_extrude_scale:new c.c2(d,e.u_extrude_scale),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_globe_extrude_scale:new c.bp(d,e.u_globe_extrude_scale),u_translate:new c.c2(d,e.u_translate)}),collisionBox:(d,e)=>({u_pixel_extrude_scale:new c.c2(d,e.u_pixel_extrude_scale)}),collisionCircle:(d,e)=>({u_viewport_size:new c.c2(d,e.u_viewport_size)}),debug:(d,e)=>({u_color:new c.b_(d,e.u_color),u_overlay:new c.bZ(d,e.u_overlay),u_overlay_scale:new c.bp(d,e.u_overlay_scale)}),depth:gl,clippingMask:gl,heatmap:(d,e)=>({u_extrude_scale:new c.bp(d,e.u_extrude_scale),u_intensity:new c.bp(d,e.u_intensity),u_globe_extrude_scale:new c.bp(d,e.u_globe_extrude_scale)}),heatmapTexture:(d,e)=>({u_matrix:new c.b$(d,e.u_matrix),u_world:new c.c2(d,e.u_world),u_image:new c.bZ(d,e.u_image),u_color_ramp:new c.bZ(d,e.u_color_ramp),u_opacity:new c.bp(d,e.u_opacity)}),hillshade:(d,e)=>({u_image:new c.bZ(d,e.u_image),u_latrange:new c.c2(d,e.u_latrange),u_exaggeration:new c.bp(d,e.u_exaggeration),u_altitudes:new c.c8(d,e.u_altitudes),u_azimuths:new c.c8(d,e.u_azimuths),u_accent:new c.b_(d,e.u_accent),u_method:new c.bZ(d,e.u_method),u_shadows:new c.c7(d,e.u_shadows),u_highlights:new c.c7(d,e.u_highlights)}),hillshadePrepare:(d,e)=>({u_matrix:new c.b$(d,e.u_matrix),u_image:new c.bZ(d,e.u_image),u_dimension:new c.c2(d,e.u_dimension),u_zoom:new c.bp(d,e.u_zoom),u_unpack:new c.c0(d,e.u_unpack)}),colorRelief:(d,e)=>({u_image:new c.bZ(d,e.u_image),u_unpack:new c.c0(d,e.u_unpack),u_dimension:new c.c2(d,e.u_dimension),u_elevation_stops:new c.bZ(d,e.u_elevation_stops),u_color_stops:new c.bZ(d,e.u_color_stops),u_color_ramp_size:new c.bZ(d,e.u_color_ramp_size),u_opacity:new c.bp(d,e.u_opacity)}),line:(d,e)=>({u_translation:new c.c2(d,e.u_translation),u_ratio:new c.bp(d,e.u_ratio),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new c.c2(d,e.u_units_to_pixels)}),lineGradient:(d,e)=>({u_translation:new c.c2(d,e.u_translation),u_ratio:new c.bp(d,e.u_ratio),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new c.c2(d,e.u_units_to_pixels),u_image:new c.bZ(d,e.u_image),u_image_height:new c.bp(d,e.u_image_height)}),linePattern:(d,e)=>({u_translation:new c.c2(d,e.u_translation),u_texsize:new c.c2(d,e.u_texsize),u_ratio:new c.bp(d,e.u_ratio),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_image:new c.bZ(d,e.u_image),u_units_to_pixels:new c.c2(d,e.u_units_to_pixels),u_scale:new c.c1(d,e.u_scale),u_fade:new c.bp(d,e.u_fade)}),lineSDF:(d,e)=>({u_translation:new c.c2(d,e.u_translation),u_ratio:new c.bp(d,e.u_ratio),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new c.c2(d,e.u_units_to_pixels),u_image:new c.bZ(d,e.u_image),u_mix:new c.bp(d,e.u_mix),u_tileratio:new c.bp(d,e.u_tileratio),u_crossfade_from:new c.bp(d,e.u_crossfade_from),u_crossfade_to:new c.bp(d,e.u_crossfade_to),u_lineatlas_width:new c.bp(d,e.u_lineatlas_width),u_lineatlas_height:new c.bp(d,e.u_lineatlas_height)}),lineGradientSDF:(d,e)=>({u_translation:new c.c2(d,e.u_translation),u_ratio:new c.bp(d,e.u_ratio),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_units_to_pixels:new c.c2(d,e.u_units_to_pixels),u_image:new c.bZ(d,e.u_image),u_image_height:new c.bp(d,e.u_image_height),u_tileratio:new c.bp(d,e.u_tileratio),u_crossfade_from:new c.bp(d,e.u_crossfade_from),u_crossfade_to:new c.bp(d,e.u_crossfade_to),u_image_dash:new c.bZ(d,e.u_image_dash),u_mix:new c.bp(d,e.u_mix),u_lineatlas_width:new c.bp(d,e.u_lineatlas_width),u_lineatlas_height:new c.bp(d,e.u_lineatlas_height)}),raster:(d,e)=>({u_tl_parent:new c.c2(d,e.u_tl_parent),u_scale_parent:new c.bp(d,e.u_scale_parent),u_buffer_scale:new c.bp(d,e.u_buffer_scale),u_fade_t:new c.bp(d,e.u_fade_t),u_opacity:new c.bp(d,e.u_opacity),u_image0:new c.bZ(d,e.u_image0),u_image1:new c.bZ(d,e.u_image1),u_brightness_low:new c.bp(d,e.u_brightness_low),u_brightness_high:new c.bp(d,e.u_brightness_high),u_saturation_factor:new c.bp(d,e.u_saturation_factor),u_contrast_factor:new c.bp(d,e.u_contrast_factor),u_spin_weights:new c.c1(d,e.u_spin_weights),u_coords_top:new c.c0(d,e.u_coords_top),u_coords_bottom:new c.c0(d,e.u_coords_bottom)}),symbolIcon:(d,e)=>({u_is_size_zoom_constant:new c.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(d,e.u_is_size_feature_constant),u_size_t:new c.bp(d,e.u_size_t),u_size:new c.bp(d,e.u_size),u_camera_to_center_distance:new c.bp(d,e.u_camera_to_center_distance),u_pitch:new c.bp(d,e.u_pitch),u_rotate_symbol:new c.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new c.bp(d,e.u_aspect_ratio),u_fade_change:new c.bp(d,e.u_fade_change),u_label_plane_matrix:new c.b$(d,e.u_label_plane_matrix),u_coord_matrix:new c.b$(d,e.u_coord_matrix),u_is_text:new c.bZ(d,e.u_is_text),u_pitch_with_map:new c.bZ(d,e.u_pitch_with_map),u_is_along_line:new c.bZ(d,e.u_is_along_line),u_is_variable_anchor:new c.bZ(d,e.u_is_variable_anchor),u_texsize:new c.c2(d,e.u_texsize),u_texture:new c.bZ(d,e.u_texture),u_translation:new c.c2(d,e.u_translation),u_pitched_scale:new c.bp(d,e.u_pitched_scale)}),symbolSDF:(d,e)=>({u_is_size_zoom_constant:new c.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(d,e.u_is_size_feature_constant),u_size_t:new c.bp(d,e.u_size_t),u_size:new c.bp(d,e.u_size),u_camera_to_center_distance:new c.bp(d,e.u_camera_to_center_distance),u_pitch:new c.bp(d,e.u_pitch),u_rotate_symbol:new c.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new c.bp(d,e.u_aspect_ratio),u_fade_change:new c.bp(d,e.u_fade_change),u_label_plane_matrix:new c.b$(d,e.u_label_plane_matrix),u_coord_matrix:new c.b$(d,e.u_coord_matrix),u_is_text:new c.bZ(d,e.u_is_text),u_pitch_with_map:new c.bZ(d,e.u_pitch_with_map),u_is_along_line:new c.bZ(d,e.u_is_along_line),u_is_variable_anchor:new c.bZ(d,e.u_is_variable_anchor),u_texsize:new c.c2(d,e.u_texsize),u_texture:new c.bZ(d,e.u_texture),u_gamma_scale:new c.bp(d,e.u_gamma_scale),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_is_halo:new c.bZ(d,e.u_is_halo),u_translation:new c.c2(d,e.u_translation),u_pitched_scale:new c.bp(d,e.u_pitched_scale)}),symbolTextAndIcon:(d,e)=>({u_is_size_zoom_constant:new c.bZ(d,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(d,e.u_is_size_feature_constant),u_size_t:new c.bp(d,e.u_size_t),u_size:new c.bp(d,e.u_size),u_camera_to_center_distance:new c.bp(d,e.u_camera_to_center_distance),u_pitch:new c.bp(d,e.u_pitch),u_rotate_symbol:new c.bZ(d,e.u_rotate_symbol),u_aspect_ratio:new c.bp(d,e.u_aspect_ratio),u_fade_change:new c.bp(d,e.u_fade_change),u_label_plane_matrix:new c.b$(d,e.u_label_plane_matrix),u_coord_matrix:new c.b$(d,e.u_coord_matrix),u_is_text:new c.bZ(d,e.u_is_text),u_pitch_with_map:new c.bZ(d,e.u_pitch_with_map),u_is_along_line:new c.bZ(d,e.u_is_along_line),u_is_variable_anchor:new c.bZ(d,e.u_is_variable_anchor),u_texsize:new c.c2(d,e.u_texsize),u_texsize_icon:new c.c2(d,e.u_texsize_icon),u_texture:new c.bZ(d,e.u_texture),u_texture_icon:new c.bZ(d,e.u_texture_icon),u_gamma_scale:new c.bp(d,e.u_gamma_scale),u_device_pixel_ratio:new c.bp(d,e.u_device_pixel_ratio),u_is_halo:new c.bZ(d,e.u_is_halo),u_translation:new c.c2(d,e.u_translation),u_pitched_scale:new c.bp(d,e.u_pitched_scale)}),background:(d,e)=>({u_opacity:new c.bp(d,e.u_opacity),u_color:new c.b_(d,e.u_color)}),backgroundPattern:(d,e)=>({u_opacity:new c.bp(d,e.u_opacity),u_image:new c.bZ(d,e.u_image),u_pattern_tl_a:new c.c2(d,e.u_pattern_tl_a),u_pattern_br_a:new c.c2(d,e.u_pattern_br_a),u_pattern_tl_b:new c.c2(d,e.u_pattern_tl_b),u_pattern_br_b:new c.c2(d,e.u_pattern_br_b),u_texsize:new c.c2(d,e.u_texsize),u_mix:new c.bp(d,e.u_mix),u_pattern_size_a:new c.c2(d,e.u_pattern_size_a),u_pattern_size_b:new c.c2(d,e.u_pattern_size_b),u_scale_a:new c.bp(d,e.u_scale_a),u_scale_b:new c.bp(d,e.u_scale_b),u_pixel_coord_upper:new c.c2(d,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(d,e.u_pixel_coord_lower),u_tile_units_to_pixels:new c.bp(d,e.u_tile_units_to_pixels)}),terrain:(d,e)=>({u_texture:new c.bZ(d,e.u_texture),u_ele_delta:new c.bp(d,e.u_ele_delta),u_fog_matrix:new c.b$(d,e.u_fog_matrix),u_fog_color:new c.b_(d,e.u_fog_color),u_fog_ground_blend:new c.bp(d,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.bp(d,e.u_fog_ground_blend_opacity),u_horizon_color:new c.b_(d,e.u_horizon_color),u_horizon_fog_blend:new c.bp(d,e.u_horizon_fog_blend),u_is_globe_mode:new c.bp(d,e.u_is_globe_mode)}),terrainDepth:(d,e)=>({u_ele_delta:new c.bp(d,e.u_ele_delta)}),terrainCoords:(d,e)=>({u_texture:new c.bZ(d,e.u_texture),u_terrain_coords_id:new c.bp(d,e.u_terrain_coords_id),u_ele_delta:new c.bp(d,e.u_ele_delta)}),projectionErrorMeasurement:(d,e)=>({u_input:new c.bp(d,e.u_input),u_output_expected:new c.bp(d,e.u_output_expected)}),atmosphere:(d,e)=>({u_sun_pos:new c.c1(d,e.u_sun_pos),u_atmosphere_blend:new c.bp(d,e.u_atmosphere_blend),u_globe_position:new c.c1(d,e.u_globe_position),u_globe_radius:new c.bp(d,e.u_globe_radius),u_inv_proj_matrix:new c.b$(d,e.u_inv_proj_matrix)}),sky:(d,e)=>({u_sky_color:new c.b_(d,e.u_sky_color),u_horizon_color:new c.b_(d,e.u_horizon_color),u_horizon:new c.c2(d,e.u_horizon),u_horizon_normal:new c.c2(d,e.u_horizon_normal),u_sky_horizon_blend:new c.bp(d,e.u_sky_horizon_blend),u_sky_blend:new c.bp(d,e.u_sky_blend)})};class is{constructor(e,n,o){this.context=e;const u=e.gl;this.buffer=u.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){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,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const yl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ph{constructor(e,n,o,u){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=e;const p=e.gl;this.buffer=p.createBuffer(),e.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(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let o=0;o<this.attributes.length;o++){const u=n.attributes[this.attributes[o].name];u!==void 0&&e.enableVertexAttribArray(u)}}setVertexAttribPointers(e,n,o){for(let u=0;u<this.attributes.length;u++){const p=this.attributes[u],m=n.attributes[p.name];m!==void 0&&e.vertexAttribPointer(m,p.components,e[yl[p.type]],!1,this.itemSize,p.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class me{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class fh extends me{getDefault(){return c.bo.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class mh extends me{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Zc extends me{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class gh extends me{getDefault(){return[!0,!0,!0,!0]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class qc extends me{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class io extends me{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ro extends me{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class no extends me{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class xl extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class rs extends me{getDefault(){return[0,1]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class da extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ls extends me{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class or extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class Wc extends me{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Hc extends me{getDefault(){return c.bo.transparent}set(e){const n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class vl extends me{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ns extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class so extends me{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class ao extends me{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class pa extends me{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class oo extends me{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Xc extends me{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Fs extends me{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Bs extends me{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Yc extends me{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class bl extends me{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ae extends me{getDefault(){return null}set(e){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class lo extends me{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;const o=this.gl;wr(o)?o.bindVertexArray(e):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class _h extends me{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Kc extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class fa extends me{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class wl extends me{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class yh extends wl{setDirty(){this.dirty=!0}set(e){if(e===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,e,0),this.current=e,this.dirty=!1}}class Jc extends wl{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class xh extends wl{set(e){if(e===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,e),this.current=e,this.dirty=!1}}const co="Framebuffer is not complete";class uo{constructor(e,n,o,u,p){this.context=e,this.width=n,this.height=o;const m=e.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new yh(e,_),u)this.depthAttachment=p?new xh(e,_):new Jc(e,_);else if(p)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error(co)}destroy(){const e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&e.deleteRenderbuffer(o)}e.deleteFramebuffer(this.framebuffer)}}class ho{constructor(e){var n,o;if(this.gl=e,this.clearColor=new fh(this),this.clearDepth=new mh(this),this.clearStencil=new Zc(this),this.colorMask=new gh(this),this.depthMask=new qc(this),this.stencilMask=new io(this),this.stencilFunc=new ro(this),this.stencilOp=new no(this),this.stencilTest=new xl(this),this.depthRange=new rs(this),this.depthTest=new da(this),this.depthFunc=new Ls(this),this.blend=new or(this),this.blendFunc=new Wc(this),this.blendColor=new Hc(this),this.blendEquation=new vl(this),this.cullFace=new ns(this),this.cullFaceSide=new so(this),this.frontFace=new ao(this),this.program=new pa(this),this.activeTexture=new oo(this),this.viewport=new Xc(this),this.bindFramebuffer=new Fs(this),this.bindRenderbuffer=new Bs(this),this.bindTexture=new Yc(this),this.bindVertexBuffer=new bl(this),this.bindElementBuffer=new ae(this),this.bindVertexArray=new lo(this),this.pixelStoreUnpack=new _h(this),this.pixelStoreUnpackPremultiplyAlpha=new Kc(this),this.pixelStoreUnpackFlipY=new fa(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),wr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const u=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=e.RGBA16F)!==null&&n!==void 0?n:u?.RGBA16F_EXT,this.RGB16F=(o=e.RGB16F)!==null&&o!==void 0?o:u?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const u=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=u?.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(e,n){return new is(this,e,n)}createVertexBuffer(e,n,o){return new ph(this,e,n,o)}createRenderbuffer(e,n,o){const u=this.gl,p=u.createRenderbuffer();return this.bindRenderbuffer.set(p),u.renderbufferStorage(u.RENDERBUFFER,e,n,o),this.bindRenderbuffer.set(null),p}createFramebuffer(e,n,o,u){return new uo(this,e,n,o,u)}clear({color:e,depth:n,stencil:o}){const u=this.gl;let p=0;e&&(p|=u.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=u.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(p|=u.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),u.clear(p)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){c.bQ(e.blendFunction,Ae.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return wr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var n;return wr(this.gl)?this.gl.deleteVertexArray(e):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let ss;function po(d,e,n,o,u){const p=d.context,m=d.transform,_=p.gl,x=d.useProgram("collisionBox"),b=[];let T=0,k=0;for(let H=0;H<o.length;H++){const K=o[H],it=e.getTile(K).getBucket(n);if(!it)continue;const Y=u?it.textCollisionBox:it.iconCollisionBox,rt=it.collisionCircleArray;rt.length>0&&(b.push({circleArray:rt,circleOffset:k,coord:K}),T+=rt.length/4,k=T),Y&&x.draw(p,_.LINES,ie.disabled,he.disabled,d.colorModeForRenderPass(),pe.disabled,ol(d.transform),d.style.map.terrain&&d.style.map.terrain.getTerrainData(K),m.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,null,d.transform.zoom,null,null,Y.collisionVertexBuffer)}if(!u||!b.length)return;const A=d.useProgram("collisionCircle"),z=new c.c9;z.resize(4*T),z._trim();let j=0;for(const H of b)for(let K=0;K<H.circleArray.length/4;K++){const it=4*K,Y=H.circleArray[it+0],rt=H.circleArray[it+1],nt=H.circleArray[it+2],Q=H.circleArray[it+3];z.emplace(j++,Y,rt,nt,Q,0),z.emplace(j++,Y,rt,nt,Q,1),z.emplace(j++,Y,rt,nt,Q,2),z.emplace(j++,Y,rt,nt,Q,3)}(!ss||ss.length<2*T)&&(ss=(function(H){const K=2*H,it=new c.cb;it.resize(K),it._trim();for(let Y=0;Y<K;Y++){const rt=6*Y;it.uint16[rt+0]=4*Y+0,it.uint16[rt+1]=4*Y+1,it.uint16[rt+2]=4*Y+2,it.uint16[rt+3]=4*Y+2,it.uint16[rt+4]=4*Y+3,it.uint16[rt+5]=4*Y+0}return it})(T));const $=p.createIndexBuffer(ss,!0),Z=p.createVertexBuffer(z,c.ca.members,!0);for(const H of b){const K=Nc(d.transform);A.draw(p,_.TRIANGLES,ie.disabled,he.disabled,d.colorModeForRenderPass(),pe.disabled,K,d.style.map.terrain&&d.style.map.terrain.getTerrainData(H.coord),null,n.id,Z,$,c.aW.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,d.transform.zoom,null,null,null)}Z.destroy(),$.destroy()}const Qc=c.ar(new Float32Array(16));function fo(d,e,n,o,u,p){const{horizontalAlign:m,verticalAlign:_}=c.aR(d);return new c.P((-(m-.5)*e/u+o[0])*p,(-(_-.5)*n/u+o[1])*p)}function mo(d,e,n,o,u,p){const m=e.tileAnchorPoint.add(new c.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=o.mult(p);n||(_=_.rotate(-u));const x=m.add(_);return Nt(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(n){const _=br(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(d),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return d.add(o.rotate(x))}return d.add(o)}function go(d,e,n,o,u,p,m,_,x,b,T,k){const A=d.text.placedSymbolArray,z=d.text.dynamicLayoutVertexArray,j=d.icon.dynamicLayoutVertexArray,$={};z.clear();for(let Z=0;Z<A.length;Z++){const H=A.get(Z),K=H.hidden||!H.crossTileID||d.allowVerticalPlacement&&!H.placedOrientation?null:o[H.crossTileID];if(K){const it=new c.P(H.anchorX,H.anchorY),Y={getElevation:k,width:u.width,height:u.height,pitchedLabelPlaneMatrix:p,pitchWithMap:n,transform:u,tileAnchorPoint:it,translation:b,unwrappedTileID:T},rt=n?Ps(it.x,it.y,Y):br(it.x,it.y,Y),nt=Xt(u.cameraToCenterDistance,rt.signedDistanceFromCamera);let Q=c.az(d.textSizeData,_,H)*nt/c.aL;n&&(Q*=d.tilePixelRatio/m);const{width:lt,height:_t,anchor:pt,textOffset:ft,textBoxScale:gt}=K,Dt=fo(pt,lt,_t,ft,gt,Q),Et=u.getPitchedTextCorrection(it.x+b[0],it.y+b[1],T),St=mo(rt.point,Y,e,Dt,-u.bearingInRadians,Et),jt=d.allowVerticalPlacement&&H.placedOrientation===c.ay.vertical?Math.PI/2:0;for(let Qt=0;Qt<H.numGlyphs;Qt++)c.aF(z,St,jt);x&&H.associatedIconIndex>=0&&($[H.associatedIconIndex]={shiftedAnchor:St,angle:jt})}else Ur(H.numGlyphs,z)}if(x){j.clear();const Z=d.icon.placedSymbolArray;for(let H=0;H<Z.length;H++){const K=Z.get(H);if(K.hidden)Ur(K.numGlyphs,j);else{const it=$[H];if(it)for(let Y=0;Y<K.numGlyphs;Y++)c.aF(j,it.shiftedAnchor,it.angle);else Ur(K.numGlyphs,j)}}d.icon.dynamicLayoutVertexBuffer.updateData(j)}d.text.dynamicLayoutVertexBuffer.updateData(z)}function Os(d,e,n){return n.iconsInText&&e?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function _o(d,e,n,o,u,p,m,_,x,b,T,k,A){const z=d.context,j=z.gl,$=d.transform,Z=_==="map",H=x==="map",K=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",it=Z&&!H&&!K,Y=!n.layout.get("symbol-sort-key").isConstant();let rt=!1;const nt=d.getDepthModeForSublayer(0,ie.ReadOnly),Q=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),lt=[],_t=$.getCircleRadiusCorrection();for(const pt of o){const ft=e.getTile(pt),gt=ft.getBucket(n);if(!gt)continue;const Dt=u?gt.text:gt.icon;if(!Dt||!Dt.segments.get().length||!Dt.hasVisibleVertices)continue;const Et=Dt.programConfigurations.get(n.id),St=u||gt.sdfIcons,jt=u?gt.textSizeData:gt.iconSizeData,Qt=H||$.pitch!==0,Jt=d.useProgram(Os(St,u,gt),Et),Me=c.ax(jt,$.zoom),Ie=d.style.map.terrain&&d.style.map.terrain.getTerrainData(pt);let Oe,ye,ri,De,Ye=[0,0],We=null;if(u)ye=ft.glyphAtlasTexture,ri=j.LINEAR,Oe=ft.glyphAtlasTexture.size,gt.iconsInText&&(Ye=ft.imageAtlasTexture.size,We=ft.imageAtlasTexture,De=Qt||d.options.rotating||d.options.zooming||jt.kind==="composite"||jt.kind==="camera"?j.LINEAR:j.NEAREST);else{const Ge=n.layout.get("icon-size").constantOr(0)!==1||gt.iconsNeedLinear;ye=ft.imageAtlasTexture,ri=St||d.options.rotating||d.options.zooming||Ge||Qt?j.LINEAR:j.NEAREST,Oe=ft.imageAtlasTexture.size}const Ke=c.aM(ft,1,d.transform.zoom),Xi=ti(Z,d.transform,Ke),on=c.N();c.aA(on,Xi);const Hr=Te(H,Z,d.transform,Ke),zn=c.aN($,ft,p,m),Rn=$.getProjectionData({overscaledTileID:pt,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),hs=Q&>.hasTextData(),ur=n.layout.get("icon-text-fit")!=="none"&&hs&>.hasIconData();if(K){const Ge=d.style.map.terrain?(ni,xe)=>d.style.map.terrain.getElevation(pt,ni,xe):null,je=n.layout.get("text-rotation-alignment")==="map";Yn(gt,d,u,Xi,on,H,b,je,pt.toUnwrapped(),$.width,$.height,zn,Ge)}const ln=u&&Q||ur,Qi=K||ln?Qc:H?Xi:d.transform.clipSpaceToPixelsMatrix,cn=St&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ds;ds=St?gt.iconsInText?pl(jt.kind,Me,it,H,K,ln,d,Qi,Hr,zn,Oe,Ye,_t):Wr(jt.kind,Me,it,H,K,ln,d,Qi,Hr,zn,u,Oe,0,_t):ha(jt.kind,Me,it,H,K,ln,d,Qi,Hr,zn,u,Oe,_t);const ps={program:Jt,buffers:Dt,uniformValues:ds,projectionData:Rn,atlasTexture:ye,atlasTextureIcon:We,atlasInterpolation:ri,atlasInterpolationIcon:De,isSDF:St,hasHalo:cn};if(Y&>.canOverlap){rt=!0;const Ge=Dt.segments.get();for(const je of Ge)lt.push({segments:new c.aW([je]),sortKey:je.sortKey,state:ps,terrainData:Ie})}else lt.push({segments:Dt.segments,sortKey:0,state:ps,terrainData:Ie})}rt&<.sort(((pt,ft)=>pt.sortKey-ft.sortKey));for(const pt of lt){const ft=pt.state;if(z.activeTexture.set(j.TEXTURE0),ft.atlasTexture.bind(ft.atlasInterpolation,j.CLAMP_TO_EDGE),ft.atlasTextureIcon&&(z.activeTexture.set(j.TEXTURE1),ft.atlasTextureIcon&&ft.atlasTextureIcon.bind(ft.atlasInterpolationIcon,j.CLAMP_TO_EDGE)),ft.isSDF){const gt=ft.uniformValues;ft.hasHalo&&(gt.u_is_halo=1,tu(ft.buffers,pt.segments,n,d,ft.program,nt,T,k,gt,ft.projectionData,pt.terrainData)),gt.u_is_halo=0}tu(ft.buffers,pt.segments,n,d,ft.program,nt,T,k,ft.uniformValues,ft.projectionData,pt.terrainData)}}function tu(d,e,n,o,u,p,m,_,x,b,T){const k=o.context;u.draw(k,k.gl.TRIANGLES,p,m,_,pe.backCCW,x,T,b,n.id,d.layoutVertexBuffer,d.indexBuffer,e,n.paint,o.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function ma(d,e,n,o,u){const p=d.context,m=p.gl,_=he.disabled,x=new Ae([m.ONE,m.ONE],c.bo.transparent,[!0,!0,!0,!0]),b=e.getBucket(n);if(!b)return;const T=o.key;let k=n.heatmapFbos.get(T);k||(k=Tl(p,e.tileSize,e.tileSize),n.heatmapFbos.set(T,k)),p.bindFramebuffer.set(k.framebuffer),p.viewport.set([0,0,e.tileSize,e.tileSize]),p.clear({color:c.bo.transparent});const A=b.programConfigurations.get(n.id),z=d.useProgram("heatmap",A,!u),j=d.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),$=d.style.map.terrain.getTerrainData(o);z.draw(p,m.TRIANGLES,ie.disabled,_,x,pe.disabled,cl(e,d.transform.zoom,n.paint.get("heatmap-intensity"),1),$,j,n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,n.paint,d.transform.zoom,A)}function vh(d,e,n,o,u){const p=d.context,m=p.gl,_=d.transform;p.setColorMode(d.colorModeForRenderPass());const x=ga(p,e),b=n.key,T=e.heatmapFbos.get(b);if(!T)return;p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,T.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),x.bind(m.LINEAR,m.CLAMP_TO_EDGE);const k=_.getProjectionData({overscaledTileID:n,applyTerrainMatrix:u,applyGlobeMatrix:!o});d.useProgram("heatmapTexture").draw(p,m.TRIANGLES,ie.disabled,he.disabled,d.colorModeForRenderPass(),pe.disabled,ul(d,e,0,1),null,k,e.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments,e.paint,_.zoom),T.destroy(),e.heatmapFbos.delete(b)}function Tl(d,e,n){var o,u;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 _=(o=d.HALF_FLOAT)!==null&&o!==void 0?o:p.UNSIGNED_BYTE,x=(u=d.RGBA16F)!==null&&u!==void 0?u:p.RGBA;p.texImage2D(p.TEXTURE_2D,0,x,e,n,0,p.RGBA,_,null);const b=d.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function ga(d,e){return e.colorRampTexture||(e.colorRampTexture=new c.T(d,e.colorRamp,d.gl.RGBA)),e.colorRampTexture}function yo(d,e,n,o,u,p,m,_){let x=256;if(u.stepInterpolant){const b=e.getSource().maxzoom,T=m.canonical.z===b?Math.ceil(1<<d.transform.maxZoom-m.canonical.z):1;x=c.an(c.cd(p.maxLineLength/c.a4*1024*T),256,n.maxTextureSize)}return _.gradient=c.ce({expression:u.gradientExpression(),evaluationKey:"lineProgress",resolution:x,image:_.gradient||void 0,clips:p.lineClipsArray}),_.texture?_.texture.update(_.gradient):_.texture=new c.T(n,_.gradient,o.RGBA),_.version=u.gradientVersion,_.texture}function eu(d,e,n,o,u){d.activeTexture.set(e.TEXTURE0),n.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),o.updatePaintBuffers(u)}function iu(d,e,n,o,u,p){(u||d.lineAtlas.dirty)&&(e.activeTexture.set(n.TEXTURE0),d.lineAtlas.bind(e)),o.updatePaintBuffers(p)}function xo(d,e,n,o,u,p,m){const _=p.gradients[u.id];let x=_.texture;u.gradientVersion!==_.version&&(x=yo(d,e,n,o,u,p,m,_)),n.activeTexture.set(o.TEXTURE0),x.bind(u.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE)}function Sl(d,e,n,o,u,p,m,_,x){const b=p.gradients[u.id];let T=b.texture;u.gradientVersion!==b.version&&(T=yo(d,e,n,o,u,p,m,b)),n.activeTexture.set(o.TEXTURE0),T.bind(u.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE1),d.lineAtlas.bind(n),_.updatePaintBuffers(x)}function ru(d,e,n,o,u){if(!n||!o||!o.imageAtlas)return;const p=o.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const x=u.getPaintProperty(e);m=p[x],_=p[x]}m&&_&&d.setConstantPatternPositions(m,_)}function Pl(d,e,n,o,u,p,m,_){const x=d.context.gl,b="fill-pattern",T=n.paint.get(b),k=T&&T.constantOr(1),A=n.getCrossfadeParameters();let z,j,$,Z,H;const K=d.transform,it=n.paint.get("fill-translate"),Y=n.paint.get("fill-translate-anchor");m?(j=k&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=x.LINES):(j=k?"fillPattern":"fill",z=x.TRIANGLES);const rt=T.constantOr(null);for(const nt of o){const Q=e.getTile(nt);if(k&&!Q.patternsLoaded())continue;const lt=Q.getBucket(n);if(!lt)continue;const _t=lt.programConfigurations.get(n.id),pt=d.useProgram(j,_t),ft=d.style.map.terrain&&d.style.map.terrain.getTerrainData(nt);k&&(d.context.activeTexture.set(x.TEXTURE0),Q.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),_t.updatePaintBuffers(A)),ru(_t,b,rt,Q,n);const gt=K.getProjectionData({overscaledTileID:nt,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Dt=c.aN(K,Q,it,Y);if(m){Z=lt.indexBuffer2,H=lt.segments2;const St=[x.drawingBufferWidth,x.drawingBufferHeight];$=j==="fillOutlinePattern"&&k?uh(d,A,Q,St,Dt):Oc(St,Dt)}else Z=lt.indexBuffer,H=lt.segments,$=k?Bc(d,A,Q,Dt):{u_fill_translate:Dt};const Et=d.stencilModeForClipping(nt);pt.draw(d.context,z,u,Et,p,pe.backCCW,$,ft,gt,n.id,lt.layoutVertexBuffer,Z,H,n.paint,d.transform.zoom,_t)}}function Be(d,e,n,o,u,p,m,_){const x=d.context,b=x.gl,T="fill-extrusion-pattern",k=n.paint.get(T),A=k.constantOr(1),z=n.getCrossfadeParameters(),j=n.paint.get("fill-extrusion-opacity"),$=k.constantOr(null),Z=d.transform;for(const H of o){const K=e.getTile(H),it=K.getBucket(n);if(!it)continue;const Y=d.style.map.terrain&&d.style.map.terrain.getTerrainData(H),rt=it.programConfigurations.get(n.id),nt=d.useProgram(A?"fillExtrusionPattern":"fillExtrusion",rt);A&&(d.context.activeTexture.set(b.TEXTURE0),K.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),rt.updatePaintBuffers(z));const Q=Z.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!_,applyTerrainMatrix:!0});ru(rt,T,$,K,n);const lt=c.aN(Z,K,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),_t=n.paint.get("fill-extrusion-vertical-gradient"),pt=A?Rs(d,_t,j,lt,H,z,K):Fc(d,_t,j,lt);nt.draw(x,x.gl.TRIANGLES,u,p,m,pe.backCCW,pt,Y,Q,n.id,it.layoutVertexBuffer,it.indexBuffer,it.segments,n.paint,d.transform.zoom,rt,d.style.map.terrain&&it.centroidVertexBuffer)}}function nn(d,e,n,o,u,p,m,_,x){var b;const T=d.style.projection,k=d.context,A=d.transform,z=k.gl,j=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],$=d.useProgram("hillshade",null,!1,j),Z=!d.options.moving;for(const H of o){const K=e.getTile(H),it=K.fbo;if(!it)continue;const Y=T.getMeshFromTileID(k,H.canonical,_,!0,"raster"),rt=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(H);k.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_2D,it.colorAttachment.get());const nt=A.getProjectionData({overscaledTileID:H,aligned:Z,applyGlobeMatrix:!x,applyTerrainMatrix:!0});$.draw(k,z.TRIANGLES,p,u[H.overscaledZ],m,pe.backCCW,es(d,K,n),rt,nt,n.id,Y.vertexBuffer,Y.indexBuffer,Y.segments)}}function Hi(d,e,n,o,u,p,m,_,x){var b;const T=d.style.projection,k=d.context,A=d.transform,z=k.gl,j=d.useProgram("colorRelief"),$=!d.options.moving;let Z=!0,H=0;for(const K of o){const it=e.getTile(K),Y=it.dem;if(Z){const pt=z.getParameter(z.MAX_TEXTURE_SIZE),{elevationTexture:ft,colorTexture:gt}=n.getColorRampTextures(k,pt,Y.getUnpackVector());k.activeTexture.set(z.TEXTURE1),ft.bind(z.NEAREST,z.CLAMP_TO_EDGE),k.activeTexture.set(z.TEXTURE4),gt.bind(z.LINEAR,z.CLAMP_TO_EDGE),Z=!1,H=ft.size[0]}if(!Y||!Y.data)continue;const rt=Y.stride,nt=Y.getPixels();if(k.activeTexture.set(z.TEXTURE0),k.pixelStoreUnpackPremultiplyAlpha.set(!1),it.demTexture=it.demTexture||d.getTileTexture(rt),it.demTexture){const pt=it.demTexture;pt.update(nt,{premultiply:!1}),pt.bind(z.LINEAR,z.CLAMP_TO_EDGE)}else it.demTexture=new c.T(k,nt,z.RGBA,{premultiply:!1}),it.demTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Q=T.getMeshFromTileID(k,K.canonical,_,!0,"raster"),lt=(b=d.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(K),_t=A.getProjectionData({overscaledTileID:K,aligned:$,applyGlobeMatrix:!x,applyTerrainMatrix:!0});j.draw(k,z.TRIANGLES,p,u[K.overscaledZ],m,pe.backCCW,ca(n,it.dem,H),lt,_t,n.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const _a=[new c.P(0,0),new c.P(c.a4,0),new c.P(c.a4,c.a4),new c.P(0,c.a4)];function as(d,e,n,o,u,p,m,_,x=!1,b=!1){const T=o[o.length-1].overscaledZ,k=d.context,A=k.gl,z=d.useProgram("raster"),j=d.transform,$=d.style.projection,Z=d.colorModeForRenderPass(),H=!d.options.moving,K=n.paint.get("raster-opacity"),it=n.paint.get("raster-resampling"),Y=n.paint.get("raster-fade-duration"),rt=!!d.style.map.terrain;for(const nt of o){const Q=d.getDepthModeForSublayer(nt.overscaledZ-T,K===1?ie.ReadWrite:ie.ReadOnly,A.LESS),lt=e.getTile(nt),_t=it==="nearest"?A.NEAREST:A.LINEAR;k.activeTexture.set(A.TEXTURE0),lt.texture.bind(_t,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),k.activeTexture.set(A.TEXTURE1);const{parentTile:pt,parentScaleBy:ft,parentTopLeft:gt,fadeValues:Dt}=nu(lt,e,Y,rt);lt.fadeOpacity=Dt.tileOpacity,pt?(pt.fadeOpacity=Dt.parentTileOpacity,pt.texture.bind(_t,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST)):lt.texture.bind(_t,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),lt.texture.useMipmap&&k.extTextureFilterAnisotropic&&d.transform.pitch>20&&A.texParameterf(A.TEXTURE_2D,k.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,k.extTextureFilterAnisotropicMax);const Et=d.style.map.terrain&&d.style.map.terrain.getTerrainData(nt),St=j.getProjectionData({overscaledTileID:nt,aligned:H,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),jt=dl(gt,ft,Dt.fadeMix,n,_),Qt=$.getMeshFromTileID(k,nt.canonical,p,m,"raster");z.draw(k,A.TRIANGLES,Q,u?u[nt.overscaledZ]:he.disabled,Z,x?pe.frontCCW:pe.backCCW,jt,Et,St,n.id,Qt.vertexBuffer,Qt.indexBuffer,Qt.segments)}}function nu(d,e,n,o){const u={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||o)return u;if(d.fadingParentID){const p=e.getLoadedTile(d.fadingParentID);if(!p)return u;const m=Math.pow(2,p.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*m%1,d.tileID.canonical.y*m%1],x=(function(b,T,k){const A=qt(),z=(A-T.timeAdded)/k,j=b.fadingDirection===at.Incoming,$=c.an((A-b.timeAdded)/k,0,1),Z=c.an(1-z,0,1),H=j?$:Z;return{tileOpacity:H,parentTileOpacity:j?Z:$,fadeMix:{opacity:1,mix:1-H}}})(d,p,n);return{parentTile:p,parentScaleBy:m,parentTopLeft:_,fadeValues:x}}if(d.selfFading){const p=(function(m,_){const x=(qt()-m.timeAdded)/_,b=c.an(x,0,1);return{tileOpacity:b,fadeMix:{opacity:b,mix:0}}})(d,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:p}}return u}const js=new c.bo(1,0,0,1),Ml=new c.bo(0,1,0,1),ya=new c.bo(0,0,1,1),Il=new c.bo(1,0,1,1),su=new c.bo(0,1,1,1);function El(d,e,n,o){xa(d,0,e+n/2,d.transform.width,n,o)}function Cl(d,e,n,o){xa(d,e-n/2,0,n,d.transform.height,o)}function xa(d,e,n,o,u,p){const m=d.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*d.pixelRatio,n*d.pixelRatio,o*d.pixelRatio,u*d.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function au(d,e,n){const o=d.context,u=o.gl,p=d.useProgram("debug"),m=ie.disabled,_=he.disabled,x=d.colorModeForRenderPass(),b="$debug",T=d.style.map.terrain&&d.style.map.terrain.getTerrainData(n);o.activeTexture.set(u.TEXTURE0);const k=e.getTileByID(n.key).latestRawTileData,A=Math.floor((k&&k.byteLength||0)/1024),z=e.getTile(n).tileSize,j=512/Math.min(z,512)*(n.overscaledZ/d.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),(function(H,K){H.initDebugOverlayCanvas();const it=H.debugOverlayCanvas,Y=H.context.gl,rt=H.debugOverlayCanvas.getContext("2d");rt.clearRect(0,0,it.width,it.height),rt.shadowColor="white",rt.shadowBlur=2,rt.lineWidth=1.5,rt.strokeStyle="white",rt.textBaseline="top",rt.font="bold 36px Open Sans, sans-serif",rt.fillText(K,5,5),rt.strokeText(K,5,5),H.debugOverlayTexture.update(it),H.debugOverlayTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)})(d,`${$} ${A}kB`);const Z=d.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(o,u.TRIANGLES,m,_,Ae.alphaBlended,pe.disabled,ll(c.bo.transparent,j),null,Z,b,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),p.draw(o,u.LINE_STRIP,m,_,x,pe.disabled,ll(c.bo.red),T,Z,b,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function kn(d,e,n,o){const{isRenderingGlobe:u}=o,p=d.context,m=p.gl,_=d.transform,x=d.colorModeForRenderPass(),b=d.getDepthModeFor3D(),T=d.useProgram("terrain");p.bindFramebuffer.set(null),p.viewport.set([0,0,d.width,d.height]);for(const k of n){const A=e.getTerrainMesh(k.tileID),z=d.renderToTexture.getTexture(k),j=e.getTerrainData(k.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,z.texture);const $=e.getMeshFrameDelta(_.zoom),Z=_.calculateFogMatrix(k.tileID.toUnwrapped()),H=al($,Z,d.style.sky,_.pitch,u),K=_.getProjectionData({overscaledTileID:k.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});T.draw(p,m.TRIANGLES,b,he.disabled,x,pe.backCCW,H,j,K,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}function Al(d,e){if(!e.mesh){const n=new c.aV;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const o=new c.aX;o.emplaceBack(0,1,2),o.emplaceBack(0,2,3),e.mesh=new In(d.createVertexBuffer(n,ei.members),d.createIndexBuffer(o),c.aW.simpleSegment(0,0,n.length,o.length))}return e.mesh}class ou{constructor(e,n){this.context=new ho(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ne.maxOverzooming+ne.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jn}resize(e,n,o){if(this.width=Math.floor(e*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const e=this.context,n=new c.aV;n.emplaceBack(0,0),n.emplaceBack(c.a4,0),n.emplaceBack(0,c.a4),n.emplaceBack(c.a4,c.a4),this.tileExtentBuffer=e.createVertexBuffer(n,ei.members),this.tileExtentSegments=c.aW.simpleSegment(0,0,4,2);const o=new c.aV;o.emplaceBack(0,0),o.emplaceBack(c.a4,0),o.emplaceBack(0,c.a4),o.emplaceBack(c.a4,c.a4),this.debugBuffer=e.createVertexBuffer(o,ei.members),this.debugSegments=c.aW.simpleSegment(0,0,4,5);const u=new c.cg;u.emplaceBack(0,0,0,0),u.emplaceBack(c.a4,0,c.a4,0),u.emplaceBack(0,c.a4,0,c.a4),u.emplaceBack(c.a4,c.a4,c.a4,c.a4),this.rasterBoundsBuffer=e.createVertexBuffer(u,qr.members),this.rasterBoundsSegments=c.aW.simpleSegment(0,0,4,2);const p=new c.aV;p.emplaceBack(0,0),p.emplaceBack(c.a4,0),p.emplaceBack(0,c.a4),p.emplaceBack(c.a4,c.a4),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(p,ei.members),this.rasterBoundsSegmentsPosOnly=c.aW.simpleSegment(0,0,4,5);const m=new c.aV;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(m,ei.members),this.viewportSegments=c.aW.simpleSegment(0,0,4,2);const _=new c.ch;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new c.aX;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const b=this.context.gl;this.stencilClearMode=new he({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.tileExtentMesh=new In(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.N();c.c6(o,0,this.width,this.height,0,0,1),c.Q(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const u={mainMatrix:o,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o};this.useProgram("clippingMask",null,!0).draw(e,n.TRIANGLES,ie.disabled,this.stencilClearMode,Ae.disabled,pe.disabled,null,null,u,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n,o){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source,this.nextStencilID+n.length>256&&this.clearStencil();const u=this.context;u.setColorMode(Ae.disabled),u.setDepthMode(ie.disabled);const p={};for(const m of n)p[m.key]=this.nextStencilID++;this._renderTileMasks(p,n,o,!0),this._renderTileMasks(p,n,o,!1),this._tileClippingMaskIDs=p}_renderTileMasks(e,n,o,u){const p=this.context,m=p.gl,_=this.style.projection,x=this.transform,b=this.useProgram("clippingMask");for(const T of n){const k=e[T.key],A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T),z=_.getMeshFromTileID(this.context,T.canonical,u,!0,"stencil"),j=x.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!o,applyTerrainMatrix:!0});b.draw(p,m.TRIANGLES,ie.disabled,new he({func:m.ALWAYS,mask:0},k,255,m.KEEP,m.KEEP,m.REPLACE),Ae.disabled,o?pe.disabled:pe.backCCW,null,A,j,"$clipping",z.vertexBuffer,z.indexBuffer,z.segments)}}_renderTilesDepthBuffer(){const e=this.context,n=e.gl,o=this.style.projection,u=this.transform,p=this.useProgram("depth"),m=this.getDepthModeFor3D(),_=te(u,{tileSize:u.tileSize});for(const x of _){const b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),T=o.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),k=u.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(e,n.TRIANGLES,m,he.disabled,Ae.disabled,pe.backCCW,null,b,k,"$clipping",T.vertexBuffer,T.indexBuffer,T.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,n=this.context.gl;return new he({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){const n=this.context.gl;return new he({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const n=this.context.gl,o=e.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),u=o[o.length-1].overscaledZ,p=o[0].overscaledZ-u+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+u]=new he({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,o]}return[{[u]:he.disabled},o]}stencilConfigForOverlapTwoPass(e){const n=this.context.gl,o=e.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),u=o[o.length-1].overscaledZ,p=o[0].overscaledZ-u+1;if(this.clearStencil(),p>1){const m={},_={};for(let x=0;x<p;x++)m[x+u]=new he({func:n.GREATER,mask:255},p+1+x,255,n.KEEP,n.KEEP,n.REPLACE),_[x+u]=new he({func:n.GREATER,mask:255},1+x,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*p+1,[m,_,o]}return this.nextStencilID=3,[{[u]:new he({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[u]:new he({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},o]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Ae([e.CONSTANT_COLOR,e.ONE],new c.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ae.unblended:Ae.alphaBlended}getDepthModeForSublayer(e,n,o){if(!this.opaquePassEnabledForLayer())return ie.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ie(o||this.context.gl.LEQUAL,n,[u,u])}getDepthModeFor3D(){return new ie(this.context.gl.LEQUAL,ie.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){var o,u;this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(qt()),this.imageManager.beginFrame();const p=this.style._order,m=this.style.tileManagers,_={},x={},b={},T={isRenderingToTexture:!1,isRenderingGlobe:((o=e.projection)===null||o===void 0?void 0:o.transitionState)>0};for(const A in m){const z=m[A];z.used&&z.prepare(this.context),_[A]=z.getVisibleCoordinates(!1),x[A]=_[A].slice().reverse(),b[A]=z.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let A=0;A<p.length;A++)if(this.style._layers[p[A]].is3D()){this.opaquePassCutoff=A;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const A of p){const z=this.style._layers[A];if(!z.hasOffscreenPass()||z.isHidden(this.transform.zoom))continue;const j=x[z.source];(z.type==="custom"||j.length)&&this.renderLayer(this,m[z.source],z,j,T)}if((u=this.style.projection)===null||u===void 0||u.updateGPUdependent({context:this.context,useProgram:A=>this.useProgram(A)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.bo.black:c.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(A,z){const j=A.context,$=j.gl,Z=((nt,Q,lt)=>{const _t=Math.cos(Q.rollInRadians),pt=Math.sin(Q.rollInRadians),ft=ut(Q),gt=Q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:nt.properties.get("sky-color"),u_horizon_color:nt.properties.get("horizon-color"),u_horizon:[(Q.width/2-ft*pt)*lt,(Q.height/2+ft*_t)*lt],u_horizon_normal:[-pt,_t],u_sky_horizon_blend:nt.properties.get("sky-horizon-blend")*Q.height/2*lt,u_sky_blend:gt}})(z,A.style.map.transform,A.pixelRatio),H=new ie($.LEQUAL,ie.ReadWrite,[0,1]),K=he.disabled,it=A.colorModeForRenderPass(),Y=A.useProgram("sky"),rt=Al(j,z);Y.draw(j,$.TRIANGLES,H,K,it,pe.disabled,Z,null,void 0,"sky",rt.vertexBuffer,rt.indexBuffer,rt.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const A=this.style._layers[p[this.currentLayer]],z=m[A.source],j=_[A.source];this._renderTileClippingMasks(A,j,!1),this.renderLayer(this,z,A,j,T)}this.renderPass="translucent";let k=!1;for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const A=this.style._layers[p[this.currentLayer]],z=m[A.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(A,T))continue;this.opaquePassEnabledForLayer()||k||(k=!0,T.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const j=(A.type==="symbol"?b:x)[A.source];this._renderTileClippingMasks(A,_[A.source],!!this.renderToTexture),this.renderLayer(this,z,A,j,T)}if(T.isRenderingGlobe&&(function(A,z,j){const $=A.context,Z=$.gl,H=A.useProgram("atmosphere"),K=new ie(Z.LEQUAL,ie.ReadOnly,[0,1]),it=A.transform,Y=(function(gt,Dt){const Et=gt.properties.get("position"),St=[-Et.x,-Et.y,-Et.z],jt=c.ar(new Float64Array(16));return gt.properties.get("anchor")==="map"&&(c.bf(jt,jt,Dt.rollInRadians),c.bg(jt,jt,-Dt.pitchInRadians),c.bf(jt,jt,Dt.bearingInRadians),c.bg(jt,jt,Dt.center.lat*Math.PI/180),c.bI(jt,jt,-Dt.center.lng*Math.PI/180)),c.cf(St,St,jt),St})(j,A.transform),rt=it.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),nt=z.properties.get("atmosphere-blend")*rt.projectionTransition;if(nt===0)return;const Q=Xa(it.worldSize,it.center.lat),lt=it.inverseProjectionMatrix,_t=new Float64Array(4);_t[3]=1,c.aG(_t,_t,it.modelViewProjectionMatrix),_t[0]/=_t[3],_t[1]/=_t[3],_t[2]/=_t[3],_t[3]=1,c.aG(_t,_t,lt),_t[0]/=_t[3],_t[1]/=_t[3],_t[2]/=_t[3],_t[3]=1;const pt=((gt,Dt,Et,St,jt)=>({u_sun_pos:gt,u_atmosphere_blend:Dt,u_globe_position:Et,u_globe_radius:St,u_inv_proj_matrix:jt}))(Y,nt,[_t[0],_t[1],_t[2]],Q,lt),ft=Al($,z);H.draw($,Z.TRIANGLES,K,he.disabled,Ae.alphaBlended,pe.disabled,pt,null,null,"atmosphere",ft.vertexBuffer,ft.indexBuffer,ft.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const A=(function(z,j){let $=null;const Z=Object.values(z._layers).flatMap((Y=>Y.source&&!Y.isHidden(j)?[z.tileManagers[Y.source]]:[])),H=Z.filter((Y=>Y.getSource().type==="vector")),K=Z.filter((Y=>Y.getSource().type!=="vector")),it=Y=>{(!$||$.getSource().maxzoom<Y.getSource().maxzoom)&&($=Y)};return H.forEach((Y=>it(Y))),$||K.forEach((Y=>it(Y))),$})(this.style,this.transform.zoom);A&&(function(z,j,$){for(let Z=0;Z<$.length;Z++)au(z,j,$[Z])})(this,A,A.getVisibleCoordinates())}this.options.showPadding&&(function(A){const z=A.transform.padding;El(A,A.transform.height-(z.top||0),3,js),El(A,z.bottom||0,3,Ml),Cl(A,z.left||0,3,ya),Cl(A,A.transform.width-(z.right||0),3,Il);const j=A.transform.centerPoint;(function($,Z,H,K){xa($,Z-1,H-10,2,20,K),xa($,Z-10,H-1,20,2,K)})(A,j.x,A.transform.height-j.y,su)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let u=this.terrainFacilitator.dirty;u||(u=e?!c.ci(n,o):!c.cj(n,o)),u||(u=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),u&&(c.ck(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(p,m){const _=p.context,x=_.gl,b=p.transform,T=Ae.unblended,k=new ie(x.LEQUAL,ie.ReadWrite,[0,1]),A=m.tileManager.getRenderableTiles(),z=p.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:c.bo.transparent,depth:1});for(const j of A){const $=m.getTerrainMesh(j.tileID),Z=m.getTerrainData(j.tileID),H=b.getProjectionData({overscaledTileID:j.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:m.getMeshFrameDelta(b.zoom)};z.draw(_,x.TRIANGLES,k,he.disabled,T,pe.backCCW,K,Z,H,"terrain",$.vertexBuffer,$.indexBuffer,$.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain),(function(p,m){const _=p.context,x=_.gl,b=p.transform,T=Ae.unblended,k=new ie(x.LEQUAL,ie.ReadWrite,[0,1]),A=m.getCoordsTexture(),z=m.tileManager.getRenderableTiles(),j=p.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:c.bo.transparent,depth:1}),m.coordsIndex=[];for(const $ of z){const Z=m.getTerrainMesh($.tileID),H=m.getTerrainData($.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,A.texture);const K={u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(b.zoom)},it=b.getProjectionData({overscaledTileID:$.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});j.draw(_,x.TRIANGLES,k,he.disabled,T,pe.backCCW,K,H,it,"terrain",Z.vertexBuffer,Z.indexBuffer,Z.segments),m.coordsIndex.push($.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain))}renderLayer(e,n,o,u,p){o.isHidden(this.transform.zoom)||(o.type==="background"||o.type==="custom"||(u||[]).length)&&(this.id=o.id,c.cl(o)?(function(m,_,x,b,T,k){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:A}=k,z=he.disabled,j=m.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function($,Z,H,K,it,Y,rt,nt,Q){const lt=Z.transform,_t=Z.style.map.terrain,pt=it==="map",ft=Y==="map";for(const gt of $){const Dt=K.getTile(gt),Et=Dt.getBucket(H);if(!Et||!Et.text||!Et.text.segments.get().length)continue;const St=c.ax(Et.textSizeData,lt.zoom),jt=c.aM(Dt,1,Z.transform.zoom),Qt=ti(pt,Z.transform,jt),Jt=H.layout.get("icon-text-fit")!=="none"&&Et.hasIconData();if(St){const Me=Math.pow(2,lt.zoom-Dt.tileID.overscaledZ),Ie=_t?(Oe,ye)=>_t.getElevation(gt,Oe,ye):null;go(Et,pt,ft,Q,lt,Qt,Me,St,Jt,c.aN(lt,Dt,rt,nt),gt.toUnwrapped(),Ie)}}})(b,m,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),T),x.paint.get("icon-opacity").constantOr(1)!==0&&_o(m,_,x,b,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),z,j,A),x.paint.get("text-opacity").constantOr(1)!==0&&_o(m,_,x,b,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),z,j,A),_.map.showCollisionBoxes&&(po(m,_,x,b,!0),po(m,_,x,b,!1))})(e,n,o,u,this.style.placement.variableOffsets,p):c.cm(o)?(function(m,_,x,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=T,A=x.paint.get("circle-opacity"),z=x.paint.get("circle-stroke-width"),j=x.paint.get("circle-stroke-opacity"),$=!x.layout.get("circle-sort-key").isConstant();if(A.constantOr(1)===0&&(z.constantOr(1)===0||j.constantOr(1)===0))return;const Z=m.context,H=Z.gl,K=m.transform,it=m.getDepthModeForSublayer(0,ie.ReadOnly),Y=he.disabled,rt=m.colorModeForRenderPass(),nt=[],Q=K.getCircleRadiusCorrection();for(let lt=0;lt<b.length;lt++){const _t=b[lt],pt=_.getTile(_t),ft=pt.getBucket(x);if(!ft)continue;const gt=x.paint.get("circle-translate"),Dt=x.paint.get("circle-translate-anchor"),Et=c.aN(K,pt,gt,Dt),St=ft.programConfigurations.get(x.id),jt=m.useProgram("circle",St),Qt=ft.layoutVertexBuffer,Jt=ft.indexBuffer,Me=m.style.map.terrain&&m.style.map.terrain.getTerrainData(_t),Ie={programConfiguration:St,program:jt,layoutVertexBuffer:Qt,indexBuffer:Jt,uniformValues:jc(m,pt,x,Et,Q),terrainData:Me,projectionData:K.getProjectionData({overscaledTileID:_t,applyGlobeMatrix:!k,applyTerrainMatrix:!0})};if($){const Oe=ft.segments.get();for(const ye of Oe)nt.push({segments:new c.aW([ye]),sortKey:ye.sortKey,state:Ie})}else nt.push({segments:ft.segments,sortKey:0,state:Ie})}$&&nt.sort(((lt,_t)=>lt.sortKey-_t.sortKey));for(const lt of nt){const{programConfiguration:_t,program:pt,layoutVertexBuffer:ft,indexBuffer:gt,uniformValues:Dt,terrainData:Et,projectionData:St}=lt.state;pt.draw(Z,H.TRIANGLES,it,Y,rt,pe.backCCW,Dt,Et,St,x.id,ft,gt,lt.segments,x.paint,m.transform.zoom,_t)}})(e,n,o,u,p):c.cn(o)?(function(m,_,x,b,T){if(x.paint.get("heatmap-opacity")===0)return;const k=m.context,{isRenderingToTexture:A,isRenderingGlobe:z}=T;if(m.style.map.terrain){for(const j of b){const $=_.getTile(j);_.hasRenderableParent(j)||(m.renderPass==="offscreen"?ma(m,$,x,j,z):m.renderPass==="translucent"&&vh(m,x,j,A,z))}k.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?(function(j,$,Z,H){const K=j.context,it=K.gl,Y=j.transform,rt=he.disabled,nt=new Ae([it.ONE,it.ONE],c.bo.transparent,[!0,!0,!0,!0]);(function(Q,lt,_t){const pt=Q.gl;Q.activeTexture.set(pt.TEXTURE1),Q.viewport.set([0,0,lt.width/4,lt.height/4]);let ft=_t.heatmapFbos.get(c.cc);ft?(pt.bindTexture(pt.TEXTURE_2D,ft.colorAttachment.get()),Q.bindFramebuffer.set(ft.framebuffer)):(ft=Tl(Q,lt.width/4,lt.height/4),_t.heatmapFbos.set(c.cc,ft))})(K,j,Z),K.clear({color:c.bo.transparent});for(let Q=0;Q<H.length;Q++){const lt=H[Q];if($.hasRenderableParent(lt))continue;const _t=$.getTile(lt),pt=_t.getBucket(Z);if(!pt)continue;const ft=pt.programConfigurations.get(Z.id),gt=j.useProgram("heatmap",ft),Dt=Y.getProjectionData({overscaledTileID:lt,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Et=Y.getCircleRadiusCorrection();gt.draw(K,it.TRIANGLES,ie.disabled,rt,nt,pe.backCCW,cl(_t,Y.zoom,Z.paint.get("heatmap-intensity"),Et),null,Dt,Z.id,pt.layoutVertexBuffer,pt.indexBuffer,pt.segments,Z.paint,Y.zoom,ft)}K.viewport.set([0,0,j.width,j.height])})(m,_,x,b):m.renderPass==="translucent"&&(function(j,$){const Z=j.context,H=Z.gl;Z.setColorMode(j.colorModeForRenderPass());const K=$.heatmapFbos.get(c.cc);K&&(Z.activeTexture.set(H.TEXTURE0),H.bindTexture(H.TEXTURE_2D,K.colorAttachment.get()),Z.activeTexture.set(H.TEXTURE1),ga(Z,$).bind(H.LINEAR,H.CLAMP_TO_EDGE),j.useProgram("heatmapTexture").draw(Z,H.TRIANGLES,ie.disabled,he.disabled,j.colorModeForRenderPass(),pe.disabled,ul(j,$,0,1),null,null,$.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments,$.paint,j.transform.zoom))})(m,x)})(e,n,o,u,p):c.co(o)?(function(m,_,x,b,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=T,A=x.paint.get("line-opacity"),z=x.paint.get("line-width");if(A.constantOr(1)===0||z.constantOr(1)===0)return;const j=m.getDepthModeForSublayer(0,ie.ReadOnly),$=m.colorModeForRenderPass(),Z=x.paint.get("line-dasharray"),H=Z.constantOr(1),K=x.paint.get("line-pattern"),it=K.constantOr(1),Y=x.paint.get("line-gradient"),rt=x.getCrossfadeParameters();let nt;nt=it?"linePattern":H&&Y?"lineGradientSDF":H?"lineSDF":Y?"lineGradient":"line";const Q=m.context,lt=Q.gl,_t=m.transform;let pt=!0;for(const ft of b){const gt=_.getTile(ft);if(it&&!gt.patternsLoaded())continue;const Dt=gt.getBucket(x);if(!Dt)continue;const Et=Dt.programConfigurations.get(x.id),St=m.context.program.get(),jt=m.useProgram(nt,Et),Qt=pt||jt.program!==St,Jt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ft),Me=K.constantOr(null),Ie=Z&&Z.constantOr(null);if(Me&>.imageAtlas){const Ye=gt.imageAtlas,We=Ye.patternPositions[Me.to.toString()],Ke=Ye.patternPositions[Me.from.toString()];We&&Ke&&Et.setConstantPatternPositions(We,Ke)}else if(Ie){const Ye=x.layout.get("line-cap")==="round",We=m.lineAtlas.getDash(Ie.to,Ye),Ke=m.lineAtlas.getDash(Ie.from,Ye);Et.setConstantDashPositions(We,Ke)}const Oe=_t.getProjectionData({overscaledTileID:ft,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),ye=_t.getPixelScale();let ri;it?(ri=hh(m,gt,x,ye,rt),eu(Q,lt,gt,Et,rt)):H&&Y?(ri=Gc(m,gt,x,ye,rt,Dt.lineClipsArray.length),Sl(m,_,Q,lt,x,Dt,ft,Et,rt)):H?(ri=dh(m,gt,x,ye,rt),iu(m,Q,lt,Et,Qt,rt)):Y?(ri=ua(m,gt,x,ye,Dt.lineClipsArray.length),xo(m,_,Q,lt,x,Dt,ft)):ri=to(m,gt,x,ye);const De=m.stencilModeForClipping(ft);jt.draw(Q,lt.TRIANGLES,j,De,$,pe.disabled,ri,Jt,Oe,x.id,Dt.layoutVertexBuffer,Dt.indexBuffer,Dt.segments,x.paint,m.transform.zoom,Et,Dt.layoutVertexBuffer2),pt=!1}})(e,n,o,u,p):c.cp(o)?(function(m,_,x,b,T){const k=x.paint.get("fill-color"),A=x.paint.get("fill-opacity");if(A.constantOr(1)===0)return;const{isRenderingToTexture:z}=T,j=m.colorModeForRenderPass(),$=x.paint.get("fill-pattern"),Z=m.opaquePassEnabledForLayer()&&!$.constantOr(1)&&k.constantOr(c.bo.transparent).a===1&&A.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===Z){const H=m.getDepthModeForSublayer(1,m.renderPass==="opaque"?ie.ReadWrite:ie.ReadOnly);Pl(m,_,x,b,H,j,!1,z)}if(m.renderPass==="translucent"&&x.paint.get("fill-antialias")){const H=m.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ie.ReadOnly);Pl(m,_,x,b,H,j,!0,z)}})(e,n,o,u,p):c.cq(o)?(function(m,_,x,b,T){const k=x.paint.get("fill-extrusion-opacity");if(k===0)return;const{isRenderingToTexture:A}=T;if(m.renderPass==="translucent"){const z=new ie(m.context.gl.LEQUAL,ie.ReadWrite,m.depthRangeFor3D);if(k!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Be(m,_,x,b,z,he.disabled,Ae.disabled,A),Be(m,_,x,b,z,m.stencilModeFor3D(),m.colorModeForRenderPass(),A);else{const j=m.colorModeForRenderPass();Be(m,_,x,b,z,he.disabled,j,A)}}})(e,n,o,u,p):c.cr(o)?(function(m,_,x,b,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const{isRenderingToTexture:k}=T,A=m.context,z=m.style.projection.useSubdivision,j=m.getDepthModeForSublayer(0,ie.ReadOnly),$=m.colorModeForRenderPass();if(m.renderPass==="offscreen")(function(Z,H,K,it,Y,rt,nt){const Q=Z.context,lt=Q.gl;for(const _t of K){const pt=H.getTile(_t),ft=pt.dem;if(!ft||!ft.data||!pt.needsHillshadePrepare)continue;const gt=ft.dim,Dt=ft.stride,Et=ft.getPixels();if(Q.activeTexture.set(lt.TEXTURE1),Q.pixelStoreUnpackPremultiplyAlpha.set(!1),pt.demTexture=pt.demTexture||Z.getTileTexture(Dt),pt.demTexture){const jt=pt.demTexture;jt.update(Et,{premultiply:!1}),jt.bind(lt.NEAREST,lt.CLAMP_TO_EDGE)}else pt.demTexture=new c.T(Q,Et,lt.RGBA,{premultiply:!1}),pt.demTexture.bind(lt.NEAREST,lt.CLAMP_TO_EDGE);Q.activeTexture.set(lt.TEXTURE0);let St=pt.fbo;if(!St){const jt=new c.T(Q,{width:gt,height:gt,data:null},lt.RGBA);jt.bind(lt.LINEAR,lt.CLAMP_TO_EDGE),St=pt.fbo=Q.createFramebuffer(gt,gt,!0,!1),St.colorAttachment.set(jt.texture)}Q.bindFramebuffer.set(St.framebuffer),Q.viewport.set([0,0,gt,gt]),Z.useProgram("hillshadePrepare").draw(Q,lt.TRIANGLES,Y,rt,nt,pe.disabled,Vc(pt.tileID,ft),null,null,it.id,Z.rasterBoundsBuffer,Z.quadTriangleIndexBuffer,Z.rasterBoundsSegments),pt.needsHillshadePrepare=!1}})(m,_,b,x,j,he.disabled,$),A.viewport.set([0,0,m.width,m.height]);else if(m.renderPass==="translucent")if(z){const[Z,H,K]=m.stencilConfigForOverlapTwoPass(b);nn(m,_,x,K,Z,j,$,!1,k),nn(m,_,x,K,H,j,$,!0,k)}else{const[Z,H]=m.getStencilConfigForOverlapAndUpdateStencilID(b);nn(m,_,x,H,Z,j,$,!1,k)}})(e,n,o,u,p):c.cs(o)?(function(m,_,x,b,T){if(m.renderPass!=="translucent"||!b.length)return;const{isRenderingToTexture:k}=T,A=m.style.projection.useSubdivision,z=m.getDepthModeForSublayer(0,ie.ReadOnly),j=m.colorModeForRenderPass();if(A){const[$,Z,H]=m.stencilConfigForOverlapTwoPass(b);Hi(m,_,x,H,$,z,j,!1,k),Hi(m,_,x,H,Z,z,j,!0,k)}else{const[$,Z]=m.getStencilConfigForOverlapAndUpdateStencilID(b);Hi(m,_,x,Z,$,z,j,!1,k)}})(e,n,o,u,p):c.bT(o)?(function(m,_,x,b,T){if(m.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!b.length)return;const{isRenderingToTexture:k}=T,A=_.getSource(),z=m.style.projection.useSubdivision;if(A instanceof Gi)as(m,_,x,b,null,!1,!1,A.tileCoords,A.flippedWindingOrder,k);else if(z){const[j,$,Z]=m.stencilConfigForOverlapTwoPass(b);as(m,_,x,Z,j,!1,!0,_a,!1,k),as(m,_,x,Z,$,!0,!0,_a,!1,k)}else{const[j,$]=m.getStencilConfigForOverlapAndUpdateStencilID(b);as(m,_,x,$,j,!1,!0,_a,!1,k)}})(e,n,o,u,p):c.ct(o)?(function(m,_,x,b,T){const k=x.paint.get("background-color"),A=x.paint.get("background-opacity");if(A===0)return;const{isRenderingToTexture:z}=T,j=m.context,$=j.gl,Z=m.style.projection,H=m.transform,K=H.tileSize,it=x.paint.get("background-pattern");if(m.isPatternMissing(it))return;const Y=!it&&k.a===1&&A===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==Y)return;const rt=he.disabled,nt=m.getDepthModeForSublayer(0,Y==="opaque"?ie.ReadWrite:ie.ReadOnly),Q=m.colorModeForRenderPass(),lt=m.useProgram(it?"backgroundPattern":"background"),_t=b||te(H,{tileSize:K,terrain:m.style.map.terrain});it&&(j.activeTexture.set($.TEXTURE0),m.imageManager.bind(m.context));const pt=x.getCrossfadeParameters();for(const ft of _t){const gt=H.getProjectionData({overscaledTileID:ft,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),Dt=it?ml(A,m,it,{tileID:ft,tileSize:K},pt):fl(A,k),Et=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ft),St=Z.getMeshFromTileID(j,ft.canonical,!1,!0,"raster");lt.draw(j,$.TRIANGLES,nt,rt,Q,pe.backCCW,Dt,Et,gt,x.id,St.vertexBuffer,St.indexBuffer,St.segments)}})(e,0,o,u,p):c.cu(o)&&(function(m,_,x,b){const{isRenderingGlobe:T}=b,k=m.context,A=x.implementation,z=m.style.projection,j=m.transform,$=j.getProjectionDataForCustomLayer(T),Z={farZ:j.farZ,nearZ:j.nearZ,fov:j.fov*Math.PI/180,modelViewProjectionMatrix:j.modelViewProjectionMatrix,projectionMatrix:j.projectionMatrix,shaderData:{variantName:z.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
804
|
+
uniform mat4 u_projection_matrix;
|
|
805
|
+
${z.shaderPreludeCode.vertexSource}`,define:z.shaderDefine},defaultProjectionData:$},H=A.renderingMode?A.renderingMode:"2d";if(m.renderPass==="offscreen"){const K=A.prerender;K&&(m.setCustomLayerDefaults(),k.setColorMode(m.colorModeForRenderPass()),K.call(A,k.gl,Z),k.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),k.setColorMode(m.colorModeForRenderPass()),k.setStencilMode(he.disabled);const K=H==="3d"?m.getDepthModeFor3D():m.getDepthModeForSublayer(0,ie.ReadOnly);k.setDepthMode(K),A.render(k.gl,Z),k.setDirty(),m.setBaseState(),k.bindFramebuffer.set(null)}})(e,0,o,p))}saveTileTexture(e){const n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const n=this.imageManager.getPattern(e.from.toString()),o=this.imageManager.getPattern(e.to.toString());return!n||!o}useProgram(e,n,o=!1,u=[]){this.cache=this.cache||{};const p=!!this.style.map.terrain,m=this.style.projection,_=o?ar.projectionMercator:m.shaderPreludeCode,x=o?Ti:m.shaderDefine,b=e+(n?n.cacheKey:"")+`/${o?Si:m.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"")+(u?`/${u.join("/")}`:"");return this.cache[b]||(this.cache[b]=new ch(this.context,ar[e],n,_l[e],this._showOverdrawInspector,p,_,x,u)),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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new c.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,n;if(this._tileTextures){for(const o in this._tileTextures){const u=this._tileTextures[o];if(u)for(const p of u)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&&((e=this.tileExtentMesh.vertexBuffer)===null||e===void 0||e.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const o in this.cache){const u=this.cache[o];u&&u.program&&this.context.gl.deleteProgram(u.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}function kl(d,e){let n,o=!1,u=null,p=null;const m=()=>{u=null,o&&(d.apply(p,n),u=setTimeout(m,e),o=!1)};return(..._)=>(o=!0,p=this,n=_,u||m(),u)}class Dl{constructor(e){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map((u=>u.split("="))).forEach((u=>{u[0]===this._hashName&&(o=u)})),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const o=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:o,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 o=n.join("/");let u=o;u.split("&").length>0&&(u=u.split("&")[0]),this._hashName&&(u=`${this._hashName}=${o}`);let p=window.location.hash.replace(u,"");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=kl(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,u=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,u),m=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,x=this._map.getBearing(),b=this._map.getPitch();let T="";if(T+=e?`/${m}/${_}/${o}`:`${o}/${_}/${m}`,(x||b)&&(T+="/"+Math.round(10*x)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){const k=this._hashName;let A=!1;const z=window.location.hash.slice(1).split("&").map((j=>{const $=j.split("=")[0];return $===k?(A=!0,`${$}=${T}`):j})).filter((j=>j));return A||z.push(`${k}=${T}`),`#${z.join("&")}`}return`#${T}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new c.V(+e[2],+e[1])}catch{return!1}const n=+e[0],o=+(e[3]||0),u=+(e[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&o>=-180&&o<=180&&u>=this._map.getMinPitch()&&u<=this._map.getMaxPitch()}}const Ns={linearity:.3,easing:c.cv(0,0,.3,1)},lu=c.e({deceleration:2500,maxSpeed:1400},Ns),cu=c.e({deceleration:20,maxSpeed:1400},Ns),uu=c.e({deceleration:1e3,maxSpeed:360},Ns),vo=c.e({deceleration:1e3,maxSpeed:90},Ns),hu=c.e({deceleration:1e3,maxSpeed:360},Ns);class lr{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:qt(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=qt();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new c.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 o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const p=Vs(n.pan.mag(),o,c.e({},lu,e||{})),m=n.pan.mult(p.amount/n.pan.mag()),_=this._map.cameraHelper.handlePanInertia(m,this._map.transform);u.center=_.easingCenter,u.offset=_.easingOffset,Bi(u,p)}if(n.zoom){const p=Vs(n.zoom,o,cu);u.zoom=this._map.transform.zoom+p.amount,Bi(u,p)}if(n.bearing){const p=Vs(n.bearing,o,uu);u.bearing=this._map.transform.bearing+c.an(p.amount,-179,179),Bi(u,p)}if(n.pitch){const p=Vs(n.pitch,o,vo);u.pitch=this._map.transform.pitch+p.amount,Bi(u,p)}if(n.roll){const p=Vs(n.roll,o,hu);u.roll=this._map.transform.roll+c.an(p.amount,-179,179),Bi(u,p)}if(u.zoom||u.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;u.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),c.e(u,{noMoveStart:!0})}}function Bi(d,e){(!d.duration||d.duration<e.duration)&&(d.duration=e.duration,d.easing=e.easing)}function Vs(d,e,n){const{maxSpeed:o,linearity:u,deceleration:p}=n,m=c.an(d*u/(e/1e3),-o,o),_=Math.abs(m)/(p*u);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class Ue extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o,u={}){o=o instanceof MouseEvent?o:new MouseEvent(e,o);const p=xt.mousePos(n.getCanvas(),o),m=n.unproject(p);super(e,c.e({point:p,lngLat:m,originalEvent:o},u)),this._defaultPrevented=!1,this.target=n}}class va extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){const u=e==="touchend"?o.changedTouches:o.touches,p=xt.touchPos(n.getCanvasContainer(),u),m=p.map((x=>n.unproject(x))),_=p.reduce(((x,b,T,k)=>x.add(b.div(k.length))),new c.P(0,0));super(e,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:o}),this._defaultPrevented=!1}}class os extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){super(e,{originalEvent:o}),this._defaultPrevented=!1}}class bh{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new os(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Ue(e.type,this._map,e))}mouseup(e){this._map.fire(new Ue(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ue(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ue(e.type,this._map,e))}mouseover(e){this._map.fire(new Ue(e.type,this._map,e))}mouseout(e){this._map.fire(new Ue(e.type,this._map,e))}touchstart(e){return this._firePreventable(new va(e.type,this._map,e))}touchmove(e){this._map.fire(new va(e.type,this._map,e))}touchend(e){this._map.fire(new va(e.type,this._map,e))}touchcancel(e){this._map.fire(new va(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ue(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ue("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ue(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ba{constructor(e){this._map=e}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(e){return this.transform.screenPointToLocation(c.P.convert(e),this._map.terrain)}}class du{constructor(e,n){this._map=e,this._tr=new ba(e),this._el=e.getCanvasContainer(),this._container=e.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(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(xt.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=o,this._box||(this._box=xt.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const p=Math.min(u.x,o.x),m=Math.max(u.x,o.x),_=Math.min(u.y,o.y),x=Math.max(u.y,o.y);xt.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;const o=this._startPos,u=n;if(this.reset(),xt.suppressClick(),o.x!==u.x||o.y!==u.y)return this._map.fire(new c.l("boxzoomend",{originalEvent:e})),{cameraAnimation:p=>p.fitScreenCoordinates(o,u,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(xt.remove(this._box),this._box=null),xt.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new c.l(e,{originalEvent:n}))}}function bo(d,e){if(d.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${e.length}`);const n={};for(let o=0;o<d.length;o++)n[d[o].identifier]=e[o];return n}class wa{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),o.length===this.numTouches&&(this.centroid=(function(u){const p=new c.P(0,0);for(const m of u)p._add(m);return p.div(u.length)})(n),this.touches=bo(o,n)))}touchmove(e,n,o){if(this.aborted||!this.centroid)return;const u=bo(o,n);for(const p in this.touches){const m=u[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(e,n,o){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class Pr{constructor(e){this.singleTap=new wa(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,o){this.singleTap.touchstart(e,n,o)}touchmove(e,n,o){this.singleTap.touchmove(e,n,o)}touchend(e,n,o){const u=this.singleTap.touchend(e,n,o);if(u){const p=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(u)<30;if(p&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Lt{constructor(e){this._tr=new ba(e),this._zoomIn=new Pr({numTouches:1,numTaps:2}),this._zoomOut=new Pr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,o){this._zoomIn.touchstart(e,n,o),this._zoomOut.touchstart(e,n,o)}touchmove(e,n,o){this._zoomIn.touchmove(e,n,o),this._zoomOut.touchmove(e,n,o)}touchend(e,n,o){const u=this._zoomIn.touchend(e,n,o),p=this._zoomOut.touchend(e,n,o),m=this._tr;return u?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(u)},{originalEvent:e})}):p?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Us{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const u=Array.isArray(n)?n[0]:n;return!this._moved&&u.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=u,this._move(o,u))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&xt.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const zl=0,pu=2,Ta={[zl]:1,[pu]:2};class sn{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const n=xt.mouseButton(e);this._eventButton=n}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!(function(n,o){const u=Ta[o];return n.buttons===void 0||(n.buttons&u)!==u})(e,this._eventButton)}isValidEndEvent(e){return xt.mouseButton(e)===this._eventButton}}class Rl{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Th{constructor(e=new sn({checkCorrectEvent:()=>!0}),n=new Rl){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(e,n,o){return e instanceof MouseEvent?n(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?o(e):void 0}startMove(e){this._executeRelevantHandler(e,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(e){this._executeRelevantHandler(e,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const Gs=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=e=>{e.preventDefault()}};class fu{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,o){return this._calculateTransform(e,n,o)}touchmove(e,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return e.preventDefault(),this._calculateTransform(e,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,o){this._calculateTransform(e,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,o){o.length>0&&(this._active=!0);const u=bo(o,n),p=new c.P(0,0),m=new c.P(0,0);let _=0;for(const b in u){const T=u[b],k=this._touches[b];k&&(p._add(T),m._add(T.sub(k)),_++,u[b]=T)}if(this._touches=u,this._shouldBePrevented(_)||!m.mag())return;const x=m.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Sa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,o){if(!this._firstTwoTouches)return;e.preventDefault();const[u,p]=this._firstTwoTouches,m=wo(o,n,u),_=wo(o,n,p);if(!m||!_)return;const x=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],x,e)}touchend(e,n,o){if(!this._firstTwoTouches)return;const[u,p]=this._firstTwoTouches,m=wo(o,n,u),_=wo(o,n,p);m&&_||(this._active&&xt.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function wo(d,e,n){for(let o=0;o<d.length;o++)if(d[o].identifier===n)return e[o]}function Ll(d,e){return Math.log(d/e)/Math.LN2}class mu extends Sa{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){const o=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Ll(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ll(this._distance,o),pinchAround:n}}}function gu(d,e){return 180*d.angleWith(e)/Math.PI}class Fl extends Sa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n,o){const u=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:gu(this._vector,u),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const n=25/(Math.PI*this._minDiameter)*360,o=gu(e,this._startVector);return Math.abs(o)<n}}function Bl(d){return Math.abs(d.y)>Math.abs(d.x)}class Ol extends Sa{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,o){super.touchstart(e,n,o),this._currentTouchCount=o.length}_start(e){this._lastPoints=e,Bl(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const u=e[0].sub(this._lastPoints[0]),p=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,p,o.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(u.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,o){if(this._valid!==void 0)return this._valid;const u=e.mag()>=2,p=n.mag()>=2;if(!u&&!p)return;if(!u||!p)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=e.y>0==n.y>0;return Bl(e)&&Bl(n)&&m}}const Sh={panStep:100,bearingStep:15,pitchStep:10};class _u{constructor(e){this._tr=new ba(e);const n=Sh;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,o=0,u=0,p=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?o=-1:(e.preventDefault(),p=-1);break;case 39:e.shiftKey?o=1:(e.preventDefault(),p=1);break;case 38:e.shiftKey?u=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?u=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,u=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Dn,zoom:n?Math.round(x.zoom)+n*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+o*this._bearingStep,pitch:x.pitch+u*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:x.center},{originalEvent:e})}}}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 Dn(d){return d*(2-d)}const ge=4.000244140625,Ph=1/450;class Pa{constructor(e,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=e,this._tr=new ba(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Ph}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const o=qt(),u=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%ge==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=xt.mousePos(this._map.getCanvas(),e),o=this._tr;this._aroundPoint=this._aroundCenter?o.transform.locationToScreenPoint(c.V.convert(o.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.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)>ge?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const b=typeof this._targetZoom!="number"?e.scale:c.aq(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),c.at(b*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,o=this._startZoom,u=this._easing;let p,m=!1;if(this._type==="wheel"&&o&&u){const _=qt()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),b=u(x);p=c.G.number(o,n,b),x<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-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=c.cx;if(this._prevEase){const o=this._prevEase,u=(qt()-o.start)/o.duration,p=o.easing(u+.01)-o.easing(u),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.cv(m,_,.25,1)}return this._prevEase={start:qt(),duration:e,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 Ma{constructor(e,n){this._clickZoom=e,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 jl{constructor(e){this._tr=new ba(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yu{constructor(){this._tap=new Pr({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(e,n,o){if(!this._swipePoint)if(this._tapTime){const u=n[0],p=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(u)<30;p&&m?o.length>0&&(this._swipePoint=u,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(e,n,o)}touchmove(e,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const u=n[0],p=u.y-this._swipePoint.y;return this._swipePoint=u,e.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(e,n,o)}touchend(e,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const u=this._tap.touchend(e,n,o);u&&(this._tapTime=e.timeStamp,this._tapPoint=u)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nl{constructor(e,n,o){this._el=e,this._mousePan=n,this._touchPan=o}enable(e){this._inertiaOptions=e||{},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 Vl{constructor(e,n,o,u){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=n,this._mousePitch=o,this._mouseRoll=u}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 xu{constructor(e,n,o,u){this._el=e,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=u,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 Mr{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=xt.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),u=document.createElement("div");u.className="maplibregl-desktop-message",u.textContent=n,this._container.appendChild(u);const p=document.createElement("div");p.className="maplibregl-mobile-message",p.textContent=o,this._container.appendChild(p),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(xt.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new c.l("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const ls=d=>d.zoom||d.drag||d.roll||d.pitch||d.rotate;class Vt extends c.l{}function Wt(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta||d.rollDelta}class Ia{constructor(e,n){this.handleWindowEvent=u=>{this.handleEvent(u,`${u.type}Window`)},this.handleEvent=(u,p)=>{if(u.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=u.type==="renderFrame"?void 0:u,_={needsRenderFrame:!1},x={},b={};for(const{handlerName:A,handler:z,allowed:j}of this._handlers){if(!z.isEnabled())continue;let $;if(this._blockedByActive(b,j,A))z.reset();else if(z[p||u.type]){if(c.cy(u,p||u.type)){const Z=xt.mousePos(this._map.getCanvas(),u);$=z[p||u.type](u,Z)}else if(c.cz(u,p||u.type)){const Z=this._getMapTouches(u.touches),H=xt.touchPos(this._map.getCanvas(),Z);$=z[p||u.type](u,H,Z)}else c.cA(p||u.type)||($=z[p||u.type](u));this.mergeHandlerResult(_,x,$,A,m),$&&$.needsRenderFrame&&this._triggerRenderFrame()}($||z.isActive())&&(b[A]=z)}const T={};for(const A in this._previousActiveHandlers)b[A]||(T[A]=m);this._previousActiveHandlers=b,(Object.keys(T).length||Wt(_))&&(this._changes.push([_,x,T]),this._triggerRenderFrame()),(Object.keys(b).length||Wt(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:k}=_;k&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],k(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new lr(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,p,m]of this._listeners)xt.addEventListener(u,p,u===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[e,n,o]of this._listeners)xt.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(e){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new bh(n,e));const u=n.boxZoom=new du(n,e);this._add("boxZoom",u),e.interactive&&e.boxZoom&&u.enable();const p=n.cooperativeGestures=new Mr(n,e.cooperativeGestures);this._add("cooperativeGestures",p),e.cooperativeGestures&&p.enable();const m=new Lt(n),_=new jl(n);n.doubleClickZoom=new Ma(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();const x=new yu;this._add("tapDragZoom",x);const b=n.touchPitch=new Ol(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);const T=()=>n.project(n.getCenter()),k=(function({enable:Y,clickTolerance:rt,aroundCenter:nt=!0,minPixelCenterThreshold:Q=100,rotateDegreesPerPixelMoved:lt=.8},_t){const pt=new sn({checkCorrectEvent:ft=>xt.mouseButton(ft)===0&&ft.ctrlKey||xt.mouseButton(ft)===2&&!ft.ctrlKey});return new Us({clickTolerance:rt,move:(ft,gt)=>{const Dt=_t();if(nt&&Math.abs(Dt.y-ft.y)>Q)return{bearingDelta:c.cw(new c.P(ft.x,gt.y),gt,Dt)};let Et=(gt.x-ft.x)*lt;return nt&>.y<Dt.y&&(Et=-Et),{bearingDelta:Et}},moveStateManager:pt,enable:Y,assignEvents:Gs})})(e,T),A=(function({enable:Y,clickTolerance:rt,pitchDegreesPerPixelMoved:nt=-.5}){const Q=new sn({checkCorrectEvent:lt=>xt.mouseButton(lt)===0&<.ctrlKey||xt.mouseButton(lt)===2});return new Us({clickTolerance:rt,move:(lt,_t)=>({pitchDelta:(_t.y-lt.y)*nt}),moveStateManager:Q,enable:Y,assignEvents:Gs})})(e),z=(function({enable:Y,clickTolerance:rt,rollDegreesPerPixelMoved:nt=.3},Q){const lt=new sn({checkCorrectEvent:_t=>xt.mouseButton(_t)===2&&_t.ctrlKey});return new Us({clickTolerance:rt,move:(_t,pt)=>{const ft=Q();let gt=(pt.x-_t.x)*nt;return pt.y<ft.y&&(gt=-gt),{rollDelta:gt}},moveStateManager:lt,enable:Y,assignEvents:Gs})})(e,T);n.dragRotate=new Vl(e,k,A,z),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",A,["mouseRotate","mouseRoll"]),this._add("mouseRoll",z,["mousePitch"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();const j=(function({enable:Y,clickTolerance:rt}){const nt=new sn({checkCorrectEvent:Q=>xt.mouseButton(Q)===0&&!Q.ctrlKey});return new Us({clickTolerance:rt,move:(Q,lt)=>({around:lt,panDelta:lt.sub(Q)}),activateOnStart:!0,moveStateManager:nt,enable:Y,assignEvents:Gs})})(e),$=new fu(e,n);n.dragPan=new Nl(o,j,$),this._add("mousePan",j),this._add("touchPan",$,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);const Z=new Fl,H=new mu;n.touchZoomRotate=new xu(o,H,Z,x),this._add("touchRotate",Z,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new wh(n));const K=n.scrollZoom=new Pa(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);const it=n.keyboard=new _u(n);this._add("keyboard",it),e.interactive&&e.keyboard&&n.keyboard.enable()}_add(e,n,o){this._handlers.push({handlerName:e,handler:n,allowed:o}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ls(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,o){for(const u in e)if(u!==o&&(!n||n.indexOf(u)<0))return!0;return!1}_getMapTouches(e){const n=[];for(const o of e)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(e,n,o,u,p){if(!o)return;c.e(e,o);const m={handlerName:u,originalEvent:o.originalEvent||p};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.rollDelta!==void 0&&(n.roll=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const e={},n={},o={};for(const[u,p,m]of this._changes)u.panDelta&&(e.panDelta=(e.panDelta||new c.P(0,0))._add(u.panDelta)),u.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+u.pitchDelta),u.rollDelta&&(e.rollDelta=(e.rollDelta||0)+u.rollDelta),u.around!==void 0&&(e.around=u.around),u.pinchAround!==void 0&&(e.pinchAround=u.pinchAround),u.noInertia&&(e.noInertia=u.noInertia),c.e(n,p),c.e(o,m);this._updateMapTransform(e,n,o),this._changes=[]}_updateMapTransform(e,n,o){const u=this._map,p=u._getTransformForUpdate(),m=u.terrain;if(!(Wt(e)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);u._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:b,pitchDelta:T,rollDelta:k,around:A,pinchAround:z}=e;z!==void 0&&(A=z),A=A||u.transform.centerPoint,m&&!p.isPointOnMapSurface(A)&&(A=p.centerPoint);const j={panDelta:_,zoomDelta:x,rollDelta:k,pitchDelta:T,bearingDelta:b,around:A};this._map.cameraHelper.useGlobeControls&&!p.isPointOnMapSurface(A)&&(A=p.centerPoint);const $=A.distSqr(p.centerPoint)<.01?p.center:p.screenPointToLocation(_?A.sub(_):A);this._handleMapControls({terrain:m,tr:p,deltasForHelper:j,preZoomAroundLoc:$,combinedEventsInProgress:n,panDelta:_}),u._applyUpdatedTransform(p),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,o,!0)}_handleMapControls({terrain:e,tr:n,deltasForHelper:o,preZoomAroundLoc:u,combinedEventsInProgress:p,panDelta:m}){const _=this._map.cameraHelper;if(_.handleMapControlsRollPitchBearingZoom(o,n),e)return _.useGlobeControls?(this._terrainMovement||!p.drag&&!p.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void _.handleMapControlsPan(o,n,u)):this._terrainMovement||!p.drag&&!p.zoom?void(p.drag&&this._terrainMovement&&m?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(m))):_.handleMapControlsPan(o,n,u)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void _.handleMapControlsPan(o,n,u));_.handleMapControlsPan(o,n,u)}_fireEvents(e,n,o){const u=ls(this._eventsInProgress),p=ls(e),m={};for(const k in e){const{originalEvent:A}=e[k];this._eventsInProgress[k]||(m[`${k}start`]=A),this._eventsInProgress[k]=e[k]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const k in m)this._fireEvent(k,m[k]);p&&this._fireEvent("move",p.originalEvent);for(const k in e){const{originalEvent:A}=e[k];this._fireEvent(k,A)}const _={};let x;for(const k in this._eventsInProgress){const{handlerName:A,originalEvent:z}=this._eventsInProgress[k];this._handlersById[A].isActive()||(delete this._eventsInProgress[k],x=n[A]||z,_[`${k}end`]=x)}for(const k in _)this._fireEvent(k,_[k]);const b=ls(this._eventsInProgress),T=(u||p)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const k=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&k.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(k)}if(o&&T){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;!k||!k.essential&&ce.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:x})),A(this._map.getBearing())&&this._map.resetNorth()):(A(k.bearing||this._map.getBearing())&&(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new c.l(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Vt("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class vu extends c.E{constructor(e,n,o){super(),this._renderFrameCallback=()=>{const u=Math.min((qt()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=o.bearingSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,n){e.apply(this.transform),this.transform=e,this.cameraHelper=n}getCenter(){return new c.V(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,n){return this.jumpTo({elevation:e},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,n,o){return e=c.P.convert(e).mult(-1),this.panTo(this.transform.center,c.e({offset:e},n),o)}panTo(e,n,o){return this.easeTo(c.e({center:e},n),o)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,o){return this.easeTo(c.e({zoom:e},n),o)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,n){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)).fire(new c.l("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,o){return this.easeTo(c.e({bearing:e},n),o)}resetNorth(e,n){return this.rotateTo(0,c.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(c.e({bearing:0,pitch:0,roll:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}getRoll(){return this.transform.roll}setRoll(e,n){return this.jumpTo({roll:e},n),this}cameraForBounds(e,n){e=Le.convert(e).adjustAntiMeridian();const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),o,n)}_cameraForBoxAndBearing(e,n,o,u){const p={top:0,bottom:0,right:0,left:0};if(typeof(u=c.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const b=u.padding;u.padding={top:b,bottom:b,right:b,left:b}}const m=c.e(p,u.padding);u.padding=m;const _=this.transform,x=new Le(e,n);return this.cameraHelper.cameraForBoxAndBearing(u,m,x,o,_)}fitBounds(e,n,o){return this._fitInternal(this.cameraForBounds(e,n),n,o)}fitScreenCoordinates(e,n,o,u,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(c.P.convert(e)),this.transform.screenPointToLocation(c.P.convert(n)),o,u),u,p)}_fitInternal(e,n,o){return e?(delete(n=c.e(e,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(e,n){this.stop();const o=this._getTransformForUpdate();let u=!1,p=!1,m=!1;const _=o.zoom;this.cameraHelper.handleJumpToCenterZoom(o,e);const x=o.zoom!==_;return"elevation"in e&&o.elevation!==+e.elevation&&o.setElevation(+e.elevation),"bearing"in e&&o.bearing!==+e.bearing&&(u=!0,o.setBearing(+e.bearing)),"pitch"in e&&o.pitch!==+e.pitch&&(p=!0,o.setPitch(+e.pitch)),"roll"in e&&o.roll!==+e.roll&&(m=!0,o.setRoll(+e.roll)),e.padding==null||o.isPaddingEqual(e.padding)||o.setPadding(e.padding),this._applyUpdatedTransform(o),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)),x&&this.fire(new c.l("zoomstart",n)).fire(new c.l("zoom",n)).fire(new c.l("zoomend",n)),u&&this.fire(new c.l("rotatestart",n)).fire(new c.l("rotate",n)).fire(new c.l("rotateend",n)),p&&this.fire(new c.l("pitchstart",n)).fire(new c.l("pitch",n)).fire(new c.l("pitchend",n)),m&&this.fire(new c.l("rollstart",n)).fire(new c.l("roll",n)).fire(new c.l("rollend",n)),this.fire(new c.l("moveend",n))}calculateCameraOptionsFromTo(e,n,o,u=0){const p=c.aa.fromLngLat(e,n),m=c.aa.fromLngLat(o,u),_=m.x-p.x,x=m.y-p.y,b=m.z-p.z,T=Math.hypot(_,x,b);if(T===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(_,x),A=c.at(this.transform.cameraToCenterDistance/T/this.transform.tileSize),z=180*Math.atan2(_,-x)/Math.PI;let j=180*Math.acos(k/T)/Math.PI;return j=b<0?90-j:90+j,{center:m.toLngLat(),elevation:u,zoom:A,pitch:j,bearing:z}}calculateCameraOptionsFromCameraLngLatAltRotation(e,n,o,u,p){const m=this.transform.calculateCenterFromCameraLngLatAlt(e,n,o,u);return{center:m.center,elevation:m.elevation,zoom:m.zoom,bearing:o,pitch:u,roll:p}}easeTo(e,n){this._stop(!1,e.easeId),((e=c.e({offset:[0,0],duration:500,easing:c.cx},e)).animate===!1||!e.essential&&ce.prefersReducedMotion)&&(e.duration=0);const o=this._getTransformForUpdate(),u=this.getBearing(),p=o.pitch,m=o.roll,_="bearing"in e?this._normalizeBearing(e.bearing,u):u,x="pitch"in e?+e.pitch:p,b="roll"in e?this._normalizeBearing(e.roll,m):m,T="padding"in e?e.padding:o.padding,k=c.P.convert(e.offset);let A,z;e.around&&(A=c.V.convert(e.around),z=o.locationToScreenPoint(A));const j={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},$=this.cameraHelper.handleEaseTo(o,{bearing:_,pitch:x,roll:b,padding:T,around:A,aroundPoint:z,offsetAsPoint:k,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||u!==_,this._pitching=this._pitching||x!==p,this._rolling=this._rolling||b!==m,this._padding=!o.isPaddingEqual(T),this._zooming=this._zooming||$.isZooming,this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,j),this.terrain&&this._prepareElevation($.elevationCenter),this._ease((Z=>{$.easeFunc(Z),this.terrain&&!e.freezeElevation&&this._updateElevation(Z),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(Z=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,Z)}),e),this}_prepareEase(e,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.l("movestart",e)),this._zooming&&!o.zooming&&this.fire(new c.l("zoomstart",e)),this._rotating&&!o.rotating&&this.fire(new c.l("rotatestart",e)),this._pitching&&!o.pitching&&this.fire(new c.l("pitchstart",e)),this._rolling&&!o.rolling&&this.fire(new c.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){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(e<1&&n!==this._elevationTarget){const o=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(o-(n-(o*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.setElevation(c.G.number(this._elevationStart,this._elevationTarget,e))}_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(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const n=e.getCameraLngLat(),o=e.getCameraAltitude(),u=this.terrain?this.terrain.getElevationForLngLatZoom(n,e.zoom):0;if(o<u){const p=this.calculateCameraOptionsFromTo(n,u,e.center,e.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(e){const n=[];if(n.push((u=>this._elevateCameraIfInsideTerrain(u))),this.transformCameraUpdate&&n.push((u=>this.transformCameraUpdate(u))),!n.length)return;const o=e.clone();for(const u of n){const p=o.clone(),{center:m,zoom:_,roll:x,pitch:b,bearing:T,elevation:k}=u(p);m&&p.setCenter(m),k!==void 0&&p.setElevation(k),_!==void 0&&p.setZoom(_),x!==void 0&&p.setRoll(x),b!==void 0&&p.setPitch(b),T!==void 0&&p.setBearing(T),o.apply(p)}this.transform.apply(o)}_fireMoveEvents(e){this.fire(new c.l("move",e)),this._zooming&&this.fire(new c.l("zoom",e)),this._rotating&&this.fire(new c.l("rotate",e)),this._pitching&&this.fire(new c.l("pitch",e)),this._rolling&&this.fire(new c.l("roll",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,u=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,o&&this.fire(new c.l("zoomend",e)),u&&this.fire(new c.l("rotateend",e)),p&&this.fire(new c.l("pitchend",e)),m&&this.fire(new c.l("rollend",e)),this.fire(new c.l("moveend",e))}flyTo(e,n){if(!e.essential&&ce.prefersReducedMotion){const gt=c.U(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(gt,n)}this.stop(),e=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.cx},e);const o=this._getTransformForUpdate(),u=o.bearing,p=o.pitch,m=o.roll,_=o.padding,x="bearing"in e?this._normalizeBearing(e.bearing,u):u,b="pitch"in e?+e.pitch:p,T="roll"in e?this._normalizeBearing(e.roll,m):m,k="padding"in e?e.padding:o.padding,A=c.P.convert(e.offset);let z=o.centerPoint.add(A);const j=o.screenPointToLocation(z),$=this.cameraHelper.handleFlyTo(o,{bearing:x,pitch:b,roll:T,padding:k,locationAtOffset:j,offsetAsPoint:A,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let Z=e.curve;const H=Math.max(o.width,o.height),K=H/$.scaleOfZoom,it=$.pixelPathLength;typeof $.scaleOfMinZoom=="number"&&(Z=Math.sqrt(H/$.scaleOfMinZoom/it*2));const Y=Z*Z;function rt(gt){const Dt=(K*K-H*H+(gt?-1:1)*Y*Y*it*it)/(2*(gt?K:H)*Y*it);return Math.log(Math.sqrt(Dt*Dt+1)-Dt)}function nt(gt){return(Math.exp(gt)-Math.exp(-gt))/2}function Q(gt){return(Math.exp(gt)+Math.exp(-gt))/2}const lt=rt(!1);let _t=function(gt){return Q(lt)/Q(lt+Z*gt)},pt=function(gt){return H*((Q(lt)*(nt(Dt=lt+Z*gt)/Q(Dt))-nt(lt))/Y)/it;var Dt},ft=(rt(!0)-lt)/Z;if(Math.abs(it)<2e-6||!isFinite(ft)){if(Math.abs(H-K)<1e-6)return this.easeTo(e,n);const gt=K<H?-1:1;ft=Math.abs(Math.log(K/H))/Z,pt=()=>0,_t=Dt=>Math.exp(gt*Z*Dt)}return e.duration="duration"in e?+e.duration:1e3*ft/("screenSpeed"in e?+e.screenSpeed/Z:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=u!==x,this._pitching=b!==p,this._rolling=T!==m,this._padding=!o.isPaddingEqual(k),this._prepareEase(n,!1),this.terrain&&this._prepareElevation($.targetCenter),this._ease((gt=>{const Dt=gt*ft,Et=1/_t(Dt),St=pt(Dt);this._rotating&&o.setBearing(c.G.number(u,x,gt)),this._pitching&&o.setPitch(c.G.number(p,b,gt)),this._rolling&&o.setRoll(c.G.number(m,T,gt)),this._padding&&(o.interpolatePadding(_,k,gt),z=o.centerPoint.add(A)),$.easeFunc(gt,Et,St,z),this.terrain&&!e.freezeElevation&&this._updateElevation(gt),this._applyUpdatedTransform(o),this._fireMoveEvents(n)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const u=this._onEaseEnd;delete this._onEaseEnd,u.call(this,n)}return e||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(e,n,o){o.animate===!1||o.duration===0?(e(1),n()):(this._easeStart=qt(),this._easeOptions=o,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=c.W(e,-180,180);const o=Math.abs(e-n);return Math.abs(e-360-n)<o&&(e-=360),Math.abs(e+360-n)<o&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(c.V.convert(e),this.transform.tileZoom):null}}const Ea={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Mi{constructor(e=Ea){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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=xt.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=xt.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=xt.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(){xt.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(e,n){const o=this._map._getUIString(`AttributionControl.${n}`);e.title=o,e.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((u=>typeof u!="string"?"":u))):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.tileManagers;for(const u in n){const p=n[u];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter((u=>String(u).trim())),e.sort(((u,p)=>u.length-p.length)),e=e.filter(((u,p)=>{for(let m=p+1;m<e.length;m++)if(e[m].indexOf(u)>=0)return!1;return!0}));const o=e.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,e.length?(this._innerContainer.innerHTML=xt.sanitize(o),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class cr{constructor(e={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=xt.create("div","maplibregl-ctrl");const n=xt.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(){xt.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class bu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){const n=this._currentlyRunning,o=n?this._queue.concat(n):this._queue;for(const u of o)if(u.id===e)return void(u.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const o of n)if(!o.cancelled&&(o.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Mh=c.aT([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends c.E{constructor(e){super(),this._lastTilesetChange=qt(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,n){this.tileManager.update(e,n),this._renderableTilesKeys=[];const o={};for(const u of te(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))o[u.key]=!0,this._renderableTilesKeys.push(u.key),this._tiles[u.key]||(u.terrainRttPosMatrix32f=new Float64Array(16),c.c6(u.terrainRttPosMatrix32f,0,c.a4,c.a4,0,0,1),this._tiles[u.key]=new F(u,this.tileSize),this._lastTilesetChange=qt());for(const u in this._tiles)o[u]||delete this._tiles[u]}freeRtt(e){for(const n in this._tiles){const o=this._tiles[n];(!e||o.tileID.equals(e)||o.tileID.isChildOf(e)||e.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,n){return n?this._getTerrainCoordsForTileRanges(e,n):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const n={};for(const o of this._renderableTilesKeys){const u=this._tiles[o].tileID,p=e.clone(),m=c.bj();if(u.canonical.equals(e.canonical))c.c6(m,0,c.a4,c.a4,0,0,1);else if(u.canonical.isChildOf(e.canonical)){const _=u.canonical.z-e.canonical.z,x=u.canonical.x-(u.canonical.x>>_<<_),b=u.canonical.y-(u.canonical.y>>_<<_),T=c.a4>>_;c.c6(m,0,T,T,0,0,1),c.O(m,m,[-x*T,-b*T,0])}else{if(!e.canonical.isChildOf(u.canonical))continue;{const _=e.canonical.z-u.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),b=e.canonical.y-(e.canonical.y>>_<<_),T=c.a4>>_;c.c6(m,0,c.a4,c.a4,0,0,1),c.O(m,m,[x*T,b*T,0]),c.Q(m,m,[1/2**_,1/2**_,0])}}p.terrainRttPosMatrix32f=new Float32Array(m),n[o]=p}return n}_getTerrainCoordsForTileRanges(e,n){const o={};for(const u of this._renderableTilesKeys){const p=this._tiles[u].tileID;if(!this._isWithinTileRanges(p,n))continue;const m=e.clone(),_=c.bj();if(p.canonical.z===e.canonical.z){const x=e.canonical.x-p.canonical.x,b=e.canonical.y-p.canonical.y;c.c6(_,0,c.a4,c.a4,0,0,1),c.O(_,_,[x*c.a4,b*c.a4,0])}else if(p.canonical.z>e.canonical.z){const x=p.canonical.z-e.canonical.z,b=p.canonical.x-(p.canonical.x>>x<<x),T=p.canonical.y-(p.canonical.y>>x<<x),k=e.canonical.x-(p.canonical.x>>x),A=e.canonical.y-(p.canonical.y>>x),z=c.a4>>x;c.c6(_,0,z,z,0,0,1),c.O(_,_,[-b*z+k*c.a4,-T*z+A*c.a4,0])}else{const x=e.canonical.z-p.canonical.z,b=e.canonical.x-(e.canonical.x>>x<<x),T=e.canonical.y-(e.canonical.y>>x<<x),k=(e.canonical.x>>x)-p.canonical.x,A=(e.canonical.y>>x)-p.canonical.y,z=c.a4<<x;c.c6(_,0,z,z,0,0,1),c.O(_,_,[b*c.a4+k*z,T*c.a4+A*z,0])}m.terrainRttPosMatrix32f=new Float32Array(_),o[u]=m}return o}getSourceTile(e,n){const o=this.tileManager._source;let u=e.overscaledZ-this.deltaZoom;if(u>o.maxzoom&&(u=o.maxzoom),u<o.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(u).key);let p=this.tileManager.getTileByID(this._sourceTileCache[e.key]);if((!p||!p.dem)&&n)for(;u>=o.minzoom&&(!p||!p.dem);)p=this.tileManager.getTileByID(e.scaledTo(u--).key);return p}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,n){return n[e.canonical.z]&&e.canonical.x>=n[e.canonical.z].minTileX&&e.canonical.x<=n[e.canonical.z].maxTileX&&e.canonical.y>=n[e.canonical.z].minTileY&&e.canonical.y<=n[e.canonical.z].maxTileY}}class Eh{constructor(e,n,o){this._meshCache={},this.painter=e,this.tileManager=new Ih(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,o,u=c.a4){var p;if(!(n>=0&&n<u&&o>=0&&o<u))return 0;const m=this.getTerrainData(e),_=(p=m.tile)===null||p===void 0?void 0:p.dem;if(!_)return 0;const x=c.cB([],[n/u*c.a4,o/u*c.a4],m.u_terrain_matrix),b=[x[0]*_.dim,x[1]*_.dim],T=Math.floor(b[0]),k=Math.floor(b[1]),A=b[0]-T,z=b[1]-k;return _.get(T,k)*(1-A)*(1-z)+_.get(T+1,k)*A*(1-z)+_.get(T,k+1)*(1-A)*z+_.get(T+1,k+1)*A*z}getElevationForLngLatZoom(e,n){if(!c.cC(n,e.wrap()))return 0;const{tileID:o,mercatorX:u,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(o,u%c.a4,p%c.a4,c.a4)}getElevation(e,n,o,u=c.a4){return this.getDEMElevation(e,n,o,u)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const u=this.painter.context,p=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new c.T(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new c.T(u,new c.R({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ar([])}const n=this.tileManager.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new c.T(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+e.key;if(o&&!this._demMatrixCache[o]){const u=this.tileManager.getSource().maxzoom;let p=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=u?p=e.canonical.z-u:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=e.canonical.x-(e.canonical.x>>p<<p),_=e.canonical.y-(e.canonical.y>>p<<p),x=c.cD(new Float64Array(16),[1/(c.a4<<p),1/(c.a4<<p),0]);c.O(x,x,[m*c.a4,_*c.a4,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[e.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(e){const n=this.painter,o=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new c.T(n.context,{width:o,height:u,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 c.T(n.context,{width:o,height:u,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(o,u,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,u))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=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 o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new c.T(e,o,e.gl.RGBA,{premultiply:!1});return u.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,u=o.gl,p=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),u.readPixels(p,_-m-1,1,1,u.RGBA,u.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const x=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],k=T&&this.tileManager.getTileByID(T);if(!k)return null;const A=this._coordsTextureSize,z=(1<<k.tileID.canonical.z)*A;return new c.aa((k.tileID.canonical.x*A+x)/z+k.tileID.wrap,(k.tileID.canonical.y*A+b)/z,this.getElevation(k.tileID,x,b,A))}depthAtPoint(e){const n=new Uint8Array(4),o=this.painter.context,u=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),u.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,u.RGBA,u.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(e){var n;const o=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,u=o&&e.canonical.y===0,p=o&&e.canonical.y===(1<<e.canonical.z)-1,m=`m_${u?"n":""}_${p?"s":""}`;if(this._meshCache[m])return this._meshCache[m];const _=this.painter.context,x=new c.cE,b=new c.aX,T=this.meshSize,k=c.a4/T,A=T*T;for(let Q=0;Q<=T;Q++)for(let lt=0;lt<=T;lt++)x.emplaceBack(lt*k,Q*k,0);for(let Q=0;Q<A;Q+=T+1)for(let lt=0;lt<T;lt++)b.emplaceBack(lt+Q,T+lt+Q+1,T+lt+Q+2),b.emplaceBack(lt+Q,T+lt+Q+2,lt+Q+1);const z=x.length,j=z+(T+1),$=(T+1)*T,Z=u?c.bq:0,H=u?0:1,K=p?c.br:c.a4,it=p?0:1;for(let Q=0;Q<=T;Q++)x.emplaceBack(Q*k,Z,H);for(let Q=0;Q<=T;Q++)x.emplaceBack(Q*k,K,it);for(let Q=0;Q<T;Q++)b.emplaceBack($+Q,j+Q,j+Q+1),b.emplaceBack($+Q,j+Q+1,$+Q+1),b.emplaceBack(0+Q,z+Q+1,z+Q),b.emplaceBack(0+Q,0+Q+1,z+Q+1);const Y=x.length,rt=Y+2*(T+1);for(const Q of[0,1])for(let lt=0;lt<=T;lt++)for(const _t of[0,1])x.emplaceBack(Q*c.a4,lt*k,_t);for(let Q=0;Q<2*T;Q+=2)b.emplaceBack(Y+Q,Y+Q+1,Y+Q+3),b.emplaceBack(Y+Q,Y+Q+3,Y+Q+2),b.emplaceBack(rt+Q,rt+Q+3,rt+Q+1),b.emplaceBack(rt+Q,rt+Q+2,rt+Q+3);const nt=new In(_.createVertexBuffer(x,Mh.members),_.createIndexBuffer(b),c.aW.simpleSegment(0,0,x.length,b.length));return this._meshCache[m]=nt,nt}getMeshFrameDelta(e){return 2*Math.PI*c.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,n){var o;const{tileID:u}=this._getOverscaledTileIDFromLngLatZoom(e,n);return(o=this.getMinMaxElevation(u).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(e){const n=this.getTerrainData(e).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(e,n){const o=c.aa.fromLngLat(e.wrap()),u=(1<<n)*c.a4,p=o.x*u,m=o.y*u,_=Math.floor(p/c.a4),x=Math.floor(m/c.a4);return{tileID:new c.a1(n,0,n,_,x),mercatorX:p,mercatorY:m}}}class Ca{constructor(e,n,o){this._context=e,this._size=n,this._tileSize=o,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new c.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.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(o.texture),{id:e,fbo:n,texture:o,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>e.id!==n)),this._recentlyUsed.push(e.id)}stampObject(e){e.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 e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((e=>!e.inUse))===!1}}const _e={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class qe{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new Ca(e.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter((o=>!e._layers[o].isHidden(n))),this._coordsAscending={};for(const o in e.tileManagers){this._coordsAscending[o]={};const u=e.tileManagers[o].getVisibleCoordinates(),p=e.tileManagers[o].getSource(),m=p instanceof Gi?p.terrainTileRanges:null;for(const _ of u){const x=this.terrain.tileManager.getTerrainCoords(_,m);for(const b in x)this._coordsAscending[o][b]||(this._coordsAscending[o][b]=[]),this._coordsAscending[o][b].push(x[b])}}this._coordsAscendingStr={};for(const o of e._order){const u=e._layers[o],p=u.source;if(_e[u.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 o of this._renderableTiles)for(const u in this._coordsAscendingStr){const p=this._coordsAscendingStr[u][o.tileID.key];p&&p!==o.rttCoords[u]&&(o.rtt=[])}}renderLayer(e,n){if(e.isHidden(this.painter.transform.zoom))return!1;const o=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),u=e.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(_e[u]&&(this._prevType&&_e[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(e.id),!m))return!0;if(_e[this._prevType]||_e[u]&&m){this._prevType=u;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const b of this._renderableTiles){if(this.pool.isFull()&&(kn(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(b),b.rtt[_]){const k=this.pool.getObjectForId(b.rtt[_].id);if(k.stamp===b.rtt[_].stamp){this.pool.useObject(k);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:c.bo.transparent,stencil:0}),p.currentStencilSource=void 0;for(let k=0;k<x.length;k++){const A=p.style._layers[x[k]],z=A.source?this._coordsAscending[A.source][b.tileID.key]:[b.tileID];p.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),p._renderTileClippingMasks(A,z,!0),p.renderLayer(p,p.style.tileManagers[A.source],A,z,o),A.source&&(b.rttCoords[A.source]=this._coordsAscendingStr[A.source][b.tileID.key])}}return kn(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects(),_e[u]}return!1}}const wu={"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"},Aa=dt,ka={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ea,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:c.a.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},Ul={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Gl{constructor(e,n,o=!1){this.mousedown=p=>{this.startMove(p,xt.mousePos(this.element,p)),xt.addEventListener(window,"mousemove",this.mousemove),xt.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=p=>{this.move(p,xt.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=xt.touchPos(this.element,p.targetTouches)[0],this.startMove(p,this._startPos),xt.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),xt.addEventListener(window,"touchend",this.touchend))},this.touchmove=p=>{p.targetTouches.length!==1?this.reset():(this._lastPos=xt.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 u=new Th;this._rotatePitchHandler=new Us({clickTolerance:3,move:(p,m)=>{const _=n.getBoundingClientRect(),x=new c.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:c.cw(new c.P(p.x,m.y),m,x),pitchDelta:o?-.5*(m.y-p.y):void 0}},moveStateManager:u,enable:!0,assignEvents:()=>{}}),this.map=e,xt.addEventListener(n,"mousedown",this.mousedown),xt.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),xt.addEventListener(n,"touchcancel",this.reset)}startMove(e,n){this._rotatePitchHandler.dragStart(e,n),xt.disableDrag()}move(e,n){const o=this.map,{bearingDelta:u,pitchDelta:p}=this._rotatePitchHandler.dragMove(e,n)||{};u&&o.setBearing(o.getBearing()+u),p&&o.setPitch(o.getPitch()+p)}off(){const e=this.element;xt.removeEventListener(e,"mousedown",this.mousedown),xt.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),xt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),xt.removeEventListener(window,"touchend",this.touchend),xt.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){xt.enableDrag(),xt.removeEventListener(window,"mousemove",this.mousemove),xt.removeEventListener(window,"mouseup",this.mouseup),xt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),xt.removeEventListener(window,"touchend",this.touchend)}}let an;function $s(d,e,n,o=!1){if(o||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return d?.wrap();const u=new c.V(d.lng,d.lat);if(d=new c.V(d.lng,d.lat),e){const p=new c.V(d.lng-360,d.lat),m=new c.V(d.lng+360,d.lat),_=n.locationToScreenPoint(d).distSqr(e);n.locationToScreenPoint(p).distSqr(e)<_?d=p:n.locationToScreenPoint(m).distSqr(e)<_&&(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!==u.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(d))?d:u}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 To(d,e,n){const o=d.classList;for(const u in Da)o.remove(`maplibregl-${n}-anchor-${u}`);o.add(`maplibregl-${n}-anchor-${e}`)}class za extends c.E{constructor(e){if(super(),this._onKeyPress=n=>{const o=n.code,u=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=$s(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 u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`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()),xt.setTransform(this._element,`${Da[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${u}`),ce.frameAsync(new AbortController).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}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 c.l("dragstart"))),this.fire(new c.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 c.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=c.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=xt.create("div");const n=xt.createNS("http://www.w3.org/2000/svg","svg"),o=41,u=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${u}px`),n.setAttributeNS(null,"viewBox",`0 0 ${u} ${o}`);const p=xt.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=xt.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=xt.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 H of x){const K=xt.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",H.rx),K.setAttributeNS(null,"ry",H.ry),_.appendChild(K)}const b=xt.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const T=xt.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 k=xt.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const A=xt.createNS("http://www.w3.org/2000/svg","path");A.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"),k.appendChild(A);const z=xt.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),z.setAttributeNS(null,"fill","#FFFFFF");const j=xt.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=xt.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");const Z=xt.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#FFFFFF"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962"),j.appendChild($),j.appendChild(Z),m.appendChild(_),m.appendChild(b),m.appendChild(k),m.appendChild(z),m.appendChild(j),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",u*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),To(this._element,this._anchor,"marker"),e&&e.className)for(const n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.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),xt.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=c.V.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const u=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,o;const u=(n=this._map)===null||n===void 0?void 0:n.terrain,p=this._map.transform.isLocationOccluded(this._lngLat);if(!u||p){const z=p?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==z&&(this._element.style.opacity=z))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),x=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,x)-_<.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,k=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),A=m.transform.lngLatToCameraDepth(this._lngLat,x+T)-k>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&A&&this._popup.remove(),this._element.style.opacity=A?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=c.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return(this._opacity===void 0||e===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const $l={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Zs=0,cs=!1;const Zl={maxWidth:100,unit:"metric"};function So(d,e,n){const o=n&&n.maxWidth||100,u=d._container.clientHeight/2,p=d._container.clientWidth/2,m=d.unproject([p-o/2,u]),_=d.unproject([p+o/2,u]),x=Math.round(d.project(_).x-d.project(m).x),b=Math.min(o,x,d._container.clientWidth),T=m.distanceTo(_);if(n&&n.unit==="imperial"){const k=3.2808*T;k>5280?us(e,b,k/5280,d._getUIString("ScaleControl.Miles")):us(e,b,k,d._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?us(e,b,T/1852,d._getUIString("ScaleControl.NauticalMiles")):T>=1e3?us(e,b,T/1e3,d._getUIString("ScaleControl.Kilometers")):us(e,b,T,d._getUIString("ScaleControl.Meters"))}function us(d,e,n,o){const u=(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(x){const b=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*b)/b})(_),m*_})(n);d.style.width=e*(u/n)+"px",d.innerHTML=`${u} ${o}`}const Po={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},ql=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Mo(d){if(d){if(typeof d=="number"){const e=Math.round(Math.abs(d)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,d),"top-left":new c.P(e,e),"top-right":new c.P(-e,e),bottom:new c.P(0,-d),"bottom-left":new c.P(e,-e),"bottom-right":new c.P(-e,-e),left:new c.P(d,0),right:new c.P(-d,0)}}if(d instanceof c.P||Array.isArray(d)){const e=c.P.convert(d);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:c.P.convert(d.center||[0,0]),top:c.P.convert(d.top||[0,0]),"top-left":c.P.convert(d["top-left"]||[0,0]),"top-right":c.P.convert(d["top-right"]||[0,0]),bottom:c.P.convert(d.bottom||[0,0]),"bottom-left":c.P.convert(d["bottom-left"]||[0,0]),"bottom-right":c.P.convert(d["bottom-right"]||[0,0]),left:c.P.convert(d.left||[0,0]),right:c.P.convert(d.right||[0,0])}}return Mo(new c.P(0,0))}const Io=dt;M.AJAXError=c.cI,M.Event=c.l,M.Evented=c.E,M.LngLat=c.V,M.MercatorCoordinate=c.aa,M.Point=c.P,M.addProtocol=c.cJ,M.config=c.a,M.removeProtocol=c.cK,M.AttributionControl=Mi,M.BoxZoomHandler=du,M.CanvasSource=ta,M.CooperativeGesturesHandler=Mr,M.DoubleClickZoomHandler=Ma,M.DragPanHandler=Nl,M.DragRotateHandler=Vl,M.EdgeInsets=Pe,M.FullscreenControl=class extends c.E{constructor(d={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.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:c.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=xt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){xt.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=xt.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);xt.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 c.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.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=Wn,M.GeolocateControl=class extends c.E{constructor(d){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new c.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const n=new c.V(e.coords.longitude,e.coords.latitude),o=e.coords.accuracy,u=this._map.getBearing(),p=c.e({bearing:u},this.options.fitBoundsOptions),m=Le.fromLngLat(n,o);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const n=new c.V(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(e.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(e.code===3&&cs)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=xt.create("button","maplibregl-ctrl-geolocate",this._container),xt.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){c.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=xt.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new za({element:this._dotElement}),this._circleElement=xt.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new za({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 o=n?.[0]instanceof ResizeObserverEntry;n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o||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 c.l("trackuserlocationend")),this.fire(new c.l("userlocationlostfocus")))}))}},this.options=c.e({},$l,d)}onAdd(d){return this._map=d,this._container=xt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return c._(this,arguments,void 0,(function*(e=!1){if(an!==void 0&&!e)return an;if(window.navigator.permissions===void 0)return an=!!window.navigator.geolocation,an;try{an=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{an=!!window.navigator.geolocation}return an}))})().then((e=>this._finishSetupUI(e))),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(),xt.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,Zs=0,cs=!1}_isOutOfMapMaxBounds(d){const e=this._map.getMaxBounds(),n=d.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.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 e=this._map.project(d),n=this._map.unproject([e.x+100,e.y]),o=d.distanceTo(n)/100,u=2*this._accuracy/o;this._circleElement.style.width=`${u.toFixed(2)}px`,this._circleElement.style.height=`${u.toFixed(2)}px`}trigger(){if(!this._setup)return c.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 c.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Zs--,cs=!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 c.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 c.l("trackuserlocationstart")),this.fire(new c.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"),Zs++,Zs>1?(d={maximumAge:6e5,timeout:0},cs=!0):(d=this.options.positionOptions,cs=!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 e=(d=this._map.getProjection())===null||d===void 0?void 0:d.type;this._map.setProjection(e!=="mercator"&&e?{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=xt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=xt.create("button","maplibregl-ctrl-globe",this._container),xt.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(){xt.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},M.Hash=Dl,M.ImageSource=Gi,M.KeyboardHandler=_u,M.LngLatBounds=Le,M.LogoControl=cr,M.Map=class extends vu{constructor(d){var e,n;c.cF.mark(c.cG.create);const o=Object.assign(Object.assign(Object.assign({},ka),d),{canvasContextAttributes:Object.assign(Object.assign({},ka.canvasContextAttributes),d.canvasContextAttributes)});if(o.minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const u=new Ce,p=new qi;if(o.minZoom!==void 0&&u.setMinZoom(o.minZoom),o.maxZoom!==void 0&&u.setMaxZoom(o.maxZoom),o.minPitch!==void 0&&u.setMinPitch(o.minPitch),o.maxPitch!==void 0&&u.setMaxPitch(o.maxPitch),o.renderWorldCopies!==void 0&&u.setRenderWorldCopies(o.renderWorldCopies),o.transformConstrain!==null&&u.setConstrainOverride(o.transformConstrain),super(u,p,{bearingSnap:o.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new bu,this._controls=[],this._mapId=c.ag(),this._lostContextStyle={style:null,images:null},this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const x of Object.values(this.style._layers))if(x.type==="custom"&&console.warn(`Custom layer with id '${x.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),x._listeners)for(const[b]of Object.entries(x._listeners))console.warn(`Custom layer with id '${x.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 c.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._setupPainter(),this.resize(),this._update(),this.fire(new c.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=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},o.canvasContextAttributes),this._trackResize=o.trackResize===!0,this._bearingSnap=o.bearingSnap,this._centerClampedToGround=o.centerClampedToGround,this._refreshExpiredTiles=o.refreshExpiredTiles===!0,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions===!0,this._collectResourceTiming=o.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},wu),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this._zoomLevelsToOverscale=o.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=o.transformCameraUpdate,this.transformConstrain=o.transformConstrain,this.cancelPendingTileRequestsWhileZooming=o.cancelPendingTileRequestsWhileZooming===!0,o.reduceMotion!==void 0&&(ce.prefersReducedMotion=o.reduceMotion),this._imageQueueHandle=_i.addThrottleControl((()=>this.isMoving())),this._requestManager=new $n(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.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 x=kl((b=>{this._trackResize&&!this._removed&&(this.resize(b),this.redraw())}),50);this._resizeObserver=new ResizeObserver((b=>{_?x(b):_=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Ia(this,o),this._hash=o.hash&&new Dl(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,roll:o.roll}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,c.e({},o.fitBoundsOptions,{duration:0}))));const m=typeof o.style=="string"||((n=(e=o.style)===null||e===void 0?void 0:e.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,m),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new Mi(typeof o.attributionControl=="boolean"?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new cr,o.logoPosition),this.on("style.load",(()=>{if(m||this._resizeTransform(),this.transform.unmodified){const _=c.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}})),this.on("data",(_=>{this._update(_.dataType==="style"),this.fire(new c.l(`${_.dataType}data`,_))})),this.on("dataloading",(_=>{this.fire(new c.l(`${_.dataType}dataloading`,_))})),this.on("dataabort",(_=>{this.fire(new c.l("sourcedataabort",_))}))}_getMapId(){return this._mapId}setGlobalStateProperty(d,e){return this.style.setGlobalStateProperty(d,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(d,e){if(e===void 0&&(e=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new c.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 o=this._controlPositions[e];return e.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new c.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(d);return e>-1&&this._controls.splice(e,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}coveringTiles(d){return te(this.transform,d)}calculateCameraOptionsFromTo(d,e,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(d,e,n,o)}resize(d,e=!0){const[n,o]=this._containerDimensions(),u=this._getClampedPixelRatio(n,o);if(this._resizeCanvas(n,o,u),this.painter.resize(n,o,u),this.painter.overLimit()){const m=this.painter.context.gl;this._maxCanvasSize=[m.drawingBufferWidth,m.drawingBufferHeight];const _=this._getClampedPixelRatio(n,o);this._resizeCanvas(n,o,_),this.painter.resize(n,o,_)}this._resizeTransform(e);const p=!this._moving;return p&&(this.stop(),this.fire(new c.l("movestart",d)).fire(new c.l("move",d))),this.fire(new c.l("resize",d)),p&&this.fire(new c.l("moveend",d)),this}_resizeTransform(d=!0){var e;const[n,o]=this._containerDimensions();this.transform.resize(n,o,d),(e=this._requestedCameraState)===null||e===void 0||e.resize(n,o,d)}_getClampedPixelRatio(d,e){const{0:n,1:o}=this._maxCanvasSize,u=this.getPixelRatio(),p=d*u,m=e*u;return Math.min(p>n?n/p:1,m>o?o/m:1)*u}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(Le.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom)return this.transform.setMinZoom(d),this._update(),this.getZoom()<d&&this.setZoom(d),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)return this.transform.setMaxZoom(d),this._update(),this.getZoom()>d&&this.setZoom(d),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(c.V.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.screenPointToLocation(c.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,e,n){if(d==="mouseenter"||d==="mouseover"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:p=>{const m=e.filter((x=>this.getLayer(x))),_=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];_.length?o||(o=!0,n.call(this,new Ue(d,this,p.originalEvent,{features:_}))):o=!1},mouseout:()=>{o=!1}}}}if(d==="mouseleave"||d==="mouseout"){let o=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{const _=e.filter((x=>this.getLayer(x)));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ue(d,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Ue(d,this,m.originalEvent)))}}}}{const o=u=>{const p=e.filter((_=>this.getLayer(_))),m=p.length!==0?this.queryRenderedFeatures(u.point,{layers:p}):[];m.length&&(u.features=m,n.call(this,u),delete u.features)};return{layers:e,listener:n,delegates:{[d]:o}}}}_saveDelegatedListener(d,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(e)}_removeDelegatedListener(d,e,n){if(!this._delegatedListeners||!this._delegatedListeners[d])return;const o=this._delegatedListeners[d];for(let u=0;u<o.length;u++){const p=o[u];if(p.listener===n&&p.layers.length===e.length&&p.layers.every((m=>e.includes(m)))){for(const m in p.delegates)this.off(m,p.delegates[m]);return void o.splice(u,1)}}}on(d,e,n){if(n===void 0)return super.on(d,e);const o=typeof e=="string"?[e]:e,u=this._createDelegatedListener(d,o,n);this._saveDelegatedListener(d,u);for(const p in u.delegates)this.on(p,u.delegates[p]);return{unsubscribe:()=>{this._removeDelegatedListener(d,o,n)}}}once(d,e,n){if(n===void 0)return super.once(d,e);const o=typeof e=="string"?[e]:e,u=this._createDelegatedListener(d,o,n);for(const p in u.delegates){const m=u.delegates[p];u.delegates[p]=(..._)=>{this._removeDelegatedListener(d,o,n),m(..._)}}this._saveDelegatedListener(d,u);for(const p in u.delegates)this.once(p,u.delegates[p]);return this}off(d,e,n){return n===void 0?super.off(d,e):(this._removeDelegatedListener(d,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(d,e){if(!this.style)return[];let n;const o=d instanceof c.P||Array.isArray(d),u=o?d:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(o?{}:d)||{},u instanceof c.P||typeof u[0]=="number")n=[c.P.convert(u)];else{const p=c.P.convert(u[0]),m=c.P.convert(u[1]);n=[p,new c.P(m.x,p.y),m,new c.P(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(d,e){return this.style.querySourceFeatures(d,e)}setStyle(d,e){return(e=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(d,e))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const e=this._locale[d];if(e==null)throw new Error(`Missing UI string '${d}'`);return e}_updateStyle(d,e){var n,o;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(d,e)));const u=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new aa(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,e,u):this.style.loadJSON(d,e,u),this):((o=(n=this.style)===null||n===void 0?void 0:n.projection)===null||o===void 0||o.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new aa(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,e){if(typeof d=="string"){const n=this._requestManager.transformRequest(d,"Style");c.j(n,new AbortController).then((o=>{this._updateDiff(o.data,e)})).catch((o=>{o&&this.fire(new c.k(o))}))}else typeof d=="object"&&this._updateDiff(d,e)}_updateDiff(d,e){try{this.style.setState(d,e)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(d,e)}}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():c.w("There is no style added to the map.")}addSource(d,e){return this._lazyInitEmptyStyle(),this.style.addSource(d,e),this._update(!0)}isSourceLoaded(d){const e=this.style&&this.style.tileManagers[d];if(e!==void 0)return e.loaded();this.fire(new c.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 e=this.style.tileManagers[d.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&e.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===d.source&&c.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."),o.type==="color-relief"&&o.source===d.source&&c.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 Eh(this.painter,e,d),this.painter.renderToTexture=new qe(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 o;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))),((o=n.source)===null||o===void 0?void 0:o.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 c.l("terrain",{terrain:d})),this}getTerrain(){var d,e;return(e=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const d=this.style&&this.style.tileManagers;for(const e in d){const n=d[e]._tiles;for(const o in n){const u=n[o];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}setSourceTileLodParams(d,e,n){if(n){const o=this.getSource(n);if(!o)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);o.calculateTileZoom=bt(Math.max(1,d),Math.max(1,e))}else for(const o in this.style.tileManagers)this.style.tileManagers[o].getSource().calculateTileZoom=bt(Math.max(1,d),Math.max(1,e));return this._update(!0),this}refreshTiles(d,e){const n=this.style.tileManagers[d];if(!n)throw new Error(`There is no tile manager with ID "${d}", cannot refresh tile`);e===void 0?n.reload(!0):n.refreshTiles(e.map((o=>new c.ad(o.z,o.x,o.y))))}addImage(d,e,n={}){const{pixelRatio:o=1,sdf:u=!1,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||c.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new c.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:k,data:A}=e,z=e;return this.style.addImage(d,{data:new c.R({width:T,height:k},new Uint8Array(A)),pixelRatio:o,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b,sdf:u,version:0,userImage:z}),z.onAdd&&z.onAdd(this,d),this}}{const{width:T,height:k,data:A}=ce.getImageData(e);this.style.addImage(d,{data:new c.R({width:T,height:k},A),pixelRatio:o,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:b,sdf:u,version:0})}}updateImage(d,e){const n=this.style.getImage(d);if(!n)return this.fire(new c.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=e instanceof HTMLImageElement||c.b(e)?ce.getImageData(e):e,{width:u,height:p,data:m}=o;if(u===void 0||p===void 0)return this.fire(new c.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(u!==n.data.width||p!==n.data.height)return this.fire(new c.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||c.b(e));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 c.k(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return _i.getImage(this._requestManager.transformRequest(d,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(d,e){return this._lazyInitEmptyStyle(),this.style.addLayer(d,e),this._update(!0)}moveLayer(d,e){return this.style.moveLayer(d,e),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,e,n){return this.style.setLayerZoomRange(d,e,n),this._update(!0)}setFilter(d,e,n={}){return this.style.setFilter(d,e,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,e,n,o={}){return this.style.setPaintProperty(d,e,n,o),this._update(!0)}getPaintProperty(d,e){return this.style.getPaintProperty(d,e)}setLayoutProperty(d,e,n,o={}){return this.style.setLayoutProperty(d,e,n,o),this._update(!0)}getLayoutProperty(d,e){return this.style.getLayoutProperty(d,e)}setGlyphs(d,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,e,n,(o=>{o||this._update(!0)})),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,e,(n=>{n||this._update(!0)})),this}setLight(d,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(d,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(d,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,e){return this.style.setFeatureState(d,e),this._update()}removeFeatureState(d,e){return this.style.removeFeatureState(d,e),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,e=0;return this._container&&(d=this._container.clientWidth||400,e=this._container.clientHeight||300),[d,e]}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const e=this._canvasContainer=xt.create("div","maplibregl-canvas-container",d);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=xt.create("canvas","maplibregl-canvas",e),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(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const u=this._controlContainer=xt.create("div","maplibregl-control-container",d),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{p[m]=xt.create("div",`maplibregl-ctrl-${m} `,u)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,e,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const d=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(o=>{e={requestedAttributes:d},o&&(e.statusMessage=o.statusMessage,e.type=o.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 o="Failed to initialize WebGL";throw e?(e.message=o,new Error(JSON.stringify(e))):new Error(o)}this.painter=new ou(n,this.transform),fr.testSupport(n)}migrateProjection(d,e){super.migrateProjection(d,e),this.painter.transform=d,this.fire(new c.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 e,n,o,u,p;const m=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const k=this.transform.zoom,A=qt();this.style.zoomHistory.update(k,A);const z=new c.H(k,{now:A,fadeDuration:m,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),j=z.crossFadingFactor();j===1&&j===this._crossFadingFactor||(x=!0,this._crossFadingFactor=j),this.style.update(z)}const b=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==_;(o=this.style.projection)===null||o===void 0||o.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((u=this.style.projection)===null||u===void 0?void 0:u.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 c.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.cF.mark(c.cG.load),this.fire(new c.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(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 c.l("idle")),!this._loaded||this._fullyLoaded||T||(this._fullyLoaded=!0,c.cF.mark(c.cG.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),_i.removeThrottleControl(this._imageQueueHandle),(d=this._resizeObserver)===null||d===void 0||d.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),xt.remove(this._canvasContainer),xt.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),c.cF.clearMetrics(),this._removed=!0,this.fire(new c.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ce.frame(this._frameRequest,(d=>{c.cF.frame(d),this._frameRequest=null;try{this._render(d)}catch(e){if(!c.cH(e)&&!(function(n){return n.message===co})(e))throw e}}),(()=>{})))}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 Aa}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(d){return this._lazyInitEmptyStyle(),this.style.setProjection(d),this._update(!0)}},M.MapMouseEvent=Ue,M.MapTouchEvent=va,M.MapWheelEvent=os,M.Marker=za,M.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const e=this._map.getZoom(),n=e===this._map.getMaxZoom(),o=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.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=(e,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);e.title=o,e.setAttribute("aria-label",o)},this.options=c.e({},Ul,d),this._container=xt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),xt.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),xt.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=xt.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 Gl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){xt.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,e){const n=xt.create("button",d,this._container);return n.type="button",n.addEventListener("click",e),n}},M.Popup=class extends c.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&&xt.remove(this._content),this._container&&(xt.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 c.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=xt.create("div","maplibregl-popup",this._map.getContainer()),this._tip=xt.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=$s(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const n=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor;const u=Mo(this.options.offset);if(!o){const m=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=n.y+u.bottom.y<_?["top"]:n.y>this._map.transform.height-_?["bottom"]:[],n.x<m/2?x.push("left"):n.x>this._map.transform.width-m/2&&x.push("right"),o=x.length===0?"bottom":x.join("-")}let p=n.add(u[o]);this.options.subpixelPositioning||(p=p.round()),xt.setTransform(this._container,`${Da[o]} translate(${p.x}px,${p.y}px)`),To(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Po),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 c.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=c.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 e=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=d;o=n.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}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=xt.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}_createCloseButton(){this.options.closeButton&&(this._closeButton=xt.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(ql);d&&d.focus()}},M.RasterDEMTileSource=wn,M.RasterTileSource=vs,M.ScaleControl=class{constructor(d){this._onMove=()=>{So(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,So(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Zl),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=xt.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){xt.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},M.ScrollZoomHandler=Pa,M.Style=aa,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=xt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=xt.create("button","maplibregl-ctrl-terrain",this._container),xt.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(){xt.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},M.TwoFingersTouchPitchHandler=Ol,M.TwoFingersTouchRotateHandler=Fl,M.TwoFingersTouchZoomHandler=mu,M.TwoFingersTouchZoomRotateHandler=xu,M.VectorTileSource=Nr,M.VideoSource=Qs,M.addSourceType=(d,e)=>c._(void 0,void 0,void 0,(function*(){if(bs(d))throw new Error(`A source type called "${d}" already exists.`);((n,o)=>{Hn[n]=o})(d,e)})),M.clearPrewarmedResources=function(){const d=Ri;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(yr),Ri=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=Wa,M.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},M.getRTLTextPluginStatus=function(){return vr().getRTLTextPluginStatus()},M.getVersion=function(){return Io},M.getWorkerCount=function(){return Ui.workerCount},M.getWorkerUrl=function(){return c.a.WORKER_URL},M.importScriptInWorkers=function(d){return Br().broadcast("IS",d)},M.isTimeFrozen=function(){return Xe.isFrozen()},M.now=qt,M.prewarm=function(){tn().acquire(yr)},M.restoreNow=function(){Xe.restoreNow()},M.setMaxParallelImageRequests=function(d){c.a.MAX_PARALLEL_IMAGE_REQUESTS=d},M.setNow=function(d){Xe.setNow(d)},M.setRTLTextPlugin=function(d,e){return vr().setRTLTextPlugin(d,e)},M.setWorkerCount=function(d){Ui.workerCount=d},M.setWorkerUrl=function(d){c.a.WORKER_URL=d}}));var ht=O;return ht}))})(eh)),eh.exports}var J_=K_();const Yf=X_(J_);var yc=I=>typeof I=="function"?I:function(){return I},Q_=typeof self<"u"?self:null,Ho=typeof window<"u"?window:null,Vn=Q_||Ho||globalThis,ty="2.0.0",Un={connecting:0,open:1,closing:2,closed:3},ey=1e4,iy=1e3,Ar={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},xs={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Rd={longpoll:"longpoll",websocket:"websocket"},ry={complete:4},Ld="base64url.bearer.phx.",Qu=class{constructor(I,P,O,N){this.channel=I,this.event=P,this.payload=O||function(){return{}},this.receivedResp=null,this.timeout=N,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,P){return this.hasReceived(I)&&P(this.receivedResp.response),this.recHooks.push({status:I,callback:P}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:I,response:P,_ref:O}){this.recHooks.filter(N=>N.status===I).forEach(N=>N.callback(P))}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,P){this.channel.trigger(this.refEvent,{status:I,response:P})}},tm=class{constructor(I,P){this.callback=I,this.timerCalc=P,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))}},ny=class{constructor(I,P,O){this.state=Ar.closed,this.topic=I,this.params=yc(P||{}),this.socket=O,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Qu(this,xs.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new tm(()=>{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=Ar.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(N=>N.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=Ar.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=Ar.closed,this.socket.remove(this)}),this.onError(N=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,N),this.isJoining()&&this.joinPush.reset(),this.state=Ar.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,xs.leave,yc({}),this.timeout).send(),this.state=Ar.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(xs.reply,(N,et)=>{this.trigger(this.replyEventName(et),N)})}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(xs.close,I)}onError(I){return this.on(xs.error,P=>I(P))}on(I,P){let O=this.bindingRef++;return this.bindings.push({event:I,ref:O,callback:P}),O}off(I,P){this.bindings=this.bindings.filter(O=>!(O.event===I&&(typeof P>"u"||P===O.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(I,P,O=this.timeout){if(P=P||{},!this.joinedOnce)throw new Error(`tried to push '${I}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let N=new Qu(this,I,function(){return P},O);return this.canPush()?N.send():(N.startTimeout(),this.pushBuffer.push(N)),N}leave(I=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Ar.leaving;let P=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(xs.close,"leave")},O=new Qu(this,xs.leave,yc({}),I);return O.receive("ok",()=>P()).receive("timeout",()=>P()),O.send(),this.canPush()||O.trigger("ok",{}),O}onMessage(I,P,O){return P}isMember(I,P,O,N){return this.topic!==I?!1:N&&N!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:I,event:P,payload:O,joinRef:N}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(I=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Ar.joining,this.joinPush.resend(I))}trigger(I,P,O,N){let et=this.onMessage(I,P,O,N);if(P&&!et)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let ht=this.bindings.filter(M=>M.event===I);for(let M=0;M<ht.length;M++)ht[M].callback(et,O,N||this.joinRef())}replyEventName(I){return`chan_reply_${I}`}isClosed(){return this.state===Ar.closed}isErrored(){return this.state===Ar.errored}isJoined(){return this.state===Ar.joined}isJoining(){return this.state===Ar.joining}isLeaving(){return this.state===Ar.leaving}},ih=class{static request(I,P,O,N,et,ht,M){if(Vn.XDomainRequest){let c=new Vn.XDomainRequest;return this.xdomainRequest(c,I,P,N,et,ht,M)}else if(Vn.XMLHttpRequest){let c=new Vn.XMLHttpRequest;return this.xhrRequest(c,I,P,O,N,et,ht,M)}else{if(Vn.fetch&&Vn.AbortController)return this.fetchRequest(I,P,O,N,et,ht,M);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(I,P,O,N,et,ht,M){let c={method:I,headers:O,body:N},dt=null;return et&&(dt=new AbortController,setTimeout(()=>dt.abort(),et),c.signal=dt.signal),Vn.fetch(P,c).then(Rt=>Rt.text()).then(Rt=>this.parseJSON(Rt)).then(Rt=>M&&M(Rt)).catch(Rt=>{Rt.name==="AbortError"&&ht?ht():M&&M(null)}),dt}static xdomainRequest(I,P,O,N,et,ht,M){return I.timeout=et,I.open(P,O),I.onload=()=>{let c=this.parseJSON(I.responseText);M&&M(c)},ht&&(I.ontimeout=ht),I.onprogress=()=>{},I.send(N),I}static xhrRequest(I,P,O,N,et,ht,M,c){I.open(P,O,!0),I.timeout=ht;for(let[dt,Rt]of Object.entries(N))I.setRequestHeader(dt,Rt);return I.onerror=()=>c&&c(null),I.onreadystatechange=()=>{if(I.readyState===ry.complete&&c){let dt=this.parseJSON(I.responseText);c(dt)}},M&&(I.ontimeout=M),I.send(et),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,P){let O=[];for(var N in I){if(!Object.prototype.hasOwnProperty.call(I,N))continue;let et=P?`${P}[${N}]`:N,ht=I[N];typeof ht=="object"?O.push(this.serialize(ht,et)):O.push(encodeURIComponent(et)+"="+encodeURIComponent(ht))}return O.join("&")}static appendParams(I,P){if(Object.keys(P).length===0)return I;let O=I.match(/\?/)?"&":"?";return`${I}${O}${this.serialize(P)}`}},sy=I=>{let P="",O=new Uint8Array(I),N=O.byteLength;for(let et=0;et<N;et++)P+=String.fromCharCode(O[et]);return btoa(P)},_c=class{constructor(I,P){P&&P.length===2&&P[1].startsWith(Ld)&&(this.authToken=atob(P[1].slice(Ld.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=Un.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(I){return I.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Rd.websocket),"$1/"+Rd.longpoll)}endpointURL(){return ih.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(I,P,O){this.close(I,P,O),this.readyState=Un.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Un.open||this.readyState===Un.connecting}poll(){const I={Accept:"application/json"};this.authToken&&(I["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",I,null,()=>this.ontimeout(),P=>{if(P){var{status:O,token:N,messages:et}=P;if(O===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=N}else O=0;switch(O){case 200:et.forEach(ht=>{setTimeout(()=>this.onmessage({data:ht}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Un.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 ${O}`)}})}send(I){typeof I!="string"&&(I=sy(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(`
|
|
806
|
+
`),()=>this.onerror("timeout"),P=>{this.awaitingBatchAck=!1,!P||P.status!==200?(this.onerror(P&&P.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(I,P,O){for(let et of this.reqs)et.abort();this.readyState=Un.closed;let N=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:I,reason:P,wasClean:O});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",N)):this.onclose(N)}ajax(I,P,O,N,et){let ht,M=()=>{this.reqs.delete(ht),N()};ht=ih.request(I,this.endpointURL(),P,O,this.timeout,M,c=>{this.reqs.delete(ht),this.isActive()&&et(c)}),this.reqs.add(ht)}},th={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(I,P){if(I.payload.constructor===ArrayBuffer)return P(this.binaryEncode(I));{let O=[I.join_ref,I.ref,I.topic,I.event,I.payload];return P(JSON.stringify(O))}},decode(I,P){if(I.constructor===ArrayBuffer)return P(this.binaryDecode(I));{let[O,N,et,ht,M]=JSON.parse(I);return P({join_ref:O,ref:N,topic:et,event:ht,payload:M})}},binaryEncode(I){let{join_ref:P,ref:O,event:N,topic:et,payload:ht}=I,M=this.META_LENGTH+P.length+O.length+et.length+N.length,c=new ArrayBuffer(this.HEADER_LENGTH+M),dt=new DataView(c),Rt=0;dt.setUint8(Rt++,this.KINDS.push),dt.setUint8(Rt++,P.length),dt.setUint8(Rt++,O.length),dt.setUint8(Rt++,et.length),dt.setUint8(Rt++,N.length),Array.from(P,Bt=>dt.setUint8(Rt++,Bt.charCodeAt(0))),Array.from(O,Bt=>dt.setUint8(Rt++,Bt.charCodeAt(0))),Array.from(et,Bt=>dt.setUint8(Rt++,Bt.charCodeAt(0))),Array.from(N,Bt=>dt.setUint8(Rt++,Bt.charCodeAt(0)));var $t=new Uint8Array(c.byteLength+ht.byteLength);return $t.set(new Uint8Array(c),0),$t.set(new Uint8Array(ht),c.byteLength),$t.buffer},binaryDecode(I){let P=new DataView(I),O=P.getUint8(0),N=new TextDecoder;switch(O){case this.KINDS.push:return this.decodePush(I,P,N);case this.KINDS.reply:return this.decodeReply(I,P,N);case this.KINDS.broadcast:return this.decodeBroadcast(I,P,N)}},decodePush(I,P,O){let N=P.getUint8(1),et=P.getUint8(2),ht=P.getUint8(3),M=this.HEADER_LENGTH+this.META_LENGTH-1,c=O.decode(I.slice(M,M+N));M=M+N;let dt=O.decode(I.slice(M,M+et));M=M+et;let Rt=O.decode(I.slice(M,M+ht));M=M+ht;let $t=I.slice(M,I.byteLength);return{join_ref:c,ref:null,topic:dt,event:Rt,payload:$t}},decodeReply(I,P,O){let N=P.getUint8(1),et=P.getUint8(2),ht=P.getUint8(3),M=P.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,dt=O.decode(I.slice(c,c+N));c=c+N;let Rt=O.decode(I.slice(c,c+et));c=c+et;let $t=O.decode(I.slice(c,c+ht));c=c+ht;let Bt=O.decode(I.slice(c,c+M));c=c+M;let Yt=I.slice(c,I.byteLength),ce={status:Bt,response:Yt};return{join_ref:dt,ref:Rt,topic:$t,event:xs.reply,payload:ce}},decodeBroadcast(I,P,O){let N=P.getUint8(1),et=P.getUint8(2),ht=this.HEADER_LENGTH+2,M=O.decode(I.slice(ht,ht+N));ht=ht+N;let c=O.decode(I.slice(ht,ht+et));ht=ht+et;let dt=I.slice(ht,I.byteLength);return{join_ref:null,ref:null,topic:M,event:c,payload:dt}}},ay=class{constructor(I,P={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=P.timeout||ey,this.transport=P.transport||Vn.WebSocket||_c,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=P.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=P.sessionStorage||Vn&&Vn.sessionStorage,this.establishedConnections=0,this.defaultEncoder=th.encode.bind(th),this.defaultDecoder=th.decode.bind(th),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=P.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.transport!==_c?(this.encode=P.encode||this.defaultEncoder,this.decode=P.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let O=null;Ho&&Ho.addEventListener&&(Ho.addEventListener("pagehide",N=>{this.conn&&(this.disconnect(),O=this.connectClock)}),Ho.addEventListener("pageshow",N=>{O===this.connectClock&&(O=null,this.connect())}),Ho.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=P.heartbeatIntervalMs||3e4,this.rejoinAfterMs=N=>P.rejoinAfterMs?P.rejoinAfterMs(N):[1e3,2e3,5e3][N-1]||1e4,this.reconnectAfterMs=N=>P.reconnectAfterMs?P.reconnectAfterMs(N):[10,50,100,150,200,250,500,1e3,2e3][N-1]||5e3,this.logger=P.logger||null,!this.logger&&P.debug&&(this.logger=(N,et,ht)=>{console.log(`${N}: ${et}`,ht)}),this.longpollerTimeout=P.longpollerTimeout||2e4,this.params=yc(P.params||{}),this.endPoint=`${I}/${Rd.websocket}`,this.vsn=P.vsn||ty,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new tm(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=P.authToken}getLongPollTransport(){return _c}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=ih.appendParams(ih.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,P,O){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,I&&I()},P,O)}connect(I){I&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=yc(I)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==_c?this.connectWithFallback(_c,this.longPollFallbackMs):this.transportConnect())}log(I,P,O){this.logger&&this.logger(I,P,O)}hasLogger(){return this.logger!==null}onOpen(I){let P=this.makeRef();return this.stateChangeCallbacks.open.push([P,I]),P}onClose(I){let P=this.makeRef();return this.stateChangeCallbacks.close.push([P,I]),P}onError(I){let P=this.makeRef();return this.stateChangeCallbacks.error.push([P,I]),P}onMessage(I){let P=this.makeRef();return this.stateChangeCallbacks.message.push([P,I]),P}ping(I){if(!this.isConnected())return!1;let P=this.makeRef(),O=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:P});let N=this.onMessage(et=>{et.ref===P&&(this.off([N]),I(Date.now()-O))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1;let I;this.authToken&&(I=["phoenix",`${Ld}${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=P=>this.onConnError(P),this.conn.onmessage=P=>this.onConnMessage(P),this.conn.onclose=P=>this.onConnClose(P)}getSession(I){return this.sessionStore&&this.sessionStore.getItem(I)}storeSession(I,P){this.sessionStore&&this.sessionStore.setItem(I,P)}connectWithFallback(I,P=2500){clearTimeout(this.fallbackTimer);let O=!1,N=!0,et,ht,M=c=>{this.log("transport",`falling back to ${I.name}...`,c),this.off([et,ht]),N=!1,this.replaceTransport(I),this.transportConnect()};if(this.getSession(`phx:fallback:${I.name}`))return M("memorized");this.fallbackTimer=setTimeout(M,P),ht=this.onError(c=>{this.log("transport","error",c),N&&!O&&(clearTimeout(this.fallbackTimer),M(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(O=!0,!N)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${I.name}`,"true"),this.log("transport",`established ${I.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(M,P),this.ping(c=>{this.log("transport","connected to primary after",c),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(),iy,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(I,P,O){if(!this.conn)return I&&I();let N=this.connectClock;this.waitForBufferDone(()=>{N===this.connectClock&&(this.conn&&(P?this.conn.close(P,O||""):this.conn.close()),this.waitForSocketClosed(()=>{N===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,P=1){if(P===5||!this.conn||!this.conn.bufferedAmount){I();return}setTimeout(()=>{this.waitForBufferDone(I,P+1)},150*P)}waitForSocketClosed(I,P=1){if(P===5||!this.conn||this.conn.readyState===Un.closed){I();return}setTimeout(()=>{this.waitForSocketClosed(I,P+1)},150*P)}onConnClose(I){this.conn&&(this.conn.onclose=()=>{});let P=I&&I.code;this.hasLogger()&&this.log("transport","close",I),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&P!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,O])=>O(I))}onConnError(I){this.hasLogger()&&this.log("transport",I);let P=this.transport,O=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,N])=>{N(I,P,O)}),(P===this.transport||O>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(I=>{I.isErrored()||I.isLeaving()||I.isClosed()||I.trigger(xs.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Un.connecting:return"connecting";case Un.open:return"open";case Un.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(I){this.off(I.stateChangeRefs),this.channels=this.channels.filter(P=>P!==I)}off(I){for(let P in this.stateChangeCallbacks)this.stateChangeCallbacks[P]=this.stateChangeCallbacks[P].filter(([O])=>I.indexOf(O)===-1)}channel(I,P={}){let O=new ny(I,P,this);return this.channels.push(O),O}push(I){if(this.hasLogger()){let{topic:P,event:O,payload:N,ref:et,join_ref:ht}=I;this.log("push",`${P} ${O} (${ht}, ${et})`,N)}this.isConnected()?this.encode(I,P=>this.conn.send(P)):this.sendBuffer.push(()=>this.encode(I,P=>this.conn.send(P)))}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,P=>{let{topic:O,event:N,payload:et,ref:ht,join_ref:M}=P;ht&&ht===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${et.status||""} ${O} ${N} ${ht&&"("+ht+")"||""}`,et);for(let c=0;c<this.channels.length;c++){const dt=this.channels[c];dt.isMember(O,N,et,M)&&dt.trigger(N,et,ht,M)}for(let c=0;c<this.stateChangeCallbacks.message.length;c++){let[,dt]=this.stateChangeCallbacks.message[c];dt(P)}})}leaveOpenTopic(I){let P=this.channels.find(O=>O.topic===I&&(O.isJoined()||O.isJoining()));P&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${I}"`),P.leave())}};class Ad extends Error{constructor(P="this function is not yet implemented."){super(P),this.name="NotImplementedError"}}class oy{now=Dr(new Date);isPlaying=Dr(!1);constructor(){}dispose(){}play(){throw new Ad}pause(){throw new Ad}seek(P){throw new Ad}}class ly{app;widgets=j_({TopBar:[],SideBar:[],MapOverlay:[]});isSidebarCollapsed=Dr(!0);constructor(P){this.app=P}openSidebar=()=>{this.isSidebarCollapsed.value=!1};closeSidebar=()=>{this.isSidebarCollapsed.value=!0};toggleSidebar=()=>{this.isSidebarCollapsed.value=!this.isSidebarCollapsed.value};registerWidget(P,O,N){this.app.component(P,N);const et={id:P};return this.widgets[O].push(et),{dispose:()=>{const ht=this.widgets[O],M=ht.findIndex(c=>c.id===P);M>-1&&ht.splice(M,1)}}}}class cy{tangramApi;constructor(P){this.tangramApi=P}map=$a(null);overlay=$a(null);layers=$a([]);isReady=Jf(()=>!!this.map.value);center=Dr({lng:0,lat:0});zoom=Dr(0);pitch=Dr(0);bearing=Dr(0);bounds=Dr(null);updateState=()=>{if(!this.map.value)return;const P=this.map.value;this.center.value=P.getCenter(),this.zoom.value=P.getZoom(),this.pitch.value=P.getPitch(),this.bearing.value=P.getBearing(),this.bounds.value=P.getBounds()};initialize=P=>{this.map.value=P,this.overlay.value=new W_({interleaved:!1,onHover:N=>{const et=this.map.value?.getCanvas();et&&(et.style.cursor=N.object?"pointer":"")},onClick:N=>{N.object||this.tangramApi.state.deselectActiveEntity()}}),this.map.value.addControl(this.overlay.value),zd(this.layers,N=>{this.overlay.value?.setProps({layers:N})},{deep:!0});const O=()=>{this.updateState(),this.map.value?.off("load",O)};this.map.value.on("load",O),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(P){return this.layers.value=[...this.layers.value,P],{dispose:()=>{this.layers.value=this.layers.value.filter(O=>O!==P)}}}setLayer(P){const O=this.layers.value.findIndex(N=>N.id===P.id);if(O>=0){const N=[...this.layers.value];N[O]=P,this.layers.value=N}else this.layers.value=[...this.layers.value,P];return{dispose:()=>{this.layers.value=this.layers.value.filter(N=>N.id!==P.id)}}}}class uy{entitiesByType=new Map;totalCounts=Dr(new Map);_selection=$a(null);activeEntity=Jf(()=>{const P=this._selection.value;return P&&this.entitiesByType.get(P.type)?.value.get(P.id)||null});registerEntityType=P=>{this.entitiesByType.has(P)||this.entitiesByType.set(P,$a(new Map))};getEntitiesByType=P=>(this.entitiesByType.has(P)||this.entitiesByType.set(P,$a(new Map)),this.entitiesByType.get(P));replaceAllEntitiesByType=(P,O)=>{let N=this.entitiesByType.get(P);N||(N=$a(new Map),this.entitiesByType.set(P,N));const et=new Map;for(const ht of O)et.set(ht.id,ht);N.value=et};setActiveEntity=P=>{this._selection.value={id:P.id,type:P.type}};deselectActiveEntity=()=>{this._selection.value=null};setTotalCount=(P,O)=>{const N=new Map(this.totalCounts.value);N.set(P,O),this.totalCounts.value=N}}class hy{socket=null;channels=new Map;channelConfig;connectionPromise=null;connectionId=null;constructor(P){this.channelConfig=P.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(P){const O=`${this.channelConfig.url}/token`,N={channel:P};this.connectionId&&(N.id=this.connectionId);const et=await fetch(O,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!et.ok)throw new Error(`failed to fetch token: ${et.statusText}`);return et.json()}connect(){return this.connectionPromise||(this.connectionPromise=(async()=>{try{if(this.socket?.isConnected())return;const{id:P,token:O}=await this.fetchToken("system");this.connectionId=P;const N=this.channelConfig.url.replace(/^http/,"ws");this.socket=new ay(N,{params:{userToken:O}}),await new Promise((et,ht)=>{this.socket.connect(),this.socket.onOpen(()=>{console.log("ws connected"),et()}),this.socket.onError(M=>{console.error("ws connection error:",M),this.connectionPromise=null,ht(M)})})}catch(P){throw this.connectionPromise=null,P}})()),this.connectionPromise}async getChannel(P){if(await this.connect(),!this.socket)throw new Error("socket connection failed");if(this.channels.has(P)){const et=this.channels.get(P);if(et.state==="joined")return et}const{token:O}=await this.fetchToken(P),N=this.socket.channel(P,{token:O});return this.channels.set(P,N),new Promise((et,ht)=>{N.join().receive("ok",()=>et(N)).receive("error",M=>ht(M)).receive("timeout",()=>ht("channel join timeout"))})}parseTopicEvent(P){const O=P.split(":");if(O.length<2)throw new Error(`invalid topic:event format: ${P}`);const N=O.pop();return[O.join(":"),N]}async subscribe(P,O){const[N,et]=this.parseTopicEvent(P),ht=await this.getChannel(N),M=ht.on(et,O);return{dispose:()=>ht.off(et,M)}}async publish(P,O){const[N,et]=this.parseTopicEvent(P);(await this.getChannel(N)).push(et,O)}}class Od{constructor(P,O){this.app=P,this.config=O,this.realtime=new hy(O),this.ui=new ly(this.app),this.time=new oy,this.map=new cy(this),this.state=new uy}time;ui;map;state;realtime;config;static async create(P){const O=await fetch("/config").then(N=>{if(!N.ok)throw new Error("failed to fetch `/config`!");return N.json()});return new Od(P,O)}getVueApp(){return this.app}}async function dy(I,P){P?.({stage:"manifest"});const O=await fetch("/manifest.json").then(N=>N.json());for(const N of O.plugins){P?.({stage:"plugin",pluginName:N});const et=`/plugins/${N}/plugin.json`,ht=await fetch(et).then(c=>c.json());if(ht.style){const c=document.createElement("link");c.rel="stylesheet",c.href=`/plugins/${N}/${ht.style}`,document.head.appendChild(c)}const M=`/plugins/${N}/${ht.main}`;try{const c=await import(M);c.install&&c.install(I)}catch(c){console.error(`failed to load plugin "${N}":`,c)}}P?.({stage:"done"})}var py=Object.defineProperty,Gn=(I,P)=>py(I,"name",{value:P,configurable:!0});function pr(I,P){let O="script";return I==="name"?O="script":I==="name2"?O="script2":I==="name3"&&(O="script3"),[["coalesce",["get",`pgf:${I}`],["get",I]],{"text-font":["case",["==",["get",O],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[P||"Noto Sans Regular"]]]}]}Gn(pr,"get_name_block");function Nn(I,P,O){let N="name";return O==="name"?N="":O==="name2"?N="2":O==="name3"&&(N="3"),P==="Latin"?["has",`script${N}`]:I==="ja"?["all",["!=",["get",`script${N}`],"Han"],["!=",["get",`script${N}`],"Hiragana"],["!=",["get",`script${N}`],"Katakana"],["!=",["get",`script${N}`],"Mixed-Japanese"]]:["!=",["get",`script${N}`],P]}Gn(Nn,"is_not_in_target_script");function yn(I){return I==="Devanagari"?{"text-font":["literal",["Noto Sans Devanagari Regular v1"]]}:{}}Gn(yn,"get_font_formatting");function jd(I){let P=fy.find(O=>O.lang===I);return P===void 0?"Latin":P.script}Gn(jd,"get_default_script");function em(I,P){let O=P||jd(I),N;return O==="Devanagari"?N="pgf:":N="",["format",["coalesce",["get",`${N}name:${I}`],["get","name:en"]],yn(O)]}Gn(em,"get_country_name");function _n(I,P,O){let N=P||jd(I),et;return N==="Devanagari"?et="pgf:":et="",["case",["all",["any",["has","name"],["has","pgf:name"]],["!",["any",["has","name2"],["has","pgf:name2"]]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",Nn(I,N,"name"),["case",["any",["is-supported-script",["get","name"]],["has","pgf:name"]],["format",["coalesce",["get",`${et}name:${I}`],["get","name:en"]],yn(N),`
|
|
807
|
+
`,{},["case",["all",["!",["has",`${et}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",[O||"Noto Sans Regular"]]]}],["get","name:en"]],["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name"],["get","name"]],yn(N)]],["all",["any",["has","name"],["has","pgf:name"]],["any",["has","name2"],["has","pgf:name2"]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",["all",Nn(I,N,"name"),Nn(I,N,"name2")],["format",["get",`${et}name:${I}`],yn(N),`
|
|
808
|
+
`,{},...pr("name",O),`
|
|
809
|
+
`,{},...pr("name2",O)],["case",Nn(I,N,"name2"),["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name"],["get","name"]],yn(N),`
|
|
810
|
+
`,{},...pr("name2",O)],["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name2"],["get","name2"]],yn(N),`
|
|
811
|
+
`,{},...pr("name",O)]]],["case",["all",Nn(I,N,"name"),Nn(I,N,"name2"),Nn(I,N,"name3")],["format",["get",`${et}name:${I}`],yn(N),`
|
|
812
|
+
`,{},...pr("name",O),`
|
|
813
|
+
`,{},...pr("name2",O),`
|
|
814
|
+
`,{},...pr("name3",O)],["case",["!",Nn(I,N,"name")],["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name"],["get","name"]],yn(N),`
|
|
815
|
+
`,{},...pr("name2",O),`
|
|
816
|
+
`,{},...pr("name3",O)],["!",Nn(I,N,"name2")],["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name2"],["get","name2"]],yn(N),`
|
|
817
|
+
`,{},...pr("name",O),`
|
|
818
|
+
`,{},...pr("name3",O)],["format",["coalesce",["get",`${et}name:${I}`],["get","pgf:name3"],["get","name3"]],yn(N),`
|
|
819
|
+
`,{},...pr("name",O),`
|
|
820
|
+
`,{},...pr("name2",O)]]]]}Gn(_n,"get_multiline_name");var fy=[{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 im(I,P){return[{id:"background",type:"background",paint:{"background-color":P.background}},{id:"earth",type:"fill",filter:["==","$type","Polygon"],source:I,"source-layer":"earth",paint:{"fill-color":P.earth}},...P.landcover?[{id:"landcover",type:"fill",source:I,"source-layer":"landcover",paint:{"fill-color":["match",["get","kind"],"grassland",P.landcover.grassland,"barren",P.landcover.barren,"urban_area",P.landcover.urban_area,"farmland",P.landcover.farmland,"glacier",P.landcover.glacier,"scrub",P.landcover.scrub,P.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"]]],P.park_b,["in",["get","kind"],["literal",["wood","nature_reserve","forest"]]],P.wood_b,["in",["get","kind"],["literal",["scrub","grassland","grass"]]],P.scrub_b,["in",["get","kind"],["literal",["glacier"]]],P.glacier,["in",["get","kind"],["literal",["sand"]]],P.sand,["in",["get","kind"],["literal",["military","naval_base","airfield"]]],P.zoo,P.earth]}},{id:"landuse_urban_green",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","allotments","village_green","playground"],paint:{"fill-color":P.park_b,"fill-opacity":.7}},{id:"landuse_hospital",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","hospital"],paint:{"fill-color":P.hospital}},{id:"landuse_industrial",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","industrial"],paint:{"fill-color":P.industrial}},{id:"landuse_school",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","school","university","college"],paint:{"fill-color":P.school}},{id:"landuse_beach",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","beach"],paint:{"fill-color":P.beach}},{id:"landuse_zoo",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","zoo"],paint:{"fill-color":P.zoo}},{id:"landuse_aerodrome",type:"fill",source:I,"source-layer":"landuse",filter:["in","kind","aerodrome"],paint:{"fill-color":P.aerodrome}},{id:"roads_runway",type:"line",source:I,"source-layer":"roads",filter:["==","kind_detail","runway"],paint:{"line-color":P.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":P.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":P.runway}},{id:"water",type:"fill",filter:["==","$type","Polygon"],source:I,"source-layer":"water",paint:{"fill-color":P.water}},{id:"water_stream",type:"line",source:I,"source-layer":"water",minzoom:14,filter:["in","kind","stream"],paint:{"line-color":P.water,"line-width":.5}},{id:"water_river",type:"line",source:I,"source-layer":"water",minzoom:9,filter:["in","kind","river"],paint:{"line-color":P.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":P.pedestrian}},{id:"landuse_pier",type:"fill",source:I,"source-layer":"landuse",filter:["==","kind","pier"],paint:{"fill-color":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.buildings,"fill-opacity":.5}},{id:"roads_pier",type:"line",source:I,"source-layer":"roads",filter:["==","kind_detail","pier"],paint:{"line-color":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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,P.minor_a,16,P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.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":P.bridges_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}}]}Gn(im,"nolabels_layers");function rm(I,P,O,N){return[{id:"address_label",type:"symbol",source:I,"source-layer":"buildings",minzoom:18,filter:["==","kind","address"],layout:{"symbol-placement":"point","text-font":[P.italic||"Noto Sans Italic"],"text-field":["get","addr_housenumber"],"text-size":12},paint:{"text-color":P.address_label,"text-halo-color":P.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":[P.italic||"Noto Sans Italic"],"text-field":_n(O,N,P.regular),"text-size":12,"text-letter-spacing":.2},paint:{"text-color":P.ocean_label,"text-halo-color":P.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":[P.regular||"Noto Sans Regular"],"text-field":_n(O,N,P.regular),"text-size":12},paint:{"text-color":P.roads_label_minor,"text-halo-color":P.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":[P.italic||"Noto Sans Italic"],"text-field":_n(O,N,P.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,10,12],"text-letter-spacing":.1,"text-max-width":9,"text-transform":"uppercase"},paint:{"text-color":P.ocean_label,"text-halo-width":1,"text-halo-color":P.water}},{id:"earth_label_islands",type:"symbol",source:I,"source-layer":"earth",filter:["in","kind","island"],layout:{"text-font":[P.italic||"Noto Sans Italic"],"text-field":_n(O,N,P.regular),"text-size":10,"text-letter-spacing":.1,"text-max-width":8},paint:{"text-color":P.subplace_label,"text-halo-color":P.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":[P.italic||"Noto Sans Italic"],"text-field":_n(O,N,P.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,6,12,10,12],"text-letter-spacing":.1,"text-max-width":9},paint:{"text-color":P.ocean_label,"text-halo-color":P.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":[P.bold||"Noto Sans Medium"],"text-size":8,"icon-size":.8,"symbol-placement":"line","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport"},paint:{"text-color":P.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":[P.regular||"Noto Sans Regular"],"text-field":_n(O,N,P.regular),"text-size":12},paint:{"text-color":P.roads_label_major,"text-halo-color":P.roads_label_major_halo,"text-halo-width":1}},...P.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":[P.regular||"Noto Sans Regular"],"text-justify":"auto","text-field":_n(O,N,P.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"]]],P.pois.green,["in",["get","kind"],["literal",["aerodrome","station","bus_stop","ferry_terminal"]]],P.pois.lapis,["in",["get","kind"],["literal",["stadium","university","library","school","animal","toilets","drinking_water","post_office","building","townhall"]]],P.pois.slategray,["in",["get","kind"],["literal",["supermarket","convenience","books","beauty","electronics","clothes"]]],P.pois.blue,["in",["get","kind"],["literal",["restaurant","fast_food","cafe","bar"]]],P.pois.tangerine,["in",["get","kind"],["literal",["attraction","museum","theatre","artwork"]]],P.pois.pink,P.earth],"text-halo-color":P.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":_n(O,N,P.regular),"text-font":[P.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":P.subplace_label,"text-halo-color":P.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,_n(O,N,P.regular)],"text-font":[P.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":P.state_label,"text-halo-color":P.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":_n(O,N,P.regular),"text-font":["case",["<=",["get","min_zoom"],5],["literal",[P.bold||"Noto Sans Medium"]],["literal",[P.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":P.city_label,"text-halo-color":P.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":em(O,N),"text-font":[P.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":P.country_label,"text-halo-color":P.earth,"text-halo-width":1}}]}Gn(rm,"labels_layers");var my={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)"}},gy={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)"}},_y={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"},yy={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"},xy={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 nm(I){switch(I){case"light":return my;case"dark":return gy;case"white":return _y;case"grayscale":return yy;case"black":return xy}throw new Error("Flavor not found")}Gn(nm,"namedFlavor");function sm(I,P,O){let N=[];return O!=null&&O.labelsOnly||(N=im(I,P)),O!=null&&O.lang&&(N=N.concat(rm(I,P,O.lang))),N}Gn(sm,"layers");var zr=Uint8Array,Yo=Uint16Array,vy=Int32Array,am=new zr([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]),om=new zr([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]),by=new zr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lm=function(I,P){for(var O=new Yo(31),N=0;N<31;++N)O[N]=P+=1<<I[N-1];for(var et=new vy(O[30]),N=1;N<30;++N)for(var ht=O[N];ht<O[N+1];++ht)et[ht]=ht-O[N]<<5|N;return{b:O,r:et}},cm=lm(am,2),um=cm.b,wy=cm.r;um[28]=258,wy[258]=28;var Ty=lm(om,0),Sy=Ty.b,Fd=new Yo(32768);for(var Ze=0;Ze<32768;++Ze){var Js=(Ze&43690)>>1|(Ze&21845)<<1;Js=(Js&52428)>>2|(Js&13107)<<2,Js=(Js&61680)>>4|(Js&3855)<<4,Fd[Ze]=((Js&65280)>>8|(Js&255)<<8)>>1}var xc=(function(I,P,O){for(var N=I.length,et=0,ht=new Yo(P);et<N;++et)I[et]&&++ht[I[et]-1];var M=new Yo(P);for(et=1;et<P;++et)M[et]=M[et-1]+ht[et-1]<<1;var c;if(O){c=new Yo(1<<P);var dt=15-P;for(et=0;et<N;++et)if(I[et])for(var Rt=et<<4|I[et],$t=P-I[et],Bt=M[I[et]-1]++<<$t,Yt=Bt|(1<<$t)-1;Bt<=Yt;++Bt)c[Fd[Bt]>>dt]=Rt}else for(c=new Yo(N),et=0;et<N;++et)I[et]&&(c[et]=Fd[M[I[et]-1]++]>>15-I[et]);return c}),bc=new zr(288);for(var Ze=0;Ze<144;++Ze)bc[Ze]=8;for(var Ze=144;Ze<256;++Ze)bc[Ze]=9;for(var Ze=256;Ze<280;++Ze)bc[Ze]=7;for(var Ze=280;Ze<288;++Ze)bc[Ze]=8;var hm=new zr(32);for(var Ze=0;Ze<32;++Ze)hm[Ze]=5;var Py=xc(bc,9,1),My=xc(hm,5,1),kd=function(I){for(var P=I[0],O=1;O<I.length;++O)I[O]>P&&(P=I[O]);return P},gn=function(I,P,O){var N=P/8|0;return(I[N]|I[N+1]<<8)>>(P&7)&O},Dd=function(I,P){var O=P/8|0;return(I[O]|I[O+1]<<8|I[O+2]<<16)>>(P&7)},Iy=function(I){return(I+7)/8|0},Ey=function(I,P,O){return(O==null||O>I.length)&&(O=I.length),new zr(I.subarray(P,O))},Cy=["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"],kr=function(I,P,O){var N=new Error(P||Cy[I]);if(N.code=I,Error.captureStackTrace&&Error.captureStackTrace(N,kr),!O)throw N;return N},Nd=function(I,P,O,N){var et=I.length,ht=0;if(!et||P.f&&!P.l)return O||new zr(0);var M=!O,c=M||P.i!=2,dt=P.i;M&&(O=new zr(et*3));var Rt=function(Br){var Li=O.length;if(Br>Li){var bn=new zr(Math.max(Li*2,Br));bn.set(O),O=bn}},$t=P.f||0,Bt=P.p||0,Yt=P.b||0,ce=P.l,Xe=P.d,qt=P.m,xt=P.n,fr=et*8;do{if(!ce){$t=gn(I,Bt,1);var ve=gn(I,Bt+1,3);if(Bt+=3,ve)if(ve==1)ce=Py,Xe=My,qt=9,xt=5;else if(ve==2){var Jr=gn(I,Bt,31)+257,_i=gn(I,Bt+10,15)+4,$n=Jr+gn(I,Bt+5,31)+1;Bt+=14;for(var zi=new zr($n),rr=new zr(19),Qe=0;Qe<_i;++Qe)rr[by[Qe]]=gn(I,Bt+Qe*3,7);Bt+=_i*3;for(var mr=kd(rr),Qr=(1<<mr)-1,Zn=xc(rr,mr,1),Qe=0;Qe<$n;){var xn=Zn[gn(I,Bt,Qr)];Bt+=xn&15;var de=xn>>4;if(de<16)zi[Qe++]=de;else{var nr=0,wi=0;for(de==16?(wi=3+gn(I,Bt,3),Bt+=2,nr=zi[Qe-1]):de==17?(wi=3+gn(I,Bt,7),Bt+=3):de==18&&(wi=11+gn(I,Bt,127),Bt+=7);wi--;)zi[Qe++]=nr}}var qn=zi.subarray(0,Jr),le=zi.subarray(Jr);qt=kd(qn),xt=kd(le),ce=xc(qn,qt,1),Xe=xc(le,xt,1)}else kr(1);else{var de=Iy(Bt)+4,Rr=I[de-4]|I[de-3]<<8,Lr=de+Rr;if(Lr>et){dt&&kr(0);break}c&&Rt(Yt+Rr),O.set(I.subarray(de,Lr),Yt),P.b=Yt+=Rr,P.p=Bt=Lr*8,P.f=$t;continue}if(Bt>fr){dt&&kr(0);break}}c&&Rt(Yt+131072);for(var vn=(1<<qt)-1,sr=(1<<xt)-1,gr=Bt;;gr=Bt){var nr=ce[Dd(I,Bt)&vn],_r=nr>>4;if(Bt+=nr&15,Bt>fr){dt&&kr(0);break}if(nr||kr(2),_r<256)O[Yt++]=_r;else if(_r==256){gr=Bt,ce=null;break}else{var yr=_r-254;if(_r>264){var Qe=_r-257,Ui=am[Qe];yr=gn(I,Bt,(1<<Ui)-1)+um[Qe],Bt+=Ui}var oi=Xe[Dd(I,Bt)&sr],Ri=oi>>4;oi||kr(3),Bt+=oi&15;var le=Sy[Ri];if(Ri>3){var Ui=om[Ri];le+=Dd(I,Bt)&(1<<Ui)-1,Bt+=Ui}if(Bt>fr){dt&&kr(0);break}c&&Rt(Yt+131072);var li=Yt+yr;if(Yt<le){var tn=ht-le,Fr=Math.min(le,li);for(tn+Yt<0&&kr(3);Yt<Fr;++Yt)O[Yt]=N[tn+Yt]}for(;Yt<li;++Yt)O[Yt]=O[Yt-le]}}P.l=ce,P.p=gr,P.b=Yt,P.f=$t,ce&&($t=1,P.m=qt,P.d=Xe,P.n=xt)}while(!$t);return Yt!=O.length&&M?Ey(O,0,Yt):O.subarray(0,Yt)},Ay=new zr(0),ky=function(I){(I[0]!=31||I[1]!=139||I[2]!=8)&&kr(6,"invalid gzip data");var P=I[3],O=10;P&4&&(O+=(I[10]|I[11]<<8)+2);for(var N=(P>>3&1)+(P>>4&1);N>0;N-=!I[O++]);return O+(P&2)},Dy=function(I){var P=I.length;return(I[P-4]|I[P-3]<<8|I[P-2]<<16|I[P-1]<<24)>>>0},zy=function(I,P){return((I[0]&15)!=8||I[0]>>4>7||(I[0]<<8|I[1])%31)&&kr(6,"invalid zlib data"),(I[1]>>5&1)==1&&kr(6,"invalid zlib data: "+(I[1]&32?"need":"unexpected")+" dictionary"),(I[1]>>3&4)+2};function Ry(I,P){return Nd(I,{i:2},P,P)}function Ly(I,P){var O=ky(I);return O+8>I.length&&kr(6,"invalid gzip data"),Nd(I.subarray(O,-8),{i:2},new zr(Dy(I)),P)}function Fy(I,P){return Nd(I.subarray(zy(I),-4),{i:2},P,P)}function By(I,P){return I[0]==31&&I[1]==139&&I[2]==8?Ly(I,P):(I[0]&15)!=8||I[0]>>4>7||(I[0]<<8|I[1])%31?Ry(I,P):Fy(I,P)}var Oy=typeof TextDecoder<"u"&&new TextDecoder,jy=0;try{Oy.decode(Ay,{stream:!0}),jy=1}catch{}var Ny=Object.defineProperty,vc=Math.pow,ke=(I,P)=>Ny(I,"name",{value:P,configurable:!0}),Di=(I,P,O)=>new Promise((N,et)=>{var ht=dt=>{try{c(O.next(dt))}catch(Rt){et(Rt)}},M=dt=>{try{c(O.throw(dt))}catch(Rt){et(Rt)}},c=dt=>dt.done?N(dt.value):Promise.resolve(dt.value).then(ht,M);c((O=O.apply(I,P)).next())});ke((I,P)=>{let O=!1,N="",et=L.GridLayer.extend({createTile:ke((ht,M)=>{let c=document.createElement("img"),dt=new AbortController,Rt=dt.signal;return c.cancel=()=>{dt.abort()},O||(I.getHeader().then($t=>{$t.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."):$t.tileType===2?N="image/png":$t.tileType===3?N="image/jpeg":$t.tileType===4?N="image/webp":$t.tileType===5&&(N="image/avif")}),O=!0),I.getZxy(ht.z,ht.x,ht.y,Rt).then($t=>{if($t){let Bt=new Blob([$t.data],{type:N}),Yt=window.URL.createObjectURL(Bt);c.src=Yt,c.cancel=void 0,M(void 0,c)}}).catch($t=>{if($t.name!=="AbortError")throw $t}),c},"createTile"),_removeTile:ke(function(ht){let M=this._tiles[ht];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[ht],this.fire("tileunload",{tile:M.el,coords:this._keyToTileCoords(ht)}))},"_removeTile")});return new et(P)},"leafletRasterLayer");var Vy=ke(I=>(P,O)=>{if(O instanceof AbortController)return I(P,O);let N=new AbortController;return I(P,N).then(et=>O(void 0,et.data,et.cacheControl||"",et.expires||""),et=>O(et)).catch(et=>O(et)),{cancel:ke(()=>N.abort(),"cancel")}},"v3compat"),dm=class{constructor(P){this.tilev4=ke((O,N)=>Di(this,null,function*(){if(O.type==="json"){let ce=O.url.substr(10),Xe=this.tiles.get(ce);if(Xe||(Xe=new Kf(ce),this.tiles.set(ce,Xe)),this.metadata)return{data:yield Xe.getTileJson(O.url)};let qt=yield Xe.getHeader();return(qt.minLon>=qt.maxLon||qt.minLat>=qt.maxLat)&&console.error(`Bounds of PMTiles archive ${qt.minLon},${qt.minLat},${qt.maxLon},${qt.maxLat} are not valid.`),{data:{tiles:[`${O.url}/{z}/{x}/{y}`],minzoom:qt.minZoom,maxzoom:qt.maxZoom,bounds:[qt.minLon,qt.minLat,qt.maxLon,qt.maxLat]}}}let et=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),ht=O.url.match(et);if(!ht)throw new Error("Invalid PMTiles protocol URL");let M=ht[1],c=this.tiles.get(M);c||(c=new Kf(M),this.tiles.set(M,c));let dt=ht[2],Rt=ht[3],$t=ht[4],Bt=yield c.getHeader(),Yt=yield c?.getZxy(+dt,+Rt,+$t,N.signal);if(Yt)return{data:new Uint8Array(Yt.data),cacheControl:Yt.cacheControl,expires:Yt.expires};if(Bt.tileType===1){if(this.errorOnMissingTile)throw new Error("Tile not found.");return{data:new Uint8Array}}return{data:null}}),"tilev4"),this.tile=Vy(this.tilev4),this.tiles=new Map,this.metadata=P?.metadata||!1,this.errorOnMissingTile=P?.errorOnMissingTile||!1}add(P){this.tiles.set(P.source.getKey(),P)}get(P){return this.tiles.get(P)}};ke(dm,"Protocol");var Uy=dm;function pm(I,P){return(P>>>0)*4294967296+(I>>>0)}ke(pm,"toNum");function fm(I,P){let O=P.buf,N=O[P.pos++],et=(N&112)>>4;if(N<128||(N=O[P.pos++],et|=(N&127)<<3,N<128)||(N=O[P.pos++],et|=(N&127)<<10,N<128)||(N=O[P.pos++],et|=(N&127)<<17,N<128)||(N=O[P.pos++],et|=(N&127)<<24,N<128)||(N=O[P.pos++],et|=(N&1)<<31,N<128))return pm(I,et);throw new Error("Expected varint not more than 10 bytes")}ke(fm,"readVarintRemainder");function Xo(I){let P=I.buf,O=P[I.pos++],N=O&127;return O<128||(O=P[I.pos++],N|=(O&127)<<7,O<128)||(O=P[I.pos++],N|=(O&127)<<14,O<128)||(O=P[I.pos++],N|=(O&127)<<21,O<128)?N:(O=P[I.pos],N|=(O&15)<<28,fm(N,I))}ke(Xo,"readVarint");function Vd(I,P,O,N){if(N===0){O===1&&(P[0]=I-1-P[0],P[1]=I-1-P[1]);let et=P[0];P[0]=P[1],P[1]=et}}ke(Vd,"rotate");function mm(I,P){let O=vc(2,I),N=P,et=P,ht=P,M=[0,0],c=1;for(;c<O;)N=1&ht/2,et=1&(ht^N),Vd(c,M,N,et),M[0]+=c*N,M[1]+=c*et,ht=ht/4,c*=2;return[I,M[0],M[1]]}ke(mm,"idOnLevel");var Gy=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function gm(I,P,O){if(I>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");if(P>vc(2,I)-1||O>vc(2,I)-1)throw new Error("tile x/y outside zoom level bounds");let N=Gy[I],et=vc(2,I),ht=0,M=0,c=0,dt=[P,O],Rt=et/2;for(;Rt>0;)ht=(dt[0]&Rt)>0?1:0,M=(dt[1]&Rt)>0?1:0,c+=Rt*Rt*(3*ht^M),Vd(Rt,dt,ht,M),Rt=Rt/2;return N+c}ke(gm,"zxyToTileId");function $y(I){let P=0;for(let O=0;O<27;O++){let N=(1<<O)*(1<<O);if(P+N>I)return mm(O,I-P);P+=N}throw new Error("Tile zoom level exceeds max safe number limit (26)")}ke($y,"tileIdToZxy");var Zy=(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))(Zy||{});function rh(I,P){return Di(this,null,function*(){if(P===1||P===0)return I;if(P===2){if(typeof globalThis.DecompressionStream>"u")return By(new Uint8Array(I));let O=new Response(I).body;if(!O)throw new Error("Failed to read response stream");let N=O.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(N).arrayBuffer()}throw new Error("Compression method not supported")})}ke(rh,"defaultDecompress");var qy=(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))(qy||{});function _m(I){return I===1?".mvt":I===2?".png":I===3?".jpg":I===4?".webp":I===5?".avif":""}ke(_m,"tileTypeExt");var Wy=127;function ym(I,P){let O=0,N=I.length-1;for(;O<=N;){let et=N+O>>1,ht=P-I[et].tileId;if(ht>0)O=et+1;else if(ht<0)N=et-1;else return I[et]}return N>=0&&(I[N].runLength===0||P-I[N].tileId<I[N].runLength)?I[N]:null}ke(ym,"findTile");var Hy=class{constructor(P){this.file=P}getKey(){return this.file.name}getBytes(P,O){return Di(this,null,function*(){return{data:yield this.file.slice(P,P+O).arrayBuffer()}})}};ke(Hy,"FileSource");var xm=class{constructor(P,O=new Headers){this.url=P,this.customHeaders=O,this.mustReload=!1;let N="";"navigator"in globalThis&&(N=globalThis.navigator.userAgent||"");let et=N.indexOf("Windows")>-1,ht=/Chrome|Chromium|Edg|OPR|Brave/.test(N);this.chromeWindowsNoCache=!1,et&&ht&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(P){this.customHeaders=P}getBytes(P,O,N,et){return Di(this,null,function*(){let ht,M;N?M=N:(ht=new AbortController,M=ht.signal);let c=new Headers(this.customHeaders);c.set("range",`bytes=${P}-${P+O-1}`);let dt;this.mustReload?dt="reload":this.chromeWindowsNoCache&&(dt="no-store");let Rt=yield fetch(this.url,{signal:M,cache:dt,headers:c});if(P===0&&Rt.status===416){let Yt=Rt.headers.get("Content-Range");if(!Yt||!Yt.startsWith("bytes */"))throw new Error("Missing content-length on 416 response");let ce=+Yt.substr(8);Rt=yield fetch(this.url,{signal:M,cache:"reload",headers:{range:`bytes=0-${ce-1}`}})}let $t=Rt.headers.get("Etag");if($t!=null&&$t.startsWith("W/")&&($t=null),Rt.status===416||et&&$t&&$t!==et)throw this.mustReload=!0,new Bd(`Server returned non-matching ETag ${et} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(Rt.status>=300)throw new Error(`Bad response code: ${Rt.status}`);let Bt=Rt.headers.get("Content-Length");if(Rt.status===200&&(!Bt||+Bt>O))throw ht&&ht.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 Rt.arrayBuffer(),etag:$t||void 0,cacheControl:Rt.headers.get("Cache-Control")||void 0,expires:Rt.headers.get("Expires")||void 0}})}};ke(xm,"FetchSource");var Xy=xm;function Kr(I,P){let O=I.getUint32(P+4,!0),N=I.getUint32(P+0,!0);return O*vc(2,32)+N}ke(Kr,"getUint64");function vm(I,P){let O=new DataView(I),N=O.getUint8(7);if(N>3)throw new Error(`Archive is spec version ${N} but this library supports up to spec version 3`);return{specVersion:N,rootDirectoryOffset:Kr(O,8),rootDirectoryLength:Kr(O,16),jsonMetadataOffset:Kr(O,24),jsonMetadataLength:Kr(O,32),leafDirectoryOffset:Kr(O,40),leafDirectoryLength:Kr(O,48),tileDataOffset:Kr(O,56),tileDataLength:Kr(O,64),numAddressedTiles:Kr(O,72),numTileEntries:Kr(O,80),numTileContents:Kr(O,88),clustered:O.getUint8(96)===1,internalCompression:O.getUint8(97),tileCompression:O.getUint8(98),tileType:O.getUint8(99),minZoom:O.getUint8(100),maxZoom:O.getUint8(101),minLon:O.getInt32(102,!0)/1e7,minLat:O.getInt32(106,!0)/1e7,maxLon:O.getInt32(110,!0)/1e7,maxLat:O.getInt32(114,!0)/1e7,centerZoom:O.getUint8(118),centerLon:O.getInt32(119,!0)/1e7,centerLat:O.getInt32(123,!0)/1e7,etag:P}}ke(vm,"bytesToHeader");function Ud(I){let P={buf:new Uint8Array(I),pos:0},O=Xo(P),N=[],et=0;for(let ht=0;ht<O;ht++){let M=Xo(P);N.push({tileId:et+M,offset:0,length:0,runLength:1}),et+=M}for(let ht=0;ht<O;ht++)N[ht].runLength=Xo(P);for(let ht=0;ht<O;ht++)N[ht].length=Xo(P);for(let ht=0;ht<O;ht++){let M=Xo(P);M===0&&ht>0?N[ht].offset=N[ht-1].offset+N[ht-1].length:N[ht].offset=M-1}return N}ke(Ud,"deserializeIndex");var bm=class extends Error{};ke(bm,"EtagMismatch");var Bd=bm;function Gd(I,P){return Di(this,null,function*(){let O=yield I.getBytes(0,16384);if(new DataView(O.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");let N=O.data.slice(0,Wy),et=vm(N,O.etag),ht=O.data.slice(et.rootDirectoryOffset,et.rootDirectoryOffset+et.rootDirectoryLength),M=`${I.getKey()}|${et.etag||""}|${et.rootDirectoryOffset}|${et.rootDirectoryLength}`,c=Ud(yield P(ht,et.internalCompression));return[et,[M,c.length,c]]})}ke(Gd,"getHeaderAndRoot");function $d(I,P,O,N,et){return Di(this,null,function*(){let ht=yield I.getBytes(O,N,void 0,et.etag),M=yield P(ht.data,et.internalCompression),c=Ud(M);if(c.length===0)throw new Error("Empty directory is invalid");return c})}ke($d,"getDirectory");var Yy=class{constructor(P=100,O=!0,N=rh){this.cache=new Map,this.maxCacheEntries=P,this.counter=1,this.decompress=N}getHeader(P){return Di(this,null,function*(){let O=P.getKey(),N=this.cache.get(O);if(N)return N.lastUsed=this.counter++,N.data;let et=yield Gd(P,this.decompress);return et[1]&&this.cache.set(et[1][0],{lastUsed:this.counter++,data:et[1][2]}),this.cache.set(O,{lastUsed:this.counter++,data:et[0]}),this.prune(),et[0]})}getDirectory(P,O,N,et){return Di(this,null,function*(){let ht=`${P.getKey()}|${et.etag||""}|${O}|${N}`,M=this.cache.get(ht);if(M)return M.lastUsed=this.counter++,M.data;let c=yield $d(P,this.decompress,O,N,et);return this.cache.set(ht,{lastUsed:this.counter++,data:c}),this.prune(),c})}prune(){if(this.cache.size>this.maxCacheEntries){let P=1/0,O;this.cache.forEach((N,et)=>{N.lastUsed<P&&(P=N.lastUsed,O=et)}),O&&this.cache.delete(O)}}invalidate(P){return Di(this,null,function*(){this.cache.delete(P.getKey())})}};ke(Yy,"ResolvedValueCache");var wm=class{constructor(P=100,O=!0,N=rh){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=P,this.counter=1,this.decompress=N}getHeader(P){return Di(this,null,function*(){let O=P.getKey(),N=this.cache.get(O);if(N)return N.lastUsed=this.counter++,yield N.data;let et=new Promise((ht,M)=>{Gd(P,this.decompress).then(c=>{c[1]&&this.cache.set(c[1][0],{lastUsed:this.counter++,data:Promise.resolve(c[1][2])}),ht(c[0]),this.prune()}).catch(c=>{M(c)})});return this.cache.set(O,{lastUsed:this.counter++,data:et}),et})}getDirectory(P,O,N,et){return Di(this,null,function*(){let ht=`${P.getKey()}|${et.etag||""}|${O}|${N}`,M=this.cache.get(ht);if(M)return M.lastUsed=this.counter++,yield M.data;let c=new Promise((dt,Rt)=>{$d(P,this.decompress,O,N,et).then($t=>{dt($t),this.prune()}).catch($t=>{Rt($t)})});return this.cache.set(ht,{lastUsed:this.counter++,data:c}),c})}prune(){if(this.cache.size>=this.maxCacheEntries){let P=1/0,O;this.cache.forEach((N,et)=>{N.lastUsed<P&&(P=N.lastUsed,O=et)}),O&&this.cache.delete(O)}}invalidate(P){return Di(this,null,function*(){let O=P.getKey();if(this.invalidations.get(O))return yield this.invalidations.get(O);this.cache.delete(P.getKey());let N=new Promise((et,ht)=>{this.getHeader(P).then(M=>{et(),this.invalidations.delete(O)}).catch(M=>{ht(M)})});this.invalidations.set(O,N)})}};ke(wm,"SharedPromiseCache");var Ky=wm,Tm=class{constructor(P,O,N){typeof P=="string"?this.source=new Xy(P):this.source=P,N?this.decompress=N:this.decompress=rh,O?this.cache=O:this.cache=new Ky}getHeader(){return Di(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(P,O,N,et){return Di(this,null,function*(){let ht=gm(P,O,N),M=yield this.cache.getHeader(this.source);if(P<M.minZoom||P>M.maxZoom)return;let c=M.rootDirectoryOffset,dt=M.rootDirectoryLength;for(let Rt=0;Rt<=3;Rt++){let $t=yield this.cache.getDirectory(this.source,c,dt,M),Bt=ym($t,ht);if(Bt){if(Bt.runLength>0){let Yt=yield this.source.getBytes(M.tileDataOffset+Bt.offset,Bt.length,et,M.etag);return{data:yield this.decompress(Yt.data,M.tileCompression),cacheControl:Yt.cacheControl,expires:Yt.expires}}c=M.leafDirectoryOffset+Bt.offset,dt=Bt.length}else return}throw new Error("Maximum directory depth exceeded")})}getZxy(P,O,N,et){return Di(this,null,function*(){try{return yield this.getZxyAttempt(P,O,N,et)}catch(ht){if(ht instanceof Bd)return this.cache.invalidate(this.source),yield this.getZxyAttempt(P,O,N,et);throw ht}})}getMetadataAttempt(){return Di(this,null,function*(){let P=yield this.cache.getHeader(this.source),O=yield this.source.getBytes(P.jsonMetadataOffset,P.jsonMetadataLength,void 0,P.etag),N=yield this.decompress(O.data,P.internalCompression),et=new TextDecoder("utf-8");return JSON.parse(et.decode(N))})}getMetadata(){return Di(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(P){if(P instanceof Bd)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw P}})}getTileJson(P){return Di(this,null,function*(){let O=yield this.getHeader(),N=yield this.getMetadata(),et=_m(O.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${P}/{z}/{x}/{y}${et}`],vector_layers:N.vector_layers,attribution:N.attribution,description:N.description,name:N.name,version:N.version,bounds:[O.minLon,O.minLat,O.maxLon,O.maxLat],center:[O.centerLon,O.centerLat,O.centerZoom],minzoom:O.minZoom,maxzoom:O.maxZoom}})}};ke(Tm,"PMTiles");var Kf=Tm;const Jy={key:0,class:"loading-container"},Qy={key:0,class:"loading-detail"},tx={key:1},ex={key:2,class:"main-container"},ix={class:"navbar",role:"navigation"},rx={class:"sidebar-tabs"},nx={role:"tablist"},sx={class:"sidebar-content"},ax=N_({__name:"App",setup(I){const P=V_().appContext.app,O=Dr("loading"),N=Dr(""),et=Dr(null),ht=Dr(null);let M;return U_(async()=>{try{const c=await Od.create(P);P.provide("tangramApi",c),await dy(c,dt=>{dt.stage==="manifest"?N.value="fetching plugin manifest":dt.stage==="plugin"&&dt.pluginName?N.value=`loading plugin: ${dt.pluginName}`:dt.stage==="done"&&(N.value="starting user interface")}),et.value=c,O.value="ready"}catch(c){console.error("failed to initialise tangram api:",c),O.value="error"}}),zd(()=>et.value?.state.activeEntity,c=>{c&&et.value?.ui.openSidebar()}),zd(ht,c=>{if(c&&et.value&&!M){const dt=et.value.config.map,Rt=new Uy;if(Yf.addProtocol("pmtiles",Rt.tile),typeof dt.style=="object"){const $t=Yt=>{if(Array.isArray(Yt))return Yt.map($t);if(typeof Yt=="string"){if(Yt.includes("#ROOT#")){const ce=window.location.origin+window.location.pathname.replace(/\/[^\/]*$/,"/");return Yt.replace(/#ROOT#/g,ce)}return Yt}return Yt!==null&&typeof Yt=="object"?Object.entries(Yt).reduce((ce,[Xe,qt])=>(qt!=null&&(ce[Xe]=$t(qt)),ce),{}):Yt},Bt=$t(dt.style);Bt.layers||(Bt.layers=sm("protomaps",nm("light"),{lang:dt.lang})),dt.style=Bt}M=new Yf.Map({container:c,style:dt.style,center:[dt.center_lon,dt.center_lat],zoom:dt.zoom,pitch:dt.pitch,bearing:dt.bearing,attributionControl:!1}),et.value.map.initialize(M)}}),G_(()=>{et.value?.map.dispose(),M&&(M.remove(),M=void 0)}),(c,dt)=>O.value==="loading"?(jn(),Ga("div",Jy,[dt[1]||(dt[1]=dr("div",null,"initialising tangram…",-1)),N.value?(jn(),Ga("div",Qy,$_(N.value),1)):Hf("",!0)])):O.value==="error"?(jn(),Ga("div",tx," error: could not connect to the tangram backend. ")):O.value==="ready"&&et.value?(jn(),Ga("div",ex,[dr("div",ix,[dt[2]||(dt[2]=dr("div",{class:"navbar-brand"},[dr("img",{src:H_,alt:"tangram",class:"navbar-logo"}),dr("span",{class:"navbar-title"},"tangram")],-1)),dt[3]||(dt[3]=dr("div",{class:"navbar-spacer"},null,-1)),(jn(!0),Ga(Md,null,Id(et.value.ui.widgets.TopBar,Rt=>(jn(),Ed(Cd(Rt.id),{key:Rt.id}))),128))]),dr("div",{id:"sidebar",class:Z_(["sidebar",{collapsed:!et.value.state.activeEntity||et.value.ui.isSidebarCollapsed}])},[dr("div",rx,[dr("ul",nx,[dr("li",null,[dr("a",{role:"tab",onClick:dt[0]||(dt[0]=Rt=>et.value.ui.toggleSidebar())},[...dt[4]||(dt[4]=[dr("span",{class:"fa fa-plane"},null,-1)])])])])]),dr("div",sx,[(jn(!0),Ga(Md,null,Id(et.value.ui.widgets.SideBar,Rt=>(jn(),Ed(Cd(Rt.id),{key:Rt.id}))),128))])],2),dr("div",{ref_key:"mapContainer",ref:ht,class:"map-container"},[(jn(!0),Ga(Md,null,Id(et.value.ui.widgets.MapOverlay,Rt=>(jn(),Ed(Cd(Rt.id),{key:Rt.id}))),128))],512)])):Hf("",!0)}});q_(ax).mount("#app");
|
|
821
|
+
//# sourceMappingURL=index-r8T0kY2p.js.map
|