'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

/*! @navvo/maps-js v0.1.0 | (c) 2026 Navvo | MIT License | https://docs.navvo.io */
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  __defProp(target, "default", { value: mod, enumerable: true }) ,
  mod
));

// node_modules/maplibre-gl/dist/maplibre-gl.js
var require_maplibre_gl = __commonJS({
  "node_modules/maplibre-gl/dist/maplibre-gl.js"(exports, module) {
    (function(global, factory) {
      typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.maplibregl = factory());
    })(exports, (function() {
      var maplibregl2 = {};
      var modules = {};
      function define2(moduleName, _dependencies, moduleFactory) {
        modules[moduleName] = moduleFactory;
        if (moduleName !== "index") {
          return;
        }
        var workerBundleString = "var sharedModule = {}; (" + modules.shared + ")(sharedModule); (" + modules.worker + ")(sharedModule);";
        var sharedModule = {};
        modules.shared(sharedModule);
        modules.index(maplibregl2, sharedModule);
        if (typeof window !== "undefined") {
          maplibregl2.setWorkerUrl(window.URL.createObjectURL(new Blob([workerBundleString], { type: "text/javascript" })));
        }
        return maplibregl2;
      }
      define2("shared", ["exports"], (function(t) {
        function e(t2, e2, n2, r2) {
          return new (n2 || (n2 = Promise))((function(i2, s2) {
            function o2(t3) {
              try {
                l2(r2.next(t3));
              } catch (t4) {
                s2(t4);
              }
            }
            function a2(t3) {
              try {
                l2(r2.throw(t3));
              } catch (t4) {
                s2(t4);
              }
            }
            function l2(t3) {
              var e3;
              t3.done ? i2(t3.value) : (e3 = t3.value, e3 instanceof n2 ? e3 : new n2((function(t4) {
                t4(e3);
              }))).then(o2, a2);
            }
            l2((r2 = r2.apply(t2, e2 || [])).next());
          }));
        }
        function n(t2, e2) {
          this.x = t2, this.y = e2;
        }
        function r(t2) {
          return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
        }
        var i, s;
        "function" == typeof SuppressedError && SuppressedError, n.prototype = { clone() {
          return new n(this.x, this.y);
        }, add(t2) {
          return this.clone()._add(t2);
        }, sub(t2) {
          return this.clone()._sub(t2);
        }, multByPoint(t2) {
          return this.clone()._multByPoint(t2);
        }, divByPoint(t2) {
          return this.clone()._divByPoint(t2);
        }, mult(t2) {
          return this.clone()._mult(t2);
        }, div(t2) {
          return this.clone()._div(t2);
        }, rotate(t2) {
          return this.clone()._rotate(t2);
        }, rotateAround(t2, e2) {
          return this.clone()._rotateAround(t2, e2);
        }, matMult(t2) {
          return this.clone()._matMult(t2);
        }, 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(t2) {
          return this.x === t2.x && this.y === t2.y;
        }, dist(t2) {
          return Math.sqrt(this.distSqr(t2));
        }, distSqr(t2) {
          const e2 = t2.x - this.x, n2 = t2.y - this.y;
          return e2 * e2 + n2 * n2;
        }, angle() {
          return Math.atan2(this.y, this.x);
        }, angleTo(t2) {
          return Math.atan2(this.y - t2.y, this.x - t2.x);
        }, angleWith(t2) {
          return this.angleWithSep(t2.x, t2.y);
        }, angleWithSep(t2, e2) {
          return Math.atan2(this.x * e2 - this.y * t2, this.x * t2 + this.y * e2);
        }, _matMult(t2) {
          const e2 = t2[2] * this.x + t2[3] * this.y;
          return this.x = t2[0] * this.x + t2[1] * this.y, this.y = e2, this;
        }, _add(t2) {
          return this.x += t2.x, this.y += t2.y, this;
        }, _sub(t2) {
          return this.x -= t2.x, this.y -= t2.y, this;
        }, _mult(t2) {
          return this.x *= t2, this.y *= t2, this;
        }, _div(t2) {
          return this.x /= t2, this.y /= t2, this;
        }, _multByPoint(t2) {
          return this.x *= t2.x, this.y *= t2.y, this;
        }, _divByPoint(t2) {
          return this.x /= t2.x, this.y /= t2.y, this;
        }, _unit() {
          return this._div(this.mag()), this;
        }, _perp() {
          const t2 = this.y;
          return this.y = this.x, this.x = -t2, this;
        }, _rotate(t2) {
          const e2 = Math.cos(t2), n2 = Math.sin(t2), r2 = n2 * this.x + e2 * this.y;
          return this.x = e2 * this.x - n2 * this.y, this.y = r2, this;
        }, _rotateAround(t2, e2) {
          const n2 = Math.cos(t2), r2 = Math.sin(t2), i2 = e2.y + r2 * (this.x - e2.x) + n2 * (this.y - e2.y);
          return this.x = e2.x + n2 * (this.x - e2.x) - r2 * (this.y - e2.y), this.y = i2, this;
        }, _round() {
          return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
        }, constructor: n }, n.convert = function(t2) {
          if (t2 instanceof n) return t2;
          if (Array.isArray(t2)) return new n(+t2[0], +t2[1]);
          if (void 0 !== t2.x && void 0 !== t2.y) return new n(+t2.x, +t2.y);
          throw new Error("Expected [x, y] or {x, y} point format");
        };
        var o = (function() {
          if (s) return i;
          function t2(t3, e2, n2, r2) {
            this.cx = 3 * t3, this.bx = 3 * (n2 - t3) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e2, this.by = 3 * (r2 - e2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t3, this.p1y = e2, this.p2x = n2, this.p2y = r2;
          }
          return s = 1, i = t2, t2.prototype = { sampleCurveX: function(t3) {
            return ((this.ax * t3 + this.bx) * t3 + this.cx) * t3;
          }, sampleCurveY: function(t3) {
            return ((this.ay * t3 + this.by) * t3 + this.cy) * t3;
          }, sampleCurveDerivativeX: function(t3) {
            return (3 * this.ax * t3 + 2 * this.bx) * t3 + this.cx;
          }, solveCurveX: function(t3, e2) {
            if (void 0 === e2 && (e2 = 1e-6), t3 < 0) return 0;
            if (t3 > 1) return 1;
            for (var n2 = t3, r2 = 0; r2 < 8; r2++) {
              var i2 = this.sampleCurveX(n2) - t3;
              if (Math.abs(i2) < e2) return n2;
              var s2 = this.sampleCurveDerivativeX(n2);
              if (Math.abs(s2) < 1e-6) break;
              n2 -= i2 / s2;
            }
            var o2 = 0, a2 = 1;
            for (n2 = t3, r2 = 0; r2 < 20 && (i2 = this.sampleCurveX(n2), !(Math.abs(i2 - t3) < e2)); r2++) t3 > i2 ? o2 = n2 : a2 = n2, n2 = 0.5 * (a2 - o2) + o2;
            return n2;
          }, solve: function(t3, e2) {
            return this.sampleCurveY(this.solveCurveX(t3, e2));
          } }, i;
        })(), a = r(o);
        let l, u;
        function c() {
          return null != l || (l = "undefined" != typeof OffscreenCanvas && new OffscreenCanvas(1, 1).getContext("2d") && "function" == typeof createImageBitmap), l;
        }
        function h() {
          if (null == u && (u = false, c())) {
            const t2 = 5, e2 = new OffscreenCanvas(t2, t2).getContext("2d", { willReadFrequently: true });
            if (e2) {
              for (let n3 = 0; n3 < t2 * t2; n3++) {
                const r2 = 4 * n3;
                e2.fillStyle = `rgb(${r2},${r2 + 1},${r2 + 2})`, e2.fillRect(n3 % t2, Math.floor(n3 / t2), 1, 1);
              }
              const n2 = e2.getImageData(0, 0, t2, t2).data;
              for (let e3 = 0; e3 < t2 * t2 * 4; e3++) if (e3 % 4 != 3 && n2[e3] !== e3) {
                u = true;
                break;
              }
            }
          }
          return u || false;
        }
        var p = 1e-6, f = "undefined" != typeof Float32Array ? Float32Array : Array;
        function d() {
          var t2 = new f(9);
          return f != Float32Array && (t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[5] = 0, t2[6] = 0, t2[7] = 0), t2[0] = 1, t2[4] = 1, t2[8] = 1, t2;
        }
        function y(t2) {
          return t2[0] = 1, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = 1, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = 1, t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0, t2[15] = 1, t2;
        }
        function m() {
          var t2 = new f(3);
          return f != Float32Array && (t2[0] = 0, t2[1] = 0, t2[2] = 0), t2;
        }
        function g(t2) {
          var e2 = t2[0], n2 = t2[1], r2 = t2[2];
          return Math.sqrt(e2 * e2 + n2 * n2 + r2 * r2);
        }
        function x(t2, e2, n2) {
          var r2 = new f(3);
          return r2[0] = t2, r2[1] = e2, r2[2] = n2, r2;
        }
        function v(t2, e2, n2) {
          return t2[0] = e2[0] + n2[0], t2[1] = e2[1] + n2[1], t2[2] = e2[2] + n2[2], t2;
        }
        function b(t2, e2, n2) {
          return t2[0] = e2[0] * n2, t2[1] = e2[1] * n2, t2[2] = e2[2] * n2, t2;
        }
        function w(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1], s2 = e2[2], o2 = n2[0], a2 = n2[1], l2 = n2[2];
          return t2[0] = i2 * l2 - s2 * a2, t2[1] = s2 * o2 - r2 * l2, t2[2] = r2 * a2 - i2 * o2, t2;
        }
        var _, S = g;
        function A(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1], s2 = e2[2], o2 = e2[3];
          return t2[0] = n2[0] * r2 + n2[4] * i2 + n2[8] * s2 + n2[12] * o2, t2[1] = n2[1] * r2 + n2[5] * i2 + n2[9] * s2 + n2[13] * o2, t2[2] = n2[2] * r2 + n2[6] * i2 + n2[10] * s2 + n2[14] * o2, t2[3] = n2[3] * r2 + n2[7] * i2 + n2[11] * s2 + n2[15] * o2, t2;
        }
        function M() {
          var t2 = new f(4);
          return f != Float32Array && (t2[0] = 0, t2[1] = 0, t2[2] = 0), t2[3] = 1, t2;
        }
        function k(t2, e2, n2, r2) {
          var i2 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "zyx", s2 = Math.PI / 360;
          e2 *= s2, r2 *= s2, n2 *= s2;
          var o2 = Math.sin(e2), a2 = Math.cos(e2), l2 = Math.sin(n2), u2 = Math.cos(n2), c2 = Math.sin(r2), h2 = Math.cos(r2);
          switch (i2) {
            case "xyz":
              t2[0] = o2 * u2 * h2 + a2 * l2 * c2, t2[1] = a2 * l2 * h2 - o2 * u2 * c2, t2[2] = a2 * u2 * c2 + o2 * l2 * h2, t2[3] = a2 * u2 * h2 - o2 * l2 * c2;
              break;
            case "xzy":
              t2[0] = o2 * u2 * h2 - a2 * l2 * c2, t2[1] = a2 * l2 * h2 - o2 * u2 * c2, t2[2] = a2 * u2 * c2 + o2 * l2 * h2, t2[3] = a2 * u2 * h2 + o2 * l2 * c2;
              break;
            case "yxz":
              t2[0] = o2 * u2 * h2 + a2 * l2 * c2, t2[1] = a2 * l2 * h2 - o2 * u2 * c2, t2[2] = a2 * u2 * c2 - o2 * l2 * h2, t2[3] = a2 * u2 * h2 + o2 * l2 * c2;
              break;
            case "yzx":
              t2[0] = o2 * u2 * h2 + a2 * l2 * c2, t2[1] = a2 * l2 * h2 + o2 * u2 * c2, t2[2] = a2 * u2 * c2 - o2 * l2 * h2, t2[3] = a2 * u2 * h2 - o2 * l2 * c2;
              break;
            case "zxy":
              t2[0] = o2 * u2 * h2 - a2 * l2 * c2, t2[1] = a2 * l2 * h2 + o2 * u2 * c2, t2[2] = a2 * u2 * c2 + o2 * l2 * h2, t2[3] = a2 * u2 * h2 - o2 * l2 * c2;
              break;
            case "zyx":
              t2[0] = o2 * u2 * h2 - a2 * l2 * c2, t2[1] = a2 * l2 * h2 + o2 * u2 * c2, t2[2] = a2 * u2 * c2 - o2 * l2 * h2, t2[3] = a2 * u2 * h2 + o2 * l2 * c2;
              break;
            default:
              throw new Error("Unknown angle order " + i2);
          }
          return t2;
        }
        function I() {
          var t2 = new f(2);
          return f != Float32Array && (t2[0] = 0, t2[1] = 0), t2;
        }
        function E(t2, e2) {
          var n2 = new f(2);
          return n2[0] = t2, n2[1] = e2, n2;
        }
        m(), _ = new f(4), f != Float32Array && (_[0] = 0, _[1] = 0, _[2] = 0, _[3] = 0), m(), x(1, 0, 0), x(0, 1, 0), M(), M(), d(), I();
        const T = 8192;
        function F(t2, e2, n2) {
          return e2 * (T / (t2.tileSize * Math.pow(2, n2 - t2.tileID.overscaledZ)));
        }
        function P(t2) {
          return t2 instanceof Error ? t2 : new Error("string" == typeof t2 ? t2 : String(t2));
        }
        function D(t2, e2) {
          return (t2 % e2 + e2) % e2;
        }
        function z(t2, e2, n2) {
          return t2 * (1 - n2) + e2 * n2;
        }
        function B(t2) {
          if (t2 <= 0) return 0;
          if (t2 >= 1) return 1;
          const e2 = t2 * t2, n2 = e2 * t2;
          return 4 * (t2 < 0.5 ? n2 : 3 * (t2 - e2) + n2 - 0.75);
        }
        function C(t2, e2, n2, r2) {
          const i2 = new a(t2, e2, n2, r2);
          return (t3) => i2.solve(t3);
        }
        const V = C(0.25, 0.1, 0.25, 1);
        function L(t2, e2, n2) {
          return Math.min(n2, Math.max(e2, t2));
        }
        function O(t2, e2, n2) {
          const r2 = n2 - e2, i2 = ((t2 - e2) % r2 + r2) % r2 + e2;
          return i2 === e2 ? n2 : i2;
        }
        function $(t2, ...e2) {
          for (const n2 of e2) for (const e3 in n2) t2[e3] = n2[e3];
          return t2;
        }
        let R = 1;
        function N(t2, e2, n2) {
          const r2 = {};
          for (const n3 in t2) r2[n3] = e2.call(this, t2[n3], n3, t2);
          return r2;
        }
        function U(t2, e2, n2) {
          const r2 = {};
          for (const n3 in t2) e2.call(this, t2[n3], n3, t2) && (r2[n3] = t2[n3]);
          return r2;
        }
        function j(t2) {
          return Array.isArray(t2) ? t2.map(j) : "object" == typeof t2 && t2 ? N(t2, j) : t2;
        }
        const q = {};
        function G(t2) {
          q[t2] || ("undefined" != typeof console && console.warn(t2), q[t2] = true);
        }
        function X(t2, e2, n2) {
          return (n2.y - t2.y) * (e2.x - t2.x) > (e2.y - t2.y) * (n2.x - t2.x);
        }
        function Y(t2) {
          return "undefined" != typeof WorkerGlobalScope && void 0 !== t2 && t2 instanceof WorkerGlobalScope;
        }
        let Z = null;
        function H(t2) {
          return "undefined" != typeof ImageBitmap && t2 instanceof ImageBitmap;
        }
        const W = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
        function K(t2, n2, r2, i2, s2) {
          return e(this, void 0, void 0, (function* () {
            if ("undefined" == typeof VideoFrame) throw new Error("VideoFrame not supported");
            const e2 = new VideoFrame(t2, { timestamp: 0 });
            try {
              const o2 = null == e2 ? void 0 : e2.format;
              if (!o2 || !o2.startsWith("BGR") && !o2.startsWith("RGB")) throw new Error(`Unrecognized format ${o2}`);
              const a2 = o2.startsWith("BGR"), l2 = new Uint8ClampedArray(i2 * s2 * 4);
              if (yield e2.copyTo(l2, (function(t3, e3, n3, r3, i3) {
                const s3 = 4 * Math.max(-e3, 0), o3 = (Math.max(0, n3) - n3) * r3 * 4 + s3, a3 = 4 * r3, l3 = Math.max(0, e3), u2 = Math.max(0, n3);
                return { rect: { x: l3, y: u2, width: Math.min(t3.width, e3 + r3) - l3, height: Math.min(t3.height, n3 + i3) - u2 }, layout: [{ offset: o3, stride: a3 }] };
              })(t2, n2, r2, i2, s2)), a2) for (let t3 = 0; t3 < l2.length; t3 += 4) {
                const e3 = l2[t3];
                l2[t3] = l2[t3 + 2], l2[t3 + 2] = e3;
              }
              return l2;
            } finally {
              e2.close();
            }
          }));
        }
        let J, Q;
        function tt(t2, e2, n2, r2) {
          return t2.addEventListener(e2, n2, r2), { unsubscribe: () => {
            t2.removeEventListener(e2, n2, r2);
          } };
        }
        function et(t2) {
          return t2 * Math.PI / 180;
        }
        function nt(t2) {
          return t2 / Math.PI * 180;
        }
        const rt = { touchstart: true, touchmove: true, touchmoveWindow: true, touchend: true, touchcancel: true }, it = { dblclick: true, click: true, mouseover: true, mouseout: true, mousedown: true, mousemove: true, mousemoveWindow: true, mouseup: true, mouseupWindow: true, contextmenu: true, wheel: true }, st = "AbortError";
        class ot extends Error {
          constructor(t2 = st) {
            super(t2 instanceof Error ? t2.message : t2), this.name = st, t2 instanceof Error && t2.stack && (this.stack = t2.stack);
          }
        }
        function at(t2) {
          return t2 instanceof Error && t2.name === st;
        }
        function lt(t2) {
          if (t2.aborted) throw new ot(t2.reason);
        }
        const ut = { MAX_PARALLEL_IMAGE_REQUESTS: 16, MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: 8, MAX_TILE_CACHE_ZOOM_LEVELS: 5, REGISTERED_PROTOCOLS: {}, WORKER_URL: "" };
        function ct(t2) {
          return ut.REGISTERED_PROTOCOLS[t2.substring(0, t2.indexOf("://"))];
        }
        const ht = "global-dispatcher";
        class pt extends Error {
          constructor(t2, e2, n2, r2) {
            super(`AJAXError: ${e2} (${t2}): ${n2}`), this.status = t2, this.statusText = e2, this.url = n2, this.body = r2;
          }
        }
        const ft = () => {
          var t2;
          return Y(self) ? null === (t2 = self.worker) || void 0 === t2 ? void 0 : t2.referrer : ("blob:" === window.location.protocol ? window.parent : window).location.href;
        }, dt = function(t2, n2) {
          return e(this, void 0, void 0, (function* () {
            var r2, i2;
            if (t2.url.includes("://") && !/^https?:|^file:/.test(t2.url)) {
              const e2 = ct(t2.url);
              if (e2) {
                const r3 = yield e2(t2, n2);
                return r3.data || "arrayBuffer" !== t2.type ? r3 : $(r3, { data: new ArrayBuffer(0) });
              }
              if (Y(self) && (null === (r2 = self.worker) || void 0 === r2 ? void 0 : r2.actor)) return self.worker.actor.sendAsync({ type: "GR", data: t2, targetMapId: ht }, n2);
            }
            if (!((t3) => {
              var e2;
              return t3.startsWith("file:") || (null === (e2 = ft()) || void 0 === e2 ? void 0 : e2.startsWith("file:")) && !/^\w+:/.test(t3);
            })(t2.url)) {
              if (fetch && Request && AbortController && Object.hasOwn(Request.prototype, "signal")) return (function(t3, n3) {
                return e(this, void 0, void 0, (function* () {
                  const e2 = new Request(t3.url, { method: t3.method || "GET", body: t3.body, credentials: t3.credentials, headers: t3.headers, cache: t3.cache, referrer: ft(), referrerPolicy: t3.referrerPolicy, signal: n3.signal });
                  let r3, i3;
                  "json" !== t3.type || e2.headers.has("Accept") || e2.headers.set("Accept", "application/json");
                  try {
                    r3 = yield fetch(e2);
                  } catch (e3) {
                    if (at(e3)) throw e3;
                    throw new pt(0, P(e3).message, t3.url, new Blob());
                  }
                  if (!r3.ok) {
                    const e3 = yield r3.blob();
                    throw new pt(r3.status, r3.statusText, t3.url, e3);
                  }
                  i3 = "arrayBuffer" === t3.type || "image" === t3.type ? r3.arrayBuffer() : "json" === t3.type ? r3.json() : r3.text();
                  const s2 = yield i3;
                  return lt(n3.signal), { data: s2, cacheControl: r3.headers.get("Cache-Control"), expires: r3.headers.get("Expires"), etag: r3.headers.get("ETag") };
                }));
              })(t2, n2);
              if (Y(self) && (null === (i2 = self.worker) || void 0 === i2 ? void 0 : i2.actor)) return self.worker.actor.sendAsync({ type: "GR", data: t2, mustQueue: true, targetMapId: ht }, n2);
            }
            return (function(t3, e2) {
              return new Promise(((n3, r3) => {
                var i3;
                const s2 = new XMLHttpRequest();
                s2.open(t3.method || "GET", t3.url, true), "arrayBuffer" !== t3.type && "image" !== t3.type || (s2.responseType = "arraybuffer");
                for (const e3 in t3.headers) s2.setRequestHeader(e3, t3.headers[e3]);
                "json" === t3.type && (s2.responseType = "text", (null === (i3 = t3.headers) || void 0 === i3 ? void 0 : i3.Accept) || s2.setRequestHeader("Accept", "application/json")), s2.withCredentials = "include" === t3.credentials, s2.onerror = () => {
                  r3(new Error(s2.statusText));
                }, s2.onload = () => {
                  if (!e2.signal.aborted) if ((s2.status >= 200 && s2.status < 300 || 0 === s2.status) && null !== s2.response) {
                    let e3 = s2.response;
                    if ("json" === t3.type) try {
                      e3 = JSON.parse(s2.response);
                    } catch (t4) {
                      return void r3(t4);
                    }
                    n3({ data: e3, cacheControl: s2.getResponseHeader("Cache-Control"), expires: s2.getResponseHeader("Expires"), etag: s2.getResponseHeader("ETag") });
                  } else {
                    const e3 = new Blob([s2.response], { type: s2.getResponseHeader("Content-Type") });
                    r3(new pt(s2.status, s2.statusText, t3.url, e3));
                  }
                }, e2.signal.addEventListener("abort", (() => {
                  s2.abort(), r3(new ot(e2.signal.reason));
                })), s2.send(t3.body);
              }));
            })(t2, n2);
          }));
        };
        function yt(t2) {
          if (!t2 || t2.indexOf("://") <= 0 || t2.startsWith("data:image/") || t2.startsWith("blob:")) return true;
          const e2 = new URL(t2), n2 = window.location;
          return e2.protocol === n2.protocol && e2.host === n2.host;
        }
        function mt(t2, e2, n2) {
          var r2;
          (null === (r2 = n2[t2]) || void 0 === r2 ? void 0 : r2.includes(e2)) || (n2[t2] || (n2[t2] = []), n2[t2].push(e2));
        }
        function gt(t2, e2, n2) {
          if (null == n2 ? void 0 : n2[t2]) {
            const r2 = n2[t2].indexOf(e2);
            -1 !== r2 && n2[t2].splice(r2, 1);
          }
        }
        class xt {
          constructor(t2, e2 = {}) {
            $(this, e2), this.type = t2;
          }
        }
        class vt extends xt {
          constructor(t2, e2 = {}) {
            super("error", $({ error: t2 }, e2));
          }
        }
        class bt {
          on(t2, e2) {
            return this._listeners || (this._listeners = {}), mt(t2, e2, this._listeners), { unsubscribe: () => {
              this.off(t2, e2);
            } };
          }
          off(t2, e2) {
            return gt(t2, e2, this._listeners), gt(t2, e2, this._oneTimeListeners), this;
          }
          once(t2, e2) {
            return e2 ? (this._oneTimeListeners || (this._oneTimeListeners = {}), mt(t2, e2, this._oneTimeListeners), this) : new Promise(((e3) => this.once(t2, e3)));
          }
          fire(t2, e2) {
            var n2, r2;
            "string" == typeof t2 && (t2 = new xt(t2, e2 || {}));
            const i2 = t2.type;
            if (this.listens(i2)) {
              t2.target = this;
              const e3 = (null === (n2 = this._listeners) || void 0 === n2 ? void 0 : n2[i2]) ? this._listeners[i2].slice() : [];
              for (const n3 of e3) n3.call(this, t2);
              const s2 = (null === (r2 = this._oneTimeListeners) || void 0 === r2 ? void 0 : r2[i2]) ? this._oneTimeListeners[i2].slice() : [];
              for (const e4 of s2) gt(i2, e4, this._oneTimeListeners), e4.call(this, t2);
              const o2 = this._eventedParent;
              o2 && ($(t2, "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData), o2.fire(t2));
            } else t2 instanceof vt && console.error(t2.error);
            return this;
          }
          listens(t2) {
            var e2, n2, r2, i2, s2;
            return (null === (n2 = null === (e2 = this._listeners) || void 0 === e2 ? void 0 : e2[t2]) || void 0 === n2 ? void 0 : n2.length) > 0 || (null === (i2 = null === (r2 = this._oneTimeListeners) || void 0 === r2 ? void 0 : r2[t2]) || void 0 === i2 ? void 0 : i2.length) > 0 || (null === (s2 = this._eventedParent) || void 0 === s2 ? void 0 : s2.listens(t2));
          }
          setEventedParent(t2, e2) {
            return this._eventedParent = t2, this._eventedParentData = e2, this;
          }
        }
        var wt = { $version: 8, $root: { version: { required: true, type: "enum", values: [8] }, name: { type: "string" }, metadata: { type: "*" }, center: { type: "array", value: "number", length: 2 }, centerAltitude: { type: "number" }, zoom: { type: "number" }, bearing: { type: "number", default: 0, period: 360, units: "degrees" }, pitch: { type: "number", default: 0, units: "degrees" }, roll: { type: "number", default: 0, units: "degrees" }, state: { type: "state", default: {} }, light: { type: "light" }, sky: { type: "sky" }, projection: { type: "projection" }, terrain: { type: "terrain" }, sources: { required: true, type: "sources" }, sprite: { type: "sprite" }, glyphs: { type: "string" }, "font-faces": { type: "fontFaces" }, transition: { type: "transition" }, layers: { required: true, type: "array", value: "layer" } }, sources: { "*": { type: "source" } }, source: ["source_vector", "source_raster", "source_raster_dem", "source_geojson", "source_video", "source_image"], source_vector: { type: { required: true, type: "enum", values: { vector: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, attribution: { type: "string" }, promoteId: { type: "promoteId" }, volatile: { type: "boolean", default: false }, encoding: { type: "enum", values: { mvt: {}, mlt: {} }, default: "mvt" }, "*": { type: "*" } }, source_raster: { type: { required: true, type: "enum", values: { raster: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, attribution: { type: "string" }, volatile: { type: "boolean", default: false }, "*": { type: "*" } }, source_raster_dem: { type: { required: true, type: "enum", values: { "raster-dem": {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, attribution: { type: "string" }, encoding: { type: "enum", values: { terrarium: {}, mapbox: {}, 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: false }, "*": { type: "*" } }, source_geojson: { type: { required: true, type: "enum", values: { geojson: {} } }, data: { required: true, type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, filter: { type: "filter" }, tolerance: { type: "number", default: 0.375 }, cluster: { type: "boolean", default: false }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterMinPoints: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: false }, generateId: { type: "boolean", default: false }, promoteId: { type: "promoteId" } }, source_video: { type: { required: true, type: "enum", values: { video: {} } }, urls: { required: true, type: "array", value: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: true, type: "enum", values: { image: {} } }, url: { required: true, type: "string" }, coordinates: { required: true, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: true }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, "color-relief": {}, background: {} }, required: true }, metadata: { type: "*" }, source: { type: "string" }, "source-layer": { type: "string" }, minzoom: { type: "number", minimum: 0, maximum: 24 }, maxzoom: { type: "number", minimum: 0, maximum: 24 }, filter: { type: "filter" }, layout: { type: "layout" }, paint: { type: "paint" } }, layout: ["layout_fill", "layout_line", "layout_circle", "layout_heatmap", "layout_fill-extrusion", "layout_symbol", "layout_raster", "layout_hillshade", "layout_color-relief", "layout_background"], layout_background: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_fill: { "fill-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_circle: { "circle-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_heatmap: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, "layout_fill-extrusion": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_line: { "line-cap": { type: "enum", values: { butt: {}, round: {}, square: {} }, default: "butt", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_symbol: { "symbol-placement": { type: "enum", values: { point: {}, line: {}, "line-center": {} }, default: "point", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: false, requires: ["icon-image", { "!": "icon-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: false, requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: false, requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-size": { type: "number", default: 1, minimum: 0, units: "factor of the original icon size", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-text-fit": { type: "enum", values: { none: {}, width: {}, height: {}, both: {} }, default: "none", requires: ["icon-image", "text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-text-fit-padding": { type: "array", value: "number", length: 4, default: [0, 0, 0, 0], units: "pixels", requires: ["icon-image", "text-field", { "icon-text-fit": ["both", "width", "height"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "padding", default: [2], units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-keep-upright": { type: "boolean", default: false, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, "viewport-glyph": {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"], requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-radial-offset": { type: "number", units: "ems", default: 0, requires: ["text-field"], "property-type": "data-driven", expression: { interpolated: true, parameters: ["zoom", "feature"] } }, "text-variable-anchor": { type: "array", value: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-variable-anchor-offset": { type: "variableAnchorOffsetCollection", requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: true, 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: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-angle": { type: "number", default: 45, units: "degrees", requires: ["text-field", { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: true, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-offset": { type: "array", value: "number", units: "ems", length: 2, default: [0, 0], requires: ["text-field", { "!": "text-radial-offset" }], expression: { interpolated: true, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: false, requires: ["text-field", { "!": "text-overlap" }], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: false, requires: ["text-field"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: false, requires: ["text-field", "icon-image"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_raster: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, layout_hillshade: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, "layout_color-relief": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", expression: { interpolated: false, parameters: ["global-state"] }, "property-type": "data-constant" } }, filter: { type: "boolean", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, filter_operator: { type: "enum", values: { "==": {}, "!=": {}, ">": {}, ">=": {}, "<": {}, "<=": {}, in: {}, "!in": {}, all: {}, any: {}, none: {}, has: {}, "!has": {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: false } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "expression_name", minimum: 1 }, light: { anchor: { type: "enum", default: "viewport", values: { map: {}, viewport: {} }, "property-type": "data-constant", transition: false, expression: { interpolated: false, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: true, expression: { interpolated: true, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, intensity: { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true } }, sky: { "sky-color": { type: "color", "property-type": "data-constant", default: "#88C6FC", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "horizon-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "fog-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "fog-ground-blend": { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "horizon-fog-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "sky-horizon-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true }, "atmosphere-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: true, parameters: ["zoom"] }, transition: true } }, terrain: { source: { type: "string", required: true }, exaggeration: { type: "number", minimum: 0, default: 1 } }, projection: { type: { type: "projectionDefinition", default: "mercator", "property-type": "data-constant", transition: false, expression: { interpolated: true, 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: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: true, requires: [{ "!": "fill-pattern" }, { "fill-antialias": true }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: true, requires: ["fill-extrusion-height"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: true, transition: false, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "line-pattern" }], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: true, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: false, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: true } }], expression: { interpolated: true, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: true, units: "pixels", expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: false, expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "heatmap-color": { type: "color", default: ["interpolate", ["linear"], ["heatmap-density"], 0, "rgba(0, 0, 255, 0)", 0.1, "royalblue", 0.3, "cyan", 0.5, "lime", 0.7, "yellow", 1, "red"], transition: false, expression: { interpolated: true, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["icon-image"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: true, overridable: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: true, requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: true, units: "pixels", requires: ["text-field"], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: true, units: "degrees", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, resampling: { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: false, units: "milliseconds", expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "numberArray", default: 335, minimum: 0, maximum: 359, transition: false, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-altitude": { type: "numberArray", default: 45, minimum: 0, maximum: 90, transition: false, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: 0.5, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "colorArray", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "colorArray", default: "#FFFFFF", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-method": { type: "enum", values: { standard: {}, basic: {}, combined: {}, igor: {}, multidirectional: {} }, default: "standard", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" }, resampling: { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, "paint_color-relief": { "color-relief-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "color-relief-color": { type: "color", transition: false, expression: { interpolated: true, parameters: ["elevation"] }, "property-type": "color-ramp" }, resampling: { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: true, requires: [{ "!": "background-pattern" }], expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: true, expression: { interpolated: false, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: true, expression: { interpolated: true, parameters: ["zoom"] }, "property-type": "data-constant" } }, transition: { duration: { type: "number", default: 300, minimum: 0, units: "milliseconds" }, delay: { type: "number", default: 0, minimum: 0, units: "milliseconds" } }, "property-type": { "data-driven": { type: "property-type" }, "cross-faded": { type: "property-type" }, "cross-faded-data-driven": { type: "property-type" }, "color-ramp": { type: "property-type" }, "data-constant": { type: "property-type" }, constant: { type: "property-type" } }, promoteId: { "*": { type: "string" } }, interpolation: { type: "array", value: "interpolation_name", minimum: 1 }, interpolation_name: { type: "enum", values: { linear: { syntax: { overloads: [{ parameters: [], "output-type": "interpolation" }], parameters: [] } }, exponential: { syntax: { overloads: [{ parameters: ["base"], "output-type": "interpolation" }], parameters: [{ name: "base", type: "number literal" }] } }, "cubic-bezier": { syntax: { overloads: [{ parameters: ["x1", "y1", "x2", "y2"], "output-type": "interpolation" }], parameters: [{ name: "x1", type: "number literal" }, { name: "y1", type: "number literal" }, { name: "x2", type: "number literal" }, { name: "y2", type: "number literal" }] } } } } };
        const _t = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
        function St(t2, e2) {
          const n2 = {};
          for (const e3 in t2) "ref" !== e3 && (n2[e3] = t2[e3]);
          return _t.forEach(((t3) => {
            t3 in e2 && (n2[t3] = e2[t3]);
          })), n2;
        }
        function At(t2, e2) {
          if (Array.isArray(t2)) {
            if (!Array.isArray(e2) || t2.length !== e2.length) return false;
            for (let n2 = 0; n2 < t2.length; n2++) if (!At(t2[n2], e2[n2])) return false;
            return true;
          }
          if ("object" == typeof t2 && null !== t2 && null !== e2) {
            if ("object" != typeof e2) return false;
            if (Object.keys(t2).length !== Object.keys(e2).length) return false;
            for (const n2 in t2) if (!At(t2[n2], e2[n2])) return false;
            return true;
          }
          return t2 === e2;
        }
        function Mt(t2, e2) {
          t2.push(e2);
        }
        function kt(t2, e2, n2) {
          Mt(n2, { command: "addSource", args: [t2, e2[t2]] });
        }
        function It(t2, e2, n2) {
          Mt(e2, { command: "removeSource", args: [t2] }), n2[t2] = true;
        }
        function Et(t2, e2, n2, r2) {
          It(t2, n2, r2), kt(t2, e2, n2);
        }
        function Tt(t2, e2, n2) {
          let r2;
          for (r2 in t2[n2]) if (Object.prototype.hasOwnProperty.call(t2[n2], r2) && "data" !== r2 && !At(t2[n2][r2], e2[n2][r2])) return false;
          for (r2 in e2[n2]) if (Object.prototype.hasOwnProperty.call(e2[n2], r2) && "data" !== r2 && !At(t2[n2][r2], e2[n2][r2])) return false;
          return true;
        }
        function Ft(t2, e2, n2, r2, i2, s2) {
          t2 = t2 || {}, e2 = e2 || {};
          for (const o2 in t2) Object.prototype.hasOwnProperty.call(t2, o2) && (At(t2[o2], e2[o2]) || n2.push({ command: s2, args: [r2, o2, e2[o2], i2] }));
          for (const o2 in e2) Object.prototype.hasOwnProperty.call(e2, o2) && !Object.prototype.hasOwnProperty.call(t2, o2) && (At(t2[o2], e2[o2]) || n2.push({ command: s2, args: [r2, o2, e2[o2], i2] }));
        }
        function Pt(t2) {
          return t2.id;
        }
        function Dt(t2, e2) {
          return t2[e2.id] = e2, t2;
        }
        class zt {
          constructor(t2, e2, n2, r2) {
            this.message = (t2 ? `${t2}: ` : "") + n2, r2 && (this.identifier = r2), null != e2 && e2.__line__ && (this.line = e2.__line__);
          }
        }
        function Bt(t2, ...e2) {
          for (const n2 of e2) for (const e3 in n2) t2[e3] = n2[e3];
          return t2;
        }
        class Ct extends Error {
          constructor(t2, e2) {
            super(e2), this.message = e2, this.key = t2;
          }
        }
        class Vt {
          constructor(t2, e2 = []) {
            this.parent = t2, this.bindings = {};
            for (const [t3, n2] of e2) this.bindings[t3] = n2;
          }
          concat(t2) {
            return new Vt(this, t2);
          }
          get(t2) {
            if (this.bindings[t2]) return this.bindings[t2];
            if (this.parent) return this.parent.get(t2);
            throw new Error(`${t2} not found in scope.`);
          }
          has(t2) {
            return !!this.bindings[t2] || !!this.parent && this.parent.has(t2);
          }
        }
        const Lt = { kind: "null" }, Ot = { kind: "number" }, $t = { kind: "string" }, Rt = { kind: "boolean" }, Nt = { kind: "color" }, Ut = { kind: "projectionDefinition" }, jt = { kind: "object" }, qt = { kind: "value" }, Gt = { kind: "collator" }, Xt = { kind: "formatted" }, Yt = { kind: "padding" }, Zt = { kind: "colorArray" }, Ht = { kind: "numberArray" }, Wt = { kind: "resolvedImage" }, Kt = { kind: "variableAnchorOffsetCollection" };
        function Jt(t2, e2) {
          return { kind: "array", itemType: t2, N: e2 };
        }
        function Qt(t2) {
          if ("array" === t2.kind) {
            const e2 = Qt(t2.itemType);
            return "number" == typeof t2.N ? `array<${e2}, ${t2.N}>` : "value" === t2.itemType.kind ? "array" : `array<${e2}>`;
          }
          return t2.kind;
        }
        const te = [Lt, Ot, $t, Rt, Nt, Ut, Xt, jt, Jt(qt), Yt, Ht, Zt, Wt, Kt];
        function ee(t2, e2) {
          if ("error" === e2.kind) return null;
          if ("array" === t2.kind) {
            if ("array" === e2.kind && (0 === e2.N && "value" === e2.itemType.kind || !ee(t2.itemType, e2.itemType)) && ("number" != typeof t2.N || t2.N === e2.N)) return null;
          } else {
            if (t2.kind === e2.kind) return null;
            if ("value" === t2.kind) {
              for (const t3 of te) if (!ee(t3, e2)) return null;
            }
          }
          return `Expected ${Qt(t2)} but found ${Qt(e2)} instead.`;
        }
        function ne(t2, e2) {
          return e2.some(((e3) => e3.kind === t2.kind));
        }
        function re(t2, e2) {
          return e2.some(((e3) => "null" === e3 ? null === t2 : "array" === e3 ? Array.isArray(t2) : "object" === e3 ? t2 && !Array.isArray(t2) && "object" == typeof t2 : e3 === typeof t2));
        }
        function ie(t2, e2) {
          return "array" === t2.kind && "array" === e2.kind ? t2.itemType.kind === e2.itemType.kind && "number" == typeof t2.N : t2.kind === e2.kind;
        }
        const se = 0.96422, oe = 0.82521, ae = 4 / 29, le = 6 / 29, ue = 3 * le * le, ce = le * le * le, he = Math.PI / 180, pe = 180 / Math.PI;
        function fe(t2) {
          return (t2 %= 360) < 0 && (t2 += 360), t2;
        }
        function de([t2, e2, n2, r2]) {
          let i2, s2;
          const o2 = me((0.2225045 * (t2 = ye(t2)) + 0.7168786 * (e2 = ye(e2)) + 0.0606169 * (n2 = ye(n2))) / 1);
          t2 === e2 && e2 === n2 ? i2 = s2 = o2 : (i2 = me((0.4360747 * t2 + 0.3850649 * e2 + 0.1430804 * n2) / se), s2 = me((0.0139322 * t2 + 0.0971045 * e2 + 0.7141733 * n2) / oe));
          const a2 = 116 * o2 - 16;
          return [a2 < 0 ? 0 : a2, 500 * (i2 - o2), 200 * (o2 - s2), r2];
        }
        function ye(t2) {
          return t2 <= 0.04045 ? t2 / 12.92 : Math.pow((t2 + 0.055) / 1.055, 2.4);
        }
        function me(t2) {
          return t2 > ce ? Math.pow(t2, 1 / 3) : t2 / ue + ae;
        }
        function ge([t2, e2, n2, r2]) {
          let i2 = (t2 + 16) / 116, s2 = isNaN(e2) ? i2 : i2 + e2 / 500, o2 = isNaN(n2) ? i2 : i2 - n2 / 200;
          return i2 = 1 * ve(i2), s2 = se * ve(s2), o2 = oe * ve(o2), [xe(3.1338561 * s2 - 1.6168667 * i2 - 0.4906146 * o2), xe(-0.9787684 * s2 + 1.9161415 * i2 + 0.033454 * o2), xe(0.0719453 * s2 - 0.2289914 * i2 + 1.4052427 * o2), r2];
        }
        function xe(t2) {
          return (t2 = t2 <= 304e-5 ? 12.92 * t2 : 1.055 * Math.pow(t2, 1 / 2.4) - 0.055) < 0 ? 0 : t2 > 1 ? 1 : t2;
        }
        function ve(t2) {
          return t2 > le ? t2 * t2 * t2 : ue * (t2 - ae);
        }
        const be = Object.hasOwn || function(t2, e2) {
          return Object.prototype.hasOwnProperty.call(t2, e2);
        };
        function we(t2, e2) {
          return be(t2, e2) ? t2[e2] : void 0;
        }
        function _e(t2) {
          return parseInt(t2.padEnd(2, t2), 16) / 255;
        }
        function Se(t2, e2) {
          return Ae(e2 ? t2 / 100 : t2, 0, 1);
        }
        function Ae(t2, e2, n2) {
          return Math.min(Math.max(e2, t2), n2);
        }
        function Me(t2) {
          return !t2.some(Number.isNaN);
        }
        const ke = { 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 Ie(t2, e2, n2) {
          return t2 + n2 * (e2 - t2);
        }
        function Ee(t2, e2, n2) {
          return t2.map(((t3, r2) => Ie(t3, e2[r2], n2)));
        }
        class Te {
          constructor(t2, e2, n2, r2 = 1, i2 = true) {
            this.r = t2, this.g = e2, this.b = n2, this.a = r2, i2 || (this.r *= r2, this.g *= r2, this.b *= r2, r2 || this.overwriteGetter("rgb", [t2, e2, n2, r2]));
          }
          static parse(t2) {
            if (t2 instanceof Te) return t2;
            if ("string" != typeof t2) return;
            const e2 = (function(t3) {
              if ("transparent" === (t3 = t3.toLowerCase().trim())) return [0, 0, 0, 0];
              const e3 = we(ke, t3);
              if (e3) {
                const [t4, n3, r2] = e3;
                return [t4 / 255, n3 / 255, r2 / 255, 1];
              }
              if (t3.startsWith("#") && /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t3)) {
                const e4 = t3.length < 6 ? 1 : 2;
                let n3 = 1;
                return [_e(t3.slice(n3, n3 += e4)), _e(t3.slice(n3, n3 += e4)), _e(t3.slice(n3, n3 += e4)), _e(t3.slice(n3, n3 + e4) || "ff")];
              }
              if (t3.startsWith("rgb")) {
                const e4 = t3.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
                if (e4) {
                  const [t4, n3, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2] = e4, f2 = [i2 || " ", a2 || " ", c2].join("");
                  if ("  " === f2 || "  /" === f2 || ",," === f2 || ",,," === f2) {
                    const t5 = [r2, o2, u2].join(""), e5 = "%%%" === t5 ? 100 : "" === t5 ? 255 : 0;
                    if (e5) {
                      const t6 = [Ae(+n3 / e5, 0, 1), Ae(+s2 / e5, 0, 1), Ae(+l2 / e5, 0, 1), h2 ? Se(+h2, p2) : 1];
                      if (Me(t6)) return t6;
                    }
                  }
                  return;
                }
              }
              const n2 = t3.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
              if (n2) {
                const [t4, e4, r2, i2, s2, o2, a2, l2, u2] = n2, c2 = [r2 || " ", s2 || " ", a2].join("");
                if ("  " === c2 || "  /" === c2 || ",," === c2 || ",,," === c2) {
                  const t5 = [+e4, Ae(+i2, 0, 100), Ae(+o2, 0, 100), l2 ? Se(+l2, u2) : 1];
                  if (Me(t5)) return (function([t6, e5, n3, r3]) {
                    function i3(r4) {
                      const i4 = (r4 + t6 / 30) % 12, s3 = e5 * Math.min(n3, 1 - n3);
                      return n3 - s3 * Math.max(-1, Math.min(i4 - 3, 9 - i4, 1));
                    }
                    return t6 = fe(t6), e5 /= 100, n3 /= 100, [i3(0), i3(8), i3(4), r3];
                  })(t5);
                }
              }
            })(t2);
            return e2 ? new Te(...e2, false) : void 0;
          }
          get rgb() {
            const { r: t2, g: e2, b: n2, a: r2 } = this, i2 = r2 || 1 / 0;
            return this.overwriteGetter("rgb", [t2 / i2, e2 / i2, n2 / i2, r2]);
          }
          get hcl() {
            return this.overwriteGetter("hcl", (function(t2) {
              const [e2, n2, r2, i2] = de(t2), s2 = Math.sqrt(n2 * n2 + r2 * r2);
              return [Math.round(1e4 * s2) ? fe(Math.atan2(r2, n2) * pe) : NaN, s2, e2, i2];
            })(this.rgb));
          }
          get lab() {
            return this.overwriteGetter("lab", de(this.rgb));
          }
          overwriteGetter(t2, e2) {
            return Object.defineProperty(this, t2, { value: e2 }), e2;
          }
          toString() {
            const [t2, e2, n2, r2] = this.rgb;
            return `rgba(${[t2, e2, n2].map(((t3) => Math.round(255 * t3))).join(",")},${r2})`;
          }
          static interpolate(t2, e2, n2, r2 = "rgb") {
            switch (r2) {
              case "rgb": {
                const [r3, i2, s2, o2] = Ee(t2.rgb, e2.rgb, n2);
                return new Te(r3, i2, s2, o2, false);
              }
              case "hcl": {
                const [r3, i2, s2, o2] = t2.hcl, [a2, l2, u2, c2] = e2.hcl;
                let h2, p2;
                if (isNaN(r3) || isNaN(a2)) isNaN(r3) ? isNaN(a2) ? h2 = NaN : (h2 = a2, 1 !== s2 && 0 !== s2 || (p2 = l2)) : (h2 = r3, 1 !== u2 && 0 !== u2 || (p2 = i2));
                else {
                  let t3 = a2 - r3;
                  a2 > r3 && t3 > 180 ? t3 -= 360 : a2 < r3 && r3 - a2 > 180 && (t3 += 360), h2 = r3 + n2 * t3;
                }
                const [f2, d2, y2, m2] = (function([t3, e3, n3, r4]) {
                  return t3 = isNaN(t3) ? 0 : t3 * he, ge([n3, Math.cos(t3) * e3, Math.sin(t3) * e3, r4]);
                })([h2, null != p2 ? p2 : Ie(i2, l2, n2), Ie(s2, u2, n2), Ie(o2, c2, n2)]);
                return new Te(f2, d2, y2, m2, false);
              }
              case "lab": {
                const [r3, i2, s2, o2] = ge(Ee(t2.lab, e2.lab, n2));
                return new Te(r3, i2, s2, o2, false);
              }
            }
          }
        }
        Te.black = new Te(0, 0, 0, 1), Te.white = new Te(1, 1, 1, 1), Te.transparent = new Te(0, 0, 0, 0), Te.red = new Te(1, 0, 0, 1);
        class Fe {
          constructor(t2, e2, n2) {
            this.sensitivity = t2 ? e2 ? "variant" : "case" : e2 ? "accent" : "base", this.locale = n2, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" });
          }
          compare(t2, e2) {
            return this.collator.compare(t2, e2);
          }
          resolvedLocale() {
            return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;
          }
        }
        const Pe = ["bottom", "center", "top"];
        class De {
          constructor(t2, e2, n2, r2, i2, s2) {
            this.text = t2, this.image = e2, this.scale = n2, this.fontStack = r2, this.textColor = i2, this.verticalAlign = s2;
          }
        }
        class ze {
          constructor(t2) {
            this.sections = t2;
          }
          static fromString(t2) {
            return new ze([new De(t2, null, null, null, null, null)]);
          }
          isEmpty() {
            return 0 === this.sections.length || !this.sections.some(((t2) => 0 !== t2.text.length || t2.image && 0 !== t2.image.name.length));
          }
          static factory(t2) {
            return t2 instanceof ze ? t2 : ze.fromString(t2);
          }
          toString() {
            return 0 === this.sections.length ? "" : this.sections.map(((t2) => t2.text)).join("");
          }
        }
        class Be {
          constructor(t2) {
            this.values = t2.slice();
          }
          static parse(t2) {
            if (t2 instanceof Be) return t2;
            if ("number" == typeof t2) return new Be([t2, t2, t2, t2]);
            if (Array.isArray(t2) && !(t2.length < 1 || t2.length > 4)) {
              for (const e2 of t2) if ("number" != typeof e2) return;
              switch (t2.length) {
                case 1:
                  t2 = [t2[0], t2[0], t2[0], t2[0]];
                  break;
                case 2:
                  t2 = [t2[0], t2[1], t2[0], t2[1]];
                  break;
                case 3:
                  t2 = [t2[0], t2[1], t2[2], t2[1]];
              }
              return new Be(t2);
            }
          }
          toString() {
            return JSON.stringify(this.values);
          }
          static interpolate(t2, e2, n2) {
            return new Be(Ee(t2.values, e2.values, n2));
          }
        }
        class Ce {
          constructor(t2) {
            this.values = t2.slice();
          }
          static parse(t2) {
            if (t2 instanceof Ce) return t2;
            if ("number" == typeof t2) return new Ce([t2]);
            if (Array.isArray(t2)) {
              for (const e2 of t2) if ("number" != typeof e2) return;
              return new Ce(t2);
            }
          }
          toString() {
            return JSON.stringify(this.values);
          }
          static interpolate(t2, e2, n2) {
            return new Ce(Ee(t2.values, e2.values, n2));
          }
        }
        class Ve {
          constructor(t2) {
            this.values = t2.slice();
          }
          static parse(t2) {
            if (t2 instanceof Ve) return t2;
            if ("string" == typeof t2) {
              const e3 = Te.parse(t2);
              if (!e3) return;
              return new Ve([e3]);
            }
            if (!Array.isArray(t2)) return;
            const e2 = [];
            for (const n2 of t2) {
              if ("string" != typeof n2) return;
              const t3 = Te.parse(n2);
              if (!t3) return;
              e2.push(t3);
            }
            return new Ve(e2);
          }
          toString() {
            return JSON.stringify(this.values);
          }
          static interpolate(t2, e2, n2, r2 = "rgb") {
            const i2 = [];
            if (t2.values.length != e2.values.length) throw new Error(`colorArray: Arrays have mismatched length (${t2.values.length} vs. ${e2.values.length}), cannot interpolate.`);
            for (let s2 = 0; s2 < t2.values.length; s2++) i2.push(Te.interpolate(t2.values[s2], e2.values[s2], n2, r2));
            return new Ve(i2);
          }
        }
        class Le extends Error {
          constructor(t2) {
            super(t2), this.name = "RuntimeError";
          }
          toJSON() {
            return this.message;
          }
        }
        const Oe = /* @__PURE__ */ new Set(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]);
        class $e {
          constructor(t2) {
            this.values = t2.slice();
          }
          static parse(t2) {
            if (t2 instanceof $e) return t2;
            if (Array.isArray(t2) && !(t2.length < 1) && t2.length % 2 == 0) {
              for (let e2 = 0; e2 < t2.length; e2 += 2) {
                const n2 = t2[e2], r2 = t2[e2 + 1];
                if ("string" != typeof n2 || !Oe.has(n2)) return;
                if (!Array.isArray(r2) || 2 !== r2.length || "number" != typeof r2[0] || "number" != typeof r2[1]) return;
              }
              return new $e(t2);
            }
          }
          toString() {
            return JSON.stringify(this.values);
          }
          static interpolate(t2, e2, n2) {
            const r2 = t2.values, i2 = e2.values;
            if (r2.length !== i2.length) throw new Le(`Cannot interpolate values of different length. from: ${t2.toString()}, to: ${e2.toString()}`);
            const s2 = [];
            for (let t3 = 0; t3 < r2.length; t3 += 2) {
              if (r2[t3] !== i2[t3]) throw new Le(`Cannot interpolate values containing mismatched anchors. from[${t3}]: ${r2[t3]}, to[${t3}]: ${i2[t3]}`);
              s2.push(r2[t3]);
              const [e3, o2] = r2[t3 + 1], [a2, l2] = i2[t3 + 1];
              s2.push([Ie(e3, a2, n2), Ie(o2, l2, n2)]);
            }
            return new $e(s2);
          }
        }
        class Re {
          constructor(t2) {
            this.name = t2.name, this.available = t2.available;
          }
          toString() {
            return this.name;
          }
          static fromString(t2) {
            return t2 ? new Re({ name: t2, available: false }) : null;
          }
        }
        class Ne {
          constructor(t2, e2, n2) {
            this.from = t2, this.to = e2, this.transition = n2;
          }
          static interpolate(t2, e2, n2) {
            return new Ne(t2, e2, n2);
          }
          static parse(t2) {
            return t2 instanceof Ne ? t2 : Array.isArray(t2) && 3 === t2.length && "string" == typeof t2[0] && "string" == typeof t2[1] && "number" == typeof t2[2] ? new Ne(t2[0], t2[1], t2[2]) : "object" == typeof t2 && "string" == typeof t2.from && "string" == typeof t2.to && "number" == typeof t2.transition ? new Ne(t2.from, t2.to, t2.transition) : "string" == typeof t2 ? new Ne(t2, t2, 1) : void 0;
          }
        }
        function Ue(t2, e2, n2, r2) {
          return "number" == typeof t2 && t2 >= 0 && t2 <= 255 && "number" == typeof e2 && e2 >= 0 && e2 <= 255 && "number" == typeof n2 && n2 >= 0 && n2 <= 255 ? void 0 === r2 || "number" == typeof r2 && r2 >= 0 && r2 <= 1 ? null : `Invalid rgba value [${[t2, e2, n2, r2].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${("number" == typeof r2 ? [t2, e2, n2, r2] : [t2, e2, n2]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`;
        }
        function je(t2) {
          if (null === t2 || "string" == typeof t2 || "boolean" == typeof t2 || "number" == typeof t2 || t2 instanceof Ne || t2 instanceof Te || t2 instanceof Fe || t2 instanceof ze || t2 instanceof Be || t2 instanceof Ce || t2 instanceof Ve || t2 instanceof $e || t2 instanceof Re) return true;
          if (Array.isArray(t2)) {
            for (const e2 of t2) if (!je(e2)) return false;
            return true;
          }
          if ("object" == typeof t2) {
            for (const e2 in t2) if (!je(t2[e2])) return false;
            return true;
          }
          return false;
        }
        function qe(t2) {
          if (null === t2) return Lt;
          if ("string" == typeof t2) return $t;
          if ("boolean" == typeof t2) return Rt;
          if ("number" == typeof t2) return Ot;
          if (t2 instanceof Te) return Nt;
          if (t2 instanceof Ne) return Ut;
          if (t2 instanceof Fe) return Gt;
          if (t2 instanceof ze) return Xt;
          if (t2 instanceof Be) return Yt;
          if (t2 instanceof Ce) return Ht;
          if (t2 instanceof Ve) return Zt;
          if (t2 instanceof $e) return Kt;
          if (t2 instanceof Re) return Wt;
          if (Array.isArray(t2)) {
            const e2 = t2.length;
            let n2;
            for (const e3 of t2) {
              const t3 = qe(e3);
              if (n2) {
                if (n2 === t3) continue;
                n2 = qt;
                break;
              }
              n2 = t3;
            }
            return Jt(n2 || qt, e2);
          }
          return jt;
        }
        function Ge(t2) {
          const e2 = typeof t2;
          return null === t2 ? "" : "string" === e2 || "number" === e2 || "boolean" === e2 ? String(t2) : t2 instanceof Te || t2 instanceof Ne || t2 instanceof ze || t2 instanceof Be || t2 instanceof Ce || t2 instanceof Ve || t2 instanceof $e || t2 instanceof Re ? t2.toString() : JSON.stringify(t2);
        }
        class Xe {
          constructor(t2, e2) {
            this.type = t2, this.value = e2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error(`'literal' expression requires exactly one argument, but found ${t2.length - 1} instead.`);
            if (!je(t2[1])) return e2.error("invalid value");
            const n2 = t2[1];
            let r2 = qe(n2);
            const i2 = e2.expectedType;
            return "array" !== r2.kind || 0 !== r2.N || !i2 || "array" !== i2.kind || "number" == typeof i2.N && 0 !== i2.N || (r2 = i2), new Xe(r2, n2);
          }
          evaluate() {
            return this.value;
          }
          eachChild() {
          }
          outputDefined() {
            return true;
          }
        }
        const Ye = { string: $t, number: Ot, boolean: Rt, object: jt };
        class Ze {
          constructor(t2, e2) {
            this.type = t2, this.args = e2;
          }
          static parse(t2, e2) {
            if (t2.length < 2) return e2.error("Expected at least one argument.");
            let n2, r2 = 1;
            const i2 = t2[0];
            if ("array" === i2) {
              let i3, s3;
              if (t2.length > 2) {
                const n3 = t2[1];
                if ("string" != typeof n3 || !(n3 in Ye) || "object" === n3) return e2.error('The item type argument of "array" must be one of string, number, boolean', 1);
                i3 = Ye[n3], r2++;
              } else i3 = qt;
              if (t2.length > 3) {
                if (null !== t2[2] && ("number" != typeof t2[2] || t2[2] < 0 || t2[2] !== Math.floor(t2[2]))) return e2.error('The length argument to "array" must be a positive integer literal', 2);
                s3 = t2[2], r2++;
              }
              n2 = Jt(i3, s3);
            } else {
              if (!Ye[i2]) throw new Error(`Types doesn't contain name = ${i2}`);
              n2 = Ye[i2];
            }
            const s2 = [];
            for (; r2 < t2.length; r2++) {
              const n3 = e2.parse(t2[r2], r2, qt);
              if (!n3) return null;
              s2.push(n3);
            }
            return new Ze(n2, s2);
          }
          evaluate(t2) {
            for (let e2 = 0; e2 < this.args.length; e2++) {
              const n2 = this.args[e2].evaluate(t2);
              if (!ee(this.type, qe(n2))) return n2;
              if (e2 === this.args.length - 1) throw new Le(`Expected value to be of type ${Qt(this.type)}, but found ${Qt(qe(n2))} instead.`);
            }
            throw new Error();
          }
          eachChild(t2) {
            this.args.forEach(t2);
          }
          outputDefined() {
            return this.args.every(((t2) => t2.outputDefined()));
          }
        }
        const He = { "to-boolean": Rt, "to-color": Nt, "to-number": Ot, "to-string": $t };
        class We {
          constructor(t2, e2) {
            this.type = t2, this.args = e2;
          }
          static parse(t2, e2) {
            if (t2.length < 2) return e2.error("Expected at least one argument.");
            const n2 = t2[0];
            if (!He[n2]) throw new Error(`Can't parse ${n2} as it is not part of the known types`);
            if (("to-boolean" === n2 || "to-string" === n2) && 2 !== t2.length) return e2.error("Expected one argument.");
            const r2 = He[n2], i2 = [];
            for (let n3 = 1; n3 < t2.length; n3++) {
              const r3 = e2.parse(t2[n3], n3, qt);
              if (!r3) return null;
              i2.push(r3);
            }
            return new We(r2, i2);
          }
          evaluate(t2) {
            switch (this.type.kind) {
              case "boolean":
                return Boolean(this.args[0].evaluate(t2));
              case "color": {
                let e2, n2;
                for (const r2 of this.args) {
                  if (e2 = r2.evaluate(t2), n2 = null, e2 instanceof Te) return e2;
                  if ("string" == typeof e2) {
                    const n3 = t2.parseColor(e2);
                    if (n3) return n3;
                  } else if (Array.isArray(e2) && (n2 = e2.length < 3 || e2.length > 4 ? `Invalid rgba value ${JSON.stringify(e2)}: expected an array containing either three or four numeric values.` : Ue(e2[0], e2[1], e2[2], e2[3]), !n2)) return new Te(e2[0] / 255, e2[1] / 255, e2[2] / 255, e2[3]);
                }
                throw new Le(n2 || `Could not parse color from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
              }
              case "padding": {
                let e2;
                for (const n2 of this.args) {
                  e2 = n2.evaluate(t2);
                  const r2 = Be.parse(e2);
                  if (r2) return r2;
                }
                throw new Le(`Could not parse padding from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
              }
              case "numberArray": {
                let e2;
                for (const n2 of this.args) {
                  e2 = n2.evaluate(t2);
                  const r2 = Ce.parse(e2);
                  if (r2) return r2;
                }
                throw new Le(`Could not parse numberArray from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
              }
              case "colorArray": {
                let e2;
                for (const n2 of this.args) {
                  e2 = n2.evaluate(t2);
                  const r2 = Ve.parse(e2);
                  if (r2) return r2;
                }
                throw new Le(`Could not parse colorArray from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
              }
              case "variableAnchorOffsetCollection": {
                let e2;
                for (const n2 of this.args) {
                  e2 = n2.evaluate(t2);
                  const r2 = $e.parse(e2);
                  if (r2) return r2;
                }
                throw new Le(`Could not parse variableAnchorOffsetCollection from value '${"string" == typeof e2 ? e2 : JSON.stringify(e2)}'`);
              }
              case "number": {
                let e2 = null;
                for (const n2 of this.args) {
                  if (e2 = n2.evaluate(t2), null === e2) return 0;
                  const r2 = Number(e2);
                  if (!isNaN(r2)) return r2;
                }
                throw new Le(`Could not convert ${JSON.stringify(e2)} to number.`);
              }
              case "formatted":
                return ze.fromString(Ge(this.args[0].evaluate(t2)));
              case "resolvedImage":
                return Re.fromString(Ge(this.args[0].evaluate(t2)));
              case "projectionDefinition":
                return this.args[0].evaluate(t2);
              default:
                return Ge(this.args[0].evaluate(t2));
            }
          }
          eachChild(t2) {
            this.args.forEach(t2);
          }
          outputDefined() {
            return this.args.every(((t2) => t2.outputDefined()));
          }
        }
        const Ke = ["Unknown", "Point", "LineString", "Polygon"];
        class Je {
          constructor() {
            this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = /* @__PURE__ */ new Map(), this.availableImages = null, this.canonical = null;
          }
          id() {
            return this.feature && "id" in this.feature ? this.feature.id : null;
          }
          geometryType() {
            return this.feature ? "number" == typeof this.feature.type ? Ke[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(t2) {
            let e2 = this._parseColorCache.get(t2);
            return e2 || (e2 = Te.parse(t2), this._parseColorCache.set(t2, e2)), e2;
          }
        }
        class Qe {
          constructor(t2, e2, n2 = [], r2, i2 = new Vt(), s2 = []) {
            this.registry = t2, this.path = n2, this.key = n2.map(((t3) => `[${t3}]`)).join(""), this.scope = i2, this.errors = s2, this.expectedType = r2, this._isConstant = e2;
          }
          parse(t2, e2, n2, r2, i2 = {}) {
            return e2 ? this.concat(e2, n2, r2)._parse(t2, i2) : this._parse(t2, i2);
          }
          _parse(t2, e2) {
            function n2(t3, e3, n3) {
              return "assert" === n3 ? new Ze(e3, [t3]) : "coerce" === n3 ? new We(e3, [t3]) : t3;
            }
            if (null !== t2 && "string" != typeof t2 && "boolean" != typeof t2 && "number" != typeof t2 || (t2 = ["literal", t2]), Array.isArray(t2)) {
              if (0 === t2.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
              const r2 = t2[0];
              if ("string" != typeof r2) return this.error(`Expression name must be a string, but found ${typeof r2} instead. If you wanted a literal array, use ["literal", [...]].`, 0), null;
              const i2 = this.registry[r2];
              if (i2) {
                let r3 = i2.parse(t2, this);
                if (!r3) return null;
                if (this.expectedType) {
                  const t3 = this.expectedType, i3 = r3.type;
                  if ("string" !== t3.kind && "number" !== t3.kind && "boolean" !== t3.kind && "object" !== t3.kind && "array" !== t3.kind || "value" !== i3.kind) {
                    if ("projectionDefinition" === t3.kind && ["string", "array"].includes(i3.kind) || ["color", "formatted", "resolvedImage"].includes(t3.kind) && ["value", "string"].includes(i3.kind) || ["padding", "numberArray"].includes(t3.kind) && ["value", "number", "array"].includes(i3.kind) || "colorArray" === t3.kind && ["value", "string", "array"].includes(i3.kind) || "variableAnchorOffsetCollection" === t3.kind && ["value", "array"].includes(i3.kind)) r3 = n2(r3, t3, e2.typeAnnotation || "coerce");
                    else if (this.checkSubtype(t3, i3)) return null;
                  } else r3 = n2(r3, t3, e2.typeAnnotation || "assert");
                }
                if (!(r3 instanceof Xe) && "resolvedImage" !== r3.type.kind && this._isConstant(r3)) {
                  const t3 = new Je();
                  try {
                    r3 = new Xe(r3.type, r3.evaluate(t3));
                  } catch (t4) {
                    return this.error(t4.message), null;
                  }
                }
                return r3;
              }
              return this.error(`Unknown expression "${r2}". If you wanted a literal array, use ["literal", [...]].`, 0);
            }
            return this.error(void 0 === t2 ? "'undefined' value invalid. Use null instead." : "object" == typeof t2 ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof t2} instead.`);
          }
          concat(t2, e2, n2) {
            const r2 = "number" == typeof t2 ? this.path.concat(t2) : this.path, i2 = n2 ? this.scope.concat(n2) : this.scope;
            return new Qe(this.registry, this._isConstant, r2, e2 || null, i2, this.errors);
          }
          error(t2, ...e2) {
            const n2 = `${this.key}${e2.map(((t3) => `[${t3}]`)).join("")}`;
            this.errors.push(new Ct(n2, t2));
          }
          checkSubtype(t2, e2) {
            const n2 = ee(t2, e2);
            return n2 && this.error(n2), n2;
          }
        }
        class tn {
          constructor(t2, e2) {
            this.type = e2.type, this.bindings = [].concat(t2), this.result = e2;
          }
          evaluate(t2) {
            return this.result.evaluate(t2);
          }
          eachChild(t2) {
            for (const e2 of this.bindings) t2(e2[1]);
            t2(this.result);
          }
          static parse(t2, e2) {
            if (t2.length < 4) return e2.error(`Expected at least 3 arguments, but found ${t2.length - 1} instead.`);
            const n2 = [];
            for (let r3 = 1; r3 < t2.length - 1; r3 += 2) {
              const i2 = t2[r3];
              if ("string" != typeof i2) return e2.error(`Expected string, but found ${typeof i2} instead.`, r3);
              if (/[^a-zA-Z0-9_]/.test(i2)) return e2.error("Variable names must contain only alphanumeric characters or '_'.", r3);
              const s2 = e2.parse(t2[r3 + 1], r3 + 1);
              if (!s2) return null;
              n2.push([i2, s2]);
            }
            const r2 = e2.parse(t2[t2.length - 1], t2.length - 1, e2.expectedType, n2);
            return r2 ? new tn(n2, r2) : null;
          }
          outputDefined() {
            return this.result.outputDefined();
          }
        }
        class en {
          constructor(t2, e2) {
            this.type = e2.type, this.name = t2, this.boundExpression = e2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length || "string" != typeof t2[1]) return e2.error("'var' expression requires exactly one string literal argument.");
            const n2 = t2[1];
            return e2.scope.has(n2) ? new en(n2, e2.scope.get(n2)) : e2.error(`Unknown variable "${n2}". Make sure "${n2}" has been bound in an enclosing "let" expression before using it.`, 1);
          }
          evaluate(t2) {
            return this.boundExpression.evaluate(t2);
          }
          eachChild() {
          }
          outputDefined() {
            return false;
          }
        }
        class nn {
          constructor(t2, e2, n2) {
            this.type = t2, this.index = e2, this.input = n2;
          }
          static parse(t2, e2) {
            if (3 !== t2.length) return e2.error(`Expected 2 arguments, but found ${t2.length - 1} instead.`);
            const n2 = e2.parse(t2[1], 1, Ot), r2 = e2.parse(t2[2], 2, Jt(e2.expectedType || qt));
            return n2 && r2 ? new nn(r2.type.itemType, n2, r2) : null;
          }
          evaluate(t2) {
            const e2 = this.index.evaluate(t2), n2 = this.input.evaluate(t2);
            if (e2 < 0) throw new Le(`Array index out of bounds: ${e2} < 0.`);
            if (e2 >= n2.length) throw new Le(`Array index out of bounds: ${e2} > ${n2.length - 1}.`);
            if (e2 !== Math.floor(e2)) throw new Le(`Array index must be an integer, but found ${e2} instead.`);
            return n2[e2];
          }
          eachChild(t2) {
            t2(this.index), t2(this.input);
          }
          outputDefined() {
            return false;
          }
        }
        class rn {
          constructor(t2, e2) {
            this.type = Rt, this.needle = t2, this.haystack = e2;
          }
          static parse(t2, e2) {
            if (3 !== t2.length) return e2.error(`Expected 2 arguments, but found ${t2.length - 1} instead.`);
            const n2 = e2.parse(t2[1], 1, qt), r2 = e2.parse(t2[2], 2, qt);
            return n2 && r2 ? ne(n2.type, [Rt, $t, Ot, Lt, qt]) ? new rn(n2, r2) : e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(n2.type)} instead`) : null;
          }
          evaluate(t2) {
            const e2 = this.needle.evaluate(t2), n2 = this.haystack.evaluate(t2);
            if (!n2) return false;
            if (!re(e2, ["boolean", "string", "number", "null"])) throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(qe(e2))} instead.`);
            if (!re(n2, ["string", "array"])) throw new Le(`Expected second argument to be of type array or string, but found ${Qt(qe(n2))} instead.`);
            return n2.indexOf(e2) >= 0;
          }
          eachChild(t2) {
            t2(this.needle), t2(this.haystack);
          }
          outputDefined() {
            return true;
          }
        }
        class sn {
          constructor(t2, e2, n2) {
            this.type = Ot, this.needle = t2, this.haystack = e2, this.fromIndex = n2;
          }
          static parse(t2, e2) {
            if (t2.length <= 2 || t2.length >= 5) return e2.error(`Expected 2 or 3 arguments, but found ${t2.length - 1} instead.`);
            const n2 = e2.parse(t2[1], 1, qt), r2 = e2.parse(t2[2], 2, qt);
            if (!n2 || !r2) return null;
            if (!ne(n2.type, [Rt, $t, Ot, Lt, qt])) return e2.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(n2.type)} instead`);
            if (4 === t2.length) {
              const i2 = e2.parse(t2[3], 3, Ot);
              return i2 ? new sn(n2, r2, i2) : null;
            }
            return new sn(n2, r2);
          }
          evaluate(t2) {
            const e2 = this.needle.evaluate(t2), n2 = this.haystack.evaluate(t2);
            if (!re(e2, ["boolean", "string", "number", "null"])) throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(qe(e2))} instead.`);
            let r2;
            if (this.fromIndex && (r2 = this.fromIndex.evaluate(t2)), re(n2, ["string"])) {
              const t3 = n2.indexOf(e2, r2);
              return -1 === t3 ? -1 : [...n2.slice(0, t3)].length;
            }
            if (re(n2, ["array"])) return n2.indexOf(e2, r2);
            throw new Le(`Expected second argument to be of type array or string, but found ${Qt(qe(n2))} instead.`);
          }
          eachChild(t2) {
            t2(this.needle), t2(this.haystack), this.fromIndex && t2(this.fromIndex);
          }
          outputDefined() {
            return false;
          }
        }
        class on {
          constructor(t2, e2, n2, r2, i2, s2) {
            this.inputType = t2, this.type = e2, this.input = n2, this.cases = r2, this.outputs = i2, this.otherwise = s2;
          }
          static parse(t2, e2) {
            if (t2.length < 5) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
            if (t2.length % 2 != 1) return e2.error("Expected an even number of arguments.");
            let n2, r2;
            e2.expectedType && "value" !== e2.expectedType.kind && (r2 = e2.expectedType);
            const i2 = {}, s2 = [];
            for (let o3 = 2; o3 < t2.length - 1; o3 += 2) {
              let a3 = t2[o3];
              const l2 = t2[o3 + 1];
              Array.isArray(a3) || (a3 = [a3]);
              const u2 = e2.concat(o3);
              if (0 === a3.length) return u2.error("Expected at least one branch label.");
              for (const t3 of a3) {
                if ("number" != typeof t3 && "string" != typeof t3) return u2.error("Branch labels must be numbers or strings.");
                if ("number" == typeof t3 && Math.abs(t3) > Number.MAX_SAFE_INTEGER) return u2.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
                if ("number" == typeof t3 && Math.floor(t3) !== t3) return u2.error("Numeric branch labels must be integer values.");
                if (n2) {
                  if (u2.checkSubtype(n2, qe(t3))) return null;
                } else n2 = qe(t3);
                if (void 0 !== i2[String(t3)]) return u2.error("Branch labels must be unique.");
                i2[String(t3)] = s2.length;
              }
              const c2 = e2.parse(l2, o3, r2);
              if (!c2) return null;
              r2 = r2 || c2.type, s2.push(c2);
            }
            const o2 = e2.parse(t2[1], 1, qt);
            if (!o2) return null;
            const a2 = e2.parse(t2[t2.length - 1], t2.length - 1, r2);
            return a2 ? "value" !== o2.type.kind && e2.concat(1).checkSubtype(n2, o2.type) ? null : new on(n2, r2, o2, i2, s2, a2) : null;
          }
          evaluate(t2) {
            const e2 = this.input.evaluate(t2);
            return (qe(e2) === this.inputType && this.outputs[this.cases[e2]] || this.otherwise).evaluate(t2);
          }
          eachChild(t2) {
            t2(this.input), this.outputs.forEach(t2), t2(this.otherwise);
          }
          outputDefined() {
            return this.outputs.every(((t2) => t2.outputDefined())) && this.otherwise.outputDefined();
          }
        }
        class an {
          constructor(t2, e2, n2) {
            this.type = t2, this.branches = e2, this.otherwise = n2;
          }
          static parse(t2, e2) {
            if (t2.length < 4) return e2.error(`Expected at least 3 arguments, but found only ${t2.length - 1}.`);
            if (t2.length % 2 != 0) return e2.error("Expected an odd number of arguments.");
            let n2;
            e2.expectedType && "value" !== e2.expectedType.kind && (n2 = e2.expectedType);
            const r2 = [];
            for (let i3 = 1; i3 < t2.length - 1; i3 += 2) {
              const s2 = e2.parse(t2[i3], i3, Rt);
              if (!s2) return null;
              const o2 = e2.parse(t2[i3 + 1], i3 + 1, n2);
              if (!o2) return null;
              r2.push([s2, o2]), n2 = n2 || o2.type;
            }
            const i2 = e2.parse(t2[t2.length - 1], t2.length - 1, n2);
            if (!i2) return null;
            if (!n2) throw new Error("Can't infer output type");
            return new an(n2, r2, i2);
          }
          evaluate(t2) {
            for (const [e2, n2] of this.branches) if (e2.evaluate(t2)) return n2.evaluate(t2);
            return this.otherwise.evaluate(t2);
          }
          eachChild(t2) {
            for (const [e2, n2] of this.branches) t2(e2), t2(n2);
            t2(this.otherwise);
          }
          outputDefined() {
            return this.branches.every((([t2, e2]) => e2.outputDefined())) && this.otherwise.outputDefined();
          }
        }
        class ln {
          constructor(t2, e2, n2, r2) {
            this.type = t2, this.input = e2, this.beginIndex = n2, this.endIndex = r2;
          }
          static parse(t2, e2) {
            if (t2.length <= 2 || t2.length >= 5) return e2.error(`Expected 2 or 3 arguments, but found ${t2.length - 1} instead.`);
            const n2 = e2.parse(t2[1], 1, qt), r2 = e2.parse(t2[2], 2, Ot);
            if (!n2 || !r2) return null;
            if (!ne(n2.type, [Jt(qt), $t, qt])) return e2.error(`Expected first argument to be of type array or string, but found ${Qt(n2.type)} instead`);
            if (4 === t2.length) {
              const i2 = e2.parse(t2[3], 3, Ot);
              return i2 ? new ln(n2.type, n2, r2, i2) : null;
            }
            return new ln(n2.type, n2, r2);
          }
          evaluate(t2) {
            const e2 = this.input.evaluate(t2), n2 = this.beginIndex.evaluate(t2);
            let r2;
            if (this.endIndex && (r2 = this.endIndex.evaluate(t2)), re(e2, ["string"])) return [...e2].slice(n2, r2).join("");
            if (re(e2, ["array"])) return e2.slice(n2, r2);
            throw new Le(`Expected first argument to be of type array or string, but found ${Qt(qe(e2))} instead.`);
          }
          eachChild(t2) {
            t2(this.input), t2(this.beginIndex), this.endIndex && t2(this.endIndex);
          }
          outputDefined() {
            return false;
          }
        }
        function un(t2, e2) {
          const n2 = t2.length - 1;
          let r2, i2, s2 = 0, o2 = n2, a2 = 0;
          for (; s2 <= o2; ) if (a2 = Math.floor((s2 + o2) / 2), r2 = t2[a2], i2 = t2[a2 + 1], r2 <= e2) {
            if (a2 === n2 || e2 < i2) return a2;
            s2 = a2 + 1;
          } else {
            if (!(r2 > e2)) throw new Le("Input is not a number.");
            o2 = a2 - 1;
          }
          return 0;
        }
        class cn {
          constructor(t2, e2, n2) {
            this.type = t2, this.input = e2, this.labels = [], this.outputs = [];
            for (const [t3, e3] of n2) this.labels.push(t3), this.outputs.push(e3);
          }
          static parse(t2, e2) {
            if (t2.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
            if ((t2.length - 1) % 2 != 0) return e2.error("Expected an even number of arguments.");
            const n2 = e2.parse(t2[1], 1, Ot);
            if (!n2) return null;
            const r2 = [];
            let i2 = null;
            e2.expectedType && "value" !== e2.expectedType.kind && (i2 = e2.expectedType);
            for (let n3 = 1; n3 < t2.length; n3 += 2) {
              const s2 = 1 === n3 ? -1 / 0 : t2[n3], o2 = t2[n3 + 1], a2 = n3, l2 = n3 + 1;
              if ("number" != typeof s2) return e2.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', a2);
              if (r2.length && r2[r2.length - 1][0] >= s2) return e2.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', a2);
              const u2 = e2.parse(o2, l2, i2);
              if (!u2) return null;
              i2 = i2 || u2.type, r2.push([s2, u2]);
            }
            return new cn(i2, n2, r2);
          }
          evaluate(t2) {
            const e2 = this.labels, n2 = this.outputs;
            if (1 === e2.length) return n2[0].evaluate(t2);
            const r2 = this.input.evaluate(t2);
            if (r2 <= e2[0]) return n2[0].evaluate(t2);
            const i2 = e2.length;
            return r2 >= e2[i2 - 1] ? n2[i2 - 1].evaluate(t2) : n2[un(e2, r2)].evaluate(t2);
          }
          eachChild(t2) {
            t2(this.input);
            for (const e2 of this.outputs) t2(e2);
          }
          outputDefined() {
            return this.outputs.every(((t2) => t2.outputDefined()));
          }
        }
        function hn(t2) {
          return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
        }
        var pn, fn, dn = (function() {
          if (fn) return pn;
          function t2(t3, e2, n2, r2) {
            this.cx = 3 * t3, this.bx = 3 * (n2 - t3) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e2, this.by = 3 * (r2 - e2) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t3, this.p1y = e2, this.p2x = n2, this.p2y = r2;
          }
          return fn = 1, pn = t2, t2.prototype = { sampleCurveX: function(t3) {
            return ((this.ax * t3 + this.bx) * t3 + this.cx) * t3;
          }, sampleCurveY: function(t3) {
            return ((this.ay * t3 + this.by) * t3 + this.cy) * t3;
          }, sampleCurveDerivativeX: function(t3) {
            return (3 * this.ax * t3 + 2 * this.bx) * t3 + this.cx;
          }, solveCurveX: function(t3, e2) {
            if (void 0 === e2 && (e2 = 1e-6), t3 < 0) return 0;
            if (t3 > 1) return 1;
            for (var n2 = t3, r2 = 0; r2 < 8; r2++) {
              var i2 = this.sampleCurveX(n2) - t3;
              if (Math.abs(i2) < e2) return n2;
              var s2 = this.sampleCurveDerivativeX(n2);
              if (Math.abs(s2) < 1e-6) break;
              n2 -= i2 / s2;
            }
            var o2 = 0, a2 = 1;
            for (n2 = t3, r2 = 0; r2 < 20 && (i2 = this.sampleCurveX(n2), !(Math.abs(i2 - t3) < e2)); r2++) t3 > i2 ? o2 = n2 : a2 = n2, n2 = 0.5 * (a2 - o2) + o2;
            return n2;
          }, solve: function(t3, e2) {
            return this.sampleCurveY(this.solveCurveX(t3, e2));
          } }, pn;
        })(), yn = hn(dn);
        class mn {
          constructor(t2, e2, n2, r2, i2) {
            this.type = t2, this.operator = e2, this.interpolation = n2, this.input = r2, this.labels = [], this.outputs = [];
            for (const [t3, e3] of i2) this.labels.push(t3), this.outputs.push(e3);
          }
          static interpolationFactor(t2, e2, n2, r2) {
            let i2 = 0;
            if ("exponential" === t2.name) i2 = gn(e2, t2.base, n2, r2);
            else if ("linear" === t2.name) i2 = gn(e2, 1, n2, r2);
            else if ("cubic-bezier" === t2.name) {
              const s2 = t2.controlPoints;
              i2 = new yn(s2[0], s2[1], s2[2], s2[3]).solve(gn(e2, 1, n2, r2));
            }
            return i2;
          }
          static parse(t2, e2) {
            let [n2, r2, i2, ...s2] = t2;
            if (!Array.isArray(r2) || 0 === r2.length) return e2.error("Expected an interpolation type expression.", 1);
            if ("linear" === r2[0]) r2 = { name: "linear" };
            else if ("exponential" === r2[0]) {
              const t3 = r2[1];
              if ("number" != typeof t3) return e2.error("Exponential interpolation requires a numeric base.", 1, 1);
              r2 = { name: "exponential", base: t3 };
            } else {
              if ("cubic-bezier" !== r2[0]) return e2.error(`Unknown interpolation type ${String(r2[0])}`, 1, 0);
              {
                const t3 = r2.slice(1);
                if (4 !== t3.length || t3.some(((t4) => "number" != typeof t4 || t4 < 0 || t4 > 1))) return e2.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
                r2 = { name: "cubic-bezier", controlPoints: t3 };
              }
            }
            if (t2.length - 1 < 4) return e2.error(`Expected at least 4 arguments, but found only ${t2.length - 1}.`);
            if ((t2.length - 1) % 2 != 0) return e2.error("Expected an even number of arguments.");
            if (i2 = e2.parse(i2, 2, Ot), !i2) return null;
            const o2 = [];
            let a2 = null;
            "interpolate-hcl" !== n2 && "interpolate-lab" !== n2 || e2.expectedType == Zt ? e2.expectedType && "value" !== e2.expectedType.kind && (a2 = e2.expectedType) : a2 = Nt;
            for (let t3 = 0; t3 < s2.length; t3 += 2) {
              const n3 = s2[t3], r3 = s2[t3 + 1], i3 = t3 + 3, l2 = t3 + 4;
              if ("number" != typeof n3) return e2.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', i3);
              if (o2.length && o2[o2.length - 1][0] >= n3) return e2.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', i3);
              const u2 = e2.parse(r3, l2, a2);
              if (!u2) return null;
              a2 = a2 || u2.type, o2.push([n3, u2]);
            }
            return ie(a2, Ot) || ie(a2, Ut) || ie(a2, Nt) || ie(a2, Yt) || ie(a2, Ht) || ie(a2, Zt) || ie(a2, Kt) || ie(a2, Jt(Ot)) ? new mn(a2, n2, r2, i2, o2) : e2.error(`Type ${Qt(a2)} is not interpolatable.`);
          }
          evaluate(t2) {
            const e2 = this.labels, n2 = this.outputs;
            if (1 === e2.length) return n2[0].evaluate(t2);
            const r2 = this.input.evaluate(t2);
            if (r2 <= e2[0]) return n2[0].evaluate(t2);
            const i2 = e2.length;
            if (r2 >= e2[i2 - 1]) return n2[i2 - 1].evaluate(t2);
            const s2 = un(e2, r2), o2 = mn.interpolationFactor(this.interpolation, r2, e2[s2], e2[s2 + 1]), a2 = n2[s2].evaluate(t2), l2 = n2[s2 + 1].evaluate(t2);
            switch (this.operator) {
              case "interpolate":
                switch (this.type.kind) {
                  case "number":
                    return Ie(a2, l2, o2);
                  case "color":
                    return Te.interpolate(a2, l2, o2);
                  case "padding":
                    return Be.interpolate(a2, l2, o2);
                  case "colorArray":
                    return Ve.interpolate(a2, l2, o2);
                  case "numberArray":
                    return Ce.interpolate(a2, l2, o2);
                  case "variableAnchorOffsetCollection":
                    return $e.interpolate(a2, l2, o2);
                  case "array":
                    return Ee(a2, l2, o2);
                  case "projectionDefinition":
                    return Ne.interpolate(a2, l2, o2);
                }
              case "interpolate-hcl":
                switch (this.type.kind) {
                  case "color":
                    return Te.interpolate(a2, l2, o2, "hcl");
                  case "colorArray":
                    return Ve.interpolate(a2, l2, o2, "hcl");
                }
              case "interpolate-lab":
                switch (this.type.kind) {
                  case "color":
                    return Te.interpolate(a2, l2, o2, "lab");
                  case "colorArray":
                    return Ve.interpolate(a2, l2, o2, "lab");
                }
            }
          }
          eachChild(t2) {
            t2(this.input);
            for (const e2 of this.outputs) t2(e2);
          }
          outputDefined() {
            return this.outputs.every(((t2) => t2.outputDefined()));
          }
        }
        function gn(t2, e2, n2, r2) {
          const i2 = r2 - n2, s2 = t2 - n2;
          return 0 === i2 ? 0 : 1 === e2 ? s2 / i2 : (Math.pow(e2, s2) - 1) / (Math.pow(e2, i2) - 1);
        }
        const xn = { color: Te.interpolate, number: Ie, padding: Be.interpolate, numberArray: Ce.interpolate, colorArray: Ve.interpolate, variableAnchorOffsetCollection: $e.interpolate, array: Ee };
        class vn {
          constructor(t2, e2) {
            this.type = t2, this.args = e2;
          }
          static parse(t2, e2) {
            if (t2.length < 2) return e2.error("Expected at least one argument.");
            let n2 = null;
            const r2 = e2.expectedType;
            r2 && "value" !== r2.kind && (n2 = r2);
            const i2 = [];
            for (const r3 of t2.slice(1)) {
              const t3 = e2.parse(r3, 1 + i2.length, n2, void 0, { typeAnnotation: "omit" });
              if (!t3) return null;
              n2 = n2 || t3.type, i2.push(t3);
            }
            if (!n2) throw new Error("No output type");
            const s2 = r2 && i2.some(((t3) => ee(r2, t3.type)));
            return new vn(s2 ? qt : n2, i2);
          }
          evaluate(t2) {
            let e2, n2 = null, r2 = 0;
            for (const i2 of this.args) if (r2++, n2 = i2.evaluate(t2), n2 && n2 instanceof Re && !n2.available && (e2 || (e2 = n2.name), n2 = null, r2 === this.args.length && (n2 = e2)), null !== n2) break;
            return n2;
          }
          eachChild(t2) {
            this.args.forEach(t2);
          }
          outputDefined() {
            return this.args.every(((t2) => t2.outputDefined()));
          }
        }
        function bn(t2, e2) {
          return "==" === t2 || "!=" === t2 ? "boolean" === e2.kind || "string" === e2.kind || "number" === e2.kind || "null" === e2.kind || "value" === e2.kind : "string" === e2.kind || "number" === e2.kind || "value" === e2.kind;
        }
        function wn(t2, e2, n2, r2) {
          return 0 === r2.compare(e2, n2);
        }
        function _n(t2, e2, n2) {
          const r2 = "==" !== t2 && "!=" !== t2;
          return class i2 {
            constructor(t3, e3, n3) {
              this.type = Rt, this.lhs = t3, this.rhs = e3, this.collator = n3, this.hasUntypedArgument = "value" === t3.type.kind || "value" === e3.type.kind;
            }
            static parse(t3, e3) {
              if (3 !== t3.length && 4 !== t3.length) return e3.error("Expected two or three arguments.");
              const n3 = t3[0];
              let s2 = e3.parse(t3[1], 1, qt);
              if (!s2) return null;
              if (!bn(n3, s2.type)) return e3.concat(1).error(`"${n3}" comparisons are not supported for type '${Qt(s2.type)}'.`);
              let o2 = e3.parse(t3[2], 2, qt);
              if (!o2) return null;
              if (!bn(n3, o2.type)) return e3.concat(2).error(`"${n3}" comparisons are not supported for type '${Qt(o2.type)}'.`);
              if (s2.type.kind !== o2.type.kind && "value" !== s2.type.kind && "value" !== o2.type.kind) return e3.error(`Cannot compare types '${Qt(s2.type)}' and '${Qt(o2.type)}'.`);
              r2 && ("value" === s2.type.kind && "value" !== o2.type.kind ? s2 = new Ze(o2.type, [s2]) : "value" !== s2.type.kind && "value" === o2.type.kind && (o2 = new Ze(s2.type, [o2])));
              let a2 = null;
              if (4 === t3.length) {
                if ("string" !== s2.type.kind && "string" !== o2.type.kind && "value" !== s2.type.kind && "value" !== o2.type.kind) return e3.error("Cannot use collator to compare non-string types.");
                if (a2 = e3.parse(t3[3], 3, Gt), !a2) return null;
              }
              return new i2(s2, o2, a2);
            }
            evaluate(i3) {
              const s2 = this.lhs.evaluate(i3), o2 = this.rhs.evaluate(i3);
              if (r2 && this.hasUntypedArgument) {
                const e3 = qe(s2), n3 = qe(o2);
                if (e3.kind !== n3.kind || "string" !== e3.kind && "number" !== e3.kind) throw new Le(`Expected arguments for "${t2}" to be (string, string) or (number, number), but found (${e3.kind}, ${n3.kind}) instead.`);
              }
              if (this.collator && !r2 && this.hasUntypedArgument) {
                const t3 = qe(s2), n3 = qe(o2);
                if ("string" !== t3.kind || "string" !== n3.kind) return e2(i3, s2, o2);
              }
              return this.collator ? n2(i3, s2, o2, this.collator.evaluate(i3)) : e2(i3, s2, o2);
            }
            eachChild(t3) {
              t3(this.lhs), t3(this.rhs), this.collator && t3(this.collator);
            }
            outputDefined() {
              return true;
            }
          };
        }
        const Sn = _n("==", (function(t2, e2, n2) {
          return e2 === n2;
        }), wn), An = _n("!=", (function(t2, e2, n2) {
          return e2 !== n2;
        }), (function(t2, e2, n2, r2) {
          return !wn(0, e2, n2, r2);
        })), Mn = _n("<", (function(t2, e2, n2) {
          return e2 < n2;
        }), (function(t2, e2, n2, r2) {
          return r2.compare(e2, n2) < 0;
        })), kn = _n(">", (function(t2, e2, n2) {
          return e2 > n2;
        }), (function(t2, e2, n2, r2) {
          return r2.compare(e2, n2) > 0;
        })), In = _n("<=", (function(t2, e2, n2) {
          return e2 <= n2;
        }), (function(t2, e2, n2, r2) {
          return r2.compare(e2, n2) <= 0;
        })), En = _n(">=", (function(t2, e2, n2) {
          return e2 >= n2;
        }), (function(t2, e2, n2, r2) {
          return r2.compare(e2, n2) >= 0;
        }));
        class Tn {
          constructor(t2, e2, n2) {
            this.type = Gt, this.locale = n2, this.caseSensitive = t2, this.diacriticSensitive = e2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error("Expected one argument.");
            const n2 = t2[1];
            if ("object" != typeof n2 || Array.isArray(n2)) return e2.error("Collator options argument must be an object.");
            const r2 = e2.parse(void 0 !== n2["case-sensitive"] && n2["case-sensitive"], 1, Rt);
            if (!r2) return null;
            const i2 = e2.parse(void 0 !== n2["diacritic-sensitive"] && n2["diacritic-sensitive"], 1, Rt);
            if (!i2) return null;
            let s2 = null;
            return n2.locale && (s2 = e2.parse(n2.locale, 1, $t), !s2) ? null : new Tn(r2, i2, s2);
          }
          evaluate(t2) {
            return new Fe(this.caseSensitive.evaluate(t2), this.diacriticSensitive.evaluate(t2), this.locale ? this.locale.evaluate(t2) : null);
          }
          eachChild(t2) {
            t2(this.caseSensitive), t2(this.diacriticSensitive), this.locale && t2(this.locale);
          }
          outputDefined() {
            return false;
          }
        }
        class Fn {
          constructor(t2, e2, n2, r2, i2, s2) {
            this.type = $t, this.number = t2, this.locale = e2, this.currency = n2, this.unit = r2, this.minFractionDigits = i2, this.maxFractionDigits = s2;
          }
          static parse(t2, e2) {
            if (3 !== t2.length) return e2.error("Expected two arguments.");
            const n2 = e2.parse(t2[1], 1, Ot);
            if (!n2) return null;
            const r2 = t2[2];
            if ("object" != typeof r2 || Array.isArray(r2)) return e2.error("NumberFormat options argument must be an object.");
            let i2 = null;
            if (r2.locale && (i2 = e2.parse(r2.locale, 1, $t), !i2)) return null;
            let s2 = null;
            if (r2.currency && (s2 = e2.parse(r2.currency, 1, $t), !s2)) return null;
            let o2 = null;
            if (r2.unit && (o2 = e2.parse(r2.unit, 1, $t), !o2)) return null;
            if (s2 && o2) return e2.error("NumberFormat options `currency` and `unit` are mutually exclusive");
            let a2 = null;
            if (r2["min-fraction-digits"] && (a2 = e2.parse(r2["min-fraction-digits"], 1, Ot), !a2)) return null;
            let l2 = null;
            return r2["max-fraction-digits"] && (l2 = e2.parse(r2["max-fraction-digits"], 1, Ot), !l2) ? null : new Fn(n2, i2, s2, o2, a2, l2);
          }
          evaluate(t2) {
            return new Intl.NumberFormat(this.locale ? this.locale.evaluate(t2) : [], { style: this.currency ? "currency" : this.unit ? "unit" : "decimal", currency: this.currency ? this.currency.evaluate(t2) : void 0, unit: this.unit ? this.unit.evaluate(t2) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(t2) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(t2) : void 0 }).format(this.number.evaluate(t2));
          }
          eachChild(t2) {
            t2(this.number), this.locale && t2(this.locale), this.currency && t2(this.currency), this.unit && t2(this.unit), this.minFractionDigits && t2(this.minFractionDigits), this.maxFractionDigits && t2(this.maxFractionDigits);
          }
          outputDefined() {
            return false;
          }
        }
        class Pn {
          constructor(t2) {
            this.type = Xt, this.sections = t2;
          }
          static parse(t2, e2) {
            if (t2.length < 2) return e2.error("Expected at least one argument.");
            const n2 = t2[1];
            if (!Array.isArray(n2) && "object" == typeof n2) return e2.error("First argument must be an image or text section.");
            const r2 = [];
            let i2 = false;
            for (let n3 = 1; n3 <= t2.length - 1; ++n3) {
              const s2 = t2[n3];
              if (i2 && "object" == typeof s2 && !Array.isArray(s2)) {
                i2 = false;
                let t3 = null;
                if (s2["font-scale"] && (t3 = e2.parse(s2["font-scale"], 1, Ot), !t3)) return null;
                let n4 = null;
                if (s2["text-font"] && (n4 = e2.parse(s2["text-font"], 1, Jt($t)), !n4)) return null;
                let o2 = null;
                if (s2["text-color"] && (o2 = e2.parse(s2["text-color"], 1, Nt), !o2)) return null;
                let a2 = null;
                if (s2["vertical-align"]) {
                  if ("string" == typeof s2["vertical-align"] && !Pe.includes(s2["vertical-align"])) return e2.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s2["vertical-align"]}' instead.`);
                  if (a2 = e2.parse(s2["vertical-align"], 1, $t), !a2) return null;
                }
                const l2 = r2[r2.length - 1];
                l2.scale = t3, l2.font = n4, l2.textColor = o2, l2.verticalAlign = a2;
              } else {
                const s3 = e2.parse(t2[n3], 1, qt);
                if (!s3) return null;
                const o2 = s3.type.kind;
                if ("string" !== o2 && "value" !== o2 && "null" !== o2 && "resolvedImage" !== o2) return e2.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
                i2 = true, r2.push({ content: s3, scale: null, font: null, textColor: null, verticalAlign: null });
              }
            }
            return new Pn(r2);
          }
          evaluate(t2) {
            return new ze(this.sections.map(((e2) => {
              const n2 = e2.content.evaluate(t2);
              return qe(n2) === Wt ? new De("", n2, null, null, null, e2.verticalAlign ? e2.verticalAlign.evaluate(t2) : null) : new De(Ge(n2), null, e2.scale ? e2.scale.evaluate(t2) : null, e2.font ? e2.font.evaluate(t2).join(",") : null, e2.textColor ? e2.textColor.evaluate(t2) : null, e2.verticalAlign ? e2.verticalAlign.evaluate(t2) : null);
            })));
          }
          eachChild(t2) {
            for (const e2 of this.sections) t2(e2.content), e2.scale && t2(e2.scale), e2.font && t2(e2.font), e2.textColor && t2(e2.textColor), e2.verticalAlign && t2(e2.verticalAlign);
          }
          outputDefined() {
            return false;
          }
        }
        class Dn {
          constructor(t2) {
            this.type = Wt, this.input = t2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error("Expected two arguments.");
            const n2 = e2.parse(t2[1], 1, $t);
            return n2 ? new Dn(n2) : e2.error("No image name provided.");
          }
          evaluate(t2) {
            const e2 = this.input.evaluate(t2), n2 = Re.fromString(e2);
            return n2 && t2.availableImages && (n2.available = t2.availableImages.indexOf(e2) > -1), n2;
          }
          eachChild(t2) {
            t2(this.input);
          }
          outputDefined() {
            return false;
          }
        }
        class zn {
          constructor(t2) {
            this.type = Ot, this.input = t2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error(`Expected 1 argument, but found ${t2.length - 1} instead.`);
            const n2 = e2.parse(t2[1], 1);
            return n2 ? "array" !== n2.type.kind && "string" !== n2.type.kind && "value" !== n2.type.kind ? e2.error(`Expected argument of type string or array, but found ${Qt(n2.type)} instead.`) : new zn(n2) : null;
          }
          evaluate(t2) {
            const e2 = this.input.evaluate(t2);
            if ("string" == typeof e2) return [...e2].length;
            if (Array.isArray(e2)) return e2.length;
            throw new Le(`Expected value to be of type string or array, but found ${Qt(qe(e2))} instead.`);
          }
          eachChild(t2) {
            t2(this.input);
          }
          outputDefined() {
            return false;
          }
        }
        const Bn = 8192;
        function Cn(t2, e2) {
          const n2 = (180 + t2[0]) / 360, r2 = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t2[1] * Math.PI / 360))) / 360, i2 = Math.pow(2, e2.z);
          return [Math.round(n2 * i2 * Bn), Math.round(r2 * i2 * Bn)];
        }
        function Vn(t2, e2) {
          const n2 = Math.pow(2, e2.z);
          return [(i2 = (t2[0] / Bn + e2.x) / n2, 360 * i2 - 180), (r2 = (t2[1] / Bn + e2.y) / n2, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * r2) * Math.PI / 180)) - 90)];
          var r2, i2;
        }
        function Ln(t2, e2) {
          t2[0] = Math.min(t2[0], e2[0]), t2[1] = Math.min(t2[1], e2[1]), t2[2] = Math.max(t2[2], e2[0]), t2[3] = Math.max(t2[3], e2[1]);
        }
        function On(t2, e2) {
          return !(t2[0] <= e2[0] || t2[2] >= e2[2] || t2[1] <= e2[1] || t2[3] >= e2[3]);
        }
        function $n(t2, e2, n2) {
          const r2 = t2[0] - e2[0], i2 = t2[1] - e2[1], s2 = t2[0] - n2[0], o2 = t2[1] - n2[1];
          return r2 * o2 - s2 * i2 == 0 && r2 * s2 <= 0 && i2 * o2 <= 0;
        }
        function Rn(t2, e2, n2, r2) {
          return 0 != (i2 = [r2[0] - n2[0], r2[1] - n2[1]])[0] * (s2 = [e2[0] - t2[0], e2[1] - t2[1]])[1] - i2[1] * s2[0] && !(!Xn(t2, e2, n2, r2) || !Xn(n2, r2, t2, e2));
          var i2, s2;
        }
        function Nn(t2, e2, n2) {
          for (const r2 of n2) for (let n3 = 0; n3 < r2.length - 1; ++n3) if (Rn(t2, e2, r2[n3], r2[n3 + 1])) return true;
          return false;
        }
        function Un(t2, e2, n2 = false) {
          let r2 = false;
          for (const a2 of e2) for (let e3 = 0; e3 < a2.length - 1; e3++) {
            if ($n(t2, a2[e3], a2[e3 + 1])) return n2;
            (s2 = a2[e3])[1] > (i2 = t2)[1] != (o2 = a2[e3 + 1])[1] > i2[1] && i2[0] < (o2[0] - s2[0]) * (i2[1] - s2[1]) / (o2[1] - s2[1]) + s2[0] && (r2 = !r2);
          }
          var i2, s2, o2;
          return r2;
        }
        function jn(t2, e2) {
          for (const n2 of e2) if (Un(t2, n2)) return true;
          return false;
        }
        function qn(t2, e2) {
          for (const n2 of t2) if (!Un(n2, e2)) return false;
          for (let n2 = 0; n2 < t2.length - 1; ++n2) if (Nn(t2[n2], t2[n2 + 1], e2)) return false;
          return true;
        }
        function Gn(t2, e2) {
          for (const n2 of e2) if (qn(t2, n2)) return true;
          return false;
        }
        function Xn(t2, e2, n2, r2) {
          const i2 = r2[0] - n2[0], s2 = r2[1] - n2[1], o2 = (t2[0] - n2[0]) * s2 - i2 * (t2[1] - n2[1]), a2 = (e2[0] - n2[0]) * s2 - i2 * (e2[1] - n2[1]);
          return o2 > 0 && a2 < 0 || o2 < 0 && a2 > 0;
        }
        function Yn(t2, e2, n2) {
          const r2 = [];
          for (let i2 = 0; i2 < t2.length; i2++) {
            const s2 = [];
            for (let r3 = 0; r3 < t2[i2].length; r3++) {
              const o2 = Cn(t2[i2][r3], n2);
              Ln(e2, o2), s2.push(o2);
            }
            r2.push(s2);
          }
          return r2;
        }
        function Zn(t2, e2, n2) {
          const r2 = [];
          for (let i2 = 0; i2 < t2.length; i2++) {
            const s2 = Yn(t2[i2], e2, n2);
            r2.push(s2);
          }
          return r2;
        }
        function Hn(t2, e2, n2, r2) {
          if (t2[0] < n2[0] || t2[0] > n2[2]) {
            const e3 = 0.5 * r2;
            let i2 = t2[0] - n2[0] > e3 ? -r2 : n2[0] - t2[0] > e3 ? r2 : 0;
            0 === i2 && (i2 = t2[0] - n2[2] > e3 ? -r2 : n2[2] - t2[0] > e3 ? r2 : 0), t2[0] += i2;
          }
          Ln(e2, t2);
        }
        function Wn(t2, e2, n2, r2) {
          const i2 = Math.pow(2, r2.z) * Bn, s2 = [r2.x * Bn, r2.y * Bn], o2 = [];
          for (const r3 of t2) for (const t3 of r3) {
            const r4 = [t3.x + s2[0], t3.y + s2[1]];
            Hn(r4, e2, n2, i2), o2.push(r4);
          }
          return o2;
        }
        function Kn(t2, e2, n2, r2) {
          const i2 = Math.pow(2, r2.z) * Bn, s2 = [r2.x * Bn, r2.y * Bn], o2 = [];
          for (const n3 of t2) {
            const t3 = [];
            for (const r3 of n3) {
              const n4 = [r3.x + s2[0], r3.y + s2[1]];
              Ln(e2, n4), t3.push(n4);
            }
            o2.push(t3);
          }
          if (e2[2] - e2[0] <= i2 / 2) {
            (a2 = e2)[0] = a2[1] = 1 / 0, a2[2] = a2[3] = -1 / 0;
            for (const t3 of o2) for (const r3 of t3) Hn(r3, e2, n2, i2);
          }
          var a2;
          return o2;
        }
        class Jn {
          constructor(t2, e2) {
            this.type = Rt, this.geojson = t2, this.geometries = e2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error(`'within' expression requires exactly one argument, but found ${t2.length - 1} instead.`);
            if (je(t2[1])) {
              const e3 = t2[1];
              if ("FeatureCollection" === e3.type) {
                const t3 = [];
                for (const n2 of e3.features) {
                  const { type: e4, coordinates: r2 } = n2.geometry;
                  "Polygon" === e4 && t3.push(r2), "MultiPolygon" === e4 && t3.push(...r2);
                }
                if (t3.length) return new Jn(e3, { type: "MultiPolygon", coordinates: t3 });
              } else if ("Feature" === e3.type) {
                const t3 = e3.geometry.type;
                if ("Polygon" === t3 || "MultiPolygon" === t3) return new Jn(e3, e3.geometry);
              } else if ("Polygon" === e3.type || "MultiPolygon" === e3.type) return new Jn(e3, e3);
            }
            return e2.error("'within' expression requires valid geojson object that contains polygon geometry type.");
          }
          evaluate(t2) {
            if (null != t2.geometry() && null != t2.canonicalID()) {
              if ("Point" === t2.geometryType()) return (function(t3, e2) {
                const n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i2 = t3.canonicalID();
                if ("Polygon" === e2.type) {
                  const s2 = Yn(e2.coordinates, r2, i2), o2 = Wn(t3.geometry(), n2, r2, i2);
                  if (!On(n2, r2)) return false;
                  for (const t4 of o2) if (!Un(t4, s2)) return false;
                }
                if ("MultiPolygon" === e2.type) {
                  const s2 = Zn(e2.coordinates, r2, i2), o2 = Wn(t3.geometry(), n2, r2, i2);
                  if (!On(n2, r2)) return false;
                  for (const t4 of o2) if (!jn(t4, s2)) return false;
                }
                return true;
              })(t2, this.geometries);
              if ("LineString" === t2.geometryType()) return (function(t3, e2) {
                const n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], r2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i2 = t3.canonicalID();
                if ("Polygon" === e2.type) {
                  const s2 = Yn(e2.coordinates, r2, i2), o2 = Kn(t3.geometry(), n2, r2, i2);
                  if (!On(n2, r2)) return false;
                  for (const t4 of o2) if (!qn(t4, s2)) return false;
                }
                if ("MultiPolygon" === e2.type) {
                  const s2 = Zn(e2.coordinates, r2, i2), o2 = Kn(t3.geometry(), n2, r2, i2);
                  if (!On(n2, r2)) return false;
                  for (const t4 of o2) if (!Gn(t4, s2)) return false;
                }
                return true;
              })(t2, this.geometries);
            }
            return false;
          }
          eachChild() {
          }
          outputDefined() {
            return true;
          }
        }
        let Qn = class {
          constructor(t2 = [], e2 = (t3, e3) => t3 < e3 ? -1 : t3 > e3 ? 1 : 0) {
            if (this.data = t2, this.length = this.data.length, this.compare = e2, this.length > 0) for (let t3 = (this.length >> 1) - 1; t3 >= 0; t3--) this._down(t3);
          }
          push(t2) {
            this.data.push(t2), this._up(this.length++);
          }
          pop() {
            if (0 === this.length) return;
            const t2 = this.data[0], e2 = this.data.pop();
            return --this.length > 0 && (this.data[0] = e2, this._down(0)), t2;
          }
          peek() {
            return this.data[0];
          }
          _up(t2) {
            const { data: e2, compare: n2 } = this, r2 = e2[t2];
            for (; t2 > 0; ) {
              const i2 = t2 - 1 >> 1, s2 = e2[i2];
              if (n2(r2, s2) >= 0) break;
              e2[t2] = s2, t2 = i2;
            }
            e2[t2] = r2;
          }
          _down(t2) {
            const { data: e2, compare: n2 } = this, r2 = this.length >> 1, i2 = e2[t2];
            for (; t2 < r2; ) {
              let r3 = 1 + (t2 << 1);
              const s2 = r3 + 1;
              if (s2 < this.length && n2(e2[s2], e2[r3]) < 0 && (r3 = s2), n2(e2[r3], i2) >= 0) break;
              e2[t2] = e2[r3], t2 = r3;
            }
            e2[t2] = i2;
          }
        };
        function tr(t2, e2, n2 = 0, r2 = t2.length - 1, i2 = nr) {
          for (; r2 > n2; ) {
            if (r2 - n2 > 600) {
              const s3 = r2 - n2 + 1, o3 = e2 - n2 + 1, a3 = Math.log(s3), l2 = 0.5 * Math.exp(2 * a3 / 3), u2 = 0.5 * Math.sqrt(a3 * l2 * (s3 - l2) / s3) * (o3 - s3 / 2 < 0 ? -1 : 1);
              tr(t2, e2, Math.max(n2, Math.floor(e2 - o3 * l2 / s3 + u2)), Math.min(r2, Math.floor(e2 + (s3 - o3) * l2 / s3 + u2)), i2);
            }
            const s2 = t2[e2];
            let o2 = n2, a2 = r2;
            for (er(t2, n2, e2), i2(t2[r2], s2) > 0 && er(t2, n2, r2); o2 < a2; ) {
              for (er(t2, o2, a2), o2++, a2--; i2(t2[o2], s2) < 0; ) o2++;
              for (; i2(t2[a2], s2) > 0; ) a2--;
            }
            0 === i2(t2[n2], s2) ? er(t2, n2, a2) : (a2++, er(t2, a2, r2)), a2 <= e2 && (n2 = a2 + 1), e2 <= a2 && (r2 = a2 - 1);
          }
        }
        function er(t2, e2, n2) {
          const r2 = t2[e2];
          t2[e2] = t2[n2], t2[n2] = r2;
        }
        function nr(t2, e2) {
          return t2 < e2 ? -1 : t2 > e2 ? 1 : 0;
        }
        function rr(t2, e2) {
          if (t2.length <= 1) return [t2];
          const n2 = [];
          let r2, i2;
          for (const e3 of t2) {
            const t3 = sr(e3);
            0 !== t3 && (e3.area = Math.abs(t3), void 0 === i2 && (i2 = t3 < 0), i2 === t3 < 0 ? (r2 && n2.push(r2), r2 = [e3]) : r2.push(e3));
          }
          if (r2 && n2.push(r2), e2 > 1) for (let t3 = 0; t3 < n2.length; t3++) n2[t3].length <= e2 || (tr(n2[t3], e2, 1, n2[t3].length - 1, ir), n2[t3] = n2[t3].slice(0, e2));
          return n2;
        }
        function ir(t2, e2) {
          return e2.area - t2.area;
        }
        function sr(t2) {
          let e2 = 0;
          for (let n2, r2, i2 = 0, s2 = t2.length, o2 = s2 - 1; i2 < s2; o2 = i2++) n2 = t2[i2], r2 = t2[o2], e2 += (r2.x - n2.x) * (n2.y + r2.y);
          return e2;
        }
        const or = 1 / 298.257223563, ar = or * (2 - or), lr = Math.PI / 180;
        class ur {
          constructor(t2) {
            const e2 = 6378.137 * lr * 1e3, n2 = Math.cos(t2 * lr), r2 = 1 / (1 - ar * (1 - n2 * n2)), i2 = Math.sqrt(r2);
            this.kx = e2 * i2 * n2, this.ky = e2 * i2 * r2 * (1 - ar);
          }
          distance(t2, e2) {
            const n2 = this.wrap(t2[0] - e2[0]) * this.kx, r2 = (t2[1] - e2[1]) * this.ky;
            return Math.sqrt(n2 * n2 + r2 * r2);
          }
          pointOnLine(t2, e2) {
            let n2, r2, i2, s2, o2 = 1 / 0;
            for (let a2 = 0; a2 < t2.length - 1; a2++) {
              let l2 = t2[a2][0], u2 = t2[a2][1], c2 = this.wrap(t2[a2 + 1][0] - l2) * this.kx, h2 = (t2[a2 + 1][1] - u2) * this.ky, p2 = 0;
              0 === c2 && 0 === h2 || (p2 = (this.wrap(e2[0] - l2) * this.kx * c2 + (e2[1] - u2) * this.ky * h2) / (c2 * c2 + h2 * h2), p2 > 1 ? (l2 = t2[a2 + 1][0], u2 = t2[a2 + 1][1]) : p2 > 0 && (l2 += c2 / this.kx * p2, u2 += h2 / this.ky * p2)), c2 = this.wrap(e2[0] - l2) * this.kx, h2 = (e2[1] - u2) * this.ky;
              const f2 = c2 * c2 + h2 * h2;
              f2 < o2 && (o2 = f2, n2 = l2, r2 = u2, i2 = a2, s2 = p2);
            }
            return { point: [n2, r2], index: i2, t: Math.max(0, Math.min(1, s2)) };
          }
          wrap(t2) {
            for (; t2 < -180; ) t2 += 360;
            for (; t2 > 180; ) t2 -= 360;
            return t2;
          }
        }
        function cr(t2, e2) {
          return e2[0] - t2[0];
        }
        function hr(t2) {
          return t2[1] - t2[0] + 1;
        }
        function pr(t2, e2) {
          return t2[1] >= t2[0] && t2[1] < e2;
        }
        function fr(t2, e2) {
          if (t2[0] > t2[1]) return [null, null];
          const n2 = hr(t2);
          if (e2) {
            if (2 === n2) return [t2, null];
            const e3 = Math.floor(n2 / 2);
            return [[t2[0], t2[0] + e3], [t2[0] + e3, t2[1]]];
          }
          if (1 === n2) return [t2, null];
          const r2 = Math.floor(n2 / 2) - 1;
          return [[t2[0], t2[0] + r2], [t2[0] + r2 + 1, t2[1]]];
        }
        function dr(t2, e2) {
          if (!pr(e2, t2.length)) return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
          const n2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
          for (let r2 = e2[0]; r2 <= e2[1]; ++r2) Ln(n2, t2[r2]);
          return n2;
        }
        function yr(t2) {
          const e2 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
          for (const n2 of t2) for (const t3 of n2) Ln(e2, t3);
          return e2;
        }
        function mr(t2) {
          return t2[0] !== -1 / 0 && t2[1] !== -1 / 0 && t2[2] !== 1 / 0 && t2[3] !== 1 / 0;
        }
        function gr(t2, e2, n2) {
          if (!mr(t2) || !mr(e2)) return NaN;
          let r2 = 0, i2 = 0;
          return t2[2] < e2[0] && (r2 = e2[0] - t2[2]), t2[0] > e2[2] && (r2 = t2[0] - e2[2]), t2[1] > e2[3] && (i2 = t2[1] - e2[3]), t2[3] < e2[1] && (i2 = e2[1] - t2[3]), n2.distance([0, 0], [r2, i2]);
        }
        function xr(t2, e2, n2) {
          const r2 = n2.pointOnLine(e2, t2);
          return n2.distance(t2, r2.point);
        }
        function vr(t2, e2, n2, r2, i2) {
          const s2 = Math.min(xr(t2, [n2, r2], i2), xr(e2, [n2, r2], i2)), o2 = Math.min(xr(n2, [t2, e2], i2), xr(r2, [t2, e2], i2));
          return Math.min(s2, o2);
        }
        function br(t2, e2, n2, r2, i2) {
          if (!pr(e2, t2.length) || !pr(r2, n2.length)) return 1 / 0;
          let s2 = 1 / 0;
          for (let o2 = e2[0]; o2 < e2[1]; ++o2) {
            const e3 = t2[o2], a2 = t2[o2 + 1];
            for (let t3 = r2[0]; t3 < r2[1]; ++t3) {
              const r3 = n2[t3], o3 = n2[t3 + 1];
              if (Rn(e3, a2, r3, o3)) return 0;
              s2 = Math.min(s2, vr(e3, a2, r3, o3, i2));
            }
          }
          return s2;
        }
        function wr(t2, e2, n2, r2, i2) {
          if (!pr(e2, t2.length) || !pr(r2, n2.length)) return NaN;
          let s2 = 1 / 0;
          for (let o2 = e2[0]; o2 <= e2[1]; ++o2) for (let e3 = r2[0]; e3 <= r2[1]; ++e3) if (s2 = Math.min(s2, i2.distance(t2[o2], n2[e3])), 0 === s2) return s2;
          return s2;
        }
        function _r(t2, e2, n2) {
          if (Un(t2, e2, true)) return 0;
          let r2 = 1 / 0;
          for (const i2 of e2) {
            const e3 = i2[0], s2 = i2[i2.length - 1];
            if (e3 !== s2 && (r2 = Math.min(r2, xr(t2, [s2, e3], n2)), 0 === r2)) return r2;
            const o2 = n2.pointOnLine(i2, t2);
            if (r2 = Math.min(r2, n2.distance(t2, o2.point)), 0 === r2) return r2;
          }
          return r2;
        }
        function Sr(t2, e2, n2, r2) {
          if (!pr(e2, t2.length)) return NaN;
          for (let r3 = e2[0]; r3 <= e2[1]; ++r3) if (Un(t2[r3], n2, true)) return 0;
          let i2 = 1 / 0;
          for (let s2 = e2[0]; s2 < e2[1]; ++s2) {
            const e3 = t2[s2], o2 = t2[s2 + 1];
            for (const t3 of n2) for (let n3 = 0, s3 = t3.length, a2 = s3 - 1; n3 < s3; a2 = n3++) {
              const s4 = t3[a2], l2 = t3[n3];
              if (Rn(e3, o2, s4, l2)) return 0;
              i2 = Math.min(i2, vr(e3, o2, s4, l2, r2));
            }
          }
          return i2;
        }
        function Ar(t2, e2) {
          for (const n2 of t2) for (const t3 of n2) if (Un(t3, e2, true)) return true;
          return false;
        }
        function Mr(t2, e2, n2, r2 = 1 / 0) {
          const i2 = yr(t2), s2 = yr(e2);
          if (r2 !== 1 / 0 && gr(i2, s2, n2) >= r2) return r2;
          if (On(i2, s2)) {
            if (Ar(t2, e2)) return 0;
          } else if (Ar(e2, t2)) return 0;
          let o2 = 1 / 0;
          for (const r3 of t2) for (let t3 = 0, i3 = r3.length, s3 = i3 - 1; t3 < i3; s3 = t3++) {
            const i4 = r3[s3], a2 = r3[t3];
            for (const t4 of e2) for (let e3 = 0, r4 = t4.length, s4 = r4 - 1; e3 < r4; s4 = e3++) {
              const r5 = t4[s4], l2 = t4[e3];
              if (Rn(i4, a2, r5, l2)) return 0;
              o2 = Math.min(o2, vr(i4, a2, r5, l2, n2));
            }
          }
          return o2;
        }
        function kr(t2, e2, n2, r2, i2, s2) {
          if (!s2) return;
          const o2 = gr(dr(r2, s2), i2, n2);
          o2 < e2 && t2.push([o2, s2, [0, 0]]);
        }
        function Ir(t2, e2, n2, r2, i2, s2, o2) {
          if (!s2 || !o2) return;
          const a2 = gr(dr(r2, s2), dr(i2, o2), n2);
          a2 < e2 && t2.push([a2, s2, o2]);
        }
        function Er(t2, e2, n2, r2, i2 = 1 / 0) {
          let s2 = Math.min(r2.distance(t2[0], n2[0][0]), i2);
          if (0 === s2) return s2;
          const o2 = new Qn([[0, [0, t2.length - 1], [0, 0]]], cr), a2 = yr(n2);
          for (; o2.length > 0; ) {
            const i3 = o2.pop();
            if (i3[0] >= s2) continue;
            const l2 = i3[1], u2 = e2 ? 50 : 100;
            if (hr(l2) <= u2) {
              if (!pr(l2, t2.length)) return NaN;
              if (e2) {
                const e3 = Sr(t2, l2, n2, r2);
                if (isNaN(e3) || 0 === e3) return e3;
                s2 = Math.min(s2, e3);
              } else for (let e3 = l2[0]; e3 <= l2[1]; ++e3) {
                const i4 = _r(t2[e3], n2, r2);
                if (s2 = Math.min(s2, i4), 0 === s2) return 0;
              }
            } else {
              const n3 = fr(l2, e2);
              kr(o2, s2, r2, t2, a2, n3[0]), kr(o2, s2, r2, t2, a2, n3[1]);
            }
          }
          return s2;
        }
        function Tr(t2, e2, n2, r2, i2, s2 = 1 / 0) {
          let o2 = Math.min(s2, i2.distance(t2[0], n2[0]));
          if (0 === o2) return o2;
          const a2 = new Qn([[0, [0, t2.length - 1], [0, n2.length - 1]]], cr);
          for (; a2.length > 0; ) {
            const s3 = a2.pop();
            if (s3[0] >= o2) continue;
            const l2 = s3[1], u2 = s3[2], c2 = e2 ? 50 : 100, h2 = r2 ? 50 : 100;
            if (hr(l2) <= c2 && hr(u2) <= h2) {
              if (!pr(l2, t2.length) && pr(u2, n2.length)) return NaN;
              let s4;
              if (e2 && r2) s4 = br(t2, l2, n2, u2, i2), o2 = Math.min(o2, s4);
              else if (e2 && !r2) {
                const e3 = t2.slice(l2[0], l2[1] + 1);
                for (let t3 = u2[0]; t3 <= u2[1]; ++t3) if (s4 = xr(n2[t3], e3, i2), o2 = Math.min(o2, s4), 0 === o2) return o2;
              } else if (!e2 && r2) {
                const e3 = n2.slice(u2[0], u2[1] + 1);
                for (let n3 = l2[0]; n3 <= l2[1]; ++n3) if (s4 = xr(t2[n3], e3, i2), o2 = Math.min(o2, s4), 0 === o2) return o2;
              } else s4 = wr(t2, l2, n2, u2, i2), o2 = Math.min(o2, s4);
            } else {
              const s4 = fr(l2, e2), c3 = fr(u2, r2);
              Ir(a2, o2, i2, t2, n2, s4[0], c3[0]), Ir(a2, o2, i2, t2, n2, s4[0], c3[1]), Ir(a2, o2, i2, t2, n2, s4[1], c3[0]), Ir(a2, o2, i2, t2, n2, s4[1], c3[1]);
            }
          }
          return o2;
        }
        function Fr(t2) {
          return "MultiPolygon" === t2.type ? t2.coordinates.map(((t3) => ({ type: "Polygon", coordinates: t3 }))) : "MultiLineString" === t2.type ? t2.coordinates.map(((t3) => ({ type: "LineString", coordinates: t3 }))) : "MultiPoint" === t2.type ? t2.coordinates.map(((t3) => ({ type: "Point", coordinates: t3 }))) : [t2];
        }
        class Pr {
          constructor(t2, e2) {
            this.type = Ot, this.geojson = t2, this.geometries = e2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error(`'distance' expression requires exactly one argument, but found ${t2.length - 1} instead.`);
            if (je(t2[1])) {
              const e3 = t2[1];
              if ("FeatureCollection" === e3.type) return new Pr(e3, e3.features.map(((t3) => Fr(t3.geometry))).flat());
              if ("Feature" === e3.type) return new Pr(e3, Fr(e3.geometry));
              if ("type" in e3 && "coordinates" in e3) return new Pr(e3, Fr(e3));
            }
            return e2.error("'distance' expression requires valid geojson object that contains polygon geometry type.");
          }
          evaluate(t2) {
            if (null != t2.geometry() && null != t2.canonicalID()) {
              if ("Point" === t2.geometryType()) return (function(t3, e2) {
                const n2 = t3.geometry(), r2 = n2.flat().map(((e3) => Vn([e3.x, e3.y], t3.canonical)));
                if (0 === n2.length) return NaN;
                const i2 = new ur(r2[0][1]);
                let s2 = 1 / 0;
                for (const t4 of e2) {
                  switch (t4.type) {
                    case "Point":
                      s2 = Math.min(s2, Tr(r2, false, [t4.coordinates], false, i2, s2));
                      break;
                    case "LineString":
                      s2 = Math.min(s2, Tr(r2, false, t4.coordinates, true, i2, s2));
                      break;
                    case "Polygon":
                      s2 = Math.min(s2, Er(r2, false, t4.coordinates, i2, s2));
                  }
                  if (0 === s2) return s2;
                }
                return s2;
              })(t2, this.geometries);
              if ("LineString" === t2.geometryType()) return (function(t3, e2) {
                const n2 = t3.geometry(), r2 = n2.flat().map(((e3) => Vn([e3.x, e3.y], t3.canonical)));
                if (0 === n2.length) return NaN;
                const i2 = new ur(r2[0][1]);
                let s2 = 1 / 0;
                for (const t4 of e2) {
                  switch (t4.type) {
                    case "Point":
                      s2 = Math.min(s2, Tr(r2, true, [t4.coordinates], false, i2, s2));
                      break;
                    case "LineString":
                      s2 = Math.min(s2, Tr(r2, true, t4.coordinates, true, i2, s2));
                      break;
                    case "Polygon":
                      s2 = Math.min(s2, Er(r2, true, t4.coordinates, i2, s2));
                  }
                  if (0 === s2) return s2;
                }
                return s2;
              })(t2, this.geometries);
              if ("Polygon" === t2.geometryType()) return (function(t3, e2) {
                const n2 = t3.geometry();
                if (0 === n2.length || 0 === n2[0].length) return NaN;
                const r2 = rr(n2, 0).map(((e3) => e3.map(((e4) => e4.map(((e5) => Vn([e5.x, e5.y], t3.canonical))))))), i2 = new ur(r2[0][0][0][1]);
                let s2 = 1 / 0;
                for (const t4 of e2) for (const e3 of r2) {
                  switch (t4.type) {
                    case "Point":
                      s2 = Math.min(s2, Er([t4.coordinates], false, e3, i2, s2));
                      break;
                    case "LineString":
                      s2 = Math.min(s2, Er(t4.coordinates, true, e3, i2, s2));
                      break;
                    case "Polygon":
                      s2 = Math.min(s2, Mr(e3, t4.coordinates, i2, s2));
                  }
                  if (0 === s2) return s2;
                }
                return s2;
              })(t2, this.geometries);
            }
            return NaN;
          }
          eachChild() {
          }
          outputDefined() {
            return true;
          }
        }
        class Dr {
          constructor(t2) {
            this.type = qt, this.key = t2;
          }
          static parse(t2, e2) {
            if (2 !== t2.length) return e2.error(`Expected 1 argument, but found ${t2.length - 1} instead.`);
            const n2 = t2[1];
            return null == n2 ? e2.error("Global state property must be defined.") : "string" != typeof n2 ? e2.error(`Global state property must be string, but found ${typeof t2[1]} instead.`) : new Dr(n2);
          }
          evaluate(t2) {
            var e2;
            const n2 = null === (e2 = t2.globals) || void 0 === e2 ? void 0 : e2.globalState;
            return n2 && 0 !== Object.keys(n2).length ? we(n2, this.key) : null;
          }
          eachChild() {
          }
          outputDefined() {
            return false;
          }
        }
        const zr = { "==": Sn, "!=": An, ">": kn, "<": Mn, ">=": En, "<=": In, array: Ze, at: nn, boolean: Ze, case: an, coalesce: vn, collator: Tn, format: Pn, image: Dn, in: rn, "index-of": sn, interpolate: mn, "interpolate-hcl": mn, "interpolate-lab": mn, length: zn, let: tn, literal: Xe, match: on, number: Ze, "number-format": Fn, object: Ze, slice: ln, step: cn, string: Ze, "to-boolean": We, "to-color": We, "to-number": We, "to-string": We, var: en, within: Jn, distance: Pr, "global-state": Dr };
        class Br {
          constructor(t2, e2, n2, r2) {
            this.name = t2, this.type = e2, this._evaluate = n2, this.args = r2;
          }
          evaluate(t2) {
            return this._evaluate(t2, this.args);
          }
          eachChild(t2) {
            this.args.forEach(t2);
          }
          outputDefined() {
            return false;
          }
          static parse(t2, e2) {
            const n2 = t2[0], r2 = Br.definitions[n2];
            if (!r2) return e2.error(`Unknown expression "${n2}". If you wanted a literal array, use ["literal", [...]].`, 0);
            const i2 = Array.isArray(r2) ? r2[0] : r2.type, s2 = Array.isArray(r2) ? [[r2[1], r2[2]]] : r2.overloads, o2 = s2.filter((([e3]) => !Array.isArray(e3) || e3.length === t2.length - 1));
            let a2 = null;
            for (const [r3, s3] of o2) {
              a2 = new Qe(e2.registry, $r, e2.path, null, e2.scope);
              const o3 = [];
              let l2 = false;
              for (let e3 = 1; e3 < t2.length; e3++) {
                const n3 = t2[e3], i3 = Array.isArray(r3) ? r3[e3 - 1] : r3.type, s4 = a2.parse(n3, 1 + o3.length, i3);
                if (!s4) {
                  l2 = true;
                  break;
                }
                o3.push(s4);
              }
              if (!l2) if (Array.isArray(r3) && r3.length !== o3.length) a2.error(`Expected ${r3.length} arguments, but found ${o3.length} instead.`);
              else {
                for (let t3 = 0; t3 < o3.length; t3++) {
                  const e3 = Array.isArray(r3) ? r3[t3] : r3.type, n3 = o3[t3];
                  a2.concat(t3 + 1).checkSubtype(e3, n3.type);
                }
                if (0 === a2.errors.length) return new Br(n2, i2, s3, o3);
              }
            }
            if (1 === o2.length) e2.errors.push(...a2.errors);
            else {
              const n3 = (o2.length ? o2 : s2).map((([t3]) => {
                return e3 = t3, Array.isArray(e3) ? `(${e3.map(Qt).join(", ")})` : `(${Qt(e3.type)}...)`;
                var e3;
              })).join(" | "), r3 = [];
              for (let n4 = 1; n4 < t2.length; n4++) {
                const i3 = e2.parse(t2[n4], 1 + r3.length);
                if (!i3) return null;
                r3.push(Qt(i3.type));
              }
              e2.error(`Expected arguments of type ${n3}, but found (${r3.join(", ")}) instead.`);
            }
            return null;
          }
          static register(t2, e2) {
            Br.definitions = e2;
            for (const n2 in e2) t2[n2] = Br;
          }
        }
        function Cr(t2, [e2, n2, r2, i2]) {
          e2 = e2.evaluate(t2), n2 = n2.evaluate(t2), r2 = r2.evaluate(t2);
          const s2 = i2 ? i2.evaluate(t2) : 1, o2 = Ue(e2, n2, r2, s2);
          if (o2) throw new Le(o2);
          return new Te(e2 / 255, n2 / 255, r2 / 255, s2, false);
        }
        function Vr(t2, e2) {
          return t2 in e2;
        }
        function Lr(t2, e2) {
          const n2 = e2[t2];
          return void 0 === n2 ? null : n2;
        }
        function Or(t2) {
          return { type: t2 };
        }
        function $r(t2) {
          if (t2 instanceof en) return $r(t2.boundExpression);
          if (t2 instanceof Br && "error" === t2.name) return false;
          if (t2 instanceof Tn) return false;
          if (t2 instanceof Jn) return false;
          if (t2 instanceof Pr) return false;
          if (t2 instanceof Dr) return false;
          const e2 = t2 instanceof We || t2 instanceof Ze;
          let n2 = true;
          return t2.eachChild(((t3) => {
            n2 = e2 ? n2 && $r(t3) : n2 && t3 instanceof Xe;
          })), !!n2 && Rr(t2) && Ur(t2, ["zoom", "heatmap-density", "elevation", "line-progress", "accumulated", "is-supported-script"]);
        }
        function Rr(t2) {
          if (t2 instanceof Br) {
            if ("get" === t2.name && 1 === t2.args.length) return false;
            if ("feature-state" === t2.name) return false;
            if ("has" === t2.name && 1 === t2.args.length) return false;
            if ("properties" === t2.name || "geometry-type" === t2.name || "id" === t2.name) return false;
            if (/^filter-/.test(t2.name)) return false;
          }
          if (t2 instanceof Jn) return false;
          if (t2 instanceof Pr) return false;
          let e2 = true;
          return t2.eachChild(((t3) => {
            e2 && !Rr(t3) && (e2 = false);
          })), e2;
        }
        function Nr(t2) {
          if (t2 instanceof Br && "feature-state" === t2.name) return false;
          let e2 = true;
          return t2.eachChild(((t3) => {
            e2 && !Nr(t3) && (e2 = false);
          })), e2;
        }
        function Ur(t2, e2) {
          if (t2 instanceof Br && e2.indexOf(t2.name) >= 0) return false;
          let n2 = true;
          return t2.eachChild(((t3) => {
            n2 && !Ur(t3, e2) && (n2 = false);
          })), n2;
        }
        function jr(t2) {
          return { result: "success", value: t2 };
        }
        function qr(t2) {
          return { result: "error", value: t2 };
        }
        function Gr(t2) {
          return "data-driven" === t2["property-type"] || "cross-faded-data-driven" === t2["property-type"];
        }
        function Xr(t2) {
          return !!t2.expression && t2.expression.parameters.indexOf("zoom") > -1;
        }
        function Yr(t2) {
          return !!t2.expression && t2.expression.interpolated;
        }
        function Zr(t2) {
          return t2 instanceof Number ? "number" : t2 instanceof String ? "string" : t2 instanceof Boolean ? "boolean" : Array.isArray(t2) ? "array" : null === t2 ? "null" : typeof t2;
        }
        function Hr(t2) {
          return "object" == typeof t2 && null !== t2 && !Array.isArray(t2) && qe(t2) === jt;
        }
        function Wr(t2) {
          return t2;
        }
        function Kr(t2, e2) {
          const n2 = t2.stops && "object" == typeof t2.stops[0][0], r2 = n2 || !(n2 || void 0 !== t2.property), i2 = t2.type || (Yr(e2) ? "exponential" : "interval"), s2 = (function(t3) {
            switch (t3.type) {
              case "color":
                return Te.parse;
              case "padding":
                return Be.parse;
              case "numberArray":
                return Ce.parse;
              case "colorArray":
                return Ve.parse;
              default:
                return null;
            }
          })(e2);
          if (s2 && ((t2 = Bt({}, t2)).stops && (t2.stops = t2.stops.map(((t3) => [t3[0], s2(t3[1])]))), t2.default = s2(t2.default ? t2.default : e2.default)), t2.colorSpace && "rgb" !== (o2 = t2.colorSpace) && "hcl" !== o2 && "lab" !== o2) throw new Error(`Unknown color space: "${t2.colorSpace}"`);
          var o2;
          const a2 = (function(t3) {
            switch (t3) {
              case "exponential":
                return ei;
              case "interval":
                return ti;
              case "categorical":
                return Qr;
              case "identity":
                return ni;
              default:
                throw new Error(`Unknown function type "${t3}"`);
            }
          })(i2);
          let l2, u2;
          if ("categorical" === i2) {
            l2 = /* @__PURE__ */ Object.create(null);
            for (const e3 of t2.stops) l2[e3[0]] = e3[1];
            u2 = typeof t2.stops[0][0];
          }
          if (n2) {
            const n3 = {}, r3 = [];
            for (let e3 = 0; e3 < t2.stops.length; e3++) {
              const i4 = t2.stops[e3], s4 = i4[0].zoom;
              void 0 === n3[s4] && (n3[s4] = { zoom: s4, type: t2.type, property: t2.property, default: t2.default, stops: [] }, r3.push(s4)), n3[s4].stops.push([i4[0].value, i4[1]]);
            }
            const i3 = [];
            for (const t3 of r3) i3.push([n3[t3].zoom, Kr(n3[t3], e2)]);
            const s3 = { name: "linear" };
            return { kind: "composite", interpolationType: s3, interpolationFactor: mn.interpolationFactor.bind(void 0, s3), zoomStops: i3.map(((t3) => t3[0])), evaluate: ({ zoom: n4 }, r4) => ei({ stops: i3, base: t2.base }, e2, n4).evaluate(n4, r4) };
          }
          if (r2) {
            const n3 = "exponential" === i2 ? { name: "exponential", base: void 0 !== t2.base ? t2.base : 1 } : null;
            return { kind: "camera", interpolationType: n3, interpolationFactor: mn.interpolationFactor.bind(void 0, n3), zoomStops: t2.stops.map(((t3) => t3[0])), evaluate: ({ zoom: n4 }) => a2(t2, e2, n4, l2, u2) };
          }
          return { kind: "source", evaluate(n3, r3) {
            const i3 = r3 && r3.properties ? r3.properties[t2.property] : void 0;
            return void 0 === i3 ? Jr(t2.default, e2.default) : a2(t2, e2, i3, l2, u2);
          } };
        }
        function Jr(t2, e2, n2) {
          return void 0 !== t2 ? t2 : void 0 !== e2 ? e2 : void 0 !== n2 ? n2 : void 0;
        }
        function Qr(t2, e2, n2, r2, i2) {
          return Jr(typeof n2 === i2 ? r2[n2] : void 0, t2.default, e2.default);
        }
        function ti(t2, e2, n2) {
          if ("number" !== Zr(n2)) return Jr(t2.default, e2.default);
          const r2 = t2.stops.length;
          if (1 === r2) return t2.stops[0][1];
          if (n2 <= t2.stops[0][0]) return t2.stops[0][1];
          if (n2 >= t2.stops[r2 - 1][0]) return t2.stops[r2 - 1][1];
          const i2 = un(t2.stops.map(((t3) => t3[0])), n2);
          return t2.stops[i2][1];
        }
        function ei(t2, e2, n2) {
          const r2 = void 0 !== t2.base ? t2.base : 1;
          if ("number" !== Zr(n2)) return Jr(t2.default, e2.default);
          const i2 = t2.stops.length;
          if (1 === i2) return t2.stops[0][1];
          if (n2 <= t2.stops[0][0]) return t2.stops[0][1];
          if (n2 >= t2.stops[i2 - 1][0]) return t2.stops[i2 - 1][1];
          const s2 = un(t2.stops.map(((t3) => t3[0])), n2), o2 = (function(t3, e3, n3, r3) {
            const i3 = r3 - n3, s3 = t3 - n3;
            return 0 === i3 ? 0 : 1 === e3 ? s3 / i3 : (Math.pow(e3, s3) - 1) / (Math.pow(e3, i3) - 1);
          })(n2, r2, t2.stops[s2][0], t2.stops[s2 + 1][0]), a2 = t2.stops[s2][1], l2 = t2.stops[s2 + 1][1], u2 = xn[e2.type] || Wr;
          return "function" == typeof a2.evaluate ? { evaluate(...e3) {
            const n3 = a2.evaluate.apply(void 0, e3), r3 = l2.evaluate.apply(void 0, e3);
            if (void 0 !== n3 && void 0 !== r3) return u2(n3, r3, o2, t2.colorSpace);
          } } : u2(a2, l2, o2, t2.colorSpace);
        }
        function ni(t2, e2, n2) {
          switch (e2.type) {
            case "color":
              n2 = Te.parse(n2);
              break;
            case "formatted":
              n2 = ze.fromString(n2.toString());
              break;
            case "resolvedImage":
              n2 = Re.fromString(n2.toString());
              break;
            case "padding":
              n2 = Be.parse(n2);
              break;
            case "colorArray":
              n2 = Ve.parse(n2);
              break;
            case "numberArray":
              n2 = Ce.parse(n2);
              break;
            default:
              Zr(n2) === e2.type || "enum" === e2.type && e2.values[n2] || (n2 = void 0);
          }
          return Jr(n2, t2.default, e2.default);
        }
        Br.register(zr, { error: [{ kind: "error" }, [$t], (t2, [e2]) => {
          throw new Le(e2.evaluate(t2));
        }], typeof: [$t, [qt], (t2, [e2]) => Qt(qe(e2.evaluate(t2)))], "to-rgba": [Jt(Ot, 4), [Nt], (t2, [e2]) => {
          const [n2, r2, i2, s2] = e2.evaluate(t2).rgb;
          return [255 * n2, 255 * r2, 255 * i2, s2];
        }], rgb: [Nt, [Ot, Ot, Ot], Cr], rgba: [Nt, [Ot, Ot, Ot, Ot], Cr], has: { type: Rt, overloads: [[[$t], (t2, [e2]) => Vr(e2.evaluate(t2), t2.properties())], [[$t, jt], (t2, [e2, n2]) => Vr(e2.evaluate(t2), n2.evaluate(t2))]] }, get: { type: qt, overloads: [[[$t], (t2, [e2]) => Lr(e2.evaluate(t2), t2.properties())], [[$t, jt], (t2, [e2, n2]) => Lr(e2.evaluate(t2), n2.evaluate(t2))]] }, "feature-state": [qt, [$t], (t2, [e2]) => Lr(e2.evaluate(t2), t2.featureState || {})], properties: [jt, [], (t2) => t2.properties()], "geometry-type": [$t, [], (t2) => t2.geometryType()], id: [qt, [], (t2) => t2.id()], zoom: [Ot, [], (t2) => t2.globals.zoom], "heatmap-density": [Ot, [], (t2) => t2.globals.heatmapDensity || 0], elevation: [Ot, [], (t2) => t2.globals.elevation || 0], "line-progress": [Ot, [], (t2) => t2.globals.lineProgress || 0], accumulated: [qt, [], (t2) => void 0 === t2.globals.accumulated ? null : t2.globals.accumulated], "+": [Ot, Or(Ot), (t2, e2) => {
          let n2 = 0;
          for (const r2 of e2) n2 += r2.evaluate(t2);
          return n2;
        }], "*": [Ot, Or(Ot), (t2, e2) => {
          let n2 = 1;
          for (const r2 of e2) n2 *= r2.evaluate(t2);
          return n2;
        }], "-": { type: Ot, overloads: [[[Ot, Ot], (t2, [e2, n2]) => e2.evaluate(t2) - n2.evaluate(t2)], [[Ot], (t2, [e2]) => -e2.evaluate(t2)]] }, "/": [Ot, [Ot, Ot], (t2, [e2, n2]) => e2.evaluate(t2) / n2.evaluate(t2)], "%": [Ot, [Ot, Ot], (t2, [e2, n2]) => e2.evaluate(t2) % n2.evaluate(t2)], ln2: [Ot, [], () => Math.LN2], pi: [Ot, [], () => Math.PI], e: [Ot, [], () => Math.E], "^": [Ot, [Ot, Ot], (t2, [e2, n2]) => Math.pow(e2.evaluate(t2), n2.evaluate(t2))], sqrt: [Ot, [Ot], (t2, [e2]) => Math.sqrt(e2.evaluate(t2))], log10: [Ot, [Ot], (t2, [e2]) => Math.log(e2.evaluate(t2)) / Math.LN10], ln: [Ot, [Ot], (t2, [e2]) => Math.log(e2.evaluate(t2))], log2: [Ot, [Ot], (t2, [e2]) => Math.log(e2.evaluate(t2)) / Math.LN2], sin: [Ot, [Ot], (t2, [e2]) => Math.sin(e2.evaluate(t2))], cos: [Ot, [Ot], (t2, [e2]) => Math.cos(e2.evaluate(t2))], tan: [Ot, [Ot], (t2, [e2]) => Math.tan(e2.evaluate(t2))], asin: [Ot, [Ot], (t2, [e2]) => Math.asin(e2.evaluate(t2))], acos: [Ot, [Ot], (t2, [e2]) => Math.acos(e2.evaluate(t2))], atan: [Ot, [Ot], (t2, [e2]) => Math.atan(e2.evaluate(t2))], min: [Ot, Or(Ot), (t2, e2) => Math.min(...e2.map(((e3) => e3.evaluate(t2))))], max: [Ot, Or(Ot), (t2, e2) => Math.max(...e2.map(((e3) => e3.evaluate(t2))))], abs: [Ot, [Ot], (t2, [e2]) => Math.abs(e2.evaluate(t2))], round: [Ot, [Ot], (t2, [e2]) => {
          const n2 = e2.evaluate(t2);
          return n2 < 0 ? -Math.round(-n2) : Math.round(n2);
        }], floor: [Ot, [Ot], (t2, [e2]) => Math.floor(e2.evaluate(t2))], ceil: [Ot, [Ot], (t2, [e2]) => Math.ceil(e2.evaluate(t2))], "filter-==": [Rt, [$t, qt], (t2, [e2, n2]) => t2.properties()[e2.value] === n2.value], "filter-id-==": [Rt, [qt], (t2, [e2]) => t2.id() === e2.value], "filter-type-==": [Rt, [$t], (t2, [e2]) => t2.geometryType() === e2.value], "filter-<": [Rt, [$t, qt], (t2, [e2, n2]) => {
          const r2 = t2.properties()[e2.value], i2 = n2.value;
          return typeof r2 == typeof i2 && r2 < i2;
        }], "filter-id-<": [Rt, [qt], (t2, [e2]) => {
          const n2 = t2.id(), r2 = e2.value;
          return typeof n2 == typeof r2 && n2 < r2;
        }], "filter->": [Rt, [$t, qt], (t2, [e2, n2]) => {
          const r2 = t2.properties()[e2.value], i2 = n2.value;
          return typeof r2 == typeof i2 && r2 > i2;
        }], "filter-id->": [Rt, [qt], (t2, [e2]) => {
          const n2 = t2.id(), r2 = e2.value;
          return typeof n2 == typeof r2 && n2 > r2;
        }], "filter-<=": [Rt, [$t, qt], (t2, [e2, n2]) => {
          const r2 = t2.properties()[e2.value], i2 = n2.value;
          return typeof r2 == typeof i2 && r2 <= i2;
        }], "filter-id-<=": [Rt, [qt], (t2, [e2]) => {
          const n2 = t2.id(), r2 = e2.value;
          return typeof n2 == typeof r2 && n2 <= r2;
        }], "filter->=": [Rt, [$t, qt], (t2, [e2, n2]) => {
          const r2 = t2.properties()[e2.value], i2 = n2.value;
          return typeof r2 == typeof i2 && r2 >= i2;
        }], "filter-id->=": [Rt, [qt], (t2, [e2]) => {
          const n2 = t2.id(), r2 = e2.value;
          return typeof n2 == typeof r2 && n2 >= r2;
        }], "filter-has": [Rt, [qt], (t2, [e2]) => e2.value in t2.properties()], "filter-has-id": [Rt, [], (t2) => null !== t2.id() && void 0 !== t2.id()], "filter-type-in": [Rt, [Jt($t)], (t2, [e2]) => e2.value.indexOf(t2.geometryType()) >= 0], "filter-id-in": [Rt, [Jt(qt)], (t2, [e2]) => e2.value.indexOf(t2.id()) >= 0], "filter-in-small": [Rt, [$t, Jt(qt)], (t2, [e2, n2]) => n2.value.indexOf(t2.properties()[e2.value]) >= 0], "filter-in-large": [Rt, [$t, Jt(qt)], (t2, [e2, n2]) => (function(t3, e3, n3, r2) {
          for (; n3 <= r2; ) {
            const i2 = n3 + r2 >> 1;
            if (e3[i2] === t3) return true;
            e3[i2] > t3 ? r2 = i2 - 1 : n3 = i2 + 1;
          }
          return false;
        })(t2.properties()[e2.value], n2.value, 0, n2.value.length - 1)], all: { type: Rt, overloads: [[[Rt, Rt], (t2, [e2, n2]) => e2.evaluate(t2) && n2.evaluate(t2)], [Or(Rt), (t2, e2) => {
          for (const n2 of e2) if (!n2.evaluate(t2)) return false;
          return true;
        }]] }, any: { type: Rt, overloads: [[[Rt, Rt], (t2, [e2, n2]) => e2.evaluate(t2) || n2.evaluate(t2)], [Or(Rt), (t2, e2) => {
          for (const n2 of e2) if (n2.evaluate(t2)) return true;
          return false;
        }]] }, "!": [Rt, [Rt], (t2, [e2]) => !e2.evaluate(t2)], "is-supported-script": [Rt, [$t], (t2, [e2]) => {
          const n2 = t2.globals && t2.globals.isSupportedScript;
          return !n2 || n2(e2.evaluate(t2));
        }], upcase: [$t, [$t], (t2, [e2]) => e2.evaluate(t2).toUpperCase()], downcase: [$t, [$t], (t2, [e2]) => e2.evaluate(t2).toLowerCase()], concat: [$t, Or(qt), (t2, e2) => e2.map(((e3) => Ge(e3.evaluate(t2)))).join("")], split: [Jt($t), [$t, $t], (t2, [e2, n2]) => e2.evaluate(t2).split(n2.evaluate(t2))], join: [$t, [Jt($t), $t], (t2, [e2, n2]) => e2.evaluate(t2).join(n2.evaluate(t2))], "resolved-locale": [$t, [Gt], (t2, [e2]) => e2.evaluate(t2).resolvedLocale()] });
        class ri {
          constructor(t2, e2, n2) {
            this.expression = t2, this._warningHistory = {}, this._evaluator = new Je(), this._defaultValue = e2 ? (function(t3) {
              if ("color" === t3.type && Hr(t3.default)) return new Te(0, 0, 0, 0);
              switch (t3.type) {
                case "color":
                  return Te.parse(t3.default) || null;
                case "padding":
                  return Be.parse(t3.default) || null;
                case "numberArray":
                  return Ce.parse(t3.default) || null;
                case "colorArray":
                  return Ve.parse(t3.default) || null;
                case "variableAnchorOffsetCollection":
                  return $e.parse(t3.default) || null;
                case "projectionDefinition":
                  return Ne.parse(t3.default) || null;
                default:
                  return void 0 === t3.default ? null : t3.default;
              }
            })(e2) : null, this._enumValues = e2 && "enum" === e2.type ? e2.values : null, this._globalState = n2;
          }
          evaluateWithoutErrorHandling(t2, e2, n2, r2, i2, s2) {
            return this._globalState && (t2 = pi(t2, this._globalState)), this._evaluator.globals = t2, this._evaluator.feature = e2, this._evaluator.featureState = n2, this._evaluator.canonical = r2, this._evaluator.availableImages = i2 || null, this._evaluator.formattedSection = s2, this.expression.evaluate(this._evaluator);
          }
          evaluate(t2, e2, n2, r2, i2, s2) {
            this._globalState && (t2 = pi(t2, this._globalState)), this._evaluator.globals = t2, this._evaluator.feature = e2 || null, this._evaluator.featureState = n2 || null, this._evaluator.canonical = r2, this._evaluator.availableImages = i2 || null, this._evaluator.formattedSection = s2 || null;
            try {
              const t3 = this.expression.evaluate(this._evaluator);
              if (null == t3 || "number" == typeof t3 && t3 != t3) return this._defaultValue;
              if (this._enumValues && !(t3 in this._enumValues)) throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(((t4) => JSON.stringify(t4))).join(", ")}, but found ${JSON.stringify(t3)} instead.`);
              return t3;
            } catch (t3) {
              return this._warningHistory[t3.message] || (this._warningHistory[t3.message] = true, "undefined" != typeof console && console.warn(t3.message)), this._defaultValue;
            }
          }
        }
        function ii(t2) {
          return Array.isArray(t2) && t2.length > 0 && "string" == typeof t2[0] && t2[0] in zr;
        }
        function si(t2, e2, n2) {
          const r2 = new Qe(zr, $r, [], e2 ? (function(t3) {
            const e3 = { color: Nt, string: $t, number: Ot, enum: $t, boolean: Rt, formatted: Xt, padding: Yt, numberArray: Ht, colorArray: Zt, projectionDefinition: Ut, resolvedImage: Wt, variableAnchorOffsetCollection: Kt };
            return "array" === t3.type ? Jt(e3[t3.value] || qt, t3.length) : e3[t3.type];
          })(e2) : void 0), i2 = r2.parse(t2, void 0, void 0, void 0, e2 && "string" === e2.type ? { typeAnnotation: "coerce" } : void 0);
          return i2 ? jr(new ri(i2, e2, n2)) : qr(r2.errors);
        }
        class oi {
          constructor(t2, e2, n2) {
            this.kind = t2, this._styleExpression = e2, this.isStateDependent = "constant" !== t2 && !Nr(e2.expression), this.globalStateRefs = hi(e2.expression), this._globalState = n2;
          }
          evaluateWithoutErrorHandling(t2, e2, n2, r2, i2, s2) {
            return this._globalState && (t2 = pi(t2, this._globalState)), this._styleExpression.evaluateWithoutErrorHandling(t2, e2, n2, r2, i2, s2);
          }
          evaluate(t2, e2, n2, r2, i2, s2) {
            return this._globalState && (t2 = pi(t2, this._globalState)), this._styleExpression.evaluate(t2, e2, n2, r2, i2, s2);
          }
        }
        class ai {
          constructor(t2, e2, n2, r2, i2) {
            this.kind = t2, this.zoomStops = n2, this._styleExpression = e2, this.isStateDependent = "camera" !== t2 && !Nr(e2.expression), this.globalStateRefs = hi(e2.expression), this.interpolationType = r2, this._globalState = i2;
          }
          evaluateWithoutErrorHandling(t2, e2, n2, r2, i2, s2) {
            return this._globalState && (t2 = pi(t2, this._globalState)), this._styleExpression.evaluateWithoutErrorHandling(t2, e2, n2, r2, i2, s2);
          }
          evaluate(t2, e2, n2, r2, i2, s2) {
            return this._globalState && (t2 = pi(t2, this._globalState)), this._styleExpression.evaluate(t2, e2, n2, r2, i2, s2);
          }
          interpolationFactor(t2, e2, n2) {
            return this.interpolationType ? mn.interpolationFactor(this.interpolationType, t2, e2, n2) : 0;
          }
        }
        function li(t2, e2, n2) {
          const r2 = si(t2, e2, n2);
          if ("error" === r2.result) return r2;
          const i2 = r2.value.expression, s2 = Rr(i2);
          if (!s2 && !Gr(e2)) return qr([new Ct("", "data expressions not supported")]);
          const o2 = Ur(i2, ["zoom"]);
          if (!o2 && !Xr(e2)) return qr([new Ct("", "zoom expressions not supported")]);
          const a2 = ci(i2);
          return a2 || o2 ? a2 instanceof Ct ? qr([a2]) : a2 instanceof mn && !Yr(e2) ? qr([new Ct("", '"interpolate" expressions cannot be used with this property')]) : jr(a2 ? new ai(s2 ? "camera" : "composite", r2.value, a2.labels, a2 instanceof mn ? a2.interpolation : void 0, n2) : new oi(s2 ? "constant" : "source", r2.value, n2)) : qr([new Ct("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
        }
        class ui {
          constructor(t2, e2) {
            this._parameters = t2, this._specification = e2, Bt(this, Kr(this._parameters, this._specification));
          }
          static deserialize(t2) {
            return new ui(t2._parameters, t2._specification);
          }
          static serialize(t2) {
            return { _parameters: t2._parameters, _specification: t2._specification };
          }
        }
        function ci(t2) {
          let e2 = null;
          if (t2 instanceof tn) e2 = ci(t2.result);
          else if (t2 instanceof vn) {
            for (const n2 of t2.args) if (e2 = ci(n2), e2) break;
          } else (t2 instanceof cn || t2 instanceof mn) && t2.input instanceof Br && "zoom" === t2.input.name && (e2 = t2);
          return e2 instanceof Ct || t2.eachChild(((t3) => {
            const n2 = ci(t3);
            n2 instanceof Ct ? e2 = n2 : !e2 && n2 ? e2 = new Ct("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : e2 && n2 && e2 !== n2 && (e2 = new Ct("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));
          })), e2;
        }
        function hi(t2, e2 = /* @__PURE__ */ new Set()) {
          return t2 instanceof Dr && e2.add(t2.key), t2.eachChild(((t3) => {
            hi(t3, e2);
          })), e2;
        }
        function pi(t2, e2) {
          const { zoom: n2, heatmapDensity: r2, elevation: i2, lineProgress: s2, isSupportedScript: o2, accumulated: a2 } = null != t2 ? t2 : {};
          return { zoom: n2, heatmapDensity: r2, elevation: i2, lineProgress: s2, isSupportedScript: o2, accumulated: a2, globalState: e2 };
        }
        function fi(t2) {
          if (true === t2 || false === t2) return true;
          if (!Array.isArray(t2) || 0 === t2.length) return false;
          switch (t2[0]) {
            case "has":
              return t2.length >= 2 && "$id" !== t2[1] && "$type" !== t2[1];
            case "in":
              return t2.length >= 3 && ("string" != typeof t2[1] || Array.isArray(t2[2]));
            case "!in":
            case "!has":
            case "none":
              return false;
            case "==":
            case "!=":
            case ">":
            case ">=":
            case "<":
            case "<=":
              return 3 !== t2.length || Array.isArray(t2[1]) || Array.isArray(t2[2]);
            case "any":
            case "all":
              for (const e2 of t2.slice(1)) if (!fi(e2) && "boolean" != typeof e2) return false;
              return true;
            default:
              return true;
          }
        }
        const di = { type: "boolean", default: false, transition: false, "property-type": "data-driven", expression: { interpolated: false, parameters: ["zoom", "feature"] } };
        function yi(t2, e2) {
          if (null == t2) return { filter: () => true, needGeometry: false, getGlobalStateRefs: () => /* @__PURE__ */ new Set() };
          fi(t2) || (t2 = xi(t2));
          const n2 = si(t2, di, e2);
          if ("error" === n2.result) throw new Error(n2.value.map(((t3) => `${t3.key}: ${t3.message}`)).join(", "));
          return { filter: (t3, e3, r2) => n2.value.evaluate(t3, e3, {}, r2), needGeometry: gi(t2), getGlobalStateRefs: () => hi(n2.value.expression) };
        }
        function mi(t2, e2) {
          return t2 < e2 ? -1 : t2 > e2 ? 1 : 0;
        }
        function gi(t2) {
          if (!Array.isArray(t2)) return false;
          if ("within" === t2[0] || "distance" === t2[0]) return true;
          for (let e2 = 1; e2 < t2.length; e2++) if (gi(t2[e2])) return true;
          return false;
        }
        function xi(t2) {
          if (!t2) return true;
          const e2 = t2[0];
          return t2.length <= 1 ? "any" !== e2 : "==" === e2 ? vi(t2[1], t2[2], "==") : "!=" === e2 ? _i(vi(t2[1], t2[2], "==")) : "<" === e2 || ">" === e2 || "<=" === e2 || ">=" === e2 ? vi(t2[1], t2[2], e2) : "any" === e2 ? (n2 = t2.slice(1), ["any"].concat(n2.map(xi))) : "all" === e2 ? ["all"].concat(t2.slice(1).map(xi)) : "none" === e2 ? ["all"].concat(t2.slice(1).map(xi).map(_i)) : "in" === e2 ? bi(t2[1], t2.slice(2)) : "!in" === e2 ? _i(bi(t2[1], t2.slice(2))) : "has" === e2 ? wi(t2[1]) : "!has" !== e2 || _i(wi(t2[1]));
          var n2;
        }
        function vi(t2, e2, n2) {
          switch (t2) {
            case "$type":
              return [`filter-type-${n2}`, e2];
            case "$id":
              return [`filter-id-${n2}`, e2];
            default:
              return [`filter-${n2}`, t2, e2];
          }
        }
        function bi(t2, e2) {
          if (0 === e2.length) return false;
          switch (t2) {
            case "$type":
              return ["filter-type-in", ["literal", e2]];
            case "$id":
              return ["filter-id-in", ["literal", e2]];
            default:
              return e2.length > 200 && !e2.some(((t3) => typeof t3 != typeof e2[0])) ? ["filter-in-large", t2, ["literal", e2.sort(mi)]] : ["filter-in-small", t2, ["literal", e2]];
          }
        }
        function wi(t2) {
          switch (t2) {
            case "$type":
              return true;
            case "$id":
              return ["filter-has-id"];
            default:
              return ["filter-has", t2];
          }
        }
        function _i(t2) {
          return ["!", t2];
        }
        function Si(t2) {
          const e2 = typeof t2;
          if ("number" === e2 || "boolean" === e2 || "string" === e2 || null == t2) return JSON.stringify(t2);
          if (Array.isArray(t2)) {
            let e3 = "[";
            for (const n3 of t2) e3 += `${Si(n3)},`;
            return `${e3}]`;
          }
          const n2 = Object.keys(t2).sort();
          let r2 = "{";
          for (let e3 = 0; e3 < n2.length; e3++) r2 += `${JSON.stringify(n2[e3])}:${Si(t2[n2[e3]])},`;
          return `${r2}}`;
        }
        function Ai(t2) {
          let e2 = "";
          for (const n2 of _t) e2 += `/${Si(t2[n2])}`;
          return e2;
        }
        function Mi(t2) {
          const e2 = t2.value;
          return e2 ? [new zt(t2.key, e2, "constants have been deprecated as of v8")] : [];
        }
        function ki(t2) {
          return t2 instanceof Number || t2 instanceof String || t2 instanceof Boolean ? t2.valueOf() : t2;
        }
        function Ii(t2) {
          if (Array.isArray(t2)) return t2.map(Ii);
          if (t2 instanceof Object && !(t2 instanceof Number || t2 instanceof String || t2 instanceof Boolean)) {
            const e2 = {};
            for (const n2 in t2) e2[n2] = Ii(t2[n2]);
            return e2;
          }
          return ki(t2);
        }
        function Ei(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = t2.valueSpec || {}, i2 = t2.objectElementValidators || {}, s2 = t2.style, o2 = t2.styleSpec, a2 = t2.validateSpec;
          let l2 = [];
          const u2 = Zr(n2);
          if ("object" !== u2) return [new zt(e2, n2, `object expected, ${u2} found`)];
          for (const t3 in n2) {
            const u3 = t3.split(".")[0], c2 = we(r2, u3) || r2["*"];
            let h2;
            if (we(i2, u3)) h2 = i2[u3];
            else if (we(r2, u3)) {
              if (void 0 === n2[t3]) continue;
              h2 = a2;
            } else if (i2["*"]) h2 = i2["*"];
            else {
              if (!r2["*"]) {
                l2.push(new zt(e2, n2[t3], `unknown property "${t3}"`));
                continue;
              }
              h2 = a2;
            }
            l2 = l2.concat(h2({ key: (e2 ? `${e2}.` : e2) + t3, value: n2[t3], valueSpec: c2, style: s2, styleSpec: o2, object: n2, objectKey: t3, validateSpec: a2 }, n2));
          }
          for (const t3 in r2) i2[t3] || r2[t3].required && void 0 === r2[t3].default && void 0 === n2[t3] && l2.push(new zt(e2, n2, `missing required property "${t3}"`));
          return l2;
        }
        function Ti(t2) {
          const e2 = t2.value, n2 = t2.valueSpec, r2 = t2.style, i2 = t2.styleSpec, s2 = t2.key, o2 = t2.arrayElementValidator || t2.validateSpec;
          if ("array" !== Zr(e2)) return [new zt(s2, e2, `array expected, ${Zr(e2)} found`)];
          if (n2.length && e2.length !== n2.length) return [new zt(s2, e2, `array length ${n2.length} expected, length ${e2.length} found`)];
          let a2 = { type: n2.value, values: n2.values };
          i2.$version < 7 && (a2.function = n2.function), "object" === Zr(n2.value) && (a2 = n2.value);
          let l2 = [];
          for (let n3 = 0; n3 < e2.length; n3++) l2 = l2.concat(o2({ array: e2, arrayIndex: n3, value: e2[n3], valueSpec: a2, validateSpec: t2.validateSpec, style: r2, styleSpec: i2, key: `${s2}[${n3}]` }));
          return l2;
        }
        function Fi(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = t2.valueSpec;
          let i2 = Zr(n2);
          return "number" === i2 && n2 != n2 && (i2 = "NaN"), "number" !== i2 ? [new zt(e2, n2, `number expected, ${i2} found`)] : "minimum" in r2 && n2 < r2.minimum ? [new zt(e2, n2, `${n2} is less than the minimum value ${r2.minimum}`)] : "maximum" in r2 && n2 > r2.maximum ? [new zt(e2, n2, `${n2} is greater than the maximum value ${r2.maximum}`)] : [];
        }
        function Pi(t2) {
          const e2 = t2.valueSpec, n2 = ki(t2.value.type);
          let r2, i2, s2, o2 = {};
          const a2 = "categorical" !== n2 && void 0 === t2.value.property, l2 = !a2, u2 = "array" === Zr(t2.value.stops) && "array" === Zr(t2.value.stops[0]) && "object" === Zr(t2.value.stops[0][0]), c2 = Ei({ key: t2.key, value: t2.value, valueSpec: t2.styleSpec.function, validateSpec: t2.validateSpec, style: t2.style, styleSpec: t2.styleSpec, objectElementValidators: { stops: function(t3) {
            if ("identity" === n2) return [new zt(t3.key, t3.value, 'identity function may not have a "stops" property')];
            let e3 = [];
            const r3 = t3.value;
            return e3 = e3.concat(Ti({ key: t3.key, value: r3, valueSpec: t3.valueSpec, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec, arrayElementValidator: h2 })), "array" === Zr(r3) && 0 === r3.length && e3.push(new zt(t3.key, r3, "array must have at least one stop")), e3;
          }, default: function(t3) {
            return t3.validateSpec({ key: t3.key, value: t3.value, valueSpec: e2, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec });
          } } });
          return "identity" === n2 && a2 && c2.push(new zt(t2.key, t2.value, 'missing required property "property"')), "identity" === n2 || t2.value.stops || c2.push(new zt(t2.key, t2.value, 'missing required property "stops"')), "exponential" === n2 && t2.valueSpec.expression && !Yr(t2.valueSpec) && c2.push(new zt(t2.key, t2.value, "exponential functions not supported")), t2.styleSpec.$version >= 8 && (l2 && !Gr(t2.valueSpec) ? c2.push(new zt(t2.key, t2.value, "property functions not supported")) : a2 && !Xr(t2.valueSpec) && c2.push(new zt(t2.key, t2.value, "zoom functions not supported"))), "categorical" !== n2 && !u2 || void 0 !== t2.value.property || c2.push(new zt(t2.key, t2.value, '"property" property is required')), c2;
          function h2(t3) {
            let n3 = [];
            const r3 = t3.value, a3 = t3.key;
            if ("array" !== Zr(r3)) return [new zt(a3, r3, `array expected, ${Zr(r3)} found`)];
            if (2 !== r3.length) return [new zt(a3, r3, `array length 2 expected, length ${r3.length} found`)];
            if (u2) {
              if ("object" !== Zr(r3[0])) return [new zt(a3, r3, `object expected, ${Zr(r3[0])} found`)];
              if (void 0 === r3[0].zoom) return [new zt(a3, r3, "object stop key must have zoom")];
              if (void 0 === r3[0].value) return [new zt(a3, r3, "object stop key must have value")];
              if (s2 && s2 > ki(r3[0].zoom)) return [new zt(a3, r3[0].zoom, "stop zoom values must appear in ascending order")];
              ki(r3[0].zoom) !== s2 && (s2 = ki(r3[0].zoom), i2 = void 0, o2 = {}), n3 = n3.concat(Ei({ key: `${a3}[0]`, value: r3[0], valueSpec: { zoom: {} }, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec, objectElementValidators: { zoom: Fi, value: p2 } }));
            } else n3 = n3.concat(p2({ key: `${a3}[0]`, value: r3[0], validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec }, r3));
            return ii(Ii(r3[1])) ? n3.concat([new zt(`${a3}[1]`, r3[1], "expressions are not allowed in function stops.")]) : n3.concat(t3.validateSpec({ key: `${a3}[1]`, value: r3[1], valueSpec: e2, validateSpec: t3.validateSpec, style: t3.style, styleSpec: t3.styleSpec }));
          }
          function p2(t3, s3) {
            const a3 = Zr(t3.value), l3 = ki(t3.value), u3 = null !== t3.value ? t3.value : s3;
            if (r2) {
              if (a3 !== r2) return [new zt(t3.key, u3, `${a3} stop domain type must match previous stop domain type ${r2}`)];
            } else r2 = a3;
            if ("number" !== a3 && "string" !== a3 && "boolean" !== a3) return [new zt(t3.key, u3, "stop domain value must be a number, string, or boolean")];
            if ("number" !== a3 && "categorical" !== n2) {
              let r3 = `number expected, ${a3} found`;
              return Gr(e2) && void 0 === n2 && (r3 += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new zt(t3.key, u3, r3)];
            }
            return "categorical" !== n2 || "number" !== a3 || isFinite(l3) && Math.floor(l3) === l3 ? "categorical" !== n2 && "number" === a3 && void 0 !== i2 && l3 < i2 ? [new zt(t3.key, u3, "stop domain values must appear in ascending order")] : (i2 = l3, "categorical" === n2 && l3 in o2 ? [new zt(t3.key, u3, "stop domain values must be unique")] : (o2[l3] = true, [])) : [new zt(t3.key, u3, `integer expected, found ${l3}`)];
          }
        }
        function Di(t2) {
          const e2 = ("property" === t2.expressionContext ? li : si)(Ii(t2.value), t2.valueSpec);
          if ("error" === e2.result) return e2.value.map(((e3) => new zt(`${t2.key}${e3.key}`, t2.value, e3.message)));
          const n2 = e2.value.expression || e2.value._styleExpression.expression;
          if ("property" === t2.expressionContext && "text-font" === t2.propertyKey && !n2.outputDefined()) return [new zt(t2.key, t2.value, `Invalid data expression for "${t2.propertyKey}". Output values must be contained as literals within the expression.`)];
          if ("property" === t2.expressionContext && "layout" === t2.propertyType && !Nr(n2)) return [new zt(t2.key, t2.value, '"feature-state" data expressions are not supported with layout properties.')];
          if ("filter" === t2.expressionContext && !Nr(n2)) return [new zt(t2.key, t2.value, '"feature-state" data expressions are not supported with filters.')];
          if (t2.expressionContext && 0 === t2.expressionContext.indexOf("cluster")) {
            if (!Ur(n2, ["zoom", "feature-state"])) return [new zt(t2.key, t2.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
            if ("cluster-initial" === t2.expressionContext && !Rr(n2)) return [new zt(t2.key, t2.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
          }
          return [];
        }
        function zi(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = Zr(n2);
          return "string" !== r2 ? [new zt(e2, n2, `color expected, ${r2} found`)] : Te.parse(String(n2)) ? [] : [new zt(e2, n2, `color expected, "${n2}" found`)];
        }
        function Bi(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = t2.valueSpec, i2 = [];
          return Array.isArray(r2.values) ? -1 === r2.values.indexOf(ki(n2)) && i2.push(new zt(e2, n2, `expected one of [${r2.values.join(", ")}], ${JSON.stringify(n2)} found`)) : -1 === Object.keys(r2.values).indexOf(ki(n2)) && i2.push(new zt(e2, n2, `expected one of [${Object.keys(r2.values).join(", ")}], ${JSON.stringify(n2)} found`)), i2;
        }
        function Ci(t2) {
          return fi(Ii(t2.value)) ? Di(Bt({}, t2, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : Vi(t2);
        }
        function Vi(t2) {
          const e2 = t2.value, n2 = t2.key;
          if ("array" !== Zr(e2)) return [new zt(n2, e2, `array expected, ${Zr(e2)} found`)];
          const r2 = t2.styleSpec;
          let i2, s2 = [];
          if (e2.length < 1) return [new zt(n2, e2, "filter array must have at least 1 element")];
          switch (s2 = s2.concat(Bi({ key: `${n2}[0]`, value: e2[0], valueSpec: r2.filter_operator, style: t2.style, styleSpec: t2.styleSpec })), ki(e2[0])) {
            case "<":
            case "<=":
            case ">":
            case ">=":
              e2.length >= 2 && "$type" === ki(e2[1]) && s2.push(new zt(n2, e2, `"$type" cannot be use with operator "${e2[0]}"`));
            case "==":
            case "!=":
              3 !== e2.length && s2.push(new zt(n2, e2, `filter array for operator "${e2[0]}" must have 3 elements`));
            case "in":
            case "!in":
              e2.length >= 2 && (i2 = Zr(e2[1]), "string" !== i2 && s2.push(new zt(`${n2}[1]`, e2[1], `string expected, ${i2} found`)));
              for (let o2 = 2; o2 < e2.length; o2++) i2 = Zr(e2[o2]), "$type" === ki(e2[1]) ? s2 = s2.concat(Bi({ key: `${n2}[${o2}]`, value: e2[o2], valueSpec: r2.geometry_type, style: t2.style, styleSpec: t2.styleSpec })) : "string" !== i2 && "number" !== i2 && "boolean" !== i2 && s2.push(new zt(`${n2}[${o2}]`, e2[o2], `string, number, or boolean expected, ${i2} found`));
              break;
            case "any":
            case "all":
            case "none":
              for (let r3 = 1; r3 < e2.length; r3++) s2 = s2.concat(Vi({ key: `${n2}[${r3}]`, value: e2[r3], style: t2.style, styleSpec: t2.styleSpec }));
              break;
            case "has":
            case "!has":
              i2 = Zr(e2[1]), 2 !== e2.length ? s2.push(new zt(n2, e2, `filter array for "${e2[0]}" operator must have 2 elements`)) : "string" !== i2 && s2.push(new zt(`${n2}[1]`, e2[1], `string expected, ${i2} found`));
          }
          return s2;
        }
        function Li(t2, e2) {
          const n2 = t2.key, r2 = t2.validateSpec, i2 = t2.style, s2 = t2.styleSpec, o2 = t2.value, a2 = t2.objectKey, l2 = s2[`${e2}_${t2.layerType}`];
          if (!l2) return [];
          const u2 = a2.match(/^(.*)-transition$/);
          if ("paint" === e2 && u2 && l2[u2[1]] && l2[u2[1]].transition) return r2({ key: n2, value: o2, valueSpec: s2.transition, style: i2, styleSpec: s2 });
          const c2 = t2.valueSpec || l2[a2];
          if (!c2) return [new zt(n2, o2, `unknown property "${a2}"`)];
          let h2;
          if ("string" === Zr(o2) && Gr(c2) && !c2.tokens && (h2 = /^{([^}]+)}$/.exec(o2))) return [new zt(n2, o2, `"${a2}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h2[1])} }\`.`)];
          const p2 = [];
          return "symbol" === t2.layerType && "text-font" === a2 && Hr(Ii(o2)) && "identity" === ki(o2.type) && p2.push(new zt(n2, o2, '"text-font" does not support identity functions')), p2.concat(r2({ key: t2.key, value: o2, valueSpec: c2, style: i2, styleSpec: s2, expressionContext: "property", propertyType: e2, propertyKey: a2 }));
        }
        function Oi(t2) {
          return Li(t2, "paint");
        }
        function $i(t2) {
          return Li(t2, "layout");
        }
        function Ri(t2) {
          var e2, n2;
          let r2 = [];
          const i2 = t2.value, s2 = t2.key, o2 = t2.style, a2 = t2.styleSpec;
          if ("object" !== Zr(i2)) return [new zt(s2, i2, `object expected, ${Zr(i2)} found`)];
          i2.type || i2.ref || r2.push(new zt(s2, i2, 'either "type" or "ref" is required'));
          let l2 = ki(i2.type);
          const u2 = ki(i2.ref);
          if (i2.id) {
            const e3 = ki(i2.id);
            for (let n3 = 0; n3 < t2.arrayIndex; n3++) {
              const t3 = o2.layers[n3];
              ki(t3.id) === e3 && r2.push(new zt(s2, i2.id, `duplicate layer id "${i2.id}", previously used at line ${t3.id.__line__}`));
            }
          }
          if ("ref" in i2) {
            let t3;
            ["type", "source", "source-layer", "filter", "layout"].forEach(((t4) => {
              t4 in i2 && r2.push(new zt(s2, i2[t4], `"${t4}" is prohibited for ref layers`));
            })), o2.layers.forEach(((e3) => {
              ki(e3.id) === u2 && (t3 = e3);
            })), t3 ? t3.ref ? r2.push(new zt(s2, i2.ref, "ref cannot reference another ref layer")) : l2 = ki(t3.type) : r2.push(new zt(s2, i2.ref, `ref layer "${u2}" not found`));
          } else if ("background" !== l2) if (i2.source) {
            const t3 = o2.sources && o2.sources[i2.source], e3 = t3 && ki(t3.type);
            t3 ? "vector" === e3 && "raster" === l2 ? r2.push(new zt(s2, i2.source, `layer "${i2.id}" requires a raster source`)) : "raster-dem" !== e3 && "hillshade" === l2 || "raster-dem" !== e3 && "color-relief" === l2 ? r2.push(new zt(s2, i2.source, `layer "${i2.id}" requires a raster-dem source`)) : "raster" === e3 && "raster" !== l2 ? r2.push(new zt(s2, i2.source, `layer "${i2.id}" requires a vector source`)) : "vector" !== e3 || i2["source-layer"] ? "raster-dem" === e3 && "hillshade" !== l2 && "color-relief" !== l2 ? r2.push(new zt(s2, i2.source, "raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")) : "line" !== l2 || !i2.paint || !i2.paint["line-gradient"] || "geojson" === e3 && t3.lineMetrics || r2.push(new zt(s2, i2, `layer "${i2.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : r2.push(new zt(s2, i2, `layer "${i2.id}" must specify a "source-layer"`)) : r2.push(new zt(s2, i2.source, `source "${i2.source}" not found`));
          } else r2.push(new zt(s2, i2, 'missing required property "source"'));
          return "raster" === l2 && (null === (e2 = i2.paint) || void 0 === e2 ? void 0 : e2.resampling) && (null === (n2 = i2.paint) || void 0 === n2 ? void 0 : n2["raster-resampling"]) && r2.push(new zt(s2, i2.paint, `layer "${i2.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)), r2 = r2.concat(Ei({ key: s2, value: i2, valueSpec: a2.layer, style: t2.style, styleSpec: t2.styleSpec, validateSpec: t2.validateSpec, objectElementValidators: { "*": () => [], type: () => t2.validateSpec({ key: `${s2}.type`, value: i2.type, valueSpec: a2.layer.type, style: t2.style, styleSpec: t2.styleSpec, validateSpec: t2.validateSpec, object: i2, objectKey: "type" }), filter: Ci, layout: (t3) => Ei({ layer: i2, key: t3.key, value: t3.value, style: t3.style, styleSpec: t3.styleSpec, validateSpec: t3.validateSpec, objectElementValidators: { "*": (t4) => $i(Bt({ layerType: l2 }, t4)) } }), paint: (t3) => Ei({ layer: i2, key: t3.key, value: t3.value, style: t3.style, styleSpec: t3.styleSpec, validateSpec: t3.validateSpec, objectElementValidators: { "*": (t4) => Oi(Bt({ layerType: l2 }, t4)) } }) } })), r2;
        }
        function Ni(t2) {
          const e2 = t2.value, n2 = t2.key, r2 = Zr(e2);
          return "string" !== r2 ? [new zt(n2, e2, `string expected, ${r2} found`)] : [];
        }
        const Ui = { promoteId: function({ key: t2, value: e2 }) {
          if ("string" === Zr(e2)) return Ni({ key: t2, value: e2 });
          {
            const n2 = [];
            for (const r2 in e2) n2.push(...Ni({ key: `${t2}.${r2}`, value: e2[r2] }));
            return n2;
          }
        } };
        function ji(t2) {
          const e2 = t2.value, n2 = t2.key, r2 = t2.styleSpec, i2 = t2.style, s2 = t2.validateSpec;
          if (!e2.type) return [new zt(n2, e2, '"type" is required')];
          const o2 = ki(e2.type);
          let a2;
          switch (o2) {
            case "vector":
            case "raster":
              return a2 = Ei({ key: n2, value: e2, valueSpec: r2[`source_${o2.replace("-", "_")}`], style: t2.style, styleSpec: r2, objectElementValidators: Ui, validateSpec: s2 }), a2;
            case "raster-dem":
              return a2 = (function(t3) {
                var e3;
                const n3 = null !== (e3 = t3.sourceName) && void 0 !== e3 ? e3 : "", r3 = t3.value, i3 = t3.styleSpec, s3 = i3.source_raster_dem, o3 = t3.style;
                let a3 = [];
                const l2 = Zr(r3);
                if (void 0 === r3) return a3;
                if ("object" !== l2) return a3.push(new zt("source_raster_dem", r3, `object expected, ${l2} found`)), a3;
                const u2 = "custom" === ki(r3.encoding), c2 = ["redFactor", "greenFactor", "blueFactor", "baseShift"], h2 = t3.value.encoding ? `"${t3.value.encoding}"` : "Default";
                for (const e4 in r3) !u2 && c2.includes(e4) ? a3.push(new zt(e4, r3[e4], `In "${n3}": "${e4}" is only valid when "encoding" is set to "custom". ${h2} encoding found`)) : s3[e4] ? a3 = a3.concat(t3.validateSpec({ key: e4, value: r3[e4], valueSpec: s3[e4], validateSpec: t3.validateSpec, style: o3, styleSpec: i3 })) : a3.push(new zt(e4, r3[e4], `unknown property "${e4}"`));
                return a3;
              })({ sourceName: n2, value: e2, style: t2.style, styleSpec: r2, validateSpec: s2 }), a2;
            case "geojson":
              if (a2 = Ei({ key: n2, value: e2, valueSpec: r2.source_geojson, style: i2, styleSpec: r2, validateSpec: s2, objectElementValidators: Ui }), e2.cluster) for (const t3 in e2.clusterProperties) {
                const [r3, i3] = e2.clusterProperties[t3], s3 = "string" == typeof r3 ? [r3, ["accumulated"], ["get", t3]] : r3;
                a2.push(...Di({ key: `${n2}.${t3}.map`, value: i3, expressionContext: "cluster-map" })), a2.push(...Di({ key: `${n2}.${t3}.reduce`, value: s3, expressionContext: "cluster-reduce" }));
              }
              return a2;
            case "video":
              return Ei({ key: n2, value: e2, valueSpec: r2.source_video, style: i2, validateSpec: s2, styleSpec: r2 });
            case "image":
              return Ei({ key: n2, value: e2, valueSpec: r2.source_image, style: i2, validateSpec: s2, styleSpec: r2 });
            case "canvas":
              return [new zt(n2, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")];
            default:
              return Bi({ key: `${n2}.type`, value: e2.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] } });
          }
        }
        function qi(t2) {
          const e2 = t2.value, n2 = t2.styleSpec, r2 = n2.light, i2 = t2.style;
          let s2 = [];
          const o2 = Zr(e2);
          if (void 0 === e2) return s2;
          if ("object" !== o2) return s2 = s2.concat([new zt("light", e2, `object expected, ${o2} found`)]), s2;
          for (const o3 in e2) {
            const a2 = o3.match(/^(.*)-transition$/);
            s2 = s2.concat(a2 && r2[a2[1]] && r2[a2[1]].transition ? t2.validateSpec({ key: o3, value: e2[o3], valueSpec: n2.transition, validateSpec: t2.validateSpec, style: i2, styleSpec: n2 }) : r2[o3] ? t2.validateSpec({ key: o3, value: e2[o3], valueSpec: r2[o3], validateSpec: t2.validateSpec, style: i2, styleSpec: n2 }) : [new zt(o3, e2[o3], `unknown property "${o3}"`)]);
          }
          return s2;
        }
        function Gi(t2) {
          const e2 = t2.value, n2 = t2.styleSpec, r2 = n2.sky, i2 = t2.style, s2 = Zr(e2);
          if (void 0 === e2) return [];
          if ("object" !== s2) return [new zt("sky", e2, `object expected, ${s2} found`)];
          let o2 = [];
          for (const s3 in e2) o2 = o2.concat(r2[s3] ? t2.validateSpec({ key: s3, value: e2[s3], valueSpec: r2[s3], style: i2, styleSpec: n2 }) : [new zt(s3, e2[s3], `unknown property "${s3}"`)]);
          return o2;
        }
        function Xi(t2) {
          const e2 = t2.value, n2 = t2.styleSpec, r2 = n2.terrain, i2 = t2.style;
          let s2 = [];
          const o2 = Zr(e2);
          if (void 0 === e2) return s2;
          if ("object" !== o2) return s2 = s2.concat([new zt("terrain", e2, `object expected, ${o2} found`)]), s2;
          for (const o3 in e2) s2 = s2.concat(r2[o3] ? t2.validateSpec({ key: o3, value: e2[o3], valueSpec: r2[o3], validateSpec: t2.validateSpec, style: i2, styleSpec: n2 }) : [new zt(o3, e2[o3], `unknown property "${o3}"`)]);
          return s2;
        }
        function Yi(t2) {
          let e2 = [];
          const n2 = t2.value, r2 = t2.key;
          if (Array.isArray(n2)) {
            const i2 = [], s2 = [];
            for (const o2 in n2) n2[o2].id && i2.includes(n2[o2].id) && e2.push(new zt(r2, n2, `all the sprites' ids must be unique, but ${n2[o2].id} is duplicated`)), i2.push(n2[o2].id), n2[o2].url && s2.includes(n2[o2].url) && e2.push(new zt(r2, n2, `all the sprites' URLs must be unique, but ${n2[o2].url} is duplicated`)), s2.push(n2[o2].url), e2 = e2.concat(Ei({ key: `${r2}[${o2}]`, value: n2[o2], valueSpec: { id: { type: "string", required: true }, url: { type: "string", required: true } }, validateSpec: t2.validateSpec }));
            return e2;
          }
          return Ni({ key: r2, value: n2 });
        }
        function Zi(t2) {
          return Boolean(t2) && t2.constructor === Object;
        }
        function Hi(t2) {
          return Zi(t2.value) ? [] : [new zt(t2.key, t2.value, `object expected, ${Zr(t2.value)} found`)];
        }
        const Wi = { "*": () => [], array: Ti, boolean: function(t2) {
          const e2 = t2.value, n2 = t2.key, r2 = Zr(e2);
          return "boolean" !== r2 ? [new zt(n2, e2, `boolean expected, ${r2} found`)] : [];
        }, number: Fi, color: zi, constants: Mi, enum: Bi, filter: Ci, function: Pi, layer: Ri, object: Ei, source: ji, light: qi, sky: Gi, terrain: Xi, projection: function(t2) {
          const e2 = t2.value, n2 = t2.styleSpec, r2 = n2.projection, i2 = t2.style, s2 = Zr(e2);
          if (void 0 === e2) return [];
          if ("object" !== s2) return [new zt("projection", e2, `object expected, ${s2} found`)];
          let o2 = [];
          for (const s3 in e2) o2 = o2.concat(r2[s3] ? t2.validateSpec({ key: s3, value: e2[s3], valueSpec: r2[s3], style: i2, styleSpec: n2 }) : [new zt(s3, e2[s3], `unknown property "${s3}"`)]);
          return o2;
        }, projectionDefinition: function(t2) {
          const e2 = t2.key;
          let n2 = t2.value;
          n2 = n2 instanceof String ? n2.valueOf() : n2;
          const r2 = Zr(n2);
          return "array" !== r2 || (function(t3) {
            return Array.isArray(t3) && 3 === t3.length && "string" == typeof t3[0] && "string" == typeof t3[1] && "number" == typeof t3[2];
          })(n2) || (function(t3) {
            return !!["interpolate", "step", "literal"].includes(t3[0]);
          })(n2) ? ["array", "string"].includes(r2) ? [] : [new zt(e2, n2, `projection expected, invalid type "${r2}" found`)] : [new zt(e2, n2, `projection expected, invalid array ${JSON.stringify(n2)} found`)];
        }, string: Ni, formatted: function(t2) {
          return 0 === Ni(t2).length ? [] : Di(t2);
        }, resolvedImage: function(t2) {
          return 0 === Ni(t2).length ? [] : Di(t2);
        }, padding: function(t2) {
          const e2 = t2.key, n2 = t2.value;
          if ("array" === Zr(n2)) {
            if (n2.length < 1 || n2.length > 4) return [new zt(e2, n2, `padding requires 1 to 4 values; ${n2.length} values found`)];
            const r2 = { type: "number" };
            let i2 = [];
            for (let s2 = 0; s2 < n2.length; s2++) i2 = i2.concat(t2.validateSpec({ key: `${e2}[${s2}]`, value: n2[s2], validateSpec: t2.validateSpec, valueSpec: r2 }));
            return i2;
          }
          return Fi({ key: e2, value: n2, valueSpec: {} });
        }, numberArray: function(t2) {
          const e2 = t2.key, n2 = t2.value;
          if ("array" === Zr(n2)) {
            const r2 = { type: "number" };
            if (n2.length < 1) return [new zt(e2, n2, "array length at least 1 expected, length 0 found")];
            let i2 = [];
            for (let s2 = 0; s2 < n2.length; s2++) i2 = i2.concat(t2.validateSpec({ key: `${e2}[${s2}]`, value: n2[s2], validateSpec: t2.validateSpec, valueSpec: r2 }));
            return i2;
          }
          return Fi({ key: e2, value: n2, valueSpec: {} });
        }, colorArray: function(t2) {
          const e2 = t2.key, n2 = t2.value;
          if ("array" === Zr(n2)) {
            if (n2.length < 1) return [new zt(e2, n2, "array length at least 1 expected, length 0 found")];
            let t3 = [];
            for (let r2 = 0; r2 < n2.length; r2++) t3 = t3.concat(zi({ key: `${e2}[${r2}]`, value: n2[r2] }));
            return t3;
          }
          return zi({ key: e2, value: n2 });
        }, variableAnchorOffsetCollection: function(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = Zr(n2), i2 = t2.styleSpec;
          if ("array" !== r2 || n2.length < 1 || n2.length % 2 != 0) return [new zt(e2, n2, "variableAnchorOffsetCollection requires a non-empty array of even length")];
          let s2 = [];
          for (let r3 = 0; r3 < n2.length; r3 += 2) s2 = s2.concat(Bi({ key: `${e2}[${r3}]`, value: n2[r3], valueSpec: i2.layout_symbol["text-anchor"] })), s2 = s2.concat(Ti({ key: `${e2}[${r3 + 1}]`, value: n2[r3 + 1], valueSpec: { length: 2, value: "number" }, validateSpec: t2.validateSpec, style: t2.style, styleSpec: i2 }));
          return s2;
        }, sprite: Yi, state: Hi, fontFaces: function(t2) {
          const e2 = t2.key, n2 = t2.value, r2 = t2.validateSpec, i2 = t2.styleSpec, s2 = t2.style;
          if (!Zi(n2)) return [new zt(e2, n2, `object expected, ${Zr(n2)} found`)];
          const o2 = [];
          for (const t3 in n2) {
            const a2 = n2[t3], l2 = Zr(a2);
            if ("string" === l2) o2.push(...Ni({ key: `${e2}.${t3}`, value: a2 }));
            else if ("array" === l2) {
              const n3 = { url: { type: "string", required: true }, "unicode-range": { type: "array", value: "string" } };
              for (const [l3, u2] of a2.entries()) o2.push(...Ei({ key: `${e2}.${t3}[${l3}]`, value: u2, valueSpec: n3, styleSpec: i2, style: s2, validateSpec: r2 }));
            } else o2.push(new zt(`${e2}.${t3}`, a2, `string or array expected, ${l2} found`));
          }
          return o2;
        } };
        function Ki(t2) {
          const e2 = t2.value, n2 = t2.valueSpec, r2 = t2.styleSpec;
          return t2.validateSpec = Ki, n2.expression && Hr(ki(e2)) ? Pi(t2) : n2.expression && ii(Ii(e2)) ? Di(t2) : n2.type && Wi[n2.type] ? Wi[n2.type](t2) : Ei(Bt({}, t2, { valueSpec: n2.type ? r2[n2.type] : n2 }));
        }
        function Ji(t2) {
          const e2 = t2.value, n2 = t2.key, r2 = Ni(t2);
          return r2.length || (-1 === e2.indexOf("{fontstack}") && r2.push(new zt(n2, e2, '"glyphs" url must include a "{fontstack}" token')), -1 === e2.indexOf("{range}") && r2.push(new zt(n2, e2, '"glyphs" url must include a "{range}" token'))), r2;
        }
        function Qi(t2, e2 = wt) {
          let n2 = [];
          return n2 = n2.concat(Ki({ key: "", value: t2, valueSpec: e2.$root, styleSpec: e2, style: t2, validateSpec: Ki, objectElementValidators: { glyphs: Ji, "*": () => [] } })), t2.constants && (n2 = n2.concat(Mi({ key: "constants", value: t2.constants }))), es(n2);
        }
        function ts(t2) {
          return function(e2) {
            return t2(Object.assign({}, e2, { validateSpec: Ki }));
          };
        }
        function es(t2) {
          return [].concat(t2).sort(((t3, e2) => t3.line - e2.line));
        }
        function ns(t2) {
          return function(...e2) {
            return es(t2.apply(this, e2));
          };
        }
        Qi.source = ns(ts(ji)), Qi.sprite = ns(ts(Yi)), Qi.glyphs = ns(ts(Ji)), Qi.light = ns(ts(qi)), Qi.sky = ns(ts(Gi)), Qi.terrain = ns(ts(Xi)), Qi.state = ns(ts(Hi)), Qi.layer = ns(ts(Ri)), Qi.filter = ns(ts(Ci)), Qi.paintProperty = ns(ts(Oi)), Qi.layoutProperty = ns(ts($i));
        const rs = { type: "enum", "property-type": "data-constant", expression: { interpolated: false, parameters: ["global-state"] }, values: { visible: {}, none: {} }, transition: false, default: "visible" };
        class is {
          constructor(t2, e2) {
            this._globalState = e2, this.setValue(t2);
          }
          evaluate() {
            var t2;
            return null !== (t2 = this._literalValue) && void 0 !== t2 ? t2 : this._compiledValue.evaluate({});
          }
          setValue(t2) {
            if (null == t2 || "visible" === t2 || "none" === t2) return this._literalValue = "none" === t2 ? "none" : "visible", this._compiledValue = void 0, void (this._globalStateRefs = /* @__PURE__ */ new Set());
            const e2 = si(t2, rs, this._globalState);
            if ("error" === e2.result) throw this._literalValue = "visible", this._compiledValue = void 0, new Error(e2.value.map(((t3) => `${t3.key}: ${t3.message}`)).join(", "));
            this._literalValue = void 0, this._compiledValue = e2.value, this._globalStateRefs = hi(e2.value.expression);
          }
          getGlobalStateRefs() {
            return this._globalStateRefs;
          }
        }
        const ss = wt, os = Qi, as = os.light, ls = os.sky, us = os.paintProperty, cs = os.layoutProperty;
        function hs(t2, e2) {
          let n2 = false;
          if (null == e2 ? void 0 : e2.length) for (const r2 of e2) t2.fire(new vt(new Error(r2.message))), n2 = true;
          return n2;
        }
        class ps {
          constructor(t2, e2, n2) {
            const r2 = this.cells = [];
            if (t2 instanceof ArrayBuffer) {
              this.arrayBuffer = t2;
              const i3 = new Int32Array(this.arrayBuffer);
              t2 = i3[0], this.d = (e2 = i3[1]) + 2 * (n2 = i3[2]);
              for (let t3 = 0; t3 < this.d * this.d; t3++) {
                const e3 = i3[3 + t3], n3 = i3[3 + t3 + 1];
                r2.push(e3 === n3 ? null : i3.subarray(e3, n3));
              }
              const s2 = i3[3 + r2.length + 1];
              this.keys = i3.subarray(i3[3 + r2.length], s2), this.bboxes = i3.subarray(s2), this.insert = this._insertReadonly;
            } else {
              this.d = e2 + 2 * n2;
              for (let t3 = 0; t3 < this.d * this.d; t3++) r2.push([]);
              this.keys = [], this.bboxes = [];
            }
            this.n = e2, this.extent = t2, this.padding = n2, this.scale = e2 / t2, this.uid = 0;
            const i2 = n2 / e2 * t2;
            this.min = -i2, this.max = t2 + i2;
          }
          insert(t2, e2, n2, r2, i2) {
            this._forEachCell(e2, n2, r2, i2, this._insertCell, this.uid++, void 0, void 0), this.keys.push(t2), this.bboxes.push(e2), this.bboxes.push(n2), this.bboxes.push(r2), this.bboxes.push(i2);
          }
          _insertReadonly() {
            throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.");
          }
          _insertCell(t2, e2, n2, r2, i2, s2) {
            this.cells[i2].push(s2);
          }
          query(t2, e2, n2, r2, i2) {
            const s2 = this.min, o2 = this.max;
            if (t2 <= s2 && e2 <= s2 && o2 <= n2 && o2 <= r2 && !i2) return [...this.keys];
            {
              const s3 = [];
              return this._forEachCell(t2, e2, n2, r2, this._queryCell, s3, {}, i2), s3;
            }
          }
          _queryCell(t2, e2, n2, r2, i2, s2, o2, a2) {
            const l2 = this.cells[i2];
            if (null !== l2) {
              const i3 = this.keys, u2 = this.bboxes;
              for (const c2 of l2) if (void 0 === o2[c2]) {
                const l3 = 4 * c2;
                (a2 ? a2(u2[l3 + 0], u2[l3 + 1], u2[l3 + 2], u2[l3 + 3]) : t2 <= u2[l3 + 2] && e2 <= u2[l3 + 3] && n2 >= u2[l3 + 0] && r2 >= u2[l3 + 1]) ? (o2[c2] = true, s2.push(i3[c2])) : o2[c2] = false;
              }
            }
          }
          _forEachCell(t2, e2, n2, r2, i2, s2, o2, a2) {
            const l2 = this._convertToCellCoord(t2), u2 = this._convertToCellCoord(e2), c2 = this._convertToCellCoord(n2), h2 = this._convertToCellCoord(r2);
            for (let p2 = l2; p2 <= c2; p2++) for (let l3 = u2; l3 <= h2; l3++) {
              const u3 = this.d * l3 + p2;
              if ((!a2 || a2(this._convertFromCellCoord(p2), this._convertFromCellCoord(l3), this._convertFromCellCoord(p2 + 1), this._convertFromCellCoord(l3 + 1))) && i2.call(this, t2, e2, n2, r2, u3, s2, o2, a2)) return;
            }
          }
          _convertFromCellCoord(t2) {
            return (t2 - this.padding) / this.scale;
          }
          _convertToCellCoord(t2) {
            return Math.max(0, Math.min(this.d - 1, Math.floor(t2 * this.scale) + this.padding));
          }
          toArrayBuffer() {
            if (this.arrayBuffer) return this.arrayBuffer;
            const t2 = this.cells, e2 = 3 + this.cells.length + 1 + 1;
            let n2 = 0;
            for (const t3 of this.cells) n2 += t3.length;
            const r2 = new Int32Array(e2 + n2 + this.keys.length + this.bboxes.length);
            r2[0] = this.extent, r2[1] = this.n, r2[2] = this.padding;
            let i2 = e2;
            for (let e3 = 0; e3 < t2.length; e3++) {
              const n3 = t2[e3];
              r2[3 + e3] = i2, r2.set(n3, i2), i2 += n3.length;
            }
            return r2[3 + t2.length] = i2, r2.set(this.keys, i2), i2 += this.keys.length, r2[3 + t2.length + 1] = i2, r2.set(this.bboxes, i2), i2 += this.bboxes.length, r2.buffer;
          }
          static serialize(t2, e2) {
            const n2 = t2.toArrayBuffer();
            return e2 && e2.push(n2), { buffer: n2 };
          }
          static deserialize(t2) {
            return new ps(t2.buffer);
          }
        }
        const fs = {};
        function ds(t2, e2, n2 = {}) {
          if (fs[t2]) throw new Error(`${t2} is already registered.`);
          Object.defineProperty(e2, "_classRegistryKey", { value: t2, writeable: false }), fs[t2] = { klass: e2, omit: n2.omit || [], shallow: n2.shallow || [] };
        }
        ds("Object", Object), ds("Set", Set), ds("TransferableGridIndex", ps), ds("Color", Te), ds("Error", Error), ds("AJAXError", pt), ds("ResolvedImage", Re), ds("StylePropertyFunction", ui), ds("StyleExpression", ri, { omit: ["_evaluator"] }), ds("ZoomDependentExpression", ai), ds("ZoomConstantExpression", oi), ds("CompoundExpression", Br, { omit: ["_evaluate"] });
        for (const t2 in zr) zr[t2]._classRegistryKey || ds(`Expression_${t2}`, zr[t2]);
        function ys(t2) {
          var e2;
          return t2 && "undefined" != typeof ArrayBuffer && (t2 instanceof ArrayBuffer || "ArrayBuffer" === (null === (e2 = t2.constructor) || void 0 === e2 ? void 0 : e2.name));
        }
        function ms(t2) {
          return t2.$name || t2.constructor._classRegistryKey;
        }
        function gs(t2) {
          return !(function(t3) {
            if (null === t3 || "object" != typeof t3) return false;
            const e2 = ms(t3);
            return e2 && "Object" !== e2;
          })(t2) && (null == t2 || "boolean" == typeof t2 || "number" == typeof t2 || "string" == typeof t2 || t2 instanceof Boolean || t2 instanceof Number || t2 instanceof String || t2 instanceof Date || t2 instanceof RegExp || t2 instanceof Blob || t2 instanceof Error || ys(t2) || H(t2) || ArrayBuffer.isView(t2) || t2 instanceof ImageData);
        }
        function xs(t2, e2) {
          if (gs(t2)) return (ys(t2) || H(t2)) && e2 && e2.push(t2), ArrayBuffer.isView(t2) && e2 && e2.push(t2.buffer), t2 instanceof ImageData && e2 && e2.push(t2.data.buffer), t2;
          if (Array.isArray(t2)) {
            const n3 = [];
            for (const r3 of t2) n3.push(xs(r3, e2));
            return n3;
          }
          if ("object" != typeof t2) throw new Error("can't serialize object of type " + typeof t2);
          const n2 = ms(t2);
          if (!n2) throw new Error(`can't serialize object of unregistered class ${t2.constructor.name}`);
          if (!fs[n2]) throw new Error(`${n2} is not registered.`);
          const { klass: r2 } = fs[n2], i2 = r2.serialize ? r2.serialize(t2, e2) : {};
          if (r2.serialize) {
            if (i2 === (null == e2 ? void 0 : e2[e2.length - 1])) throw new Error("statically serialized object won't survive transfer of $name property");
          } else {
            for (const r3 in t2) {
              if (!t2.hasOwnProperty(r3)) continue;
              if (fs[n2].omit.includes(r3)) continue;
              const s2 = t2[r3];
              i2[r3] = fs[n2].shallow.includes(r3) ? s2 : xs(s2, e2);
            }
            t2 instanceof Error && (i2.message = t2.message);
          }
          if (i2.$name) throw new Error("$name property is reserved for worker serialization logic.");
          return "Object" !== n2 && (i2.$name = n2), i2;
        }
        function vs(t2) {
          if (gs(t2)) return t2;
          if (Array.isArray(t2)) return t2.map(vs);
          if ("object" != typeof t2) throw new Error("can't deserialize object of type " + typeof t2);
          const e2 = ms(t2) || "Object";
          if (!fs[e2]) throw new Error(`can't deserialize unregistered class ${e2}`);
          const { klass: n2 } = fs[e2];
          if (!n2) throw new Error(`can't deserialize unregistered class ${e2}`);
          if (n2.deserialize) return n2.deserialize(t2);
          const r2 = Object.create(n2.prototype);
          for (const n3 of Object.keys(t2)) {
            if ("$name" === n3) continue;
            const i2 = t2[n3];
            r2[n3] = fs[e2].shallow.includes(n3) ? i2 : vs(i2);
          }
          return r2;
        }
        class bs {
          constructor() {
            this.first = true;
          }
          update(t2, e2) {
            const n2 = Math.floor(t2);
            return this.first ? (this.first = false, this.lastIntegerZoom = n2, this.lastIntegerZoomTime = 0, this.lastZoom = t2, this.lastFloorZoom = n2, true) : (this.lastFloorZoom > n2 ? (this.lastIntegerZoom = n2 + 1, this.lastIntegerZoomTime = e2) : this.lastFloorZoom < n2 && (this.lastIntegerZoom = n2, this.lastIntegerZoomTime = e2), t2 !== this.lastZoom && (this.lastZoom = t2, this.lastFloorZoom = n2, true));
          }
        }
        function ws(t2) {
          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(t2));
        }
        function _s(t2) {
          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(t2));
        }
        function Ss(t2) {
          return /\s/u.test(String.fromCodePoint(t2));
        }
        function As(t2) {
          for (const e2 of t2) if (_s(e2.codePointAt(0))) return true;
          return false;
        }
        function Ms(t2) {
          for (const e2 of t2) if (!Es(e2.codePointAt(0))) return false;
          return true;
        }
        function ks(t2) {
          const e2 = t2.map(((t3) => {
            try {
              return new RegExp(`\\p{sc=${t3}}`, "u").source;
            } catch (t4) {
              return null;
            }
          })).filter(((t3) => t3));
          return new RegExp(e2.join("|"), "u");
        }
        const Is = ks(["Arab", "Dupl", "Mong", "Ougr", "Syrc"]);
        function Es(t2) {
          return !Is.test(String.fromCodePoint(t2));
        }
        function Ts(t2) {
          return !(_s(t2) || (e2 = t2, /[\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(e2))));
          var e2;
        }
        const Fs = ks(["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 Ps(t2) {
          return Fs.test(String.fromCodePoint(t2));
        }
        function Ds(t2, e2) {
          return !(!e2 && Ps(t2) || /[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t2)));
        }
        function zs(t2) {
          for (const e2 of t2) if (Ps(e2.codePointAt(0))) return true;
          return false;
        }
        const Bs = new class {
          constructor() {
            this.TIMEOUT = 5e3, this.applyArabicShaping = null, this.processBidirectionalText = null, this.processStyledBidirectionalText = null, this.pluginStatus = "unavailable", this.pluginURL = null, this.loadScriptResolve = () => {
            };
          }
          setState(t2) {
            this.pluginStatus = t2.pluginStatus, this.pluginURL = t2.pluginURL;
          }
          getState() {
            return { pluginStatus: this.pluginStatus, pluginURL: this.pluginURL };
          }
          setMethods(t2) {
            if (Bs.isParsed()) throw new Error("RTL text plugin already registered.");
            this.applyArabicShaping = t2.applyArabicShaping, this.processBidirectionalText = t2.processBidirectionalText, this.processStyledBidirectionalText = t2.processStyledBidirectionalText, this.loadScriptResolve();
          }
          isParsed() {
            return null != this.applyArabicShaping && null != this.processBidirectionalText && null != this.processStyledBidirectionalText;
          }
          getRTLTextPluginStatus() {
            return this.pluginStatus;
          }
          syncState(t2, n2) {
            return e(this, void 0, void 0, (function* () {
              if (this.isParsed()) return this.getState();
              if ("loading" !== t2.pluginStatus) return this.setState(t2), t2;
              const e2 = t2.pluginURL, r2 = new Promise(((t3) => {
                this.loadScriptResolve = t3;
              }));
              n2(e2);
              const i2 = new Promise(((t3) => setTimeout((() => t3()), this.TIMEOUT)));
              if (yield Promise.race([r2, i2]), this.isParsed()) {
                const t3 = { pluginStatus: "loaded", pluginURL: e2 };
                return this.setState(t3), t3;
              }
              throw this.setState({ pluginStatus: "error", pluginURL: "" }), new Error(`RTL Text Plugin failed to import scripts from ${e2}`);
            }));
          }
        }();
        class Cs {
          constructor(t2, e2) {
            this.isSupportedScript = Vs, this.zoom = t2, e2 ? (this.now = e2.now || 0, this.fadeDuration = e2.fadeDuration || 0, this.zoomHistory = e2.zoomHistory || new bs(), this.transition = e2.transition || {}) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new bs(), this.transition = {});
          }
          crossFadingFactor() {
            return 0 === this.fadeDuration ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);
          }
          getCrossfadeParameters() {
            const t2 = this.zoom, e2 = t2 - Math.floor(t2), n2 = this.crossFadingFactor();
            return t2 > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: e2 + (1 - e2) * n2 } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - n2) * e2 };
          }
        }
        function Vs(t2) {
          return (function(t3, e2) {
            for (const n2 of t3) if (!Ds(n2.codePointAt(0), e2)) return false;
            return true;
          })(t2, "loaded" === Bs.getRTLTextPluginStatus());
        }
        const Ls = "-transition";
        class Os {
          constructor(t2, e2, n2) {
            this.property = t2, this.value = e2, this.expression = (function(t3, e3, n3) {
              if (Hr(t3)) return new ui(t3, e3);
              if (ii(t3)) {
                const r2 = li(t3, e3, n3);
                if ("error" === r2.result) throw new Error(r2.value.map(((t4) => `${t4.key}: ${t4.message}`)).join(", "));
                return r2.value;
              }
              {
                let n4 = t3;
                return "color" === e3.type && "string" == typeof t3 ? n4 = Te.parse(t3) : "padding" !== e3.type || "number" != typeof t3 && !Array.isArray(t3) ? "numberArray" !== e3.type || "number" != typeof t3 && !Array.isArray(t3) ? "colorArray" !== e3.type || "string" != typeof t3 && !Array.isArray(t3) ? "variableAnchorOffsetCollection" === e3.type && Array.isArray(t3) ? n4 = $e.parse(t3) : "projectionDefinition" === e3.type && "string" == typeof t3 && (n4 = Ne.parse(t3)) : n4 = Ve.parse(t3) : n4 = Ce.parse(t3) : n4 = Be.parse(t3), { globalStateRefs: /* @__PURE__ */ new Set(), _globalState: null, kind: "constant", evaluate: () => n4 };
              }
            })(void 0 === e2 ? t2.specification.default : e2, t2.specification, n2);
          }
          isDataDriven() {
            return "source" === this.expression.kind || "composite" === this.expression.kind;
          }
          getGlobalStateRefs() {
            return this.expression.globalStateRefs || /* @__PURE__ */ new Set();
          }
          possiblyEvaluate(t2, e2, n2) {
            return this.property.possiblyEvaluate(this, t2, e2, n2);
          }
        }
        class $s {
          constructor(t2, e2) {
            this.property = t2, this.value = new Os(t2, void 0, e2);
          }
          transitioned(t2, e2) {
            return new Ns(this.property, this.value, e2, $({}, t2.transition, this.transition), t2.now);
          }
          untransitioned() {
            return new Ns(this.property, this.value, null, {}, 0);
          }
        }
        class Rs {
          constructor(t2, e2) {
            this._properties = t2, this._values = Object.create(t2.defaultTransitionablePropertyValues), this._globalState = e2;
          }
          hasProperty(t2) {
            return t2 in this._properties.defaultTransitionablePropertyValues;
          }
          getValue(t2) {
            return j(this._values[t2].value.value);
          }
          setValue(t2, e2) {
            Object.hasOwn(this._values, t2) || (this._values[t2] = new $s(this._values[t2].property, this._globalState)), this._values[t2].value = new Os(this._values[t2].property, null === e2 ? void 0 : j(e2), this._globalState);
          }
          getTransition(t2) {
            return j(this._values[t2].transition);
          }
          setTransition(t2, e2) {
            Object.hasOwn(this._values, t2) || (this._values[t2] = new $s(this._values[t2].property, this._globalState)), this._values[t2].transition = j(e2) || void 0;
          }
          serialize() {
            const t2 = {};
            for (const e2 of Object.keys(this._values)) {
              const n2 = this.getValue(e2);
              void 0 !== n2 && (t2[e2] = n2);
              const r2 = this.getTransition(e2);
              void 0 !== r2 && (t2[`${e2}${Ls}`] = r2);
            }
            return t2;
          }
          transitioned(t2, e2) {
            const n2 = new Us(this._properties);
            for (const r2 of Object.keys(this._values)) n2._values[r2] = this._values[r2].transitioned(t2, e2._values[r2]);
            return n2;
          }
          untransitioned() {
            const t2 = new Us(this._properties);
            for (const e2 of Object.keys(this._values)) t2._values[e2] = this._values[e2].untransitioned();
            return t2;
          }
        }
        class Ns {
          constructor(t2, e2, n2, r2, i2) {
            this.property = t2, this.value = e2, this.begin = i2 + r2.delay || 0, this.end = this.begin + r2.duration || 0, t2.specification.transition && (r2.delay || r2.duration) && (this.prior = n2);
          }
          possiblyEvaluate(t2, e2, n2) {
            const r2 = t2.now || 0, i2 = this.value.possiblyEvaluate(t2, e2, n2), s2 = this.prior;
            if (s2) {
              if (r2 > this.end) return this.prior = null, i2;
              if (this.value.isDataDriven()) return this.prior = null, i2;
              if (r2 < this.begin) return s2.possiblyEvaluate(t2, e2, n2);
              {
                const o2 = (r2 - this.begin) / (this.end - this.begin);
                return this.property.interpolate(s2.possiblyEvaluate(t2, e2, n2), i2, B(o2));
              }
            }
            return i2;
          }
        }
        class Us {
          constructor(t2) {
            this._properties = t2, this._values = Object.create(t2.defaultTransitioningPropertyValues);
          }
          possiblyEvaluate(t2, e2, n2) {
            const r2 = new Gs(this._properties);
            for (const i2 of Object.keys(this._values)) r2._values[i2] = this._values[i2].possiblyEvaluate(t2, e2, n2);
            return r2;
          }
          hasTransition() {
            for (const t2 of Object.keys(this._values)) if (this._values[t2].prior) return true;
            return false;
          }
        }
        class js {
          constructor(t2, e2) {
            this._properties = t2, this._values = Object.create(t2.defaultPropertyValues), this._globalState = e2;
          }
          hasValue(t2) {
            return void 0 !== this._values[t2].value;
          }
          hasProperty(t2) {
            return t2 in this._properties.defaultPropertyValues;
          }
          getValue(t2) {
            return j(this._values[t2].value);
          }
          setValue(t2, e2) {
            this._values[t2] = new Os(this._values[t2].property, null === e2 ? void 0 : j(e2), this._globalState);
          }
          serialize() {
            const t2 = {};
            for (const e2 of Object.keys(this._values)) {
              const n2 = this.getValue(e2);
              void 0 !== n2 && (t2[e2] = n2);
            }
            return t2;
          }
          possiblyEvaluate(t2, e2, n2) {
            const r2 = new Gs(this._properties);
            for (const i2 of Object.keys(this._values)) r2._values[i2] = this._values[i2].possiblyEvaluate(t2, e2, n2);
            return r2;
          }
        }
        class qs {
          constructor(t2, e2, n2) {
            this.property = t2, this.value = e2, this.parameters = n2;
          }
          isConstant() {
            return "constant" === this.value.kind;
          }
          constantOr(t2) {
            return "constant" === this.value.kind ? this.value.value : t2;
          }
          evaluate(t2, e2, n2, r2) {
            return this.property.evaluate(this.value, this.parameters, t2, e2, n2, r2);
          }
        }
        class Gs {
          constructor(t2) {
            this._properties = t2, this._values = Object.create(t2.defaultPossiblyEvaluatedValues);
          }
          get(t2) {
            return this._values[t2];
          }
        }
        class Xs {
          constructor(t2) {
            this.specification = t2;
          }
          possiblyEvaluate(t2, e2) {
            if (t2.isDataDriven()) throw new Error("Value should not be data driven");
            return t2.expression.evaluate(e2);
          }
          interpolate(t2, e2, n2) {
            const r2 = xn[this.specification.type];
            return r2 ? r2(t2, e2, n2) : t2;
          }
        }
        class Ys {
          constructor(t2, e2) {
            this.specification = t2, this.overrides = e2;
          }
          possiblyEvaluate(t2, e2, n2, r2) {
            return new qs(this, "constant" === t2.expression.kind || "camera" === t2.expression.kind ? { kind: "constant", value: t2.expression.evaluate(e2, null, {}, n2, r2) } : t2.expression, e2);
          }
          interpolate(t2, e2, n2) {
            if ("constant" !== t2.value.kind || "constant" !== e2.value.kind) return t2;
            if (void 0 === t2.value.value || void 0 === e2.value.value) return new qs(this, { kind: "constant", value: void 0 }, t2.parameters);
            const r2 = xn[this.specification.type];
            if (r2) {
              const i2 = r2(t2.value.value, e2.value.value, n2);
              return new qs(this, { kind: "constant", value: i2 }, t2.parameters);
            }
            return t2;
          }
          evaluate(t2, e2, n2, r2, i2, s2) {
            return "constant" === t2.kind ? t2.value : t2.evaluate(e2, n2, r2, i2, s2);
          }
        }
        class Zs extends Ys {
          possiblyEvaluate(t2, e2, n2, r2) {
            if (void 0 === t2.value) return new qs(this, { kind: "constant", value: void 0 }, e2);
            if ("constant" === t2.expression.kind) {
              const i2 = t2.expression.evaluate(e2, null, {}, n2, r2), s2 = "resolvedImage" === t2.property.specification.type && "string" != typeof i2 ? i2.name : i2, o2 = this._calculate(s2, s2, s2, e2);
              return new qs(this, { kind: "constant", value: o2 }, e2);
            }
            if ("camera" === t2.expression.kind) {
              const n3 = this._calculate(t2.expression.evaluate({ zoom: e2.zoom - 1 }), t2.expression.evaluate({ zoom: e2.zoom }), t2.expression.evaluate({ zoom: e2.zoom + 1 }), e2);
              return new qs(this, { kind: "constant", value: n3 }, e2);
            }
            return new qs(this, t2.expression, e2);
          }
          evaluate(t2, e2, n2, r2, i2, s2) {
            if ("source" === t2.kind) {
              const o2 = t2.evaluate(e2, n2, r2, i2, s2);
              return this._calculate(o2, o2, o2, e2);
            }
            return "composite" === t2.kind ? this._calculate(t2.evaluate({ zoom: Math.floor(e2.zoom) - 1 }, n2, r2), t2.evaluate({ zoom: Math.floor(e2.zoom) }, n2, r2), t2.evaluate({ zoom: Math.floor(e2.zoom) + 1 }, n2, r2), e2) : t2.value;
          }
          _calculate(t2, e2, n2, r2) {
            return r2.zoom > r2.zoomHistory.lastIntegerZoom ? { from: t2, to: e2 } : { from: n2, to: e2 };
          }
          interpolate(t2) {
            return t2;
          }
        }
        class Hs {
          constructor(t2) {
            this.specification = t2;
          }
          possiblyEvaluate(t2, e2, n2, r2) {
            if (void 0 !== t2.value) {
              if ("constant" === t2.expression.kind) {
                const i2 = t2.expression.evaluate(e2, null, {}, n2, r2);
                return this._calculate(i2, i2, i2, e2);
              }
              return this._calculate(t2.expression.evaluate(new Cs(Math.floor(e2.zoom - 1), e2)), t2.expression.evaluate(new Cs(Math.floor(e2.zoom), e2)), t2.expression.evaluate(new Cs(Math.floor(e2.zoom + 1), e2)), e2);
            }
          }
          _calculate(t2, e2, n2, r2) {
            return r2.zoom > r2.zoomHistory.lastIntegerZoom ? { from: t2, to: e2 } : { from: n2, to: e2 };
          }
          interpolate(t2) {
            return t2;
          }
        }
        class Ws {
          constructor(t2) {
            this.specification = t2;
          }
          possiblyEvaluate(t2, e2, n2, r2) {
            return !!t2.expression.evaluate(e2, null, {}, n2, r2);
          }
          interpolate() {
            return false;
          }
        }
        class Ks {
          constructor(t2) {
            this.properties = t2, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [];
            for (const e2 in t2) {
              const n2 = t2[e2];
              n2.specification.overridable && this.overridableProperties.push(e2);
              const r2 = this.defaultPropertyValues[e2] = new Os(n2, void 0, void 0), i2 = this.defaultTransitionablePropertyValues[e2] = new $s(n2, void 0);
              this.defaultTransitioningPropertyValues[e2] = i2.untransitioned(), this.defaultPossiblyEvaluatedValues[e2] = r2.possiblyEvaluate({});
            }
          }
        }
        ds("DataDrivenProperty", Ys), ds("DataConstantProperty", Xs), ds("CrossFadedDataDrivenProperty", Zs), ds("CrossFadedProperty", Hs), ds("ColorRampProperty", Ws);
        const Js = " is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?", Qs = " is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";
        class to extends bt {
          constructor(t2, e2, n2) {
            if (super(), this.id = t2.id, this.type = t2.type, this._globalState = n2, this._featureFilter = { filter: () => true, needGeometry: false, getGlobalStateRefs: () => /* @__PURE__ */ new Set() }, this._visibilityExpression = (function(t3, e3) {
              return new is(t3, e3);
            })(this.visibility, n2), "custom" !== t2.type && (this.metadata = t2.metadata, this.minzoom = t2.minzoom, this.maxzoom = t2.maxzoom, "background" !== t2.type && (this.source = t2.source, this.sourceLayer = t2["source-layer"], this.filter = t2.filter, this._featureFilter = yi(t2.filter, n2)), e2.layout && (this._unevaluatedLayout = new js(e2.layout, n2)), e2.paint)) {
              this._transitionablePaint = new Rs(e2.paint, n2);
              for (const e3 in t2.paint) this.setPaintProperty(e3, t2.paint[e3], { validate: false });
              for (const e3 in t2.layout) this.setLayoutProperty(e3, t2.layout[e3], { validate: false });
              this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new Gs(e2.paint);
            }
          }
          setFilter(t2) {
            this.filter = t2, this._featureFilter = yi(t2, this._globalState);
          }
          getCrossfadeParameters() {
            return this._crossfadeParameters;
          }
          getLayoutProperty(t2) {
            var e2;
            if ("visibility" === t2) return this.visibility;
            if (null === (e2 = this._transitionablePaint) || void 0 === e2 ? void 0 : e2.hasProperty(t2)) throw new Error(t2 + Js);
            if (!this._unevaluatedLayout) throw new Error(`Cannot get layout property "${t2}" on layer type "${this.type}" which has no layout properties.`);
            return this._unevaluatedLayout.getValue(t2);
          }
          getLayoutAffectingGlobalStateRefs() {
            const t2 = /* @__PURE__ */ new Set();
            for (const e2 of this._visibilityExpression.getGlobalStateRefs()) t2.add(e2);
            if (this._unevaluatedLayout) for (const e2 in this._unevaluatedLayout._values) {
              const n2 = this._unevaluatedLayout._values[e2];
              for (const e3 of n2.getGlobalStateRefs()) t2.add(e3);
            }
            for (const e2 of this._featureFilter.getGlobalStateRefs()) t2.add(e2);
            return t2;
          }
          getPaintAffectingGlobalStateRefs() {
            var t2;
            const e2 = new globalThis.Map();
            if (this._transitionablePaint) for (const n2 in this._transitionablePaint._values) {
              const r2 = this._transitionablePaint._values[n2].value;
              for (const i2 of r2.getGlobalStateRefs()) {
                const s2 = null !== (t2 = e2.get(i2)) && void 0 !== t2 ? t2 : [];
                s2.push({ name: n2, value: r2.value }), e2.set(i2, s2);
              }
            }
            return e2;
          }
          getVisibilityAffectingGlobalStateRefs() {
            return this._visibilityExpression.getGlobalStateRefs();
          }
          setLayoutProperty(t2, e2, n2 = {}) {
            var r2;
            if ("visibility" === t2) return this.visibility = e2, this._visibilityExpression.setValue(e2), void this.recalculateVisibility();
            (null === (r2 = this._transitionablePaint) || void 0 === r2 ? void 0 : r2.hasProperty(t2)) ? this.fire(new vt(new Error(t2 + Js))) : null != e2 && this._validate(cs, `layers.${this.id}.layout.${t2}`, t2, e2, n2) || this._unevaluatedLayout.setValue(t2, e2);
          }
          getPaintProperty(t2) {
            var e2, n2;
            if (t2.endsWith(Ls)) {
              const n3 = t2.slice(0, -11);
              if ("visibility" === n3 || (null === (e2 = this._unevaluatedLayout) || void 0 === e2 ? void 0 : e2.hasProperty(n3))) throw new Error(t2 + Qs);
              return this._transitionablePaint.getTransition(n3);
            }
            if ("visibility" === t2 || (null === (n2 = this._unevaluatedLayout) || void 0 === n2 ? void 0 : n2.hasProperty(t2))) throw new Error(t2 + Qs);
            return this._transitionablePaint.getValue(t2);
          }
          setPaintProperty(t2, e2, n2 = {}) {
            var r2;
            if ("visibility" === t2 || (null === (r2 = this._unevaluatedLayout) || void 0 === r2 ? void 0 : r2.hasProperty(t2))) return this.fire(new vt(new Error(t2 + Qs))), false;
            if (null != e2 && this._validate(us, `layers.${this.id}.paint.${t2}`, t2, e2, n2)) return false;
            if (t2.endsWith(Ls)) return this._transitionablePaint.setTransition(t2.slice(0, -11), e2 || void 0), false;
            {
              const n3 = this._transitionablePaint._values[t2], r3 = "cross-faded-data-driven" === n3.property.specification["property-type"], i2 = n3.value.isDataDriven(), s2 = n3.value;
              this._transitionablePaint.setValue(t2, e2), this._handleSpecialPaintPropertyUpdate(t2);
              const o2 = this._transitionablePaint._values[t2].value;
              return o2.isDataDriven() || i2 || r3 || this._handleOverridablePaintPropertyUpdate(t2, s2, o2);
            }
          }
          _handleSpecialPaintPropertyUpdate(t2) {
          }
          _handleOverridablePaintPropertyUpdate(t2, e2, n2) {
            return false;
          }
          isHidden(t2 = this.minzoom, e2 = false) {
            return !!(this.minzoom && t2 < (e2 ? Math.floor(this.minzoom) : this.minzoom)) || !!(this.maxzoom && t2 >= this.maxzoom) || "none" === this._evaluatedVisibility;
          }
          updateTransitions(t2) {
            this._transitioningPaint = this._transitionablePaint.transitioned(t2, this._transitioningPaint);
          }
          hasTransition() {
            return this._transitioningPaint.hasTransition();
          }
          recalculateVisibility() {
            this._evaluatedVisibility = this._visibilityExpression.evaluate();
          }
          recalculate(t2, e2) {
            t2.getCrossfadeParameters && (this._crossfadeParameters = t2.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t2, void 0, e2)), this.paint = this._transitioningPaint.possiblyEvaluate(t2, void 0, e2);
          }
          serialize() {
            var t2, e2;
            const n2 = { 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: null === (t2 = this._unevaluatedLayout) || void 0 === t2 ? void 0 : t2.serialize(), paint: null === (e2 = this._transitionablePaint) || void 0 === e2 ? void 0 : e2.serialize() };
            return this.visibility && (n2.layout || (n2.layout = {}), n2.layout.visibility = this.visibility), U(n2, ((t3, e3) => !(void 0 === t3 || "layout" === e3 && !Object.keys(t3).length || "paint" === e3 && !Object.keys(t3).length)));
          }
          _validate(t2, e2, n2, r2, i2 = {}) {
            return false !== (null == i2 ? void 0 : i2.validate) && hs(this, t2.call(os, { key: e2, layerType: this.type, objectKey: n2, value: r2, styleSpec: wt, style: { glyphs: true, sprite: true } }));
          }
          is3D() {
            return false;
          }
          isTileClipped() {
            return false;
          }
          hasOffscreenPass() {
            return false;
          }
          resize() {
          }
          isStateDependent() {
            for (const t2 in this.paint._values) {
              const e2 = this.paint.get(t2);
              if (e2 instanceof qs && Gr(e2.property.specification) && ("source" === e2.value.kind || "composite" === e2.value.kind) && e2.value.isStateDependent) return true;
            }
            return false;
          }
        }
        let eo;
        var no = { get paint() {
          return eo = eo || new Ks({ "raster-opacity": new Xs(wt.paint_raster["raster-opacity"]), "raster-hue-rotate": new Xs(wt.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new Xs(wt.paint_raster["raster-brightness-min"]), "raster-brightness-max": new Xs(wt.paint_raster["raster-brightness-max"]), "raster-saturation": new Xs(wt.paint_raster["raster-saturation"]), "raster-contrast": new Xs(wt.paint_raster["raster-contrast"]), resampling: new Xs(wt.paint_raster.resampling), "raster-resampling": new Xs(wt.paint_raster["raster-resampling"]), "raster-fade-duration": new Xs(wt.paint_raster["raster-fade-duration"]) });
        } };
        class ro extends to {
          constructor(t2, e2) {
            super(t2, no, e2);
          }
        }
        const io = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array };
        class so {
          constructor(t2, e2) {
            this._structArray = t2, this._pos1 = e2 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;
          }
        }
        class oo {
          constructor() {
            this.isTransferred = false, this.capacity = -1, this.resize(0);
          }
          static serialize(t2, e2) {
            return t2._trim(), e2 && (t2.isTransferred = true, e2.push(t2.arrayBuffer)), { length: t2.length, arrayBuffer: t2.arrayBuffer };
          }
          static deserialize(t2) {
            const e2 = Object.create(this.prototype);
            return e2.arrayBuffer = t2.arrayBuffer, e2.length = t2.length, e2.capacity = t2.arrayBuffer.byteLength / e2.bytesPerElement, e2._refreshViews(), e2;
          }
          _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(t2) {
            this.reserve(t2), this.length = t2;
          }
          reserve(t2) {
            if (t2 > this.capacity) {
              this.capacity = Math.max(t2, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
              const e2 = this.uint8;
              this._refreshViews(), e2 && this.uint8.set(e2);
            }
          }
          _refreshViews() {
            throw new Error("_refreshViews() must be implemented by each concrete StructArray layout");
          }
          freeBufferAfterUpload() {
            this.arrayBuffer = new ArrayBuffer(0), this._refreshViews();
          }
        }
        function ao(t2, e2 = 1) {
          let n2 = 0, r2 = 0;
          return { members: t2.map(((t3) => {
            const i2 = io[t3.type].BYTES_PER_ELEMENT, s2 = n2 = lo(n2, Math.max(e2, i2)), o2 = t3.components || 1;
            return r2 = Math.max(r2, i2), n2 += i2 * o2, { name: t3.name, type: t3.type, components: o2, offset: s2 };
          })), size: lo(n2, Math.max(r2, e2)), alignment: e2 };
        }
        function lo(t2, e2) {
          return Math.ceil(t2 / e2) * e2;
        }
        class uo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2) {
            const n2 = this.length;
            return this.resize(n2 + 1), this.emplace(n2, t2, e2);
          }
          emplace(t2, e2, n2) {
            const r2 = 2 * t2;
            return this.int16[r2 + 0] = e2, this.int16[r2 + 1] = n2, t2;
          }
        }
        uo.prototype.bytesPerElement = 4, ds("StructArrayLayout2i4", uo);
        class co extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2) {
            const r2 = this.length;
            return this.resize(r2 + 1), this.emplace(r2, t2, e2, n2);
          }
          emplace(t2, e2, n2, r2) {
            const i2 = 3 * t2;
            return this.int16[i2 + 0] = e2, this.int16[i2 + 1] = n2, this.int16[i2 + 2] = r2, t2;
          }
        }
        co.prototype.bytesPerElement = 6, ds("StructArrayLayout3i6", co);
        class ho extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2) {
            const i2 = this.length;
            return this.resize(i2 + 1), this.emplace(i2, t2, e2, n2, r2);
          }
          emplace(t2, e2, n2, r2, i2) {
            const s2 = 4 * t2;
            return this.int16[s2 + 0] = e2, this.int16[s2 + 1] = n2, this.int16[s2 + 2] = r2, this.int16[s2 + 3] = i2, t2;
          }
        }
        ho.prototype.bytesPerElement = 8, ds("StructArrayLayout4i8", ho);
        class po extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2) {
            const o2 = this.length;
            return this.resize(o2 + 1), this.emplace(o2, t2, e2, n2, r2, i2, s2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = 6 * t2;
            return this.int16[a2 + 0] = e2, this.int16[a2 + 1] = n2, this.int16[a2 + 2] = r2, this.int16[a2 + 3] = i2, this.int16[a2 + 4] = s2, this.int16[a2 + 5] = o2, t2;
          }
        }
        po.prototype.bytesPerElement = 12, ds("StructArrayLayout2i4i12", po);
        class fo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2) {
            const o2 = this.length;
            return this.resize(o2 + 1), this.emplace(o2, t2, e2, n2, r2, i2, s2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = 4 * t2, l2 = 8 * t2;
            return this.int16[a2 + 0] = e2, this.int16[a2 + 1] = n2, this.uint8[l2 + 4] = r2, this.uint8[l2 + 5] = i2, this.uint8[l2 + 6] = s2, this.uint8[l2 + 7] = o2, t2;
          }
        }
        fo.prototype.bytesPerElement = 8, ds("StructArrayLayout2i4ub8", fo);
        class yo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2) {
            const n2 = this.length;
            return this.resize(n2 + 1), this.emplace(n2, t2, e2);
          }
          emplace(t2, e2, n2) {
            const r2 = 2 * t2;
            return this.float32[r2 + 0] = e2, this.float32[r2 + 1] = n2, t2;
          }
        }
        yo.prototype.bytesPerElement = 8, ds("StructArrayLayout2f8", yo);
        class mo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2) {
            const c2 = this.length;
            return this.resize(c2 + 1), this.emplace(c2, t2, e2, n2, r2, i2, s2, o2, a2, l2, u2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2) {
            const h2 = 10 * t2;
            return this.uint16[h2 + 0] = e2, this.uint16[h2 + 1] = n2, this.uint16[h2 + 2] = r2, this.uint16[h2 + 3] = i2, this.uint16[h2 + 4] = s2, this.uint16[h2 + 5] = o2, this.uint16[h2 + 6] = a2, this.uint16[h2 + 7] = l2, this.uint16[h2 + 8] = u2, this.uint16[h2 + 9] = c2, t2;
          }
        }
        mo.prototype.bytesPerElement = 20, ds("StructArrayLayout10ui20", mo);
        class go extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2, o2, a2) {
            const l2 = this.length;
            return this.resize(l2 + 1), this.emplace(l2, t2, e2, n2, r2, i2, s2, o2, a2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
            const u2 = 8 * t2;
            return this.uint16[u2 + 0] = e2, this.uint16[u2 + 1] = n2, this.uint16[u2 + 2] = r2, this.uint16[u2 + 3] = i2, this.uint16[u2 + 4] = s2, this.uint16[u2 + 5] = o2, this.uint16[u2 + 6] = a2, this.uint16[u2 + 7] = l2, t2;
          }
        }
        go.prototype.bytesPerElement = 16, ds("StructArrayLayout8ui16", go);
        class xo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2) {
            const p2 = this.length;
            return this.resize(p2 + 1), this.emplace(p2, t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2) {
            const f2 = 12 * t2;
            return this.int16[f2 + 0] = e2, this.int16[f2 + 1] = n2, this.int16[f2 + 2] = r2, this.int16[f2 + 3] = i2, this.uint16[f2 + 4] = s2, this.uint16[f2 + 5] = o2, this.uint16[f2 + 6] = a2, this.uint16[f2 + 7] = l2, this.int16[f2 + 8] = u2, this.int16[f2 + 9] = c2, this.int16[f2 + 10] = h2, this.int16[f2 + 11] = p2, t2;
          }
        }
        xo.prototype.bytesPerElement = 24, ds("StructArrayLayout4i4ui4i24", xo);
        class vo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2) {
            const r2 = this.length;
            return this.resize(r2 + 1), this.emplace(r2, t2, e2, n2);
          }
          emplace(t2, e2, n2, r2) {
            const i2 = 3 * t2;
            return this.float32[i2 + 0] = e2, this.float32[i2 + 1] = n2, this.float32[i2 + 2] = r2, t2;
          }
        }
        vo.prototype.bytesPerElement = 12, ds("StructArrayLayout3f12", vo);
        class bo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);
          }
          emplaceBack(t2) {
            const e2 = this.length;
            return this.resize(e2 + 1), this.emplace(e2, t2);
          }
          emplace(t2, e2) {
            return this.uint32[1 * t2 + 0] = e2, t2;
          }
        }
        bo.prototype.bytesPerElement = 4, ds("StructArrayLayout1ul4", bo);
        class wo extends oo {
          _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(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
            const u2 = this.length;
            return this.resize(u2 + 1), this.emplace(u2, t2, e2, n2, r2, i2, s2, o2, a2, l2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2) {
            const c2 = 10 * t2, h2 = 5 * t2;
            return this.int16[c2 + 0] = e2, this.int16[c2 + 1] = n2, this.int16[c2 + 2] = r2, this.int16[c2 + 3] = i2, this.int16[c2 + 4] = s2, this.int16[c2 + 5] = o2, this.uint32[h2 + 3] = a2, this.uint16[c2 + 8] = l2, this.uint16[c2 + 9] = u2, t2;
          }
        }
        wo.prototype.bytesPerElement = 20, ds("StructArrayLayout6i1ul2ui20", wo);
        class _o extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2) {
            const o2 = this.length;
            return this.resize(o2 + 1), this.emplace(o2, t2, e2, n2, r2, i2, s2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = 6 * t2;
            return this.int16[a2 + 0] = e2, this.int16[a2 + 1] = n2, this.int16[a2 + 2] = r2, this.int16[a2 + 3] = i2, this.int16[a2 + 4] = s2, this.int16[a2 + 5] = o2, t2;
          }
        }
        _o.prototype.bytesPerElement = 12, ds("StructArrayLayout2i2i2i12", _o);
        class So extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2) {
            const s2 = this.length;
            return this.resize(s2 + 1), this.emplace(s2, t2, e2, n2, r2, i2);
          }
          emplace(t2, e2, n2, r2, i2, s2) {
            const o2 = 4 * t2, a2 = 8 * t2;
            return this.float32[o2 + 0] = e2, this.float32[o2 + 1] = n2, this.float32[o2 + 2] = r2, this.int16[a2 + 6] = i2, this.int16[a2 + 7] = s2, t2;
          }
        }
        So.prototype.bytesPerElement = 16, ds("StructArrayLayout2f1f2i16", So);
        class Ao extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2, i2, s2) {
            const o2 = this.length;
            return this.resize(o2 + 1), this.emplace(o2, t2, e2, n2, r2, i2, s2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = 16 * t2, l2 = 4 * t2, u2 = 8 * t2;
            return this.uint8[a2 + 0] = e2, this.uint8[a2 + 1] = n2, this.float32[l2 + 1] = r2, this.float32[l2 + 2] = i2, this.int16[u2 + 6] = s2, this.int16[u2 + 7] = o2, t2;
          }
        }
        Ao.prototype.bytesPerElement = 16, ds("StructArrayLayout2ub2f2i16", Ao);
        class Mo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2) {
            const r2 = this.length;
            return this.resize(r2 + 1), this.emplace(r2, t2, e2, n2);
          }
          emplace(t2, e2, n2, r2) {
            const i2 = 3 * t2;
            return this.uint16[i2 + 0] = e2, this.uint16[i2 + 1] = n2, this.uint16[i2 + 2] = r2, t2;
          }
        }
        Mo.prototype.bytesPerElement = 6, ds("StructArrayLayout3ui6", Mo);
        class ko extends oo {
          _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(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2) {
            const g2 = this.length;
            return this.resize(g2 + 1), this.emplace(g2, t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2) {
            const x2 = 24 * t2, v2 = 12 * t2, b2 = 48 * t2;
            return this.int16[x2 + 0] = e2, this.int16[x2 + 1] = n2, this.uint16[x2 + 2] = r2, this.uint16[x2 + 3] = i2, this.uint32[v2 + 2] = s2, this.uint32[v2 + 3] = o2, this.uint32[v2 + 4] = a2, this.uint16[x2 + 10] = l2, this.uint16[x2 + 11] = u2, this.uint16[x2 + 12] = c2, this.float32[v2 + 7] = h2, this.float32[v2 + 8] = p2, this.uint8[b2 + 36] = f2, this.uint8[b2 + 37] = d2, this.uint8[b2 + 38] = y2, this.uint32[v2 + 10] = m2, this.int16[x2 + 22] = g2, t2;
          }
        }
        ko.prototype.bytesPerElement = 48, ds("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", ko);
        class Io extends oo {
          _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(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, S2, A2, M2, k2, I2) {
            const E2 = this.length;
            return this.resize(E2 + 1), this.emplace(E2, t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, S2, A2, M2, k2, I2);
          }
          emplace(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2, b2, w2, _2, S2, A2, M2, k2, I2, E2) {
            const T2 = 32 * t2, F2 = 16 * t2;
            return this.int16[T2 + 0] = e2, this.int16[T2 + 1] = n2, this.int16[T2 + 2] = r2, this.int16[T2 + 3] = i2, this.int16[T2 + 4] = s2, this.int16[T2 + 5] = o2, this.int16[T2 + 6] = a2, this.int16[T2 + 7] = l2, this.uint16[T2 + 8] = u2, this.uint16[T2 + 9] = c2, this.uint16[T2 + 10] = h2, this.uint16[T2 + 11] = p2, this.uint16[T2 + 12] = f2, this.uint16[T2 + 13] = d2, this.uint16[T2 + 14] = y2, this.uint16[T2 + 15] = m2, this.uint16[T2 + 16] = g2, this.uint16[T2 + 17] = x2, this.uint16[T2 + 18] = v2, this.uint16[T2 + 19] = b2, this.uint16[T2 + 20] = w2, this.uint16[T2 + 21] = _2, this.uint16[T2 + 22] = S2, this.uint32[F2 + 12] = A2, this.float32[F2 + 13] = M2, this.float32[F2 + 14] = k2, this.uint16[T2 + 30] = I2, this.uint16[T2 + 31] = E2, t2;
          }
        }
        Io.prototype.bytesPerElement = 64, ds("StructArrayLayout8i15ui1ul2f2ui64", Io);
        class Eo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
          }
          emplaceBack(t2) {
            const e2 = this.length;
            return this.resize(e2 + 1), this.emplace(e2, t2);
          }
          emplace(t2, e2) {
            return this.float32[1 * t2 + 0] = e2, t2;
          }
        }
        Eo.prototype.bytesPerElement = 4, ds("StructArrayLayout1f4", Eo);
        class To extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2) {
            const r2 = this.length;
            return this.resize(r2 + 1), this.emplace(r2, t2, e2, n2);
          }
          emplace(t2, e2, n2, r2) {
            const i2 = 3 * t2;
            return this.uint16[6 * t2 + 0] = e2, this.float32[i2 + 1] = n2, this.float32[i2 + 2] = r2, t2;
          }
        }
        To.prototype.bytesPerElement = 12, ds("StructArrayLayout1ui2f12", To);
        class Fo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2) {
            const r2 = this.length;
            return this.resize(r2 + 1), this.emplace(r2, t2, e2, n2);
          }
          emplace(t2, e2, n2, r2) {
            const i2 = 4 * t2;
            return this.uint32[2 * t2 + 0] = e2, this.uint16[i2 + 2] = n2, this.uint16[i2 + 3] = r2, t2;
          }
        }
        Fo.prototype.bytesPerElement = 8, ds("StructArrayLayout1ul2ui8", Fo);
        class Po extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2) {
            const n2 = this.length;
            return this.resize(n2 + 1), this.emplace(n2, t2, e2);
          }
          emplace(t2, e2, n2) {
            const r2 = 2 * t2;
            return this.uint16[r2 + 0] = e2, this.uint16[r2 + 1] = n2, t2;
          }
        }
        Po.prototype.bytesPerElement = 4, ds("StructArrayLayout2ui4", Po);
        class Do extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
          }
          emplaceBack(t2) {
            const e2 = this.length;
            return this.resize(e2 + 1), this.emplace(e2, t2);
          }
          emplace(t2, e2) {
            return this.uint16[1 * t2 + 0] = e2, t2;
          }
        }
        Do.prototype.bytesPerElement = 2, ds("StructArrayLayout1ui2", Do);
        class zo extends oo {
          _refreshViews() {
            this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
          }
          emplaceBack(t2, e2, n2, r2) {
            const i2 = this.length;
            return this.resize(i2 + 1), this.emplace(i2, t2, e2, n2, r2);
          }
          emplace(t2, e2, n2, r2, i2) {
            const s2 = 4 * t2;
            return this.float32[s2 + 0] = e2, this.float32[s2 + 1] = n2, this.float32[s2 + 2] = r2, this.float32[s2 + 3] = i2, t2;
          }
        }
        zo.prototype.bytesPerElement = 16, ds("StructArrayLayout4f16", zo);
        class Bo extends so {
          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 n(this.anchorPointX, this.anchorPointY);
          }
        }
        Bo.prototype.size = 20;
        class Co extends wo {
          get(t2) {
            return new Bo(this, t2);
          }
        }
        ds("CollisionBoxArray", Co);
        class Vo extends so {
          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(t2) {
            this._structArray.uint8[this._pos1 + 37] = t2;
          }
          get hidden() {
            return this._structArray.uint8[this._pos1 + 38];
          }
          set hidden(t2) {
            this._structArray.uint8[this._pos1 + 38] = t2;
          }
          get crossTileID() {
            return this._structArray.uint32[this._pos4 + 10];
          }
          set crossTileID(t2) {
            this._structArray.uint32[this._pos4 + 10] = t2;
          }
          get associatedIconIndex() {
            return this._structArray.int16[this._pos2 + 22];
          }
        }
        Vo.prototype.size = 48;
        class Lo extends ko {
          get(t2) {
            return new Vo(this, t2);
          }
        }
        ds("PlacedSymbolArray", Lo);
        class Oo extends so {
          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(t2) {
            this._structArray.uint32[this._pos4 + 12] = t2;
          }
          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];
          }
        }
        Oo.prototype.size = 64;
        class $o extends Io {
          get(t2) {
            return new Oo(this, t2);
          }
        }
        ds("SymbolInstanceArray", $o);
        class Ro extends Eo {
          getoffsetX(t2) {
            return this.float32[1 * t2 + 0];
          }
        }
        ds("GlyphOffsetArray", Ro);
        class No extends co {
          getx(t2) {
            return this.int16[3 * t2 + 0];
          }
          gety(t2) {
            return this.int16[3 * t2 + 1];
          }
          gettileUnitDistanceFromAnchor(t2) {
            return this.int16[3 * t2 + 2];
          }
        }
        ds("SymbolLineVertexArray", No);
        class Uo extends so {
          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];
          }
        }
        Uo.prototype.size = 12;
        class jo extends To {
          get(t2) {
            return new Uo(this, t2);
          }
        }
        ds("TextAnchorOffsetArray", jo);
        class qo extends so {
          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];
          }
        }
        qo.prototype.size = 8;
        class Go extends Fo {
          get(t2) {
            return new qo(this, t2);
          }
        }
        ds("FeatureIndexArray", Go);
        class Xo extends uo {
        }
        class Yo extends uo {
        }
        class Zo extends uo {
        }
        class Ho extends po {
        }
        class Wo extends fo {
        }
        class Ko extends yo {
        }
        class Jo extends mo {
        }
        class Qo extends go {
        }
        class ta extends xo {
        }
        class ea extends vo {
        }
        class na extends bo {
        }
        class ra extends _o {
        }
        class ia extends Ao {
        }
        class sa extends Mo {
        }
        class oa extends Po {
        }
        const aa = ao([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: la } = aa;
        class ua {
          constructor(t2 = []) {
            this._forceNewSegmentOnNextPrepare = false, this.segments = t2;
          }
          prepareSegment(t2, e2, n2, r2) {
            const i2 = this.segments[this.segments.length - 1];
            return t2 > ua.MAX_VERTEX_ARRAY_LENGTH && G(`Max vertices per segment is ${ua.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t2}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ua.MAX_VERTEX_ARRAY_LENGTH} vertices.`), this._forceNewSegmentOnNextPrepare || !i2 || i2.vertexLength + t2 > ua.MAX_VERTEX_ARRAY_LENGTH || i2.sortKey !== r2 ? this.createNewSegment(e2, n2, r2) : i2;
          }
          createNewSegment(t2, e2, n2) {
            const r2 = { vertexOffset: t2.length, primitiveOffset: e2.length, vertexLength: 0, primitiveLength: 0, vaos: {} };
            return void 0 !== n2 && (r2.sortKey = n2), this._forceNewSegmentOnNextPrepare = false, this.segments.push(r2), r2;
          }
          getOrCreateLatestSegment(t2, e2, n2) {
            return this.prepareSegment(0, t2, e2, n2);
          }
          forceNewSegmentOnNextPrepare() {
            this._forceNewSegmentOnNextPrepare = true;
          }
          get() {
            return this.segments;
          }
          destroy() {
            for (const t2 of this.segments) for (const e2 in t2.vaos) t2.vaos[e2].destroy();
          }
          static simpleSegment(t2, e2, n2, r2) {
            return new ua([{ vertexOffset: t2, primitiveOffset: e2, vertexLength: n2, primitiveLength: r2, vaos: {}, sortKey: 0 }]);
          }
        }
        function ca(t2, e2) {
          return 256 * (t2 = L(Math.floor(t2), 0, 255)) + L(Math.floor(e2), 0, 255);
        }
        ua.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, ds("SegmentVector", ua);
        const ha = ao([{ 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" }]), pa = ao([{ name: "a_dasharray_from", components: 4, type: "Uint16" }, { name: "a_dasharray_to", components: 4, type: "Uint16" }]);
        var fa, da, ya, ma = { exports: {} }, ga = { exports: {} }, xa = { exports: {} }, va = (function() {
          if (ya) return ma.exports;
          ya = 1;
          var t2 = (fa || (fa = 1, ga.exports = function(t3, e3) {
            var n2, r2, i2, s2, o2, a2, l2, u2;
            for (r2 = t3.length - (n2 = 3 & t3.length), i2 = e3, o2 = 3432918353, a2 = 461845907, u2 = 0; u2 < r2; ) l2 = 255 & t3.charCodeAt(u2) | (255 & t3.charCodeAt(++u2)) << 8 | (255 & t3.charCodeAt(++u2)) << 16 | (255 & t3.charCodeAt(++u2)) << 24, ++u2, i2 = 27492 + (65535 & (s2 = 5 * (65535 & (i2 = (i2 ^= l2 = (65535 & (l2 = (l2 = (65535 & l2) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * a2 + (((l2 >>> 16) * a2 & 65535) << 16) & 4294967295) << 13 | i2 >>> 19)) + ((5 * (i2 >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (s2 >>> 16) & 65535) << 16);
            switch (l2 = 0, n2) {
              case 3:
                l2 ^= (255 & t3.charCodeAt(u2 + 2)) << 16;
              case 2:
                l2 ^= (255 & t3.charCodeAt(u2 + 1)) << 8;
              case 1:
                i2 ^= l2 = (65535 & (l2 = (l2 = (65535 & (l2 ^= 255 & t3.charCodeAt(u2))) * o2 + (((l2 >>> 16) * o2 & 65535) << 16) & 4294967295) << 15 | l2 >>> 17)) * a2 + (((l2 >>> 16) * a2 & 65535) << 16) & 4294967295;
            }
            return i2 ^= t3.length, i2 = 2246822507 * (65535 & (i2 ^= i2 >>> 16)) + ((2246822507 * (i2 >>> 16) & 65535) << 16) & 4294967295, i2 = 3266489909 * (65535 & (i2 ^= i2 >>> 13)) + ((3266489909 * (i2 >>> 16) & 65535) << 16) & 4294967295, (i2 ^= i2 >>> 16) >>> 0;
          }), ga.exports), e2 = (da || (da = 1, xa.exports = function(t3, e3) {
            for (var n2, r2 = t3.length, i2 = e3 ^ r2, s2 = 0; r2 >= 4; ) n2 = 1540483477 * (65535 & (n2 = 255 & t3.charCodeAt(s2) | (255 & t3.charCodeAt(++s2)) << 8 | (255 & t3.charCodeAt(++s2)) << 16 | (255 & t3.charCodeAt(++s2)) << 24)) + ((1540483477 * (n2 >>> 16) & 65535) << 16), i2 = 1540483477 * (65535 & i2) + ((1540483477 * (i2 >>> 16) & 65535) << 16) ^ (n2 = 1540483477 * (65535 & (n2 ^= n2 >>> 24)) + ((1540483477 * (n2 >>> 16) & 65535) << 16)), r2 -= 4, ++s2;
            switch (r2) {
              case 3:
                i2 ^= (255 & t3.charCodeAt(s2 + 2)) << 16;
              case 2:
                i2 ^= (255 & t3.charCodeAt(s2 + 1)) << 8;
              case 1:
                i2 = 1540483477 * (65535 & (i2 ^= 255 & t3.charCodeAt(s2))) + ((1540483477 * (i2 >>> 16) & 65535) << 16);
            }
            return i2 = 1540483477 * (65535 & (i2 ^= i2 >>> 13)) + ((1540483477 * (i2 >>> 16) & 65535) << 16), (i2 ^= i2 >>> 15) >>> 0;
          }), xa.exports);
          return ma.exports = t2, ma.exports.murmur3 = t2, ma.exports.murmur2 = e2, ma.exports;
        })(), ba = r(va);
        class wa {
          constructor() {
            this.ids = [], this.positions = [], this.indexed = false;
          }
          add(t2, e2, n2, r2) {
            this.ids.push(_a(t2)), this.positions.push(e2, n2, r2);
          }
          getPositions(t2) {
            if (!this.indexed) throw new Error("Trying to get index, but feature positions are not indexed");
            const e2 = _a(t2);
            let n2 = 0, r2 = this.ids.length - 1;
            for (; n2 < r2; ) {
              const t3 = n2 + r2 >> 1;
              this.ids[t3] >= e2 ? r2 = t3 : n2 = t3 + 1;
            }
            const i2 = [];
            for (; this.ids[n2] === e2; ) i2.push({ index: this.positions[3 * n2], start: this.positions[3 * n2 + 1], end: this.positions[3 * n2 + 2] }), n2++;
            return i2;
          }
          static serialize(t2, e2) {
            const n2 = new Float64Array(t2.ids), r2 = new Uint32Array(t2.positions);
            return Sa(n2, r2, 0, n2.length - 1), e2 && e2.push(n2.buffer, r2.buffer), { ids: n2, positions: r2 };
          }
          static deserialize(t2) {
            const e2 = new wa();
            return e2.ids = t2.ids, e2.positions = t2.positions, e2.indexed = true, e2;
          }
        }
        function _a(t2) {
          const e2 = +t2;
          return !isNaN(e2) && e2 <= Number.MAX_SAFE_INTEGER ? e2 : ba(String(t2));
        }
        function Sa(t2, e2, n2, r2) {
          for (; n2 < r2; ) {
            const i2 = t2[n2 + r2 >> 1];
            let s2 = n2 - 1, o2 = r2 + 1;
            for (; ; ) {
              do {
                s2++;
              } while (t2[s2] < i2);
              do {
                o2--;
              } while (t2[o2] > i2);
              if (s2 >= o2) break;
              Aa(t2, s2, o2), Aa(e2, 3 * s2, 3 * o2), Aa(e2, 3 * s2 + 1, 3 * o2 + 1), Aa(e2, 3 * s2 + 2, 3 * o2 + 2);
            }
            o2 - n2 < r2 - o2 ? (Sa(t2, e2, n2, o2), n2 = o2 + 1) : (Sa(t2, e2, o2 + 1, r2), r2 = o2);
          }
        }
        function Aa(t2, e2, n2) {
          const r2 = t2[e2];
          t2[e2] = t2[n2], t2[n2] = r2;
        }
        ds("FeaturePositionMap", wa);
        class Ma {
          constructor(t2, e2) {
            this.gl = t2.gl, this.location = e2;
          }
        }
        class ka extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = 0;
          }
          set(t2) {
            this.current !== t2 && (this.current = t2, this.gl.uniform1f(this.location, t2));
          }
        }
        class Ia extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = [0, 0, 0, 0];
          }
          set(t2) {
            t2[0] === this.current[0] && t2[1] === this.current[1] && t2[2] === this.current[2] && t2[3] === this.current[3] || (this.current = t2, this.gl.uniform4f(this.location, t2[0], t2[1], t2[2], t2[3]));
          }
        }
        class Ea extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = Te.transparent;
          }
          set(t2) {
            t2.r === this.current.r && t2.g === this.current.g && t2.b === this.current.b && t2.a === this.current.a || (this.current = t2, this.gl.uniform4f(this.location, t2.r, t2.g, t2.b, t2.a));
          }
        }
        const Ta = new Float32Array(16);
        function Fa(t2) {
          return [ca(255 * t2.r, 255 * t2.g), ca(255 * t2.b, 255 * t2.a)];
        }
        class Pa {
          constructor(t2, e2, n2) {
            this.value = t2, this.uniformNames = e2.map(((t3) => `u_${t3}`)), this.type = n2;
          }
          setUniform(t2, e2, n2) {
            t2.set(n2.constantOr(this.value));
          }
          getBinding(t2, e2, n2) {
            return "color" === this.type ? new Ea(t2, e2) : new ka(t2, e2);
          }
        }
        class Da {
          constructor(t2, e2) {
            this.uniformNames = e2.map(((t3) => `u_${t3}`)), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;
          }
          setConstantPatternPositions(t2, e2) {
            this.pixelRatioFrom = e2.pixelRatio, this.pixelRatioTo = t2.pixelRatio, this.patternFrom = e2.tlbr, this.patternTo = t2.tlbr;
          }
          setConstantDashPositions(t2, e2) {
            this.dashTo = [0, t2.y, t2.height, t2.width], this.dashFrom = [0, e2.y, e2.height, e2.width];
          }
          setUniform(t2, e2, n2, r2) {
            let i2 = null;
            "u_pattern_to" === r2 ? i2 = this.patternTo : "u_pattern_from" === r2 ? i2 = this.patternFrom : "u_dasharray_to" === r2 ? i2 = this.dashTo : "u_dasharray_from" === r2 ? i2 = this.dashFrom : "u_pixel_ratio_to" === r2 ? i2 = this.pixelRatioTo : "u_pixel_ratio_from" === r2 && (i2 = this.pixelRatioFrom), null !== i2 && t2.set(i2);
          }
          getBinding(t2, e2, n2) {
            return n2.startsWith("u_pattern") || n2.startsWith("u_dasharray_") ? new Ia(t2, e2) : new ka(t2, e2);
          }
        }
        class za {
          constructor(t2, e2, n2, r2) {
            this.expression = t2, this.type = n2, this.maxValue = 0, this.paintVertexAttributes = e2.map(((t3) => ({ name: `a_${t3}`, type: "Float32", components: "color" === n2 ? 2 : 1, offset: 0 }))), this.paintVertexArray = new r2();
          }
          populatePaintArray(t2, e2, n2) {
            const r2 = this.paintVertexArray.length, i2 = this.expression.evaluate(new Cs(0, n2), e2, {}, n2.canonical, [], n2.formattedSection);
            this.paintVertexArray.resize(t2), this._setPaintValue(r2, t2, i2);
          }
          updatePaintArray(t2, e2, n2, r2, i2) {
            const s2 = this.expression.evaluate(new Cs(0, i2), n2, r2);
            this._setPaintValue(t2, e2, s2);
          }
          _setPaintValue(t2, e2, n2) {
            if ("color" === this.type) {
              const r2 = Fa(n2);
              for (let n3 = t2; n3 < e2; n3++) this.paintVertexArray.emplace(n3, r2[0], r2[1]);
            } else {
              for (let r2 = t2; r2 < e2; r2++) this.paintVertexArray.emplace(r2, n2);
              this.maxValue = Math.max(this.maxValue, Math.abs(n2));
            }
          }
          upload(t2) {
            var e2, n2;
            (null === (e2 = this.paintVertexArray) || void 0 === e2 ? void 0 : e2.arrayBuffer.byteLength) && ((null === (n2 = this.paintVertexBuffer) || void 0 === n2 ? void 0 : n2.buffer) ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
          }
          destroy() {
            this.paintVertexBuffer && this.paintVertexBuffer.destroy();
          }
        }
        class Ba {
          constructor(t2, e2, n2, r2, i2, s2) {
            this.expression = t2, this.uniformNames = e2.map(((t3) => `u_${t3}_t`)), this.type = n2, this.useIntegerZoom = r2, this.zoom = i2, this.maxValue = 0, this.paintVertexAttributes = e2.map(((t3) => ({ name: `a_${t3}`, type: "Float32", components: "color" === n2 ? 4 : 2, offset: 0 }))), this.paintVertexArray = new s2();
          }
          populatePaintArray(t2, e2, n2) {
            const r2 = this.expression.evaluate(new Cs(this.zoom, n2), e2, {}, n2.canonical, [], n2.formattedSection), i2 = this.expression.evaluate(new Cs(this.zoom + 1, n2), e2, {}, n2.canonical, [], n2.formattedSection), s2 = this.paintVertexArray.length;
            this.paintVertexArray.resize(t2), this._setPaintValue(s2, t2, r2, i2);
          }
          updatePaintArray(t2, e2, n2, r2, i2) {
            const s2 = this.expression.evaluate(new Cs(this.zoom, i2), n2, r2), o2 = this.expression.evaluate(new Cs(this.zoom + 1, i2), n2, r2);
            this._setPaintValue(t2, e2, s2, o2);
          }
          _setPaintValue(t2, e2, n2, r2) {
            if ("color" === this.type) {
              const i2 = Fa(n2), s2 = Fa(r2);
              for (let n3 = t2; n3 < e2; n3++) this.paintVertexArray.emplace(n3, i2[0], i2[1], s2[0], s2[1]);
            } else {
              for (let i2 = t2; i2 < e2; i2++) this.paintVertexArray.emplace(i2, n2, r2);
              this.maxValue = Math.max(this.maxValue, Math.abs(n2), Math.abs(r2));
            }
          }
          upload(t2) {
            var e2, n2;
            (null === (e2 = this.paintVertexArray) || void 0 === e2 ? void 0 : e2.arrayBuffer.byteLength) && ((null === (n2 = this.paintVertexBuffer) || void 0 === n2 ? void 0 : n2.buffer) ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t2.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
          }
          destroy() {
            this.paintVertexBuffer && this.paintVertexBuffer.destroy();
          }
          setUniform(t2, e2) {
            const n2 = this.useIntegerZoom ? Math.floor(e2.zoom) : e2.zoom, r2 = L(this.expression.interpolationFactor(n2, this.zoom, this.zoom + 1), 0, 1);
            t2.set(r2);
          }
          getBinding(t2, e2, n2) {
            return new ka(t2, e2);
          }
        }
        class Ca {
          constructor(t2, e2, n2, r2, i2, s2) {
            this.expression = t2, this.type = e2, this.useIntegerZoom = n2, this.zoom = r2, this.layerId = s2, this.zoomInPaintVertexArray = new i2(), this.zoomOutPaintVertexArray = new i2();
          }
          populatePaintArray(t2, e2, n2) {
            const r2 = this.zoomInPaintVertexArray.length;
            this.zoomInPaintVertexArray.resize(t2), this.zoomOutPaintVertexArray.resize(t2), this._setPaintValues(r2, t2, this.getPositionIds(e2), n2);
          }
          updatePaintArray(t2, e2, n2, r2, i2) {
            this._setPaintValues(t2, e2, this.getPositionIds(n2), i2);
          }
          _setPaintValues(t2, e2, n2, r2) {
            const i2 = this.getPositions(r2);
            if (!i2 || !n2) return;
            const s2 = i2[n2.min], o2 = i2[n2.mid], a2 = i2[n2.max];
            if (s2 && o2 && a2) for (let n3 = t2; n3 < e2; n3++) this.emplace(this.zoomInPaintVertexArray, n3, o2, s2), this.emplace(this.zoomOutPaintVertexArray, n3, o2, a2);
          }
          upload(t2) {
            var e2, n2;
            if ((null === (e2 = this.zoomInPaintVertexArray) || void 0 === e2 ? void 0 : e2.arrayBuffer.byteLength) && (null === (n2 = this.zoomOutPaintVertexArray) || void 0 === n2 ? void 0 : n2.arrayBuffer.byteLength)) {
              const e3 = this.getVertexAttributes();
              this.zoomInPaintVertexBuffer = t2.createVertexBuffer(this.zoomInPaintVertexArray, e3, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = t2.createVertexBuffer(this.zoomOutPaintVertexArray, e3, this.expression.isStateDependent);
            }
          }
          destroy() {
            this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
          }
        }
        class Va extends Ca {
          getPositions(t2) {
            return t2.imagePositions;
          }
          getPositionIds(t2) {
            var e2;
            return null === (e2 = t2.patterns) || void 0 === e2 ? void 0 : e2[this.layerId];
          }
          getVertexAttributes() {
            return ha.members;
          }
          emplace(t2, e2, n2, r2) {
            t2.emplace(e2, n2.tlbr[0], n2.tlbr[1], n2.tlbr[2], n2.tlbr[3], r2.tlbr[0], r2.tlbr[1], r2.tlbr[2], r2.tlbr[3], n2.pixelRatio, r2.pixelRatio);
          }
        }
        class La extends Ca {
          getPositions(t2) {
            return t2.dashPositions;
          }
          getPositionIds(t2) {
            var e2;
            return null === (e2 = t2.dashes) || void 0 === e2 ? void 0 : e2[this.layerId];
          }
          getVertexAttributes() {
            return pa.members;
          }
          emplace(t2, e2, n2, r2) {
            t2.emplace(e2, 0, n2.y, n2.height, n2.width, 0, r2.y, r2.height, r2.width);
          }
        }
        class Oa {
          constructor(t2, e2, n2) {
            this.binders = {}, this._buffers = [];
            const r2 = [];
            for (const i2 in t2.paint._values) {
              if (!n2(i2)) continue;
              const s2 = t2.paint.get(i2);
              if (!(s2 instanceof qs && Gr(s2.property.specification))) continue;
              const o2 = Ra(i2, t2.type), a2 = s2.value, l2 = s2.property.specification.type, u2 = s2.property.useIntegerZoom, c2 = s2.property.specification["property-type"], h2 = "cross-faded" === c2 || "cross-faded-data-driven" === c2;
              if ("constant" === a2.kind) this.binders[i2] = h2 ? new Da(a2.value, o2) : new Pa(a2.value, o2, l2), r2.push(`/u_${i2}`);
              else if ("source" === a2.kind || h2) {
                const n3 = Na(i2, l2, "source");
                this.binders[i2] = h2 ? "line-dasharray" === i2 ? new La(a2, l2, u2, e2, n3, t2.id) : new Va(a2, l2, u2, e2, n3, t2.id) : new za(a2, o2, l2, n3), r2.push(`/a_${i2}`);
              } else {
                const t3 = Na(i2, l2, "composite");
                this.binders[i2] = new Ba(a2, o2, l2, u2, e2, t3), r2.push(`/z_${i2}`);
              }
            }
            this.cacheKey = r2.sort().join("");
          }
          getMaxValue(t2) {
            const e2 = this.binders[t2];
            return e2 instanceof za || e2 instanceof Ba ? e2.maxValue : 0;
          }
          populatePaintArrays(t2, e2, n2) {
            for (const r2 in this.binders) {
              const i2 = this.binders[r2];
              (i2 instanceof za || i2 instanceof Ba || i2 instanceof Ca) && i2.populatePaintArray(t2, e2, n2);
            }
          }
          setConstantPatternPositions(t2, e2) {
            for (const n2 in this.binders) {
              const r2 = this.binders[n2];
              r2 instanceof Da && r2.setConstantPatternPositions(t2, e2);
            }
          }
          setConstantDashPositions(t2, e2) {
            for (const n2 in this.binders) {
              const r2 = this.binders[n2];
              r2 instanceof Da && r2.setConstantDashPositions(t2, e2);
            }
          }
          updatePaintArrays(t2, e2, n2, r2, i2) {
            let s2 = false;
            for (const o2 in t2) {
              const a2 = e2.getPositions(o2);
              for (const e3 of a2) {
                const a3 = n2.feature(e3.index);
                for (const n3 in this.binders) {
                  const l2 = this.binders[n3];
                  if ((l2 instanceof za || l2 instanceof Ba || l2 instanceof Ca) && true === l2.expression.isStateDependent) {
                    const u2 = r2.paint.get(n3);
                    l2.expression = u2.value, l2.updatePaintArray(e3.start, e3.end, a3, t2[o2], i2), s2 = true;
                  }
                }
              }
            }
            return s2;
          }
          defines() {
            const t2 = [];
            for (const e2 in this.binders) {
              const n2 = this.binders[e2];
              (n2 instanceof Pa || n2 instanceof Da) && t2.push(...n2.uniformNames.map(((t3) => `#define HAS_UNIFORM_${t3}`)));
            }
            return t2;
          }
          getBinderAttributes() {
            const t2 = [];
            for (const e2 in this.binders) {
              const n2 = this.binders[e2];
              if (n2 instanceof za || n2 instanceof Ba) for (const e3 of n2.paintVertexAttributes) t2.push(e3.name);
              else if (n2 instanceof Ca) {
                const e3 = n2.getVertexAttributes();
                for (const n3 of e3) t2.push(n3.name);
              }
            }
            return t2;
          }
          getBinderUniforms() {
            const t2 = [];
            for (const e2 in this.binders) {
              const n2 = this.binders[e2];
              if (n2 instanceof Pa || n2 instanceof Da || n2 instanceof Ba) for (const e3 of n2.uniformNames) t2.push(e3);
            }
            return t2;
          }
          getPaintVertexBuffers() {
            return this._buffers;
          }
          getUniforms(t2, e2) {
            const n2 = [];
            for (const r2 in this.binders) {
              const i2 = this.binders[r2];
              if (i2 instanceof Pa || i2 instanceof Da || i2 instanceof Ba) {
                for (const s2 of i2.uniformNames) if (e2[s2]) {
                  const o2 = i2.getBinding(t2, e2[s2], s2);
                  n2.push({ name: s2, property: r2, binding: o2 });
                }
              }
            }
            return n2;
          }
          setUniforms(t2, e2, n2, r2) {
            for (const { name: t3, property: i2, binding: s2 } of e2) this.binders[i2].setUniform(s2, r2, n2.get(i2), t3);
          }
          updatePaintBuffers(t2) {
            this._buffers = [];
            for (const e2 in this.binders) {
              const n2 = this.binders[e2];
              if (t2 && n2 instanceof Ca) {
                const e3 = 2 === t2.fromScale ? n2.zoomInPaintVertexBuffer : n2.zoomOutPaintVertexBuffer;
                e3 && this._buffers.push(e3);
              } else (n2 instanceof za || n2 instanceof Ba) && n2.paintVertexBuffer && this._buffers.push(n2.paintVertexBuffer);
            }
          }
          upload(t2) {
            for (const e2 in this.binders) {
              const n2 = this.binders[e2];
              (n2 instanceof za || n2 instanceof Ba || n2 instanceof Ca) && n2.upload(t2);
            }
            this.updatePaintBuffers();
          }
          destroy() {
            for (const t2 in this.binders) {
              const e2 = this.binders[t2];
              (e2 instanceof za || e2 instanceof Ba || e2 instanceof Ca) && e2.destroy();
            }
          }
        }
        class $a {
          constructor(t2, e2, n2 = () => true) {
            this.programConfigurations = {};
            for (const r2 of t2) this.programConfigurations[r2.id] = new Oa(r2, e2, n2);
            this.needsUpload = false, this._featureMap = new wa(), this._bufferOffset = 0;
          }
          populatePaintArrays(t2, e2, n2, r2) {
            for (const n3 in this.programConfigurations) this.programConfigurations[n3].populatePaintArrays(t2, e2, r2);
            void 0 !== e2.id && this._featureMap.add(e2.id, n2, this._bufferOffset, t2), this._bufferOffset = t2, this.needsUpload = true;
          }
          updatePaintArrays(t2, e2, n2, r2) {
            for (const i2 of n2) this.needsUpload = this.programConfigurations[i2.id].updatePaintArrays(t2, this._featureMap, e2, i2, r2) || this.needsUpload;
          }
          get(t2) {
            return this.programConfigurations[t2];
          }
          upload(t2) {
            if (this.needsUpload) {
              for (const e2 in this.programConfigurations) this.programConfigurations[e2].upload(t2);
              this.needsUpload = false;
            }
          }
          destroy() {
            for (const t2 in this.programConfigurations) this.programConfigurations[t2].destroy();
          }
        }
        function Ra(t2, e2) {
          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"] }[t2] || [t2.replace(`${e2}-`, "").replace(/-/g, "_")];
        }
        function Na(t2, e2, n2) {
          const r2 = { color: { source: yo, composite: zo }, number: { source: Eo, composite: yo } }, i2 = (function(t3) {
            return { "line-pattern": { source: Jo, composite: Jo }, "fill-pattern": { source: Jo, composite: Jo }, "fill-extrusion-pattern": { source: Jo, composite: Jo }, "line-dasharray": { source: Qo, composite: Qo } }[t3];
          })(t2);
          return (null == i2 ? void 0 : i2[n2]) || r2[e2][n2];
        }
        ds("ConstantBinder", Pa), ds("CrossFadedConstantBinder", Da), ds("SourceExpressionBinder", za), ds("CrossFadedPatternBinder", Va), ds("CrossFadedDasharrayBinder", La), ds("CompositeExpressionBinder", Ba), ds("ProgramConfiguration", Oa, { omit: ["_buffers"] }), ds("ProgramConfigurationSet", $a);
        const Ua = Math.pow(2, 14) - 1, ja = -Ua - 1;
        function qa(t2) {
          const e2 = T / t2.extent, n2 = t2.loadGeometry();
          for (const t3 of n2) for (const n3 of t3) {
            const t4 = Math.round(n3.x * e2), r2 = Math.round(n3.y * e2);
            n3.x = L(t4, ja, Ua), n3.y = L(r2, ja, Ua), (t4 < n3.x || t4 > n3.x + 1 || r2 < n3.y || r2 > n3.y + 1) && G("Geometry exceeds allowed extent, reduce your vector tile buffer size");
          }
          return n2;
        }
        function Ga(t2, e2) {
          return { type: t2.type, id: t2.id, properties: t2.properties, geometry: e2 ? qa(t2) : [] };
        }
        const Xa = -32768;
        function Ya(t2, e2, n2, r2, i2) {
          t2.emplaceBack(Xa + 8 * e2 + r2, Xa + 8 * n2 + i2);
        }
        class Za {
          constructor(t2) {
            this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasDependencies = false, this.layoutVertexArray = new Yo(), this.indexArray = new sa(), this.segments = new ua(), this.programConfigurations = new $a(t2.layers, t2.zoom), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
          }
          populate(t2, e2, n2) {
            const r2 = this.layers[0], i2 = [];
            let s2 = null, o2 = false, a2 = "heatmap" === r2.type;
            if ("circle" === r2.type) {
              const t3 = r2;
              s2 = t3.layout.get("circle-sort-key"), o2 = !s2.isConstant(), a2 || (a2 = "map" === t3.paint.get("circle-pitch-alignment"));
            }
            const l2 = a2 ? e2.subdivisionGranularity.circle : 1;
            for (const { feature: e3, id: r3, index: a3, sourceLayerIndex: l3 } of t2) {
              const t3 = this.layers[0]._featureFilter.needGeometry, u2 = Ga(e3, t3);
              if (!this.layers[0]._featureFilter.filter(new Cs(this.zoom), u2, n2)) continue;
              const c2 = o2 ? s2.evaluate(u2, {}, n2) : void 0, h2 = { id: r3, properties: e3.properties, type: e3.type, sourceLayerIndex: l3, index: a3, geometry: t3 ? u2.geometry : qa(e3), patterns: {}, sortKey: c2 };
              i2.push(h2);
            }
            o2 && i2.sort(((t3, e3) => t3.sortKey - e3.sortKey));
            for (const r3 of i2) {
              const { geometry: i3, index: s3, sourceLayerIndex: o3 } = r3, a3 = t2[s3].feature;
              this.addFeature(r3, i3, s3, n2, l2), e2.featureIndex.insert(a3, i3, s3, o3, this.index);
            }
          }
          update(t2, e2, n2) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, { imagePositions: n2 });
          }
          isEmpty() {
            return 0 === this.layoutVertexArray.length;
          }
          uploadPending() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }
          upload(t2) {
            this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, la), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
          }
          addFeature(t2, e2, n2, r2, i2 = 1) {
            let s2;
            switch (i2) {
              case 1:
                s2 = [0, 7];
                break;
              case 3:
                s2 = [0, 2, 5, 7];
                break;
              case 5:
                s2 = [0, 1, 3, 4, 6, 7];
                break;
              case 7:
                s2 = [0, 1, 2, 3, 4, 5, 6, 7];
                break;
              default:
                throw new Error(`Invalid circle bucket granularity: ${i2}; valid values are 1, 3, 5, 7.`);
            }
            const o2 = s2.length;
            for (const n3 of e2) for (const e3 of n3) {
              const n4 = e3.x, r3 = e3.y;
              if (n4 < 0 || n4 >= T || r3 < 0 || r3 >= T) continue;
              const i3 = this.segments.prepareSegment(o2 * o2, this.layoutVertexArray, this.indexArray, t2.sortKey), a2 = i3.vertexLength;
              for (let t3 = 0; t3 < o2; t3++) for (let e4 = 0; e4 < o2; e4++) Ya(this.layoutVertexArray, n4, r3, s2[e4], s2[t3]);
              for (let t3 = 0; t3 < o2 - 1; t3++) for (let e4 = 0; e4 < o2 - 1; e4++) {
                const n5 = a2 + t3 * o2 + e4, r4 = a2 + (t3 + 1) * o2 + e4;
                this.indexArray.emplaceBack(n5, r4 + 1, n5 + 1), this.indexArray.emplaceBack(n5, r4, r4 + 1);
              }
              i3.vertexLength += o2 * o2, i3.primitiveLength += (o2 - 1) * (o2 - 1) * 2;
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, n2, { imagePositions: {}, canonical: r2 });
          }
        }
        function Ha(t2, e2) {
          for (const n2 of t2) if (il(e2, n2)) return true;
          for (const n2 of e2) if (il(t2, n2)) return true;
          return Qa(t2, e2);
        }
        function Wa(t2, e2, n2) {
          return !!il(t2, e2) || el(e2, t2, n2);
        }
        function Ka(t2, e2) {
          if (1 === t2.length) return rl(e2, t2[0]);
          for (const n2 of e2) for (const e3 of n2) if (il(t2, e3)) return true;
          for (const n2 of t2) if (rl(e2, n2)) return true;
          for (const n2 of e2) if (Qa(t2, n2)) return true;
          return false;
        }
        function Ja(t2, e2, n2) {
          if (t2.length > 1) {
            if (Qa(t2, e2)) return true;
            for (const r2 of e2) if (el(r2, t2, n2)) return true;
          }
          for (const r2 of t2) if (el(r2, e2, n2)) return true;
          return false;
        }
        function Qa(t2, e2) {
          if (0 === t2.length || 0 === e2.length) return false;
          for (let n2 = 0; n2 < t2.length - 1; n2++) {
            const r2 = t2[n2], i2 = t2[n2 + 1];
            for (let t3 = 0; t3 < e2.length - 1; t3++) if (tl(r2, i2, e2[t3], e2[t3 + 1])) return true;
          }
          return false;
        }
        function tl(t2, e2, n2, r2) {
          return X(t2, n2, r2) !== X(e2, n2, r2) && X(t2, e2, n2) !== X(t2, e2, r2);
        }
        function el(t2, e2, n2) {
          const r2 = n2 * n2;
          if (1 === e2.length) return t2.distSqr(e2[0]) < r2;
          for (let n3 = 1; n3 < e2.length; n3++) if (nl(t2, e2[n3 - 1], e2[n3]) < r2) return true;
          return false;
        }
        function nl(t2, e2, n2) {
          const r2 = e2.distSqr(n2);
          if (0 === r2) return t2.distSqr(e2);
          const i2 = ((t2.x - e2.x) * (n2.x - e2.x) + (t2.y - e2.y) * (n2.y - e2.y)) / r2;
          return t2.distSqr(i2 < 0 ? e2 : i2 > 1 ? n2 : n2.sub(e2)._mult(i2)._add(e2));
        }
        function rl(t2, e2) {
          let n2, r2, i2, s2 = false;
          for (const o2 of t2) {
            n2 = o2;
            for (let t3 = 0, o3 = n2.length - 1; t3 < n2.length; o3 = t3++) r2 = n2[t3], i2 = n2[o3], r2.y > e2.y != i2.y > e2.y && e2.x < (i2.x - r2.x) * (e2.y - r2.y) / (i2.y - r2.y) + r2.x && (s2 = !s2);
          }
          return s2;
        }
        function il(t2, e2) {
          let n2 = false;
          for (let r2 = 0, i2 = t2.length - 1; r2 < t2.length; i2 = r2++) {
            const s2 = t2[r2], o2 = t2[i2];
            s2.y > e2.y != o2.y > e2.y && e2.x < (o2.x - s2.x) * (e2.y - s2.y) / (o2.y - s2.y) + s2.x && (n2 = !n2);
          }
          return n2;
        }
        function sl(t2, e2, n2) {
          const r2 = n2[0], i2 = n2[2];
          if (t2.x < r2.x && e2.x < r2.x || t2.x > i2.x && e2.x > i2.x || t2.y < r2.y && e2.y < r2.y || t2.y > i2.y && e2.y > i2.y) return false;
          const s2 = X(t2, e2, n2[0]);
          return s2 !== X(t2, e2, n2[1]) || s2 !== X(t2, e2, n2[2]) || s2 !== X(t2, e2, n2[3]);
        }
        function ol(t2, e2, n2) {
          const r2 = e2.paint.get(t2).value;
          return "constant" === r2.kind ? r2.value : n2.programConfigurations.get(e2.id).getMaxValue(t2);
        }
        function al(t2) {
          return Math.sqrt(t2[0] * t2[0] + t2[1] * t2[1]);
        }
        function ll(t2, e2, r2, i2, s2) {
          if (!e2[0] && !e2[1]) return t2;
          const o2 = n.convert(e2)._mult(s2);
          "viewport" === r2 && o2._rotate(-i2);
          const a2 = [];
          for (const e3 of t2) a2.push(e3.sub(o2));
          return a2;
        }
        function ul(t2) {
          const e2 = [];
          for (let n2 = 0; n2 < t2.length; n2++) {
            const r2 = t2[n2], i2 = e2.at(-1);
            (0 === n2 || i2 && !r2.equals(i2)) && e2.push(r2);
          }
          return e2;
        }
        function cl({ queryGeometry: t2, size: e2 }, n2) {
          return Wa(t2, n2, e2);
        }
        function hl({ queryGeometry: t2, size: e2, transform: n2, unwrappedTileID: r2, getElevation: i2 }, s2) {
          return Wa(t2, s2, e2 * (n2.projectTileCoordinates(s2.x, s2.y, r2, i2).signedDistanceFromCamera / n2.cameraToCenterDistance));
        }
        function pl({ queryGeometry: t2, size: e2, transform: n2, unwrappedTileID: r2, getElevation: i2 }, s2) {
          const o2 = n2.projectTileCoordinates(s2.x, s2.y, r2, i2).signedDistanceFromCamera, a2 = e2 * (n2.cameraToCenterDistance / o2);
          return Wa(t2, yl(s2, n2, r2, i2), a2);
        }
        function fl({ queryGeometry: t2, size: e2, transform: n2, unwrappedTileID: r2, getElevation: i2 }, s2) {
          return Wa(t2, yl(s2, n2, r2, i2), e2);
        }
        function dl({ queryGeometry: t2, size: e2, transform: n2, unwrappedTileID: r2, getElevation: i2, pitchAlignment: s2 = "map", pitchScale: o2 = "map" }, a2) {
          const l2 = "map" === s2 ? "map" === o2 ? cl : hl : "map" === o2 ? pl : fl, u2 = { queryGeometry: t2, size: e2, transform: n2, unwrappedTileID: r2, getElevation: i2 };
          for (const t3 of a2) for (const e3 of t3) if (l2(u2, e3)) return true;
          return false;
        }
        function yl(t2, e2, r2, i2) {
          const s2 = e2.projectTileCoordinates(t2.x, t2.y, r2, i2).point;
          return new n((0.5 * s2.x + 0.5) * e2.width, (0.5 * -s2.y + 0.5) * e2.height);
        }
        let ml2, gl;
        ds("CircleBucket", Za, { omit: ["layers"] });
        var xl = { get paint() {
          return gl = gl || new Ks({ "circle-radius": new Ys(wt.paint_circle["circle-radius"]), "circle-color": new Ys(wt.paint_circle["circle-color"]), "circle-blur": new Ys(wt.paint_circle["circle-blur"]), "circle-opacity": new Ys(wt.paint_circle["circle-opacity"]), "circle-translate": new Xs(wt.paint_circle["circle-translate"]), "circle-translate-anchor": new Xs(wt.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new Xs(wt.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new Xs(wt.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new Ys(wt.paint_circle["circle-stroke-width"]), "circle-stroke-color": new Ys(wt.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new Ys(wt.paint_circle["circle-stroke-opacity"]) });
        }, get layout() {
          return ml2 = ml2 || new Ks({ "circle-sort-key": new Ys(wt.layout_circle["circle-sort-key"]) });
        } };
        class vl extends to {
          constructor(t2, e2) {
            super(t2, xl, e2);
          }
          createBucket(t2) {
            return new Za(t2);
          }
          queryRadius(t2) {
            const e2 = t2;
            return ol("circle-radius", this, e2) + ol("circle-stroke-width", this, e2) + al(this.paint.get("circle-translate"));
          }
          queryIntersectsFeature({ queryGeometry: t2, feature: e2, featureState: n2, geometry: r2, transform: i2, pixelsToTileUnits: s2, unwrappedTileID: o2, getElevation: a2 }) {
            const l2 = ll(t2, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), -i2.bearingInRadians, s2), u2 = this.paint.get("circle-radius").evaluate(e2, n2) + this.paint.get("circle-stroke-width").evaluate(e2, n2), c2 = this.paint.get("circle-pitch-scale"), h2 = this.paint.get("circle-pitch-alignment");
            let p2, f2;
            return "map" === h2 ? (p2 = l2, f2 = u2 * s2) : (p2 = (function(t3, e3, n3, r3) {
              return t3.map(((t4) => yl(t4, e3, n3, r3)));
            })(l2, i2, o2, a2), f2 = u2), dl({ queryGeometry: p2, size: f2, transform: i2, unwrappedTileID: o2, getElevation: a2, pitchAlignment: h2, pitchScale: c2 }, r2);
          }
        }
        class bl extends Za {
        }
        let wl;
        ds("HeatmapBucket", bl, { omit: ["layers"] });
        var _l = { get paint() {
          return wl = wl || new Ks({ "heatmap-radius": new Ys(wt.paint_heatmap["heatmap-radius"]), "heatmap-weight": new Ys(wt.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new Xs(wt.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Ws(wt.paint_heatmap["heatmap-color"]), "heatmap-opacity": new Xs(wt.paint_heatmap["heatmap-opacity"]) });
        } };
        function Sl(t2, { width: e2, height: n2 }, r2, i2) {
          if (i2) {
            if (i2 instanceof Uint8ClampedArray) i2 = new Uint8Array(i2.buffer);
            else if (i2.length !== e2 * n2 * r2) throw new RangeError(`mismatched image size. expected: ${i2.length} but got: ${e2 * n2 * r2}`);
          } else i2 = new Uint8Array(e2 * n2 * r2);
          return t2.width = e2, t2.height = n2, t2.data = i2, t2;
        }
        function Al(t2, { width: e2, height: n2 }, r2) {
          if (e2 === t2.width && n2 === t2.height) return;
          const i2 = Sl({}, { width: e2, height: n2 }, r2);
          Ml(t2, i2, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t2.width, e2), height: Math.min(t2.height, n2) }, r2), t2.width = e2, t2.height = n2, t2.data = i2.data;
        }
        function Ml(t2, e2, n2, r2, i2, s2) {
          if (0 === i2.width || 0 === i2.height) return e2;
          if (i2.width > t2.width || i2.height > t2.height || n2.x > t2.width - i2.width || n2.y > t2.height - i2.height) throw new RangeError("out of range source coordinates for image copy");
          if (i2.width > e2.width || i2.height > e2.height || r2.x > e2.width - i2.width || r2.y > e2.height - i2.height) throw new RangeError("out of range destination coordinates for image copy");
          const o2 = t2.data, a2 = e2.data;
          if (o2 === a2) throw new Error("srcData equals dstData, so image is already copied");
          for (let l2 = 0; l2 < i2.height; l2++) {
            const u2 = ((n2.y + l2) * t2.width + n2.x) * s2, c2 = ((r2.y + l2) * e2.width + r2.x) * s2;
            for (let t3 = 0; t3 < i2.width * s2; t3++) a2[c2 + t3] = o2[u2 + t3];
          }
          return e2;
        }
        class kl {
          constructor(t2, e2) {
            Sl(this, t2, 1, e2);
          }
          resize(t2) {
            Al(this, t2, 1);
          }
          clone() {
            return new kl({ width: this.width, height: this.height }, new Uint8Array(this.data));
          }
          static copy(t2, e2, n2, r2, i2) {
            Ml(t2, e2, n2, r2, i2, 1);
          }
        }
        class Il {
          constructor(t2, e2) {
            Sl(this, t2, 4, e2);
          }
          resize(t2) {
            Al(this, t2, 4);
          }
          replace(t2, e2) {
            e2 ? this.data.set(t2) : this.data = t2 instanceof Uint8ClampedArray ? new Uint8Array(t2.buffer) : t2;
          }
          clone() {
            return new Il({ width: this.width, height: this.height }, new Uint8Array(this.data));
          }
          static copy(t2, e2, n2, r2, i2) {
            Ml(t2, e2, n2, r2, i2, 4);
          }
          setPixel(t2, e2, n2) {
            const r2 = 4 * (t2 * this.width + e2);
            this.data[r2 + 0] = Math.round(255 * n2.r / n2.a), this.data[r2 + 1] = Math.round(255 * n2.g / n2.a), this.data[r2 + 2] = Math.round(255 * n2.b / n2.a), this.data[r2 + 3] = Math.round(255 * n2.a);
          }
        }
        function El(t2) {
          const e2 = new Uint8Array(t2.length);
          for (let n2 = 0; n2 < t2.length; n2 += 4) {
            const r2 = t2[n2 + 3];
            e2[n2 + 0] = Math.round(t2[n2 + 0] * r2 / 255), e2[n2 + 1] = Math.round(t2[n2 + 1] * r2 / 255), e2[n2 + 2] = Math.round(t2[n2 + 2] * r2 / 255), e2[n2 + 3] = r2;
          }
          return e2;
        }
        function Tl(t2) {
          const e2 = {}, n2 = t2.resolution || 256, r2 = t2.clips ? t2.clips.length : 1, i2 = t2.image || new Il({ width: n2, height: r2 });
          if (Math.log(n2) / Math.LN2 % 1 != 0) throw new Error(`width is not a power of 2 - ${n2}`);
          const s2 = (r3, s3, o2) => {
            e2[t2.evaluationKey] = o2;
            const a2 = t2.expression.evaluate(e2);
            i2.setPixel(r3 / 4 / n2, s3 / 4, a2);
          };
          if (t2.clips) for (let e3 = 0, i3 = 0; e3 < r2; ++e3, i3 += 4 * n2) for (let r3 = 0, o2 = 0; r3 < n2; r3++, o2 += 4) {
            const a2 = r3 / (n2 - 1), { start: l2, end: u2 } = t2.clips[e3];
            s2(i3, o2, l2 * (1 - a2) + u2 * a2);
          }
          else for (let t3 = 0, e3 = 0; t3 < n2; t3++, e3 += 4) s2(0, e3, t3 / (n2 - 1));
          return i2;
        }
        ds("AlphaImage", kl), ds("RGBAImage", Il);
        const Fl = "big-fb";
        class Pl extends to {
          createBucket(t2) {
            return new bl(t2);
          }
          constructor(t2, e2) {
            super(t2, _l, e2), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();
          }
          _handleSpecialPaintPropertyUpdate(t2) {
            "heatmap-color" === t2 && this._updateColorRamp();
          }
          _updateColorRamp() {
            this.colorRamp = Tl({ expression: this._transitionablePaint._values["heatmap-color"].value.expression, evaluationKey: "heatmapDensity", image: this.colorRamp }), this.colorRampTexture = null;
          }
          resize() {
            this.heatmapFbos.has(Fl) && this.heatmapFbos.delete(Fl);
          }
          queryRadius(t2) {
            return ol("heatmap-radius", this, t2);
          }
          queryIntersectsFeature({ queryGeometry: t2, feature: e2, featureState: n2, geometry: r2, transform: i2, pixelsToTileUnits: s2, unwrappedTileID: o2, getElevation: a2 }) {
            return dl({ queryGeometry: t2, size: this.paint.get("heatmap-radius").evaluate(e2, n2) * s2, transform: i2, unwrappedTileID: o2, getElevation: a2 }, r2);
          }
          hasOffscreenPass() {
            return 0 !== this.paint.get("heatmap-opacity") && !this.isHidden();
          }
        }
        let Dl;
        var zl = { get paint() {
          return Dl = Dl || new Ks({ "hillshade-illumination-direction": new Xs(wt.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-altitude": new Xs(wt.paint_hillshade["hillshade-illumination-altitude"]), "hillshade-illumination-anchor": new Xs(wt.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new Xs(wt.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new Xs(wt.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new Xs(wt.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new Xs(wt.paint_hillshade["hillshade-accent-color"]), "hillshade-method": new Xs(wt.paint_hillshade["hillshade-method"]), resampling: new Xs(wt.paint_hillshade.resampling) });
        } };
        class Bl extends to {
          constructor(t2, e2) {
            super(t2, zl, e2), this.recalculate({ zoom: 0, zoomHistory: {} }, void 0);
          }
          getIlluminationProperties() {
            let t2 = this.paint.get("hillshade-illumination-direction").values, e2 = this.paint.get("hillshade-illumination-altitude").values, n2 = this.paint.get("hillshade-highlight-color").values, r2 = this.paint.get("hillshade-shadow-color").values;
            const i2 = Math.max(t2.length, e2.length, n2.length, r2.length);
            t2 = t2.concat(Array(i2 - t2.length).fill(t2.at(-1))), e2 = e2.concat(Array(i2 - e2.length).fill(e2.at(-1))), n2 = n2.concat(Array(i2 - n2.length).fill(n2.at(-1))), r2 = r2.concat(Array(i2 - r2.length).fill(r2.at(-1)));
            const s2 = e2.map(et);
            return { directionRadians: t2.map(et), altitudeRadians: s2, shadowColor: r2, highlightColor: n2 };
          }
          hasOffscreenPass() {
            return 0 !== this.paint.get("hillshade-exaggeration") && !this.isHidden();
          }
        }
        let Cl;
        var Vl = { get paint() {
          return Cl = Cl || new Ks({ "color-relief-opacity": new Xs(wt["paint_color-relief"]["color-relief-opacity"]), "color-relief-color": new Ws(wt["paint_color-relief"]["color-relief-color"]), resampling: new Xs(wt["paint_color-relief"].resampling) });
        } };
        function Ll(t2) {
          return "data" in t2;
        }
        class Ol {
          constructor(t2, e2, n2, r2) {
            this.context = t2, this.format = n2, this.texture = t2.gl.createTexture(), this._ownedHandle = this.texture, this.update(e2, r2);
          }
          update(t2, e2, n2) {
            var r2;
            const { width: i2, height: s2 } = t2, o2 = ((null === (r2 = this.size) || void 0 === r2 ? void 0 : r2[0]) !== i2 || this.size[1] !== s2) && !n2, { context: a2 } = this, { gl: l2 } = a2;
            this.useMipmap = Boolean(null == e2 ? void 0 : e2.useMipmap), l2.bindTexture(l2.TEXTURE_2D, this.texture), a2.pixelStoreUnpackFlipY.set(false), a2.pixelStoreUnpack.set(1);
            const u2 = this.format === l2.RGBA && false !== (null == e2 ? void 0 : e2.premultiply);
            if (o2) this.size = [i2, s2], Ll(t2) ? (a2.pixelStoreUnpackPremultiplyAlpha.set(false), this._uploadRawData(t2, u2, i2, s2, l2)) : (a2.pixelStoreUnpackPremultiplyAlpha.set(u2), this._uploadDomImage(t2, l2));
            else {
              const { x: e3, y: r3 } = n2 || { x: 0, y: 0 };
              Ll(t2) ? (a2.pixelStoreUnpackPremultiplyAlpha.set(false), this._updateRawData(t2, u2, e3, r3, i2, s2, l2)) : (a2.pixelStoreUnpackPremultiplyAlpha.set(u2), this._updateDomImage(t2, e3, r3, l2));
            }
            this.useMipmap && this.isSizePowerOfTwo() && l2.generateMipmap(l2.TEXTURE_2D), a2.pixelStoreUnpackFlipY.setDefault(), a2.pixelStoreUnpack.setDefault(), a2.pixelStoreUnpackPremultiplyAlpha.setDefault();
          }
          _uploadDomImage(t2, e2) {
            e2.texImage2D(e2.TEXTURE_2D, 0, this.format, this.format, e2.UNSIGNED_BYTE, t2);
          }
          _uploadRawData(t2, e2, n2, r2, i2) {
            let { data: s2 } = t2;
            e2 && s2 && (s2 = El(s2)), i2.texImage2D(i2.TEXTURE_2D, 0, this.format, n2, r2, 0, this.format, i2.UNSIGNED_BYTE, s2);
          }
          _updateDomImage(t2, e2, n2, r2) {
            r2.texSubImage2D(r2.TEXTURE_2D, 0, e2, n2, r2.RGBA, r2.UNSIGNED_BYTE, t2);
          }
          _updateRawData(t2, e2, n2, r2, i2, s2, o2) {
            let { data: a2 } = t2;
            e2 && a2 && (a2 = El(a2)), o2.texSubImage2D(o2.TEXTURE_2D, 0, n2, r2, i2, s2, o2.RGBA, o2.UNSIGNED_BYTE, a2);
          }
          bind(t2, e2, n2) {
            const { context: r2 } = this, { gl: i2 } = r2;
            this.texture !== this._ownedHandle && (this.texture = this._ownedHandle), i2.bindTexture(i2.TEXTURE_2D, this.texture), n2 !== i2.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (n2 = i2.LINEAR), t2 !== this.filter && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MAG_FILTER, t2), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_MIN_FILTER, n2 || t2), this.filter = t2), e2 !== this.wrap && (i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_S, e2), i2.texParameteri(i2.TEXTURE_2D, i2.TEXTURE_WRAP_T, e2), this.wrap = e2);
          }
          isSizePowerOfTwo() {
            return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
          }
          destroy() {
            const { gl: t2 } = this.context;
            t2.deleteTexture(this.texture), this.texture = null, this._ownedHandle = null;
          }
        }
        class $l {
          constructor(t2, e2, n2, r2 = 1, i2 = 1, s2 = 1, o2 = 0) {
            if (this.uid = t2, e2.height !== e2.width) throw new RangeError("DEM tiles must be square");
            if (n2 && !["mapbox", "terrarium", "custom"].includes(n2)) return void G(`"${n2}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);
            this.stride = e2.height;
            const a2 = this.dim = e2.height - 2;
            switch (this.data = new Uint32Array(e2.data.buffer), n2) {
              case "terrarium":
                this.redFactor = 256, this.greenFactor = 1, this.blueFactor = 1 / 256, this.baseShift = 32768;
                break;
              case "custom":
                this.redFactor = r2, this.greenFactor = i2, this.blueFactor = s2, this.baseShift = o2;
                break;
              default:
                this.redFactor = 6553.6, this.greenFactor = 25.6, this.blueFactor = 0.1, this.baseShift = 1e4;
            }
            for (let t3 = 0; t3 < a2; t3++) this.data[this._idx(-1, t3)] = this.data[this._idx(0, t3)], this.data[this._idx(a2, t3)] = this.data[this._idx(a2 - 1, t3)], this.data[this._idx(t3, -1)] = this.data[this._idx(t3, 0)], this.data[this._idx(t3, a2)] = this.data[this._idx(t3, a2 - 1)];
            this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(a2, -1)] = this.data[this._idx(a2 - 1, 0)], this.data[this._idx(-1, a2)] = this.data[this._idx(0, a2 - 1)], this.data[this._idx(a2, a2)] = this.data[this._idx(a2 - 1, a2 - 1)], this.min = Number.MAX_SAFE_INTEGER, this.max = Number.MIN_SAFE_INTEGER;
            for (let t3 = 0; t3 < a2; t3++) for (let e3 = 0; e3 < a2; e3++) {
              const n3 = this.get(t3, e3);
              n3 > this.max && (this.max = n3), n3 < this.min && (this.min = n3);
            }
          }
          get(t2, e2) {
            const n2 = new Uint8Array(this.data.buffer), r2 = 4 * this._idx(t2, e2);
            return this.unpack(n2[r2], n2[r2 + 1], n2[r2 + 2]);
          }
          getUnpackVector() {
            return [this.redFactor, this.greenFactor, this.blueFactor, this.baseShift];
          }
          _idx(t2, e2) {
            if (t2 < -1 || t2 >= this.dim + 1 || e2 < -1 || e2 >= this.dim + 1) throw new RangeError(`Out of range source coordinates for DEM data. x: ${t2}, y: ${e2}, dim: ${this.dim}`);
            return (e2 + 1) * this.stride + (t2 + 1);
          }
          unpack(t2, e2, n2) {
            return t2 * this.redFactor + e2 * this.greenFactor + n2 * this.blueFactor - this.baseShift;
          }
          pack(t2) {
            return Rl(t2, this.getUnpackVector());
          }
          getPixels() {
            return new Il({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));
          }
          backfillBorder(t2, e2, n2) {
            if (this.dim !== t2.dim) throw new Error("dem dimension mismatch");
            let r2 = e2 * this.dim, i2 = e2 * this.dim + this.dim, s2 = n2 * this.dim, o2 = n2 * this.dim + this.dim;
            switch (e2) {
              case -1:
                r2 = i2 - 1;
                break;
              case 1:
                i2 = r2 + 1;
            }
            switch (n2) {
              case -1:
                s2 = o2 - 1;
                break;
              case 1:
                o2 = s2 + 1;
            }
            const a2 = -e2 * this.dim, l2 = -n2 * this.dim;
            for (let e3 = s2; e3 < o2; e3++) for (let n3 = r2; n3 < i2; n3++) this.data[this._idx(n3, e3)] = t2.data[this._idx(n3 + a2, e3 + l2)];
          }
        }
        function Rl(t2, e2) {
          const n2 = e2[0], r2 = e2[1], i2 = e2[2], s2 = e2[3], o2 = Math.min(n2, r2, i2), a2 = Math.round((t2 + s2) / o2);
          return { r: Math.floor(a2 * o2 / n2) % 256, g: Math.floor(a2 * o2 / r2) % 256, b: Math.floor(a2 * o2 / i2) % 256 };
        }
        ds("DEMData", $l);
        class Nl extends to {
          constructor(t2, e2) {
            super(t2, Vl, e2);
          }
          _createColorRamp(t2) {
            const e2 = { elevationStops: [], colorStops: [] }, n2 = this._transitionablePaint._values["color-relief-color"].value.expression;
            if (n2 instanceof oi && n2._styleExpression.expression instanceof mn) {
              this.colorRampExpression = n2;
              const t3 = n2._styleExpression.expression;
              e2.elevationStops = t3.labels, e2.colorStops = [];
              for (const n3 of e2.elevationStops) e2.colorStops.push(t3.evaluate({ globals: { elevation: n3 } }));
            }
            if (e2.elevationStops.length < 1 && (e2.elevationStops = [0], e2.colorStops = [Te.transparent]), e2.elevationStops.length < 2 && (e2.elevationStops.push(e2.elevationStops[0] + 1), e2.colorStops.push(e2.colorStops[0])), e2.elevationStops.length <= t2) return e2;
            const r2 = { elevationStops: [], colorStops: [] }, i2 = (e2.elevationStops.length - 1) / (t2 - 1);
            for (let t3 = 0; t3 < e2.elevationStops.length - 0.5; t3 += i2) r2.elevationStops.push(e2.elevationStops[Math.round(t3)]), r2.colorStops.push(e2.colorStops[Math.round(t3)]);
            return G(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t2}, provided: ${e2.elevationStops.length}`), r2;
          }
          _colorRampChanged() {
            return this.colorRampExpression != this._transitionablePaint._values["color-relief-color"].value.expression;
          }
          getColorRampTextures(t2, e2, n2) {
            if (this.colorRampTextures && !this._colorRampChanged()) return this.colorRampTextures;
            const r2 = this._createColorRamp(e2), i2 = new Il({ width: r2.colorStops.length, height: 1 }), s2 = new Il({ width: r2.colorStops.length, height: 1 });
            for (let t3 = 0; t3 < r2.elevationStops.length; t3++) {
              const e3 = Rl(r2.elevationStops[t3], n2);
              s2.setPixel(0, t3, new Te(e3.r / 255, e3.g / 255, e3.b / 255, 1)), i2.setPixel(0, t3, r2.colorStops[t3]);
            }
            return this.colorRampTextures = { elevationTexture: new Ol(t2, s2, t2.gl.RGBA), colorTexture: new Ol(t2, i2, t2.gl.RGBA) }, this.colorRampTextures;
          }
          hasOffscreenPass() {
            return !this.isHidden() && !!this.colorRampTextures;
          }
        }
        const Ul = ao([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: jl } = Ul;
        function ql(t2, e2, n2) {
          const r2 = n2.patternDependencies;
          let i2 = false;
          for (const n3 of e2) {
            const e3 = n3.paint.get(`${t2}-pattern`);
            e3.isConstant() || (i2 = true);
            const s2 = e3.constantOr(null);
            s2 && (i2 = true, r2[s2.to] = true, r2[s2.from] = true);
          }
          return i2;
        }
        function Gl(t2, e2, n2, r2, i2) {
          const { zoom: s2 } = r2, o2 = i2.patternDependencies;
          for (const r3 of e2) {
            const e3 = r3.paint.get(`${t2}-pattern`).value;
            if ("constant" !== e3.kind) {
              let t3 = e3.evaluate({ zoom: s2 - 1 }, n2, {}, i2.availableImages), a2 = e3.evaluate({ zoom: s2 }, n2, {}, i2.availableImages), l2 = e3.evaluate({ zoom: s2 + 1 }, n2, {}, i2.availableImages);
              t3 = (null == t3 ? void 0 : t3.name) ? t3.name : t3, a2 = (null == a2 ? void 0 : a2.name) ? a2.name : a2, l2 = (null == l2 ? void 0 : l2.name) ? l2.name : l2, o2[t3] = true, o2[a2] = true, o2[l2] = true, n2.patterns[r3.id] = { min: t3, mid: a2, max: l2 };
            }
          }
          return n2;
        }
        function Xl(t2, e2, n2, r2, i2) {
          let s2;
          if (i2 === (function(t3, e3, n3, r3) {
            let i3 = 0;
            for (let s3 = e3, o2 = n3 - r3; s3 < n3; s3 += r3) i3 += (t3[o2] - t3[s3]) * (t3[s3 + 1] + t3[o2 + 1]), o2 = s3;
            return i3;
          })(t2, e2, n2, r2) > 0) for (let i3 = e2; i3 < n2; i3 += r2) s2 = du(i3 / r2 | 0, t2[i3], t2[i3 + 1], s2);
          else for (let i3 = n2 - r2; i3 >= e2; i3 -= r2) s2 = du(i3 / r2 | 0, t2[i3], t2[i3 + 1], s2);
          return s2 && lu(s2, s2.next) && (yu(s2), s2 = s2.next), s2;
        }
        function Yl(t2, e2) {
          if (!t2) return t2;
          e2 || (e2 = t2);
          let n2, r2 = t2;
          do {
            if (n2 = false, r2.steiner || !lu(r2, r2.next) && 0 !== au(r2.prev, r2, r2.next)) r2 = r2.next;
            else {
              if (yu(r2), r2 = e2 = r2.prev, r2 === r2.next) break;
              n2 = true;
            }
          } while (n2 || r2 !== e2);
          return e2;
        }
        function Zl(t2, e2, n2, r2, i2, s2, o2) {
          if (!t2) return;
          !o2 && s2 && (function(t3, e3, n3, r3) {
            let i3 = t3;
            do {
              0 === i3.z && (i3.z = nu(i3.x, i3.y, e3, n3, r3)), i3.prevZ = i3.prev, i3.nextZ = i3.next, i3 = i3.next;
            } while (i3 !== t3);
            i3.prevZ.nextZ = null, i3.prevZ = null, (function(t4) {
              let e4, n4 = 1;
              do {
                let r4, i4 = t4;
                t4 = null;
                let s3 = null;
                for (e4 = 0; i4; ) {
                  e4++;
                  let o3 = i4, a3 = 0;
                  for (let t5 = 0; t5 < n4 && (a3++, o3 = o3.nextZ, o3); t5++) ;
                  let l2 = n4;
                  for (; a3 > 0 || l2 > 0 && o3; ) 0 !== a3 && (0 === l2 || !o3 || i4.z <= o3.z) ? (r4 = i4, i4 = i4.nextZ, a3--) : (r4 = o3, o3 = o3.nextZ, l2--), s3 ? s3.nextZ = r4 : t4 = r4, r4.prevZ = s3, s3 = r4;
                  i4 = o3;
                }
                s3.nextZ = null, n4 *= 2;
              } while (e4 > 1);
            })(i3);
          })(t2, r2, i2, s2);
          let a2 = t2;
          for (; t2.prev !== t2.next; ) {
            const l2 = t2.prev, u2 = t2.next;
            if (s2 ? Wl(t2, r2, i2, s2) : Hl(t2)) e2.push(l2.i, t2.i, u2.i), yu(t2), t2 = u2.next, a2 = u2.next;
            else if ((t2 = u2) === a2) {
              o2 ? 1 === o2 ? Zl(t2 = Kl(Yl(t2), e2), e2, n2, r2, i2, s2, 2) : 2 === o2 && Jl(t2, e2, n2, r2, i2, s2) : Zl(Yl(t2), e2, n2, r2, i2, s2, 1);
              break;
            }
          }
        }
        function Hl(t2) {
          const e2 = t2.prev, n2 = t2, r2 = t2.next;
          if (au(e2, n2, r2) >= 0) return false;
          const i2 = e2.x, s2 = n2.x, o2 = r2.x, a2 = e2.y, l2 = n2.y, u2 = r2.y, c2 = Math.min(i2, s2, o2), h2 = Math.min(a2, l2, u2), p2 = Math.max(i2, s2, o2), f2 = Math.max(a2, l2, u2);
          let d2 = r2.next;
          for (; d2 !== e2; ) {
            if (d2.x >= c2 && d2.x <= p2 && d2.y >= h2 && d2.y <= f2 && su(i2, a2, s2, l2, o2, u2, d2.x, d2.y) && au(d2.prev, d2, d2.next) >= 0) return false;
            d2 = d2.next;
          }
          return true;
        }
        function Wl(t2, e2, n2, r2) {
          const i2 = t2.prev, s2 = t2, o2 = t2.next;
          if (au(i2, s2, o2) >= 0) return false;
          const a2 = i2.x, l2 = s2.x, u2 = o2.x, c2 = i2.y, h2 = s2.y, p2 = o2.y, f2 = Math.min(a2, l2, u2), d2 = Math.min(c2, h2, p2), y2 = Math.max(a2, l2, u2), m2 = Math.max(c2, h2, p2), g2 = nu(f2, d2, e2, n2, r2), x2 = nu(y2, m2, e2, n2, r2);
          let v2 = t2.prevZ, b2 = t2.nextZ;
          for (; v2 && v2.z >= g2 && b2 && b2.z <= x2; ) {
            if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i2 && v2 !== o2 && su(a2, c2, l2, h2, u2, p2, v2.x, v2.y) && au(v2.prev, v2, v2.next) >= 0) return false;
            if (v2 = v2.prevZ, b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i2 && b2 !== o2 && su(a2, c2, l2, h2, u2, p2, b2.x, b2.y) && au(b2.prev, b2, b2.next) >= 0) return false;
            b2 = b2.nextZ;
          }
          for (; v2 && v2.z >= g2; ) {
            if (v2.x >= f2 && v2.x <= y2 && v2.y >= d2 && v2.y <= m2 && v2 !== i2 && v2 !== o2 && su(a2, c2, l2, h2, u2, p2, v2.x, v2.y) && au(v2.prev, v2, v2.next) >= 0) return false;
            v2 = v2.prevZ;
          }
          for (; b2 && b2.z <= x2; ) {
            if (b2.x >= f2 && b2.x <= y2 && b2.y >= d2 && b2.y <= m2 && b2 !== i2 && b2 !== o2 && su(a2, c2, l2, h2, u2, p2, b2.x, b2.y) && au(b2.prev, b2, b2.next) >= 0) return false;
            b2 = b2.nextZ;
          }
          return true;
        }
        function Kl(t2, e2) {
          let n2 = t2;
          do {
            const r2 = n2.prev, i2 = n2.next.next;
            !lu(r2, i2) && uu(r2, n2, n2.next, i2) && pu(r2, i2) && pu(i2, r2) && (e2.push(r2.i, n2.i, i2.i), yu(n2), yu(n2.next), n2 = t2 = i2), n2 = n2.next;
          } while (n2 !== t2);
          return Yl(n2);
        }
        function Jl(t2, e2, n2, r2, i2, s2) {
          let o2 = t2;
          do {
            let t3 = o2.next.next;
            for (; t3 !== o2.prev; ) {
              if (o2.i !== t3.i && ou(o2, t3)) {
                let a2 = fu(o2, t3);
                return o2 = Yl(o2, o2.next), a2 = Yl(a2, a2.next), Zl(o2, e2, n2, r2, i2, s2, 0), void Zl(a2, e2, n2, r2, i2, s2, 0);
              }
              t3 = t3.next;
            }
            o2 = o2.next;
          } while (o2 !== t2);
        }
        function Ql(t2, e2) {
          let n2 = t2.x - e2.x;
          return 0 === n2 && (n2 = t2.y - e2.y, 0 === n2) && (n2 = (t2.next.y - t2.y) / (t2.next.x - t2.x) - (e2.next.y - e2.y) / (e2.next.x - e2.x)), n2;
        }
        function tu(t2, e2) {
          const n2 = (function(t3, e3) {
            let n3 = e3;
            const r3 = t3.x, i2 = t3.y;
            let s2, o2 = -1 / 0;
            if (lu(t3, n3)) return n3;
            do {
              if (lu(t3, n3.next)) return n3.next;
              if (i2 <= n3.y && i2 >= n3.next.y && n3.next.y !== n3.y) {
                const t4 = n3.x + (i2 - n3.y) * (n3.next.x - n3.x) / (n3.next.y - n3.y);
                if (t4 <= r3 && t4 > o2 && (o2 = t4, s2 = n3.x < n3.next.x ? n3 : n3.next, t4 === r3)) return s2;
              }
              n3 = n3.next;
            } while (n3 !== e3);
            if (!s2) return null;
            const a2 = s2, l2 = s2.x, u2 = s2.y;
            let c2 = 1 / 0;
            n3 = s2;
            do {
              if (r3 >= n3.x && n3.x >= l2 && r3 !== n3.x && iu(i2 < u2 ? r3 : o2, i2, l2, u2, i2 < u2 ? o2 : r3, i2, n3.x, n3.y)) {
                const e4 = Math.abs(i2 - n3.y) / (r3 - n3.x);
                pu(n3, t3) && (e4 < c2 || e4 === c2 && (n3.x > s2.x || n3.x === s2.x && eu(s2, n3))) && (s2 = n3, c2 = e4);
              }
              n3 = n3.next;
            } while (n3 !== a2);
            return s2;
          })(t2, e2);
          if (!n2) return e2;
          const r2 = fu(n2, t2);
          return Yl(r2, r2.next), Yl(n2, n2.next);
        }
        function eu(t2, e2) {
          return au(t2.prev, t2, e2.prev) < 0 && au(e2.next, t2, t2.next) < 0;
        }
        function nu(t2, e2, n2, r2, i2) {
          return (t2 = 1431655765 & ((t2 = 858993459 & ((t2 = 252645135 & ((t2 = 16711935 & ((t2 = (t2 - n2) * i2 | 0) | t2 << 8)) | t2 << 4)) | t2 << 2)) | t2 << 1)) | (e2 = 1431655765 & ((e2 = 858993459 & ((e2 = 252645135 & ((e2 = 16711935 & ((e2 = (e2 - r2) * i2 | 0) | e2 << 8)) | e2 << 4)) | e2 << 2)) | e2 << 1)) << 1;
        }
        function ru(t2) {
          let e2 = t2, n2 = t2;
          do {
            (e2.x < n2.x || e2.x === n2.x && e2.y < n2.y) && (n2 = e2), e2 = e2.next;
          } while (e2 !== t2);
          return n2;
        }
        function iu(t2, e2, n2, r2, i2, s2, o2, a2) {
          return (i2 - o2) * (e2 - a2) >= (t2 - o2) * (s2 - a2) && (t2 - o2) * (r2 - a2) >= (n2 - o2) * (e2 - a2) && (n2 - o2) * (s2 - a2) >= (i2 - o2) * (r2 - a2);
        }
        function su(t2, e2, n2, r2, i2, s2, o2, a2) {
          return !(t2 === o2 && e2 === a2) && iu(t2, e2, n2, r2, i2, s2, o2, a2);
        }
        function ou(t2, e2) {
          return t2.next.i !== e2.i && t2.prev.i !== e2.i && !(function(t3, e3) {
            let n2 = t3;
            do {
              if (n2.i !== t3.i && n2.next.i !== t3.i && n2.i !== e3.i && n2.next.i !== e3.i && uu(n2, n2.next, t3, e3)) return true;
              n2 = n2.next;
            } while (n2 !== t3);
            return false;
          })(t2, e2) && (pu(t2, e2) && pu(e2, t2) && (function(t3, e3) {
            let n2 = t3, r2 = false;
            const i2 = (t3.x + e3.x) / 2, s2 = (t3.y + e3.y) / 2;
            do {
              n2.y > s2 != n2.next.y > s2 && n2.next.y !== n2.y && i2 < (n2.next.x - n2.x) * (s2 - n2.y) / (n2.next.y - n2.y) + n2.x && (r2 = !r2), n2 = n2.next;
            } while (n2 !== t3);
            return r2;
          })(t2, e2) && (au(t2.prev, t2, e2.prev) || au(t2, e2.prev, e2)) || lu(t2, e2) && au(t2.prev, t2, t2.next) > 0 && au(e2.prev, e2, e2.next) > 0);
        }
        function au(t2, e2, n2) {
          return (e2.y - t2.y) * (n2.x - e2.x) - (e2.x - t2.x) * (n2.y - e2.y);
        }
        function lu(t2, e2) {
          return t2.x === e2.x && t2.y === e2.y;
        }
        function uu(t2, e2, n2, r2) {
          const i2 = hu(au(t2, e2, n2)), s2 = hu(au(t2, e2, r2)), o2 = hu(au(n2, r2, t2)), a2 = hu(au(n2, r2, e2));
          return i2 !== s2 && o2 !== a2 || !(0 !== i2 || !cu(t2, n2, e2)) || !(0 !== s2 || !cu(t2, r2, e2)) || !(0 !== o2 || !cu(n2, t2, r2)) || !(0 !== a2 || !cu(n2, e2, r2));
        }
        function cu(t2, e2, n2) {
          return e2.x <= Math.max(t2.x, n2.x) && e2.x >= Math.min(t2.x, n2.x) && e2.y <= Math.max(t2.y, n2.y) && e2.y >= Math.min(t2.y, n2.y);
        }
        function hu(t2) {
          return t2 > 0 ? 1 : t2 < 0 ? -1 : 0;
        }
        function pu(t2, e2) {
          return au(t2.prev, t2, t2.next) < 0 ? au(t2, e2, t2.next) >= 0 && au(t2, t2.prev, e2) >= 0 : au(t2, e2, t2.prev) < 0 || au(t2, t2.next, e2) < 0;
        }
        function fu(t2, e2) {
          const n2 = mu(t2.i, t2.x, t2.y), r2 = mu(e2.i, e2.x, e2.y), i2 = t2.next, s2 = e2.prev;
          return t2.next = e2, e2.prev = t2, n2.next = i2, i2.prev = n2, r2.next = n2, n2.prev = r2, s2.next = r2, r2.prev = s2, r2;
        }
        function du(t2, e2, n2, r2) {
          const i2 = mu(t2, e2, n2);
          return r2 ? (i2.next = r2.next, i2.prev = r2, r2.next.prev = i2, r2.next = i2) : (i2.prev = i2, i2.next = i2), i2;
        }
        function yu(t2) {
          t2.next.prev = t2.prev, t2.prev.next = t2.next, t2.prevZ && (t2.prevZ.nextZ = t2.nextZ), t2.nextZ && (t2.nextZ.prevZ = t2.prevZ);
        }
        function mu(t2, e2, n2) {
          return { i: t2, x: e2, y: n2, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: false };
        }
        class gu {
          constructor(t2, e2) {
            if (e2 > t2) throw new Error("Min granularity must not be greater than base granularity.");
            this._baseZoomGranularity = t2, this._minGranularity = e2;
          }
          getGranularityForZoomLevel(t2) {
            return Math.max(Math.floor(this._baseZoomGranularity / (1 << t2)), this._minGranularity, 1);
          }
        }
        class xu {
          constructor(t2) {
            this.fill = t2.fill, this.line = t2.line, this.tile = t2.tile, this.stencil = t2.stencil, this.circle = t2.circle;
          }
        }
        xu.noSubdivision = new xu({ fill: new gu(0, 0), line: new gu(0, 0), tile: new gu(0, 0), stencil: new gu(0, 0), circle: 1 }), ds("SubdivisionGranularityExpression", gu), ds("SubdivisionGranularitySetting", xu);
        const vu = -32768, bu = 32767;
        class wu {
          constructor(t2, e2) {
            this._vertexBuffer = [], this._vertexDictionary = /* @__PURE__ */ new Map(), this._used = false, this._granularity = t2, this._granularityCellSize = T / t2, this._canonical = e2;
          }
          _getKey(t2, e2) {
            return (t2 += 32768) << 16 | e2 + 32768;
          }
          _vertexToIndex(t2, e2) {
            if (t2 < -32768 || e2 < -32768 || t2 > 32767 || e2 > 32767) throw new Error("Vertex coordinates are out of signed 16 bit integer range.");
            const n2 = 0 | Math.round(t2), r2 = 0 | Math.round(e2), i2 = this._getKey(n2, r2);
            if (this._vertexDictionary.has(i2)) return this._vertexDictionary.get(i2);
            const s2 = this._vertexBuffer.length / 2;
            return this._vertexDictionary.set(i2, s2), this._vertexBuffer.push(n2, r2), s2;
          }
          _subdivideTrianglesScanline(t2) {
            if (this._granularity < 2) return (function(t3, e3) {
              const n3 = [];
              for (let r2 = 0; r2 < e3.length; r2 += 3) {
                const i2 = e3[r2], s2 = e3[r2 + 1], o2 = e3[r2 + 2], a2 = t3[2 * i2], l2 = t3[2 * i2 + 1];
                (t3[2 * s2] - a2) * (t3[2 * o2 + 1] - l2) - (t3[2 * s2 + 1] - l2) * (t3[2 * o2] - a2) > 0 ? (n3.push(i2), n3.push(o2), n3.push(s2)) : (n3.push(i2), n3.push(s2), n3.push(o2));
              }
              return n3;
            })(this._vertexBuffer, t2);
            const e2 = [], n2 = t2.length;
            for (let r2 = 0; r2 < n2; r2 += 3) {
              const n3 = [t2[r2 + 0], t2[r2 + 1], t2[r2 + 2]], i2 = [this._vertexBuffer[2 * t2[r2 + 0] + 0], this._vertexBuffer[2 * t2[r2 + 0] + 1], this._vertexBuffer[2 * t2[r2 + 1] + 0], this._vertexBuffer[2 * t2[r2 + 1] + 1], this._vertexBuffer[2 * t2[r2 + 2] + 0], this._vertexBuffer[2 * t2[r2 + 2] + 1]];
              let s2 = 1 / 0, o2 = 1 / 0, a2 = -1 / 0, l2 = -1 / 0;
              for (let t3 = 0; t3 < 3; t3++) {
                const e3 = i2[2 * t3], n4 = i2[2 * t3 + 1];
                s2 = Math.min(s2, e3), a2 = Math.max(a2, e3), o2 = Math.min(o2, n4), l2 = Math.max(l2, n4);
              }
              if (s2 === a2 || o2 === l2) continue;
              const u2 = Math.floor(s2 / this._granularityCellSize), c2 = Math.ceil(a2 / this._granularityCellSize), h2 = Math.floor(o2 / this._granularityCellSize), p2 = Math.ceil(l2 / this._granularityCellSize);
              if (u2 !== c2 || h2 !== p2) for (let t3 = h2; t3 < p2; t3++) {
                const r3 = this._scanlineGenerateVertexRingForCellRow(t3, i2, n3);
                Au(this._vertexBuffer, r3, e2);
              }
              else e2.push(...n3);
            }
            return e2;
          }
          _scanlineGenerateVertexRingForCellRow(t2, e2, n2) {
            const r2 = t2 * this._granularityCellSize, i2 = r2 + this._granularityCellSize, s2 = [];
            for (let t3 = 0; t3 < 3; t3++) {
              const o2 = e2[2 * t3], a2 = e2[2 * t3 + 1], l2 = e2[2 * (t3 + 1) % 6], u2 = e2[(2 * (t3 + 1) + 1) % 6], c2 = e2[2 * (t3 + 2) % 6], h2 = e2[(2 * (t3 + 2) + 1) % 6], p2 = l2 - o2, f2 = u2 - a2, d2 = 0 === p2, y2 = 0 === f2, m2 = (r2 - a2) / f2, g2 = (i2 - a2) / f2, x2 = Math.min(m2, g2), v2 = Math.max(m2, g2);
              if (!y2 && (x2 >= 1 || v2 <= 0) || y2 && (a2 < r2 || a2 > i2)) {
                u2 >= r2 && u2 <= i2 && s2.push(n2[(t3 + 1) % 3]);
                continue;
              }
              !y2 && x2 > 0 && s2.push(this._vertexToIndex(o2 + p2 * x2, a2 + f2 * x2));
              const b2 = o2 + p2 * Math.max(x2, 0), w2 = o2 + p2 * Math.min(v2, 1);
              d2 || this._generateIntraEdgeVertices(s2, o2, a2, l2, u2, b2, w2), !y2 && v2 < 1 && s2.push(this._vertexToIndex(o2 + p2 * v2, a2 + f2 * v2)), (y2 || u2 >= r2 && u2 <= i2) && s2.push(n2[(t3 + 1) % 3]), !y2 && (u2 <= r2 || u2 >= i2) && this._generateInterEdgeVertices(s2, o2, a2, l2, u2, c2, h2, w2, r2, i2);
            }
            return s2;
          }
          _generateIntraEdgeVertices(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = r2 - e2, l2 = i2 - n2, u2 = 0 === l2, c2 = u2 ? Math.min(e2, r2) : Math.min(s2, o2), h2 = u2 ? Math.max(e2, r2) : Math.max(s2, o2), p2 = Math.floor(c2 / this._granularityCellSize) + 1, f2 = Math.ceil(h2 / this._granularityCellSize) - 1;
            if (u2 ? e2 < r2 : s2 < o2) for (let r3 = p2; r3 <= f2; r3++) {
              const i3 = r3 * this._granularityCellSize;
              t2.push(this._vertexToIndex(i3, n2 + l2 * (i3 - e2) / a2));
            }
            else for (let r3 = f2; r3 >= p2; r3--) {
              const i3 = r3 * this._granularityCellSize;
              t2.push(this._vertexToIndex(i3, n2 + l2 * (i3 - e2) / a2));
            }
          }
          _generateInterEdgeVertices(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2) {
            const c2 = i2 - n2, h2 = s2 - r2, p2 = o2 - i2, f2 = (l2 - i2) / p2, d2 = (u2 - i2) / p2, y2 = Math.min(f2, d2), m2 = Math.max(f2, d2), g2 = r2 + h2 * y2;
            let x2 = Math.floor(Math.min(g2, a2) / this._granularityCellSize) + 1, v2 = Math.ceil(Math.max(g2, a2) / this._granularityCellSize) - 1, b2 = a2 < g2;
            const w2 = 0 === p2;
            if (w2 && (o2 === l2 || o2 === u2)) return;
            if (w2 || y2 >= 1 || m2 <= 0) {
              const t3 = n2 - o2, r3 = s2 + (e2 - s2) * Math.min((l2 - o2) / t3, (u2 - o2) / t3);
              x2 = Math.floor(Math.min(r3, a2) / this._granularityCellSize) + 1, v2 = Math.ceil(Math.max(r3, a2) / this._granularityCellSize) - 1, b2 = a2 < r3;
            }
            const _2 = c2 > 0 ? u2 : l2;
            if (b2) for (let e3 = x2; e3 <= v2; e3++) t2.push(this._vertexToIndex(e3 * this._granularityCellSize, _2));
            else for (let e3 = v2; e3 >= x2; e3--) t2.push(this._vertexToIndex(e3 * this._granularityCellSize, _2));
          }
          _generateOutline(t2) {
            const e2 = [];
            for (const n2 of t2) {
              const t3 = Su(n2, this._granularity, true), r2 = this._pointArrayToIndices(t3), i2 = [];
              for (let t4 = 1; t4 < r2.length; t4++) i2.push(r2[t4 - 1]), i2.push(r2[t4]);
              e2.push(i2);
            }
            return e2;
          }
          _handlePoles(t2) {
            let e2 = false, n2 = false;
            this._canonical && (0 === this._canonical.y && (e2 = true), this._canonical.y === (1 << this._canonical.z) - 1 && (n2 = true)), (e2 || n2) && this._fillPoles(t2, e2, n2);
          }
          _ensureNoPoleVertices() {
            const t2 = this._vertexBuffer;
            for (let e2 = 0; e2 < t2.length; e2 += 2) {
              const n2 = t2[e2 + 1];
              n2 === vu && (t2[e2 + 1] = -32767), n2 === bu && (t2[e2 + 1] = 32766);
            }
          }
          _generatePoleQuad(t2, e2, n2, r2, i2, s2) {
            r2 > i2 != (s2 === vu) ? (t2.push(e2), t2.push(n2), t2.push(this._vertexToIndex(r2, s2)), t2.push(n2), t2.push(this._vertexToIndex(i2, s2)), t2.push(this._vertexToIndex(r2, s2))) : (t2.push(n2), t2.push(e2), t2.push(this._vertexToIndex(r2, s2)), t2.push(this._vertexToIndex(i2, s2)), t2.push(n2), t2.push(this._vertexToIndex(r2, s2)));
          }
          _fillPoles(t2, e2, n2) {
            const r2 = this._vertexBuffer, i2 = T, s2 = t2.length;
            for (let o2 = 2; o2 < s2; o2 += 3) {
              const s3 = t2[o2 - 2], a2 = t2[o2 - 1], l2 = t2[o2], u2 = r2[2 * s3], c2 = r2[2 * s3 + 1], h2 = r2[2 * a2], p2 = r2[2 * a2 + 1], f2 = r2[2 * l2], d2 = r2[2 * l2 + 1];
              e2 && (0 === c2 && 0 === p2 && this._generatePoleQuad(t2, s3, a2, u2, h2, vu), 0 === p2 && 0 === d2 && this._generatePoleQuad(t2, a2, l2, h2, f2, vu), 0 === d2 && 0 === c2 && this._generatePoleQuad(t2, l2, s3, f2, u2, vu)), n2 && (c2 === i2 && p2 === i2 && this._generatePoleQuad(t2, s3, a2, u2, h2, bu), p2 === i2 && d2 === i2 && this._generatePoleQuad(t2, a2, l2, h2, f2, bu), d2 === i2 && c2 === i2 && this._generatePoleQuad(t2, l2, s3, f2, u2, bu));
            }
          }
          _initializeVertices(t2) {
            for (let e2 = 0; e2 < t2.length; e2 += 2) this._vertexToIndex(t2[e2], t2[e2 + 1]);
          }
          subdividePolygonInternal(t2, e2) {
            if (this._used) throw new Error("Subdivision: multiple use not allowed.");
            this._used = true;
            const { flattened: n2, holeIndices: r2 } = (function(t3) {
              const e3 = [], n3 = [];
              for (const r3 of t3) if (0 !== r3.length) {
                r3 !== t3[0] && e3.push(n3.length / 2);
                for (const t4 of r3) n3.push(t4.x), n3.push(t4.y);
              }
              return { flattened: n3, holeIndices: e3 };
            })(t2);
            let i2;
            this._initializeVertices(n2);
            try {
              const t3 = (function(t4, e4, n3 = 2) {
                const r3 = e4 && e4.length, i3 = r3 ? e4[0] * n3 : t4.length;
                let s3 = Xl(t4, 0, i3, n3, true);
                const o2 = [];
                if (!s3 || s3.next === s3.prev) return o2;
                let a2, l2, u2;
                if (r3 && (s3 = (function(t5, e5, n4, r4) {
                  const i4 = [];
                  for (let n5 = 0, s4 = e5.length; n5 < s4; n5++) {
                    const o3 = Xl(t5, e5[n5] * r4, n5 < s4 - 1 ? e5[n5 + 1] * r4 : t5.length, r4, false);
                    o3 === o3.next && (o3.steiner = true), i4.push(ru(o3));
                  }
                  i4.sort(Ql);
                  for (let t6 = 0; t6 < i4.length; t6++) n4 = tu(i4[t6], n4);
                  return n4;
                })(t4, e4, s3, n3)), t4.length > 80 * n3) {
                  a2 = t4[0], l2 = t4[1];
                  let e5 = a2, r4 = l2;
                  for (let s4 = n3; s4 < i3; s4 += n3) {
                    const n4 = t4[s4], i4 = t4[s4 + 1];
                    n4 < a2 && (a2 = n4), i4 < l2 && (l2 = i4), n4 > e5 && (e5 = n4), i4 > r4 && (r4 = i4);
                  }
                  u2 = Math.max(e5 - a2, r4 - l2), u2 = 0 !== u2 ? 32767 / u2 : 0;
                }
                return Zl(s3, o2, n3, a2, l2, u2, 0), o2;
              })(n2, r2), e3 = this._convertIndices(n2, t3);
              i2 = this._subdivideTrianglesScanline(e3);
            } catch (t3) {
              console.error(t3);
            }
            let s2 = [];
            return e2 && (s2 = this._generateOutline(t2)), this._ensureNoPoleVertices(), this._handlePoles(i2), { verticesFlattened: this._vertexBuffer, indicesTriangles: i2, indicesLineList: s2 };
          }
          _convertIndices(t2, e2) {
            const n2 = [];
            for (const r2 of e2) n2.push(this._vertexToIndex(t2[2 * r2], t2[2 * r2 + 1]));
            return n2;
          }
          _pointArrayToIndices(t2) {
            const e2 = [];
            for (const n2 of t2) e2.push(this._vertexToIndex(n2.x, n2.y));
            return e2;
          }
        }
        function _u(t2, e2, n2, r2 = true) {
          return new wu(n2, e2).subdividePolygonInternal(t2, r2);
        }
        function Su(t2, e2, r2 = false) {
          if (!t2 || t2.length < 1) return [];
          if (t2.length < 2) return [];
          const i2 = t2[0], s2 = t2[t2.length - 1], o2 = r2 && (i2.x !== s2.x || i2.y !== s2.y);
          if (e2 < 2) return o2 ? [...t2, t2[0]] : [...t2];
          const a2 = Math.floor(T / e2), l2 = [];
          l2.push(new n(t2[0].x, t2[0].y));
          const u2 = t2.length, c2 = o2 ? u2 : u2 - 1;
          for (let e3 = 0; e3 < c2; e3++) {
            const r3 = t2[e3], i3 = e3 < u2 - 1 ? t2[e3 + 1] : t2[0], s3 = r3.x, o3 = r3.y, c3 = i3.x, h2 = i3.y, p2 = s3 !== c3, f2 = o3 !== h2;
            if (!p2 && !f2) continue;
            const d2 = c3 - s3, y2 = h2 - o3, m2 = Math.abs(d2), g2 = Math.abs(y2);
            let x2 = s3, v2 = o3;
            for (; ; ) {
              const t3 = d2 > 0 ? (Math.floor(x2 / a2) + 1) * a2 : (Math.ceil(x2 / a2) - 1) * a2, e4 = y2 > 0 ? (Math.floor(v2 / a2) + 1) * a2 : (Math.ceil(v2 / a2) - 1) * a2, r4 = Math.abs(x2 - t3), i4 = Math.abs(v2 - e4), s4 = Math.abs(x2 - c3), o4 = Math.abs(v2 - h2), u3 = p2 ? r4 / m2 : Number.POSITIVE_INFINITY, b3 = f2 ? i4 / g2 : Number.POSITIVE_INFINITY;
              if ((s4 <= r4 || !p2) && (o4 <= i4 || !f2)) break;
              if (u3 < b3 && p2 || !f2) {
                x2 = t3, v2 += y2 * u3;
                const e5 = new n(x2, Math.round(v2));
                l2[l2.length - 1].x === e5.x && l2[l2.length - 1].y === e5.y || l2.push(e5);
              } else {
                x2 += d2 * b3, v2 = e4;
                const t4 = new n(Math.round(x2), v2);
                l2[l2.length - 1].x === t4.x && l2[l2.length - 1].y === t4.y || l2.push(t4);
              }
            }
            const b2 = new n(c3, h2);
            l2[l2.length - 1].x === b2.x && l2[l2.length - 1].y === b2.y || l2.push(b2);
          }
          return l2;
        }
        function Au(t2, e2, n2) {
          if (0 === e2.length) throw new Error("Subdivision vertex ring is empty.");
          let r2 = 0, i2 = t2[2 * e2[0]];
          for (let n3 = 1; n3 < e2.length; n3++) {
            const s3 = t2[2 * e2[n3]];
            s3 < i2 && (i2 = s3, r2 = n3);
          }
          const s2 = e2.length;
          let o2 = r2, a2 = (o2 + 1) % s2;
          for (; ; ) {
            const r3 = o2 - 1 >= 0 ? o2 - 1 : s2 - 1, i3 = (a2 + 1) % s2, l2 = t2[2 * e2[r3]], u2 = t2[2 * e2[i3]], c2 = t2[2 * e2[o2]], h2 = t2[2 * e2[o2] + 1], p2 = t2[2 * e2[a2] + 1];
            let f2 = false;
            if (l2 < u2) f2 = true;
            else if (l2 > u2) f2 = false;
            else {
              const n3 = p2 - h2, s3 = -(t2[2 * e2[a2]] - c2), o3 = h2 < p2 ? 1 : -1;
              ((l2 - c2) * n3 + (t2[2 * e2[r3] + 1] - h2) * s3) * o3 > ((u2 - c2) * n3 + (t2[2 * e2[i3] + 1] - h2) * s3) * o3 && (f2 = true);
            }
            if (f2) {
              const t3 = e2[r3], i4 = e2[o2], l3 = e2[a2];
              t3 !== i4 && t3 !== l3 && i4 !== l3 && n2.push(l3, i4, t3), o2--, o2 < 0 && (o2 = s2 - 1);
            } else {
              const t3 = e2[i3], r4 = e2[o2], l3 = e2[a2];
              t3 !== r4 && t3 !== l3 && r4 !== l3 && n2.push(l3, r4, t3), a2++, a2 >= s2 && (a2 = 0);
            }
            if (r3 === i3) break;
          }
        }
        function Mu(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
          const u2 = i2.length / 2, c2 = o2 && a2 && l2;
          if (u2 < ua.MAX_VERTEX_ARRAY_LENGTH) {
            const h2 = e2.prepareSegment(u2, n2, r2), p2 = h2.vertexLength;
            for (let t3 = 0; t3 < s2.length; t3 += 3) r2.emplaceBack(p2 + s2[t3], p2 + s2[t3 + 1], p2 + s2[t3 + 2]);
            let f2, d2;
            h2.vertexLength += u2, h2.primitiveLength += s2.length / 3, c2 && (d2 = o2.prepareSegment(u2, n2, a2), f2 = d2.vertexLength, d2.vertexLength += u2);
            for (let e3 = 0; e3 < i2.length; e3 += 2) t2(i2[e3], i2[e3 + 1]);
            if (c2) for (const t3 of l2) {
              for (let e3 = 1; e3 < t3.length; e3 += 2) a2.emplaceBack(f2 + t3[e3 - 1], f2 + t3[e3]);
              d2.primitiveLength += t3.length / 2;
            }
          } else !(function(t3, e3, n3, r3, i3, s3) {
            const o3 = [];
            for (let t4 = 0; t4 < r3.length / 2; t4++) o3.push(-1);
            const a3 = { count: 0 };
            let l3 = 0, u3 = t3.getOrCreateLatestSegment(e3, n3), c3 = u3.vertexLength;
            for (let h2 = 2; h2 < i3.length; h2 += 3) {
              const p2 = i3[h2 - 2], f2 = i3[h2 - 1], d2 = i3[h2];
              let y2 = o3[p2] < l3, m2 = o3[f2] < l3, g2 = o3[d2] < l3;
              u3.vertexLength + ((y2 ? 1 : 0) + (m2 ? 1 : 0) + (g2 ? 1 : 0)) > ua.MAX_VERTEX_ARRAY_LENGTH && (u3 = t3.createNewSegment(e3, n3), l3 = a3.count, y2 = true, m2 = true, g2 = true, c3 = 0);
              const x2 = ku(o3, r3, s3, a3, p2, y2, u3), v2 = ku(o3, r3, s3, a3, f2, m2, u3), b2 = ku(o3, r3, s3, a3, d2, g2, u3);
              n3.emplaceBack(c3 + x2 - l3, c3 + v2 - l3, c3 + b2 - l3), u3.primitiveLength++;
            }
          })(e2, n2, r2, i2, s2, t2), c2 && (function(t3, e3, n3, r3, i3, s3) {
            const o3 = [];
            for (let t4 = 0; t4 < r3.length / 2; t4++) o3.push(-1);
            const a3 = { count: 0 };
            let l3 = 0, u3 = t3.getOrCreateLatestSegment(e3, n3), c3 = u3.vertexLength;
            for (const h2 of i3) for (let i4 = 1; i4 < h2.length; i4 += 2) {
              const p2 = h2[i4 - 1], f2 = h2[i4];
              let d2 = o3[p2] < l3, y2 = o3[f2] < l3;
              u3.vertexLength + ((d2 ? 1 : 0) + (y2 ? 1 : 0)) > ua.MAX_VERTEX_ARRAY_LENGTH && (u3 = t3.createNewSegment(e3, n3), l3 = a3.count, d2 = true, y2 = true, c3 = 0);
              const m2 = ku(o3, r3, s3, a3, p2, d2, u3), g2 = ku(o3, r3, s3, a3, f2, y2, u3);
              n3.emplaceBack(c3 + m2 - l3, c3 + g2 - l3), u3.primitiveLength++;
            }
          })(o2, n2, a2, i2, l2, t2), e2.forceNewSegmentOnNextPrepare(), null == o2 || o2.forceNewSegmentOnNextPrepare();
        }
        function ku(t2, e2, n2, r2, i2, s2, o2) {
          if (s2) {
            const s3 = r2.count;
            return n2(e2[2 * i2], e2[2 * i2 + 1]), t2[i2] = r2.count, r2.count++, o2.vertexLength++, s3;
          }
          return t2[i2];
        }
        class Iu {
          constructor(t2) {
            this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasDependencies = false, this.patternFeatures = [], this.layoutVertexArray = new Zo(), this.indexArray = new sa(), this.indexArray2 = new oa(), this.programConfigurations = new $a(t2.layers, t2.zoom), this.segments = new ua(), this.segments2 = new ua(), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
          }
          populate(t2, e2, n2) {
            this.hasDependencies = ql("fill", this.layers, e2);
            const r2 = this.layers[0].layout.get("fill-sort-key"), i2 = !r2.isConstant(), s2 = [];
            for (const { feature: o2, id: a2, index: l2, sourceLayerIndex: u2 } of t2) {
              const t3 = this.layers[0]._featureFilter.needGeometry, c2 = Ga(o2, t3);
              if (!this.layers[0]._featureFilter.filter(new Cs(this.zoom), c2, n2)) continue;
              const h2 = i2 ? r2.evaluate(c2, {}, n2, e2.availableImages) : void 0, p2 = { id: a2, properties: o2.properties, type: o2.type, sourceLayerIndex: u2, index: l2, geometry: t3 ? c2.geometry : qa(o2), patterns: {}, sortKey: h2 };
              s2.push(p2);
            }
            i2 && s2.sort(((t3, e3) => t3.sortKey - e3.sortKey));
            for (const r3 of s2) {
              const { geometry: i3, index: s3, sourceLayerIndex: o2 } = r3;
              if (this.hasDependencies) {
                const t3 = Gl("fill", this.layers, r3, { zoom: this.zoom }, e2);
                this.patternFeatures.push(t3);
              } else this.addFeature(r3, i3, s3, n2, {}, e2.subdivisionGranularity);
              e2.featureIndex.insert(t2[s3].feature, i3, s3, o2, this.index);
            }
          }
          update(t2, e2, n2) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, { imagePositions: n2 });
          }
          addFeatures(t2, e2, n2) {
            for (const r2 of this.patternFeatures) this.addFeature(r2, r2.geometry, r2.index, e2, n2, t2.subdivisionGranularity);
          }
          isEmpty() {
            return 0 === this.layoutVertexArray.length;
          }
          uploadPending() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }
          upload(t2) {
            this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, jl), this.indexBuffer = t2.createIndexBuffer(this.indexArray), this.indexBuffer2 = t2.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(t2), this.uploaded = true;
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
          }
          addFeature(t2, e2, n2, r2, i2, s2) {
            for (const t3 of rr(e2, 500)) {
              const e3 = _u(t3, r2, s2.fill.getGranularityForZoomLevel(r2.z)), n3 = this.layoutVertexArray;
              Mu(((t4, e4) => {
                n3.emplaceBack(t4, e4);
              }), this.segments, this.layoutVertexArray, this.indexArray, e3.verticesFlattened, e3.indicesTriangles, this.segments2, this.indexArray2, e3.indicesLineList);
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, n2, { imagePositions: i2, canonical: r2 });
          }
        }
        let Eu, Tu;
        ds("FillBucket", Iu, { omit: ["layers", "patternFeatures"] });
        var Fu = { get paint() {
          return Tu = Tu || new Ks({ "fill-antialias": new Xs(wt.paint_fill["fill-antialias"]), "fill-opacity": new Ys(wt.paint_fill["fill-opacity"]), "fill-color": new Ys(wt.paint_fill["fill-color"]), "fill-outline-color": new Ys(wt.paint_fill["fill-outline-color"]), "fill-translate": new Xs(wt.paint_fill["fill-translate"]), "fill-translate-anchor": new Xs(wt.paint_fill["fill-translate-anchor"]), "fill-pattern": new Zs(wt.paint_fill["fill-pattern"]) });
        }, get layout() {
          return Eu = Eu || new Ks({ "fill-sort-key": new Ys(wt.layout_fill["fill-sort-key"]) });
        } };
        class Pu extends to {
          constructor(t2, e2) {
            super(t2, Fu, e2);
          }
          recalculate(t2, e2) {
            super.recalculate(t2, e2);
            const n2 = this.paint._values["fill-outline-color"];
            "constant" === n2.value.kind && void 0 === n2.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]);
          }
          createBucket(t2) {
            return new Iu(t2);
          }
          queryRadius() {
            return al(this.paint.get("fill-translate"));
          }
          queryIntersectsFeature({ queryGeometry: t2, geometry: e2, transform: n2, pixelsToTileUnits: r2 }) {
            return Ka(ll(t2, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), -n2.bearingInRadians, r2), e2);
          }
          isTileClipped() {
            return true;
          }
        }
        const Du = ao([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), zu = ao([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: Bu } = Du;
        class Cu {
          constructor(t2, e2, n2, r2, i2) {
            this.properties = {}, this.extent = n2, this.type = 0, this.id = void 0, this._pbf = t2, this._geometry = -1, this._keys = r2, this._values = i2, t2.readFields(Vu, this, e2);
          }
          loadGeometry() {
            const t2 = this._pbf;
            t2.pos = this._geometry;
            const e2 = t2.readVarint() + t2.pos, r2 = [];
            let i2, s2 = 1, o2 = 0, a2 = 0, l2 = 0;
            for (; t2.pos < e2; ) {
              if (o2 <= 0) {
                const e3 = t2.readVarint();
                s2 = 7 & e3, o2 = e3 >> 3;
              }
              if (o2--, 1 === s2 || 2 === s2) a2 += t2.readSVarint(), l2 += t2.readSVarint(), 1 === s2 && (i2 && r2.push(i2), i2 = []), i2 && i2.push(new n(a2, l2));
              else {
                if (7 !== s2) throw new Error(`unknown command ${s2}`);
                i2 && i2.push(i2[0].clone());
              }
            }
            return i2 && r2.push(i2), r2;
          }
          bbox() {
            const t2 = this._pbf;
            t2.pos = this._geometry;
            const e2 = t2.readVarint() + t2.pos;
            let n2 = 1, r2 = 0, i2 = 0, s2 = 0, o2 = 1 / 0, a2 = -1 / 0, l2 = 1 / 0, u2 = -1 / 0;
            for (; t2.pos < e2; ) {
              if (r2 <= 0) {
                const e3 = t2.readVarint();
                n2 = 7 & e3, r2 = e3 >> 3;
              }
              if (r2--, 1 === n2 || 2 === n2) i2 += t2.readSVarint(), s2 += t2.readSVarint(), i2 < o2 && (o2 = i2), i2 > a2 && (a2 = i2), s2 < l2 && (l2 = s2), s2 > u2 && (u2 = s2);
              else if (7 !== n2) throw new Error(`unknown command ${n2}`);
            }
            return [o2, l2, a2, u2];
          }
          toGeoJSON(t2, e2, n2) {
            const r2 = this.extent * Math.pow(2, n2), i2 = this.extent * t2, s2 = this.extent * e2, o2 = this.loadGeometry();
            function a2(t3) {
              return [360 * (t3.x + i2) / r2 - 180, 360 / Math.PI * Math.atan(Math.exp((1 - 2 * (t3.y + s2) / r2) * Math.PI)) - 90];
            }
            function l2(t3) {
              return t3.map(a2);
            }
            let u2;
            if (1 === this.type) {
              const t3 = [];
              for (const e4 of o2) t3.push(e4[0]);
              const e3 = l2(t3);
              u2 = 1 === t3.length ? { type: "Point", coordinates: e3[0] } : { type: "MultiPoint", coordinates: e3 };
            } else if (2 === this.type) {
              const t3 = o2.map(l2);
              u2 = 1 === t3.length ? { type: "LineString", coordinates: t3[0] } : { type: "MultiLineString", coordinates: t3 };
            } else {
              if (3 !== this.type) throw new Error("unknown feature type");
              {
                const t3 = Lu(o2), e3 = [];
                for (const n3 of t3) e3.push(n3.map(l2));
                u2 = 1 === e3.length ? { type: "Polygon", coordinates: e3[0] } : { type: "MultiPolygon", coordinates: e3 };
              }
            }
            const c2 = { type: "Feature", geometry: u2, properties: this.properties };
            return null != this.id && (c2.id = this.id), c2;
          }
        }
        function Vu(t2, e2, n2) {
          1 === t2 ? e2.id = n2.readVarint() : 2 === t2 ? (function(t3, e3) {
            const n3 = t3.readVarint() + t3.pos;
            for (; t3.pos < n3; ) {
              const n4 = e3._keys[t3.readVarint()], r2 = e3._values[t3.readVarint()];
              e3.properties[n4] = r2;
            }
          })(n2, e2) : 3 === t2 ? e2.type = n2.readVarint() : 4 === t2 && (e2._geometry = n2.pos);
        }
        function Lu(t2) {
          const e2 = t2.length;
          if (e2 <= 1) return [t2];
          const n2 = [];
          let r2, i2;
          for (let s2 = 0; s2 < e2; s2++) {
            const e3 = Ou(t2[s2]);
            0 !== e3 && (void 0 === i2 && (i2 = e3 < 0), i2 === e3 < 0 ? (r2 && n2.push(r2), r2 = [t2[s2]]) : r2 && r2.push(t2[s2]));
          }
          return r2 && n2.push(r2), n2;
        }
        function Ou(t2) {
          let e2 = 0;
          for (let n2, r2, i2 = 0, s2 = t2.length, o2 = s2 - 1; i2 < s2; o2 = i2++) n2 = t2[i2], r2 = t2[o2], e2 += (r2.x - n2.x) * (n2.y + r2.y);
          return e2;
        }
        Cu.types = ["Unknown", "Point", "LineString", "Polygon"];
        class $u {
          constructor(t2, e2) {
            this.version = 1, this.name = "", this.extent = 4096, this.length = 0, this._pbf = t2, this._keys = [], this._values = [], this._features = [], t2.readFields(Ru, this, e2), this.length = this._features.length;
          }
          feature(t2) {
            if (t2 < 0 || t2 >= this._features.length) throw new Error("feature index out of bounds");
            this._pbf.pos = this._features[t2];
            const e2 = this._pbf.readVarint() + this._pbf.pos;
            return new Cu(this._pbf, e2, this.extent, this._keys, this._values);
          }
        }
        function Ru(t2, e2, n2) {
          15 === t2 ? e2.version = n2.readVarint() : 1 === t2 ? e2.name = n2.readString() : 5 === t2 ? e2.extent = n2.readVarint() : 2 === t2 ? e2._features.push(n2.pos) : 3 === t2 ? e2._keys.push(n2.readString()) : 4 === t2 && e2._values.push((function(t3) {
            let e3 = null;
            const n3 = t3.readVarint() + t3.pos;
            for (; t3.pos < n3; ) {
              const n4 = t3.readVarint() >> 3;
              e3 = 1 === n4 ? t3.readString() : 2 === n4 ? t3.readFloat() : 3 === n4 ? t3.readDouble() : 4 === n4 ? t3.readVarint64() : 5 === n4 ? t3.readVarint() : 6 === n4 ? t3.readSVarint() : 7 === n4 ? t3.readBoolean() : null;
            }
            if (null == e3) throw new Error("unknown feature value");
            return e3;
          })(n2));
        }
        class Nu {
          constructor(t2, e2) {
            this.layers = t2.readFields(Uu, {}, e2);
          }
        }
        function Uu(t2, e2, n2) {
          if (3 === t2) {
            const t3 = new $u(n2, n2.readVarint() + n2.pos);
            t3.length && (e2[t3.name] = t3);
          }
        }
        const ju = Math.pow(2, 13);
        function qu(t2, e2, n2, r2, i2, s2, o2, a2) {
          t2.emplaceBack(e2, n2, 2 * Math.floor(r2 * ju) + o2, i2 * ju * 2, s2 * ju * 2, Math.round(a2));
        }
        class Gu {
          constructor(t2) {
            this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasDependencies = false, this.layoutVertexArray = new Ho(), this.centroidVertexArray = new Xo(), this.indexArray = new sa(), this.programConfigurations = new $a(t2.layers, t2.zoom), this.segments = new ua(), this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
          }
          populate(t2, e2, n2) {
            this.features = [], this.hasDependencies = ql("fill-extrusion", this.layers, e2);
            for (const { feature: r2, id: i2, index: s2, sourceLayerIndex: o2 } of t2) {
              const t3 = this.layers[0]._featureFilter.needGeometry, a2 = Ga(r2, t3);
              if (!this.layers[0]._featureFilter.filter(new Cs(this.zoom), a2, n2)) continue;
              const l2 = { id: i2, sourceLayerIndex: o2, index: s2, geometry: t3 ? a2.geometry : qa(r2), properties: r2.properties, type: r2.type, patterns: {} };
              this.hasDependencies ? this.features.push(Gl("fill-extrusion", this.layers, l2, { zoom: this.zoom }, e2)) : this.addFeature(l2, l2.geometry, s2, n2, {}, e2.subdivisionGranularity), e2.featureIndex.insert(r2, l2.geometry, s2, o2, this.index, true);
            }
          }
          addFeatures(t2, e2, n2) {
            for (const r2 of this.features) {
              const { geometry: i2 } = r2;
              this.addFeature(r2, i2, r2.index, e2, n2, t2.subdivisionGranularity);
            }
          }
          update(t2, e2, n2) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, { imagePositions: n2 });
          }
          isEmpty() {
            return 0 === this.layoutVertexArray.length && 0 === this.centroidVertexArray.length;
          }
          uploadPending() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }
          upload(t2) {
            this.uploaded || (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, Bu), this.centroidVertexBuffer = t2.createVertexBuffer(this.centroidVertexArray, zu.members, true), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.centroidVertexBuffer.destroy());
          }
          addFeature(t2, e2, n2, r2, i2, s2) {
            for (const n3 of rr(e2, 500)) {
              const e3 = { x: 0, y: 0, sampleCount: 0 }, i3 = this.layoutVertexArray.length;
              this.processPolygon(e3, r2, t2, n3, s2);
              const o2 = this.layoutVertexArray.length - i3, a2 = Math.floor(e3.x / e3.sampleCount), l2 = Math.floor(e3.y / e3.sampleCount);
              for (let t3 = 0; t3 < o2; t3++) this.centroidVertexArray.emplaceBack(a2, l2);
            }
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, n2, { imagePositions: i2, canonical: r2 });
          }
          processPolygon(t2, e2, n2, r2, i2) {
            if (r2.length < 1) return;
            if (Zu(r2[0])) return;
            for (const e3 of r2) 0 !== e3.length && Xu(t2, e3);
            const s2 = { segment: this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray) }, o2 = i2.fill.getGranularityForZoomLevel(e2.z), a2 = "Polygon" === Cu.types[n2.type];
            for (const t3 of r2) {
              if (0 === t3.length) continue;
              if (Zu(t3)) continue;
              const e3 = Su(t3, o2, a2);
              this._generateSideFaces(e3, s2);
            }
            if (!a2) return;
            const l2 = _u(r2, e2, o2, false), u2 = this.layoutVertexArray;
            Mu(((t3, e3) => {
              qu(u2, t3, e3, 0, 0, 1, 1, 0);
            }), this.segments, this.layoutVertexArray, this.indexArray, l2.verticesFlattened, l2.indicesTriangles);
          }
          _generateSideFaces(t2, e2) {
            let n2 = 0;
            for (let r2 = 1; r2 < t2.length; r2++) {
              const i2 = t2[r2], s2 = t2[r2 - 1];
              if (Yu(i2, s2)) continue;
              e2.segment.vertexLength + 4 > ua.MAX_VERTEX_ARRAY_LENGTH && (e2.segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
              const o2 = i2.sub(s2)._perp()._unit(), a2 = s2.dist(i2);
              n2 + a2 > 32768 && (n2 = 0), qu(this.layoutVertexArray, i2.x, i2.y, o2.x, o2.y, 0, 0, n2), qu(this.layoutVertexArray, i2.x, i2.y, o2.x, o2.y, 0, 1, n2), n2 += a2, qu(this.layoutVertexArray, s2.x, s2.y, o2.x, o2.y, 0, 0, n2), qu(this.layoutVertexArray, s2.x, s2.y, o2.x, o2.y, 0, 1, n2);
              const l2 = e2.segment.vertexLength;
              this.indexArray.emplaceBack(l2, l2 + 2, l2 + 1), this.indexArray.emplaceBack(l2 + 1, l2 + 2, l2 + 3), e2.segment.vertexLength += 4, e2.segment.primitiveLength += 2;
            }
          }
        }
        function Xu(t2, e2) {
          for (let n2 = 0; n2 < e2.length; n2++) {
            const r2 = e2[n2];
            n2 === e2.length - 1 && e2[0].x === r2.x && e2[0].y === r2.y || (t2.x += r2.x, t2.y += r2.y, t2.sampleCount++);
          }
        }
        function Yu(t2, e2) {
          return t2.x === e2.x && (t2.x < 0 || t2.x > T) || t2.y === e2.y && (t2.y < 0 || t2.y > T);
        }
        function Zu(t2) {
          return t2.every(((t3) => t3.x < 0)) || t2.every(((t3) => t3.x > T)) || t2.every(((t3) => t3.y < 0)) || t2.every(((t3) => t3.y > T));
        }
        let Hu;
        ds("FillExtrusionBucket", Gu, { omit: ["layers", "features"] });
        var Wu = { get paint() {
          return Hu = Hu || new Ks({ "fill-extrusion-opacity": new Xs(wt["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new Ys(wt["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new Xs(wt["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new Xs(wt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Zs(wt["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new Ys(wt["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new Ys(wt["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new Xs(wt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) });
        } };
        class Ku extends to {
          constructor(t2, e2) {
            super(t2, Wu, e2);
          }
          createBucket(t2) {
            return new Gu(t2);
          }
          queryRadius() {
            return al(this.paint.get("fill-extrusion-translate"));
          }
          is3D() {
            return true;
          }
          queryIntersectsFeature({ queryGeometry: t2, feature: e2, featureState: r2, geometry: i2, transform: s2, pixelsToTileUnits: o2, pixelPosMatrix: a2 }) {
            const l2 = ll(t2, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), -s2.bearingInRadians, o2), u2 = this.paint.get("fill-extrusion-height").evaluate(e2, r2), c2 = this.paint.get("fill-extrusion-base").evaluate(e2, r2), h2 = (function(t3, e3) {
              const r3 = [];
              for (const i3 of t3) {
                const t4 = [i3.x, i3.y, 0, 1];
                A(t4, t4, e3), r3.push(new n(t4[0] / t4[3], t4[1] / t4[3]));
              }
              return r3;
            })(l2, a2), p2 = (function(t3, e3, r3, i3) {
              const s3 = [], o3 = [], a3 = i3[8] * e3, l3 = i3[9] * e3, u3 = i3[10] * e3, c3 = i3[11] * e3, h3 = i3[8] * r3, p3 = i3[9] * r3, f2 = i3[10] * r3, d2 = i3[11] * r3;
              for (const e4 of t3) {
                const t4 = [], r4 = [];
                for (const s4 of e4) {
                  const e5 = s4.x, o4 = s4.y, y2 = i3[0] * e5 + i3[4] * o4 + i3[12], m2 = i3[1] * e5 + i3[5] * o4 + i3[13], g2 = i3[2] * e5 + i3[6] * o4 + i3[14], x2 = i3[3] * e5 + i3[7] * o4 + i3[15], v2 = g2 + u3, b2 = x2 + c3, w2 = y2 + h3, _2 = m2 + p3, S2 = g2 + f2, A2 = x2 + d2, M2 = new n((y2 + a3) / b2, (m2 + l3) / b2);
                  M2.z = v2 / b2, t4.push(M2);
                  const k2 = new n(w2 / A2, _2 / A2);
                  k2.z = S2 / A2, r4.push(k2);
                }
                s3.push(t4), o3.push(r4);
              }
              return [s3, o3];
            })(i2, c2, u2, a2);
            return (function(t3, e3, n2) {
              let r3 = 1 / 0;
              Ka(n2, e3) && (r3 = Qu(n2, e3[0]));
              for (let i3 = 0; i3 < e3.length; i3++) {
                const s3 = e3[i3], o3 = t3[i3];
                for (let t4 = 0; t4 < s3.length - 1; t4++) {
                  const e4 = s3[t4], i4 = [e4, s3[t4 + 1], o3[t4 + 1], o3[t4], e4];
                  Ha(n2, i4) && (r3 = Math.min(r3, Qu(n2, i4)));
                }
              }
              return r3 !== 1 / 0 && r3;
            })(p2[0], p2[1], h2);
          }
        }
        function Ju(t2, e2) {
          return t2.x * e2.x + t2.y * e2.y;
        }
        function Qu(t2, e2) {
          if (1 === t2.length) {
            let n2 = 0;
            const r2 = e2[n2++];
            let i2;
            for (; !i2 || r2.equals(i2); ) if (i2 = e2[n2++], !i2) return 1 / 0;
            for (; n2 < e2.length; n2++) {
              const s2 = e2[n2], o2 = t2[0], a2 = i2.sub(r2), l2 = s2.sub(r2), u2 = o2.sub(r2), c2 = Ju(a2, a2), h2 = Ju(a2, l2), p2 = Ju(l2, l2), f2 = Ju(u2, a2), d2 = Ju(u2, l2), y2 = c2 * p2 - h2 * h2, m2 = (p2 * f2 - h2 * d2) / y2, g2 = (c2 * d2 - h2 * f2) / y2, x2 = r2.z * (1 - m2 - g2) + i2.z * m2 + s2.z * g2;
              if (isFinite(x2)) return x2;
            }
            return 1 / 0;
          }
          {
            let t3 = 1 / 0;
            for (const n2 of e2) t3 = Math.min(t3, n2.z);
            return t3;
          }
        }
        const tc = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
        class ec {
          static from(t2) {
            if (!(t2 instanceof ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer.");
            const [e2, n2] = new Uint8Array(t2, 0, 2);
            if (219 !== e2) throw new Error("Data does not appear to be in a KDBush format.");
            const r2 = n2 >> 4;
            if (1 !== r2) throw new Error(`Got v${r2} data when expected v1.`);
            const i2 = tc[15 & n2];
            if (!i2) throw new Error("Unrecognized array type.");
            const [s2] = new Uint16Array(t2, 2, 1), [o2] = new Uint32Array(t2, 4, 1);
            return new ec(o2, s2, i2, t2);
          }
          constructor(t2, e2 = 64, n2 = Float64Array, r2) {
            if (isNaN(t2) || t2 < 0) throw new Error(`Unpexpected numItems value: ${t2}.`);
            this.numItems = +t2, this.nodeSize = Math.min(Math.max(+e2, 2), 65535), this.ArrayType = n2, this.IndexArrayType = t2 < 65536 ? Uint16Array : Uint32Array;
            const i2 = tc.indexOf(this.ArrayType), s2 = 2 * t2 * this.ArrayType.BYTES_PER_ELEMENT, o2 = t2 * this.IndexArrayType.BYTES_PER_ELEMENT, a2 = (8 - o2 % 8) % 8;
            if (i2 < 0) throw new Error(`Unexpected typed array class: ${n2}.`);
            r2 && r2 instanceof ArrayBuffer ? (this.data = r2, this.ids = new this.IndexArrayType(this.data, 8, t2), this.coords = new this.ArrayType(this.data, 8 + o2 + a2, 2 * t2), this._pos = 2 * t2, this._finished = true) : (this.data = new ArrayBuffer(8 + s2 + o2 + a2), this.ids = new this.IndexArrayType(this.data, 8, t2), this.coords = new this.ArrayType(this.data, 8 + o2 + a2, 2 * t2), this._pos = 0, this._finished = false, new Uint8Array(this.data, 0, 2).set([219, 16 + i2]), new Uint16Array(this.data, 2, 1)[0] = e2, new Uint32Array(this.data, 4, 1)[0] = t2);
          }
          add(t2, e2) {
            const n2 = this._pos >> 1;
            return this.ids[n2] = n2, this.coords[this._pos++] = t2, this.coords[this._pos++] = e2, n2;
          }
          finish() {
            const t2 = this._pos >> 1;
            if (t2 !== this.numItems) throw new Error(`Added ${t2} items when expected ${this.numItems}.`);
            return nc(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this;
          }
          range(t2, e2, n2, r2) {
            if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
            const { ids: i2, coords: s2, nodeSize: o2 } = this, a2 = [0, i2.length - 1, 0], l2 = [];
            for (; a2.length; ) {
              const u2 = a2.pop() || 0, c2 = a2.pop() || 0, h2 = a2.pop() || 0;
              if (c2 - h2 <= o2) {
                for (let o3 = h2; o3 <= c2; o3++) {
                  const a3 = s2[2 * o3], u3 = s2[2 * o3 + 1];
                  a3 >= t2 && a3 <= n2 && u3 >= e2 && u3 <= r2 && l2.push(i2[o3]);
                }
                continue;
              }
              const p2 = h2 + c2 >> 1, f2 = s2[2 * p2], d2 = s2[2 * p2 + 1];
              f2 >= t2 && f2 <= n2 && d2 >= e2 && d2 <= r2 && l2.push(i2[p2]), (0 === u2 ? t2 <= f2 : e2 <= d2) && (a2.push(h2), a2.push(p2 - 1), a2.push(1 - u2)), (0 === u2 ? n2 >= f2 : r2 >= d2) && (a2.push(p2 + 1), a2.push(c2), a2.push(1 - u2));
            }
            return l2;
          }
          within(t2, e2, n2) {
            if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
            const { ids: r2, coords: i2, nodeSize: s2 } = this, o2 = [0, r2.length - 1, 0], a2 = [], l2 = n2 * n2;
            for (; o2.length; ) {
              const u2 = o2.pop() || 0, c2 = o2.pop() || 0, h2 = o2.pop() || 0;
              if (c2 - h2 <= s2) {
                for (let n3 = h2; n3 <= c2; n3++) oc(i2[2 * n3], i2[2 * n3 + 1], t2, e2) <= l2 && a2.push(r2[n3]);
                continue;
              }
              const p2 = h2 + c2 >> 1, f2 = i2[2 * p2], d2 = i2[2 * p2 + 1];
              oc(f2, d2, t2, e2) <= l2 && a2.push(r2[p2]), (0 === u2 ? t2 - n2 <= f2 : e2 - n2 <= d2) && (o2.push(h2), o2.push(p2 - 1), o2.push(1 - u2)), (0 === u2 ? t2 + n2 >= f2 : e2 + n2 >= d2) && (o2.push(p2 + 1), o2.push(c2), o2.push(1 - u2));
            }
            return a2;
          }
        }
        function nc(t2, e2, n2, r2, i2, s2) {
          if (i2 - r2 <= n2) return;
          const o2 = r2 + i2 >> 1;
          rc(t2, e2, o2, r2, i2, s2), nc(t2, e2, n2, r2, o2 - 1, 1 - s2), nc(t2, e2, n2, o2 + 1, i2, 1 - s2);
        }
        function rc(t2, e2, n2, r2, i2, s2) {
          for (; i2 > r2; ) {
            if (i2 - r2 > 600) {
              const o3 = i2 - r2 + 1, a3 = n2 - r2 + 1, l3 = Math.log(o3), u2 = 0.5 * Math.exp(2 * l3 / 3), c2 = 0.5 * Math.sqrt(l3 * u2 * (o3 - u2) / o3) * (a3 - o3 / 2 < 0 ? -1 : 1);
              rc(t2, e2, n2, Math.max(r2, Math.floor(n2 - a3 * u2 / o3 + c2)), Math.min(i2, Math.floor(n2 + (o3 - a3) * u2 / o3 + c2)), s2);
            }
            const o2 = e2[2 * n2 + s2];
            let a2 = r2, l2 = i2;
            for (ic(t2, e2, r2, n2), e2[2 * i2 + s2] > o2 && ic(t2, e2, r2, i2); a2 < l2; ) {
              for (ic(t2, e2, a2, l2), a2++, l2--; e2[2 * a2 + s2] < o2; ) a2++;
              for (; e2[2 * l2 + s2] > o2; ) l2--;
            }
            e2[2 * r2 + s2] === o2 ? ic(t2, e2, r2, l2) : (l2++, ic(t2, e2, l2, i2)), l2 <= n2 && (r2 = l2 + 1), n2 <= l2 && (i2 = l2 - 1);
          }
        }
        function ic(t2, e2, n2, r2) {
          sc(t2, n2, r2), sc(e2, 2 * n2, 2 * r2), sc(e2, 2 * n2 + 1, 2 * r2 + 1);
        }
        function sc(t2, e2, n2) {
          const r2 = t2[e2];
          t2[e2] = t2[n2], t2[n2] = r2;
        }
        function oc(t2, e2, n2, r2) {
          const i2 = t2 - n2, s2 = e2 - r2;
          return i2 * i2 + s2 * s2;
        }
        function ac(t2, e2, n2, r2) {
          let i2 = r2;
          const s2 = e2 + (n2 - e2 >> 1);
          let o2, a2 = n2 - e2;
          const l2 = t2[e2], u2 = t2[e2 + 1], c2 = t2[n2], h2 = t2[n2 + 1];
          for (let r3 = e2 + 3; r3 < n2; r3 += 3) {
            const e3 = lc(t2[r3], t2[r3 + 1], l2, u2, c2, h2);
            if (e3 > i2) o2 = r3, i2 = e3;
            else if (e3 === i2) {
              const t3 = Math.abs(r3 - s2);
              t3 < a2 && (o2 = r3, a2 = t3);
            }
          }
          i2 > r2 && (o2 - e2 > 3 && ac(t2, e2, o2, r2), t2[o2 + 2] = i2, n2 - o2 > 3 && ac(t2, o2, n2, r2));
        }
        function lc(t2, e2, n2, r2, i2, s2) {
          let o2 = i2 - n2, a2 = s2 - r2;
          if (0 !== o2 || 0 !== a2) {
            const l2 = ((t2 - n2) * o2 + (e2 - r2) * a2) / (o2 * o2 + a2 * a2);
            l2 > 1 ? (n2 = i2, r2 = s2) : l2 > 0 && (n2 += o2 * l2, r2 += a2 * l2);
          }
          return o2 = t2 - n2, a2 = e2 - r2, o2 * o2 + a2 * a2;
        }
        function uc(t2, e2, n2, r2) {
          const i2 = { type: e2, geom: n2 }, s2 = { id: null == t2 ? null : t2, type: i2.type, geometry: i2.geom, tags: r2, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
          switch (i2.type) {
            case "Point":
            case "MultiPoint":
              hc(s2, i2.geom);
              break;
            case "LineString":
              hc(s2, i2.geom.points);
              break;
            case "Polygon":
              hc(s2, i2.geom[0].points);
              break;
            case "MultiLineString":
              for (const t3 of i2.geom) hc(s2, t3.points);
              break;
            case "MultiPolygon":
              for (const t3 of i2.geom) hc(s2, t3[0].points);
          }
          return s2;
        }
        function cc(t2) {
          t2.points.length > 64 && (t2.points = new Float64Array(t2.points));
        }
        function hc(t2, e2) {
          for (let n2 = 0; n2 < e2.length; n2 += 3) t2.minX = Math.min(t2.minX, e2[n2]), t2.minY = Math.min(t2.minY, e2[n2 + 1]), t2.maxX = Math.max(t2.maxX, e2[n2]), t2.maxY = Math.max(t2.maxY, e2[n2 + 1]);
        }
        function pc(t2, e2) {
          const n2 = [];
          switch (t2.type) {
            case "FeatureCollection":
              for (let r2 = 0; r2 < t2.features.length; r2++) fc(n2, t2.features[r2], e2, r2);
              break;
            case "Feature":
              fc(n2, t2, e2);
              break;
            default:
              fc(n2, { geometry: t2, properties: void 0 }, e2);
          }
          return n2;
        }
        function fc(t2, e2, n2, r2) {
          if (!e2.geometry) return;
          if ("GeometryCollection" === e2.geometry.type) return void (function(t3, e3, n3, r3, i3) {
            for (const s3 of n3.geometries) fc(t3, { id: e3.id, geometry: s3, properties: e3.properties }, r3, i3);
          })(t2, e2, e2.geometry, n2, r2);
          const i2 = e2.geometry.coordinates;
          if (!i2?.length) return;
          const s2 = (function(t3, e3, n3) {
            return e3.promoteId ? t3.properties?.[e3.promoteId] : e3.generateId ? n3 || 0 : t3.id;
          })(e2, n2, r2), o2 = Math.pow(n2.tolerance / ((1 << n2.maxZoom) * n2.extent), 2);
          switch (e2.geometry.type) {
            case "Point":
              return void (function(t3, e3, n3, r3) {
                const i3 = [];
                i3.push(mc(n3.coordinates[0]), gc(n3.coordinates[1]), 0), t3.push(uc(e3, "Point", i3, r3));
              })(t2, s2, e2.geometry, e2.properties);
            case "MultiPoint":
              return void (function(t3, e3, n3, r3) {
                const i3 = [];
                for (const t4 of n3.coordinates) i3.push(mc(t4[0]), gc(t4[1]), 0);
                t3.push(uc(e3, "MultiPoint", i3, r3));
              })(t2, s2, e2.geometry, e2.properties);
            case "LineString":
              return void (function(t3, e3, n3, r3, i3) {
                const s3 = { points: [] };
                dc(n3.coordinates, s3, r3, false), t3.push(uc(e3, "LineString", s3, i3));
              })(t2, s2, e2.geometry, o2, e2.properties);
            case "MultiLineString":
              return void (function(t3, e3, n3, r3, i3, s3) {
                if (i3.lineMetrics) for (const i4 of n3.coordinates) {
                  const n4 = { points: [] };
                  dc(i4, n4, r3, false), t3.push(uc(e3, "LineString", n4, s3));
                }
                else {
                  const i4 = [];
                  yc(n3.coordinates, i4, r3, false), t3.push(uc(e3, "MultiLineString", i4, s3));
                }
              })(t2, s2, e2.geometry, o2, n2, e2.properties);
            case "Polygon":
              return void (function(t3, e3, n3, r3, i3) {
                const s3 = [];
                yc(n3.coordinates, s3, r3, true), t3.push(uc(e3, "Polygon", s3, i3));
              })(t2, s2, e2.geometry, o2, e2.properties);
            case "MultiPolygon":
              return void (function(t3, e3, n3, r3, i3) {
                const s3 = [];
                for (const t4 of n3.coordinates) {
                  const e4 = [];
                  yc(t4, e4, r3, true), s3.push(e4);
                }
                t3.push(uc(e3, "MultiPolygon", s3, i3));
              })(t2, s2, e2.geometry, o2, e2.properties);
            default:
              throw new Error("Input data is not a valid GeoJSON object.");
          }
        }
        function dc(t2, e2, n2, r2) {
          let i2, s2, o2 = 0;
          for (let n3 = 0; n3 < t2.length; n3++) {
            const a3 = mc(t2[n3][0]), l2 = gc(t2[n3][1]);
            e2.points.push(a3, l2, 0), n3 > 0 && (o2 += r2 ? (i2 * l2 - a3 * s2) / 2 : Math.sqrt(Math.pow(a3 - i2, 2) + Math.pow(l2 - s2, 2))), i2 = a3, s2 = l2;
          }
          const a2 = e2.points.length - 3;
          e2.points[2] = 1, n2 > 0 && ac(e2.points, 0, a2, n2), e2.points[a2 + 2] = 1, cc(e2), e2.size = Math.abs(o2), e2.start = 0, e2.end = e2.size;
        }
        function yc(t2, e2, n2, r2) {
          for (let i2 = 0; i2 < t2.length; i2++) {
            const s2 = { points: [] };
            dc(t2[i2], s2, n2, r2), e2.push(s2);
          }
        }
        function mc(t2) {
          return t2 / 360 + 0.5;
        }
        function gc(t2) {
          const e2 = Math.sin(t2 * Math.PI / 180), n2 = 0.5 - 0.25 * Math.log((1 + e2) / (1 - e2)) / Math.PI;
          return n2 < 0 ? 0 : n2 > 1 ? 1 : n2;
        }
        function xc(t2) {
          const e2 = { type: "Feature", geometry: vc(t2), properties: t2.tags };
          return null != t2.id && (e2.id = t2.id), e2;
        }
        function vc(t2) {
          const { type: e2, geometry: n2 } = t2;
          switch (e2) {
            case "Point":
              return { type: e2, coordinates: wc(n2[0], n2[1]) };
            case "MultiPoint":
              return { type: e2, coordinates: bc(n2) };
            case "LineString":
              return { type: e2, coordinates: bc(n2.points) };
            case "MultiLineString":
            case "Polygon":
              return { type: e2, coordinates: n2.map(((t3) => bc(t3.points))) };
            case "MultiPolygon":
              return { type: e2, coordinates: n2.map(((t3) => t3.map(((t4) => bc(t4.points))))) };
          }
        }
        function bc(t2) {
          const e2 = [];
          for (let n2 = 0; n2 < t2.length; n2 += 3) e2.push(wc(t2[n2], t2[n2 + 1]));
          return e2;
        }
        function wc(t2, e2) {
          return [_c(t2), Sc(e2)];
        }
        function _c(t2) {
          return 360 * (t2 - 0.5);
        }
        function Sc(t2) {
          const e2 = (180 - 360 * t2) * Math.PI / 180;
          return 360 * Math.atan(Math.exp(e2)) / Math.PI - 90;
        }
        var Ac;
        function Mc(t2, e2, n2, r2, i2, s2, o2, a2) {
          if (r2 /= e2, s2 >= (n2 /= e2) && o2 < r2) return t2;
          if (o2 < n2 || s2 >= r2) return null;
          const l2 = [];
          for (const e3 of t2) {
            const t3 = i2 === Ac.X ? e3.minX : e3.minY, s3 = i2 === Ac.X ? e3.maxX : e3.maxY;
            if (t3 >= n2 && s3 < r2) l2.push(e3);
            else if (!(s3 < n2 || t3 >= r2)) switch (e3.type) {
              case "Point":
              case "MultiPoint":
                kc(e3, l2, n2, r2, i2);
                continue;
              case "LineString":
                Ic(e3, l2, n2, r2, i2, a2);
                continue;
              case "MultiLineString":
                Ec(e3, l2, n2, r2, i2);
                continue;
              case "Polygon":
                Tc(e3, l2, n2, r2, i2);
                continue;
              case "MultiPolygon":
                Fc(e3, l2, n2, r2, i2);
                continue;
            }
          }
          return l2.length ? l2 : null;
        }
        function kc(t2, e2, n2, r2, i2) {
          const s2 = [];
          ((function(t3, e3, n3, r3, i3) {
            for (let s3 = 0; s3 < t3.length; s3 += 3) {
              const o2 = t3[s3 + i3];
              o2 >= n3 && o2 <= r3 && Bc(e3, t3[s3], t3[s3 + 1], t3[s3 + 2]);
            }
          }))(t2.geometry, s2, n2, r2, i2), s2.length && e2.push(uc(t2.id, 3 === s2.length ? "Point" : "MultiPoint", s2, t2.tags));
        }
        function Ic(t2, e2, n2, r2, i2, s2) {
          const o2 = [];
          if (Pc(t2.geometry, o2, n2, r2, i2, false, s2.lineMetrics), o2.length) if (s2.lineMetrics) for (const n3 of o2) e2.push(uc(t2.id, "LineString", n3, t2.tags));
          else e2.push(o2.length > 1 ? uc(t2.id, "MultiLineString", o2, t2.tags) : uc(t2.id, "LineString", o2[0], t2.tags));
        }
        function Ec(t2, e2, n2, r2, i2) {
          const s2 = [];
          zc(t2.geometry, s2, n2, r2, i2, false), s2.length && e2.push(1 !== s2.length ? uc(t2.id, "MultiLineString", s2, t2.tags) : uc(t2.id, "LineString", s2[0], t2.tags));
        }
        function Tc(t2, e2, n2, r2, i2) {
          const s2 = [];
          zc(t2.geometry, s2, n2, r2, i2, true), s2.length && e2.push(uc(t2.id, "Polygon", s2, t2.tags));
        }
        function Fc(t2, e2, n2, r2, i2) {
          const s2 = [];
          for (const e3 of t2.geometry) {
            const t3 = [];
            zc(e3, t3, n2, r2, i2, true), t3.length && s2.push(t3);
          }
          s2.length && e2.push(uc(t2.id, "MultiPolygon", s2, t2.tags));
        }
        function Pc(t2, e2, n2, r2, i2, s2, o2) {
          let a2 = Dc(t2);
          const l2 = i2 === Ac.X ? Cc : Vc;
          let u2, c2, h2 = t2.start;
          for (let p3 = 0; p3 < t2.points.length - 3; p3 += 3) {
            const f3 = t2.points[p3], d3 = t2.points[p3 + 1], y3 = t2.points[p3 + 2], m2 = t2.points[p3 + 3], g2 = t2.points[p3 + 4], x2 = i2 === Ac.X ? f3 : d3, v2 = i2 === Ac.X ? m2 : g2;
            let b2 = false;
            o2 && (u2 = Math.sqrt(Math.pow(f3 - m2, 2) + Math.pow(d3 - g2, 2))), x2 < n2 ? v2 > n2 && (c2 = l2(a2, f3, d3, m2, g2, n2), o2 && (a2.start = h2 + u2 * c2)) : x2 > r2 ? v2 < r2 && (c2 = l2(a2, f3, d3, m2, g2, r2), o2 && (a2.start = h2 + u2 * c2)) : Bc(a2.points, f3, d3, y3), v2 < n2 && x2 >= n2 && (c2 = l2(a2, f3, d3, m2, g2, n2), b2 = true), v2 > r2 && x2 <= r2 && (c2 = l2(a2, f3, d3, m2, g2, r2), b2 = true), !s2 && b2 && (o2 && (a2.end = h2 + u2 * c2), e2.push(a2), a2 = Dc(t2)), o2 && (h2 += u2);
          }
          let p2 = t2.points.length - 3;
          const f2 = t2.points[p2], d2 = t2.points[p2 + 1], y2 = i2 === Ac.X ? f2 : d2;
          y2 >= n2 && y2 <= r2 && Bc(a2.points, f2, d2, t2.points[p2 + 2]), p2 = a2.points.length - 3, s2 && p2 >= 3 && (a2.points[p2] !== a2.points[0] || a2.points[p2 + 1] !== a2.points[1]) && Bc(a2.points, a2.points[0], a2.points[1], a2.points[2]), a2.points.length && (cc(a2), e2.push(a2));
        }
        function Dc(t2) {
          return { points: [], size: t2.size, start: t2.start, end: t2.end };
        }
        function zc(t2, e2, n2, r2, i2, s2) {
          for (const o2 of t2) Pc(o2, e2, n2, r2, i2, s2, false);
        }
        function Bc(t2, e2, n2, r2) {
          t2.push(e2, n2, r2);
        }
        function Cc(t2, e2, n2, r2, i2, s2) {
          const o2 = (s2 - e2) / (r2 - e2);
          return Bc(t2.points, s2, n2 + (i2 - n2) * o2, 1), o2;
        }
        function Vc(t2, e2, n2, r2, i2, s2) {
          const o2 = (s2 - n2) / (i2 - n2);
          return Bc(t2.points, e2 + (r2 - e2) * o2, s2, 1), o2;
        }
        function Lc(t2, e2) {
          const n2 = e2.buffer / e2.extent;
          let r2 = t2;
          const i2 = Mc(t2, 1, -1 - n2, n2, Ac.X, -1, 2, e2), s2 = Mc(t2, 1, 1 - n2, 2 + n2, Ac.X, -1, 2, e2);
          return i2 || s2 ? (r2 = Mc(t2, 1, -n2, 1 + n2, Ac.X, -1, 2, e2) || [], i2 && (r2 = Oc(i2, 1).concat(r2)), s2 && (r2 = r2.concat(Oc(s2, -1))), r2) : r2;
        }
        function Oc(t2, e2) {
          const n2 = [];
          for (const r2 of t2) switch (r2.type) {
            case "Point":
            case "MultiPoint": {
              const t3 = $c(r2.geometry, e2);
              n2.push(uc(r2.id, r2.type, t3, r2.tags));
              continue;
            }
            case "LineString": {
              const t3 = Rc(r2.geometry, e2);
              n2.push(uc(r2.id, r2.type, t3, r2.tags));
              continue;
            }
            case "MultiLineString":
            case "Polygon": {
              const t3 = [];
              for (const n3 of r2.geometry) t3.push(Rc(n3, e2));
              n2.push(uc(r2.id, r2.type, t3, r2.tags));
              continue;
            }
            case "MultiPolygon": {
              const t3 = [];
              for (const n3 of r2.geometry) {
                const r3 = [];
                for (const t4 of n3) r3.push(Rc(t4, e2));
                t3.push(r3);
              }
              n2.push(uc(r2.id, r2.type, t3, r2.tags));
              continue;
            }
          }
          return n2;
        }
        function $c(t2, e2) {
          const n2 = [];
          for (let r2 = 0; r2 < t2.length; r2 += 3) n2.push(t2[r2] + e2, t2[r2 + 1], t2[r2 + 2]);
          return n2;
        }
        function Rc(t2, e2) {
          const n2 = { points: [], size: t2.size };
          void 0 !== t2.start && (n2.start = t2.start, n2.end = t2.end);
          for (let r2 = 0; r2 < t2.points.length; r2 += 3) n2.points.push(t2.points[r2] + e2, t2.points[r2 + 1], t2.points[r2 + 2]);
          return cc(n2), n2;
        }
        function Nc(t2, e2, n2) {
          const r2 = !!e2.newGeometry, i2 = e2.removeAllProperties || e2.removeProperties?.length > 0 || e2.addOrUpdateProperties?.length > 0;
          if (r2) {
            const r3 = t2[0];
            let s2 = pc({ type: "FeatureCollection", features: [{ type: "Feature", id: r3.id, geometry: e2.newGeometry, properties: i2 ? Uc(r3.tags, e2) : r3.tags }] }, n2);
            return s2 = Lc(s2, n2), s2;
          }
          if (i2) {
            const n3 = [];
            for (const r3 of t2) {
              const t3 = { ...r3 };
              t3.tags = Uc(t3.tags, e2), n3.push(t3);
            }
            return n3;
          }
          return t2;
        }
        function Uc(t2, e2) {
          if (e2.removeAllProperties) return {};
          const n2 = { ...t2 || {} };
          if (e2.removeProperties) for (const t3 of e2.removeProperties) delete n2[t3];
          if (e2.addOrUpdateProperties) for (const { key: t3, value: r2 } of e2.addOrUpdateProperties) n2[t3] = r2;
          return n2;
        }
        !(function(t2) {
          t2[t2.X = 0] = "X", t2[t2.Y = 1] = "Y";
        })(Ac || (Ac = {}));
        const jc = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: false, generateId: false, reduce: null, map: (t2) => t2 };
        class qc {
          constructor(t2) {
            this.options = Object.assign(Object.create(jc), t2), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [], this.points = [];
          }
          load(t2) {
            const e2 = [];
            for (const n2 of t2) {
              if (!n2.geometry) continue;
              const [t3, r2] = n2.geometry.coordinates, [i2, s2] = [mc(t3), gc(r2)];
              e2.push({ id: n2.id, type: "Point", geometry: [i2, s2], tags: n2.properties });
            }
            this.createIndex(e2);
          }
          initialize(t2) {
            const e2 = [];
            for (const n2 of t2) "Point" === n2.type && e2.push(n2);
            this.createIndex(e2);
          }
          updateIndex(t2, e2, n2) {
            this.options = Object.assign(Object.create(jc), n2.clusterOptions), this.initialize(t2);
          }
          createIndex(t2) {
            const { log: e2, minZoom: n2, maxZoom: r2 } = this.options;
            e2 && console.time("total time");
            const i2 = `prepare ${t2.length} points`;
            e2 && console.time(i2), this.points = t2;
            const s2 = [];
            for (let e3 = 0; e3 < t2.length; e3++) {
              const n3 = t2[e3];
              if (!n3?.geometry) continue;
              let [r3, i3] = n3.geometry;
              r3 = Math.fround(r3), i3 = Math.fround(i3), s2.push(r3, i3, 1 / 0, e3, -1, 1), this.options.reduce && s2.push(0);
            }
            let o2 = this.trees[r2 + 1] = this.createTree(s2);
            e2 && console.timeEnd(i2);
            for (let t3 = r2; t3 >= n2; t3--) {
              const n3 = Date.now();
              o2 = this.trees[t3] = this.createTree(this.cluster(o2, t3)), e2 && console.log("z%d: %d clusters in %dms", t3, o2.numItems, Date.now() - n3);
            }
            e2 && console.timeEnd("total time");
          }
          getClusters(t2, e2) {
            return this.getClustersInternal(t2, e2).map(((t3) => xc(t3)));
          }
          getClustersInternal(t2, e2) {
            let n2 = ((t2[0] + 180) % 360 + 360) % 360 - 180;
            const r2 = Math.max(-90, Math.min(90, t2[1]));
            let i2 = 180 === t2[2] ? 180 : ((t2[2] + 180) % 360 + 360) % 360 - 180;
            const s2 = Math.max(-90, Math.min(90, t2[3]));
            if (t2[2] - t2[0] >= 360) n2 = -180, i2 = 180;
            else if (n2 > i2) {
              const t3 = this.getClustersInternal([n2, r2, 180, s2], e2), o3 = this.getClustersInternal([-180, r2, i2, s2], e2);
              return t3.concat(o3);
            }
            const o2 = this.trees[this.limitZoom(e2)], a2 = o2.range(mc(n2), gc(s2), mc(i2), gc(r2)), l2 = o2.flatData, u2 = [];
            for (const t3 of a2) {
              const e3 = this.stride * t3;
              u2.push(l2[e3 + 5] > 1 ? Gc(l2, e3, this.clusterProps) : this.points[l2[e3 + 3]]);
            }
            return u2;
          }
          getChildren(t2) {
            const e2 = this.getOriginId(t2), n2 = this.getOriginZoom(t2), r2 = new Error("No cluster with the specified id: " + t2), i2 = this.trees[n2];
            if (!i2) throw r2;
            const s2 = i2.flatData;
            if (e2 * this.stride >= s2.length) throw r2;
            const o2 = this.options.radius / (this.options.extent * Math.pow(2, n2 - 1)), a2 = i2.within(s2[e2 * this.stride], s2[e2 * this.stride + 1], o2), l2 = [];
            for (const e3 of a2) {
              const n3 = e3 * this.stride;
              s2[n3 + 4] === t2 && l2.push(s2[n3 + 5] > 1 ? Xc(s2, n3, this.clusterProps) : xc(this.points[s2[n3 + 3]]));
            }
            if (0 === l2.length) throw r2;
            return l2;
          }
          getLeaves(t2, e2, n2) {
            const r2 = [];
            return this.appendLeaves(r2, t2, e2 = e2 || 10, n2 = n2 || 0, 0), r2;
          }
          getTile(t2, e2, n2) {
            const r2 = this.trees[this.limitZoom(t2)];
            if (!r2) return null;
            const i2 = Math.pow(2, t2), { extent: s2, radius: o2 } = this.options, a2 = o2 / s2, l2 = (n2 - a2) / i2, u2 = (n2 + 1 + a2) / i2, c2 = { transformed: true, features: [], source: null, x: e2, y: n2, z: t2 };
            return this.addTileFeatures(r2.range((e2 - a2) / i2, l2, (e2 + 1 + a2) / i2, u2), r2.flatData, e2, n2, i2, c2), 0 === e2 && this.addTileFeatures(r2.range(1 - a2 / i2, l2, 1, u2), r2.flatData, i2, n2, i2, c2), e2 === i2 - 1 && this.addTileFeatures(r2.range(0, l2, a2 / i2, u2), r2.flatData, -1, n2, i2, c2), c2;
          }
          getClusterExpansionZoom(t2) {
            return this.getOriginZoom(t2);
          }
          appendLeaves(t2, e2, n2, r2, i2) {
            const s2 = this.getChildren(e2);
            for (const e3 of s2) {
              const s3 = e3.properties;
              if (s3?.cluster ? i2 + s3.point_count <= r2 ? i2 += s3.point_count : i2 = this.appendLeaves(t2, s3.cluster_id, n2, r2, i2) : i2 < r2 ? i2++ : t2.push(e3), t2.length === n2) break;
            }
            return i2;
          }
          createTree(t2) {
            const e2 = new ec(t2.length / this.stride | 0, this.options.nodeSize, Float32Array);
            for (let n2 = 0; n2 < t2.length; n2 += this.stride) e2.add(t2[n2], t2[n2 + 1]);
            return e2.finish(), e2.flatData = t2, e2.data = null, e2;
          }
          addTileFeatures(t2, e2, n2, r2, i2, s2) {
            for (const o2 of t2) {
              const t3 = o2 * this.stride, a2 = e2[t3 + 5] > 1;
              let l2, u2, c2;
              if (a2) l2 = Yc(e2, t3, this.clusterProps), u2 = e2[t3], c2 = e2[t3 + 1];
              else {
                const n3 = this.points[e2[t3 + 3]];
                l2 = n3.tags, [u2, c2] = n3.geometry;
              }
              const h2 = { type: 1, geometry: [[Math.round(this.options.extent * (u2 * i2 - n2)), Math.round(this.options.extent * (c2 * i2 - r2))]], tags: l2 };
              let p2;
              p2 = a2 || this.options.generateId ? e2[t3 + 3] : this.points[e2[t3 + 3]].id, void 0 !== p2 && (h2.id = p2), s2.features.push(h2);
            }
          }
          limitZoom(t2) {
            return Math.max(this.options.minZoom, Math.min(Math.floor(+t2), this.options.maxZoom + 1));
          }
          cluster(t2, e2) {
            const { radius: n2, extent: r2, reduce: i2, minPoints: s2 } = this.options, o2 = n2 / (r2 * Math.pow(2, e2)), a2 = t2.flatData, l2 = [], u2 = this.stride;
            for (let n3 = 0; n3 < a2.length; n3 += u2) {
              if (a2[n3 + 2] <= e2) continue;
              a2[n3 + 2] = e2;
              const r3 = a2[n3], c2 = a2[n3 + 1], h2 = t2.within(a2[n3], a2[n3 + 1], o2), p2 = a2[n3 + 5];
              let f2 = p2;
              for (const t3 of h2) {
                const n4 = t3 * u2;
                a2[n4 + 2] > e2 && (f2 += a2[n4 + 5]);
              }
              if (f2 > p2 && f2 >= s2) {
                let t3, s3 = r3 * p2, o3 = c2 * p2, d2 = -1;
                const y2 = (n3 / u2 << 5) + (e2 + 1) + this.points.length;
                for (const r4 of h2) {
                  const l3 = r4 * u2;
                  if (a2[l3 + 2] <= e2) continue;
                  a2[l3 + 2] = e2;
                  const c3 = a2[l3 + 5];
                  s3 += a2[l3] * c3, o3 += a2[l3 + 1] * c3, a2[l3 + 4] = y2, i2 && (t3 || (t3 = this.map(a2, n3, true), d2 = this.clusterProps.length, this.clusterProps.push(t3)), i2(t3, this.map(a2, l3)));
                }
                a2[n3 + 4] = y2, l2.push(s3 / f2, o3 / f2, 1 / 0, y2, -1, f2), i2 && l2.push(d2);
              } else {
                for (let t3 = 0; t3 < u2; t3++) l2.push(a2[n3 + t3]);
                if (f2 > 1) for (const t3 of h2) {
                  const n4 = t3 * u2;
                  if (!(a2[n4 + 2] <= e2)) {
                    a2[n4 + 2] = e2;
                    for (let t4 = 0; t4 < u2; t4++) l2.push(a2[n4 + t4]);
                  }
                }
              }
            }
            return l2;
          }
          getOriginId(t2) {
            return t2 - this.points.length >> 5;
          }
          getOriginZoom(t2) {
            return (t2 - this.points.length) % 32;
          }
          map(t2, e2, n2) {
            if (t2[e2 + 5] > 1) {
              const r3 = this.clusterProps[t2[e2 + 6]];
              return n2 ? Object.assign({}, r3) : r3;
            }
            const r2 = this.points[t2[e2 + 3]].tags, i2 = this.options.map(r2);
            return n2 && i2 === r2 ? Object.assign({}, i2) : i2;
          }
        }
        function Gc(t2, e2, n2) {
          return { id: t2[e2 + 3], type: "Point", tags: Yc(t2, e2, n2), geometry: [t2[e2], t2[e2 + 1]] };
        }
        function Xc(t2, e2, n2) {
          return { type: "Feature", id: t2[e2 + 3], properties: Yc(t2, e2, n2), geometry: { type: "Point", coordinates: [_c(t2[e2]), Sc(t2[e2 + 1])] } };
        }
        function Yc(t2, e2, n2) {
          const r2 = t2[e2 + 5], i2 = r2 >= 1e4 ? `${Math.round(r2 / 1e3)}k` : r2 >= 1e3 ? Math.round(r2 / 100) / 10 + "k" : r2, s2 = t2[e2 + 6], o2 = -1 === s2 ? {} : Object.assign({}, n2[s2]);
          return Object.assign(o2, { cluster: true, cluster_id: t2[e2 + 3], point_count: r2, point_count_abbreviated: i2 });
        }
        const Zc = "geojsonvt_clip_start", Hc = "geojsonvt_clip_end";
        function Wc(t2, e2, n2, r2, i2) {
          const s2 = e2 === i2.maxZoom ? 0 : i2.tolerance / ((1 << e2) * i2.extent), o2 = { transformed: false, features: [], source: null, x: n2, y: r2, z: e2, minX: 2, minY: 1, maxX: -1, maxY: 0, numPoints: 0, numSimplified: 0, numFeatures: t2.length };
          for (const e3 of t2) Kc(o2, e3, s2, i2);
          return o2;
        }
        function Kc(t2, e2, n2, r2) {
          switch (t2.minX = Math.min(t2.minX, e2.minX), t2.minY = Math.min(t2.minY, e2.minY), t2.maxX = Math.max(t2.maxX, e2.maxX), t2.maxY = Math.max(t2.maxY, e2.maxY), e2.type) {
            case "Point":
            case "MultiPoint":
              return void (function(t3, e3) {
                const n3 = [];
                for (let r4 = 0; r4 < e3.geometry.length; r4 += 3) n3.push(e3.geometry[r4], e3.geometry[r4 + 1]), t3.numPoints++, t3.numSimplified++;
                if (!n3.length) return;
                const r3 = { type: 1, tags: e3.tags || null, geometry: n3 };
                null !== e3.id && (r3.id = e3.id), t3.features.push(r3);
              })(t2, e2);
            case "LineString":
              return void (function(t3, e3, n3, r3) {
                const i2 = [];
                if (Jc(i2, e3.geometry, t3, n3, false, false), !i2.length) return;
                let s2 = e3.tags || null;
                if (r3.lineMetrics) {
                  s2 = {};
                  for (const t4 in e3.tags) s2[t4] = e3.tags[t4];
                  s2[Zc] = e3.geometry.start / e3.geometry.size, s2[Hc] = e3.geometry.end / e3.geometry.size;
                }
                const o2 = { type: 2, tags: s2, geometry: i2 };
                null !== e3.id && (o2.id = e3.id), t3.features.push(o2);
              })(t2, e2, n2, r2);
            case "MultiLineString":
            case "Polygon":
              return void (function(t3, e3, n3) {
                const r3 = [];
                for (let i3 = 0; i3 < e3.geometry.length; i3++) Jc(r3, e3.geometry[i3], t3, n3, "Polygon" === e3.type, 0 === i3);
                if (!r3.length) return;
                const i2 = { type: "Polygon" === e3.type ? 3 : 2, tags: e3.tags || null, geometry: r3 };
                null !== e3.id && (i2.id = e3.id), t3.features.push(i2);
              })(t2, e2, n2);
            case "MultiPolygon":
              return void (function(t3, e3, n3) {
                const r3 = [];
                for (let i3 = 0; i3 < e3.geometry.length; i3++) {
                  const s2 = e3.geometry[i3];
                  for (let e4 = 0; e4 < s2.length; e4++) Jc(r3, s2[e4], t3, n3, true, 0 === e4);
                }
                if (!r3.length) return;
                const i2 = { type: 3, tags: e3.tags || null, geometry: r3 };
                null !== e3.id && (i2.id = e3.id), t3.features.push(i2);
              })(t2, e2, n2);
          }
        }
        function Jc(t2, e2, n2, r2, i2, s2) {
          const o2 = r2 * r2;
          if (r2 > 0 && e2.size < (i2 ? o2 : r2)) return void (n2.numPoints += e2.points.length / 3);
          const a2 = [];
          for (let t3 = 0; t3 < e2.points.length; t3 += 3) (0 === r2 || e2.points[t3 + 2] > o2) && (n2.numSimplified++, a2.push(e2.points[t3], e2.points[t3 + 1])), n2.numPoints++;
          i2 && (function(t3, e3) {
            let n3 = 0;
            for (let e4 = 0, r3 = t3.length, i3 = r3 - 2; e4 < r3; i3 = e4, e4 += 2) n3 += (t3[e4] - t3[i3]) * (t3[e4 + 1] + t3[i3 + 1]);
            if (n3 > 0 === e3) for (let e4 = 0, n4 = t3.length; e4 < n4 / 2; e4 += 2) {
              const r3 = t3[e4], i3 = t3[e4 + 1];
              t3[e4] = t3[n4 - 2 - e4], t3[e4 + 1] = t3[n4 - 1 - e4], t3[n4 - 2 - e4] = r3, t3[n4 - 1 - e4] = i3;
            }
          })(a2, s2), t2.push(a2);
        }
        function Qc(t2, e2) {
          if (t2.transformed) return t2;
          const n2 = 1 << t2.z, r2 = t2.x, i2 = t2.y;
          for (const s2 of t2.features) 1 === s2.type ? th(s2, e2, n2, r2, i2) : eh(s2, e2, n2, r2, i2);
          return t2.transformed = true, t2;
        }
        function th(t2, e2, n2, r2, i2) {
          const s2 = t2, o2 = t2.geometry, a2 = [];
          for (let t3 = 0; t3 < o2.length; t3 += 2) a2.push(nh(o2[t3], o2[t3 + 1], e2, n2, r2, i2));
          return s2.geometry = a2, s2;
        }
        function eh(t2, e2, n2, r2, i2) {
          const s2 = t2, o2 = t2.geometry, a2 = [];
          for (const t3 of o2) {
            const s3 = [];
            for (let o3 = 0; o3 < t3.length; o3 += 2) s3.push(nh(t3[o3], t3[o3 + 1], e2, n2, r2, i2));
            a2.push(s3);
          }
          return s2.geometry = a2, s2;
        }
        function nh(t2, e2, n2, r2, i2, s2) {
          return [Math.round(n2 * (t2 * r2 - i2)), Math.round(n2 * (e2 * r2 - s2))];
        }
        class rh {
          constructor(t2) {
            this.options = t2, this.total = 0, this.stats = {}, this.tiles = {}, this.tileCoords = [], this.stats = {}, this.total = 0;
          }
          initialize(t2) {
            this.splitTile(t2, 0, 0, 0), this.options.debug && (t2.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)));
          }
          updateIndex(t2, e2, n2) {
            n2.debug > 1 && (console.log("invalidating tiles"), console.time("invalidating")), this.invalidateTiles(e2), n2.debug > 1 && console.timeEnd("invalidating");
            const [r2, i2, s2] = [0, 0, 0], o2 = Wc(t2, r2, i2, s2, n2);
            o2.source = t2;
            const a2 = ih(r2, i2, s2);
            if (this.tiles[a2] = o2, this.tileCoords.push({ z: r2, x: i2, y: s2, id: a2 }), n2.debug) {
              const t3 = `z${r2}`;
              this.stats[t3] = (this.stats[t3] || 0) + 1, this.total++;
            }
          }
          getClusterExpansionZoom(t2) {
            return null;
          }
          getChildren(t2) {
            return null;
          }
          getLeaves(t2, e2, n2) {
            return null;
          }
          getTile(t2, e2, n2) {
            const { extent: r2, debug: i2 } = this.options, s2 = 1 << t2, o2 = ih(t2, e2 = e2 + s2 & s2 - 1, n2);
            if (this.tiles[o2]) return Qc(this.tiles[o2], r2);
            i2 > 1 && console.log("drilling down to z%d-%d-%d", t2, e2, n2);
            let a2, l2 = t2, u2 = e2, c2 = n2;
            for (; !a2 && l2 > 0; ) l2--, u2 >>= 1, c2 >>= 1, a2 = this.tiles[ih(l2, u2, c2)];
            return a2?.source ? (i2 > 1 && (console.log("found parent tile z%d-%d-%d", l2, u2, c2), console.time("drilling down")), this.splitTile(a2.source, l2, u2, c2, t2, e2, n2), i2 > 1 && console.timeEnd("drilling down"), this.tiles[o2] ? Qc(this.tiles[o2], r2) : null) : null;
          }
          splitTile(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = [t2, e2, n2, r2], l2 = this.options, u2 = l2.debug;
            for (; a2.length; ) {
              r2 = a2.pop(), n2 = a2.pop(), e2 = a2.pop(), t2 = a2.pop();
              const c2 = 1 << e2, h2 = ih(e2, n2, r2);
              let p2 = this.tiles[h2];
              if (!p2 && (u2 > 1 && console.time("creation"), p2 = this.tiles[h2] = Wc(t2, e2, n2, r2, l2), this.tileCoords.push({ z: e2, x: n2, y: r2, id: h2 }), u2)) {
                u2 > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", e2, n2, r2, p2.numFeatures, p2.numPoints, p2.numSimplified), console.timeEnd("creation"));
                const t3 = `z${e2}`;
                this.stats[t3] = (this.stats[t3] || 0) + 1, this.total++;
              }
              if (p2.source = t2, null == i2) {
                if (e2 === l2.indexMaxZoom || p2.numPoints <= l2.indexMaxPoints) continue;
              } else {
                if (e2 === l2.maxZoom || e2 === i2) continue;
                if (null != i2) {
                  const t3 = i2 - e2;
                  if (n2 !== s2 >> t3 || r2 !== o2 >> t3) continue;
                }
              }
              if (p2.source = null, !t2.length) continue;
              u2 > 1 && console.time("clipping");
              const f2 = 0.5 * l2.buffer / l2.extent, d2 = 0.5 - f2, y2 = 0.5 + f2, m2 = 1 + f2;
              let g2 = null, x2 = null, v2 = null, b2 = null;
              const w2 = Mc(t2, c2, n2 - f2, n2 + y2, Ac.X, p2.minX, p2.maxX, l2), _2 = Mc(t2, c2, n2 + d2, n2 + m2, Ac.X, p2.minX, p2.maxX, l2);
              w2 && (g2 = Mc(w2, c2, r2 - f2, r2 + y2, Ac.Y, p2.minY, p2.maxY, l2), x2 = Mc(w2, c2, r2 + d2, r2 + m2, Ac.Y, p2.minY, p2.maxY, l2)), _2 && (v2 = Mc(_2, c2, r2 - f2, r2 + y2, Ac.Y, p2.minY, p2.maxY, l2), b2 = Mc(_2, c2, r2 + d2, r2 + m2, Ac.Y, p2.minY, p2.maxY, l2)), u2 > 1 && console.timeEnd("clipping"), a2.push(g2 || [], e2 + 1, 2 * n2, 2 * r2), a2.push(x2 || [], e2 + 1, 2 * n2, 2 * r2 + 1), a2.push(v2 || [], e2 + 1, 2 * n2 + 1, 2 * r2), a2.push(b2 || [], e2 + 1, 2 * n2 + 1, 2 * r2 + 1);
            }
          }
          invalidateTiles(t2) {
            if (!t2.length) return;
            const e2 = this.options, { debug: n2 } = e2;
            let r2 = 1 / 0, i2 = -1 / 0, s2 = 1 / 0, o2 = -1 / 0;
            for (const e3 of t2) r2 = Math.min(r2, e3.minX), i2 = Math.max(i2, e3.maxX), s2 = Math.min(s2, e3.minY), o2 = Math.max(o2, e3.maxY);
            const a2 = e2.buffer / e2.extent, l2 = /* @__PURE__ */ new Set();
            for (const e3 in this.tiles) {
              const u2 = this.tiles[e3], c2 = 1 << u2.z, h2 = (u2.x - a2) / c2, p2 = (u2.x + 1 + a2) / c2, f2 = (u2.y - a2) / c2, d2 = (u2.y + 1 + a2) / c2;
              if (i2 < h2 || r2 >= p2 || o2 < f2 || s2 >= d2) continue;
              let y2 = false;
              for (const e4 of t2) if (e4.maxX >= h2 && e4.minX < p2 && e4.maxY >= f2 && e4.minY < d2) {
                y2 = true;
                break;
              }
              if (y2) {
                if (n2) {
                  n2 > 1 && console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", u2.z, u2.x, u2.y, u2.numFeatures, u2.numPoints, u2.numSimplified);
                  const t3 = `z${u2.z}`;
                  this.stats[t3] = (this.stats[t3] || 0) - 1, this.total--;
                }
                delete this.tiles[e3], l2.add(e3);
              }
            }
            l2.size && (this.tileCoords = this.tileCoords.filter(((t3) => !l2.has(t3.id))));
          }
        }
        function ih(t2, e2, n2) {
          return 32 * ((1 << t2) * n2 + e2) + t2;
        }
        const sh = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: false, promoteId: null, generateId: false, updateable: false, cluster: false, clusterOptions: jc, debug: 0 }, oh = ao([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: ah } = oh, lh = ao([{ name: "a_uv_x", components: 1, type: "Float32" }, { name: "a_split_index", components: 1, type: "Float32" }]), { members: uh } = lh, ch = Math.cos(Math.PI / 180 * 37.5), hh = Math.pow(2, 14) / 0.5;
        class ph {
          constructor(t2) {
            this.zoom = t2.zoom, this.overscaling = t2.overscaling, this.layers = t2.layers, this.layerIds = this.layers.map(((t3) => t3.id)), this.index = t2.index, this.hasDependencies = false, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {};
            for (const t3 of this.layers) this.gradients[t3.id] = {};
            this.layoutVertexArray = new Wo(), this.layoutVertexArray2 = new Ko(), this.indexArray = new sa(), this.programConfigurations = new $a(t2.layers, t2.zoom), this.segments = new ua(), this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter(((t3) => t3.isStateDependent())).map(((t3) => t3.id));
          }
          populate(t2, e2, n2) {
            this.hasDependencies = ql("line", this.layers, e2) || this.hasLineDasharray(this.layers);
            const r2 = this.layers[0].layout.get("line-sort-key"), i2 = !r2.isConstant(), s2 = [];
            for (const { feature: e3, id: o2, index: a2, sourceLayerIndex: l2 } of t2) {
              const t3 = this.layers[0]._featureFilter.needGeometry, u2 = Ga(e3, t3);
              if (!this.layers[0]._featureFilter.filter(new Cs(this.zoom), u2, n2)) continue;
              const c2 = i2 ? r2.evaluate(u2, {}, n2) : void 0, h2 = { id: o2, properties: e3.properties, type: e3.type, sourceLayerIndex: l2, index: a2, geometry: t3 ? u2.geometry : qa(e3), patterns: {}, dashes: {}, sortKey: c2 };
              s2.push(h2);
            }
            i2 && s2.sort(((t3, e3) => t3.sortKey - e3.sortKey));
            for (const r3 of s2) {
              const { geometry: i3, index: s3, sourceLayerIndex: o2 } = r3;
              this.hasDependencies ? (ql("line", this.layers, e2) ? Gl("line", this.layers, r3, { zoom: this.zoom }, e2) : this.hasLineDasharray(this.layers) && this.addLineDashDependencies(this.layers, r3, this.zoom, e2), this.patternFeatures.push(r3)) : this.addFeature(r3, i3, s3, n2, {}, {}, e2.subdivisionGranularity), e2.featureIndex.insert(t2[s3].feature, i3, s3, o2, this.index);
            }
          }
          update(t2, e2, n2, r2) {
            this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t2, e2, this.stateDependentLayers, { imagePositions: n2, dashPositions: r2 });
          }
          addFeatures(t2, e2, n2, r2) {
            for (const i2 of this.patternFeatures) this.addFeature(i2, i2.geometry, i2.index, e2, n2, r2, t2.subdivisionGranularity);
          }
          isEmpty() {
            return 0 === this.layoutVertexArray.length;
          }
          uploadPending() {
            return !this.uploaded || this.programConfigurations.needsUpload;
          }
          upload(t2) {
            this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = t2.createVertexBuffer(this.layoutVertexArray2, uh)), this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, ah), this.indexBuffer = t2.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t2), this.uploaded = true;
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
          }
          lineFeatureClips(t2) {
            if (t2.properties && Object.hasOwn(t2.properties, Zc) && Object.hasOwn(t2.properties, Hc)) return { start: +t2.properties[Zc], end: +t2.properties[Hc] };
          }
          addFeature(t2, e2, n2, r2, i2, s2, o2) {
            const a2 = this.layers[0].layout, l2 = a2.get("line-join").evaluate(t2, {}), u2 = a2.get("line-cap").evaluate(t2, {}), c2 = a2.get("line-miter-limit").evaluate(t2, {}), h2 = a2.get("line-round-limit").evaluate(t2, {});
            this.lineClips = this.lineFeatureClips(t2);
            for (const n3 of e2) this.addLine(n3, t2, l2, u2, c2, h2, r2, o2);
            this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t2, n2, { imagePositions: i2, dashPositions: s2, canonical: r2 });
          }
          addLine(t2, e2, n2, r2, i2, s2, o2, a2) {
            if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, t2 = Su(t2, o2 ? a2.line.getGranularityForZoomLevel(o2.z) : 1), this.lineClips) {
              this.lineClipsArray.push(this.lineClips);
              for (let e3 = 0; e3 < t2.length - 1; e3++) this.totalDistance += t2[e3].dist(t2[e3 + 1]);
              this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);
            }
            const l2 = "Polygon" === Cu.types[e2.type];
            let u2 = t2.length;
            for (; u2 >= 2 && t2[u2 - 1].equals(t2[u2 - 2]); ) u2--;
            let c2 = 0;
            for (; c2 < u2 - 1 && t2[c2].equals(t2[c2 + 1]); ) c2++;
            if (u2 < (l2 ? 3 : 2)) return;
            "bevel" === n2 && (i2 = 1.05);
            const h2 = this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0, p2 = this.segments.prepareSegment(10 * u2, this.layoutVertexArray, this.indexArray);
            let f2, d2, y2, m2, g2;
            this.e1 = this.e2 = -1, l2 && (f2 = t2[u2 - 2], g2 = t2[c2].sub(f2)._unit()._perp());
            for (let e3 = c2; e3 < u2; e3++) {
              if (y2 = e3 === u2 - 1 ? l2 ? t2[c2 + 1] : void 0 : t2[e3 + 1], y2 && t2[e3].equals(y2)) continue;
              g2 && (m2 = g2), f2 && (d2 = f2), f2 = t2[e3], g2 = y2 ? y2.sub(f2)._unit()._perp() : m2, m2 || (m2 = g2);
              let o3 = m2.add(g2);
              0 === o3.x && 0 === o3.y || o3._unit();
              const a3 = m2.x * g2.x + m2.y * g2.y, x2 = o3.x * g2.x + o3.y * g2.y, v2 = 0 !== x2 ? 1 / x2 : 1 / 0, b2 = 2 * Math.sqrt(2 - 2 * x2), w2 = x2 < ch && d2 && y2, _2 = m2.x * g2.y - m2.y * g2.x > 0;
              if (w2 && e3 > c2) {
                const t3 = f2.dist(d2);
                if (t3 > 2 * h2) {
                  const e4 = f2.sub(f2.sub(d2)._mult(h2 / t3)._round());
                  this.updateDistance(d2, e4), this.addCurrentVertex(e4, m2, 0, 0, p2), d2 = e4;
                }
              }
              const S2 = d2 && y2;
              let A2 = S2 ? n2 : l2 ? "butt" : r2;
              if (S2 && "round" === A2 && (v2 < s2 ? A2 = "miter" : v2 <= 2 && (A2 = "fakeround")), "miter" === A2 && v2 > i2 && (A2 = "bevel"), "bevel" === A2 && (v2 > 2 && (A2 = "flipbevel"), v2 < i2 && (A2 = "miter")), d2 && this.updateDistance(d2, f2), "miter" === A2) o3._mult(v2), this.addCurrentVertex(f2, o3, 0, 0, p2);
              else if ("flipbevel" === A2) {
                if (v2 > 100) o3 = g2.mult(-1);
                else {
                  const t3 = v2 * m2.add(g2).mag() / m2.sub(g2).mag();
                  o3._perp()._mult(t3 * (_2 ? -1 : 1));
                }
                this.addCurrentVertex(f2, o3, 0, 0, p2), this.addCurrentVertex(f2, o3.mult(-1), 0, 0, p2);
              } else if ("bevel" === A2 || "fakeround" === A2) {
                const t3 = -Math.sqrt(v2 * v2 - 1), e4 = _2 ? t3 : 0, n3 = _2 ? 0 : t3;
                if (d2 && this.addCurrentVertex(f2, m2, e4, n3, p2), "fakeround" === A2) {
                  const t4 = Math.round(180 * b2 / Math.PI / 20);
                  for (let e5 = 1; e5 < t4; e5++) {
                    let n4 = e5 / t4;
                    if (0.5 !== n4) {
                      const t5 = n4 - 0.5;
                      n4 += n4 * t5 * (n4 - 1) * ((1.0904 + a3 * (a3 * (3.55645 - 1.43519 * a3) - 3.2452)) * t5 * t5 + (0.848013 + a3 * (0.215638 * a3 - 1.06021)));
                    }
                    const r3 = g2.sub(m2)._mult(n4)._add(m2)._unit()._mult(_2 ? -1 : 1);
                    this.addHalfVertex(f2, r3.x, r3.y, false, _2, 0, p2);
                  }
                }
                y2 && this.addCurrentVertex(f2, g2, -e4, -n3, p2);
              } else if ("butt" === A2) this.addCurrentVertex(f2, o3, 0, 0, p2);
              else if ("square" === A2) {
                const t3 = d2 ? 1 : -1;
                this.addCurrentVertex(f2, o3, t3, t3, p2);
              } else "round" === A2 && (d2 && (this.addCurrentVertex(f2, m2, 0, 0, p2), this.addCurrentVertex(f2, m2, 1, 1, p2, true)), y2 && (this.addCurrentVertex(f2, g2, -1, -1, p2, true), this.addCurrentVertex(f2, g2, 0, 0, p2)));
              if (w2 && e3 < u2 - 1) {
                const t3 = f2.dist(y2);
                if (t3 > 2 * h2) {
                  const e4 = f2.add(y2.sub(f2)._mult(h2 / t3)._round());
                  this.updateDistance(f2, e4), this.addCurrentVertex(e4, g2, 0, 0, p2), f2 = e4;
                }
              }
            }
          }
          addCurrentVertex(t2, e2, n2, r2, i2, s2 = false) {
            const o2 = e2.y * r2 - e2.x, a2 = -e2.y - e2.x * r2;
            this.addHalfVertex(t2, e2.x + e2.y * n2, e2.y - e2.x * n2, s2, false, n2, i2), this.addHalfVertex(t2, o2, a2, s2, true, -r2, i2), this.distance > hh / 2 && 0 === this.totalDistance && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(t2, e2, n2, r2, i2, s2));
          }
          addHalfVertex({ x: t2, y: e2 }, n2, r2, i2, s2, o2, a2) {
            const l2 = 0.5 * (this.lineClips ? this.scaledDistance * (hh - 1) : this.scaledDistance);
            this.layoutVertexArray.emplaceBack((t2 << 1) + (i2 ? 1 : 0), (e2 << 1) + (s2 ? 1 : 0), Math.round(63 * n2) + 128, Math.round(63 * r2) + 128, 1 + (0 === o2 ? 0 : o2 < 0 ? -1 : 1) | (63 & l2) << 2, l2 >> 6), this.lineClips && this.layoutVertexArray2.emplaceBack((this.scaledDistance - this.lineClips.start) / (this.lineClips.end - this.lineClips.start), this.lineClipsArray.length);
            const u2 = a2.vertexLength++;
            this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, u2, this.e2), a2.primitiveLength++), s2 ? this.e2 = u2 : this.e1 = u2;
          }
          updateScaledDistance() {
            this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;
          }
          updateDistance(t2, e2) {
            this.distance += t2.dist(e2), this.updateScaledDistance();
          }
          hasLineDasharray(t2) {
            for (const e2 of t2) {
              const t3 = e2.paint.get("line-dasharray");
              if (t3 && !t3.isConstant()) return true;
            }
            return false;
          }
          addLineDashDependencies(t2, e2, n2, r2) {
            for (const i2 of t2) {
              const t3 = i2.paint.get("line-dasharray");
              if (!t3 || "constant" === t3.value.kind) continue;
              const s2 = "round" === i2.layout.get("line-cap").evaluate(e2, {}), o2 = { dasharray: t3.value.evaluate({ zoom: n2 - 1 }, e2, {}), round: s2 }, a2 = { dasharray: t3.value.evaluate({ zoom: n2 }, e2, {}), round: s2 }, l2 = { dasharray: t3.value.evaluate({ zoom: n2 + 1 }, e2, {}), round: s2 }, u2 = `${o2.dasharray.join(",")},${o2.round}`, c2 = `${a2.dasharray.join(",")},${a2.round}`, h2 = `${l2.dasharray.join(",")},${l2.round}`;
              r2.dashDependencies[u2] = o2, r2.dashDependencies[c2] = a2, r2.dashDependencies[h2] = l2, e2.dashes[i2.id] = { min: u2, mid: c2, max: h2 };
            }
          }
        }
        let fh, dh;
        ds("LineBucket", ph, { omit: ["layers", "patternFeatures"] });
        var yh = { get paint() {
          return dh = dh || new Ks({ "line-opacity": new Ys(wt.paint_line["line-opacity"]), "line-color": new Ys(wt.paint_line["line-color"]), "line-translate": new Xs(wt.paint_line["line-translate"]), "line-translate-anchor": new Xs(wt.paint_line["line-translate-anchor"]), "line-width": new Ys(wt.paint_line["line-width"]), "line-gap-width": new Ys(wt.paint_line["line-gap-width"]), "line-offset": new Ys(wt.paint_line["line-offset"]), "line-blur": new Ys(wt.paint_line["line-blur"]), "line-dasharray": new Zs(wt.paint_line["line-dasharray"]), "line-pattern": new Zs(wt.paint_line["line-pattern"]), "line-gradient": new Ws(wt.paint_line["line-gradient"]) });
        }, get layout() {
          return fh = fh || new Ks({ "line-cap": new Ys(wt.layout_line["line-cap"]), "line-join": new Ys(wt.layout_line["line-join"]), "line-miter-limit": new Ys(wt.layout_line["line-miter-limit"]), "line-round-limit": new Ys(wt.layout_line["line-round-limit"]), "line-sort-key": new Ys(wt.layout_line["line-sort-key"]) });
        } };
        class mh extends Ys {
          possiblyEvaluate(t2, e2) {
            return e2 = new Cs(Math.floor(e2.zoom), { now: e2.now, fadeDuration: e2.fadeDuration, zoomHistory: e2.zoomHistory, transition: e2.transition }), super.possiblyEvaluate(t2, e2);
          }
          evaluate(t2, e2, n2, r2) {
            return e2 = $({}, e2, { zoom: Math.floor(e2.zoom) }), super.evaluate(t2, e2, n2, r2);
          }
        }
        let gh;
        class xh extends to {
          constructor(t2, e2) {
            super(t2, yh, e2), this.gradientVersion = 0, gh || (gh = new mh(yh.paint.properties["line-width"].specification), gh.useIntegerZoom = true);
          }
          _handleSpecialPaintPropertyUpdate(t2) {
            if ("line-gradient" === t2) {
              const t3 = this.gradientExpression();
              this.stepInterpolant = !!(function(t4) {
                return void 0 !== t4._styleExpression;
              })(t3) && t3._styleExpression.expression instanceof cn, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER;
            }
          }
          gradientExpression() {
            return this._transitionablePaint._values["line-gradient"].value.expression;
          }
          recalculate(t2, e2) {
            super.recalculate(t2, e2), this.paint._values["line-floorwidth"] = gh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, t2);
          }
          createBucket(t2) {
            return new ph(t2);
          }
          queryRadius(t2) {
            const e2 = t2, n2 = vh(ol("line-width", this, e2), ol("line-gap-width", this, e2)), r2 = ol("line-offset", this, e2);
            return n2 / 2 + Math.abs(r2) + al(this.paint.get("line-translate"));
          }
          queryIntersectsFeature({ queryGeometry: t2, feature: e2, featureState: r2, geometry: i2, transform: s2, pixelsToTileUnits: o2 }) {
            const a2 = ll(t2, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), -s2.bearingInRadians, o2), l2 = o2 / 2 * vh(this.paint.get("line-width").evaluate(e2, r2), this.paint.get("line-gap-width").evaluate(e2, r2)), u2 = this.paint.get("line-offset").evaluate(e2, r2);
            return u2 && (i2 = (function(t3, e3) {
              const r3 = [];
              for (const i3 of t3) {
                const t4 = ul(i3), s3 = [];
                for (let r4 = 0; r4 < t4.length; r4++) {
                  const i4 = t4[r4], o3 = t4[r4 - 1], a3 = t4[r4 + 1], l3 = 0 === r4 ? new n(0, 0) : i4.sub(o3)._unit()._perp(), u3 = r4 === t4.length - 1 ? new n(0, 0) : a3.sub(i4)._unit()._perp(), c2 = l3._add(u3)._unit(), h2 = c2.x * u3.x + c2.y * u3.y;
                  0 !== h2 && c2._mult(1 / h2), s3.push(c2._mult(e3)._add(i4));
                }
                r3.push(s3);
              }
              return r3;
            })(i2, u2 * o2)), (function(t3, e3, n2) {
              for (const r3 of e3) {
                if (t3.length >= 3) {
                  for (const e4 of r3) if (il(t3, e4)) return true;
                }
                if (Ja(t3, r3, n2)) return true;
              }
              return false;
            })(a2, i2, l2);
          }
          isTileClipped() {
            return true;
          }
        }
        function vh(t2, e2) {
          return e2 > 0 ? e2 + 2 * t2 : t2;
        }
        const bh = ao([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), wh = ao([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
        ao([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
        const _h = ao([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }, { name: "a_box_real", components: 2, type: "Int16" }]);
        ao([{ 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 Sh = ao([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), Ah = ao([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
        function Mh(t2, e2, n2) {
          const r2 = e2.layout.get("text-transform").evaluate(n2, {});
          return "uppercase" === r2 ? t2 = t2.toLocaleUpperCase() : "lowercase" === r2 && (t2 = t2.toLocaleLowerCase()), Bs.applyArabicShaping && (t2 = Bs.applyArabicShaping(t2)), t2;
        }
        function kh(t2, e2, n2) {
          for (const r2 of t2.sections) r2.text = Mh(r2.text, e2, n2);
          return t2;
        }
        ao([{ name: "triangle", components: 3, type: "Uint16" }]), ao([{ 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" }]), ao([{ 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" }]), ao([{ type: "Float32", name: "offsetX" }]), ao([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]), ao([{ type: "Uint16", name: "textAnchor" }, { type: "Float32", components: 2, name: "textOffset" }]);
        var Ih = 24;
        const Eh = { "!": "\uFE15", "#": "\uFF03", $: "\uFF04", "%": "\uFF05", "&": "\uFF06", "(": "\uFE35", ")": "\uFE36", "*": "\uFF0A", "+": "\uFF0B", ",": "\uFE10", "-": "\uFE32", ".": "\u30FB", "/": "\uFF0F", ":": "\uFE13", ";": "\uFE14", "<": "\uFE3F", "=": "\uFF1D", ">": "\uFE40", "?": "\uFE16", "@": "\uFF20", "[": "\uFE47", "\\": "\uFF3C", "]": "\uFE48", "^": "\uFF3E", _: "\uFE33", "`": "\uFF40", "{": "\uFE37", "|": "\u2015", "}": "\uFE38", "~": "\uFF5E", "\xA2": "\uFFE0", "\xA3": "\uFFE1", "\xA5": "\uFFE5", "\xA6": "\uFFE4", "\xAC": "\uFFE2", "\xAF": "\uFFE3", "\u2013": "\uFE32", "\u2014": "\uFE31", "\u2018": "\uFE43", "\u2019": "\uFE44", "\u201C": "\uFE41", "\u201D": "\uFE42", "\u2026": "\uFE19", "\u22EF": "\uFE19", "\u2027": "\u30FB", "\u20A9": "\uFFE6", "\u3001": "\uFE11", "\u3002": "\uFE12", "\u3008": "\uFE3F", "\u3009": "\uFE40", "\u300A": "\uFE3D", "\u300B": "\uFE3E", "\u300C": "\uFE41", "\u300D": "\uFE42", "\u300E": "\uFE43", "\u300F": "\uFE44", "\u3010": "\uFE3B", "\u3011": "\uFE3C", "\u3014": "\uFE39", "\u3015": "\uFE3A", "\u3016": "\uFE17", "\u3017": "\uFE18", "\uFF01": "\uFE15", "\uFF08": "\uFE35", "\uFF09": "\uFE36", "\uFF0C": "\uFE10", "\uFF0D": "\uFE32", "\uFF0E": "\u30FB", "\uFF1A": "\uFE13", "\uFF1B": "\uFE14", "\uFF1C": "\uFE3F", "\uFF1E": "\uFE40", "\uFF1F": "\uFE16", "\uFF3B": "\uFE47", "\uFF3D": "\uFE48", "\uFF3F": "\uFE33", "\uFF5B": "\uFE37", "\uFF5C": "\u2015", "\uFF5D": "\uFE38", "\uFF5F": "\uFE35", "\uFF60": "\uFE36", "\uFF61": "\uFE12", "\uFF62": "\uFE41", "\uFF63": "\uFE42" }, Th = { 10: true, 32: true, 38: true, 41: true, 43: true, 45: true, 47: true, 173: true, 183: true, 8203: true, 8208: true, 8211: true, 8231: true }, Fh = { 40: true };
        function Ph(t2, e2, n2, r2, i2, s2) {
          if ("fontStack" in e2) {
            const r3 = n2[e2.fontStack], s3 = null == r3 ? void 0 : r3[t2];
            return s3 ? s3.metrics.advance * e2.scale + i2 : 0;
          }
          {
            const t3 = r2[e2.imageName];
            return t3 ? t3.displaySize[0] * e2.scale * Ih / s2 + i2 : 0;
          }
        }
        function Dh(t2, e2, n2, r2) {
          const i2 = Math.pow(t2 - e2, 2);
          return r2 ? t2 < e2 ? i2 / 2 : 2 * i2 : i2 + Math.abs(n2) * n2;
        }
        function zh(t2, e2, n2) {
          let r2 = 0;
          return 10 === t2 && (r2 -= 1e4), n2 && (r2 += 150), 40 !== t2 && 65288 !== t2 || (r2 += 50), 41 !== e2 && 65289 !== e2 || (r2 += 50), r2;
        }
        function Bh(t2, e2, n2, r2, i2, s2) {
          let o2 = null, a2 = Dh(e2, n2, i2, s2);
          for (const t3 of r2) {
            const r3 = Dh(e2 - t3.x, n2, i2, s2) + t3.badness;
            r3 <= a2 && (o2 = t3, a2 = r3);
          }
          return { index: t2, x: e2, priorBreak: o2, badness: a2 };
        }
        function Ch(t2) {
          return t2 ? Ch(t2.priorBreak).concat(t2.index) : [];
        }
        class Vh {
          constructor(t2 = "", e2 = [], n2 = []) {
            this.text = t2, this.sections = e2, this.sectionIndex = n2, this.imageSectionID = null;
          }
          static fromFeature(t2, e2) {
            const n2 = new Vh();
            for (const r2 of t2.sections) r2.image ? n2.addImageSection(r2) : n2.addTextSection(r2, e2);
            return n2;
          }
          length() {
            return [...this.text].length;
          }
          getSection(t2) {
            return this.sections[this.sectionIndex[t2]];
          }
          getSectionIndex(t2) {
            return this.sectionIndex[t2];
          }
          verticalizePunctuation() {
            this.text = (function(t2) {
              let e2 = "", n2 = { premature: true, value: void 0 };
              const r2 = t2[Symbol.iterator]();
              let i2 = r2.next();
              const s2 = t2[Symbol.iterator]();
              s2.next();
              let o2 = s2.next();
              for (; !i2.done; ) e2 += !o2.done && Ts(o2.value.codePointAt(0)) && !Eh[o2.value] || !n2.premature && Ts(n2.value.codePointAt(0)) && !Eh[n2.value] || !Eh[i2.value] ? i2.value : Eh[i2.value], n2 = { value: i2.value, premature: false }, i2 = r2.next(), o2 = s2.next();
              return e2;
            })(this.text);
          }
          hasZeroWidthSpaces() {
            return this.text.includes("\u200B");
          }
          trim() {
            const t2 = this.text.match(/^\s*/), e2 = t2 ? t2[0].length : 0, n2 = this.text.match(/\S\s*$/), r2 = n2 ? n2[0].length - 1 : 0;
            this.text = this.text.substring(e2, this.text.length - r2), this.sectionIndex = this.sectionIndex.slice(e2, this.sectionIndex.length - r2);
          }
          substring(t2, e2) {
            const n2 = [...this.text].slice(t2, e2).join(""), r2 = this.sectionIndex.slice(t2, e2);
            return new Vh(n2, this.sections, r2);
          }
          toCodeUnitIndex(t2) {
            return [...this.text].slice(0, t2).join("").length;
          }
          toString() {
            return this.text;
          }
          getMaxScale() {
            return this.sectionIndex.reduce(((t2, e2) => Math.max(t2, this.sections[e2].scale)), 0);
          }
          getMaxImageSize(t2) {
            let e2 = 0, n2 = 0;
            for (let r2 = 0; r2 < this.length(); r2++) {
              const i2 = this.getSection(r2);
              if ("imageName" in i2) {
                const r3 = t2[i2.imageName];
                if (!r3) continue;
                const s2 = r3.displaySize;
                e2 = Math.max(e2, s2[0]), n2 = Math.max(n2, s2[1]);
              }
            }
            return { maxImageWidth: e2, maxImageHeight: n2 };
          }
          addTextSection(t2, e2) {
            this.text += t2.text, this.sections.push({ scale: t2.scale || 1, verticalAlign: t2.verticalAlign || "bottom", fontStack: t2.fontStack || e2 });
            const n2 = this.sections.length - 1;
            this.sectionIndex.push(...[...t2.text].map((() => n2)));
          }
          addImageSection(t2) {
            const e2 = t2.image ? t2.image.name : "";
            if (0 === e2.length) return void G("Can't add FormattedSection with an empty image.");
            const n2 = this.getNextImageSectionCharCode();
            n2 ? (this.text += String.fromCharCode(n2), this.sections.push({ scale: 1, verticalAlign: t2.verticalAlign || "bottom", imageName: e2 }), this.sectionIndex.push(this.sections.length - 1)) : G("Reached maximum number of images 6401");
          }
          getNextImageSectionCharCode() {
            return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
          }
          determineLineBreaks(t2, e2, n2, r2, i2) {
            const s2 = [], o2 = this.determineAverageLineWidth(t2, e2, n2, r2, i2), a2 = this.hasZeroWidthSpaces();
            let l2 = 0, u2 = 0;
            const c2 = this.text[Symbol.iterator]();
            let h2 = c2.next();
            const p2 = this.text[Symbol.iterator]();
            p2.next();
            let f2 = p2.next();
            const d2 = this.text[Symbol.iterator]();
            d2.next(), d2.next();
            let y2 = d2.next();
            for (; !h2.done; ) {
              const e3 = this.getSection(u2), m2 = h2.value.codePointAt(0);
              if (Ss(m2) || (l2 += Ph(m2, e3, n2, r2, t2, i2)), !f2.done) {
                const t3 = ws(m2), n3 = f2.value.codePointAt(0);
                (Th[m2] || t3 || "imageName" in e3 || !y2.done && Fh[n3]) && s2.push(Bh(u2 + 1, l2, o2, s2, zh(m2, n3, t3 && a2), false));
              }
              u2++, h2 = c2.next(), f2 = p2.next(), y2 = d2.next();
            }
            return Ch(Bh(this.length(), l2, o2, s2, 0, true));
          }
          determineAverageLineWidth(t2, e2, n2, r2, i2) {
            let s2 = 0, o2 = 0;
            for (const e3 of this.text) {
              const a2 = this.getSection(o2);
              s2 += Ph(e3.codePointAt(0), a2, n2, r2, t2, i2), o2++;
            }
            return s2 / Math.max(1, Math.ceil(s2 / e2));
          }
        }
        const Lh = 4294967296, Oh = 1 / Lh, $h = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf-8");
        class Rh {
          constructor(t2 = new Uint8Array(16)) {
            this.buf = ArrayBuffer.isView(t2) ? t2 : new Uint8Array(t2), this.dataView = new DataView(this.buf.buffer), this.pos = 0, this.type = 0, this.length = this.buf.length;
          }
          readFields(t2, e2, n2 = this.length) {
            for (; this.pos < n2; ) {
              const n3 = this.readVarint(), r2 = n3 >> 3, i2 = this.pos;
              this.type = 7 & n3, t2(r2, e2, this), this.pos === i2 && this.skip(n3);
            }
            return e2;
          }
          readMessage(t2, e2) {
            return this.readFields(t2, e2, this.readVarint() + this.pos);
          }
          readFixed32() {
            const t2 = this.dataView.getUint32(this.pos, true);
            return this.pos += 4, t2;
          }
          readSFixed32() {
            const t2 = this.dataView.getInt32(this.pos, true);
            return this.pos += 4, t2;
          }
          readFixed64() {
            const t2 = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * Lh;
            return this.pos += 8, t2;
          }
          readSFixed64() {
            const t2 = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * Lh;
            return this.pos += 8, t2;
          }
          readFloat() {
            const t2 = this.dataView.getFloat32(this.pos, true);
            return this.pos += 4, t2;
          }
          readDouble() {
            const t2 = this.dataView.getFloat64(this.pos, true);
            return this.pos += 8, t2;
          }
          readVarint(t2) {
            const e2 = this.buf;
            let n2, r2;
            return r2 = e2[this.pos++], n2 = 127 & r2, r2 < 128 ? n2 : (r2 = e2[this.pos++], n2 |= (127 & r2) << 7, r2 < 128 ? n2 : (r2 = e2[this.pos++], n2 |= (127 & r2) << 14, r2 < 128 ? n2 : (r2 = e2[this.pos++], n2 |= (127 & r2) << 21, r2 < 128 ? n2 : (r2 = e2[this.pos], n2 |= (15 & r2) << 28, (function(t3, e3, n3) {
              const r3 = n3.buf;
              let i2, s2;
              if (s2 = r3[n3.pos++], i2 = (112 & s2) >> 4, s2 < 128) return Nh(t3, i2, e3);
              if (s2 = r3[n3.pos++], i2 |= (127 & s2) << 3, s2 < 128) return Nh(t3, i2, e3);
              if (s2 = r3[n3.pos++], i2 |= (127 & s2) << 10, s2 < 128) return Nh(t3, i2, e3);
              if (s2 = r3[n3.pos++], i2 |= (127 & s2) << 17, s2 < 128) return Nh(t3, i2, e3);
              if (s2 = r3[n3.pos++], i2 |= (127 & s2) << 24, s2 < 128) return Nh(t3, i2, e3);
              if (s2 = r3[n3.pos++], i2 |= (1 & s2) << 31, s2 < 128) return Nh(t3, i2, e3);
              throw new Error("Expected varint not more than 10 bytes");
            })(n2, t2, this)))));
          }
          readVarint64() {
            return this.readVarint(true);
          }
          readSVarint() {
            const t2 = this.readVarint();
            return t2 % 2 == 1 ? (t2 + 1) / -2 : t2 / 2;
          }
          readBoolean() {
            return Boolean(this.readVarint());
          }
          readString() {
            const t2 = this.readVarint() + this.pos, e2 = this.pos;
            return this.pos = t2, t2 - e2 >= 12 && $h ? $h.decode(this.buf.subarray(e2, t2)) : (function(t3, e3, n2) {
              let r2 = "", i2 = e3;
              for (; i2 < n2; ) {
                const e4 = t3[i2];
                let s2, o2, a2, l2 = null, u2 = e4 > 239 ? 4 : e4 > 223 ? 3 : e4 > 191 ? 2 : 1;
                if (i2 + u2 > n2) break;
                1 === u2 ? e4 < 128 && (l2 = e4) : 2 === u2 ? (s2 = t3[i2 + 1], 128 == (192 & s2) && (l2 = (31 & e4) << 6 | 63 & s2, l2 <= 127 && (l2 = null))) : 3 === u2 ? (s2 = t3[i2 + 1], o2 = t3[i2 + 2], 128 == (192 & s2) && 128 == (192 & o2) && (l2 = (15 & e4) << 12 | (63 & s2) << 6 | 63 & o2, (l2 <= 2047 || l2 >= 55296 && l2 <= 57343) && (l2 = null))) : 4 === u2 && (s2 = t3[i2 + 1], o2 = t3[i2 + 2], a2 = t3[i2 + 3], 128 == (192 & s2) && 128 == (192 & o2) && 128 == (192 & a2) && (l2 = (15 & e4) << 18 | (63 & s2) << 12 | (63 & o2) << 6 | 63 & a2, (l2 <= 65535 || l2 >= 1114112) && (l2 = null))), null === l2 ? (l2 = 65533, u2 = 1) : l2 > 65535 && (l2 -= 65536, r2 += String.fromCharCode(l2 >>> 10 & 1023 | 55296), l2 = 56320 | 1023 & l2), r2 += String.fromCharCode(l2), i2 += u2;
              }
              return r2;
            })(this.buf, e2, t2);
          }
          readBytes() {
            const t2 = this.readVarint() + this.pos, e2 = this.buf.subarray(this.pos, t2);
            return this.pos = t2, e2;
          }
          readPackedVarint(t2 = [], e2) {
            const n2 = this.readPackedEnd();
            for (; this.pos < n2; ) t2.push(this.readVarint(e2));
            return t2;
          }
          readPackedSVarint(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readSVarint());
            return t2;
          }
          readPackedBoolean(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readBoolean());
            return t2;
          }
          readPackedFloat(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readFloat());
            return t2;
          }
          readPackedDouble(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readDouble());
            return t2;
          }
          readPackedFixed32(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readFixed32());
            return t2;
          }
          readPackedSFixed32(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readSFixed32());
            return t2;
          }
          readPackedFixed64(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readFixed64());
            return t2;
          }
          readPackedSFixed64(t2 = []) {
            const e2 = this.readPackedEnd();
            for (; this.pos < e2; ) t2.push(this.readSFixed64());
            return t2;
          }
          readPackedEnd() {
            return 2 === this.type ? this.readVarint() + this.pos : this.pos + 1;
          }
          skip(t2) {
            const e2 = 7 & t2;
            if (0 === e2) for (; this.buf[this.pos++] > 127; ) ;
            else if (2 === e2) this.pos = this.readVarint() + this.pos;
            else if (5 === e2) this.pos += 4;
            else {
              if (1 !== e2) throw new Error(`Unimplemented type: ${e2}`);
              this.pos += 8;
            }
          }
          writeTag(t2, e2) {
            this.writeVarint(t2 << 3 | e2);
          }
          realloc(t2) {
            let e2 = this.length || 16;
            for (; e2 < this.pos + t2; ) e2 *= 2;
            if (e2 !== this.length) {
              const t3 = new Uint8Array(e2);
              t3.set(this.buf), this.buf = t3, this.dataView = new DataView(t3.buffer), this.length = e2;
            }
          }
          finish() {
            return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
          }
          writeFixed32(t2) {
            this.realloc(4), this.dataView.setInt32(this.pos, t2, true), this.pos += 4;
          }
          writeSFixed32(t2) {
            this.realloc(4), this.dataView.setInt32(this.pos, t2, true), this.pos += 4;
          }
          writeFixed64(t2) {
            this.realloc(8), this.dataView.setInt32(this.pos, -1 & t2, true), this.dataView.setInt32(this.pos + 4, Math.floor(t2 * Oh), true), this.pos += 8;
          }
          writeSFixed64(t2) {
            this.realloc(8), this.dataView.setInt32(this.pos, -1 & t2, true), this.dataView.setInt32(this.pos + 4, Math.floor(t2 * Oh), true), this.pos += 8;
          }
          writeVarint(t2) {
            (t2 = +t2 || 0) > 268435455 || t2 < 0 ? (function(t3, e2) {
              let n2, r2;
              if (t3 >= 0 ? (n2 = t3 % 4294967296 | 0, r2 = t3 / 4294967296 | 0) : (n2 = ~(-t3 % 4294967296), r2 = ~(-t3 / 4294967296), 4294967295 ^ n2 ? n2 = n2 + 1 | 0 : (n2 = 0, r2 = r2 + 1 | 0)), t3 >= 18446744073709552e3 || t3 < -18446744073709552e3) throw new Error("Given varint doesn't fit into 10 bytes");
              e2.realloc(10), (function(t4, e3, n3) {
                n3.buf[n3.pos++] = 127 & t4 | 128, t4 >>>= 7, n3.buf[n3.pos++] = 127 & t4 | 128, t4 >>>= 7, n3.buf[n3.pos++] = 127 & t4 | 128, t4 >>>= 7, n3.buf[n3.pos++] = 127 & t4 | 128, n3.buf[n3.pos] = 127 & (t4 >>>= 7);
              })(n2, 0, e2), (function(t4, e3) {
                const n3 = (7 & t4) << 4;
                e3.buf[e3.pos++] |= n3 | ((t4 >>>= 3) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4 | ((t4 >>>= 7) ? 128 : 0), t4 && (e3.buf[e3.pos++] = 127 & t4)))));
              })(r2, e2);
            })(t2, this) : (this.realloc(4), this.buf[this.pos++] = 127 & t2 | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = 127 & (t2 >>>= 7) | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = 127 & (t2 >>>= 7) | (t2 > 127 ? 128 : 0), t2 <= 127 || (this.buf[this.pos++] = t2 >>> 7 & 127))));
          }
          writeSVarint(t2) {
            this.writeVarint(t2 < 0 ? 2 * -t2 - 1 : 2 * t2);
          }
          writeBoolean(t2) {
            this.writeVarint(+t2);
          }
          writeString(t2) {
            t2 = String(t2), this.realloc(4 * t2.length), this.pos++;
            const e2 = this.pos;
            this.pos = (function(t3, e3, n3) {
              for (let r2, i2, s2 = 0; s2 < e3.length; s2++) {
                if (r2 = e3.charCodeAt(s2), r2 > 55295 && r2 < 57344) {
                  if (!i2) {
                    r2 > 56319 || s2 + 1 === e3.length ? (t3[n3++] = 239, t3[n3++] = 191, t3[n3++] = 189) : i2 = r2;
                    continue;
                  }
                  if (r2 < 56320) {
                    t3[n3++] = 239, t3[n3++] = 191, t3[n3++] = 189, i2 = r2;
                    continue;
                  }
                  r2 = i2 - 55296 << 10 | r2 - 56320 | 65536, i2 = null;
                } else i2 && (t3[n3++] = 239, t3[n3++] = 191, t3[n3++] = 189, i2 = null);
                r2 < 128 ? t3[n3++] = r2 : (r2 < 2048 ? t3[n3++] = r2 >> 6 | 192 : (r2 < 65536 ? t3[n3++] = r2 >> 12 | 224 : (t3[n3++] = r2 >> 18 | 240, t3[n3++] = r2 >> 12 & 63 | 128), t3[n3++] = r2 >> 6 & 63 | 128), t3[n3++] = 63 & r2 | 128);
              }
              return n3;
            })(this.buf, t2, this.pos);
            const n2 = this.pos - e2;
            n2 >= 128 && Uh(e2, n2, this), this.pos = e2 - 1, this.writeVarint(n2), this.pos += n2;
          }
          writeFloat(t2) {
            this.realloc(4), this.dataView.setFloat32(this.pos, t2, true), this.pos += 4;
          }
          writeDouble(t2) {
            this.realloc(8), this.dataView.setFloat64(this.pos, t2, true), this.pos += 8;
          }
          writeBytes(t2) {
            const e2 = t2.length;
            this.writeVarint(e2), this.realloc(e2);
            for (let n2 = 0; n2 < e2; n2++) this.buf[this.pos++] = t2[n2];
          }
          writeRawMessage(t2, e2) {
            this.pos++;
            const n2 = this.pos;
            t2(e2, this);
            const r2 = this.pos - n2;
            r2 >= 128 && Uh(n2, r2, this), this.pos = n2 - 1, this.writeVarint(r2), this.pos += r2;
          }
          writeMessage(t2, e2, n2) {
            this.writeTag(t2, 2), this.writeRawMessage(e2, n2);
          }
          writePackedVarint(t2, e2) {
            e2.length && this.writeMessage(t2, jh, e2);
          }
          writePackedSVarint(t2, e2) {
            e2.length && this.writeMessage(t2, qh, e2);
          }
          writePackedBoolean(t2, e2) {
            e2.length && this.writeMessage(t2, Yh, e2);
          }
          writePackedFloat(t2, e2) {
            e2.length && this.writeMessage(t2, Gh, e2);
          }
          writePackedDouble(t2, e2) {
            e2.length && this.writeMessage(t2, Xh, e2);
          }
          writePackedFixed32(t2, e2) {
            e2.length && this.writeMessage(t2, Zh, e2);
          }
          writePackedSFixed32(t2, e2) {
            e2.length && this.writeMessage(t2, Hh, e2);
          }
          writePackedFixed64(t2, e2) {
            e2.length && this.writeMessage(t2, Wh, e2);
          }
          writePackedSFixed64(t2, e2) {
            e2.length && this.writeMessage(t2, Kh, e2);
          }
          writeBytesField(t2, e2) {
            this.writeTag(t2, 2), this.writeBytes(e2);
          }
          writeFixed32Field(t2, e2) {
            this.writeTag(t2, 5), this.writeFixed32(e2);
          }
          writeSFixed32Field(t2, e2) {
            this.writeTag(t2, 5), this.writeSFixed32(e2);
          }
          writeFixed64Field(t2, e2) {
            this.writeTag(t2, 1), this.writeFixed64(e2);
          }
          writeSFixed64Field(t2, e2) {
            this.writeTag(t2, 1), this.writeSFixed64(e2);
          }
          writeVarintField(t2, e2) {
            this.writeTag(t2, 0), this.writeVarint(e2);
          }
          writeSVarintField(t2, e2) {
            this.writeTag(t2, 0), this.writeSVarint(e2);
          }
          writeStringField(t2, e2) {
            this.writeTag(t2, 2), this.writeString(e2);
          }
          writeFloatField(t2, e2) {
            this.writeTag(t2, 5), this.writeFloat(e2);
          }
          writeDoubleField(t2, e2) {
            this.writeTag(t2, 1), this.writeDouble(e2);
          }
          writeBooleanField(t2, e2) {
            this.writeVarintField(t2, +e2);
          }
        }
        function Nh(t2, e2, n2) {
          return n2 ? 4294967296 * e2 + (t2 >>> 0) : 4294967296 * (e2 >>> 0) + (t2 >>> 0);
        }
        function Uh(t2, e2, n2) {
          const r2 = e2 <= 16383 ? 1 : e2 <= 2097151 ? 2 : e2 <= 268435455 ? 3 : Math.floor(Math.log(e2) / (7 * Math.LN2));
          n2.realloc(r2);
          for (let e3 = n2.pos - 1; e3 >= t2; e3--) n2.buf[e3 + r2] = n2.buf[e3];
        }
        function jh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeVarint(t2[n2]);
        }
        function qh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeSVarint(t2[n2]);
        }
        function Gh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeFloat(t2[n2]);
        }
        function Xh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeDouble(t2[n2]);
        }
        function Yh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeBoolean(t2[n2]);
        }
        function Zh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeFixed32(t2[n2]);
        }
        function Hh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeSFixed32(t2[n2]);
        }
        function Wh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeFixed64(t2[n2]);
        }
        function Kh(t2, e2) {
          for (let n2 = 0; n2 < t2.length; n2++) e2.writeSFixed64(t2[n2]);
        }
        function Jh(t2, e2, n2) {
          1 === t2 && n2.readMessage(Qh, e2);
        }
        function Qh(t2, e2, n2) {
          if (3 === t2) {
            const { id: t3, bitmap: r2, width: i2, height: s2, left: o2, top: a2, advance: l2 } = n2.readMessage(tp, {});
            e2.push({ id: t3, bitmap: new kl({ width: i2 + 6, height: s2 + 6 }, r2), metrics: { width: i2, height: s2, left: o2, top: a2, advance: l2 } });
          }
        }
        function tp(t2, e2, n2) {
          1 === t2 ? e2.id = n2.readVarint() : 2 === t2 ? e2.bitmap = n2.readBytes() : 3 === t2 ? e2.width = n2.readVarint() : 4 === t2 ? e2.height = n2.readVarint() : 5 === t2 ? e2.left = n2.readSVarint() : 6 === t2 ? e2.top = n2.readSVarint() : 7 === t2 && (e2.advance = n2.readVarint());
        }
        function ep(t2) {
          let e2 = 0, n2 = 0;
          for (const r3 of t2) e2 += r3.w * r3.h, n2 = Math.max(n2, r3.w);
          t2.sort(((t3, e3) => e3.h - t3.h));
          const r2 = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e2 / 0.95)), n2), h: 1 / 0 }];
          let i2 = 0, s2 = 0;
          for (const e3 of t2) for (let t3 = r2.length - 1; t3 >= 0; t3--) {
            const n3 = r2[t3];
            if (!(e3.w > n3.w || e3.h > n3.h)) {
              if (e3.x = n3.x, e3.y = n3.y, s2 = Math.max(s2, e3.y + e3.h), i2 = Math.max(i2, e3.x + e3.w), e3.w === n3.w && e3.h === n3.h) {
                const e4 = r2.pop();
                e4 && t3 < r2.length && (r2[t3] = e4);
              } else e3.h === n3.h ? (n3.x += e3.w, n3.w -= e3.w) : e3.w === n3.w ? (n3.y += e3.h, n3.h -= e3.h) : (r2.push({ x: n3.x + e3.w, y: n3.y, w: n3.w - e3.w, h: e3.h }), n3.y += e3.h, n3.h -= e3.h);
              break;
            }
          }
          return { w: i2, h: s2, fill: e2 / (i2 * s2) || 0 };
        }
        class np {
          constructor(t2, { pixelRatio: e2, version: n2, stretchX: r2, stretchY: i2, content: s2, textFitWidth: o2, textFitHeight: a2 }) {
            this.paddedRect = t2, this.pixelRatio = e2, this.stretchX = r2, this.stretchY = i2, this.content = s2, this.version = n2, this.textFitWidth = o2, this.textFitHeight = a2;
          }
          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(t2, e2) {
            const n2 = {}, r2 = {};
            this.haveRenderCallbacks = [];
            const i2 = [];
            this.addImages(t2, n2, i2), this.addImages(e2, r2, i2);
            const { w: s2, h: o2 } = ep(i2), a2 = new Il({ width: s2 || 1, height: o2 || 1 });
            for (const e3 in t2) {
              const r3 = t2[e3], i3 = n2[e3].paddedRect;
              Il.copy(r3.data, a2, { x: 0, y: 0 }, { x: i3.x + 1, y: i3.y + 1 }, r3.data);
            }
            for (const t3 in e2) {
              const n3 = e2[t3], i3 = r2[t3].paddedRect, s3 = i3.x + 1, o3 = i3.y + 1, l2 = n3.data.width, u2 = n3.data.height;
              Il.copy(n3.data, a2, { x: 0, y: 0 }, { x: s3, y: o3 }, n3.data), Il.copy(n3.data, a2, { x: 0, y: u2 - 1 }, { x: s3, y: o3 - 1 }, { width: l2, height: 1 }), Il.copy(n3.data, a2, { x: 0, y: 0 }, { x: s3, y: o3 + u2 }, { width: l2, height: 1 }), Il.copy(n3.data, a2, { x: l2 - 1, y: 0 }, { x: s3 - 1, y: o3 }, { width: 1, height: u2 }), Il.copy(n3.data, a2, { x: 0, y: 0 }, { x: s3 + l2, y: o3 }, { width: 1, height: u2 });
            }
            this.image = a2, this.iconPositions = n2, this.patternPositions = r2;
          }
          addImages(t2, e2, n2) {
            for (const r2 in t2) {
              const i2 = t2[r2], s2 = { x: 0, y: 0, w: i2.data.width + 2, h: i2.data.height + 2 };
              n2.push(s2), e2[r2] = new np(s2, i2), i2.hasRenderCallback && this.haveRenderCallbacks.push(r2);
            }
          }
          patchUpdatedImages(t2, e2) {
            t2.dispatchRenderCallbacks(this.haveRenderCallbacks);
            for (const n2 in t2.updatedImages) this.patchUpdatedImage(this.iconPositions[n2], t2.getImage(n2), e2), this.patchUpdatedImage(this.patternPositions[n2], t2.getImage(n2), e2);
          }
          patchUpdatedImage(t2, e2, n2) {
            if (!t2 || !e2) return;
            if (t2.version === e2.version) return;
            t2.version = e2.version;
            const [r2, i2] = t2.tl;
            n2.update(e2.data, void 0, { x: r2, y: i2 });
          }
        }
        var ip;
        function sp(e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2) {
          const m2 = Vh.fromFeature(e2, s2);
          let g2;
          p2 === t.ax.vertical && m2.verticalizePunctuation();
          let x2 = m2.determineLineBreaks(c2, o2, n2, i2, d2);
          const { processBidirectionalText: v2, processStyledBidirectionalText: b2 } = Bs;
          if (v2 && 1 === m2.sections.length) {
            g2 = [], x2 = x2.map(((t3) => m2.toCodeUnitIndex(t3)));
            const t2 = v2(m2.toString(), x2);
            for (const e3 of t2) {
              const t3 = [...e3].map((() => 0));
              g2.push(new Vh(e3, m2.sections, t3));
            }
          } else if (b2) {
            g2 = [], x2 = x2.map(((t3) => m2.toCodeUnitIndex(t3)));
            let t2 = 0;
            const e3 = [];
            for (const n4 of m2.text) e3.push(...Array(n4.length).fill(m2.sectionIndex[t2])), t2++;
            const n3 = b2(m2.text, e3, x2);
            for (const t3 of n3) {
              const e4 = [];
              let n4 = "";
              for (const r3 of t3[0]) e4.push(t3[1][n4.length]), n4 += r3;
              g2.push(new Vh(t3[0], m2.sections, e4));
            }
          } else g2 = (function(t2, e3) {
            const n3 = [];
            let r3 = 0;
            for (const i3 of e3) n3.push(t2.substring(r3, i3)), r3 = i3;
            return r3 < t2.length() && n3.push(t2.substring(r3, t2.length())), n3;
          })(m2, x2);
          const w2 = [], _2 = { positionedLines: w2, text: m2.toString(), top: h2[1], bottom: h2[1], left: h2[0], right: h2[0], writingMode: p2, iconsInText: false, verticalizable: false };
          return (function(t2, e3, n3, r3, i3, s3, o3, a3, l3, u3, c3, h3) {
            let p3 = 0, f3 = 0, d3 = 0, y3 = 0;
            const m3 = "right" === a3 ? 1 : "left" === a3 ? 0 : 0.5, g3 = Ih / h3;
            let x3 = 0;
            for (const o4 of i3) {
              o4.trim();
              const i4 = o4.getMaxScale(), a4 = { positionedGlyphs: [], lineOffset: 0 };
              t2.positionedLines[x3] = a4;
              const h4 = a4.positionedGlyphs;
              let v4 = 0;
              if (!o4.length()) {
                f3 += s3, ++x3;
                continue;
              }
              const b4 = ap(r3, o4, g3);
              let w3 = 0;
              for (const s4 of o4.text) {
                const a5 = o4.getSection(w3), d4 = s4.codePointAt(0), y4 = up(l3, c3, d4), m4 = { glyph: d4, imageName: null, x: p3, y: f3 + -17, vertical: y4, scale: 1, fontStack: "", sectionIndex: o4.getSectionIndex(w3), metrics: null, rect: null };
                let x4;
                if ("fontStack" in a5) {
                  if (x4 = cp(a5, d4, y4, b4, e3, n3), !x4) continue;
                  m4.fontStack = a5.fontStack;
                } else {
                  if (t2.iconsInText = true, a5.scale *= g3, x4 = hp(a5, y4, i4, b4, r3), !x4) continue;
                  v4 = Math.max(v4, x4.imageOffset), m4.imageName = a5.imageName;
                }
                const { rect: _4, metrics: S2, baselineOffset: A2 } = x4;
                m4.y += A2, m4.scale = a5.scale, m4.metrics = S2, m4.rect = _4, h4.push(m4), y4 ? (t2.verticalizable = true, p3 += ("imageName" in a5 ? S2.advance : Ih) * a5.scale + u3) : p3 += S2.advance * a5.scale + u3, w3++;
              }
              0 !== h4.length && (d3 = Math.max(p3 - u3, d3), pp(h4, 0, h4.length - 1, m3)), p3 = 0, a4.lineOffset = Math.max(v4, (i4 - 1) * Ih);
              const _3 = s3 * i4 + v4;
              f3 += _3, y3 = Math.max(_3, y3), ++x3;
            }
            const { horizontalAlign: v3, verticalAlign: b3 } = op(o3);
            ((function(t3, e4, n4, r4, i4, s4, o4, a4, l4) {
              const u4 = (e4 - n4) * i4;
              let c4 = 0;
              c4 = s4 !== o4 ? -a4 * r4 - -17 : -r4 * l4 * o4 + 0.5 * o4;
              for (const e5 of t3) for (const t4 of e5.positionedGlyphs) t4.x += u4, t4.y += c4;
            }))(t2.positionedLines, m3, v3, b3, d3, y3, s3, f3, i3.length), t2.top += -b3 * f3, t2.bottom = t2.top + f3, t2.left += -v3 * d3, t2.right = t2.left + d3;
          })(_2, n2, r2, i2, g2, a2, l2, u2, p2, c2, f2, y2), !(function(t2) {
            for (const e3 of t2) if (0 !== e3.positionedGlyphs.length) return false;
            return true;
          })(w2) && _2;
        }
        function op(t2) {
          let e2 = 0.5, n2 = 0.5;
          switch (t2) {
            case "right":
            case "top-right":
            case "bottom-right":
              e2 = 1;
              break;
            case "left":
            case "top-left":
            case "bottom-left":
              e2 = 0;
          }
          switch (t2) {
            case "bottom":
            case "bottom-right":
            case "bottom-left":
              n2 = 1;
              break;
            case "top":
            case "top-right":
            case "top-left":
              n2 = 0;
          }
          return { horizontalAlign: e2, verticalAlign: n2 };
        }
        function ap(t2, e2, n2) {
          const r2 = e2.getMaxScale() * Ih, { maxImageWidth: i2, maxImageHeight: s2 } = e2.getMaxImageSize(t2), o2 = Math.max(r2, s2 * n2);
          return { verticalLineContentWidth: Math.max(r2, i2 * n2), horizontalLineContentHeight: o2 };
        }
        function lp(t2) {
          switch (t2) {
            case "top":
              return 0;
            case "center":
              return 0.5;
            default:
              return 1;
          }
        }
        function up(e2, n2, r2) {
          return !(e2 === t.ax.horizontal || !n2 && !_s(r2) || n2 && (Ss(r2) || (i2 = r2, /\p{sc=Arab}/u.test(String.fromCodePoint(i2)))));
          var i2;
        }
        function cp(t2, e2, n2, r2, i2, s2) {
          const o2 = s2[t2.fontStack], a2 = (function(t3, e3, n3, r3) {
            if (null == t3 ? void 0 : t3.rect) return t3;
            const i3 = e3[n3.fontStack], s3 = null == i3 ? void 0 : i3[r3];
            return s3 ? { rect: null, metrics: s3.metrics } : null;
          })(null == o2 ? void 0 : o2[e2], i2, t2, e2);
          if (null === a2) return null;
          let l2;
          if (n2) l2 = r2.verticalLineContentWidth - t2.scale * Ih;
          else {
            const e3 = lp(t2.verticalAlign);
            l2 = (r2.horizontalLineContentHeight - t2.scale * Ih) * e3;
          }
          return { rect: a2.rect, metrics: a2.metrics, baselineOffset: l2 };
        }
        function hp(t2, e2, n2, r2, i2) {
          const s2 = i2[t2.imageName];
          if (!s2) return null;
          const o2 = s2.paddedRect, a2 = s2.displaySize, l2 = { width: a2[0], height: a2[1], left: 1, top: -3, advance: e2 ? a2[1] : a2[0] };
          let u2;
          if (e2) u2 = r2.verticalLineContentWidth - a2[1] * t2.scale;
          else {
            const e3 = lp(t2.verticalAlign);
            u2 = (r2.horizontalLineContentHeight - a2[1] * t2.scale) * e3;
          }
          return { rect: o2, metrics: l2, baselineOffset: u2, imageOffset: (e2 ? a2[0] : a2[1]) * t2.scale - Ih * n2 };
        }
        function pp(t2, e2, n2, r2) {
          if (0 === r2) return;
          const i2 = t2[n2], s2 = (t2[n2].x + i2.metrics.advance * i2.scale) * r2;
          for (let r3 = e2; r3 <= n2; r3++) t2[r3].x -= s2;
        }
        function fp(t2, e2, n2) {
          const { horizontalAlign: r2, verticalAlign: i2 } = op(n2), s2 = e2[0] - t2.displaySize[0] * r2, o2 = e2[1] - t2.displaySize[1] * i2;
          return { image: t2, top: o2, bottom: o2 + t2.displaySize[1], left: s2, right: s2 + t2.displaySize[0] };
        }
        function dp(t2) {
          var e2, n2;
          let r2 = t2.left, i2 = t2.top, s2 = t2.right - r2, o2 = t2.bottom - i2;
          const a2 = null !== (e2 = t2.image.textFitWidth) && void 0 !== e2 ? e2 : "stretchOrShrink", l2 = null !== (n2 = t2.image.textFitHeight) && void 0 !== n2 ? n2 : "stretchOrShrink", u2 = (t2.image.content[2] - t2.image.content[0]) / (t2.image.content[3] - t2.image.content[1]);
          if ("proportional" === l2) {
            if ("stretchOnly" === a2 && s2 / o2 < u2 || "proportional" === a2) {
              const t3 = Math.ceil(o2 * u2);
              r2 *= t3 / s2, s2 = t3;
            }
          } else if ("proportional" === a2 && "stretchOnly" === l2 && 0 !== u2 && s2 / o2 > u2) {
            const t3 = Math.ceil(s2 / u2);
            i2 *= t3 / o2, o2 = t3;
          }
          return { x1: r2, y1: i2, x2: r2 + s2, y2: i2 + o2 };
        }
        function yp(t2, e2, n2, r2, i2, s2) {
          const o2 = t2.image;
          let a2;
          if (o2.content) {
            const t3 = o2.content, e3 = o2.pixelRatio || 1;
            a2 = [t3[0] / e3, t3[1] / e3, o2.displaySize[0] - t3[2] / e3, o2.displaySize[1] - t3[3] / e3];
          }
          const l2 = e2.left * s2, u2 = e2.right * s2;
          let c2, h2, p2, f2;
          "width" === n2 || "both" === n2 ? (f2 = i2[0] + l2 - r2[3], h2 = i2[0] + u2 + r2[1]) : (f2 = i2[0] + (l2 + u2 - o2.displaySize[0]) / 2, h2 = f2 + o2.displaySize[0]);
          const d2 = e2.top * s2, y2 = e2.bottom * s2;
          return "height" === n2 || "both" === n2 ? (c2 = i2[1] + d2 - r2[0], p2 = i2[1] + y2 + r2[2]) : (c2 = i2[1] + (d2 + y2 - o2.displaySize[1]) / 2, p2 = c2 + o2.displaySize[1]), { image: o2, top: c2, right: h2, bottom: p2, left: f2, collisionPadding: a2 };
        }
        ds("ImagePosition", np), ds("ImageAtlas", rp), t.ax = void 0, (ip = t.ax || (t.ax = {}))[ip.none = 0] = "none", ip[ip.horizontal = 1] = "horizontal", ip[ip.vertical = 2] = "vertical", ip[ip.horizontalOnly = 3] = "horizontalOnly";
        const mp = 128, gp = 32640;
        function xp(t2, e2) {
          const { expression: n2 } = e2;
          if ("constant" === n2.kind) return { kind: "constant", layoutSize: n2.evaluate(new Cs(t2 + 1)) };
          if ("source" === n2.kind) return { kind: "source" };
          {
            const { zoomStops: e3, interpolationType: r2 } = n2;
            let i2 = 0;
            for (; i2 < e3.length && e3[i2] <= t2; ) i2++;
            i2 = Math.max(0, i2 - 1);
            let s2 = i2;
            for (; s2 < e3.length && e3[s2] < t2 + 1; ) s2++;
            s2 = Math.min(e3.length - 1, s2);
            const o2 = e3[i2], a2 = e3[s2];
            return "composite" === n2.kind ? { kind: "composite", minZoom: o2, maxZoom: a2, interpolationType: r2 } : { kind: "camera", minZoom: o2, maxZoom: a2, minSize: n2.evaluate(new Cs(o2)), maxSize: n2.evaluate(new Cs(a2)), interpolationType: r2 };
          }
        }
        function vp(t2, e2, n2) {
          let r2 = "never";
          const i2 = t2.get(e2);
          return i2 ? r2 = i2 : t2.get(n2) && (r2 = "always"), r2;
        }
        const bp = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
        function wp(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2) {
          const f2 = a2 ? Math.min(gp, Math.round(a2[0])) : 0, d2 = a2 ? Math.min(gp, Math.round(a2[1])) : 0;
          t2.emplaceBack(e2, n2, Math.round(32 * r2), Math.round(32 * i2), s2, o2, (f2 << 1) + (l2 ? 1 : 0), d2, 16 * u2, 16 * c2, 256 * h2, 256 * p2);
        }
        function _p(t2, e2, n2) {
          t2.emplaceBack(e2.x, e2.y, n2), t2.emplaceBack(e2.x, e2.y, n2), t2.emplaceBack(e2.x, e2.y, n2), t2.emplaceBack(e2.x, e2.y, n2);
        }
        function Sp(t2) {
          for (const e2 of t2.sections) if (zs(e2.text)) return true;
          return false;
        }
        class Ap {
          constructor(t2) {
            this.layoutVertexArray = new ta(), this.indexArray = new sa(), this.programConfigurations = t2, this.segments = new ua(), this.dynamicLayoutVertexArray = new ea(), this.opacityVertexArray = new na(), this.hasVisibleVertices = false, this.placedSymbolArray = new Lo();
          }
          isEmpty() {
            return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length;
          }
          upload(t2, e2, n2, r2) {
            this.isEmpty() || (n2 && (this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, bh.members), this.indexBuffer = t2.createIndexBuffer(this.indexArray, e2), this.dynamicLayoutVertexBuffer = t2.createVertexBuffer(this.dynamicLayoutVertexArray, wh.members, true), this.opacityVertexBuffer = t2.createVertexBuffer(this.opacityVertexArray, bp, true), this.opacityVertexBuffer.itemSize = 1), (n2 || r2) && this.programConfigurations.upload(t2));
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());
          }
        }
        ds("SymbolBuffers", Ap);
        class Mp {
          constructor(t2, e2, n2) {
            this.layoutVertexArray = new t2(), this.layoutAttributes = e2, this.indexArray = new n2(), this.segments = new ua(), this.collisionVertexArray = new ia();
          }
          upload(t2) {
            this.layoutVertexBuffer = t2.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t2.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t2.createVertexBuffer(this.collisionVertexArray, _h.members, true);
          }
          destroy() {
            this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
          }
        }
        ds("CollisionBuffers", Mp);
        class kp {
          constructor(e2) {
            this.collisionBoxArray = e2.collisionBoxArray, this.zoom = e2.zoom, this.overscaling = e2.overscaling, this.layers = e2.layers, this.layerIds = this.layers.map(((t2) => t2.id)), this.index = e2.index, this.pixelRatio = e2.pixelRatio, this.sourceLayerIndex = e2.sourceLayerIndex, this.hasDependencies = false, this.hasRTLText = false, this.sortKeyRanges = [], this.collisionCircleArray = [];
            const n2 = this.layers[0]._unevaluatedLayout._values;
            this.textSizeData = xp(this.zoom, n2["text-size"]), this.iconSizeData = xp(this.zoom, n2["icon-size"]);
            const r2 = this.layers[0].layout, i2 = r2.get("symbol-sort-key"), s2 = r2.get("symbol-z-order");
            this.canOverlap = "never" !== vp(r2, "text-overlap", "text-allow-overlap") || "never" !== vp(r2, "icon-overlap", "icon-allow-overlap") || r2.get("text-ignore-placement") || r2.get("icon-ignore-placement"), this.sortFeaturesByKey = "viewport-y" !== s2 && !i2.isConstant(), this.sortFeaturesByY = ("viewport-y" === s2 || "auto" === s2 && !this.sortFeaturesByKey) && this.canOverlap, "point" === r2.get("symbol-placement") && (this.writingModes = r2.get("text-writing-mode").map(((e3) => t.ax[e3]))), this.stateDependentLayerIds = this.layers.filter(((t2) => t2.isStateDependent())).map(((t2) => t2.id)), this.sourceID = e2.sourceID;
          }
          createArrays() {
            this.text = new Ap(new $a(this.layers, this.zoom, ((t2) => t2.startsWith("text")))), this.icon = new Ap(new $a(this.layers, this.zoom, ((t2) => t2.startsWith("icon")))), this.glyphOffsetArray = new Ro(), this.lineVertexArray = new No(), this.symbolInstances = new $o(), this.textAnchorOffsets = new jo();
          }
          calculateGlyphDependencies(t2, e2, n2, r2, i2) {
            for (const s2 of t2) if (e2[s2.codePointAt(0)] = true, (n2 || r2) && i2) {
              const t3 = Eh[s2];
              t3 && (e2[t3.codePointAt(0)] = true);
            }
          }
          populate(e2, n2, r2) {
            var i2;
            const s2 = this.layers[0], o2 = s2.layout, a2 = o2.get("text-font"), l2 = o2.get("text-field"), u2 = o2.get("icon-image"), c2 = ("constant" !== l2.value.kind || l2.value.value instanceof ze && !l2.value.value.isEmpty() || l2.value.value.toString().length > 0) && ("constant" !== a2.value.kind || a2.value.value.length > 0), h2 = "constant" !== u2.value.kind || !!u2.value.value || Object.keys(u2.parameters).length > 0, p2 = o2.get("symbol-sort-key");
            if (this.features = [], !c2 && !h2) return;
            const f2 = n2.iconDependencies, d2 = n2.glyphDependencies, y2 = n2.availableImages, m2 = new Cs(this.zoom);
            for (const { feature: n3, id: l3, index: u3, sourceLayerIndex: g2 } of e2) {
              const e3 = s2._featureFilter.needGeometry, x2 = Ga(n3, e3);
              if (!s2._featureFilter.filter(m2, x2, r2)) continue;
              let v2, b2;
              if (e3 || (x2.geometry = qa(n3)), c2) {
                const t2 = s2.getValueAndResolveTokens("text-field", x2, r2, y2), e4 = ze.factory(t2);
                this.hasRTLText || (this.hasRTLText = Sp(e4)), (!this.hasRTLText || "unavailable" === Bs.getRTLTextPluginStatus() || this.hasRTLText && Bs.isParsed()) && (v2 = kh(e4, s2, x2));
              }
              if (h2) {
                const t2 = s2.getValueAndResolveTokens("icon-image", x2, r2, y2);
                b2 = t2 instanceof Re ? t2 : Re.fromString(t2);
              }
              if (!v2 && !b2) continue;
              const w2 = this.sortFeaturesByKey ? p2.evaluate(x2, {}, r2) : void 0;
              if (this.features.push({ id: l3, text: v2, icon: b2, index: u3, sourceLayerIndex: g2, geometry: x2.geometry, properties: n3.properties, type: Cu.types[n3.type], sortKey: w2 }), b2 && (f2[b2.name] = true), v2) {
                const e4 = a2.evaluate(x2, {}, r2).join(","), n4 = "viewport" !== o2.get("text-rotation-alignment") && "point" !== o2.get("symbol-placement");
                this.allowVerticalPlacement = null === (i2 = this.writingModes) || void 0 === i2 ? void 0 : i2.includes(t.ax.vertical);
                for (const t2 of v2.sections) if (t2.image) f2[t2.image.name] = true;
                else {
                  const r3 = As(v2.toString()), i3 = t2.fontStack || e4;
                  d2[i3] || (d2[i3] = {}), this.calculateGlyphDependencies(t2.text, d2[i3], n4, this.allowVerticalPlacement, r3);
                }
              }
            }
            "line" === o2.get("symbol-placement") && (this.features = (function(t2) {
              const e3 = {}, n3 = {}, r3 = [];
              let i3 = 0;
              function s3(e4) {
                r3.push(t2[e4]), i3++;
              }
              function o3(t3, e4, i4) {
                const s4 = n3[t3];
                return delete n3[t3], n3[e4] = s4, r3[s4].geometry[0].pop(), r3[s4].geometry[0] = r3[s4].geometry[0].concat(i4[0]), s4;
              }
              function a3(t3, n4, i4) {
                const s4 = e3[n4];
                return delete e3[n4], e3[t3] = s4, r3[s4].geometry[0].shift(), r3[s4].geometry[0] = i4[0].concat(r3[s4].geometry[0]), s4;
              }
              function l3(t3, e4, n4) {
                const r4 = n4 ? e4[0][e4[0].length - 1] : e4[0][0];
                return `${t3}:${r4.x}:${r4.y}`;
              }
              for (let u3 = 0; u3 < t2.length; u3++) {
                const c3 = t2[u3], h3 = c3.geometry, p3 = c3.text ? c3.text.toString() : null;
                if (!p3) {
                  s3(u3);
                  continue;
                }
                const f3 = l3(p3, h3), d3 = l3(p3, h3, true);
                if (f3 in n3 && d3 in e3 && n3[f3] !== e3[d3]) {
                  const t3 = a3(f3, d3, h3), i4 = o3(f3, d3, r3[t3].geometry);
                  delete e3[f3], delete n3[d3], n3[l3(p3, r3[i4].geometry, true)] = i4, r3[t3].geometry = null;
                } else f3 in n3 ? o3(f3, d3, h3) : d3 in e3 ? a3(f3, d3, h3) : (s3(u3), e3[f3] = i3 - 1, n3[d3] = i3 - 1);
              }
              return r3.filter(((t3) => t3.geometry));
            })(this.features)), this.sortFeaturesByKey && this.features.sort(((t2, e3) => t2.sortKey - e3.sortKey));
          }
          update(t2, e2, n2) {
            this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(t2, e2, this.layers, { imagePositions: n2 }), this.icon.programConfigurations.updatePaintArrays(t2, e2, this.layers, { imagePositions: n2 }));
          }
          isEmpty() {
            return 0 === this.symbolInstances.length && !this.hasRTLText;
          }
          uploadPending() {
            return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;
          }
          upload(t2) {
            !this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(t2), this.iconCollisionBox.upload(t2)), this.text.upload(t2, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(t2, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = true;
          }
          destroyDebugData() {
            this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();
          }
          destroy() {
            this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();
          }
          addToLineVertexArray(t2, e2) {
            const n2 = this.lineVertexArray.length;
            if (void 0 !== t2.segment) {
              let n3 = t2.dist(e2[t2.segment + 1]), r2 = t2.dist(e2[t2.segment]);
              const i2 = {};
              for (let r3 = t2.segment + 1; r3 < e2.length; r3++) i2[r3] = { x: e2[r3].x, y: e2[r3].y, tileUnitDistanceFromAnchor: n3 }, r3 < e2.length - 1 && (n3 += e2[r3 + 1].dist(e2[r3]));
              for (let n4 = t2.segment || 0; n4 >= 0; n4--) i2[n4] = { x: e2[n4].x, y: e2[n4].y, tileUnitDistanceFromAnchor: r2 }, n4 > 0 && (r2 += e2[n4 - 1].dist(e2[n4]));
              for (let t3 = 0; t3 < e2.length; t3++) {
                const e3 = i2[t3];
                this.lineVertexArray.emplaceBack(e3.x, e3.y, e3.tileUnitDistanceFromAnchor);
              }
            }
            return { lineStartIndex: n2, lineLength: this.lineVertexArray.length - n2 };
          }
          addSymbols(e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2) {
            const f2 = e2.indexArray, d2 = e2.layoutVertexArray, y2 = e2.segments.prepareSegment(4 * n2.length, d2, f2, this.canOverlap ? o2.sortKey : void 0), m2 = this.glyphOffsetArray.length, g2 = y2.vertexLength, x2 = this.allowVerticalPlacement && a2 === t.ax.vertical ? Math.PI / 2 : 0, v2 = o2.text && o2.text.sections;
            for (let t2 = 0; t2 < n2.length; t2++) {
              const { tl: i3, tr: s3, bl: a3, br: u3, tex: c3, pixelOffsetTL: h3, pixelOffsetBR: m3, minFontScaleX: g3, minFontScaleY: b2, glyphOffset: w2, isSDF: _2, sectionIndex: S2 } = n2[t2], A2 = y2.vertexLength, M2 = w2[1];
              wp(d2, l2.x, l2.y, i3.x, M2 + i3.y, c3.x, c3.y, r2, _2, h3.x, h3.y, g3, b2), wp(d2, l2.x, l2.y, s3.x, M2 + s3.y, c3.x + c3.w, c3.y, r2, _2, m3.x, h3.y, g3, b2), wp(d2, l2.x, l2.y, a3.x, M2 + a3.y, c3.x, c3.y + c3.h, r2, _2, h3.x, m3.y, g3, b2), wp(d2, l2.x, l2.y, u3.x, M2 + u3.y, c3.x + c3.w, c3.y + c3.h, r2, _2, m3.x, m3.y, g3, b2), _p(e2.dynamicLayoutVertexArray, l2, x2), f2.emplaceBack(A2, A2 + 2, A2 + 1), f2.emplaceBack(A2 + 1, A2 + 2, A2 + 3), y2.vertexLength += 4, y2.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(w2[0]), t2 !== n2.length - 1 && S2 === n2[t2 + 1].sectionIndex || e2.programConfigurations.populatePaintArrays(d2.length, o2, o2.index, { imagePositions: {}, canonical: p2, formattedSection: null == v2 ? void 0 : v2[S2] });
            }
            e2.placedSymbolArray.emplaceBack(l2.x, l2.y, m2, this.glyphOffsetArray.length - m2, g2, u2, c2, l2.segment, r2 ? r2[0] : 0, r2 ? r2[1] : 0, i2[0], i2[1], a2, 0, false, 0, h2);
          }
          _addCollisionDebugVertex(t2, e2, n2, r2, i2, s2) {
            return e2.emplaceBack(0, 0), t2.emplaceBack(n2.x, n2.y, r2, i2, Math.round(s2.x), Math.round(s2.y));
          }
          addCollisionDebugVertices(t2, e2, r2, i2, s2, o2, a2) {
            const l2 = s2.segments.prepareSegment(4, s2.layoutVertexArray, s2.indexArray), u2 = l2.vertexLength, c2 = s2.layoutVertexArray, h2 = s2.collisionVertexArray, p2 = a2.anchorX, f2 = a2.anchorY;
            this._addCollisionDebugVertex(c2, h2, o2, p2, f2, new n(t2, e2)), this._addCollisionDebugVertex(c2, h2, o2, p2, f2, new n(r2, e2)), this._addCollisionDebugVertex(c2, h2, o2, p2, f2, new n(r2, i2)), this._addCollisionDebugVertex(c2, h2, o2, p2, f2, new n(t2, i2)), l2.vertexLength += 4;
            const d2 = s2.indexArray;
            d2.emplaceBack(u2, u2 + 1), d2.emplaceBack(u2 + 1, u2 + 2), d2.emplaceBack(u2 + 2, u2 + 3), d2.emplaceBack(u2 + 3, u2), l2.primitiveLength += 4;
          }
          addDebugCollisionBoxes(t2, e2, n2, r2) {
            for (let i2 = t2; i2 < e2; i2++) {
              const t3 = this.collisionBoxArray.get(i2);
              this.addCollisionDebugVertices(t3.x1, t3.y1, t3.x2, t3.y2, r2 ? this.textCollisionBox : this.iconCollisionBox, t3.anchorPoint, n2);
            }
          }
          generateCollisionDebugBuffers() {
            this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new Mp(ra, Sh.members, oa), this.iconCollisionBox = new Mp(ra, Sh.members, oa);
            for (let t2 = 0; t2 < this.symbolInstances.length; t2++) {
              const e2 = this.symbolInstances.get(t2);
              this.addDebugCollisionBoxes(e2.textBoxStartIndex, e2.textBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.verticalTextBoxStartIndex, e2.verticalTextBoxEndIndex, e2, true), this.addDebugCollisionBoxes(e2.iconBoxStartIndex, e2.iconBoxEndIndex, e2, false), this.addDebugCollisionBoxes(e2.verticalIconBoxStartIndex, e2.verticalIconBoxEndIndex, e2, false);
            }
          }
          _deserializeCollisionBoxesForSymbol(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
            const u2 = {};
            for (let r3 = e2; r3 < n2; r3++) {
              const e3 = t2.get(r3);
              u2.textBox = { x1: e3.x1, y1: e3.y1, x2: e3.x2, y2: e3.y2, anchorPointX: e3.anchorPointX, anchorPointY: e3.anchorPointY }, u2.textFeatureIndex = e3.featureIndex;
              break;
            }
            for (let e3 = r2; e3 < i2; e3++) {
              const n3 = t2.get(e3);
              u2.verticalTextBox = { x1: n3.x1, y1: n3.y1, x2: n3.x2, y2: n3.y2, anchorPointX: n3.anchorPointX, anchorPointY: n3.anchorPointY }, u2.verticalTextFeatureIndex = n3.featureIndex;
              break;
            }
            for (let e3 = s2; e3 < o2; e3++) {
              const n3 = t2.get(e3);
              u2.iconBox = { x1: n3.x1, y1: n3.y1, x2: n3.x2, y2: n3.y2, anchorPointX: n3.anchorPointX, anchorPointY: n3.anchorPointY }, u2.iconFeatureIndex = n3.featureIndex;
              break;
            }
            for (let e3 = a2; e3 < l2; e3++) {
              const n3 = t2.get(e3);
              u2.verticalIconBox = { x1: n3.x1, y1: n3.y1, x2: n3.x2, y2: n3.y2, anchorPointX: n3.anchorPointX, anchorPointY: n3.anchorPointY }, u2.verticalIconFeatureIndex = n3.featureIndex;
              break;
            }
            return u2;
          }
          deserializeCollisionBoxes(t2) {
            this.collisionArrays = [];
            for (let e2 = 0; e2 < this.symbolInstances.length; e2++) {
              const n2 = this.symbolInstances.get(e2);
              this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t2, n2.textBoxStartIndex, n2.textBoxEndIndex, n2.verticalTextBoxStartIndex, n2.verticalTextBoxEndIndex, n2.iconBoxStartIndex, n2.iconBoxEndIndex, n2.verticalIconBoxStartIndex, n2.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(t2, e2) {
            const n2 = t2.placedSymbolArray.get(e2), r2 = n2.vertexStartIndex + 4 * n2.numGlyphs;
            for (let e3 = n2.vertexStartIndex; e3 < r2; e3 += 4) t2.indexArray.emplaceBack(e3, e3 + 2, e3 + 1), t2.indexArray.emplaceBack(e3 + 1, e3 + 2, e3 + 3);
          }
          getSortedSymbolIndexes(t2) {
            if (this.sortedAngle === t2 && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes;
            const e2 = Math.sin(t2), n2 = Math.cos(t2), r2 = [], i2 = [], s2 = [];
            for (let t3 = 0; t3 < this.symbolInstances.length; ++t3) {
              s2.push(t3);
              const o2 = this.symbolInstances.get(t3);
              r2.push(0 | Math.round(e2 * o2.anchorX + n2 * o2.anchorY)), i2.push(o2.featureIndex);
            }
            return s2.sort(((t3, e3) => r2[t3] - r2[e3] || i2[e3] - i2[t3])), s2;
          }
          addToSortKeyRanges(t2, e2) {
            const n2 = this.sortKeyRanges[this.sortKeyRanges.length - 1];
            (null == n2 ? void 0 : n2.sortKey) === e2 ? n2.symbolInstanceEnd = t2 + 1 : this.sortKeyRanges.push({ sortKey: e2, symbolInstanceStart: t2, symbolInstanceEnd: t2 + 1 });
          }
          sortFeatures(t2) {
            if (this.sortFeaturesByY && this.sortedAngle !== t2 && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
              this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t2), this.sortedAngle = t2, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];
              for (const t3 of this.symbolInstanceIndexes) {
                const e2 = this.symbolInstances.get(t3);
                this.featureSortOrder.push(e2.featureIndex);
                const n2 = [e2.rightJustifiedTextSymbolIndex, e2.centerJustifiedTextSymbolIndex, e2.leftJustifiedTextSymbolIndex];
                for (let t4 = 0; t4 < n2.length; t4++) {
                  const e3 = n2[t4];
                  e3 >= 0 && n2.indexOf(e3) === t4 && this.addIndicesForPlacedSymbol(this.text, e3);
                }
                e2.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, e2.verticalPlacedTextSymbolIndex), e2.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.placedIconSymbolIndex), e2.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, e2.verticalPlacedIconSymbolIndex);
              }
              this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);
            }
          }
        }
        let Ip, Ep;
        ds("SymbolBucket", kp, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), kp.MAX_GLYPHS = 65535, kp.addDynamicAttributes = _p;
        var Tp = { get paint() {
          return Ep = Ep || new Ks({ "icon-opacity": new Ys(wt.paint_symbol["icon-opacity"]), "icon-color": new Ys(wt.paint_symbol["icon-color"]), "icon-halo-color": new Ys(wt.paint_symbol["icon-halo-color"]), "icon-halo-width": new Ys(wt.paint_symbol["icon-halo-width"]), "icon-halo-blur": new Ys(wt.paint_symbol["icon-halo-blur"]), "icon-translate": new Xs(wt.paint_symbol["icon-translate"]), "icon-translate-anchor": new Xs(wt.paint_symbol["icon-translate-anchor"]), "text-opacity": new Ys(wt.paint_symbol["text-opacity"]), "text-color": new Ys(wt.paint_symbol["text-color"], { runtimeType: Nt, getOverride: (t2) => t2.textColor, hasOverride: (t2) => !!t2.textColor }), "text-halo-color": new Ys(wt.paint_symbol["text-halo-color"]), "text-halo-width": new Ys(wt.paint_symbol["text-halo-width"]), "text-halo-blur": new Ys(wt.paint_symbol["text-halo-blur"]), "text-translate": new Xs(wt.paint_symbol["text-translate"]), "text-translate-anchor": new Xs(wt.paint_symbol["text-translate-anchor"]) });
        }, get layout() {
          return Ip = Ip || new Ks({ "symbol-placement": new Xs(wt.layout_symbol["symbol-placement"]), "symbol-spacing": new Xs(wt.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new Xs(wt.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new Ys(wt.layout_symbol["symbol-sort-key"]), "symbol-z-order": new Xs(wt.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new Xs(wt.layout_symbol["icon-allow-overlap"]), "icon-overlap": new Xs(wt.layout_symbol["icon-overlap"]), "icon-ignore-placement": new Xs(wt.layout_symbol["icon-ignore-placement"]), "icon-optional": new Xs(wt.layout_symbol["icon-optional"]), "icon-rotation-alignment": new Xs(wt.layout_symbol["icon-rotation-alignment"]), "icon-size": new Ys(wt.layout_symbol["icon-size"]), "icon-text-fit": new Xs(wt.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new Xs(wt.layout_symbol["icon-text-fit-padding"]), "icon-image": new Ys(wt.layout_symbol["icon-image"]), "icon-rotate": new Ys(wt.layout_symbol["icon-rotate"]), "icon-padding": new Ys(wt.layout_symbol["icon-padding"]), "icon-keep-upright": new Xs(wt.layout_symbol["icon-keep-upright"]), "icon-offset": new Ys(wt.layout_symbol["icon-offset"]), "icon-anchor": new Ys(wt.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new Xs(wt.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new Xs(wt.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new Xs(wt.layout_symbol["text-rotation-alignment"]), "text-field": new Ys(wt.layout_symbol["text-field"]), "text-font": new Ys(wt.layout_symbol["text-font"]), "text-size": new Ys(wt.layout_symbol["text-size"]), "text-max-width": new Ys(wt.layout_symbol["text-max-width"]), "text-line-height": new Xs(wt.layout_symbol["text-line-height"]), "text-letter-spacing": new Ys(wt.layout_symbol["text-letter-spacing"]), "text-justify": new Ys(wt.layout_symbol["text-justify"]), "text-radial-offset": new Ys(wt.layout_symbol["text-radial-offset"]), "text-variable-anchor": new Xs(wt.layout_symbol["text-variable-anchor"]), "text-variable-anchor-offset": new Ys(wt.layout_symbol["text-variable-anchor-offset"]), "text-anchor": new Ys(wt.layout_symbol["text-anchor"]), "text-max-angle": new Xs(wt.layout_symbol["text-max-angle"]), "text-writing-mode": new Xs(wt.layout_symbol["text-writing-mode"]), "text-rotate": new Ys(wt.layout_symbol["text-rotate"]), "text-padding": new Xs(wt.layout_symbol["text-padding"]), "text-keep-upright": new Xs(wt.layout_symbol["text-keep-upright"]), "text-transform": new Ys(wt.layout_symbol["text-transform"]), "text-offset": new Ys(wt.layout_symbol["text-offset"]), "text-allow-overlap": new Xs(wt.layout_symbol["text-allow-overlap"]), "text-overlap": new Xs(wt.layout_symbol["text-overlap"]), "text-ignore-placement": new Xs(wt.layout_symbol["text-ignore-placement"]), "text-optional": new Xs(wt.layout_symbol["text-optional"]) });
        } };
        class Fp {
          constructor(t2) {
            if (void 0 === t2.property.overrides) throw new Error("overrides must be provided to instantiate FormatSectionOverride class");
            this.type = t2.property.overrides ? t2.property.overrides.runtimeType : Lt, this.defaultValue = t2;
          }
          evaluate(t2) {
            if (t2.formattedSection) {
              const e2 = this.defaultValue.property.overrides;
              if (null == e2 ? void 0 : e2.hasOverride(t2.formattedSection)) return e2.getOverride(t2.formattedSection);
            }
            return t2.feature && t2.featureState ? this.defaultValue.evaluate(t2.feature, t2.featureState) : this.defaultValue.property.specification.default;
          }
          eachChild(t2) {
            this.defaultValue.isConstant() || t2(this.defaultValue.value._styleExpression.expression);
          }
          outputDefined() {
            return false;
          }
          serialize() {
            return null;
          }
        }
        ds("FormatSectionOverride", Fp, { omit: ["defaultValue"] });
        class Pp extends to {
          constructor(t2, e2) {
            super(t2, Tp, e2);
          }
          recalculate(t2, e2) {
            if (super.recalculate(t2, e2), "auto" === this.layout.get("icon-rotation-alignment") && (this.layout._values["icon-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"), "auto" === this.layout.get("text-rotation-alignment") && (this.layout._values["text-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"), "auto" === this.layout.get("text-pitch-alignment") && (this.layout._values["text-pitch-alignment"] = "map" === this.layout.get("text-rotation-alignment") ? "map" : "viewport"), "auto" === this.layout.get("icon-pitch-alignment") && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")), "point" === this.layout.get("symbol-placement")) {
              const t3 = this.layout.get("text-writing-mode");
              if (t3) {
                const e3 = [];
                for (const n2 of t3) e3.includes(n2) || e3.push(n2);
                this.layout._values["text-writing-mode"] = e3;
              } else this.layout._values["text-writing-mode"] = ["horizontal"];
            }
            this._setPaintOverrides();
          }
          getValueAndResolveTokens(t2, e2, n2, r2) {
            const i2 = this.layout.get(t2).evaluate(e2, {}, n2, r2), s2 = this._unevaluatedLayout._values[t2];
            return s2.isDataDriven() || ii(s2.value) || !i2 ? i2 : (function(t3, e3) {
              return e3.replace(/{([^{}]+)}/g, ((e4, n3) => t3 && n3 in t3 ? String(t3[n3]) : ""));
            })(e2.properties, i2);
          }
          createBucket(t2) {
            return new kp(t2);
          }
          queryRadius() {
            return 0;
          }
          queryIntersectsFeature() {
            throw new Error("Should take a different path in FeatureIndex");
          }
          _setPaintOverrides() {
            for (const t2 of Tp.paint.overridableProperties) {
              if (!Pp.hasPaintOverride(this.layout, t2)) continue;
              const e2 = this.paint.get(t2), n2 = new Fp(e2), r2 = new ri(n2, e2.property.specification);
              let i2 = null;
              i2 = "constant" === e2.value.kind || "source" === e2.value.kind ? new oi("source", r2) : new ai("composite", r2, e2.value.zoomStops), this.paint._values[t2] = new qs(e2.property, i2, e2.parameters);
            }
          }
          _handleOverridablePaintPropertyUpdate(t2, e2, n2) {
            return !(!this.layout || e2.isDataDriven() || n2.isDataDriven()) && Pp.hasPaintOverride(this.layout, t2);
          }
          static hasPaintOverride(t2, e2) {
            const n2 = t2.get("text-field"), r2 = Tp.paint.properties[e2];
            let i2 = false;
            const s2 = (t3) => {
              var e3;
              for (const n3 of t3) if (null === (e3 = r2.overrides) || void 0 === e3 ? void 0 : e3.hasOverride(n3)) return void (i2 = true);
            };
            if ("constant" === n2.value.kind && n2.value.value instanceof ze) s2(n2.value.value.sections);
            else if ("source" === n2.value.kind || "composite" === n2.value.kind) {
              const t3 = (e4) => {
                i2 || (e4 instanceof Xe && qe(e4.value) === Xt ? s2(e4.value.sections) : e4 instanceof Pn ? s2(e4.sections) : e4.eachChild(t3));
              }, e3 = n2.value;
              e3._styleExpression && t3(e3._styleExpression.expression);
            }
            return i2;
          }
        }
        let Dp;
        var zp = { get paint() {
          return Dp = Dp || new Ks({ "background-color": new Xs(wt.paint_background["background-color"]), "background-pattern": new Hs(wt.paint_background["background-pattern"]), "background-opacity": new Xs(wt.paint_background["background-opacity"]) });
        } };
        class Bp extends to {
          constructor(t2, e2) {
            super(t2, zp, e2);
          }
        }
        class Cp extends to {
          constructor(t2, e2) {
            super(t2, {}, e2), this.onAdd = (t3) => {
              this.implementation.onAdd && this.implementation.onAdd(t3, t3.painter.context.gl);
            }, this.onRemove = (t3) => {
              this.implementation.onRemove && this.implementation.onRemove(t3, t3.painter.context.gl);
            }, this.implementation = t2;
          }
          is3D() {
            return "3d" === this.implementation.renderingMode;
          }
          hasOffscreenPass() {
            return void 0 !== this.implementation.prerender;
          }
          recalculate() {
          }
          updateTransitions() {
          }
          hasTransition() {
            return false;
          }
          serialize() {
            throw new Error("Custom layers cannot be serialized");
          }
        }
        class Vp {
          constructor(t2) {
            this._methodToThrottle = t2, this._triggered = false, this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {
              this._triggered = false, this._methodToThrottle();
            };
          }
          trigger() {
            var t2;
            this._triggered || (this._triggered = true, null === (t2 = this._channel) || void 0 === t2 || t2.port1.postMessage(true));
          }
          remove() {
            delete this._channel, this._methodToThrottle = () => {
            };
          }
        }
        const Lp = { once: true }, Op = 63710088e-1;
        class $p {
          constructor(t2, e2) {
            if (isNaN(t2) || isNaN(e2)) throw new Error(`Invalid LngLat object: (${t2}, ${e2})`);
            if (this.lng = +t2, this.lat = +e2, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
          }
          wrap() {
            return new $p(O(this.lng, -180, 180), this.lat);
          }
          toArray() {
            return [this.lng, this.lat];
          }
          toString() {
            return `LngLat(${this.lng}, ${this.lat})`;
          }
          distanceTo(t2) {
            const e2 = Math.PI / 180, n2 = this.lat * e2, r2 = t2.lat * e2, i2 = Math.sin(n2) * Math.sin(r2) + Math.cos(n2) * Math.cos(r2) * Math.cos((t2.lng - this.lng) * e2);
            return Op * Math.acos(Math.min(i2, 1));
          }
          static convert(t2) {
            if (t2 instanceof $p) return t2;
            if (Array.isArray(t2) && (2 === t2.length || 3 === t2.length)) return new $p(Number(t2[0]), Number(t2[1]));
            if (!Array.isArray(t2) && "object" == typeof t2 && null !== t2) return new $p(Number("lng" in t2 ? t2.lng : t2.lon), Number(t2.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 Rp = 2 * Math.PI * Op;
        function Np(t2) {
          return Rp * Math.cos(t2 * Math.PI / 180);
        }
        function Up(t2) {
          return (180 + t2) / 360;
        }
        function jp(t2) {
          return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t2 * Math.PI / 360))) / 360;
        }
        function qp(t2, e2) {
          return t2 / Np(e2);
        }
        function Gp(t2) {
          return 360 * t2 - 180;
        }
        function Xp(t2) {
          return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t2) * Math.PI / 180)) - 90;
        }
        function Yp(t2, e2) {
          return t2 * Np(Xp(e2));
        }
        class Zp {
          constructor(t2, e2, n2 = 0) {
            this.x = +t2, this.y = +e2, this.z = +n2;
          }
          static fromLngLat(t2, e2 = 0) {
            const n2 = $p.convert(t2);
            return new Zp(Up(n2.lng), jp(n2.lat), qp(e2, n2.lat));
          }
          toLngLat() {
            return new $p(Gp(this.x), Xp(this.y));
          }
          toAltitude() {
            return Yp(this.z, this.y);
          }
          meterInMercatorCoordinateUnits() {
            return 1 / Rp * (t2 = Xp(this.y), 1 / Math.cos(t2 * Math.PI / 180));
            var t2;
          }
        }
        function Hp(t2, e2, n2) {
          var r2 = 2 * Math.PI * 6378137 / 256 / Math.pow(2, n2);
          return [t2 * r2 - 2 * Math.PI * 6378137 / 2, e2 * r2 - 2 * Math.PI * 6378137 / 2];
        }
        class Wp {
          constructor(t2, e2, n2) {
            if (!(function(t3, e3, n3) {
              return !(t3 < 0 || t3 > 25 || n3 < 0 || n3 >= Math.pow(2, t3) || e3 < 0 || e3 >= Math.pow(2, t3));
            })(t2, e2, n2)) throw new Error(`x=${e2}, y=${n2}, z=${t2} outside of bounds. 0<=x<${Math.pow(2, t2)}, 0<=y<${Math.pow(2, t2)} 0<=z<=25 `);
            this.z = t2, this.x = e2, this.y = n2, this.key = Qp(0, t2, t2, e2, n2);
          }
          equals(t2) {
            return this.z === t2.z && this.x === t2.x && this.y === t2.y;
          }
          url(t2, e2, n2) {
            const r2 = (s2 = this.y, o2 = this.z, a2 = Hp(256 * (i2 = this.x), 256 * (s2 = Math.pow(2, o2) - s2 - 1), o2), l2 = Hp(256 * (i2 + 1), 256 * (s2 + 1), o2), a2[0] + "," + a2[1] + "," + l2[0] + "," + l2[1]);
            var i2, s2, o2, a2, l2;
            const u2 = (function(t3, e3, n3) {
              let r3 = "";
              for (let i3 = t3; i3 > 0; i3--) {
                const t4 = 1 << i3 - 1;
                r3 += (e3 & t4 ? 1 : 0) + (n3 & t4 ? 2 : 0);
              }
              return r3;
            })(this.z, this.x, this.y);
            return t2[(this.x + this.y) % t2.length].replace(/{prefix}/g, (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(/{z}/g, String(this.z)).replace(/{x}/g, String(this.x)).replace(/{y}/g, String("tms" === n2 ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(/{ratio}/g, e2 > 1 ? "@2x" : "").replace(/{quadkey}/g, u2).replace(/{bbox-epsg-3857}/g, r2);
          }
          isChildOf(t2) {
            const e2 = this.z - t2.z;
            return e2 > 0 && t2.x === this.x >> e2 && t2.y === this.y >> e2;
          }
          getTilePoint(t2) {
            const e2 = Math.pow(2, this.z);
            return new n((t2.x * e2 - this.x) * T, (t2.y * e2 - this.y) * T);
          }
          toString() {
            return `${this.z}/${this.x}/${this.y}`;
          }
        }
        class Kp {
          constructor(t2, e2) {
            this.wrap = t2, this.canonical = e2, this.key = Qp(t2, e2.z, e2.z, e2.x, e2.y);
          }
        }
        class Jp {
          constructor(t2, e2, n2, r2, i2) {
            if (this.terrainRttPosMatrix32f = null, t2 < n2) throw new Error(`overscaledZ should be >= z; overscaledZ = ${t2}; z = ${n2}`);
            this.overscaledZ = t2, this.wrap = e2, this.canonical = new Wp(n2, +r2, +i2), this.key = Qp(e2, t2, n2, r2, i2);
          }
          clone() {
            return new Jp(this.overscaledZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);
          }
          equals(t2) {
            return this.overscaledZ === t2.overscaledZ && this.wrap === t2.wrap && this.canonical.equals(t2.canonical);
          }
          scaledTo(t2) {
            if (t2 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t2}; overscaledZ = ${this.overscaledZ}`);
            const e2 = this.canonical.z - t2;
            return t2 > this.canonical.z ? new Jp(t2, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new Jp(t2, this.wrap, t2, this.canonical.x >> e2, this.canonical.y >> e2);
          }
          isOverscaled() {
            return this.overscaledZ > this.canonical.z;
          }
          calculateScaledKey(t2, e2) {
            if (t2 > this.overscaledZ) throw new Error(`targetZ > this.overscaledZ; targetZ = ${t2}; overscaledZ = ${this.overscaledZ}`);
            const n2 = this.canonical.z - t2;
            return t2 > this.canonical.z ? Qp(this.wrap * +e2, t2, this.canonical.z, this.canonical.x, this.canonical.y) : Qp(this.wrap * +e2, t2, t2, this.canonical.x >> n2, this.canonical.y >> n2);
          }
          isChildOf(t2) {
            if (t2.wrap !== this.wrap) return false;
            if (this.overscaledZ - t2.overscaledZ <= 0) return false;
            if (0 === t2.overscaledZ) return this.overscaledZ > 0;
            const e2 = this.canonical.z - t2.canonical.z;
            return !(e2 < 0) && t2.canonical.x === this.canonical.x >> e2 && t2.canonical.y === this.canonical.y >> e2;
          }
          children(t2) {
            if (this.overscaledZ >= t2) return [new Jp(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];
            const e2 = this.canonical.z + 1, n2 = 2 * this.canonical.x, r2 = 2 * this.canonical.y;
            return [new Jp(e2, this.wrap, e2, n2, r2), new Jp(e2, this.wrap, e2, n2 + 1, r2), new Jp(e2, this.wrap, e2, n2, r2 + 1), new Jp(e2, this.wrap, e2, n2 + 1, r2 + 1)];
          }
          isLessThan(t2) {
            return this.wrap < t2.wrap || !(this.wrap > t2.wrap) && (this.overscaledZ < t2.overscaledZ || !(this.overscaledZ > t2.overscaledZ) && (this.canonical.x < t2.canonical.x || !(this.canonical.x > t2.canonical.x) && this.canonical.y < t2.canonical.y));
          }
          wrapped() {
            return new Jp(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
          }
          unwrapTo(t2) {
            return new Jp(this.overscaledZ, t2, 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(t2) {
            return this.canonical.getTilePoint(new Zp(t2.x - this.wrap, t2.y));
          }
          normalizeCoordinates(t2, e2, n2 = 8192) {
            if (t2 >= 0 && t2 < n2 && e2 >= 0 && e2 < n2) return { tileID: this, x: t2, y: e2 };
            const r2 = Math.floor(t2 / n2), i2 = Math.floor(e2 / n2), s2 = t2 - r2 * n2, o2 = e2 - i2 * n2, a2 = this.canonical.z, l2 = 1 << a2, u2 = this.canonical.y + i2;
            if (u2 < 0 || u2 >= l2) return null;
            let c2 = this.canonical.x + r2, h2 = this.wrap;
            return c2 < 0 ? (h2 -= Math.ceil(-c2 / l2), c2 = (c2 % l2 + l2) % l2) : c2 >= l2 && (h2 += Math.floor(c2 / l2), c2 %= l2), { tileID: new Jp(this.overscaledZ, h2, a2, c2, u2), x: s2, y: o2 };
          }
        }
        function Qp(t2, e2, n2, r2, i2) {
          (t2 *= 2) < 0 && (t2 = -1 * t2 - 1);
          const s2 = 1 << n2;
          return (s2 * s2 * t2 + s2 * i2 + r2).toString(36) + n2.toString(36) + e2.toString(36);
        }
        ds("CanonicalTileID", Wp), ds("OverscaledTileID", Jp, { omit: ["terrainRttPosMatrix32f"] });
        class tf {
          constructor() {
            this.minX = 1 / 0, this.maxX = -1 / 0, this.minY = 1 / 0, this.maxY = -1 / 0;
          }
          extend(t2) {
            return this.minX = Math.min(this.minX, t2.x), this.minY = Math.min(this.minY, t2.y), this.maxX = Math.max(this.maxX, t2.x), this.maxY = Math.max(this.maxY, t2.y), this;
          }
          expandBy(t2) {
            return this.minX -= t2, this.minY -= t2, this.maxX += t2, this.maxY += t2, (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(t2) {
            return this.expandBy(-t2);
          }
          map(t2) {
            const e2 = new tf();
            return e2.extend(t2(new n(this.minX, this.minY))), e2.extend(t2(new n(this.maxX, this.minY))), e2.extend(t2(new n(this.minX, this.maxY))), e2.extend(t2(new n(this.maxX, this.maxY))), e2;
          }
          static fromPoints(t2) {
            const e2 = new tf();
            for (const n2 of t2) e2.extend(n2);
            return e2;
          }
          contains(t2) {
            return t2.x >= this.minX && t2.x <= this.maxX && t2.y >= this.minY && t2.y <= this.maxY;
          }
          empty() {
            return this.minX > this.maxX;
          }
          width() {
            return this.maxX - this.minX;
          }
          height() {
            return this.maxY - this.minY;
          }
          covers(t2) {
            return !this.empty() && !t2.empty() && t2.minX >= this.minX && t2.maxX <= this.maxX && t2.minY >= this.minY && t2.maxY <= this.maxY;
          }
          intersects(t2) {
            return !this.empty() && !t2.empty() && t2.minX <= this.maxX && t2.maxX >= this.minX && t2.minY <= this.maxY && t2.maxY >= this.minY;
          }
        }
        class ef {
          constructor(t2) {
            this._stringToNumber = {}, this._numberToString = [];
            for (let e2 = 0; e2 < t2.length; e2++) {
              const n2 = t2[e2];
              this._stringToNumber[n2] = e2, this._numberToString[e2] = n2;
            }
          }
          encode(t2) {
            return this._stringToNumber[t2];
          }
          decode(t2) {
            if (t2 >= this._numberToString.length) throw new Error(`Out of bounds. Index requested n=${t2} can't be >= this._numberToString.length ${this._numberToString.length}`);
            return this._numberToString[t2];
          }
        }
        class nf {
          constructor(t2, e2, n2, r2, i2) {
            this.type = "Feature", this._vectorTileFeature = t2, this._x = n2, this._y = r2, this._z = e2, this.properties = t2.properties, this.id = i2;
          }
          projectPoint(t2, e2, n2, r2) {
            return [360 * (t2.x + e2) / r2 - 180, 360 / Math.PI * Math.atan(Math.exp((1 - 2 * (t2.y + n2) / r2) * Math.PI)) - 90];
          }
          projectLine(t2, e2, n2, r2) {
            return t2.map(((t3) => this.projectPoint(t3, e2, n2, r2)));
          }
          get geometry() {
            if (this._geometry) return this._geometry;
            const t2 = this._vectorTileFeature, e2 = t2.extent * Math.pow(2, this._z), n2 = t2.extent * this._x, r2 = t2.extent * this._y, i2 = t2.loadGeometry();
            switch (t2.type) {
              case 1: {
                const t3 = [];
                for (const e3 of i2) t3.push(e3[0]);
                const s2 = this.projectLine(t3, n2, r2, e2);
                this._geometry = 1 === t3.length ? { type: "Point", coordinates: s2[0] } : { type: "MultiPoint", coordinates: s2 };
                break;
              }
              case 2: {
                const t3 = i2.map(((t4) => this.projectLine(t4, n2, r2, e2)));
                this._geometry = 1 === t3.length ? { type: "LineString", coordinates: t3[0] } : { type: "MultiLineString", coordinates: t3 };
                break;
              }
              case 3: {
                const t3 = Lu(i2), s2 = [];
                for (const i3 of t3) s2.push(i3.map(((t4) => this.projectLine(t4, n2, r2, e2))));
                this._geometry = 1 === s2.length ? { type: "Polygon", coordinates: s2[0] } : { type: "MultiPolygon", coordinates: s2 };
                break;
              }
              default:
                throw new Error(`unknown feature type: ${t2.type}`);
            }
            return this._geometry;
          }
          set geometry(t2) {
            this._geometry = t2;
          }
          toJSON() {
            const t2 = { geometry: this.geometry };
            for (const e2 in this) "_geometry" !== e2 && "_vectorTileFeature" !== e2 && "_x" !== e2 && "_y" !== e2 && "_z" !== e2 && (t2[e2] = this[e2]);
            return t2;
          }
        }
        class rf {
          constructor(t2, e2, n2) {
            this._name = t2, this.dataBuffer = e2, "number" == typeof n2 ? this._size = n2 : (this.nullabilityBuffer = n2, this._size = n2.size());
          }
          getValue(t2) {
            return this.nullabilityBuffer && !this.nullabilityBuffer.get(t2) ? null : this.getValueFromBuffer(t2);
          }
          has(t2) {
            return this.nullabilityBuffer?.get(t2) || !this.nullabilityBuffer;
          }
          get name() {
            return this._name;
          }
          get size() {
            return this._size;
          }
        }
        class sf extends rf {
        }
        class of extends sf {
          getValueFromBuffer(t2) {
            return this.dataBuffer[t2];
          }
        }
        class af extends sf {
          getValueFromBuffer(t2) {
            return this.dataBuffer[t2];
          }
        }
        class lf extends rf {
          constructor(t2, e2, n2, r2) {
            super(t2, e2, r2), this.delta = n2;
          }
        }
        class uf extends lf {
          constructor(t2, e2, n2, r2) {
            super(t2, Int32Array.of(e2), n2, r2);
          }
          getValueFromBuffer(t2) {
            return this.dataBuffer[0] + t2 * this.delta;
          }
        }
        class cf extends rf {
          constructor(t2, e2, n2, r2) {
            super(t2, r2 ? Int32Array.of(e2) : Uint32Array.of(e2), n2);
          }
          getValueFromBuffer(t2) {
            return this.dataBuffer[0];
          }
        }
        class hf {
          constructor(t2, e2, n2, r2, i2 = 4096) {
            this._name = t2, this._geometryVector = e2, this._idVector = n2, this._propertyVectors = r2, this._extent = i2;
          }
          get name() {
            return this._name;
          }
          get idVector() {
            return this._idVector;
          }
          get geometryVector() {
            return this._geometryVector;
          }
          get propertyVectors() {
            return this._propertyVectors;
          }
          getPropertyVector(t2) {
            return this.propertyVectorsMap || (this.propertyVectorsMap = new Map(this._propertyVectors.map(((t3) => [t3.name, t3])))), this.propertyVectorsMap.get(t2);
          }
          get numFeatures() {
            return this.geometryVector.numGeometries;
          }
          get extent() {
            return this._extent;
          }
          getFeatures() {
            const t2 = [], e2 = this.geometryVector.getGeometries();
            for (let n2 = 0; n2 < this.numFeatures; n2++) {
              let r2;
              if (this.idVector) {
                const t3 = this.idVector.getValue(n2);
                r2 = this.containsMaxSafeIntegerValues(this.idVector) && null !== t3 ? Number(t3) : t3;
              }
              const i2 = { coordinates: e2[n2], type: this.geometryVector.geometryType(n2) }, s2 = {};
              for (const t3 of this.propertyVectors) {
                if (!t3) continue;
                const e3 = t3.name, r3 = t3.getValue(n2);
                null !== r3 && (s2[e3] = r3);
              }
              t2.push({ id: r2, geometry: i2, properties: s2 });
            }
            return t2;
          }
          containsMaxSafeIntegerValues(t2) {
            return t2 instanceof of || t2 instanceof cf || t2 instanceof uf || t2 instanceof af;
          }
        }
        class pf {
          constructor(t2) {
            this.value = t2;
          }
          get() {
            return this.value;
          }
          set(t2) {
            this.value = t2;
          }
          increment() {
            return this.value++;
          }
          add(t2) {
            this.value += t2;
          }
        }
        var ff, df;
        !(function(t2) {
          t2.NONE = "NONE", t2.DELTA = "DELTA", t2.COMPONENTWISE_DELTA = "COMPONENTWISE_DELTA", t2.RLE = "RLE", t2.MORTON = "MORTON", t2.PDE = "PDE";
        })(ff || (ff = {})), (function(t2) {
          t2.NONE = "NONE", t2.FAST_PFOR = "FAST_PFOR", t2.VARINT = "VARINT", t2.ALP = "ALP";
        })(df || (df = {}));
        const yf = new Uint32Array(33);
        yf[0] = 0;
        for (let t2 = 1; t2 <= 32; t2++) yf[t2] = 32 === t2 ? 4294967295 : 4294967295 >>> 32 - t2;
        const mf = yf, gf = 256;
        function xf(t2, e2) {
          return t2 - t2 % e2;
        }
        function vf(t2) {
          const e2 = t2 >>> 0;
          return ((255 & e2) << 24 | (65280 & e2) << 8 | e2 >>> 8 & 65280 | e2 >>> 24 & 255) >>> 0;
        }
        const bf = (function() {
          if (!Number.isFinite(65536)) return 65536;
          const t2 = xf(Math.floor(65536), gf);
          return 0 === t2 ? gf : t2;
        })(), wf = 3 * bf / gf + bf | 0;
        function _f() {
          const t2 = new Uint8Array(wf);
          return { dataToBePacked: new Array(33), dataPointers: new Int32Array(33), byteContainer: t2, byteContainerI32: new Int32Array(t2.buffer, t2.byteOffset, t2.byteLength >>> 2), exceptionSizes: new Int32Array(33) };
        }
        function Sf(t2, e2, n2, r2, i2) {
          switch (i2) {
            case 1:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 1, n3[i3++] = e5 >>> 1 & 1, n3[i3++] = e5 >>> 2 & 1, n3[i3++] = e5 >>> 3 & 1, n3[i3++] = e5 >>> 4 & 1, n3[i3++] = e5 >>> 5 & 1, n3[i3++] = e5 >>> 6 & 1, n3[i3++] = e5 >>> 7 & 1, n3[i3++] = e5 >>> 8 & 1, n3[i3++] = e5 >>> 9 & 1, n3[i3++] = e5 >>> 10 & 1, n3[i3++] = e5 >>> 11 & 1, n3[i3++] = e5 >>> 12 & 1, n3[i3++] = e5 >>> 13 & 1, n3[i3++] = e5 >>> 14 & 1, n3[i3++] = e5 >>> 15 & 1, n3[i3++] = e5 >>> 16 & 1, n3[i3++] = e5 >>> 17 & 1, n3[i3++] = e5 >>> 18 & 1, n3[i3++] = e5 >>> 19 & 1, n3[i3++] = e5 >>> 20 & 1, n3[i3++] = e5 >>> 21 & 1, n3[i3++] = e5 >>> 22 & 1, n3[i3++] = e5 >>> 23 & 1, n3[i3++] = e5 >>> 24 & 1, n3[i3++] = e5 >>> 25 & 1, n3[i3++] = e5 >>> 26 & 1, n3[i3++] = e5 >>> 27 & 1, n3[i3++] = e5 >>> 28 & 1, n3[i3++] = e5 >>> 29 & 1, n3[i3++] = e5 >>> 30 & 1, n3[i3++] = e5 >>> 31 & 1;
                }
              })(t2, e2, n2, r2);
              break;
            case 2:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 3, n3[i3++] = e5 >>> 2 & 3, n3[i3++] = e5 >>> 4 & 3, n3[i3++] = e5 >>> 6 & 3, n3[i3++] = e5 >>> 8 & 3, n3[i3++] = e5 >>> 10 & 3, n3[i3++] = e5 >>> 12 & 3, n3[i3++] = e5 >>> 14 & 3, n3[i3++] = e5 >>> 16 & 3, n3[i3++] = e5 >>> 18 & 3, n3[i3++] = e5 >>> 20 & 3, n3[i3++] = e5 >>> 22 & 3, n3[i3++] = e5 >>> 24 & 3, n3[i3++] = e5 >>> 26 & 3, n3[i3++] = e5 >>> 28 & 3, n3[i3++] = e5 >>> 30 & 3, n3[i3++] = r4 >>> 0 & 3, n3[i3++] = r4 >>> 2 & 3, n3[i3++] = r4 >>> 4 & 3, n3[i3++] = r4 >>> 6 & 3, n3[i3++] = r4 >>> 8 & 3, n3[i3++] = r4 >>> 10 & 3, n3[i3++] = r4 >>> 12 & 3, n3[i3++] = r4 >>> 14 & 3, n3[i3++] = r4 >>> 16 & 3, n3[i3++] = r4 >>> 18 & 3, n3[i3++] = r4 >>> 20 & 3, n3[i3++] = r4 >>> 22 & 3, n3[i3++] = r4 >>> 24 & 3, n3[i3++] = r4 >>> 26 & 3, n3[i3++] = r4 >>> 28 & 3, n3[i3++] = r4 >>> 30 & 3;
                }
              })(t2, e2, n2, r2);
              break;
            case 3:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 7, n3[i3++] = e5 >>> 3 & 7, n3[i3++] = e5 >>> 6 & 7, n3[i3++] = e5 >>> 9 & 7, n3[i3++] = e5 >>> 12 & 7, n3[i3++] = e5 >>> 15 & 7, n3[i3++] = e5 >>> 18 & 7, n3[i3++] = e5 >>> 21 & 7, n3[i3++] = e5 >>> 24 & 7, n3[i3++] = e5 >>> 27 & 7, n3[i3++] = 7 & (e5 >>> 30 | (1 & r4) << 2), n3[i3++] = r4 >>> 1 & 7, n3[i3++] = r4 >>> 4 & 7, n3[i3++] = r4 >>> 7 & 7, n3[i3++] = r4 >>> 10 & 7, n3[i3++] = r4 >>> 13 & 7, n3[i3++] = r4 >>> 16 & 7, n3[i3++] = r4 >>> 19 & 7, n3[i3++] = r4 >>> 22 & 7, n3[i3++] = r4 >>> 25 & 7, n3[i3++] = r4 >>> 28 & 7, n3[i3++] = 7 & (r4 >>> 31 | (3 & o2) << 1), n3[i3++] = o2 >>> 2 & 7, n3[i3++] = o2 >>> 5 & 7, n3[i3++] = o2 >>> 8 & 7, n3[i3++] = o2 >>> 11 & 7, n3[i3++] = o2 >>> 14 & 7, n3[i3++] = o2 >>> 17 & 7, n3[i3++] = o2 >>> 20 & 7, n3[i3++] = o2 >>> 23 & 7, n3[i3++] = o2 >>> 26 & 7, n3[i3++] = o2 >>> 29 & 7;
                }
              })(t2, e2, n2, r2);
              break;
            case 4:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0, a2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 15, n3[i3++] = e5 >>> 4 & 15, n3[i3++] = e5 >>> 8 & 15, n3[i3++] = e5 >>> 12 & 15, n3[i3++] = e5 >>> 16 & 15, n3[i3++] = e5 >>> 20 & 15, n3[i3++] = e5 >>> 24 & 15, n3[i3++] = e5 >>> 28 & 15, n3[i3++] = r4 >>> 0 & 15, n3[i3++] = r4 >>> 4 & 15, n3[i3++] = r4 >>> 8 & 15, n3[i3++] = r4 >>> 12 & 15, n3[i3++] = r4 >>> 16 & 15, n3[i3++] = r4 >>> 20 & 15, n3[i3++] = r4 >>> 24 & 15, n3[i3++] = r4 >>> 28 & 15, n3[i3++] = o2 >>> 0 & 15, n3[i3++] = o2 >>> 4 & 15, n3[i3++] = o2 >>> 8 & 15, n3[i3++] = o2 >>> 12 & 15, n3[i3++] = o2 >>> 16 & 15, n3[i3++] = o2 >>> 20 & 15, n3[i3++] = o2 >>> 24 & 15, n3[i3++] = o2 >>> 28 & 15, n3[i3++] = a2 >>> 0 & 15, n3[i3++] = a2 >>> 4 & 15, n3[i3++] = a2 >>> 8 & 15, n3[i3++] = a2 >>> 12 & 15, n3[i3++] = a2 >>> 16 & 15, n3[i3++] = a2 >>> 20 & 15, n3[i3++] = a2 >>> 24 & 15, n3[i3++] = a2 >>> 28 & 15;
                }
              })(t2, e2, n2, r2);
              break;
            case 5:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0, a2 = t3[s2++] >>> 0, l2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 31, n3[i3++] = e5 >>> 5 & 31, n3[i3++] = e5 >>> 10 & 31, n3[i3++] = e5 >>> 15 & 31, n3[i3++] = e5 >>> 20 & 31, n3[i3++] = e5 >>> 25 & 31, n3[i3++] = 31 & (e5 >>> 30 | (7 & r4) << 2), n3[i3++] = r4 >>> 3 & 31, n3[i3++] = r4 >>> 8 & 31, n3[i3++] = r4 >>> 13 & 31, n3[i3++] = r4 >>> 18 & 31, n3[i3++] = r4 >>> 23 & 31, n3[i3++] = 31 & (r4 >>> 28 | (1 & o2) << 4), n3[i3++] = o2 >>> 1 & 31, n3[i3++] = o2 >>> 6 & 31, n3[i3++] = o2 >>> 11 & 31, n3[i3++] = o2 >>> 16 & 31, n3[i3++] = o2 >>> 21 & 31, n3[i3++] = o2 >>> 26 & 31, n3[i3++] = 31 & (o2 >>> 31 | (15 & a2) << 1), n3[i3++] = a2 >>> 4 & 31, n3[i3++] = a2 >>> 9 & 31, n3[i3++] = a2 >>> 14 & 31, n3[i3++] = a2 >>> 19 & 31, n3[i3++] = a2 >>> 24 & 31, n3[i3++] = 31 & (a2 >>> 29 | (3 & l2) << 3), n3[i3++] = l2 >>> 2 & 31, n3[i3++] = l2 >>> 7 & 31, n3[i3++] = l2 >>> 12 & 31, n3[i3++] = l2 >>> 17 & 31, n3[i3++] = l2 >>> 22 & 31, n3[i3++] = l2 >>> 27 & 31;
                }
              })(t2, e2, n2, r2);
              break;
            case 6:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0, a2 = t3[s2++] >>> 0, l2 = t3[s2++] >>> 0, u2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 63, n3[i3++] = e5 >>> 6 & 63, n3[i3++] = e5 >>> 12 & 63, n3[i3++] = e5 >>> 18 & 63, n3[i3++] = e5 >>> 24 & 63, n3[i3++] = 63 & (e5 >>> 30 | (15 & r4) << 2), n3[i3++] = r4 >>> 4 & 63, n3[i3++] = r4 >>> 10 & 63, n3[i3++] = r4 >>> 16 & 63, n3[i3++] = r4 >>> 22 & 63, n3[i3++] = 63 & (r4 >>> 28 | (3 & o2) << 4), n3[i3++] = o2 >>> 2 & 63, n3[i3++] = o2 >>> 8 & 63, n3[i3++] = o2 >>> 14 & 63, n3[i3++] = o2 >>> 20 & 63, n3[i3++] = o2 >>> 26 & 63, n3[i3++] = a2 >>> 0 & 63, n3[i3++] = a2 >>> 6 & 63, n3[i3++] = a2 >>> 12 & 63, n3[i3++] = a2 >>> 18 & 63, n3[i3++] = a2 >>> 24 & 63, n3[i3++] = 63 & (a2 >>> 30 | (15 & l2) << 2), n3[i3++] = l2 >>> 4 & 63, n3[i3++] = l2 >>> 10 & 63, n3[i3++] = l2 >>> 16 & 63, n3[i3++] = l2 >>> 22 & 63, n3[i3++] = 63 & (l2 >>> 28 | (3 & u2) << 4), n3[i3++] = u2 >>> 2 & 63, n3[i3++] = u2 >>> 8 & 63, n3[i3++] = u2 >>> 14 & 63, n3[i3++] = u2 >>> 20 & 63, n3[i3++] = u2 >>> 26 & 63;
                }
              })(t2, e2, n2, r2);
              break;
            case 7:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0, a2 = t3[s2++] >>> 0, l2 = t3[s2++] >>> 0, u2 = t3[s2++] >>> 0, c2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 127, n3[i3++] = e5 >>> 7 & 127, n3[i3++] = e5 >>> 14 & 127, n3[i3++] = e5 >>> 21 & 127, n3[i3++] = 127 & (e5 >>> 28 | (7 & r4) << 4), n3[i3++] = r4 >>> 3 & 127, n3[i3++] = r4 >>> 10 & 127, n3[i3++] = r4 >>> 17 & 127, n3[i3++] = r4 >>> 24 & 127, n3[i3++] = 127 & (r4 >>> 31 | (63 & o2) << 1), n3[i3++] = o2 >>> 6 & 127, n3[i3++] = o2 >>> 13 & 127, n3[i3++] = o2 >>> 20 & 127, n3[i3++] = 127 & (o2 >>> 27 | (3 & a2) << 5), n3[i3++] = a2 >>> 2 & 127, n3[i3++] = a2 >>> 9 & 127, n3[i3++] = a2 >>> 16 & 127, n3[i3++] = a2 >>> 23 & 127, n3[i3++] = 127 & (a2 >>> 30 | (31 & l2) << 2), n3[i3++] = l2 >>> 5 & 127, n3[i3++] = l2 >>> 12 & 127, n3[i3++] = l2 >>> 19 & 127, n3[i3++] = 127 & (l2 >>> 26 | (1 & u2) << 6), n3[i3++] = u2 >>> 1 & 127, n3[i3++] = u2 >>> 8 & 127, n3[i3++] = u2 >>> 15 & 127, n3[i3++] = u2 >>> 22 & 127, n3[i3++] = 127 & (u2 >>> 29 | (15 & c2) << 3), n3[i3++] = c2 >>> 4 & 127, n3[i3++] = c2 >>> 11 & 127, n3[i3++] = c2 >>> 18 & 127, n3[i3++] = c2 >>> 25 & 127;
                }
              })(t2, e2, n2, r2);
              break;
            case 8:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 8; e4++) {
                  const e5 = t3[s2++] >>> 0, r4 = t3[s2++] >>> 0, o2 = t3[s2++] >>> 0, a2 = t3[s2++] >>> 0, l2 = t3[s2++] >>> 0, u2 = t3[s2++] >>> 0, c2 = t3[s2++] >>> 0, h2 = t3[s2++] >>> 0;
                  n3[i3++] = e5 >>> 0 & 255, n3[i3++] = e5 >>> 8 & 255, n3[i3++] = e5 >>> 16 & 255, n3[i3++] = e5 >>> 24 & 255, n3[i3++] = r4 >>> 0 & 255, n3[i3++] = r4 >>> 8 & 255, n3[i3++] = r4 >>> 16 & 255, n3[i3++] = r4 >>> 24 & 255, n3[i3++] = o2 >>> 0 & 255, n3[i3++] = o2 >>> 8 & 255, n3[i3++] = o2 >>> 16 & 255, n3[i3++] = o2 >>> 24 & 255, n3[i3++] = a2 >>> 0 & 255, n3[i3++] = a2 >>> 8 & 255, n3[i3++] = a2 >>> 16 & 255, n3[i3++] = a2 >>> 24 & 255, n3[i3++] = l2 >>> 0 & 255, n3[i3++] = l2 >>> 8 & 255, n3[i3++] = l2 >>> 16 & 255, n3[i3++] = l2 >>> 24 & 255, n3[i3++] = u2 >>> 0 & 255, n3[i3++] = u2 >>> 8 & 255, n3[i3++] = u2 >>> 16 & 255, n3[i3++] = u2 >>> 24 & 255, n3[i3++] = c2 >>> 0 & 255, n3[i3++] = c2 >>> 8 & 255, n3[i3++] = c2 >>> 16 & 255, n3[i3++] = c2 >>> 24 & 255, n3[i3++] = h2 >>> 0 & 255, n3[i3++] = h2 >>> 8 & 255, n3[i3++] = h2 >>> 16 & 255, n3[i3++] = h2 >>> 24 & 255;
                }
              })(t2, e2, n2, r2);
              break;
            case 16:
              !(function(t3, e3, n3, r3) {
                let i3 = r3, s2 = e3;
                for (let e4 = 0; e4 < 128; e4++) {
                  const e5 = t3[s2++] >>> 0;
                  n3[i3++] = 65535 & e5, n3[i3++] = e5 >>> 16 & 65535;
                }
              })(t2, e2, n2, r2);
              break;
            default:
              !(function(t3, e3, n3, r3, i3) {
                const s2 = mf[i3] >>> 0;
                let o2 = e3, a2 = 0, l2 = t3[o2] >>> 0, u2 = r3;
                for (let e4 = 0; e4 < 8; e4++) {
                  for (let e5 = 0; e5 < 32; e5++) if (a2 + i3 <= 32) n3[u2 + e5] = l2 >>> a2 & s2, a2 += i3, 32 === a2 && (a2 = 0, o2++, 31 !== e5 && (l2 = t3[o2] >>> 0));
                  else {
                    const r4 = 32 - a2, c2 = l2 >>> a2;
                    o2++, l2 = t3[o2] >>> 0;
                    const h2 = i3 - r4;
                    n3[u2 + e5] = (c2 | (l2 & -1 >>> 32 - h2 >>> 0) << r4) & s2, a2 = h2;
                  }
                  u2 += 32, a2 = 0, e4 < 7 && (l2 = t3[o2] >>> 0);
                }
              })(t2, e2, n2, r2, i2);
          }
          return e2 + (i2 << 3) | 0;
        }
        function Af(t2, e2, n2, r2) {
          if (n2 + 2 > e2) throw new Error(`FastPFOR decode: byteContainer underflow at block=${r2} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n2}, byteSize=${e2})`);
          const i2 = t2[n2++], s2 = t2[n2++];
          if (i2 > 32) throw new Error(`FastPFOR decode: invalid bitWidth=${i2} at block=${r2} (expected 0..32). This likely indicates corrupted or truncated input.`);
          return { bitWidth: i2, exceptionCount: s2, bytePosIn: n2 };
        }
        function Mf(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
          const { maxBits: u2, exceptionBitWidth: c2, bytePosIn: h2 } = (function(t3, e3, n3, r3, i3, s3) {
            if (n3 + 1 > e3) throw new Error(`FastPFOR decode: exception header underflow at block=${s3} (need 1 byte for maxBits, bytePos=${n3}, byteSize=${e3})`);
            const o3 = t3[n3++];
            if (o3 < r3 || o3 > 32) throw new Error(`FastPFOR decode: invalid maxBits=${o3} at block=${s3} (bitWidth=${r3}, expected ${r3}..32)`);
            const a3 = o3 - r3 | 0;
            if (a3 < 1 || a3 > 32) throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a3} at block=${s3} (bitWidth=${r3}, maxBits=${o3})`);
            if (n3 + i3 > e3) throw new Error(`FastPFOR decode: exception positions underflow at block=${s3} (need=${i3}, have=${e3 - n3})`);
            return { maxBits: o3, exceptionBitWidth: a3, bytePosIn: n3 };
          })(i2, s2, o2, n2, r2, l2);
          if (o2 = h2, 1 === c2) {
            const s3 = 1 << n2;
            for (let n3 = 0; n3 < r2; n3 = n3 + 1 | 0) t2[i2[o2++] + e2 | 0] |= s3;
            return o2;
          }
          const p2 = a2.dataToBePacked[c2];
          if (!p2) throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c2} (bitWidth=${n2}, maxBits=${u2}) at block ${l2}`);
          const f2 = a2.dataPointers;
          let d2 = 0 | f2[c2];
          const y2 = 0 | a2.exceptionSizes[c2];
          if (d2 + r2 > y2) throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c2} (ptr=${d2}, need ${r2}, size=${y2}) at block ${l2}`);
          for (let s3 = 0; s3 < r2; s3 = s3 + 1 | 0) {
            const r3 = i2[o2++], s4 = 0 | p2[d2++];
            t2[r3 + e2 | 0] |= s4 << n2;
          }
          return f2[c2] = d2, o2;
        }
        function kf(t2, e2, n2, r2, i2, s2) {
          const o2 = 0 | n2, a2 = 0 | t2[o2];
          if (a2 <= 0 || o2 + a2 > t2.length - 1) throw new Error(`FastPFOR decode: invalid whereMeta=${a2} at pageStart=${o2} (expected > 0 and pageStart+whereMeta < encoded.length=${t2.length})`);
          const l2 = o2 + 1 | 0, u2 = o2 + a2 | 0, c2 = t2[u2] >>> 0, h2 = c2 + 3 >>> 2, p2 = u2 + 1, f2 = p2 + h2;
          if (f2 >= t2.length) throw new Error(`FastPFOR decode: invalid byteSize=${c2} (metaInts=${h2}, pageStart=${o2}, packedEnd=${u2}, byteContainerStart=${p2}) causes bitmapPos=${f2} out of bounds (encoded.length=${t2.length})`);
          const d2 = (function(t3, e3, n3, r3) {
            r3.byteContainer.length < n3 && (r3.byteContainer = new Uint8Array(2 * n3), r3.byteContainerI32 = void 0);
            const i3 = r3.byteContainer, s3 = n3 >>> 2;
            if (3 & i3.byteOffset) for (let n4 = 0; n4 < s3; n4 = n4 + 1 | 0) {
              const r4 = 0 | t3[e3 + n4 | 0], s4 = n4 << 2;
              i3[s4] = 255 & r4, i3[s4 + 1 | 0] = r4 >>> 8 & 255, i3[s4 + 2 | 0] = r4 >>> 16 & 255, i3[s4 + 3 | 0] = r4 >>> 24 & 255;
            }
            else {
              let n4 = r3.byteContainerI32;
              (!n4 || n4.buffer !== i3.buffer || n4.byteOffset !== i3.byteOffset || n4.length < s3) && (n4 = r3.byteContainerI32 = new Int32Array(i3.buffer, i3.byteOffset, i3.byteLength >>> 2)), n4.set(t3.subarray(e3, e3 + s3));
            }
            const o3 = 3 & n3;
            if (o3 > 0) {
              const n4 = 0 | t3[e3 + s3 | 0], r4 = s3 << 2;
              for (let t4 = 0; t4 < o3; t4 = t4 + 1 | 0) i3[r4 + t4 | 0] = n4 >>> (t4 << 3) & 255;
            }
            return i3;
          })(t2, p2, c2, s2), y2 = c2, m2 = (function(t3, e3, n3) {
            const r3 = 0 | t3[e3++], i3 = n3.dataToBePacked;
            for (let s3 = 2; s3 <= 32; s3 = s3 + 1 | 0) {
              if (!(r3 >>> s3 - 1 & 1)) continue;
              if (e3 >= t3.length) throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s3}, streamWordIndex=${e3}, needWords=1, availableWords=${t3.length - e3}, encodedWords=${t3.length})`);
              const o3 = t3[e3++] >>> 0, a3 = xf(o3 + 31, 32), l3 = o3 * s3 + 31 >>> 5;
              if (e3 + l3 > t3.length) throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${s3}, size=${o3}, streamWordIndex=${e3}, needWords=${l3}, availableWords=${t3.length - e3}, encodedWords=${t3.length})`);
              let u3 = i3[s3];
              (!u3 || u3.length < a3) && (u3 = i3[s3] = new Uint32Array(a3));
              let c3 = 0;
              for (; c3 < o3; c3 = c3 + 32 | 0) If(t3, e3, u3, c3, s3), e3 = e3 + s3 | 0;
              e3 = e3 - ((c3 - o3 | 0) * s3 >>> 5) | 0, n3.exceptionSizes[s3] = o3;
            }
            return e3;
          })(t2, f2, s2);
          return s2.dataPointers.fill(0), (function(t3, e3, n3, r3, i3, s3, o3, a3, l3, u3) {
            let c3 = 0 | n3, h3 = 0;
            for (let e4 = 0; e4 < o3; e4 = e4 + 1 | 0) {
              const n4 = Af(a3, l3, h3, e4);
              h3 = n4.bytePosIn;
              const r4 = n4.bitWidth, o4 = n4.exceptionCount, p3 = s3 + e4 * gf | 0;
              switch (r4) {
                case 0:
                  i3.fill(0, p3, p3 + gf);
                  break;
                case 32:
                  for (let e5 = 0; e5 < gf; e5 = e5 + 1 | 0) i3[p3 + e5 | 0] = 0 | t3[c3 + e5 | 0];
                  c3 = c3 + gf | 0;
                  break;
                default:
                  c3 = Sf(t3, c3, i3, p3, r4);
              }
              o4 > 0 && (h3 = Mf(i3, p3, r4, o4, a3, l3, h3, u3, e4));
            }
            if (c3 !== r3) throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e3}, packedStart=${n3}, consumedPackedEnd=${c3}, expectedPackedEnd=${r3}, packedWords=${r3 - n3}, encoded.length=${t3.length})`);
          })(t2, o2, l2, u2, e2, 0 | r2, i2 / gf | 0, d2, y2, s2), m2;
        }
        function If(t2, e2, n2, r2, i2) {
          switch (i2) {
            case 2:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0;
                n3[i3++] = s3 >>> 0 & 3, n3[i3++] = s3 >>> 2 & 3, n3[i3++] = s3 >>> 4 & 3, n3[i3++] = s3 >>> 6 & 3, n3[i3++] = s3 >>> 8 & 3, n3[i3++] = s3 >>> 10 & 3, n3[i3++] = s3 >>> 12 & 3, n3[i3++] = s3 >>> 14 & 3, n3[i3++] = s3 >>> 16 & 3, n3[i3++] = s3 >>> 18 & 3, n3[i3++] = s3 >>> 20 & 3, n3[i3++] = s3 >>> 22 & 3, n3[i3++] = s3 >>> 24 & 3, n3[i3++] = s3 >>> 26 & 3, n3[i3++] = s3 >>> 28 & 3, n3[i3++] = s3 >>> 30 & 3, n3[i3++] = o3 >>> 0 & 3, n3[i3++] = o3 >>> 2 & 3, n3[i3++] = o3 >>> 4 & 3, n3[i3++] = o3 >>> 6 & 3, n3[i3++] = o3 >>> 8 & 3, n3[i3++] = o3 >>> 10 & 3, n3[i3++] = o3 >>> 12 & 3, n3[i3++] = o3 >>> 14 & 3, n3[i3++] = o3 >>> 16 & 3, n3[i3++] = o3 >>> 18 & 3, n3[i3++] = o3 >>> 20 & 3, n3[i3++] = o3 >>> 22 & 3, n3[i3++] = o3 >>> 24 & 3, n3[i3++] = o3 >>> 26 & 3, n3[i3++] = o3 >>> 28 & 3, n3[i3] = o3 >>> 30 & 3;
              })(t2, e2, n2, r2);
            case 3:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0;
                n3[i3++] = s3 >>> 0 & 7, n3[i3++] = s3 >>> 3 & 7, n3[i3++] = s3 >>> 6 & 7, n3[i3++] = s3 >>> 9 & 7, n3[i3++] = s3 >>> 12 & 7, n3[i3++] = s3 >>> 15 & 7, n3[i3++] = s3 >>> 18 & 7, n3[i3++] = s3 >>> 21 & 7, n3[i3++] = s3 >>> 24 & 7, n3[i3++] = s3 >>> 27 & 7, n3[i3++] = 7 & (s3 >>> 30 | (1 & o3) << 2), n3[i3++] = o3 >>> 1 & 7, n3[i3++] = o3 >>> 4 & 7, n3[i3++] = o3 >>> 7 & 7, n3[i3++] = o3 >>> 10 & 7, n3[i3++] = o3 >>> 13 & 7, n3[i3++] = o3 >>> 16 & 7, n3[i3++] = o3 >>> 19 & 7, n3[i3++] = o3 >>> 22 & 7, n3[i3++] = o3 >>> 25 & 7, n3[i3++] = o3 >>> 28 & 7, n3[i3++] = 7 & (o3 >>> 31 | (3 & a3) << 1), n3[i3++] = a3 >>> 2 & 7, n3[i3++] = a3 >>> 5 & 7, n3[i3++] = a3 >>> 8 & 7, n3[i3++] = a3 >>> 11 & 7, n3[i3++] = a3 >>> 14 & 7, n3[i3++] = a3 >>> 17 & 7, n3[i3++] = a3 >>> 20 & 7, n3[i3++] = a3 >>> 23 & 7, n3[i3++] = a3 >>> 26 & 7, n3[i3] = a3 >>> 29 & 7;
              })(t2, e2, n2, r2);
            case 4:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0;
                n3[i3++] = s3 >>> 0 & 15, n3[i3++] = s3 >>> 4 & 15, n3[i3++] = s3 >>> 8 & 15, n3[i3++] = s3 >>> 12 & 15, n3[i3++] = s3 >>> 16 & 15, n3[i3++] = s3 >>> 20 & 15, n3[i3++] = s3 >>> 24 & 15, n3[i3++] = s3 >>> 28 & 15, n3[i3++] = o3 >>> 0 & 15, n3[i3++] = o3 >>> 4 & 15, n3[i3++] = o3 >>> 8 & 15, n3[i3++] = o3 >>> 12 & 15, n3[i3++] = o3 >>> 16 & 15, n3[i3++] = o3 >>> 20 & 15, n3[i3++] = o3 >>> 24 & 15, n3[i3++] = o3 >>> 28 & 15, n3[i3++] = a3 >>> 0 & 15, n3[i3++] = a3 >>> 4 & 15, n3[i3++] = a3 >>> 8 & 15, n3[i3++] = a3 >>> 12 & 15, n3[i3++] = a3 >>> 16 & 15, n3[i3++] = a3 >>> 20 & 15, n3[i3++] = a3 >>> 24 & 15, n3[i3++] = a3 >>> 28 & 15, n3[i3++] = l3 >>> 0 & 15, n3[i3++] = l3 >>> 4 & 15, n3[i3++] = l3 >>> 8 & 15, n3[i3++] = l3 >>> 12 & 15, n3[i3++] = l3 >>> 16 & 15, n3[i3++] = l3 >>> 20 & 15, n3[i3++] = l3 >>> 24 & 15, n3[i3] = l3 >>> 28 & 15;
              })(t2, e2, n2, r2);
            case 5:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0;
                n3[i3++] = s3 >>> 0 & 31, n3[i3++] = s3 >>> 5 & 31, n3[i3++] = s3 >>> 10 & 31, n3[i3++] = s3 >>> 15 & 31, n3[i3++] = s3 >>> 20 & 31, n3[i3++] = s3 >>> 25 & 31, n3[i3++] = 31 & (s3 >>> 30 | (7 & o3) << 2), n3[i3++] = o3 >>> 3 & 31, n3[i3++] = o3 >>> 8 & 31, n3[i3++] = o3 >>> 13 & 31, n3[i3++] = o3 >>> 18 & 31, n3[i3++] = o3 >>> 23 & 31, n3[i3++] = 31 & (o3 >>> 28 | (1 & a3) << 4), n3[i3++] = a3 >>> 1 & 31, n3[i3++] = a3 >>> 6 & 31, n3[i3++] = a3 >>> 11 & 31, n3[i3++] = a3 >>> 16 & 31, n3[i3++] = a3 >>> 21 & 31, n3[i3++] = a3 >>> 26 & 31, n3[i3++] = 31 & (a3 >>> 31 | (15 & l3) << 1), n3[i3++] = l3 >>> 4 & 31, n3[i3++] = l3 >>> 9 & 31, n3[i3++] = l3 >>> 14 & 31, n3[i3++] = l3 >>> 19 & 31, n3[i3++] = l3 >>> 24 & 31, n3[i3++] = 31 & (l3 >>> 29 | (3 & u2) << 3), n3[i3++] = u2 >>> 2 & 31, n3[i3++] = u2 >>> 7 & 31, n3[i3++] = u2 >>> 12 & 31, n3[i3++] = u2 >>> 17 & 31, n3[i3++] = u2 >>> 22 & 31, n3[i3] = u2 >>> 27 & 31;
              })(t2, e2, n2, r2);
            case 6:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0;
                n3[i3++] = s3 >>> 0 & 63, n3[i3++] = s3 >>> 6 & 63, n3[i3++] = s3 >>> 12 & 63, n3[i3++] = s3 >>> 18 & 63, n3[i3++] = s3 >>> 24 & 63, n3[i3++] = 63 & (s3 >>> 30 | (15 & o3) << 2), n3[i3++] = o3 >>> 4 & 63, n3[i3++] = o3 >>> 10 & 63, n3[i3++] = o3 >>> 16 & 63, n3[i3++] = o3 >>> 22 & 63, n3[i3++] = 63 & (o3 >>> 28 | (3 & a3) << 4), n3[i3++] = a3 >>> 2 & 63, n3[i3++] = a3 >>> 8 & 63, n3[i3++] = a3 >>> 14 & 63, n3[i3++] = a3 >>> 20 & 63, n3[i3++] = a3 >>> 26 & 63, n3[i3++] = l3 >>> 0 & 63, n3[i3++] = l3 >>> 6 & 63, n3[i3++] = l3 >>> 12 & 63, n3[i3++] = l3 >>> 18 & 63, n3[i3++] = l3 >>> 24 & 63, n3[i3++] = 63 & (l3 >>> 30 | (15 & u2) << 2), n3[i3++] = u2 >>> 4 & 63, n3[i3++] = u2 >>> 10 & 63, n3[i3++] = u2 >>> 16 & 63, n3[i3++] = u2 >>> 22 & 63, n3[i3++] = 63 & (u2 >>> 28 | (3 & c2) << 4), n3[i3++] = c2 >>> 2 & 63, n3[i3++] = c2 >>> 8 & 63, n3[i3++] = c2 >>> 14 & 63, n3[i3++] = c2 >>> 20 & 63, n3[i3] = c2 >>> 26 & 63;
              })(t2, e2, n2, r2);
            case 7:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0;
                n3[i3++] = s3 >>> 0 & 127, n3[i3++] = s3 >>> 7 & 127, n3[i3++] = s3 >>> 14 & 127, n3[i3++] = s3 >>> 21 & 127, n3[i3++] = 127 & (s3 >>> 28 | (7 & o3) << 4), n3[i3++] = o3 >>> 3 & 127, n3[i3++] = o3 >>> 10 & 127, n3[i3++] = o3 >>> 17 & 127, n3[i3++] = o3 >>> 24 & 127, n3[i3++] = 127 & (o3 >>> 31 | (63 & a3) << 1), n3[i3++] = a3 >>> 6 & 127, n3[i3++] = a3 >>> 13 & 127, n3[i3++] = a3 >>> 20 & 127, n3[i3++] = 127 & (a3 >>> 27 | (3 & l3) << 5), n3[i3++] = l3 >>> 2 & 127, n3[i3++] = l3 >>> 9 & 127, n3[i3++] = l3 >>> 16 & 127, n3[i3++] = l3 >>> 23 & 127, n3[i3++] = 127 & (l3 >>> 30 | (31 & u2) << 2), n3[i3++] = u2 >>> 5 & 127, n3[i3++] = u2 >>> 12 & 127, n3[i3++] = u2 >>> 19 & 127, n3[i3++] = 127 & (u2 >>> 26 | (1 & c2) << 6), n3[i3++] = c2 >>> 1 & 127, n3[i3++] = c2 >>> 8 & 127, n3[i3++] = c2 >>> 15 & 127, n3[i3++] = c2 >>> 22 & 127, n3[i3++] = 127 & (c2 >>> 29 | (15 & h2) << 3), n3[i3++] = h2 >>> 4 & 127, n3[i3++] = h2 >>> 11 & 127, n3[i3++] = h2 >>> 18 & 127, n3[i3] = h2 >>> 25 & 127;
              })(t2, e2, n2, r2);
            case 8:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0;
                n3[i3++] = s3 >>> 0 & 255, n3[i3++] = s3 >>> 8 & 255, n3[i3++] = s3 >>> 16 & 255, n3[i3++] = s3 >>> 24 & 255, n3[i3++] = o3 >>> 0 & 255, n3[i3++] = o3 >>> 8 & 255, n3[i3++] = o3 >>> 16 & 255, n3[i3++] = o3 >>> 24 & 255, n3[i3++] = a3 >>> 0 & 255, n3[i3++] = a3 >>> 8 & 255, n3[i3++] = a3 >>> 16 & 255, n3[i3++] = a3 >>> 24 & 255, n3[i3++] = l3 >>> 0 & 255, n3[i3++] = l3 >>> 8 & 255, n3[i3++] = l3 >>> 16 & 255, n3[i3++] = l3 >>> 24 & 255, n3[i3++] = u2 >>> 0 & 255, n3[i3++] = u2 >>> 8 & 255, n3[i3++] = u2 >>> 16 & 255, n3[i3++] = u2 >>> 24 & 255, n3[i3++] = c2 >>> 0 & 255, n3[i3++] = c2 >>> 8 & 255, n3[i3++] = c2 >>> 16 & 255, n3[i3++] = c2 >>> 24 & 255, n3[i3++] = h2 >>> 0 & 255, n3[i3++] = h2 >>> 8 & 255, n3[i3++] = h2 >>> 16 & 255, n3[i3++] = h2 >>> 24 & 255, n3[i3++] = p2 >>> 0 & 255, n3[i3++] = p2 >>> 8 & 255, n3[i3++] = p2 >>> 16 & 255, n3[i3] = p2 >>> 24 & 255;
              })(t2, e2, n2, r2);
            case 9:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0, f2 = t3[e3 + 8] >>> 0;
                n3[i3++] = s3 >>> 0 & 511, n3[i3++] = s3 >>> 9 & 511, n3[i3++] = s3 >>> 18 & 511, n3[i3++] = 511 & (s3 >>> 27 | (15 & o3) << 5), n3[i3++] = o3 >>> 4 & 511, n3[i3++] = o3 >>> 13 & 511, n3[i3++] = o3 >>> 22 & 511, n3[i3++] = 511 & (o3 >>> 31 | (255 & a3) << 1), n3[i3++] = a3 >>> 8 & 511, n3[i3++] = a3 >>> 17 & 511, n3[i3++] = 511 & (a3 >>> 26 | (7 & l3) << 6), n3[i3++] = l3 >>> 3 & 511, n3[i3++] = l3 >>> 12 & 511, n3[i3++] = l3 >>> 21 & 511, n3[i3++] = 511 & (l3 >>> 30 | (127 & u2) << 2), n3[i3++] = u2 >>> 7 & 511, n3[i3++] = u2 >>> 16 & 511, n3[i3++] = 511 & (u2 >>> 25 | (3 & c2) << 7), n3[i3++] = c2 >>> 2 & 511, n3[i3++] = c2 >>> 11 & 511, n3[i3++] = c2 >>> 20 & 511, n3[i3++] = 511 & (c2 >>> 29 | (63 & h2) << 3), n3[i3++] = h2 >>> 6 & 511, n3[i3++] = h2 >>> 15 & 511, n3[i3++] = 511 & (h2 >>> 24 | (1 & p2) << 8), n3[i3++] = p2 >>> 1 & 511, n3[i3++] = p2 >>> 10 & 511, n3[i3++] = p2 >>> 19 & 511, n3[i3++] = 511 & (p2 >>> 28 | (31 & f2) << 4), n3[i3++] = f2 >>> 5 & 511, n3[i3++] = f2 >>> 14 & 511, n3[i3] = f2 >>> 23 & 511;
              })(t2, e2, n2, r2);
            case 10:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0, f2 = t3[e3 + 8] >>> 0, d2 = t3[e3 + 9] >>> 0;
                n3[i3++] = s3 >>> 0 & 1023, n3[i3++] = s3 >>> 10 & 1023, n3[i3++] = s3 >>> 20 & 1023, n3[i3++] = 1023 & (s3 >>> 30 | (255 & o3) << 2), n3[i3++] = o3 >>> 8 & 1023, n3[i3++] = o3 >>> 18 & 1023, n3[i3++] = 1023 & (o3 >>> 28 | (63 & a3) << 4), n3[i3++] = a3 >>> 6 & 1023, n3[i3++] = a3 >>> 16 & 1023, n3[i3++] = 1023 & (a3 >>> 26 | (15 & l3) << 6), n3[i3++] = l3 >>> 4 & 1023, n3[i3++] = l3 >>> 14 & 1023, n3[i3++] = 1023 & (l3 >>> 24 | (3 & u2) << 8), n3[i3++] = u2 >>> 2 & 1023, n3[i3++] = u2 >>> 12 & 1023, n3[i3++] = u2 >>> 22 & 1023, n3[i3++] = c2 >>> 0 & 1023, n3[i3++] = c2 >>> 10 & 1023, n3[i3++] = c2 >>> 20 & 1023, n3[i3++] = 1023 & (c2 >>> 30 | (255 & h2) << 2), n3[i3++] = h2 >>> 8 & 1023, n3[i3++] = h2 >>> 18 & 1023, n3[i3++] = 1023 & (h2 >>> 28 | (63 & p2) << 4), n3[i3++] = p2 >>> 6 & 1023, n3[i3++] = p2 >>> 16 & 1023, n3[i3++] = 1023 & (p2 >>> 26 | (15 & f2) << 6), n3[i3++] = f2 >>> 4 & 1023, n3[i3++] = f2 >>> 14 & 1023, n3[i3++] = 1023 & (f2 >>> 24 | (3 & d2) << 8), n3[i3++] = d2 >>> 2 & 1023, n3[i3++] = d2 >>> 12 & 1023, n3[i3] = d2 >>> 22 & 1023;
              })(t2, e2, n2, r2);
            case 11:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0, f2 = t3[e3 + 8] >>> 0, d2 = t3[e3 + 9] >>> 0, y2 = t3[e3 + 10] >>> 0;
                n3[i3++] = s3 >>> 0 & 2047, n3[i3++] = s3 >>> 11 & 2047, n3[i3++] = 2047 & (s3 >>> 22 | (1 & o3) << 10), n3[i3++] = o3 >>> 1 & 2047, n3[i3++] = o3 >>> 12 & 2047, n3[i3++] = 2047 & (o3 >>> 23 | (3 & a3) << 9), n3[i3++] = a3 >>> 2 & 2047, n3[i3++] = a3 >>> 13 & 2047, n3[i3++] = 2047 & (a3 >>> 24 | (7 & l3) << 8), n3[i3++] = l3 >>> 3 & 2047, n3[i3++] = l3 >>> 14 & 2047, n3[i3++] = 2047 & (l3 >>> 25 | (15 & u2) << 7), n3[i3++] = u2 >>> 4 & 2047, n3[i3++] = u2 >>> 15 & 2047, n3[i3++] = 2047 & (u2 >>> 26 | (31 & c2) << 6), n3[i3++] = c2 >>> 5 & 2047, n3[i3++] = c2 >>> 16 & 2047, n3[i3++] = 2047 & (c2 >>> 27 | (63 & h2) << 5), n3[i3++] = h2 >>> 6 & 2047, n3[i3++] = h2 >>> 17 & 2047, n3[i3++] = 2047 & (h2 >>> 28 | (127 & p2) << 4), n3[i3++] = p2 >>> 7 & 2047, n3[i3++] = p2 >>> 18 & 2047, n3[i3++] = 2047 & (p2 >>> 29 | (255 & f2) << 3), n3[i3++] = f2 >>> 8 & 2047, n3[i3++] = f2 >>> 19 & 2047, n3[i3++] = 2047 & (f2 >>> 30 | (511 & d2) << 2), n3[i3++] = d2 >>> 9 & 2047, n3[i3++] = d2 >>> 20 & 2047, n3[i3++] = 2047 & (d2 >>> 31 | (1023 & y2) << 1), n3[i3++] = y2 >>> 10 & 2047, n3[i3] = y2 >>> 21 & 2047;
              })(t2, e2, n2, r2);
            case 12:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0, f2 = t3[e3 + 8] >>> 0, d2 = t3[e3 + 9] >>> 0, y2 = t3[e3 + 10] >>> 0, m2 = t3[e3 + 11] >>> 0;
                n3[i3++] = s3 >>> 0 & 4095, n3[i3++] = s3 >>> 12 & 4095, n3[i3++] = 4095 & (s3 >>> 24 | (15 & o3) << 8), n3[i3++] = o3 >>> 4 & 4095, n3[i3++] = o3 >>> 16 & 4095, n3[i3++] = 4095 & (o3 >>> 28 | (255 & a3) << 4), n3[i3++] = a3 >>> 8 & 4095, n3[i3++] = a3 >>> 20 & 4095, n3[i3++] = l3 >>> 0 & 4095, n3[i3++] = l3 >>> 12 & 4095, n3[i3++] = 4095 & (l3 >>> 24 | (15 & u2) << 8), n3[i3++] = u2 >>> 4 & 4095, n3[i3++] = u2 >>> 16 & 4095, n3[i3++] = 4095 & (u2 >>> 28 | (255 & c2) << 4), n3[i3++] = c2 >>> 8 & 4095, n3[i3++] = c2 >>> 20 & 4095, n3[i3++] = h2 >>> 0 & 4095, n3[i3++] = h2 >>> 12 & 4095, n3[i3++] = 4095 & (h2 >>> 24 | (15 & p2) << 8), n3[i3++] = p2 >>> 4 & 4095, n3[i3++] = p2 >>> 16 & 4095, n3[i3++] = 4095 & (p2 >>> 28 | (255 & f2) << 4), n3[i3++] = f2 >>> 8 & 4095, n3[i3++] = f2 >>> 20 & 4095, n3[i3++] = d2 >>> 0 & 4095, n3[i3++] = d2 >>> 12 & 4095, n3[i3++] = 4095 & (d2 >>> 24 | (15 & y2) << 8), n3[i3++] = y2 >>> 4 & 4095, n3[i3++] = y2 >>> 16 & 4095, n3[i3++] = 4095 & (y2 >>> 28 | (255 & m2) << 4), n3[i3++] = m2 >>> 8 & 4095, n3[i3] = m2 >>> 20 & 4095;
              })(t2, e2, n2, r2);
            case 16:
              return void (function(t3, e3, n3, r3) {
                let i3 = r3;
                const s3 = t3[e3] >>> 0, o3 = t3[e3 + 1] >>> 0, a3 = t3[e3 + 2] >>> 0, l3 = t3[e3 + 3] >>> 0, u2 = t3[e3 + 4] >>> 0, c2 = t3[e3 + 5] >>> 0, h2 = t3[e3 + 6] >>> 0, p2 = t3[e3 + 7] >>> 0, f2 = t3[e3 + 8] >>> 0, d2 = t3[e3 + 9] >>> 0, y2 = t3[e3 + 10] >>> 0, m2 = t3[e3 + 11] >>> 0, g2 = t3[e3 + 12] >>> 0, x2 = t3[e3 + 13] >>> 0, v2 = t3[e3 + 14] >>> 0, b2 = t3[e3 + 15] >>> 0;
                n3[i3++] = s3 >>> 0 & 65535, n3[i3++] = s3 >>> 16 & 65535, n3[i3++] = o3 >>> 0 & 65535, n3[i3++] = o3 >>> 16 & 65535, n3[i3++] = a3 >>> 0 & 65535, n3[i3++] = a3 >>> 16 & 65535, n3[i3++] = l3 >>> 0 & 65535, n3[i3++] = l3 >>> 16 & 65535, n3[i3++] = u2 >>> 0 & 65535, n3[i3++] = u2 >>> 16 & 65535, n3[i3++] = c2 >>> 0 & 65535, n3[i3++] = c2 >>> 16 & 65535, n3[i3++] = h2 >>> 0 & 65535, n3[i3++] = h2 >>> 16 & 65535, n3[i3++] = p2 >>> 0 & 65535, n3[i3++] = p2 >>> 16 & 65535, n3[i3++] = f2 >>> 0 & 65535, n3[i3++] = f2 >>> 16 & 65535, n3[i3++] = d2 >>> 0 & 65535, n3[i3++] = d2 >>> 16 & 65535, n3[i3++] = y2 >>> 0 & 65535, n3[i3++] = y2 >>> 16 & 65535, n3[i3++] = m2 >>> 0 & 65535, n3[i3++] = m2 >>> 16 & 65535, n3[i3++] = g2 >>> 0 & 65535, n3[i3++] = g2 >>> 16 & 65535, n3[i3++] = x2 >>> 0 & 65535, n3[i3++] = x2 >>> 16 & 65535, n3[i3++] = v2 >>> 0 & 65535, n3[i3++] = v2 >>> 16 & 65535, n3[i3++] = b2 >>> 0 & 65535, n3[i3] = b2 >>> 16 & 65535;
              })(t2, e2, n2, r2);
            case 32:
              for (let i3 = 0; i3 < 32; i3 = i3 + 1 | 0) n2[r2 + i3 | 0] = 0 | t2[e2 + i3 | 0];
              return;
          }
          const s2 = mf[i2] >>> 0;
          let o2 = e2, a2 = 0, l2 = t2[o2] >>> 0;
          for (let e3 = 0; e3 < 32; e3++) if (a2 + i2 <= 32) n2[r2 + e3] = l2 >>> a2 & s2, a2 += i2, 32 === a2 && (a2 = 0, o2++, 31 !== e3 && (l2 = t2[o2] >>> 0));
          else {
            const u2 = 32 - a2, c2 = l2 >>> a2;
            o2++, l2 = t2[o2] >>> 0, n2[r2 + e3] = (c2 | (l2 & mf[i2 - u2] >>> 0) << u2) & s2, a2 = i2 - u2;
          }
        }
        function Ef(t2, e2, n2) {
          const r2 = new Uint32Array(n2);
          let i2 = 0, s2 = e2.get();
          for (let e3 = 0; e3 < r2.length; e3++) {
            let e4 = t2[s2++], n3 = 127 & e4;
            e4 < 128 || (e4 = t2[s2++], n3 |= (127 & e4) << 7, e4 < 128 || (e4 = t2[s2++], n3 |= (127 & e4) << 14, e4 < 128 || (e4 = t2[s2++], n3 |= (127 & e4) << 21, e4 < 128 || (e4 = t2[s2++], n3 |= (15 & e4) << 28)))), r2[i2++] = n3;
          }
          return e2.set(s2), r2;
        }
        function Tf(t2, e2, n2) {
          const r2 = new BigUint64Array(n2);
          for (let n3 = 0; n3 < r2.length; n3++) r2[n3] = Ff(t2, e2);
          return r2;
        }
        function Ff(t2, e2) {
          let n2 = 0n, r2 = 0, i2 = e2.get();
          for (; i2 < t2.length; ) {
            const e3 = t2[i2++];
            if (n2 |= BigInt(127 & e3) << BigInt(r2), !(128 & e3)) break;
            if (r2 += 7, r2 >= 64) throw new Error("Varint too long");
          }
          return e2.set(i2), n2;
        }
        function Pf(t2, e2) {
          let n2, r2;
          return r2 = t2[e2.get()], e2.increment(), n2 = 127 & r2, r2 < 128 ? n2 : (r2 = t2[e2.get()], e2.increment(), n2 |= (127 & r2) << 7, r2 < 128 ? n2 : (r2 = t2[e2.get()], e2.increment(), n2 |= (127 & r2) << 14, r2 < 128 ? n2 : (r2 = t2[e2.get()], e2.increment(), n2 |= (127 & r2) << 21, r2 < 128 ? n2 : (r2 = t2[e2.get()], n2 |= (15 & r2) << 28, (function(t3, e3, n3) {
            let r3, i2;
            if (i2 = e3[n3.get()], n3.increment(), r3 = (112 & i2) >> 4, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            if (i2 = e3[n3.get()], n3.increment(), r3 |= (127 & i2) << 3, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            if (i2 = e3[n3.get()], n3.increment(), r3 |= (127 & i2) << 10, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            if (i2 = e3[n3.get()], n3.increment(), r3 |= (127 & i2) << 17, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            if (i2 = e3[n3.get()], n3.increment(), r3 |= (127 & i2) << 24, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            if (i2 = e3[n3.get()], n3.increment(), r3 |= (1 & i2) << 31, i2 < 128) return 4294967296 * r3 + (t3 >>> 0);
            throw new Error("Expected varint not more than 10 bytes");
          })(n2, t2, e2)))));
        }
        function Df(t2) {
          return t2 >>> 1 ^ -(1 & t2);
        }
        function zf(t2) {
          return t2 >> 1n ^ -(1n & t2);
        }
        function Bf(t2) {
          return t2 % 2 == 1 ? (t2 + 1) / -2 : t2 / 2;
        }
        function Cf(t2, e2, n2) {
          if (void 0 === n2) {
            n2 = 0;
            for (let r3 = 0; r3 < e2; r3++) n2 += t2[r3];
          }
          const r2 = new Uint32Array(n2);
          let i2 = 0;
          for (let n3 = 0; n3 < e2; n3++) {
            const s2 = t2[n3];
            r2.fill(t2[n3 + e2], i2, i2 + s2), i2 += s2;
          }
          return r2;
        }
        function Vf(t2, e2, n2) {
          if (void 0 === n2) {
            n2 = 0;
            for (let r3 = 0; r3 < e2; r3++) n2 += Number(t2[r3]);
          }
          const r2 = new BigUint64Array(n2);
          let i2 = 0;
          for (let n3 = 0; n3 < e2; n3++) {
            const s2 = Number(t2[n3]);
            r2.fill(t2[n3 + e2], i2, i2 + s2), i2 += s2;
          }
          return r2;
        }
        function Lf(t2, e2, n2) {
          const r2 = new Float64Array(n2);
          let i2 = 0;
          for (let n3 = 0; n3 < e2; n3++) {
            const s2 = t2[n3];
            r2.fill(t2[n3 + e2], i2, i2 + s2), i2 += s2;
          }
          return r2;
        }
        function Of(t2) {
          const e2 = new Int32Array(t2.length);
          e2[0] = Df(t2[0]);
          const n2 = t2.length / 4 * 4;
          let r2 = 1;
          if (n2 >= 4) for (; r2 < n2 - 4; r2 += 4) {
            const n3 = t2[r2 + 1], i2 = t2[r2 + 2], s2 = t2[r2 + 3];
            e2[r2] = Df(t2[r2]) + e2[r2 - 1], e2[r2 + 1] = Df(n3) + e2[r2], e2[r2 + 2] = Df(i2) + e2[r2 + 1], e2[r2 + 3] = Df(s2) + e2[r2 + 2];
          }
          for (; r2 !== t2.length; ++r2) e2[r2] = Df(t2[r2]) + e2[r2 - 1];
          return e2;
        }
        function $f(t2) {
          const e2 = new BigInt64Array(t2.length);
          e2[0] = zf(t2[0]);
          const n2 = t2.length / 4 * 4;
          let r2 = 1;
          if (n2 >= 4) for (; r2 < n2 - 4; r2 += 4) {
            const n3 = t2[r2 + 1], i2 = t2[r2 + 2], s2 = t2[r2 + 3];
            e2[r2] = zf(t2[r2]) + e2[r2 - 1], e2[r2 + 1] = zf(n3) + e2[r2], e2[r2 + 2] = zf(i2) + e2[r2 + 1], e2[r2 + 3] = zf(s2) + e2[r2 + 2];
          }
          for (; r2 !== e2.length; ++r2) e2[r2] = zf(t2[r2]) + e2[r2 - 1];
          return e2;
        }
        function Rf(t2) {
          const e2 = t2.length / 4 * 4;
          let n2 = 1;
          if (e2 >= 4) for (let r2 = t2[0]; n2 < e2 - 4; n2 += 4) r2 = t2[n2] += r2, r2 = t2[n2 + 1] += r2, r2 = t2[n2 + 2] += r2, r2 = t2[n2 + 3] += r2;
          for (; n2 !== t2.length; ) t2[n2] += t2[n2 - 1], ++n2;
        }
        var Nf, Uf, jf, qf, Gf, Xf, Yf, Zf;
        function Hf(t2, e2) {
          const n2 = (function(t3, e3) {
            const n3 = t3[e3.get()], r2 = Object.values(Nf)[n3 >> 4];
            let i2 = null;
            switch (r2) {
              case Nf.DATA:
                i2 = { dictionaryType: Object.values(Uf)[15 & n3] };
                break;
              case Nf.OFFSET:
                i2 = { offsetType: Object.values(jf)[15 & n3] };
                break;
              case Nf.LENGTH:
                i2 = { lengthType: Object.values(qf)[15 & n3] };
            }
            e3.increment();
            const s2 = t3[e3.get()], o2 = Object.values(ff)[s2 >> 5], a2 = Object.values(ff)[s2 >> 2 & 7], l2 = Object.values(df)[3 & s2];
            e3.increment();
            const u2 = Ef(t3, e3, 2), c2 = u2[0];
            return { physicalStreamType: r2, logicalStreamType: i2, logicalLevelTechnique1: o2, logicalLevelTechnique2: a2, physicalLevelTechnique: l2, numValues: c2, byteLength: u2[1], decompressedCount: c2 };
          })(t2, e2);
          return n2.logicalLevelTechnique1 === ff.MORTON ? (function(t3, e3, n3) {
            const r2 = Ef(e3, n3, 2);
            return { physicalStreamType: t3.physicalStreamType, logicalStreamType: t3.logicalStreamType, logicalLevelTechnique1: t3.logicalLevelTechnique1, logicalLevelTechnique2: t3.logicalLevelTechnique2, physicalLevelTechnique: t3.physicalLevelTechnique, numValues: t3.numValues, byteLength: t3.byteLength, decompressedCount: t3.decompressedCount, numBits: r2[0], coordinateShift: r2[1] };
          })(n2, t2, e2) : ff.RLE !== n2.logicalLevelTechnique1 && ff.RLE !== n2.logicalLevelTechnique2 || df.NONE === n2.physicalLevelTechnique ? n2 : (function(t3, e3, n3) {
            const r2 = Ef(e3, n3, 2);
            return { physicalStreamType: t3.physicalStreamType, logicalStreamType: t3.logicalStreamType, logicalLevelTechnique1: t3.logicalLevelTechnique1, logicalLevelTechnique2: t3.logicalLevelTechnique2, physicalLevelTechnique: t3.physicalLevelTechnique, numValues: t3.numValues, byteLength: t3.byteLength, decompressedCount: r2[1], runs: r2[0], numRleValues: r2[1] };
          })(n2, t2, e2);
        }
        !(function(t2) {
          t2.PRESENT = "PRESENT", t2.DATA = "DATA", t2.OFFSET = "OFFSET", t2.LENGTH = "LENGTH";
        })(Nf || (Nf = {})), (function(t2) {
          t2.NONE = "NONE", t2.SINGLE = "SINGLE", t2.SHARED = "SHARED", t2.VERTEX = "VERTEX", t2.MORTON = "MORTON", t2.FSST = "FSST";
        })(Uf || (Uf = {})), (function(t2) {
          t2.VERTEX = "VERTEX", t2.INDEX = "INDEX", t2.STRING = "STRING", t2.KEY = "KEY";
        })(jf || (jf = {})), (function(t2) {
          t2.VAR_BINARY = "VAR_BINARY", t2.GEOMETRIES = "GEOMETRIES", t2.PARTS = "PARTS", t2.RINGS = "RINGS", t2.TRIANGLES = "TRIANGLES", t2.SYMBOL = "SYMBOL", t2.DICTIONARY = "DICTIONARY";
        })(qf || (qf = {})), (function(t2) {
          t2[t2.FLAT = 0] = "FLAT", t2[t2.CONST = 1] = "CONST", t2[t2.SEQUENCE = 2] = "SEQUENCE", t2[t2.DICTIONARY = 3] = "DICTIONARY", t2[t2.FSST_DICTIONARY = 4] = "FSST_DICTIONARY";
        })(Gf || (Gf = {}));
        class Wf {
          constructor(t2, e2) {
            this.values = t2, this._size = e2;
          }
          get(t2) {
            const e2 = Math.floor(t2 / 8);
            return 1 == (this.values[e2] >> t2 % 8 & 1);
          }
          set(t2, e2) {
            const n2 = Math.floor(t2 / 8);
            this.values[n2] = this.values[n2] | (e2 ? 1 : 0) << t2 % 8;
          }
          getInt(t2) {
            const e2 = Math.floor(t2 / 8);
            return this.values[e2] >> t2 % 8 & 1;
          }
          size() {
            return this._size;
          }
          getBuffer() {
            return this.values;
          }
        }
        function Kf(t2, e2, n2) {
          if (!e2) return t2;
          const r2 = e2.size(), i2 = new (t2.constructor)(r2);
          let s2 = 0;
          for (let o2 = 0; o2 < r2; o2++) i2[o2] = e2.get(o2) ? t2[s2++] : n2;
          return i2;
        }
        function Jf(t2, e2, n2, r2, i2) {
          return (function(t3, e3, n3, r3) {
            let i3;
            switch (e3.logicalLevelTechnique1) {
              case ff.DELTA:
                if (e3.logicalLevelTechnique2 === ff.RLE) {
                  const n4 = e3;
                  if (!r3) return (function(t4, e4, n5) {
                    const r4 = new Int32Array(n5);
                    let i4 = 0, s2 = 0;
                    for (let n6 = 0; n6 < e4; n6++) {
                      const o2 = t4[n6], a2 = Df(t4[n6 + e4]);
                      for (let t5 = 0; t5 < o2; t5++) s2 += a2, r4[i4++] = s2;
                    }
                    return r4;
                  })(t3, n4.runs, n4.numRleValues);
                  i3 = Of(t3 = Cf(t3, n4.runs, n4.numRleValues));
                } else i3 = Of(t3);
                break;
              case ff.RLE:
                i3 = (function(t4, e4, n4) {
                  if (void 0 === n4) {
                    n4 = 0;
                    for (let r5 = 0; r5 < e4; r5++) n4 += t4[r5];
                  }
                  const r4 = new Int32Array(n4);
                  let i4 = 0;
                  for (let n5 = 0; n5 < e4; n5++) {
                    const s2 = t4[n5];
                    let o2 = t4[n5 + e4];
                    o2 = Df(o2), r4.fill(o2, i4, i4 + s2), i4 += s2;
                  }
                  return r4;
                })(t3, e3.runs, e3.numRleValues);
                break;
              case ff.MORTON:
                Rf(t3), i3 = new Int32Array(t3);
                break;
              case ff.COMPONENTWISE_DELTA:
                i3 = (function(t4) {
                  if (t4.length < 2) return new Int32Array(t4);
                  const e4 = new Int32Array(t4.length);
                  e4[0] = Df(t4[0]), e4[1] = Df(t4[1]);
                  const n4 = t4.length / 4 * 4;
                  let r4 = 2;
                  if (n4 >= 4) for (; r4 < n4 - 4; r4 += 4) {
                    const n5 = t4[r4 + 1], i4 = t4[r4 + 2], s2 = t4[r4 + 3];
                    e4[r4] = Df(t4[r4]) + e4[r4 - 2], e4[r4 + 1] = Df(n5) + e4[r4 - 1], e4[r4 + 2] = Df(i4) + e4[r4], e4[r4 + 3] = Df(s2) + e4[r4 + 1];
                  }
                  for (; r4 !== t4.length; r4 += 2) e4[r4] = Df(t4[r4]) + e4[r4 - 2], e4[r4 + 1] = Df(t4[r4 + 1]) + e4[r4 - 1];
                  return e4;
                })(t3);
                break;
              case ff.NONE:
                i3 = (function(t4) {
                  const e4 = new Int32Array(t4.length);
                  for (let n4 = 0; n4 < t4.length; n4++) e4[n4] = Df(t4[n4]);
                  return e4;
                })(t3);
                break;
              default:
                throw new Error(`The specified Logical level technique is not supported: ${e3.logicalLevelTechnique1}`);
            }
            return r3 ? Kf(i3, r3, 0) : i3;
          })(ed(t2, e2, n2), n2, 0, i2);
        }
        function Qf(t2, e2, n2, r2, i2) {
          return (function(t3, e3, n3, r3) {
            let i3;
            switch (e3.logicalLevelTechnique1) {
              case ff.DELTA:
                i3 = (function(t4) {
                  const e4 = new Uint32Array(t4.length);
                  e4[0] = Df(t4[0]) >>> 0;
                  for (let n4 = 1; n4 < t4.length; n4++) e4[n4] = e4[n4 - 1] + Df(t4[n4]) >>> 0;
                  return e4;
                })(e3.logicalLevelTechnique2 === ff.RLE ? Cf(t3, e3.runs, e3.numRleValues) : t3);
                break;
              case ff.RLE:
                i3 = Cf(t3, e3.runs, e3.numRleValues);
                break;
              case ff.MORTON:
                Rf(t3), i3 = t3;
                break;
              case ff.COMPONENTWISE_DELTA:
                i3 = (function(t4) {
                  if (t4.length < 2) return new Uint32Array(t4);
                  const e4 = new Uint32Array(t4.length);
                  e4[0] = Df(t4[0]) >>> 0, e4[1] = Df(t4[1]) >>> 0;
                  for (let n4 = 2; n4 < t4.length; n4 += 2) e4[n4] = e4[n4 - 2] + Df(t4[n4]) >>> 0, e4[n4 + 1] = e4[n4 - 1] + Df(t4[n4 + 1]) >>> 0;
                  return e4;
                })(t3);
                break;
              case ff.NONE:
                i3 = t3;
                break;
              default:
                throw new Error(`The specified Logical level technique is not supported: ${e3.logicalLevelTechnique1}`);
            }
            return r3 ? Kf(i3, r3, 0) : i3;
          })(ed(t2, e2, n2), n2, 0, i2);
        }
        function td(t2, e2, n2) {
          return (function(t3, e3) {
            if (e3.logicalLevelTechnique1 === ff.DELTA && e3.logicalLevelTechnique2 === ff.NONE) return (function(t4) {
              const e4 = new Int32Array(t4.length + 1);
              e4[0] = 0, e4[1] = Df(t4[0]);
              let n3 = e4[1];
              for (let r2 = 2; r2 !== e4.length; ++r2) n3 += Df(t4[r2 - 1]), e4[r2] = e4[r2 - 1] + n3;
              return new Uint32Array(e4);
            })(t3);
            if (e3.logicalLevelTechnique1 === ff.RLE && e3.logicalLevelTechnique2 === ff.NONE) return (function(t4, e4, n3) {
              const r2 = new Uint32Array(n3 + 1);
              r2[0] = 0;
              let i2 = 1, s2 = r2[0];
              for (let n4 = 0; n4 < e4; n4++) {
                const o2 = t4[n4], a2 = t4[n4 + e4];
                for (let t5 = i2; t5 < i2 + o2; t5++) r2[t5] = a2 + s2, s2 = r2[t5];
                i2 += o2;
              }
              return r2;
            })(t3, e3.runs, e3.numRleValues);
            if (e3.logicalLevelTechnique1 === ff.NONE && e3.logicalLevelTechnique2 === ff.NONE) {
              !(function(t4) {
                let e4 = 0;
                for (let n4 = 0; n4 < t4.length; n4++) t4[n4] += e4, e4 = t4[n4];
              })(t3);
              const n3 = new Uint32Array(e3.numValues + 1);
              return n3[0] = 0, n3.set(t3, 1), n3;
            }
            if (e3.logicalLevelTechnique1 === ff.DELTA && e3.logicalLevelTechnique2 === ff.RLE) {
              const n3 = (function(t4, e4, n4) {
                const r2 = new Int32Array(n4 + 1);
                r2[0] = 0;
                let i2 = 1, s2 = r2[0];
                for (let n5 = 0; n5 < e4; n5++) {
                  const o2 = t4[n5];
                  let a2 = t4[n5 + e4];
                  a2 = Df(a2);
                  for (let t5 = i2; t5 < i2 + o2; t5++) r2[t5] = a2 + s2, s2 = r2[t5];
                  i2 += o2;
                }
                return r2;
              })(t3, e3.runs, e3.numRleValues);
              return Rf(n3), new Uint32Array(n3);
            }
            throw new Error("Only delta encoding is supported for transforming length to offset streams yet.");
          })(ed(t2, e2, n2), n2);
        }
        function ed(t2, e2, n2) {
          const r2 = n2.physicalLevelTechnique;
          switch (r2) {
            case df.FAST_PFOR:
              return (function(t3, e3, n3, r3) {
                return (function(t4, e4, n4, r4, i2) {
                  const s2 = r4.get();
                  if (3 & n4) throw new Error(`FastPFOR: invalid encodedByteLength=${n4} at offset=${s2} (encodedBytes.length=${t4.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);
                  const o2 = n4 >>> 2, a2 = (function(t5, e5) {
                    if (e5 <= t5.encodedWords.length) return t5.encodedWords;
                    const n5 = new Uint32Array(Math.max(16, 2 * e5));
                    return t5.encodedWords = n5, n5;
                  })(i2, o2);
                  !(function(t5, e5, n5, r5) {
                    if (e5 < 0 || n5 < 0 || e5 + n5 > t5.length) throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e5}, byteLength=${n5}, bytes.length=${t5.length})`);
                    const i3 = Math.floor(n5 / 4), s3 = n5 % 4 != 0, o3 = s3 ? i3 + 1 : i3;
                    if (r5.length < o3) throw new RangeError(`decodeBigEndianInt32sInto: out.length=${r5.length} < ${o3}`);
                    if (i3 > 0) {
                      const n6 = t5.byteOffset + e5;
                      if (3 & n6) for (let n7 = 0; n7 < i3; n7++) {
                        const i4 = e5 + 4 * n7;
                        r5[n7] = t5[i4] << 24 | t5[i4 + 1] << 16 | t5[i4 + 2] << 8 | t5[i4 + 3];
                      }
                      else {
                        const e6 = new Uint32Array(t5.buffer, n6, i3);
                        for (let t6 = 0; t6 < i3; t6++) r5[t6] = 0 | vf(e6[t6]);
                      }
                    }
                    if (s3) {
                      const s4 = e5 + 4 * i3, o4 = n5 - 4 * i3;
                      let a3 = 0;
                      for (let e6 = 0; e6 < o4; e6++) a3 |= t5[s4 + e6] << 24 - 8 * e6;
                      r5[i3] = 0 | a3;
                    }
                  })(t4, s2, n4, a2);
                  const l2 = (function(t5, e5, n5) {
                    let r5 = 0, i3 = 0;
                    const s3 = new Uint32Array(e5), o3 = n5 ?? _f();
                    if (t5.length > 0) {
                      const e6 = 0 | t5[r5];
                      if (r5 = r5 + 1 | 0, 255 & e6) throw new Error(`FastPFOR decode: invalid alignedLength=${e6} (expected multiple of 256)`);
                      if (i3 + e6 > s3.length) throw new Error(`FastPFOR decode: output buffer too small (outPos=${i3}, alignedLength=${e6}, out.length=${s3.length})`);
                      r5 = (function(t6, e7, n6, r6, i4, s4) {
                        const o4 = r6 + xf(i4, gf);
                        let a3 = r6, l3 = n6;
                        for (; a3 !== o4; ) {
                          const n7 = Math.min(bf, o4 - a3);
                          l3 = kf(t6, e7, l3, a3, n7, s4), a3 = a3 + n7 | 0;
                        }
                        return l3;
                      })(t5, s3, r5, i3, e6, o3), i3 = i3 + e6 | 0;
                    }
                    return (function(t6, e6, n6, r6, i4, s4) {
                      if (0 === s4) return e6;
                      let o4 = 0, a3 = e6;
                      const l3 = e6 + n6, u2 = i4;
                      let c2 = i4;
                      const h2 = i4 + s4;
                      let p2 = 0, f2 = 0;
                      for (; a3 < l3 && c2 < h2; ) {
                        const e7 = t6[a3] >>> o4 & 255;
                        if (o4 += 8, a3 += o4 >>> 5, o4 &= 31, p2 |= (127 & e7) << f2, 128 & e7) r6[c2++] = 0 | p2, p2 = 0, f2 = 0;
                        else if (f2 += 7, f2 > 28) throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f2}, partial=${p2}, decoded=${c2 - u2}/${s4}, inPos=${a3}, inEnd=${l3})`);
                      }
                      if (c2 !== h2) throw new Error(`FastPFOR VByte: truncated stream (decoded=${c2 - u2}, expected=${s4}, consumedWords=${a3 - e6}/${n6}, vbyteStart=${e6}, vbyteEnd=${l3})`);
                    })(t5, r5, t5.length - r5 | 0, s3, i3, e5 - i3 | 0), s3;
                  })(a2.subarray(0, o2), e4, i2.decoderWorkspace);
                  return r4.add(n4), l2;
                })(t3, e3, n3, r3, (function(t4 = 16) {
                  if (t4 < 0) throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${t4}`);
                  const e4 = Math.max(16, 0 | t4);
                  return { encodedWords: new Uint32Array(e4), decoderWorkspace: _f() };
                })(n3 >>> 2));
              })(t2, n2.numValues, n2.byteLength, e2);
            case df.VARINT:
              return Ef(t2, e2, n2.numValues);
            case df.NONE: {
              const r3 = e2.get();
              e2.add(n2.byteLength);
              const i2 = t2.subarray(r3, e2.get());
              return new Uint32Array(i2);
            }
            default:
              throw new Error(`Specified physicalLevelTechnique ${r2} is not supported (yet).`);
          }
        }
        function nd(t2, e2, n2) {
          const r2 = ed(t2, e2, n2);
          return 1 === r2.length ? r2[0] : (function(t3) {
            return t3[1];
          })(r2);
        }
        function rd(t2, e2, n2) {
          return (function(t3) {
            if (2 === t3.length) {
              const e3 = Df(t3[1]);
              return [e3, e3];
            }
            return [Df(t3[2]), Df(t3[3])];
          })(ed(t2, e2, n2));
        }
        function id(t2, e2, n2) {
          return (function(t3) {
            if (2 === t3.length) {
              const e3 = zf(t3[1]);
              return [e3, e3];
            }
            return [zf(t3[2]), zf(t3[3])];
          })(Tf(t2, e2, n2.numValues));
        }
        function sd(t2, e2, n2, r2) {
          return (function(t3, e3, n3) {
            let r3;
            switch (e3.logicalLevelTechnique1) {
              case ff.DELTA:
                r3 = (function(t4) {
                  const e4 = new BigUint64Array(t4.length);
                  e4[0] = BigInt.asUintN(64, zf(t4[0]));
                  for (let n4 = 1; n4 < t4.length; n4++) e4[n4] = BigInt.asUintN(64, e4[n4 - 1] + zf(t4[n4]));
                  return e4;
                })(e3.logicalLevelTechnique2 === ff.RLE ? Vf(t3, e3.runs, e3.numRleValues) : t3);
                break;
              case ff.RLE:
                r3 = Vf(t3, e3.runs, e3.numRleValues);
                break;
              case ff.NONE:
                r3 = t3;
                break;
              default:
                throw new Error(`The specified Logical level technique is not supported: ${e3.logicalLevelTechnique1}`);
            }
            return n3 ? Kf(r3, n3, 0n) : r3;
          })(Tf(t2, e2, n2.numValues), n2, r2);
        }
        function od(t2, e2, n2) {
          const r2 = Tf(t2, e2, n2.numValues);
          return 1 === r2.length ? r2[0] : (function(t3) {
            return t3[1];
          })(r2);
        }
        function ad(t2, e2, n2, r2, i2 = "int32") {
          const s2 = t2.logicalLevelTechnique1;
          if (s2 === ff.RLE) return 1 === t2.runs ? Gf.CONST : Gf.FLAT;
          if (s2 !== ff.DELTA || t2.logicalLevelTechnique2 !== ff.RLE) return 1 === t2.numValues ? Gf.CONST : Gf.FLAT;
          const o2 = e2 instanceof Wf ? e2.size() : e2;
          if (t2.numRleValues !== o2) return Gf.FLAT;
          if (1 === t2.runs) return Gf.SEQUENCE;
          if (2 !== t2.runs) return 1 === t2.numValues ? Gf.CONST : Gf.FLAT;
          const a2 = r2.get();
          if (t2.physicalLevelTechnique === df.VARINT) return (function(t3, e3, n3) {
            const r3 = new pf(e3.get());
            if ("int64" === n3) {
              const e4 = Tf(t3, r3, 4);
              return 2n === e4[2] && 2n === e4[3];
            }
            const i3 = Ef(t3, r3, 4);
            return 2 === i3[2] && 2 === i3[3];
          })(n2, r2, i2) ? Gf.SEQUENCE : 1 === t2.numValues ? Gf.CONST : Gf.FLAT;
          const l2 = r2.get(), u2 = new Int32Array(n2.buffer, n2.byteOffset + l2, 4);
          return r2.set(a2), 2 === u2[2] && 2 === u2[3] ? Gf.SEQUENCE : 1 === t2.numValues ? Gf.CONST : Gf.FLAT;
        }
        class ld extends sf {
          getValueFromBuffer(t2) {
            return this.dataBuffer[t2];
          }
        }
        class ud extends lf {
          constructor(t2, e2, n2, r2) {
            super(t2, BigInt64Array.of(e2), n2, r2);
          }
          getValueFromBuffer(t2) {
            return this.dataBuffer[0] + BigInt(t2) * this.delta;
          }
        }
        function cd(t2, e2, n2) {
          return { x: hd(t2, e2) - n2, y: hd(t2 >> 1, e2) - n2 };
        }
        function hd(t2, e2) {
          let n2 = 0;
          for (let r2 = 0; r2 < e2; r2++) n2 |= (t2 & 1 << 2 * r2) >> r2;
          return n2;
        }
        function pd(t2, e2, r2, i2, s2, o2, a2) {
          return t2 === Zf.MORTON ? (function(t3, e3, r3, i3, s3, o3) {
            const a3 = new Array(s3 ? i3 + 1 : i3);
            for (let s4 = 0; s4 < i3; s4++) {
              const i4 = cd(t3[e3[r3 + s4]], o3.numBits, o3.coordinateShift);
              a3[s4] = new n(i4.x, i4.y);
            }
            return s3 && (a3[a3.length - 1] = a3[0]), a3;
          })(e2, r2, i2, s2, o2, a2) : (function(t3, e3, r3, i3, s3) {
            const o3 = new Array(s3 ? i3 + 1 : i3);
            for (let s4 = 0; s4 < 2 * i3; s4 += 2) {
              const i4 = 2 * e3[r3 + s4 / 2];
              o3[s4 / 2] = new n(t3[i4], t3[i4 + 1]);
            }
            return s3 && (o3[o3.length - 1] = o3[0]), o3;
          })(e2, r2, i2, s2, o2);
        }
        function fd(t2, e2, r2, i2) {
          const s2 = new Array(i2 ? r2 + 1 : r2);
          for (let i3 = 0; i3 < 2 * r2; i3 += 2) s2[i3 / 2] = new n(t2[e2 + i3], t2[e2 + i3 + 1]);
          return i2 && (s2[s2.length - 1] = s2[0]), s2;
        }
        !(function(t2) {
          t2[t2.POINT = 0] = "POINT", t2[t2.LINESTRING = 1] = "LINESTRING", t2[t2.POLYGON = 2] = "POLYGON", t2[t2.MULTIPOINT = 3] = "MULTIPOINT", t2[t2.MULTILINESTRING = 4] = "MULTILINESTRING", t2[t2.MULTIPOLYGON = 5] = "MULTIPOLYGON";
        })(Xf || (Xf = {})), (function(t2) {
          t2[t2.POINT = 0] = "POINT", t2[t2.LINESTRING = 1] = "LINESTRING", t2[t2.POLYGON = 2] = "POLYGON";
        })(Yf || (Yf = {})), (function(t2) {
          t2[t2.MORTON = 0] = "MORTON", t2[t2.VEC_2 = 1] = "VEC_2", t2[t2.VEC_3 = 2] = "VEC_3";
        })(Zf || (Zf = {}));
        class dd {
          constructor(t2, e2, n2, r2, i2) {
            this._vertexBufferType = t2, this._topologyVector = e2, this._vertexOffsets = n2, this._vertexBuffer = r2, this._mortonSettings = i2;
          }
          get vertexBufferType() {
            return this._vertexBufferType;
          }
          get topologyVector() {
            return this._topologyVector;
          }
          get vertexOffsets() {
            return this._vertexOffsets;
          }
          get vertexBuffer() {
            return this._vertexBuffer;
          }
          getSimpleEncodedVertex(t2) {
            const e2 = this.vertexOffsets ? 2 * this.vertexOffsets[t2] : 2 * t2;
            return [this.vertexBuffer[e2], this.vertexBuffer[e2 + 1]];
          }
          getVertex(t2) {
            if (this.vertexOffsets && this.mortonSettings) {
              const e3 = cd(this.vertexBuffer[this.vertexOffsets[t2]], this.mortonSettings.numBits, this.mortonSettings.coordinateShift);
              return [e3.x, e3.y];
            }
            const e2 = this.vertexOffsets ? 2 * this.vertexOffsets[t2] : 2 * t2;
            return [this.vertexBuffer[e2], this.vertexBuffer[e2 + 1]];
          }
          getGeometries() {
            return (function(t2) {
              const e2 = new Array(t2.numGeometries);
              let r2 = 1, i2 = 1, s2 = 1, o2 = 0, a2 = 0, l2 = 0;
              const u2 = t2.mortonSettings, c2 = t2.topologyVector, h2 = c2.geometryOffsets, p2 = c2.partOffsets, f2 = c2.ringOffsets, d2 = t2.vertexOffsets, y2 = !d2 || 0 === d2.length, m2 = t2.containsPolygonGeometry(), g2 = t2.vertexBuffer;
              for (let c3 = 0; c3 < t2.numGeometries; c3++) switch (t2.geometryType(c3)) {
                case Xf.POINT:
                  {
                    let c4, m3;
                    if (y2) c4 = g2[a2++], m3 = g2[a2++];
                    else if (t2.vertexBufferType === Zf.MORTON) {
                      const t3 = cd(g2[d2[l2++]], u2.numBits, u2.coordinateShift);
                      c4 = t3.x, m3 = t3.y;
                    } else {
                      const t3 = 2 * d2[l2++];
                      c4 = g2[t3], m3 = g2[t3 + 1];
                    }
                    e2[o2++] = [[new n(c4, m3)]], h2 && s2++, p2 && r2++, f2 && i2++;
                  }
                  break;
                case Xf.MULTIPOINT:
                  {
                    const t3 = h2[s2] - h2[s2 - 1];
                    s2++;
                    const u3 = new Array(t3);
                    if (y2) for (let e3 = 0; e3 < t3; e3++) {
                      const t4 = g2[a2++], r3 = g2[a2++];
                      u3[e3] = new n(t4, r3);
                    }
                    else for (let e3 = 0; e3 < t3; e3++) {
                      const t4 = 2 * d2[l2++];
                      u3[e3] = new n(g2[t4], g2[t4 + 1]);
                    }
                    e2[o2++] = u3.map(((t4) => [t4])), r2 += t3, i2 += t3;
                  }
                  break;
                case Xf.LINESTRING:
                  {
                    let n2, c4;
                    m2 ? (n2 = f2[i2] - f2[i2 - 1], i2++) : n2 = p2[r2] - p2[r2 - 1], r2++, y2 ? (c4 = fd(g2, a2, n2, false), a2 += 2 * n2) : (c4 = pd(t2.vertexBufferType, g2, d2, l2, n2, false, u2), l2 += n2), e2[o2++] = [c4], h2 && s2++;
                  }
                  break;
                case Xf.POLYGON:
                  {
                    const n2 = p2[r2] - p2[r2 - 1];
                    r2++;
                    const c4 = new Array(n2 - 1);
                    let m3, x2 = f2[i2] - f2[i2 - 1];
                    if (i2++, y2) {
                      m3 = fd(g2, a2, x2, true), a2 += 2 * x2;
                      for (let t3 = 0; t3 < c4.length; t3++) x2 = f2[i2] - f2[i2 - 1], i2++, c4[t3] = fd(g2, a2, x2, true), a2 += 2 * x2;
                    } else {
                      m3 = pd(t2.vertexBufferType, g2, d2, l2, x2, true, u2), l2 += x2;
                      for (let e3 = 0; e3 < c4.length; e3++) x2 = f2[i2] - f2[i2 - 1], i2++, c4[e3] = pd(t2.vertexBufferType, g2, d2, l2, x2, true, u2), l2 += x2;
                    }
                    e2[o2++] = [m3].concat(c4), h2 && s2++;
                  }
                  break;
                case Xf.MULTILINESTRING:
                  {
                    const n2 = h2[s2] - h2[s2 - 1];
                    s2++;
                    const c4 = new Array(n2);
                    for (let e3 = 0; e3 < n2; e3++) {
                      let n3;
                      if (m2 ? (n3 = f2[i2] - f2[i2 - 1], i2++) : n3 = p2[r2] - p2[r2 - 1], r2++, y2) c4[e3] = fd(g2, a2, n3, false), a2 += 2 * n3;
                      else {
                        const r3 = pd(t2.vertexBufferType, g2, d2, l2, n3, false, u2);
                        c4[e3] = r3, l2 += n3;
                      }
                    }
                    e2[o2++] = c4;
                  }
                  break;
                case Xf.MULTIPOLYGON:
                  {
                    const n2 = h2[s2] - h2[s2 - 1];
                    s2++;
                    const c4 = new Array(n2);
                    for (let e3 = 0; e3 < n2; e3++) {
                      const n3 = p2[r2] - p2[r2 - 1];
                      let s3;
                      r2++;
                      const o3 = new Array(n3 - 1), h3 = f2[i2] - f2[i2 - 1];
                      i2++, y2 ? (s3 = fd(g2, a2, h3, true), a2 += 2 * h3) : (s3 = pd(t2.vertexBufferType, g2, d2, l2, h3, true, u2), l2 += h3);
                      for (let e4 = 0; e4 < o3.length; e4++) {
                        const n4 = f2[i2] - f2[i2 - 1];
                        i2++, y2 ? (o3[e4] = fd(g2, a2, n4, true), a2 += 2 * n4) : (o3[e4] = pd(t2.vertexBufferType, g2, d2, l2, n4, true, u2), l2 += n4);
                      }
                      c4[e3] = [s3].concat(o3);
                    }
                    e2[o2++] = c4.flat();
                  }
                  break;
                default:
                  throw new Error("The specified geometry type is currently not supported.");
              }
              return e2;
            })(this);
          }
          get mortonSettings() {
            return this._mortonSettings;
          }
        }
        class yd extends dd {
          constructor(t2, e2, n2, r2, i2, s2, o2) {
            super(n2, r2, i2, s2, o2), this._numGeometries = t2, this._geometryType = e2;
          }
          geometryType(t2) {
            return this._geometryType;
          }
          get numGeometries() {
            return this._numGeometries;
          }
          containsPolygonGeometry() {
            return this._geometryType === Xf.POLYGON || this._geometryType === Xf.MULTIPOLYGON;
          }
          containsSingleGeometryType() {
            return true;
          }
        }
        class md extends dd {
          constructor(t2, e2, n2, r2, i2, s2) {
            super(t2, n2, r2, i2, s2), this._geometryTypes = e2;
          }
          geometryType(t2) {
            return this._geometryTypes[t2];
          }
          get numGeometries() {
            return this._geometryTypes.length;
          }
          containsPolygonGeometry() {
            for (let t2 = 0; t2 < this.numGeometries; t2++) if (this.geometryType(t2) === Xf.POLYGON || this.geometryType(t2) === Xf.MULTIPOLYGON) return true;
            return false;
          }
          containsSingleGeometryType() {
            return false;
          }
        }
        class gd {
          constructor(t2, e2, n2, r2) {
            this._triangleOffsets = t2, this._indexBuffer = e2, this._vertexBuffer = n2, this._topologyVector = r2;
          }
          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 t2 = new Array(this.numGeometries), e2 = this._topologyVector, r2 = e2.partOffsets, i2 = e2.ringOffsets, s2 = e2.geometryOffsets;
            let o2 = 0, a2 = 1, l2 = 1, u2 = 1;
            for (let e3 = 0; e3 < this.numGeometries; e3++) switch (this.geometryType(e3)) {
              case Xf.POLYGON:
                {
                  const c2 = r2[a2] - r2[a2 - 1];
                  a2++;
                  const h2 = [];
                  for (let t3 = 0; t3 < c2; t3++) {
                    const t4 = i2[l2] - i2[l2 - 1];
                    l2++;
                    const e4 = [];
                    for (let r3 = 0; r3 < t4; r3++) {
                      const t5 = this._vertexBuffer[o2++], r4 = this._vertexBuffer[o2++];
                      e4.push(new n(t5, r4));
                    }
                    e4.length > 0 && e4.push(e4[0]), h2.push(e4);
                  }
                  t2[e3] = h2, s2 && u2++;
                }
                break;
              case Xf.MULTIPOLYGON: {
                const c2 = s2[u2] - s2[u2 - 1];
                u2++;
                const h2 = [];
                for (let t3 = 0; t3 < c2; t3++) {
                  const t4 = r2[a2] - r2[a2 - 1];
                  a2++;
                  for (let e4 = 0; e4 < t4; e4++) {
                    const t5 = i2[l2] - i2[l2 - 1];
                    l2++;
                    const e5 = [];
                    for (let r3 = 0; r3 < t5; r3++) {
                      const t6 = this._vertexBuffer[o2++], r4 = this._vertexBuffer[o2++];
                      e5.push(new n(t6, r4));
                    }
                    e5.length > 0 && e5.push(e5[0]), h2.push(e5);
                  }
                }
                t2[e3] = h2;
              }
            }
            return t2;
          }
          [Symbol.iterator]() {
            return null;
          }
        }
        function xd(t2, e2, n2, r2, i2, s2) {
          return new vd(t2, e2, n2, r2, i2, s2);
        }
        class vd extends gd {
          constructor(t2, e2, n2, r2, i2, s2) {
            super(n2, r2, i2, s2), this._numGeometries = t2, this._geometryType = e2;
          }
          geometryType(t2) {
            return this._geometryType;
          }
          get numGeometries() {
            return this._numGeometries;
          }
          containsSingleGeometryType() {
            return true;
          }
        }
        function bd(t2, e2, n2, r2, i2) {
          return new wd(t2, e2, n2, r2, i2);
        }
        class wd extends gd {
          constructor(t2, e2, n2, r2, i2) {
            super(e2, n2, r2, i2), this._geometryTypes = t2;
          }
          geometryType(t2) {
            return this._geometryTypes[t2];
          }
          get numGeometries() {
            return this._geometryTypes.length;
          }
          containsSingleGeometryType() {
            return false;
          }
        }
        function _d(t2, e2, n2, r2, i2) {
          const s2 = Hf(t2, n2);
          let o2, a2, l2, u2;
          if (ad(s2, r2, t2, n2) === Gf.CONST) {
            const i3 = nd(t2, n2, s2);
            let c3, h3, p3, f3;
            for (let r3 = 0; r3 < e2 - 1; r3++) {
              const e3 = Hf(t2, n2);
              switch (e3.physicalStreamType) {
                case Nf.LENGTH:
                  switch (e3.logicalStreamType.lengthType) {
                    case qf.GEOMETRIES:
                      c3 = td(t2, n2, e3);
                      break;
                    case qf.PARTS:
                      h3 = td(t2, n2, e3);
                      break;
                    case qf.RINGS:
                      p3 = td(t2, n2, e3);
                      break;
                    case qf.TRIANGLES:
                      f3 = td(t2, n2, e3);
                  }
                  break;
                case Nf.OFFSET:
                  switch (e3.logicalStreamType.offsetType) {
                    case jf.VERTEX:
                      o2 = Qf(t2, n2, e3);
                      break;
                    case jf.INDEX:
                      u2 = Qf(t2, n2, e3);
                  }
                  break;
                case Nf.DATA:
                  Uf.VERTEX === e3.logicalStreamType.dictionaryType ? a2 = Jf(t2, n2, e3) : (l2 = { numBits: e3.numBits, coordinateShift: e3.coordinateShift }, a2 = Qf(t2, n2, e3));
              }
            }
            return u2 ? void 0 !== c3 || void 0 !== h3 ? xd(r2, i3, f3, u2, a2, { geometryOffsets: c3, partOffsets: h3, ringOffsets: p3 }) : xd(r2, i3, f3, u2, a2) : void 0 === l2 ? (function(t3, e3, n3, r3, i4) {
              return new yd(t3, e3, Zf.VEC_2, n3, r3, i4);
            })(r2, i3, { geometryOffsets: c3, partOffsets: h3, ringOffsets: p3 }, o2, a2) : (function(t3, e3, n3, r3, i4, s3) {
              return new yd(t3, e3, Zf.MORTON, n3, r3, i4, s3);
            })(r2, i3, { geometryOffsets: c3, partOffsets: h3, ringOffsets: p3 }, o2, a2, l2);
          }
          const c2 = Qf(t2, n2, s2);
          let h2, p2, f2, d2, y2, m2, g2;
          for (let r3 = 0; r3 < e2 - 1; r3++) {
            const e3 = Hf(t2, n2);
            switch (e3.physicalStreamType) {
              case Nf.LENGTH:
                switch (e3.logicalStreamType.lengthType) {
                  case qf.GEOMETRIES:
                    h2 = Qf(t2, n2, e3);
                    break;
                  case qf.PARTS:
                    p2 = Qf(t2, n2, e3);
                    break;
                  case qf.RINGS:
                    f2 = Qf(t2, n2, e3);
                    break;
                  case qf.TRIANGLES:
                    d2 = td(t2, n2, e3);
                }
                break;
              case Nf.OFFSET:
                switch (e3.logicalStreamType.offsetType) {
                  case jf.VERTEX:
                    o2 = Qf(t2, n2, e3);
                    break;
                  case jf.INDEX:
                    u2 = Qf(t2, n2, e3);
                }
                break;
              case Nf.DATA:
                Uf.VERTEX === e3.logicalStreamType.dictionaryType ? a2 = Jf(t2, n2, e3) : (l2 = { numBits: e3.numBits, coordinateShift: e3.coordinateShift }, a2 = Qf(t2, n2, e3));
            }
          }
          return h2 ? (y2 = Sd(c2, h2, 2), p2 && f2 ? (m2 = Ad(c2, y2, p2, false), g2 = (function(t3, e3, n3, r3) {
            const i3 = new Uint32Array(n3[n3.length - 1] + 1);
            let s3 = 0;
            i3[0] = s3;
            let o3 = 1, a3 = 1, l3 = 0;
            for (let u3 = 0; u3 < t3.length; u3++) {
              const c3 = t3[u3], h3 = e3[u3 + 1] - e3[u3];
              if (0 !== c3 && 3 !== c3) for (let t4 = 0; t4 < h3; t4++) {
                const t5 = n3[o3] - n3[o3 - 1];
                o3++;
                for (let e4 = 0; e4 < t5; e4++) s3 = i3[a3++] = s3 + r3[l3++];
              }
              else for (let t4 = 0; t4 < h3; t4++) i3[a3++] = ++s3, o3++;
            }
            return i3;
          })(c2, y2, m2, f2)) : p2 && (m2 = (function(t3, e3, n3) {
            const r3 = new Uint32Array(e3[e3.length - 1] + 1);
            let i3 = 0;
            r3[0] = i3;
            let s3 = 1, o3 = 0;
            for (let a3 = 0; a3 < t3.length; a3++) {
              const l3 = t3[a3], u3 = e3[a3 + 1] - e3[a3];
              if (4 === l3 || 1 === l3) for (let t4 = 0; t4 < u3; t4++) i3 = r3[s3++] = i3 + n3[o3++];
              else for (let t4 = 0; t4 < u3; t4++) r3[s3++] = ++i3;
            }
            return r3;
          })(c2, y2, p2))) : p2 && f2 ? (m2 = Sd(c2, p2, 1), g2 = Ad(c2, m2, f2, true)) : p2 && (m2 = Sd(c2, p2, 0)), u2 && !m2 ? bd(c2, d2, u2, a2) : u2 ? bd(c2, d2, u2, a2, { geometryOffsets: y2, partOffsets: m2, ringOffsets: g2 }) : void 0 === l2 ? (function(t3, e3, n3, r3) {
            return new md(Zf.VEC_2, t3, e3, n3, r3);
          })(c2, { geometryOffsets: y2, partOffsets: m2, ringOffsets: g2 }, o2, a2) : (function(t3, e3, n3, r3, i3) {
            return new md(Zf.MORTON, t3, e3, n3, r3, i3);
          })(c2, { geometryOffsets: y2, partOffsets: m2, ringOffsets: g2 }, o2, a2, l2);
        }
        function Sd(t2, e2, n2) {
          const r2 = new Uint32Array(t2.length + 1);
          let i2 = 0;
          r2[0] = i2;
          let s2 = 0;
          for (let o2 = 0; o2 < t2.length; o2++) i2 = r2[o2 + 1] = i2 + (t2[o2] > n2 ? e2[s2++] : 1);
          return r2;
        }
        function Ad(t2, e2, n2, r2) {
          const i2 = new Uint32Array(e2[e2.length - 1] + 1);
          let s2 = 0;
          i2[0] = s2;
          let o2 = 1, a2 = 0;
          for (let l2 = 0; l2 < t2.length; l2++) {
            const u2 = t2[l2], c2 = e2[l2 + 1] - e2[l2];
            if (5 === u2 || 2 === u2 || r2 && (4 === u2 || 1 === u2)) for (let t3 = 0; t3 < c2; t3++) s2 = i2[o2++] = s2 + n2[a2++];
            else for (let t3 = 0; t3 < c2; t3++) i2[o2++] = ++s2;
          }
          return i2;
        }
        class Md extends rf {
          constructor(t2, e2, n2) {
            super(t2, e2.getBuffer(), n2), this.dataVector = e2;
          }
          getValueFromBuffer(t2) {
            return this.dataVector.get(t2);
          }
        }
        class kd extends sf {
          getValueFromBuffer(t2) {
            return this.dataBuffer[t2];
          }
        }
        class Id extends rf {
          constructor(t2, e2, n2, r2) {
            super(t2, r2 ? BigInt64Array.of(e2) : BigUint64Array.of(e2), n2);
          }
          getValueFromBuffer(t2) {
            return this.dataBuffer[0];
          }
        }
        function Ed(t2, e2, n2, r2, i2) {
          const s2 = (function(t3, e3, n3, r3) {
            const i3 = new Uint8Array(e3);
            let s3 = 0;
            const o2 = r3.get() + n3;
            for (; s3 < e3 && !(r3.get() >= o2); ) {
              const n4 = t3[r3.increment()];
              if (n4 <= 127) {
                const o3 = n4 + 3, a2 = t3[r3.increment()], l2 = Math.min(s3 + o3, e3);
                i3.fill(a2, s3, l2), s3 = l2;
              } else {
                const o3 = 256 - n4;
                for (let n5 = 0; n5 < o3 && s3 < e3; n5++) i3[s3++] = t3[r3.increment()];
              }
            }
            return r3.set(o2), i3;
          })(t2, Math.ceil(e2 / 8), n2, r2);
          return i2 ? (function(t3, e3, n3) {
            if (!n3) return t3;
            const r3 = n3.size(), i3 = new Wf(t3, e3), s3 = new Wf(new Uint8Array(Math.ceil(r3 / 8)), r3);
            let o2 = 0;
            for (let t4 = 0; t4 < r3; t4++) {
              const e4 = !!n3.get(t4) && i3.get(o2++);
              s3.set(t4, e4);
            }
            return s3.getBuffer();
          })(s2, e2, i2) : s2;
        }
        const Td = new TextDecoder();
        function Fd(t2, e2, n2) {
          return n2 - e2 >= 12 ? Td.decode(t2.subarray(e2, n2)) : (function(t3, e3, n3) {
            let r2 = "", i2 = e3;
            for (; i2 < n3; ) {
              const e4 = t3[i2];
              let s2, o2, a2, l2 = null, u2 = e4 > 239 ? 4 : e4 > 223 ? 3 : e4 > 191 ? 2 : 1;
              if (i2 + u2 > n3) break;
              1 === u2 ? e4 < 128 && (l2 = e4) : 2 === u2 ? (s2 = t3[i2 + 1], 128 == (192 & s2) && (l2 = (31 & e4) << 6 | 63 & s2, l2 <= 127 && (l2 = null))) : 3 === u2 ? (s2 = t3[i2 + 1], o2 = t3[i2 + 2], 128 == (192 & s2) && 128 == (192 & o2) && (l2 = (15 & e4) << 12 | (63 & s2) << 6 | 63 & o2, (l2 <= 2047 || l2 >= 55296 && l2 <= 57343) && (l2 = null))) : 4 === u2 && (s2 = t3[i2 + 1], o2 = t3[i2 + 2], a2 = t3[i2 + 3], 128 == (192 & s2) && 128 == (192 & o2) && 128 == (192 & a2) && (l2 = (15 & e4) << 18 | (63 & s2) << 12 | (63 & o2) << 6 | 63 & a2, (l2 <= 65535 || l2 >= 1114112) && (l2 = null))), null === l2 ? (l2 = 65533, u2 = 1) : l2 > 65535 && (l2 -= 65536, r2 += String.fromCharCode(l2 >>> 10 & 1023 | 55296), l2 = 56320 | 1023 & l2), r2 += String.fromCharCode(l2), i2 += u2;
            }
            return r2;
          })(t2, e2, n2);
        }
        class Pd extends rf {
          constructor(t2, e2, n2, r2) {
            super(t2, n2, r2), this.offsetBuffer = e2;
          }
        }
        class Dd extends Pd {
          constructor(t2, e2, n2, r2) {
            super(t2, e2, n2, r2 ?? e2.length - 1);
          }
          getValueFromBuffer(t2) {
            return Fd(this.dataBuffer, this.offsetBuffer[t2], this.offsetBuffer[t2 + 1]);
          }
        }
        class zd extends Pd {
          constructor(t2, e2, n2, r2, i2) {
            super(t2, n2, r2, i2 ?? e2.length), this.indexBuffer = e2, this.indexBuffer = e2;
          }
          getValueFromBuffer(t2) {
            const e2 = this.indexBuffer[t2];
            return Fd(this.dataBuffer, this.offsetBuffer[e2], this.offsetBuffer[e2 + 1]);
          }
        }
        class Bd extends Pd {
          constructor(t2, e2, n2, r2, i2, s2, o2) {
            super(t2, n2, r2, o2), this.indexBuffer = e2, this.symbolOffsetBuffer = i2, this.symbolTableBuffer = s2;
          }
          getValueFromBuffer(t2) {
            null == this.decodedDictionary && (null == this.symbolLengthBuffer && (this.symbolLengthBuffer = this.offsetToLengthBuffer(this.symbolOffsetBuffer)), this.decodedDictionary = (function(t3, e3, n2) {
              const r2 = [], i2 = new Array(e3.length).fill(0);
              for (let t4 = 1; t4 < e3.length; t4++) i2[t4] = i2[t4 - 1] + e3[t4 - 1];
              for (let s2 = 0; s2 < n2.length; s2++) if (255 === n2[s2]) r2.push(n2[++s2]);
              else {
                const o2 = e3[n2[s2]], a2 = i2[n2[s2]];
                for (let e4 = 0; e4 < o2; e4++) r2.push(t3[a2 + e4]);
              }
              return new Uint8Array(r2);
            })(this.symbolTableBuffer, this.symbolLengthBuffer, this.dataBuffer));
            const e2 = this.indexBuffer[t2];
            return Fd(this.decodedDictionary, this.offsetBuffer[e2], this.offsetBuffer[e2 + 1]);
          }
          offsetToLengthBuffer(t2) {
            const e2 = new Uint32Array(t2.length - 1);
            let n2 = t2[0];
            for (let r2 = 1; r2 < t2.length; r2++) {
              const i2 = t2[r2];
              e2[r2 - 1] = i2 - n2, n2 = i2;
            }
            return e2;
          }
        }
        function Cd(t2, e2, n2, r2, i2, s2) {
          return "scalarType" === n2.type ? (function(t3, e3, n3, r3, i3, s3) {
            let o2 = null;
            if (0 === t3) return null;
            if (s3.nullable) {
              const t4 = Hf(e3, n3), r4 = t4.numValues, i4 = n3.get(), s4 = Ed(e3, r4, t4.byteLength, n3);
              n3.set(i4 + t4.byteLength), o2 = new Wf(s4, t4.numValues);
            }
            const a2 = o2 ?? r3;
            switch (i3.physicalType) {
              case 4:
              case 3:
                return (function(t4, e4, n4, r4, i4) {
                  const s4 = Hf(t4, e4), o3 = ad(s4, i4, t4, e4), a3 = 3 === r4.physicalType;
                  if (o3 === Gf.FLAT) {
                    const r5 = Vd(i4) ? i4 : void 0, o4 = a3 ? Jf(t4, e4, s4, 0, r5) : Qf(t4, e4, s4, 0, r5);
                    return new of(n4.name, o4, i4);
                  }
                  if (o3 === Gf.SEQUENCE) {
                    const r5 = rd(t4, e4, s4);
                    return new uf(n4.name, r5[0], r5[1], s4.numRleValues);
                  }
                  const l2 = a3 ? (function(t5, e5, n5) {
                    const r5 = ed(t5, e5, n5);
                    return 1 === r5.length ? Df(r5[0]) : (function(t6) {
                      return Df(t6[1]);
                    })(r5);
                  })(t4, e4, s4) : nd(t4, e4, s4);
                  return new cf(n4.name, l2, i4, a3);
                })(e3, n3, s3, i3, a2);
              case 9:
                return (function(t4, e4, n4, r4, i4) {
                  let s4 = null, o3 = null, a3 = null, l2 = null, u2 = null, c2 = i4 ?? null, h2 = null, p2 = null;
                  for (let t5 = 0; t5 < r4; t5++) {
                    const t6 = Hf(e4, n4);
                    switch (t6.physicalStreamType) {
                      case Nf.PRESENT: {
                        const r5 = Ed(e4, t6.numValues, t6.byteLength, n4), s5 = new Wf(r5, t6.numValues);
                        c2 = i4 ?? s5;
                        break;
                      }
                      case Nf.OFFSET:
                        o3 = Qf(e4, n4, t6, 0, c2);
                        break;
                      case Nf.LENGTH: {
                        const r5 = td(e4, n4, t6);
                        qf.DICTIONARY === t6.logicalStreamType.lengthType ? s4 = r5 : qf.SYMBOL === t6.logicalStreamType.lengthType ? l2 = r5 : h2 = r5;
                        break;
                      }
                      case Nf.DATA: {
                        const r5 = e4.subarray(n4.get(), n4.get() + t6.byteLength);
                        n4.add(t6.byteLength);
                        const i5 = t6.logicalStreamType.dictionaryType;
                        Uf.FSST === i5 ? u2 = r5 : Uf.SINGLE === i5 || Uf.SHARED === i5 ? a3 = r5 : Uf.NONE === i5 && (p2 = r5);
                        break;
                      }
                    }
                  }
                  return (function(t5, e5, n5, r5, i5, s5, o4) {
                    return e5 ? new Bd(t5, n5, r5, i5, s5, e5, o4) : null;
                  })(t4, u2, o3, s4, a3, l2, c2) ?? (function(t5, e5, n5, r5, i5) {
                    return e5 ? i5 ? new zd(t5, n5, r5, e5, i5) : new zd(t5, n5, r5, e5) : null;
                  })(t4, a3, o3, s4, c2) ?? (function(t5, e5, n5, r5, i5) {
                    if (!e5 || !n5) return null;
                    if (r5) return i5 ? new zd(t5, r5, e5, n5, i5) : new zd(t5, r5, e5, n5);
                    if (i5 && i5.size() !== e5.length - 1) {
                      const r6 = new Uint32Array(i5.size());
                      let s5 = 0;
                      for (let t6 = 0; t6 < i5.size(); t6++) r6[t6] = i5.get(t6) ? s5++ : 0;
                      return new zd(t5, r6, e5, n5, i5);
                    }
                    return i5 ? new Dd(t5, e5, n5, i5) : new Dd(t5, e5, n5);
                  })(t4, h2, p2, o3, c2);
                })(s3.name, e3, n3, s3.nullable ? t3 - 1 : t3, o2);
              case 0:
                return (function(t4, e4, n4, r4, i4) {
                  const s4 = Hf(t4, e4), o3 = s4.numValues, a3 = e4.get(), l2 = Vd(i4) ? i4 : void 0, u2 = Ed(t4, o3, s4.byteLength, e4, l2);
                  e4.set(a3 + s4.byteLength);
                  const c2 = new Wf(u2, o3);
                  return new Md(n4.name, c2, i4);
                })(e3, n3, s3, 0, a2);
              case 6:
              case 5:
                return (function(t4, e4, n4, r4, i4) {
                  const s4 = Hf(t4, e4), o3 = ad(s4, r4, t4, e4, "int64"), a3 = 5 === i4.physicalType;
                  if (o3 === Gf.FLAT) {
                    const i5 = Vd(r4) ? r4 : void 0, o4 = a3 ? (function(t5, e5, n5, r5) {
                      return (function(t6, e6, n6) {
                        let r6;
                        switch (e6.logicalLevelTechnique1) {
                          case ff.DELTA:
                            if (e6.logicalLevelTechnique2 === ff.RLE) {
                              const i6 = e6;
                              if (!n6) return (function(t7, e7, n7) {
                                const r7 = new BigInt64Array(n7);
                                let i7 = 0, s5 = 0n;
                                for (let n8 = 0; n8 < e7; n8++) {
                                  const o5 = Number(t7[n8]), a4 = zf(t7[n8 + e7]);
                                  for (let t8 = 0; t8 < o5; t8++) s5 += a4, r7[i7++] = s5;
                                }
                                return r7;
                              })(t6, i6.runs, i6.numRleValues);
                              r6 = $f(t6 = Vf(t6, i6.runs, i6.numRleValues));
                            } else r6 = $f(t6);
                            break;
                          case ff.RLE:
                            r6 = (function(t7, e7, n7) {
                              if (void 0 === n7) {
                                n7 = 0;
                                for (let r8 = 0; r8 < e7; r8++) n7 += Number(t7[r8]);
                              }
                              const r7 = new BigInt64Array(n7);
                              let i6 = 0;
                              for (let n8 = 0; n8 < e7; n8++) {
                                const s5 = Number(t7[n8]);
                                let o5 = t7[n8 + e7];
                                o5 = zf(o5), r7.fill(o5, i6, i6 + s5), i6 += s5;
                              }
                              return r7;
                            })(t6, e6.runs, e6.numRleValues);
                            break;
                          case ff.NONE:
                            r6 = (function(t7) {
                              const e7 = new BigInt64Array(t7.length);
                              for (let n7 = 0; n7 < t7.length; n7++) e7[n7] = zf(t7[n7]);
                              return e7;
                            })(t6);
                            break;
                          default:
                            throw new Error(`The specified Logical level technique is not supported: ${e6.logicalLevelTechnique1}`);
                        }
                        return n6 ? Kf(r6, n6, 0n) : r6;
                      })(Tf(t5, e5, n5.numValues), n5, r5);
                    })(t4, e4, s4, i5) : sd(t4, e4, s4, i5);
                    return new ld(n4.name, o4, r4);
                  }
                  if (o3 === Gf.SEQUENCE) {
                    const r5 = id(t4, e4, s4);
                    return new ud(n4.name, r5[0], r5[1], s4.numRleValues);
                  }
                  const l2 = a3 ? (function(t5, e5, n5) {
                    const r5 = Tf(t5, e5, n5.numValues);
                    return 1 === r5.length ? zf(r5[0]) : (function(t6) {
                      return zf(t6[1]);
                    })(r5);
                  })(t4, e4, s4) : od(t4, e4, s4);
                  return new Id(n4.name, l2, r4, a3);
                })(e3, n3, s3, a2, i3);
              case 7:
                return (function(t4, e4, n4, r4) {
                  const i4 = Hf(t4, e4), s4 = Vd(r4) ? r4 : void 0, o3 = (function(t5, e5, n5, r5) {
                    const i5 = e5.get(), s5 = i5 + n5 * Float32Array.BYTES_PER_ELEMENT, o4 = new Uint8Array(t5.subarray(i5, s5)).buffer, a3 = new Float32Array(o4);
                    return e5.set(s5), r5 ? Kf(a3, r5, 0) : a3;
                  })(t4, e4, i4.numValues, s4);
                  return new kd(n4.name, o3, r4);
                })(e3, n3, s3, a2);
              case 8:
                return (function(t4, e4, n4, r4) {
                  const i4 = Hf(t4, e4), s4 = Vd(r4) ? r4 : void 0, o3 = (function(t5, e5, n5, r5) {
                    const i5 = e5.get(), s5 = i5 + n5 * Float64Array.BYTES_PER_ELEMENT, o4 = new Uint8Array(t5.subarray(i5, s5)).buffer, a3 = new Float64Array(o4);
                    return e5.set(s5), r5 ? Kf(a3, r5, 0) : a3;
                  })(t4, e4, i4.numValues, s4);
                  return new af(n4.name, o3, r4);
                })(e3, n3, s3, a2);
              default:
                throw new Error(`The specified data type for the field is currently not supported: ${i3}`);
            }
          })(r2, t2, e2, i2, n2.scalarType, n2) : 0 === r2 ? null : (function(t3, e3, n3, r3) {
            let i3 = null, s3 = null, o2 = null, a2 = null, l2 = false;
            for (; !l2; ) {
              const n4 = Hf(t3, e3);
              switch (n4.physicalStreamType) {
                case Nf.LENGTH:
                  qf.DICTIONARY === n4.logicalStreamType.lengthType ? i3 = td(t3, e3, n4) : o2 = td(t3, e3, n4);
                  break;
                case Nf.DATA:
                  Uf.SINGLE === n4.logicalStreamType.dictionaryType || Uf.SHARED === n4.logicalStreamType.dictionaryType ? (s3 = t3.subarray(e3.get(), e3.get() + n4.byteLength), l2 = true) : a2 = t3.subarray(e3.get(), e3.get() + n4.byteLength), e3.add(n4.byteLength);
              }
            }
            const u2 = n3.complexType.children, c2 = [];
            let h2 = 0;
            for (const l3 of u2) {
              const u3 = Ef(t3, e3, 1)[0];
              if (0 === u3) continue;
              const p2 = l3.name ? `${n3.name}${l3.name}` : n3.name;
              if (2 !== u3 || "scalarField" !== l3.type || 9 !== l3.scalarField.physicalType) throw new Error("Currently only optional string fields are implemented for a struct.");
              const f2 = Hf(t3, e3), d2 = Ed(t3, f2.numValues, f2.byteLength, e3), y2 = Hf(t3, e3), m2 = Qf(t3, e3, y2, 0, y2.decompressedCount !== r3 ? new Wf(d2, f2.numValues) : void 0);
              c2[h2++] = a2 ? new Bd(p2, m2, i3, s3, o2, a2, new Wf(d2, f2.numValues)) : new zd(p2, m2, i3, s3, new Wf(d2, f2.numValues));
            }
            return c2;
          })(t2, e2, n2, i2);
        }
        function Vd(t2) {
          return t2 instanceof Wf;
        }
        function Ld(t2) {
          switch (t2) {
            case 0:
            case 1:
            case 2:
            case 3: {
              const e2 = {};
              e2.nullable = !!(1 & t2), e2.columnScope = 0;
              const n2 = { type: "logicalType", logicalType: 0 };
              return n2.longID = !!(2 & t2), e2.scalarType = n2, e2.type = "scalarType", e2;
            }
            case 4: {
              const t3 = { nullable: false, columnScope: 0 }, e2 = { type: "physicalType", physicalType: 0 };
              return t3.type = "complexType", t3.complexType = e2, t3;
            }
            case 30: {
              const t3 = { nullable: false, columnScope: 0 }, e2 = { type: "physicalType", physicalType: 1 };
              return t3.type = "complexType", t3.complexType = e2, t3;
            }
            default:
              return (function(t3) {
                let e2;
                switch (t3) {
                  case 10:
                  case 11:
                    e2 = 0;
                    break;
                  case 12:
                  case 13:
                    e2 = 1;
                    break;
                  case 14:
                  case 15:
                    e2 = 2;
                    break;
                  case 16:
                  case 17:
                    e2 = 3;
                    break;
                  case 18:
                  case 19:
                    e2 = 4;
                    break;
                  case 20:
                  case 21:
                    e2 = 5;
                    break;
                  case 22:
                  case 23:
                    e2 = 6;
                    break;
                  case 24:
                  case 25:
                    e2 = 7;
                    break;
                  case 26:
                  case 27:
                    e2 = 8;
                    break;
                  case 28:
                  case 29:
                    e2 = 9;
                    break;
                  default:
                    return null;
                }
                const n2 = {};
                n2.nullable = !!(1 & t3), n2.columnScope = 0;
                const r2 = { type: "physicalType" };
                return r2.physicalType = e2, n2.type = "scalarType", n2.scalarType = r2, n2;
              })(t2);
          }
        }
        function Od(t2) {
          return t2 >= 10;
        }
        function $d(t2) {
          return 30 === t2;
        }
        function Rd(t2) {
          if ("scalarType" === t2.type) {
            const e2 = t2.scalarType;
            if ("physicalType" === e2.type) switch (e2.physicalType) {
              case 0:
              case 1:
              case 2:
              case 3:
              case 4:
              case 5:
              case 6:
              case 7:
              case 8:
              default:
                return false;
              case 9:
                return true;
            }
            if ("logicalType" === e2.type) return false;
          } else if ("complexType" === t2.type) {
            const e2 = t2.complexType;
            if ("physicalType" === e2.type) switch (e2.physicalType) {
              case 0:
              case 1:
                return true;
              default:
                return false;
            }
          }
          return console.warn("Unexpected column type in hasStreamCount", t2), false;
        }
        function Nd(t2) {
          return "complexType" === t2.type && "physicalType" === t2.complexType?.type && 0 === t2.complexType.physicalType;
        }
        const Ud = new TextDecoder();
        function jd(t2, e2) {
          const n2 = Ef(t2, e2, 1)[0];
          if (0 === n2) return "";
          const r2 = e2.get(), i2 = t2.subarray(r2, r2 + n2);
          return e2.add(n2), Ud.decode(i2);
        }
        function qd(t2, e2) {
          const n2 = Ef(t2, e2, 1)[0] >>> 0;
          if (n2 < 10 || n2 > 30) throw new Error(`Unsupported field type code ${n2}. Supported: 10-29(scalars), 30(STRUCT)`);
          const r2 = Ld(n2);
          if (Od(n2) && (r2.name = jd(t2, e2)), $d(n2)) {
            const n3 = Ef(t2, e2, 1)[0] >>> 0;
            r2.complexType.children = new Array(n3);
            for (let i2 = 0; i2 < n3; i2++) r2.complexType.children[i2] = qd(t2, e2);
          }
          return (function(t3) {
            return { name: t3.name, nullable: t3.nullable, scalarField: t3.scalarType, complexField: t3.complexType, type: "scalarType" === t3.type ? "scalarField" : "complexField" };
          })(r2);
        }
        function Gd(t2, e2) {
          const n2 = Ef(t2, e2, 1)[0] >>> 0, r2 = Ld(n2);
          if (!r2) throw new Error(`Unsupported column type code ${n2}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);
          if (Od(n2) ? r2.name = jd(t2, e2) : n2 >= 0 && n2 <= 3 ? r2.name = "id" : 4 === n2 && (r2.name = "geometry"), $d(n2)) {
            const n3 = Ef(t2, e2, 1)[0] >>> 0, i2 = r2.complexType;
            i2.children = new Array(n3);
            for (let r3 = 0; r3 < n3; r3++) i2.children[r3] = qd(t2, e2);
          }
          return r2;
        }
        function Xd(t2, e2) {
          const n2 = { featureTables: [] }, r2 = {};
          r2.name = jd(t2, e2);
          const i2 = Ef(t2, e2, 1)[0] >>> 0, s2 = Ef(t2, e2, 1)[0] >>> 0;
          r2.columns = new Array(s2);
          for (let n3 = 0; n3 < s2; n3++) r2.columns[n3] = Gd(t2, e2);
          return n2.featureTables.push(r2), [n2, i2];
        }
        function Yd(t2, e2, n2, r2, i2, s2, o2 = false) {
          const a2 = e2.scalarType;
          if (!a2 || "logicalType" !== a2.type || 0 !== a2.logicalType) throw new Error(`ID column must be a logical ID scalar type: ${r2}`);
          const l2 = a2.longID ? 6 : 4, u2 = "number" == typeof s2 ? void 0 : s2, c2 = ad(i2, s2, t2, n2, 6 === l2 ? "int64" : "int32");
          if (4 === l2) switch (c2) {
            case Gf.FLAT: {
              const e3 = Qf(t2, n2, i2, 0, u2);
              return new of(r2, e3, s2);
            }
            case Gf.SEQUENCE: {
              const e3 = rd(t2, n2, i2);
              return new uf(r2, e3[0], e3[1], i2.numRleValues);
            }
            case Gf.CONST: {
              const e3 = nd(t2, n2, i2);
              return new cf(r2, e3, s2, false);
            }
          }
          switch (c2) {
            case Gf.FLAT: {
              if (o2) {
                const e4 = (function(t3, e5, n3) {
                  const r3 = (function(t4, e6, n4) {
                    const r4 = new Float64Array(n4);
                    for (let i3 = 0; i3 < n4; i3++) r4[i3] = Pf(t4, e6);
                    return r4;
                  })(t3, e5, n3.numValues);
                  return (function(t4, e6) {
                    switch (e6.logicalLevelTechnique1) {
                      case ff.DELTA:
                        return e6.logicalLevelTechnique2 === ff.RLE && (t4 = Lf(t4, e6.runs, e6.numRleValues)), (function(t5) {
                          t5[0] = Bf(t5[0]);
                          const e7 = t5.length / 4 * 4;
                          let n4 = 1;
                          if (e7 >= 4) for (; n4 < e7 - 4; n4 += 4) {
                            const e8 = t5[n4 + 1], r4 = t5[n4 + 2], i3 = t5[n4 + 3];
                            t5[n4] = Bf(t5[n4]) + t5[n4 - 1], t5[n4 + 1] = Bf(e8) + t5[n4], t5[n4 + 2] = Bf(r4) + t5[n4 + 1], t5[n4 + 3] = Bf(i3) + t5[n4 + 2];
                          }
                          for (; n4 !== t5.length; ++n4) t5[n4] = Bf(t5[n4]) + t5[n4 - 1];
                        })(t4), t4;
                      case ff.RLE:
                        return (function(t5, e7) {
                          return Lf(t5, e7.runs, e7.numRleValues);
                        })(t4, e6);
                      case ff.NONE:
                        return t4;
                      default:
                        throw new Error(`The specified Logical level technique is not supported: ${e6.logicalLevelTechnique1}`);
                    }
                  })(r3, n3);
                })(t2, n2, i2);
                return new af(r2, e4, s2);
              }
              const e3 = sd(t2, n2, i2, u2);
              return new ld(r2, e3, s2);
            }
            case Gf.SEQUENCE: {
              const e3 = id(t2, n2, i2);
              return new ud(r2, e3[0], e3[1], i2.numRleValues);
            }
            case Gf.CONST: {
              const e3 = od(t2, n2, i2);
              return new Id(r2, e3, s2, false);
            }
          }
          throw new Error("Vector type not supported for id column.");
        }
        class Zd {
          constructor(t2, e2) {
            var n2;
            switch (this._featureData = t2, this.properties = this._featureData.properties || {}, null === (n2 = this._featureData.geometry) || void 0 === n2 ? void 0 : n2.type) {
              case Xf.POINT:
              case Xf.MULTIPOINT:
                this.type = 1;
                break;
              case Xf.LINESTRING:
              case Xf.MULTILINESTRING:
                this.type = 2;
                break;
              case Xf.POLYGON:
              case Xf.MULTIPOLYGON:
                this.type = 3;
                break;
              default:
                this.type = 0;
            }
            this.extent = e2, this.id = Number(this._featureData.id);
          }
          loadGeometry() {
            const t2 = [];
            for (const e2 of this._featureData.geometry.coordinates) {
              const r2 = [];
              for (const t3 of e2) r2.push(new n(t3.x, t3.y));
              t2.push(r2);
            }
            return t2;
          }
        }
        class Hd {
          constructor(t2) {
            this.features = [], this.featureTable = t2, this.name = t2.name, this.extent = t2.extent, this.version = 2, this.features = t2.getFeatures(), this.length = this.features.length;
          }
          feature(t2) {
            return new Zd(this.features[t2], this.extent);
          }
        }
        class Wd {
          constructor(t2) {
            this.layers = {};
            const e2 = (function(t3, e3, n2 = true) {
              const r2 = new pf(0), i2 = [];
              for (; r2.get() < t3.length; ) {
                const e4 = Ef(t3, r2, 1)[0] >>> 0, o2 = r2.get() + e4;
                if (o2 > t3.length) throw new Error(`Block overruns tile: ${o2} > ${t3.length}`);
                if (1 != Ef(t3, r2, 1)[0] >>> 0) {
                  r2.set(o2);
                  continue;
                }
                const [a2, l2] = Xd(t3, r2), u2 = a2.featureTables[0];
                let c2 = null, h2 = null;
                const p2 = [];
                let f2 = 0;
                for (const e5 of u2.columns) {
                  const i3 = e5.name;
                  if ("scalarType" === (s2 = e5).type && "logicalType" === s2.scalarType?.type && 0 === s2.scalarType.logicalType) {
                    let s3 = null;
                    if (e5.nullable) {
                      const e6 = Hf(t3, r2), n3 = r2.get(), i4 = Ed(t3, e6.numValues, e6.byteLength, r2);
                      r2.set(n3 + e6.byteLength), s3 = new Wf(i4, e6.numValues);
                    }
                    const o3 = Hf(t3, r2);
                    f2 = s3 ? s3.size() : o3.decompressedCount, c2 = Yd(t3, e5, r2, i3, o3, s3 ?? f2, n2);
                  } else if (Nd(e5)) {
                    const e6 = Ef(t3, r2, 1)[0];
                    if (0 === f2) {
                      const e7 = r2.get();
                      f2 = Hf(t3, r2).decompressedCount, r2.set(e7);
                    }
                    h2 = _d(t3, e6, r2, f2);
                  } else {
                    const n3 = Rd(e5) ? Ef(t3, r2, 1)[0] : 1;
                    if (0 === n3) continue;
                    const i4 = Cd(t3, r2, e5, n3, f2);
                    if (i4) if (Array.isArray(i4)) for (const t4 of i4) p2.push(t4);
                    else p2.push(i4);
                  }
                }
                const d2 = new hf(u2.name, h2, c2, p2, l2);
                i2.push(d2), r2.set(o2);
              }
              var s2;
              return i2;
            })(new Uint8Array(t2));
            this.layers = e2.reduce(((t3, e3) => Object.assign(Object.assign({}, t3), { [e3.name]: new Hd(e3) })), {});
          }
        }
        class Kd {
          constructor(t2, e2) {
            this.feature = t2, this.type = t2.type, this.properties = t2.tags ? t2.tags : {}, this.extent = e2, "id" in t2 && ("string" == typeof t2.id ? this.id = parseInt(t2.id, 10) : "number" != typeof t2.id || isNaN(t2.id) || (this.id = t2.id));
          }
          loadGeometry() {
            const t2 = [], e2 = 1 === this.feature.type ? [this.feature.geometry] : this.feature.geometry;
            for (const r2 of e2) {
              const e3 = [];
              for (const t3 of r2) e3.push(new n(t3[0], t3[1]));
              t2.push(e3);
            }
            return t2;
          }
        }
        const Jd = "_geojsonTileLayer";
        function Qd(t2, e2, n2 = "") {
          e2.writeVarintField(15, t2.version || 1), e2.writeStringField(1, t2.name || ""), e2.writeVarintField(5, t2.extent || 4096);
          const r2 = { jsonPrefix: n2, keys: [], values: [], keycache: {}, valuecache: {} };
          for (let n3 = 0; n3 < t2.length; n3++) r2.feature = t2.feature(n3), e2.writeMessage(2, ty, r2);
          const i2 = r2.keys;
          for (const t3 of i2) e2.writeStringField(3, t3);
          const s2 = r2.values;
          for (const t3 of s2) e2.writeMessage(4, sy, t3);
        }
        function ty(t2, e2) {
          if (!t2.feature) return;
          const n2 = t2.feature;
          void 0 !== n2.id && e2.writeVarintField(1, n2.id), e2.writeMessage(2, ey, t2), e2.writeVarintField(3, n2.type), e2.writeMessage(4, iy, n2);
        }
        function ey(t2, e2) {
          for (const n2 in t2.feature?.properties) {
            let r2 = t2.feature.properties[n2], i2 = t2.keycache[n2];
            if (null == r2) continue;
            void 0 === i2 && (t2.keys.push(n2), i2 = t2.keys.length - 1, t2.keycache[n2] = i2), e2.writeVarint(i2), "string" != typeof r2 && "boolean" != typeof r2 && "number" != typeof r2 && (r2 = t2.jsonPrefix + JSON.stringify(r2));
            const s2 = typeof r2 + ":" + r2;
            let o2 = t2.valuecache[s2];
            void 0 === o2 && (t2.values.push(r2), o2 = t2.values.length - 1, t2.valuecache[s2] = o2), e2.writeVarint(o2);
          }
        }
        function ny(t2, e2) {
          return (e2 << 3) + (7 & t2);
        }
        function ry(t2) {
          return t2 << 1 ^ t2 >> 31;
        }
        function iy(t2, e2) {
          const n2 = t2.loadGeometry(), r2 = t2.type;
          let i2 = 0, s2 = 0;
          for (const o2 of n2) {
            let n3 = 1;
            1 === r2 && (n3 = o2.length), e2.writeVarint(ny(1, n3));
            const a2 = 3 === r2 ? o2.length - 1 : o2.length;
            for (let t3 = 0; t3 < a2; t3++) {
              1 === t3 && 1 !== r2 && e2.writeVarint(ny(2, a2 - 1));
              const n4 = o2[t3].x - i2, l2 = o2[t3].y - s2;
              e2.writeVarint(ry(n4)), e2.writeVarint(ry(l2)), i2 += n4, s2 += l2;
            }
            3 === t2.type && e2.writeVarint(ny(7, 1));
          }
        }
        function sy(t2, e2) {
          const n2 = typeof t2;
          "string" === n2 ? e2.writeStringField(1, t2) : "boolean" === n2 ? e2.writeBooleanField(7, t2) : "number" === n2 && (t2 % 1 != 0 ? e2.writeDoubleField(3, t2) : t2 < 0 ? e2.writeSVarintField(6, t2) : e2.writeVarintField(5, t2));
        }
        class oy {
          constructor(t2, e2) {
            this.tileID = t2, this.x = t2.canonical.x, this.y = t2.canonical.y, this.z = t2.canonical.z, this.grid = new ps(T, 16, 0), this.grid3D = new ps(T, 16, 0), this.featureIndexArray = new Go(), this.promoteId = e2;
          }
          insert(t2, e2, n2, r2, i2, s2) {
            const o2 = this.featureIndexArray.length;
            this.featureIndexArray.emplaceBack(n2, r2, i2);
            const a2 = s2 ? this.grid3D : this.grid;
            for (const t3 of e2) {
              const e3 = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
              for (const n3 of t3) e3[0] = Math.min(e3[0], n3.x), e3[1] = Math.min(e3[1], n3.y), e3[2] = Math.max(e3[2], n3.x), e3[3] = Math.max(e3[3], n3.y);
              e3[0] < T && e3[1] < T && e3[2] >= 0 && e3[3] >= 0 && a2.insert(o2, e3[0], e3[1], e3[2], e3[3]);
            }
          }
          loadVTLayers() {
            return this.vtLayers || (this.vtLayers = "mlt" !== this.encoding ? new Nu(new Rh(this.rawTileData)).layers : new Wd(this.rawTileData).layers, this.sourceLayerCoder = new ef(this.vtLayers ? Object.keys(this.vtLayers).sort() : [Jd])), this.vtLayers;
          }
          query(t2, e2, r2, i2) {
            this.loadVTLayers();
            const s2 = t2.params, o2 = T / t2.tileSize / t2.scale, a2 = yi(s2.filter, s2.globalState), l2 = t2.queryGeometry, u2 = t2.queryPadding * o2, c2 = tf.fromPoints(l2), h2 = this.grid.query(c2.minX - u2, c2.minY - u2, c2.maxX + u2, c2.maxY + u2), p2 = tf.fromPoints(t2.cameraQueryGeometry).expandBy(u2), f2 = this.grid3D.query(p2.minX, p2.minY, p2.maxX, p2.maxY, ((e3, r3, i3, s3) => (function(t3, e4, r4, i4, s4) {
              for (const n2 of t3) if (e4 <= n2.x && r4 <= n2.y && i4 >= n2.x && s4 >= n2.y) return true;
              const o3 = [new n(e4, r4), new n(e4, s4), new n(i4, s4), new n(i4, r4)];
              if (t3.length > 2) {
                for (const e5 of o3) if (il(t3, e5)) return true;
              }
              for (let e5 = 0; e5 < t3.length - 1; e5++) if (sl(t3[e5], t3[e5 + 1], o3)) return true;
              return false;
            })(t2.cameraQueryGeometry, e3 - u2, r3 - u2, i3 + u2, s3 + u2)));
            for (const t3 of f2) h2.push(t3);
            h2.sort(ly);
            const d2 = {};
            let y2;
            for (const n2 of h2) {
              if (n2 === y2) continue;
              y2 = n2;
              const u3 = this.featureIndexArray.get(n2);
              let c3 = null;
              this.loadMatchingFeature(d2, u3.bucketIndex, u3.sourceLayerIndex, u3.featureIndex, a2, s2.layers, s2.availableImages, e2, r2, i2, ((e3, n3, r3) => (c3 || (c3 = qa(e3)), n3.queryIntersectsFeature({ queryGeometry: l2, feature: e3, featureState: r3, geometry: c3, zoom: this.z, transform: t2.transform, pixelsToTileUnits: o2, pixelPosMatrix: t2.pixelPosMatrix, unwrappedTileID: this.tileID.toUnwrapped(), getElevation: t2.getElevation }))));
            }
            return d2;
          }
          loadMatchingFeature(t2, e2, n2, r2, i2, s2, o2, a2, l2, u2, c2) {
            const h2 = this.bucketLayerIDs[e2];
            if (s2 && !h2.some(((t3) => s2.has(t3)))) return;
            const p2 = this.sourceLayerCoder.decode(n2), f2 = this.vtLayers[p2].feature(r2);
            if (i2.needGeometry) {
              const t3 = Ga(f2, true);
              if (!i2.filter(new Cs(this.tileID.overscaledZ), t3, this.tileID.canonical)) return;
            } else if (!i2.filter(new Cs(this.tileID.overscaledZ), f2)) return;
            const d2 = this.getId(f2, p2);
            for (const e3 of h2) {
              if (s2 && !s2.has(e3)) continue;
              const n3 = a2[e3];
              if (!n3) continue;
              let i3 = {};
              d2 && u2 && (i3 = u2.getState(n3.sourceLayer || Jd, d2));
              const h3 = $({}, l2[e3]);
              h3.paint = ay(h3.paint, n3.paint, f2, i3, o2), h3.layout = ay(h3.layout, n3.layout, f2, i3, o2);
              const p3 = !c2 || c2(f2, n3, i3);
              if (!p3) continue;
              const y2 = new nf(f2, this.z, this.x, this.y, d2);
              y2.layer = h3;
              let m2 = t2[e3];
              void 0 === m2 && (m2 = t2[e3] = []), m2.push({ featureIndex: r2, feature: y2, intersectionZ: p3 });
            }
          }
          lookupSymbolFeatures(t2, e2, n2, r2, i2, s2, o2, a2) {
            const l2 = {};
            this.loadVTLayers();
            const u2 = yi(i2.filterSpec, i2.globalState);
            for (const i3 of t2) this.loadMatchingFeature(l2, n2, r2, i3, u2, s2, o2, a2, e2);
            return l2;
          }
          hasLayer(t2) {
            for (const e2 of this.bucketLayerIDs) for (const n2 of e2) if (t2 === n2) return true;
            return false;
          }
          getId(t2, e2) {
            var n2;
            let r2 = t2.id;
            return this.promoteId && (r2 = t2.properties["string" == typeof this.promoteId ? this.promoteId : this.promoteId[e2]], "boolean" == typeof r2 && (r2 = Number(r2)), void 0 === r2 && (null === (n2 = t2.properties) || void 0 === n2 ? void 0 : n2.cluster) && this.promoteId && (r2 = Number(t2.properties.cluster_id))), r2;
          }
        }
        function ay(t2, e2, n2, r2, i2) {
          return N(t2, ((t3, s2) => {
            const o2 = e2 instanceof Gs ? e2.get(s2) : null;
            return (null == o2 ? void 0 : o2.evaluate) ? o2.evaluate(n2, r2, i2) : o2;
          }));
        }
        function ly(t2, e2) {
          return e2 - t2;
        }
        function uy(t2, e2, r2, i2, s2) {
          const o2 = [];
          for (const a2 of t2) {
            let t3;
            for (let l2 = 0; l2 < a2.length - 1; l2++) {
              let u2 = a2[l2], c2 = a2[l2 + 1];
              u2.x < e2 && c2.x < e2 || (u2.x < e2 ? u2 = new n(e2, u2.y + (e2 - u2.x) / (c2.x - u2.x) * (c2.y - u2.y))._round() : c2.x < e2 && (c2 = new n(e2, u2.y + (e2 - u2.x) / (c2.x - u2.x) * (c2.y - u2.y))._round()), u2.y < r2 && c2.y < r2 || (u2.y < r2 ? u2 = new n(u2.x + (r2 - u2.y) / (c2.y - u2.y) * (c2.x - u2.x), r2)._round() : c2.y < r2 && (c2 = new n(u2.x + (r2 - u2.y) / (c2.y - u2.y) * (c2.x - u2.x), r2)._round()), u2.x >= i2 && c2.x >= i2 || (u2.x >= i2 ? u2 = new n(i2, u2.y + (i2 - u2.x) / (c2.x - u2.x) * (c2.y - u2.y))._round() : c2.x >= i2 && (c2 = new n(i2, u2.y + (i2 - u2.x) / (c2.x - u2.x) * (c2.y - u2.y))._round()), u2.y >= s2 && c2.y >= s2 || (u2.y >= s2 ? u2 = new n(u2.x + (s2 - u2.y) / (c2.y - u2.y) * (c2.x - u2.x), s2)._round() : c2.y >= s2 && (c2 = new n(u2.x + (s2 - u2.y) / (c2.y - u2.y) * (c2.x - u2.x), s2)._round()), t3 && u2.equals(t3[t3.length - 1]) || (t3 = [u2], o2.push(t3)), t3.push(c2)))));
            }
          }
          return o2;
        }
        function cy(t2, e2, n2, r2, i2) {
          switch (e2) {
            case 1:
              return (function(t3, e3, n3, r3) {
                const i3 = [];
                for (const s2 of t3) for (const t4 of s2) {
                  const s3 = 0 === r3 ? t4.x : t4.y;
                  s3 >= e3 && s3 <= n3 && i3.push([t4]);
                }
                return i3;
              })(t2, n2, r2, i2);
            case 2:
              return py(t2, n2, r2, i2, false);
            case 3:
              return py(t2, n2, r2, i2, true);
          }
          return [];
        }
        function hy(t2, e2, r2, i2, s2) {
          const o2 = 0 === i2 ? fy : dy;
          let a2 = [];
          const l2 = [];
          for (let n2 = 0; n2 < t2.length - 1; n2++) {
            const u3 = t2[n2], c3 = t2[n2 + 1], h2 = 0 === i2 ? u3.x : u3.y, p2 = 0 === i2 ? c3.x : c3.y;
            let f2 = false;
            h2 < e2 ? p2 > e2 && a2.push(o2(u3, c3, e2)) : h2 > r2 ? p2 < r2 && a2.push(o2(u3, c3, r2)) : a2.push(u3), p2 < e2 && h2 >= e2 && (a2.push(o2(u3, c3, e2)), f2 = true), p2 > r2 && h2 <= r2 && (a2.push(o2(u3, c3, r2)), f2 = true), !s2 && f2 && (l2.push(a2), a2 = []);
          }
          const u2 = t2.length - 1, c2 = 0 === i2 ? t2[u2].x : t2[u2].y;
          return c2 >= e2 && c2 <= r2 && a2.push(t2[u2]), s2 && a2.length > 0 && !a2[0].equals(a2[a2.length - 1]) && a2.push(new n(a2[0].x, a2[0].y)), a2.length > 0 && l2.push(a2), l2;
        }
        function py(t2, e2, n2, r2, i2) {
          const s2 = [];
          for (const o2 of t2) {
            const t3 = hy(o2, e2, n2, r2, i2);
            t3.length > 0 && s2.push(...t3);
          }
          return s2;
        }
        function fy(t2, e2, r2) {
          return new n(r2, t2.y + (r2 - t2.x) / (e2.x - t2.x) * (e2.y - t2.y));
        }
        function dy(t2, e2, r2) {
          return new n(t2.x + (r2 - t2.y) / (e2.y - t2.y) * (e2.x - t2.x), r2);
        }
        ds("FeatureIndex", oy, { omit: ["rawTileData", "sourceLayerCoder"] });
        class yy extends n {
          constructor(t2, e2, n2, r2) {
            super(t2, e2), this.angle = n2, void 0 !== r2 && (this.segment = r2);
          }
          clone() {
            return new yy(this.x, this.y, this.angle, this.segment);
          }
        }
        function my(t2, e2, n2, r2, i2) {
          if (void 0 === e2.segment || 0 === n2) return true;
          let s2 = e2, o2 = e2.segment + 1, a2 = 0;
          for (; a2 > -n2 / 2; ) {
            if (o2--, o2 < 0) return false;
            a2 -= t2[o2].dist(s2), s2 = t2[o2];
          }
          a2 += t2[o2].dist(t2[o2 + 1]), o2++;
          const l2 = [];
          let u2 = 0;
          for (; a2 < n2 / 2; ) {
            const e3 = t2[o2], n3 = t2[o2 + 1];
            if (!n3) return false;
            let s3 = t2[o2 - 1].angleTo(e3) - e3.angleTo(n3);
            for (s3 = Math.abs((s3 + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l2.push({ distance: a2, angleDelta: s3 }), u2 += s3; a2 - l2[0].distance > r2; ) u2 -= l2.shift().angleDelta;
            if (u2 > i2) return false;
            o2++, a2 += e3.dist(n3);
          }
          return true;
        }
        function gy(t2) {
          let e2 = 0;
          for (let n2 = 0; n2 < t2.length - 1; n2++) e2 += t2[n2].dist(t2[n2 + 1]);
          return e2;
        }
        function xy(t2, e2, n2) {
          return t2 ? 0.6 * e2 * n2 : 0;
        }
        function vy(t2, e2) {
          return Math.max(t2 ? t2.right - t2.left : 0, e2 ? e2.right - e2.left : 0);
        }
        function by(t2, e2, n2, r2, i2, s2) {
          const o2 = xy(n2, i2, s2), a2 = vy(n2, r2) * s2;
          let l2 = 0;
          const u2 = gy(t2) / 2;
          for (let n3 = 0; n3 < t2.length - 1; n3++) {
            const r3 = t2[n3], i3 = t2[n3 + 1], s3 = r3.dist(i3);
            if (l2 + s3 > u2) {
              const c2 = (u2 - l2) / s3, h2 = xn.number(r3.x, i3.x, c2), p2 = xn.number(r3.y, i3.y, c2), f2 = new yy(h2, p2, i3.angleTo(r3), n3);
              return f2._round(), !o2 || my(t2, f2, a2, o2, e2) ? f2 : void 0;
            }
            l2 += s3;
          }
        }
        function wy(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
          const u2 = xy(r2, s2, o2), c2 = vy(r2, i2), h2 = c2 * o2, p2 = 0 === t2[0].x || t2[0].x === l2 || 0 === t2[0].y || t2[0].y === l2;
          return e2 - h2 < e2 / 4 && (e2 = h2 + e2 / 4), _y(t2, p2 ? e2 / 2 * a2 % e2 : (c2 / 2 + 2 * s2) * o2 * a2 % e2, e2, u2, n2, h2, p2, false, l2);
        }
        function _y(t2, e2, n2, r2, i2, s2, o2, a2, l2) {
          const u2 = s2 / 2, c2 = gy(t2);
          let h2 = 0, p2 = e2 - n2, f2 = [];
          for (let e3 = 0; e3 < t2.length - 1; e3++) {
            const o3 = t2[e3], a3 = t2[e3 + 1], d2 = o3.dist(a3), y2 = a3.angleTo(o3);
            for (; p2 + n2 < h2 + d2; ) {
              p2 += n2;
              const m2 = (p2 - h2) / d2, g2 = xn.number(o3.x, a3.x, m2), x2 = xn.number(o3.y, a3.y, m2);
              if (g2 >= 0 && g2 < l2 && x2 >= 0 && x2 < l2 && p2 - u2 >= 0 && p2 + u2 <= c2) {
                const n3 = new yy(g2, x2, y2, e3);
                n3._round(), r2 && !my(t2, n3, s2, r2, i2) || f2.push(n3);
              }
            }
            h2 += d2;
          }
          return a2 || f2.length || o2 || (f2 = _y(t2, h2 / 2, n2, r2, i2, s2, o2, true, l2)), f2;
        }
        function Sy(t2, e2, r2, i2) {
          const s2 = [], o2 = t2.image, a2 = o2.pixelRatio, l2 = o2.paddedRect.w - 2, u2 = o2.paddedRect.h - 2;
          let c2 = { x1: t2.left, y1: t2.top, x2: t2.right, y2: t2.bottom };
          const h2 = o2.stretchX || [[0, l2]], p2 = o2.stretchY || [[0, u2]], f2 = (t3, e3) => t3 + e3[1] - e3[0], d2 = h2.reduce(f2, 0), y2 = p2.reduce(f2, 0), m2 = l2 - d2, g2 = u2 - y2;
          let x2 = 0, v2 = d2, b2 = 0, w2 = y2, _2 = 0, S2 = m2, A2 = 0, M2 = g2;
          if (o2.content && i2) {
            const e3 = o2.content, n2 = e3[2] - e3[0], r3 = e3[3] - e3[1];
            (o2.textFitWidth || o2.textFitHeight) && (c2 = dp(t2)), x2 = Ay(h2, 0, e3[0]), b2 = Ay(p2, 0, e3[1]), v2 = Ay(h2, e3[0], e3[2]), w2 = Ay(p2, e3[1], e3[3]), _2 = e3[0] - x2, A2 = e3[1] - b2, S2 = n2 - v2, M2 = r3 - w2;
          }
          const k2 = c2.x1, I2 = c2.y1, E2 = c2.x2 - k2, T2 = c2.y2 - I2, F2 = (t3, i3, s3, l3) => {
            const u3 = ky(t3.stretch - x2, v2, E2, k2), c3 = Iy(t3.fixed - _2, S2, t3.stretch, d2), h3 = ky(i3.stretch - b2, w2, T2, I2), p3 = Iy(i3.fixed - A2, M2, i3.stretch, y2), f3 = ky(s3.stretch - x2, v2, E2, k2), m3 = Iy(s3.fixed - _2, S2, s3.stretch, d2), g3 = ky(l3.stretch - b2, w2, T2, I2), F3 = Iy(l3.fixed - A2, M2, l3.stretch, y2), P2 = new n(u3, h3), D2 = new n(f3, h3), z2 = new n(f3, g3), B2 = new n(u3, g3), C2 = new n(c3 / a2, p3 / a2), V2 = new n(m3 / a2, F3 / a2), L2 = e2 * Math.PI / 180;
            if (L2) {
              const t4 = Math.sin(L2), e3 = Math.cos(L2), n2 = [e3, -t4, t4, e3];
              P2._matMult(n2), D2._matMult(n2), B2._matMult(n2), z2._matMult(n2);
            }
            const O2 = t3.stretch + t3.fixed, $2 = i3.stretch + i3.fixed;
            return { tl: P2, tr: D2, bl: B2, br: z2, tex: { x: o2.paddedRect.x + 1 + O2, y: o2.paddedRect.y + 1 + $2, w: s3.stretch + s3.fixed - O2, h: l3.stretch + l3.fixed - $2 }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: C2, pixelOffsetBR: V2, minFontScaleX: S2 / a2 / E2, minFontScaleY: M2 / a2 / T2, isSDF: r2 };
          };
          if (i2 && (o2.stretchX || o2.stretchY)) {
            const t3 = My(h2, m2, d2), e3 = My(p2, g2, y2);
            for (let n2 = 0; n2 < t3.length - 1; n2++) {
              const r3 = t3[n2], i3 = t3[n2 + 1];
              for (let t4 = 0; t4 < e3.length - 1; t4++) s2.push(F2(r3, e3[t4], i3, e3[t4 + 1]));
            }
          } else s2.push(F2({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: l2 + 1 }, { fixed: 0, stretch: u2 + 1 }));
          return s2;
        }
        function Ay(t2, e2, n2) {
          let r2 = 0;
          for (const i2 of t2) r2 += Math.max(e2, Math.min(n2, i2[1])) - Math.max(e2, Math.min(n2, i2[0]));
          return r2;
        }
        function My(t2, e2, n2) {
          const r2 = [{ fixed: -1, stretch: 0 }];
          for (const [e3, n3] of t2) {
            const t3 = r2[r2.length - 1];
            r2.push({ fixed: e3 - t3.stretch, stretch: t3.stretch }), r2.push({ fixed: e3 - t3.stretch, stretch: t3.stretch + (n3 - e3) });
          }
          return r2.push({ fixed: e2 + 1, stretch: n2 }), r2;
        }
        function ky(t2, e2, n2, r2) {
          return t2 / e2 * n2 + r2;
        }
        function Iy(t2, e2, n2, r2) {
          return t2 - e2 * n2 / r2;
        }
        ds("Anchor", yy);
        class Ey {
          constructor(t2, e2, r2, i2, s2, o2, a2, l2, u2, c2) {
            var h2;
            if (this.boxStartIndex = t2.length, u2) {
              let t3 = o2.top, e3 = o2.bottom;
              const n2 = o2.collisionPadding;
              n2 && (t3 -= n2[1], e3 += n2[3]);
              let r3 = e3 - t3;
              r3 > 0 && (r3 = Math.max(10, r3), this.circleDiameter = r3);
            } else {
              const u3 = (null === (h2 = o2.image) || void 0 === h2 ? void 0 : h2.content) && (o2.image.textFitWidth || o2.image.textFitHeight) ? dp(o2) : { x1: o2.left, y1: o2.top, x2: o2.right, y2: o2.bottom };
              u3.y1 = u3.y1 * a2 - l2[0], u3.y2 = u3.y2 * a2 + l2[2], u3.x1 = u3.x1 * a2 - l2[3], u3.x2 = u3.x2 * a2 + l2[1];
              const p2 = o2.collisionPadding;
              if (p2 && (u3.x1 -= p2[0] * a2, u3.y1 -= p2[1] * a2, u3.x2 += p2[2] * a2, u3.y2 += p2[3] * a2), c2) {
                const t3 = new n(u3.x1, u3.y1), e3 = new n(u3.x2, u3.y1), r3 = new n(u3.x1, u3.y2), i3 = new n(u3.x2, u3.y2), s3 = c2 * Math.PI / 180;
                t3._rotate(s3), e3._rotate(s3), r3._rotate(s3), i3._rotate(s3), u3.x1 = Math.min(t3.x, e3.x, r3.x, i3.x), u3.x2 = Math.max(t3.x, e3.x, r3.x, i3.x), u3.y1 = Math.min(t3.y, e3.y, r3.y, i3.y), u3.y2 = Math.max(t3.y, e3.y, r3.y, i3.y);
              }
              t2.emplaceBack(e2.x, e2.y, u3.x1, u3.y1, u3.x2, u3.y2, r2, i2, s2);
            }
            this.boxEndIndex = t2.length;
          }
        }
        class Ty {
          constructor(t2 = [], e2 = (t3, e3) => t3 < e3 ? -1 : t3 > e3 ? 1 : 0) {
            if (this.data = t2, this.length = this.data.length, this.compare = e2, this.length > 0) for (let t3 = (this.length >> 1) - 1; t3 >= 0; t3--) this._down(t3);
          }
          push(t2) {
            this.data.push(t2), this._up(this.length++);
          }
          pop() {
            if (0 === this.length) return;
            const t2 = this.data[0], e2 = this.data.pop();
            return --this.length > 0 && (this.data[0] = e2, this._down(0)), t2;
          }
          peek() {
            return this.data[0];
          }
          _up(t2) {
            const { data: e2, compare: n2 } = this, r2 = e2[t2];
            for (; t2 > 0; ) {
              const i2 = t2 - 1 >> 1, s2 = e2[i2];
              if (n2(r2, s2) >= 0) break;
              e2[t2] = s2, t2 = i2;
            }
            e2[t2] = r2;
          }
          _down(t2) {
            const { data: e2, compare: n2 } = this, r2 = this.length >> 1, i2 = e2[t2];
            for (; t2 < r2; ) {
              let r3 = 1 + (t2 << 1);
              const s2 = r3 + 1;
              if (s2 < this.length && n2(e2[s2], e2[r3]) < 0 && (r3 = s2), n2(e2[r3], i2) >= 0) break;
              e2[t2] = e2[r3], t2 = r3;
            }
            e2[t2] = i2;
          }
        }
        function Fy(t2, e2 = 1) {
          const r2 = tf.fromPoints(t2[0]), i2 = Math.min(r2.width(), r2.height());
          let s2 = i2 / 2;
          const o2 = new Ty([], Py), { minX: a2, minY: l2, maxX: u2, maxY: c2 } = r2;
          if (0 === i2) return new n(a2, l2);
          for (let e3 = a2; e3 < u2; e3 += i2) for (let n2 = l2; n2 < c2; n2 += i2) o2.push(new Dy(e3 + s2, n2 + s2, s2, t2));
          const h2 = (function(t3) {
            let e3 = 0, n2 = 0, r3 = 0;
            const i3 = t3[0];
            for (let t4 = 0, s3 = i3.length, o3 = s3 - 1; t4 < s3; o3 = t4++) {
              const s4 = i3[t4], a3 = i3[o3], l3 = s4.x * a3.y - a3.x * s4.y;
              n2 += (s4.x + a3.x) * l3, r3 += (s4.y + a3.y) * l3, e3 += 3 * l3;
            }
            return new Dy(n2 / e3, r3 / e3, 0, t3);
          })(t2);
          let p2 = h2;
          for (; o2.length; ) {
            const n2 = o2.pop();
            (n2.d > p2.d || !p2.d) && (p2 = n2), n2.max - p2.d <= e2 || (s2 = n2.h / 2, o2.push(new Dy(n2.p.x - s2, n2.p.y - s2, s2, t2)), o2.push(new Dy(n2.p.x + s2, n2.p.y - s2, s2, t2)), o2.push(new Dy(n2.p.x - s2, n2.p.y + s2, s2, t2)), o2.push(new Dy(n2.p.x + s2, n2.p.y + s2, s2, t2)));
          }
          return h2.d > 0 && p2.d - h2.d <= e2 ? h2.p : p2.p;
        }
        function Py(t2, e2) {
          return e2.max - t2.max;
        }
        class Dy {
          constructor(t2, e2, r2, i2) {
            this.p = new n(t2, e2), this.h = r2, this.d = (function(t3, e3) {
              let n2 = false, r3 = 1 / 0;
              for (const i3 of e3) for (let e4 = 0, s2 = i3.length, o2 = s2 - 1; e4 < s2; o2 = e4++) {
                const s3 = i3[e4], a2 = i3[o2];
                s3.y > t3.y != a2.y > t3.y && t3.x < (a2.x - s3.x) * (t3.y - s3.y) / (a2.y - s3.y) + s3.x && (n2 = !n2), r3 = Math.min(r3, nl(t3, s3, a2));
              }
              return (n2 ? 1 : -1) * Math.sqrt(r3);
            })(this.p, i2), this.max = this.d + this.h * Math.SQRT2;
          }
        }
        var zy;
        t.aM = void 0, (zy = t.aM || (t.aM = {}))[zy.center = 1] = "center", zy[zy.left = 2] = "left", zy[zy.right = 3] = "right", zy[zy.top = 4] = "top", zy[zy.bottom = 5] = "bottom", zy[zy["top-left"] = 6] = "top-left", zy[zy["top-right"] = 7] = "top-right", zy[zy["bottom-left"] = 8] = "bottom-left", zy[zy["bottom-right"] = 9] = "bottom-right";
        const By = Number.POSITIVE_INFINITY;
        function Cy(t2, e2) {
          return e2[1] !== By ? (function(t3, e3, n2) {
            let r2 = 0, i2 = 0;
            switch (e3 = Math.abs(e3), n2 = Math.abs(n2), t3) {
              case "top-right":
              case "top-left":
              case "top":
                i2 = n2 - 7;
                break;
              case "bottom-right":
              case "bottom-left":
              case "bottom":
                i2 = 7 - n2;
            }
            switch (t3) {
              case "top-right":
              case "bottom-right":
              case "right":
                r2 = -e3;
                break;
              case "top-left":
              case "bottom-left":
              case "left":
                r2 = e3;
            }
            return [r2, i2];
          })(t2, e2[0], e2[1]) : (function(t3, e3) {
            let n2 = 0, r2 = 0;
            e3 < 0 && (e3 = 0);
            const i2 = e3 / Math.SQRT2;
            switch (t3) {
              case "top-right":
              case "top-left":
                r2 = i2 - 7;
                break;
              case "bottom-right":
              case "bottom-left":
                r2 = 7 - i2;
                break;
              case "bottom":
                r2 = 7 - e3;
                break;
              case "top":
                r2 = e3 - 7;
            }
            switch (t3) {
              case "top-right":
              case "bottom-right":
                n2 = -i2;
                break;
              case "top-left":
              case "bottom-left":
                n2 = i2;
                break;
              case "left":
                n2 = e3;
                break;
              case "right":
                n2 = -e3;
            }
            return [n2, r2];
          })(t2, e2[0]);
        }
        function Vy(t2, e2, n2) {
          var r2;
          const i2 = t2.layout, s2 = null === (r2 = i2.get("text-variable-anchor-offset")) || void 0 === r2 ? void 0 : r2.evaluate(e2, {}, n2);
          if (s2) {
            const t3 = s2.values, e3 = [];
            for (let n3 = 0; n3 < t3.length; n3 += 2) {
              const r3 = e3[n3] = t3[n3], i3 = t3[n3 + 1].map(((t4) => t4 * Ih));
              r3.startsWith("top") ? i3[1] -= 7 : r3.startsWith("bottom") && (i3[1] += 7), e3[n3 + 1] = i3;
            }
            return new $e(e3);
          }
          const o2 = i2.get("text-variable-anchor");
          if (o2) {
            let r3;
            r3 = void 0 !== t2._unevaluatedLayout.getValue("text-radial-offset") ? [i2.get("text-radial-offset").evaluate(e2, {}, n2) * Ih, By] : i2.get("text-offset").evaluate(e2, {}, n2).map(((t3) => t3 * Ih));
            const s3 = [];
            for (const t3 of o2) s3.push(t3, Cy(t3, r3));
            return new $e(s3);
          }
          return null;
        }
        function Ly(t2) {
          switch (t2) {
            case "right":
            case "top-right":
            case "bottom-right":
              return "right";
            case "left":
            case "top-left":
            case "bottom-left":
              return "left";
          }
          return "center";
        }
        function Oy(e2, n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2) {
          let f2 = o2.textMaxSize.evaluate(n2, {});
          void 0 === f2 && (f2 = a2);
          const d2 = e2.layers[0].layout, y2 = d2.get("icon-offset").evaluate(n2, {}, h2), m2 = Ry(r2.horizontal), g2 = a2 / 24, x2 = e2.tilePixelRatio * g2, v2 = e2.tilePixelRatio * f2 / 24, b2 = e2.tilePixelRatio * l2, w2 = e2.tilePixelRatio * d2.get("symbol-spacing"), _2 = d2.get("text-padding") * e2.tilePixelRatio, S2 = (function(t2, e3, n3, r3 = 1) {
            const i3 = t2.get("icon-padding").evaluate(e3, {}, n3), s3 = null == i3 ? void 0 : i3.values;
            return [s3[0] * r3, s3[1] * r3, s3[2] * r3, s3[3] * r3];
          })(d2, n2, h2, e2.tilePixelRatio), A2 = d2.get("text-max-angle") / 180 * Math.PI, M2 = "viewport" !== d2.get("text-rotation-alignment") && "point" !== d2.get("symbol-placement"), k2 = "map" === d2.get("icon-rotation-alignment") && "point" !== d2.get("symbol-placement"), I2 = d2.get("symbol-placement"), E2 = w2 / 2, F2 = d2.get("icon-text-fit");
          let P2;
          i2 && "none" !== F2 && (e2.allowVerticalPlacement && r2.vertical && (P2 = yp(i2, r2.vertical, F2, d2.get("icon-text-fit-padding"), y2, g2)), m2 && (i2 = yp(i2, m2, F2, d2.get("icon-text-fit-padding"), y2, g2)));
          const D2 = h2 ? p2.line.getGranularityForZoomLevel(h2.z) : 1, z2 = (l3, p3) => {
            p3.x < 0 || p3.x >= T || p3.y < 0 || p3.y >= T || (function(e3, n3, r3, i3, s3, o3, a3, l4, u3, c3, h3, p4, f3, d3, y3, m3, g3, x3, v3, b3, w3, _3, S3, A3, M3) {
              const k3 = e3.addToLineVertexArray(n3, r3);
              let I3, E3, T2, F3, P3 = 0, D3 = 0, z3 = 0, B2 = 0, C2 = -1, V2 = -1;
              const L2 = {};
              let O2 = ba("");
              if (e3.allowVerticalPlacement && i3.vertical) {
                const t2 = l4.layout.get("text-rotate").evaluate(w3, {}, A3) + 90;
                T2 = new Ey(u3, n3, c3, h3, p4, i3.vertical, f3, d3, y3, t2), a3 && (F3 = new Ey(u3, n3, c3, h3, p4, a3, g3, x3, y3, t2));
              }
              if (s3) {
                const r4 = l4.layout.get("icon-rotate").evaluate(w3, {}), i4 = "none" !== l4.layout.get("icon-text-fit"), o4 = Sy(s3, r4, S3, i4), f4 = a3 ? Sy(a3, r4, S3, i4) : void 0;
                E3 = new Ey(u3, n3, c3, h3, p4, s3, g3, x3, false, r4), P3 = 4 * o4.length;
                const d4 = e3.iconSizeData;
                let y4 = null;
                "source" === d4.kind ? (y4 = [mp * l4.layout.get("icon-size").evaluate(w3, {})], y4[0] > gp && G(`${e3.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)) : "composite" === d4.kind && (y4 = [mp * _3.compositeIconSizes[0].evaluate(w3, {}, A3), mp * _3.compositeIconSizes[1].evaluate(w3, {}, A3)], (y4[0] > gp || y4[1] > gp) && G(`${e3.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)), e3.addSymbols(e3.icon, o4, y4, b3, v3, w3, t.ax.none, n3, k3.lineStartIndex, k3.lineLength, -1, A3), C2 = e3.icon.placedSymbolArray.length - 1, f4 && (D3 = 4 * f4.length, e3.addSymbols(e3.icon, f4, y4, b3, v3, w3, t.ax.vertical, n3, k3.lineStartIndex, k3.lineLength, -1, A3), V2 = e3.icon.placedSymbolArray.length - 1);
              }
              const $2 = Object.keys(i3.horizontal);
              for (const r4 of $2) {
                const s4 = i3.horizontal[r4];
                if (!I3) {
                  O2 = ba(s4.text);
                  const t2 = l4.layout.get("text-rotate").evaluate(w3, {}, A3);
                  I3 = new Ey(u3, n3, c3, h3, p4, s4, f3, d3, y3, t2);
                }
                const a4 = 1 === s4.positionedLines.length;
                if (z3 += $y(e3, n3, s4, o3, l4, y3, w3, m3, k3, i3.vertical ? t.ax.horizontal : t.ax.horizontalOnly, a4 ? $2 : [r4], L2, C2, _3, A3), a4) break;
              }
              i3.vertical && (B2 += $y(e3, n3, i3.vertical, o3, l4, y3, w3, m3, k3, t.ax.vertical, ["vertical"], L2, V2, _3, A3));
              const R2 = I3 ? I3.boxStartIndex : e3.collisionBoxArray.length, N2 = I3 ? I3.boxEndIndex : e3.collisionBoxArray.length, U2 = T2 ? T2.boxStartIndex : e3.collisionBoxArray.length, j2 = T2 ? T2.boxEndIndex : e3.collisionBoxArray.length, q2 = E3 ? E3.boxStartIndex : e3.collisionBoxArray.length, X2 = E3 ? E3.boxEndIndex : e3.collisionBoxArray.length, Y2 = F3 ? F3.boxStartIndex : e3.collisionBoxArray.length, Z2 = F3 ? F3.boxEndIndex : e3.collisionBoxArray.length;
              let H2 = -1;
              const W2 = (t2, e4) => (null == t2 ? void 0 : t2.circleDiameter) ? Math.max(t2.circleDiameter, e4) : e4;
              H2 = W2(I3, H2), H2 = W2(T2, H2), H2 = W2(E3, H2), H2 = W2(F3, H2);
              const K2 = H2 > -1 ? 1 : 0;
              K2 && (H2 *= M3 / Ih), e3.glyphOffsetArray.length >= kp.MAX_GLYPHS && G("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), void 0 !== w3.sortKey && e3.addToSortKeyRanges(e3.symbolInstances.length, w3.sortKey);
              const J2 = Vy(l4, w3, A3), [Q2, tt2] = (function(e4, n4) {
                const r4 = e4.length, i4 = null == n4 ? void 0 : n4.values;
                if ((null == i4 ? void 0 : i4.length) > 0) for (let n5 = 0; n5 < i4.length; n5 += 2) {
                  const r5 = i4[n5 + 1];
                  e4.emplaceBack(t.aM[i4[n5]], r5[0], r5[1]);
                }
                return [r4, e4.length];
              })(e3.textAnchorOffsets, J2);
              e3.symbolInstances.emplaceBack(n3.x, n3.y, L2.right >= 0 ? L2.right : -1, L2.center >= 0 ? L2.center : -1, L2.left >= 0 ? L2.left : -1, L2.vertical || -1, C2, V2, O2, R2, N2, U2, j2, q2, X2, Y2, Z2, c3, z3, B2, P3, D3, K2, 0, f3, H2, Q2, tt2);
            })(e2, p3, l3, r2, i2, s2, P2, e2.layers[0], e2.collisionBoxArray, n2.index, n2.sourceLayerIndex, e2.index, x2, [_2, _2, _2, _2], M2, u2, b2, S2, k2, y2, n2, o2, c2, h2, a2);
          };
          if ("line" === I2) for (const t2 of uy(n2.geometry, 0, 0, T, T)) {
            const n3 = Su(t2, D2), s3 = wy(n3, w2, A2, r2.vertical || m2, i2, 24, v2, e2.overscaling, T);
            for (const t3 of s3) m2 && Ny(e2, m2.text, E2, t3) || z2(n3, t3);
          }
          else if ("line-center" === I2) {
            for (const t2 of n2.geometry) if (t2.length > 1) {
              const e3 = Su(t2, D2), n3 = by(e3, A2, r2.vertical || m2, i2, 24, v2);
              n3 && z2(e3, n3);
            }
          } else if ("Polygon" === n2.type) for (const t2 of rr(n2.geometry, 0)) {
            const e3 = Fy(t2, 16);
            z2(Su(t2[0], D2, true), new yy(e3.x, e3.y, 0));
          }
          else if ("LineString" === n2.type) for (const t2 of n2.geometry) {
            const e3 = Su(t2, D2);
            z2(e3, new yy(e3[0].x, e3[0].y, 0));
          }
          else if ("Point" === n2.type) for (const t2 of n2.geometry) for (const e3 of t2) z2([e3], new yy(e3.x, e3.y, 0));
        }
        function $y(t2, e2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2) {
          const m2 = (function(t3, e3, r3, i3, s3, o3, a3, l3) {
            const u3 = i3.layout.get("text-rotate").evaluate(o3, {}) * Math.PI / 180, c3 = [];
            for (const t4 of e3.positionedLines) for (const i4 of t4.positionedGlyphs) {
              if (!i4.rect) continue;
              const o4 = i4.rect || {};
              let h3 = 4, p3 = true, f3 = 1, d3 = 0;
              const y3 = (s3 || l3) && i4.vertical, m3 = i4.metrics.advance * i4.scale / 2;
              if (l3 && e3.verticalizable && (d3 = t4.lineOffset / 2 - (i4.imageName ? -(Ih - i4.metrics.width * i4.scale) / 2 : (i4.scale - 1) * Ih)), i4.imageName) {
                const t5 = a3[i4.imageName];
                p3 = t5.sdf, f3 = t5.pixelRatio, h3 = 1 / f3;
              }
              const g3 = s3 ? [i4.x + m3, i4.y] : [0, 0];
              let x3 = s3 ? [0, 0] : [i4.x + m3 + r3[0], i4.y + r3[1] - d3], v2 = [0, 0];
              y3 && (v2 = x3, x3 = [0, 0]);
              const b2 = i4.metrics.isDoubleResolution ? 2 : 1, w2 = (i4.metrics.left - h3) * i4.scale - m3 + x3[0], _2 = (-i4.metrics.top - h3) * i4.scale + x3[1], S2 = w2 + o4.w / b2 * i4.scale / f3, A2 = _2 + o4.h / b2 * i4.scale / f3, M2 = new n(w2, _2), k2 = new n(S2, _2), I2 = new n(w2, A2), E2 = new n(S2, A2);
              if (y3) {
                const t5 = new n(-m3, m3 - -17), e4 = -Math.PI / 2, r4 = 12 - m3, s4 = new n(22 - r4, -(i4.imageName ? r4 : 0)), o5 = new n(...v2);
                M2._rotateAround(e4, t5)._add(s4)._add(o5), k2._rotateAround(e4, t5)._add(s4)._add(o5), I2._rotateAround(e4, t5)._add(s4)._add(o5), E2._rotateAround(e4, t5)._add(s4)._add(o5);
              }
              if (u3) {
                const t5 = Math.sin(u3), e4 = Math.cos(u3), n2 = [e4, -t5, t5, e4];
                M2._matMult(n2), k2._matMult(n2), I2._matMult(n2), E2._matMult(n2);
              }
              const T2 = new n(0, 0), F2 = new n(0, 0);
              c3.push({ tl: M2, tr: k2, bl: I2, br: E2, tex: o4, writingMode: e3.writingMode, glyphOffset: g3, sectionIndex: i4.sectionIndex, isSDF: p3, pixelOffsetTL: T2, pixelOffsetBR: F2, minFontScaleX: 0, minFontScaleY: 0 });
            }
            return c3;
          })(0, r2, l2, s2, o2, a2, i2, t2.allowVerticalPlacement), g2 = t2.textSizeData;
          let x2 = null;
          "source" === g2.kind ? (x2 = [mp * s2.layout.get("text-size").evaluate(a2, {})], x2[0] > gp && G(`${t2.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)) : "composite" === g2.kind && (x2 = [mp * d2.compositeTextSizes[0].evaluate(a2, {}, y2), mp * d2.compositeTextSizes[1].evaluate(a2, {}, y2)], (x2[0] > gp || x2[1] > gp) && G(`${t2.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)), t2.addSymbols(t2.text, m2, x2, l2, o2, a2, c2, e2, u2.lineStartIndex, u2.lineLength, f2, y2);
          for (const e3 of h2) p2[e3] = t2.text.placedSymbolArray.length - 1;
          return 4 * m2.length;
        }
        function Ry(t2) {
          for (const e2 in t2) return t2[e2];
          return null;
        }
        function Ny(t2, e2, n2, r2) {
          const i2 = t2.compareText;
          if (e2 in i2) {
            const t3 = i2[e2];
            for (let e3 = t3.length - 1; e3 >= 0; e3--) if (r2.dist(t3[e3]) < n2) return true;
          } else i2[e2] = [];
          return i2[e2].push(r2), false;
        }
        t.$ = at, t.A = f, t.B = Ls, t.C = hs, t.D = Xs, t.E = bt, t.F = os, t.G = function([t2, e2, n2]) {
          return e2 += 90, e2 *= Math.PI / 180, n2 *= Math.PI / 180, { x: t2 * Math.cos(e2) * Math.sin(n2), y: t2 * Math.sin(e2) * Math.sin(n2), z: t2 * Math.cos(n2) };
        }, t.H = xn, t.I = np, t.J = Cs, t.K = ls, t.L = function(t2) {
          if (null == Z) {
            const e2 = t2.navigator ? t2.navigator.userAgent : null;
            Z = !!t2.safari || !(!e2 || !(/\b(iPad|iPhone|iPod)\b/.test(e2) || e2.match("Safari") && !e2.match("Chrome")));
          }
          return Z;
        }, t.M = ht, t.N = class {
          constructor(t2, e2) {
            this.target = t2, this.mapId = e2, this.resolveRejects = {}, this.tasks = {}, this.taskQueue = [], this.abortControllers = {}, this.messageHandlers = {}, this.invoker = new Vp((() => this.process())), this.subscription = tt(this.target, "message", ((t3) => this.receive(t3)), false), this.globalScope = Y(self) ? t2 : window;
          }
          registerMessageHandler(t2, e2) {
            this.messageHandlers[t2] = e2;
          }
          unregisterMessageHandler(t2) {
            delete this.messageHandlers[t2];
          }
          sendAsync(t2, e2) {
            return new Promise(((n2, r2) => {
              const i2 = Math.round(1e18 * Math.random()).toString(36).substring(0, 10), s2 = e2 ? tt(e2.signal, "abort", (() => {
                null == s2 || s2.unsubscribe(), delete this.resolveRejects[i2];
                const e3 = { id: i2, type: "<cancel>", origin: location.origin, targetMapId: t2.targetMapId, sourceMapId: this.mapId };
                this.target.postMessage(e3);
              }), Lp) : null;
              this.resolveRejects[i2] = { resolve: (t3) => {
                null == s2 || s2.unsubscribe(), n2(t3);
              }, reject: (t3) => {
                null == s2 || s2.unsubscribe(), r2(t3);
              } };
              const o2 = [], a2 = Object.assign(Object.assign({}, t2), { id: i2, sourceMapId: this.mapId, origin: location.origin, data: xs(t2.data, o2) });
              this.target.postMessage(a2, { transfer: o2 });
            }));
          }
          receive(t2) {
            const e2 = t2.data, n2 = e2.id, r2 = ["file://", "resource://android", "null"], i2 = [e2.origin, location.origin], s2 = e2.origin === location.origin, o2 = i2.some(((t3) => r2.includes(t3)));
            if ((s2 || o2) && (!e2.targetMapId || this.mapId === e2.targetMapId)) {
              if ("<cancel>" === e2.type) {
                delete this.tasks[n2];
                const t3 = this.abortControllers[n2];
                return delete this.abortControllers[n2], void (t3 && t3.abort());
              }
              if (Y(self) || e2.mustQueue) return this.tasks[n2] = e2, this.taskQueue.push(n2), void this.invoker.trigger();
              this.processTask(n2, e2);
            }
          }
          process() {
            if (0 === this.taskQueue.length) return;
            const t2 = this.taskQueue.shift(), e2 = this.tasks[t2];
            delete this.tasks[t2], this.taskQueue.length > 0 && this.invoker.trigger(), e2 && this.processTask(t2, e2);
          }
          processTask(t2, n2) {
            return e(this, void 0, void 0, (function* () {
              if ("<response>" === n2.type) {
                const e3 = this.resolveRejects[t2];
                if (delete this.resolveRejects[t2], !e3) return;
                return void (n2.error ? e3.reject(P(vs(n2.error))) : e3.resolve(vs(n2.data)));
              }
              if (!this.messageHandlers[n2.type]) return void this.completeTask(t2, new Error(`Could not find a registered handler for ${n2.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));
              const e2 = vs(n2.data), r2 = new AbortController();
              this.abortControllers[t2] = r2;
              try {
                const i2 = yield this.messageHandlers[n2.type](n2.sourceMapId, e2, r2);
                this.completeTask(t2, null, i2);
              } catch (e3) {
                this.completeTask(t2, P(e3));
              }
            }));
          }
          completeTask(t2, e2, n2) {
            const r2 = [];
            delete this.abortControllers[t2];
            const i2 = { id: t2, type: "<response>", sourceMapId: this.mapId, origin: location.origin, error: e2 ? xs(e2) : null, data: xs(n2, r2) };
            this.target.postMessage(i2, { transfer: r2 });
          }
          remove() {
            this.invoker.remove(), this.subscription.unsubscribe();
          }
        }, t.O = function() {
          var t2 = new f(16);
          return f != Float32Array && (t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0), t2[0] = 1, t2[5] = 1, t2[10] = 1, t2[15] = 1, t2;
        }, t.P = n, t.Q = function(t2, e2, n2) {
          var r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2 = n2[0], m2 = n2[1], g2 = n2[2];
          return e2 === t2 ? (t2[12] = e2[0] * y2 + e2[4] * m2 + e2[8] * g2 + e2[12], t2[13] = e2[1] * y2 + e2[5] * m2 + e2[9] * g2 + e2[13], t2[14] = e2[2] * y2 + e2[6] * m2 + e2[10] * g2 + e2[14], t2[15] = e2[3] * y2 + e2[7] * m2 + e2[11] * g2 + e2[15]) : (i2 = e2[1], s2 = e2[2], o2 = e2[3], a2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], t2[0] = r2 = e2[0], t2[1] = i2, t2[2] = s2, t2[3] = o2, t2[4] = a2, t2[5] = l2, t2[6] = u2, t2[7] = c2, t2[8] = h2, t2[9] = p2, t2[10] = f2, t2[11] = d2, t2[12] = r2 * y2 + a2 * m2 + h2 * g2 + e2[12], t2[13] = i2 * y2 + l2 * m2 + p2 * g2 + e2[13], t2[14] = s2 * y2 + u2 * m2 + f2 * g2 + e2[14], t2[15] = o2 * y2 + c2 * m2 + d2 * g2 + e2[15]), t2;
        }, t.R = Il, t.S = function(t2, e2, n2) {
          var r2 = n2[0], i2 = n2[1], s2 = n2[2];
          return t2[0] = e2[0] * r2, t2[1] = e2[1] * r2, t2[2] = e2[2] * r2, t2[3] = e2[3] * r2, t2[4] = e2[4] * i2, t2[5] = e2[5] * i2, t2[6] = e2[6] * i2, t2[7] = e2[7] * i2, t2[8] = e2[8] * s2, t2[9] = e2[9] * s2, t2[10] = e2[10] * s2, t2[11] = e2[11] * s2, t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15], t2;
        }, t.T = Ol, t.U = function(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1], s2 = e2[2], o2 = e2[3], a2 = e2[4], l2 = e2[5], u2 = e2[6], c2 = e2[7], h2 = e2[8], p2 = e2[9], f2 = e2[10], d2 = e2[11], y2 = e2[12], m2 = e2[13], g2 = e2[14], x2 = e2[15], v2 = n2[0], b2 = n2[1], w2 = n2[2], _2 = n2[3];
          return t2[0] = v2 * r2 + b2 * a2 + w2 * h2 + _2 * y2, t2[1] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t2[2] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t2[3] = v2 * o2 + b2 * c2 + w2 * d2 + _2 * x2, t2[4] = (v2 = n2[4]) * r2 + (b2 = n2[5]) * a2 + (w2 = n2[6]) * h2 + (_2 = n2[7]) * y2, t2[5] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t2[6] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t2[7] = v2 * o2 + b2 * c2 + w2 * d2 + _2 * x2, t2[8] = (v2 = n2[8]) * r2 + (b2 = n2[9]) * a2 + (w2 = n2[10]) * h2 + (_2 = n2[11]) * y2, t2[9] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t2[10] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t2[11] = v2 * o2 + b2 * c2 + w2 * d2 + _2 * x2, t2[12] = (v2 = n2[12]) * r2 + (b2 = n2[13]) * a2 + (w2 = n2[14]) * h2 + (_2 = n2[15]) * y2, t2[13] = v2 * i2 + b2 * l2 + w2 * p2 + _2 * m2, t2[14] = v2 * s2 + b2 * u2 + w2 * f2 + _2 * g2, t2[15] = v2 * o2 + b2 * c2 + w2 * d2 + _2 * x2, t2;
        }, t.V = function(t2, e2) {
          const n2 = {};
          for (const r2 of e2) r2 in t2 && (n2[r2] = t2[r2]);
          return n2;
        }, t.W = $p, t.X = O, t.Y = jp, t.Z = Up, t._ = e, t.a = ot, t.a$ = function(t2) {
          var e2 = new f(3);
          return e2[0] = t2[0], e2[1] = t2[1], e2[2] = t2[2], e2;
        }, t.a0 = c, t.a1 = h, t.a2 = K, t.a3 = Jp, t.a4 = Gp, t.a5 = Xp, t.a6 = T, t.a7 = Zp, t.a8 = tf, t.a9 = 25, t.aA = function(t2) {
          var e2 = t2[0], n2 = t2[1];
          return Math.sqrt(e2 * e2 + n2 * n2);
        }, t.aB = function(t2) {
          return t2[0] = 0, t2[1] = 0, t2;
        }, t.aC = function(t2, e2, n2) {
          return t2[0] = e2[0] * n2, t2[1] = e2[1] * n2, t2;
        }, t.aD = _p, t.aE = A, t.aF = function(t2, e2, r2, i2) {
          const s2 = e2.y - t2.y, o2 = e2.x - t2.x, a2 = i2.y - r2.y, l2 = i2.x - r2.x, u2 = a2 * o2 - l2 * s2;
          if (0 === u2) return null;
          const c2 = (l2 * (t2.y - r2.y) - a2 * (t2.x - r2.x)) / u2;
          return new n(t2.x + c2 * o2, t2.y + c2 * s2);
        }, t.aG = uy, t.aH = Ha, t.aI = function(t2) {
          let e2 = 1 / 0, n2 = 1 / 0, r2 = -1 / 0, i2 = -1 / 0;
          for (const s2 of t2) e2 = Math.min(e2, s2.x), n2 = Math.min(n2, s2.y), r2 = Math.max(r2, s2.x), i2 = Math.max(i2, s2.y);
          return [e2, n2, r2, i2];
        }, t.aJ = Ih, t.aK = F, t.aL = function(t2, e2, n2, r2, i2 = false) {
          if (!n2[0] && !n2[1]) return [0, 0];
          const s2 = i2 ? "map" === r2 ? -t2.bearingInRadians : 0 : "viewport" === r2 ? t2.bearingInRadians : 0;
          if (s2) {
            const t3 = Math.sin(s2), e3 = Math.cos(s2);
            n2 = [n2[0] * e3 - n2[1] * t3, n2[0] * t3 + n2[1] * e3];
          }
          return [i2 ? n2[0] : F(e2, n2[0], t2.zoom), i2 ? n2[1] : F(e2, n2[1], t2.zoom)];
        }, t.aN = vp, t.aO = Ly, t.aP = op, t.aQ = (t2) => "symbol" === t2.type, t.aR = ec, t.aS = ao, t.aT = xu, t.aU = Xo, t.aV = ua, t.aW = sa, t.aX = nt, t.aY = Yp, t.aZ = b, t.a_ = v, t.aa = Wp, t.ab = (t2) => {
          const e2 = window.document.createElement("video");
          return e2.muted = true, new Promise(((n2) => {
            e2.onloadstart = () => {
              n2(e2);
            };
            for (const n3 of t2) {
              const t3 = window.document.createElement("source");
              yt(n3) || (e2.crossOrigin = "Anonymous"), t3.src = n3, e2.appendChild(t3);
            }
          }));
        }, t.ac = zt, t.ad = function() {
          return R++;
        }, t.ae = Co, t.af = kp, t.ag = Jd, t.ah = yi, t.ai = Ga, t.aj = nf, t.ak = function(t2) {
          const e2 = {};
          if (t2.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, ((t3, n2, r2, i2) => {
            const s2 = r2 || i2;
            return e2[n2] = !s2 || s2.toLowerCase(), "";
          })), e2["max-age"]) {
            const t3 = parseInt(e2["max-age"], 10);
            isNaN(t3) ? delete e2["max-age"] : e2["max-age"] = t3;
          }
          return e2;
        }, t.al = L, t.am = 85.051129, t.an = et, t.ao = function(t2) {
          return Math.pow(2, t2);
        }, t.ap = y, t.aq = qp, t.ar = function(t2) {
          return Math.log(t2) / Math.LN2;
        }, t.as = function(t2) {
          var e2 = t2[0], n2 = t2[1];
          return e2 * e2 + n2 * n2;
        }, t.at = function(t2) {
          if (!t2.length) return /* @__PURE__ */ new Set();
          const e2 = Math.max(...t2.map(((t3) => t3.canonical.z)));
          let n2 = 1 / 0, r2 = -1 / 0, i2 = 1 / 0, s2 = -1 / 0;
          const o2 = [];
          for (const a3 of t2) {
            const { x: t3, y: l2, z: u2 } = a3.canonical, c2 = Math.pow(2, e2 - u2), h2 = t3 * c2, p2 = l2 * c2;
            o2.push({ id: a3, x: h2, y: p2 }), h2 < n2 && (n2 = h2), h2 > r2 && (r2 = h2), p2 < i2 && (i2 = p2), p2 > s2 && (s2 = p2);
          }
          const a2 = /* @__PURE__ */ new Set();
          for (const t3 of o2) t3.x !== n2 && t3.x !== r2 && t3.y !== i2 && t3.y !== s2 || a2.add(t3.id);
          return a2;
        }, t.au = function(t2, e2) {
          const n2 = Math.abs(2 * t2.wrap) - +(t2.wrap < 0), r2 = Math.abs(2 * e2.wrap) - +(e2.wrap < 0);
          return t2.overscaledZ - e2.overscaledZ || r2 - n2 || e2.canonical.y - t2.canonical.y || e2.canonical.x - t2.canonical.x;
        }, t.av = class {
          constructor(t2, e2) {
            this.max = t2, this.onRemove = e2, this.reset();
          }
          reset() {
            for (const t2 in this.data) for (const e2 of this.data[t2]) e2.timeout && clearTimeout(e2.timeout), this.onRemove(e2.value);
            return this.data = {}, this.order = [], this;
          }
          add(t2, e2, n2) {
            const r2 = t2.wrapped().key;
            void 0 === this.data[r2] && (this.data[r2] = []);
            const i2 = { value: e2, timeout: void 0 };
            if (void 0 !== n2 && (i2.timeout = setTimeout((() => {
              this.remove(t2, i2);
            }), n2)), this.data[r2].push(i2), this.order.push(r2), this.order.length > this.max) {
              const t3 = this._getAndRemoveByKey(this.order[0]);
              t3 && this.onRemove(t3);
            }
            return this;
          }
          has(t2) {
            return t2.wrapped().key in this.data;
          }
          getAndRemove(t2) {
            return this.has(t2) ? this._getAndRemoveByKey(t2.wrapped().key) : null;
          }
          _getAndRemoveByKey(t2) {
            const e2 = this.data[t2].shift();
            return e2.timeout && clearTimeout(e2.timeout), 0 === this.data[t2].length && delete this.data[t2], this.order.splice(this.order.indexOf(t2), 1), e2.value;
          }
          getByKey(t2) {
            const e2 = this.data[t2];
            return e2 ? e2[0].value : null;
          }
          get(t2) {
            return this.has(t2) ? this.data[t2.wrapped().key][0].value : null;
          }
          remove(t2, e2) {
            if (!this.has(t2)) return this;
            const n2 = t2.wrapped().key, r2 = void 0 === e2 ? 0 : this.data[n2].indexOf(e2), i2 = this.data[n2][r2];
            return this.data[n2].splice(r2, 1), i2.timeout && clearTimeout(i2.timeout), 0 === this.data[n2].length && delete this.data[n2], this.onRemove(i2.value), this.order.splice(this.order.indexOf(n2), 1), this;
          }
          setMaxSize(t2) {
            for (this.max = t2; this.order.length > this.max; ) {
              const t3 = this._getAndRemoveByKey(this.order[0]);
              t3 && this.onRemove(t3);
            }
            return this;
          }
          filter(t2) {
            const e2 = [];
            for (const n2 in this.data) for (const r2 of this.data[n2]) t2(r2.value) || e2.push(r2);
            for (const t3 of e2) this.remove(t3.value.tileID, t3);
          }
        }, t.aw = function(t2, e2) {
          let n2 = 0, r2 = 0;
          if ("constant" === t2.kind) r2 = t2.layoutSize;
          else if ("source" !== t2.kind) {
            const { interpolationType: i2, minZoom: s2, maxZoom: o2 } = t2, a2 = i2 ? L(mn.interpolationFactor(i2, e2, s2, o2), 0, 1) : 0;
            "camera" === t2.kind ? r2 = xn.number(t2.minSize, t2.maxSize, a2) : n2 = a2;
          }
          return { uSizeT: n2, uSize: r2 };
        }, t.ay = function(t2, { uSize: e2, uSizeT: n2 }, { lowerSize: r2, upperSize: i2 }) {
          return "source" === t2.kind ? r2 / mp : "composite" === t2.kind ? xn.number(r2 / mp, i2 / mp, n2) : e2;
        }, t.az = I, t.b = H, t.b$ = Ea, t.b0 = function(t2, e2, n2) {
          return t2[0] = e2[0] - n2[0], t2[1] = e2[1] - n2[1], t2[2] = e2[2] - n2[2], t2;
        }, t.b1 = function(t2, e2) {
          var n2 = e2[0], r2 = e2[1], i2 = e2[2], s2 = n2 * n2 + r2 * r2 + i2 * i2;
          return s2 > 0 && (s2 = 1 / Math.sqrt(s2)), t2[0] = e2[0] * s2, t2[1] = e2[1] * s2, t2[2] = e2[2] * s2, t2;
        }, t.b2 = w, t.b3 = function(t2, e2) {
          return t2[0] * e2[0] + t2[1] * e2[1] + t2[2] * e2[2];
        }, t.b4 = function(t2, e2, n2) {
          return t2[0] = e2[0] * n2[0], t2[1] = e2[1] * n2[1], t2[2] = e2[2] * n2[2], t2[3] = e2[3] * n2[3], t2;
        }, t.b5 = g, t.b6 = function(t2, e2, n2) {
          const r2 = e2[0] * n2[0] + e2[1] * n2[1] + e2[2] * n2[2];
          return 0 === r2 ? null : (-(t2[0] * n2[0] + t2[1] * n2[1] + t2[2] * n2[2]) - n2[3]) / r2;
        }, t.b7 = S, t.b8 = function(t2, e2, n2) {
          return t2[0] = e2[0] * n2, t2[1] = e2[1] * n2, t2[2] = e2[2] * n2, t2[3] = e2[3] * n2, t2;
        }, t.b9 = function(t2, e2) {
          return t2[0] * e2[0] + t2[1] * e2[1] + t2[2] * e2[2] + t2[3];
        }, t.bA = k, t.bB = function(t2, e2, n2) {
          var r2 = n2[0], i2 = n2[1], s2 = n2[2], o2 = n2[3], a2 = e2[0], l2 = e2[1], u2 = e2[2], c2 = i2 * u2 - s2 * l2, h2 = s2 * a2 - r2 * u2, p2 = r2 * l2 - i2 * a2;
          return t2[0] = a2 + o2 * (c2 += c2) + i2 * (p2 += p2) - s2 * (h2 += h2), t2[1] = l2 + o2 * h2 + s2 * c2 - r2 * p2, t2[2] = u2 + o2 * p2 + r2 * h2 - i2 * c2, t2;
        }, t.bC = function(t2, e2, n2) {
          const r2 = (i2 = [t2[0], t2[1], t2[2], e2[0], e2[1], e2[2], n2[0], n2[1], n2[2]])[0] * ((c2 = i2[8]) * (o2 = i2[4]) - (a2 = i2[5]) * (u2 = i2[7])) + i2[1] * (-c2 * (s2 = i2[3]) + a2 * (l2 = i2[6])) + i2[2] * (u2 * s2 - o2 * l2);
          var i2, s2, o2, a2, l2, u2, c2;
          if (0 === r2) return null;
          const h2 = w([], [e2[0], e2[1], e2[2]], [n2[0], n2[1], n2[2]]), p2 = w([], [n2[0], n2[1], n2[2]], [t2[0], t2[1], t2[2]]), f2 = w([], [t2[0], t2[1], t2[2]], [e2[0], e2[1], e2[2]]), d2 = b([], h2, -t2[3]);
          return v(d2, d2, b([], p2, -e2[3])), v(d2, d2, b([], f2, -n2[3])), b(d2, d2, 1 / r2), d2;
        }, t.bD = Op, t.bE = function() {
          return new Float64Array(4);
        }, t.bF = function(t2, e2, n2, r2) {
          var i2 = [], s2 = [];
          return i2[0] = e2[0] - n2[0], i2[1] = e2[1] - n2[1], i2[2] = e2[2] - n2[2], s2[0] = i2[0] * Math.cos(r2) - i2[1] * Math.sin(r2), s2[1] = i2[0] * Math.sin(r2) + i2[1] * Math.cos(r2), s2[2] = i2[2], t2[0] = s2[0] + n2[0], t2[1] = s2[1] + n2[1], t2[2] = s2[2] + n2[2], t2;
        }, t.bG = function(t2, e2, n2, r2) {
          var i2 = [], s2 = [];
          return i2[0] = e2[0] - n2[0], i2[1] = e2[1] - n2[1], i2[2] = e2[2] - n2[2], s2[0] = i2[0], s2[1] = i2[1] * Math.cos(r2) - i2[2] * Math.sin(r2), s2[2] = i2[1] * Math.sin(r2) + i2[2] * Math.cos(r2), t2[0] = s2[0] + n2[0], t2[1] = s2[1] + n2[1], t2[2] = s2[2] + n2[2], t2;
        }, t.bH = function(t2, e2, n2, r2) {
          var i2 = [], s2 = [];
          return i2[0] = e2[0] - n2[0], i2[1] = e2[1] - n2[1], i2[2] = e2[2] - n2[2], s2[0] = i2[2] * Math.sin(r2) + i2[0] * Math.cos(r2), s2[1] = i2[1], s2[2] = i2[2] * Math.cos(r2) - i2[0] * Math.sin(r2), t2[0] = s2[0] + n2[0], t2[1] = s2[1] + n2[1], t2[2] = s2[2] + n2[2], t2;
        }, t.bI = function(t2, e2, n2) {
          var r2 = Math.sin(n2), i2 = Math.cos(n2), s2 = e2[0], o2 = e2[1], a2 = e2[2], l2 = e2[3], u2 = e2[8], c2 = e2[9], h2 = e2[10], p2 = e2[11];
          return e2 !== t2 && (t2[4] = e2[4], t2[5] = e2[5], t2[6] = e2[6], t2[7] = e2[7], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15]), t2[0] = s2 * i2 - u2 * r2, t2[1] = o2 * i2 - c2 * r2, t2[2] = a2 * i2 - h2 * r2, t2[3] = l2 * i2 - p2 * r2, t2[8] = s2 * r2 + u2 * i2, t2[9] = o2 * r2 + c2 * i2, t2[10] = a2 * r2 + h2 * i2, t2[11] = l2 * r2 + p2 * i2, t2;
        }, t.bJ = function(t2, e2) {
          const n2 = D(t2, 360), r2 = D(e2, 360), i2 = r2 - n2, s2 = r2 > n2 ? i2 - 360 : i2 + 360;
          return Math.abs(i2) < Math.abs(s2) ? i2 : s2;
        }, t.bK = function(t2) {
          return t2[0] = 0, t2[1] = 0, t2[2] = 0, t2;
        }, t.bL = function(t2, e2, n2, r2) {
          const i2 = Math.sqrt(t2 * t2 + e2 * e2), s2 = Math.sqrt(n2 * n2 + r2 * r2);
          t2 /= i2, e2 /= i2, n2 /= s2, r2 /= s2;
          const o2 = Math.acos(t2 * n2 + e2 * r2);
          return -e2 * n2 + t2 * r2 > 0 ? o2 : -o2;
        }, t.bM = function(t2, e2) {
          const n2 = D(t2, 2 * Math.PI), r2 = D(e2, 2 * Math.PI);
          return Math.min(Math.abs(n2 - r2), Math.abs(n2 - r2 + 2 * Math.PI), Math.abs(n2 - r2 - 2 * Math.PI));
        }, t.bN = function() {
          const t2 = {}, e2 = wt.$version;
          for (const n2 in wt.$root) {
            const r2 = wt.$root[n2];
            if (r2.required) {
              let i2 = null;
              i2 = "version" === n2 ? e2 : "array" === r2.type ? [] : {}, null != i2 && (t2[n2] = i2);
            }
          }
          return t2;
        }, t.bO = ft, t.bP = bs, t.bQ = function t2(e2, n2) {
          if (Array.isArray(e2)) {
            if (!Array.isArray(n2) || e2.length !== n2.length) return false;
            for (let r2 = 0; r2 < e2.length; r2++) if (!t2(e2[r2], n2[r2])) return false;
            return true;
          }
          if ("object" == typeof e2 && null !== e2 && null !== n2) {
            if ("object" != typeof n2) return false;
            if (Object.keys(e2).length !== Object.keys(n2).length) return false;
            for (const r2 in e2) if (!t2(e2[r2], n2[r2])) return false;
            return true;
          }
          return e2 === n2;
        }, t.bR = lt, t.bS = function(t2) {
          t2 = t2.slice();
          const e2 = /* @__PURE__ */ Object.create(null);
          for (let n2 = 0; n2 < t2.length; n2++) e2[t2[n2].id] = t2[n2];
          for (let n2 = 0; n2 < t2.length; n2++) "ref" in t2[n2] && (t2[n2] = St(t2[n2], e2[t2[n2].ref]));
          return t2;
        }, t.bT = function(t2, e2) {
          if ("custom" === t2.type) return new Cp(t2, e2);
          switch (t2.type) {
            case "background":
              return new Bp(t2, e2);
            case "circle":
              return new vl(t2, e2);
            case "color-relief":
              return new Nl(t2, e2);
            case "fill":
              return new Pu(t2, e2);
            case "fill-extrusion":
              return new Ku(t2, e2);
            case "heatmap":
              return new Pl(t2, e2);
            case "hillshade":
              return new Bl(t2, e2);
            case "line":
              return new xh(t2, e2);
            case "raster":
              return new ro(t2, e2);
            case "symbol":
              return new Pp(t2, e2);
          }
        }, t.bU = (t2) => "raster" === t2.type, t.bV = j, t.bW = function(t2, e2) {
          if (!t2) return [{ command: "setStyle", args: [e2] }];
          let n2 = [];
          try {
            if (!At(t2.version, e2.version)) return [{ command: "setStyle", args: [e2] }];
            At(t2.center, e2.center) || n2.push({ command: "setCenter", args: [e2.center] }), At(t2.state, e2.state) || n2.push({ command: "setGlobalState", args: [e2.state] }), At(t2.centerAltitude, e2.centerAltitude) || n2.push({ command: "setCenterAltitude", args: [e2.centerAltitude] }), At(t2.zoom, e2.zoom) || n2.push({ command: "setZoom", args: [e2.zoom] }), At(t2.bearing, e2.bearing) || n2.push({ command: "setBearing", args: [e2.bearing] }), At(t2.pitch, e2.pitch) || n2.push({ command: "setPitch", args: [e2.pitch] }), At(t2.roll, e2.roll) || n2.push({ command: "setRoll", args: [e2.roll] }), At(t2.sprite, e2.sprite) || n2.push({ command: "setSprite", args: [e2.sprite] }), At(t2.glyphs, e2.glyphs) || n2.push({ command: "setGlyphs", args: [e2.glyphs] }), At(t2.transition, e2.transition) || n2.push({ command: "setTransition", args: [e2.transition] }), At(t2.light, e2.light) || n2.push({ command: "setLight", args: [e2.light] }), At(t2.terrain, e2.terrain) || n2.push({ command: "setTerrain", args: [e2.terrain] }), At(t2.sky, e2.sky) || n2.push({ command: "setSky", args: [e2.sky] }), At(t2.projection, e2.projection) || n2.push({ command: "setProjection", args: [e2.projection] });
            const r2 = {}, i2 = [];
            !(function(t3, e3, n3, r3) {
              let i3;
              for (i3 in e3 = e3 || {}, t3 = t3 || {}) Object.prototype.hasOwnProperty.call(t3, i3) && (Object.prototype.hasOwnProperty.call(e3, i3) || It(i3, n3, r3));
              for (i3 in e3) Object.prototype.hasOwnProperty.call(e3, i3) && (Object.prototype.hasOwnProperty.call(t3, i3) ? At(t3[i3], e3[i3]) || ("geojson" === t3[i3].type && "geojson" === e3[i3].type && Tt(t3, e3, i3) ? Mt(n3, { command: "setGeoJSONSourceData", args: [i3, e3[i3].data] }) : Et(i3, e3, n3, r3)) : kt(i3, e3, n3));
            })(t2.sources, e2.sources, i2, r2);
            const s2 = [];
            t2.layers && t2.layers.forEach(((t3) => {
              "source" in t3 && r2[t3.source] ? n2.push({ command: "removeLayer", args: [t3.id] }) : s2.push(t3);
            })), n2 = n2.concat(i2), (function(t3, e3, n3) {
              e3 = e3 || [];
              const r3 = (t3 = t3 || []).map(Pt), i3 = e3.map(Pt), s3 = t3.reduce(Dt, {}), o2 = e3.reduce(Dt, {}), a2 = r3.slice(), l2 = /* @__PURE__ */ Object.create(null);
              let u2, c2, h2, p2, f2;
              for (let t4 = 0, e4 = 0; t4 < r3.length; t4++) u2 = r3[t4], Object.prototype.hasOwnProperty.call(o2, u2) ? e4++ : (Mt(n3, { command: "removeLayer", args: [u2] }), a2.splice(a2.indexOf(u2, e4), 1));
              for (let t4 = 0, e4 = 0; t4 < i3.length; t4++) u2 = i3[i3.length - 1 - t4], a2[a2.length - 1 - t4] !== u2 && (Object.prototype.hasOwnProperty.call(s3, u2) ? (Mt(n3, { command: "removeLayer", args: [u2] }), a2.splice(a2.lastIndexOf(u2, a2.length - e4), 1)) : e4++, p2 = a2[a2.length - t4], Mt(n3, { command: "addLayer", args: [o2[u2], p2] }), a2.splice(a2.length - t4, 0, u2), l2[u2] = true);
              for (let t4 = 0; t4 < i3.length; t4++) if (u2 = i3[t4], c2 = s3[u2], h2 = o2[u2], !l2[u2] && !At(c2, h2)) if (At(c2.source, h2.source) && At(c2["source-layer"], h2["source-layer"]) && At(c2.type, h2.type)) {
                for (f2 in Ft(c2.layout, h2.layout, n3, u2, null, "setLayoutProperty"), Ft(c2.paint, h2.paint, n3, u2, null, "setPaintProperty"), At(c2.filter, h2.filter) || Mt(n3, { command: "setFilter", args: [u2, h2.filter] }), At(c2.minzoom, h2.minzoom) && At(c2.maxzoom, h2.maxzoom) || Mt(n3, { command: "setLayerZoomRange", args: [u2, h2.minzoom, h2.maxzoom] }), c2) Object.prototype.hasOwnProperty.call(c2, f2) && "layout" !== f2 && "paint" !== f2 && "filter" !== f2 && "metadata" !== f2 && "minzoom" !== f2 && "maxzoom" !== f2 && (0 === f2.indexOf("paint.") ? Ft(c2[f2], h2[f2], n3, u2, f2.slice(6), "setPaintProperty") : At(c2[f2], h2[f2]) || Mt(n3, { command: "setLayerProperty", args: [u2, f2, h2[f2]] }));
                for (f2 in h2) Object.prototype.hasOwnProperty.call(h2, f2) && !Object.prototype.hasOwnProperty.call(c2, f2) && "layout" !== f2 && "paint" !== f2 && "filter" !== f2 && "metadata" !== f2 && "minzoom" !== f2 && "maxzoom" !== f2 && (0 === f2.indexOf("paint.") ? Ft(c2[f2], h2[f2], n3, u2, f2.slice(6), "setPaintProperty") : At(c2[f2], h2[f2]) || Mt(n3, { command: "setLayerProperty", args: [u2, f2, h2[f2]] }));
              } else Mt(n3, { command: "removeLayer", args: [u2] }), p2 = a2[a2.lastIndexOf(u2) + 1], Mt(n3, { command: "addLayer", args: [h2, p2] });
            })(s2, e2.layers, n2);
          } catch (t3) {
            console.warn("Unable to compute style diff:", t3), n2 = [{ command: "setStyle", args: [e2] }];
          }
          return n2;
        }, t.bX = function(t2) {
          const e2 = [], n2 = t2.id;
          return void 0 === n2 && e2.push({ message: `layers.${n2}: missing required property "id"` }), void 0 === t2.render && e2.push({ message: `layers.${n2}: missing required method "render"` }), t2.renderingMode && "2d" !== t2.renderingMode && "3d" !== t2.renderingMode && e2.push({ message: `layers.${n2}: property "renderingMode" must be either "2d" or "3d"` }), e2;
        }, t.bY = N, t.bZ = U, t.b_ = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = 0;
          }
          set(t2) {
            this.current !== t2 && (this.current = t2, this.gl.uniform1i(this.location, t2));
          }
        }, t.ba = Kp, t.bb = Qp, t.bc = function(t2, e2, n2, r2, i2) {
          var s2 = 1 / Math.tan(e2 / 2);
          if (t2[0] = s2 / n2, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = s2, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[11] = -1, t2[12] = 0, t2[13] = 0, t2[15] = 0, null != i2 && i2 !== 1 / 0) {
            var o2 = 1 / (r2 - i2);
            t2[10] = (i2 + r2) * o2, t2[14] = 2 * i2 * r2 * o2;
          } else t2[10] = -1, t2[14] = -2 * r2;
          return t2;
        }, t.bd = function(t2) {
          var e2 = new f(16);
          return e2[0] = t2[0], e2[1] = t2[1], e2[2] = t2[2], e2[3] = t2[3], e2[4] = t2[4], e2[5] = t2[5], e2[6] = t2[6], e2[7] = t2[7], e2[8] = t2[8], e2[9] = t2[9], e2[10] = t2[10], e2[11] = t2[11], e2[12] = t2[12], e2[13] = t2[13], e2[14] = t2[14], e2[15] = t2[15], e2;
        }, t.be = function(t2, e2, n2) {
          var r2 = Math.sin(n2), i2 = Math.cos(n2), s2 = e2[0], o2 = e2[1], a2 = e2[2], l2 = e2[3], u2 = e2[4], c2 = e2[5], h2 = e2[6], p2 = e2[7];
          return e2 !== t2 && (t2[8] = e2[8], t2[9] = e2[9], t2[10] = e2[10], t2[11] = e2[11], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15]), t2[0] = s2 * i2 + u2 * r2, t2[1] = o2 * i2 + c2 * r2, t2[2] = a2 * i2 + h2 * r2, t2[3] = l2 * i2 + p2 * r2, t2[4] = u2 * i2 - s2 * r2, t2[5] = c2 * i2 - o2 * r2, t2[6] = h2 * i2 - a2 * r2, t2[7] = p2 * i2 - l2 * r2, t2;
        }, t.bf = function(t2, e2, n2) {
          var r2 = Math.sin(n2), i2 = Math.cos(n2), s2 = e2[4], o2 = e2[5], a2 = e2[6], l2 = e2[7], u2 = e2[8], c2 = e2[9], h2 = e2[10], p2 = e2[11];
          return e2 !== t2 && (t2[0] = e2[0], t2[1] = e2[1], t2[2] = e2[2], t2[3] = e2[3], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15]), t2[4] = s2 * i2 + u2 * r2, t2[5] = o2 * i2 + c2 * r2, t2[6] = a2 * i2 + h2 * r2, t2[7] = l2 * i2 + p2 * r2, t2[8] = u2 * i2 - s2 * r2, t2[9] = c2 * i2 - o2 * r2, t2[10] = h2 * i2 - a2 * r2, t2[11] = p2 * i2 - l2 * r2, t2;
        }, t.bg = function(t2, e2) {
          var n2 = e2[0], r2 = e2[1], i2 = e2[2], s2 = e2[3], o2 = e2[4], a2 = e2[5], l2 = e2[6], u2 = e2[7], c2 = e2[8], h2 = e2[9], p2 = e2[10], f2 = e2[11], d2 = e2[12], y2 = e2[13], m2 = e2[14], g2 = e2[15], x2 = n2 * a2 - r2 * o2, v2 = n2 * l2 - i2 * o2, b2 = n2 * u2 - s2 * o2, w2 = r2 * l2 - i2 * a2, _2 = r2 * u2 - s2 * a2, S2 = i2 * u2 - s2 * l2, A2 = c2 * y2 - h2 * d2, M2 = c2 * m2 - p2 * d2, k2 = c2 * g2 - f2 * d2, I2 = h2 * m2 - p2 * y2, E2 = h2 * g2 - f2 * y2, T2 = p2 * g2 - f2 * m2, F2 = x2 * T2 - v2 * E2 + b2 * I2 + w2 * k2 - _2 * M2 + S2 * A2;
          return F2 ? (t2[0] = (a2 * T2 - l2 * E2 + u2 * I2) * (F2 = 1 / F2), t2[1] = (i2 * E2 - r2 * T2 - s2 * I2) * F2, t2[2] = (y2 * S2 - m2 * _2 + g2 * w2) * F2, t2[3] = (p2 * _2 - h2 * S2 - f2 * w2) * F2, t2[4] = (l2 * k2 - o2 * T2 - u2 * M2) * F2, t2[5] = (n2 * T2 - i2 * k2 + s2 * M2) * F2, t2[6] = (m2 * b2 - d2 * S2 - g2 * v2) * F2, t2[7] = (c2 * S2 - p2 * b2 + f2 * v2) * F2, t2[8] = (o2 * E2 - a2 * k2 + u2 * A2) * F2, t2[9] = (r2 * k2 - n2 * E2 - s2 * A2) * F2, t2[10] = (d2 * _2 - y2 * b2 + g2 * x2) * F2, t2[11] = (h2 * b2 - c2 * _2 - f2 * x2) * F2, t2[12] = (a2 * M2 - o2 * I2 - l2 * A2) * F2, t2[13] = (n2 * I2 - r2 * M2 + i2 * A2) * F2, t2[14] = (y2 * v2 - d2 * w2 - m2 * x2) * F2, t2[15] = (c2 * w2 - h2 * v2 + p2 * x2) * F2, t2) : null;
        }, t.bh = function() {
          const t2 = new Float32Array(16);
          return y(t2), t2;
        }, t.bi = function() {
          const t2 = new Float64Array(16);
          return y(t2), t2;
        }, t.bj = function() {
          return new Float64Array(16);
        }, t.bk = function(t2, e2, n2) {
          const r2 = new Float64Array(4);
          return k(r2, t2, e2 - 90, n2), r2;
        }, t.bl = function(t2, e2, n2, r2) {
          var i2, s2, o2, a2, l2, u2 = e2[0], c2 = e2[1], h2 = e2[2], f2 = e2[3], d2 = n2[0], y2 = n2[1], m2 = n2[2], g2 = n2[3];
          return (s2 = u2 * d2 + c2 * y2 + h2 * m2 + f2 * g2) < 0 && (s2 = -s2, d2 = -d2, y2 = -y2, m2 = -m2, g2 = -g2), 1 - s2 > p ? (i2 = Math.acos(s2), o2 = Math.sin(i2), a2 = Math.sin((1 - r2) * i2) / o2, l2 = Math.sin(r2 * i2) / o2) : (a2 = 1 - r2, l2 = r2), t2[0] = a2 * u2 + l2 * d2, t2[1] = a2 * c2 + l2 * y2, t2[2] = a2 * h2 + l2 * m2, t2[3] = a2 * f2 + l2 * g2, t2;
        }, t.bm = function(t2) {
          const e2 = new Float64Array(9);
          var n2, r2, i2, s2, o2, a2, l2, u2, c2, h2, p2, f2, d2, y2, m2, g2, x2, v2;
          h2 = (i2 = (r2 = t2)[0]) * (l2 = i2 + i2), p2 = (s2 = r2[1]) * l2, d2 = (o2 = r2[2]) * l2, y2 = o2 * (u2 = s2 + s2), g2 = (a2 = r2[3]) * l2, x2 = a2 * u2, v2 = a2 * (c2 = o2 + o2), (n2 = e2)[0] = 1 - (f2 = s2 * u2) - (m2 = o2 * c2), n2[3] = p2 - v2, n2[6] = d2 + x2, n2[1] = p2 + v2, n2[4] = 1 - h2 - m2, n2[7] = y2 - g2, n2[2] = d2 - x2, n2[5] = y2 + g2, n2[8] = 1 - h2 - f2;
          const b2 = nt(-Math.asin(L(e2[2], -1, 1)));
          let w2, _2;
          return Math.hypot(e2[5], e2[8]) < 1e-3 ? (w2 = 0, _2 = -nt(Math.atan2(e2[3], e2[4]))) : (w2 = nt(0 === e2[5] && 0 === e2[8] ? 0 : Math.atan2(e2[5], e2[8])), _2 = nt(0 === e2[1] && 0 === e2[0] ? 0 : Math.atan2(e2[1], e2[0]))), { roll: w2, pitch: b2 + 90, bearing: _2 };
        }, t.bn = function(t2, e2) {
          return t2.roll == e2.roll && t2.pitch == e2.pitch && t2.bearing == e2.bearing;
        }, t.bo = Te, t.bp = ka, t.bq = vu, t.br = bu, t.bs = gu, t.bt = z, t.bu = B, t.bv = Ne, t.bw = function(t2, e2, n2, r2, i2) {
          return z(r2, i2, L((t2 - e2) / (n2 - e2), 0, 1));
        }, t.bx = function(t2, e2, n2, r2) {
          return t2[0] = e2[0] + n2[0] * r2, t2[1] = e2[1] + n2[1] * r2, t2[2] = e2[2] + n2[2] * r2, t2;
        }, t.by = D, t.bz = function() {
          return new Float64Array(3);
        }, t.c = ut, t.c$ = si, t.c0 = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = Ta;
          }
          set(t2) {
            if (t2[12] !== this.current[12] || t2[0] !== this.current[0]) return this.current = t2, void this.gl.uniformMatrix4fv(this.location, false, t2);
            for (let e2 = 1; e2 < 16; e2++) if (t2[e2] !== this.current[e2]) {
              this.current = t2, this.gl.uniformMatrix4fv(this.location, false, t2);
              break;
            }
          }
        }, t.c1 = Ia, t.c2 = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = [0, 0, 0];
          }
          set(t2) {
            t2[0] === this.current[0] && t2[1] === this.current[1] && t2[2] === this.current[2] || (this.current = t2, this.gl.uniform3f(this.location, t2[0], t2[1], t2[2]));
          }
        }, t.c3 = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = [0, 0];
          }
          set(t2) {
            t2[0] === this.current[0] && t2[1] === this.current[1] || (this.current = t2, this.gl.uniform2f(this.location, t2[0], t2[1]));
          }
        }, t.c4 = d, t.c5 = function(t2, e2) {
          var n2 = Math.sin(e2), r2 = Math.cos(e2);
          return t2[0] = r2, t2[1] = n2, t2[2] = 0, t2[3] = -n2, t2[4] = r2, t2[5] = 0, t2[6] = 0, t2[7] = 0, t2[8] = 1, t2;
        }, t.c6 = function(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1], s2 = e2[2];
          return t2[0] = r2 * n2[0] + i2 * n2[3] + s2 * n2[6], t2[1] = r2 * n2[1] + i2 * n2[4] + s2 * n2[7], t2[2] = r2 * n2[2] + i2 * n2[5] + s2 * n2[8], t2;
        }, t.c7 = function(t2, e2, n2, r2, i2, s2, o2) {
          var a2 = 1 / (e2 - n2), l2 = 1 / (r2 - i2), u2 = 1 / (s2 - o2);
          return t2[0] = -2 * a2, t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = -2 * l2, t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = 2 * u2, t2[11] = 0, t2[12] = (e2 + n2) * a2, t2[13] = (i2 + r2) * l2, t2[14] = (o2 + s2) * u2, t2[15] = 1, t2;
        }, t.c8 = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = new Array();
          }
          set(t2) {
            if (t2 != this.current) {
              this.current = t2;
              const e2 = new Float32Array(4 * t2.length);
              for (let n2 = 0; n2 < t2.length; n2++) e2[4 * n2] = t2[n2].r, e2[4 * n2 + 1] = t2[n2].g, e2[4 * n2 + 2] = t2[n2].b, e2[4 * n2 + 3] = t2[n2].a;
              this.gl.uniform4fv(this.location, e2);
            }
          }
        }, t.c9 = class extends Ma {
          constructor(t2, e2) {
            super(t2, e2), this.current = new Array();
          }
          set(t2) {
            if (t2 != this.current) {
              this.current = t2;
              const e2 = new Float32Array(t2);
              this.gl.uniform1fv(this.location, e2);
            }
          }
        }, t.cA = function(t2, e2) {
          return rt[e2] && "touches" in t2;
        }, t.cB = function(t2) {
          return rt[t2] || it[t2];
        }, t.cC = function(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1];
          return t2[0] = n2[0] * r2 + n2[4] * i2 + n2[12], t2[1] = n2[1] * r2 + n2[5] * i2 + n2[13], t2;
        }, t.cD = function(t2, e2) {
          const { x: n2, y: r2 } = Zp.fromLngLat(e2);
          return !(t2 < 0 || t2 > 25 || r2 < 0 || r2 >= 1 || n2 < 0 || n2 >= 1);
        }, t.cE = function(t2, e2) {
          return t2[0] = e2[0], t2[1] = 0, t2[2] = 0, t2[3] = 0, t2[4] = 0, t2[5] = e2[1], t2[6] = 0, t2[7] = 0, t2[8] = 0, t2[9] = 0, t2[10] = e2[2], t2[11] = 0, t2[12] = 0, t2[13] = 0, t2[14] = 0, t2[15] = 1, t2;
        }, t.cF = class extends co {
        }, t.cG = pt, t.cH = function(t2, e2) {
          ut.REGISTERED_PROTOCOLS[t2] = e2;
        }, t.cI = function(t2) {
          delete ut.REGISTERED_PROTOCOLS[t2];
        }, t.cJ = function(t2, e2) {
          const n2 = {};
          for (let r3 = 0; r3 < t2.length; r3++) {
            const i2 = e2 && e2[t2[r3].id] || Ai(t2[r3]);
            e2 && (e2[t2[r3].id] = i2);
            let s2 = n2[i2];
            s2 || (s2 = n2[i2] = []), s2.push(t2[r3]);
          }
          const r2 = [];
          for (const t3 in n2) r2.push(n2[t3]);
          return r2;
        }, t.cK = ds, t.cL = ef, t.cM = oy, t.cN = rp, t.cO = function(e2) {
          var n2, r2;
          e2.bucket.createArrays(), e2.bucket.tilePixelRatio = T / (512 * e2.bucket.overscaling), e2.bucket.compareText = {}, e2.bucket.iconsNeedLinear = false;
          const i2 = e2.bucket.layers[0], s2 = i2.layout, o2 = i2._unevaluatedLayout._values, a2 = { layoutIconSize: o2["icon-size"].possiblyEvaluate(new Cs(e2.bucket.zoom + 1), e2.canonical), layoutTextSize: o2["text-size"].possiblyEvaluate(new Cs(e2.bucket.zoom + 1), e2.canonical), textMaxSize: o2["text-size"].possiblyEvaluate(new Cs(18)) };
          if ("composite" === e2.bucket.textSizeData.kind) {
            const { minZoom: t2, maxZoom: n3 } = e2.bucket.textSizeData;
            a2.compositeTextSizes = [o2["text-size"].possiblyEvaluate(new Cs(t2), e2.canonical), o2["text-size"].possiblyEvaluate(new Cs(n3), e2.canonical)];
          }
          if ("composite" === e2.bucket.iconSizeData.kind) {
            const { minZoom: t2, maxZoom: n3 } = e2.bucket.iconSizeData;
            a2.compositeIconSizes = [o2["icon-size"].possiblyEvaluate(new Cs(t2), e2.canonical), o2["icon-size"].possiblyEvaluate(new Cs(n3), e2.canonical)];
          }
          const l2 = s2.get("text-line-height") * Ih, u2 = "viewport" !== s2.get("text-rotation-alignment") && "point" !== s2.get("symbol-placement"), c2 = s2.get("text-keep-upright"), h2 = s2.get("text-size");
          for (const o3 of e2.bucket.features) {
            const p2 = s2.get("text-font").evaluate(o3, {}, e2.canonical).join(","), f2 = h2.evaluate(o3, {}, e2.canonical), d2 = a2.layoutTextSize.evaluate(o3, {}, e2.canonical), y2 = a2.layoutIconSize.evaluate(o3, {}, e2.canonical), m2 = { horizontal: {}, vertical: void 0 }, g2 = o3.text;
            let x2, v2 = [0, 0];
            if (g2) {
              const n3 = g2.toString(), r3 = s2.get("text-letter-spacing").evaluate(o3, {}, e2.canonical) * Ih, a3 = Ms(n3) ? r3 : 0, h3 = s2.get("text-anchor").evaluate(o3, {}, e2.canonical), y3 = Vy(i2, o3, e2.canonical);
              if (!y3) {
                const t2 = s2.get("text-radial-offset").evaluate(o3, {}, e2.canonical);
                v2 = t2 ? Cy(h3, [t2 * Ih, By]) : s2.get("text-offset").evaluate(o3, {}, e2.canonical).map(((t3) => t3 * Ih));
              }
              let x3 = u2 ? "center" : s2.get("text-justify").evaluate(o3, {}, e2.canonical);
              const b3 = "point" === s2.get("symbol-placement") ? s2.get("text-max-width").evaluate(o3, {}, e2.canonical) * Ih : 1 / 0, w3 = () => {
                e2.bucket.allowVerticalPlacement && As(n3) && (m2.vertical = sp(g2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, p2, b3, l2, h3, "left", a3, v2, t.ax.vertical, true, d2, f2));
              };
              if (!u2 && y3) {
                const n4 = /* @__PURE__ */ new Set();
                if ("auto" === x3) for (let t2 = 0; t2 < y3.values.length; t2 += 2) n4.add(Ly(y3.values[t2]));
                else n4.add(x3);
                let r4 = false;
                for (const i3 of n4) if (!m2.horizontal[i3]) if (r4) m2.horizontal[i3] = m2.horizontal[0];
                else {
                  const n5 = sp(g2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, p2, b3, l2, "center", i3, a3, v2, t.ax.horizontal, false, d2, f2);
                  n5 && (m2.horizontal[i3] = n5, r4 = 1 === n5.positionedLines.length);
                }
                w3();
              } else {
                "auto" === x3 && (x3 = Ly(h3));
                const r4 = sp(g2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, p2, b3, l2, h3, x3, a3, v2, t.ax.horizontal, false, d2, f2);
                r4 && (m2.horizontal[x3] = r4), w3(), As(n3) && u2 && c2 && (m2.vertical = sp(g2, e2.glyphMap, e2.glyphPositions, e2.imagePositions, p2, b3, l2, h3, x3, a3, v2, t.ax.vertical, false, d2, f2));
              }
            }
            let b2 = false;
            if (null === (n2 = o3.icon) || void 0 === n2 ? void 0 : n2.name) {
              const t2 = e2.imageMap[o3.icon.name];
              t2 && (x2 = fp(e2.imagePositions[o3.icon.name], s2.get("icon-offset").evaluate(o3, {}, e2.canonical), s2.get("icon-anchor").evaluate(o3, {}, e2.canonical)), b2 = !!t2.sdf, void 0 === e2.bucket.sdfIcons ? e2.bucket.sdfIcons = b2 : e2.bucket.sdfIcons !== b2 && G("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (t2.pixelRatio !== e2.bucket.pixelRatio || 0 !== s2.get("icon-rotate").constantOr(1)) && (e2.bucket.iconsNeedLinear = true));
            }
            const w2 = Ry(m2.horizontal) || m2.vertical;
            (r2 = e2.bucket).iconsInText || (r2.iconsInText = !!w2 && w2.iconsInText), (w2 || x2) && Oy(e2.bucket, o3, m2, x2, e2.imageMap, a2, d2, y2, v2, b2, e2.canonical, e2.subdivisionGranularity);
          }
          e2.showCollisionBoxes && e2.bucket.generateCollisionDebugBuffers();
        }, t.cP = Iu, t.cQ = Gu, t.cR = ph, t.cS = function(t2, e2 = "") {
          const n2 = new Rh();
          return (function(t3, e3, n3 = "") {
            for (const r2 in t3.layers) e3.writeMessage(3, ((t4, e4) => Qd(t4, e4, n3)), t3.layers[r2]);
          })(t2, n2, e2), n2.finish();
        }, t.cT = function(t2, e2, n2, r2, i2, s2) {
          let o2 = cy(t2, e2, n2, i2, 0);
          return o2 = cy(o2, e2, r2, s2, 1), o2;
        }, t.cU = class {
          constructor(t2) {
            this.maxEntries = t2, this.map = /* @__PURE__ */ new Map();
          }
          get(t2) {
            const e2 = this.map.get(t2);
            return void 0 !== e2 && (this.map.delete(t2), this.map.set(t2, e2)), e2;
          }
          set(t2, e2) {
            if (this.map.has(t2)) this.map.delete(t2);
            else if (this.map.size >= this.maxEntries) {
              const t3 = this.map.keys().next().value;
              this.map.delete(t3);
            }
            this.map.set(t2, e2);
          }
          clear() {
            this.map.clear();
          }
        }, t.cV = Nu, t.cW = Rh, t.cX = Wd, t.cY = function(t2, n2, r2, i2, s2) {
          return e(this, void 0, void 0, (function* () {
            if (h()) try {
              return yield K(t2, n2, r2, i2, s2);
            } catch (t3) {
            }
            return (function(t3, e2, n3, r3, i3) {
              const s3 = t3.width, o2 = t3.height;
              J && Q || (J = new OffscreenCanvas(s3, o2), Q = J.getContext("2d", { willReadFrequently: true })), J.width = s3, J.height = o2, Q.drawImage(t3, 0, 0, s3, o2);
              const a2 = Q.getImageData(e2, n3, r3, i3);
              return Q.clearRect(0, 0, s3, o2), a2.data;
            })(t2, n2, r2, i2, s2);
          }));
        }, t.cZ = $l, t.c_ = class {
          constructor(t2, e2) {
            this.layers = { [Jd]: this }, this.name = Jd, this.version = e2 ? e2.version : 1, this.extent = e2 ? e2.extent : 4096, this.length = t2.length, this.features = t2;
          }
          feature(t2) {
            return new Kd(this.features[t2], this.extent);
          }
        }, t.ca = class extends So {
        }, t.cb = Ah, t.cc = class extends Mo {
        }, t.cd = Fl, t.ce = function(t2) {
          return t2 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(t2) / Math.LN2));
        }, t.cf = Tl, t.cg = function(t2, e2, n2) {
          var r2 = e2[0], i2 = e2[1], s2 = e2[2], o2 = n2[3] * r2 + n2[7] * i2 + n2[11] * s2 + n2[15];
          return t2[0] = (n2[0] * r2 + n2[4] * i2 + n2[8] * s2 + n2[12]) / (o2 = o2 || 1), t2[1] = (n2[1] * r2 + n2[5] * i2 + n2[9] * s2 + n2[13]) / o2, t2[2] = (n2[2] * r2 + n2[6] * i2 + n2[10] * s2 + n2[14]) / o2, t2;
        }, t.ch = class extends ho {
        }, t.ci = class extends Do {
        }, t.cj = function(t2, e2) {
          return t2[0] === e2[0] && t2[1] === e2[1] && t2[2] === e2[2] && t2[3] === e2[3] && t2[4] === e2[4] && t2[5] === e2[5] && t2[6] === e2[6] && t2[7] === e2[7] && t2[8] === e2[8] && t2[9] === e2[9] && t2[10] === e2[10] && t2[11] === e2[11] && t2[12] === e2[12] && t2[13] === e2[13] && t2[14] === e2[14] && t2[15] === e2[15];
        }, t.ck = function(t2, e2) {
          var n2 = t2[0], r2 = t2[1], i2 = t2[2], s2 = t2[3], o2 = t2[4], a2 = t2[5], l2 = t2[6], u2 = t2[7], c2 = t2[8], h2 = t2[9], f2 = t2[10], d2 = t2[11], y2 = t2[12], m2 = t2[13], g2 = t2[14], x2 = t2[15], v2 = e2[0], b2 = e2[1], w2 = e2[2], _2 = e2[3], S2 = e2[4], A2 = e2[5], M2 = e2[6], k2 = e2[7], I2 = e2[8], E2 = e2[9], T2 = e2[10], F2 = e2[11], P2 = e2[12], D2 = e2[13], z2 = e2[14], B2 = e2[15];
          return Math.abs(n2 - v2) <= p * Math.max(1, Math.abs(n2), Math.abs(v2)) && Math.abs(r2 - b2) <= p * Math.max(1, Math.abs(r2), Math.abs(b2)) && Math.abs(i2 - w2) <= p * Math.max(1, Math.abs(i2), Math.abs(w2)) && Math.abs(s2 - _2) <= p * Math.max(1, Math.abs(s2), Math.abs(_2)) && Math.abs(o2 - S2) <= p * Math.max(1, Math.abs(o2), Math.abs(S2)) && Math.abs(a2 - A2) <= p * Math.max(1, Math.abs(a2), Math.abs(A2)) && Math.abs(l2 - M2) <= p * Math.max(1, Math.abs(l2), Math.abs(M2)) && Math.abs(u2 - k2) <= p * Math.max(1, Math.abs(u2), Math.abs(k2)) && Math.abs(c2 - I2) <= p * Math.max(1, Math.abs(c2), Math.abs(I2)) && Math.abs(h2 - E2) <= p * Math.max(1, Math.abs(h2), Math.abs(E2)) && Math.abs(f2 - T2) <= p * Math.max(1, Math.abs(f2), Math.abs(T2)) && Math.abs(d2 - F2) <= p * Math.max(1, Math.abs(d2), Math.abs(F2)) && Math.abs(y2 - P2) <= p * Math.max(1, Math.abs(y2), Math.abs(P2)) && Math.abs(m2 - D2) <= p * Math.max(1, Math.abs(m2), Math.abs(D2)) && Math.abs(g2 - z2) <= p * Math.max(1, Math.abs(g2), Math.abs(z2)) && Math.abs(x2 - B2) <= p * Math.max(1, Math.abs(x2), Math.abs(B2));
        }, t.cl = function(t2, e2) {
          return t2[0] = e2[0], t2[1] = e2[1], t2[2] = e2[2], t2[3] = e2[3], t2[4] = e2[4], t2[5] = e2[5], t2[6] = e2[6], t2[7] = e2[7], t2[8] = e2[8], t2[9] = e2[9], t2[10] = e2[10], t2[11] = e2[11], t2[12] = e2[12], t2[13] = e2[13], t2[14] = e2[14], t2[15] = e2[15], t2;
        }, t.cm = (t2) => "circle" === t2.type, t.cn = (t2) => "heatmap" === t2.type, t.co = (t2) => "line" === t2.type, t.cp = (t2) => "fill" === t2.type, t.cq = (t2) => "fill-extrusion" === t2.type, t.cr = (t2) => "hillshade" === t2.type, t.cs = (t2) => "color-relief" === t2.type, t.ct = (t2) => "background" === t2.type, t.cu = (t2) => "custom" === t2.type, t.cv = C, t.cw = function(t2, e2, n2) {
          if (e2 <= 0) return t2;
          const r2 = 1 / e2;
          return void 0 === n2 || Math.abs(n2) < 1e-10 ? Math.round(t2 * r2) / r2 : (n2 > 0 ? Math.ceil(t2 * r2 - 1e-9) : Math.floor(t2 * r2 + 1e-10)) / r2;
        }, t.cx = function(t2, e2, n2) {
          const r2 = E(e2.x - n2.x, e2.y - n2.y), i2 = E(t2.x - n2.x, t2.y - n2.y);
          var s2, o2;
          return nt(Math.atan2(r2[0] * i2[1] - r2[1] * i2[0], (s2 = r2)[0] * (o2 = i2)[0] + s2[1] * o2[1]));
        }, t.cy = V, t.cz = function(t2, e2) {
          var n2;
          if (!it[e2]) return false;
          const r2 = null == t2 ? void 0 : t2.target, i2 = (null === (n2 = null == r2 ? void 0 : r2.ownerDocument) || void 0 === n2 ? void 0 : n2.defaultView) || window;
          return t2 instanceof i2.MouseEvent || t2 instanceof i2.WheelEvent;
        }, t.d = P, t.d0 = class {
          constructor(t2, e2) {
            const n2 = (e2 = this.options = Object.assign({}, sh, e2)).debug;
            if (n2 && console.time("preprocess data"), e2.maxZoom < 0 || e2.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range");
            if (e2.promoteId && e2.generateId) throw new Error("promoteId and generateId cannot be used together.");
            let r2 = pc(t2, e2);
            n2 && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", e2.indexMaxZoom, e2.indexMaxPoints), console.time("generate tiles")), r2 = Lc(r2, e2), e2.updateable && (this.source = r2), this.initializeIndex(r2, e2);
          }
          initializeIndex(t2, e2) {
            this.tileIndex = e2.cluster ? new qc(e2.clusterOptions) : new rh(e2), t2.length && this.tileIndex.initialize(t2);
          }
          getTile(t2, e2, n2) {
            return e2 = +e2, n2 = +n2, (t2 = +t2) < 0 || t2 > 24 ? null : this.tileIndex.getTile(t2, e2, n2);
          }
          updateData(t2, e2) {
            const n2 = this.options;
            if (!n2.updateable) throw new Error("to update tile geojson `updateable` option must be set to true");
            let { affected: r2, source: i2 } = (function(t3, e3, n3) {
              const r3 = (function(t4, e4) {
                return t4 ? { removeAll: t4.removeAll, remove: new Set(t4.remove || []), add: new Map(t4.add?.map(((t5) => [e4.promoteId ? t5.properties[e4.promoteId] : t5.id, t5]))), update: new Map(t4.update?.map(((t5) => [t5.id, t5]))) } : { remove: /* @__PURE__ */ new Set(), add: /* @__PURE__ */ new Map(), update: /* @__PURE__ */ new Map() };
              })(e3, n3);
              let i3 = [];
              if (r3.removeAll && (i3 = t3, t3 = []), r3.remove.size || r3.add.size) {
                const e4 = [];
                for (const n4 of t3) (r3.remove.has(n4.id) || r3.add.has(n4.id)) && e4.push(n4);
                if (e4.length) {
                  i3.push(...e4);
                  const n4 = new Set(e4.map(((t4) => t4.id)));
                  t3 = t3.filter(((t4) => !n4.has(t4.id)));
                }
                if (r3.add.size) {
                  let e5 = pc({ type: "FeatureCollection", features: Array.from(r3.add.values()) }, n3);
                  e5 = Lc(e5, n3), i3.push(...e5), t3.push(...e5);
                }
              }
              if (r3.update.size) {
                const e4 = /* @__PURE__ */ new Map(), s2 = [];
                for (const n4 of t3) r3.update.has(n4.id) ? e4.set(n4.id, [...e4.get(n4.id) || [], n4]) : s2.push(n4);
                for (const [t4, o2] of r3.update) {
                  const r4 = e4.get(t4);
                  if (!r4 || 0 === r4.length) continue;
                  const a2 = Nc(r4, o2, n3);
                  i3.push(...r4, ...a2), s2.push(...a2);
                }
                t3 = s2;
              }
              return { affected: i3, source: t3 };
            })(this.source, t2, n2);
            e2 && ({ affected: r2, source: i2 } = this.filterUpdate(i2, r2, e2)), r2.length && (this.source = i2, this.tileIndex.updateIndex(i2, r2, n2));
          }
          filterUpdate(t2, e2, n2) {
            const r2 = /* @__PURE__ */ new Set();
            for (const i2 of t2) null != i2.id && (n2(xc(i2)) || (e2.push(i2), r2.add(i2.id)));
            return { affected: e2, source: t2 = t2.filter(((t3) => !r2.has(t3.id))) };
          }
          getData() {
            if (!this.options.updateable) throw new Error("to retrieve data the `updateable` option must be set to true");
            return { type: "FeatureCollection", features: this.source.map(((t2) => xc(t2))) };
          }
          updateClusterOptions(t2, e2) {
            const n2 = this.options.cluster;
            this.options.cluster = t2, this.options.clusterOptions = e2, n2 != t2 ? this.initializeIndex(this.source, this.options) : this.tileIndex.updateIndex(this.source, [], this.options);
          }
          getClusterExpansionZoom(t2) {
            return this.tileIndex.getClusterExpansionZoom(t2);
          }
          getClusterChildren(t2) {
            return this.tileIndex.getChildren(t2);
          }
          getClusterLeaves(t2, e2, n2) {
            return this.tileIndex.getLeaves(t2, e2, n2);
          }
        }, t.d1 = Bs, t.e = $, t.f = yt, t.g = ct, t.h = (t2) => e(void 0, void 0, void 0, (function* () {
          if (0 === t2.byteLength) return createImageBitmap(new ImageData(1, 1));
          const e2 = new Blob([new Uint8Array(t2)], { type: "image/png" });
          try {
            return createImageBitmap(e2);
          } catch (t3) {
            throw new Error(`Could not load image because of ${P(t3).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`);
          }
        })), t.i = Y, t.j = (t2) => new Promise(((e2, n2) => {
          const r2 = new Image();
          r2.onload = () => {
            e2(r2), URL.revokeObjectURL(r2.src), r2.onload = null, window.requestAnimationFrame((() => r2.src = W));
          }, r2.onerror = () => n2(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 i2 = new Blob([new Uint8Array(t2)], { type: "image/png" });
          r2.src = t2.byteLength ? URL.createObjectURL(i2) : W;
        })), t.k = (t2, e2) => dt($(t2, { type: "json" }), e2), t.l = vt, t.m = dt, t.n = xt, t.o = (t2, e2) => dt($(t2, { type: "arrayBuffer" }), e2), t.p = ep, t.q = function(t2) {
          return new Rh(t2).readFields(Jh, []);
        }, t.r = function(t2) {
          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(t2));
        }, t.s = tt, t.t = kl, t.u = Ks, t.v = ss, t.w = G, t.x = wt, t.y = Rs, t.z = as;
      }));
      define2("worker", ["./shared"], (function(e) {
        class t {
          constructor(e2, t2) {
            this.keyCache = {}, e2 && this.replace(e2, t2);
          }
          replace(e2, t2) {
            this._layerConfigs = {}, this._layers = {}, this.update(e2, [], t2);
          }
          update(t2, i2, s2) {
            for (const i3 of t2) {
              this._layerConfigs[i3.id] = i3;
              const t3 = this._layers[i3.id] = e.bT(i3, s2);
              t3._featureFilter = e.ah(t3.filter, s2), this.keyCache[i3.id] && delete this.keyCache[i3.id];
            }
            for (const e2 of i2) delete this.keyCache[e2], delete this._layerConfigs[e2], delete this._layers[e2];
            this.familiesBySource = {};
            const r2 = e.cJ(Object.values(this._layerConfigs), this.keyCache);
            for (const t3 of r2) {
              const i3 = t3.map(((e2) => this._layers[e2.id])), s3 = i3[0];
              if (s3.isHidden()) continue;
              const r3 = s3.source || "";
              let o2 = this.familiesBySource[r3];
              o2 || (o2 = this.familiesBySource[r3] = {});
              const n2 = s3.sourceLayer || e.ag;
              let a2 = o2[n2];
              a2 || (a2 = o2[n2] = []), a2.push(i3);
            }
          }
        }
        class i {
          constructor(t2) {
            const i2 = {}, s2 = [];
            for (const e2 in t2) {
              const r3 = t2[e2], o3 = i2[e2] = {};
              for (const e3 in r3) {
                const t3 = r3[+e3];
                if (!t3 || 0 === t3.bitmap.width || 0 === t3.bitmap.height) continue;
                const i3 = { x: 0, y: 0, w: t3.bitmap.width + 2, h: t3.bitmap.height + 2 };
                s2.push(i3), o3[e3] = { rect: i3, metrics: t3.metrics };
              }
            }
            const { w: r2, h: o2 } = e.p(s2), n2 = new e.t({ width: r2 || 1, height: o2 || 1 });
            for (const s3 in t2) {
              const r3 = t2[s3];
              for (const t3 in r3) {
                const o3 = r3[+t3];
                if (!o3 || 0 === o3.bitmap.width || 0 === o3.bitmap.height) continue;
                const a2 = i2[s3][t3].rect;
                e.t.copy(o3.bitmap, n2, { x: 0, y: 0 }, { x: a2.x + 1, y: a2.y + 1 }, o3.bitmap);
              }
            }
            this.image = n2, this.positions = i2;
          }
        }
        e.cK("GlyphAtlas", i);
        class s {
          constructor(t2) {
            this.tileID = new e.a3(t2.tileID.overscaledZ, t2.tileID.wrap, t2.tileID.canonical.z, t2.tileID.canonical.x, t2.tileID.canonical.y), this.uid = t2.uid, this.zoom = t2.zoom, this.pixelRatio = t2.pixelRatio, this.tileSize = t2.tileSize, this.source = t2.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t2.showCollisionBoxes, this.collectResourceTiming = !!t2.collectResourceTiming, this.returnDependencies = !!t2.returnDependencies, this.promoteId = t2.promoteId, this.inFlightDependencies = [];
          }
          parse(t2, s2, o2, n2, a2) {
            return e._(this, void 0, void 0, (function* () {
              this.status = "parsing", this.data = t2, this.collisionBoxArray = new e.ae();
              const l2 = new e.cL(Object.keys(t2.layers).sort()), c2 = new e.cM(this.tileID, this.promoteId);
              c2.bucketLayerIDs = [];
              const h2 = {}, d2 = { featureIndex: c2, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, dashDependencies: {}, availableImages: o2, subdivisionGranularity: a2 }, u2 = s2.familiesBySource[this.source];
              for (const i2 in u2) {
                const s3 = t2.layers[i2];
                if (!s3) continue;
                1 === s3.version && e.w(`Vector tile source "${this.source}" layer "${i2}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
                const n3 = l2.encode(i2), a3 = [];
                for (let e2 = 0; e2 < s3.length; e2++) {
                  const t3 = s3.feature(e2), r2 = c2.getId(t3, i2);
                  a3.push({ feature: t3, id: r2, index: e2, sourceLayerIndex: n3 });
                }
                for (const t3 of u2[i2]) {
                  const i3 = t3[0];
                  i3.source !== this.source && e.w(`layer.source = ${i3.source} does not equal this.source = ${this.source}`), i3.isHidden(this.zoom, true) || (r(t3, this.zoom, o2), (h2[i3.id] = i3.createBucket({ index: c2.bucketLayerIDs.length, layers: t3, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: n3, sourceID: this.source })).populate(a3, d2, this.tileID.canonical), c2.bucketLayerIDs.push(t3.map(((e2) => e2.id))));
                }
              }
              const g2 = e.bY(d2.glyphDependencies, ((e2) => Object.keys(e2).map(Number)));
              for (const e2 of this.inFlightDependencies) null == e2 || e2.abort();
              this.inFlightDependencies = [];
              let p2 = Promise.resolve({});
              if (Object.keys(g2).length) {
                const e2 = new AbortController();
                this.inFlightDependencies.push(e2), p2 = n2.sendAsync({ type: "GG", data: { stacks: g2, source: this.source, tileID: this.tileID, type: "glyphs" } }, e2);
              }
              const f2 = Object.keys(d2.iconDependencies);
              let y2 = Promise.resolve({});
              if (f2.length) {
                const e2 = new AbortController();
                this.inFlightDependencies.push(e2), y2 = n2.sendAsync({ type: "GI", data: { icons: f2, source: this.source, tileID: this.tileID, type: "icons" } }, e2);
              }
              const v2 = Object.keys(d2.patternDependencies);
              let m = Promise.resolve({});
              if (v2.length) {
                const e2 = new AbortController();
                this.inFlightDependencies.push(e2), m = n2.sendAsync({ type: "GI", data: { icons: v2, source: this.source, tileID: this.tileID, type: "patterns" } }, e2);
              }
              const _ = d2.dashDependencies;
              let S = Promise.resolve({});
              if (Object.keys(_).length) {
                const e2 = new AbortController();
                this.inFlightDependencies.push(e2), S = n2.sendAsync({ type: "GDA", data: { dashes: _ } }, e2);
              }
              const [w, b, I, T] = yield Promise.all([p2, y2, m, S]), k = new i(w), x = new e.cN(b, I);
              for (const t3 in h2) {
                const i2 = h2[t3];
                i2 instanceof e.af ? (r(i2.layers, this.zoom, o2), e.cO({ bucket: i2, glyphMap: w, glyphPositions: k.positions, imageMap: b, imagePositions: x.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical, subdivisionGranularity: d2.subdivisionGranularity })) : i2.hasDependencies && (i2 instanceof e.cP || i2 instanceof e.cQ || i2 instanceof e.cR) && (r(i2.layers, this.zoom, o2), i2.addFeatures(d2, this.tileID.canonical, x.patternPositions, T));
              }
              return this.status = "done", { buckets: Object.values(h2).filter(((e2) => !e2.isEmpty())), featureIndex: c2, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: k.image, imageAtlas: x, dashPositions: T, glyphMap: this.returnDependencies ? w : null, iconMap: this.returnDependencies ? b : null, glyphPositions: this.returnDependencies ? k.positions : null };
            }));
          }
        }
        function r(t2, i2, s2) {
          const r2 = new e.J(i2);
          for (const e2 of t2) e2.recalculate(r2, s2);
        }
        class o {
          constructor() {
            this.loading = {}, this.loaded = {}, this.parsing = {};
          }
          startLoading(e2, t2) {
            this.loading[e2] = t2;
          }
          finishLoading(e2) {
            delete this.loading[e2];
          }
          abort(e2) {
            const t2 = this.loading[e2];
            (null == t2 ? void 0 : t2.abort) && (t2.abort.abort(), delete this.loading[e2]);
          }
          setParsing(e2, t2) {
            this.parsing[e2] = t2;
          }
          consumeParsing(e2) {
            const t2 = this.parsing[e2];
            if (t2) return delete this.parsing[e2], t2;
          }
          clearParsing(e2) {
            delete this.parsing[e2];
          }
          markLoaded(e2, t2) {
            this.loaded[e2] = t2;
          }
          getLoaded(e2) {
            const t2 = this.loaded[e2];
            if (t2) return t2;
          }
          removeLoaded(e2) {
            delete this.loaded[e2];
          }
          clearLoaded() {
            this.loaded = {};
          }
        }
        class n {
          constructor(e2) {
            this.start = `${e2}#start`, this.end = `${e2}#end`, this.measure = e2, performance.mark(this.start);
          }
          finish() {
            performance.mark(this.end);
            let e2 = performance.getEntriesByName(this.measure);
            return 0 === e2.length && (performance.measure(this.measure, this.start, this.end), e2 = performance.getEntriesByName(this.measure), performance.clearMarks(this.start), performance.clearMarks(this.end), performance.clearMeasures(this.measure)), e2;
          }
        }
        class a {
          constructor(e2, t2, i2, s2, r2) {
            this.type = e2, this.properties = i2 || {}, this.extent = r2, this.pointsArray = t2, this.id = s2;
          }
          loadGeometry() {
            return this.pointsArray.map(((t2) => t2.map(((t3) => new e.P(t3.x, t3.y)))));
          }
        }
        class l {
          constructor(e2, t2, i2) {
            this.version = 2, this._myFeatures = e2, this.name = t2, this.length = e2.length, this.extent = i2;
          }
          feature(e2) {
            return this._myFeatures[e2];
          }
        }
        class c {
          constructor() {
            this.layers = {};
          }
          addLayer(e2) {
            this.layers[e2.name] = e2;
          }
        }
        function h(t2) {
          let i2 = e.cS(t2);
          return 0 === i2.byteOffset && i2.byteLength === i2.buffer.byteLength || (i2 = new Uint8Array(i2)), { vectorTile: t2, rawData: i2.buffer };
        }
        function d(t2, i2, s2) {
          const { extent: r2 } = t2, o2 = Math.pow(2, s2.z - i2.z), n2 = (s2.x - i2.x * o2) * r2, c2 = (s2.y - i2.y * o2) * r2, h2 = [];
          for (let i3 = 0; i3 < t2.length; i3++) {
            const s3 = t2.feature(i3);
            let l2 = s3.loadGeometry();
            for (const e2 of l2) for (const t3 of e2) t3.x = t3.x * o2 - n2, t3.y = t3.y * o2 - c2;
            const d2 = 128;
            l2 = e.cT(l2, s3.type, -d2, -d2, r2 + d2, r2 + d2), 0 !== l2.length && h2.push(new a(s3.type, l2, s3.properties, s3.id, r2));
          }
          return new l(h2, t2.name, r2);
        }
        class u {
          constructor(t2, i2, s2) {
            this.actor = t2, this.layerIndex = i2, this.availableImages = s2, this.tileState = new o(), this.overzoomedTileResultCache = new e.cU(1e3);
          }
          loadVectorTile(t2, i2) {
            try {
              return { vectorTile: "mlt" !== t2.encoding ? new e.cV(new e.cW(i2)) : new e.cX(i2), rawData: i2 };
            } catch (s2) {
              const r2 = new Uint8Array(i2);
              let o2 = `Unable to parse the tile at ${t2.request.url}, `;
              throw o2 += 31 === r2[0] && 139 === r2[1] ? "please make sure the data is not gzipped and that you have configured the relevant header in the server" : `got error: ${e.d(s2).message}`, new Error(o2);
            }
          }
          loadTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              const { uid: i2, overzoomParameters: r2 } = t2;
              r2 && (t2.request = r2.overzoomRequest);
              const o2 = this._startRequestTiming(t2), n2 = new s(t2);
              this.tileState.startLoading(i2, n2);
              const a2 = new AbortController();
              n2.abort = a2;
              try {
                const s2 = yield e.o(t2.request, a2);
                if (t2.etag && t2.etag === s2.etag) return this.tileState.finishLoading(i2), this._getEtagUnmodifiedResult(s2, o2);
                const l2 = this.loadVectorTile(t2, s2.data);
                if (this.tileState.finishLoading(i2), !l2) return null;
                let { vectorTile: c2, rawData: h2 } = l2;
                r2 && ({ vectorTile: c2, rawData: h2 } = this._getOverzoomTile(t2, c2));
                const d2 = this._getExpiryData(s2), u2 = this._finishRequestTiming(o2);
                n2.vectorTile = c2, this.tileState.markLoaded(i2, n2);
                const g2 = { rawData: h2, cacheControl: d2, resourceTiming: u2 };
                this.tileState.setParsing(i2, g2);
                try {
                  return yield this._parseWorkerTile(n2, t2, g2);
                } finally {
                  this.tileState.clearParsing(i2);
                }
              } catch (e2) {
                throw this.tileState.finishLoading(i2), n2.status = "done", this.tileState.markLoaded(i2, n2), e2;
              }
            }));
          }
          _getEtagUnmodifiedResult(t2, i2) {
            const s2 = this._getExpiryData(t2), r2 = this._finishRequestTiming(i2);
            return e.e({ etagUnmodified: true }, s2, r2);
          }
          _parseWorkerTile(t2, i2, s2) {
            return e._(this, void 0, void 0, (function* () {
              let r2 = yield t2.parse(t2.vectorTile, this.layerIndex, this.availableImages, this.actor, i2.subdivisionGranularity);
              if (s2) {
                const { rawData: t3, cacheControl: o2, resourceTiming: n2 } = s2;
                r2 = e.e({ rawTileData: t3.slice(0), encoding: i2.encoding }, r2, o2, n2);
              }
              return r2;
            }));
          }
          _getExpiryData({ expires: e2, cacheControl: t2, etag: i2 }) {
            const s2 = {};
            return e2 && (s2.expires = e2), t2 && (s2.cacheControl = t2), i2 && (s2.etag = i2), s2;
          }
          _startRequestTiming(e2) {
            var t2;
            if (null === (t2 = e2.request) || void 0 === t2 ? void 0 : t2.collectResourceTiming) return new n(e2.request.url);
          }
          _finishRequestTiming(e2) {
            const t2 = null == e2 ? void 0 : e2.finish();
            return t2 ? { resourceTiming: JSON.parse(JSON.stringify(t2)) } : {};
          }
          _getOverzoomTile(e2, t2) {
            var i2;
            const { tileID: s2, source: r2, overzoomParameters: o2 } = e2, { maxZoomTileID: n2 } = o2, a2 = `${n2.key}_${s2.key}_${null === (i2 = e2.request) || void 0 === i2 ? void 0 : i2.url}`, l2 = this.overzoomedTileResultCache.get(a2);
            if (l2) return l2;
            const u2 = new c(), g2 = this.layerIndex.familiesBySource[r2];
            for (const e3 in g2) {
              const i3 = t2.layers[e3];
              if (!i3) continue;
              const r3 = d(i3, n2, s2.canonical);
              r3.length > 0 && u2.addLayer(r3);
            }
            const p2 = h(u2);
            return this.overzoomedTileResultCache.set(a2, p2), p2;
          }
          reloadTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              const e2 = t2.uid, i2 = this.tileState.getLoaded(e2);
              if (!i2) throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");
              if (i2.showCollisionBoxes = t2.showCollisionBoxes, "parsing" === i2.status) {
                const s2 = this.tileState.consumeParsing(e2);
                return yield this._parseWorkerTile(i2, t2, s2);
              }
              if ("done" === i2.status && i2.vectorTile) return yield this._parseWorkerTile(i2, t2);
            }));
          }
          abortTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              this.tileState.abort(t2.uid);
            }));
          }
          removeTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              this.tileState.removeLoaded(t2.uid);
            }));
          }
        }
        class g {
          constructor() {
            this.loaded = {};
          }
          loadTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              const { uid: i2, encoding: s2, rawImageData: r2, redFactor: o2, greenFactor: n2, blueFactor: a2, baseShift: l2 } = t2, c2 = r2.width + 2, h2 = r2.height + 2, d2 = e.b(r2) ? new e.R({ width: c2, height: h2 }, yield e.cY(r2, -1, -1, c2, h2)) : r2, u2 = new e.cZ(i2, d2, s2, o2, n2, a2, l2);
              return this.loaded || (this.loaded = {}), this.loaded[i2] = u2, u2;
            }));
          }
          removeTile(e2) {
            const t2 = this.loaded, i2 = e2.uid;
            (null == t2 ? void 0 : t2[i2]) && delete t2[i2];
          }
        }
        class p {
          constructor(e2, t2, i2, s2 = f) {
            this.actor = e2, this.layerIndex = t2, this.availableImages = i2, this.tileState = new o(), this._createGeoJSONIndex = s2;
          }
          loadVectorTile(t2) {
            if (!this._geoJSONIndex) throw new Error("Unable to parse the data into a cluster or geojson");
            const { z: i2, x: s2, y: r2 } = t2.tileID.canonical, o2 = this._geoJSONIndex.getTile(i2, s2, r2);
            return o2 ? h(new e.c_(o2.features, { version: 2, extent: e.a6 })) : null;
          }
          loadTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              const { uid: e2 } = t2, i2 = new s(t2);
              i2.abort = new AbortController();
              try {
                const s2 = this.loadVectorTile(t2);
                if (!s2) return null;
                const { vectorTile: r2, rawData: o2 } = s2;
                i2.vectorTile = r2, this.tileState.markLoaded(e2, i2);
                const n2 = { rawData: o2 };
                this.tileState.setParsing(e2, n2);
                try {
                  return yield this._parseWorkerTile(i2, t2, n2);
                } finally {
                  this.tileState.clearParsing(e2);
                }
              } catch (t3) {
                throw i2.status = "done", this.tileState.markLoaded(e2, i2), t3;
              }
            }));
          }
          _reloadLoadedTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              const e2 = t2.uid, i2 = this.tileState.getLoaded(e2);
              if (!i2) throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");
              if (i2.showCollisionBoxes = t2.showCollisionBoxes, "parsing" === i2.status) {
                const s2 = this.tileState.consumeParsing(e2);
                return yield this._parseWorkerTile(i2, t2, s2);
              }
              if ("done" === i2.status && i2.vectorTile) return yield this._parseWorkerTile(i2, t2);
            }));
          }
          _parseWorkerTile(t2, i2, s2) {
            return e._(this, void 0, void 0, (function* () {
              let r2 = yield t2.parse(t2.vectorTile, this.layerIndex, this.availableImages, this.actor, i2.subdivisionGranularity);
              if (s2) {
                const { rawData: t3 } = s2;
                r2 = e.e({ rawTileData: t3.slice(0), encoding: "mvt" }, r2);
              }
              return r2;
            }));
          }
          abortTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              this.tileState.abort(t2.uid);
            }));
          }
          removeTile(t2) {
            return e._(this, void 0, void 0, (function* () {
              this.tileState.removeLoaded(t2.uid);
            }));
          }
          loadData(t2) {
            return e._(this, void 0, void 0, (function* () {
              var i2;
              null === (i2 = this._pendingRequest) || void 0 === i2 || i2.abort();
              const s2 = this._startRequestTiming(t2);
              this._pendingRequest = new AbortController();
              try {
                yield this.loadAndProcessGeoJSON(t2, this._pendingRequest), delete this._pendingRequest, this.tileState.clearLoaded();
                const e2 = {};
                return t2.request && (e2.data = t2.data), this._finishRequestTiming(s2, t2, e2), e2;
              } catch (t3) {
                if (delete this._pendingRequest, !e.$(t3)) throw t3;
                return { abandoned: true };
              }
            }));
          }
          _startRequestTiming(e2) {
            var t2;
            if (null === (t2 = e2.request) || void 0 === t2 ? void 0 : t2.collectResourceTiming) return new n(e2.request.url);
          }
          _finishRequestTiming(e2, t2, i2) {
            const s2 = null == e2 ? void 0 : e2.finish();
            s2 && (i2.resourceTiming = { [t2.source]: JSON.parse(JSON.stringify(s2)) });
          }
          reloadTile(e2) {
            return this.tileState.getLoaded(e2.uid) ? this._reloadLoadedTile(e2) : this.loadTile(e2);
          }
          loadAndProcessGeoJSON(t2, i2) {
            return e._(this, void 0, void 0, (function* () {
              var s2;
              if (t2.request && (t2.data = (yield e.k(t2.request, i2)).data), t2.data) return t2.data = this._filterGeoJSON(t2.data, t2.filter), void (this._geoJSONIndex = this._createGeoJSONIndex(t2.data, t2));
              if (t2.dataDiff) return null !== (s2 = this._geoJSONIndex) && void 0 !== s2 || (this._geoJSONIndex = this._createGeoJSONIndex({ type: "FeatureCollection", features: [] }, t2)), void this._geoJSONIndex.updateData(t2.dataDiff, this._getFilterPredicate(t2.filter));
              if (t2.updateCluster && this._geoJSONIndex.updateClusterOptions(t2.geojsonVtOptions.cluster, y(t2)), null == this._geoJSONIndex) throw new Error(`Input data given to '${t2.source}' is not a valid GeoJSON object.`);
            }));
          }
          _filterGeoJSON(e2, t2) {
            if ("FeatureCollection" !== e2.type) return e2;
            const i2 = this._getFilterPredicate(t2);
            return i2 ? { type: "FeatureCollection", features: e2.features.filter(((e3) => i2(e3))) } : e2;
          }
          _getFilterPredicate(t2) {
            if ("boolean" != typeof t2 && !(null == t2 ? void 0 : t2.length)) return;
            const i2 = e.c$(t2, { type: "boolean", "property-type": "data-driven", overridable: false, transition: false });
            if ("error" === i2.result) throw new Error(i2.value.map(((e2) => `${e2.key}: ${e2.message}`)).join(", "));
            return (e2) => i2.value.evaluate({ zoom: 0 }, e2);
          }
          removeSource(t2) {
            return e._(this, void 0, void 0, (function* () {
              var e2;
              null === (e2 = this._pendingRequest) || void 0 === e2 || e2.abort();
            }));
          }
          getClusterExpansionZoom(e2) {
            return this._geoJSONIndex.getClusterExpansionZoom(e2.clusterId);
          }
          getClusterChildren(e2) {
            return this._geoJSONIndex.getClusterChildren(e2.clusterId);
          }
          getClusterLeaves(e2) {
            return this._geoJSONIndex.getClusterLeaves(e2.clusterId, e2.limit, e2.offset);
          }
        }
        function f(t2, i2) {
          const s2 = e.e(i2.geojsonVtOptions || {}, { updateable: true, clusterOptions: y(i2) });
          return new e.d0(t2, s2);
        }
        function y({ geojsonVtOptions: t2, clusterProperties: i2 }) {
          if (!i2 || !t2.clusterOptions) return t2.clusterOptions;
          const s2 = {}, r2 = {}, o2 = { accumulated: null, zoom: 0 }, n2 = { properties: null }, a2 = Object.keys(i2);
          for (const t3 of a2) {
            const [o3, n3] = i2[t3], a3 = e.c$(n3), l2 = e.c$("string" == typeof o3 ? [o3, ["accumulated"], ["get", t3]] : o3);
            s2[t3] = a3.value, r2[t3] = l2.value;
          }
          return t2.clusterOptions.map = (e2) => {
            n2.properties = e2;
            const t3 = {};
            for (const e3 of a2) t3[e3] = s2[e3].evaluate(o2, n2);
            return t3;
          }, t2.clusterOptions.reduce = (e2, t3) => {
            n2.properties = t3;
            for (const t4 of a2) o2.accumulated = e2[t4], e2[t4] = r2[t4].evaluate(o2, n2);
          }, t2.clusterOptions;
        }
        class v {
          constructor(t2) {
            this.self = t2, this.actor = new e.N(t2), this.layerIndexes = {}, this.availableImages = {}, this.workerSources = {}, this.demWorkerSources = {}, this.externalWorkerSourceTypes = {}, this.globalStates = /* @__PURE__ */ new Map(), this.self.registerWorkerSource = (e2, t3) => {
              if (this.externalWorkerSourceTypes[e2]) throw new Error(`Worker source with name "${e2}" already registered.`);
              this.externalWorkerSourceTypes[e2] = t3;
            }, this.self.addProtocol = e.cH, this.self.removeProtocol = e.cI, this.self.registerRTLTextPlugin = (t3) => {
              e.d1.setMethods(t3);
            }, this.self.makeRequest = e.m, this.actor.registerMessageHandler("LDT", ((e2, t3) => this._getDEMWorkerSource(e2, t3.source).loadTile(t3))), this.actor.registerMessageHandler("RDT", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              this._getDEMWorkerSource(t3, i2.source).removeTile(i2);
            })))), this.actor.registerMessageHandler("GCEZ", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              return this._getWorkerSource(t3, i2.type, i2.source).getClusterExpansionZoom(i2);
            })))), this.actor.registerMessageHandler("GCC", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              return this._getWorkerSource(t3, i2.type, i2.source).getClusterChildren(i2);
            })))), this.actor.registerMessageHandler("GCL", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              return this._getWorkerSource(t3, i2.type, i2.source).getClusterLeaves(i2);
            })))), this.actor.registerMessageHandler("LD", ((e2, t3) => this._getWorkerSource(e2, t3.type, t3.source).loadData(t3))), this.actor.registerMessageHandler("LT", ((e2, t3) => this._getWorkerSource(e2, t3.type, t3.source).loadTile(t3))), this.actor.registerMessageHandler("RT", ((e2, t3) => this._getWorkerSource(e2, t3.type, t3.source).reloadTile(t3))), this.actor.registerMessageHandler("AT", ((e2, t3) => this._getWorkerSource(e2, t3.type, t3.source).abortTile(t3))), this.actor.registerMessageHandler("RMT", ((e2, t3) => this._getWorkerSource(e2, t3.type, t3.source).removeTile(t3))), this.actor.registerMessageHandler("RS", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              var e2, s2;
              if (!(null === (s2 = null === (e2 = this.workerSources[t3]) || void 0 === e2 ? void 0 : e2[i2.type]) || void 0 === s2 ? void 0 : s2[i2.source])) return;
              const r2 = this.workerSources[t3][i2.type][i2.source];
              delete this.workerSources[t3][i2.type][i2.source], void 0 !== r2.removeSource && r2.removeSource(i2);
            })))), this.actor.registerMessageHandler("RM", ((t3) => e._(this, void 0, void 0, (function* () {
              delete this.layerIndexes[t3], delete this.availableImages[t3], delete this.workerSources[t3], delete this.demWorkerSources[t3], this.globalStates.delete(t3);
            })))), this.actor.registerMessageHandler("SR", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              this.referrer = i2;
            })))), this.actor.registerMessageHandler("SRPS", ((e2, t3) => this._syncRTLPluginState(e2, t3))), this.actor.registerMessageHandler("IS", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              this.self.importScripts(i2);
            })))), this.actor.registerMessageHandler("SI", ((e2, t3) => this._setImages(e2, t3))), this.actor.registerMessageHandler("UL", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              this._getLayerIndex(t3).update(i2.layers, i2.removedIds, this._getGlobalState(t3));
            })))), this.actor.registerMessageHandler("UGS", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              const e2 = this._getGlobalState(t3);
              for (const t4 in i2) e2[t4] = i2[t4];
            })))), this.actor.registerMessageHandler("SL", ((t3, i2) => e._(this, void 0, void 0, (function* () {
              this._getLayerIndex(t3).replace(i2, this._getGlobalState(t3));
            }))));
          }
          _getGlobalState(e2) {
            let t2 = this.globalStates.get(e2);
            return t2 || (t2 = {}, this.globalStates.set(e2, t2)), t2;
          }
          _setImages(t2, i2) {
            return e._(this, void 0, void 0, (function* () {
              this.availableImages[t2] = i2;
              for (const e2 in this.workerSources[t2]) {
                const s2 = this.workerSources[t2][e2];
                for (const e3 in s2) s2[e3].availableImages = i2;
              }
            }));
          }
          _syncRTLPluginState(t2, i2) {
            return e._(this, void 0, void 0, (function* () {
              return yield e.d1.syncState(i2, this.self.importScripts);
            }));
          }
          _getAvailableImages(e2) {
            let t2 = this.availableImages[e2];
            return t2 || (t2 = []), t2;
          }
          _getLayerIndex(e2) {
            let i2 = this.layerIndexes[e2];
            return i2 || (i2 = this.layerIndexes[e2] = new t()), i2;
          }
          _getWorkerSource(e2, t2, i2) {
            var s2, r2;
            if ((s2 = this.workerSources)[e2] || (s2[e2] = {}), (r2 = this.workerSources[e2])[t2] || (r2[t2] = {}), !this.workerSources[e2][t2][i2]) {
              const s3 = { sendAsync: (t3, i3) => (t3.targetMapId = e2, this.actor.sendAsync(t3, i3)) };
              switch (t2) {
                case "vector":
                  this.workerSources[e2][t2][i2] = new u(s3, this._getLayerIndex(e2), this._getAvailableImages(e2));
                  break;
                case "geojson":
                  this.workerSources[e2][t2][i2] = new p(s3, this._getLayerIndex(e2), this._getAvailableImages(e2));
                  break;
                default:
                  this.workerSources[e2][t2][i2] = new this.externalWorkerSourceTypes[t2](s3, this._getLayerIndex(e2), this._getAvailableImages(e2));
              }
            }
            return this.workerSources[e2][t2][i2];
          }
          _getDEMWorkerSource(e2, t2) {
            var i2, s2;
            return (i2 = this.demWorkerSources)[e2] || (i2[e2] = {}), (s2 = this.demWorkerSources[e2])[t2] || (s2[t2] = new g()), this.demWorkerSources[e2][t2];
          }
        }
        return e.i(self) && (self.worker = new v(self)), v;
      }));
      define2("index", ["exports", "./shared"], (function(e, t) {
        var i = "5.24.0";
        function o() {
          var e2 = new t.A(4);
          return t.A != Float32Array && (e2[1] = 0, e2[2] = 0), e2[0] = 1, e2[3] = 1, e2;
        }
        let a, r, s;
        const n = { frame(e2, i2, o2, a2) {
          const r2 = a2 || window, s2 = r2.requestAnimationFrame(((e3) => {
            n2(), i2(e3);
          })), { unsubscribe: n2 } = t.s(e2.signal, "abort", (() => {
            n2(), r2.cancelAnimationFrame(s2), o2(new t.a(e2.signal.reason));
          }), false);
        }, frameAsync(e2, t2) {
          return new Promise(((i2, o2) => {
            this.frame(e2, i2, o2, t2);
          }));
        }, getImageData(e2, t2 = 0) {
          return this.getImageCanvasContext(e2).getImageData(-t2, -t2, e2.width + 2 * t2, e2.height + 2 * t2);
        }, getImageCanvasContext(e2) {
          const t2 = window.document.createElement("canvas"), i2 = t2.getContext("2d", { willReadFrequently: true });
          if (!i2) throw new Error("failed to create canvas 2d context");
          return t2.width = e2.width, t2.height = e2.height, i2.drawImage(e2, 0, 0, e2.width, e2.height), i2;
        }, resolveURL: (e2) => (a || (a = document.createElement("a")), a.href = e2, a.href), hardwareConcurrency: "undefined" != typeof navigator && navigator.hardwareConcurrency || 4, get prefersReducedMotion() {
          return void 0 !== s ? s : !!matchMedia && (null != r || (r = matchMedia("(prefers-reduced-motion: reduce)")), r.matches);
        }, set prefersReducedMotion(e2) {
          s = e2;
        } }, l = new class {
          constructor() {
            this._frozenAt = null;
          }
          getCurrentTime() {
            return null !== this._frozenAt ? this._frozenAt : performance.now();
          }
          setNow(e2) {
            this._frozenAt = e2;
          }
          restoreNow() {
            this._frozenAt = null;
          }
          isFrozen() {
            return null !== this._frozenAt;
          }
        }();
        function c() {
          return l.getCurrentTime();
        }
        var h, u;
        class d {
          static create(e2, t2, i2) {
            const o2 = window.document.createElement(e2);
            return void 0 !== t2 && (o2.className = t2), i2 && i2.appendChild(o2), o2;
          }
          static createNS(e2, t2) {
            return window.document.createElementNS(e2, t2);
          }
          static disableDrag() {
            d.docStyle && d.selectProp && (d.userSelect = d.docStyle[d.selectProp], d.docStyle[d.selectProp] = "none");
          }
          static enableDrag() {
            d.docStyle && d.selectProp && (d.docStyle[d.selectProp] = d.userSelect);
          }
          static suppressClickInternal(e2) {
            e2.preventDefault(), e2.stopPropagation(), window.removeEventListener("click", d.suppressClickInternal, true);
          }
          static suppressClick() {
            window.addEventListener("click", d.suppressClickInternal, true), window.setTimeout((() => {
              window.removeEventListener("click", d.suppressClickInternal, true);
            }), 0);
          }
          static getScale(e2) {
            const t2 = e2.getBoundingClientRect();
            return { x: t2.width / e2.offsetWidth || 1, y: t2.height / e2.offsetHeight || 1, boundingClientRect: t2 };
          }
          static getPoint(e2, i2, o2) {
            const a2 = i2.boundingClientRect;
            return new t.P((o2.clientX - a2.left) / i2.x - e2.clientLeft, (o2.clientY - a2.top) / i2.y - e2.clientTop);
          }
          static mousePos(e2, t2) {
            const i2 = d.getScale(e2);
            return d.getPoint(e2, i2, t2);
          }
          static touchPos(e2, t2) {
            const i2 = [], o2 = d.getScale(e2);
            for (const a2 of t2) i2.push(d.getPoint(e2, o2, a2));
            return i2;
          }
          static sanitize(e2) {
            const t2 = new DOMParser().parseFromString(e2, "text/html").body || document.createElement("body"), i2 = t2.querySelectorAll("script");
            for (const e3 of i2) e3.remove();
            return d.clean(t2), t2.innerHTML;
          }
          static isPossiblyDangerous(e2, t2) {
            const i2 = t2.replace(/\s+/g, "").toLowerCase();
            return !(!["src", "href", "xlink:href"].includes(e2) || !i2.includes("javascript:") && !i2.includes("data:")) || !!e2.startsWith("on") || void 0;
          }
          static clean(e2) {
            const t2 = e2.children;
            for (const e3 of t2) d.removeAttributes(e3), d.clean(e3);
          }
          static removeAttributes(e2) {
            for (const { name: t2, value: i2 } of e2.attributes) d.isPossiblyDangerous(t2, i2) && e2.removeAttribute(t2);
          }
        }
        d.docStyle = "undefined" != typeof window && (null === (h = window.document) || void 0 === h ? void 0 : h.documentElement.style), d.selectProp = !d.docStyle || "userSelect" in d.docStyle ? "userSelect" : "webkitUserSelect", (function(e2) {
          let i2, o2, a2, r2;
          e2.resetRequestQueue = () => {
            i2 = [], o2 = 0, a2 = 0, r2 = {};
          }, e2.addThrottleControl = (e3) => {
            const t2 = a2++;
            return r2[t2] = e3, t2;
          }, e2.removeThrottleControl = (e3) => {
            delete r2[e3], n2();
          }, e2.getImage = (e3, o3, a3 = true) => new Promise(((r3, s3) => {
            e3.headers || (e3.headers = {}), e3.headers.accept = "image/webp,*/*", t.e(e3, { type: "image" }), i2.push({ abortController: o3, requestParameters: e3, supportImageRefresh: a3, state: "queued", onError: (e4) => {
              s3(e4);
            }, onSuccess: (e4) => {
              r3(e4);
            } }), n2();
          }));
          const s2 = (e3) => t._(this, void 0, void 0, (function* () {
            e3.state = "running";
            const { requestParameters: i3, supportImageRefresh: a3, onError: r3, onSuccess: s3, abortController: c2 } = e3, h2 = false === a3 && !t.i(self) && !t.g(i3.url) && (!i3.headers || Object.keys(i3.headers).reduce(((e4, t2) => e4 && "accept" === t2), true));
            o2++;
            const u2 = h2 ? l2(i3, c2) : t.m(i3, c2);
            try {
              const i4 = yield u2;
              delete e3.abortController, e3.state = "completed", i4.data instanceof HTMLImageElement || t.b(i4.data) ? s3(i4) : i4.data && s3({ data: yield (d2 = i4.data, "function" == typeof createImageBitmap ? t.h(d2) : t.j(d2)), cacheControl: i4.cacheControl, expires: i4.expires });
            } catch (i4) {
              delete e3.abortController, r3(t.d(i4));
            } finally {
              o2--, n2();
            }
            var d2;
          })), n2 = () => {
            const e3 = (() => {
              for (const e4 of Object.keys(r2)) if (r2[e4]()) return true;
              return false;
            })() ? t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : t.c.MAX_PARALLEL_IMAGE_REQUESTS;
            for (let t2 = o2; t2 < e3 && i2.length > 0; t2++) {
              const e4 = i2.shift();
              e4.abortController.signal.aborted ? t2-- : s2(e4);
            }
          }, l2 = (e3, i3) => new Promise(((o3, a3) => {
            const r3 = new Image(), s3 = e3.url, n3 = e3.credentials;
            n3 && "include" === n3 ? r3.crossOrigin = "use-credentials" : (n3 && "same-origin" === n3 || !t.f(s3)) && (r3.crossOrigin = "anonymous"), i3.signal.addEventListener("abort", (() => {
              r3.src = "", a3(new t.a(i3.signal.reason));
            })), r3.fetchPriority = "high", r3.onload = () => {
              r3.onerror = r3.onload = null, o3({ data: r3 });
            }, r3.onerror = () => {
              r3.onerror = r3.onload = null, i3.signal.aborted || a3(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."));
            }, r3.src = s3;
          }));
        })(u || (u = {})), u.resetRequestQueue();
        class _ {
          constructor(e2) {
            this._transformRequestFn = null != e2 ? e2 : null;
          }
          transformRequest(e2, t2) {
            return this._transformRequestFn && this._transformRequestFn(e2, t2) || { url: e2 };
          }
          setTransformRequest(e2) {
            this._transformRequestFn = e2;
          }
        }
        function p(e2) {
          const t2 = [];
          if ("string" == typeof e2) t2.push({ id: "default", url: e2 });
          else if (e2 && e2.length > 0) {
            const i2 = [];
            for (const { id: o2, url: a2 } of e2) {
              const e3 = `${o2}${a2}`;
              i2.includes(e3) || (i2.push(e3), t2.push({ id: o2, url: a2 }));
            }
          }
          return t2;
        }
        function m(e2, t2, i2) {
          try {
            const o2 = new URL(e2);
            return o2.pathname += `${t2}${i2}`, o2.toString();
          } catch (t3) {
            throw new Error(`Invalid sprite URL "${e2}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`);
          }
        }
        function f(e2) {
          const { userImage: t2 } = e2;
          return !(!(null == t2 ? void 0 : t2.render) || !t2.render() || (e2.data.replace(new Uint8Array(t2.data.buffer)), 0));
        }
        class g extends t.E {
          constructor() {
            super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = false, this.requestors = [], this.patterns = {}, this.atlasImage = new t.R({ width: 1, height: 1 }), this.dirty = true;
          }
          destroy() {
            this.atlasTexture && (this.atlasTexture.destroy(), this.atlasTexture = null);
            for (const e2 of Object.keys(this.images)) this.removeImage(e2);
            this.patterns = {}, this.atlasImage = new t.R({ width: 1, height: 1 }), this.dirty = true;
          }
          isLoaded() {
            return this.loaded;
          }
          setLoaded(e2) {
            if (this.loaded !== e2 && (this.loaded = e2, e2)) {
              for (const { ids: e3, promiseResolve: t2 } of this.requestors) t2(this._getImagesForIds(e3));
              this.requestors = [];
            }
          }
          getImage(e2) {
            const i2 = this.images[e2];
            if (i2 && !i2.data && i2.spriteData) {
              const e3 = i2.spriteData;
              i2.data = new t.R({ width: e3.width, height: e3.height }, e3.context.getImageData(e3.x, e3.y, e3.width, e3.height).data), i2.spriteData = null;
            }
            return i2;
          }
          addImage(e2, t2) {
            if (this.images[e2]) throw new Error(`Image id ${e2} already exist, use updateImage instead`);
            this._validate(e2, t2) && (this.images[e2] = t2);
          }
          _validate(e2, i2) {
            let o2 = true;
            const a2 = i2.data || i2.spriteData;
            return this._validateStretch(i2.stretchX, null == a2 ? void 0 : a2.width) || (this.fire(new t.l(new Error(`Image "${e2}" has invalid "stretchX" value`))), o2 = false), this._validateStretch(i2.stretchY, null == a2 ? void 0 : a2.height) || (this.fire(new t.l(new Error(`Image "${e2}" has invalid "stretchY" value`))), o2 = false), this._validateContent(i2.content, i2) || (this.fire(new t.l(new Error(`Image "${e2}" has invalid "content" value`))), o2 = false), o2;
          }
          _validateStretch(e2, t2) {
            if (!e2) return true;
            let i2 = 0;
            for (const o2 of e2) {
              if (o2[0] < i2 || o2[1] < o2[0] || t2 < o2[1]) return false;
              i2 = o2[1];
            }
            return true;
          }
          _validateContent(e2, t2) {
            if (!e2) return true;
            if (4 !== e2.length) return false;
            const i2 = t2.spriteData, o2 = (null == i2 ? void 0 : i2.width) || t2.data.width, a2 = (null == i2 ? void 0 : i2.height) || t2.data.height;
            return !(e2[0] < 0 || o2 < e2[0] || e2[1] < 0 || a2 < e2[1] || e2[2] < 0 || o2 < e2[2] || e2[3] < 0 || a2 < e2[3] || e2[2] < e2[0] || !(e2[3] >= e2[1]));
          }
          updateImage(e2, t2, i2 = true) {
            const o2 = this.getImage(e2);
            if (i2 && (o2.data.width !== t2.data.width || o2.data.height !== t2.data.height)) throw new Error(`size mismatch between old image (${o2.data.width}x${o2.data.height}) and new image (${t2.data.width}x${t2.data.height}).`);
            t2.version = o2.version + 1, this.images[e2] = t2, this.updatedImages[e2] = true;
          }
          removeImage(e2) {
            var t2;
            const i2 = this.images[e2];
            delete this.images[e2], delete this.patterns[e2], (null === (t2 = i2.userImage) || void 0 === t2 ? void 0 : t2.onRemove) && i2.userImage.onRemove();
          }
          listImages() {
            return Object.keys(this.images);
          }
          getImages(e2) {
            return new Promise(((t2, i2) => {
              let o2 = true;
              if (!this.isLoaded()) for (const t3 of e2) this.images[t3] || (o2 = false);
              this.isLoaded() || o2 ? t2(this._getImagesForIds(e2)) : this.requestors.push({ ids: e2, promiseResolve: t2 });
            }));
          }
          _getImagesForIds(e2) {
            var i2;
            const o2 = {};
            for (const a2 of e2) {
              let e3 = this.getImage(a2);
              e3 || (this.fire(new t.n("styleimagemissing", { id: a2 })), e3 = this.getImage(a2)), e3 ? o2[a2] = { data: e3.data.clone(), pixelRatio: e3.pixelRatio, sdf: e3.sdf, version: e3.version, stretchX: e3.stretchX, stretchY: e3.stretchY, content: e3.content, textFitWidth: e3.textFitWidth, textFitHeight: e3.textFitHeight, hasRenderCallback: Boolean(null === (i2 = e3.userImage) || void 0 === i2 ? void 0 : i2.render) } : t.w(`Image "${a2}" 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 o2;
          }
          getPixelSize() {
            const { width: e2, height: t2 } = this.atlasImage;
            return { width: e2, height: t2 };
          }
          getPattern(e2) {
            const i2 = this.patterns[e2], o2 = this.getImage(e2);
            if (!o2) return null;
            if (i2 && i2.position.version === o2.version) return i2.position;
            if (i2) i2.position.version = o2.version;
            else {
              const i3 = { w: o2.data.width + 2, h: o2.data.height + 2, x: 0, y: 0 }, a2 = new t.I(i3, o2);
              this.patterns[e2] = { bin: i3, position: a2 };
            }
            return this._updatePatternAtlas(), this.patterns[e2].position;
          }
          bind(e2) {
            const i2 = e2.gl;
            this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = false) : this.atlasTexture = new t.T(e2, this.atlasImage, i2.RGBA), this.atlasTexture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE);
          }
          _updatePatternAtlas() {
            const e2 = [];
            for (const t2 in this.patterns) e2.push(this.patterns[t2].bin);
            const { w: i2, h: o2 } = t.p(e2), a2 = this.atlasImage;
            a2.resize({ width: i2 || 1, height: o2 || 1 });
            for (const e3 in this.patterns) {
              const { bin: i3 } = this.patterns[e3], o3 = i3.x + 1, r2 = i3.y + 1, s2 = this.getImage(e3).data, n2 = s2.width, l2 = s2.height;
              t.R.copy(s2, a2, { x: 0, y: 0 }, { x: o3, y: r2 }, { width: n2, height: l2 }), t.R.copy(s2, a2, { x: 0, y: l2 - 1 }, { x: o3, y: r2 - 1 }, { width: n2, height: 1 }), t.R.copy(s2, a2, { x: 0, y: 0 }, { x: o3, y: r2 + l2 }, { width: n2, height: 1 }), t.R.copy(s2, a2, { x: n2 - 1, y: 0 }, { x: o3 - 1, y: r2 }, { width: 1, height: l2 }), t.R.copy(s2, a2, { x: 0, y: 0 }, { x: o3 + n2, y: r2 }, { width: 1, height: l2 });
            }
            this.dirty = true;
          }
          beginFrame() {
            this.callbackDispatchedThisFrame = {};
          }
          dispatchRenderCallbacks(e2) {
            for (const i2 of e2) {
              if (this.callbackDispatchedThisFrame[i2]) continue;
              this.callbackDispatchedThisFrame[i2] = true;
              const e3 = this.getImage(i2);
              e3 || t.w(`Image with ID: "${i2}" was not found`), f(e3) && this.updateImage(i2, e3);
            }
          }
          cloneImages() {
            const e2 = {};
            for (const t2 in this.images) {
              const i2 = this.images[t2];
              e2[t2] = Object.assign(Object.assign({}, i2), { data: i2.data ? i2.data.clone() : null });
            }
            return e2;
          }
        }
        const v = 1e20, x = new Float64Array(256);
        for (let e2 = 0; e2 < 256; e2++) {
          const t2 = 0.5 - Math.pow(e2 / 255, 1 / 2.2);
          x[e2] = t2 * Math.abs(t2);
        }
        function b(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
          for (let c2 = t2; c2 < t2 + o2; c2++) y(e2, i2 * r2 + c2, r2, a2, s2, n2, l2);
          for (let c2 = i2; c2 < i2 + a2; c2++) y(e2, c2 * r2 + t2, 1, o2, s2, n2, l2);
        }
        function y(e2, t2, i2, o2, a2, r2, s2) {
          r2[0] = 0, s2[0] = -v, s2[1] = v, a2[0] = e2[t2];
          for (let n2 = 1, l2 = 0, c2 = 0; n2 < o2; n2++) {
            a2[n2] = e2[t2 + n2 * i2];
            const o3 = n2 * n2;
            do {
              const e3 = r2[l2];
              c2 = (a2[n2] - a2[e3] + o3 - e3 * e3) / (n2 - e3) / 2;
            } while (c2 <= s2[l2] && --l2 > -1);
            l2++, r2[l2] = n2, s2[l2] = c2, s2[l2 + 1] = v;
          }
          for (let n2 = 0, l2 = 0; n2 < o2; n2++) {
            for (; s2[l2 + 1] < n2; ) l2++;
            const o3 = r2[l2], c2 = n2 - o3;
            e2[t2 + n2 * i2] = a2[o3] + c2 * c2;
          }
        }
        x[255] = -v;
        const w = t.v.layout_symbol["text-font"].default.join(",");
        class T {
          constructor(e2, t2, i2) {
            this.requestManager = e2, this.localIdeographFontFamily = t2, this.entries = {}, this.lang = i2;
          }
          setURL(e2) {
            this.url = e2;
          }
          getGlyphs(e2) {
            return t._(this, void 0, void 0, (function* () {
              const t2 = [];
              for (const i3 in e2) for (const o3 of e2[i3]) t2.push(this._getAndCacheGlyphsPromise(i3, o3));
              const i2 = yield Promise.all(t2), o2 = {};
              for (const { stack: e3, id: t3, glyph: a2 } of i2) o2[e3] || (o2[e3] = {}), o2[e3][t3] = a2 && { id: a2.id, bitmap: a2.bitmap.clone(), metrics: a2.metrics };
              return o2;
            }));
          }
          _getAndCacheGlyphsPromise(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              var t2, o2;
              null !== (t2 = (o2 = this.entries)[e2]) && void 0 !== t2 || (o2[e2] = { glyphs: {}, requests: {}, ranges: {} });
              const a2 = this.entries[e2];
              let r2 = a2.glyphs[i2];
              return void 0 !== r2 ? { stack: e2, id: i2, glyph: r2 } : !this.url || this._charUsesLocalIdeographFontFamily(i2) ? (r2 = a2.glyphs[i2] = this._drawGlyph(a2, e2, i2), { stack: e2, id: i2, glyph: r2 }) : yield this._downloadAndCacheRangePromise(e2, i2);
            }));
          }
          _downloadAndCacheRangePromise(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              var o2;
              const a2 = this.entries[e2], r2 = Math.floor(i2 / 256);
              if (a2.ranges[r2]) return { stack: e2, id: i2, glyph: null };
              (o2 = a2.requests)[r2] || (o2[r2] = T.loadGlyphRange(e2, r2, this.url, this.requestManager));
              try {
                const t2 = yield a2.requests[r2];
                for (const e3 in t2) a2.glyphs[+e3] = t2[+e3];
                return a2.ranges[r2] = true, { stack: e2, id: i2, glyph: t2[i2] || null };
              } catch (o3) {
                const s2 = a2.glyphs[i2] = this._drawGlyph(a2, e2, i2);
                return this._warnOnMissingGlyphRange(s2, r2, i2, t.d(o3)), { stack: e2, id: i2, glyph: s2 };
              }
            }));
          }
          _warnOnMissingGlyphRange(e2, i2, o2, a2) {
            const r2 = 256 * i2, s2 = r2 + 255, n2 = o2.toString(16).padStart(4, "0").toUpperCase();
            t.w(`Unable to load glyph range ${i2}, ${r2}-${s2}. Rendering codepoint U+${n2} locally instead. ${a2}`);
          }
          _charUsesLocalIdeographFontFamily(e2) {
            return !!this.localIdeographFontFamily && t.r(e2);
          }
          _drawGlyph(e2, i2, o2) {
            const a2 = i2 === w && "" !== this.localIdeographFontFamily && this._charUsesLocalIdeographFontFamily(o2), r2 = a2 ? "ideographTinySDF" : "tinySDF";
            e2[r2] || (e2[r2] = this._createTinySDF(a2 ? this.localIdeographFontFamily : i2));
            const s2 = e2[r2].draw(String.fromCodePoint(o2)), n2 = /^\p{gc=Cf}+$/u.test(String.fromCodePoint(o2));
            return { id: o2, bitmap: new t.t({ width: s2.width || 60, height: s2.height || 60 }, s2.data), metrics: { width: n2 ? 0 : s2.glyphWidth / 2 || 24, height: s2.glyphHeight / 2 || 24, left: s2.glyphLeft / 2 + 0.5 || 0, top: s2.glyphTop / 2 - 27.5 || -8, advance: n2 ? 0 : s2.glyphAdvance / 2 || 24, isDoubleResolution: true } };
          }
          _createTinySDF(e2) {
            const t2 = e2 ? e2.split(",") : [];
            t2.push("sans-serif");
            const i2 = t2.map(((e3) => /[-\w]+/.test(e3) ? e3 : `'${CSS.escape(e3)}'`)).join(",");
            return new T.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: i2, fontWeight: this._fontWeight(t2[0]), fontStyle: this._fontStyle(t2[0]), lang: this.lang });
          }
          _fontStyle(e2) {
            return /italic/i.test(e2) ? "italic" : /oblique/i.test(e2) ? "oblique" : "normal";
          }
          _fontWeight(e2) {
            const t2 = { 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 i2;
            for (const [o2, a2] of Object.entries(t2)) new RegExp(`\\b${o2}\\b`, "i").test(e2) && (i2 = `${a2}`);
            return i2;
          }
          destroy() {
            for (const e2 in this.entries) {
              const t2 = this.entries[e2];
              t2.tinySDF = null, t2.ideographTinySDF = null, t2.glyphs = {}, t2.requests = {}, t2.ranges = {};
            }
            this.entries = {};
          }
        }
        T.loadGlyphRange = function(e2, i2, o2, a2) {
          return t._(this, void 0, void 0, (function* () {
            const r2 = 256 * i2, s2 = r2 + 255, n2 = yield a2.transformRequest(o2.replace("{fontstack}", e2).replace("{range}", `${r2}-${s2}`), "Glyphs"), l2 = yield t.o(n2, new AbortController());
            if (!(null == l2 ? void 0 : l2.data)) throw new Error(`Could not load glyph range. range: ${i2}, ${r2}-${s2}`);
            const c2 = {};
            for (const e3 of t.q(l2.data)) c2[e3.id] = e3;
            return c2;
          }));
        }, T.TinySDF = class {
          constructor({ fontSize: e2 = 24, buffer: t2 = 3, radius: i2 = 8, cutoff: o2 = 0.25, fontFamily: a2 = "sans-serif", fontWeight: r2 = "normal", fontStyle: s2 = "normal", lang: n2 = null } = {}) {
            this.buffer = t2, this.radius = i2, this.cutoff = o2, this.lang = n2;
            const l2 = this.size = e2 + 4 * t2, c2 = this._createCanvas(l2), h2 = this.ctx = c2.getContext("2d", { willReadFrequently: true });
            h2.font = `${s2} ${r2} ${e2}px ${a2}`, h2.textBaseline = "alphabetic", h2.textAlign = "left", h2.fillStyle = "black", this.gridOuter = new Float64Array(l2 * l2), this.gridInner = new Float64Array(l2 * l2), this.f = new Float64Array(l2), this.z = new Float64Array(l2 + 1), this.v = new Uint16Array(l2);
          }
          _createCanvas(e2) {
            if ("undefined" != typeof OffscreenCanvas) return new OffscreenCanvas(e2, e2);
            const t2 = document.createElement("canvas");
            return t2.width = t2.height = e2, t2;
          }
          draw(e2) {
            const { width: t2, actualBoundingBoxAscent: i2, actualBoundingBoxDescent: o2, actualBoundingBoxLeft: a2, actualBoundingBoxRight: r2 } = this.ctx.measureText(e2), s2 = Math.ceil(i2), n2 = Math.floor(a2), l2 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(r2) - n2)), c2 = Math.max(0, Math.min(this.size - this.buffer, s2 + Math.ceil(o2))), h2 = l2 + 2 * this.buffer, u2 = c2 + 2 * this.buffer, d2 = Math.max(h2 * u2, 0), _2 = new Uint8ClampedArray(d2), p2 = { data: _2, width: h2, height: u2, glyphWidth: l2, glyphHeight: c2, glyphTop: s2, glyphLeft: n2, glyphAdvance: t2 };
            if (0 === l2 || 0 === c2) return p2;
            const { ctx: m2, buffer: f2, gridInner: g2, gridOuter: y2 } = this;
            this.lang && (m2.lang = this.lang), m2.clearRect(f2, f2, l2, c2), m2.fillText(e2, f2 - n2, f2 + s2);
            const w2 = m2.getImageData(f2, f2, l2, c2);
            y2.fill(v, 0, d2), g2.fill(0, 0, d2);
            let T2 = 3;
            for (let e3 = 0; e3 < c2; e3++) {
              let t3 = (e3 + f2) * h2 + f2;
              for (let e4 = 0; e4 < l2; e4++, T2 += 4, t3++) {
                const e5 = w2.data[T2];
                if (0 === e5) continue;
                const i3 = x[e5];
                y2[t3] = Math.max(0, i3), g2[t3] = Math.max(0, -i3);
              }
            }
            b(y2, 0, 0, h2, u2, h2, this.f, this.v, this.z), b(g2, f2, f2, l2, c2, h2, this.f, this.v, this.z);
            const P2 = 255 / this.radius, C2 = 255 * (1 - this.cutoff);
            for (let e3 = 0; e3 < d2; e3++) {
              const t3 = Math.sqrt(y2[e3]) - Math.sqrt(g2[e3]);
              _2[e3] = Math.round(C2 - P2 * t3);
            }
            return p2;
          }
        };
        class P {
          constructor() {
            this.specification = t.x.light.position;
          }
          possiblyEvaluate(e2, i2) {
            return t.G(e2.expression.evaluate(i2));
          }
          interpolate(e2, i2, o2) {
            return { x: t.H.number(e2.x, i2.x, o2), y: t.H.number(e2.y, i2.y, o2), z: t.H.number(e2.z, i2.z, o2) };
          }
        }
        let C;
        class M extends t.E {
          constructor(e2) {
            super(), C || (C = new t.u({ anchor: new t.D(t.x.light.anchor), position: new P(), color: new t.D(t.x.light.color), intensity: new t.D(t.x.light.intensity) })), this._transitionable = new t.y(C, void 0), this.setLight(e2), this._transitioning = this._transitionable.untransitioned();
          }
          getLight() {
            return this._transitionable.serialize();
          }
          setLight(e2, i2 = {}) {
            if (!this._validate(t.z, e2, i2)) for (const i3 in e2) {
              const o2 = e2[i3];
              i3.endsWith(t.B) ? this._transitionable.setTransition(i3.slice(0, -t.B.length), o2) : this._transitionable.setValue(i3, o2);
            }
          }
          updateTransitions(e2) {
            this._transitioning = this._transitionable.transitioned(e2, this._transitioning);
          }
          hasTransition() {
            return this._transitioning.hasTransition();
          }
          recalculate(e2) {
            this.properties = this._transitioning.possiblyEvaluate(e2);
          }
          _validate(e2, i2, o2) {
            return false !== (null == o2 ? void 0 : o2.validate) && t.C(this, e2.call(t.F, { value: i2, style: { glyphs: true, sprite: true }, styleSpec: t.x }));
          }
        }
        const I = new t.u({ "sky-color": new t.D(t.x.sky["sky-color"]), "horizon-color": new t.D(t.x.sky["horizon-color"]), "fog-color": new t.D(t.x.sky["fog-color"]), "fog-ground-blend": new t.D(t.x.sky["fog-ground-blend"]), "horizon-fog-blend": new t.D(t.x.sky["horizon-fog-blend"]), "sky-horizon-blend": new t.D(t.x.sky["sky-horizon-blend"]), "atmosphere-blend": new t.D(t.x.sky["atmosphere-blend"]) });
        class E extends t.E {
          constructor(e2) {
            super(), this._transitionable = new t.y(I, void 0), this.setSky(e2), this._transitioning = this._transitionable.untransitioned(), this.recalculate(new t.J(0));
          }
          setSky(e2, i2 = {}) {
            if (!this._validate(t.K, e2, i2)) {
              e2 || (e2 = { "sky-color": "transparent", "horizon-color": "transparent", "fog-color": "transparent", "fog-ground-blend": 1, "atmosphere-blend": 0 });
              for (const i3 in e2) {
                const o2 = e2[i3];
                i3.endsWith(t.B) ? this._transitionable.setTransition(i3.slice(0, -t.B.length), o2) : this._transitionable.setValue(i3, o2);
              }
            }
          }
          getSky() {
            return this._transitionable.serialize();
          }
          updateTransitions(e2) {
            this._transitioning = this._transitionable.transitioned(e2, this._transitioning);
          }
          hasTransition() {
            return this._transitioning.hasTransition();
          }
          recalculate(e2) {
            this.properties = this._transitioning.possiblyEvaluate(e2);
          }
          _validate(e2, i2, o2 = {}) {
            return false !== (null == o2 ? void 0 : o2.validate) && t.C(this, e2.call(t.F, t.e({ value: i2, style: { glyphs: true, sprite: true }, styleSpec: t.x })));
          }
          calculateFogBlendOpacity(e2) {
            return e2 < 60 ? 0 : e2 < 70 ? (e2 - 60) / 10 : 1;
          }
        }
        class S {
          constructor(e2, t2) {
            this.width = e2, this.height = t2, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};
          }
          getDash(e2, t2) {
            var i2;
            const o2 = e2.join(",") + String(t2);
            return (i2 = this.dashEntry)[o2] || (i2[o2] = this.addDash(e2, t2)), this.dashEntry[o2];
          }
          getDashRanges(e2, t2, i2) {
            const o2 = [];
            let a2 = e2.length % 2 == 1 ? -e2[e2.length - 1] * i2 : 0, r2 = e2[0] * i2, s2 = true;
            o2.push({ left: a2, right: r2, isDash: s2, zeroLength: 0 === e2[0] });
            let n2 = e2[0];
            for (let t3 = 1; t3 < e2.length; t3++) {
              s2 = !s2;
              const l2 = e2[t3];
              a2 = n2 * i2, n2 += l2, r2 = n2 * i2, o2.push({ left: a2, right: r2, isDash: s2, zeroLength: 0 === l2 });
            }
            return o2;
          }
          addRoundDash(e2, t2, i2) {
            const o2 = t2 / 2;
            for (let t3 = -i2; t3 <= i2; t3++) {
              const a2 = this.width * (this.nextRow + i2 + t3);
              let r2 = 0, s2 = e2[r2];
              for (let n2 = 0; n2 < this.width; n2++) {
                n2 / s2.right > 1 && (s2 = e2[++r2]);
                const l2 = Math.abs(n2 - s2.left), c2 = Math.abs(n2 - s2.right), h2 = Math.min(l2, c2);
                let u2;
                const d2 = t3 / i2 * (o2 + 1);
                if (s2.isDash) {
                  const e3 = o2 - Math.abs(d2);
                  u2 = Math.sqrt(h2 * h2 + e3 * e3);
                } else u2 = o2 - Math.sqrt(h2 * h2 + d2 * d2);
                this.data[a2 + n2] = Math.max(0, Math.min(255, u2 + 128));
              }
            }
          }
          addRegularDash(e2) {
            for (let t3 = e2.length - 1; t3 >= 0; --t3) {
              const i3 = e2[t3], o3 = e2[t3 + 1];
              i3.zeroLength ? e2.splice(t3, 1) : o3 && o3.isDash === i3.isDash && (o3.left = i3.left, e2.splice(t3, 1));
            }
            const t2 = e2[0], i2 = e2[e2.length - 1];
            t2.isDash === i2.isDash && (t2.left = i2.left - this.width, i2.right = t2.right + this.width);
            const o2 = this.width * this.nextRow;
            let a2 = 0, r2 = e2[a2];
            for (let t3 = 0; t3 < this.width; t3++) {
              t3 / r2.right > 1 && (r2 = e2[++a2]);
              const i3 = Math.abs(t3 - r2.left), s2 = Math.abs(t3 - r2.right), n2 = Math.min(i3, s2);
              this.data[o2 + t3] = Math.max(0, Math.min(255, (r2.isDash ? n2 : -n2) + 128));
            }
          }
          addDash(e2, i2) {
            const o2 = i2 ? 7 : 0, a2 = 2 * o2 + 1;
            if (this.nextRow + a2 > this.height) return t.w("LineAtlas out of space"), null;
            let r2 = 0;
            for (const t2 of e2) r2 += t2;
            if (0 !== r2) {
              const t2 = this.width / r2, a3 = this.getDashRanges(e2, this.width, t2);
              i2 ? this.addRoundDash(a3, t2, o2) : this.addRegularDash(a3);
            }
            const s2 = { y: this.nextRow + o2, height: 2 * o2, width: r2 };
            return this.nextRow += a2, this.dirty = true, s2;
          }
          bind(e2) {
            const t2 = e2.gl;
            this.texture ? (t2.bindTexture(t2.TEXTURE_2D, this.texture), this.dirty && (this.dirty = false, t2.texSubImage2D(t2.TEXTURE_2D, 0, 0, 0, this.width, this.height, t2.ALPHA, t2.UNSIGNED_BYTE, this.data))) : (this.texture = t2.createTexture(), t2.bindTexture(t2.TEXTURE_2D, this.texture), t2.texParameteri(t2.TEXTURE_2D, t2.TEXTURE_WRAP_S, t2.REPEAT), t2.texParameteri(t2.TEXTURE_2D, t2.TEXTURE_WRAP_T, t2.REPEAT), t2.texParameteri(t2.TEXTURE_2D, t2.TEXTURE_MIN_FILTER, t2.LINEAR), t2.texParameteri(t2.TEXTURE_2D, t2.TEXTURE_MAG_FILTER, t2.LINEAR), t2.texImage2D(t2.TEXTURE_2D, 0, t2.ALPHA, this.width, this.height, 0, t2.ALPHA, t2.UNSIGNED_BYTE, this.data));
          }
        }
        const z = "maplibre_preloaded_worker_pool";
        class R {
          constructor() {
            this.active = {};
          }
          acquire(e2) {
            if (!this.workers) for (this.workers = []; this.workers.length < R.workerCount; ) this.workers.push(new Worker(t.c.WORKER_URL));
            return this.active[e2] = true, this.workers.slice();
          }
          release(e2) {
            if (delete this.active[e2], 0 === this.numActive()) {
              for (const e3 of this.workers) e3.terminate();
              this.workers = null;
            }
          }
          isPreloaded() {
            return !!this.active[z];
          }
          numActive() {
            return Object.keys(this.active).length;
          }
        }
        const D = Math.floor(n.hardwareConcurrency / 2);
        let A, L;
        function F() {
          return A || (A = new R()), A;
        }
        R.workerCount = t.L(globalThis) ? Math.max(Math.min(D, 3), 1) : 1;
        class k {
          constructor(e2, i2) {
            this.workerPool = e2, this.actors = [], this.currentActor = 0, this.id = i2;
            const o2 = this.workerPool.acquire(i2);
            for (let e3 = 0; e3 < o2.length; e3++) {
              const a2 = new t.N(o2[e3], i2);
              a2.name = `Worker ${e3}`, this.actors.push(a2);
            }
            if (!this.actors.length) throw new Error("No actors found");
          }
          broadcast(e2, t2) {
            const i2 = [];
            for (const o2 of this.actors) i2.push(o2.sendAsync({ type: e2, data: t2 }));
            return Promise.all(i2);
          }
          getActor() {
            return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];
          }
          remove(e2 = true) {
            for (const e3 of this.actors) e3.remove();
            this.actors = [], e2 && this.workerPool.release(this.id);
          }
          registerMessageHandler(e2, t2) {
            for (const i2 of this.actors) i2.registerMessageHandler(e2, t2);
          }
          unregisterMessageHandler(e2) {
            for (const t2 of this.actors) t2.unregisterMessageHandler(e2);
          }
        }
        function B() {
          return L || (L = new k(F(), t.M), L.registerMessageHandler("GR", ((e2, i2, o2) => t.m(i2, o2)))), L;
        }
        function O(e2, i2) {
          const o2 = t.O();
          return t.Q(o2, o2, [1, 1, 0]), t.S(o2, o2, [0.5 * e2.width, 0.5 * e2.height, 1]), e2.calculatePosMatrix ? t.U(o2, o2, e2.calculatePosMatrix(i2.toUnwrapped())) : o2;
        }
        function j(e2, t2, i2, o2, a2, r2, s2) {
          var n2;
          const l2 = (function(e3, t3, i3) {
            if (e3) for (const o3 of e3) {
              const e4 = t3[o3];
              if ((null == e4 ? void 0 : e4.source) === i3 && "fill-extrusion" === e4.type) return true;
            }
            else for (const e4 in t3) {
              const o3 = t3[e4];
              if (o3.source === i3 && "fill-extrusion" === o3.type) return true;
            }
            return false;
          })(null !== (n2 = null == a2 ? void 0 : a2.layers) && void 0 !== n2 ? n2 : null, t2, e2.id), c2 = r2.maxPitchScaleFactor(), h2 = e2.tilesIn(o2, c2, l2);
          h2.sort(N);
          const u2 = [];
          for (const o3 of h2) u2.push({ wrappedTileID: o3.tileID.wrapped().key, queryResults: o3.tile.queryRenderedFeatures(t2, i2, e2.getState(), o3.queryGeometry, o3.cameraQueryGeometry, o3.scale, a2, r2, c2, O(r2, o3.tileID), s2 ? (e3, t3) => s2(o3.tileID, e3, t3) : void 0) });
          return (function(e3, t3) {
            for (const i3 in e3) for (const o3 of e3[i3]) Z(o3, t3);
            return e3;
          })((function(e3) {
            const t3 = {}, i3 = {};
            for (const { queryResults: o3, wrappedTileID: a3 } of e3) {
              i3[a3] || (i3[a3] = {});
              const e4 = i3[a3];
              for (const i4 in o3) {
                const a4 = o3[i4];
                e4[i4] || (e4[i4] = {});
                const r3 = e4[i4];
                t3[i4] || (t3[i4] = []);
                for (const e5 of a4) r3[e5.featureIndex] || (r3[e5.featureIndex] = true, t3[i4].push(e5));
              }
            }
            return t3;
          })(u2), e2);
        }
        function N(e2, t2) {
          const i2 = e2.tileID, o2 = t2.tileID;
          return i2.overscaledZ - o2.overscaledZ || i2.canonical.y - o2.canonical.y || i2.wrap - o2.wrap || i2.canonical.x - o2.canonical.x;
        }
        function Z(e2, t2) {
          const i2 = e2.feature, o2 = t2.getFeatureState(i2.layer["source-layer"], i2.id);
          i2.source = i2.layer.source, i2.layer["source-layer"] && (i2.sourceLayer = i2.layer["source-layer"]), i2.state = o2;
        }
        function U(e2, i2, o2, a2) {
          return t._(this, void 0, void 0, (function* () {
            let r2 = e2;
            if (e2.url ? r2 = (yield t.k(yield i2.transformRequest(e2.url, "Source"), o2)).data : yield n.frameAsync(o2, a2), !r2) return null;
            const s2 = t.V(t.e(r2, e2), ["tiles", "minzoom", "maxzoom", "attribution", "bounds", "scheme", "tileSize", "encoding"]);
            return "vector_layers" in r2 && r2.vector_layers && (s2.vectorLayerIds = r2.vector_layers.map(((e3) => e3.id))), s2;
          }));
        }
        class G {
          constructor(e2, t2) {
            e2 && (t2 ? this.setSouthWest(e2).setNorthEast(t2) : Array.isArray(e2) && (4 === e2.length ? this.setSouthWest([e2[0], e2[1]]).setNorthEast([e2[2], e2[3]]) : this.setSouthWest(e2[0]).setNorthEast(e2[1])));
          }
          setNorthEast(e2) {
            return this._ne = e2 instanceof t.W ? new t.W(e2.lng, e2.lat) : t.W.convert(e2), this;
          }
          setSouthWest(e2) {
            return this._sw = e2 instanceof t.W ? new t.W(e2.lng, e2.lat) : t.W.convert(e2), this;
          }
          extend(e2) {
            const i2 = this._sw, o2 = this._ne;
            let a2, r2;
            if (e2 instanceof t.W) a2 = e2, r2 = e2;
            else {
              if (!(e2 instanceof G)) return Array.isArray(e2) ? 4 === e2.length || e2.every(Array.isArray) ? this.extend(G.convert(e2)) : this.extend(t.W.convert(e2)) : e2 && ("lng" in e2 || "lon" in e2) && "lat" in e2 ? this.extend(t.W.convert(e2)) : this;
              if (a2 = e2._sw, r2 = e2._ne, !a2 || !r2) return this;
            }
            return i2 || o2 ? (i2.lng = Math.min(a2.lng, i2.lng), i2.lat = Math.min(a2.lat, i2.lat), o2.lng = Math.max(r2.lng, o2.lng), o2.lat = Math.max(r2.lat, o2.lat)) : (this._sw = new t.W(a2.lng, a2.lat), this._ne = new t.W(r2.lng, r2.lat)), this;
          }
          getCenter() {
            return new t.W((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 t.W(this.getWest(), this.getNorth());
          }
          getSouthEast() {
            return new t.W(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(e2) {
            const { lng: i2, lat: o2 } = t.W.convert(e2);
            let a2 = this._sw.lng <= i2 && i2 <= this._ne.lng;
            return this._sw.lng > this._ne.lng && (a2 = this._sw.lng >= i2 && i2 >= this._ne.lng), this._sw.lat <= o2 && o2 <= this._ne.lat && a2;
          }
          intersects(e2) {
            if (!((e2 = G.convert(e2)).getNorth() >= this.getSouth() && e2.getSouth() <= this.getNorth())) return false;
            const i2 = Math.abs(this.getEast() - this.getWest()), o2 = Math.abs(e2.getEast() - e2.getWest());
            if (i2 >= 360 || o2 >= 360) return true;
            const a2 = t.X(this.getWest(), -180, 180), r2 = t.X(this.getEast(), -180, 180), s2 = t.X(e2.getWest(), -180, 180), n2 = t.X(e2.getEast(), -180, 180), l2 = a2 > r2, c2 = s2 > n2;
            return !(!l2 || !c2) || (l2 ? n2 >= a2 || s2 <= r2 : c2 ? r2 >= s2 || a2 <= n2 : s2 <= r2 && n2 >= a2);
          }
          static convert(e2) {
            return e2 instanceof G ? e2 : e2 ? new G(e2) : e2;
          }
          static fromLngLat(e2, i2 = 0) {
            const o2 = 360 * i2 / 40075017, a2 = o2 / Math.cos(Math.PI / 180 * e2.lat);
            return new G(new t.W(e2.lng - a2, e2.lat - o2), new t.W(e2.lng + a2, e2.lat + o2));
          }
          adjustAntiMeridian() {
            const e2 = new t.W(this._sw.lng, this._sw.lat), i2 = new t.W(this._ne.lng, this._ne.lat);
            return new G(e2, e2.lng > i2.lng ? new t.W(i2.lng + 360, i2.lat) : i2);
          }
        }
        class V {
          constructor(e2, t2, i2) {
            this.bounds = G.convert(this.validateBounds(e2)), this.minzoom = t2 || 0, this.maxzoom = i2 || 24;
          }
          validateBounds(e2) {
            return Array.isArray(e2) && 4 === e2.length ? [Math.max(-180, e2[0]), Math.max(-90, e2[1]), Math.min(180, e2[2]), Math.min(90, e2[3])] : [-180, -90, 180, 90];
          }
          contains(e2) {
            const i2 = Math.pow(2, e2.z), o2 = Math.floor(t.Z(this.bounds.getWest()) * i2), a2 = Math.floor(t.Y(this.bounds.getNorth()) * i2), r2 = Math.ceil(t.Z(this.bounds.getEast()) * i2), s2 = Math.ceil(t.Y(this.bounds.getSouth()) * i2);
            return e2.x >= o2 && e2.x < r2 && e2.y >= a2 && e2.y < s2;
          }
        }
        class W extends t.E {
          constructor(e2, i2, o2, a2) {
            if (super(), this.id = e2, this.dispatcher = o2, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = true, this.isTileClipped = true, this._loaded = false, t.e(this, t.V(i2, ["url", "scheme", "tileSize", "promoteId", "encoding"])), this._options = t.e({ type: "vector" }, i2), this._collectResourceTiming = i2.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512");
            this.setEventedParent(a2);
          }
          load() {
            return t._(this, arguments, void 0, (function* (e2 = false) {
              this._loaded = false, this.fire(new t.n("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
              try {
                const i2 = yield U(this._options, this.map._requestManager, this._tileJSONRequest, this.map._ownerWindow);
                this._tileJSONRequest = null, this._loaded = true, i2 && (t.e(this, i2), i2.bounds && (this.tileBounds = new V(i2.bounds, this.minzoom, this.maxzoom)), this.fire(new t.n("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new t.n("data", { dataType: "source", sourceDataType: "content", sourceDataChanged: e2 })));
              } catch (e3) {
                this._tileJSONRequest = null, this._loaded = true, t.$(e3) || this.fire(new t.l(t.d(e3)));
              }
            }));
          }
          loaded() {
            return this._loaded;
          }
          hasTile(e2) {
            return !this.tileBounds || this.tileBounds.contains(e2.canonical);
          }
          onAdd(e2) {
            this.map = e2, this.load();
          }
          setSourceProperty(e2) {
            this._tileJSONRequest && this._tileJSONRequest.abort(), e2(), this.load(true);
          }
          setTiles(e2) {
            return this.setSourceProperty((() => {
              this._options.tiles = e2;
            })), this;
          }
          setUrl(e2) {
            return this.setSourceProperty((() => {
              this.url = e2, this._options.url = e2;
            })), this;
          }
          onRemove() {
            this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
          }
          serialize() {
            return t.e({}, this._options);
          }
          loadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              const t2 = e2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), i2 = { request: yield this.map._requestManager.transformRequest(t2, "Tile"), uid: e2.uid, tileID: e2.tileID, zoom: e2.tileID.overscaledZ, tileSize: this.tileSize * e2.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: yield this._getOverzoomParameters(e2), etag: e2.etag };
              i2.request.collectResourceTiming = this._collectResourceTiming;
              let o2 = "RT";
              if (e2.actor && "expired" !== e2.state) {
                if ("loading" === e2.state) return new Promise(((t3, i3) => {
                  e2.reloadPromise = { resolve: t3, reject: i3 };
                }));
              } else e2.actor = this.dispatcher.getActor(), o2 = "LT";
              e2.abortController = new AbortController();
              try {
                const t3 = yield e2.actor.sendAsync({ type: o2, data: i2 }, e2.abortController);
                if (delete e2.abortController, e2.aborted) return;
                this._afterTileLoadWorkerResponse(e2, t3);
                const a2 = {};
                return (null == t3 ? void 0 : t3.etagUnmodified) && (a2.unmodified = true), a2;
              } catch (t3) {
                if (delete e2.abortController, e2.aborted) return;
                if (t3 && 404 !== t3.status) throw t3;
                this._afterTileLoadWorkerResponse(e2, null);
              }
            }));
          }
          _getOverzoomParameters(e2) {
            return t._(this, void 0, void 0, (function* () {
              if (e2.tileID.canonical.z <= this.maxzoom) return;
              if (void 0 === this.map._zoomLevelsToOverscale) return;
              const t2 = e2.tileID.scaledTo(this.maxzoom).canonical, i2 = t2.url(this.tiles, this.map.getPixelRatio(), this.scheme);
              return { maxZoomTileID: t2, overzoomRequest: yield this.map._requestManager.transformRequest(i2, "Tile") };
            }));
          }
          _afterTileLoadWorkerResponse(e2, t2) {
            if ((null == t2 ? void 0 : t2.resourceTiming) && (e2.resourceTiming = t2.resourceTiming), t2 && this.map._refreshExpiredTiles && e2.setExpiryData(t2), e2.etag = null == t2 ? void 0 : t2.etag, e2.loadVectorData(t2, this.map.painter), e2.reloadPromise) {
              const t3 = e2.reloadPromise;
              e2.reloadPromise = null, this.loadTile(e2).then(t3.resolve).catch(t3.reject);
            }
          }
          abortTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.abortController && (e2.abortController.abort(), delete e2.abortController), e2.actor && (yield e2.actor.sendAsync({ type: "AT", data: { uid: e2.uid, type: this.type, source: this.id } }));
            }));
          }
          unloadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.unloadVectorData(), e2.actor && (yield e2.actor.sendAsync({ type: "RMT", data: { uid: e2.uid, type: this.type, source: this.id } }));
            }));
          }
          hasTransition() {
            return false;
          }
        }
        class q extends t.E {
          constructor(e2, i2, o2, a2) {
            super(), this.id = e2, this.dispatcher = o2, this.setEventedParent(a2), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = true, this.scheme = "xyz", this.tileSize = 512, this._loaded = false, this._options = t.e({ type: "raster" }, i2), t.e(this, t.V(i2, ["url", "scheme", "tileSize"]));
          }
          load() {
            return t._(this, arguments, void 0, (function* (e2 = false) {
              this._loaded = false, this.fire(new t.n("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
              try {
                const i2 = yield U(this._options, this.map._requestManager, this._tileJSONRequest, this.map._ownerWindow);
                this._tileJSONRequest = null, this._loaded = true, i2 && (t.e(this, i2), i2.bounds && (this.tileBounds = new V(i2.bounds, this.minzoom, this.maxzoom)), this.fire(new t.n("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new t.n("data", { dataType: "source", sourceDataType: "content", sourceDataChanged: e2 })));
              } catch (e3) {
                this._tileJSONRequest = null, this._loaded = true, t.$(e3) || this.fire(new t.l(t.d(e3)));
              }
            }));
          }
          loaded() {
            return this._loaded;
          }
          onAdd(e2) {
            this.map = e2, this.load();
          }
          onRemove() {
            this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
          }
          setSourceProperty(e2) {
            this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null), e2(), this.load(true);
          }
          setTiles(e2) {
            return this.setSourceProperty((() => {
              this._options.tiles = e2;
            })), this;
          }
          setUrl(e2) {
            return this.setSourceProperty((() => {
              this.url = e2, this._options.url = e2;
            })), this;
          }
          serialize() {
            return t.e({}, this._options);
          }
          hasTile(e2) {
            return !this.tileBounds || this.tileBounds.contains(e2.canonical);
          }
          loadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              const i2 = e2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
              e2.abortController = new AbortController();
              try {
                const o2 = yield u.getImage(yield this.map._requestManager.transformRequest(i2, "Tile"), e2.abortController, this.map._refreshExpiredTiles);
                if (delete e2.abortController, e2.aborted) return void (e2.state = "unloaded");
                if (null == o2 ? void 0 : o2.data) {
                  this.map._refreshExpiredTiles && (o2.cacheControl || o2.expires) && e2.setExpiryData({ cacheControl: o2.cacheControl, expires: o2.expires });
                  const i3 = this.map.painter.context, a2 = i3.gl, r2 = o2.data;
                  e2.texture = this.map.painter.getTileTexture(r2.width), e2.texture ? e2.texture.update(r2, { useMipmap: true }) : (e2.texture = new t.T(i3, r2, a2.RGBA, { useMipmap: true }), e2.texture.bind(a2.LINEAR, a2.CLAMP_TO_EDGE, a2.LINEAR_MIPMAP_NEAREST)), e2.state = "loaded";
                }
              } catch (t2) {
                if (delete e2.abortController, e2.aborted) e2.state = "unloaded";
                else if (t2) throw e2.state = "errored", t2;
              }
            }));
          }
          abortTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.abortController && (e2.abortController.abort(), delete e2.abortController);
            }));
          }
          unloadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.texture && this.map.painter.saveTileTexture(e2.texture);
            }));
          }
          hasTransition() {
            return false;
          }
        }
        class $ extends q {
          constructor(e2, i2, o2, a2) {
            super(e2, i2, o2, a2), this.type = "raster-dem", this.maxzoom = 22, this._options = t.e({ type: "raster-dem" }, i2), this.encoding = i2.encoding || "mapbox", this.redFactor = i2.redFactor, this.greenFactor = i2.greenFactor, this.blueFactor = i2.blueFactor, this.baseShift = i2.baseShift;
          }
          loadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              const i2 = e2.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), o2 = yield this.map._requestManager.transformRequest(i2, "Tile");
              e2.neighboringTiles = this._getNeighboringTiles(e2.tileID), e2.abortController = new AbortController();
              try {
                const i3 = yield u.getImage(o2, e2.abortController, this.map._refreshExpiredTiles);
                if (delete e2.abortController, e2.aborted) return void (e2.state = "unloaded");
                if (null == i3 ? void 0 : i3.data) {
                  const o3 = i3.data;
                  this.map._refreshExpiredTiles && (i3.cacheControl || i3.expires) && e2.setExpiryData({ cacheControl: i3.cacheControl, expires: i3.expires });
                  const a2 = t.b(o3) && t.a0() ? o3 : yield this.readImageNow(o3), r2 = { type: this.type, uid: e2.uid, source: this.id, rawImageData: a2, encoding: this.encoding, redFactor: this.redFactor, greenFactor: this.greenFactor, blueFactor: this.blueFactor, baseShift: this.baseShift };
                  if (e2.actor && "expired" !== e2.state && "reloading" !== e2.state) return;
                  e2.actor && "expired" !== e2.state || (e2.actor = this.dispatcher.getActor()), e2.dem = yield e2.actor.sendAsync({ type: "LDT", data: r2 }), e2.needsHillshadePrepare = true, e2.needsTerrainPrepare = true, e2.state = "loaded";
                }
              } catch (t2) {
                if (delete e2.abortController, e2.aborted) e2.state = "unloaded";
                else if (t2) throw e2.state = "errored", t2;
              }
            }));
          }
          readImageNow(e2) {
            return t._(this, void 0, void 0, (function* () {
              if ("undefined" != typeof VideoFrame && t.a1()) {
                const i2 = e2.width + 2, o2 = e2.height + 2;
                try {
                  return new t.R({ width: i2, height: o2 }, yield t.a2(e2, -1, -1, i2, o2));
                } catch (e3) {
                }
              }
              return n.getImageData(e2, 1);
            }));
          }
          _getNeighboringTiles(e2) {
            const i2 = e2.canonical, o2 = Math.pow(2, i2.z), a2 = (i2.x - 1 + o2) % o2, r2 = 0 === i2.x ? e2.wrap - 1 : e2.wrap, s2 = (i2.x + 1 + o2) % o2, n2 = i2.x + 1 === o2 ? e2.wrap + 1 : e2.wrap, l2 = {};
            return l2[new t.a3(e2.overscaledZ, r2, i2.z, a2, i2.y).key] = { backfilled: false }, l2[new t.a3(e2.overscaledZ, n2, i2.z, s2, i2.y).key] = { backfilled: false }, i2.y > 0 && (l2[new t.a3(e2.overscaledZ, r2, i2.z, a2, i2.y - 1).key] = { backfilled: false }, l2[new t.a3(e2.overscaledZ, e2.wrap, i2.z, i2.x, i2.y - 1).key] = { backfilled: false }, l2[new t.a3(e2.overscaledZ, n2, i2.z, s2, i2.y - 1).key] = { backfilled: false }), i2.y + 1 < o2 && (l2[new t.a3(e2.overscaledZ, r2, i2.z, a2, i2.y + 1).key] = { backfilled: false }, l2[new t.a3(e2.overscaledZ, e2.wrap, i2.z, i2.x, i2.y + 1).key] = { backfilled: false }, l2[new t.a3(e2.overscaledZ, n2, i2.z, s2, i2.y + 1).key] = { backfilled: false }), l2;
          }
          unloadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.demTexture && this.map.painter.saveTileTexture(e2.demTexture), e2.fbo && (e2.fbo.destroy(), delete e2.fbo), e2.dem && delete e2.dem, delete e2.neighboringTiles, e2.state = "unloaded", e2.actor && (yield e2.actor.sendAsync({ type: "RDT", data: { type: this.type, uid: e2.uid, source: this.id } }));
            }));
          }
        }
        function H(e2, t2) {
          return t2 ? e2.properties[t2] : e2.id;
        }
        function X(e2, t2) {
          const i2 = { id: e2.id };
          if (t2.removeAllProperties && (delete e2.removeProperties, delete e2.addOrUpdateProperties, delete t2.removeProperties), t2.removeProperties) for (const i3 of t2.removeProperties) {
            const t3 = e2.addOrUpdateProperties.findIndex(((e3) => e3.key === i3));
            t3 > -1 && e2.addOrUpdateProperties.splice(t3, 1);
          }
          return (e2.removeAllProperties || t2.removeAllProperties) && (i2.removeAllProperties = true), (e2.removeProperties || t2.removeProperties) && (i2.removeProperties = [...e2.removeProperties || [], ...t2.removeProperties || []]), (e2.addOrUpdateProperties || t2.addOrUpdateProperties) && (i2.addOrUpdateProperties = [...e2.addOrUpdateProperties || [], ...t2.addOrUpdateProperties || []]), (e2.newGeometry || t2.newGeometry) && (i2.newGeometry = t2.newGeometry || e2.newGeometry), i2;
        }
        function K(e2) {
          var t2, i2;
          if (!e2) return {};
          const o2 = {};
          return o2.removeAll = e2.removeAll, o2.remove = new Set(e2.remove || []), o2.add = new Map(null === (t2 = e2.add) || void 0 === t2 ? void 0 : t2.map(((e3) => [e3.id, e3]))), o2.update = new Map(null === (i2 = e2.update) || void 0 === i2 ? void 0 : i2.map(((e3) => [e3.id, e3]))), o2;
        }
        function Y(e2) {
          return e2 && 0 !== e2.length ? "number" == typeof e2[0] ? [e2] : e2.flatMap(((e3) => Y(e3))) : [];
        }
        function Q(e2) {
          return "GeometryCollection" === e2.type ? e2.geometries.flatMap(((e3) => Q(e3))) : Y(e2.coordinates);
        }
        function J(e2) {
          const t2 = new G();
          let i2;
          switch (e2.type) {
            case "FeatureCollection":
              i2 = e2.features.flatMap(((e3) => Q(e3.geometry)));
              break;
            case "Feature":
              i2 = Q(e2.geometry);
              break;
            default:
              i2 = Q(e2);
          }
          if (0 === i2.length) return t2;
          for (const e3 of i2) {
            const [i3, o2] = e3;
            t2.extend([i3, o2]);
          }
          return t2;
        }
        class ee extends t.E {
          constructor(e2, i2, o2, a2) {
            super(), this.id = e2, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = true, this.reparseOverscaled = true, this._removed = false, this._isUpdatingWorker = false, this._pendingWorkerUpdate = { data: i2.data }, this.actor = o2.getActor(), this.setEventedParent(a2), this._data = "string" == typeof i2.data ? { url: i2.data } : { geojson: i2.data }, this._options = t.e({}, i2), this._collectResourceTiming = i2.collectResourceTiming, void 0 !== i2.maxzoom && (this.maxzoom = i2.maxzoom), i2.type && (this.type = i2.type), i2.attribution && (this.attribution = i2.attribution), this.promoteId = i2.promoteId, void 0 !== i2.clusterMaxZoom && this.maxzoom <= i2.clusterMaxZoom && t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i2.clusterMaxZoom}".`), this.workerOptions = t.e({ source: this.id, geojsonVtOptions: { buffer: this._pixelsToTileUnits(void 0 !== i2.buffer ? i2.buffer : 128), tolerance: this._pixelsToTileUnits(void 0 !== i2.tolerance ? i2.tolerance : 0.375), extent: t.a6, maxZoom: this.maxzoom, lineMetrics: i2.lineMetrics || false, generateId: i2.generateId || false, promoteId: "string" == typeof i2.promoteId ? i2.promoteId : void 0, cluster: i2.cluster || false, clusterOptions: { maxZoom: this._getClusterMaxZoom(i2.clusterMaxZoom), minPoints: Math.max(2, i2.clusterMinPoints || 2), extent: t.a6, radius: this._pixelsToTileUnits(i2.clusterRadius || 50), log: false, generateId: i2.generateId || false } }, clusterProperties: i2.clusterProperties, filter: i2.filter }, i2.workerOptions);
          }
          _hasPendingWorkerUpdate() {
            return void 0 !== this._pendingWorkerUpdate.data || void 0 !== this._pendingWorkerUpdate.diff || this._pendingWorkerUpdate.updateCluster;
          }
          _pixelsToTileUnits(e2) {
            return e2 * (t.a6 / this.tileSize);
          }
          _getClusterMaxZoom(e2) {
            const i2 = e2 ? Math.round(e2) : this.maxzoom - 1;
            return Number.isInteger(e2) || void 0 === e2 || t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e2}" rounded to "${i2}"`), i2;
          }
          load() {
            return t._(this, void 0, void 0, (function* () {
              yield this._updateWorkerData();
            }));
          }
          onAdd(e2) {
            this.map = e2, this.load();
          }
          setData(e2, t2) {
            this._data = "string" == typeof e2 ? { url: e2 } : { geojson: e2 }, this._pendingWorkerUpdate = { data: e2 };
            const i2 = this._updateWorkerData();
            return t2 ? i2 : this;
          }
          updateData(e2, t2) {
            this._pendingWorkerUpdate.diff = (function(e3, t3) {
              if (!e3) return t3 || {};
              if (!t3) return e3 || {};
              const i3 = K(e3), o2 = K(t3);
              !(function(e4, t4) {
                t4.removeAll && (e4.add.clear(), e4.update.clear(), e4.remove.clear(), t4.remove.clear());
                for (const i4 of t4.remove) e4.add.delete(i4), e4.update.delete(i4);
                for (const [i4, o3] of t4.update) {
                  const a3 = e4.update.get(i4);
                  a3 && (t4.update.set(i4, X(a3, o3)), e4.update.delete(i4));
                }
              })(i3, o2);
              const a2 = {};
              if ((i3.removeAll || o2.removeAll) && (a2.removeAll = true), a2.remove = /* @__PURE__ */ new Set([...i3.remove, ...o2.remove]), a2.add = new Map([...i3.add, ...o2.add]), a2.update = new Map([...i3.update, ...o2.update]), a2.remove.size && a2.add.size) for (const e4 of a2.add.keys()) a2.remove.delete(e4);
              return (function(e4) {
                const t4 = {};
                return e4.removeAll && (t4.removeAll = e4.removeAll), e4.remove && (t4.remove = Array.from(e4.remove)), e4.add && (t4.add = Array.from(e4.add.values())), e4.update && (t4.update = Array.from(e4.update.values())), t4;
              })(a2);
            })(this._pendingWorkerUpdate.diff, e2);
            const i2 = this._updateWorkerData();
            return t2 ? i2 : this;
          }
          getData() {
            return t._(this, void 0, void 0, (function* () {
              return this._data.url && (yield this.once("data")), this._data.geojson ? this._data.geojson : { type: "FeatureCollection", features: Array.from(this._data.updateable.values()) };
            }));
          }
          getBounds() {
            return t._(this, void 0, void 0, (function* () {
              return J(yield this.getData());
            }));
          }
          setClusterOptions(e2) {
            return this.workerOptions.geojsonVtOptions.cluster = e2.cluster, void 0 !== e2.clusterRadius && (this.workerOptions.geojsonVtOptions.clusterOptions.radius = this._pixelsToTileUnits(e2.clusterRadius)), void 0 !== e2.clusterMaxZoom && (this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom = this._getClusterMaxZoom(e2.clusterMaxZoom)), this._pendingWorkerUpdate.updateCluster = true, this._updateWorkerData(), this;
          }
          getClusterExpansionZoom(e2) {
            return this.actor.sendAsync({ type: "GCEZ", data: { type: this.type, clusterId: e2, source: this.id } });
          }
          getClusterChildren(e2) {
            return this.actor.sendAsync({ type: "GCC", data: { type: this.type, clusterId: e2, source: this.id } });
          }
          getClusterLeaves(e2, t2, i2) {
            return this.actor.sendAsync({ type: "GCL", data: { type: this.type, source: this.id, clusterId: e2, limit: t2, offset: i2 } });
          }
          _updateWorkerData() {
            return t._(this, void 0, void 0, (function* () {
              if (this._isUpdatingWorker) return;
              if (!this._hasPendingWorkerUpdate()) return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);
              const { data: e2, diff: i2, updateCluster: o2 } = this._pendingWorkerUpdate, a2 = this._getLoadGeoJSONParameters(e2, i2, o2);
              void 0 !== e2 ? this._pendingWorkerUpdate.data = void 0 : i2 ? this._pendingWorkerUpdate.diff = void 0 : o2 && (this._pendingWorkerUpdate.updateCluster = void 0), yield this._dispatchWorkerUpdate(a2);
            }));
          }
          _getLoadGeoJSONParameters(e2, i2, o2) {
            return t._(this, void 0, void 0, (function* () {
              const a2 = t.e({ type: this.type }, this.workerOptions);
              return "string" == typeof e2 ? (a2.request = yield this.map._requestManager.transformRequest(n.resolveURL(e2), "Source"), a2.request.collectResourceTiming = this._collectResourceTiming, a2) : void 0 !== e2 ? (a2.data = e2, a2) : i2 ? (a2.dataDiff = i2, a2) : o2 ? (a2.updateCluster = true, a2) : void 0;
            }));
          }
          _dispatchWorkerUpdate(e2) {
            return t._(this, void 0, void 0, (function* () {
              this._isUpdatingWorker = true, this.fire(new t.n("dataloading", { dataType: "source" }));
              try {
                const i2 = yield e2, o2 = yield this.actor.sendAsync({ type: "LD", data: i2 });
                if (this._isUpdatingWorker = false, this._removed || o2.abandoned) return void this.fire(new t.n("dataabort", { dataType: "source" }));
                o2.data && (this._data = { geojson: o2.data });
                const a2 = this._applyDiffToSource(i2.dataDiff), r2 = this._getShouldReloadTileOptions(a2), s2 = { dataType: "source" };
                this._applyResourceTiming(s2, o2), this.fire(new t.n("data", Object.assign(Object.assign({}, s2), { sourceDataType: "metadata" }))), this.fire(new t.n("data", Object.assign(Object.assign({}, s2), { sourceDataType: "content", shouldReloadTileOptions: r2 })));
              } catch (e3) {
                if (this._isUpdatingWorker = false, this._removed) return void this.fire(new t.n("dataabort", { dataType: "source" }));
                this.fire(new t.l(t.d(e3)));
              } finally {
                this._hasPendingWorkerUpdate() && this._updateWorkerData();
              }
            }));
          }
          _applyResourceTiming(e2, i2) {
            var o2;
            if (!this._collectResourceTiming) return;
            const a2 = null === (o2 = i2.resourceTiming) || void 0 === o2 ? void 0 : o2[this.id];
            if (!a2) return;
            const r2 = a2.slice(0);
            (null == r2 ? void 0 : r2.length) && t.e(e2, { resourceTiming: r2 });
          }
          _applyDiffToSource(e2) {
            if (!e2) return;
            const t2 = "string" == typeof this.promoteId ? this.promoteId : void 0;
            if (!this._data.url && !this._data.updateable) {
              const e3 = (function(e4, t3) {
                const i3 = /* @__PURE__ */ new Map();
                if (null == e4) return i3;
                if (null == e4.type) return i3;
                if ("Feature" === e4.type) {
                  const o2 = H(e4, t3);
                  if (null == o2) return;
                  return i3.set(o2, e4), i3;
                }
                if ("FeatureCollection" === e4.type) {
                  const o2 = /* @__PURE__ */ new Set();
                  for (const a2 of e4.features) {
                    const e5 = H(a2, t3);
                    if (null == e5) return;
                    if (o2.has(e5)) return;
                    o2.add(e5), i3.set(e5, a2);
                  }
                  return i3;
                }
              })(this._data.geojson, t2);
              if (!e3) throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);
              this._data = { updateable: e3 };
            }
            if (!this._data.updateable) return;
            const i2 = (function(e3, t3, i3) {
              var o2, a2;
              const r2 = [];
              if (t3.removeAll) e3.clear();
              else if (t3.remove) for (const i4 of t3.remove) {
                const t4 = e3.get(i4);
                t4 && (r2.push(t4.geometry), e3.delete(i4));
              }
              if (t3.add) for (const o3 of t3.add) {
                const t4 = H(o3, i3);
                if (null == t4) continue;
                const a3 = e3.get(t4);
                a3 && r2.push(a3.geometry), r2.push(o3.geometry), e3.set(t4, o3);
              }
              if (t3.update) for (const i4 of t3.update) {
                const t4 = e3.get(i4.id);
                if (!t4) continue;
                const s2 = !!i4.newGeometry, n2 = i4.removeAllProperties || (null === (o2 = i4.removeProperties) || void 0 === o2 ? void 0 : o2.length) > 0 || (null === (a2 = i4.addOrUpdateProperties) || void 0 === a2 ? void 0 : a2.length) > 0;
                if (!s2 && !n2) continue;
                r2.push(t4.geometry);
                const l2 = Object.assign({}, t4);
                if (e3.set(i4.id, l2), s2 && (r2.push(i4.newGeometry), l2.geometry = i4.newGeometry), n2) {
                  if (l2.properties = i4.removeAllProperties ? {} : Object.assign({}, l2.properties || {}), i4.removeProperties) for (const e4 of i4.removeProperties) delete l2.properties[e4];
                  if (i4.addOrUpdateProperties) for (const { key: e4, value: t5 } of i4.addOrUpdateProperties) l2.properties[e4] = t5;
                }
              }
              return r2;
            })(this._data.updateable, e2, t2);
            return e2.removeAll || this._options.cluster ? void 0 : i2;
          }
          _getShouldReloadTileOptions(e2) {
            if (e2) return { affectedBounds: e2.filter(Boolean).map(((e3) => J(e3))) };
          }
          shouldReloadTile(e2, { affectedBounds: i2 }) {
            if ("loading" === e2.state) return true;
            if ("unloaded" === e2.state) return false;
            const { buffer: o2, extent: a2 } = this.workerOptions.geojsonVtOptions, r2 = (function({ x: e3, y: i3, z: o3 }, a3 = 0) {
              const r3 = t.a4((e3 - a3) / Math.pow(2, o3)), s2 = t.a5((i3 + 1 + a3) / Math.pow(2, o3)), n2 = t.a4((e3 + 1 + a3) / Math.pow(2, o3)), l2 = t.a5((i3 - a3) / Math.pow(2, o3));
              return new G([r3, s2], [n2, l2]);
            })(e2.tileID.canonical, o2 / a2);
            for (const e3 of i2) if (r2.intersects(e3)) return true;
            return false;
          }
          loaded() {
            return !this._isUpdatingWorker && !this._hasPendingWorkerUpdate();
          }
          loadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              const t2 = e2.actor ? "RT" : "LT";
              e2.actor = this.actor;
              const i2 = { type: this.type, uid: e2.uid, tileID: e2.tileID, zoom: e2.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 };
              e2.abortController = new AbortController();
              const o2 = yield this.actor.sendAsync({ type: t2, data: i2 }, e2.abortController);
              delete e2.abortController, e2.unloadVectorData(), e2.aborted || e2.loadVectorData(o2, this.map.painter, "RT" === t2);
            }));
          }
          abortTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.abortController && (e2.abortController.abort(), delete e2.abortController), e2.aborted = true;
            }));
          }
          unloadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              e2.unloadVectorData(), yield this.actor.sendAsync({ type: "RMT", data: { uid: e2.uid, type: this.type, source: this.id } });
            }));
          }
          onRemove() {
            this._removed = true, this.actor.sendAsync({ type: "RS", data: { type: this.type, source: this.id } });
          }
          serialize() {
            return t.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 false;
          }
        }
        class te extends t.E {
          constructor(e2, t2, i2, o2) {
            super(), this.flippedWindingOrder = false, this.id = e2, this.dispatcher = i2, this.coordinates = t2.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = false, this.setEventedParent(o2), this.options = t2;
          }
          load(e2) {
            return t._(this, void 0, void 0, (function* () {
              this._loaded = false, this.fire(new t.n("dataloading", { dataType: "source" })), this.url = this.options.url, this._request = new AbortController();
              try {
                const t2 = yield u.getImage(yield this.map._requestManager.transformRequest(this.url, "Image"), this._request);
                this._request = null, this._loaded = true, (null == t2 ? void 0 : t2.data) && (this.image = t2.data, e2 && (this.coordinates = e2), this._finishLoading());
              } catch (e3) {
                this._request = null, this._loaded = true, t.$(e3) || this.fire(new t.l(t.d(e3)));
              }
            }));
          }
          loaded() {
            return this._loaded;
          }
          updateImage(e2) {
            return e2.url ? (this._request && (this._request.abort(), this._request = null), this.options.url = e2.url, this.load(e2.coordinates).finally((() => this.texture = null)), this) : this;
          }
          _finishLoading() {
            this.map && (this.setCoordinates(this.coordinates), this.fire(new t.n("data", { dataType: "source", sourceDataType: "metadata" })));
          }
          onAdd(e2) {
            this.map = e2, this.load();
          }
          onRemove() {
            this._request && (this._request.abort(), this._request = null);
          }
          setCoordinates(e2) {
            this.coordinates = e2;
            const i2 = e2.map(t.a7.fromLngLat);
            var o2;
            return this.tileID = (function(e3) {
              const i3 = t.a8.fromPoints(e3), o3 = i3.width(), a2 = i3.height(), r2 = Math.max(o3, a2), s2 = Math.max(0, Math.floor(-Math.log(r2) / Math.LN2)), n2 = Math.pow(2, s2);
              return new t.aa(s2, Math.floor((i3.minX + i3.maxX) / 2 * n2), Math.floor((i3.minY + i3.maxY) / 2 * n2));
            })(i2), this.terrainTileRanges = this._getOverlappingTileRanges(i2), this.minzoom = this.maxzoom = this.tileID.z, this.tileCoords = i2.map(((e3) => this.tileID.getTilePoint(e3)._round())), this.flippedWindingOrder = ((o2 = this.tileCoords)[1].x - o2[0].x) * (o2[2].y - o2[0].y) - (o2[1].y - o2[0].y) * (o2[2].x - o2[0].x) < 0, this.fire(new t.n("data", { dataType: "source", sourceDataType: "content" })), this;
          }
          prepare() {
            if (0 === Object.keys(this.tiles).length || !this.image) return;
            const e2 = this.map.painter.context, i2 = e2.gl;
            this.texture || (this.texture = new t.T(e2, this.image, i2.RGBA), this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE));
            let o2 = false;
            for (const e3 in this.tiles) {
              const t2 = this.tiles[e3];
              "loaded" !== t2.state && (t2.state = "loaded", t2.texture = this.texture, o2 = true);
            }
            o2 && this.fire(new t.n("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
          }
          loadTile(e2) {
            return t._(this, void 0, void 0, (function* () {
              var t2;
              (null === (t2 = this.tileID) || void 0 === t2 ? void 0 : t2.equals(e2.tileID.canonical)) ? (this.tiles[String(e2.tileID.wrap)] = e2, e2.buckets = {}) : e2.state = "errored";
            }));
          }
          serialize() {
            return { type: "image", url: this.options.url, coordinates: this.coordinates };
          }
          hasTransition() {
            return false;
          }
          _getOverlappingTileRanges(e2) {
            const { minX: i2, minY: o2, maxX: a2, maxY: r2 } = t.a8.fromPoints(e2), s2 = {};
            for (let e3 = 0; e3 <= t.a9; e3++) {
              const t2 = Math.pow(2, e3), n2 = Math.floor(i2 * t2), l2 = Math.floor(o2 * t2), c2 = Math.floor(a2 * t2), h2 = Math.floor(r2 * t2), u2 = (n2 % t2 + t2) % t2, d2 = c2 % t2, _2 = Math.floor(n2 / t2), p2 = Math.floor(c2 / t2);
              s2[e3] = { minWrap: _2, maxWrap: p2, minTileXWrapped: u2, maxTileXWrapped: d2, minTileY: l2, maxTileY: h2 };
            }
            return s2;
          }
        }
        class ie extends te {
          constructor(e2, t2, i2, o2) {
            super(e2, t2, i2, o2), this._onPlayingHandler = () => {
              var e3;
              null === (e3 = this.map) || void 0 === e3 || e3.triggerRepaint();
            }, this.roundZoom = true, this.type = "video", this.options = t2;
          }
          load() {
            return t._(this, void 0, void 0, (function* () {
              this._loaded = false;
              const e2 = this.options;
              this.urls = [];
              for (const t2 of e2.urls) this.urls.push((yield this.map._requestManager.transformRequest(t2, "Source")).url);
              try {
                const e3 = yield t.ab(this.urls);
                if (this._loaded = true, !e3) return;
                this.video = e3, this.video.loop = true, this.video.addEventListener("playing", this._onPlayingHandler), this.map && this.video.play(), this._finishLoading();
              } catch (e3) {
                this.fire(new t.l(t.d(e3)));
              }
            }));
          }
          pause() {
            this.video && this.video.pause();
          }
          play() {
            this.video && this.video.play();
          }
          seek(e2) {
            if (this.video) {
              const i2 = this.video.seekable;
              e2 < i2.start(0) || e2 > i2.end(0) ? this.fire(new t.l(new t.ac(`sources.${this.id}`, null, `Playback for this video can be set only between the ${i2.start(0)} and ${i2.end(0)}-second mark.`))) : this.video.currentTime = e2;
            }
          }
          getVideo() {
            return this.video;
          }
          onAdd(e2) {
            this.map || (this.map = e2, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));
          }
          onRemove() {
            super.onRemove(), this.video && (this.video.removeEventListener("playing", this._onPlayingHandler), this.video.pause());
          }
          prepare() {
            if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) return;
            const e2 = this.map.painter.context, i2 = e2.gl;
            this.texture ? this.video.paused || (this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE), i2.texSubImage2D(i2.TEXTURE_2D, 0, 0, 0, i2.RGBA, i2.UNSIGNED_BYTE, this.video)) : (this.texture = new t.T(e2, this.video, i2.RGBA), this.texture.bind(i2.LINEAR, i2.CLAMP_TO_EDGE));
            let o2 = false;
            for (const e3 in this.tiles) {
              const t2 = this.tiles[e3];
              "loaded" !== t2.state && (t2.state = "loaded", t2.texture = this.texture, o2 = true);
            }
            o2 && this.fire(new t.n("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 oe extends te {
          constructor(e2, i2, o2, a2) {
            super(e2, i2, o2, a2), i2.coordinates ? Array.isArray(i2.coordinates) && 4 === i2.coordinates.length && !i2.coordinates.some(((e3) => !Array.isArray(e3) || 2 !== e3.length || e3.some(((e4) => "number" != typeof e4)))) || this.fire(new t.l(new t.ac(`sources.${e2}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new t.l(new t.ac(`sources.${e2}`, null, 'missing required property "coordinates"'))), i2.animate && "boolean" != typeof i2.animate && this.fire(new t.l(new t.ac(`sources.${e2}`, null, 'optional "animate" property must be a boolean value'))), i2.canvas ? "string" == typeof i2.canvas || i2.canvas instanceof HTMLCanvasElement || this.fire(new t.l(new t.ac(`sources.${e2}`, null, '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new t.l(new t.ac(`sources.${e2}`, null, 'missing required property "canvas"'))), this.options = i2, this.animate = void 0 === i2.animate || i2.animate;
          }
          load() {
            return t._(this, void 0, void 0, (function* () {
              this._loaded = true, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new t.l(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
                this._playing = true, this.map.triggerRepaint();
              }, this.pause = function() {
                this._playing && (this.prepare(), this._playing = false);
              }, this._finishLoading());
            }));
          }
          getCanvas() {
            return this.canvas;
          }
          onAdd(e2) {
            this.map = e2, this.load(), this.canvas && this.animate && this.play();
          }
          onRemove() {
            this.pause();
          }
          prepare() {
            let e2 = false;
            if (this.canvas.width !== this.width && (this.width = this.canvas.width, e2 = true), this.canvas.height !== this.height && (this.height = this.canvas.height, e2 = true), this._hasInvalidDimensions()) return;
            if (0 === Object.keys(this.tiles).length) return;
            const i2 = this.map.painter.context, o2 = i2.gl;
            this.texture ? (e2 || this._playing) && this.texture.update(this.canvas, { premultiply: true }) : (this.texture = new t.T(i2, this.canvas, o2.RGBA, { premultiply: true }), this.texture.bind(o2.LINEAR, o2.CLAMP_TO_EDGE));
            let a2 = false;
            for (const e3 in this.tiles) {
              const t2 = this.tiles[e3];
              "loaded" !== t2.state && (t2.state = "loaded", t2.texture = this.texture, a2 = true);
            }
            a2 && this.fire(new t.n("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 e2 of [this.canvas.width, this.canvas.height]) if (isNaN(e2) || e2 <= 0) return true;
            return false;
          }
        }
        const ae = {}, re = (e2) => {
          switch (e2) {
            case "geojson":
              return ee;
            case "image":
              return te;
            case "raster":
              return q;
            case "raster-dem":
              return $;
            case "vector":
              return W;
            case "video":
              return ie;
            case "canvas":
              return oe;
          }
          return ae[e2];
        }, se = "RTLPluginLoaded";
        class ne extends t.E {
          constructor() {
            super(...arguments), this.status = "unavailable", this.url = null, this.dispatcher = B();
          }
          _syncState(e2) {
            return this.status = e2, this.dispatcher.broadcast("SRPS", { pluginStatus: e2, pluginURL: this.url }).catch(((e3) => {
              throw this.status = "error", e3;
            }));
          }
          getRTLTextPluginStatus() {
            return this.status;
          }
          clearRTLTextPlugin() {
            this.status = "unavailable", this.url = null;
          }
          setRTLTextPlugin(e2) {
            return t._(this, arguments, void 0, (function* (e3, t2 = false) {
              if (this.url) throw new Error("setRTLTextPlugin cannot be called multiple times.");
              if (this.url = n.resolveURL(e3), !this.url) throw new Error(`requested url ${e3} is invalid`);
              if ("unavailable" === this.status) {
                if (!t2) return this._requestImport();
                this.status = "deferred", this._syncState(this.status);
              } else if ("requested" === this.status) return this._requestImport();
            }));
          }
          _requestImport() {
            return t._(this, void 0, void 0, (function* () {
              yield this._syncState("loading"), this.status = "loaded", this.fire(new t.n(se));
            }));
          }
          lazyLoad() {
            "unavailable" === this.status ? this.status = "requested" : "deferred" === this.status && this._requestImport();
          }
        }
        let le = null;
        function ce() {
          return le || (le = new ne()), le;
        }
        var he, ue;
        !(function(e2) {
          e2[e2.Base = 0] = "Base", e2[e2.Parent = 1] = "Parent";
        })(he || (he = {})), (function(e2) {
          e2[e2.Departing = 0] = "Departing", e2[e2.Incoming = 1] = "Incoming";
        })(ue || (ue = {}));
        class de {
          constructor(e2, i2) {
            this.timeAdded = 0, this.fadeEndTime = 0, this.fadeOpacity = 1, this.tileID = e2, this.uid = t.ad(), this.uses = 0, this.tileSize = i2, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = false, this.hasRTLText = false, this.dependencies = {}, this.rtt = [], this.rttFingerprint = {}, this.expiredRequestCount = 0, this.state = "loading";
          }
          isRenderable(e2) {
            return this.hasData() && (!this.fadeEndTime || this.fadeOpacity > 0) && (e2 || !this.holdingForSymbolFade());
          }
          setCrossFadeLogic({ fadingRole: e2, fadingDirection: t2, fadingParentID: i2, fadeEndTime: o2 }) {
            this.resetFadeLogic(), this.fadingRole = e2, this.fadingDirection = t2, this.fadingParentID = i2, this.fadeEndTime = o2;
          }
          setSelfFadeLogic(e2) {
            this.resetFadeLogic(), this.selfFading = true, this.fadeEndTime = e2;
          }
          resetFadeLogic() {
            this.fadingRole = null, this.fadingDirection = null, this.fadingParentID = null, this.selfFading = false, this.timeAdded = c(), this.fadeEndTime = 0, this.fadeOpacity = 1;
          }
          wasRequested() {
            return "errored" === this.state || "loaded" === this.state || "reloading" === this.state;
          }
          clearTextures(e2) {
            this.demTexture && e2.saveTileTexture(this.demTexture), this.demTexture = null;
          }
          loadVectorData(e2, i2, o2) {
            if (true !== (null == e2 ? void 0 : e2.etagUnmodified)) if (this.hasData() && this.unloadVectorData(), this.state = "loaded", e2) {
              e2.featureIndex && (this.latestFeatureIndex = e2.featureIndex, e2.rawTileData ? (this.latestRawTileData = e2.rawTileData, this.latestEncoding = e2.encoding, this.latestFeatureIndex.rawTileData = e2.rawTileData, this.latestFeatureIndex.encoding = e2.encoding) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData, this.latestFeatureIndex.encoding = this.latestEncoding)), this.collisionBoxArray = e2.collisionBoxArray, this.buckets = (function(e3, t2) {
                const i3 = {};
                if (!t2) return i3;
                for (const o3 of e3) {
                  const e4 = o3.layerIds.map(((e5) => t2.getLayer(e5))).filter(Boolean);
                  if (0 !== e4.length) {
                    o3.layers = e4, o3.stateDependentLayerIds && (o3.stateDependentLayers = o3.stateDependentLayerIds.map(((t3) => e4.filter(((e5) => e5.id === t3))[0])));
                    for (const t3 of e4) i3[t3.id] = o3;
                  }
                }
                return i3;
              })(e2.buckets, null == i2 ? void 0 : i2.style), this.hasSymbolBuckets = false;
              for (const e3 in this.buckets) {
                const i3 = this.buckets[e3];
                if (i3 instanceof t.af) {
                  if (this.hasSymbolBuckets = true, !o2) break;
                  i3.justReloaded = true;
                }
              }
              if (this.hasRTLText = false, this.hasSymbolBuckets) for (const e3 in this.buckets) {
                const i3 = this.buckets[e3];
                if (i3 instanceof t.af && i3.hasRTLText) {
                  this.hasRTLText = true, ce().lazyLoad();
                  break;
                }
              }
              this.queryPadding = 0;
              for (const e3 in this.buckets) {
                const t2 = this.buckets[e3];
                this.queryPadding = Math.max(this.queryPadding, i2.style.getLayer(e3).queryRadius(t2));
              }
              e2.imageAtlas && (this.imageAtlas = e2.imageAtlas), e2.glyphAtlasImage && (this.glyphAtlasImage = e2.glyphAtlasImage), this.dashPositions = e2.dashPositions;
            } else this.collisionBoxArray = new t.ae();
            else this.state = "loaded";
          }
          unloadVectorData() {
            for (const e2 in this.buckets) this.buckets[e2].destroy();
            this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.imageAtlas = null, this.dashPositions = null, this.latestFeatureIndex = null, this.state = "unloaded";
          }
          getBucket(e2) {
            return this.buckets[e2.id];
          }
          upload(e2) {
            for (const t2 in this.buckets) {
              const i3 = this.buckets[t2];
              i3.uploadPending() && i3.upload(e2);
            }
            const i2 = e2.gl;
            this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new t.T(e2, this.imageAtlas.image, i2.RGBA), this.imageAtlas.uploaded = true), this.glyphAtlasImage && (this.glyphAtlasTexture = new t.T(e2, this.glyphAtlasImage, i2.ALPHA), this.glyphAtlasImage = null);
          }
          prepare(e2) {
            this.imageAtlas && this.imageAtlas.patchUpdatedImages(e2, this.imageAtlasTexture);
          }
          queryRenderedFeatures(e2, t2, i2, o2, a2, r2, s2, n2, l2, c2, h2) {
            var u2;
            return (null === (u2 = this.latestFeatureIndex) || void 0 === u2 ? void 0 : u2.rawTileData) ? this.latestFeatureIndex.query({ queryGeometry: o2, cameraQueryGeometry: a2, scale: r2, tileSize: this.tileSize, pixelPosMatrix: c2, transform: n2, params: s2, queryPadding: this.queryPadding * l2, getElevation: h2 }, e2, t2, i2) : {};
          }
          querySourceFeatures(e2, i2) {
            const o2 = this.latestFeatureIndex;
            if (!(null == o2 ? void 0 : o2.rawTileData)) return;
            const a2 = o2.loadVTLayers(), r2 = (null == i2 ? void 0 : i2.sourceLayer) ? i2.sourceLayer : "", s2 = a2[t.ag] || a2[r2];
            if (!s2) return;
            const n2 = t.ah(null == i2 ? void 0 : i2.filter, null == i2 ? void 0 : i2.globalState), { z: l2, x: c2, y: h2 } = this.tileID.canonical, u2 = { z: l2, x: c2, y: h2 };
            for (let i3 = 0; i3 < s2.length; i3++) {
              const a3 = s2.feature(i3);
              if (n2.needGeometry) {
                const e3 = t.ai(a3, true);
                if (!n2.filter(new t.J(this.tileID.overscaledZ), e3, this.tileID.canonical)) continue;
              } else if (!n2.filter(new t.J(this.tileID.overscaledZ), a3)) continue;
              const d2 = o2.getId(a3, r2), _2 = new t.aj(a3, l2, c2, h2, d2);
              _2.tile = u2, e2.push(_2);
            }
          }
          hasData() {
            return "loaded" === this.state || "reloading" === this.state || "expired" === this.state;
          }
          patternsLoaded() {
            return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;
          }
          setExpiryData(e2) {
            const i2 = this.expirationTime;
            if (e2.cacheControl) {
              const i3 = t.ak(e2.cacheControl);
              i3["max-age"] && (this.expirationTime = Date.now() + 1e3 * i3["max-age"]);
            } else e2.expires && (this.expirationTime = new Date(e2.expires).getTime());
            if (this.expirationTime) {
              const e3 = Date.now();
              let t2 = false;
              if (this.expirationTime > e3) t2 = false;
              else if (i2) if (this.expirationTime < i2) t2 = true;
              else {
                const o2 = this.expirationTime - i2;
                o2 ? this.expirationTime = e3 + Math.max(o2, 3e4) : t2 = true;
              }
              else t2 = true;
              t2 ? (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 - (/* @__PURE__ */ new Date()).getTime(), Math.pow(2, 31) - 1);
          }
          setFeatureState(e2, i2) {
            var o2, a2, r2;
            if (!(null === (o2 = this.latestFeatureIndex) || void 0 === o2 ? void 0 : o2.rawTileData) || 0 === Object.keys(e2).length) return;
            const s2 = this.latestFeatureIndex.loadVTLayers();
            for (const o3 in this.buckets) {
              if (!i2.style.hasLayer(o3)) continue;
              const n2 = this.buckets[o3], l2 = n2.layers[0].sourceLayer || t.ag, c2 = s2[l2], h2 = e2[l2];
              if (!c2 || !h2 || 0 === Object.keys(h2).length) continue;
              n2.update(h2, c2, (null === (a2 = this.imageAtlas) || void 0 === a2 ? void 0 : a2.patternPositions) || {}, this.dashPositions || {});
              const u2 = null === (r2 = null == i2 ? void 0 : i2.style) || void 0 === r2 ? void 0 : r2.getLayer(o3);
              u2 && (this.queryPadding = Math.max(this.queryPadding, u2.queryRadius(n2)));
            }
          }
          holdingForSymbolFade() {
            return void 0 !== this.symbolFadeHoldUntil;
          }
          symbolFadeFinished() {
            return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < c();
          }
          clearSymbolFadeHold() {
            this.symbolFadeHoldUntil = void 0;
          }
          setSymbolHoldDuration(e2) {
            this.symbolFadeHoldUntil = c() + e2;
          }
          setDependencies(e2, t2) {
            const i2 = {};
            for (const e3 of t2) i2[e3] = true;
            this.dependencies[e2] = i2;
          }
          hasDependency(e2, t2) {
            for (const i2 of e2) {
              const e3 = this.dependencies[i2];
              if (e3) {
                for (const i3 of t2) if (e3[i3]) return true;
              }
            }
            return false;
          }
        }
        class _e {
          constructor() {
            this.state = {}, this.stateChanges = {}, this.deletedStates = {}, this.revision = 0;
          }
          updateState(e2, i2, o2) {
            var a2, r2, s2, n2, l2;
            const c2 = String(i2);
            if ((n2 = this.stateChanges)[e2] || (n2[e2] = {}), (l2 = this.stateChanges[e2])[c2] || (l2[c2] = {}), t.e(this.stateChanges[e2][c2], o2), null === this.deletedStates[e2]) {
              this.deletedStates[e2] = {};
              for (const t2 in this.state[e2]) t2 !== c2 && (this.deletedStates[e2][t2] = null);
            } else if (null === (null === (a2 = this.deletedStates[e2]) || void 0 === a2 ? void 0 : a2[c2])) {
              this.deletedStates[e2][c2] = {};
              for (const t2 in this.state[e2][c2]) o2[t2] || (this.deletedStates[e2][c2][t2] = null);
            } else for (const t2 in o2) null === (null === (s2 = null === (r2 = this.deletedStates[e2]) || void 0 === r2 ? void 0 : r2[c2]) || void 0 === s2 ? void 0 : s2[t2]) && delete this.deletedStates[e2][c2][t2];
          }
          removeFeatureState(e2, t2, i2) {
            var o2, a2, r2;
            if (null === this.deletedStates[e2]) return;
            const s2 = String(t2);
            if ((a2 = this.deletedStates)[e2] || (a2[e2] = {}), i2 && void 0 !== t2) null !== this.deletedStates[e2][s2] && ((r2 = this.deletedStates[e2])[s2] || (r2[s2] = {}), this.deletedStates[e2][s2][i2] = null);
            else if (void 0 !== t2) if (null === (o2 = this.stateChanges[e2]) || void 0 === o2 ? void 0 : o2[s2]) for (i2 in this.deletedStates[e2][s2] = {}, this.stateChanges[e2][s2]) this.deletedStates[e2][s2][i2] = null;
            else this.deletedStates[e2][s2] = null;
            else this.deletedStates[e2] = null;
          }
          getState(e2, i2) {
            const o2 = String(i2), a2 = t.e({}, (this.state[e2] || {})[o2], (this.stateChanges[e2] || {})[o2]);
            if (null === this.deletedStates[e2]) return {};
            if (this.deletedStates[e2]) {
              const t2 = this.deletedStates[e2][i2];
              if (null === t2) return {};
              for (const e3 in t2) delete a2[e3];
            }
            return a2;
          }
          initializeTileState(e2, t2) {
            e2.setFeatureState(this.state, t2);
          }
          coalesceChanges(e2, i2) {
            var o2, a2, r2;
            const s2 = {};
            for (const e3 in this.stateChanges) {
              (o2 = this.state)[e3] || (o2[e3] = {});
              const i3 = {};
              for (const o3 in this.stateChanges[e3]) (a2 = this.state[e3])[o3] || (a2[o3] = {}), t.e(this.state[e3][o3], this.stateChanges[e3][o3]), i3[o3] = this.state[e3][o3];
              s2[e3] = i3;
            }
            for (const e3 in this.deletedStates) {
              (r2 = this.state)[e3] || (r2[e3] = {});
              const i3 = {};
              if (null === this.deletedStates[e3]) for (const t2 in this.state[e3]) i3[t2] = {}, this.state[e3][t2] = {};
              else for (const t2 in this.deletedStates[e3]) {
                if (null === this.deletedStates[e3][t2]) this.state[e3][t2] = {};
                else for (const i4 of Object.keys(this.deletedStates[e3][t2])) delete this.state[e3][t2][i4];
                i3[t2] = this.state[e3][t2];
              }
              s2[e3] || (s2[e3] = {}), t.e(s2[e3], i3);
            }
            this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(s2).length && (this.revision++, e2.setFeatureState(s2, i2));
          }
        }
        const pe = 89.25;
        function me(e2, i2) {
          const o2 = t.al(i2.lat, -t.am, t.am);
          return new t.P(t.Z(i2.lng) * e2, t.Y(o2) * e2);
        }
        function fe(e2, i2) {
          return new t.a7(i2.x / e2, i2.y / e2).toLngLat();
        }
        function ge(e2) {
          return e2.cameraToCenterDistance * Math.min(0.85 * Math.tan(t.an(90 - e2.pitch)), Math.tan(t.an(pe - e2.pitch)));
        }
        function ve(e2, i2) {
          const o2 = e2.canonical, a2 = i2 / t.ao(o2.z), r2 = o2.x + Math.pow(2, o2.z) * e2.wrap, s2 = t.ap(new Float64Array(16));
          return t.Q(s2, s2, [r2 * a2, o2.y * a2, 0]), t.S(s2, s2, [a2 / t.a6, a2 / t.a6, 1]), s2;
        }
        function xe(e2, i2, o2, a2, r2) {
          const s2 = t.a7.fromLngLat(e2, i2), n2 = r2 * t.aq(1, e2.lat), { x: l2, y: c2, z: h2 } = be(o2, a2);
          return new t.a7(s2.x + n2 * -l2, s2.y + n2 * -c2, s2.z + n2 * -h2);
        }
        function be(e2, i2) {
          const o2 = t.an(e2), a2 = t.an(i2), r2 = Math.cos(-o2), s2 = Math.sin(o2);
          return { x: s2 * Math.sin(a2), y: -s2 * Math.cos(a2), z: r2 };
        }
        function ye(e2, t2, i2) {
          const o2 = t2.intersectsFrustum(e2);
          if (!i2 || 0 === o2) return o2;
          const a2 = t2.intersectsPlane(i2);
          return 0 === a2 ? 0 : 2 === o2 && 2 === a2 ? 2 : 1;
        }
        function we(e2, t2, i2) {
          let o2 = 0;
          const a2 = (i2 - t2) / 10;
          for (let r2 = 0; r2 < 10; r2++) o2 += a2 * Math.pow(Math.cos(t2 + (r2 + 0.5) / 10 * (i2 - t2)), e2);
          return o2;
        }
        function Te(e2, i2) {
          return function(o2, a2, r2, s2, n2) {
            const l2 = 2 * ((e2 - 1) / t.ar(Math.cos(t.an(pe - n2)) / Math.cos(t.an(pe))) - 1), c2 = Math.acos(r2 / s2), h2 = 2 * we(l2 - 1, 0, t.an(n2 / 2)), u2 = Math.min(t.an(pe), c2 + t.an(n2 / 2)), d2 = we(l2 - 1, Math.min(u2, c2 - t.an(n2 / 2)), u2), _2 = Math.atan(a2 / r2), p2 = Math.hypot(a2, r2);
            let m2 = o2;
            return m2 += t.ar(s2 / p2 / Math.max(0.5, Math.cos(t.an(n2 / 2)))), m2 += l2 * t.ar(Math.cos(_2)) / 2, m2 -= t.ar(Math.max(1, d2 / h2 / i2)) / 2, m2;
          };
        }
        const Pe = Te(9.314, 3);
        function Ce(e2, i2) {
          const o2 = (i2.roundZoom ? Math.round : Math.floor)(e2.zoom + t.ar(e2.tileSize / i2.tileSize));
          return Math.max(0, o2);
        }
        function Me(e2, i2) {
          const o2 = e2.getCameraFrustum(), a2 = e2.getClippingPlane(), r2 = e2.screenPointToMercatorCoordinate(e2.getCameraPoint()), s2 = t.a7.fromLngLat(e2.center, e2.elevation);
          r2.z = s2.z + Math.cos(e2.pitchInRadians) * e2.cameraToCenterDistance / e2.worldSize;
          const n2 = e2.getCoveringTilesDetailsProvider(), l2 = n2.allowVariableZoom(e2, i2), c2 = Ce(e2, i2), h2 = i2.minzoom || 0, u2 = void 0 !== i2.maxzoom ? i2.maxzoom : e2.maxZoom, d2 = Math.min(Math.max(0, c2), u2), _2 = Math.pow(2, d2), p2 = [_2 * r2.x, _2 * r2.y, 0], m2 = [_2 * s2.x, _2 * s2.y, 0], f2 = Math.hypot(s2.x - r2.x, s2.y - r2.y), g2 = Math.abs(s2.z - r2.z), v2 = Math.hypot(f2, g2), x2 = (e3) => ({ zoom: 0, x: 0, y: 0, wrap: e3, fullyVisible: false }), b2 = [], y2 = [];
          if (e2.renderWorldCopies && n2.allowWorldCopies()) for (let e3 = 1; e3 <= 3; e3++) b2.push(x2(-e3)), b2.push(x2(e3));
          for (b2.push(x2(0)); b2.length > 0; ) {
            const _3 = b2.pop(), f3 = _3.x, x3 = _3.y;
            let w2 = _3.fullyVisible;
            const T2 = { x: f3, y: x3, z: _3.zoom }, P2 = n2.getTileBoundingVolume(T2, _3.wrap, e2.elevation, i2);
            if (!w2) {
              const e3 = ye(o2, P2, a2);
              if (0 === e3) continue;
              w2 = 2 === e3;
            }
            const C2 = n2.distanceToTile2d(r2.x, r2.y, T2, P2);
            let M2 = c2;
            l2 && (M2 = (i2.calculateTileZoom || Pe)(e2.zoom + t.ar(e2.tileSize / i2.tileSize), C2, g2, v2, e2.fov)), M2 = (i2.roundZoom ? Math.round : Math.floor)(M2), M2 = Math.max(0, M2);
            const I2 = Math.min(M2, u2);
            if (_3.wrap = n2.getWrap(s2, T2, _3.wrap), _3.zoom >= I2) {
              if (_3.zoom < h2) continue;
              const e3 = d2 - _3.zoom, o3 = p2[0] - 0.5 - (f3 << e3), a3 = p2[1] - 0.5 - (x3 << e3), r3 = i2.reparseOverscaled ? Math.max(_3.zoom, M2) : _3.zoom;
              y2.push({ tileID: new t.a3(_3.zoom === u2 ? r3 : _3.zoom, _3.wrap, _3.zoom, f3, x3), distanceSq: t.as([m2[0] - 0.5 - f3, m2[1] - 0.5 - x3]), tileDistanceToCamera: Math.sqrt(o3 * o3 + a3 * a3) });
            } else for (let e3 = 0; e3 < 4; e3++) b2.push({ zoom: _3.zoom + 1, x: (f3 << 1) + e3 % 2, y: (x3 << 1) + (e3 >> 1), wrap: _3.wrap, fullyVisible: w2 });
          }
          return y2.sort(((e3, t2) => e3.distanceSq - t2.distanceSq)).map(((e3) => e3.tileID));
        }
        const Ie = t.a8.fromPoints([new t.P(0, 0), new t.P(t.a6, t.a6)]);
        function Ee(e2) {
          return "raster" === e2 || "image" === e2 || "video" === e2;
        }
        function Se(e2, t2, i2, o2, a2, r2, s2) {
          if (!t2.hasData()) return false;
          const { tileID: n2, fadingRole: l2, fadingDirection: c2, fadingParentID: h2 } = t2;
          if (l2 === he.Base && c2 === ue.Incoming && h2) return i2[h2.key] = h2, true;
          const u2 = Math.max(n2.overscaledZ - a2, r2);
          for (let a3 = n2.overscaledZ - 1; a3 >= u2; a3--) {
            const r3 = n2.scaledTo(a3), l3 = e2.getLoadedTile(r3);
            if (l3) return t2.setCrossFadeLogic({ fadingRole: he.Base, fadingDirection: ue.Incoming, fadingParentID: l3.tileID, fadeEndTime: o2 + s2 }), l3.setCrossFadeLogic({ fadingRole: he.Parent, fadingDirection: ue.Departing, fadeEndTime: o2 + s2 }), i2[r3.key] = r3, true;
          }
          return false;
        }
        function ze(e2, t2, i2, o2, a2, r2) {
          if (!t2.hasData()) return false;
          const s2 = t2.tileID.children(a2);
          let n2 = Re(e2, t2, s2, i2, o2, a2, r2);
          if (n2) return true;
          for (const l2 of s2) Re(e2, t2, l2.children(a2), i2, o2, a2, r2) && (n2 = true);
          return n2;
        }
        function Re(e2, t2, i2, o2, a2, r2, s2) {
          if (i2[0].overscaledZ >= r2) return false;
          let n2 = false;
          for (const r3 of i2) {
            const i3 = e2.getLoadedTile(r3);
            if (!i3) continue;
            const { fadingRole: l2, fadingDirection: c2, fadingParentID: h2 } = i3;
            l2 === he.Base && c2 === ue.Departing && h2 || (i3.setCrossFadeLogic({ fadingRole: he.Base, fadingDirection: ue.Departing, fadingParentID: t2.tileID, fadeEndTime: a2 + s2 }), t2.setCrossFadeLogic({ fadingRole: he.Parent, fadingDirection: ue.Incoming, fadeEndTime: a2 + s2 })), o2[r3.key] = r3, n2 = true;
          }
          return n2;
        }
        function De(e2, t2, i2, o2) {
          const a2 = e2.tileID;
          return !!e2.selfFading || !e2.hasData() && !!t2.has(a2) && (e2.setSelfFadeLogic(i2 + o2), true);
        }
        function Ae(e2, t2) {
          var i2;
          e2.needsHillshadePrepare = true, e2.needsTerrainPrepare = true;
          let o2 = t2.tileID.canonical.x - e2.tileID.canonical.x;
          const a2 = t2.tileID.canonical.y - e2.tileID.canonical.y, r2 = Math.pow(2, e2.tileID.canonical.z), s2 = t2.tileID.key;
          0 === o2 && 0 === a2 || Math.abs(a2) > 1 || (Math.abs(o2) > 1 && (1 === Math.abs(o2 + r2) ? o2 += r2 : 1 === Math.abs(o2 - r2) && (o2 -= r2)), t2.dem && e2.dem && (e2.dem.backfillBorder(t2.dem, o2, a2), (null === (i2 = e2.neighboringTiles) || void 0 === i2 ? void 0 : i2[s2]) && (e2.neighboringTiles[s2].backfilled = true)));
        }
        class Le {
          constructor() {
            this._tiles = {};
          }
          handleWrapJump(e2) {
            const t2 = {};
            for (const i2 in this._tiles) {
              const o2 = this._tiles[i2];
              o2.tileID = o2.tileID.unwrapTo(o2.tileID.wrap + e2), t2[o2.tileID.key] = o2;
            }
            this._tiles = t2;
          }
          setFeatureState(e2, t2) {
            for (const i2 in this._tiles) this._tiles[i2].setFeatureState(e2, t2);
          }
          getAllTiles() {
            return Object.values(this._tiles);
          }
          getAllIds(e2 = false) {
            return e2 ? Object.values(this._tiles).map(((e3) => e3.tileID)).sort(t.au).map(((e3) => e3.key)) : Object.keys(this._tiles);
          }
          getTileById(e2) {
            return this._tiles[e2];
          }
          setTile(e2, t2) {
            this._tiles[e2] = t2;
          }
          deleteTileById(e2) {
            delete this._tiles[e2];
          }
          getLoadedTile(e2) {
            const t2 = this.getTileById(e2.key);
            return (null == t2 ? void 0 : t2.hasData()) ? t2 : null;
          }
          isIdRenderable(e2, t2 = false) {
            var i2;
            return null === (i2 = this.getTileById(e2)) || void 0 === i2 ? void 0 : i2.isRenderable(t2);
          }
          getRenderableIds(e2 = 0, i2) {
            const o2 = [];
            for (const e3 of this.getAllIds()) this.isIdRenderable(e3, i2) && o2.push(this.getTileById(e3));
            return i2 ? o2.sort(((i3, o3) => {
              const a2 = i3.tileID, r2 = o3.tileID, s2 = new t.P(a2.canonical.x, a2.canonical.y)._rotate(-e2), n2 = new t.P(r2.canonical.x, r2.canonical.y)._rotate(-e2);
              return a2.overscaledZ - r2.overscaledZ || n2.y - s2.y || n2.x - s2.x;
            })).map(((e3) => e3.tileID.key)) : o2.map(((e3) => e3.tileID)).sort(t.au).map(((e3) => e3.key));
          }
        }
        class Fe extends t.E {
          constructor(e2, i2, o2) {
            super(), this.id = e2, this.dispatcher = o2, this.on("data", ((e3) => {
              this._dataHandler(e3);
            })), this.on("dataloading", (() => {
              this._sourceErrored = false;
            })), this.on("error", (() => {
              this._sourceErrored = this._source.loaded();
            })), this._source = ((e3, t2, i3, o3) => {
              const a2 = new (re(t2.type))(e3, t2, i3, o3);
              if (a2.id !== e3) throw new Error(`Expected Source id to be ${e3} instead of ${a2.id}`);
              return a2;
            })(e2, i2, o2, this), this._inViewTiles = new Le(), this._outOfViewCache = new t.av(0, ((e3) => this._unloadTile(e3))), this._timers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._rasterFadeDuration = 0, this._maxFadingAncestorLevels = 5, this._state = new _e(), this._didEmitContent = false, this._updated = false;
          }
          onAdd(e2) {
            var t2;
            this.map = e2, this._maxTileCacheSize = e2 ? e2._maxTileCacheSize : null, this._maxTileCacheZoomLevels = e2 ? e2._maxTileCacheZoomLevels : null, (null === (t2 = this._source) || void 0 === t2 ? void 0 : t2.onAdd) && this._source.onAdd(e2);
          }
          onRemove(e2) {
            var t2;
            for (const e3 of this._inViewTiles.getAllTiles()) e3.unloadVectorData();
            this.clearTiles(), (null === (t2 = this._source) || void 0 === t2 ? void 0 : t2.onRemove) && this._source.onRemove(e2), this._inViewTiles = new Le();
          }
          loaded() {
            if (this._sourceErrored) return true;
            if (!this._sourceLoaded) return false;
            if (!this._source.loaded()) return false;
            if (!(void 0 === this.used && void 0 === this.usedForTerrain || this.used || this.usedForTerrain)) return true;
            if (!this._updated) return false;
            for (const e2 of this._inViewTiles.getAllTiles()) if ("loaded" !== e2.state && "errored" !== e2.state) return false;
            return true;
          }
          getSource() {
            return this._source;
          }
          getState() {
            return this._state;
          }
          pause() {
            this._paused = true;
          }
          resume() {
            if (!this._paused) return;
            const e2 = this._shouldReloadOnResume;
            this._paused = false, this._shouldReloadOnResume = false, e2 && this.reload(), this.transform && this.update(this.transform, this.terrain);
          }
          _loadTile(e2, i2, o2) {
            return t._(this, void 0, void 0, (function* () {
              try {
                const t2 = yield this._source.loadTile(e2);
                this._tileLoaded(e2, i2, o2, t2);
              } catch (i3) {
                e2.state = "errored", 404 !== i3.status ? this._source.fire(new t.l(t.d(i3), { tile: e2 })) : this.update(this.transform, this.terrain);
              }
            }));
          }
          _unloadTile(e2) {
            this._source.unloadTile && this._source.unloadTile(e2);
          }
          _abortTile(e2) {
            this._source.abortTile && this._source.abortTile(e2), this._source.fire(new t.n("dataabort", { tile: e2, coord: e2.tileID, dataType: "source" }));
          }
          serialize() {
            return this._source.serialize();
          }
          prepare(e2) {
            this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._inViewTiles, this.map ? this.map.painter : null);
            for (const t2 of this._inViewTiles.getAllTiles()) t2.upload(e2), t2.prepare(this.map.style.imageManager);
          }
          getIds() {
            return this._inViewTiles.getAllIds(true);
          }
          getRenderableIds(e2) {
            var t2;
            return this._inViewTiles.getRenderableIds(null === (t2 = this.transform) || void 0 === t2 ? void 0 : t2.bearingInRadians, e2);
          }
          hasRenderableParent(e2) {
            const t2 = e2.overscaledZ - 1;
            if (t2 >= this._source.minzoom) {
              const i2 = this.getLoadedTile(e2.scaledTo(t2));
              if (i2) return this._inViewTiles.isIdRenderable(i2.tileID.key);
            }
            return false;
          }
          reload(e2, t2 = void 0) {
            if (this._paused) this._shouldReloadOnResume = true;
            else {
              this._outOfViewCache.reset();
              for (const i2 of this._inViewTiles.getAllIds()) {
                const o2 = this._inViewTiles.getTileById(i2);
                t2 && !this._source.shouldReloadTile(o2, t2) || (e2 ? this._reloadTile(i2, "expired") : "errored" !== o2.state && this._reloadTile(i2, "reloading"));
              }
            }
          }
          _reloadTile(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              const t2 = this._inViewTiles.getTileById(e2);
              t2 && ("loading" !== t2.state && (t2.state = i2), yield this._loadTile(t2, e2, i2));
            }));
          }
          _tileLoaded(e2, i2, o2, a2) {
            e2.timeAdded = c(), e2.selfFading && (e2.fadeEndTime = e2.timeAdded + this._rasterFadeDuration), "expired" === o2 && (e2.refreshedUponExpiration = true), this._setTileReloadTimer(i2, e2), (null == a2 ? void 0 : a2.unmodified) || ("raster-dem" === this.getSource().type && e2.dem && (function(e3, t2) {
              var i3, o3, a3;
              const r2 = t2.getRenderableIds();
              for (const s2 of r2) {
                if (!(null === (i3 = e3.neighboringTiles) || void 0 === i3 ? void 0 : i3[s2])) continue;
                const r3 = t2.getTileById(s2);
                e3.neighboringTiles[s2].backfilled || Ae(e3, r3), (null === (a3 = null === (o3 = r3.neighboringTiles) || void 0 === o3 ? void 0 : o3[e3.tileID.key]) || void 0 === a3 ? void 0 : a3.backfilled) || Ae(r3, e3);
              }
            })(e2, this._inViewTiles), this._state.initializeTileState(e2, this.map ? this.map.painter : null), e2.aborted || this._source.fire(new t.n("data", { dataType: "source", tile: e2, coord: e2.tileID })));
          }
          getTile(e2) {
            return this.getTileByID(e2.key);
          }
          getTileByID(e2) {
            return this._inViewTiles.getTileById(e2);
          }
          _retainLoadedChildren(e2, t2) {
            const i2 = this._getLoadedDescendents(t2), o2 = /* @__PURE__ */ new Set();
            for (const a2 of t2) {
              const t3 = i2[a2.key];
              if (!(null == t3 ? void 0 : t3.length)) {
                o2.add(a2);
                continue;
              }
              const r2 = a2.overscaledZ + Fe.maxOverzooming, s2 = t3.filter(((e3) => e3.tileID.overscaledZ <= r2));
              if (!s2.length) {
                o2.add(a2);
                continue;
              }
              const n2 = Math.min(...s2.map(((e3) => e3.tileID.overscaledZ))), l2 = s2.filter(((e3) => e3.tileID.overscaledZ === n2)).map(((e3) => e3.tileID));
              for (const t4 of l2) e2[t4.key] = t4;
              this._areDescendentsComplete(l2, n2, a2.overscaledZ) || o2.add(a2);
            }
            return o2;
          }
          _getLoadedDescendents(e2) {
            var t2;
            const i2 = {};
            for (const o2 of this._inViewTiles.getAllTiles().filter(((e3) => e3.hasData()))) for (const a2 of e2) o2.tileID.isChildOf(a2) && (i2[t2 = a2.key] || (i2[t2] = []), i2[a2.key].push(o2));
            return i2;
          }
          _areDescendentsComplete(e2, t2, i2) {
            return 1 === e2.length && e2[0].isOverscaled() ? e2[0].overscaledZ === t2 : Math.pow(4, t2 - i2) === e2.length;
          }
          getLoadedTile(e2) {
            return this._inViewTiles.getLoadedTile(e2);
          }
          updateCacheSize(e2) {
            const i2 = Math.ceil(e2.width / this._source.tileSize) + 1, o2 = Math.ceil(e2.height / this._source.tileSize) + 1, a2 = Math.floor(i2 * o2 * (null === this._maxTileCacheZoomLevels ? t.c.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels)), r2 = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, a2) : a2;
            this._outOfViewCache.setMaxSize(r2);
          }
          handleWrapJump(e2) {
            const t2 = Math.round((e2 - (void 0 === this._prevLng ? e2 : this._prevLng)) / 360);
            this._prevLng = e2, t2 && (this._inViewTiles.handleWrapJump(t2), this._resetTileReloadTimers());
          }
          update(e2, i2) {
            if (!this._sourceLoaded || this._paused) return;
            let o2;
            this.transform = e2, this.terrain = i2, this.updateCacheSize(e2), this.handleWrapJump(this.transform.center.lng), this.used || this.usedForTerrain ? this._source.tileID ? o2 = e2.getVisibleUnwrappedCoordinates(this._source.tileID).map(((e3) => new t.a3(e3.canonical.z, e3.wrap, e3.canonical.z, e3.canonical.x, e3.canonical.y))) : (o2 = Me(e2, { tileSize: this.usedForTerrain ? this.tileSize : this._source.tileSize, minzoom: this._source.minzoom, maxzoom: "vector" === this._source.type && void 0 !== this.map._zoomLevelsToOverscale ? e2.maxZoom - this.map._zoomLevelsToOverscale : this._source.maxzoom, roundZoom: !this.usedForTerrain && this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled, terrain: i2, calculateTileZoom: this._source.calculateTileZoom }), this._source.hasTile && (o2 = o2.filter(((e3) => this._source.hasTile(e3))))) : o2 = [], this.usedForTerrain && (o2 = this._addTerrainIdealTiles(o2));
            const a2 = 0 === o2.length && !this._updated && this._didEmitContent;
            this._updated = true, a2 && this.fire(new t.n("data", { sourceDataType: "idle", dataType: "source", sourceId: this.id }));
            const r2 = Ce(e2, this._source), s2 = this._updateRetainedTiles(o2, r2), n2 = Ee(this._source.type);
            n2 && this._rasterFadeDuration > 0 && !i2 && (function(e3, i3, o3, a3, r3, s3, n3) {
              const l2 = c(), h2 = t.at(i3);
              for (const t2 of i3) {
                const i4 = e3.getTileById(t2.key);
                i4.fadingDirection !== ue.Departing && 0 !== i4.fadeOpacity || i4.resetFadeLogic(), Se(e3, i4, o3, l2, a3, r3, n3) || ze(e3, i4, o3, l2, s3, n3) || De(i4, h2, l2, n3) || i4.resetFadeLogic();
              }
            })(this._inViewTiles, o2, s2, this._maxFadingAncestorLevels, this._source.minzoom, this._source.maxzoom, this._rasterFadeDuration), n2 ? this._cleanUpRasterTiles(s2) : this._cleanUpVectorTiles(s2);
          }
          _cleanUpRasterTiles(e2) {
            for (const t2 of this._inViewTiles.getAllIds()) e2[t2] || this._removeTile(t2);
          }
          _cleanUpVectorTiles(e2) {
            for (const t2 of this._inViewTiles.getAllIds()) {
              const i2 = this._inViewTiles.getTileById(t2);
              e2[t2] ? i2.clearSymbolFadeHold() : i2.hasSymbolBuckets ? i2.holdingForSymbolFade() ? i2.symbolFadeFinished() && this._removeTile(t2) : i2.setSymbolHoldDuration(this.map._fadeDuration) : this._removeTile(t2);
            }
          }
          _addTerrainIdealTiles(e2) {
            const t2 = [];
            for (const i2 of e2) if (i2.canonical.z > this._source.minzoom) {
              const e3 = i2.scaledTo(i2.canonical.z - 1);
              t2.push(e3);
              const o2 = i2.scaledTo(Math.max(this._source.minzoom, Math.min(i2.canonical.z, 5)));
              t2.push(o2);
            }
            return e2.concat(t2);
          }
          releaseSymbolFadeTiles() {
            for (const e2 of this._inViewTiles.getAllIds()) this._inViewTiles.getTileById(e2).holdingForSymbolFade() && this._removeTile(e2);
          }
          _updateRetainedTiles(e2, t2) {
            var i2;
            const o2 = /* @__PURE__ */ new Set();
            for (const t3 of e2) this._addTile(t3).hasData() || o2.add(t3);
            const a2 = e2.reduce(((e3, t3) => (e3[t3.key] = t3, e3)), {}), r2 = this._retainLoadedChildren(a2, o2), s2 = {}, n2 = Math.max(t2 - Fe.maxUnderzooming, this._source.minzoom);
            for (const e3 of r2) {
              let t3 = this._inViewTiles.getTileById(e3.key), o3 = null == t3 ? void 0 : t3.wasRequested();
              for (let r3 = e3.overscaledZ - 1; r3 >= n2; --r3) {
                const n3 = e3.scaledTo(r3);
                if (s2[n3.key]) break;
                if (s2[n3.key] = true, t3 = this.getTile(n3), !t3 && o3 && (t3 = this._addTile(n3)), t3) {
                  const e4 = t3.hasData();
                  if ((e4 || !(null === (i2 = this.map) || void 0 === i2 ? void 0 : i2.cancelPendingTileRequestsWhileZooming) || o3) && (a2[n3.key] = n3), o3 = t3.wasRequested(), e4) break;
                }
              }
            }
            return a2;
          }
          _addTile(e2) {
            let i2 = this._inViewTiles.getTileById(e2.key);
            if (i2) return i2;
            i2 = this._outOfViewCache.getAndRemove(e2), i2 && (i2.resetFadeLogic(), this._setTileReloadTimer(e2.key, i2), i2.tileID = e2, this._state.initializeTileState(i2, this.map ? this.map.painter : null));
            const o2 = i2;
            return i2 || (i2 = new de(e2, this._source.tileSize * e2.overscaleFactor()), this._loadTile(i2, e2.key, i2.state)), i2.uses++, this._inViewTiles.setTile(e2.key, i2), o2 || this._source.fire(new t.n("dataloading", { tile: i2, coord: i2.tileID, dataType: "source" })), i2;
          }
          _setTileReloadTimer(e2, t2) {
            this._clearTileReloadTimer(e2);
            const i2 = t2.getExpiryTimeout();
            i2 && (this._timers[e2] = setTimeout((() => {
              this._reloadTile(e2, "expired"), delete this._timers[e2];
            }), i2));
          }
          _clearTileReloadTimer(e2) {
            const t2 = this._timers[e2];
            t2 && (clearTimeout(t2), delete this._timers[e2]);
          }
          _resetTileReloadTimers() {
            for (const e2 in this._timers) clearTimeout(this._timers[e2]), delete this._timers[e2];
            for (const e2 of this._inViewTiles.getAllIds()) {
              const t2 = this._inViewTiles.getTileById(e2);
              this._setTileReloadTimer(e2, t2);
            }
          }
          refreshTiles(e2) {
            for (const t2 of this._inViewTiles.getAllIds()) {
              const i2 = this._inViewTiles.getTileById(t2);
              (this._inViewTiles.isIdRenderable(t2) || "errored" == i2.state) && e2.some(((e3) => e3.equals(i2.tileID.canonical))) && this._reloadTile(t2, "expired");
            }
          }
          _removeTile(e2) {
            const t2 = this._inViewTiles.getTileById(e2);
            t2 && (t2.uses--, this._inViewTiles.deleteTileById(e2), this._clearTileReloadTimer(e2), t2.uses > 0 || (t2.hasData() && "reloading" !== t2.state ? this._outOfViewCache.add(t2.tileID, t2, t2.getExpiryTimeout()) : (t2.aborted = true, this._abortTile(t2), this._unloadTile(t2))));
          }
          _dataHandler(e2) {
            "source" === e2.dataType && ("metadata" !== e2.sourceDataType ? "content" === e2.sourceDataType && this._sourceLoaded && !this._paused && (this.reload(e2.sourceDataChanged, e2.shouldReloadTileOptions), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = true) : this._sourceLoaded = true);
          }
          clearTiles() {
            this._shouldReloadOnResume = false, this._paused = false;
            for (const e2 of this._inViewTiles.getAllIds()) this._removeTile(e2);
            this._outOfViewCache.reset();
          }
          tilesIn(e2, i2, o2) {
            const a2 = [], r2 = this.transform;
            if (!r2) return a2;
            const s2 = r2.getCoveringTilesDetailsProvider().allowWorldCopies(), n2 = o2 ? r2.getCameraQueryGeometry(e2) : e2, l2 = (e3) => r2.screenPointToMercatorCoordinate(e3, this.terrain), c2 = this.transformBbox(e2, l2, !s2), h2 = this.transformBbox(n2, l2, !s2), u2 = this.getIds(), d2 = t.a8.fromPoints(h2);
            for (const e3 of u2) {
              const o3 = this._inViewTiles.getTileById(e3);
              if (o3.holdingForSymbolFade()) continue;
              const n3 = s2 ? [o3.tileID] : [o3.tileID.unwrapTo(-1), o3.tileID.unwrapTo(0)], l3 = Math.pow(2, r2.zoom - o3.tileID.overscaledZ), u3 = i2 * o3.queryPadding * t.a6 / o3.tileSize / l3;
              for (const e4 of n3) {
                const i3 = d2.map(((i4) => e4.getTilePoint(new t.a7(i4.x, i4.y))));
                if (i3.expandBy(u3), i3.intersects(Ie)) {
                  const t2 = c2.map(((t3) => e4.getTilePoint(t3))), i4 = h2.map(((t3) => e4.getTilePoint(t3)));
                  a2.push({ tile: o3, tileID: s2 ? e4 : e4.unwrapTo(0), queryGeometry: t2, cameraQueryGeometry: i4, scale: l3 });
                }
              }
            }
            return a2;
          }
          transformBbox(e2, i2, o2) {
            let a2 = e2.map(i2);
            if (o2) {
              const o3 = t.a8.fromPoints(e2);
              o3.shrinkBy(1e-3 * Math.min(o3.width(), o3.height()));
              const r2 = o3.map(i2);
              t.a8.fromPoints(a2).covers(r2) || (a2 = a2.map(((e3) => e3.x > 0.5 ? new t.a7(e3.x - 1, e3.y, e3.z) : e3)));
            }
            return a2;
          }
          getVisibleCoordinates(e2) {
            const t2 = this.getRenderableIds(e2).map(((e3) => this._inViewTiles.getTileById(e3).tileID));
            return this.transform && this.transform.populateCache(t2), t2;
          }
          hasTransition() {
            return !!this._source.hasTransition() || Ee(this._source.type) && (function(e2, t2) {
              if (t2 <= 0) return false;
              const i2 = c();
              for (const t3 of e2.getAllTiles()) if (t3.fadeEndTime >= i2) return true;
              return false;
            })(this._inViewTiles, this._rasterFadeDuration);
          }
          setRasterFadeDuration(e2) {
            this._rasterFadeDuration = e2;
          }
          setFeatureState(e2, i2, o2) {
            e2 || (e2 = t.ag), this._state.updateState(e2, i2, o2);
          }
          removeFeatureState(e2, i2, o2) {
            e2 || (e2 = t.ag), this._state.removeFeatureState(e2, i2, o2);
          }
          getFeatureState(e2, i2) {
            return e2 || (e2 = t.ag), this._state.getState(e2, i2);
          }
          setDependencies(e2, t2, i2) {
            const o2 = this._inViewTiles.getTileById(e2);
            o2 && o2.setDependencies(t2, i2);
          }
          reloadTilesForDependencies(e2, t2) {
            for (const i2 of this._inViewTiles.getAllIds()) this._inViewTiles.getTileById(i2).hasDependency(e2, t2) && this._reloadTile(i2, "reloading");
            this._outOfViewCache.filter(((i2) => !i2.hasDependency(e2, t2)));
          }
          areTilesLoaded() {
            for (const e2 of this._inViewTiles.getAllTiles()) if ("loaded" !== e2.state && "errored" !== e2.state) return false;
            return true;
          }
        }
        Fe.maxUnderzooming = 10, Fe.maxOverzooming = 3;
        class ke {
          constructor(e2, t2) {
            this.reset(e2, t2);
          }
          reset(e2, t2) {
            this.points = e2 || [], this._distances = [0];
            for (let e3 = 1; e3 < this.points.length; e3++) this._distances[e3] = this._distances[e3 - 1] + this.points[e3].dist(this.points[e3 - 1]);
            this.length = this._distances[this._distances.length - 1], this.padding = Math.min(t2 || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;
          }
          lerp(e2) {
            if (1 === this.points.length) return this.points[0];
            e2 = t.al(e2, 0, 1);
            let i2 = 1, o2 = this._distances[i2];
            const a2 = e2 * this.paddedLength + this.padding;
            for (; o2 < a2 && i2 < this._distances.length; ) o2 = this._distances[++i2];
            const r2 = i2 - 1, s2 = this._distances[r2], n2 = o2 - s2, l2 = n2 > 0 ? (a2 - s2) / n2 : 0;
            return this.points[r2].mult(1 - l2).add(this.points[i2].mult(l2));
          }
        }
        function Be(e2, t2) {
          let i2 = true;
          return "always" === e2 || "never" !== e2 && "never" !== t2 || (i2 = false), i2;
        }
        class Oe {
          constructor(e2, t2, i2) {
            const o2 = this.boxCells = [], a2 = this.circleCells = [];
            this.xCellCount = Math.ceil(e2 / i2), this.yCellCount = Math.ceil(t2 / i2);
            for (let e3 = 0; e3 < this.xCellCount * this.yCellCount; e3++) o2.push([]), a2.push([]);
            this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = e2, this.height = t2, this.xScale = this.xCellCount / e2, this.yScale = this.yCellCount / t2, this.boxUid = 0, this.circleUid = 0;
          }
          keysLength() {
            return this.boxKeys.length + this.circleKeys.length;
          }
          insert(e2, t2, i2, o2, a2) {
            this._forEachCell(t2, i2, o2, a2, this._insertBoxCell, this.boxUid++), this.boxKeys.push(e2), this.bboxes.push(t2), this.bboxes.push(i2), this.bboxes.push(o2), this.bboxes.push(a2);
          }
          insertCircle(e2, t2, i2, o2) {
            this._forEachCell(t2 - o2, i2 - o2, t2 + o2, i2 + o2, this._insertCircleCell, this.circleUid++), this.circleKeys.push(e2), this.circles.push(t2), this.circles.push(i2), this.circles.push(o2);
          }
          _insertBoxCell(e2, t2, i2, o2, a2, r2) {
            this.boxCells[a2].push(r2);
          }
          _insertCircleCell(e2, t2, i2, o2, a2, r2) {
            this.circleCells[a2].push(r2);
          }
          _query(e2, t2, i2, o2, a2, r2, s2) {
            if (i2 < 0 || e2 > this.width || o2 < 0 || t2 > this.height) return [];
            const n2 = [];
            if (e2 <= 0 && t2 <= 0 && this.width <= i2 && this.height <= o2) {
              if (a2) return [{ key: null, x1: e2, y1: t2, x2: i2, y2: o2 }];
              for (let e3 = 0; e3 < this.boxKeys.length; e3++) n2.push({ key: this.boxKeys[e3], x1: this.bboxes[4 * e3], y1: this.bboxes[4 * e3 + 1], x2: this.bboxes[4 * e3 + 2], y2: this.bboxes[4 * e3 + 3] });
              for (let e3 = 0; e3 < this.circleKeys.length; e3++) {
                const t3 = this.circles[3 * e3], i3 = this.circles[3 * e3 + 1], o3 = this.circles[3 * e3 + 2];
                n2.push({ key: this.circleKeys[e3], x1: t3 - o3, y1: i3 - o3, x2: t3 + o3, y2: i3 + o3 });
              }
            } else this._forEachCell(e2, t2, i2, o2, this._queryCell, n2, { hitTest: a2, overlapMode: r2, seenUids: { box: {}, circle: {} } }, s2);
            return n2;
          }
          query(e2, t2, i2, o2) {
            return this._query(e2, t2, i2, o2, false, null);
          }
          hitTest(e2, t2, i2, o2, a2, r2) {
            return this._query(e2, t2, i2, o2, true, a2, r2).length > 0;
          }
          hitTestCircle(e2, t2, i2, o2, a2) {
            const r2 = e2 - i2, s2 = e2 + i2, n2 = t2 - i2, l2 = t2 + i2;
            if (s2 < 0 || r2 > this.width || l2 < 0 || n2 > this.height) return false;
            const c2 = [];
            return this._forEachCell(r2, n2, s2, l2, this._queryCellCircle, c2, { hitTest: true, overlapMode: o2, circle: { x: e2, y: t2, radius: i2 }, seenUids: { box: {}, circle: {} } }, a2), c2.length > 0;
          }
          _queryCell(e2, t2, i2, o2, a2, r2, s2, n2) {
            const { seenUids: l2, hitTest: c2, overlapMode: h2 } = s2, u2 = this.boxCells[a2], d2 = 1e-6;
            if (null !== u2) {
              const a3 = this.bboxes;
              for (const s3 of u2) if (!l2.box[s3]) {
                l2.box[s3] = true;
                const u3 = 4 * s3, _3 = this.boxKeys[s3];
                if (e2 <= a3[u3 + 2] + d2 && t2 <= a3[u3 + 3] + d2 && i2 >= a3[u3 + 0] - d2 && o2 >= a3[u3 + 1] - d2 && (!n2 || n2(_3)) && (!c2 || !Be(h2, _3.overlapMode)) && (r2.push({ key: _3, x1: a3[u3], y1: a3[u3 + 1], x2: a3[u3 + 2], y2: a3[u3 + 3] }), c2)) return true;
              }
            }
            const _2 = this.circleCells[a2];
            if (null !== _2) {
              const a3 = this.circles;
              for (const s3 of _2) if (!l2.circle[s3]) {
                l2.circle[s3] = true;
                const u3 = 3 * s3, d3 = this.circleKeys[s3];
                if (this._circleAndRectCollide(a3[u3], a3[u3 + 1], a3[u3 + 2], e2, t2, i2, o2) && (!n2 || n2(d3)) && (!c2 || !Be(h2, d3.overlapMode))) {
                  const e3 = a3[u3], t3 = a3[u3 + 1], i3 = a3[u3 + 2];
                  if (r2.push({ key: d3, x1: e3 - i3, y1: t3 - i3, x2: e3 + i3, y2: t3 + i3 }), c2) return true;
                }
              }
            }
            return false;
          }
          _queryCellCircle(e2, t2, i2, o2, a2, r2, s2, n2) {
            const { circle: l2, seenUids: c2, overlapMode: h2 } = s2, u2 = this.boxCells[a2];
            if (null !== u2) {
              const e3 = this.bboxes;
              for (const t3 of u2) if (!c2.box[t3]) {
                c2.box[t3] = true;
                const i3 = 4 * t3, o3 = this.boxKeys[t3];
                if (this._circleAndRectCollide(l2.x, l2.y, l2.radius, e3[i3 + 0], e3[i3 + 1], e3[i3 + 2], e3[i3 + 3]) && (!n2 || n2(o3)) && !Be(h2, o3.overlapMode)) return r2.push(true), true;
              }
            }
            const d2 = this.circleCells[a2];
            if (null !== d2) {
              const e3 = this.circles;
              for (const t3 of d2) if (!c2.circle[t3]) {
                c2.circle[t3] = true;
                const i3 = 3 * t3, o3 = this.circleKeys[t3];
                if (this._circlesCollide(e3[i3], e3[i3 + 1], e3[i3 + 2], l2.x, l2.y, l2.radius) && (!n2 || n2(o3)) && !Be(h2, o3.overlapMode)) return r2.push(true), true;
              }
            }
          }
          _forEachCell(e2, t2, i2, o2, a2, r2, s2, n2) {
            const l2 = this._convertToXCellCoord(e2), c2 = this._convertToYCellCoord(t2), h2 = this._convertToXCellCoord(i2), u2 = this._convertToYCellCoord(o2);
            for (let d2 = l2; d2 <= h2; d2++) for (let l3 = c2; l3 <= u2; l3++) if (a2.call(this, e2, t2, i2, o2, this.xCellCount * l3 + d2, r2, s2, n2)) return;
          }
          _convertToXCellCoord(e2) {
            return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(e2 * this.xScale)));
          }
          _convertToYCellCoord(e2) {
            return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(e2 * this.yScale)));
          }
          _circlesCollide(e2, t2, i2, o2, a2, r2) {
            const s2 = o2 - e2, n2 = a2 - t2, l2 = i2 + r2;
            return l2 * l2 > s2 * s2 + n2 * n2;
          }
          _circleAndRectCollide(e2, t2, i2, o2, a2, r2, s2) {
            const n2 = (r2 - o2) / 2, l2 = Math.abs(e2 - (o2 + n2));
            if (l2 > n2 + i2) return false;
            const c2 = (s2 - a2) / 2, h2 = Math.abs(t2 - (a2 + c2));
            if (h2 > c2 + i2) return false;
            if (l2 <= n2 || h2 <= c2) return true;
            const u2 = l2 - n2, d2 = h2 - c2;
            return u2 * u2 + d2 * d2 <= i2 * i2;
          }
        }
        function je(e2, t2) {
          const i2 = 1 / (t2[0] * t2[0] + t2[1] * t2[1] + t2[2] * t2[2]), o2 = 1 / (t2[8] * t2[8] + t2[9] * t2[9] + t2[10] * t2[10]), a2 = t2[0] * i2, r2 = t2[4] * i2, s2 = t2[8] * o2, n2 = t2[1] * i2, l2 = t2[5] * i2, c2 = t2[9] * o2, h2 = t2[2] * i2, u2 = t2[6] * i2, d2 = t2[10] * o2;
          e2[0] = a2, e2[1] = r2, e2[2] = s2, e2[4] = n2, e2[5] = l2, e2[6] = c2, e2[8] = h2, e2[9] = u2, e2[10] = d2;
          const _2 = t2[12], p2 = t2[13], m2 = t2[14];
          return e2[12] = -a2 * _2 - n2 * p2 - h2 * m2, e2[13] = -r2 * _2 - l2 * p2 - u2 * m2, e2[14] = -s2 * _2 - c2 * p2 - d2 * m2, e2[3] = 0, e2[7] = 0, e2[11] = 0, e2[15] = 1, e2;
        }
        const Ne = t.O();
        function Ze(e2, i2, a2) {
          const r2 = t.O();
          if (!e2) {
            const { vecSouth: e3, vecEast: t2 } = Ge(i2), a3 = o();
            a3[0] = t2[0], a3[1] = t2[1], a3[2] = e3[0], a3[3] = e3[1], s2 = a3, (d2 = (l2 = (n2 = a3)[0]) * (u2 = n2[3]) - (h2 = n2[2]) * (c2 = n2[1])) && (s2[0] = u2 * (d2 = 1 / d2), s2[1] = -c2 * d2, s2[2] = -h2 * d2, s2[3] = l2 * d2), r2[0] = a3[0], r2[1] = a3[1], r2[4] = a3[2], r2[5] = a3[3];
          }
          var s2, n2, l2, c2, h2, u2, d2;
          return t.S(r2, r2, [1 / a2, 1 / a2, 1]), r2;
        }
        function Ue(e2, i2, o2, a2) {
          if (e2) {
            const e3 = t.O();
            if (!i2) {
              const { vecSouth: t2, vecEast: i3 } = Ge(o2);
              e3[0] = i3[0], e3[1] = i3[1], e3[4] = t2[0], e3[5] = t2[1];
            }
            return t.S(e3, e3, [a2, a2, 1]), e3;
          }
          return o2.pixelsToClipSpaceMatrix;
        }
        function Ge(e2) {
          const i2 = Math.cos(e2.rollInRadians), o2 = Math.sin(e2.rollInRadians), a2 = Math.cos(e2.pitchInRadians), r2 = Math.cos(e2.bearingInRadians), s2 = Math.sin(e2.bearingInRadians), n2 = t.az();
          n2[0] = -r2 * a2 * o2 - s2 * i2, n2[1] = -s2 * a2 * o2 + r2 * i2;
          const l2 = t.aA(n2);
          l2 < 1e-9 ? t.aB(n2) : t.aC(n2, n2, 1 / l2);
          const c2 = t.az();
          c2[0] = r2 * a2 * i2 - s2 * o2, c2[1] = s2 * a2 * i2 + r2 * o2;
          const h2 = t.aA(c2);
          return h2 < 1e-9 ? t.aB(c2) : t.aC(c2, c2, 1 / h2), { vecEast: c2, vecSouth: n2 };
        }
        function Ve(e2, i2, o2, a2) {
          let r2;
          a2 ? (r2 = [e2, i2, a2(e2, i2), 1], t.aE(r2, r2, o2)) : (r2 = [e2, i2, 0, 1], nt(r2, r2, o2));
          const s2 = r2[3];
          return { point: new t.P(r2[0] / s2, r2[1] / s2), signedDistanceFromCamera: s2, isOccluded: false };
        }
        function We(e2, t2) {
          return 0.5 + e2 / t2 * 0.5;
        }
        function qe(e2, t2) {
          return e2.x >= -t2[0] && e2.x <= t2[0] && e2.y >= -t2[1] && e2.y <= t2[1];
        }
        function $e(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2) {
          const p2 = o2 ? e2.textSizeData : e2.iconSizeData, m2 = t.aw(p2, i2.transform.zoom), f2 = [256 / i2.width * 2 + 1, 256 / i2.height * 2 + 1], g2 = o2 ? e2.text.dynamicLayoutVertexArray : e2.icon.dynamicLayoutVertexArray;
          g2.clear();
          const v2 = e2.lineVertexArray, x2 = o2 ? e2.text.placedSymbolArray : e2.icon.placedSymbolArray, b2 = i2.transform.width / i2.transform.height;
          let y2 = false;
          for (let o3 = 0; o3 < x2.length; o3++) {
            const w2 = x2.get(o3);
            if (w2.hidden || w2.writingMode === t.ax.vertical && !y2) {
              st(w2.numGlyphs, g2);
              continue;
            }
            y2 = false;
            const T2 = new t.P(w2.anchorX, w2.anchorY), P2 = { getElevation: _2, pitchedLabelPlaneMatrix: a2, lineVertexArray: v2, pitchWithMap: s2, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: false }, transform: i2.transform, tileAnchorPoint: T2, unwrappedTileID: c2, width: h2, height: u2, translation: d2 }, C2 = tt(w2.anchorX, w2.anchorY, P2);
            if (!qe(C2.point, f2)) {
              st(w2.numGlyphs, g2);
              continue;
            }
            const M2 = We(i2.transform.cameraToCenterDistance, C2.signedDistanceFromCamera), I2 = t.ay(p2, m2, w2), E2 = s2 ? I2 * i2.transform.getPitchedTextCorrection(w2.anchorX, w2.anchorY, c2) / M2 : I2 * M2, S2 = Ke({ projectionContext: P2, pitchedLabelPlaneMatrixInverse: r2, symbol: w2, fontSize: E2, flip: false, keepUpright: n2, glyphOffsetArray: e2.glyphOffsetArray, dynamicLayoutVertexArray: g2, aspectRatio: b2, rotateToLine: l2 });
            y2 = S2.useVertical, (S2.notEnoughRoom || y2 || S2.needsFlipping && Ke({ projectionContext: P2, pitchedLabelPlaneMatrixInverse: r2, symbol: w2, fontSize: E2, flip: true, keepUpright: n2, glyphOffsetArray: e2.glyphOffsetArray, dynamicLayoutVertexArray: g2, aspectRatio: b2, rotateToLine: l2 }).notEnoughRoom) && st(w2.numGlyphs, g2);
          }
          o2 ? e2.text.dynamicLayoutVertexBuffer.updateData(g2) : e2.icon.dynamicLayoutVertexBuffer.updateData(g2);
        }
        function He(e2, t2, i2, o2, a2, r2, s2, n2) {
          const l2 = r2.glyphStartIndex + r2.numGlyphs, c2 = r2.lineStartIndex, h2 = r2.lineStartIndex + r2.lineLength, u2 = t2.getoffsetX(r2.glyphStartIndex), d2 = t2.getoffsetX(l2 - 1), _2 = at(e2 * u2, i2, o2, a2, r2.segment, c2, h2, n2, s2);
          if (!_2) return null;
          const p2 = at(e2 * d2, i2, o2, a2, r2.segment, c2, h2, n2, s2);
          return p2 ? n2.projectionCache.anyProjectionOccluded ? null : { first: _2, last: p2 } : null;
        }
        function Xe(e2, i2, o2, a2) {
          return e2 === t.ax.horizontal && Math.abs(o2.y - i2.y) > Math.abs(o2.x - i2.x) * a2 ? { useVertical: true } : (e2 === t.ax.vertical ? i2.y < o2.y : i2.x > o2.x) ? { needsFlipping: true } : null;
        }
        function Ke(e2) {
          const { projectionContext: i2, pitchedLabelPlaneMatrixInverse: o2, symbol: a2, fontSize: r2, flip: s2, keepUpright: n2, glyphOffsetArray: l2, dynamicLayoutVertexArray: c2, aspectRatio: h2, rotateToLine: u2 } = e2, d2 = r2 / 24, _2 = a2.lineOffsetX * d2, p2 = a2.lineOffsetY * d2;
          let m2;
          if (a2.numGlyphs > 1) {
            const e3 = a2.glyphStartIndex + a2.numGlyphs, t2 = a2.lineStartIndex, r3 = a2.lineStartIndex + a2.lineLength, c3 = He(d2, l2, _2, p2, s2, a2, u2, i2);
            if (!c3) return { notEnoughRoom: true };
            const f2 = et(c3.first.point.x, c3.first.point.y, i2, o2), g2 = et(c3.last.point.x, c3.last.point.y, i2, o2);
            if (n2 && !s2) {
              const e4 = Xe(a2.writingMode, f2, g2, h2);
              if (e4) return e4;
            }
            m2 = [c3.first];
            for (let o3 = a2.glyphStartIndex + 1; o3 < e3 - 1; o3++) {
              const e4 = at(d2 * l2.getoffsetX(o3), _2, p2, s2, a2.segment, t2, r3, i2, u2);
              if (!e4) return { notEnoughRoom: true };
              m2.push(e4);
            }
            m2.push(c3.last);
          } else {
            if (n2 && !s2) {
              const e4 = Je(i2.tileAnchorPoint.x, i2.tileAnchorPoint.y, i2).point, r3 = a2.lineStartIndex + a2.segment + 1, s3 = new t.P(i2.lineVertexArray.getx(r3), i2.lineVertexArray.gety(r3)), n3 = Je(s3.x, s3.y, i2), l3 = n3.signedDistanceFromCamera > 0 ? n3.point : Ye(i2.tileAnchorPoint, s3, e4, 1, i2), c3 = et(e4.x, e4.y, i2, o2), u3 = et(l3.x, l3.y, i2, o2), d3 = Xe(a2.writingMode, c3, u3, h2);
              if (d3) return d3;
            }
            const e3 = at(d2 * l2.getoffsetX(a2.glyphStartIndex), _2, p2, s2, a2.segment, a2.lineStartIndex, a2.lineStartIndex + a2.lineLength, i2, u2);
            if (!e3 || i2.projectionCache.anyProjectionOccluded) return { notEnoughRoom: true };
            m2 = [e3];
          }
          for (const e3 of m2) t.aD(c2, e3.point, e3.angle);
          return {};
        }
        function Ye(e2, t2, i2, o2, a2) {
          const r2 = e2.add(e2.sub(t2)._unit()), s2 = Je(r2.x, r2.y, a2).point, n2 = i2.sub(s2);
          return i2.add(n2._mult(o2 / n2.mag()));
        }
        function Qe(e2, i2, o2) {
          const a2 = i2.projectionCache;
          if (a2.projections[e2]) return a2.projections[e2];
          const r2 = new t.P(i2.lineVertexArray.getx(e2), i2.lineVertexArray.gety(e2)), s2 = Je(r2.x, r2.y, i2);
          if (s2.signedDistanceFromCamera > 0) return a2.projections[e2] = s2.point, a2.anyProjectionOccluded || (a2.anyProjectionOccluded = s2.isOccluded), s2.point;
          const n2 = e2 - o2.direction;
          return Ye(0 === o2.distanceFromAnchor ? i2.tileAnchorPoint : new t.P(i2.lineVertexArray.getx(n2), i2.lineVertexArray.gety(n2)), r2, o2.previousVertex, o2.absOffsetX - o2.distanceFromAnchor + 1, i2);
        }
        function Je(e2, t2, i2) {
          const o2 = e2 + i2.translation[0], a2 = t2 + i2.translation[1];
          let r2;
          return i2.pitchWithMap ? (r2 = Ve(o2, a2, i2.pitchedLabelPlaneMatrix, i2.getElevation), r2.isOccluded = false) : (r2 = i2.transform.projectTileCoordinates(o2, a2, i2.unwrappedTileID, i2.getElevation), r2.point.x = (0.5 * r2.point.x + 0.5) * i2.width, r2.point.y = (0.5 * -r2.point.y + 0.5) * i2.height), r2;
        }
        function et(e2, i2, o2, a2) {
          if (o2.pitchWithMap) {
            const r2 = [e2, i2, 0, 1];
            return t.aE(r2, r2, a2), o2.transform.projectTileCoordinates(r2[0] / r2[3], r2[1] / r2[3], o2.unwrappedTileID, o2.getElevation).point;
          }
          return { x: e2 / o2.width * 2 - 1, y: 1 - i2 / o2.height * 2 };
        }
        function tt(e2, t2, i2) {
          return i2.transform.projectTileCoordinates(e2, t2, i2.unwrappedTileID, i2.getElevation);
        }
        function it(e2, t2, i2) {
          return e2._unit()._perp()._mult(t2 * i2);
        }
        function ot(e2, i2, o2, a2, r2, s2, n2, l2, c2) {
          if (l2.projectionCache.offsets[e2]) return l2.projectionCache.offsets[e2];
          const h2 = o2.add(i2);
          if (e2 + c2.direction < a2 || e2 + c2.direction >= r2) return l2.projectionCache.offsets[e2] = h2, h2;
          const u2 = Qe(e2 + c2.direction, l2, c2), d2 = it(u2.sub(o2), n2, c2.direction), _2 = o2.add(d2), p2 = u2.add(d2);
          return l2.projectionCache.offsets[e2] = t.aF(s2, h2, _2, p2) || h2, l2.projectionCache.offsets[e2];
        }
        function at(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
          const c2 = o2 ? e2 - t2 : e2 + t2;
          let h2 = c2 > 0 ? 1 : -1, u2 = 0;
          o2 && (h2 *= -1, u2 = Math.PI), h2 < 0 && (u2 += Math.PI);
          let d2, _2 = h2 > 0 ? r2 + a2 : r2 + a2 + 1;
          n2.projectionCache.cachedAnchorPoint ? d2 = n2.projectionCache.cachedAnchorPoint : (d2 = Je(n2.tileAnchorPoint.x, n2.tileAnchorPoint.y, n2).point, n2.projectionCache.cachedAnchorPoint = d2);
          let p2, m2, f2 = d2, g2 = d2, v2 = 0, x2 = 0;
          const b2 = Math.abs(c2), y2 = [];
          let w2;
          for (; v2 + x2 <= b2; ) {
            if (_2 += h2, _2 < r2 || _2 >= s2) return null;
            v2 += x2, g2 = f2, m2 = p2;
            const e3 = { absOffsetX: b2, direction: h2, distanceFromAnchor: v2, previousVertex: g2 };
            if (f2 = Qe(_2, n2, e3), 0 === i2) y2.push(g2), w2 = f2.sub(g2);
            else {
              let t3;
              const o3 = f2.sub(g2);
              t3 = 0 === o3.mag() ? it(Qe(_2 + h2, n2, e3).sub(f2), i2, h2) : it(o3, i2, h2), m2 || (m2 = g2.add(t3)), p2 = ot(_2, t3, f2, r2, s2, m2, i2, n2, e3), y2.push(m2), w2 = p2.sub(m2);
            }
            x2 = w2.mag();
          }
          const T2 = w2._mult((b2 - v2) / x2)._add(m2 || g2), P2 = u2 + Math.atan2(f2.y - g2.y, f2.x - g2.x);
          return y2.push(T2), { point: T2, angle: l2 ? P2 : 0, path: y2 };
        }
        const rt = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
        function st(e2, t2) {
          for (let i2 = 0; i2 < e2; i2++) {
            const e3 = t2.length;
            t2.resize(e3 + 4), t2.float32.set(rt, 3 * e3);
          }
        }
        function nt(e2, t2, i2) {
          const o2 = t2[0], a2 = t2[1];
          return e2[0] = i2[0] * o2 + i2[4] * a2 + i2[12], e2[1] = i2[1] * o2 + i2[5] * a2 + i2[13], e2[3] = i2[3] * o2 + i2[7] * a2 + i2[15], e2;
        }
        const lt = 100;
        class ct {
          constructor(e2, t2 = new Oe(e2.width + 200, e2.height + 200, 25), i2 = new Oe(e2.width + 200, e2.height + 200, 25)) {
            this.transform = e2, this.grid = t2, this.ignoredGrid = i2, this.pitchFactor = Math.cos(e2.pitch * Math.PI / 180) * e2.cameraToCenterDistance, this.screenRightBoundary = e2.width + lt, this.screenBottomBoundary = e2.height + lt, this.gridRightBoundary = e2.width + 200, this.gridBottomBoundary = e2.height + 200, this.perspectiveRatioCutoff = 0.6;
          }
          placeCollisionBox(e2, t2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2) {
            const d2 = this.projectAndGetPerspectiveRatio(e2.anchorPointX + n2[0], e2.anchorPointY + n2[1], a2, c2, u2), _2 = i2 * d2.perspectiveRatio;
            let p2;
            if (r2 || s2) p2 = this._projectCollisionBox(e2, _2, o2, a2, r2, s2, n2, d2, c2, h2, u2);
            else {
              const t3 = d2.x + (h2 ? h2.x * _2 : 0), i3 = d2.y + (h2 ? h2.y * _2 : 0);
              p2 = { allPointsOccluded: false, box: [t3 + e2.x1 * _2, i3 + e2.y1 * _2, t3 + e2.x2 * _2, i3 + e2.y2 * _2] };
            }
            const [m2, f2, g2, v2] = p2.box, x2 = r2 ? p2.allPointsOccluded : d2.isOccluded;
            let b2 = x2;
            return b2 || (b2 = d2.perspectiveRatio < this.perspectiveRatioCutoff), b2 || (b2 = !this.isInsideGrid(m2, f2, g2, v2)), b2 || "always" !== t2 && this.grid.hitTest(m2, f2, g2, v2, t2, l2) ? { box: [m2, f2, g2, v2], placeable: false, offscreen: false, occluded: x2 } : { box: [m2, f2, g2, v2], placeable: true, offscreen: this.isOffscreen(m2, f2, g2, v2), occluded: x2 };
          }
          placeCollisionCircles(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2, p2) {
            const m2 = [], f2 = new t.P(i2.anchorX, i2.anchorY), g2 = this.getPerspectiveRatio(f2.x, f2.y, s2, p2), v2 = (c2 ? r2 * this.transform.getPitchedTextCorrection(i2.anchorX, i2.anchorY, s2) / g2 : r2 * g2) / t.aJ, x2 = { getElevation: p2, pitchedLabelPlaneMatrix: n2, lineVertexArray: o2, pitchWithMap: c2, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: false }, transform: this.transform, tileAnchorPoint: f2, unwrappedTileID: s2, width: this.transform.width, height: this.transform.height, translation: _2 }, b2 = He(v2, a2, i2.lineOffsetX * v2, i2.lineOffsetY * v2, false, i2, false, x2);
            let y2 = false, w2 = false, T2 = true;
            if (b2) {
              const i3 = 0.5 * u2 * g2 + d2, o3 = new t.P(-100, -100), a3 = new t.P(this.screenRightBoundary, this.screenBottomBoundary), r3 = new ke(), s3 = b2.first, n3 = b2.last;
              let _3 = [];
              for (let e3 = s3.path.length - 1; e3 >= 1; e3--) _3.push(s3.path[e3]);
              for (let e3 = 1; e3 < n3.path.length; e3++) _3.push(n3.path[e3]);
              const p3 = 2.5 * i3;
              if (c2) {
                const e3 = this.projectPathToScreenSpace(_3, x2);
                _3 = e3.some(((e4) => e4.signedDistanceFromCamera <= 0)) ? [] : e3.map(((e4) => e4.point));
              }
              let f3 = [];
              if (_3.length > 0) {
                const e3 = _3[0].clone(), i4 = _3[0].clone();
                for (let t2 = 1; t2 < _3.length; t2++) e3.x = Math.min(e3.x, _3[t2].x), e3.y = Math.min(e3.y, _3[t2].y), i4.x = Math.max(i4.x, _3[t2].x), i4.y = Math.max(i4.y, _3[t2].y);
                f3 = e3.x >= o3.x && i4.x <= a3.x && e3.y >= o3.y && i4.y <= a3.y ? [_3] : i4.x < o3.x || e3.x > a3.x || i4.y < o3.y || e3.y > a3.y ? [] : t.aG([_3], o3.x, o3.y, a3.x, a3.y);
              }
              for (const t2 of f3) {
                r3.reset(t2, 0.25 * i3);
                let o4 = 0;
                o4 = r3.length <= 0.5 * i3 ? 1 : Math.ceil(r3.paddedLength / p3) + 1;
                for (let t3 = 0; t3 < o4; t3++) {
                  const a4 = t3 / Math.max(o4 - 1, 1), s4 = r3.lerp(a4), n4 = s4.x + lt, c3 = s4.y + lt;
                  m2.push(n4, c3, i3, 0);
                  const u3 = n4 - i3, d3 = c3 - i3, _4 = n4 + i3, p4 = c3 + i3;
                  if (T2 && (T2 = this.isOffscreen(u3, d3, _4, p4)), w2 || (w2 = this.isInsideGrid(u3, d3, _4, p4)), "always" !== e2 && this.grid.hitTestCircle(n4, c3, i3, e2, h2) && (y2 = true, !l2)) return { circles: [], offscreen: false, collisionDetected: y2 };
                }
              }
            }
            return { circles: !l2 && y2 || !w2 || g2 < this.perspectiveRatioCutoff ? [] : m2, offscreen: T2, collisionDetected: y2 };
          }
          projectPathToScreenSpace(e2, t2) {
            const i2 = (function(e3, t3) {
              const i3 = Ne;
              return (function(e4, t4) {
                const i4 = 1 / (t4[0] * t4[5] - t4[1] * t4[4]);
                e4[0] = t4[5] * i4, e4[1] = -t4[1] * i4, e4[2] = 0, e4[3] = 0, e4[4] = -t4[4] * i4, e4[5] = t4[0] * i4, e4[6] = 0, e4[7] = 0, e4[8] = 0, e4[9] = 0, e4[10] = 1 / t4[10], e4[11] = 0, e4[12] = 0, e4[13] = 0, e4[14] = 0, e4[15] = 1 / t4[15];
              })(i3, t3.pitchedLabelPlaneMatrix), e3.map(((e4) => {
                const o2 = Ve(e4.x, e4.y, i3, t3.getElevation), a2 = t3.transform.projectTileCoordinates(o2.point.x, o2.point.y, t3.unwrappedTileID, t3.getElevation);
                return a2.point.x = (0.5 * a2.point.x + 0.5) * t3.width, a2.point.y = (0.5 * -a2.point.y + 0.5) * t3.height, a2;
              }));
            })(e2, t2);
            return (function(e3) {
              let t3 = 0, i3 = 0, o2 = 0, a2 = 0;
              for (let r2 = 0; r2 < e3.length; r2++) e3[r2].isOccluded ? (o2 = r2 + 1, a2 = 0) : (a2++, a2 > i3 && (i3 = a2, t3 = o2));
              return e3.slice(t3, t3 + i3);
            })(i2);
          }
          queryRenderedSymbols(e2) {
            if (0 === e2.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {};
            const i2 = [], o2 = new t.a8();
            for (const a3 of e2) {
              const e3 = new t.P(a3.x + lt, a3.y + lt);
              o2.extend(e3), i2.push(e3);
            }
            const { minX: a2, minY: r2, maxX: s2, maxY: n2 } = o2, l2 = this.grid.query(a2, r2, s2, n2).concat(this.ignoredGrid.query(a2, r2, s2, n2)), c2 = {}, h2 = {};
            for (const e3 of l2) {
              const o3 = e3.key;
              if (void 0 === c2[o3.bucketInstanceId] && (c2[o3.bucketInstanceId] = {}), c2[o3.bucketInstanceId][o3.featureIndex]) continue;
              const a3 = [new t.P(e3.x1, e3.y1), new t.P(e3.x2, e3.y1), new t.P(e3.x2, e3.y2), new t.P(e3.x1, e3.y2)];
              t.aH(i2, a3) && (c2[o3.bucketInstanceId][o3.featureIndex] = true, void 0 === h2[o3.bucketInstanceId] && (h2[o3.bucketInstanceId] = []), h2[o3.bucketInstanceId].push(o3.featureIndex));
            }
            return h2;
          }
          insertCollisionBox(e2, t2, i2, o2, a2, r2) {
            (i2 ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: o2, featureIndex: a2, collisionGroupID: r2, overlapMode: t2 }, e2[0], e2[1], e2[2], e2[3]);
          }
          insertCollisionCircles(e2, t2, i2, o2, a2, r2) {
            const s2 = i2 ? this.ignoredGrid : this.grid, n2 = { bucketInstanceId: o2, featureIndex: a2, collisionGroupID: r2, overlapMode: t2 };
            for (let t3 = 0; t3 < e2.length; t3 += 4) s2.insertCircle(n2, e2[t3], e2[t3 + 1], e2[t3 + 2]);
          }
          projectAndGetPerspectiveRatio(e2, i2, o2, a2, r2) {
            if (r2) {
              let o3;
              a2 ? (o3 = [e2, i2, a2(e2, i2), 1], t.aE(o3, o3, r2)) : (o3 = [e2, i2, 0, 1], nt(o3, o3, r2));
              const s2 = o3[3];
              return { x: (o3[0] / s2 + 1) / 2 * this.transform.width + lt, y: (-o3[1] / s2 + 1) / 2 * this.transform.height + lt, perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / s2 * 0.5, isOccluded: false, signedDistanceFromCamera: s2 };
            }
            {
              const t2 = this.transform.projectTileCoordinates(e2, i2, o2, a2);
              return { x: (t2.point.x + 1) / 2 * this.transform.width + lt, y: (1 - t2.point.y) / 2 * this.transform.height + lt, perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / t2.signedDistanceFromCamera * 0.5, isOccluded: t2.isOccluded, signedDistanceFromCamera: t2.signedDistanceFromCamera };
            }
          }
          getPerspectiveRatio(e2, t2, i2, o2) {
            const a2 = this.transform.projectTileCoordinates(e2, t2, i2, o2);
            return 0.5 + this.transform.cameraToCenterDistance / a2.signedDistanceFromCamera * 0.5;
          }
          isOffscreen(e2, t2, i2, o2) {
            return i2 < lt || e2 >= this.screenRightBoundary || o2 < lt || t2 > this.screenBottomBoundary;
          }
          isInsideGrid(e2, t2, i2, o2) {
            return i2 >= 0 && e2 < this.gridRightBoundary && o2 >= 0 && t2 < this.gridBottomBoundary;
          }
          getViewportMatrix() {
            const e2 = t.ap([]);
            return t.Q(e2, e2, [-100, -100, 0]), e2;
          }
          _projectCollisionBox(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2) {
            let d2 = 1, _2 = 0, p2 = 0, m2 = 1;
            const f2 = e2.anchorPointX + n2[0], g2 = e2.anchorPointY + n2[1];
            if (s2 && !r2) {
              const e3 = this.projectAndGetPerspectiveRatio(f2 + 1, g2, a2, c2, u2), t2 = e3.x - l2.x, i3 = Math.atan((e3.y - l2.y) / t2) + (t2 < 0 ? Math.PI : 0), o3 = Math.sin(i3), r3 = Math.cos(i3);
              d2 = r3, _2 = o3, p2 = -o3, m2 = r3;
            } else if (!s2 && r2) {
              const e3 = Ge(this.transform);
              d2 = e3.vecEast[0], _2 = e3.vecEast[1], p2 = e3.vecSouth[0], m2 = e3.vecSouth[1];
            }
            let v2 = l2.x, x2 = l2.y, b2 = i2;
            r2 && (v2 = f2, x2 = g2, b2 = Math.pow(2, -(this.transform.zoom - o2.overscaledZ)), b2 *= this.transform.getPitchedTextCorrection(f2, g2, a2), h2 || (b2 *= t.al(0.5 + l2.signedDistanceFromCamera / this.transform.cameraToCenterDistance * 0.5, 0, 4))), h2 && (v2 += d2 * h2.x * b2 + p2 * h2.y * b2, x2 += _2 * h2.x * b2 + m2 * h2.y * b2);
            const y2 = e2.x1 * b2, w2 = e2.x2 * b2, T2 = (y2 + w2) / 2, P2 = e2.y1 * b2, C2 = e2.y2 * b2, M2 = (P2 + C2) / 2, I2 = [{ offsetX: y2, offsetY: P2 }, { offsetX: T2, offsetY: P2 }, { offsetX: w2, offsetY: P2 }, { offsetX: w2, offsetY: M2 }, { offsetX: w2, offsetY: C2 }, { offsetX: T2, offsetY: C2 }, { offsetX: y2, offsetY: C2 }, { offsetX: y2, offsetY: M2 }];
            let E2 = [];
            for (const { offsetX: e3, offsetY: i3 } of I2) E2.push(new t.P(v2 + d2 * e3 + p2 * i3, x2 + _2 * e3 + m2 * i3));
            let S2 = false;
            if (r2) {
              const e3 = E2.map(((e4) => this.projectAndGetPerspectiveRatio(e4.x, e4.y, a2, c2, u2)));
              S2 = e3.some(((e4) => !e4.isOccluded)), E2 = e3.map(((e4) => new t.P(e4.x, e4.y)));
            } else S2 = true;
            return { box: t.aI(E2), allPointsOccluded: !S2 };
          }
        }
        class ht {
          constructor(e2, t2, i2, o2) {
            this.opacity = e2 ? Math.max(0, Math.min(1, e2.opacity + (e2.placed ? t2 : -t2))) : o2 && i2 ? 1 : 0, this.placed = i2;
          }
          isHidden() {
            return 0 === this.opacity && !this.placed;
          }
        }
        class ut {
          constructor(e2, t2, i2, o2, a2) {
            this.text = new ht(e2 ? e2.text : null, t2, i2, a2), this.icon = new ht(e2 ? e2.icon : null, t2, o2, a2);
          }
          isHidden() {
            return this.text.isHidden() && this.icon.isHidden();
          }
        }
        class dt {
          constructor(e2, t2, i2) {
            this.text = e2, this.icon = t2, this.skipFade = i2;
          }
        }
        class _t {
          constructor(e2, t2, i2, o2, a2) {
            this.bucketInstanceId = e2, this.featureIndex = t2, this.sourceLayerIndex = i2, this.bucketIndex = o2, this.tileID = a2;
          }
        }
        class pt {
          constructor(e2) {
            this.crossSourceCollisions = e2, this.maxGroupID = 0, this.collisionGroups = {};
          }
          get(e2) {
            if (this.crossSourceCollisions) return { ID: 0, predicate: null };
            if (!this.collisionGroups[e2]) {
              const t2 = ++this.maxGroupID;
              this.collisionGroups[e2] = { ID: t2, predicate: (e3) => e3.collisionGroupID === t2 };
            }
            return this.collisionGroups[e2];
          }
        }
        function mt(e2, i2, o2, a2, r2) {
          const { horizontalAlign: s2, verticalAlign: n2 } = t.aP(e2);
          return new t.P(-(s2 - 0.5) * i2 + a2[0] * r2, -(n2 - 0.5) * o2 + a2[1] * r2);
        }
        class ft {
          constructor(e2, t2, i2, o2, a2) {
            this.transform = e2.clone(), this.terrain = t2, this.collisionIndex = new ct(this.transform), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = false, this.commitTime = 0, this.fadeDuration = i2, this.retainedQueryData = {}, this.collisionGroups = new pt(o2), this.collisionCircleArrays = {}, this.collisionBoxArrays = /* @__PURE__ */ new Map(), this.prevPlacement = a2, a2 && (a2.prevPlacement = void 0), this.placedOrientations = {};
          }
          _getTerrainElevationFunc(e2) {
            const t2 = this.terrain;
            return t2 ? (i2, o2) => t2.getElevation(e2, i2, o2) : null;
          }
          getBucketParts(e2, i2, o2, a2) {
            const r2 = o2.getBucket(i2), s2 = o2.latestFeatureIndex;
            if (!r2 || !s2 || i2.id !== r2.layerIds[0]) return;
            const n2 = o2.collisionBoxArray, l2 = r2.layers[0].layout, c2 = r2.layers[0].paint, h2 = Math.pow(2, this.transform.zoom - o2.tileID.overscaledZ), u2 = o2.tileSize / t.a6, d2 = o2.tileID.toUnwrapped(), _2 = "map" === l2.get("text-rotation-alignment"), p2 = t.aK(o2, 1, this.transform.zoom), m2 = t.aL(this.collisionIndex.transform, o2, c2.get("text-translate"), c2.get("text-translate-anchor")), f2 = t.aL(this.collisionIndex.transform, o2, c2.get("icon-translate"), c2.get("icon-translate-anchor")), g2 = Ze(_2, this.transform, p2);
            this.retainedQueryData[r2.bucketInstanceId] = new _t(r2.bucketInstanceId, s2, r2.sourceLayerIndex, r2.index, o2.tileID);
            const v2 = { bucket: r2, layout: l2, translationText: m2, translationIcon: f2, unwrappedTileID: d2, pitchedLabelPlaneMatrix: g2, scale: h2, textPixelRatio: u2, holdingForFade: o2.holdingForSymbolFade(), collisionBoxArray: n2, partiallyEvaluatedTextSize: t.aw(r2.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(r2.sourceID) };
            if (a2) for (const t2 of r2.sortKeyRanges) {
              const { sortKey: i3, symbolInstanceStart: o3, symbolInstanceEnd: a3 } = t2;
              e2.push({ sortKey: i3, symbolInstanceStart: o3, symbolInstanceEnd: a3, parameters: v2 });
            }
            else e2.push({ symbolInstanceStart: 0, symbolInstanceEnd: r2.symbolInstances.length, parameters: v2 });
          }
          attemptAnchorPlacement(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2, p2, m2, f2, g2, v2, x2, b2) {
            var y2, w2, T2;
            const P2 = t.aM[e2.textAnchor], C2 = [e2.textOffset0, e2.textOffset1], M2 = mt(P2, o2, a2, C2, r2), I2 = this.collisionIndex.placeCollisionBox(i2, d2, l2, c2, h2, n2, s2, f2, u2.predicate, x2, M2, b2);
            if ((!v2 || this.collisionIndex.placeCollisionBox(v2, d2, l2, c2, h2, n2, s2, g2, u2.predicate, x2, M2, b2).placeable) && I2.placeable) {
              let e3;
              if ((null === (y2 = this.prevPlacement) || void 0 === y2 ? void 0 : y2.variableOffsets[_2.crossTileID]) && (null === (T2 = null === (w2 = this.prevPlacement) || void 0 === w2 ? void 0 : w2.placements[_2.crossTileID]) || void 0 === T2 ? void 0 : T2.text) && (e3 = this.prevPlacement.variableOffsets[_2.crossTileID].anchor), 0 === _2.crossTileID) throw new Error("symbolInstance.crossTileID can't be 0");
              return this.variableOffsets[_2.crossTileID] = { textOffset: C2, width: o2, height: a2, anchor: P2, textBoxScale: r2, prevAnchor: e3 }, this.markUsedJustification(p2, P2, _2, m2), p2.allowVerticalPlacement && (this.markUsedOrientation(p2, m2, _2), this.placedOrientations[_2.crossTileID] = m2), { shift: M2, placedGlyphBoxes: I2 };
            }
          }
          placeLayerBucketPart(e2, i2, o2) {
            const { bucket: a2, layout: r2, translationText: s2, translationIcon: n2, unwrappedTileID: l2, pitchedLabelPlaneMatrix: c2, textPixelRatio: h2, holdingForFade: u2, collisionBoxArray: d2, partiallyEvaluatedTextSize: _2, collisionGroup: p2 } = e2.parameters, m2 = r2.get("text-optional"), f2 = r2.get("icon-optional"), g2 = t.aN(r2, "text-overlap", "text-allow-overlap"), v2 = "always" === g2, x2 = t.aN(r2, "icon-overlap", "icon-allow-overlap"), b2 = "always" === x2, y2 = "map" === r2.get("text-rotation-alignment"), w2 = "map" === r2.get("text-pitch-alignment"), T2 = "none" !== r2.get("icon-text-fit"), P2 = "viewport-y" === r2.get("symbol-z-order"), C2 = v2 && (b2 || !a2.hasIconData() || f2), M2 = b2 && (v2 || !a2.hasTextData() || m2);
            !a2.collisionArrays && d2 && a2.deserializeCollisionBoxes(d2);
            const I2 = this.retainedQueryData[a2.bucketInstanceId].tileID, E2 = this._getTerrainElevationFunc(I2), S2 = this.transform.getFastPathSimpleProjectionMatrix(I2), z2 = (e3, d3, b3) => {
              var P3, z3;
              if (i2[e3.crossTileID]) return;
              if (u2) return void (this.placements[e3.crossTileID] = new dt(false, false, false));
              let R2 = false, D2 = false, A2 = true, L2 = null, F2 = { box: null, placeable: false, offscreen: null, occluded: false }, k2 = { placeable: false }, B2 = null, O2 = null, j2 = null, N2 = 0, Z2 = 0, U2 = 0;
              d3.textFeatureIndex ? N2 = d3.textFeatureIndex : e3.useRuntimeCollisionCircles && (N2 = e3.featureIndex), d3.verticalTextFeatureIndex && (Z2 = d3.verticalTextFeatureIndex);
              const G2 = d3.textBox;
              if (G2) {
                const i3 = (i4) => {
                  let o3 = t.ax.horizontal;
                  if (a2.allowVerticalPlacement && !i4 && this.prevPlacement) {
                    const t2 = this.prevPlacement.placedOrientations[e3.crossTileID];
                    t2 && (this.placedOrientations[e3.crossTileID] = t2, o3 = t2, this.markUsedOrientation(a2, o3, e3));
                  }
                  return o3;
                }, r3 = (i4, o3) => {
                  if (a2.allowVerticalPlacement && e3.numVerticalGlyphVertices > 0 && d3.verticalTextBox) {
                    for (const e4 of a2.writingModes) if (e4 === t.ax.vertical ? (F2 = o3(), k2 = F2) : F2 = i4(), null == F2 ? void 0 : F2.placeable) break;
                  } else F2 = i4();
                }, c3 = e3.textAnchorOffsetStartIndex, u3 = e3.textAnchorOffsetEndIndex;
                if (u3 === c3) {
                  const o3 = (t2, i4) => {
                    const o4 = this.collisionIndex.placeCollisionBox(t2, g2, h2, I2, l2, w2, y2, s2, p2.predicate, E2, void 0, S2);
                    return (null == o4 ? void 0 : o4.placeable) && (this.markUsedOrientation(a2, i4, e3), this.placedOrientations[e3.crossTileID] = i4), o4;
                  };
                  r3((() => o3(G2, t.ax.horizontal)), (() => {
                    const i4 = d3.verticalTextBox;
                    return a2.allowVerticalPlacement && e3.numVerticalGlyphVertices > 0 && i4 ? o3(i4, t.ax.vertical) : { box: null, offscreen: null };
                  })), i3(null == F2 ? void 0 : F2.placeable);
                } else {
                  let _3 = t.aM[null === (z3 = null === (P3 = this.prevPlacement) || void 0 === P3 ? void 0 : P3.variableOffsets[e3.crossTileID]) || void 0 === z3 ? void 0 : z3.anchor];
                  const m3 = (t2, i4, r4) => {
                    const d4 = t2.x2 - t2.x1, m4 = t2.y2 - t2.y1, f4 = e3.textBoxScale, v3 = T2 && "never" === x2 ? i4 : null;
                    let b4 = null, P4 = "never" === g2 ? 1 : 2, C3 = "never";
                    _3 && P4++;
                    for (let i5 = 0; i5 < P4; i5++) {
                      for (let i6 = c3; i6 < u3; i6++) {
                        const o3 = a2.textAnchorOffsets.get(i6);
                        if (_3 && o3.textAnchor !== _3) continue;
                        const c4 = this.attemptAnchorPlacement(o3, t2, d4, m4, f4, y2, w2, h2, I2, l2, p2, C3, e3, a2, r4, s2, n2, v3, E2);
                        if (c4 && (b4 = c4.placedGlyphBoxes, null == b4 ? void 0 : b4.placeable)) return R2 = true, L2 = c4.shift, b4;
                      }
                      _3 ? _3 = null : C3 = g2;
                    }
                    return o2 && !b4 && (b4 = { box: this.collisionIndex.placeCollisionBox(G2, "always", h2, I2, l2, w2, y2, s2, p2.predicate, E2, void 0, S2).box, offscreen: false, placeable: false, occluded: false }), b4;
                  };
                  r3((() => m3(G2, d3.iconBox, t.ax.horizontal)), (() => {
                    const i4 = d3.verticalTextBox;
                    return a2.allowVerticalPlacement && !(null == F2 ? void 0 : F2.placeable) && e3.numVerticalGlyphVertices > 0 && i4 ? m3(i4, d3.verticalIconBox, t.ax.vertical) : { box: null, occluded: true, offscreen: null };
                  })), F2 && (R2 = F2.placeable, A2 = F2.offscreen);
                  const f3 = i3(null == F2 ? void 0 : F2.placeable);
                  if (!R2 && this.prevPlacement) {
                    const t2 = this.prevPlacement.variableOffsets[e3.crossTileID];
                    t2 && (this.variableOffsets[e3.crossTileID] = t2, this.markUsedJustification(a2, t2.anchor, e3, f3));
                  }
                }
              }
              if (B2 = F2, R2 = null == B2 ? void 0 : B2.placeable, A2 = null == B2 ? void 0 : B2.offscreen, e3.useRuntimeCollisionCircles && e3.centerJustifiedTextSymbolIndex >= 0) {
                const i3 = a2.text.placedSymbolArray.get(e3.centerJustifiedTextSymbolIndex), n3 = t.ay(a2.textSizeData, _2, i3), h3 = r2.get("text-padding");
                O2 = this.collisionIndex.placeCollisionCircles(g2, i3, a2.lineVertexArray, a2.glyphOffsetArray, n3, l2, c2, o2, w2, p2.predicate, e3.collisionCircleDiameter, h3, s2, E2), O2.circles.length && O2.collisionDetected && !o2 && t.w("Collisions detected, but collision boxes are not shown"), R2 = v2 || O2.circles.length > 0 && !O2.collisionDetected, A2 && (A2 = O2.offscreen);
              }
              if (d3.iconFeatureIndex && (U2 = d3.iconFeatureIndex), d3.iconBox) {
                const e4 = (e5) => this.collisionIndex.placeCollisionBox(e5, x2, h2, I2, l2, w2, y2, n2, p2.predicate, E2, T2 && L2 ? L2 : void 0, S2);
                k2 && k2.placeable && d3.verticalIconBox ? (j2 = e4(d3.verticalIconBox), D2 = j2.placeable) : (j2 = e4(d3.iconBox), D2 = j2.placeable), A2 && (A2 = j2.offscreen);
              }
              const V2 = m2 || 0 === e3.numHorizontalGlyphVertices && 0 === e3.numVerticalGlyphVertices, W2 = f2 || 0 === e3.numIconVertices;
              V2 || W2 ? W2 ? V2 || D2 && (D2 = R2) : R2 = D2 && R2 : D2 = R2 = D2 && R2;
              const q2 = D2 && j2.placeable;
              if (R2 && B2.placeable && this.collisionIndex.insertCollisionBox(B2.box, g2, r2.get("text-ignore-placement"), a2.bucketInstanceId, k2 && k2.placeable && Z2 ? Z2 : N2, p2.ID), q2 && this.collisionIndex.insertCollisionBox(j2.box, x2, r2.get("icon-ignore-placement"), a2.bucketInstanceId, U2, p2.ID), O2 && R2 && this.collisionIndex.insertCollisionCircles(O2.circles, g2, r2.get("text-ignore-placement"), a2.bucketInstanceId, N2, p2.ID), o2 && this.storeCollisionData(a2.bucketInstanceId, b3, d3, B2, j2, O2), 0 === e3.crossTileID) throw new Error("symbolInstance.crossTileID can't be 0");
              if (0 === a2.bucketInstanceId) throw new Error("bucket.bucketInstanceId can't be 0");
              this.placements[e3.crossTileID] = new dt((R2 || C2) && !(null == B2 ? void 0 : B2.occluded), (D2 || M2) && !(null == j2 ? void 0 : j2.occluded), A2 || a2.justReloaded), i2[e3.crossTileID] = true;
            };
            if (P2) {
              if (0 !== e2.symbolInstanceStart) throw new Error("bucket.bucketInstanceId should be 0");
              const t2 = a2.getSortedSymbolIndexes(-this.transform.bearingInRadians);
              for (let e3 = t2.length - 1; e3 >= 0; --e3) {
                const i3 = t2[e3];
                z2(a2.symbolInstances.get(i3), a2.collisionArrays[i3], i3);
              }
            } else for (let t2 = e2.symbolInstanceStart; t2 < e2.symbolInstanceEnd; t2++) z2(a2.symbolInstances.get(t2), a2.collisionArrays[t2], t2);
            a2.justReloaded = false;
          }
          storeCollisionData(e2, t2, i2, o2, a2, r2) {
            if (i2.textBox || i2.iconBox) {
              let r3, s2;
              this.collisionBoxArrays.has(e2) ? r3 = this.collisionBoxArrays.get(e2) : (r3 = /* @__PURE__ */ new Map(), this.collisionBoxArrays.set(e2, r3)), r3.has(t2) ? s2 = r3.get(t2) : (s2 = { text: null, icon: null }, r3.set(t2, s2)), i2.textBox && (s2.text = o2.box), i2.iconBox && (s2.icon = a2.box);
            }
            if (r2) {
              let t3 = this.collisionCircleArrays[e2];
              void 0 === t3 && (t3 = this.collisionCircleArrays[e2] = []);
              for (let e3 = 0; e3 < r2.circles.length; e3 += 4) t3.push(r2.circles[e3 + 0] - lt), t3.push(r2.circles[e3 + 1] - lt), t3.push(r2.circles[e3 + 2]), t3.push(r2.collisionDetected ? 1 : 0);
            }
          }
          markUsedJustification(e2, i2, o2, a2) {
            let r2;
            r2 = a2 === t.ax.vertical ? o2.verticalPlacedTextSymbolIndex : { left: o2.leftJustifiedTextSymbolIndex, center: o2.centerJustifiedTextSymbolIndex, right: o2.rightJustifiedTextSymbolIndex }[t.aO(i2)];
            const s2 = [o2.leftJustifiedTextSymbolIndex, o2.centerJustifiedTextSymbolIndex, o2.rightJustifiedTextSymbolIndex, o2.verticalPlacedTextSymbolIndex];
            for (const t2 of s2) t2 >= 0 && (e2.text.placedSymbolArray.get(t2).crossTileID = r2 >= 0 && t2 !== r2 ? 0 : o2.crossTileID);
          }
          markUsedOrientation(e2, i2, o2) {
            const a2 = i2 === t.ax.horizontal || i2 === t.ax.horizontalOnly ? i2 : 0, r2 = i2 === t.ax.vertical ? i2 : 0, s2 = [o2.leftJustifiedTextSymbolIndex, o2.centerJustifiedTextSymbolIndex, o2.rightJustifiedTextSymbolIndex];
            for (const t2 of s2) e2.text.placedSymbolArray.get(t2).placedOrientation = a2;
            o2.verticalPlacedTextSymbolIndex && (e2.text.placedSymbolArray.get(o2.verticalPlacedTextSymbolIndex).placedOrientation = r2);
          }
          commit(e2) {
            this.commitTime = e2, this.zoomAtLastRecencyCheck = this.transform.zoom;
            const t2 = this.prevPlacement;
            let i2 = false;
            this.prevZoomAdjustment = t2 ? t2.zoomAdjustment(this.transform.zoom) : 0;
            const o2 = t2 ? t2.symbolFadeChange(e2) : 1, a2 = t2 ? t2.opacities : {}, r2 = t2 ? t2.variableOffsets : {}, s2 = t2 ? t2.placedOrientations : {};
            for (const e3 in this.placements) {
              const t3 = this.placements[e3], r3 = a2[e3];
              r3 ? (this.opacities[e3] = new ut(r3, o2, t3.text, t3.icon), i2 || (i2 = t3.text !== r3.text.placed), i2 || (i2 = t3.icon !== r3.icon.placed)) : (this.opacities[e3] = new ut(null, o2, t3.text, t3.icon, t3.skipFade), i2 || (i2 = t3.text || t3.icon));
            }
            for (const e3 in a2) {
              const t3 = a2[e3];
              if (!this.opacities[e3]) {
                const a3 = new ut(t3, o2, false, false);
                a3.isHidden() || (this.opacities[e3] = a3, i2 || (i2 = t3.text.placed), i2 || (i2 = t3.icon.placed));
              }
            }
            for (const e3 in r2) this.variableOffsets[e3] || !this.opacities[e3] || this.opacities[e3].isHidden() || (this.variableOffsets[e3] = r2[e3]);
            for (const e3 in s2) this.placedOrientations[e3] || !this.opacities[e3] || this.opacities[e3].isHidden() || (this.placedOrientations[e3] = s2[e3]);
            if (t2 && void 0 === t2.lastPlacementChangeTime) throw new Error("Last placement time for previous placement is not defined");
            i2 ? this.lastPlacementChangeTime = e2 : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = t2 ? t2.lastPlacementChangeTime : e2);
          }
          updateLayerOpacities(e2, t2) {
            const i2 = {};
            for (const o2 of t2) {
              const t3 = o2.getBucket(e2);
              t3 && o2.latestFeatureIndex && e2.id === t3.layerIds[0] && this.updateBucketOpacities(t3, o2.tileID, i2, o2.collisionBoxArray);
            }
          }
          updateBucketOpacities(e2, i2, o2, a2) {
            e2.hasTextData() && (e2.text.opacityVertexArray.clear(), e2.text.hasVisibleVertices = false), e2.hasIconData() && (e2.icon.opacityVertexArray.clear(), e2.icon.hasVisibleVertices = false), e2.hasIconCollisionBoxData() && e2.iconCollisionBox.collisionVertexArray.clear(), e2.hasTextCollisionBoxData() && e2.textCollisionBox.collisionVertexArray.clear();
            const r2 = e2.layers[0], s2 = r2.layout, n2 = new ut(null, 0, false, false, true), l2 = s2.get("text-allow-overlap"), c2 = s2.get("icon-allow-overlap"), h2 = r2._unevaluatedLayout.hasValue("text-variable-anchor") || r2._unevaluatedLayout.hasValue("text-variable-anchor-offset"), u2 = "map" === s2.get("text-rotation-alignment"), d2 = "map" === s2.get("text-pitch-alignment"), _2 = "none" !== s2.get("icon-text-fit"), p2 = new ut(null, 0, l2 && (c2 || !e2.hasIconData() || s2.get("icon-optional")), c2 && (l2 || !e2.hasTextData() || s2.get("text-optional")), true);
            !e2.collisionArrays && a2 && (e2.hasIconCollisionBoxData() || e2.hasTextCollisionBoxData()) && e2.deserializeCollisionBoxes(a2);
            const m2 = (e3, t2, i3) => {
              for (let o3 = 0; o3 < t2 / 4; o3++) e3.opacityVertexArray.emplaceBack(i3);
              e3.hasVisibleVertices || (e3.hasVisibleVertices = i3 !== Mt);
            }, f2 = this.collisionBoxArrays.get(e2.bucketInstanceId);
            for (let i3 = 0; i3 < e2.symbolInstances.length; i3++) {
              const a3 = e2.symbolInstances.get(i3), { numHorizontalGlyphVertices: r3, numVerticalGlyphVertices: s3, crossTileID: l3 } = a3;
              let c3 = this.opacities[l3];
              o2[l3] ? c3 = n2 : c3 || (c3 = p2, this.opacities[l3] = c3), o2[l3] = true;
              const g2 = a3.numIconVertices > 0, v2 = this.placedOrientations[a3.crossTileID], x2 = v2 === t.ax.vertical, b2 = v2 === t.ax.horizontal || v2 === t.ax.horizontalOnly;
              if (r3 > 0 || s3 > 0) {
                const t2 = Ct(c3.text);
                m2(e2.text, r3, x2 ? Mt : t2), m2(e2.text, s3, b2 ? Mt : t2);
                const i4 = c3.text.isHidden(), o3 = [a3.rightJustifiedTextSymbolIndex, a3.centerJustifiedTextSymbolIndex, a3.leftJustifiedTextSymbolIndex];
                for (const t3 of o3) t3 >= 0 && (e2.text.placedSymbolArray.get(t3).hidden = i4 || x2 ? 1 : 0);
                a3.verticalPlacedTextSymbolIndex >= 0 && (e2.text.placedSymbolArray.get(a3.verticalPlacedTextSymbolIndex).hidden = i4 || b2 ? 1 : 0);
                const n3 = this.variableOffsets[a3.crossTileID];
                n3 && this.markUsedJustification(e2, n3.anchor, a3, v2);
                const l4 = this.placedOrientations[a3.crossTileID];
                l4 && (this.markUsedJustification(e2, "left", a3, l4), this.markUsedOrientation(e2, l4, a3));
              }
              if (g2) {
                const t2 = Ct(c3.icon), i4 = !(_2 && a3.verticalPlacedIconSymbolIndex && x2);
                a3.placedIconSymbolIndex >= 0 && (m2(e2.icon, a3.numIconVertices, i4 ? t2 : Mt), e2.icon.placedSymbolArray.get(a3.placedIconSymbolIndex).hidden = c3.icon.isHidden()), a3.verticalPlacedIconSymbolIndex >= 0 && (m2(e2.icon, a3.numVerticalIconVertices, i4 ? Mt : t2), e2.icon.placedSymbolArray.get(a3.verticalPlacedIconSymbolIndex).hidden = c3.icon.isHidden());
              }
              const y2 = (null == f2 ? void 0 : f2.has(i3)) ? f2.get(i3) : { text: null, icon: null };
              if (e2.hasIconCollisionBoxData() || e2.hasTextCollisionBoxData()) {
                const o3 = e2.collisionArrays[i3];
                if (o3) {
                  let i4 = new t.P(0, 0);
                  if (o3.textBox || o3.verticalTextBox) {
                    let t2 = true;
                    if (h2) {
                      const e3 = this.variableOffsets[l3];
                      e3 ? (i4 = mt(e3.anchor, e3.width, e3.height, e3.textOffset, e3.textBoxScale), u2 && i4._rotate(d2 ? -this.transform.bearingInRadians : this.transform.bearingInRadians)) : t2 = false;
                    }
                    if (o3.textBox || o3.verticalTextBox) {
                      let a4;
                      o3.textBox && (a4 = x2), o3.verticalTextBox && (a4 = b2), gt(e2.textCollisionBox.collisionVertexArray, c3.text.placed, !t2 || a4, y2.text, i4.x, i4.y);
                    }
                  }
                  if (o3.iconBox || o3.verticalIconBox) {
                    const t2 = Boolean(!b2 && o3.verticalIconBox);
                    let a4;
                    o3.iconBox && (a4 = t2), o3.verticalIconBox && (a4 = !t2), gt(e2.iconCollisionBox.collisionVertexArray, c3.icon.placed, a4, y2.icon, _2 ? i4.x : 0, _2 ? i4.y : 0);
                  }
                }
              }
            }
            if (e2.sortFeatures(-this.transform.bearingInRadians), this.retainedQueryData[e2.bucketInstanceId] && (this.retainedQueryData[e2.bucketInstanceId].featureSortOrder = e2.featureSortOrder), e2.hasTextData() && e2.text.opacityVertexBuffer && e2.text.opacityVertexBuffer.updateData(e2.text.opacityVertexArray), e2.hasIconData() && e2.icon.opacityVertexBuffer && e2.icon.opacityVertexBuffer.updateData(e2.icon.opacityVertexArray), e2.hasIconCollisionBoxData() && e2.iconCollisionBox.collisionVertexBuffer && e2.iconCollisionBox.collisionVertexBuffer.updateData(e2.iconCollisionBox.collisionVertexArray), e2.hasTextCollisionBoxData() && e2.textCollisionBox.collisionVertexBuffer && e2.textCollisionBox.collisionVertexBuffer.updateData(e2.textCollisionBox.collisionVertexArray), e2.text.opacityVertexArray.length !== e2.text.layoutVertexArray.length / 4) throw new Error(`bucket.text.opacityVertexArray.length (= ${e2.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e2.text.layoutVertexArray.length}) / 4`);
            if (e2.icon.opacityVertexArray.length !== e2.icon.layoutVertexArray.length / 4) throw new Error(`bucket.icon.opacityVertexArray.length (= ${e2.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e2.icon.layoutVertexArray.length}) / 4`);
            e2.bucketInstanceId in this.collisionCircleArrays && (e2.collisionCircleArray = this.collisionCircleArrays[e2.bucketInstanceId], delete this.collisionCircleArrays[e2.bucketInstanceId]);
          }
          symbolFadeChange(e2) {
            return 0 === this.fadeDuration ? 1 : (e2 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;
          }
          zoomAdjustment(e2) {
            return Math.max(0, (this.transform.zoom - e2) / 1.5);
          }
          hasTransitions(e2) {
            return this.stale || e2 - this.lastPlacementChangeTime < this.fadeDuration;
          }
          stillRecent(e2, t2) {
            const i2 = this.zoomAtLastRecencyCheck === t2 ? 1 - this.zoomAdjustment(t2) : 1;
            return this.zoomAtLastRecencyCheck = t2, this.commitTime + this.fadeDuration * i2 > e2;
          }
          setStale() {
            this.stale = true;
          }
        }
        function gt(e2, t2, i2, o2, a2, r2) {
          o2 && 0 !== o2.length || (o2 = [0, 0, 0, 0]);
          const s2 = o2[0] - lt, n2 = o2[1] - lt, l2 = o2[2] - lt, c2 = o2[3] - lt;
          e2.emplaceBack(t2 ? 1 : 0, i2 ? 1 : 0, a2 || 0, r2 || 0, s2, n2), e2.emplaceBack(t2 ? 1 : 0, i2 ? 1 : 0, a2 || 0, r2 || 0, l2, n2), e2.emplaceBack(t2 ? 1 : 0, i2 ? 1 : 0, a2 || 0, r2 || 0, l2, c2), e2.emplaceBack(t2 ? 1 : 0, i2 ? 1 : 0, a2 || 0, r2 || 0, s2, c2);
        }
        const vt = Math.pow(2, 25), xt = Math.pow(2, 24), bt = Math.pow(2, 17), yt = Math.pow(2, 16), wt = Math.pow(2, 9), Tt = Math.pow(2, 8), Pt = Math.pow(2, 1);
        function Ct(e2) {
          if (0 === e2.opacity && !e2.placed) return 0;
          if (1 === e2.opacity && e2.placed) return 4294967295;
          const t2 = e2.placed ? 1 : 0, i2 = Math.floor(127 * e2.opacity);
          return i2 * vt + t2 * xt + i2 * bt + t2 * yt + i2 * wt + t2 * Tt + i2 * Pt + t2;
        }
        const Mt = 0;
        class It {
          constructor(e2) {
            this._sortAcrossTiles = "viewport-y" !== e2.layout.get("symbol-z-order") && !e2.layout.get("symbol-sort-key").isConstant(), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];
          }
          continuePlacement(e2, t2, i2, o2, a2) {
            const r2 = this._bucketParts;
            for (; this._currentTileIndex < e2.length; ) if (t2.getBucketParts(r2, o2, e2[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, a2()) return true;
            for (this._sortAcrossTiles && (this._sortAcrossTiles = false, r2.sort(((e3, t3) => e3.sortKey - t3.sortKey))); this._currentPartIndex < r2.length; ) if (t2.placeLayerBucketPart(r2[this._currentPartIndex], this._seenCrossTileIDs, i2), this._currentPartIndex++, a2()) return true;
            return false;
          }
        }
        class Et {
          constructor(e2, t2, i2, o2, a2, r2, s2, n2) {
            this.placement = new ft(e2, t2, r2, s2, n2), this._currentPlacementIndex = i2.length - 1, this._forceFullPlacement = o2, this._showCollisionBoxes = a2, this._done = false;
          }
          isDone() {
            return this._done;
          }
          continuePlacement(e2, i2, o2) {
            const a2 = c(), r2 = () => !this._forceFullPlacement && c() - a2 > 2;
            for (; this._currentPlacementIndex >= 0; ) {
              const a3 = i2[e2[this._currentPlacementIndex]], s2 = this.placement.collisionIndex.transform.zoom;
              if (t.aQ(a3) && a3.layout && (!a3.minzoom || a3.minzoom <= s2) && (!a3.maxzoom || a3.maxzoom > s2)) {
                if (this._inProgressLayer || (this._inProgressLayer = new It(a3)), this._inProgressLayer.continuePlacement(o2[a3.source], this.placement, this._showCollisionBoxes, a3, r2)) return;
                delete this._inProgressLayer;
              }
              this._currentPlacementIndex--;
            }
            this._done = true;
          }
          commit(e2) {
            return this.placement.commit(e2), this.placement;
          }
        }
        const St = 512 / t.a6 / 2;
        class zt {
          constructor(e2, i2, o2) {
            this.tileID = e2, this.bucketInstanceId = o2, this._symbolsByKey = {};
            const a2 = /* @__PURE__ */ new Map();
            for (let e3 = 0; e3 < i2.length; e3++) {
              const t2 = i2.get(e3), o3 = t2.key, r2 = a2.get(o3);
              r2 ? r2.push(t2) : a2.set(o3, [t2]);
            }
            for (const [e3, i3] of a2) {
              const o3 = { positions: i3.map(((e4) => ({ x: Math.floor(e4.anchorX * St), y: Math.floor(e4.anchorY * St) }))), crossTileIDs: i3.map(((e4) => e4.crossTileID)) };
              if (o3.positions.length > 128) {
                const e4 = new t.aR(o3.positions.length, 16, Uint16Array);
                for (const { x: t2, y: i4 } of o3.positions) e4.add(t2, i4);
                e4.finish(), delete o3.positions, o3.index = e4;
              }
              this._symbolsByKey[e3] = o3;
            }
          }
          getScaledCoordinates(e2, i2) {
            const { x: o2, y: a2, z: r2 } = this.tileID.canonical, { x: s2, y: n2, z: l2 } = i2.canonical, c2 = St / Math.pow(2, l2 - r2), h2 = (n2 * t.a6 + e2.anchorY) * c2, u2 = a2 * t.a6 * St;
            return { x: Math.floor((s2 * t.a6 + e2.anchorX) * c2 - o2 * t.a6 * St), y: Math.floor(h2 - u2) };
          }
          findMatches(e2, t2, i2) {
            const o2 = this.tileID.canonical.z < t2.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - t2.canonical.z);
            for (let a2 = 0; a2 < e2.length; a2++) {
              const r2 = e2.get(a2);
              if (r2.crossTileID) continue;
              const s2 = this._symbolsByKey[r2.key];
              if (!s2) continue;
              const n2 = this.getScaledCoordinates(r2, t2);
              if (s2.index) {
                const e3 = s2.index.range(n2.x - o2, n2.y - o2, n2.x + o2, n2.y + o2).sort();
                for (const t3 of e3) {
                  const e4 = s2.crossTileIDs[t3];
                  if (!i2[e4]) {
                    i2[e4] = true, r2.crossTileID = e4;
                    break;
                  }
                }
              } else if (s2.positions) for (let e3 = 0; e3 < s2.positions.length; e3++) {
                const t3 = s2.positions[e3], a3 = s2.crossTileIDs[e3];
                if (Math.abs(t3.x - n2.x) <= o2 && Math.abs(t3.y - n2.y) <= o2 && !i2[a3]) {
                  i2[a3] = true, r2.crossTileID = a3;
                  break;
                }
              }
            }
          }
          getCrossTileIDsLists() {
            return Object.values(this._symbolsByKey).map((({ crossTileIDs: e2 }) => e2));
          }
        }
        class Rt {
          constructor() {
            this.maxCrossTileID = 0;
          }
          generate() {
            return ++this.maxCrossTileID;
          }
        }
        class Dt {
          constructor() {
            this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;
          }
          handleWrapJump(e2) {
            const t2 = Math.round((e2 - this.lng) / 360);
            if (0 !== t2) for (const e3 in this.indexes) {
              const i2 = this.indexes[e3], o2 = {};
              for (const e4 in i2) {
                const a2 = i2[e4];
                a2.tileID = a2.tileID.unwrapTo(a2.tileID.wrap + t2), o2[a2.tileID.key] = a2;
              }
              this.indexes[e3] = o2;
            }
            this.lng = e2;
          }
          addBucket(e2, t2, i2) {
            var o2, a2, r2;
            if (null === (o2 = this.indexes[e2.overscaledZ]) || void 0 === o2 ? void 0 : o2[e2.key]) {
              if (this.indexes[e2.overscaledZ][e2.key].bucketInstanceId === t2.bucketInstanceId) return false;
              this.removeBucketCrossTileIDs(e2.overscaledZ, this.indexes[e2.overscaledZ][e2.key]);
            }
            for (let e3 = 0; e3 < t2.symbolInstances.length; e3++) t2.symbolInstances.get(e3).crossTileID = 0;
            (a2 = this.usedCrossTileIDs)[r2 = e2.overscaledZ] || (a2[r2] = {});
            const s2 = this.usedCrossTileIDs[e2.overscaledZ];
            for (const i3 in this.indexes) {
              const o3 = this.indexes[i3];
              if (Number(i3) > e2.overscaledZ) for (const i4 in o3) {
                const a3 = o3[i4];
                a3.tileID.isChildOf(e2) && a3.findMatches(t2.symbolInstances, e2, s2);
              }
              else {
                const a3 = o3[e2.scaledTo(Number(i3)).key];
                a3 && a3.findMatches(t2.symbolInstances, e2, s2);
              }
            }
            for (let e3 = 0; e3 < t2.symbolInstances.length; e3++) {
              const o3 = t2.symbolInstances.get(e3);
              o3.crossTileID || (o3.crossTileID = i2.generate(), s2[o3.crossTileID] = true);
            }
            return void 0 === this.indexes[e2.overscaledZ] && (this.indexes[e2.overscaledZ] = {}), this.indexes[e2.overscaledZ][e2.key] = new zt(e2, t2.symbolInstances, t2.bucketInstanceId), true;
          }
          removeBucketCrossTileIDs(e2, t2) {
            for (const i2 of t2.getCrossTileIDsLists()) for (const t3 of i2) delete this.usedCrossTileIDs[e2][t3];
          }
          removeStaleBuckets(e2) {
            let t2 = false;
            for (const i2 in this.indexes) {
              const o2 = this.indexes[i2];
              for (const a2 in o2) e2[o2[a2].bucketInstanceId] || (this.removeBucketCrossTileIDs(i2, o2[a2]), delete o2[a2], t2 = true);
            }
            return t2;
          }
        }
        class At {
          constructor() {
            this.layerIndexes = {}, this.crossTileIDs = new Rt(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
          }
          addLayer(e2, t2, i2) {
            let o2 = this.layerIndexes[e2.id];
            void 0 === o2 && (o2 = this.layerIndexes[e2.id] = new Dt());
            let a2 = false;
            const r2 = {};
            o2.handleWrapJump(i2);
            for (const i3 of t2) {
              const t3 = i3.getBucket(e2);
              e2.id === (null == t3 ? void 0 : t3.layerIds[0]) && (t3.bucketInstanceId || (this.maxBucketInstanceId += 1, t3.bucketInstanceId = this.maxBucketInstanceId), o2.addBucket(i3.tileID, t3, this.crossTileIDs) && (a2 = true), r2[t3.bucketInstanceId] = true);
            }
            return o2.removeStaleBuckets(r2) && (a2 = true), a2;
          }
          pruneUnusedLayers(e2) {
            const t2 = {};
            for (const i2 of e2) t2[i2] = true;
            for (const e3 in this.layerIndexes) t2[e3] || delete this.layerIndexes[e3];
          }
        }
        var Lt = "void main() {fragColor=vec4(1.0);}";
        const Ft = { prelude: kt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;", "#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}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\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(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));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"), projectionMercator: kt("", "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: kt("", "#define GLOBE_RADIUS 6371008.8\nuniform 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\n);}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); \nif (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\n);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: kt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"), backgroundPattern: kt("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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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: kt("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);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;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat 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 {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_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);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} 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: kt(Lt, "in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"), heatmap: kt("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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);\n#ifdef GLOBE\nvec2 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);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"), heatmapTexture: kt("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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}", "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: kt("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: kt("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: kt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform 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\n{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));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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: kt("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: kt(Lt, "in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"), fill: kt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"), fillOutline: kt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"), fillOutlinePattern: kt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"), fillPattern: kt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=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: kt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=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;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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: kt("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;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=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;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: 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: kt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform 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);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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: kt("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];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat 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\n{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\n{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);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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: kt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"), lineGradient: kt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"), linePattern: kt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"), lineSDF: kt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=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);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nfloat 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: kt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=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);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nfloat 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: kt("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);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"), symbolIcon: kt("uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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_total_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 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;}"), symbolSDF: kt("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;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);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,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;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"), symbolTextAndIcon: kt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}", "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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}"), terrain: kt("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 && u_fog_ground_blend_opacity > 0.0 && 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,ele-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: kt("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: kt("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: kt("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: kt("#ifdef GL_ES\nprecision highp float;\n#endif\nin 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\n);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: kt("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 kt(e2, t2) {
          const i2 = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, o2 = t2.match(/in ([\w]+) ([\w]+)/g), a2 = e2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), r2 = t2.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), s2 = r2 ? r2.concat(a2) : a2, n2 = {};
          return { fragmentSource: e2 = e2.replace(i2, ((e3, t3, i3, o3, a3) => (n2[a3] = true, "define" === t3 ? `
#ifndef HAS_UNIFORM_u_${a3}
in ${i3} ${o3} ${a3};
#else
uniform ${i3} ${o3} u_${a3};
#endif
` : `
#ifdef HAS_UNIFORM_u_${a3}
    ${i3} ${o3} ${a3} = u_${a3};
#endif
`))), vertexSource: t2 = t2.replace(i2, ((e3, t3, i3, o3, a3) => {
            const r3 = "float" === o3 ? "vec2" : "vec4", s3 = a3.match(/color/) ? "color" : r3;
            return n2[a3] ? "define" === t3 ? `
#ifndef HAS_UNIFORM_u_${a3}
uniform lowp float u_${a3}_t;
in ${i3} ${r3} a_${a3};
out ${i3} ${o3} ${a3};
#else
uniform ${i3} ${o3} u_${a3};
#endif
` : "vec4" === s3 ? `
#ifndef HAS_UNIFORM_u_${a3}
    ${a3} = a_${a3};
#else
    ${i3} ${o3} ${a3} = u_${a3};
#endif
` : `
#ifndef HAS_UNIFORM_u_${a3}
    ${a3} = unpack_mix_${s3}(a_${a3}, u_${a3}_t);
#else
    ${i3} ${o3} ${a3} = u_${a3};
#endif
` : "define" === t3 ? `
#ifndef HAS_UNIFORM_u_${a3}
uniform lowp float u_${a3}_t;
in ${i3} ${r3} a_${a3};
#else
uniform ${i3} ${o3} u_${a3};
#endif
` : "vec4" === s3 ? `
#ifndef HAS_UNIFORM_u_${a3}
    ${i3} ${o3} ${a3} = a_${a3};
#else
    ${i3} ${o3} ${a3} = u_${a3};
#endif
` : `
#ifndef HAS_UNIFORM_u_${a3}
    ${i3} ${o3} ${a3} = unpack_mix_${s3}(a_${a3}, u_${a3}_t);
#else
    ${i3} ${o3} ${a3} = u_${a3};
#endif
`;
          })), staticAttributes: o2, staticUniforms: s2 };
        }
        class Bt {
          constructor(e2, t2, i2) {
            this.vertexBuffer = e2, this.indexBuffer = t2, this.segments = i2;
          }
          destroy() {
            this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.vertexBuffer = null, this.indexBuffer = null, this.segments = null;
          }
        }
        var Ot = t.aS([{ name: "a_pos", type: "Int16", components: 2 }]);
        const jt = "#define PROJECTION_MERCATOR", Nt = "mercator";
        class Zt {
          constructor() {
            this._cachedMesh = null;
          }
          get name() {
            return "mercator";
          }
          get useSubdivision() {
            return false;
          }
          get shaderVariantName() {
            return Nt;
          }
          get shaderDefine() {
            return jt;
          }
          get shaderPreludeCode() {
            return Ft.projectionMercator;
          }
          get vertexShaderPreludeCode() {
            return Ft.projectionMercator.vertexSource;
          }
          get subdivisionGranularity() {
            return t.aT.noSubdivision;
          }
          get useGlobeControls() {
            return false;
          }
          get transitionState() {
            return 0;
          }
          get latitudeErrorCorrectionRadians() {
            return 0;
          }
          destroy() {
          }
          updateGPUdependent(e2) {
          }
          getMeshFromTileID(e2, i2, o2, a2, r2) {
            if (this._cachedMesh) return this._cachedMesh;
            const s2 = new t.aU();
            s2.emplaceBack(0, 0), s2.emplaceBack(t.a6, 0), s2.emplaceBack(0, t.a6), s2.emplaceBack(t.a6, t.a6);
            const n2 = e2.createVertexBuffer(s2, Ot.members), l2 = t.aV.simpleSegment(0, 0, 4, 2), c2 = new t.aW();
            c2.emplaceBack(1, 0, 2), c2.emplaceBack(1, 2, 3);
            const h2 = e2.createIndexBuffer(c2);
            return this._cachedMesh = new Bt(n2, h2, l2), this._cachedMesh;
          }
          recalculate() {
          }
          hasTransition() {
            return false;
          }
          setErrorQueryLatitudeDegrees(e2) {
          }
        }
        class Ut {
          constructor(e2 = 0, t2 = 0, i2 = 0, o2 = 0) {
            if (isNaN(e2) || e2 < 0 || isNaN(t2) || t2 < 0 || isNaN(i2) || i2 < 0 || isNaN(o2) || o2 < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
            this.top = e2, this.bottom = t2, this.left = i2, this.right = o2;
          }
          interpolate(e2, i2, o2) {
            return null != i2.top && null != e2.top && (this.top = t.H.number(e2.top, i2.top, o2)), null != i2.bottom && null != e2.bottom && (this.bottom = t.H.number(e2.bottom, i2.bottom, o2)), null != i2.left && null != e2.left && (this.left = t.H.number(e2.left, i2.left, o2)), null != i2.right && null != e2.right && (this.right = t.H.number(e2.right, i2.right, o2)), this;
          }
          getCenter(e2, i2) {
            const o2 = t.al((this.left + e2 - this.right) / 2, 0, e2), a2 = t.al((this.top + i2 - this.bottom) / 2, 0, i2);
            return new t.P(o2, a2);
          }
          equals(e2) {
            return this.top === e2.top && this.bottom === e2.bottom && this.left === e2.left && this.right === e2.right;
          }
          clone() {
            return new Ut(this.top, this.bottom, this.left, this.right);
          }
          toJSON() {
            return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };
          }
        }
        function Gt(e2, t2) {
          if (!e2.renderWorldCopies || e2.lngRange) return;
          const i2 = t2.lng - e2.center.lng;
          t2.lng += i2 > 180 ? -360 : i2 < -180 ? 360 : 0;
        }
        function Vt(e2) {
          return Math.max(0, Math.floor(e2));
        }
        class Wt {
          constructor(e2, i2) {
            var o2;
            this.applyConstrain = (e3, t2) => null !== this._constrainOverride ? this._constrainOverride(e3, t2) : this._callbacks.defaultConstrain(e3, t2), this._callbacks = e2, this._tileSize = 512, this._renderWorldCopies = void 0 === (null == i2 ? void 0 : i2.renderWorldCopies) || !!(null == i2 ? void 0 : i2.renderWorldCopies), this._minZoom = (null == i2 ? void 0 : i2.minZoom) || 0, this._maxZoom = (null == i2 ? void 0 : i2.maxZoom) || 22, this._minPitch = null == (null == i2 ? void 0 : i2.minPitch) ? 0 : null == i2 ? void 0 : i2.minPitch, this._maxPitch = null == (null == i2 ? void 0 : i2.maxPitch) ? 60 : null == i2 ? void 0 : i2.maxPitch, this._constrainOverride = null !== (o2 = null == i2 ? void 0 : i2.constrainOverride) && void 0 !== o2 ? o2 : null, this.setMaxBounds(), this._width = 0, this._height = 0, this._center = new t.W(0, 0), this._elevation = 0, this._zoom = 0, this._tileZoom = Vt(this._zoom), this._scale = t.ao(this._zoom), this._bearingInRadians = 0, this._fovInRadians = 0.6435011087932844, this._pitchInRadians = 0, this._rollInRadians = 0, this._unmodified = true, this._edgeInsets = new Ut(), this._minElevationForCurrentTile = 0, this._autoCalculateNearFarZ = true;
          }
          apply(e2, i2, o2) {
            this._constrainOverride = e2.constrainOverride, this._latRange = e2.latRange, this._lngRange = e2.lngRange, this._width = e2.width, this._height = e2.height, this._center = e2.center, this._elevation = e2.elevation, this._minElevationForCurrentTile = e2.minElevationForCurrentTile, this._zoom = e2.zoom, this._tileZoom = Vt(this._zoom), this._scale = t.ao(this._zoom), this._bearingInRadians = e2.bearingInRadians, this._fovInRadians = e2.fovInRadians, this._pitchInRadians = e2.pitchInRadians, this._rollInRadians = e2.rollInRadians, this._unmodified = e2.unmodified, this._edgeInsets = new Ut(e2.padding.top, e2.padding.bottom, e2.padding.left, e2.padding.right), this._minZoom = e2.minZoom, this._maxZoom = e2.maxZoom, this._minPitch = e2.minPitch, this._maxPitch = e2.maxPitch, this._renderWorldCopies = e2.renderWorldCopies, this._cameraToCenterDistance = e2.cameraToCenterDistance, this._nearZ = e2.nearZ, this._farZ = e2.farZ, this._autoCalculateNearFarZ = !o2 && e2.autoCalculateNearFarZ, i2 && this.constrainInternal(), this._calcMatrices();
          }
          get pixelsToClipSpaceMatrix() {
            return this._pixelsToClipSpaceMatrix;
          }
          get clipSpaceToPixelsMatrix() {
            return this._clipSpaceToPixelsMatrix;
          }
          get minElevationForCurrentTile() {
            return this._minElevationForCurrentTile;
          }
          setMinElevationForCurrentTile(e2) {
            this._minElevationForCurrentTile = e2;
          }
          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(e2) {
            this._minZoom !== e2 && (this._minZoom = e2, this.setZoom(this.applyConstrain(this._center, this.zoom).zoom));
          }
          get maxZoom() {
            return this._maxZoom;
          }
          setMaxZoom(e2) {
            this._maxZoom !== e2 && (this._maxZoom = e2, this.setZoom(this.applyConstrain(this._center, this.zoom).zoom));
          }
          get minPitch() {
            return this._minPitch;
          }
          setMinPitch(e2) {
            this._minPitch !== e2 && (this._minPitch = e2, this.setPitch(Math.max(this.pitch, e2)));
          }
          get maxPitch() {
            return this._maxPitch;
          }
          setMaxPitch(e2) {
            this._maxPitch !== e2 && (this._maxPitch = e2, this.setPitch(Math.min(this.pitch, e2)));
          }
          get renderWorldCopies() {
            return this._renderWorldCopies;
          }
          setRenderWorldCopies(e2) {
            void 0 === e2 ? e2 = true : null === e2 && (e2 = false), this._renderWorldCopies = e2;
          }
          get constrainOverride() {
            return this._constrainOverride;
          }
          setConstrainOverride(e2) {
            void 0 === e2 && (e2 = null), this._constrainOverride !== e2 && (this._constrainOverride = e2, 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 t.P(this._width, this._height);
          }
          get bearing() {
            return this._bearingInRadians / Math.PI * 180;
          }
          setBearing(e2) {
            const i2 = t.X(e2, -180, 180) * Math.PI / 180;
            var a2, r2, s2, n2, l2, c2, h2, u2, d2;
            this._bearingInRadians !== i2 && (this._unmodified = false, this._bearingInRadians = i2, this._calcMatrices(), this._rotationMatrix = o(), a2 = this._rotationMatrix, s2 = -this._bearingInRadians, n2 = (r2 = this._rotationMatrix)[0], l2 = r2[1], c2 = r2[2], h2 = r2[3], u2 = Math.sin(s2), d2 = Math.cos(s2), a2[0] = n2 * d2 + c2 * u2, a2[1] = l2 * d2 + h2 * u2, a2[2] = n2 * -u2 + c2 * d2, a2[3] = l2 * -u2 + h2 * d2);
          }
          get rotationMatrix() {
            return this._rotationMatrix;
          }
          get pitchInRadians() {
            return this._pitchInRadians;
          }
          get pitch() {
            return this._pitchInRadians / Math.PI * 180;
          }
          setPitch(e2) {
            const i2 = t.al(e2, this.minPitch, this.maxPitch) / 180 * Math.PI;
            this._pitchInRadians !== i2 && (this._unmodified = false, this._pitchInRadians = i2, this._calcMatrices());
          }
          get rollInRadians() {
            return this._rollInRadians;
          }
          get roll() {
            return this._rollInRadians / Math.PI * 180;
          }
          setRoll(e2) {
            const t2 = e2 / 180 * Math.PI;
            this._rollInRadians !== t2 && (this._unmodified = false, this._rollInRadians = t2, this._calcMatrices());
          }
          get fovInRadians() {
            return this._fovInRadians;
          }
          get fov() {
            return t.aX(this._fovInRadians);
          }
          setFov(e2) {
            e2 = t.al(e2, 0.1, 150), this.fov !== e2 && (this._unmodified = false, this._fovInRadians = t.an(e2), this._calcMatrices());
          }
          get zoom() {
            return this._zoom;
          }
          setZoom(e2) {
            const i2 = this.applyConstrain(this._center, e2).zoom;
            this._zoom !== i2 && (this._unmodified = false, this._zoom = i2, this._tileZoom = Math.max(0, Math.floor(i2)), this._scale = t.ao(i2), this.constrainInternal(), this._calcMatrices());
          }
          get center() {
            return this._center;
          }
          setCenter(e2) {
            e2.lat === this._center.lat && e2.lng === this._center.lng || (this._unmodified = false, this._center = e2, this.constrainInternal(), this._calcMatrices());
          }
          get elevation() {
            return this._elevation;
          }
          setElevation(e2) {
            e2 !== this._elevation && (this._elevation = e2, this.constrainInternal(), this._calcMatrices());
          }
          get padding() {
            return this._edgeInsets.toJSON();
          }
          setPadding(e2) {
            this._edgeInsets.equals(e2) || (this._unmodified = false, this._edgeInsets.interpolate(this._edgeInsets, e2, 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(e2, t2) {
            this._autoCalculateNearFarZ = false, this._nearZ = e2, this._farZ = t2, this._calcMatrices();
          }
          clearNearFarZOverride() {
            this._autoCalculateNearFarZ = true, this._calcMatrices();
          }
          isPaddingEqual(e2) {
            return this._edgeInsets.equals(e2);
          }
          interpolatePadding(e2, t2, i2) {
            this._unmodified = false, this._edgeInsets.interpolate(e2, t2, i2), this.constrainInternal(), this._calcMatrices();
          }
          resize(e2, t2, i2 = true) {
            this._width = e2, this._height = t2, i2 && this.constrainInternal(), this._calcMatrices();
          }
          getMaxBounds() {
            var e2, t2;
            return 2 !== (null === (e2 = this._latRange) || void 0 === e2 ? void 0 : e2.length) || 2 !== (null === (t2 = this._lngRange) || void 0 === t2 ? void 0 : t2.length) ? null : new G([this._lngRange[0], this._latRange[0]], [this._lngRange[1], this._latRange[1]]);
          }
          setMaxBounds(e2) {
            e2 ? (this._lngRange = [e2.getWest(), e2.getEast()], this._latRange = [e2.getSouth(), e2.getNorth()], this.constrainInternal()) : (this._lngRange = null, this._latRange = [-t.am, t.am]);
          }
          getCameraQueryGeometry(e2, i2) {
            if (1 === i2.length) return [i2[0], e2];
            {
              const { minX: o2, minY: a2, maxX: r2, maxY: s2 } = t.a8.fromPoints(i2).extend(e2);
              return [new t.P(o2, a2), new t.P(r2, a2), new t.P(r2, s2), new t.P(o2, s2), new t.P(o2, a2)];
            }
          }
          constrainInternal() {
            if (!this.center || !this._width || !this._height || this._constraining) return;
            this._constraining = true;
            const e2 = this._unmodified, { center: t2, zoom: i2 } = this.applyConstrain(this.center, this.zoom);
            this.setCenter(t2), this.setZoom(i2), this._unmodified = e2, this._constraining = false;
          }
          _calcMatrices() {
            if (this._width && this._height) {
              this._pixelsToGLUnits = [2 / this._width, -2 / this._height];
              let e2 = t.ap(new Float64Array(16));
              t.S(e2, e2, [this._width / 2, -this._height / 2, 1]), t.Q(e2, e2, [1, -1, 0]), this._clipSpaceToPixelsMatrix = e2, e2 = t.ap(new Float64Array(16)), t.S(e2, e2, [1, -1, 1]), t.Q(e2, e2, [-1, -1, 0]), t.S(e2, e2, [2 / this._width, 2 / this._height, 1]), this._pixelsToClipSpaceMatrix = e2, this._cameraToCenterDistance = 0.5 / Math.tan(this.fovInRadians / 2) * this._height;
            }
            this._callbacks.calcMatrices();
          }
          calculateCenterFromCameraLngLatAlt(e2, i2, o2, a2) {
            const r2 = void 0 !== o2 ? o2 : this.bearing, s2 = a2 = void 0 !== a2 ? a2 : this.pitch, { distanceToCenter: n2, clampedElevation: l2 } = this._distanceToCenterFromAltElevationPitch(i2, this.elevation, s2), { x: c2, y: h2 } = be(s2, r2), u2 = t.a7.fromLngLat(e2, i2);
            let d2, _2, p2 = t.aY(1, u2.y), m2 = 0;
            do {
              if (m2 += 1, m2 > 10) break;
              _2 = n2 / p2, d2 = new t.a7(u2.x + c2 * _2, u2.y + h2 * _2), p2 = 1 / d2.meterInMercatorCoordinateUnits();
            } while (Math.abs(n2 - _2 * p2) > 1e-12);
            return { center: d2.toLngLat(), elevation: l2, zoom: t.ar(this.height / 2 / Math.tan(this.fovInRadians / 2) / _2 / this.tileSize) };
          }
          recalculateZoomAndCenter(e2) {
            if (this.elevation - e2 == 0) return;
            const i2 = 1 / this.worldSize, o2 = t.aq(1, this.center.lat) * this.worldSize, a2 = t.a7.fromLngLat(this.center, this.elevation), r2 = a2.x / i2, s2 = a2.y / i2, n2 = a2.z / i2, l2 = this.pitch, c2 = this.bearing, { x: h2, y: u2, z: d2 } = be(l2, c2), _2 = this.cameraToCenterDistance, p2 = r2 + _2 * -h2, m2 = s2 + _2 * -u2, f2 = n2 + _2 * d2, { distanceToCenter: g2, clampedElevation: v2 } = this._distanceToCenterFromAltElevationPitch(f2 / o2, e2, l2), x2 = g2 * o2, b2 = new t.a7((p2 + h2 * x2) * i2, (m2 + u2 * x2) * i2, 0).toLngLat(), y2 = t.aq(1, b2.lat), w2 = t.ar(this.height / 2 / Math.tan(this.fovInRadians / 2) / g2 / y2 / this.tileSize);
            this._elevation = v2, this._center = b2, this.setZoom(w2);
          }
          _distanceToCenterFromAltElevationPitch(e2, i2, o2) {
            const a2 = -Math.cos(t.an(o2)), r2 = e2 - i2;
            let s2, n2 = i2;
            return a2 * r2 >= 0 || Math.abs(a2) < 0.1 ? (s2 = 1e4, n2 = e2 + s2 * a2) : s2 = -r2 / a2, { distanceToCenter: s2, clampedElevation: n2 };
          }
          getCameraPoint() {
            const e2 = Math.tan(this.pitchInRadians) * (this.cameraToCenterDistance || 1);
            return this.centerPoint.add(new t.P(e2 * Math.sin(this.rollInRadians), e2 * Math.cos(this.rollInRadians)));
          }
          getCameraAltitude() {
            return Math.cos(this.pitchInRadians) * this._cameraToCenterDistance / this._pixelPerMeter + this.elevation;
          }
          getCameraLngLat() {
            const e2 = t.aq(1, this.center.lat) * this.worldSize;
            return xe(this.center, this.elevation, this.pitch, this.bearing, this.cameraToCenterDistance / e2).toLngLat();
          }
          getMercatorTileCoordinates(e2) {
            if (!e2) return [0, 0, 1, 1];
            const i2 = e2.canonical.z >= 0 ? 1 << e2.canonical.z : Math.pow(2, e2.canonical.z);
            return [e2.canonical.x / i2, e2.canonical.y / i2, 1 / i2 / t.a6, 1 / i2 / t.a6];
          }
        }
        class qt {
          constructor(e2, i2) {
            this.min = e2, this.max = i2, this.center = t.aZ([], t.a_([], this.min, this.max), 0.5);
          }
          quadrant(e2) {
            const i2 = [e2 % 2 == 0, e2 < 2], o2 = t.a$(this.min), a2 = t.a$(this.max);
            for (let e3 = 0; e3 < i2.length; e3++) o2[e3] = i2[e3] ? this.min[e3] : this.center[e3], a2[e3] = i2[e3] ? this.center[e3] : this.max[e3];
            return a2[2] = this.max[2], new qt(o2, a2);
          }
          distanceX(e2) {
            return Math.max(Math.min(this.max[0], e2[0]), this.min[0]) - e2[0];
          }
          distanceY(e2) {
            return Math.max(Math.min(this.max[1], e2[1]), this.min[1]) - e2[1];
          }
          intersectsFrustum(e2) {
            let t2 = true;
            for (const i2 of e2.planes) {
              const e3 = this.intersectsPlane(i2);
              if (0 === e3) return 0;
              1 === e3 && (t2 = false);
            }
            return t2 ? 2 : e2.aabb.min[0] > this.max[0] || e2.aabb.min[1] > this.max[1] || e2.aabb.min[2] > this.max[2] || e2.aabb.max[0] < this.min[0] || e2.aabb.max[1] < this.min[1] || e2.aabb.max[2] < this.min[2] ? 0 : 1;
          }
          intersectsPlane(e2) {
            let t2 = e2[3], i2 = e2[3];
            for (let o2 = 0; o2 < 3; o2++) e2[o2] > 0 ? (t2 += e2[o2] * this.min[o2], i2 += e2[o2] * this.max[o2]) : (i2 += e2[o2] * this.min[o2], t2 += e2[o2] * this.max[o2]);
            return t2 >= 0 ? 2 : i2 < 0 ? 0 : 1;
          }
        }
        class $t {
          distanceToTile2d(e2, t2, i2, o2) {
            const a2 = o2, r2 = a2.distanceX([e2, t2]), s2 = a2.distanceY([e2, t2]);
            return Math.hypot(r2, s2);
          }
          getWrap(e2, t2, i2) {
            return i2;
          }
          getTileBoundingVolume(e2, i2, o2, a2) {
            var r2, s2;
            let n2 = 0, l2 = 0;
            if (null == a2 ? void 0 : a2.terrain) {
              const c3 = new t.a3(e2.z, i2, e2.z, e2.x, e2.y), h2 = a2.terrain.getMinMaxElevation(c3);
              n2 = null !== (r2 = h2.minElevation) && void 0 !== r2 ? r2 : Math.min(0, o2), l2 = null !== (s2 = h2.maxElevation) && void 0 !== s2 ? s2 : Math.max(0, o2);
            }
            const c2 = 1 << e2.z;
            return new qt([i2 + e2.x / c2, e2.y / c2, n2], [i2 + (e2.x + 1) / c2, (e2.y + 1) / c2, l2]);
          }
          allowVariableZoom(e2, i2) {
            const o2 = e2.fov * (Math.abs(Math.cos(e2.rollInRadians)) * e2.height + Math.abs(Math.sin(e2.rollInRadians)) * e2.width) / e2.height, a2 = t.al(78.5 - o2 / 2, 0, 60);
            return !!i2.terrain || e2.pitch > a2;
          }
          allowWorldCopies() {
            return true;
          }
          prepareNextFrame() {
          }
        }
        class Ht {
          constructor(e2, t2, i2) {
            this.points = e2, this.planes = t2, this.aabb = i2;
          }
          static fromInvProjectionMatrix(e2, i2 = 1, o2 = 0, a2, r2) {
            const s2 = r2 ? [[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]], n2 = Math.pow(2, o2), l2 = [[-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(((o3) => (function(e3, i3, o4, a3) {
              const r3 = t.aE([], e3, i3), s3 = 1 / r3[3] / o4 * a3;
              return t.b4(r3, r3, [s3, s3, 1 / r3[3], s3]);
            })(o3, e2, i2, n2)));
            a2 && (function(e3, i3, o3, a3) {
              const r3 = a3 ? 4 : 0, s3 = a3 ? 0 : 4;
              let n3 = 0;
              const l3 = [], c3 = [];
              for (let i4 = 0; i4 < 4; i4++) {
                const o4 = t.b0([], e3[i4 + s3], e3[i4 + r3]), a4 = t.b5(o4);
                t.aZ(o4, o4, 1 / a4), l3.push(a4), c3.push(o4);
              }
              for (let i4 = 0; i4 < 4; i4++) {
                const a4 = t.b6(e3[i4 + r3], c3[i4], o3);
                n3 = null !== a4 && a4 >= 0 ? Math.max(n3, a4) : Math.max(n3, l3[i4]);
              }
              const h3 = (function(e4, i4) {
                const o4 = t.b0([], e4[i4[0]], e4[i4[1]]), a4 = t.b0([], e4[i4[2]], e4[i4[1]]), r4 = [0, 0, 0, 0];
                return t.b1(r4, t.b2([], o4, a4)), r4[3] = -t.b3(r4, e4[i4[0]]), r4;
              })(e3, i3), u3 = (function(e4, i4) {
                const o4 = t.b7(e4), a4 = t.b8([], e4, 1 / o4), r4 = t.b0([], i4, t.aZ([], a4, t.b3(i4, a4))), s4 = t.b7(r4);
                if (s4 > 0) {
                  const e5 = Math.sqrt(1 - a4[3] * a4[3]), o5 = t.aZ([], a4, -a4[3]), n4 = t.a_([], o5, t.aZ([], r4, e5 / s4));
                  return t.b9(i4, n4);
                }
                return null;
              })(o3, h3);
              if (null !== u3) {
                const e4 = u3 / t.b3(c3[0], h3);
                n3 = Math.min(n3, e4);
              }
              for (let t2 = 0; t2 < 4; t2++) {
                const i4 = Math.min(n3, l3[t2]);
                e3[t2 + s3] = [e3[t2 + r3][0] + c3[t2][0] * i4, e3[t2 + r3][1] + c3[t2][1] * i4, e3[t2 + r3][2] + c3[t2][2] * i4, 1];
              }
            })(l2, s2[0], a2, r2);
            const c2 = s2.map(((e3) => {
              const i3 = t.b0([], l2[e3[0]], l2[e3[1]]), o3 = t.b0([], l2[e3[2]], l2[e3[1]]), a3 = t.b1([], t.b2([], i3, o3)), r3 = -t.b3(a3, l2[e3[1]]);
              return a3.concat(r3);
            })), h2 = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY], u2 = [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY];
            for (const e3 of l2) for (let t2 = 0; t2 < 3; t2++) h2[t2] = Math.min(h2[t2], e3[t2]), u2[t2] = Math.max(u2[t2], e3[t2]);
            return new Ht(l2, c2, new qt(h2, u2));
          }
        }
        class Xt {
          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(e2) {
            this._helper.setMinZoom(e2);
          }
          setMaxZoom(e2) {
            this._helper.setMaxZoom(e2);
          }
          setMinPitch(e2) {
            this._helper.setMinPitch(e2);
          }
          setMaxPitch(e2) {
            this._helper.setMaxPitch(e2);
          }
          setRenderWorldCopies(e2) {
            this._helper.setRenderWorldCopies(e2);
          }
          setBearing(e2) {
            this._helper.setBearing(e2);
          }
          setPitch(e2) {
            this._helper.setPitch(e2);
          }
          setRoll(e2) {
            this._helper.setRoll(e2);
          }
          setFov(e2) {
            this._helper.setFov(e2);
          }
          setZoom(e2) {
            this._helper.setZoom(e2);
          }
          setCenter(e2) {
            this._helper.setCenter(e2);
          }
          setElevation(e2) {
            this._helper.setElevation(e2);
          }
          setMinElevationForCurrentTile(e2) {
            this._helper.setMinElevationForCurrentTile(e2);
          }
          setPadding(e2) {
            this._helper.setPadding(e2);
          }
          interpolatePadding(e2, t2, i2) {
            this._helper.interpolatePadding(e2, t2, i2);
          }
          isPaddingEqual(e2) {
            return this._helper.isPaddingEqual(e2);
          }
          resize(e2, t2, i2 = true) {
            this._helper.resize(e2, t2, i2);
          }
          getMaxBounds() {
            return this._helper.getMaxBounds();
          }
          setMaxBounds(e2) {
            this._helper.setMaxBounds(e2);
          }
          setConstrainOverride(e2) {
            this._helper.setConstrainOverride(e2);
          }
          overrideNearFarZ(e2, t2) {
            this._helper.overrideNearFarZ(e2, t2);
          }
          clearNearFarZOverride() {
            this._helper.clearNearFarZOverride();
          }
          getCameraQueryGeometry(e2) {
            return this._helper.getCameraQueryGeometry(this.getCameraPoint(), e2);
          }
          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(e2, t2) {
          }
          constructor(e2) {
            this._posMatrixCache = /* @__PURE__ */ new Map(), this._alignedPosMatrixCache = /* @__PURE__ */ new Map(), this._fogMatrixCacheF32 = /* @__PURE__ */ new Map(), this.defaultConstrain = (e3, i2) => {
              i2 = t.al(+i2, this.minZoom, this.maxZoom);
              const o2 = { center: new t.W(e3.lng, e3.lat), zoom: i2 };
              let a2 = this._helper._lngRange;
              if (!this._helper._renderWorldCopies && null === a2) {
                const e4 = 180 - 1e-10;
                a2 = [-e4, e4];
              }
              const r2 = this.tileSize * t.ao(o2.zoom);
              let s2 = 0, n2 = r2, l2 = 0, c2 = r2, h2 = 0, u2 = 0;
              const { x: d2, y: _2 } = this.size;
              if (this._helper._latRange) {
                const e4 = this._helper._latRange;
                s2 = t.Y(e4[1]) * r2, n2 = t.Y(e4[0]) * r2, n2 - s2 < _2 && (h2 = _2 / (n2 - s2));
              }
              a2 && (l2 = t.X(t.Z(a2[0]) * r2, 0, r2), c2 = t.X(t.Z(a2[1]) * r2, 0, r2), c2 < l2 && (c2 += r2), c2 - l2 < d2 && (u2 = d2 / (c2 - l2)));
              const { x: p2, y: m2 } = me(r2, e3);
              let f2, g2;
              const v2 = Math.max(u2 || 0, h2 || 0);
              if (v2) {
                const e4 = new t.P(u2 ? (c2 + l2) / 2 : p2, h2 ? (n2 + s2) / 2 : m2);
                return o2.center = fe(r2, e4).wrap(), o2.zoom += t.ar(v2), o2;
              }
              if (this._helper._latRange) {
                const e4 = _2 / 2;
                m2 - e4 < s2 && (g2 = s2 + e4), m2 + e4 > n2 && (g2 = n2 - e4);
              }
              if (a2) {
                const e4 = (l2 + c2) / 2;
                let i3 = p2;
                this._helper._renderWorldCopies && (i3 = t.X(p2, e4 - r2 / 2, e4 + r2 / 2));
                const o3 = d2 / 2;
                i3 - o3 < l2 && (f2 = l2 + o3), i3 + o3 > c2 && (f2 = c2 - o3);
              }
              if (void 0 !== f2 || void 0 !== g2) {
                const e4 = new t.P(null != f2 ? f2 : p2, null != g2 ? g2 : m2);
                o2.center = fe(r2, e4).wrap();
              }
              return o2;
            }, this.applyConstrain = (e3, t2) => this._helper.applyConstrain(e3, t2), this._helper = new Wt({ calcMatrices: () => this._calcMatrices(), defaultConstrain: (e3, t2) => this.defaultConstrain(e3, t2) }, e2), this._coveringTilesDetailsProvider = new $t();
          }
          clone() {
            const e2 = new Xt();
            return e2.apply(this, false), e2;
          }
          apply(e2, t2, i2) {
            this._helper.apply(e2, t2, i2);
          }
          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(e2) {
            const i2 = [new t.ba(0, e2)];
            if (this._helper._renderWorldCopies) {
              const o2 = this.screenPointToMercatorCoordinate(new t.P(0, 0)), a2 = this.screenPointToMercatorCoordinate(new t.P(this._helper._width, 0)), r2 = this.screenPointToMercatorCoordinate(new t.P(this._helper._width, this._helper._height)), s2 = this.screenPointToMercatorCoordinate(new t.P(0, this._helper._height)), n2 = Math.floor(Math.min(o2.x, a2.x, r2.x, s2.x)), l2 = Math.floor(Math.max(o2.x, a2.x, r2.x, s2.x)), c2 = 1;
              for (let o3 = n2 - c2; o3 <= l2 + c2; o3++) 0 !== o3 && i2.push(new t.ba(o3, e2));
            }
            return i2;
          }
          getCameraFrustum() {
            return Ht.fromInvProjectionMatrix(this._invViewProjMatrix, this.worldSize);
          }
          getClippingPlane() {
            return null;
          }
          getCoveringTilesDetailsProvider() {
            return this._coveringTilesDetailsProvider;
          }
          recalculateZoomAndCenter(e2) {
            const t2 = this.screenPointToLocation(this.centerPoint, e2), i2 = e2 ? e2.getElevationForLngLatZoom(t2, this._helper._tileZoom) : 0;
            this._helper.recalculateZoomAndCenter(i2);
          }
          setLocationAtPoint(e2, i2) {
            const o2 = t.aq(this.elevation, this.center.lat), a2 = this.screenPointToMercatorCoordinateAtZ(i2, o2), r2 = this.screenPointToMercatorCoordinateAtZ(this.centerPoint, o2), s2 = t.a7.fromLngLat(e2), n2 = new t.a7(s2.x - (a2.x - r2.x), s2.y - (a2.y - r2.y));
            this.setCenter(null == n2 ? void 0 : n2.toLngLat()), this._helper._renderWorldCopies && this.setCenter(this.center.wrap());
          }
          locationToScreenPoint(e2, i2) {
            return i2 ? this.coordinatePoint(t.a7.fromLngLat(e2), i2.getElevationForLngLat(e2, this), this._pixelMatrix3D) : this.coordinatePoint(t.a7.fromLngLat(e2));
          }
          screenPointToLocation(e2, t2) {
            var i2;
            return null === (i2 = this.screenPointToMercatorCoordinate(e2, t2)) || void 0 === i2 ? void 0 : i2.toLngLat();
          }
          screenPointToMercatorCoordinate(e2, t2) {
            if (t2) {
              const i2 = t2.pointCoordinate(e2);
              if (null != i2) return i2;
            }
            return this.screenPointToMercatorCoordinateAtZ(e2);
          }
          screenPointToMercatorCoordinateAtZ(e2, i2) {
            const o2 = i2 || 0, a2 = [e2.x, e2.y, 0, 1], r2 = [e2.x, e2.y, 1, 1];
            t.aE(a2, a2, this._pixelMatrixInverse), t.aE(r2, r2, this._pixelMatrixInverse);
            const s2 = a2[3], n2 = r2[3], l2 = a2[1] / s2, c2 = r2[1] / n2, h2 = a2[2] / s2, u2 = r2[2] / n2, d2 = h2 === u2 ? 0 : (o2 - h2) / (u2 - h2);
            return new t.a7(t.H.number(a2[0] / s2, r2[0] / n2, d2) / this.worldSize, t.H.number(l2, c2, d2) / this.worldSize, o2);
          }
          coordinatePoint(e2, i2 = 0, o2 = this._pixelMatrix) {
            const a2 = [e2.x * this.worldSize, e2.y * this.worldSize, i2, 1];
            return t.aE(a2, a2, o2), new t.P(a2[0] / a2[3], a2[1] / a2[3]);
          }
          getBounds() {
            const e2 = Math.max(0, this._helper._height / 2 - ge(this));
            return new G().extend(this.screenPointToLocation(new t.P(0, e2))).extend(this.screenPointToLocation(new t.P(this._helper._width, e2))).extend(this.screenPointToLocation(new t.P(this._helper._width, this._helper._height))).extend(this.screenPointToLocation(new t.P(0, this._helper._height)));
          }
          isPointOnMapSurface(e2, t2) {
            return t2 ? null != t2.pointCoordinate(e2) : e2.y > this.height / 2 - ge(this);
          }
          calculatePosMatrix(e2, i2 = false, o2) {
            var a2;
            const r2 = null !== (a2 = e2.key) && void 0 !== a2 ? a2 : t.bb(e2.wrap, e2.canonical.z, e2.canonical.z, e2.canonical.x, e2.canonical.y), s2 = i2 ? this._alignedPosMatrixCache : this._posMatrixCache;
            if (s2.has(r2)) {
              const e3 = s2.get(r2);
              return o2 ? e3.f32 : e3.f64;
            }
            const n2 = ve(e2, this.worldSize);
            t.U(n2, i2 ? this._alignedProjMatrix : this._viewProjMatrix, n2);
            const l2 = { f64: n2, f32: new Float32Array(n2) };
            return s2.set(r2, l2), o2 ? l2.f32 : l2.f64;
          }
          calculateFogMatrix(e2) {
            const i2 = e2.key, o2 = this._fogMatrixCacheF32;
            if (o2.has(i2)) return o2.get(i2);
            const a2 = ve(e2, this.worldSize);
            return t.U(a2, this._fogMatrix, a2), o2.set(i2, new Float32Array(a2)), o2.get(i2);
          }
          calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2) {
            return this._helper.calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2);
          }
          _calculateNearFarZIfNeeded(e2, i2, o2) {
            if (!this._helper.autoCalculateNearFarZ) return;
            const a2 = Math.min(this.elevation, this.minElevationForCurrentTile, this.getCameraAltitude() - 100), r2 = e2 - a2 * this._helper._pixelPerMeter / Math.cos(i2), s2 = a2 < 0 ? r2 : e2, n2 = Math.PI / 2 + this.pitchInRadians, l2 = t.an(this.fov) * (Math.abs(Math.cos(t.an(this.roll))) * this.height + Math.abs(Math.sin(t.an(this.roll))) * this.width) / this.height * (0.5 + o2.y / this.height), c2 = Math.sin(l2) * s2 / Math.sin(t.al(Math.PI - n2 - l2, 0.01, Math.PI - 0.01)), h2 = ge(this), u2 = Math.atan(h2 / this._helper.cameraToCenterDistance), d2 = t.an(0.75), _2 = u2 > d2 ? 2 * u2 * (0.5 + o2.y / (2 * h2)) : d2, p2 = Math.sin(_2) * s2 / Math.sin(t.al(Math.PI - n2 - _2, 0.01, Math.PI - 0.01)), m2 = Math.min(c2, p2);
            this._helper._farZ = 1.01 * (Math.cos(Math.PI / 2 - i2) * m2 + s2), this._helper._nearZ = this._helper._height / 50;
          }
          _calcMatrices() {
            if (!this._helper._height) return;
            const e2 = this.centerOffset, i2 = me(this.worldSize, this.center), o2 = i2.x, a2 = i2.y;
            this._helper._pixelPerMeter = t.aq(1, this.center.lat) * this.worldSize;
            const r2 = t.an(Math.min(this.pitch, pe)), s2 = Math.max(this._helper.cameraToCenterDistance / 2, this._helper.cameraToCenterDistance + this._helper._elevation * this._helper._pixelPerMeter / Math.cos(r2));
            let n2;
            var l2, c2;
            this._calculateNearFarZIfNeeded(s2, r2, e2), n2 = new Float64Array(16), t.bc(n2, this.fovInRadians, this._helper._width / this._helper._height, this._helper._nearZ, this._helper._farZ), this._invProjMatrix = new Float64Array(16), (l2 = this._invProjMatrix)[0] = 1 / (c2 = n2)[0], l2[1] = 0, l2[2] = 0, l2[3] = 0, l2[4] = 0, l2[5] = 1 / c2[5], l2[6] = 0, l2[7] = 0, l2[8] = 0, l2[9] = 0, l2[10] = 0, l2[11] = 1 / c2[14], l2[12] = 0, l2[13] = 0, l2[14] = -1, l2[15] = c2[10] / c2[14], n2[8] = 2 * -e2.x / this._helper._width, n2[9] = 2 * e2.y / this._helper._height, this._projectionMatrix = t.bd(n2), t.S(n2, n2, [1, -1, 1]), t.Q(n2, n2, [0, 0, -this._helper.cameraToCenterDistance]), t.be(n2, n2, -this.rollInRadians), t.bf(n2, n2, this.pitchInRadians), t.be(n2, n2, -this.bearingInRadians), t.Q(n2, n2, [-o2, -a2, 0]), this._mercatorMatrix = t.S([], n2, [this.worldSize, this.worldSize, this.worldSize]), t.S(n2, n2, [1, 1, this._helper._pixelPerMeter]), this._pixelMatrix = t.U(new Float64Array(16), this.clipSpaceToPixelsMatrix, n2), t.Q(n2, n2, [0, 0, -this.elevation]), this._viewProjMatrix = n2, this._invViewProjMatrix = t.bg([], n2);
            const h2 = [0, 0, -1, 1];
            t.aE(h2, h2, this._invViewProjMatrix), this._cameraPosition = [h2[0] / h2[3], h2[1] / h2[3], h2[2] / h2[3]], this._fogMatrix = new Float64Array(16), t.bc(this._fogMatrix, this.fovInRadians, this.width / this.height, s2, this._helper._farZ), this._fogMatrix[8] = 2 * -e2.x / this.width, this._fogMatrix[9] = 2 * e2.y / this.height, t.S(this._fogMatrix, this._fogMatrix, [1, -1, 1]), t.Q(this._fogMatrix, this._fogMatrix, [0, 0, -this.cameraToCenterDistance]), t.be(this._fogMatrix, this._fogMatrix, -this.rollInRadians), t.bf(this._fogMatrix, this._fogMatrix, this.pitchInRadians), t.be(this._fogMatrix, this._fogMatrix, -this.bearingInRadians), t.Q(this._fogMatrix, this._fogMatrix, [-o2, -a2, 0]), t.S(this._fogMatrix, this._fogMatrix, [1, 1, this._helper._pixelPerMeter]), t.Q(this._fogMatrix, this._fogMatrix, [0, 0, -this.elevation]), this._pixelMatrix3D = t.U(new Float64Array(16), this.clipSpaceToPixelsMatrix, n2);
            const u2 = this._helper._width % 2 / 2, d2 = this._helper._height % 2 / 2, _2 = Math.cos(this.bearingInRadians), p2 = Math.sin(-this.bearingInRadians), m2 = o2 - Math.round(o2) + _2 * u2 + p2 * d2, f2 = a2 - Math.round(a2) + _2 * d2 + p2 * u2, g2 = new Float64Array(n2);
            if (t.Q(g2, g2, [m2 > 0.5 ? m2 - 1 : m2, f2 > 0.5 ? f2 - 1 : f2, 0]), this._alignedProjMatrix = g2, n2 = t.bg(new Float64Array(16), this._pixelMatrix), !n2) throw new Error("failed to invert matrix");
            this._pixelMatrixInverse = n2, this._clearMatrixCaches();
          }
          _clearMatrixCaches() {
            this._posMatrixCache.clear(), this._alignedPosMatrixCache.clear(), this._fogMatrixCacheF32.clear();
          }
          maxPitchScaleFactor() {
            if (!this._pixelMatrixInverse) return 1;
            const e2 = this.screenPointToMercatorCoordinate(new t.P(0, 0)), i2 = [e2.x * this.worldSize, e2.y * this.worldSize, 0, 1];
            return t.aE(i2, i2, this._pixelMatrix)[3] / this._helper.cameraToCenterDistance;
          }
          getCameraPoint() {
            return this._helper.getCameraPoint();
          }
          getCameraAltitude() {
            return this._helper.getCameraAltitude();
          }
          getCameraLngLat() {
            const e2 = t.aq(1, this.center.lat) * this.worldSize;
            return xe(this.center, this.elevation, this.pitch, this.bearing, this._helper.cameraToCenterDistance / e2).toLngLat();
          }
          lngLatToCameraDepth(e2, i2) {
            const o2 = t.a7.fromLngLat(e2), a2 = [o2.x * this.worldSize, o2.y * this.worldSize, i2, 1];
            return t.aE(a2, a2, this._viewProjMatrix), a2[2] / a2[3];
          }
          getProjectionData(e2) {
            const { overscaledTileID: i2, aligned: o2, applyTerrainMatrix: a2 } = e2, r2 = this._helper.getMercatorTileCoordinates(i2), s2 = i2 ? this.calculatePosMatrix(i2, o2, true) : null;
            let n2;
            return n2 = (null == i2 ? void 0 : i2.terrainRttPosMatrix32f) && a2 ? i2.terrainRttPosMatrix32f : s2 || t.bh(), { mainMatrix: n2, tileMercatorCoords: r2, clippingPlane: [0, 0, 0, 0], projectionTransition: 0, fallbackMatrix: n2 };
          }
          isLocationOccluded(e2) {
            return false;
          }
          getPixelScale() {
            return 1;
          }
          getCircleRadiusCorrection() {
            return 1;
          }
          getPitchedTextCorrection(e2, t2, i2) {
            return 1;
          }
          transformLightDirection(e2) {
            return t.a$(e2);
          }
          getRayDirectionFromPixel(e2) {
            throw new Error("Not implemented.");
          }
          projectTileCoordinates(e2, i2, o2, a2) {
            const r2 = this.calculatePosMatrix(o2);
            let s2;
            a2 ? (s2 = [e2, i2, a2(e2, i2), 1], t.aE(s2, s2, r2)) : (s2 = [e2, i2, 0, 1], nt(s2, s2, r2));
            const n2 = s2[3];
            return { point: new t.P(s2[0] / n2, s2[1] / n2), signedDistanceFromCamera: n2, isOccluded: false };
          }
          populateCache(e2) {
            for (const t2 of e2) this.calculatePosMatrix(t2);
          }
          getMatrixForModel(e2, i2) {
            const o2 = t.a7.fromLngLat(e2, i2), a2 = o2.meterInMercatorCoordinateUnits(), r2 = t.bi();
            return t.Q(r2, r2, [o2.x, o2.y, o2.z]), t.be(r2, r2, Math.PI), t.bf(r2, r2, Math.PI / 2), t.S(r2, r2, [-a2, a2, a2]), r2;
          }
          getProjectionDataForCustomLayer(e2 = true) {
            const i2 = new t.a3(0, 0, 0, 0, 0), o2 = this.getProjectionData({ overscaledTileID: i2, applyGlobeMatrix: e2 }), a2 = ve(i2, this.worldSize);
            t.U(a2, this._viewProjMatrix, a2), o2.tileMercatorCoords = [0, 0, 1, 1];
            const r2 = [t.a6, t.a6, this.worldSize / this._helper.pixelsPerMeter], s2 = t.bj();
            return t.S(s2, a2, r2), o2.fallbackMatrix = s2, o2.mainMatrix = s2, o2;
          }
          getFastPathSimpleProjectionMatrix(e2) {
            return this.calculatePosMatrix(e2);
          }
        }
        function Kt() {
          t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
        }
        function Yt(e2) {
          if (e2.useSlerp) if (e2.k < 1) {
            const i2 = t.bk(e2.startEulerAngles.roll, e2.startEulerAngles.pitch, e2.startEulerAngles.bearing), o2 = t.bk(e2.endEulerAngles.roll, e2.endEulerAngles.pitch, e2.endEulerAngles.bearing), a2 = new Float64Array(4);
            t.bl(a2, i2, o2, e2.k);
            const r2 = t.bm(a2);
            e2.tr.setRoll(r2.roll), e2.tr.setPitch(r2.pitch), e2.tr.setBearing(r2.bearing);
          } else e2.tr.setRoll(e2.endEulerAngles.roll), e2.tr.setPitch(e2.endEulerAngles.pitch), e2.tr.setBearing(e2.endEulerAngles.bearing);
          else e2.tr.setRoll(t.H.number(e2.startEulerAngles.roll, e2.endEulerAngles.roll, e2.k)), e2.tr.setPitch(t.H.number(e2.startEulerAngles.pitch, e2.endEulerAngles.pitch, e2.k)), e2.tr.setBearing(t.H.number(e2.startEulerAngles.bearing, e2.endEulerAngles.bearing, e2.k));
        }
        function Qt(e2, i2, o2, a2, r2) {
          const s2 = r2.padding, n2 = me(r2.worldSize, o2.getNorthWest()), l2 = me(r2.worldSize, o2.getNorthEast()), c2 = me(r2.worldSize, o2.getSouthEast()), h2 = me(r2.worldSize, o2.getSouthWest()), u2 = t.an(-a2), d2 = n2.rotate(u2), _2 = l2.rotate(u2), p2 = c2.rotate(u2), m2 = h2.rotate(u2), f2 = new t.P(Math.max(d2.x, _2.x, m2.x, p2.x), Math.max(d2.y, _2.y, m2.y, p2.y)), g2 = new t.P(Math.min(d2.x, _2.x, m2.x, p2.x), Math.min(d2.y, _2.y, m2.y, p2.y)), v2 = f2.sub(g2), x2 = (r2.width - (s2.left + s2.right + i2.left + i2.right)) / v2.x, b2 = (r2.height - (s2.top + s2.bottom + i2.top + i2.bottom)) / v2.y;
          if (b2 < 0 || x2 < 0) return void Kt();
          const y2 = Math.min(t.ar(r2.scale * Math.min(x2, b2)), e2.maxZoom), w2 = t.P.convert(e2.offset), T2 = new t.P((i2.left - i2.right) / 2, (i2.top - i2.bottom) / 2).rotate(t.an(a2)), P2 = w2.add(T2).mult(r2.scale / t.ao(y2));
          return { center: fe(r2.worldSize, n2.add(c2).div(2).sub(P2)), zoom: y2, bearing: a2 };
        }
        class Jt {
          get useGlobeControls() {
            return false;
          }
          handlePanInertia(e2, t2) {
            const i2 = e2.mag(), o2 = Math.abs(ge(t2));
            return { easingOffset: e2.mult(Math.min(0.75 * o2 / i2, 1)), easingCenter: t2.center };
          }
          handleMapControlsRollPitchBearingZoom(e2, t2) {
            e2.bearingDelta && t2.setBearing(t2.bearing + e2.bearingDelta), e2.pitchDelta && t2.setPitch(t2.pitch + e2.pitchDelta), e2.rollDelta && t2.setRoll(t2.roll + e2.rollDelta), e2.zoomDelta && t2.setZoom(t2.zoom + e2.zoomDelta);
          }
          handleMapControlsPan(e2, t2, i2) {
            e2.around.distSqr(t2.centerPoint) < 0.01 || t2.setLocationAtPoint(i2, e2.around);
          }
          cameraForBoxAndBearing(e2, t2, i2, o2, a2) {
            return Qt(e2, t2, i2, o2, a2);
          }
          handleJumpToCenterZoom(e2, i2) {
            e2.zoom !== (void 0 !== i2.zoom ? +i2.zoom : e2.zoom) && e2.setZoom(+i2.zoom), void 0 !== i2.center && e2.setCenter(t.W.convert(i2.center));
          }
          handleEaseTo(e2, i2) {
            const o2 = e2.zoom, a2 = e2.padding, r2 = { roll: e2.roll, pitch: e2.pitch, bearing: e2.bearing }, s2 = { roll: void 0 === i2.roll ? e2.roll : i2.roll, pitch: void 0 === i2.pitch ? e2.pitch : i2.pitch, bearing: void 0 === i2.bearing ? e2.bearing : i2.bearing }, n2 = void 0 !== i2.zoom, l2 = !e2.isPaddingEqual(i2.padding);
            let c2 = false;
            const h2 = n2 ? +i2.zoom : e2.zoom;
            let u2 = e2.centerPoint.add(i2.offsetAsPoint);
            const d2 = e2.screenPointToLocation(u2), { center: _2, zoom: p2 } = e2.applyConstrain(t.W.convert(i2.center || d2), null != h2 ? h2 : o2);
            Gt(e2, _2);
            const m2 = me(e2.worldSize, d2), f2 = me(e2.worldSize, _2).sub(m2), g2 = t.ao(p2 - o2);
            return c2 = p2 !== o2, { easeFunc: (n3) => {
              if (c2 && e2.setZoom(t.H.number(o2, p2, n3)), t.bn(r2, s2) || Yt({ startEulerAngles: r2, endEulerAngles: s2, tr: e2, k: n3, useSlerp: r2.roll != s2.roll }), l2 && (e2.interpolatePadding(a2, i2.padding, n3), u2 = e2.centerPoint.add(i2.offsetAsPoint)), i2.around) e2.setLocationAtPoint(i2.around, i2.aroundPoint);
              else {
                const i3 = t.ao(e2.zoom - o2), a3 = p2 > o2 ? Math.min(2, g2) : Math.max(0.5, g2), r3 = Math.pow(a3, 1 - n3), s3 = fe(e2.worldSize, m2.add(f2.mult(n3 * r3)).mult(i3));
                e2.setLocationAtPoint(e2.renderWorldCopies ? s3.wrap() : s3, u2);
              }
            }, isZooming: c2, elevationCenter: _2 };
          }
          handleFlyTo(e2, i2) {
            const o2 = void 0 !== i2.zoom, a2 = e2.zoom, r2 = e2.applyConstrain(t.W.convert(i2.center || i2.locationAtOffset), o2 ? +i2.zoom : a2), s2 = r2.center, n2 = r2.zoom;
            Gt(e2, s2);
            const l2 = me(e2.worldSize, i2.locationAtOffset), c2 = me(e2.worldSize, s2).sub(l2), h2 = c2.mag(), u2 = t.ao(n2 - a2);
            let d2;
            if (void 0 !== i2.minZoom) {
              const o3 = Math.min(+i2.minZoom, a2, n2), r3 = e2.applyConstrain(s2, o3).zoom;
              d2 = t.ao(r3 - a2);
            }
            return { easeFunc: (i3, o3, r3, h3) => {
              e2.setZoom(1 === i3 ? n2 : a2 + t.ar(o3));
              const u3 = 1 === i3 ? s2 : fe(e2.worldSize, l2.add(c2.mult(r3)).mult(o3));
              e2.setLocationAtPoint(e2.renderWorldCopies ? u3.wrap() : u3, h3);
            }, scaleOfZoom: u2, targetCenter: s2, scaleOfMinZoom: d2, pixelPathLength: h2 };
          }
        }
        class ei {
          constructor(e2, t2, i2) {
            this.blendFunction = e2, this.blendColor = t2, this.mask = i2;
          }
        }
        ei.Replace = [1, 0], ei.disabled = new ei(ei.Replace, t.bo.transparent, [false, false, false, false]), ei.unblended = new ei(ei.Replace, t.bo.transparent, [true, true, true, true]), ei.alphaBlended = new ei([1, 771], t.bo.transparent, [true, true, true, true]);
        const ti = 2305;
        class ii {
          constructor(e2, t2, i2) {
            this.enable = e2, this.mode = t2, this.frontFace = i2;
          }
        }
        ii.disabled = new ii(false, 1029, ti), ii.backCCW = new ii(true, 1029, ti), ii.frontCCW = new ii(true, 1028, ti);
        class oi {
          constructor(e2, t2, i2) {
            this.func = e2, this.mask = t2, this.range = i2;
          }
        }
        oi.ReadOnly = false, oi.ReadWrite = true, oi.disabled = new oi(519, oi.ReadOnly, [0, 1]);
        const ai = 7680;
        class ri {
          constructor(e2, t2, i2, o2, a2, r2) {
            this.test = e2, this.ref = t2, this.mask = i2, this.fail = o2, this.depthFail = a2, this.pass = r2;
          }
        }
        function si(e2) {
          return "undefined" != typeof WebGL2RenderingContext && e2 instanceof WebGL2RenderingContext;
        }
        ri.disabled = new ri({ func: 519, mask: 0 }, 0, 0, ai, ai, ai);
        class ni {
          get awaitingQuery() {
            return !!this._readbackQueue;
          }
          constructor(e2) {
            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 = e2;
            const i2 = e2.context, o2 = i2.gl;
            this._texFormat = o2.RGBA, this._texType = o2.UNSIGNED_BYTE;
            const a2 = new t.aU();
            a2.emplaceBack(-1, -1), a2.emplaceBack(2, -1), a2.emplaceBack(-1, 2);
            const r2 = new t.aW();
            r2.emplaceBack(0, 1, 2), this._fullscreenTriangle = new Bt(i2.createVertexBuffer(a2, Ot.members), i2.createIndexBuffer(r2), t.aV.simpleSegment(0, 0, a2.length, r2.length)), this._resultBuffer = new Uint8Array(4), i2.activeTexture.set(o2.TEXTURE1);
            const s2 = o2.createTexture();
            o2.bindTexture(o2.TEXTURE_2D, s2), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_WRAP_S, o2.CLAMP_TO_EDGE), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_WRAP_T, o2.CLAMP_TO_EDGE), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_MIN_FILTER, o2.NEAREST), o2.texParameteri(o2.TEXTURE_2D, o2.TEXTURE_MAG_FILTER, o2.NEAREST), o2.texImage2D(o2.TEXTURE_2D, 0, this._texFormat, this._texWidth, this._texHeight, 0, this._texFormat, this._texType, null), this._fbo = i2.createFramebuffer(this._texWidth, this._texHeight, false, false), this._fbo.colorAttachment.set(s2), si(o2) && (this._pbo = o2.createBuffer(), o2.bindBuffer(o2.PIXEL_PACK_BUFFER, this._pbo), o2.bufferData(o2.PIXEL_PACK_BUFFER, 4, o2.STREAM_READ), o2.bindBuffer(o2.PIXEL_PACK_BUFFER, null));
          }
          destroy() {
            const e2 = this._cachedRenderContext.context.gl;
            this._fullscreenTriangle.destroy(), this._fbo.destroy(), e2.deleteBuffer(this._pbo), this._fullscreenTriangle = null, this._fbo = null, this._pbo = null, this._resultBuffer = null;
          }
          updateErrorLoop(e2, t2) {
            const i2 = this._updateCount;
            return this._readbackQueue ? i2 >= this._readbackQueue.frameNumberIssued + this._readbackWaitFrames && this._tryReadback() : i2 >= this._lastReadbackFrame + this._measureWaitFrames && this._renderErrorTexture(e2, t2), this._updateCount++, this._measuredError;
          }
          _bindFramebuffer() {
            const e2 = this._cachedRenderContext.context, t2 = e2.gl;
            e2.activeTexture.set(t2.TEXTURE1), t2.bindTexture(t2.TEXTURE_2D, this._fbo.colorAttachment.get()), e2.bindFramebuffer.set(this._fbo.framebuffer);
          }
          _renderErrorTexture(e2, i2) {
            const o2 = this._cachedRenderContext.context, a2 = o2.gl;
            if (this._bindFramebuffer(), o2.viewport.set([0, 0, this._texWidth, this._texHeight]), o2.clear({ color: t.bo.transparent }), this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o2, a2.TRIANGLES, oi.disabled, ri.disabled, ei.unblended, ii.disabled, /* @__PURE__ */ ((e3, t2) => ({ u_input: e3, u_output_expected: t2 }))(e2, i2), null, null, "$clipping", this._fullscreenTriangle.vertexBuffer, this._fullscreenTriangle.indexBuffer, this._fullscreenTriangle.segments), this._pbo && si(a2)) {
              a2.bindBuffer(a2.PIXEL_PACK_BUFFER, this._pbo), a2.readBuffer(a2.COLOR_ATTACHMENT0), a2.readPixels(0, 0, this._texWidth, this._texHeight, this._texFormat, this._texType, 0), a2.bindBuffer(a2.PIXEL_PACK_BUFFER, null);
              const e3 = a2.fenceSync(a2.SYNC_GPU_COMMANDS_COMPLETE, 0);
              a2.flush(), this._readbackQueue = { frameNumberIssued: this._updateCount, sync: e3 };
            } else this._readbackQueue = { frameNumberIssued: this._updateCount, sync: null };
          }
          _tryReadback() {
            const e2 = this._cachedRenderContext.context.gl;
            if (this._pbo && this._readbackQueue && si(e2)) {
              const i2 = e2.clientWaitSync(this._readbackQueue.sync, 0, 0);
              if (i2 === e2.WAIT_FAILED) return t.w("WebGL2 clientWaitSync failed."), this._readbackQueue = null, void (this._lastReadbackFrame = this._updateCount);
              if (i2 === e2.TIMEOUT_EXPIRED) return;
              e2.bindBuffer(e2.PIXEL_PACK_BUFFER, this._pbo), e2.getBufferSubData(e2.PIXEL_PACK_BUFFER, 0, this._resultBuffer, 0, 4), e2.bindBuffer(e2.PIXEL_PACK_BUFFER, null);
            } else this._bindFramebuffer(), e2.readPixels(0, 0, this._texWidth, this._texHeight, this._texFormat, this._texType, this._resultBuffer);
            this._readbackQueue = null, this._measuredError = ni._parseRGBA8float(this._resultBuffer), this._lastReadbackFrame = this._updateCount;
          }
          static _parseRGBA8float(e2) {
            let t2 = 0;
            return t2 += e2[0] / 256, t2 += e2[1] / 65536, t2 += e2[2] / 16777216, e2[3] < 127 && (t2 = -t2), t2 / 128;
          }
        }
        const li = t.a6 / 128;
        function ci(e2, i2) {
          const o2 = void 0 !== e2.granularity ? Math.max(e2.granularity, 1) : 1, a2 = o2 + (e2.generateBorders ? 2 : 0), r2 = o2 + (e2.extendToNorthPole || e2.generateBorders ? 1 : 0) + (e2.extendToSouthPole || e2.generateBorders ? 1 : 0), s2 = a2 + 1, n2 = r2 + 1, l2 = e2.generateBorders ? -1 : 0, c2 = e2.generateBorders || e2.extendToNorthPole ? -1 : 0, h2 = o2 + (e2.generateBorders ? 1 : 0), u2 = o2 + (e2.generateBorders || e2.extendToSouthPole ? 1 : 0), d2 = s2 * n2, _2 = a2 * r2 * 6, p2 = s2 * n2 > 65536;
          if (p2 && "16bit" === i2) throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");
          const m2 = p2 || "32bit" === i2, f2 = new Int16Array(2 * d2);
          let g2 = 0;
          for (let i3 = c2; i3 <= u2; i3++) for (let a3 = l2; a3 <= h2; a3++) {
            let r3 = a3 / o2 * t.a6;
            -1 === a3 && (r3 = -li), a3 === o2 + 1 && (r3 = t.a6 + li);
            let s3 = i3 / o2 * t.a6;
            -1 === i3 && (s3 = e2.extendToNorthPole ? t.bq : -li), i3 === o2 + 1 && (s3 = e2.extendToSouthPole ? t.br : t.a6 + li), f2[g2++] = r3, f2[g2++] = s3;
          }
          const v2 = m2 ? new Uint32Array(_2) : new Uint16Array(_2);
          let x2 = 0;
          for (let e3 = 0; e3 < r2; e3++) for (let t2 = 0; t2 < a2; t2++) {
            const i3 = t2 + 1 + e3 * s2, o3 = t2 + (e3 + 1) * s2, a3 = t2 + 1 + (e3 + 1) * s2;
            v2[x2++] = t2 + e3 * s2, v2[x2++] = o3, v2[x2++] = i3, v2[x2++] = i3, v2[x2++] = o3, v2[x2++] = a3;
          }
          return { vertices: f2.buffer.slice(0), indices: v2.buffer.slice(0), uses32bitIndices: m2 };
        }
        const hi = new t.aT({ fill: new t.bs(128, 2), line: new t.bs(512, 0), tile: new t.bs(128, 32), stencil: new t.bs(128, 1), circle: 3 });
        class ui {
          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 true;
          }
          get shaderVariantName() {
            return "globe";
          }
          get shaderDefine() {
            return "#define GLOBE";
          }
          get shaderPreludeCode() {
            return Ft.projectionGlobe;
          }
          get vertexShaderPreludeCode() {
            return Ft.projectionMercator.vertexSource;
          }
          get subdivisionGranularity() {
            return hi;
          }
          get useGlobeControls() {
            return true;
          }
          get latitudeErrorCorrectionRadians() {
            return this._errorCorrectionUsable;
          }
          destroy() {
            this._errorMeasurement && this._errorMeasurement.destroy();
          }
          updateGPUdependent(e2) {
            this._errorMeasurement || (this._errorMeasurement = new ni(e2));
            const i2 = t.Y(this._errorQueryLatitudeDegrees), o2 = 2 * Math.atan(Math.exp(Math.PI - i2 * Math.PI * 2)) - 0.5 * Math.PI, a2 = this._errorMeasurement.updateErrorLoop(i2, o2), r2 = c();
            a2 !== this._errorMeasurementLastValue && (this._errorCorrectionPreviousValue = this._errorCorrectionUsable, this._errorMeasurementLastValue = a2, this._errorMeasurementLastChangeTime = r2);
            const s2 = Math.min(Math.max((r2 - this._errorMeasurementLastChangeTime) / 1e3 / 0.5, 0), 1);
            this._errorCorrectionUsable = t.bt(this._errorCorrectionPreviousValue, -this._errorMeasurementLastValue, t.bu(s2));
          }
          _getMeshKey(e2) {
            return `${e2.granularity.toString(36)}_${e2.generateBorders ? "b" : ""}${e2.extendToNorthPole ? "n" : ""}${e2.extendToSouthPole ? "s" : ""}`;
          }
          getMeshFromTileID(e2, t2, i2, o2, a2) {
            const r2 = ("stencil" === a2 ? hi.stencil : hi.tile).getGranularityForZoomLevel(t2.z);
            return this._getMesh(e2, { granularity: r2, generateBorders: i2, extendToNorthPole: 0 === t2.y && o2, extendToSouthPole: t2.y === (1 << t2.z) - 1 && o2 });
          }
          _getMesh(e2, i2) {
            const o2 = this._getMeshKey(i2);
            if (o2 in this._tileMeshCache) return this._tileMeshCache[o2];
            const a2 = (function(e3, i3) {
              const o3 = ci(i3, "16bit"), a3 = t.aU.deserialize({ arrayBuffer: o3.vertices, length: o3.vertices.byteLength / 2 / 2 }), r2 = t.aW.deserialize({ arrayBuffer: o3.indices, length: o3.indices.byteLength / 2 / 3 });
              return new Bt(e3.createVertexBuffer(a3, Ot.members), e3.createIndexBuffer(r2), t.aV.simpleSegment(0, 0, a3.length, r2.length));
            })(e2, i2);
            return this._tileMeshCache[o2] = a2, a2;
          }
          recalculate(e2) {
          }
          hasTransition() {
            var e2;
            const t2 = c();
            let i2 = false;
            return i2 || (i2 = (t2 - this._errorMeasurementLastChangeTime) / 1e3 < 0.7), i2 || (i2 = null === (e2 = this._errorMeasurement) || void 0 === e2 ? void 0 : e2.awaitingQuery), i2;
          }
          setErrorQueryLatitudeDegrees(e2) {
            this._errorQueryLatitudeDegrees = e2;
          }
        }
        const di = new t.u({ type: new t.D(t.x.projection.type) });
        class _i extends t.E {
          constructor(e2) {
            super(), this._transitionable = new t.y(di, void 0), this.setProjection(e2), this._transitioning = this._transitionable.untransitioned(), this.recalculate(new t.J(0)), this._mercatorProjection = new Zt(), this._verticalPerspectiveProjection = new ui();
          }
          get transitionState() {
            const e2 = this.properties.get("type");
            if ("string" == typeof e2 && "mercator" === e2) return 0;
            if ("string" == typeof e2 && "vertical-perspective" === e2) return 1;
            if (e2 instanceof t.bv) {
              if ("vertical-perspective" === e2.from && "mercator" === e2.to) return 1 - e2.transition;
              if ("mercator" === e2.from && "vertical-perspective" === e2.to) return e2.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(e2) {
            this._mercatorProjection.updateGPUdependent(e2), this._verticalPerspectiveProjection.updateGPUdependent(e2);
          }
          getMeshFromTileID(e2, t2, i2, o2, a2) {
            return this.currentProjection.getMeshFromTileID(e2, t2, i2, o2, a2);
          }
          setProjection(e2) {
            this._transitionable.setValue("type", (null == e2 ? void 0 : e2.type) || "mercator");
          }
          updateTransitions(e2) {
            this._transitioning = this._transitionable.transitioned(e2, this._transitioning);
          }
          hasTransition() {
            return this._transitioning.hasTransition() || this.currentProjection.hasTransition();
          }
          recalculate(e2) {
            this.properties = this._transitioning.possiblyEvaluate(e2);
          }
          setErrorQueryLatitudeDegrees(e2) {
            this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e2), this._mercatorProjection.setErrorQueryLatitudeDegrees(e2);
          }
        }
        function pi(e2) {
          const t2 = gi(e2.worldSize, e2.center.lat);
          return 2 * Math.PI * t2;
        }
        function mi(e2, i2, o2, a2, r2) {
          const s2 = 1 / (1 << r2), n2 = i2 / t.a6 * s2 + a2 * s2, l2 = t.by((e2 / t.a6 * s2 + o2 * s2) * Math.PI * 2 + Math.PI, 2 * Math.PI), c2 = 2 * Math.atan(Math.exp(Math.PI - n2 * Math.PI * 2)) - 0.5 * Math.PI, h2 = Math.cos(c2), u2 = new Float64Array(3);
          return u2[0] = Math.sin(l2) * h2, u2[1] = Math.sin(c2), u2[2] = Math.cos(l2) * h2, u2;
        }
        function fi(e2) {
          return (function(e3, t2) {
            const i2 = Math.cos(t2), o2 = new Float64Array(3);
            return o2[0] = Math.sin(e3) * i2, o2[1] = Math.sin(t2), o2[2] = Math.cos(e3) * i2, o2;
          })(e2.lng * Math.PI / 180, e2.lat * Math.PI / 180);
        }
        function gi(e2, t2) {
          return e2 / (2 * Math.PI) / Math.cos(t2 * Math.PI / 180);
        }
        function vi(e2) {
          const i2 = Math.asin(e2[1]) / Math.PI * 180, o2 = Math.sqrt(e2[0] * e2[0] + e2[2] * e2[2]);
          if (o2 > 1e-6) {
            const a2 = e2[0] / o2, r2 = Math.acos(e2[2] / o2), s2 = (a2 > 0 ? r2 : -r2) / Math.PI * 180;
            return new t.W(t.X(s2, -180, 180), i2);
          }
          return new t.W(0, i2);
        }
        function xi(e2) {
          return Math.cos(e2 * Math.PI / 180);
        }
        function bi(e2, i2) {
          const o2 = xi(e2), a2 = xi(i2);
          return t.ar(a2 / o2);
        }
        function yi(e2, i2) {
          const o2 = e2.rotate(i2.bearingInRadians), a2 = i2.zoom + bi(i2.center.lat, 0), r2 = t.bt(1 / xi(i2.center.lat), 1 / xi(Math.min(Math.abs(i2.center.lat), 60)), t.bw(a2, 7, 3, 0, 1)), s2 = 360 / pi({ worldSize: i2.worldSize, center: { lat: i2.center.lat } });
          return new t.W(i2.center.lng - o2.x * s2 * r2, t.al(i2.center.lat + o2.y * s2, -t.am, t.am));
        }
        function wi(e2) {
          const t2 = 0.5 * e2, i2 = Math.sin(t2), o2 = Math.cos(t2);
          return Math.log(i2 + o2) - Math.log(o2 - i2);
        }
        function Ti(e2, i2, o2, a2) {
          const r2 = e2.lat + o2 * a2;
          if (Math.abs(o2) > 1) {
            const s2 = (Math.sign(e2.lat + o2) !== Math.sign(e2.lat) ? -Math.abs(e2.lat) : Math.abs(e2.lat)) * Math.PI / 180, n2 = Math.abs(e2.lat + o2) * Math.PI / 180, l2 = wi(s2 + a2 * (n2 - s2)), c2 = wi(s2), h2 = wi(n2);
            return new t.W(e2.lng + i2 * ((l2 - c2) / (h2 - c2)), r2);
          }
          return new t.W(e2.lng + i2 * a2, r2);
        }
        class Pi {
          constructor(e2) {
            this._cachePrevious = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this._hadAnyChanges = false, this._boundingVolumeFactory = e2;
          }
          swapBuffers() {
            if (!this._hadAnyChanges) return;
            const e2 = this._cachePrevious;
            this._cachePrevious = this._cache, this._cache = e2, this._cache.clear(), this._hadAnyChanges = false;
          }
          getTileBoundingVolume(e2, t2, i2, o2) {
            const a2 = `${e2.z}_${e2.x}_${e2.y}_${(null == o2 ? void 0 : o2.terrain) ? "t" : ""}`, r2 = this._cache.get(a2);
            if (r2) return r2;
            const s2 = this._cachePrevious.get(a2);
            if (s2) return this._cache.set(a2, s2), s2;
            const n2 = this._boundingVolumeFactory(e2, t2, i2, o2);
            return this._cache.set(a2, n2), this._hadAnyChanges = true, n2;
          }
        }
        class Ci {
          constructor(e2, t2, i2, o2) {
            this.min = i2, this.max = o2, this.points = e2, this.planes = t2;
          }
          static fromAabb(e2, t2) {
            const i2 = [];
            for (let o2 = 0; o2 < 8; o2++) i2.push([1 & ~o2 ? e2[0] : t2[0], 1 == (o2 >> 1 & 1) ? t2[1] : e2[1], 1 == (o2 >> 2 & 1) ? t2[2] : e2[2]]);
            return new Ci(i2, [[-1, 0, 0, t2[0]], [1, 0, 0, -e2[0]], [0, -1, 0, t2[1]], [0, 1, 0, -e2[1]], [0, 0, -1, t2[2]], [0, 0, 1, -e2[2]]], e2, t2);
          }
          static fromCenterSizeAngles(e2, i2, o2) {
            const a2 = t.bA([], o2[0], o2[1], o2[2]), r2 = t.bB([], [i2[0], 0, 0], a2), s2 = t.bB([], [0, i2[1], 0], a2), n2 = t.bB([], [0, 0, i2[2]], a2), l2 = [...e2], c2 = [...e2];
            for (let t2 = 0; t2 < 8; t2++) for (let i3 = 0; i3 < 3; i3++) {
              const o3 = e2[i3] + r2[i3] * (1 & ~t2 ? -1 : 1) + s2[i3] * (1 == (t2 >> 1 & 1) ? 1 : -1) + n2[i3] * (1 == (t2 >> 2 & 1) ? 1 : -1);
              l2[i3] = Math.min(l2[i3], o3), c2[i3] = Math.max(c2[i3], o3);
            }
            const h2 = [];
            for (let i3 = 0; i3 < 8; i3++) {
              const o3 = [...e2];
              t.a_(o3, o3, t.aZ([], r2, 1 & ~i3 ? -1 : 1)), t.a_(o3, o3, t.aZ([], s2, 1 == (i3 >> 1 & 1) ? 1 : -1)), t.a_(o3, o3, t.aZ([], n2, 1 == (i3 >> 2 & 1) ? 1 : -1)), h2.push(o3);
            }
            return new Ci(h2, [[...r2, -t.b3(r2, h2[0])], [...s2, -t.b3(s2, h2[0])], [...n2, -t.b3(n2, h2[0])], [-r2[0], -r2[1], -r2[2], -t.b3(r2, h2[7])], [-s2[0], -s2[1], -s2[2], -t.b3(s2, h2[7])], [-n2[0], -n2[1], -n2[2], -t.b3(n2, h2[7])]], l2, c2);
          }
          intersectsFrustum(e2) {
            let t2 = true;
            const i2 = this.points.length, o2 = this.planes.length, a2 = e2.planes.length, r2 = e2.points.length;
            for (let o3 = 0; o3 < a2; o3++) {
              const a3 = e2.planes[o3];
              let r3 = 0;
              for (let e3 = 0; e3 < i2; e3++) {
                const t3 = this.points[e3];
                a3[0] * t3[0] + a3[1] * t3[1] + a3[2] * t3[2] + a3[3] >= 0 && r3++;
              }
              if (0 === r3) return 0;
              r3 < i2 && (t2 = false);
            }
            if (t2) return 2;
            for (let t3 = 0; t3 < o2; t3++) {
              const i3 = this.planes[t3];
              let o3 = 0;
              for (let t4 = 0; t4 < r2; t4++) {
                const a3 = e2.points[t4];
                i3[0] * a3[0] + i3[1] * a3[1] + i3[2] * a3[2] + i3[3] >= 0 && o3++;
              }
              if (0 === o3) return 0;
            }
            return 1;
          }
          intersectsPlane(e2) {
            const t2 = this.points.length;
            let i2 = 0;
            for (let o2 = 0; o2 < t2; o2++) {
              const t3 = this.points[o2];
              e2[0] * t3[0] + e2[1] * t3[1] + e2[2] * t3[2] + e2[3] >= 0 && i2++;
            }
            return i2 === t2 ? 2 : 0 === i2 ? 0 : 1;
          }
        }
        function Mi(e2, t2, i2) {
          const o2 = e2 - t2;
          return o2 < 0 ? -o2 : Math.max(0, o2 - i2);
        }
        function Ii(e2, t2, i2, o2, a2) {
          const r2 = e2 - i2;
          let s2;
          return s2 = r2 < 0 ? Math.min(-r2, 1 + r2 - a2) : r2 > a2 ? Math.min(Math.max(r2 - a2, 0), 1 - r2) : 0, Math.max(s2, Mi(t2, o2, a2));
        }
        class Ei {
          constructor() {
            this._boundingVolumeCache = new Pi(this._computeTileBoundingVolume);
          }
          prepareNextFrame() {
            this._boundingVolumeCache.swapBuffers();
          }
          distanceToTile2d(e2, t2, i2, o2) {
            const a2 = 1 << i2.z, r2 = 1 / a2, s2 = i2.x / a2, n2 = i2.y / a2;
            let l2 = 2;
            return l2 = Math.min(l2, Ii(e2, t2, s2, n2, r2)), l2 = Math.min(l2, Ii(e2, t2, s2 + 0.5, -n2 - r2, r2)), l2 = Math.min(l2, Ii(e2, t2, s2 + 0.5, 2 - n2 - r2, r2)), l2;
          }
          getWrap(e2, t2, i2) {
            const o2 = 1 << t2.z, a2 = 1 / o2, r2 = t2.x / o2, s2 = Mi(e2.x, r2, a2), n2 = Mi(e2.x, r2 - 1, a2), l2 = Mi(e2.x, r2 + 1, a2), c2 = Math.min(s2, n2, l2);
            return c2 === l2 ? 1 : c2 === n2 ? -1 : 0;
          }
          allowVariableZoom(e2, t2) {
            return Ce(e2, t2) > 4;
          }
          allowWorldCopies() {
            return false;
          }
          getTileBoundingVolume(e2, t2, i2, o2) {
            return this._boundingVolumeCache.getTileBoundingVolume(e2, t2, i2, o2);
          }
          _computeTileBoundingVolume(e2, i2, o2, a2) {
            var r2, s2;
            let n2 = 0, l2 = 0;
            if (null == a2 ? void 0 : a2.terrain) {
              const c2 = new t.a3(e2.z, i2, e2.z, e2.x, e2.y), h2 = a2.terrain.getMinMaxElevation(c2);
              n2 = null !== (r2 = h2.minElevation) && void 0 !== r2 ? r2 : Math.min(0, o2), l2 = null !== (s2 = h2.maxElevation) && void 0 !== s2 ? s2 : Math.max(0, o2);
            }
            if (n2 /= t.bD, l2 /= t.bD, n2 += 1, l2 += 1, e2.z <= 0) return Ci.fromAabb([-l2, -l2, -l2], [l2, l2, l2]);
            if (1 === e2.z) return Ci.fromAabb([0 === e2.x ? -l2 : 0, 0 === e2.y ? 0 : -l2, -l2], [0 === e2.x ? 0 : l2, 0 === e2.y ? l2 : 0, l2]);
            {
              const i3 = [mi(0, 0, e2.x, e2.y, e2.z), mi(t.a6, 0, e2.x, e2.y, e2.z), mi(t.a6, t.a6, e2.x, e2.y, e2.z), mi(0, t.a6, e2.x, e2.y, e2.z)], o3 = [];
              for (const e3 of i3) o3.push(t.aZ([], e3, l2));
              if (l2 !== n2) for (const e3 of i3) o3.push(t.aZ([], e3, n2));
              0 === e2.y && o3.push([0, 1, 0]), e2.y === (1 << e2.z) - 1 && o3.push([0, -1, 0]);
              const a3 = [1, 1, 1], r3 = [-1, -1, -1];
              for (const e3 of o3) for (let t2 = 0; t2 < 3; t2++) a3[t2] = Math.min(a3[t2], e3[t2]), r3[t2] = Math.max(r3[t2], e3[t2]);
              const s3 = mi(t.a6 / 2, t.a6 / 2, e2.x, e2.y, e2.z), c2 = t.b2([], [0, 1, 0], s3);
              t.b1(c2, c2);
              const h2 = t.b2([], s3, c2);
              t.b1(h2, h2);
              const u2 = t.b2([], i3[2], i3[1]);
              t.b1(u2, u2);
              const d2 = t.b2([], i3[0], i3[3]);
              t.b1(d2, d2), o3.push(t.aZ([], s3, l2)), e2.y >= (1 << e2.z) / 2 && o3.push(t.aZ([], mi(t.a6 / 2, 0, e2.x, e2.y, e2.z), l2)), e2.y < (1 << e2.z) / 2 && o3.push(t.aZ([], mi(t.a6 / 2, t.a6, e2.x, e2.y, e2.z), l2));
              const _2 = Si(s3, o3), p2 = Si(h2, o3), m2 = [-s3[0], -s3[1], -s3[2], _2.max], f2 = [s3[0], s3[1], s3[2], -_2.min], g2 = [-h2[0], -h2[1], -h2[2], p2.max], v2 = [h2[0], h2[1], h2[2], -p2.min], x2 = [...u2, 0], b2 = [...d2, 0], y2 = [];
              return 0 === e2.y ? y2.push(t.bC(b2, x2, m2), t.bC(b2, x2, f2)) : y2.push(t.bC(g2, x2, m2), t.bC(g2, x2, f2), t.bC(g2, b2, m2), t.bC(g2, b2, f2)), e2.y === (1 << e2.z) - 1 ? y2.push(t.bC(b2, x2, m2), t.bC(b2, x2, f2)) : y2.push(t.bC(v2, x2, m2), t.bC(v2, x2, f2), t.bC(v2, b2, m2), t.bC(v2, b2, f2)), new Ci(y2, [m2, f2, g2, v2, x2, b2], a3, r3);
            }
          }
        }
        function Si(e2, i2) {
          let o2 = 1 / 0, a2 = -1 / 0;
          for (const r2 of i2) {
            const i3 = t.b3(e2, r2);
            o2 = Math.min(o2, i3), a2 = Math.max(a2, i3);
          }
          return { min: o2, max: a2 };
        }
        class zi {
          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(e2) {
            this._helper.setMinZoom(e2);
          }
          setMaxZoom(e2) {
            this._helper.setMaxZoom(e2);
          }
          setMinPitch(e2) {
            this._helper.setMinPitch(e2);
          }
          setMaxPitch(e2) {
            this._helper.setMaxPitch(e2);
          }
          setRenderWorldCopies(e2) {
            this._helper.setRenderWorldCopies(e2);
          }
          setBearing(e2) {
            this._helper.setBearing(e2);
          }
          setPitch(e2) {
            this._helper.setPitch(e2);
          }
          setRoll(e2) {
            this._helper.setRoll(e2);
          }
          setFov(e2) {
            this._helper.setFov(e2);
          }
          setZoom(e2) {
            this._helper.setZoom(e2);
          }
          setCenter(e2) {
            this._helper.setCenter(e2);
          }
          setElevation(e2) {
            this._helper.setElevation(e2);
          }
          setMinElevationForCurrentTile(e2) {
            this._helper.setMinElevationForCurrentTile(e2);
          }
          setPadding(e2) {
            this._helper.setPadding(e2);
          }
          interpolatePadding(e2, t2, i2) {
            this._helper.interpolatePadding(e2, t2, i2);
          }
          isPaddingEqual(e2) {
            return this._helper.isPaddingEqual(e2);
          }
          resize(e2, t2) {
            this._helper.resize(e2, t2);
          }
          getMaxBounds() {
            return this._helper.getMaxBounds();
          }
          setMaxBounds(e2) {
            this._helper.setMaxBounds(e2);
          }
          setConstrainOverride(e2) {
            this._helper.setConstrainOverride(e2);
          }
          overrideNearFarZ(e2, t2) {
            this._helper.overrideNearFarZ(e2, t2);
          }
          clearNearFarZOverride() {
            this._helper.clearNearFarZOverride();
          }
          getCameraQueryGeometry(e2) {
            return this._helper.getCameraQueryGeometry(this.getCameraPoint(), e2);
          }
          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(e2) {
          }
          constructor(e2) {
            this._cachedClippingPlane = t.bE(), this._projectionMatrix = t.bi(), this._globeViewProjMatrix32f = t.bh(), this._globeViewProjMatrixNoCorrection = t.bi(), this._globeViewProjMatrixNoCorrectionInverted = t.bi(), this._globeProjMatrixInverted = t.bi(), this._cameraPosition = t.bz(), this._globeLatitudeErrorCorrectionRadians = 0, this.defaultConstrain = (e3, i2) => {
              const o2 = t.al(e3.lat, -t.am, t.am), a2 = t.al(+i2, this.minZoom + bi(0, o2), this.maxZoom);
              return { center: new t.W(e3.lng, o2), zoom: a2 };
            }, this.applyConstrain = (e3, t2) => this._helper.applyConstrain(e3, t2), this._helper = new Wt({ calcMatrices: () => this._calcMatrices(), defaultConstrain: (e3, t2) => this.defaultConstrain(e3, t2) }, e2), this._coveringTilesDetailsProvider = new Ei();
          }
          clone() {
            const e2 = new zi();
            return e2.apply(this, false), e2;
          }
          apply(e2, t2, i2) {
            this._globeLatitudeErrorCorrectionRadians = i2 || 0, this._helper.apply(e2, t2);
          }
          get projectionMatrix() {
            return this._projectionMatrix;
          }
          get modelViewProjectionMatrix() {
            return this._globeViewProjMatrixNoCorrection;
          }
          get inverseProjectionMatrix() {
            return this._globeProjMatrixInverted;
          }
          get cameraPosition() {
            const e2 = t.bz();
            return e2[0] = this._cameraPosition[0], e2[1] = this._cameraPosition[1], e2[2] = this._cameraPosition[2], e2;
          }
          get cameraToCenterDistance() {
            return this._helper.cameraToCenterDistance;
          }
          getProjectionData(e2) {
            const { overscaledTileID: t2, applyGlobeMatrix: i2 } = e2, o2 = this._helper.getMercatorTileCoordinates(t2);
            return { mainMatrix: this._globeViewProjMatrix32f, tileMercatorCoords: o2, clippingPlane: this._cachedClippingPlane, projectionTransition: i2 ? 1 : 0, fallbackMatrix: this._globeViewProjMatrix32f };
          }
          _computeClippingPlane(e2) {
            const i2 = this.pitchInRadians, o2 = this.cameraToCenterDistance / e2, a2 = Math.sin(i2) * o2, r2 = Math.cos(i2) * o2 + 1, s2 = 1 / Math.sqrt(a2 * a2 + r2 * r2) * 1;
            let n2 = -a2, l2 = r2;
            const c2 = Math.sqrt(n2 * n2 + l2 * l2);
            n2 /= c2, l2 /= c2;
            const h2 = [0, n2, l2];
            t.bF(h2, h2, [0, 0, 0], -this.bearingInRadians), t.bG(h2, h2, [0, 0, 0], -1 * this.center.lat * Math.PI / 180), t.bH(h2, h2, [0, 0, 0], this.center.lng * Math.PI / 180);
            const u2 = 1 / t.b5(h2);
            return t.aZ(h2, h2, u2), [...h2, -s2 * u2];
          }
          isLocationOccluded(e2) {
            return !this.isSurfacePointVisible(fi(e2));
          }
          transformLightDirection(e2) {
            const i2 = this._helper._center.lng * Math.PI / 180, o2 = this._helper._center.lat * Math.PI / 180, a2 = Math.cos(o2), r2 = [Math.sin(i2) * a2, Math.sin(o2), Math.cos(i2) * a2], s2 = [r2[2], 0, -r2[0]], n2 = [0, 0, 0];
            t.b2(n2, s2, r2), t.b1(s2, s2), t.b1(n2, n2);
            const l2 = [0, 0, 0];
            return t.b1(l2, [s2[0] * e2[0] + n2[0] * e2[1] + r2[0] * e2[2], s2[1] * e2[0] + n2[1] * e2[1] + r2[1] * e2[2], s2[2] * e2[0] + n2[2] * e2[1] + r2[2] * e2[2]]), l2;
          }
          getPixelScale() {
            return 1 / Math.cos(this._helper._center.lat * Math.PI / 180);
          }
          getCircleRadiusCorrection() {
            return Math.cos(this._helper._center.lat * Math.PI / 180);
          }
          getPitchedTextCorrection(e2, i2, o2) {
            const a2 = (function(e3, i3, o3) {
              const a3 = 1 / (1 << o3.z);
              return new t.a7(e3 / t.a6 * a3 + o3.x * a3, i3 / t.a6 * a3 + o3.y * a3);
            })(e2, i2, o2.canonical), r2 = (s2 = a2.y, [t.by(a2.x * Math.PI * 2 + Math.PI, 2 * Math.PI), 2 * Math.atan(Math.exp(Math.PI - s2 * Math.PI * 2)) - 0.5 * Math.PI]);
            var s2;
            return this.getCircleRadiusCorrection() / Math.cos(r2[1]);
          }
          projectTileCoordinates(e2, i2, o2, a2) {
            const r2 = o2.canonical, s2 = mi(e2, i2, r2.x, r2.y, r2.z), n2 = 1 + (a2 ? a2(e2, i2) : 0) / t.bD, l2 = [s2[0] * n2, s2[1] * n2, s2[2] * n2, 1];
            t.aE(l2, l2, this._globeViewProjMatrixNoCorrection);
            const c2 = this._cachedClippingPlane, h2 = c2[0] * s2[0] + c2[1] * s2[1] + c2[2] * s2[2] + c2[3] < 0;
            return { point: new t.P(l2[0] / l2[3], l2[1] / l2[3]), signedDistanceFromCamera: l2[3], isOccluded: h2 };
          }
          _calcMatrices() {
            if (!this._helper._width || !this._helper._height) return;
            const e2 = gi(this.worldSize, this.center.lat), i2 = t.bj(), o2 = t.bj();
            this._helper.autoCalculateNearFarZ && (this._helper._nearZ = 0.5, this._helper._farZ = this.cameraToCenterDistance + 2 * e2), t.bc(i2, this.fovInRadians, this.width / this.height, this._helper._nearZ, this._helper._farZ);
            const a2 = this.centerOffset;
            i2[8] = 2 * -a2.x / this._helper._width, i2[9] = 2 * a2.y / this._helper._height, this._projectionMatrix = t.bd(i2), this._globeProjMatrixInverted = t.bj(), t.bg(this._globeProjMatrixInverted, i2), t.Q(i2, i2, [0, 0, -this.cameraToCenterDistance]), t.be(i2, i2, this.rollInRadians), t.bf(i2, i2, -this.pitchInRadians), t.be(i2, i2, this.bearingInRadians), t.Q(i2, i2, [0, 0, -e2]);
            const r2 = t.bz();
            r2[0] = e2, r2[1] = e2, r2[2] = e2, t.bf(o2, i2, this.center.lat * Math.PI / 180), t.bI(o2, o2, -this.center.lng * Math.PI / 180), t.S(o2, o2, r2), this._globeViewProjMatrixNoCorrection = o2, t.bf(i2, i2, this.center.lat * Math.PI / 180 - this._globeLatitudeErrorCorrectionRadians), t.bI(i2, i2, -this.center.lng * Math.PI / 180), t.S(i2, i2, r2), this._globeViewProjMatrix32f = new Float32Array(i2), this._globeViewProjMatrixNoCorrectionInverted = t.bj(), t.bg(this._globeViewProjMatrixNoCorrectionInverted, o2);
            const s2 = t.bz();
            this._cameraPosition = t.bz(), this._cameraPosition[2] = this.cameraToCenterDistance / e2, t.bF(this._cameraPosition, this._cameraPosition, s2, -this.rollInRadians), t.bG(this._cameraPosition, this._cameraPosition, s2, this.pitchInRadians), t.bF(this._cameraPosition, this._cameraPosition, s2, -this.bearingInRadians), t.a_(this._cameraPosition, this._cameraPosition, [0, 0, 1]), t.bG(this._cameraPosition, this._cameraPosition, s2, -this.center.lat * Math.PI / 180), t.bH(this._cameraPosition, this._cameraPosition, s2, this.center.lng * Math.PI / 180), this._cachedClippingPlane = this._computeClippingPlane(e2);
            const n2 = t.bd(this._globeViewProjMatrixNoCorrectionInverted);
            t.S(n2, n2, [1, 1, -1]), this._cachedFrustum = Ht.fromInvProjectionMatrix(n2, 1, 0, this._cachedClippingPlane, true);
          }
          calculateFogMatrix(e2) {
            t.w("calculateFogMatrix is not supported on globe projection.");
            const i2 = t.bj();
            return t.ap(i2), i2;
          }
          getVisibleUnwrappedCoordinates(e2) {
            return [new t.ba(0, e2)];
          }
          getCameraFrustum() {
            return this._cachedFrustum;
          }
          getClippingPlane() {
            return this._cachedClippingPlane;
          }
          getCoveringTilesDetailsProvider() {
            return this._coveringTilesDetailsProvider;
          }
          recalculateZoomAndCenter(e2) {
            e2 && t.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(e2, i2) {
            if (!this._globeViewProjMatrixNoCorrection) return 1;
            const o2 = fi(e2);
            t.aZ(o2, o2, 1 + i2 / t.bD);
            const a2 = t.bE();
            return t.aE(a2, [o2[0], o2[1], o2[2], 1], this._globeViewProjMatrixNoCorrection), a2[2] / a2[3];
          }
          populateCache(e2) {
          }
          getBounds() {
            const e2 = 0.5 * this.width, i2 = 0.5 * this.height, o2 = [new t.P(0, 0), new t.P(e2, 0), new t.P(this.width, 0), new t.P(this.width, i2), new t.P(this.width, this.height), new t.P(e2, this.height), new t.P(0, this.height), new t.P(0, i2)], a2 = [];
            for (const e3 of o2) a2.push(this.unprojectScreenPoint(e3));
            let r2 = 0, s2 = 0, n2 = 0, l2 = 0;
            const c2 = this.center;
            for (const e3 of a2) {
              const i3 = t.bJ(c2.lng, e3.lng), o3 = t.bJ(c2.lat, e3.lat);
              i3 < s2 && (s2 = i3), i3 > r2 && (r2 = i3), o3 < l2 && (l2 = o3), o3 > n2 && (n2 = o3);
            }
            const h2 = [c2.lng + s2, c2.lat + l2, c2.lng + r2, c2.lat + n2];
            return this.isSurfacePointOnScreen([0, 1, 0]) && (h2[3] = 90, h2[0] = -180, h2[2] = 180), this.isSurfacePointOnScreen([0, -1, 0]) && (h2[1] = -90, h2[0] = -180, h2[2] = 180), new G(h2);
          }
          calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2) {
            return this._helper.calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2);
          }
          setLocationAtPoint(e2, i2) {
            const o2 = fi(this.unprojectScreenPoint(i2)), a2 = fi(e2), r2 = t.bz();
            t.bK(r2);
            const s2 = t.bz();
            t.bH(s2, o2, r2, -this.center.lng * Math.PI / 180), t.bG(s2, s2, r2, this.center.lat * Math.PI / 180);
            const n2 = a2[0] * a2[0] + a2[2] * a2[2], l2 = s2[0] * s2[0];
            if (n2 < l2) return;
            const c2 = Math.sqrt(n2 - l2), h2 = -c2, u2 = t.bL(a2[0], a2[2], s2[0], c2), d2 = t.bL(a2[0], a2[2], s2[0], h2), _2 = t.bz();
            t.bH(_2, a2, r2, -u2);
            const p2 = t.bL(_2[1], _2[2], s2[1], s2[2]), m2 = t.bz();
            t.bH(m2, a2, r2, -d2);
            const f2 = t.bL(m2[1], m2[2], s2[1], s2[2]), g2 = 0.5 * Math.PI, v2 = p2 >= -g2 && p2 <= g2, x2 = f2 >= -g2 && f2 <= g2;
            let b2, y2;
            if (v2 && x2) {
              const e3 = this.center.lng * Math.PI / 180, i3 = this.center.lat * Math.PI / 180;
              t.bM(u2, e3) + t.bM(p2, i3) < t.bM(d2, e3) + t.bM(f2, i3) ? (b2 = u2, y2 = p2) : (b2 = d2, y2 = f2);
            } else if (v2) b2 = u2, y2 = p2;
            else {
              if (!x2) return;
              b2 = d2, y2 = f2;
            }
            const w2 = b2 / Math.PI * 180, T2 = y2 / Math.PI * 180, P2 = this.center.lat;
            this.setCenter(new t.W(w2, t.al(T2, -90, 90))), this.setZoom(this.zoom + bi(P2, this.center.lat));
          }
          locationToScreenPoint(e2, i2) {
            const o2 = fi(e2);
            if (i2) {
              const a2 = i2.getElevationForLngLatZoom(e2, this._helper._tileZoom);
              t.aZ(o2, o2, 1 + a2 / t.bD);
            }
            return this._projectSurfacePointToScreen(o2);
          }
          _projectSurfacePointToScreen(e2) {
            const i2 = t.bE();
            return t.aE(i2, [...e2, 1], this._globeViewProjMatrixNoCorrection), i2[0] /= i2[3], i2[1] /= i2[3], new t.P((0.5 * i2[0] + 0.5) * this.width, (0.5 * -i2[1] + 0.5) * this.height);
          }
          screenPointToMercatorCoordinate(e2, i2) {
            if (i2) {
              const t2 = i2.pointCoordinate(e2);
              if (t2) return t2;
            }
            return t.a7.fromLngLat(this.unprojectScreenPoint(e2));
          }
          screenPointToLocation(e2, t2) {
            var i2;
            return null === (i2 = this.screenPointToMercatorCoordinate(e2, t2)) || void 0 === i2 ? void 0 : i2.toLngLat();
          }
          isPointOnMapSurface(e2, t2) {
            const i2 = this._cameraPosition, o2 = this.getRayDirectionFromPixel(e2);
            return !!this.rayPlanetIntersection(i2, o2);
          }
          getRayDirectionFromPixel(e2) {
            const i2 = t.bE();
            i2[0] = e2.x / this.width * 2 - 1, i2[1] = -1 * (e2.y / this.height * 2 - 1), i2[2] = 1, i2[3] = 1, t.aE(i2, i2, this._globeViewProjMatrixNoCorrectionInverted), i2[0] /= i2[3], i2[1] /= i2[3], i2[2] /= i2[3];
            const o2 = t.bz();
            o2[0] = i2[0] - this._cameraPosition[0], o2[1] = i2[1] - this._cameraPosition[1], o2[2] = i2[2] - this._cameraPosition[2];
            const a2 = t.bz();
            return t.b1(a2, o2), a2;
          }
          isSurfacePointVisible(e2) {
            const t2 = this._cachedClippingPlane;
            return t2[0] * e2[0] + t2[1] * e2[1] + t2[2] * e2[2] + t2[3] >= 0;
          }
          isSurfacePointOnScreen(e2) {
            if (!this.isSurfacePointVisible(e2)) return false;
            const i2 = t.bE();
            return t.aE(i2, [...e2, 1], this._globeViewProjMatrixNoCorrection), i2[0] /= i2[3], i2[1] /= i2[3], i2[2] /= i2[3], i2[0] > -1 && i2[0] < 1 && i2[1] > -1 && i2[1] < 1 && i2[2] > -1 && i2[2] < 1;
          }
          rayPlanetIntersection(e2, i2) {
            const o2 = t.b3(e2, i2), a2 = t.bz(), r2 = t.bz();
            t.aZ(r2, i2, o2), t.b0(a2, e2, r2);
            const s2 = 1 - t.b3(a2, a2);
            if (s2 < 0) return null;
            const n2 = t.b3(e2, e2) - 1, l2 = -o2 + (o2 < 0 ? 1 : -1) * Math.sqrt(s2), c2 = n2 / l2, h2 = l2;
            return { tMin: Math.min(c2, h2), tMax: Math.max(c2, h2) };
          }
          unprojectScreenPoint(e2) {
            const i2 = this._cameraPosition, o2 = this.getRayDirectionFromPixel(e2), a2 = this.rayPlanetIntersection(i2, o2);
            if (a2) {
              const e3 = t.bz();
              t.a_(e3, i2, [o2[0] * a2.tMin, o2[1] * a2.tMin, o2[2] * a2.tMin]);
              const r3 = t.bz();
              return t.b1(r3, e3), vi(r3);
            }
            const r2 = this._cachedClippingPlane, s2 = r2[0] * o2[0] + r2[1] * o2[1] + r2[2] * o2[2], n2 = -t.b9(r2, i2) / s2, l2 = t.bz();
            if (n2 > 0) t.a_(l2, i2, [o2[0] * n2, o2[1] * n2, o2[2] * n2]);
            else {
              const e3 = t.bz();
              t.a_(e3, i2, [2 * o2[0], 2 * o2[1], 2 * o2[2]]);
              const a3 = t.b9(this._cachedClippingPlane, e3);
              t.b0(l2, e3, [this._cachedClippingPlane[0] * a3, this._cachedClippingPlane[1] * a3, this._cachedClippingPlane[2] * a3]);
            }
            const c2 = (function(e3) {
              const i3 = t.bz();
              return i3[0] = e3[0] * -e3[3], i3[1] = e3[1] * -e3[3], i3[2] = e3[2] * -e3[3], { center: i3, radius: Math.sqrt(1 - e3[3] * e3[3]) };
            })(r2);
            return vi((function(e3, i3, o3) {
              const a3 = t.bz();
              t.b0(a3, o3, e3);
              const r3 = t.bz();
              return t.bx(r3, e3, a3, i3 / t.b7(a3)), r3;
            })(c2.center, c2.radius, l2));
          }
          getMatrixForModel(e2, i2) {
            const o2 = t.W.convert(e2), a2 = 1 / t.bD, r2 = t.bi();
            return t.bI(r2, r2, o2.lng / 180 * Math.PI), t.bf(r2, r2, -o2.lat / 180 * Math.PI), t.Q(r2, r2, [0, 0, 1 + i2 / t.bD]), t.bf(r2, r2, 0.5 * Math.PI), t.S(r2, r2, [a2, a2, a2]), r2;
          }
          getProjectionDataForCustomLayer(e2 = true) {
            const i2 = this.getProjectionData({ overscaledTileID: new t.a3(0, 0, 0, 0, 0), applyGlobeMatrix: e2 });
            return i2.tileMercatorCoords = [0, 0, 1, 1], i2;
          }
          getFastPathSimpleProjectionMatrix(e2) {
          }
        }
        class Ri {
          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(e2) {
            this._helper.setMinZoom(e2);
          }
          setMaxZoom(e2) {
            this._helper.setMaxZoom(e2);
          }
          setMinPitch(e2) {
            this._helper.setMinPitch(e2);
          }
          setMaxPitch(e2) {
            this._helper.setMaxPitch(e2);
          }
          setRenderWorldCopies(e2) {
            this._helper.setRenderWorldCopies(e2);
          }
          setBearing(e2) {
            this._helper.setBearing(e2);
          }
          setPitch(e2) {
            this._helper.setPitch(e2);
          }
          setRoll(e2) {
            this._helper.setRoll(e2);
          }
          setFov(e2) {
            this._helper.setFov(e2);
          }
          setZoom(e2) {
            this._helper.setZoom(e2);
          }
          setCenter(e2) {
            this._helper.setCenter(e2);
          }
          setElevation(e2) {
            this._helper.setElevation(e2);
          }
          setMinElevationForCurrentTile(e2) {
            this._helper.setMinElevationForCurrentTile(e2);
          }
          setPadding(e2) {
            this._helper.setPadding(e2);
          }
          interpolatePadding(e2, t2, i2) {
            this._helper.interpolatePadding(e2, t2, i2);
          }
          isPaddingEqual(e2) {
            return this._helper.isPaddingEqual(e2);
          }
          resize(e2, t2, i2 = true) {
            this._helper.resize(e2, t2, i2);
          }
          getMaxBounds() {
            return this._helper.getMaxBounds();
          }
          setMaxBounds(e2) {
            this._helper.setMaxBounds(e2);
          }
          setConstrainOverride(e2) {
            this._helper.setConstrainOverride(e2);
          }
          overrideNearFarZ(e2, t2) {
            this._helper.overrideNearFarZ(e2, t2);
          }
          clearNearFarZOverride() {
            this._helper.clearNearFarZOverride();
          }
          getCameraQueryGeometry(e2) {
            return this._helper.getCameraQueryGeometry(this.getCameraPoint(), e2);
          }
          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(e2, t2) {
            this._globeness = e2, this._globeLatitudeErrorCorrectionRadians = t2, this._calcMatrices(), this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(), this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame();
          }
          get currentTransform() {
            return this.isGlobeRendering ? this._verticalPerspectiveTransform : this._mercatorTransform;
          }
          constructor(e2) {
            this._globeLatitudeErrorCorrectionRadians = 0, this._globeness = 1, this.defaultConstrain = (e3, t2) => this.currentTransform.defaultConstrain(e3, t2), this.applyConstrain = (e3, t2) => this._helper.applyConstrain(e3, t2), this._helper = new Wt({ calcMatrices: () => this._calcMatrices(), defaultConstrain: (e3, t2) => this.defaultConstrain(e3, t2) }, e2), this._globeness = 1, this._mercatorTransform = new Xt(), this._verticalPerspectiveTransform = new zi();
          }
          clone() {
            const e2 = new Ri();
            return e2._globeness = this._globeness, e2._globeLatitudeErrorCorrectionRadians = this._globeLatitudeErrorCorrectionRadians, e2.apply(this, false), e2;
          }
          apply(e2, t2) {
            this._helper.apply(e2, t2), this._mercatorTransform.apply(this, false), this._verticalPerspectiveTransform.apply(this, false, 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(e2) {
            const t2 = this._mercatorTransform.getProjectionData(e2), i2 = this._verticalPerspectiveTransform.getProjectionData(e2);
            return { mainMatrix: this.isGlobeRendering ? i2.mainMatrix : t2.mainMatrix, clippingPlane: i2.clippingPlane, tileMercatorCoords: i2.tileMercatorCoords, projectionTransition: e2.applyGlobeMatrix ? this._globeness : 0, fallbackMatrix: t2.fallbackMatrix };
          }
          isLocationOccluded(e2) {
            return this.currentTransform.isLocationOccluded(e2);
          }
          transformLightDirection(e2) {
            return this.currentTransform.transformLightDirection(e2);
          }
          getPixelScale() {
            return t.bt(this._mercatorTransform.getPixelScale(), this._verticalPerspectiveTransform.getPixelScale(), this._globeness);
          }
          getCircleRadiusCorrection() {
            return t.bt(this._mercatorTransform.getCircleRadiusCorrection(), this._verticalPerspectiveTransform.getCircleRadiusCorrection(), this._globeness);
          }
          getPitchedTextCorrection(e2, i2, o2) {
            const a2 = this._mercatorTransform.getPitchedTextCorrection(e2, i2, o2), r2 = this._verticalPerspectiveTransform.getPitchedTextCorrection(e2, i2, o2);
            return t.bt(a2, r2, this._globeness);
          }
          projectTileCoordinates(e2, t2, i2, o2) {
            return this.currentTransform.projectTileCoordinates(e2, t2, i2, o2);
          }
          _calcMatrices() {
            this._helper._width && this._helper._height && (this._verticalPerspectiveTransform.apply(this, false, this._globeLatitudeErrorCorrectionRadians), this._helper._nearZ = this._verticalPerspectiveTransform.nearZ, this._helper._farZ = this._verticalPerspectiveTransform.farZ, this._mercatorTransform.apply(this, true, this.isGlobeRendering), this._helper._nearZ = this._mercatorTransform.nearZ, this._helper._farZ = this._mercatorTransform.farZ);
          }
          calculateFogMatrix(e2) {
            return this.currentTransform.calculateFogMatrix(e2);
          }
          getVisibleUnwrappedCoordinates(e2) {
            return this.currentTransform.getVisibleUnwrappedCoordinates(e2);
          }
          getCameraFrustum() {
            return this.currentTransform.getCameraFrustum();
          }
          getClippingPlane() {
            return this.currentTransform.getClippingPlane();
          }
          getCoveringTilesDetailsProvider() {
            return this.currentTransform.getCoveringTilesDetailsProvider();
          }
          recalculateZoomAndCenter(e2) {
            this._mercatorTransform.recalculateZoomAndCenter(e2), this._verticalPerspectiveTransform.recalculateZoomAndCenter(e2);
          }
          maxPitchScaleFactor() {
            return this._mercatorTransform.maxPitchScaleFactor();
          }
          getCameraPoint() {
            return this._helper.getCameraPoint();
          }
          getCameraAltitude() {
            return this._helper.getCameraAltitude();
          }
          getCameraLngLat() {
            return this._helper.getCameraLngLat();
          }
          lngLatToCameraDepth(e2, t2) {
            return this.currentTransform.lngLatToCameraDepth(e2, t2);
          }
          populateCache(e2) {
            this._mercatorTransform.populateCache(e2), this._verticalPerspectiveTransform.populateCache(e2);
          }
          getBounds() {
            return this.currentTransform.getBounds();
          }
          calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2) {
            return this._helper.calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2);
          }
          setLocationAtPoint(e2, t2) {
            if (!this.isGlobeRendering) return this._mercatorTransform.setLocationAtPoint(e2, t2), void this.apply(this._mercatorTransform, false);
            this._verticalPerspectiveTransform.setLocationAtPoint(e2, t2), this.apply(this._verticalPerspectiveTransform, false);
          }
          locationToScreenPoint(e2, t2) {
            return this.currentTransform.locationToScreenPoint(e2, t2);
          }
          screenPointToMercatorCoordinate(e2, t2) {
            return this.currentTransform.screenPointToMercatorCoordinate(e2, t2);
          }
          screenPointToLocation(e2, t2) {
            return this.currentTransform.screenPointToLocation(e2, t2);
          }
          isPointOnMapSurface(e2, t2) {
            return this.currentTransform.isPointOnMapSurface(e2, t2);
          }
          getRayDirectionFromPixel(e2) {
            return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e2);
          }
          getMatrixForModel(e2, t2) {
            return this.currentTransform.getMatrixForModel(e2, t2);
          }
          getProjectionDataForCustomLayer(e2 = true) {
            const t2 = this._mercatorTransform.getProjectionDataForCustomLayer(e2);
            if (!this.isGlobeRendering) return t2;
            const i2 = this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e2);
            return i2.fallbackMatrix = t2.mainMatrix, i2;
          }
          getFastPathSimpleProjectionMatrix(e2) {
            return this.currentTransform.getFastPathSimpleProjectionMatrix(e2);
          }
        }
        class Di {
          get useGlobeControls() {
            return true;
          }
          handlePanInertia(e2, i2) {
            const o2 = yi(e2, i2);
            return Math.abs(o2.lng - i2.center.lng) > 180 && (o2.lng = i2.center.lng + 179.5 * Math.sign(o2.lng - i2.center.lng)), { easingCenter: o2, easingOffset: new t.P(0, 0) };
          }
          handleMapControlsRollPitchBearingZoom(e2, i2) {
            const o2 = e2.around, a2 = i2.screenPointToLocation(o2);
            e2.bearingDelta && i2.setBearing(i2.bearing + e2.bearingDelta), e2.pitchDelta && i2.setPitch(i2.pitch + e2.pitchDelta), e2.rollDelta && i2.setRoll(i2.roll + e2.rollDelta);
            const r2 = i2.zoom;
            e2.zoomDelta && i2.setZoom(i2.zoom + e2.zoomDelta);
            const s2 = i2.zoom - r2;
            if (0 === s2) return;
            const n2 = t.bJ(i2.center.lng, a2.lng), l2 = n2 / (Math.abs(n2 / 180) + 1), c2 = t.bJ(i2.center.lat, a2.lat), h2 = i2.getRayDirectionFromPixel(o2), u2 = i2.cameraPosition, d2 = -1 * t.b3(u2, h2), _2 = t.bz();
            t.a_(_2, u2, [h2[0] * d2, h2[1] * d2, h2[2] * d2]);
            const p2 = t.b5(_2) - 1, m2 = Math.exp(0.5 * -Math.max(p2 - 0.3, 0)), f2 = gi(i2.worldSize, i2.center.lat) / Math.min(i2.width, i2.height), g2 = t.bw(f2, 0.9, 0.5, 1, 0.25), v2 = (1 - t.ao(-s2)) * Math.min(m2, g2), x2 = i2.center.lat, b2 = i2.zoom, y2 = new t.W(i2.center.lng + l2 * v2, t.al(i2.center.lat + c2 * v2, -t.am, t.am));
            i2.setLocationAtPoint(a2, o2);
            const w2 = i2.center, T2 = t.bw(Math.abs(n2), 45, 85, 0, 1), P2 = t.bw(f2, 0.75, 0.35, 0, 1), C2 = Math.pow(Math.max(T2, P2), 0.25), M2 = t.bJ(w2.lng, y2.lng), I2 = t.bJ(w2.lat, y2.lat);
            i2.setCenter(new t.W(w2.lng + M2 * C2, w2.lat + I2 * C2).wrap()), i2.setZoom(b2 + bi(x2, i2.center.lat));
          }
          handleMapControlsPan(e2, t2, i2) {
            if (!e2.panDelta) return;
            const o2 = t2.center.lat, a2 = t2.zoom;
            t2.setCenter(yi(e2.panDelta, t2).wrap()), t2.setZoom(a2 + bi(o2, t2.center.lat));
          }
          cameraForBoxAndBearing(e2, i2, o2, a2, r2) {
            const s2 = Qt(e2, i2, o2, a2, r2), n2 = i2.left / r2.width * 2 - 1, l2 = (r2.width - i2.right) / r2.width * 2 - 1, c2 = i2.top / r2.height * -2 + 1, h2 = (r2.height - i2.bottom) / r2.height * -2 + 1, u2 = t.bJ(o2.getWest(), o2.getEast()) < 0, d2 = u2 ? o2.getEast() : o2.getWest(), _2 = u2 ? o2.getWest() : o2.getEast(), p2 = Math.max(o2.getNorth(), o2.getSouth()), m2 = Math.min(o2.getNorth(), o2.getSouth()), f2 = d2 + 0.5 * t.bJ(d2, _2), g2 = p2 + 0.5 * t.bJ(p2, m2), v2 = r2.clone();
            v2.setCenter(s2.center), v2.setBearing(s2.bearing), v2.setPitch(0), v2.setRoll(0), v2.setZoom(s2.zoom);
            const x2 = v2.modelViewProjectionMatrix, b2 = [fi(o2.getNorthWest()), fi(o2.getNorthEast()), fi(o2.getSouthWest()), fi(o2.getSouthEast()), fi(new t.W(_2, g2)), fi(new t.W(d2, g2)), fi(new t.W(f2, p2)), fi(new t.W(f2, m2))], y2 = fi(s2.center);
            let w2 = Number.POSITIVE_INFINITY;
            for (const e3 of b2) n2 < 0 && (w2 = Di.getLesserNonNegativeNonNull(w2, Di.solveVectorScale(e3, y2, x2, "x", n2))), l2 > 0 && (w2 = Di.getLesserNonNegativeNonNull(w2, Di.solveVectorScale(e3, y2, x2, "x", l2))), c2 > 0 && (w2 = Di.getLesserNonNegativeNonNull(w2, Di.solveVectorScale(e3, y2, x2, "y", c2))), h2 < 0 && (w2 = Di.getLesserNonNegativeNonNull(w2, Di.solveVectorScale(e3, y2, x2, "y", h2)));
            if (Number.isFinite(w2) && 0 !== w2) return s2.zoom = Math.min(v2.zoom + t.ar(w2), e2.maxZoom), s2;
            Kt();
          }
          handleJumpToCenterZoom(e2, i2) {
            const o2 = e2.center.lat, a2 = e2.applyConstrain(i2.center ? t.W.convert(i2.center) : e2.center, e2.zoom).center;
            e2.setCenter(a2.wrap());
            const r2 = void 0 !== i2.zoom ? +i2.zoom : e2.zoom + bi(o2, a2.lat);
            e2.zoom !== r2 && e2.setZoom(r2);
          }
          handleEaseTo(e2, i2) {
            const o2 = e2.zoom, a2 = e2.center, r2 = e2.padding, s2 = { roll: e2.roll, pitch: e2.pitch, bearing: e2.bearing }, n2 = { roll: void 0 === i2.roll ? e2.roll : i2.roll, pitch: void 0 === i2.pitch ? e2.pitch : i2.pitch, bearing: void 0 === i2.bearing ? e2.bearing : i2.bearing }, l2 = void 0 !== i2.zoom, c2 = !e2.isPaddingEqual(i2.padding);
            let h2 = false;
            const u2 = i2.center ? t.W.convert(i2.center) : a2, d2 = e2.applyConstrain(u2, o2).center;
            Gt(e2, d2);
            const _2 = e2.clone();
            _2.setCenter(d2), _2.setZoom(l2 ? +i2.zoom : o2 + bi(a2.lat, u2.lat)), _2.setBearing(i2.bearing);
            const p2 = new t.P(t.al(e2.centerPoint.x + i2.offsetAsPoint.x, 0, e2.width), t.al(e2.centerPoint.y + i2.offsetAsPoint.y, 0, e2.height));
            _2.setLocationAtPoint(d2, p2);
            const m2 = (i2.offset && i2.offsetAsPoint.mag()) > 0 ? _2.center : d2, f2 = l2 ? +i2.zoom : o2 + bi(a2.lat, m2.lat), g2 = o2 + bi(a2.lat, 0), v2 = f2 + bi(m2.lat, 0), x2 = t.bJ(a2.lng, m2.lng), b2 = t.bJ(a2.lat, m2.lat), y2 = t.ao(v2 - g2);
            return h2 = f2 !== o2, { easeFunc: (o3) => {
              if (t.bn(s2, n2) || Yt({ startEulerAngles: s2, endEulerAngles: n2, tr: e2, k: o3, useSlerp: s2.roll != n2.roll }), c2 && e2.interpolatePadding(r2, i2.padding, o3), i2.around) t.w("Easing around a point is not supported under globe projection."), e2.setLocationAtPoint(i2.around, i2.aroundPoint);
              else {
                const t2 = v2 > g2 ? Math.min(2, y2) : Math.max(0.5, y2), i3 = Math.pow(t2, 1 - o3), r3 = Ti(a2, x2, b2, o3 * i3);
                e2.setCenter(r3.wrap());
              }
              if (h2) {
                const i3 = t.H.number(g2, v2, o3) + bi(0, e2.center.lat);
                e2.setZoom(i3);
              }
            }, isZooming: h2, elevationCenter: m2 };
          }
          handleFlyTo(e2, i2) {
            const o2 = void 0 !== i2.zoom, a2 = e2.center, r2 = e2.zoom, s2 = e2.padding, n2 = !e2.isPaddingEqual(i2.padding), l2 = e2.applyConstrain(t.W.convert(i2.center || i2.locationAtOffset), r2).center, c2 = o2 ? +i2.zoom : e2.zoom + bi(e2.center.lat, l2.lat), h2 = e2.clone();
            h2.setCenter(l2), h2.setZoom(c2), h2.setBearing(i2.bearing);
            const u2 = new t.P(t.al(e2.centerPoint.x + i2.offsetAsPoint.x, 0, e2.width), t.al(e2.centerPoint.y + i2.offsetAsPoint.y, 0, e2.height));
            h2.setLocationAtPoint(l2, u2);
            const d2 = h2.center;
            Gt(e2, d2);
            const _2 = (function(e3, i3, o3) {
              const a3 = fi(i3), r3 = fi(o3), s3 = t.b3(a3, r3), n3 = Math.acos(s3), l3 = pi(e3);
              return n3 / (2 * Math.PI) * l3;
            })(e2, a2, d2), p2 = r2 + bi(a2.lat, 0), m2 = c2 + bi(d2.lat, 0), f2 = t.ao(m2 - p2);
            let g2;
            if ("number" == typeof i2.minZoom) {
              const o3 = +i2.minZoom + bi(d2.lat, 0), a3 = Math.min(o3, p2, m2) + bi(0, d2.lat), r3 = e2.applyConstrain(d2, a3).zoom + bi(d2.lat, 0);
              g2 = t.ao(r3 - p2);
            }
            const v2 = t.bJ(a2.lng, d2.lng), x2 = t.bJ(a2.lat, d2.lat);
            return { easeFunc: (o3, r3, l3, h3) => {
              const u3 = Ti(a2, v2, x2, l3);
              n2 && e2.interpolatePadding(s2, i2.padding, o3);
              const _3 = 1 === o3 ? d2 : u3;
              e2.setCenter(_3.wrap());
              const m3 = p2 + t.ar(r3);
              e2.setZoom(1 === o3 ? c2 : m3 + bi(0, _3.lat));
            }, scaleOfZoom: f2, targetCenter: d2, scaleOfMinZoom: g2, pixelPathLength: _2 };
          }
          static solveVectorScale(e2, t2, i2, o2, a2) {
            const r2 = "x" === o2 ? [i2[0], i2[4], i2[8], i2[12]] : [i2[1], i2[5], i2[9], i2[13]], s2 = [i2[3], i2[7], i2[11], i2[15]], n2 = e2[0] * r2[0] + e2[1] * r2[1] + e2[2] * r2[2], l2 = e2[0] * s2[0] + e2[1] * s2[1] + e2[2] * s2[2], c2 = t2[0] * r2[0] + t2[1] * r2[1] + t2[2] * r2[2], h2 = t2[0] * s2[0] + t2[1] * s2[1] + t2[2] * s2[2];
            return c2 + a2 * l2 === n2 + a2 * h2 || s2[3] * (n2 - c2) + r2[3] * (h2 - l2) + n2 * h2 == c2 * l2 ? null : (c2 + r2[3] - a2 * h2 - a2 * s2[3]) / (c2 - n2 - a2 * h2 + a2 * l2);
          }
          static getLesserNonNegativeNonNull(e2, t2) {
            return null !== t2 && t2 >= 0 && t2 < e2 ? t2 : e2;
          }
        }
        class Ai {
          constructor(e2) {
            this._globe = e2, this._mercatorCameraHelper = new Jt(), this._verticalPerspectiveCameraHelper = new Di();
          }
          get useGlobeControls() {
            return this._globe.useGlobeRendering;
          }
          get currentHelper() {
            return this.useGlobeControls ? this._verticalPerspectiveCameraHelper : this._mercatorCameraHelper;
          }
          handlePanInertia(e2, t2) {
            return this.currentHelper.handlePanInertia(e2, t2);
          }
          handleMapControlsRollPitchBearingZoom(e2, t2) {
            this.currentHelper.handleMapControlsRollPitchBearingZoom(e2, t2);
          }
          handleMapControlsPan(e2, t2, i2) {
            this.currentHelper.handleMapControlsPan(e2, t2, i2);
          }
          cameraForBoxAndBearing(e2, t2, i2, o2, a2) {
            return this.currentHelper.cameraForBoxAndBearing(e2, t2, i2, o2, a2);
          }
          handleJumpToCenterZoom(e2, t2) {
            this.currentHelper.handleJumpToCenterZoom(e2, t2);
          }
          handleEaseTo(e2, t2) {
            return this.currentHelper.handleEaseTo(e2, t2);
          }
          handleFlyTo(e2, t2) {
            return this.currentHelper.handleFlyTo(e2, t2);
          }
        }
        const Li = (e2, i2) => t.C(e2, null == i2 ? void 0 : i2.filter(((e3) => "source.canvas" !== e3.identifier))), Fi = t.bN();
        class ki extends t.E {
          constructor(e2, i2 = {}) {
            var o2, a2;
            super(), this._rtlPluginLoaded = () => {
              for (const e3 in this.tileManagers) {
                const t2 = this.tileManagers[e3].getSource().type;
                "vector" !== t2 && "geojson" !== t2 || this.tileManagers[e3].reload();
              }
            }, this.map = e2, this.dispatcher = new k(F(), e2._getMapId()), this.dispatcher.registerMessageHandler("GG", ((e3, t2) => this.getGlyphs(e3, t2))), this.dispatcher.registerMessageHandler("GI", ((e3, t2) => this.getImages(e3, t2))), this.dispatcher.registerMessageHandler("GDA", ((e3, t2) => this.getDashes(e3, t2))), this.imageManager = new g(), this.imageManager.setEventedParent(this);
            const r2 = (null === (o2 = e2._container) || void 0 === o2 ? void 0 : o2.lang) || "undefined" != typeof document && (null === (a2 = document.documentElement) || void 0 === a2 ? void 0 : a2.lang) || void 0;
            this.glyphManager = new T(e2._requestManager, i2.localIdeographFontFamily, r2), this.lineAtlas = new S(256, 512), this.crossTileSymbolIndex = new At(), this._setInitialValues(), this._resetUpdates(), this.dispatcher.broadcast("SR", t.bO()), ce().on(se, this._rtlPluginLoaded), this.on("data", ((e3) => {
              if ("source" !== e3.dataType || "metadata" !== e3.sourceDataType) return;
              const t2 = this.tileManagers[e3.sourceId];
              if (!t2) return;
              const i3 = t2.getSource();
              if (null == i3 ? void 0 : i3.vectorLayerIds) for (const e4 in this._layers) {
                const t3 = this._layers[e4];
                t3.source === i3.id && this._validateLayer(t3);
              }
            }));
          }
          _setInitialValues() {
            var e2;
            this._spritesImagesIds = {}, this._layers = {}, this._order = [], this.tileManagers = {}, this.zoomHistory = new t.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 = false, this._changed = false, this._updatedLayers = {}, this._updatedSources = {}, this._changedImages = {}, this._glyphsDidChange = false, this._updatedPaintProps = {}, this._layerOrderChanged = false, this.crossTileSymbolIndex = new ((null === (e2 = this.crossTileSymbolIndex) || void 0 === e2 ? void 0 : e2.constructor) || Object)(), this.pauseablePlacement = void 0, this.placement = void 0, this.z = 0;
          }
          setGlobalStateProperty(e2, i2) {
            var o2, a2, r2;
            this._checkLoaded();
            const s2 = null === i2 ? null !== (r2 = null === (a2 = null === (o2 = this.stylesheet.state) || void 0 === o2 ? void 0 : o2[e2]) || void 0 === a2 ? void 0 : a2.default) && void 0 !== r2 ? r2 : null : i2;
            if (t.bQ(s2, this._globalState[e2])) return this;
            this._globalState[e2] = s2, this._applyGlobalStateChanges([e2]);
          }
          getGlobalState() {
            return this._globalState;
          }
          setGlobalState(e2) {
            this._checkLoaded();
            const i2 = [];
            for (const o2 in e2) !t.bQ(this._globalState[o2], e2[o2].default) && (i2.push(o2), this._globalState[o2] = e2[o2].default);
            this._applyGlobalStateChanges(i2);
          }
          _applyGlobalStateChanges(e2) {
            if (0 === e2.length) return;
            const t2 = /* @__PURE__ */ new Set(), i2 = {};
            for (const o2 of e2) {
              i2[o2] = this._globalState[o2];
              for (const e3 in this._layers) {
                const i3 = this._layers[e3], a2 = i3.getLayoutAffectingGlobalStateRefs(), r2 = i3.getPaintAffectingGlobalStateRefs(), s2 = i3.getVisibilityAffectingGlobalStateRefs();
                if (a2.has(o2) && t2.add(i3.source), r2.has(o2)) for (const { name: e4, value: t3 } of r2.get(o2)) this._updatePaintProperty(i3, e4, t3);
                (null == s2 ? void 0 : s2.has(o2)) && (i3.recalculateVisibility(), this._updateLayer(i3));
              }
            }
            this.dispatcher.broadcast("UGS", i2);
            for (const e3 in this.tileManagers) t2.has(e3) && (this._reloadSource(e3), this._changed = true);
          }
          loadURL(e2) {
            return t._(this, arguments, void 0, (function* (e3, i2 = {}, o2) {
              this.fire(new t.n("dataloading", { dataType: "style" })), i2.validate = "boolean" != typeof i2.validate || i2.validate, this._loadStyleRequest = new AbortController();
              const a2 = this._loadStyleRequest;
              try {
                const r2 = yield this.map._requestManager.transformRequest(e3, "Style");
                t.bR(a2.signal);
                const s2 = yield t.k(r2, a2);
                this._loadStyleRequest === a2 && (this._loadStyleRequest = null), this._load(s2.data, i2, o2);
              } catch (e4) {
                this._loadStyleRequest === a2 && (this._loadStyleRequest = null), e4 && !a2.signal.aborted && this.fire(new t.l(t.d(e4)));
              }
            }));
          }
          loadJSON(e2, i2 = {}, o2) {
            this.fire(new t.n("dataloading", { dataType: "style" })), this._frameRequest = new AbortController(), n.frameAsync(this._frameRequest, this.map._ownerWindow).then((() => {
              this._frameRequest = null, i2.validate = false !== i2.validate, this._load(e2, i2, o2);
            })).catch((() => {
            }));
          }
          loadEmpty() {
            this.fire(new t.n("dataloading", { dataType: "style" })), this._load(Fi, { validate: false });
          }
          _load(e2, i2, o2) {
            var a2, r2;
            let s2 = i2.transformStyle ? i2.transformStyle(o2, e2) : e2;
            if (!i2.validate || !Li(this, t.F(s2))) {
              s2 = Object.assign({}, s2), this._loaded = true, this.stylesheet = s2;
              for (const e3 in s2.sources) this.addSource(e3, s2.sources[e3], { validate: false });
              s2.sprite ? this._loadSprite(s2.sprite) : this.imageManager.setLoaded(true), this.glyphManager.setURL(s2.glyphs), this._createLayers(), this.light = new M(this.stylesheet.light), this._setProjectionInternal((null === (a2 = this.stylesheet.projection) || void 0 === a2 ? void 0 : a2.type) || "mercator"), this.sky = new E(this.stylesheet.sky), this.map.setTerrain(null !== (r2 = this.stylesheet.terrain) && void 0 !== r2 ? r2 : null), this.fire(new t.n("data", { dataType: "style" })), this.fire(new t.n("style.load"));
            }
          }
          _createLayers() {
            var e2, i2, o2;
            const a2 = t.bS(this.stylesheet.layers);
            this.setGlobalState(null !== (e2 = this.stylesheet.state) && void 0 !== e2 ? e2 : null), this.dispatcher.broadcast("SL", a2), this._order = a2.map(((e3) => e3.id)), this._layers = {}, this._serializedLayers = null;
            for (const e3 of a2) {
              const a3 = t.bT(e3, this._globalState);
              if (a3.setEventedParent(this, { layer: { id: e3.id } }), this._layers[e3.id] = a3, t.bU(a3) && this.tileManagers[a3.source]) {
                const t2 = null !== (o2 = null === (i2 = e3.paint) || void 0 === i2 ? void 0 : i2["raster-fade-duration"]) && void 0 !== o2 ? o2 : a3.paint.get("raster-fade-duration");
                this.tileManagers[a3.source].setRasterFadeDuration(t2);
              }
            }
          }
          _loadSprite(e2, i2 = false, o2 = void 0) {
            this.imageManager.setLoaded(false);
            const a2 = new AbortController();
            let r2;
            this._spriteRequest = a2, (function(e3, i3, o3, a3) {
              return t._(this, void 0, void 0, (function* () {
                const r3 = p(e3), s2 = o3 > 1 ? "@2x" : "", l2 = {}, c2 = {};
                for (const { id: e4, url: o4 } of r3) {
                  const r4 = yield i3.transformRequest(m(o4, s2, ".json"), "SpriteJSON");
                  l2[e4] = t.k(r4, a3);
                  const n2 = yield i3.transformRequest(m(o4, s2, ".png"), "SpriteImage");
                  c2[e4] = u.getImage(n2, a3);
                }
                return yield Promise.all([...Object.values(l2), ...Object.values(c2)]), (function(e4, i4) {
                  return t._(this, void 0, void 0, (function* () {
                    const t2 = {};
                    for (const o4 in e4) {
                      t2[o4] = {};
                      const a4 = n.getImageCanvasContext((yield i4[o4]).data), r4 = (yield e4[o4]).data;
                      for (const e5 in r4) {
                        const { width: i5, height: s3, x: n2, y: l3, sdf: c3, pixelRatio: h2, stretchX: u2, stretchY: d2, content: _2, textFitWidth: p2, textFitHeight: m2 } = r4[e5];
                        t2[o4][e5] = { data: null, pixelRatio: h2, sdf: c3, stretchX: u2, stretchY: d2, content: _2, textFitWidth: p2, textFitHeight: m2, spriteData: { width: i5, height: s3, x: n2, y: l3, context: a4 } };
                      }
                    }
                    return t2;
                  }));
                })(l2, c2);
              }));
            })(e2, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then(((e3) => {
              if (this._spriteRequest = null, e3) for (const t2 in e3) {
                this._spritesImagesIds[t2] = [];
                const o3 = this._spritesImagesIds[t2] ? this._spritesImagesIds[t2].filter(((t3) => !(t3 in e3))) : [];
                for (const e4 of o3) this.imageManager.removeImage(e4), this._changedImages[e4] = true;
                for (const o4 in e3[t2]) {
                  const a3 = "default" === t2 ? o4 : `${t2}:${o4}`;
                  this._spritesImagesIds[t2].push(a3), a3 in this.imageManager.images ? this.imageManager.updateImage(a3, e3[t2][o4], false) : this.imageManager.addImage(a3, e3[t2][o4]), i2 && (this._changedImages[a3] = true);
                }
              }
            })).catch(((e3) => {
              this._spriteRequest = null, r2 = e3, a2.signal.aborted || this.fire(new t.l(r2));
            })).finally((() => {
              this.imageManager.setLoaded(true), this._availableImages = this.imageManager.listImages(), i2 && (this._changed = true), this.dispatcher.broadcast("SI", this._availableImages), this.fire(new t.n("data", { dataType: "style" })), o2 && o2(r2);
            }));
          }
          _unloadSprite() {
            for (const e2 of Object.values(this._spritesImagesIds).flat()) this.imageManager.removeImage(e2), this._changedImages[e2] = true;
            this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new t.n("data", { dataType: "style" }));
          }
          _validateLayer(e2) {
            const i2 = this.tileManagers[e2.source];
            if (!i2) return;
            const o2 = e2.sourceLayer;
            if (!o2) return;
            const a2 = i2.getSource();
            ("geojson" === a2.type || a2.vectorLayerIds && !a2.vectorLayerIds.includes(o2)) && this.fire(new t.l(new Error(`Source layer "${o2}" does not exist on source "${a2.id}" as specified by style layer "${e2.id}".`)));
          }
          loaded() {
            if (!this._loaded) return false;
            if (Object.keys(this._updatedSources).length) return false;
            for (const e2 in this.tileManagers) if (!this.tileManagers[e2].loaded()) return false;
            return this.imageManager.isLoaded();
          }
          _serializeByIds(e2, i2 = false) {
            const o2 = this._serializedAllLayers();
            if (!e2 || 0 === e2.length) return Object.values(i2 ? t.bV(o2) : o2);
            const a2 = [];
            for (const r2 of e2) if (o2[r2]) {
              const e3 = i2 ? t.bV(o2[r2]) : o2[r2];
              a2.push(e3);
            }
            return a2;
          }
          _serializedAllLayers() {
            let e2 = this._serializedLayers;
            if (e2) return e2;
            e2 = this._serializedLayers = {};
            const t2 = Object.keys(this._layers);
            for (const i2 of t2) {
              const t3 = this._layers[i2];
              "custom" !== t3.type && (e2[i2] = t3.serialize());
            }
            return e2;
          }
          hasTransitions() {
            var e2, t2, i2;
            if (null === (e2 = this.light) || void 0 === e2 ? void 0 : e2.hasTransition()) return true;
            if (null === (t2 = this.sky) || void 0 === t2 ? void 0 : t2.hasTransition()) return true;
            if (null === (i2 = this.projection) || void 0 === i2 ? void 0 : i2.hasTransition()) return true;
            for (const e3 in this.tileManagers) if (this.tileManagers[e3].hasTransition()) return true;
            for (const e3 in this._layers) if (this._layers[e3].hasTransition()) return true;
            return false;
          }
          _checkLoaded() {
            if (!this._loaded) throw new Error("Style is not done loading.");
          }
          update(e2) {
            if (!this._loaded) return;
            const i2 = this._changed;
            if (i2) {
              const t2 = Object.keys(this._updatedLayers), i3 = Object.keys(this._removedLayers);
              (t2.length || i3.length) && this._updateWorkerLayers(t2, i3);
              for (const e3 in this._updatedSources) {
                const t3 = this._updatedSources[e3];
                if ("reload" === t3) this._reloadSource(e3);
                else {
                  if ("clear" !== t3) throw new Error(`Invalid action ${t3}`);
                  this._clearSource(e3);
                }
              }
              this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();
              for (const t3 in this._updatedPaintProps) this._layers[t3].updateTransitions(e2);
              this.light.updateTransitions(e2), this.sky.updateTransitions(e2), this._resetUpdates();
            }
            const o2 = {};
            for (const e3 in this.tileManagers) {
              const t2 = this.tileManagers[e3];
              o2[e3] = t2.used, t2.used = false;
            }
            for (const t2 of this._order) {
              const i3 = this._layers[t2];
              i3.recalculate(e2, this._availableImages), !i3.isHidden(e2.zoom) && i3.source && (this.tileManagers[i3.source].used = true);
            }
            for (const e3 in o2) {
              const i3 = this.tileManagers[e3];
              !!o2[e3] != !!i3.used && i3.fire(new t.n("data", { sourceDataType: "visibility", dataType: "source", sourceId: e3 }));
            }
            this.light.recalculate(e2), this.sky.recalculate(e2), this.projection.recalculate(e2), this.z = e2.zoom, i2 && this.fire(new t.n("data", { dataType: "style" }));
          }
          _updateTilesForChangedImages() {
            const e2 = Object.keys(this._changedImages);
            if (e2.length) {
              for (const t2 in this.tileManagers) this.tileManagers[t2].reloadTilesForDependencies(["icons", "patterns"], e2);
              this._changedImages = {};
            }
          }
          _updateTilesForChangedGlyphs() {
            if (this._glyphsDidChange) {
              for (const e2 in this.tileManagers) this.tileManagers[e2].reloadTilesForDependencies(["glyphs"], [""]);
              this._glyphsDidChange = false;
            }
          }
          _updateWorkerLayers(e2, t2) {
            this.dispatcher.broadcast("UL", { layers: this._serializeByIds(e2, false), removedIds: t2 });
          }
          _resetUpdates() {
            this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = false;
          }
          setState(e2, i2 = {}) {
            var o2;
            this._checkLoaded();
            const a2 = this.serialize();
            if (e2 = i2.transformStyle ? i2.transformStyle(a2, e2) : e2, (null === (o2 = i2.validate) || void 0 === o2 || o2) && Li(this, t.F(e2))) return false;
            (e2 = t.bV(e2)).layers = t.bS(e2.layers);
            const r2 = t.bW(a2, e2), s2 = this._getOperationsToPerform(r2);
            if (s2.unimplemented.length > 0) throw new Error(`Unimplemented: ${s2.unimplemented.join(", ")}.`);
            if (0 === s2.operations.length) return false;
            for (const e3 of s2.operations) e3();
            return this.stylesheet = e2, this._serializedLayers = null, this.fire(new t.n("style.load", { style: this })), true;
          }
          _getOperationsToPerform(e2) {
            const t2 = [], i2 = [];
            for (const o2 of e2) switch (o2.command) {
              case "setCenter":
              case "setZoom":
              case "setBearing":
              case "setPitch":
              case "setRoll":
                continue;
              case "addLayer":
                t2.push((() => this.addLayer.apply(this, o2.args)));
                break;
              case "removeLayer":
                t2.push((() => this.removeLayer.apply(this, o2.args)));
                break;
              case "setPaintProperty":
                t2.push((() => this.setPaintProperty.apply(this, o2.args)));
                break;
              case "setLayoutProperty":
                t2.push((() => this.setLayoutProperty.apply(this, o2.args)));
                break;
              case "setFilter":
                t2.push((() => this.setFilter.apply(this, o2.args)));
                break;
              case "addSource":
                t2.push((() => this.addSource.apply(this, o2.args)));
                break;
              case "removeSource":
                t2.push((() => this.removeSource.apply(this, o2.args)));
                break;
              case "setLayerZoomRange":
                t2.push((() => this.setLayerZoomRange.apply(this, o2.args)));
                break;
              case "setLight":
                t2.push((() => this.setLight.apply(this, o2.args)));
                break;
              case "setGeoJSONSourceData":
                t2.push((() => this.setGeoJSONSourceData.apply(this, o2.args)));
                break;
              case "setGlyphs":
                t2.push((() => this.setGlyphs.apply(this, o2.args)));
                break;
              case "setSprite":
                t2.push((() => this.setSprite.apply(this, o2.args)));
                break;
              case "setTerrain":
                t2.push((() => this.map.setTerrain.apply(this, o2.args)));
                break;
              case "setSky":
                t2.push((() => this.setSky.apply(this, o2.args)));
                break;
              case "setProjection":
                this.setProjection.apply(this, o2.args);
                break;
              case "setGlobalState":
                t2.push((() => this.setGlobalState.apply(this, o2.args)));
                break;
              case "setTransition":
                t2.push((() => {
                }));
                break;
              default:
                i2.push(o2.command);
            }
            return { operations: t2, unimplemented: i2 };
          }
          addImage(e2, i2) {
            if (this.getImage(e2)) return this.fire(new t.l(new Error(`An image named "${e2}" already exists.`)));
            this.imageManager.addImage(e2, i2), this._afterImageUpdated(e2);
          }
          updateImage(e2, t2) {
            this.imageManager.updateImage(e2, t2);
          }
          getImage(e2) {
            return this.imageManager.getImage(e2);
          }
          removeImage(e2) {
            if (!this.getImage(e2)) return this.fire(new t.l(new Error(`An image named "${e2}" does not exist.`)));
            this.imageManager.removeImage(e2), this._afterImageUpdated(e2);
          }
          _afterImageUpdated(e2) {
            this._availableImages = this.imageManager.listImages(), this._changedImages[e2] = true, this._changed = true, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new t.n("data", { dataType: "style" }));
          }
          listImages() {
            return this._checkLoaded(), this.imageManager.listImages();
          }
          addSource(e2, i2, o2 = {}) {
            var a2;
            if (this._checkLoaded(), void 0 !== this.tileManagers[e2]) throw new Error(`Source "${e2}" already exists.`);
            if (!i2.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i2).join(", ")}.`);
            if (["vector", "raster", "geojson", "video", "image"].includes(i2.type) && this._validate(t.F.source, `sources.${e2}`, i2, null, o2)) return;
            (null === (a2 = this.map) || void 0 === a2 ? void 0 : a2._collectResourceTiming) && (i2.collectResourceTiming = true);
            const r2 = this.tileManagers[e2] = new Fe(e2, i2, this.dispatcher);
            r2.style = this, r2.setEventedParent(this, (() => ({ isSourceLoaded: r2.loaded(), source: r2.serialize(), sourceId: e2 }))), r2.onAdd(this.map), this._changed = true;
          }
          removeSource(e2) {
            if (this._checkLoaded(), void 0 === this.tileManagers[e2]) throw new Error(`There is no source with this ID=${e2}`);
            for (const i3 in this._layers) if (this._layers[i3].source === e2) return this.fire(new t.l(new Error(`Source "${e2}" cannot be removed while layer "${i3}" is using it.`)));
            const i2 = this.tileManagers[e2];
            delete this.tileManagers[e2], delete this._updatedSources[e2], i2.fire(new t.n("data", { sourceDataType: "metadata", dataType: "source", sourceId: e2 })), i2.setEventedParent(null), i2.onRemove(this.map), this._changed = true;
          }
          setGeoJSONSourceData(e2, t2) {
            if (this._checkLoaded(), void 0 === this.tileManagers[e2]) throw new Error(`There is no source with this ID=${e2}`);
            const i2 = this.tileManagers[e2].getSource();
            if ("geojson" !== i2.type) throw new Error(`geojsonSource.type is ${i2.type}, which is !== 'geojson`);
            i2.setData(t2), this._changed = true;
          }
          getSource(e2) {
            var t2;
            return null === (t2 = this.tileManagers[e2]) || void 0 === t2 ? void 0 : t2.getSource();
          }
          addLayer(e2, i2, o2 = {}) {
            this._checkLoaded();
            const a2 = e2.id;
            if (this.getLayer(a2)) return void this.fire(new t.l(new Error(`Layer "${a2}" already exists on this map.`)));
            let r2;
            if ("custom" === e2.type) {
              if (Li(this, t.bX(e2))) return;
              r2 = t.bT(e2, this._globalState);
            } else {
              if ("source" in e2 && "object" == typeof e2.source && (this.addSource(a2, e2.source), e2 = t.bV(e2), e2 = t.e(e2, { source: a2 })), this._validate(t.F.layer, `layers.${a2}`, e2, { arrayIndex: -1 }, o2)) return;
              r2 = t.bT(e2, this._globalState), this._validateLayer(r2), r2.setEventedParent(this, { layer: { id: a2 } });
            }
            const s2 = i2 ? this._order.indexOf(i2) : this._order.length;
            if (i2 && -1 === s2) this.fire(new t.l(new Error(`Cannot add layer "${a2}" before non-existing layer "${i2}".`)));
            else {
              if (this._order.splice(s2, 0, a2), this._layerOrderChanged = true, this._layers[a2] = r2, this._removedLayers[a2] && r2.source && "custom" !== r2.type) {
                const e3 = this._removedLayers[a2];
                delete this._removedLayers[a2], e3.type !== r2.type ? this._updatedSources[r2.source] = "clear" : (this._updatedSources[r2.source] = "reload", this.tileManagers[r2.source].pause());
              }
              this._updateLayer(r2), r2.onAdd && r2.onAdd(this.map);
            }
          }
          moveLayer(e2, i2) {
            if (this._checkLoaded(), this._changed = true, !this._layers[e2]) return void this.fire(new t.l(new Error(`The layer '${e2}' does not exist in the map's style and cannot be moved.`)));
            if (e2 === i2) return;
            const o2 = this._order.indexOf(e2);
            this._order.splice(o2, 1);
            const a2 = i2 ? this._order.indexOf(i2) : this._order.length;
            i2 && -1 === a2 ? this.fire(new t.l(new Error(`Cannot move layer "${e2}" before non-existing layer "${i2}".`))) : (this._order.splice(a2, 0, e2), this._layerOrderChanged = true);
          }
          removeLayer(e2) {
            this._checkLoaded();
            const i2 = this._layers[e2];
            if (!i2) return void this.fire(new t.l(new Error(`Cannot remove non-existing layer "${e2}".`)));
            i2.setEventedParent(null);
            const o2 = this._order.indexOf(e2);
            this._order.splice(o2, 1), this._layerOrderChanged = true, this._changed = true, this._removedLayers[e2] = i2, delete this._layers[e2], this._serializedLayers && delete this._serializedLayers[e2], delete this._updatedLayers[e2], delete this._updatedPaintProps[e2], i2.onRemove && i2.onRemove(this.map);
          }
          getLayer(e2) {
            return this._layers[e2];
          }
          getLayersOrder() {
            return [...this._order];
          }
          hasLayer(e2) {
            return e2 in this._layers;
          }
          setLayerZoomRange(e2, i2, o2) {
            this._checkLoaded();
            const a2 = this.getLayer(e2);
            a2 ? a2.minzoom === i2 && a2.maxzoom === o2 || (null != i2 && (a2.minzoom = i2), null != o2 && (a2.maxzoom = o2), this._updateLayer(a2)) : this.fire(new t.l(new Error(`Cannot set the zoom range of non-existing layer "${e2}".`)));
          }
          setFilter(e2, i2, o2 = {}) {
            this._checkLoaded();
            const a2 = this.getLayer(e2);
            if (a2) {
              if (!t.bQ(a2.filter, i2)) return null == i2 ? (a2.setFilter(void 0), void this._updateLayer(a2)) : void (this._validate(t.F.filter, `layers.${a2.id}.filter`, i2, null, o2) || (a2.setFilter(t.bV(i2)), this._updateLayer(a2)));
            } else this.fire(new t.l(new Error(`Cannot filter non-existing layer "${e2}".`)));
          }
          getFilter(e2) {
            return t.bV(this.getLayer(e2).filter);
          }
          setLayoutProperty(e2, i2, o2, a2 = {}) {
            this._checkLoaded();
            const r2 = this.getLayer(e2);
            r2 ? t.bQ(r2.getLayoutProperty(i2), o2) || (r2.setLayoutProperty(i2, o2, a2), this._updateLayer(r2)) : this.fire(new t.l(new Error(`Cannot style non-existing layer "${e2}".`)));
          }
          getLayoutProperty(e2, i2) {
            const o2 = this.getLayer(e2);
            if (o2) return o2.getLayoutProperty(i2);
            this.fire(new t.l(new Error(`Cannot get style of non-existing layer "${e2}".`)));
          }
          setPaintProperty(e2, i2, o2, a2 = {}) {
            this._checkLoaded();
            const r2 = this.getLayer(e2);
            r2 ? t.bQ(r2.getPaintProperty(i2), o2) || this._updatePaintProperty(r2, i2, o2, a2) : this.fire(new t.l(new Error(`Cannot style non-existing layer "${e2}".`)));
          }
          _updatePaintProperty(e2, i2, o2, a2 = {}) {
            e2.setPaintProperty(i2, o2, a2) && this._updateLayer(e2), t.bU(e2) && "raster-fade-duration" === i2 && this.tileManagers[e2.source].setRasterFadeDuration(o2), this._changed = true, this._updatedPaintProps[e2.id] = true, this._serializedLayers = null;
          }
          getPaintProperty(e2, t2) {
            return this.getLayer(e2).getPaintProperty(t2);
          }
          setFeatureState(e2, i2) {
            this._checkLoaded();
            const o2 = e2.source, a2 = e2.sourceLayer, r2 = this.tileManagers[o2];
            if (void 0 === r2) return void this.fire(new t.l(new Error(`The source '${o2}' does not exist in the map's style.`)));
            const s2 = r2.getSource().type;
            "geojson" === s2 && a2 ? this.fire(new t.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : "vector" !== s2 || a2 ? (void 0 === e2.id && this.fire(new t.l(new Error("The feature id parameter must be provided."))), r2.setFeatureState(a2, e2.id, i2)) : this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")));
          }
          removeFeatureState(e2, i2) {
            this._checkLoaded();
            const o2 = e2.source, a2 = this.tileManagers[o2];
            if (void 0 === a2) return void this.fire(new t.l(new Error(`The source '${o2}' does not exist in the map's style.`)));
            const r2 = a2.getSource().type, s2 = "vector" === r2 ? e2.sourceLayer : void 0;
            "vector" !== r2 || s2 ? i2 && "string" != typeof e2.id && "number" != typeof e2.id ? this.fire(new t.l(new Error("A feature id is required to remove its specific state property."))) : a2.removeFeatureState(s2, e2.id, i2) : this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")));
          }
          getFeatureState(e2) {
            this._checkLoaded();
            const i2 = e2.source, o2 = e2.sourceLayer, a2 = this.tileManagers[i2];
            if (void 0 !== a2) return "vector" !== a2.getSource().type || o2 ? (void 0 === e2.id && this.fire(new t.l(new Error("The feature id parameter must be provided."))), a2.getFeatureState(o2, e2.id)) : void this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")));
            this.fire(new t.l(new Error(`The source '${i2}' does not exist in the map's style.`)));
          }
          getTransition() {
            var e2;
            return t.e({ duration: 300, delay: 0 }, null === (e2 = this.stylesheet) || void 0 === e2 ? void 0 : e2.transition);
          }
          serialize() {
            if (!this._loaded) return;
            const e2 = t.bY(this.tileManagers, ((e3) => e3.serialize())), i2 = this._serializeByIds(this._order, true), o2 = this.map.getTerrain() || void 0, a2 = this.stylesheet;
            return t.bZ({ version: a2.version, name: a2.name, metadata: a2.metadata, light: a2.light, sky: a2.sky, center: a2.center, zoom: a2.zoom, bearing: a2.bearing, pitch: a2.pitch, sprite: a2.sprite, glyphs: a2.glyphs, transition: a2.transition, projection: a2.projection, sources: e2, layers: i2, terrain: o2 }, ((e3) => void 0 !== e3));
          }
          _updateLayer(e2) {
            this._updatedLayers[e2.id] = true, e2.source && !this._updatedSources[e2.source] && "raster" !== this.tileManagers[e2.source].getSource().type && (this._updatedSources[e2.source] = "reload", this.tileManagers[e2.source].pause()), this._serializedLayers = null, this._changed = true;
          }
          _flattenAndSortRenderedFeatures(e2) {
            const t2 = (e3) => "fill-extrusion" === this._layers[e3].type, i2 = {}, o2 = [];
            for (let a3 = this._order.length - 1; a3 >= 0; a3--) {
              const r2 = this._order[a3];
              if (t2(r2)) {
                i2[r2] = a3;
                for (const t3 of e2) {
                  const e3 = t3[r2];
                  if (e3) for (const t4 of e3) o2.push(t4);
                }
              }
            }
            o2.sort(((e3, t3) => t3.intersectionZ - e3.intersectionZ));
            const a2 = [];
            for (let r2 = this._order.length - 1; r2 >= 0; r2--) {
              const s2 = this._order[r2];
              if (t2(s2)) for (let e3 = o2.length - 1; e3 >= 0; e3--) {
                const t3 = o2[e3].feature;
                if (i2[t3.layer.id] < r2) break;
                a2.push(t3), o2.pop();
              }
              else for (const t3 of e2) {
                const e3 = t3[s2];
                if (e3) for (const t4 of e3) a2.push(t4.feature);
              }
            }
            return a2;
          }
          queryRenderedFeatures(e2, i2, o2) {
            (null == i2 ? void 0 : i2.filter) && this._validate(t.F.filter, "queryRenderedFeatures.filter", i2.filter, null, i2);
            const a2 = {};
            if (null == i2 ? void 0 : i2.layers) {
              if (!(Array.isArray(i2.layers) || i2.layers instanceof Set)) return this.fire(new t.l(new Error("parameters.layers must be an Array or a Set of strings"))), [];
              for (const e3 of i2.layers) {
                const i3 = this._layers[e3];
                if (!i3) return this.fire(new t.l(new Error(`The layer '${e3}' does not exist in the map's style and cannot be queried for features.`))), [];
                a2[i3.source] = true;
              }
            }
            const r2 = [];
            i2.availableImages = this._availableImages;
            const s2 = this._serializedAllLayers(), n2 = i2.layers instanceof Set ? i2.layers : Array.isArray(i2.layers) ? new Set(i2.layers) : null, l2 = Object.assign(Object.assign({}, i2), { layers: n2, globalState: this._globalState });
            for (const t2 in this.tileManagers) i2.layers && !a2[t2] || r2.push(j(this.tileManagers[t2], this._layers, s2, e2, l2, o2, this.map.terrain ? (e3, t3, i3) => this.map.terrain.getElevation(e3, t3, i3) : void 0));
            return this.placement && r2.push((function(e3, t2, i3, o3, a3, r3, s3) {
              const n3 = {}, l3 = r3.queryRenderedSymbols(o3), c2 = [];
              for (const e4 of Object.keys(l3).map(Number)) c2.push(s3[e4]);
              c2.sort(N);
              for (const i4 of c2) {
                const o4 = i4.featureIndex.lookupSymbolFeatures(l3[i4.bucketInstanceId], t2, i4.bucketIndex, i4.sourceLayerIndex, { filterSpec: a3.filter, globalState: a3.globalState }, a3.layers, a3.availableImages, e3);
                for (const e4 in o4) {
                  n3[e4] || (n3[e4] = []);
                  const t3 = o4[e4];
                  t3.sort(((e5, t4) => {
                    const o5 = i4.featureSortOrder;
                    if (o5) {
                      const i5 = o5.indexOf(e5.featureIndex);
                      return o5.indexOf(t4.featureIndex) - i5;
                    }
                    return t4.featureIndex - e5.featureIndex;
                  }));
                  for (const i5 of t3) n3[e4].push(i5);
                }
              }
              return (function(e4, t3, i4) {
                for (const o4 in e4) for (const a4 of e4[o4]) Z(a4, i4[t3[o4].source]);
                return e4;
              })(n3, e3, i3);
            })(this._layers, s2, this.tileManagers, e2, l2, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(r2);
          }
          querySourceFeatures(e2, i2) {
            (null == i2 ? void 0 : i2.filter) && this._validate(t.F.filter, "querySourceFeatures.filter", i2.filter, null, i2);
            const o2 = this.tileManagers[e2];
            return o2 ? (function(e3, t2) {
              const i3 = e3.getRenderableIds().map(((t3) => e3.getTileByID(t3))), o3 = [], a2 = {};
              for (const e4 of i3) {
                const i4 = e4.tileID.canonical.key;
                a2[i4] || (a2[i4] = true, e4.querySourceFeatures(o3, t2));
              }
              return o3;
            })(o2, i2 ? Object.assign(Object.assign({}, i2), { globalState: this._globalState }) : { globalState: this._globalState }) : [];
          }
          getLight() {
            return this.light.getLight();
          }
          setLight(e2, i2 = {}) {
            this._checkLoaded();
            const o2 = this.light.getLight();
            let a2 = false;
            for (const i3 in e2) if (!t.bQ(e2[i3], o2[i3])) {
              a2 = true;
              break;
            }
            if (!a2) return;
            const r2 = { now: c(), transition: t.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
            this.light.setLight(e2, i2), this.light.updateTransitions(r2);
          }
          getProjection() {
            var e2;
            return null === (e2 = this.stylesheet) || void 0 === e2 ? void 0 : e2.projection;
          }
          setProjection(e2) {
            this._checkLoaded();
            const t2 = null != e2 ? e2 : { type: "mercator" };
            if (this.stylesheet.projection = e2, this.projection) {
              if (this.projection.name === t2.type) return;
              this.projection.destroy(), delete this.projection;
            }
            this._setProjectionInternal(t2.type);
          }
          getSky() {
            var e2;
            return null === (e2 = this.stylesheet) || void 0 === e2 ? void 0 : e2.sky;
          }
          setSky(e2, i2 = {}) {
            this._checkLoaded();
            const o2 = this.getSky();
            let a2 = false;
            if (!e2 && !o2) return;
            if (e2 && !o2) a2 = true;
            else if (!e2 && o2) a2 = true;
            else for (const i3 in e2) if (!t.bQ(e2[i3], o2[i3])) {
              a2 = true;
              break;
            }
            if (!a2) return;
            const r2 = { now: c(), transition: t.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
            this.stylesheet.sky = e2, this.sky.setSky(e2, i2), this.sky.updateTransitions(r2);
          }
          _setProjectionInternal(e2) {
            const i2 = (function(e3, i3) {
              const o2 = { constrainOverride: i3 };
              if (Array.isArray(e3)) {
                const t2 = new _i({ type: e3 });
                return { projection: t2, transform: new Ri(o2), cameraHelper: new Ai(t2) };
              }
              switch (e3) {
                case "mercator":
                  return { projection: new Zt(), transform: new Xt(o2), cameraHelper: new Jt() };
                case "globe": {
                  const e4 = new _i({ type: ["interpolate", ["linear"], ["zoom"], 11, "vertical-perspective", 12, "mercator"] });
                  return { projection: e4, transform: new Ri(o2), cameraHelper: new Ai(e4) };
                }
                case "vertical-perspective":
                  return { projection: new ui(), transform: new zi(o2), cameraHelper: new Di() };
                default:
                  return t.w(`Unknown projection name: ${e3}. Falling back to mercator projection.`), { projection: new Zt(), transform: new Xt(o2), cameraHelper: new Jt() };
              }
            })(e2, this.map.transformConstrain);
            this.projection = i2.projection, this.map.migrateProjection(i2.transform, i2.cameraHelper);
            for (const e3 in this.tileManagers) this.tileManagers[e3].reload();
          }
          _validate(e2, i2, o2, a2, r2 = {}) {
            return false !== (null == r2 ? void 0 : r2.validate) && Li(this, e2.call(t.F, t.e({ key: i2, style: this.serialize(), value: o2, styleSpec: t.x }, a2)));
          }
          _remove(e2 = true) {
            this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._loadStyleRequest && (this._loadStyleRequest.abort(), this._loadStyleRequest = null), this._spriteRequest && (this._spriteRequest.abort(), this._spriteRequest = null), ce().off(se, this._rtlPluginLoaded);
            for (const e3 in this._layers) this._layers[e3].setEventedParent(null);
            for (const e3 in this.tileManagers) {
              const t2 = this.tileManagers[e3];
              t2.setEventedParent(null), t2.onRemove(this.map);
            }
            this.imageManager.setEventedParent(null), this.setEventedParent(null), e2 && this.dispatcher.broadcast("RM", void 0), this.dispatcher.remove(e2);
          }
          _clearSource(e2) {
            this.tileManagers[e2].clearTiles();
          }
          _reloadSource(e2) {
            this.tileManagers[e2].resume(), this.tileManagers[e2].reload();
          }
          _updateSources(e2) {
            for (const t2 in this.tileManagers) this.tileManagers[t2].update(e2, this.map.terrain);
          }
          _generateCollisionBoxes() {
            for (const e2 in this.tileManagers) this._reloadSource(e2);
          }
          _updatePlacement(e2, t2, i2, o2, a2 = false) {
            let r2 = false, s2 = false;
            const n2 = {};
            for (const t3 of this._order) {
              const i3 = this._layers[t3];
              if ("symbol" !== i3.type) continue;
              if (!n2[i3.source]) {
                const e3 = this.tileManagers[i3.source];
                n2[i3.source] = e3.getRenderableIds(true).map(((t4) => e3.getTileByID(t4))).sort(((e4, t4) => t4.tileID.overscaledZ - e4.tileID.overscaledZ || (e4.tileID.isLessThan(t4.tileID) ? -1 : 1)));
              }
              const o3 = this.crossTileSymbolIndex.addLayer(i3, n2[i3.source], e2.center.lng);
              r2 || (r2 = o3);
            }
            if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), a2 || (a2 = this._layerOrderChanged || 0 === i2), (a2 || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(c(), e2.zoom)) && (this.pauseablePlacement = new Et(e2, this.map.terrain, this._order, a2, t2, i2, o2, this.placement), this._layerOrderChanged = false), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, n2), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(c()), s2 = true), r2 && this.pauseablePlacement.placement.setStale()), s2 || r2) for (const e3 of this._order) {
              const t3 = this._layers[e3];
              "symbol" === t3.type && this.placement.updateLayerOpacities(t3, n2[t3.source]);
            }
            return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(c());
          }
          _releaseSymbolFadeTiles() {
            for (const e2 in this.tileManagers) this.tileManagers[e2].releaseSymbolFadeTiles();
          }
          getImages(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              const e3 = yield this.imageManager.getImages(i2.icons);
              this._updateTilesForChangedImages();
              const t2 = this.tileManagers[i2.source];
              return t2 && t2.setDependencies(i2.tileID.key, i2.type, i2.icons), e3;
            }));
          }
          getGlyphs(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              const e3 = yield this.glyphManager.getGlyphs(i2.stacks), t2 = this.tileManagers[i2.source];
              return t2 && t2.setDependencies(i2.tileID.key, i2.type, [""]), e3;
            }));
          }
          getGlyphsUrl() {
            return this.stylesheet.glyphs || null;
          }
          setGlyphs(e2, i2 = {}) {
            this._checkLoaded(), e2 && this._validate(t.F.glyphs, "glyphs", e2, null, i2) || (this._glyphsDidChange = true, this.stylesheet.glyphs = e2, this.glyphManager.entries = {}, this.glyphManager.setURL(e2));
          }
          getDashes(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              const e3 = {};
              for (const [t2, o2] of Object.entries(i2.dashes)) e3[t2] = this.lineAtlas.getDash(o2.dasharray, o2.round);
              return e3;
            }));
          }
          addSprite(e2, i2, o2 = {}, a2) {
            this._checkLoaded();
            const r2 = [{ id: e2, url: i2 }], s2 = [...p(this.stylesheet.sprite), ...r2];
            this._validate(t.F.sprite, "sprite", s2, null, o2) || (this.stylesheet.sprite = s2, this._loadSprite(r2, true, a2));
          }
          removeSprite(e2) {
            this._checkLoaded();
            const i2 = p(this.stylesheet.sprite);
            if (i2.find(((t2) => t2.id === e2))) {
              if (this._spritesImagesIds[e2]) for (const t2 of this._spritesImagesIds[e2]) this.imageManager.removeImage(t2), this._changedImages[t2] = true;
              i2.splice(i2.findIndex(((t2) => t2.id === e2)), 1), this.stylesheet.sprite = i2.length > 0 ? i2 : void 0, delete this._spritesImagesIds[e2], this._availableImages = this.imageManager.listImages(), this._changed = true, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new t.n("data", { dataType: "style" }));
            } else this.fire(new t.l(new Error(`Sprite "${e2}" doesn't exists on this map.`)));
          }
          getSprite() {
            return p(this.stylesheet.sprite);
          }
          setSprite(e2, i2 = {}, o2) {
            this._checkLoaded(), e2 && this._validate(t.F.sprite, "sprite", e2, null, i2) || (this.stylesheet.sprite = e2, e2 ? this._loadSprite(e2, true, o2) : (this._unloadSprite(), o2 && o2(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 e2 in this.tileManagers) {
              const t2 = this.tileManagers[e2];
              t2.setEventedParent(null), t2.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 e2 in this._layers) {
              const t2 = this._layers[e2];
              t2.setEventedParent(null), t2.onRemove && t2.onRemove(this.map);
            }
            this._setInitialValues(), this.setEventedParent(null), this.dispatcher.unregisterMessageHandler("GG"), this.dispatcher.unregisterMessageHandler("GI"), this.dispatcher.unregisterMessageHandler("GDA"), this.dispatcher.remove(true), this._listeners = {}, this._oneTimeListeners = {};
          }
        }
        var Bi = t.aS([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]);
        class Oi {
          constructor() {
            this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;
          }
          bind(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
            this.context = e2;
            let c2 = this.boundPaintVertexBuffers.length !== o2.length;
            for (let e3 = 0; !c2 && e3 < o2.length; e3++) this.boundPaintVertexBuffers[e3] !== o2[e3] && (c2 = true);
            !this.vao || this.boundProgram !== t2 || this.boundLayoutVertexBuffer !== i2 || c2 || this.boundIndexBuffer !== a2 || this.boundVertexOffset !== r2 || this.boundDynamicVertexBuffer !== s2 || this.boundDynamicVertexBuffer2 !== n2 || this.boundDynamicVertexBuffer3 !== l2 ? this.freshBind(t2, i2, o2, a2, r2, s2, n2, l2) : (e2.bindVertexArray.set(this.vao), s2 && s2.bind(), (null == a2 ? void 0 : a2.dynamicDraw) && a2.bind(), n2 && n2.bind(), l2 && l2.bind());
          }
          freshBind(e2, t2, i2, o2, a2, r2, s2, n2) {
            const l2 = e2.numAttributes, c2 = this.context, h2 = c2.gl;
            this.vao && this.destroy(), this.vao = c2.createVertexArray(), c2.bindVertexArray.set(this.vao), this.boundProgram = e2, this.boundLayoutVertexBuffer = t2, this.boundPaintVertexBuffers = i2, this.boundIndexBuffer = o2, this.boundVertexOffset = a2, this.boundDynamicVertexBuffer = r2, this.boundDynamicVertexBuffer2 = s2, this.boundDynamicVertexBuffer3 = n2, t2.enableAttributes(h2, e2);
            for (const t3 of i2) t3.enableAttributes(h2, e2);
            r2 && r2.enableAttributes(h2, e2), s2 && s2.enableAttributes(h2, e2), n2 && n2.enableAttributes(h2, e2), t2.bind(), t2.setVertexAttribPointers(h2, e2, a2);
            for (const t3 of i2) t3.bind(), t3.setVertexAttribPointers(h2, e2, a2);
            r2 && (r2.bind(), r2.setVertexAttribPointers(h2, e2, a2)), o2 && o2.bind(), s2 && (s2.bind(), s2.setVertexAttribPointers(h2, e2, a2)), n2 && (n2.bind(), n2.setVertexAttribPointers(h2, e2, a2)), c2.currentNumAttributes = l2;
          }
          destroy() {
            this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);
          }
        }
        const ji = (e2, i2, o2, a2, r2) => ({ u_texture: 0, u_ele_delta: e2, u_fog_matrix: i2, u_fog_color: o2 ? o2.properties.get("fog-color") : t.bo.white, u_fog_ground_blend: o2 ? o2.properties.get("fog-ground-blend") : 1, u_fog_ground_blend_opacity: r2 ? 0 : o2 ? o2.calculateFogBlendOpacity(a2) : 0, u_horizon_color: o2 ? o2.properties.get("horizon-color") : t.bo.white, u_horizon_fog_blend: o2 ? o2.properties.get("horizon-fog-blend") : 1, u_is_globe_mode: r2 ? 1 : 0 }), Ni = { 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 Zi(e2) {
          const t2 = [];
          for (const i2 of e2) {
            if (null === i2) continue;
            const e3 = i2.split(" ");
            t2.push(e3.pop());
          }
          return t2;
        }
        class Ui {
          constructor(e2, i2, o2, a2, r2, s2, n2, l2, c2 = []) {
            const h2 = e2.gl;
            this.program = h2.createProgram();
            const u2 = Zi(i2.staticAttributes), d2 = o2 ? o2.getBinderAttributes() : [], _2 = u2.concat(d2), p2 = Ft.prelude.staticUniforms ? Zi(Ft.prelude.staticUniforms) : [], m2 = n2.staticUniforms ? Zi(n2.staticUniforms) : [], f2 = i2.staticUniforms ? Zi(i2.staticUniforms) : [], g2 = o2 ? o2.getBinderUniforms() : [], v2 = p2.concat(m2).concat(f2).concat(g2), x2 = [];
            for (const e3 of v2) x2.includes(e3) || x2.push(e3);
            const b2 = o2 ? o2.defines() : [];
            si(h2) && b2.unshift("#version 300 es"), r2 && b2.push("#define OVERDRAW_INSPECTOR;"), s2 && b2.push("#define TERRAIN3D;"), l2 && b2.push(l2), c2 && b2.push(...c2);
            let y2 = b2.concat(Ft.prelude.fragmentSource, n2.fragmentSource, i2.fragmentSource).join("\n"), w2 = b2.concat(Ft.prelude.vertexSource, n2.vertexSource, i2.vertexSource).join("\n");
            si(h2) || (y2 = (function(e3) {
              return e3.replace(/\bin\s/g, "varying ").replace("out highp vec4 fragColor;", "").replace(/fragColor/g, "gl_FragColor").replace(/texture\(/g, "texture2D(");
            })(y2), w2 = (function(e3) {
              return e3.replace(/\bin\s/g, "attribute ").replace(/\bout\s/g, "varying ").replace(/texture\(/g, "texture2D(");
            })(w2));
            const T2 = h2.createShader(h2.FRAGMENT_SHADER);
            if (h2.isContextLost()) return void (this.failedToCreate = true);
            if (h2.shaderSource(T2, y2), h2.compileShader(T2), !h2.getShaderParameter(T2, h2.COMPILE_STATUS)) throw new Error(`Could not compile fragment shader: ${h2.getShaderInfoLog(T2)}`);
            h2.attachShader(this.program, T2);
            const P2 = h2.createShader(h2.VERTEX_SHADER);
            if (h2.isContextLost()) return void (this.failedToCreate = true);
            if (h2.shaderSource(P2, w2), h2.compileShader(P2), !h2.getShaderParameter(P2, h2.COMPILE_STATUS)) throw new Error(`Could not compile vertex shader: ${h2.getShaderInfoLog(P2)}`);
            h2.attachShader(this.program, P2), this.attributes = {};
            const C2 = {};
            this.numAttributes = _2.length;
            for (let e3 = 0; e3 < this.numAttributes; e3++) _2[e3] && (h2.bindAttribLocation(this.program, e3, _2[e3]), this.attributes[_2[e3]] = e3);
            if (h2.linkProgram(this.program), !h2.getProgramParameter(this.program, h2.LINK_STATUS)) throw new Error(`Program failed to link: ${h2.getProgramInfoLog(this.program)}`);
            h2.deleteShader(P2), h2.deleteShader(T2);
            for (const e3 of x2) if (e3 && !C2[e3]) {
              const t2 = h2.getUniformLocation(this.program, e3);
              t2 && (C2[e3] = t2);
            }
            this.fixedUniforms = a2(e2, C2), this.terrainUniforms = ((e3, i3) => ({ u_depth: new t.b_(e3, i3.u_depth), u_terrain: new t.b_(e3, i3.u_terrain), u_terrain_dim: new t.bp(e3, i3.u_terrain_dim), u_terrain_matrix: new t.c0(e3, i3.u_terrain_matrix), u_terrain_unpack: new t.c1(e3, i3.u_terrain_unpack), u_terrain_exaggeration: new t.bp(e3, i3.u_terrain_exaggeration) }))(e2, C2), this.projectionUniforms = ((e3, i3) => ({ u_projection_matrix: new t.c0(e3, i3.u_projection_matrix), u_projection_tile_mercator_coords: new t.c1(e3, i3.u_projection_tile_mercator_coords), u_projection_clipping_plane: new t.c1(e3, i3.u_projection_clipping_plane), u_projection_transition: new t.bp(e3, i3.u_projection_transition), u_projection_fallback_matrix: new t.c0(e3, i3.u_projection_fallback_matrix) }))(e2, C2), this.binderUniforms = o2 ? o2.getUniforms(e2, C2) : [];
          }
          draw(e2, t2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2, p2, m2, f2, g2, v2) {
            var x2;
            const b2 = e2.gl;
            if (this.failedToCreate) return;
            if (e2.program.set(this.program), e2.setDepthMode(i2), e2.setStencilMode(o2), e2.setColorMode(a2), e2.setCullFace(r2), n2) {
              e2.activeTexture.set(b2.TEXTURE2), b2.bindTexture(b2.TEXTURE_2D, n2.depthTexture), e2.activeTexture.set(b2.TEXTURE3), b2.bindTexture(b2.TEXTURE_2D, n2.texture);
              for (const e3 in this.terrainUniforms) this.terrainUniforms[e3].set(n2[e3]);
            }
            if (l2) for (const e3 in l2) this.projectionUniforms[Ni[e3]].set(l2[e3]);
            if (s2) for (const e3 in this.fixedUniforms) this.fixedUniforms[e3].set(s2[e3]);
            m2 && m2.setUniforms(e2, this.binderUniforms, _2, { zoom: p2 });
            let y2 = 0;
            switch (t2) {
              case b2.LINES:
                y2 = 2;
                break;
              case b2.TRIANGLES:
                y2 = 3;
                break;
              case b2.LINE_STRIP:
                y2 = 1;
            }
            for (const i3 of d2.get()) i3.vaos || (i3.vaos = {}), (x2 = i3.vaos)[c2] || (x2[c2] = new Oi()), i3.vaos[c2].bind(e2, this, h2, m2 ? m2.getPaintVertexBuffers() : [], u2, i3.vertexOffset, f2, g2, v2), b2.drawElements(t2, i3.primitiveLength * y2, b2.UNSIGNED_SHORT, i3.primitiveOffset * y2 * 2);
          }
        }
        function Gi(e2, i2, o2) {
          const a2 = 1 / t.aK(o2, 1, i2.transform.tileZoom), r2 = Math.pow(2, o2.tileID.overscaledZ), s2 = o2.tileSize * Math.pow(2, i2.transform.tileZoom) / r2, n2 = s2 * (o2.tileID.canonical.x + o2.tileID.wrap * r2), l2 = s2 * o2.tileID.canonical.y;
          return { u_image: 0, u_texsize: o2.imageAtlasTexture.size, u_scale: [a2, e2.fromScale, e2.toScale], u_fade: e2.t, u_pixel_coord_upper: [n2 >> 16, l2 >> 16], u_pixel_coord_lower: [65535 & n2, 65535 & l2] };
        }
        const Vi = (e2, i2, o2, a2) => {
          const r2 = e2.style.light, s2 = r2.properties.get("position"), n2 = [s2.x, s2.y, s2.z], l2 = t.c4();
          "viewport" === r2.properties.get("anchor") && t.c5(l2, e2.transform.bearingInRadians), t.c6(n2, n2, l2);
          const c2 = e2.transform.transformLightDirection(n2), h2 = r2.properties.get("color");
          return { u_lightpos: n2, u_lightpos_globe: c2, u_lightintensity: r2.properties.get("intensity"), u_lightcolor: [h2.r, h2.g, h2.b], u_vertical_gradient: +i2, u_opacity: o2, u_fill_translate: a2 };
        }, Wi = (e2, i2, o2, a2, r2, s2, n2) => t.e(Vi(e2, i2, o2, a2), Gi(s2, e2, n2), { u_height_factor: -Math.pow(2, r2.overscaledZ) / n2.tileSize / 8 }), qi = (e2, i2, o2, a2) => t.e(Gi(i2, e2, o2), { u_fill_translate: a2 }), $i = (e2, t2) => ({ u_world: e2, u_fill_translate: t2 }), Hi = (e2, i2, o2, a2, r2) => t.e(qi(e2, i2, o2, r2), { u_world: a2 }), Xi = (e2, i2, o2, a2, r2) => {
          const s2 = e2.transform;
          let n2, l2, c2 = 0;
          if ("map" === o2.paint.get("circle-pitch-alignment")) {
            const e3 = t.aK(i2, 1, s2.zoom);
            n2 = true, l2 = [e3, e3], c2 = e3 / (t.a6 * Math.pow(2, i2.tileID.overscaledZ)) * 2 * Math.PI * r2;
          } else n2 = false, l2 = s2.pixelsToGLUnits;
          return { u_camera_to_center_distance: s2.cameraToCenterDistance, u_scale_with_map: +("map" === o2.paint.get("circle-pitch-scale")), u_pitch_with_map: +n2, u_device_pixel_ratio: e2.pixelRatio, u_extrude_scale: l2, u_globe_extrude_scale: c2, u_translate: a2 };
        }, Ki = (e2) => ({ u_pixel_extrude_scale: [1 / e2.width, 1 / e2.height] }), Yi = (e2) => ({ u_viewport_size: [e2.width, e2.height] }), Qi = (e2, t2 = 1) => ({ u_color: e2, u_overlay: 0, u_overlay_scale: t2 }), Ji = (e2, i2, o2, a2) => {
          const r2 = t.aK(e2, 1, i2) / (t.a6 * Math.pow(2, e2.tileID.overscaledZ)) * 2 * Math.PI * a2;
          return { u_extrude_scale: t.aK(e2, 1, i2), u_intensity: o2, u_globe_extrude_scale: r2 };
        }, eo = (e2, i2, o2, a2) => {
          const r2 = t.O();
          t.c7(r2, 0, e2.width, e2.height, 0, 0, 1);
          const s2 = e2.context.gl;
          return { u_matrix: r2, u_world: [s2.drawingBufferWidth, s2.drawingBufferHeight], u_image: o2, u_color_ramp: a2, u_opacity: i2.paint.get("heatmap-opacity") };
        }, to = (e2, t2, i2) => {
          const o2 = i2.paint.get("hillshade-accent-color");
          let a2;
          switch (i2.paint.get("hillshade-method")) {
            case "basic":
              a2 = 4;
              break;
            case "combined":
              a2 = 1;
              break;
            case "igor":
              a2 = 2;
              break;
            case "multidirectional":
              a2 = 3;
              break;
            default:
              a2 = 0;
          }
          const r2 = i2.getIlluminationProperties();
          for (let t3 = 0; t3 < r2.directionRadians.length; t3++) "viewport" === i2.paint.get("hillshade-illumination-anchor") && (r2.directionRadians[t3] += e2.transform.bearingInRadians);
          return { u_image: 0, u_latrange: oo(0, t2.tileID), u_exaggeration: i2.paint.get("hillshade-exaggeration"), u_altitudes: r2.altitudeRadians, u_azimuths: r2.directionRadians, u_accent: o2, u_method: a2, u_highlights: r2.highlightColor, u_shadows: r2.shadowColor };
        }, io = (e2, i2) => {
          const o2 = i2.stride, a2 = t.O();
          return t.c7(a2, 0, t.a6, -t.a6, 0, 0, 1), t.Q(a2, a2, [0, -t.a6, 0]), { u_matrix: a2, u_image: 1, u_dimension: [o2, o2], u_zoom: e2.overscaledZ, u_unpack: i2.getUnpackVector() };
        };
        function oo(e2, i2) {
          const o2 = Math.pow(2, i2.canonical.z), a2 = i2.canonical.y;
          return [new t.a7(0, a2 / o2).toLngLat().lat, new t.a7(0, (a2 + 1) / o2).toLngLat().lat];
        }
        const ao = (e2, t2, i2 = 0) => ({ u_image: 0, u_unpack: t2.getUnpackVector(), u_dimension: [t2.stride, t2.stride], u_elevation_stops: 1, u_color_stops: 4, u_color_ramp_size: i2, u_opacity: e2.paint.get("color-relief-opacity") }), ro = (e2, i2, o2, a2) => {
          const r2 = e2.transform;
          return { u_translation: uo(e2, i2, o2), u_ratio: a2 / t.aK(i2, 1, r2.zoom), u_device_pixel_ratio: e2.pixelRatio, u_units_to_pixels: [1 / r2.pixelsToGLUnits[0], 1 / r2.pixelsToGLUnits[1]] };
        }, so = (e2, i2, o2, a2, r2) => t.e(ro(e2, i2, o2, a2), { u_image: 0, u_image_height: r2 }), no = (e2, i2, o2, a2, r2) => {
          const s2 = e2.transform, n2 = ho(i2, s2);
          return { u_translation: uo(e2, i2, o2), u_texsize: i2.imageAtlasTexture.size, u_ratio: a2 / t.aK(i2, 1, s2.zoom), u_device_pixel_ratio: e2.pixelRatio, u_image: 0, u_scale: [n2, r2.fromScale, r2.toScale], u_fade: r2.t, u_units_to_pixels: [1 / s2.pixelsToGLUnits[0], 1 / s2.pixelsToGLUnits[1]] };
        }, lo = (e2, i2, o2, a2, r2) => {
          const s2 = ho(i2, e2.transform);
          return t.e(ro(e2, i2, o2, a2), { u_tileratio: s2, u_crossfade_from: r2.fromScale, u_crossfade_to: r2.toScale, u_image: 0, u_mix: r2.t, u_lineatlas_width: e2.lineAtlas.width, u_lineatlas_height: e2.lineAtlas.height });
        }, co = (e2, i2, o2, a2, r2, s2) => {
          const n2 = ho(i2, e2.transform);
          return t.e(ro(e2, i2, o2, a2), { u_image: 0, u_image_height: s2, u_tileratio: n2, u_crossfade_from: r2.fromScale, u_crossfade_to: r2.toScale, u_image_dash: 1, u_mix: r2.t, u_lineatlas_width: e2.lineAtlas.width, u_lineatlas_height: e2.lineAtlas.height });
        };
        function ho(e2, i2) {
          return 1 / t.aK(e2, 1, i2.tileZoom);
        }
        function uo(e2, i2, o2) {
          return t.aL(e2.transform, i2, o2.paint.get("line-translate"), o2.paint.get("line-translate-anchor"));
        }
        const _o = (e2, t2, i2, o2, a2) => {
          return { u_tl_parent: e2, u_scale_parent: t2, u_buffer_scale: 1, u_fade_t: i2.mix, u_opacity: i2.opacity * o2.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: o2.paint.get("raster-brightness-min"), u_brightness_high: o2.paint.get("raster-brightness-max"), u_saturation_factor: (s2 = o2.paint.get("raster-saturation"), s2 > 0 ? 1 - 1 / (1.001 - s2) : -s2), u_contrast_factor: (r2 = o2.paint.get("raster-contrast"), r2 > 0 ? 1 / (1 - r2) : 1 + r2), u_spin_weights: po(o2.paint.get("raster-hue-rotate")), u_coords_top: [a2[0].x, a2[0].y, a2[1].x, a2[1].y], u_coords_bottom: [a2[3].x, a2[3].y, a2[2].x, a2[2].y] };
          var r2, s2;
        };
        function po(e2) {
          e2 *= Math.PI / 180;
          const t2 = Math.sin(e2), i2 = Math.cos(e2);
          return [(2 * i2 + 1) / 3, (-Math.sqrt(3) * t2 - i2 + 1) / 3, (Math.sqrt(3) * t2 - i2 + 1) / 3];
        }
        const mo = (e2, t2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2) => {
          const _2 = s2.transform;
          return { u_is_size_zoom_constant: +("constant" === e2 || "source" === e2), u_is_size_feature_constant: +("constant" === e2 || "camera" === e2), u_size_t: t2 ? t2.uSizeT : 0, u_size: t2 ? t2.uSize : 0, u_camera_to_center_distance: _2.cameraToCenterDistance, u_pitch: _2.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +i2, u_aspect_ratio: _2.width / _2.height, u_fade_change: s2.options.fadeDuration ? s2.symbolFadeChange : 1, u_label_plane_matrix: n2, u_coord_matrix: l2, u_is_text: +h2, u_pitch_with_map: +o2, u_is_along_line: a2, u_is_variable_anchor: r2, u_texsize: u2, u_texture: 0, u_translation: c2, u_pitched_scale: d2 };
        }, fo = (e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2, p2) => {
          const m2 = n2.transform;
          return t.e(mo(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, p2), { u_gamma_scale: a2 ? Math.cos(m2.pitch * Math.PI / 180) * m2.cameraToCenterDistance : 1, u_device_pixel_ratio: n2.pixelRatio, u_is_halo: _2 ? 1 : 0, u_is_plain: 1 });
        }, go = (e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2) => t.e(fo(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, true, u2, true, _2), { u_texsize_icon: d2, u_texture_icon: 1 }), vo = (e2, t2) => ({ u_opacity: e2, u_color: t2 }), xo = (e2, i2, o2, a2, r2) => t.e((function(e3, i3, o3, a3) {
          const r3 = o3.imageManager.getPattern(e3.from.toString()), s2 = o3.imageManager.getPattern(e3.to.toString()), { width: n2, height: l2 } = o3.imageManager.getPixelSize(), c2 = Math.pow(2, a3.tileID.overscaledZ), h2 = a3.tileSize * Math.pow(2, o3.transform.tileZoom) / c2, u2 = h2 * (a3.tileID.canonical.x + a3.tileID.wrap * c2), d2 = h2 * a3.tileID.canonical.y;
          return { u_image: 0, u_pattern_tl_a: r3.tl, u_pattern_br_a: r3.br, u_pattern_tl_b: s2.tl, u_pattern_br_b: s2.br, u_texsize: [n2, l2], u_mix: i3.t, u_pattern_size_a: r3.displaySize, u_pattern_size_b: s2.displaySize, u_scale_a: i3.fromScale, u_scale_b: i3.toScale, u_tile_units_to_pixels: 1 / t.aK(a3, 1, o3.transform.tileZoom), u_pixel_coord_upper: [u2 >> 16, d2 >> 16], u_pixel_coord_lower: [65535 & u2, 65535 & d2] };
        })(o2, r2, i2, a2), { u_opacity: e2 }), bo = (e2, t2) => {
        }, yo = { fillExtrusion: (e2, i2) => ({ u_lightpos: new t.c2(e2, i2.u_lightpos), u_lightpos_globe: new t.c2(e2, i2.u_lightpos_globe), u_lightintensity: new t.bp(e2, i2.u_lightintensity), u_lightcolor: new t.c2(e2, i2.u_lightcolor), u_vertical_gradient: new t.bp(e2, i2.u_vertical_gradient), u_opacity: new t.bp(e2, i2.u_opacity), u_fill_translate: new t.c3(e2, i2.u_fill_translate) }), fillExtrusionPattern: (e2, i2) => ({ u_lightpos: new t.c2(e2, i2.u_lightpos), u_lightpos_globe: new t.c2(e2, i2.u_lightpos_globe), u_lightintensity: new t.bp(e2, i2.u_lightintensity), u_lightcolor: new t.c2(e2, i2.u_lightcolor), u_vertical_gradient: new t.bp(e2, i2.u_vertical_gradient), u_height_factor: new t.bp(e2, i2.u_height_factor), u_opacity: new t.bp(e2, i2.u_opacity), u_fill_translate: new t.c3(e2, i2.u_fill_translate), u_image: new t.b_(e2, i2.u_image), u_texsize: new t.c3(e2, i2.u_texsize), u_pixel_coord_upper: new t.c3(e2, i2.u_pixel_coord_upper), u_pixel_coord_lower: new t.c3(e2, i2.u_pixel_coord_lower), u_scale: new t.c2(e2, i2.u_scale), u_fade: new t.bp(e2, i2.u_fade) }), fill: (e2, i2) => ({ u_fill_translate: new t.c3(e2, i2.u_fill_translate) }), fillPattern: (e2, i2) => ({ u_image: new t.b_(e2, i2.u_image), u_texsize: new t.c3(e2, i2.u_texsize), u_pixel_coord_upper: new t.c3(e2, i2.u_pixel_coord_upper), u_pixel_coord_lower: new t.c3(e2, i2.u_pixel_coord_lower), u_scale: new t.c2(e2, i2.u_scale), u_fade: new t.bp(e2, i2.u_fade), u_fill_translate: new t.c3(e2, i2.u_fill_translate) }), fillOutline: (e2, i2) => ({ u_world: new t.c3(e2, i2.u_world), u_fill_translate: new t.c3(e2, i2.u_fill_translate) }), fillOutlinePattern: (e2, i2) => ({ u_world: new t.c3(e2, i2.u_world), u_image: new t.b_(e2, i2.u_image), u_texsize: new t.c3(e2, i2.u_texsize), u_pixel_coord_upper: new t.c3(e2, i2.u_pixel_coord_upper), u_pixel_coord_lower: new t.c3(e2, i2.u_pixel_coord_lower), u_scale: new t.c2(e2, i2.u_scale), u_fade: new t.bp(e2, i2.u_fade), u_fill_translate: new t.c3(e2, i2.u_fill_translate) }), circle: (e2, i2) => ({ u_camera_to_center_distance: new t.bp(e2, i2.u_camera_to_center_distance), u_scale_with_map: new t.b_(e2, i2.u_scale_with_map), u_pitch_with_map: new t.b_(e2, i2.u_pitch_with_map), u_extrude_scale: new t.c3(e2, i2.u_extrude_scale), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_globe_extrude_scale: new t.bp(e2, i2.u_globe_extrude_scale), u_translate: new t.c3(e2, i2.u_translate) }), collisionBox: (e2, i2) => ({ u_pixel_extrude_scale: new t.c3(e2, i2.u_pixel_extrude_scale) }), collisionCircle: (e2, i2) => ({ u_viewport_size: new t.c3(e2, i2.u_viewport_size) }), debug: (e2, i2) => ({ u_color: new t.b$(e2, i2.u_color), u_overlay: new t.b_(e2, i2.u_overlay), u_overlay_scale: new t.bp(e2, i2.u_overlay_scale) }), depth: bo, clippingMask: bo, heatmap: (e2, i2) => ({ u_extrude_scale: new t.bp(e2, i2.u_extrude_scale), u_intensity: new t.bp(e2, i2.u_intensity), u_globe_extrude_scale: new t.bp(e2, i2.u_globe_extrude_scale) }), heatmapTexture: (e2, i2) => ({ u_matrix: new t.c0(e2, i2.u_matrix), u_world: new t.c3(e2, i2.u_world), u_image: new t.b_(e2, i2.u_image), u_color_ramp: new t.b_(e2, i2.u_color_ramp), u_opacity: new t.bp(e2, i2.u_opacity) }), hillshade: (e2, i2) => ({ u_image: new t.b_(e2, i2.u_image), u_latrange: new t.c3(e2, i2.u_latrange), u_exaggeration: new t.bp(e2, i2.u_exaggeration), u_altitudes: new t.c9(e2, i2.u_altitudes), u_azimuths: new t.c9(e2, i2.u_azimuths), u_accent: new t.b$(e2, i2.u_accent), u_method: new t.b_(e2, i2.u_method), u_shadows: new t.c8(e2, i2.u_shadows), u_highlights: new t.c8(e2, i2.u_highlights) }), hillshadePrepare: (e2, i2) => ({ u_matrix: new t.c0(e2, i2.u_matrix), u_image: new t.b_(e2, i2.u_image), u_dimension: new t.c3(e2, i2.u_dimension), u_zoom: new t.bp(e2, i2.u_zoom), u_unpack: new t.c1(e2, i2.u_unpack) }), colorRelief: (e2, i2) => ({ u_image: new t.b_(e2, i2.u_image), u_unpack: new t.c1(e2, i2.u_unpack), u_dimension: new t.c3(e2, i2.u_dimension), u_elevation_stops: new t.b_(e2, i2.u_elevation_stops), u_color_stops: new t.b_(e2, i2.u_color_stops), u_color_ramp_size: new t.b_(e2, i2.u_color_ramp_size), u_opacity: new t.bp(e2, i2.u_opacity) }), line: (e2, i2) => ({ u_translation: new t.c3(e2, i2.u_translation), u_ratio: new t.bp(e2, i2.u_ratio), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_units_to_pixels: new t.c3(e2, i2.u_units_to_pixels) }), lineGradient: (e2, i2) => ({ u_translation: new t.c3(e2, i2.u_translation), u_ratio: new t.bp(e2, i2.u_ratio), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_units_to_pixels: new t.c3(e2, i2.u_units_to_pixels), u_image: new t.b_(e2, i2.u_image), u_image_height: new t.bp(e2, i2.u_image_height) }), linePattern: (e2, i2) => ({ u_translation: new t.c3(e2, i2.u_translation), u_texsize: new t.c3(e2, i2.u_texsize), u_ratio: new t.bp(e2, i2.u_ratio), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_image: new t.b_(e2, i2.u_image), u_units_to_pixels: new t.c3(e2, i2.u_units_to_pixels), u_scale: new t.c2(e2, i2.u_scale), u_fade: new t.bp(e2, i2.u_fade) }), lineSDF: (e2, i2) => ({ u_translation: new t.c3(e2, i2.u_translation), u_ratio: new t.bp(e2, i2.u_ratio), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_units_to_pixels: new t.c3(e2, i2.u_units_to_pixels), u_image: new t.b_(e2, i2.u_image), u_mix: new t.bp(e2, i2.u_mix), u_tileratio: new t.bp(e2, i2.u_tileratio), u_crossfade_from: new t.bp(e2, i2.u_crossfade_from), u_crossfade_to: new t.bp(e2, i2.u_crossfade_to), u_lineatlas_width: new t.bp(e2, i2.u_lineatlas_width), u_lineatlas_height: new t.bp(e2, i2.u_lineatlas_height) }), lineGradientSDF: (e2, i2) => ({ u_translation: new t.c3(e2, i2.u_translation), u_ratio: new t.bp(e2, i2.u_ratio), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_units_to_pixels: new t.c3(e2, i2.u_units_to_pixels), u_image: new t.b_(e2, i2.u_image), u_image_height: new t.bp(e2, i2.u_image_height), u_tileratio: new t.bp(e2, i2.u_tileratio), u_crossfade_from: new t.bp(e2, i2.u_crossfade_from), u_crossfade_to: new t.bp(e2, i2.u_crossfade_to), u_image_dash: new t.b_(e2, i2.u_image_dash), u_mix: new t.bp(e2, i2.u_mix), u_lineatlas_width: new t.bp(e2, i2.u_lineatlas_width), u_lineatlas_height: new t.bp(e2, i2.u_lineatlas_height) }), raster: (e2, i2) => ({ u_tl_parent: new t.c3(e2, i2.u_tl_parent), u_scale_parent: new t.bp(e2, i2.u_scale_parent), u_buffer_scale: new t.bp(e2, i2.u_buffer_scale), u_fade_t: new t.bp(e2, i2.u_fade_t), u_opacity: new t.bp(e2, i2.u_opacity), u_image0: new t.b_(e2, i2.u_image0), u_image1: new t.b_(e2, i2.u_image1), u_brightness_low: new t.bp(e2, i2.u_brightness_low), u_brightness_high: new t.bp(e2, i2.u_brightness_high), u_saturation_factor: new t.bp(e2, i2.u_saturation_factor), u_contrast_factor: new t.bp(e2, i2.u_contrast_factor), u_spin_weights: new t.c2(e2, i2.u_spin_weights), u_coords_top: new t.c1(e2, i2.u_coords_top), u_coords_bottom: new t.c1(e2, i2.u_coords_bottom) }), symbolIcon: (e2, i2) => ({ u_is_size_zoom_constant: new t.b_(e2, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new t.b_(e2, i2.u_is_size_feature_constant), u_size_t: new t.bp(e2, i2.u_size_t), u_size: new t.bp(e2, i2.u_size), u_camera_to_center_distance: new t.bp(e2, i2.u_camera_to_center_distance), u_pitch: new t.bp(e2, i2.u_pitch), u_rotate_symbol: new t.b_(e2, i2.u_rotate_symbol), u_aspect_ratio: new t.bp(e2, i2.u_aspect_ratio), u_fade_change: new t.bp(e2, i2.u_fade_change), u_label_plane_matrix: new t.c0(e2, i2.u_label_plane_matrix), u_coord_matrix: new t.c0(e2, i2.u_coord_matrix), u_is_text: new t.b_(e2, i2.u_is_text), u_pitch_with_map: new t.b_(e2, i2.u_pitch_with_map), u_is_along_line: new t.b_(e2, i2.u_is_along_line), u_is_variable_anchor: new t.b_(e2, i2.u_is_variable_anchor), u_texsize: new t.c3(e2, i2.u_texsize), u_texture: new t.b_(e2, i2.u_texture), u_translation: new t.c3(e2, i2.u_translation), u_pitched_scale: new t.bp(e2, i2.u_pitched_scale) }), symbolSDF: (e2, i2) => ({ u_is_size_zoom_constant: new t.b_(e2, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new t.b_(e2, i2.u_is_size_feature_constant), u_size_t: new t.bp(e2, i2.u_size_t), u_size: new t.bp(e2, i2.u_size), u_camera_to_center_distance: new t.bp(e2, i2.u_camera_to_center_distance), u_pitch: new t.bp(e2, i2.u_pitch), u_rotate_symbol: new t.b_(e2, i2.u_rotate_symbol), u_aspect_ratio: new t.bp(e2, i2.u_aspect_ratio), u_fade_change: new t.bp(e2, i2.u_fade_change), u_label_plane_matrix: new t.c0(e2, i2.u_label_plane_matrix), u_coord_matrix: new t.c0(e2, i2.u_coord_matrix), u_is_text: new t.b_(e2, i2.u_is_text), u_pitch_with_map: new t.b_(e2, i2.u_pitch_with_map), u_is_along_line: new t.b_(e2, i2.u_is_along_line), u_is_variable_anchor: new t.b_(e2, i2.u_is_variable_anchor), u_texsize: new t.c3(e2, i2.u_texsize), u_texture: new t.b_(e2, i2.u_texture), u_gamma_scale: new t.bp(e2, i2.u_gamma_scale), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_is_halo: new t.b_(e2, i2.u_is_halo), u_is_plain: new t.b_(e2, i2.u_is_plain), u_translation: new t.c3(e2, i2.u_translation), u_pitched_scale: new t.bp(e2, i2.u_pitched_scale) }), symbolTextAndIcon: (e2, i2) => ({ u_is_size_zoom_constant: new t.b_(e2, i2.u_is_size_zoom_constant), u_is_size_feature_constant: new t.b_(e2, i2.u_is_size_feature_constant), u_size_t: new t.bp(e2, i2.u_size_t), u_size: new t.bp(e2, i2.u_size), u_camera_to_center_distance: new t.bp(e2, i2.u_camera_to_center_distance), u_pitch: new t.bp(e2, i2.u_pitch), u_rotate_symbol: new t.b_(e2, i2.u_rotate_symbol), u_aspect_ratio: new t.bp(e2, i2.u_aspect_ratio), u_fade_change: new t.bp(e2, i2.u_fade_change), u_label_plane_matrix: new t.c0(e2, i2.u_label_plane_matrix), u_coord_matrix: new t.c0(e2, i2.u_coord_matrix), u_is_text: new t.b_(e2, i2.u_is_text), u_pitch_with_map: new t.b_(e2, i2.u_pitch_with_map), u_is_along_line: new t.b_(e2, i2.u_is_along_line), u_is_variable_anchor: new t.b_(e2, i2.u_is_variable_anchor), u_texsize: new t.c3(e2, i2.u_texsize), u_texsize_icon: new t.c3(e2, i2.u_texsize_icon), u_texture: new t.b_(e2, i2.u_texture), u_texture_icon: new t.b_(e2, i2.u_texture_icon), u_gamma_scale: new t.bp(e2, i2.u_gamma_scale), u_device_pixel_ratio: new t.bp(e2, i2.u_device_pixel_ratio), u_is_halo: new t.b_(e2, i2.u_is_halo), u_translation: new t.c3(e2, i2.u_translation), u_pitched_scale: new t.bp(e2, i2.u_pitched_scale) }), background: (e2, i2) => ({ u_opacity: new t.bp(e2, i2.u_opacity), u_color: new t.b$(e2, i2.u_color) }), backgroundPattern: (e2, i2) => ({ u_opacity: new t.bp(e2, i2.u_opacity), u_image: new t.b_(e2, i2.u_image), u_pattern_tl_a: new t.c3(e2, i2.u_pattern_tl_a), u_pattern_br_a: new t.c3(e2, i2.u_pattern_br_a), u_pattern_tl_b: new t.c3(e2, i2.u_pattern_tl_b), u_pattern_br_b: new t.c3(e2, i2.u_pattern_br_b), u_texsize: new t.c3(e2, i2.u_texsize), u_mix: new t.bp(e2, i2.u_mix), u_pattern_size_a: new t.c3(e2, i2.u_pattern_size_a), u_pattern_size_b: new t.c3(e2, i2.u_pattern_size_b), u_scale_a: new t.bp(e2, i2.u_scale_a), u_scale_b: new t.bp(e2, i2.u_scale_b), u_pixel_coord_upper: new t.c3(e2, i2.u_pixel_coord_upper), u_pixel_coord_lower: new t.c3(e2, i2.u_pixel_coord_lower), u_tile_units_to_pixels: new t.bp(e2, i2.u_tile_units_to_pixels) }), terrain: (e2, i2) => ({ u_texture: new t.b_(e2, i2.u_texture), u_ele_delta: new t.bp(e2, i2.u_ele_delta), u_fog_matrix: new t.c0(e2, i2.u_fog_matrix), u_fog_color: new t.b$(e2, i2.u_fog_color), u_fog_ground_blend: new t.bp(e2, i2.u_fog_ground_blend), u_fog_ground_blend_opacity: new t.bp(e2, i2.u_fog_ground_blend_opacity), u_horizon_color: new t.b$(e2, i2.u_horizon_color), u_horizon_fog_blend: new t.bp(e2, i2.u_horizon_fog_blend), u_is_globe_mode: new t.bp(e2, i2.u_is_globe_mode) }), terrainDepth: (e2, i2) => ({ u_ele_delta: new t.bp(e2, i2.u_ele_delta) }), terrainCoords: (e2, i2) => ({ u_texture: new t.b_(e2, i2.u_texture), u_terrain_coords_id: new t.bp(e2, i2.u_terrain_coords_id), u_ele_delta: new t.bp(e2, i2.u_ele_delta) }), projectionErrorMeasurement: (e2, i2) => ({ u_input: new t.bp(e2, i2.u_input), u_output_expected: new t.bp(e2, i2.u_output_expected) }), atmosphere: (e2, i2) => ({ u_sun_pos: new t.c2(e2, i2.u_sun_pos), u_atmosphere_blend: new t.bp(e2, i2.u_atmosphere_blend), u_globe_position: new t.c2(e2, i2.u_globe_position), u_globe_radius: new t.bp(e2, i2.u_globe_radius), u_inv_proj_matrix: new t.c0(e2, i2.u_inv_proj_matrix) }), sky: (e2, i2) => ({ u_sky_color: new t.b$(e2, i2.u_sky_color), u_horizon_color: new t.b$(e2, i2.u_horizon_color), u_horizon: new t.c3(e2, i2.u_horizon), u_horizon_normal: new t.c3(e2, i2.u_horizon_normal), u_sky_horizon_blend: new t.bp(e2, i2.u_sky_horizon_blend), u_sky_blend: new t.bp(e2, i2.u_sky_blend) }) };
        class wo {
          constructor(e2, t2, i2) {
            this.context = e2;
            const o2 = e2.gl;
            this.buffer = o2.createBuffer(), this.dynamicDraw = Boolean(i2), this.context.unbindVAO(), e2.bindElementBuffer.set(this.buffer), o2.bufferData(o2.ELEMENT_ARRAY_BUFFER, t2.arrayBuffer, this.dynamicDraw ? o2.DYNAMIC_DRAW : o2.STATIC_DRAW), this.dynamicDraw || t2.freeBufferAfterUpload();
          }
          bind() {
            this.context.bindElementBuffer.set(this.buffer);
          }
          updateData(e2) {
            const t2 = this.context.gl;
            if (!this.dynamicDraw) throw new Error("Attempted to update data while not in dynamic mode.");
            this.context.unbindVAO(), this.bind(), t2.bufferSubData(t2.ELEMENT_ARRAY_BUFFER, 0, e2.arrayBuffer);
          }
          destroy() {
            this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
          }
        }
        const To = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" };
        class Po {
          constructor(e2, t2, i2, o2) {
            this.length = t2.length, this.attributes = i2, this.itemSize = t2.bytesPerElement, this.dynamicDraw = o2, this.context = e2;
            const a2 = e2.gl;
            this.buffer = a2.createBuffer(), e2.bindVertexBuffer.set(this.buffer), a2.bufferData(a2.ARRAY_BUFFER, t2.arrayBuffer, this.dynamicDraw ? a2.DYNAMIC_DRAW : a2.STATIC_DRAW), this.dynamicDraw || t2.freeBufferAfterUpload();
          }
          bind() {
            this.context.bindVertexBuffer.set(this.buffer);
          }
          updateData(e2) {
            if (e2.length !== this.length) throw new Error(`Length of new data is ${e2.length}, which doesn't match current length of ${this.length}`);
            const t2 = this.context.gl;
            this.bind(), t2.bufferSubData(t2.ARRAY_BUFFER, 0, e2.arrayBuffer);
          }
          enableAttributes(e2, t2) {
            for (const i2 of this.attributes) {
              const o2 = t2.attributes[i2.name];
              void 0 !== o2 && e2.enableVertexAttribArray(o2);
            }
          }
          setVertexAttribPointers(e2, t2, i2) {
            for (const o2 of this.attributes) {
              const a2 = t2.attributes[o2.name];
              void 0 !== a2 && e2.vertexAttribPointer(a2, o2.components, e2[To[o2.type]], false, this.itemSize, o2.offset + this.itemSize * (i2 || 0));
            }
          }
          destroy() {
            this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
          }
        }
        class Co {
          constructor(e2) {
            this.gl = e2.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false;
          }
          get() {
            return this.current;
          }
          set(e2) {
          }
          getDefault() {
            return this.default;
          }
          setDefault() {
            this.set(this.default);
          }
        }
        class Mo extends Co {
          getDefault() {
            return t.bo.transparent;
          }
          set(e2) {
            const t2 = this.current;
            (e2.r !== t2.r || e2.g !== t2.g || e2.b !== t2.b || e2.a !== t2.a || this.dirty) && (this.gl.clearColor(e2.r, e2.g, e2.b, e2.a), this.current = e2, this.dirty = false);
          }
        }
        class Io extends Co {
          getDefault() {
            return 1;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.clearDepth(e2), this.current = e2, this.dirty = false);
          }
        }
        class Eo extends Co {
          getDefault() {
            return 0;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.clearStencil(e2), this.current = e2, this.dirty = false);
          }
        }
        class So extends Co {
          getDefault() {
            return [true, true, true, true];
          }
          set(e2) {
            const t2 = this.current;
            (e2[0] !== t2[0] || e2[1] !== t2[1] || e2[2] !== t2[2] || e2[3] !== t2[3] || this.dirty) && (this.gl.colorMask(e2[0], e2[1], e2[2], e2[3]), this.current = e2, this.dirty = false);
          }
        }
        class zo extends Co {
          getDefault() {
            return true;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.depthMask(e2), this.current = e2, this.dirty = false);
          }
        }
        class Ro extends Co {
          getDefault() {
            return 255;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.stencilMask(e2), this.current = e2, this.dirty = false);
          }
        }
        class Do extends Co {
          getDefault() {
            return { func: this.gl.ALWAYS, ref: 0, mask: 255 };
          }
          set(e2) {
            const t2 = this.current;
            (e2.func !== t2.func || e2.ref !== t2.ref || e2.mask !== t2.mask || this.dirty) && (this.gl.stencilFunc(e2.func, e2.ref, e2.mask), this.current = e2, this.dirty = false);
          }
        }
        class Ao extends Co {
          getDefault() {
            const e2 = this.gl;
            return [e2.KEEP, e2.KEEP, e2.KEEP];
          }
          set(e2) {
            const t2 = this.current;
            (e2[0] !== t2[0] || e2[1] !== t2[1] || e2[2] !== t2[2] || this.dirty) && (this.gl.stencilOp(e2[0], e2[1], e2[2]), this.current = e2, this.dirty = false);
          }
        }
        class Lo extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            e2 ? t2.enable(t2.STENCIL_TEST) : t2.disable(t2.STENCIL_TEST), this.current = e2, this.dirty = false;
          }
        }
        class Fo extends Co {
          getDefault() {
            return [0, 1];
          }
          set(e2) {
            const t2 = this.current;
            (e2[0] !== t2[0] || e2[1] !== t2[1] || this.dirty) && (this.gl.depthRange(e2[0], e2[1]), this.current = e2, this.dirty = false);
          }
        }
        class ko extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            e2 ? t2.enable(t2.DEPTH_TEST) : t2.disable(t2.DEPTH_TEST), this.current = e2, this.dirty = false;
          }
        }
        class Bo extends Co {
          getDefault() {
            return this.gl.LESS;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.depthFunc(e2), this.current = e2, this.dirty = false);
          }
        }
        class Oo extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            e2 ? t2.enable(t2.BLEND) : t2.disable(t2.BLEND), this.current = e2, this.dirty = false;
          }
        }
        class jo extends Co {
          getDefault() {
            const e2 = this.gl;
            return [e2.ONE, e2.ZERO];
          }
          set(e2) {
            const t2 = this.current;
            (e2[0] !== t2[0] || e2[1] !== t2[1] || this.dirty) && (this.gl.blendFunc(e2[0], e2[1]), this.current = e2, this.dirty = false);
          }
        }
        class No extends Co {
          getDefault() {
            return t.bo.transparent;
          }
          set(e2) {
            const t2 = this.current;
            (e2.r !== t2.r || e2.g !== t2.g || e2.b !== t2.b || e2.a !== t2.a || this.dirty) && (this.gl.blendColor(e2.r, e2.g, e2.b, e2.a), this.current = e2, this.dirty = false);
          }
        }
        class Zo extends Co {
          getDefault() {
            return this.gl.FUNC_ADD;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.blendEquation(e2), this.current = e2, this.dirty = false);
          }
        }
        class Uo extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            e2 ? t2.enable(t2.CULL_FACE) : t2.disable(t2.CULL_FACE), this.current = e2, this.dirty = false;
          }
        }
        class Go extends Co {
          getDefault() {
            return this.gl.BACK;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.cullFace(e2), this.current = e2, this.dirty = false);
          }
        }
        class Vo extends Co {
          getDefault() {
            return this.gl.CCW;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.frontFace(e2), this.current = e2, this.dirty = false);
          }
        }
        class Wo extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.useProgram(e2), this.current = e2, this.dirty = false);
          }
        }
        class qo extends Co {
          getDefault() {
            return this.gl.TEXTURE0;
          }
          set(e2) {
            (e2 !== this.current || this.dirty) && (this.gl.activeTexture(e2), this.current = e2, this.dirty = false);
          }
        }
        class $o extends Co {
          getDefault() {
            const e2 = this.gl;
            return [0, 0, e2.drawingBufferWidth, e2.drawingBufferHeight];
          }
          set(e2) {
            const t2 = this.current;
            (e2[0] !== t2[0] || e2[1] !== t2[1] || e2[2] !== t2[2] || e2[3] !== t2[3] || this.dirty) && (this.gl.viewport(e2[0], e2[1], e2[2], e2[3]), this.current = e2, this.dirty = false);
          }
        }
        class Ho extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.bindFramebuffer(t2.FRAMEBUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        class Xo extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.bindRenderbuffer(t2.RENDERBUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        class Ko extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.bindTexture(t2.TEXTURE_2D, e2), this.current = e2, this.dirty = false;
          }
        }
        class Yo extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.bindBuffer(t2.ARRAY_BUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        class Qo extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            const t2 = this.gl;
            t2.bindBuffer(t2.ELEMENT_ARRAY_BUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        class Jo extends Co {
          getDefault() {
            return null;
          }
          set(e2) {
            var t2;
            if (e2 === this.current && !this.dirty) return;
            const i2 = this.gl;
            si(i2) ? i2.bindVertexArray(e2) : null === (t2 = i2.getExtension("OES_vertex_array_object")) || void 0 === t2 || t2.bindVertexArrayOES(e2), this.current = e2, this.dirty = false;
          }
        }
        class ea extends Co {
          getDefault() {
            return 4;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.pixelStorei(t2.UNPACK_ALIGNMENT, e2), this.current = e2, this.dirty = false;
          }
        }
        class ta extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.pixelStorei(t2.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e2), this.current = e2, this.dirty = false;
          }
        }
        class ia extends Co {
          getDefault() {
            return false;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            const t2 = this.gl;
            t2.pixelStorei(t2.UNPACK_FLIP_Y_WEBGL, e2), this.current = e2, this.dirty = false;
          }
        }
        class oa extends Co {
          constructor(e2, t2) {
            super(e2), this.context = e2, this.parent = t2;
          }
          getDefault() {
            return null;
          }
        }
        class aa extends oa {
          setDirty() {
            this.dirty = true;
          }
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            this.context.bindFramebuffer.set(this.parent);
            const t2 = this.gl;
            t2.framebufferTexture2D(t2.FRAMEBUFFER, t2.COLOR_ATTACHMENT0, t2.TEXTURE_2D, e2, 0), this.current = e2, this.dirty = false;
          }
        }
        class ra extends oa {
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            this.context.bindFramebuffer.set(this.parent);
            const t2 = this.gl;
            t2.framebufferRenderbuffer(t2.FRAMEBUFFER, t2.DEPTH_ATTACHMENT, t2.RENDERBUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        class sa extends oa {
          set(e2) {
            if (e2 === this.current && !this.dirty) return;
            this.context.bindFramebuffer.set(this.parent);
            const t2 = this.gl;
            t2.framebufferRenderbuffer(t2.FRAMEBUFFER, t2.DEPTH_STENCIL_ATTACHMENT, t2.RENDERBUFFER, e2), this.current = e2, this.dirty = false;
          }
        }
        const na = "Framebuffer is not complete";
        class la {
          constructor(e2, t2, i2, o2, a2) {
            this.context = e2, this.width = t2, this.height = i2;
            const r2 = e2.gl, s2 = this.framebuffer = r2.createFramebuffer();
            if (this.colorAttachment = new aa(e2, s2), o2) this.depthAttachment = a2 ? new sa(e2, s2) : new ra(e2, s2);
            else if (a2) throw new Error("Stencil cannot be set without depth");
            if (r2.checkFramebufferStatus(r2.FRAMEBUFFER) !== r2.FRAMEBUFFER_COMPLETE) throw new Error(na);
          }
          destroy() {
            const e2 = this.context.gl, t2 = this.colorAttachment.get();
            if (t2 && e2.deleteTexture(t2), this.depthAttachment) {
              const t3 = this.depthAttachment.get();
              t3 && e2.deleteRenderbuffer(t3);
            }
            e2.deleteFramebuffer(this.framebuffer);
          }
        }
        class ca {
          constructor(e2) {
            var t2, i2;
            if (this.gl = e2, this.clearColor = new Mo(this), this.clearDepth = new Io(this), this.clearStencil = new Eo(this), this.colorMask = new So(this), this.depthMask = new zo(this), this.stencilMask = new Ro(this), this.stencilFunc = new Do(this), this.stencilOp = new Ao(this), this.stencilTest = new Lo(this), this.depthRange = new Fo(this), this.depthTest = new ko(this), this.depthFunc = new Bo(this), this.blend = new Oo(this), this.blendFunc = new jo(this), this.blendColor = new No(this), this.blendEquation = new Zo(this), this.cullFace = new Uo(this), this.cullFaceSide = new Go(this), this.frontFace = new Vo(this), this.program = new Wo(this), this.activeTexture = new qo(this), this.viewport = new $o(this), this.bindFramebuffer = new Ho(this), this.bindRenderbuffer = new Xo(this), this.bindTexture = new Ko(this), this.bindVertexBuffer = new Yo(this), this.bindElementBuffer = new Qo(this), this.bindVertexArray = new Jo(this), this.pixelStoreUnpack = new ea(this), this.pixelStoreUnpackPremultiplyAlpha = new ta(this), this.pixelStoreUnpackFlipY = new ia(this), this.extTextureFilterAnisotropic = e2.getExtension("EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = e2.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.maxTextureSize = e2.getParameter(e2.MAX_TEXTURE_SIZE), si(e2)) {
              this.HALF_FLOAT = e2.HALF_FLOAT;
              const o2 = e2.getExtension("EXT_color_buffer_half_float");
              this.RGBA16F = null !== (t2 = e2.RGBA16F) && void 0 !== t2 ? t2 : null == o2 ? void 0 : o2.RGBA16F_EXT, this.RGB16F = null !== (i2 = e2.RGB16F) && void 0 !== i2 ? i2 : null == o2 ? void 0 : o2.RGB16F_EXT, e2.getExtension("EXT_color_buffer_float");
            } else {
              e2.getExtension("EXT_color_buffer_half_float"), e2.getExtension("OES_texture_half_float_linear");
              const t3 = e2.getExtension("OES_texture_half_float");
              this.HALF_FLOAT = null == t3 ? void 0 : t3.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 = true, this.clearDepth.dirty = true, this.clearStencil.dirty = true, this.colorMask.dirty = true, this.depthMask.dirty = true, this.stencilMask.dirty = true, this.stencilFunc.dirty = true, this.stencilOp.dirty = true, this.stencilTest.dirty = true, this.depthRange.dirty = true, this.depthTest.dirty = true, this.depthFunc.dirty = true, this.blend.dirty = true, this.blendFunc.dirty = true, this.blendColor.dirty = true, this.blendEquation.dirty = true, this.cullFace.dirty = true, this.cullFaceSide.dirty = true, this.frontFace.dirty = true, this.program.dirty = true, this.activeTexture.dirty = true, this.viewport.dirty = true, this.bindFramebuffer.dirty = true, this.bindRenderbuffer.dirty = true, this.bindTexture.dirty = true, this.bindVertexBuffer.dirty = true, this.bindElementBuffer.dirty = true, this.bindVertexArray.dirty = true, this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true;
          }
          createIndexBuffer(e2, t2) {
            return new wo(this, e2, t2);
          }
          createVertexBuffer(e2, t2, i2) {
            return new Po(this, e2, t2, i2);
          }
          createRenderbuffer(e2, t2, i2) {
            const o2 = this.gl, a2 = o2.createRenderbuffer();
            return this.bindRenderbuffer.set(a2), o2.renderbufferStorage(o2.RENDERBUFFER, e2, t2, i2), this.bindRenderbuffer.set(null), a2;
          }
          createFramebuffer(e2, t2, i2, o2) {
            return new la(this, e2, t2, i2, o2);
          }
          clear({ color: e2, depth: t2, stencil: i2 }) {
            const o2 = this.gl;
            let a2 = 0;
            e2 && (a2 |= o2.COLOR_BUFFER_BIT, this.clearColor.set(e2), this.colorMask.set([true, true, true, true])), void 0 !== t2 && (a2 |= o2.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(t2), this.depthMask.set(true)), void 0 !== i2 && (a2 |= o2.STENCIL_BUFFER_BIT, this.clearStencil.set(i2), this.stencilMask.set(255)), o2.clear(a2);
          }
          setCullFace(e2) {
            false === e2.enable ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(e2.mode), this.frontFace.set(e2.frontFace));
          }
          setDepthMode(e2) {
            e2.func !== this.gl.ALWAYS || e2.mask ? (this.depthTest.set(true), this.depthFunc.set(e2.func), this.depthMask.set(e2.mask), this.depthRange.set(e2.range)) : this.depthTest.set(false);
          }
          setStencilMode(e2) {
            e2.test.func !== this.gl.ALWAYS || e2.mask ? (this.stencilTest.set(true), this.stencilMask.set(e2.mask), this.stencilOp.set([e2.fail, e2.depthFail, e2.pass]), this.stencilFunc.set({ func: e2.test.func, ref: e2.ref, mask: e2.test.mask })) : this.stencilTest.set(false);
          }
          setColorMode(e2) {
            t.bQ(e2.blendFunction, ei.Replace) ? this.blend.set(false) : (this.blend.set(true), this.blendFunc.set(e2.blendFunction), this.blendColor.set(e2.blendColor)), this.colorMask.set(e2.mask);
          }
          createVertexArray() {
            var e2;
            return si(this.gl) ? this.gl.createVertexArray() : null === (e2 = this.gl.getExtension("OES_vertex_array_object")) || void 0 === e2 ? void 0 : e2.createVertexArrayOES();
          }
          deleteVertexArray(e2) {
            var t2;
            si(this.gl) ? this.gl.deleteVertexArray(e2) : null === (t2 = this.gl.getExtension("OES_vertex_array_object")) || void 0 === t2 || t2.deleteVertexArrayOES(e2);
          }
          unbindVAO() {
            this.bindVertexArray.set(null);
          }
        }
        let ha;
        function ua(e2, i2, o2, a2, r2) {
          var s2, n2;
          const l2 = e2.context, c2 = e2.transform, h2 = l2.gl, u2 = e2.useProgram("collisionBox"), d2 = [];
          let _2 = 0, p2 = 0;
          for (const t2 of a2) {
            const a3 = i2.getTile(t2).getBucket(o2);
            if (!a3) continue;
            const n3 = r2 ? a3.textCollisionBox : a3.iconCollisionBox, m3 = a3.collisionCircleArray;
            m3.length > 0 && (d2.push({ circleArray: m3, circleOffset: p2, coord: t2 }), _2 += m3.length / 4, p2 = _2), n3 && u2.draw(l2, h2.LINES, oi.disabled, ri.disabled, e2.colorModeForRenderPass(), ii.disabled, Ki(e2.transform), null === (s2 = e2.style.map.terrain) || void 0 === s2 ? void 0 : s2.getTerrainData(t2), c2.getProjectionData({ overscaledTileID: t2, applyGlobeMatrix: true, applyTerrainMatrix: true }), o2.id, n3.layoutVertexBuffer, n3.indexBuffer, n3.segments, null, e2.transform.zoom, null, null, n3.collisionVertexBuffer);
          }
          if (!r2 || !d2.length) return;
          const m2 = e2.useProgram("collisionCircle"), f2 = new t.ca();
          f2.resize(4 * _2), f2._trim();
          let g2 = 0;
          for (const e3 of d2) for (let t2 = 0; t2 < e3.circleArray.length / 4; t2++) {
            const i3 = 4 * t2, o3 = e3.circleArray[i3 + 0], a3 = e3.circleArray[i3 + 1], r3 = e3.circleArray[i3 + 2], s3 = e3.circleArray[i3 + 3];
            f2.emplace(g2++, o3, a3, r3, s3, 0), f2.emplace(g2++, o3, a3, r3, s3, 1), f2.emplace(g2++, o3, a3, r3, s3, 2), f2.emplace(g2++, o3, a3, r3, s3, 3);
          }
          (!ha || ha.length < 2 * _2) && (ha = (function(e3) {
            const i3 = 2 * e3, o3 = new t.cc();
            o3.resize(i3), o3._trim();
            for (let e4 = 0; e4 < i3; e4++) {
              const t2 = 6 * e4;
              o3.uint16[t2 + 0] = 4 * e4 + 0, o3.uint16[t2 + 1] = 4 * e4 + 1, o3.uint16[t2 + 2] = 4 * e4 + 2, o3.uint16[t2 + 3] = 4 * e4 + 2, o3.uint16[t2 + 4] = 4 * e4 + 3, o3.uint16[t2 + 5] = 4 * e4 + 0;
            }
            return o3;
          })(_2));
          const v2 = l2.createIndexBuffer(ha, true), x2 = l2.createVertexBuffer(f2, t.cb.members, true);
          for (const i3 of d2) {
            const a3 = Yi(e2.transform);
            m2.draw(l2, h2.TRIANGLES, oi.disabled, ri.disabled, e2.colorModeForRenderPass(), ii.disabled, a3, null === (n2 = e2.style.map.terrain) || void 0 === n2 ? void 0 : n2.getTerrainData(i3.coord), null, o2.id, x2, v2, t.aV.simpleSegment(0, 2 * i3.circleOffset, i3.circleArray.length, i3.circleArray.length / 2), null, e2.transform.zoom, null, null, null);
          }
          x2.destroy(), v2.destroy();
        }
        const da = t.ap(new Float32Array(16));
        function _a(e2, i2, o2, a2, r2, s2) {
          const { horizontalAlign: n2, verticalAlign: l2 } = t.aP(e2);
          return new t.P((-(n2 - 0.5) * i2 / r2 + a2[0]) * s2, (-(l2 - 0.5) * o2 / r2 + a2[1]) * s2);
        }
        function pa(e2, i2, o2, a2, r2, s2) {
          const n2 = i2.tileAnchorPoint.add(new t.P(i2.translation[0], i2.translation[1]));
          if (i2.pitchWithMap) {
            let e3 = a2.mult(s2);
            o2 || (e3 = e3.rotate(-r2));
            const t2 = n2.add(e3);
            return Ve(t2.x, t2.y, i2.pitchedLabelPlaneMatrix, i2.getElevation).point;
          }
          if (o2) {
            const t2 = Je(i2.tileAnchorPoint.x + 1, i2.tileAnchorPoint.y, i2).point.sub(e2), o3 = Math.atan(t2.y / t2.x) + (t2.x < 0 ? Math.PI : 0);
            return e2.add(a2.rotate(o3));
          }
          return e2.add(a2);
        }
        function ma(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2) {
          const _2 = e2.text.placedSymbolArray, p2 = e2.text.dynamicLayoutVertexArray, m2 = e2.icon.dynamicLayoutVertexArray, f2 = {};
          p2.clear();
          for (let m3 = 0; m3 < _2.length; m3++) {
            const g2 = _2.get(m3), v2 = g2.hidden || !g2.crossTileID || e2.allowVerticalPlacement && !g2.placedOrientation ? null : a2[g2.crossTileID];
            if (v2) {
              const a3 = new t.P(g2.anchorX, g2.anchorY), _3 = { getElevation: d2, width: r2.width, height: r2.height, pitchedLabelPlaneMatrix: s2, pitchWithMap: o2, transform: r2, tileAnchorPoint: a3, translation: h2, unwrappedTileID: u2 }, m4 = o2 ? tt(a3.x, a3.y, _3) : Je(a3.x, a3.y, _3), x2 = We(r2.cameraToCenterDistance, m4.signedDistanceFromCamera);
              let b2 = t.ay(e2.textSizeData, l2, g2) * x2 / t.aJ;
              o2 && (b2 *= e2.tilePixelRatio / n2);
              const { width: y2, height: w2, anchor: T2, textOffset: P2, textBoxScale: C2 } = v2, M2 = _a(T2, y2, w2, P2, C2, b2), I2 = r2.getPitchedTextCorrection(a3.x + h2[0], a3.y + h2[1], u2), E2 = pa(m4.point, _3, i2, M2, -r2.bearingInRadians, I2), S2 = e2.allowVerticalPlacement && g2.placedOrientation === t.ax.vertical ? Math.PI / 2 : 0;
              for (let e3 = 0; e3 < g2.numGlyphs; e3++) t.aD(p2, E2, S2);
              c2 && g2.associatedIconIndex >= 0 && (f2[g2.associatedIconIndex] = { shiftedAnchor: E2, angle: S2 });
            } else st(g2.numGlyphs, p2);
          }
          if (c2) {
            m2.clear();
            const i3 = e2.icon.placedSymbolArray;
            for (let e3 = 0; e3 < i3.length; e3++) {
              const o3 = i3.get(e3);
              if (o3.hidden) st(o3.numGlyphs, m2);
              else {
                const i4 = f2[e3];
                if (i4) for (let e4 = 0; e4 < o3.numGlyphs; e4++) t.aD(m2, i4.shiftedAnchor, i4.angle);
                else st(o3.numGlyphs, m2);
              }
            }
            e2.icon.dynamicLayoutVertexBuffer.updateData(m2);
          }
          e2.text.dynamicLayoutVertexBuffer.updateData(p2);
        }
        function fa(e2, t2, i2) {
          return i2.iconsInText && t2 ? "symbolTextAndIcon" : e2 ? "symbolSDF" : "symbolIcon";
        }
        function ga(e2, i2, o2, a2, r2, s2, n2, l2, c2, h2, u2, d2, _2) {
          var p2, m2;
          const f2 = e2.context, g2 = f2.gl, v2 = e2.transform, x2 = "map" === l2, b2 = "map" === c2, y2 = "viewport" !== l2 && "point" !== o2.layout.get("symbol-placement"), w2 = x2 && !b2 && !y2, T2 = !o2.layout.get("symbol-sort-key").isConstant();
          let P2 = false;
          const C2 = e2.getDepthModeForSublayer(0, oi.ReadOnly), M2 = o2._unevaluatedLayout.hasValue("text-variable-anchor") || o2._unevaluatedLayout.hasValue("text-variable-anchor-offset"), I2 = [], E2 = v2.getCircleRadiusCorrection();
          for (const l3 of a2) {
            const a3 = i2.getTile(l3), c3 = a3.getBucket(o2);
            if (!c3) continue;
            const u3 = r2 ? c3.text : c3.icon;
            if (!(null == u3 ? void 0 : u3.segments.get().length) || !u3.hasVisibleVertices) continue;
            const d3 = u3.programConfigurations.get(o2.id), m3 = r2 || c3.sdfIcons, f3 = r2 ? c3.textSizeData : c3.iconSizeData, C3 = b2 || 0 !== v2.pitch, S3 = e2.useProgram(fa(m3, r2, c3), d3), z3 = t.aw(f3, v2.zoom), R2 = null === (p2 = e2.style.map.terrain) || void 0 === p2 ? void 0 : p2.getTerrainData(l3);
            let D2, A2, L2, F2, k2 = [0, 0], B2 = null;
            if (r2) A2 = a3.glyphAtlasTexture, L2 = g2.LINEAR, D2 = a3.glyphAtlasTexture.size, c3.iconsInText && (k2 = a3.imageAtlasTexture.size, B2 = a3.imageAtlasTexture, F2 = C3 || e2.options.rotating || e2.options.zooming || "composite" === f3.kind || "camera" === f3.kind ? g2.LINEAR : g2.NEAREST);
            else {
              const t2 = 1 !== o2.layout.get("icon-size").constantOr(0) || c3.iconsNeedLinear;
              A2 = a3.imageAtlasTexture, L2 = m3 || e2.options.rotating || e2.options.zooming || t2 || C3 ? g2.LINEAR : g2.NEAREST, D2 = a3.imageAtlasTexture.size;
            }
            const O2 = t.aK(a3, 1, e2.transform.zoom), j2 = Ze(x2, e2.transform, O2), N2 = Ue(b2, x2, e2.transform, O2), Z2 = t.aL(v2, a3, s2, n2), U2 = v2.getProjectionData({ overscaledTileID: l3, applyGlobeMatrix: !_2, applyTerrainMatrix: true }), G2 = M2 && c3.hasTextData(), V2 = "none" !== o2.layout.get("icon-text-fit") && G2 && c3.hasIconData();
            if (y2) {
              const i3 = t.O();
              je(i3, j2);
              const a4 = e2.style.map.terrain ? (t2, i4) => e2.style.map.terrain.getElevation(l3, t2, i4) : null, s3 = "map" === o2.layout.get("text-rotation-alignment");
              $e(c3, e2, r2, j2, i3, b2, h2, s3, l3.toUnwrapped(), v2.width, v2.height, Z2, a4);
            }
            const W2 = r2 && M2 || V2, q2 = y2 || W2 ? da : b2 ? j2 : e2.transform.clipSpaceToPixelsMatrix, $2 = m3 && 0 !== o2.paint.get(r2 ? "text-halo-width" : "icon-halo-width").constantOr(1);
            let H2;
            H2 = m3 ? c3.iconsInText ? go(f3.kind, z3, w2, b2, y2, W2, e2, q2, N2, Z2, D2, k2, E2) : fo(f3.kind, z3, w2, b2, y2, W2, e2, q2, N2, Z2, r2, D2, $2, E2) : mo(f3.kind, z3, w2, b2, y2, W2, e2, q2, N2, Z2, r2, D2, E2);
            const X2 = { program: S3, buffers: u3, uniformValues: H2, projectionData: U2, atlasTexture: A2, atlasTextureIcon: B2, atlasInterpolation: L2, atlasInterpolationIcon: F2, isSDF: m3, hasHalo: $2 };
            if (T2 && c3.canOverlap) {
              P2 = true;
              const e3 = u3.segments.get();
              for (const i3 of e3) I2.push({ segments: new t.aV([i3]), sortKey: i3.sortKey, state: X2, terrainData: R2 });
            } else I2.push({ segments: u3.segments, sortKey: 0, state: X2, terrainData: R2 });
          }
          P2 && I2.sort(((e3, t2) => e3.sortKey - t2.sortKey));
          const S2 = null !== (m2 = o2.paint.get(r2 ? "text-halo-width" : "icon-halo-width").constantOr(null)) && void 0 !== m2 ? m2 : 1 / 0, z2 = o2.layout.get("text-letter-spacing").constantOr(0) * t.aJ < 0 || S2 > 1;
          for (const t2 of I2) {
            const i3 = t2.state;
            f2.activeTexture.set(g2.TEXTURE0), i3.atlasTexture.bind(i3.atlasInterpolation, g2.CLAMP_TO_EDGE), i3.atlasTextureIcon && (f2.activeTexture.set(g2.TEXTURE1), i3.atlasTextureIcon && i3.atlasTextureIcon.bind(i3.atlasInterpolationIcon, g2.CLAMP_TO_EDGE));
            const a3 = i3.isSDF && i3.hasHalo;
            if (a3) {
              const a4 = i3.uniformValues;
              a4.u_is_halo = 1, z2 && (a4.u_is_plain = 0, va(i3.buffers, t2.segments, o2, e2, i3.program, C2, u2, d2, a4, i3.projectionData, t2.terrainData), a4.u_is_halo = 0, a4.u_is_plain = 1);
            }
            va(i3.buffers, t2.segments, o2, e2, i3.program, C2, u2, d2, i3.uniformValues, i3.projectionData, t2.terrainData), a3 && !z2 && (i3.uniformValues.u_is_halo = 0);
          }
        }
        function va(e2, t2, i2, o2, a2, r2, s2, n2, l2, c2, h2) {
          const u2 = o2.context;
          a2.draw(u2, u2.gl.TRIANGLES, r2, s2, n2, ii.backCCW, l2, h2, c2, i2.id, e2.layoutVertexBuffer, e2.indexBuffer, t2, i2.paint, o2.transform.zoom, e2.programConfigurations.get(i2.id), e2.dynamicLayoutVertexBuffer, e2.opacityVertexBuffer);
        }
        function xa(e2, i2, o2, a2, r2) {
          const s2 = e2.context, n2 = s2.gl, l2 = ri.disabled, c2 = new ei([n2.ONE, n2.ONE], t.bo.transparent, [true, true, true, true]), h2 = i2.getBucket(o2);
          if (!h2) return;
          const u2 = a2.key;
          let d2 = o2.heatmapFbos.get(u2);
          d2 || (d2 = ya(s2, i2.tileSize, i2.tileSize), o2.heatmapFbos.set(u2, d2)), s2.bindFramebuffer.set(d2.framebuffer), s2.viewport.set([0, 0, i2.tileSize, i2.tileSize]), s2.clear({ color: t.bo.transparent });
          const _2 = h2.programConfigurations.get(o2.id), p2 = e2.useProgram("heatmap", _2, !r2), m2 = e2.transform.getProjectionData({ overscaledTileID: i2.tileID, applyGlobeMatrix: true, applyTerrainMatrix: true }), f2 = e2.style.map.terrain.getTerrainData(a2);
          p2.draw(s2, n2.TRIANGLES, oi.disabled, l2, c2, ii.disabled, Ji(i2, e2.transform.zoom, o2.paint.get("heatmap-intensity"), 1), f2, m2, o2.id, h2.layoutVertexBuffer, h2.indexBuffer, h2.segments, o2.paint, e2.transform.zoom, _2);
        }
        function ba(e2, t2, i2, o2, a2) {
          const r2 = e2.context, s2 = r2.gl, n2 = e2.transform;
          r2.setColorMode(e2.colorModeForRenderPass());
          const l2 = wa(r2, t2), c2 = i2.key, h2 = t2.heatmapFbos.get(c2);
          if (!h2) return;
          r2.activeTexture.set(s2.TEXTURE0), s2.bindTexture(s2.TEXTURE_2D, h2.colorAttachment.get()), r2.activeTexture.set(s2.TEXTURE1), l2.bind(s2.LINEAR, s2.CLAMP_TO_EDGE);
          const u2 = n2.getProjectionData({ overscaledTileID: i2, applyTerrainMatrix: a2, applyGlobeMatrix: !o2 });
          e2.useProgram("heatmapTexture").draw(r2, s2.TRIANGLES, oi.disabled, ri.disabled, e2.colorModeForRenderPass(), ii.disabled, eo(e2, t2, 0, 1), null, u2, t2.id, e2.rasterBoundsBuffer, e2.quadTriangleIndexBuffer, e2.rasterBoundsSegments, t2.paint, n2.zoom), h2.destroy(), t2.heatmapFbos.delete(c2);
        }
        function ya(e2, t2, i2) {
          var o2, a2;
          const r2 = e2.gl, s2 = r2.createTexture();
          r2.bindTexture(r2.TEXTURE_2D, s2), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_S, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_WRAP_T, r2.CLAMP_TO_EDGE), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MIN_FILTER, r2.LINEAR), r2.texParameteri(r2.TEXTURE_2D, r2.TEXTURE_MAG_FILTER, r2.LINEAR);
          const n2 = null !== (o2 = e2.HALF_FLOAT) && void 0 !== o2 ? o2 : r2.UNSIGNED_BYTE, l2 = null !== (a2 = e2.RGBA16F) && void 0 !== a2 ? a2 : r2.RGBA;
          r2.texImage2D(r2.TEXTURE_2D, 0, l2, t2, i2, 0, r2.RGBA, n2, null);
          const c2 = e2.createFramebuffer(t2, i2, false, false);
          return c2.colorAttachment.set(s2), c2;
        }
        function wa(e2, i2) {
          return i2.colorRampTexture || (i2.colorRampTexture = new t.T(e2, i2.colorRamp, e2.gl.RGBA)), i2.colorRampTexture;
        }
        function Ta(e2, i2, o2, a2, r2, s2, n2, l2) {
          let c2 = 256;
          if (r2.stepInterpolant) {
            const a3 = i2.getSource().maxzoom, r3 = n2.canonical.z === a3 ? Math.ceil(1 << e2.transform.maxZoom - n2.canonical.z) : 1;
            c2 = t.al(t.ce(s2.maxLineLength / t.a6 * 1024 * r3), 256, o2.maxTextureSize);
          }
          return l2.gradient = t.cf({ expression: r2.gradientExpression(), evaluationKey: "lineProgress", resolution: c2, image: l2.gradient || void 0, clips: s2.lineClipsArray }), l2.texture ? l2.texture.update(l2.gradient) : l2.texture = new t.T(o2, l2.gradient, a2.RGBA), l2.version = r2.gradientVersion, l2.texture;
        }
        function Pa(e2, t2, i2, o2, a2) {
          e2.activeTexture.set(t2.TEXTURE0), i2.imageAtlasTexture.bind(t2.LINEAR, t2.CLAMP_TO_EDGE), o2.updatePaintBuffers(a2);
        }
        function Ca(e2, t2, i2, o2, a2, r2) {
          (a2 || e2.lineAtlas.dirty) && (t2.activeTexture.set(i2.TEXTURE0), e2.lineAtlas.bind(t2)), o2.updatePaintBuffers(r2);
        }
        function Ma(e2, t2, i2, o2, a2, r2, s2) {
          const n2 = r2.gradients[a2.id];
          let l2 = n2.texture;
          a2.gradientVersion !== n2.version && (l2 = Ta(e2, t2, i2, o2, a2, r2, s2, n2)), i2.activeTexture.set(o2.TEXTURE0), l2.bind(a2.stepInterpolant ? o2.NEAREST : o2.LINEAR, o2.CLAMP_TO_EDGE);
        }
        function Ia(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
          const c2 = r2.gradients[a2.id];
          let h2 = c2.texture;
          a2.gradientVersion !== c2.version && (h2 = Ta(e2, t2, i2, o2, a2, r2, s2, c2)), i2.activeTexture.set(o2.TEXTURE0), h2.bind(a2.stepInterpolant ? o2.NEAREST : o2.LINEAR, o2.CLAMP_TO_EDGE), i2.activeTexture.set(o2.TEXTURE1), e2.lineAtlas.bind(i2), n2.updatePaintBuffers(l2);
        }
        function Ea(e2, t2, i2, o2, a2) {
          if (!i2 || !(null == o2 ? void 0 : o2.imageAtlas)) return;
          const r2 = o2.imageAtlas.patternPositions;
          let s2 = r2[i2.to.toString()], n2 = r2[i2.from.toString()];
          if (!s2 && n2 && (s2 = n2), !n2 && s2 && (n2 = s2), !s2 || !n2) {
            const e3 = a2.getPaintProperty(t2);
            s2 = r2[e3], n2 = r2[e3];
          }
          s2 && n2 && e2.setConstantPatternPositions(s2, n2);
        }
        function Sa(e2, i2, o2, a2, r2, s2, n2, l2) {
          var c2;
          const h2 = e2.context.gl, u2 = "fill-pattern", d2 = o2.paint.get(u2), _2 = null == d2 ? void 0 : d2.constantOr(1), p2 = o2.getCrossfadeParameters();
          let m2, f2, g2, v2, x2;
          const b2 = e2.transform, y2 = o2.paint.get("fill-translate"), w2 = o2.paint.get("fill-translate-anchor");
          n2 ? (f2 = _2 && !o2.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", m2 = h2.LINES) : (f2 = _2 ? "fillPattern" : "fill", m2 = h2.TRIANGLES);
          const T2 = d2.constantOr(null);
          for (const d3 of a2) {
            const a3 = i2.getTile(d3);
            if (_2 && !a3.patternsLoaded()) continue;
            const P2 = a3.getBucket(o2);
            if (!P2) continue;
            const C2 = P2.programConfigurations.get(o2.id), M2 = e2.useProgram(f2, C2), I2 = null === (c2 = e2.style.map.terrain) || void 0 === c2 ? void 0 : c2.getTerrainData(d3);
            _2 && (e2.context.activeTexture.set(h2.TEXTURE0), a3.imageAtlasTexture.bind(h2.LINEAR, h2.CLAMP_TO_EDGE), C2.updatePaintBuffers(p2)), Ea(C2, u2, T2, a3, o2);
            const E2 = b2.getProjectionData({ overscaledTileID: d3, applyGlobeMatrix: !l2, applyTerrainMatrix: true }), S2 = t.aL(b2, a3, y2, w2);
            if (n2) {
              v2 = P2.indexBuffer2, x2 = P2.segments2;
              const t2 = [h2.drawingBufferWidth, h2.drawingBufferHeight];
              g2 = "fillOutlinePattern" === f2 && _2 ? Hi(e2, p2, a3, t2, S2) : $i(t2, S2);
            } else v2 = P2.indexBuffer, x2 = P2.segments, g2 = _2 ? qi(e2, p2, a3, S2) : { u_fill_translate: S2 };
            const z2 = e2.stencilModeForClipping(d3);
            M2.draw(e2.context, m2, r2, z2, s2, ii.backCCW, g2, I2, E2, o2.id, P2.layoutVertexBuffer, v2, x2, o2.paint, e2.transform.zoom, C2);
          }
        }
        function za(e2, i2, o2, a2, r2, s2, n2, l2) {
          var c2;
          const h2 = e2.context, u2 = h2.gl, d2 = "fill-extrusion-pattern", _2 = o2.paint.get(d2), p2 = _2.constantOr(1), m2 = o2.getCrossfadeParameters(), f2 = o2.paint.get("fill-extrusion-opacity"), g2 = _2.constantOr(null), v2 = e2.transform;
          for (const _3 of a2) {
            const a3 = i2.getTile(_3), x2 = a3.getBucket(o2);
            if (!x2) continue;
            const b2 = null === (c2 = e2.style.map.terrain) || void 0 === c2 ? void 0 : c2.getTerrainData(_3), y2 = x2.programConfigurations.get(o2.id), w2 = e2.useProgram(p2 ? "fillExtrusionPattern" : "fillExtrusion", y2);
            p2 && (e2.context.activeTexture.set(u2.TEXTURE0), a3.imageAtlasTexture.bind(u2.LINEAR, u2.CLAMP_TO_EDGE), y2.updatePaintBuffers(m2));
            const T2 = v2.getProjectionData({ overscaledTileID: _3, applyGlobeMatrix: !l2, applyTerrainMatrix: true });
            Ea(y2, d2, g2, a3, o2);
            const P2 = t.aL(v2, a3, o2.paint.get("fill-extrusion-translate"), o2.paint.get("fill-extrusion-translate-anchor")), C2 = o2.paint.get("fill-extrusion-vertical-gradient"), M2 = p2 ? Wi(e2, C2, f2, P2, _3, m2, a3) : Vi(e2, C2, f2, P2);
            w2.draw(h2, h2.gl.TRIANGLES, r2, s2, n2, ii.backCCW, M2, b2, T2, o2.id, x2.layoutVertexBuffer, x2.indexBuffer, x2.segments, o2.paint, e2.transform.zoom, y2, e2.style.map.terrain && x2.centroidVertexBuffer);
          }
        }
        function Ra(e2, t2, i2, o2, a2, r2, s2, n2, l2) {
          var c2;
          const h2 = e2.style.projection, u2 = e2.context, d2 = e2.transform, _2 = u2.gl, p2 = [`#define NUM_ILLUMINATION_SOURCES ${i2.paint.get("hillshade-highlight-color").values.length}`], m2 = e2.useProgram("hillshade", null, false, p2), f2 = !e2.options.moving;
          for (const p3 of o2) {
            const o3 = t2.getTile(p3), g2 = o3.fbo;
            if (!g2) continue;
            const v2 = h2.getMeshFromTileID(u2, p3.canonical, n2, true, "raster"), x2 = null === (c2 = e2.style.map.terrain) || void 0 === c2 ? void 0 : c2.getTerrainData(p3);
            u2.activeTexture.set(_2.TEXTURE0), _2.bindTexture(_2.TEXTURE_2D, g2.colorAttachment.get());
            const b2 = d2.getProjectionData({ overscaledTileID: p3, aligned: f2, applyGlobeMatrix: !l2, applyTerrainMatrix: true });
            m2.draw(u2, _2.TRIANGLES, r2, a2[p3.overscaledZ], s2, ii.backCCW, to(e2, o3, i2), x2, b2, i2.id, v2.vertexBuffer, v2.indexBuffer, v2.segments);
          }
        }
        let Da = 0;
        function Aa(e2, i2, o2, a2, r2, s2, n2, l2, c2) {
          var h2;
          const u2 = e2.style.projection, d2 = e2.context, _2 = e2.transform, p2 = d2.gl, m2 = e2.useProgram("colorRelief"), f2 = !e2.options.moving, g2 = "nearest" === o2.paint.get("resampling") ? p2.NEAREST : p2.LINEAR;
          let v2 = true, x2 = 0;
          for (const b2 of a2) {
            const a3 = i2.getTile(b2), y2 = a3.dem;
            if (v2) {
              Da || (Da = p2.getParameter(p2.MAX_TEXTURE_SIZE));
              const e3 = Da, { elevationTexture: t2, colorTexture: i3 } = o2.getColorRampTextures(d2, e3, y2.getUnpackVector());
              d2.activeTexture.set(p2.TEXTURE1), t2.bind(p2.NEAREST, p2.CLAMP_TO_EDGE), d2.activeTexture.set(p2.TEXTURE4), i3.bind(p2.LINEAR, p2.CLAMP_TO_EDGE), v2 = false, x2 = t2.size[0];
            }
            if (!(null == y2 ? void 0 : y2.data)) continue;
            const w2 = y2.stride, T2 = y2.getPixels();
            if (d2.activeTexture.set(p2.TEXTURE0), d2.pixelStoreUnpackPremultiplyAlpha.set(false), a3.demTexture || (a3.demTexture = e2.getTileTexture(w2)), a3.demTexture) {
              const e3 = a3.demTexture;
              e3.update(T2, { premultiply: false }), e3.bind(g2, p2.CLAMP_TO_EDGE);
            } else a3.demTexture = new t.T(d2, T2, p2.RGBA, { premultiply: false }), a3.demTexture.bind(g2, p2.CLAMP_TO_EDGE);
            const P2 = u2.getMeshFromTileID(d2, b2.canonical, l2, true, "raster"), C2 = null === (h2 = e2.style.map.terrain) || void 0 === h2 ? void 0 : h2.getTerrainData(b2), M2 = _2.getProjectionData({ overscaledTileID: b2, aligned: f2, applyGlobeMatrix: !c2, applyTerrainMatrix: true });
            m2.draw(d2, p2.TRIANGLES, s2, r2[b2.overscaledZ], n2, ii.backCCW, ao(o2, a3.dem, x2), C2, M2, o2.id, P2.vertexBuffer, P2.indexBuffer, P2.segments);
          }
        }
        const La = [new t.P(0, 0), new t.P(t.a6, 0), new t.P(t.a6, t.a6), new t.P(0, t.a6)];
        function Fa(e2, t2, i2, o2, a2, r2, s2, n2, l2 = false, c2 = false) {
          var h2;
          const u2 = o2[o2.length - 1].overscaledZ, d2 = e2.context, _2 = d2.gl, p2 = e2.useProgram("raster"), m2 = e2.transform, f2 = e2.style.projection, g2 = e2.colorModeForRenderPass(), v2 = !e2.options.moving, x2 = i2.paint.get("raster-opacity"), b2 = "nearest" === i2.paint.get("resampling") || "nearest" === i2.paint.get("raster-resampling") ? _2.NEAREST : _2.LINEAR, y2 = i2.paint.get("raster-fade-duration"), w2 = !!e2.style.map.terrain;
          for (const T2 of o2) {
            const o3 = e2.getDepthModeForSublayer(T2.overscaledZ - u2, 1 === x2 ? oi.ReadWrite : oi.ReadOnly, _2.LESS), P2 = t2.getTile(T2);
            d2.activeTexture.set(_2.TEXTURE0), P2.texture.bind(b2, _2.CLAMP_TO_EDGE, _2.LINEAR_MIPMAP_NEAREST), d2.activeTexture.set(_2.TEXTURE1);
            const { parentTile: C2, parentScaleBy: M2, parentTopLeft: I2, fadeValues: E2 } = ka(P2, t2, y2, w2);
            P2.fadeOpacity = E2.tileOpacity, C2 ? (C2.fadeOpacity = E2.parentTileOpacity, C2.texture.bind(b2, _2.CLAMP_TO_EDGE, _2.LINEAR_MIPMAP_NEAREST)) : P2.texture.bind(b2, _2.CLAMP_TO_EDGE, _2.LINEAR_MIPMAP_NEAREST), P2.texture.useMipmap && d2.extTextureFilterAnisotropic && e2.transform.pitch > e2.options.anisotropicFilterPitch && _2.texParameterf(_2.TEXTURE_2D, d2.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, d2.extTextureFilterAnisotropicMax);
            const S2 = null === (h2 = e2.style.map.terrain) || void 0 === h2 ? void 0 : h2.getTerrainData(T2), z2 = m2.getProjectionData({ overscaledTileID: T2, aligned: v2, applyGlobeMatrix: !c2, applyTerrainMatrix: true }), R2 = _o(I2, M2, E2.fadeMix, i2, n2), D2 = f2.getMeshFromTileID(d2, T2.canonical, r2, s2, "raster");
            p2.draw(d2, _2.TRIANGLES, o3, a2 ? a2[T2.overscaledZ] : ri.disabled, g2, l2 ? ii.frontCCW : ii.backCCW, R2, S2, z2, i2.id, D2.vertexBuffer, D2.indexBuffer, D2.segments);
          }
        }
        function ka(e2, i2, o2, a2) {
          const r2 = { parentTile: null, parentScaleBy: 1, parentTopLeft: [0, 0], fadeValues: { tileOpacity: 1, parentTileOpacity: 1, fadeMix: { opacity: 1, mix: 0 } } };
          if (0 === o2 || a2) return r2;
          if (e2.fadingParentID) {
            const a3 = i2.getLoadedTile(e2.fadingParentID);
            if (!a3) return r2;
            const s2 = Math.pow(2, a3.tileID.overscaledZ - e2.tileID.overscaledZ), n2 = [e2.tileID.canonical.x * s2 % 1, e2.tileID.canonical.y * s2 % 1], l2 = (function(e3, i3, o3) {
              const a4 = c(), r3 = (a4 - i3.timeAdded) / o3, s3 = e3.fadingDirection === ue.Incoming, n3 = t.al((a4 - e3.timeAdded) / o3, 0, 1), l3 = t.al(1 - r3, 0, 1), h2 = s3 ? n3 : l3;
              return { tileOpacity: h2, parentTileOpacity: s3 ? l3 : n3, fadeMix: { opacity: 1, mix: 1 - h2 } };
            })(e2, a3, o2);
            return { parentTile: a3, parentScaleBy: s2, parentTopLeft: n2, fadeValues: l2 };
          }
          if (e2.selfFading) {
            const i3 = (function(e3, i4) {
              const o3 = (c() - e3.timeAdded) / i4, a3 = t.al(o3, 0, 1);
              return { tileOpacity: a3, fadeMix: { opacity: a3, mix: 0 } };
            })(e2, o2);
            return { parentTile: null, parentScaleBy: 1, parentTopLeft: [0, 0], fadeValues: i3 };
          }
          return r2;
        }
        const Ba = new t.bo(1, 0, 0, 1), Oa = new t.bo(0, 1, 0, 1), ja = new t.bo(0, 0, 1, 1), Na = new t.bo(1, 0, 1, 1), Za = new t.bo(0, 1, 1, 1);
        function Ua(e2, t2, i2, o2) {
          Va(e2, 0, t2 + i2 / 2, e2.transform.width, i2, o2);
        }
        function Ga(e2, t2, i2, o2) {
          Va(e2, t2 - i2 / 2, 0, i2, e2.transform.height, o2);
        }
        function Va(e2, t2, i2, o2, a2, r2) {
          const s2 = e2.context, n2 = s2.gl;
          n2.enable(n2.SCISSOR_TEST), n2.scissor(t2 * e2.pixelRatio, i2 * e2.pixelRatio, o2 * e2.pixelRatio, a2 * e2.pixelRatio), s2.clear({ color: r2 }), n2.disable(n2.SCISSOR_TEST);
        }
        function Wa(e2, i2, o2) {
          var a2;
          const r2 = e2.context, s2 = r2.gl, n2 = e2.useProgram("debug"), l2 = oi.disabled, c2 = ri.disabled, h2 = e2.colorModeForRenderPass(), u2 = "$debug", d2 = null === (a2 = e2.style.map.terrain) || void 0 === a2 ? void 0 : a2.getTerrainData(o2);
          r2.activeTexture.set(s2.TEXTURE0);
          const _2 = i2.getTileByID(o2.key).latestRawTileData, p2 = Math.floor(((null == _2 ? void 0 : _2.byteLength) || 0) / 1024), m2 = i2.getTile(o2).tileSize, f2 = 512 / Math.min(m2, 512) * (o2.overscaledZ / e2.transform.zoom) * 0.5;
          let g2 = o2.canonical.toString();
          o2.overscaledZ !== o2.canonical.z && (g2 += ` => ${o2.overscaledZ}`), (function(e3, t2) {
            e3.initDebugOverlayCanvas();
            const i3 = e3.debugOverlayCanvas, o3 = e3.context.gl, a3 = e3.debugOverlayCanvas.getContext("2d");
            a3.clearRect(0, 0, i3.width, i3.height), a3.shadowColor = "white", a3.shadowBlur = 2, a3.lineWidth = 1.5, a3.strokeStyle = "white", a3.textBaseline = "top", a3.font = "bold 36px Open Sans, sans-serif", a3.fillText(t2, 5, 5), a3.strokeText(t2, 5, 5), e3.debugOverlayTexture.update(i3), e3.debugOverlayTexture.bind(o3.LINEAR, o3.CLAMP_TO_EDGE);
          })(e2, `${g2} ${p2}kB`);
          const v2 = e2.transform.getProjectionData({ overscaledTileID: o2, applyGlobeMatrix: true, applyTerrainMatrix: true });
          n2.draw(r2, s2.TRIANGLES, l2, c2, ei.alphaBlended, ii.disabled, Qi(t.bo.transparent, f2), null, v2, u2, e2.debugBuffer, e2.quadTriangleIndexBuffer, e2.debugSegments), n2.draw(r2, s2.LINE_STRIP, l2, c2, h2, ii.disabled, Qi(t.bo.red), d2, v2, u2, e2.debugBuffer, e2.tileBorderIndexBuffer, e2.debugSegments);
        }
        function qa(e2, t2, i2, o2) {
          const { isRenderingGlobe: a2 } = o2, r2 = e2.context, s2 = r2.gl, n2 = e2.transform, l2 = e2.colorModeForRenderPass(), c2 = e2.getDepthModeFor3D(), h2 = e2.useProgram("terrain");
          r2.bindFramebuffer.set(null), r2.viewport.set([0, 0, e2.width, e2.height]);
          for (const o3 of i2) {
            const i3 = t2.getTerrainMesh(o3.tileID), u2 = e2.renderToTexture.getTexture(o3), d2 = t2.getTerrainData(o3.tileID);
            r2.activeTexture.set(s2.TEXTURE0), s2.bindTexture(s2.TEXTURE_2D, u2.texture);
            const _2 = t2.getMeshFrameDelta(n2.zoom), p2 = n2.calculateFogMatrix(o3.tileID.toUnwrapped()), m2 = ji(_2, p2, e2.style.sky, n2.pitch, a2), f2 = n2.getProjectionData({ overscaledTileID: o3.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true });
            h2.draw(r2, s2.TRIANGLES, c2, ri.disabled, l2, ii.backCCW, m2, d2, f2, "terrain", i3.vertexBuffer, i3.indexBuffer, i3.segments);
          }
        }
        function $a(e2, i2) {
          if (!i2.mesh) {
            const o2 = new t.aU();
            o2.emplaceBack(-1, -1), o2.emplaceBack(1, -1), o2.emplaceBack(1, 1), o2.emplaceBack(-1, 1);
            const a2 = new t.aW();
            a2.emplaceBack(0, 1, 2), a2.emplaceBack(0, 2, 3), i2.mesh = new Bt(e2.createVertexBuffer(o2, Ot.members), e2.createIndexBuffer(a2), t.aV.simpleSegment(0, 0, o2.length, a2.length));
          }
          return i2.mesh;
        }
        const Ha = { symbol: function(e2, i2, o2, a2, r2, s2) {
          if ("translucent" !== e2.renderPass) return;
          const { isRenderingToTexture: n2 } = s2, l2 = ri.disabled, c2 = e2.colorModeForRenderPass();
          (o2._unevaluatedLayout.hasValue("text-variable-anchor") || o2._unevaluatedLayout.hasValue("text-variable-anchor-offset")) && (function(e3, i3, o3, a3, r3, s3, n3, l3, c3) {
            var h2;
            const u2 = i3.transform, d2 = i3.style.map.terrain, _2 = "map" === r3, p2 = "map" === s3;
            for (const r4 of e3) {
              const e4 = a3.getTile(r4), s4 = e4.getBucket(o3);
              if (!(null === (h2 = null == s4 ? void 0 : s4.text) || void 0 === h2 ? void 0 : h2.segments.get().length)) continue;
              const m2 = t.aw(s4.textSizeData, u2.zoom), f2 = t.aK(e4, 1, i3.transform.zoom), g2 = Ze(_2, i3.transform, f2), v2 = "none" !== o3.layout.get("icon-text-fit") && s4.hasIconData();
              if (m2) {
                const i4 = Math.pow(2, u2.zoom - e4.tileID.overscaledZ), o4 = d2 ? (e5, t2) => d2.getElevation(r4, e5, t2) : null;
                ma(s4, _2, p2, c3, u2, g2, i4, m2, v2, t.aL(u2, e4, n3, l3), r4.toUnwrapped(), o4);
              }
            }
          })(a2, e2, o2, i2, o2.layout.get("text-rotation-alignment"), o2.layout.get("text-pitch-alignment"), o2.paint.get("text-translate"), o2.paint.get("text-translate-anchor"), r2), 0 !== o2.paint.get("icon-opacity").constantOr(1) && ga(e2, i2, o2, a2, false, o2.paint.get("icon-translate"), o2.paint.get("icon-translate-anchor"), o2.layout.get("icon-rotation-alignment"), o2.layout.get("icon-pitch-alignment"), o2.layout.get("icon-keep-upright"), l2, c2, n2), 0 !== o2.paint.get("text-opacity").constantOr(1) && ga(e2, i2, o2, a2, true, o2.paint.get("text-translate"), o2.paint.get("text-translate-anchor"), o2.layout.get("text-rotation-alignment"), o2.layout.get("text-pitch-alignment"), o2.layout.get("text-keep-upright"), l2, c2, n2), i2.map.showCollisionBoxes && (ua(e2, i2, o2, a2, true), ua(e2, i2, o2, a2, false));
        }, circle: function(e2, i2, o2, a2, r2) {
          var s2;
          if ("translucent" !== e2.renderPass) return;
          const { isRenderingToTexture: n2 } = r2, l2 = o2.paint.get("circle-opacity"), c2 = o2.paint.get("circle-stroke-width"), h2 = o2.paint.get("circle-stroke-opacity"), u2 = !o2.layout.get("circle-sort-key").isConstant();
          if (0 === l2.constantOr(1) && (0 === c2.constantOr(1) || 0 === h2.constantOr(1))) return;
          const d2 = e2.context, _2 = d2.gl, p2 = e2.transform, m2 = e2.getDepthModeForSublayer(0, oi.ReadOnly), f2 = ri.disabled, g2 = e2.colorModeForRenderPass(), v2 = [], x2 = p2.getCircleRadiusCorrection();
          for (const r3 of a2) {
            const a3 = i2.getTile(r3), l3 = a3.getBucket(o2);
            if (!l3) continue;
            const c3 = o2.paint.get("circle-translate"), h3 = o2.paint.get("circle-translate-anchor"), d3 = t.aL(p2, a3, c3, h3), _3 = l3.programConfigurations.get(o2.id), m3 = e2.useProgram("circle", _3), f3 = l3.layoutVertexBuffer, g3 = l3.indexBuffer, b2 = null === (s2 = e2.style.map.terrain) || void 0 === s2 ? void 0 : s2.getTerrainData(r3), y2 = { programConfiguration: _3, program: m3, layoutVertexBuffer: f3, indexBuffer: g3, uniformValues: Xi(e2, a3, o2, d3, x2), terrainData: b2, projectionData: p2.getProjectionData({ overscaledTileID: r3, applyGlobeMatrix: !n2, applyTerrainMatrix: true }) };
            if (u2) {
              const e3 = l3.segments.get();
              for (const i3 of e3) v2.push({ segments: new t.aV([i3]), sortKey: i3.sortKey, state: y2 });
            } else v2.push({ segments: l3.segments, sortKey: 0, state: y2 });
          }
          u2 && v2.sort(((e3, t2) => e3.sortKey - t2.sortKey));
          for (const t2 of v2) {
            const { programConfiguration: i3, program: a3, layoutVertexBuffer: r3, indexBuffer: s3, uniformValues: n3, terrainData: l3, projectionData: c3 } = t2.state;
            a3.draw(d2, _2.TRIANGLES, m2, f2, g2, ii.backCCW, n3, l3, c3, o2.id, r3, s3, t2.segments, o2.paint, e2.transform.zoom, i3);
          }
        }, heatmap: function(e2, i2, o2, a2, r2) {
          if (0 === o2.paint.get("heatmap-opacity")) return;
          const s2 = e2.context, { isRenderingToTexture: n2, isRenderingGlobe: l2 } = r2;
          if (e2.style.map.terrain) {
            for (const t2 of a2) {
              const a3 = i2.getTile(t2);
              i2.hasRenderableParent(t2) || ("offscreen" === e2.renderPass ? xa(e2, a3, o2, t2, l2) : "translucent" === e2.renderPass && ba(e2, o2, t2, n2, l2));
            }
            s2.viewport.set([0, 0, e2.width, e2.height]);
          } else "offscreen" === e2.renderPass ? (function(e3, i3, o3, a3) {
            const r3 = e3.context, s3 = r3.gl, n3 = e3.transform, l3 = ri.disabled, c2 = new ei([s3.ONE, s3.ONE], t.bo.transparent, [true, true, true, true]);
            ((function(e4, i4, o4) {
              const a4 = e4.gl;
              e4.activeTexture.set(a4.TEXTURE1), e4.viewport.set([0, 0, i4.width / 4, i4.height / 4]);
              let r4 = o4.heatmapFbos.get(t.cd);
              r4 ? (a4.bindTexture(a4.TEXTURE_2D, r4.colorAttachment.get()), e4.bindFramebuffer.set(r4.framebuffer)) : (r4 = ya(e4, i4.width / 4, i4.height / 4), o4.heatmapFbos.set(t.cd, r4));
            }))(r3, e3, o3), r3.clear({ color: t.bo.transparent });
            for (const t2 of a3) {
              if (i3.hasRenderableParent(t2)) continue;
              const a4 = i3.getTile(t2), h2 = a4.getBucket(o3);
              if (!h2) continue;
              const u2 = h2.programConfigurations.get(o3.id), d2 = e3.useProgram("heatmap", u2), _2 = n3.getProjectionData({ overscaledTileID: t2, applyGlobeMatrix: true, applyTerrainMatrix: false }), p2 = n3.getCircleRadiusCorrection();
              d2.draw(r3, s3.TRIANGLES, oi.disabled, l3, c2, ii.backCCW, Ji(a4, n3.zoom, o3.paint.get("heatmap-intensity"), p2), null, _2, o3.id, h2.layoutVertexBuffer, h2.indexBuffer, h2.segments, o3.paint, n3.zoom, u2);
            }
            r3.viewport.set([0, 0, e3.width, e3.height]);
          })(e2, i2, o2, a2) : "translucent" === e2.renderPass && (function(e3, i3) {
            const o3 = e3.context, a3 = o3.gl;
            o3.setColorMode(e3.colorModeForRenderPass());
            const r3 = i3.heatmapFbos.get(t.cd);
            r3 && (o3.activeTexture.set(a3.TEXTURE0), a3.bindTexture(a3.TEXTURE_2D, r3.colorAttachment.get()), o3.activeTexture.set(a3.TEXTURE1), wa(o3, i3).bind(a3.LINEAR, a3.CLAMP_TO_EDGE), e3.useProgram("heatmapTexture").draw(o3, a3.TRIANGLES, oi.disabled, ri.disabled, e3.colorModeForRenderPass(), ii.disabled, eo(e3, i3, 0, 1), null, null, i3.id, e3.viewportBuffer, e3.quadTriangleIndexBuffer, e3.viewportSegments, i3.paint, e3.transform.zoom));
          })(e2, o2);
        }, line: function(e2, t2, i2, o2, a2) {
          var r2;
          if ("translucent" !== e2.renderPass) return;
          const { isRenderingToTexture: s2 } = a2, n2 = i2.paint.get("line-opacity"), l2 = i2.paint.get("line-width");
          if (0 === n2.constantOr(1) || 0 === l2.constantOr(1)) return;
          const c2 = e2.getDepthModeForSublayer(0, oi.ReadOnly), h2 = e2.colorModeForRenderPass(), u2 = i2.paint.get("line-dasharray"), d2 = u2.constantOr(1), _2 = i2.paint.get("line-pattern"), p2 = _2.constantOr(1), m2 = i2.paint.get("line-gradient"), f2 = i2.getCrossfadeParameters();
          let g2;
          g2 = p2 ? "linePattern" : d2 && m2 ? "lineGradientSDF" : d2 ? "lineSDF" : m2 ? "lineGradient" : "line";
          const v2 = e2.context, x2 = v2.gl, b2 = e2.transform;
          let y2 = true;
          for (const a3 of o2) {
            const o3 = t2.getTile(a3);
            if (p2 && !o3.patternsLoaded()) continue;
            const n3 = o3.getBucket(i2);
            if (!n3) continue;
            const l3 = n3.programConfigurations.get(i2.id), w2 = e2.context.program.get(), T2 = e2.useProgram(g2, l3), P2 = y2 || T2.program !== w2, C2 = null === (r2 = e2.style.map.terrain) || void 0 === r2 ? void 0 : r2.getTerrainData(a3), M2 = _2.constantOr(null), I2 = null == u2 ? void 0 : u2.constantOr(null);
            if (M2 && o3.imageAtlas) {
              const e3 = o3.imageAtlas, t3 = e3.patternPositions[M2.to.toString()], i3 = e3.patternPositions[M2.from.toString()];
              t3 && i3 && l3.setConstantPatternPositions(t3, i3);
            } else if (I2) {
              const t3 = "round" === i2.layout.get("line-cap").constantOr(null), o4 = e2.lineAtlas.getDash(I2.to, t3), a4 = e2.lineAtlas.getDash(I2.from, t3);
              l3.setConstantDashPositions(o4, a4);
            }
            const E2 = b2.getProjectionData({ overscaledTileID: a3, applyGlobeMatrix: !s2, applyTerrainMatrix: true }), S2 = b2.getPixelScale();
            let z2;
            p2 ? (z2 = no(e2, o3, i2, S2, f2), Pa(v2, x2, o3, l3, f2)) : d2 && m2 ? (z2 = co(e2, o3, i2, S2, f2, n3.lineClipsArray.length), Ia(e2, t2, v2, x2, i2, n3, a3, l3, f2)) : d2 ? (z2 = lo(e2, o3, i2, S2, f2), Ca(e2, v2, x2, l3, P2, f2)) : m2 ? (z2 = so(e2, o3, i2, S2, n3.lineClipsArray.length), Ma(e2, t2, v2, x2, i2, n3, a3)) : z2 = ro(e2, o3, i2, S2);
            const R2 = e2.stencilModeForClipping(a3);
            T2.draw(v2, x2.TRIANGLES, c2, R2, h2, ii.disabled, z2, C2, E2, i2.id, n3.layoutVertexBuffer, n3.indexBuffer, n3.segments, i2.paint, e2.transform.zoom, l3, n3.layoutVertexBuffer2), y2 = false;
          }
        }, fill: function(e2, i2, o2, a2, r2) {
          const s2 = o2.paint.get("fill-color"), n2 = o2.paint.get("fill-opacity");
          if (0 === n2.constantOr(1)) return;
          const { isRenderingToTexture: l2 } = r2, c2 = e2.colorModeForRenderPass(), h2 = o2.paint.get("fill-pattern"), u2 = e2.opaquePassEnabledForLayer() && !h2.constantOr(1) && 1 === s2.constantOr(t.bo.transparent).a && 1 === n2.constantOr(0) ? "opaque" : "translucent";
          if (e2.renderPass === u2) {
            const t2 = e2.getDepthModeForSublayer(1, "opaque" === e2.renderPass ? oi.ReadWrite : oi.ReadOnly);
            Sa(e2, i2, o2, a2, t2, c2, false, l2);
          }
          if ("translucent" === e2.renderPass && o2.paint.get("fill-antialias")) {
            const t2 = e2.getDepthModeForSublayer(o2.getPaintProperty("fill-outline-color") ? 2 : 0, oi.ReadOnly);
            Sa(e2, i2, o2, a2, t2, c2, true, l2);
          }
        }, fillExtrusion: function(e2, t2, i2, o2, a2) {
          const r2 = i2.paint.get("fill-extrusion-opacity");
          if (0 === r2) return;
          const { isRenderingToTexture: s2 } = a2;
          if ("translucent" === e2.renderPass) {
            const a3 = new oi(e2.context.gl.LEQUAL, oi.ReadWrite, e2.depthRangeFor3D);
            if (1 !== r2 || i2.paint.get("fill-extrusion-pattern").constantOr(1)) za(e2, t2, i2, o2, a3, ri.disabled, ei.disabled, s2), za(e2, t2, i2, o2, a3, e2.stencilModeFor3D(), e2.colorModeForRenderPass(), s2);
            else {
              const r3 = e2.colorModeForRenderPass();
              za(e2, t2, i2, o2, a3, ri.disabled, r3, s2);
            }
          }
        }, hillshade: function(e2, i2, o2, a2, r2) {
          if ("offscreen" !== e2.renderPass && "translucent" !== e2.renderPass) return;
          const { isRenderingToTexture: s2 } = r2, n2 = e2.context, l2 = e2.style.projection.useSubdivision, c2 = e2.getDepthModeForSublayer(0, oi.ReadOnly), h2 = e2.colorModeForRenderPass();
          if ("offscreen" === e2.renderPass) !(function(e3, i3, o3, a3, r3, s3, n3) {
            const l3 = e3.context, c3 = l3.gl, h3 = "nearest" === a3.paint.get("resampling") ? c3.NEAREST : c3.LINEAR;
            for (const u2 of o3) {
              const o4 = i3.getTile(u2), d2 = o4.dem;
              if (!(null == d2 ? void 0 : d2.data)) continue;
              if (!o4.needsHillshadePrepare) continue;
              const _2 = d2.dim, p2 = d2.stride, m2 = d2.getPixels();
              if (l3.activeTexture.set(c3.TEXTURE1), l3.pixelStoreUnpackPremultiplyAlpha.set(false), o4.demTexture || (o4.demTexture = e3.getTileTexture(p2)), o4.demTexture) {
                const e4 = o4.demTexture;
                e4.update(m2, { premultiply: false }), e4.bind(c3.NEAREST, c3.CLAMP_TO_EDGE);
              } else o4.demTexture = new t.T(l3, m2, c3.RGBA, { premultiply: false }), o4.demTexture.bind(c3.NEAREST, c3.CLAMP_TO_EDGE);
              l3.activeTexture.set(c3.TEXTURE0);
              let f2 = o4.fbo;
              if (!f2) {
                const e4 = new t.T(l3, { width: _2, height: _2, data: null }, c3.RGBA);
                e4.bind(h3, c3.CLAMP_TO_EDGE), f2 = o4.fbo = l3.createFramebuffer(_2, _2, true, false), f2.colorAttachment.set(e4.texture);
              }
              l3.bindFramebuffer.set(f2.framebuffer), l3.viewport.set([0, 0, _2, _2]), e3.useProgram("hillshadePrepare").draw(l3, c3.TRIANGLES, r3, s3, n3, ii.disabled, io(o4.tileID, d2), null, null, a3.id, e3.rasterBoundsBuffer, e3.quadTriangleIndexBuffer, e3.rasterBoundsSegments), o4.needsHillshadePrepare = false;
            }
          })(e2, i2, a2, o2, c2, ri.disabled, h2), n2.viewport.set([0, 0, e2.width, e2.height]);
          else if ("translucent" === e2.renderPass) if (l2) {
            const [t2, r3, n3] = e2.stencilConfigForOverlapTwoPass(a2);
            Ra(e2, i2, o2, n3, t2, c2, h2, false, s2), Ra(e2, i2, o2, n3, r3, c2, h2, true, s2);
          } else {
            const [t2, r3] = e2.getStencilConfigForOverlapAndUpdateStencilID(a2);
            Ra(e2, i2, o2, r3, t2, c2, h2, false, s2);
          }
        }, colorRelief: function(e2, t2, i2, o2, a2) {
          if ("translucent" !== e2.renderPass) return;
          if (!o2.length) return;
          const { isRenderingToTexture: r2 } = a2, s2 = e2.style.projection.useSubdivision, n2 = e2.getDepthModeForSublayer(0, oi.ReadOnly), l2 = e2.colorModeForRenderPass();
          if (s2) {
            const [a3, s3, c2] = e2.stencilConfigForOverlapTwoPass(o2);
            Aa(e2, t2, i2, c2, a3, n2, l2, false, r2), Aa(e2, t2, i2, c2, s3, n2, l2, true, r2);
          } else {
            const [a3, s3] = e2.getStencilConfigForOverlapAndUpdateStencilID(o2);
            Aa(e2, t2, i2, s3, a3, n2, l2, false, r2);
          }
        }, raster: function(e2, t2, i2, o2, a2) {
          if ("translucent" !== e2.renderPass) return;
          if (0 === i2.paint.get("raster-opacity")) return;
          if (!o2.length) return;
          const { isRenderingToTexture: r2 } = a2, s2 = t2.getSource(), n2 = e2.style.projection.useSubdivision;
          if (s2 instanceof te) Fa(e2, t2, i2, o2, null, false, false, s2.tileCoords, s2.flippedWindingOrder, r2);
          else if (n2) {
            const [a3, s3, n3] = e2.stencilConfigForOverlapTwoPass(o2);
            Fa(e2, t2, i2, n3, a3, false, true, La, false, r2), Fa(e2, t2, i2, n3, s3, true, true, La, false, r2);
          } else {
            const [a3, s3] = e2.getStencilConfigForOverlapAndUpdateStencilID(o2);
            Fa(e2, t2, i2, s3, a3, false, true, La, false, r2);
          }
        }, background: function(e2, t2, i2, o2, a2) {
          var r2;
          const s2 = i2.paint.get("background-color"), n2 = i2.paint.get("background-opacity");
          if (0 === n2) return;
          const { isRenderingToTexture: l2 } = a2, c2 = e2.context, h2 = c2.gl, u2 = e2.style.projection, d2 = e2.transform, _2 = d2.tileSize, p2 = i2.paint.get("background-pattern");
          if (e2.isPatternMissing(p2)) return;
          const m2 = !p2 && 1 === s2.a && 1 === n2 && e2.opaquePassEnabledForLayer() ? "opaque" : "translucent";
          if (e2.renderPass !== m2) return;
          const f2 = ri.disabled, g2 = e2.getDepthModeForSublayer(0, "opaque" === m2 ? oi.ReadWrite : oi.ReadOnly), v2 = e2.colorModeForRenderPass(), x2 = e2.useProgram(p2 ? "backgroundPattern" : "background"), b2 = o2 || Me(d2, { tileSize: _2, terrain: e2.style.map.terrain });
          p2 && (c2.activeTexture.set(h2.TEXTURE0), e2.imageManager.bind(e2.context));
          const y2 = i2.getCrossfadeParameters();
          for (const t3 of b2) {
            const o3 = d2.getProjectionData({ overscaledTileID: t3, applyGlobeMatrix: !l2, applyTerrainMatrix: true }), a3 = p2 ? xo(n2, e2, p2, { tileID: t3, tileSize: _2 }, y2) : vo(n2, s2), m3 = null === (r2 = e2.style.map.terrain) || void 0 === r2 ? void 0 : r2.getTerrainData(t3), b3 = u2.getMeshFromTileID(c2, t3.canonical, false, true, "raster");
            x2.draw(c2, h2.TRIANGLES, g2, f2, v2, ii.backCCW, a3, m3, o3, i2.id, b3.vertexBuffer, b3.indexBuffer, b3.segments);
          }
        }, sky: function(e2, t2) {
          const i2 = e2.context, o2 = i2.gl, a2 = ((e3, t3, i3) => {
            const o3 = Math.cos(t3.rollInRadians), a3 = Math.sin(t3.rollInRadians), r3 = ge(t3), s3 = t3.getProjectionData({ overscaledTileID: null, applyGlobeMatrix: true, applyTerrainMatrix: true }).projectionTransition;
            return { u_sky_color: e3.properties.get("sky-color"), u_horizon_color: e3.properties.get("horizon-color"), u_horizon: [(t3.width / 2 - r3 * a3) * i3, (t3.height / 2 + r3 * o3) * i3], u_horizon_normal: [-a3, o3], u_sky_horizon_blend: e3.properties.get("sky-horizon-blend") * t3.height / 2 * i3, u_sky_blend: s3 };
          })(t2, e2.style.map.transform, e2.pixelRatio), r2 = new oi(o2.LEQUAL, oi.ReadWrite, [0, 1]), s2 = ri.disabled, n2 = e2.colorModeForRenderPass(), l2 = e2.useProgram("sky"), c2 = $a(i2, t2);
          l2.draw(i2, o2.TRIANGLES, r2, s2, n2, ii.disabled, a2, null, void 0, "sky", c2.vertexBuffer, c2.indexBuffer, c2.segments);
        }, atmosphere: function(e2, i2, o2) {
          const a2 = e2.context, r2 = a2.gl, s2 = e2.useProgram("atmosphere"), n2 = new oi(r2.LEQUAL, oi.ReadOnly, [0, 1]), l2 = e2.transform, c2 = (function(e3, i3) {
            const o3 = e3.properties.get("position"), a3 = [-o3.x, -o3.y, -o3.z], r3 = t.ap(new Float64Array(16));
            return "map" === e3.properties.get("anchor") && (t.be(r3, r3, i3.rollInRadians), t.bf(r3, r3, -i3.pitchInRadians), t.be(r3, r3, i3.bearingInRadians), t.bf(r3, r3, i3.center.lat * Math.PI / 180), t.bI(r3, r3, -i3.center.lng * Math.PI / 180)), t.cg(a3, a3, r3), a3;
          })(o2, e2.transform), h2 = l2.getProjectionData({ overscaledTileID: null, applyGlobeMatrix: true, applyTerrainMatrix: true }), u2 = i2.properties.get("atmosphere-blend") * h2.projectionTransition;
          if (0 === u2) return;
          const d2 = gi(l2.worldSize, l2.center.lat), _2 = l2.inverseProjectionMatrix, p2 = new Float64Array(4);
          p2[3] = 1, t.aE(p2, p2, l2.modelViewProjectionMatrix), p2[0] /= p2[3], p2[1] /= p2[3], p2[2] /= p2[3], p2[3] = 1, t.aE(p2, p2, _2), p2[0] /= p2[3], p2[1] /= p2[3], p2[2] /= p2[3], p2[3] = 1;
          const m2 = /* @__PURE__ */ ((e3, t2, i3, o3, a3) => ({ u_sun_pos: e3, u_atmosphere_blend: t2, u_globe_position: i3, u_globe_radius: o3, u_inv_proj_matrix: a3 }))(c2, u2, [p2[0], p2[1], p2[2]], d2, _2), f2 = $a(a2, i2);
          s2.draw(a2, r2.TRIANGLES, n2, ri.disabled, ei.alphaBlended, ii.disabled, m2, null, null, "atmosphere", f2.vertexBuffer, f2.indexBuffer, f2.segments);
        }, custom: function(e2, t2, i2, o2) {
          const { isRenderingGlobe: a2 } = o2, r2 = e2.context, s2 = i2.implementation, n2 = e2.style.projection, l2 = e2.transform, c2 = l2.getProjectionDataForCustomLayer(a2), h2 = { farZ: l2.farZ, nearZ: l2.nearZ, fov: l2.fov * Math.PI / 180, modelViewProjectionMatrix: l2.modelViewProjectionMatrix, projectionMatrix: l2.projectionMatrix, shaderData: { variantName: n2.shaderVariantName, vertexShaderPrelude: `const float PI = 3.141592653589793;
uniform mat4 u_projection_matrix;
${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProjectionData: c2 }, u2 = s2.renderingMode ? s2.renderingMode : "2d";
          if ("offscreen" === e2.renderPass) {
            const t3 = s2.prerender;
            t3 && (e2.setCustomLayerDefaults(), r2.setColorMode(e2.colorModeForRenderPass()), t3.call(s2, r2.gl, h2), r2.setDirty(), e2.setBaseState());
          } else if ("translucent" === e2.renderPass) {
            e2.setCustomLayerDefaults(), r2.setColorMode(e2.colorModeForRenderPass()), r2.setStencilMode(ri.disabled);
            const t3 = "3d" === u2 ? e2.getDepthModeFor3D() : e2.getDepthModeForSublayer(0, oi.ReadOnly);
            r2.setDepthMode(t3), s2.render(r2.gl, h2), r2.setDirty(), e2.setBaseState(), r2.bindFramebuffer.set(null);
          }
        }, debug: function(e2, t2, i2) {
          for (const o2 of i2) Wa(e2, t2, o2);
        }, debugPadding: function(e2) {
          const t2 = e2.transform.padding;
          Ua(e2, e2.transform.height - (t2.top || 0), 3, Ba), Ua(e2, t2.bottom || 0, 3, Oa), Ga(e2, t2.left || 0, 3, ja), Ga(e2, e2.transform.width - (t2.right || 0), 3, Na);
          const i2 = e2.transform.centerPoint;
          !(function(e3, t3, i3, o2) {
            Va(e3, t3 - 1, i3 - 10, 2, 20, o2), Va(e3, t3 - 10, i3 - 1, 20, 2, o2);
          })(e2, i2.x, e2.transform.height - i2.y, Za);
        }, terrainDepth: function(e2, i2) {
          const o2 = e2.context, a2 = o2.gl, r2 = e2.transform, s2 = ei.unblended, n2 = new oi(a2.LEQUAL, oi.ReadWrite, [0, 1]), l2 = i2.tileManager.getRenderableTiles(), c2 = e2.useProgram("terrainDepth");
          o2.bindFramebuffer.set(i2.getFramebuffer("depth").framebuffer), o2.viewport.set([0, 0, e2.width / devicePixelRatio, e2.height / devicePixelRatio]), o2.clear({ color: t.bo.transparent, depth: 1 });
          for (const e3 of l2) {
            const t2 = i2.getTerrainMesh(e3.tileID), l3 = i2.getTerrainData(e3.tileID), h2 = r2.getProjectionData({ overscaledTileID: e3.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true }), u2 = { u_ele_delta: i2.getMeshFrameDelta(r2.zoom) };
            c2.draw(o2, a2.TRIANGLES, n2, ri.disabled, s2, ii.backCCW, u2, l3, h2, "terrain", t2.vertexBuffer, t2.indexBuffer, t2.segments);
          }
          o2.bindFramebuffer.set(null), o2.viewport.set([0, 0, e2.width, e2.height]);
        }, terrainCoords: function(e2, i2) {
          const o2 = e2.context, a2 = o2.gl, r2 = e2.transform, s2 = ei.unblended, n2 = new oi(a2.LEQUAL, oi.ReadWrite, [0, 1]), l2 = i2.getCoordsTexture(), c2 = i2.tileManager.getRenderableTiles(), h2 = e2.useProgram("terrainCoords");
          o2.bindFramebuffer.set(i2.getFramebuffer("coords").framebuffer), o2.viewport.set([0, 0, e2.width / devicePixelRatio, e2.height / devicePixelRatio]), o2.clear({ color: t.bo.transparent, depth: 1 }), i2.coordsIndex = [];
          for (const e3 of c2) {
            const t2 = i2.getTerrainMesh(e3.tileID), c3 = i2.getTerrainData(e3.tileID);
            o2.activeTexture.set(a2.TEXTURE0), a2.bindTexture(a2.TEXTURE_2D, l2.texture);
            const u2 = { u_terrain_coords_id: (255 - i2.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: i2.getMeshFrameDelta(r2.zoom) }, d2 = r2.getProjectionData({ overscaledTileID: e3.tileID, applyTerrainMatrix: false, applyGlobeMatrix: true });
            h2.draw(o2, a2.TRIANGLES, n2, ri.disabled, s2, ii.backCCW, u2, c3, d2, "terrain", t2.vertexBuffer, t2.indexBuffer, t2.segments), i2.coordsIndex.push(e3.tileID.key);
          }
          o2.bindFramebuffer.set(null), o2.viewport.set([0, 0, e2.width, e2.height]);
        } };
        class Xa {
          constructor(e2, i2) {
            this.drawFunctions = Ha, this.context = new ca(e2), this.transform = i2, this._tileTextures = {}, this.terrainFacilitator = { depthDirty: true, coordsDirty: false, matrix: t.ap(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = Fe.maxOverzooming + Fe.maxUnderzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new At();
          }
          resize(e2, t2, i2) {
            if (this.width = Math.floor(e2 * i2), this.height = Math.floor(t2 * i2), this.pixelRatio = i2, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (const e3 of this.style._order) this.style._layers[e3].resize();
          }
          setup() {
            const e2 = this.context, i2 = new t.aU();
            i2.emplaceBack(0, 0), i2.emplaceBack(t.a6, 0), i2.emplaceBack(0, t.a6), i2.emplaceBack(t.a6, t.a6), this.tileExtentBuffer = e2.createVertexBuffer(i2, Ot.members), this.tileExtentSegments = t.aV.simpleSegment(0, 0, 4, 2);
            const o2 = new t.aU();
            o2.emplaceBack(0, 0), o2.emplaceBack(t.a6, 0), o2.emplaceBack(0, t.a6), o2.emplaceBack(t.a6, t.a6), this.debugBuffer = e2.createVertexBuffer(o2, Ot.members), this.debugSegments = t.aV.simpleSegment(0, 0, 4, 5);
            const a2 = new t.ch();
            a2.emplaceBack(0, 0, 0, 0), a2.emplaceBack(t.a6, 0, t.a6, 0), a2.emplaceBack(0, t.a6, 0, t.a6), a2.emplaceBack(t.a6, t.a6, t.a6, t.a6), this.rasterBoundsBuffer = e2.createVertexBuffer(a2, Bi.members), this.rasterBoundsSegments = t.aV.simpleSegment(0, 0, 4, 2);
            const r2 = new t.aU();
            r2.emplaceBack(0, 0), r2.emplaceBack(t.a6, 0), r2.emplaceBack(0, t.a6), r2.emplaceBack(t.a6, t.a6), this.rasterBoundsBufferPosOnly = e2.createVertexBuffer(r2, Ot.members), this.rasterBoundsSegmentsPosOnly = t.aV.simpleSegment(0, 0, 4, 5);
            const s2 = new t.aU();
            s2.emplaceBack(0, 0), s2.emplaceBack(1, 0), s2.emplaceBack(0, 1), s2.emplaceBack(1, 1), this.viewportBuffer = e2.createVertexBuffer(s2, Ot.members), this.viewportSegments = t.aV.simpleSegment(0, 0, 4, 2);
            const n2 = new t.ci();
            n2.emplaceBack(0), n2.emplaceBack(1), n2.emplaceBack(3), n2.emplaceBack(2), n2.emplaceBack(0), this.tileBorderIndexBuffer = e2.createIndexBuffer(n2);
            const l2 = new t.aW();
            l2.emplaceBack(1, 0, 2), l2.emplaceBack(1, 2, 3), this.quadTriangleIndexBuffer = e2.createIndexBuffer(l2);
            const c2 = this.context.gl;
            this.stencilClearMode = new ri({ func: c2.ALWAYS, mask: 0 }, 0, 255, c2.ZERO, c2.ZERO, c2.ZERO), this.tileExtentMesh = new Bt(this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);
          }
          clearStencil() {
            const e2 = this.context, i2 = e2.gl;
            this.nextStencilID = 1, this.currentStencilSource = void 0;
            const o2 = t.O();
            t.c7(o2, 0, this.width, this.height, 0, 0, 1), t.S(o2, o2, [i2.drawingBufferWidth, i2.drawingBufferHeight, 0]);
            const a2 = { mainMatrix: o2, tileMercatorCoords: [0, 0, 1, 1], clippingPlane: [0, 0, 0, 0], projectionTransition: 0, fallbackMatrix: o2 };
            this.useProgram("clippingMask", null, true).draw(e2, i2.TRIANGLES, oi.disabled, this.stencilClearMode, ei.disabled, ii.disabled, null, null, a2, "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);
          }
          _renderTileClippingMasks(e2, t2, i2) {
            if (this.currentStencilSource === e2.source || !e2.isTileClipped() || !(null == t2 ? void 0 : t2.length)) return;
            this.currentStencilSource = e2.source, this.nextStencilID + t2.length > 256 && this.clearStencil();
            const o2 = this.context;
            o2.setColorMode(ei.disabled), o2.setDepthMode(oi.disabled);
            const a2 = {};
            for (const e3 of t2) a2[e3.key] = this.nextStencilID++;
            this._renderTileMasks(a2, t2, i2, true), this._renderTileMasks(a2, t2, i2, false), this._tileClippingMaskIDs = a2;
          }
          _renderTileMasks(e2, t2, i2, o2) {
            var a2;
            const r2 = this.context, s2 = r2.gl, n2 = this.style.projection, l2 = this.transform, c2 = this.useProgram("clippingMask");
            for (const h2 of t2) {
              const t3 = e2[h2.key], u2 = null === (a2 = this.style.map.terrain) || void 0 === a2 ? void 0 : a2.getTerrainData(h2), d2 = n2.getMeshFromTileID(this.context, h2.canonical, o2, true, "stencil"), _2 = l2.getProjectionData({ overscaledTileID: h2, applyGlobeMatrix: !i2, applyTerrainMatrix: true });
              c2.draw(r2, s2.TRIANGLES, oi.disabled, new ri({ func: s2.ALWAYS, mask: 0 }, t3, 255, s2.KEEP, s2.KEEP, s2.REPLACE), ei.disabled, i2 ? ii.disabled : ii.backCCW, null, u2, _2, "$clipping", d2.vertexBuffer, d2.indexBuffer, d2.segments);
            }
          }
          _renderTilesDepthBuffer() {
            var e2;
            const t2 = this.context, i2 = t2.gl, o2 = this.style.projection, a2 = this.transform, r2 = this.useProgram("depth"), s2 = this.getDepthModeFor3D(), n2 = Me(a2, { tileSize: a2.tileSize });
            for (const l2 of n2) {
              const n3 = null === (e2 = this.style.map.terrain) || void 0 === e2 ? void 0 : e2.getTerrainData(l2), c2 = o2.getMeshFromTileID(this.context, l2.canonical, true, true, "raster"), h2 = a2.getProjectionData({ overscaledTileID: l2, applyGlobeMatrix: true, applyTerrainMatrix: true });
              r2.draw(t2, i2.TRIANGLES, s2, ri.disabled, ei.disabled, ii.backCCW, null, n3, h2, "$clipping", c2.vertexBuffer, c2.indexBuffer, c2.segments);
            }
          }
          stencilModeFor3D() {
            this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();
            const e2 = this.nextStencilID++, t2 = this.context.gl;
            return new ri({ func: t2.NOTEQUAL, mask: 255 }, e2, 255, t2.KEEP, t2.KEEP, t2.REPLACE);
          }
          stencilModeForClipping(e2) {
            const t2 = this.context.gl;
            return new ri({ func: t2.EQUAL, mask: 255 }, this._tileClippingMaskIDs[e2.key], 0, t2.KEEP, t2.KEEP, t2.REPLACE);
          }
          getStencilConfigForOverlapAndUpdateStencilID(e2) {
            const t2 = this.context.gl, i2 = e2.sort(((e3, t3) => t3.overscaledZ - e3.overscaledZ)), o2 = i2[i2.length - 1].overscaledZ, a2 = i2[0].overscaledZ - o2 + 1;
            if (a2 > 1) {
              this.currentStencilSource = void 0, this.nextStencilID + a2 > 256 && this.clearStencil();
              const e3 = {};
              for (let i3 = 0; i3 < a2; i3++) e3[i3 + o2] = new ri({ func: t2.GEQUAL, mask: 255 }, i3 + this.nextStencilID, 255, t2.KEEP, t2.KEEP, t2.REPLACE);
              return this.nextStencilID += a2, [e3, i2];
            }
            return [{ [o2]: ri.disabled }, i2];
          }
          stencilConfigForOverlapTwoPass(e2) {
            const t2 = this.context.gl, i2 = e2.sort(((e3, t3) => t3.overscaledZ - e3.overscaledZ)), o2 = i2[i2.length - 1].overscaledZ, a2 = i2[0].overscaledZ - o2 + 1;
            if (this.clearStencil(), a2 > 1) {
              const e3 = {}, r2 = {};
              for (let i3 = 0; i3 < a2; i3++) e3[i3 + o2] = new ri({ func: t2.GREATER, mask: 255 }, a2 + 1 + i3, 255, t2.KEEP, t2.KEEP, t2.REPLACE), r2[i3 + o2] = new ri({ func: t2.GREATER, mask: 255 }, 1 + i3, 255, t2.KEEP, t2.KEEP, t2.REPLACE);
              return this.nextStencilID = 2 * a2 + 1, [e3, r2, i2];
            }
            return this.nextStencilID = 3, [{ [o2]: new ri({ func: t2.GREATER, mask: 255 }, 2, 255, t2.KEEP, t2.KEEP, t2.REPLACE) }, { [o2]: new ri({ func: t2.GREATER, mask: 255 }, 1, 255, t2.KEEP, t2.KEEP, t2.REPLACE) }, i2];
          }
          colorModeForRenderPass() {
            const e2 = this.context.gl;
            if (this._showOverdrawInspector) {
              const i2 = 1 / 8;
              return new ei([e2.CONSTANT_COLOR, e2.ONE], new t.bo(i2, i2, i2, 0), [true, true, true, true]);
            }
            return "opaque" === this.renderPass ? ei.unblended : ei.alphaBlended;
          }
          getDepthModeForSublayer(e2, t2, i2) {
            if (!this.opaquePassEnabledForLayer()) return oi.disabled;
            const o2 = 1 - ((1 + this.currentLayer) * this.numSublayers + e2) * this.depthEpsilon;
            return new oi(i2 || this.context.gl.LEQUAL, t2, [o2, o2]);
          }
          getDepthModeFor3D() {
            return new oi(this.context.gl.LEQUAL, oi.ReadWrite, this.depthRangeFor3D);
          }
          opaquePassEnabledForLayer() {
            return this.currentLayer < this.opaquePassCutoff;
          }
          render(e2, i2) {
            var o2, a2, r2;
            this.style = e2, this.options = i2, this.lineAtlas = e2.lineAtlas, this.imageManager = e2.imageManager, this.glyphManager = e2.glyphManager, this.symbolFadeChange = e2.placement.symbolFadeChange(c()), this.imageManager.beginFrame();
            const s2 = this.style._order, n2 = this.style.tileManagers, l2 = {}, h2 = {}, u2 = {}, d2 = { isRenderingToTexture: false, isRenderingGlobe: (null === (o2 = e2.projection) || void 0 === o2 ? void 0 : o2.transitionState) > 0 };
            for (const e3 in n2) {
              const t2 = n2[e3];
              t2.used && t2.prepare(this.context), l2[e3] = t2.getVisibleCoordinates(false), h2[e3] = l2[e3].slice().reverse(), u2[e3] = t2.getVisibleCoordinates(true).reverse();
            }
            this.opaquePassCutoff = 1 / 0;
            for (let e3 = 0; e3 < s2.length; e3++) if (this.style._layers[s2[e3]].is3D()) {
              this.opaquePassCutoff = e3;
              break;
            }
            this.maybeDrawDepth(false), this.renderToTexture && (this.renderToTexture.prepareForRender(this.style, this.transform.zoom), this.opaquePassCutoff = 0), this.renderPass = "offscreen";
            for (const e3 of s2) {
              const t2 = this.style._layers[e3];
              if (!t2.hasOffscreenPass() || t2.isHidden(this.transform.zoom)) continue;
              const i3 = h2[t2.source];
              ("custom" === t2.type || i3.length) && this.renderLayer(this, n2[t2.source], t2, i3, d2);
            }
            if (null === (a2 = this.style.projection) || void 0 === a2 || a2.updateGPUdependent({ context: this.context, useProgram: (e3) => this.useProgram(e3) }), this.context.viewport.set([0, 0, this.width, this.height]), this.context.bindFramebuffer.set(null), this.context.clear({ color: i2.showOverdrawInspector ? t.bo.black : t.bo.transparent, depth: 1 }), this.clearStencil(), this.style.sky && this.drawFunctions.sky(this, this.style.sky), this._showOverdrawInspector = i2.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (e2._order.length + 2) * this.numSublayers * this.depthEpsilon], !this.renderToTexture) for (this.renderPass = "opaque", this.currentLayer = s2.length - 1; this.currentLayer >= 0; this.currentLayer--) {
              const e3 = this.style._layers[s2[this.currentLayer]], t2 = n2[e3.source], i3 = l2[e3.source];
              this._renderTileClippingMasks(e3, i3, false), this.renderLayer(this, t2, e3, i3, d2);
            }
            this.renderPass = "translucent";
            let _2 = false;
            for (this.currentLayer = 0; this.currentLayer < s2.length; this.currentLayer++) {
              const e3 = this.style._layers[s2[this.currentLayer]], t2 = n2[e3.source];
              if (null === (r2 = this.renderToTexture) || void 0 === r2 ? void 0 : r2.renderLayer(e3, d2)) continue;
              this.opaquePassEnabledForLayer() || _2 || (_2 = true, d2.isRenderingGlobe && !this.style.map.terrain && this._renderTilesDepthBuffer());
              const i3 = ("symbol" === e3.type ? u2 : h2)[e3.source];
              this._renderTileClippingMasks(e3, l2[e3.source], !!this.renderToTexture), this.renderLayer(this, t2, e3, i3, d2);
            }
            if (d2.isRenderingGlobe && this.drawFunctions.atmosphere(this, this.style.sky, this.style.light), this.options.showTileBoundaries) {
              const e3 = (function(e4, t2) {
                let i3 = null;
                const o3 = Object.values(e4._layers).flatMap(((i4) => i4.source && !i4.isHidden(t2) ? [e4.tileManagers[i4.source]] : [])), a3 = o3.filter(((e5) => "vector" === e5.getSource().type)), r3 = o3.filter(((e5) => "vector" !== e5.getSource().type)), s3 = (e5) => {
                  (!i3 || i3.getSource().maxzoom < e5.getSource().maxzoom) && (i3 = e5);
                };
                for (const e5 of a3) s3(e5);
                if (!i3) for (const e5 of r3) s3(e5);
                return i3;
              })(this.style, this.transform.zoom);
              e3 && this.drawFunctions.debug(this, e3, e3.getVisibleCoordinates());
            }
            this.options.showPadding && this.drawFunctions.debugPadding(this), this.context.setDefault();
          }
          maybeDrawDepth(e2) {
            var i2, o2;
            if (!(null === (o2 = null === (i2 = this.style) || void 0 === i2 ? void 0 : i2.map) || void 0 === o2 ? void 0 : o2.terrain)) return;
            const a2 = this.terrainFacilitator.matrix, r2 = this.transform.modelViewProjectionMatrix;
            let s2 = this.terrainFacilitator.depthDirty;
            s2 || (s2 = e2 ? !t.cj(a2, r2) : !t.ck(a2, r2)), s2 || (s2 = this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)), s2 && (t.cl(a2, r2), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.depthDirty = false, this.terrainFacilitator.coordsDirty = true, this.drawFunctions.terrainDepth(this, this.style.map.terrain));
          }
          maybeDrawCoords() {
            var e2, t2;
            (null === (t2 = null === (e2 = this.style) || void 0 === e2 ? void 0 : e2.map) || void 0 === t2 ? void 0 : t2.terrain) && this.terrainFacilitator.coordsDirty && (this.terrainFacilitator.coordsDirty = false, this.drawFunctions.terrainCoords(this, this.style.map.terrain));
          }
          renderLayer(e2, i2, o2, a2, r2) {
            if (o2.isHidden(this.transform.zoom)) return;
            if ("background" !== o2.type && "custom" !== o2.type && !(a2 || []).length) return;
            this.id = o2.id;
            const s2 = this.drawFunctions;
            t.aQ(o2) ? s2.symbol(e2, i2, o2, a2, this.style.placement.variableOffsets, r2) : t.cm(o2) ? s2.circle(e2, i2, o2, a2, r2) : t.cn(o2) ? s2.heatmap(e2, i2, o2, a2, r2) : t.co(o2) ? s2.line(e2, i2, o2, a2, r2) : t.cp(o2) ? s2.fill(e2, i2, o2, a2, r2) : t.cq(o2) ? s2.fillExtrusion(e2, i2, o2, a2, r2) : t.cr(o2) ? s2.hillshade(e2, i2, o2, a2, r2) : t.cs(o2) ? s2.colorRelief(e2, i2, o2, a2, r2) : t.bU(o2) ? s2.raster(e2, i2, o2, a2, r2) : t.ct(o2) ? s2.background(e2, i2, o2, a2, r2) : t.cu(o2) && s2.custom(e2, i2, o2, r2);
          }
          saveTileTexture(e2) {
            const t2 = this._tileTextures[e2.size[0]];
            t2 ? t2.length < Xa.MAX_TEXTURE_POOL_SIZE_PER_BUCKET ? t2.push(e2) : e2.destroy() : this._tileTextures[e2.size[0]] = [e2];
          }
          getTileTexture(e2) {
            const t2 = this._tileTextures[e2];
            return t2 && t2.length > 0 ? t2.pop() : null;
          }
          isPatternMissing(e2) {
            if (!e2) return false;
            if (!e2.from || !e2.to) return true;
            const t2 = this.imageManager.getPattern(e2.from.toString()), i2 = this.imageManager.getPattern(e2.to.toString());
            return !t2 || !i2;
          }
          useProgram(e2, t2, i2 = false, o2 = []) {
            var a2;
            this.cache || (this.cache = {});
            const r2 = !!this.style.map.terrain, s2 = this.style.projection, n2 = i2 ? Ft.projectionMercator : s2.shaderPreludeCode, l2 = i2 ? jt : s2.shaderDefine, c2 = e2 + (t2 ? t2.cacheKey : "") + `/${i2 ? Nt : s2.shaderVariantName}` + (this._showOverdrawInspector ? "/overdraw" : "") + (r2 ? "/terrain" : "") + (o2 ? `/${o2.join("/")}` : "");
            return (a2 = this.cache)[c2] || (a2[c2] = new Ui(this.context, Ft[e2], t2, yo[e2], this._showOverdrawInspector, r2, n2, l2, o2)), this.cache[c2];
          }
          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 e2 = this.context.gl;
            this.context.cullFace.set(false), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(e2.FUNC_ADD);
          }
          initDebugOverlayCanvas() {
            null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new t.T(this.context, this.debugOverlayCanvas, this.context.gl.RGBA));
          }
          destroy() {
            var e2, t2;
            if (this._tileTextures) {
              for (const e3 in this._tileTextures) {
                const t3 = this._tileTextures[e3];
                if (t3) for (const e4 of t3) e4.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 && (null === (e2 = this.tileExtentMesh.vertexBuffer) || void 0 === e2 || e2.destroy()), this.tileExtentMesh && (null === (t2 = this.tileExtentMesh.indexBuffer) || void 0 === t2 || t2.destroy()), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this.cache) {
              for (const e3 in this.cache) {
                const t3 = this.cache[e3];
                (null == t3 ? void 0 : t3.program) && this.context.gl.deleteProgram(t3.program);
              }
              this.cache = {};
            }
            this.context && this.context.setDefault();
          }
          overLimit() {
            const { drawingBufferWidth: e2, drawingBufferHeight: t2 } = this.context.gl;
            return this.width !== e2 || this.height !== t2;
          }
        }
        function Ka(e2, t2) {
          let i2, o2 = false, a2 = null;
          const r2 = () => {
            a2 = null, o2 && (e2(...i2), a2 = setTimeout(r2, t2), o2 = false);
          };
          return (...e3) => (o2 = true, i2 = e3, a2 || r2(), a2);
        }
        Xa.MAX_TEXTURE_POOL_SIZE_PER_BUCKET = 50;
        class Ya {
          constructor(e2) {
            this._getCurrentHash = () => {
              const e3 = window.location.hash.replace("#", "");
              if (this._hashName) {
                let t2;
                const i2 = e3.split("&").map(((e4) => e4.split("=")));
                for (const e4 of i2) e4[0] === this._hashName && (t2 = e4);
                return (t2 && t2[1] || "").split("/");
              }
              return e3.split("/");
            }, this._onHashChange = () => {
              const e3 = this._getCurrentHash();
              if (!this._isValidHash(e3)) return false;
              const t2 = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(e3[3] || 0) : this._map.getBearing();
              return this._map.jumpTo({ center: [+e3[2], +e3[1]], zoom: +e3[0], bearing: t2, pitch: +(e3[4] || 0) }), true;
            }, this._updateHashUnthrottled = () => {
              const e3 = window.location.href.replace(/(#.*)?$/, this.getHashString());
              window.history.replaceState(window.history.state, null, e3);
            }, this._removeHash = () => {
              const e3 = this._getCurrentHash();
              if (0 === e3.length) return;
              const t2 = e3.join("/");
              let i2 = t2;
              i2.split("&").length > 0 && (i2 = i2.split("&")[0]), this._hashName && (i2 = `${this._hashName}=${t2}`);
              let o2 = window.location.hash.replace(i2, "");
              o2.startsWith("#&") ? o2 = o2.slice(0, 1) + o2.slice(2) : "#" === o2 && (o2 = "");
              let a2 = window.location.href.replace(/(#.+)?$/, o2);
              a2 = a2.replace("&&", "&"), window.history.replaceState(window.history.state, null, a2);
            }, this._updateHash = Ka(this._updateHashUnthrottled, 300), this._hashName = e2 && encodeURIComponent(e2);
          }
          addTo(e2) {
            return this._map = e2, addEventListener("hashchange", this._onHashChange, false), this._map.on("moveend", this._updateHash), this;
          }
          remove() {
            return removeEventListener("hashchange", this._onHashChange, false), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), this._removeHash(), delete this._map, this;
          }
          getHashString(e2) {
            const t2 = this._map.getCenter(), i2 = Math.round(100 * this._map.getZoom()) / 100, o2 = Math.ceil((i2 * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), a2 = Math.pow(10, o2), r2 = Math.round(t2.lng * a2) / a2, s2 = Math.round(t2.lat * a2) / a2, n2 = this._map.getBearing(), l2 = this._map.getPitch();
            let c2 = "";
            if (c2 += e2 ? `/${r2}/${s2}/${i2}` : `${i2}/${s2}/${r2}`, (n2 || l2) && (c2 += "/" + Math.round(10 * n2) / 10), l2 && (c2 += `/${Math.round(l2)}`), this._hashName) {
              const e3 = this._hashName;
              let t3 = false;
              const i3 = window.location.hash.slice(1).split("&").map(((i4) => {
                const o3 = i4.split("=")[0];
                return o3 === e3 ? (t3 = true, `${o3}=${c2}`) : i4;
              })).filter(((e4) => e4));
              return t3 || i3.push(`${e3}=${c2}`), `#${i3.join("&")}`;
            }
            return `#${c2}`;
          }
          _isValidHash(e2) {
            if (e2.length < 3 || e2.some(isNaN)) return false;
            try {
              new t.W(+e2[2], +e2[1]);
            } catch (e3) {
              return false;
            }
            const i2 = +e2[0], o2 = +(e2[3] || 0), a2 = +(e2[4] || 0);
            return i2 >= this._map.getMinZoom() && i2 <= this._map.getMaxZoom() && o2 >= -180 && o2 <= 180 && a2 >= this._map.getMinPitch() && a2 <= this._map.getMaxPitch();
          }
        }
        const Qa = { linearity: 0.3, easing: t.cv(0, 0, 0.3, 1) }, Ja = t.e({ deceleration: 2500, maxSpeed: 1400 }, Qa), er = t.e({ deceleration: 20, maxSpeed: 1400 }, Qa), tr = t.e({ deceleration: 1e3, maxSpeed: 360 }, Qa), ir = t.e({ deceleration: 1e3, maxSpeed: 90 }, Qa), or = t.e({ deceleration: 1e3, maxSpeed: 360 }, Qa);
        class ar {
          constructor(e2) {
            this._map = e2, this.clear();
          }
          clear() {
            this._inertiaBuffer = [];
          }
          record(e2) {
            this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: c(), settings: e2 });
          }
          _drainInertiaBuffer() {
            const e2 = this._inertiaBuffer, t2 = c();
            for (; e2.length > 0 && t2 - e2[0].time > 160; ) e2.shift();
          }
          _onMoveEnd(e2) {
            if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return;
            const i2 = { zoom: 0, bearing: 0, pitch: 0, roll: 0, pan: new t.P(0, 0), pinchAround: void 0, around: void 0 };
            for (const { settings: e3 } of this._inertiaBuffer) i2.zoom += e3.zoomDelta || 0, i2.bearing += e3.bearingDelta || 0, i2.pitch += e3.pitchDelta || 0, i2.roll += e3.rollDelta || 0, e3.panDelta && i2.pan._add(e3.panDelta), e3.around && (i2.around = e3.around), e3.pinchAround && (i2.pinchAround = e3.pinchAround);
            const o2 = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, a2 = {};
            if (i2.pan.mag()) {
              const r2 = sr(i2.pan.mag(), o2, t.e({}, Ja, e2 || {})), s2 = i2.pan.mult(r2.amount / i2.pan.mag()), n2 = this._map.cameraHelper.handlePanInertia(s2, this._map.transform);
              a2.center = n2.easingCenter, a2.offset = n2.easingOffset, rr(a2, r2);
            }
            if (i2.zoom) {
              const e3 = sr(i2.zoom, o2, er);
              a2.zoom = t.cw(this._map.transform.zoom + e3.amount, this._map.getZoomSnap(), e3.amount), rr(a2, e3);
            }
            if (i2.bearing) {
              const e3 = sr(i2.bearing, o2, tr);
              a2.bearing = this._map.transform.bearing + t.al(e3.amount, -179, 179), rr(a2, e3);
            }
            if (i2.pitch) {
              const e3 = sr(i2.pitch, o2, ir);
              a2.pitch = this._map.transform.pitch + e3.amount, rr(a2, e3);
            }
            if (i2.roll) {
              const e3 = sr(i2.roll, o2, or);
              a2.roll = this._map.transform.roll + t.al(e3.amount, -179, 179), rr(a2, e3);
            }
            if (a2.zoom || a2.bearing) {
              const e3 = void 0 === i2.pinchAround ? i2.around : i2.pinchAround;
              a2.around = e3 ? this._map.unproject(e3) : this._map.getCenter();
            }
            return this.clear(), t.e(a2, { noMoveStart: true });
          }
        }
        function rr(e2, t2) {
          (!e2.duration || e2.duration < t2.duration) && (e2.duration = t2.duration, e2.easing = t2.easing);
        }
        function sr(e2, i2, o2) {
          const { maxSpeed: a2, linearity: r2, deceleration: s2 } = o2, n2 = t.al(e2 * r2 / (i2 / 1e3), -a2, a2), l2 = Math.abs(n2) / (s2 * r2);
          return { easing: o2.easing, duration: 1e3 * l2, amount: n2 * (l2 / 2) };
        }
        class nr extends t.n {
          preventDefault() {
            this._defaultPrevented = true;
          }
          get defaultPrevented() {
            return this._defaultPrevented;
          }
          constructor(e2, i2, o2, a2 = {}) {
            o2 = o2 instanceof MouseEvent ? o2 : new MouseEvent(e2, o2);
            const r2 = d.mousePos(i2.getCanvas(), o2), s2 = i2.unproject(r2);
            super(e2, t.e({ point: r2, lngLat: s2, originalEvent: o2 }, a2)), this._defaultPrevented = false, this.target = i2;
          }
        }
        class lr extends t.n {
          preventDefault() {
            this._defaultPrevented = true;
          }
          get defaultPrevented() {
            return this._defaultPrevented;
          }
          constructor(e2, i2, o2) {
            const a2 = "touchend" === e2 ? o2.changedTouches : o2.touches, r2 = d.touchPos(i2.getCanvasContainer(), a2), s2 = r2.map(((e3) => i2.unproject(e3))), n2 = r2.reduce(((e3, t2, i3, o3) => e3.add(t2.div(o3.length))), new t.P(0, 0));
            super(e2, { points: r2, point: n2, lngLats: s2, lngLat: i2.unproject(n2), originalEvent: o2 }), this._defaultPrevented = false;
          }
        }
        class cr extends t.n {
          preventDefault() {
            this._defaultPrevented = true;
          }
          get defaultPrevented() {
            return this._defaultPrevented;
          }
          constructor(e2, t2, i2) {
            super(e2, { originalEvent: i2 }), this._defaultPrevented = false;
          }
        }
        class hr {
          constructor(e2, t2) {
            this._map = e2, this._clickTolerance = t2.clickTolerance;
          }
          reset() {
            delete this._mousedownPos;
          }
          wheel(e2) {
            return this._firePreventable(new cr(e2.type, this._map, e2));
          }
          mousedown(e2, t2) {
            return this._mousedownPos = t2, this._firePreventable(new nr(e2.type, this._map, e2));
          }
          mouseup(e2) {
            this._map.fire(new nr(e2.type, this._map, e2));
          }
          click(e2, t2) {
            this._mousedownPos && this._mousedownPos.dist(t2) >= this._clickTolerance || this._map.fire(new nr(e2.type, this._map, e2));
          }
          dblclick(e2) {
            return this._firePreventable(new nr(e2.type, this._map, e2));
          }
          mouseover(e2) {
            this._map.fire(new nr(e2.type, this._map, e2));
          }
          mouseout(e2) {
            this._map.fire(new nr(e2.type, this._map, e2));
          }
          touchstart(e2) {
            return this._firePreventable(new lr(e2.type, this._map, e2));
          }
          touchmove(e2) {
            this._map.fire(new lr(e2.type, this._map, e2));
          }
          touchend(e2) {
            this._map.fire(new lr(e2.type, this._map, e2));
          }
          touchcancel(e2) {
            this._map.fire(new lr(e2.type, this._map, e2));
          }
          _firePreventable(e2) {
            if (this._map.fire(e2), e2.defaultPrevented) return {};
          }
          isEnabled() {
            return true;
          }
          isActive() {
            return false;
          }
          enable() {
          }
          disable() {
          }
        }
        class ur {
          constructor(e2) {
            this._map = e2;
          }
          reset() {
            this._delayContextMenu = false, this._ignoreContextMenu = true, delete this._contextMenuEvent;
          }
          mousemove(e2) {
            this._map.fire(new nr(e2.type, this._map, e2));
          }
          mousedown() {
            this._delayContextMenu = true, this._ignoreContextMenu = false;
          }
          mouseup() {
            this._delayContextMenu = false, this._contextMenuEvent && (this._map.fire(new nr("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);
          }
          contextmenu(e2) {
            this._delayContextMenu ? this._contextMenuEvent = e2 : this._ignoreContextMenu || this._map.fire(new nr(e2.type, this._map, e2)), this._map.listens("contextmenu") && e2.preventDefault();
          }
          isEnabled() {
            return true;
          }
          isActive() {
            return false;
          }
          enable() {
          }
          disable() {
          }
        }
        class dr {
          constructor(e2) {
            this._map = e2;
          }
          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(e2) {
            return this.transform.screenPointToLocation(t.P.convert(e2), this._map.terrain);
          }
        }
        class _r {
          constructor(e2, t2) {
            this._map = e2, this._tr = new dr(e2), this._el = e2.getCanvasContainer(), this._container = e2.getContainer(), this._clickTolerance = t2.clickTolerance || 1, t2.boxZoom && "object" == typeof t2.boxZoom && (this._boxZoomEnd = t2.boxZoom.boxZoomEnd);
          }
          isEnabled() {
            return !!this._enabled;
          }
          isActive() {
            return !!this._active;
          }
          enable() {
            this.isEnabled() || (this._enabled = true);
          }
          disable() {
            this.isEnabled() && (this._enabled = false);
          }
          mousedown(e2, t2) {
            this.isEnabled() && e2.shiftKey && 0 === e2.button && (d.disableDrag(), this._startPos = this._lastPos = t2, this._active = true);
          }
          mousemoveWindow(e2, t2) {
            if (!this._active) return;
            const i2 = t2;
            if (this._lastPos.equals(i2) || !this._box && i2.dist(this._startPos) < this._clickTolerance) return;
            const o2 = this._startPos;
            this._lastPos = i2, this._box || (this._box = d.create("div", "maplibregl-boxzoom", this._container), this._container.classList.add("maplibregl-crosshair"), this._fireEvent("boxzoomstart", e2));
            const a2 = Math.min(o2.x, i2.x), r2 = Math.max(o2.x, i2.x), s2 = Math.min(o2.y, i2.y), n2 = Math.max(o2.y, i2.y);
            this._box.style.transform = `translate(${a2}px,${s2}px)`, this._box.style.width = r2 - a2 + "px", this._box.style.height = n2 - s2 + "px";
          }
          mouseupWindow(e2, i2) {
            if (!this._active) return;
            if (0 !== e2.button) return;
            const o2 = this._startPos, a2 = i2;
            if (this.reset(), d.suppressClick(), o2.x !== a2.x || o2.y !== a2.y) return this._map.fire(new t.n("boxzoomend", { originalEvent: e2 })), this._boxZoomEnd ? void this._boxZoomEnd(this._map, o2, a2, e2) : { cameraAnimation: (e3) => e3.fitScreenCoordinates(o2, a2, this._tr.bearing, { linear: true }) };
            this._fireEvent("boxzoomcancel", e2);
          }
          keydown(e2) {
            this._active && 27 === e2.keyCode && (this.reset(), this._fireEvent("boxzoomcancel", e2));
          }
          reset() {
            this._active = false, this._container.classList.remove("maplibregl-crosshair"), this._box && (this._box.remove(), this._box = null), d.enableDrag(), delete this._startPos, delete this._lastPos;
          }
          _fireEvent(e2, i2) {
            return this._map.fire(new t.n(e2, { originalEvent: i2 }));
          }
        }
        function pr(e2, t2) {
          if (e2.length !== t2.length) throw new Error(`The number of touches and points are not equal - touches ${e2.length}, points ${t2.length}`);
          const i2 = {};
          for (let o2 = 0; o2 < e2.length; o2++) i2[e2[o2].identifier] = t2[o2];
          return i2;
        }
        class mr {
          constructor(e2) {
            this.reset(), this.numTouches = e2.numTouches;
          }
          reset() {
            delete this.centroid, delete this.startTime, delete this.touches, this.aborted = false;
          }
          touchstart(e2, i2, o2) {
            (this.centroid || o2.length > this.numTouches) && (this.aborted = true), this.aborted || (void 0 === this.startTime && (this.startTime = e2.timeStamp), o2.length === this.numTouches && (this.centroid = (function(e3) {
              const i3 = new t.P(0, 0);
              for (const t2 of e3) i3._add(t2);
              return i3.div(e3.length);
            })(i2), this.touches = pr(o2, i2)));
          }
          touchmove(e2, t2, i2) {
            if (this.aborted || !this.centroid) return;
            const o2 = pr(i2, t2);
            for (const e3 in this.touches) {
              const t3 = o2[e3];
              (!t3 || t3.dist(this.touches[e3]) > 30) && (this.aborted = true);
            }
          }
          touchend(e2, t2, i2) {
            if ((!this.centroid || e2.timeStamp - this.startTime > 500) && (this.aborted = true), 0 === i2.length) {
              const e3 = !this.aborted && this.centroid;
              if (this.reset(), e3) return e3;
            }
          }
        }
        class fr {
          constructor(e2) {
            this.singleTap = new mr(e2), this.numTaps = e2.numTaps, this.reset();
          }
          reset() {
            this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();
          }
          touchstart(e2, t2, i2) {
            this.singleTap.touchstart(e2, t2, i2);
          }
          touchmove(e2, t2, i2) {
            this.singleTap.touchmove(e2, t2, i2);
          }
          touchend(e2, t2, i2) {
            const o2 = this.singleTap.touchend(e2, t2, i2);
            if (o2) {
              const t3 = e2.timeStamp - this.lastTime < 500, i3 = !this.lastTap || this.lastTap.dist(o2) < 30;
              if (t3 && i3 || this.reset(), this.count++, this.lastTime = e2.timeStamp, this.lastTap = o2, this.count === this.numTaps) return this.reset(), o2;
            }
          }
        }
        class gr {
          constructor(e2) {
            this._tr = new dr(e2), this._zoomIn = new fr({ numTouches: 1, numTaps: 2 }), this._zoomOut = new fr({ numTouches: 2, numTaps: 1 }), this.reset();
          }
          reset() {
            this._active = false, this._zoomIn.reset(), this._zoomOut.reset();
          }
          touchstart(e2, t2, i2) {
            this._zoomIn.touchstart(e2, t2, i2), this._zoomOut.touchstart(e2, t2, i2);
          }
          touchmove(e2, t2, i2) {
            this._zoomIn.touchmove(e2, t2, i2), this._zoomOut.touchmove(e2, t2, i2);
          }
          touchend(e2, i2, o2) {
            const a2 = this._zoomIn.touchend(e2, i2, o2), r2 = this._zoomOut.touchend(e2, i2, o2), s2 = this._tr;
            return a2 ? (this._active = true, e2.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (i3) => i3.easeTo({ duration: 300, zoom: t.cw(s2.zoom + 1, i3.getZoomSnap()), around: s2.unproject(a2) }, { originalEvent: e2 }) }) : r2 ? (this._active = true, e2.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (i3) => i3.easeTo({ duration: 300, zoom: t.cw(s2.zoom - 1, i3.getZoomSnap()), around: s2.unproject(r2) }, { originalEvent: e2 }) }) : void 0;
          }
          touchcancel() {
            this.reset();
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
        }
        class vr {
          constructor(e2) {
            this._enabled = !!e2.enable, this._moveStateManager = e2.moveStateManager, this._clickTolerance = e2.clickTolerance || 1, this._moveFunction = e2.move, this._activateOnStart = !!e2.activateOnStart, e2.assignEvents(this), this.reset();
          }
          reset(e2) {
            this._active = false, this._moved = false, delete this._lastPoint, this._moveStateManager.endMove(e2);
          }
          _move(...e2) {
            const t2 = this._moveFunction(...e2);
            if (t2.bearingDelta || t2.pitchDelta || t2.rollDelta || t2.around || t2.panDelta) return this._active = true, t2;
          }
          dragStart(e2, t2) {
            this.isEnabled() && !this._lastPoint && this._moveStateManager.isValidStartEvent(e2) && (this._moveStateManager.startMove(e2), this._lastPoint = Array.isArray(t2) ? t2[0] : t2, this._activateOnStart && this._lastPoint && (this._active = true));
          }
          dragMove(e2, t2) {
            if (!this.isEnabled()) return;
            const i2 = this._lastPoint;
            if (!i2) return;
            if (e2.preventDefault(), !this._moveStateManager.isValidMoveEvent(e2)) return void this.reset(e2);
            const o2 = Array.isArray(t2) ? t2[0] : t2;
            return !this._moved && o2.dist(i2) < this._clickTolerance ? void 0 : (this._moved = true, this._lastPoint = o2, this._move(i2, o2));
          }
          dragEnd(e2) {
            this.isEnabled() && this._lastPoint && this._moveStateManager.isValidEndEvent(e2) && (this._moved && d.suppressClick(), this.reset(e2));
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
          getClickTolerance() {
            return this._clickTolerance;
          }
        }
        const xr = 0, br = 2, yr = { [xr]: 1, [br]: 2 };
        class wr {
          constructor(e2) {
            this._correctEvent = e2.checkCorrectEvent;
          }
          startMove(e2) {
            this._eventButton = e2.button;
          }
          endMove(e2) {
            delete this._eventButton;
          }
          isValidStartEvent(e2) {
            return this._correctEvent(e2);
          }
          isValidMoveEvent(e2) {
            return !(function(e3, t2) {
              const i2 = yr[t2];
              return void 0 === e3.buttons || (e3.buttons & i2) !== i2;
            })(e2, this._eventButton);
          }
          isValidEndEvent(e2) {
            return e2.button === this._eventButton;
          }
        }
        class Tr {
          constructor() {
            this._firstTouch = void 0;
          }
          _isOneFingerTouch(e2) {
            return 1 === e2.targetTouches.length;
          }
          _isSameTouchEvent(e2) {
            return e2.targetTouches[0].identifier === this._firstTouch;
          }
          startMove(e2) {
            this._firstTouch = e2.targetTouches[0].identifier;
          }
          endMove(e2) {
            delete this._firstTouch;
          }
          isValidStartEvent(e2) {
            return this._isOneFingerTouch(e2);
          }
          isValidMoveEvent(e2) {
            return this._isOneFingerTouch(e2) && this._isSameTouchEvent(e2);
          }
          isValidEndEvent(e2) {
            return this._isOneFingerTouch(e2) && this._isSameTouchEvent(e2);
          }
        }
        class Pr {
          constructor(e2 = new wr({ checkCorrectEvent: () => true }), t2 = new Tr()) {
            this.mouseMoveStateManager = e2, this.oneFingerTouchMoveStateManager = t2;
          }
          _executeRelevantHandler(e2, t2, i2) {
            return e2 instanceof MouseEvent ? t2(e2) : "undefined" != typeof TouchEvent && e2 instanceof TouchEvent ? i2(e2) : void 0;
          }
          startMove(e2) {
            this._executeRelevantHandler(e2, ((e3) => {
              this.mouseMoveStateManager.startMove(e3);
            }), ((e3) => {
              this.oneFingerTouchMoveStateManager.startMove(e3);
            }));
          }
          endMove(e2) {
            this._executeRelevantHandler(e2, ((e3) => {
              this.mouseMoveStateManager.endMove(e3);
            }), ((e3) => {
              this.oneFingerTouchMoveStateManager.endMove(e3);
            }));
          }
          isValidStartEvent(e2) {
            return this._executeRelevantHandler(e2, ((e3) => this.mouseMoveStateManager.isValidStartEvent(e3)), ((e3) => this.oneFingerTouchMoveStateManager.isValidStartEvent(e3)));
          }
          isValidMoveEvent(e2) {
            return this._executeRelevantHandler(e2, ((e3) => this.mouseMoveStateManager.isValidMoveEvent(e3)), ((e3) => this.oneFingerTouchMoveStateManager.isValidMoveEvent(e3)));
          }
          isValidEndEvent(e2) {
            return this._executeRelevantHandler(e2, ((e3) => this.mouseMoveStateManager.isValidEndEvent(e3)), ((e3) => this.oneFingerTouchMoveStateManager.isValidEndEvent(e3)));
          }
        }
        const Cr = (e2) => {
          e2.mousedown = e2.dragStart, e2.mousemoveWindow = e2.dragMove, e2.mouseup = e2.dragEnd, e2.contextmenu = (e3) => {
            e3.preventDefault();
          };
        };
        class Mr {
          constructor(e2, t2) {
            this._clickTolerance = e2.clickTolerance || 1, this._map = t2, this.reset();
          }
          reset() {
            this._active = false, this._touches = {}, this._sum = new t.P(0, 0);
          }
          _shouldBePrevented(e2) {
            return e2 < (this._map.cooperativeGestures.isEnabled() ? 2 : 1);
          }
          touchstart(e2, t2, i2) {
            return this._calculateTransform(e2, t2, i2);
          }
          touchmove(e2, t2, i2) {
            if (this._active) {
              if (!this._shouldBePrevented(i2.length)) return e2.preventDefault(), this._calculateTransform(e2, t2, i2);
              this._map.cooperativeGestures.notifyGestureBlocked("touch_pan", e2);
            }
          }
          touchend(e2, t2, i2) {
            this._calculateTransform(e2, t2, i2), this._active && this._shouldBePrevented(i2.length) && this.reset();
          }
          touchcancel() {
            this.reset();
          }
          _calculateTransform(e2, i2, o2) {
            o2.length > 0 && (this._active = true);
            const a2 = pr(o2, i2), r2 = new t.P(0, 0), s2 = new t.P(0, 0);
            let n2 = 0;
            for (const e3 in a2) {
              const t2 = a2[e3], i3 = this._touches[e3];
              i3 && (r2._add(t2), s2._add(t2.sub(i3)), n2++, a2[e3] = t2);
            }
            if (this._touches = a2, this._shouldBePrevented(n2) || !s2.mag()) return;
            const l2 = s2.div(n2);
            return this._sum._add(l2), this._sum.mag() < this._clickTolerance ? void 0 : { around: r2.div(n2), panDelta: l2 };
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
        }
        class Ir {
          constructor() {
            this.reset();
          }
          reset() {
            this._active = false, delete this._firstTwoTouches;
          }
          touchstart(e2, t2, i2) {
            this._firstTwoTouches || i2.length < 2 || (this._firstTwoTouches = [i2[0].identifier, i2[1].identifier], this._start([t2[0], t2[1]]));
          }
          touchmove(e2, t2, i2) {
            if (!this._firstTwoTouches) return;
            e2.preventDefault();
            const [o2, a2] = this._firstTwoTouches, r2 = Er(i2, t2, o2), s2 = Er(i2, t2, a2);
            if (!r2 || !s2) return;
            const n2 = this._aroundCenter ? null : r2.add(s2).div(2);
            return this._move([r2, s2], n2, e2);
          }
          touchend(e2, t2, i2) {
            if (!this._firstTwoTouches) return;
            const [o2, a2] = this._firstTwoTouches, r2 = Er(i2, t2, o2), s2 = Er(i2, t2, a2);
            r2 && s2 || (this._active && d.suppressClick(), this.reset());
          }
          touchcancel() {
            this.reset();
          }
          enable(e2) {
            this._enabled = true, this._aroundCenter = !!e2 && "center" === e2.around;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return !!this._enabled;
          }
          isActive() {
            return !!this._active;
          }
        }
        function Er(e2, t2, i2) {
          for (let o2 = 0; o2 < e2.length; o2++) if (e2[o2].identifier === i2) return t2[o2];
        }
        function Sr(e2, t2) {
          return Math.log(e2 / t2) / Math.LN2;
        }
        class zr extends Ir {
          constructor() {
            super(), this._zoomRate = 1, this._zoomThreshold = 0.1;
          }
          setZoomRate(e2) {
            this._zoomRate = null != e2 ? e2 : 1;
          }
          setZoomThreshold(e2) {
            this._zoomThreshold = null != e2 ? e2 : 0.1;
          }
          reset() {
            super.reset(), delete this._distance, delete this._startDistance;
          }
          _start(e2) {
            this._startDistance = this._distance = e2[0].dist(e2[1]);
          }
          _move(e2, t2) {
            const i2 = this._distance;
            if (this._distance = e2[0].dist(e2[1]), this._active || !(Math.abs(Sr(this._distance, this._startDistance)) < this._zoomThreshold)) return this._active = true, { zoomDelta: Sr(this._distance, i2) * this._zoomRate, pinchAround: t2 };
          }
        }
        function Rr(e2, t2) {
          return 180 * e2.angleWith(t2) / Math.PI;
        }
        class Dr extends Ir {
          reset() {
            super.reset(), delete this._minDiameter, delete this._startVector, delete this._vector;
          }
          _start(e2) {
            this._startVector = this._vector = e2[0].sub(e2[1]), this._minDiameter = e2[0].dist(e2[1]);
          }
          _move(e2, t2, i2) {
            const o2 = this._vector;
            if (this._vector = e2[0].sub(e2[1]), this._active || !this._isBelowThreshold(this._vector)) return this._active = true, { bearingDelta: Rr(this._vector, o2), pinchAround: t2 };
          }
          _isBelowThreshold(e2) {
            this._minDiameter = Math.min(this._minDiameter, e2.mag());
            const t2 = 25 / (Math.PI * this._minDiameter) * 360, i2 = Rr(e2, this._startVector);
            return Math.abs(i2) < t2;
          }
        }
        function Ar(e2) {
          return Math.abs(e2.y) > Math.abs(e2.x);
        }
        class Lr extends Ir {
          constructor(e2) {
            super(), this._currentTouchCount = 0, this._map = e2;
          }
          reset() {
            super.reset(), this._valid = void 0, delete this._firstMove, delete this._lastPoints;
          }
          touchstart(e2, t2, i2) {
            super.touchstart(e2, t2, i2), this._currentTouchCount = i2.length;
          }
          _start(e2) {
            this._lastPoints = e2, Ar(e2[0].sub(e2[1])) && (this._valid = false);
          }
          _move(e2, t2, i2) {
            if (this._map.cooperativeGestures.isEnabled() && this._currentTouchCount < 3) return;
            const o2 = e2[0].sub(this._lastPoints[0]), a2 = e2[1].sub(this._lastPoints[1]);
            return this._valid = this.gestureBeginsVertically(o2, a2, i2.timeStamp), this._valid ? (this._lastPoints = e2, this._active = true, { pitchDelta: (o2.y + a2.y) / 2 * -0.5 }) : void 0;
          }
          gestureBeginsVertically(e2, t2, i2) {
            if (void 0 !== this._valid) return this._valid;
            const o2 = e2.mag() >= 2, a2 = t2.mag() >= 2;
            if (!o2 && !a2) return;
            if (!o2 || !a2) return void 0 === this._firstMove && (this._firstMove = i2), i2 - this._firstMove < 100 && void 0;
            const r2 = e2.y > 0 == t2.y > 0;
            return Ar(e2) && Ar(t2) && r2;
          }
        }
        const Fr = { panStep: 100, bearingStep: 15, pitchStep: 10 };
        class kr {
          constructor(e2) {
            this._tr = new dr(e2);
            const t2 = Fr;
            this._panStep = t2.panStep, this._bearingStep = t2.bearingStep, this._pitchStep = t2.pitchStep, this._rotationDisabled = false;
          }
          reset() {
            this._active = false;
          }
          keydown(e2) {
            if (e2.altKey || e2.ctrlKey || e2.metaKey) return;
            let i2 = 0, o2 = 0, a2 = 0, r2 = 0, s2 = 0;
            switch (e2.keyCode) {
              case 61:
              case 107:
              case 171:
              case 187:
                i2 = 1;
                break;
              case 189:
              case 109:
              case 173:
                i2 = -1;
                break;
              case 37:
                e2.shiftKey ? o2 = -1 : (e2.preventDefault(), r2 = -1);
                break;
              case 39:
                e2.shiftKey ? o2 = 1 : (e2.preventDefault(), r2 = 1);
                break;
              case 38:
                e2.shiftKey ? a2 = 1 : (e2.preventDefault(), s2 = -1);
                break;
              case 40:
                e2.shiftKey ? a2 = -1 : (e2.preventDefault(), s2 = 1);
                break;
              default:
                return;
            }
            return this._rotationDisabled && (o2 = 0, a2 = 0), { cameraAnimation: (n2) => {
              const l2 = this._tr;
              n2.easeTo({ duration: 300, easeId: "keyboardHandler", easing: Br, zoom: i2 ? t.cw(l2.zoom + i2 * (e2.shiftKey ? 2 : 1), n2.getZoomSnap()) : l2.zoom, bearing: l2.bearing + o2 * this._bearingStep, pitch: l2.pitch + a2 * this._pitchStep, offset: [-r2 * this._panStep, -s2 * this._panStep], center: l2.center }, { originalEvent: e2 });
            } };
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
          disableRotation() {
            this._rotationDisabled = true;
          }
          enableRotation() {
            this._rotationDisabled = false;
          }
        }
        function Br(e2) {
          return e2 * (2 - e2);
        }
        const Or = 4.000244140625, jr = 1 / 450;
        class Nr {
          constructor(e2, t2) {
            this._onTimeout = (e3) => {
              this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(e3);
            }, this._map = e2, this._tr = new dr(e2), this._triggerRenderFrame = t2, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = jr;
          }
          setZoomRate(e2) {
            this._defaultZoomRate = e2;
          }
          setWheelZoomRate(e2) {
            this._wheelZoomRate = e2;
          }
          isEnabled() {
            return !!this._enabled;
          }
          isActive() {
            return !!this._active || void 0 !== this._finishTimeout;
          }
          isZooming() {
            return !!this._zooming;
          }
          enable(e2) {
            this.isEnabled() || (this._enabled = true, this._aroundCenter = !!e2 && "center" === e2.around);
          }
          disable() {
            this.isEnabled() && (this._enabled = false);
          }
          _shouldBePrevented(e2) {
            return !!this._map.cooperativeGestures.isEnabled() && !(e2.ctrlKey || this._map.cooperativeGestures.isBypassed(e2));
          }
          wheel(e2) {
            if (!this.isEnabled()) return;
            if (this._shouldBePrevented(e2)) return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom", e2);
            let t2 = e2.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * e2.deltaY : e2.deltaY;
            const i2 = c(), o2 = i2 - (this._lastWheelEventTime || 0);
            this._lastWheelEventTime = i2, 0 !== t2 && t2 % Or == 0 ? this._type = "wheel" : 0 !== t2 && Math.abs(t2) < 4 ? this._type = "trackpad" : o2 > 400 ? (this._type = null, this._lastValue = t2, this._timeout = setTimeout(this._onTimeout, 40, e2)) : this._type || (this._type = Math.abs(o2 * t2) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, t2 += this._lastValue)), e2.shiftKey && t2 && (t2 /= 4), this._type && (this._lastWheelEvent = e2, this._delta -= t2, this._active || this._start(e2)), e2.preventDefault();
          }
          _start(e2) {
            if (!this._delta) return;
            this._needsRerender = false, this._active = true, this.isZooming() || (this._zooming = true), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
            const i2 = d.mousePos(this._map.getCanvas(), e2), o2 = this._tr;
            this._aroundPoint = this._aroundCenter ? o2.transform.locationToScreenPoint(t.W.convert(o2.center)) : i2, this._needsRerender || (this._needsRerender = true, this._triggerRenderFrame());
          }
          renderFrame() {
            if (!this._needsRerender) return;
            if (this._needsRerender = false, !this.isActive()) return;
            const e2 = this._tr.transform;
            if ("number" == typeof this._lastExpectedZoom) {
              const t2 = e2.zoom - this._lastExpectedZoom;
              "number" == typeof this._startZoom && (this._startZoom += t2), "number" == typeof this._targetZoom && (this._targetZoom += t2);
            }
            if (0 !== this._delta) {
              const i3 = "wheel" === this._type && Math.abs(this._delta) > Or ? this._wheelZoomRate : this._defaultZoomRate;
              let o3 = 2 / (1 + Math.exp(-Math.abs(this._delta * i3)));
              this._delta < 0 && 0 !== o3 && (o3 = 1 / o3);
              const a3 = "number" != typeof this._targetZoom ? e2.scale : t.ao(this._targetZoom), r3 = e2.applyConstrain(e2.getCameraLngLat(), t.ar(a3 * o3)).zoom, s3 = this._map.getZoomSnap();
              if ("wheel" === this._type && s3 > 0) {
                const i4 = t.cw(e2.zoom, s3);
                this._targetZoom = t.cw(r3, s3, r3 - i4);
              } else this._targetZoom = r3;
              "wheel" === this._type && (this._startZoom = e2.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;
            }
            const i2 = "number" != typeof this._targetZoom ? e2.zoom : this._targetZoom, o2 = this._startZoom, a2 = this._easing;
            let r2, s2 = false;
            if ("wheel" === this._type && o2 && a2) {
              const e3 = c() - this._lastWheelEventTime, n2 = Math.min((e3 + 5) / 200, 1), l2 = a2(n2);
              r2 = t.H.number(o2, i2, l2), n2 < 1 ? this._needsRerender = true : s2 = true;
            } else r2 = i2, s2 = true;
            return this._active = true, s2 && (this._active = false, this._finishTimeout = setTimeout((() => {
              this._zooming = false, this._triggerRenderFrame(), delete this._targetZoom, delete this._lastExpectedZoom, delete this._finishTimeout;
            }), 200)), this._lastExpectedZoom = r2, { noInertia: true, needsRenderFrame: !s2, zoomDelta: r2 - e2.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
          }
          _smoothOutEasing(e2) {
            let i2 = t.cy;
            if (this._prevEase) {
              const e3 = this._prevEase, o2 = (c() - e3.start) / e3.duration, a2 = e3.easing(o2 + 0.01) - e3.easing(o2), r2 = 0.27 / Math.sqrt(a2 * a2 + 1e-4) * 0.01, s2 = Math.sqrt(0.0729 - r2 * r2);
              i2 = t.cv(r2, s2, 0.25, 1);
            }
            return this._prevEase = { start: c(), duration: e2, easing: i2 }, i2;
          }
          reset() {
            this._active = false, this._zooming = false, delete this._targetZoom, delete this._lastExpectedZoom, this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
          }
        }
        class Zr {
          constructor(e2, t2) {
            this._clickZoom = e2, this._tapZoom = t2;
          }
          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 Ur {
          constructor(e2) {
            this._tr = new dr(e2), this.reset();
          }
          reset() {
            this._active = false;
          }
          dblclick(e2, i2) {
            return e2.preventDefault(), { cameraAnimation: (o2) => {
              o2.easeTo({ duration: 300, zoom: t.cw(this._tr.zoom + (e2.shiftKey ? -1 : 1), o2.getZoomSnap()), around: this._tr.unproject(i2) }, { originalEvent: e2 });
            } };
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
        }
        class Gr {
          constructor() {
            this._tap = new fr({ numTouches: 1, numTaps: 1 }), this._zoomRate = 1, this.reset();
          }
          setZoomRate(e2) {
            this._zoomRate = null != e2 ? e2 : 1;
          }
          reset() {
            this._active = false, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();
          }
          touchstart(e2, t2, i2) {
            if (!this._swipePoint) if (this._tapTime) {
              const o2 = t2[0], a2 = e2.timeStamp - this._tapTime < 500, r2 = this._tapPoint.dist(o2) < 30;
              a2 && r2 ? i2.length > 0 && (this._swipePoint = o2, this._swipeTouch = i2[0].identifier) : this.reset();
            } else this._tap.touchstart(e2, t2, i2);
          }
          touchmove(e2, t2, i2) {
            if (this._tapTime) {
              if (this._swipePoint) {
                if (i2[0].identifier !== this._swipeTouch) return;
                const o2 = t2[0], a2 = o2.y - this._swipePoint.y;
                return this._swipePoint = o2, e2.preventDefault(), this._active = true, { zoomDelta: a2 / 128 * this._zoomRate };
              }
            } else this._tap.touchmove(e2, t2, i2);
          }
          touchend(e2, t2, i2) {
            if (this._tapTime) this._swipePoint && 0 === i2.length && this.reset();
            else {
              const o2 = this._tap.touchend(e2, t2, i2);
              o2 && (this._tapTime = e2.timeStamp, this._tapPoint = o2);
            }
          }
          touchcancel() {
            this.reset();
          }
          enable() {
            this._enabled = true;
          }
          disable() {
            this._enabled = false, this.reset();
          }
          isEnabled() {
            return this._enabled;
          }
          isActive() {
            return this._active;
          }
        }
        class Vr {
          constructor(e2, t2, i2) {
            this._el = e2, this._mousePan = t2, this._touchPan = i2;
          }
          enable(e2) {
            this._inertiaOptions = e2 || {}, 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 Wr {
          constructor(e2, t2, i2, o2) {
            this._pitchWithRotate = e2.pitchWithRotate, this._rollEnabled = e2.rollEnabled, this._mouseRotate = t2, this._mousePitch = i2, this._mouseRoll = o2;
          }
          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 qr {
          constructor(e2, t2, i2, o2) {
            this._el = e2, this._touchZoom = t2, this._touchRotate = i2, this._tapDragZoom = o2, this._rotationDisabled = false, this._enabled = true;
          }
          enable(e2) {
            this._touchZoom.enable(e2), this._rotationDisabled || this._touchRotate.enable(e2), 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();
          }
          setZoomRate(e2) {
            this._touchZoom.setZoomRate(e2), this._tapDragZoom.setZoomRate(e2);
          }
          setZoomThreshold(e2) {
            this._touchZoom.setZoomThreshold(e2);
          }
          disableRotation() {
            this._rotationDisabled = true, this._touchRotate.disable();
          }
          enableRotation() {
            this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable();
          }
        }
        class $r {
          constructor(e2, t2) {
            this._bypassKey = navigator.userAgent.includes("Mac") ? "metaKey" : "ctrlKey", this._map = e2, this._options = t2, this._enabled = false;
          }
          isActive() {
            return false;
          }
          reset() {
          }
          _setupUI() {
            if (this._container) return;
            const e2 = this._map.getCanvasContainer();
            e2.classList.add("maplibregl-cooperative-gestures"), this._container = d.create("div", "maplibregl-cooperative-gesture-screen", e2);
            let t2 = this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");
            "metaKey" === this._bypassKey && (t2 = this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));
            const i2 = this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"), o2 = document.createElement("div");
            o2.className = "maplibregl-desktop-message", o2.textContent = t2, this._container.appendChild(o2);
            const a2 = document.createElement("div");
            a2.className = "maplibregl-mobile-message", a2.textContent = i2, this._container.appendChild(a2), this._container.setAttribute("aria-hidden", "true");
          }
          _destroyUI() {
            this._container && (this._container.remove(), this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")), delete this._container;
          }
          enable() {
            this._setupUI(), this._enabled = true;
          }
          disable() {
            this._enabled = false, this._destroyUI();
          }
          isEnabled() {
            return this._enabled;
          }
          isBypassed(e2) {
            return e2[this._bypassKey];
          }
          notifyGestureBlocked(e2, i2) {
            this._enabled && (this._map.fire(new t.n("cooperativegestureprevented", { gestureType: e2, originalEvent: i2 })), this._container.classList.add("maplibregl-show"), setTimeout((() => {
              this._container.classList.remove("maplibregl-show");
            }), 100));
          }
        }
        const Hr = (e2) => e2.zoom || e2.drag || e2.roll || e2.pitch || e2.rotate;
        class Xr extends t.n {
        }
        function Kr(e2) {
          var t2;
          return (null === (t2 = e2.panDelta) || void 0 === t2 ? void 0 : t2.mag()) || e2.zoomDelta || e2.bearingDelta || e2.pitchDelta || e2.rollDelta;
        }
        class Yr {
          get _ownerDocument() {
            var e2;
            return (null === (e2 = this._el) || void 0 === e2 ? void 0 : e2.ownerDocument) || document;
          }
          get _ownerWindow() {
            var e2, t2;
            return (null === (t2 = null === (e2 = this._el) || void 0 === e2 ? void 0 : e2.ownerDocument) || void 0 === t2 ? void 0 : t2.defaultView) || window;
          }
          constructor(e2, i2) {
            this.handleWindowEvent = (e3) => {
              this.handleEvent(e3, `${e3.type}Window`);
            }, this.handleEvent = (e3, i3) => {
              if ("blur" === e3.type) return void this.stop(true);
              this._updatingCamera = true;
              const o3 = "renderFrame" === e3.type ? void 0 : e3, a2 = { needsRenderFrame: false }, r2 = {}, s2 = {};
              for (const { handlerName: n3, handler: l3, allowed: c2 } of this._handlers) {
                if (!l3.isEnabled()) continue;
                let h2;
                if (this._blockedByActive(s2, c2, n3)) l3.reset();
                else if (l3[i3 || e3.type]) {
                  if (t.cz(e3, i3 || e3.type)) {
                    const t2 = d.mousePos(this._map.getCanvas(), e3);
                    h2 = l3[i3 || e3.type](e3, t2);
                  } else if (t.cA(e3, i3 || e3.type)) {
                    const t2 = this._getMapTouches(e3.touches), o4 = d.touchPos(this._map.getCanvas(), t2);
                    h2 = l3[i3 || e3.type](e3, o4, t2);
                  } else t.cB(i3 || e3.type) || (h2 = l3[i3 || e3.type](e3));
                  this.mergeHandlerResult(a2, r2, h2, n3, o3), (null == h2 ? void 0 : h2.needsRenderFrame) && this._triggerRenderFrame();
                }
                (h2 || l3.isActive()) && (s2[n3] = l3);
              }
              const n2 = {};
              for (const e4 in this._previousActiveHandlers) s2[e4] || (n2[e4] = o3);
              this._previousActiveHandlers = s2, (Object.keys(n2).length || Kr(a2)) && (this._changes.push([a2, r2, n2]), this._triggerRenderFrame()), (Object.keys(s2).length || Kr(a2)) && this._map._stop(true), this._updatingCamera = false;
              const { cameraAnimation: l2 } = a2;
              l2 && (this._inertia.clear(), this._fireEvents({}, {}, true), this._changes = [], l2(this._map));
            }, this._map = e2, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new ar(e2), this._bearingSnap = i2.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(i2);
            const o2 = this._el;
            this._listeners = [[o2, "touchstart", { passive: true }], [o2, "touchmove", { passive: false }], [o2, "touchend", void 0], [o2, "touchcancel", void 0], [o2, "mousedown", void 0], [o2, "mousemove", void 0], [o2, "mouseup", void 0], [this._ownerDocument, "mousemove", { capture: true }], [this._ownerDocument, "mouseup", void 0], [o2, "mouseover", void 0], [o2, "mouseout", void 0], [o2, "dblclick", void 0], [o2, "click", void 0], [o2, "keydown", { capture: false }], [o2, "keyup", void 0], [o2, "wheel", { passive: false }], [o2, "contextmenu", void 0], [this._ownerWindow, "blur", void 0]];
            for (const [e3, t2, i3] of this._listeners) e3.addEventListener(t2, e3 === this._ownerDocument ? this.handleWindowEvent : this.handleEvent, i3);
          }
          destroy() {
            for (const [e2, t2, i2] of this._listeners) e2.removeEventListener(t2, e2 === this._ownerDocument ? this.handleWindowEvent : this.handleEvent, i2);
          }
          _addDefaultHandlers(e2) {
            const i2 = this._map, o2 = i2.getCanvasContainer();
            this._add("mapEvent", new hr(i2, e2));
            const a2 = i2.boxZoom = new _r(i2, e2);
            this._add("boxZoom", a2), e2.interactive && e2.boxZoom && a2.enable();
            const r2 = i2.cooperativeGestures = new $r(i2, e2.cooperativeGestures);
            this._add("cooperativeGestures", r2), e2.cooperativeGestures && r2.enable();
            const s2 = new gr(i2), n2 = new Ur(i2);
            i2.doubleClickZoom = new Zr(n2, s2), this._add("tapZoom", s2), this._add("clickZoom", n2), e2.interactive && e2.doubleClickZoom && i2.doubleClickZoom.enable();
            const l2 = new Gr();
            this._add("tapDragZoom", l2);
            const c2 = i2.touchPitch = new Lr(i2);
            this._add("touchPitch", c2), e2.interactive && e2.touchPitch && i2.touchPitch.enable(e2.touchPitch);
            const h2 = () => i2.project(i2.getCenter()), u2 = (function({ enable: e3, clickTolerance: i3, aroundCenter: o3 = true, minPixelCenterThreshold: a3 = 100, rotateDegreesPerPixelMoved: r3 = 0.8 }, s3) {
              const n3 = new wr({ checkCorrectEvent: (e4) => 0 === e4.button && e4.ctrlKey || 2 === e4.button && !e4.ctrlKey });
              return new vr({ clickTolerance: i3, move: (e4, i4) => {
                const n4 = s3();
                if (o3 && Math.abs(n4.y - e4.y) > a3) return { bearingDelta: t.cx(new t.P(e4.x, i4.y), i4, n4) };
                let l3 = (i4.x - e4.x) * r3;
                return o3 && i4.y < n4.y && (l3 = -l3), { bearingDelta: l3 };
              }, moveStateManager: n3, enable: e3, assignEvents: Cr });
            })(e2, h2), d2 = (function({ enable: e3, clickTolerance: t2, pitchDegreesPerPixelMoved: i3 = -0.5 }) {
              const o3 = new wr({ checkCorrectEvent: (e4) => 0 === e4.button && e4.ctrlKey || 2 === e4.button });
              return new vr({ clickTolerance: t2, move: (e4, t3) => ({ pitchDelta: (t3.y - e4.y) * i3 }), moveStateManager: o3, enable: e3, assignEvents: Cr });
            })(e2), _2 = (function({ enable: e3, clickTolerance: t2, rollDegreesPerPixelMoved: i3 = 0.3 }, o3) {
              const a3 = new wr({ checkCorrectEvent: (e4) => 2 === e4.button && e4.ctrlKey });
              return new vr({ clickTolerance: t2, move: (e4, t3) => {
                const a4 = o3();
                let r3 = (t3.x - e4.x) * i3;
                return t3.y < a4.y && (r3 = -r3), { rollDelta: r3 };
              }, moveStateManager: a3, enable: e3, assignEvents: Cr });
            })(e2, h2);
            i2.dragRotate = new Wr(e2, u2, d2, _2), this._add("mouseRotate", u2, ["mousePitch"]), this._add("mousePitch", d2, ["mouseRotate", "mouseRoll"]), this._add("mouseRoll", _2, ["mousePitch"]), e2.interactive && e2.dragRotate && i2.dragRotate.enable();
            const p2 = (function({ enable: e3, clickTolerance: t2 }) {
              const i3 = new wr({ checkCorrectEvent: (e4) => 0 === e4.button && !e4.ctrlKey });
              return new vr({ clickTolerance: t2, move: (e4, t3) => ({ around: t3, panDelta: t3.sub(e4) }), activateOnStart: true, moveStateManager: i3, enable: e3, assignEvents: Cr });
            })(e2), m2 = new Mr(e2, i2);
            i2.dragPan = new Vr(o2, p2, m2), this._add("mousePan", p2), this._add("touchPan", m2, ["touchZoom", "touchRotate"]), e2.interactive && e2.dragPan && i2.dragPan.enable(e2.dragPan);
            const f2 = new Dr(), g2 = new zr();
            i2.touchZoomRotate = new qr(o2, g2, f2, l2), this._add("touchRotate", f2, ["touchPan", "touchZoom"]), this._add("touchZoom", g2, ["touchPan", "touchRotate"]), e2.interactive && e2.touchZoomRotate && i2.touchZoomRotate.enable(e2.touchZoomRotate), this._add("blockableMapEvent", new ur(i2));
            const v2 = i2.scrollZoom = new Nr(i2, (() => this._triggerRenderFrame()));
            this._add("scrollZoom", v2, ["mousePan"]), e2.interactive && e2.scrollZoom && i2.scrollZoom.enable(e2.scrollZoom);
            const x2 = i2.keyboard = new kr(i2);
            this._add("keyboard", x2), e2.interactive && e2.keyboard && i2.keyboard.enable();
          }
          _add(e2, t2, i2) {
            this._handlers.push({ handlerName: e2, handler: t2, allowed: i2 }), this._handlersById[e2] = t2;
          }
          stop(e2) {
            if (!this._updatingCamera) {
              for (const { handler: e3 } of this._handlers) e3.reset();
              this._inertia.clear(), this._fireEvents({}, {}, e2), this._changes = [];
            }
          }
          isActive() {
            for (const { handler: e2 } of this._handlers) if (e2.isActive()) return true;
            return false;
          }
          isZooming() {
            return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
          }
          isRotating() {
            return !!this._eventsInProgress.rotate;
          }
          isMoving() {
            return Boolean(Hr(this._eventsInProgress)) || this.isZooming();
          }
          _blockedByActive(e2, t2, i2) {
            for (const o2 in e2) if (o2 !== i2 && !(null == t2 ? void 0 : t2.includes(o2))) return true;
            return false;
          }
          _getMapTouches(e2) {
            const t2 = [];
            for (const i2 of e2) this._el.contains(i2.target) && t2.push(i2);
            return t2;
          }
          mergeHandlerResult(e2, i2, o2, a2, r2) {
            if (!o2) return;
            t.e(e2, o2);
            const s2 = { handlerName: a2, originalEvent: o2.originalEvent || r2 };
            void 0 !== o2.zoomDelta && (i2.zoom = s2), void 0 !== o2.panDelta && (i2.drag = s2), void 0 !== o2.rollDelta && (i2.roll = s2), void 0 !== o2.pitchDelta && (i2.pitch = s2), void 0 !== o2.bearingDelta && (i2.rotate = s2);
          }
          _applyChanges() {
            const e2 = {}, i2 = {}, o2 = {};
            for (const [a2, r2, s2] of this._changes) a2.panDelta && (e2.panDelta = (e2.panDelta || new t.P(0, 0))._add(a2.panDelta)), a2.zoomDelta && (e2.zoomDelta = (e2.zoomDelta || 0) + a2.zoomDelta), a2.bearingDelta && (e2.bearingDelta = (e2.bearingDelta || 0) + a2.bearingDelta), a2.pitchDelta && (e2.pitchDelta = (e2.pitchDelta || 0) + a2.pitchDelta), a2.rollDelta && (e2.rollDelta = (e2.rollDelta || 0) + a2.rollDelta), void 0 !== a2.around && (e2.around = a2.around), void 0 !== a2.pinchAround && (e2.pinchAround = a2.pinchAround), a2.noInertia && (e2.noInertia = a2.noInertia), t.e(i2, r2), t.e(o2, s2);
            this._updateMapTransform(e2, i2, o2), this._changes = [];
          }
          _updateMapTransform(e2, t2, i2) {
            const o2 = this._map, a2 = o2._getTransformForUpdate(), r2 = o2.terrain;
            if (!(Kr(e2) || r2 && this._terrainMovement)) return void this._fireEvents(t2, i2, true);
            o2._stop(true);
            let { panDelta: s2, zoomDelta: n2, bearingDelta: l2, pitchDelta: c2, rollDelta: h2, around: u2, pinchAround: d2 } = e2;
            void 0 !== d2 && (u2 = d2), u2 || (u2 = o2.transform.centerPoint), r2 && !a2.isPointOnMapSurface(u2) && (u2 = a2.centerPoint);
            const _2 = { panDelta: s2, zoomDelta: n2, rollDelta: h2, pitchDelta: c2, bearingDelta: l2, around: u2 };
            this._map.cameraHelper.useGlobeControls && !a2.isPointOnMapSurface(u2) && (u2 = a2.centerPoint);
            const p2 = u2.distSqr(a2.centerPoint) < 0.01 ? a2.center : a2.screenPointToLocation(s2 ? u2.sub(s2) : u2);
            this._handleMapControls({ terrain: r2, tr: a2, deltasForHelper: _2, preZoomAroundLoc: p2, combinedEventsInProgress: t2, panDelta: s2 }), o2._applyUpdatedTransform(a2), this._map._update(), e2.noInertia || this._inertia.record(e2), this._fireEvents(t2, i2, true);
          }
          _handleMapControls({ terrain: e2, tr: t2, deltasForHelper: i2, preZoomAroundLoc: o2, combinedEventsInProgress: a2, panDelta: r2 }) {
            const s2 = this._map.cameraHelper;
            if (s2.handleMapControlsRollPitchBearingZoom(i2, t2), e2) return s2.useGlobeControls ? (this._terrainMovement || !a2.drag && !a2.zoom || (this._terrainMovement = true, this._map._elevationFreeze = true), void s2.handleMapControlsPan(i2, t2, o2)) : this._terrainMovement || !a2.drag && !a2.zoom ? void (a2.drag && this._terrainMovement && r2 ? t2.setCenter(t2.screenPointToLocation(t2.centerPoint.sub(r2))) : s2.handleMapControlsPan(i2, t2, o2)) : (this._terrainMovement = true, this._map._elevationFreeze = true, void s2.handleMapControlsPan(i2, t2, o2));
            s2.handleMapControlsPan(i2, t2, o2);
          }
          _fireEvents(e2, i2, o2) {
            const a2 = Hr(this._eventsInProgress), r2 = Hr(e2), s2 = {};
            for (const t2 in e2) {
              const { originalEvent: i3 } = e2[t2];
              this._eventsInProgress[t2] || (s2[`${t2}start`] = i3), this._eventsInProgress[t2] = e2[t2];
            }
            !a2 && r2 && this._fireEvent("movestart", r2.originalEvent);
            for (const e3 in s2) this._fireEvent(e3, s2[e3]);
            r2 && this._fireEvent("move", r2.originalEvent);
            for (const t2 in e2) {
              const { originalEvent: i3 } = e2[t2];
              this._fireEvent(t2, i3);
            }
            const l2 = {};
            let c2;
            for (const e3 in this._eventsInProgress) {
              const { handlerName: t2, originalEvent: o3 } = this._eventsInProgress[e3];
              this._handlersById[t2].isActive() || (delete this._eventsInProgress[e3], c2 = i2[t2] || o3, l2[`${e3}end`] = c2);
            }
            for (const e3 in l2) this._fireEvent(e3, l2[e3]);
            const h2 = Hr(this._eventsInProgress), u2 = (a2 || r2) && !h2;
            if (u2 && this._terrainMovement) {
              this._map._elevationFreeze = false, this._terrainMovement = false;
              const e3 = this._map._getTransformForUpdate();
              this._map.getCenterClampedToGround() && e3.recalculateZoomAndCenter(this._map.terrain), this._map._applyUpdatedTransform(e3);
            }
            if (o2 && u2) {
              this._updatingCamera = true;
              const e3 = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i3 = (e4) => 0 !== e4 && -this._bearingSnap < e4 && e4 < this._bearingSnap;
              !e3 || !e3.essential && n.prefersReducedMotion ? (this._map.fire(new t.n("moveend", { originalEvent: c2 })), i3(this._map.getBearing()) && this._map.resetNorth()) : (i3(e3.bearing || this._map.getBearing()) && (e3.bearing = 0), e3.freezeElevation = true, this._map.easeTo(e3, { originalEvent: c2 })), this._updatingCamera = false;
            }
          }
          _fireEvent(e2, i2) {
            this._map.fire(new t.n(e2, i2 ? { originalEvent: i2 } : {}));
          }
          _requestFrame() {
            return this._map.triggerRepaint(), this._map._renderTaskQueue.add(((e2) => {
              delete this._frameId, this.handleEvent(new Xr("renderFrame", { timeStamp: e2 })), this._applyChanges();
            }));
          }
          _triggerRenderFrame() {
            void 0 === this._frameId && (this._frameId = this._requestFrame());
          }
        }
        class Qr extends t.E {
          constructor(e2, t2, i2) {
            super(), this._renderFrameCallback = () => {
              const e3 = Math.min((c() - this._easeStart) / this._easeOptions.duration, 1);
              this._onEaseFrame(this._easeOptions.easing(e3)), e3 < 1 && this._easeFrameId ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();
            }, this._moving = false, this._zooming = false, this.transform = e2, this._bearingSnap = i2.bearingSnap, this._zoomSnap = i2.zoomSnap, this.cameraHelper = t2, this.on("moveend", (() => {
              delete this._requestedCameraState;
            }));
          }
          migrateProjection(e2, t2) {
            e2.apply(this.transform, true), this.transform = e2, this.cameraHelper = t2;
          }
          getCenter() {
            return new t.W(this.transform.center.lng, this.transform.center.lat);
          }
          setCenter(e2, t2) {
            return this.jumpTo({ center: e2 }, t2);
          }
          getCenterElevation() {
            return this.transform.elevation;
          }
          setCenterElevation(e2, t2) {
            return this.jumpTo({ elevation: e2 }, t2), this;
          }
          getCenterClampedToGround() {
            return this._centerClampedToGround;
          }
          setCenterClampedToGround(e2) {
            this._centerClampedToGround = e2;
          }
          panBy(e2, i2, o2) {
            return e2 = t.P.convert(e2).mult(-1), this.panTo(this.transform.center, t.e({ offset: e2 }, i2), o2);
          }
          panTo(e2, i2, o2) {
            return this.easeTo(t.e({ center: e2 }, i2), o2);
          }
          getZoom() {
            return this.transform.zoom;
          }
          setZoom(e2, t2) {
            return this.jumpTo({ zoom: e2 }, t2), this;
          }
          zoomTo(e2, i2, o2) {
            return this.easeTo(t.e({ zoom: e2 }, i2), o2);
          }
          zoomIn(e2, i2) {
            return this.zoomTo(t.cw(this.getZoom() + 1, this._zoomSnap), e2, i2), this;
          }
          zoomOut(e2, i2) {
            return this.zoomTo(t.cw(this.getZoom() - 1, this._zoomSnap), e2, i2), this;
          }
          getVerticalFieldOfView() {
            return this.transform.fov;
          }
          setVerticalFieldOfView(e2, i2) {
            return e2 != this.transform.fov && (this.transform.setFov(e2), this.fire(new t.n("movestart", i2)).fire(new t.n("move", i2)).fire(new t.n("moveend", i2))), this;
          }
          getBearing() {
            return this.transform.bearing;
          }
          setZoomSnap(e2) {
            return this._zoomSnap = e2, this;
          }
          getZoomSnap() {
            return this._zoomSnap;
          }
          setBearing(e2, t2) {
            return this.jumpTo({ bearing: e2 }, t2), this;
          }
          getPadding() {
            return this.transform.padding;
          }
          setPadding(e2, t2) {
            return this.jumpTo({ padding: e2 }, t2), this;
          }
          rotateTo(e2, i2, o2) {
            return this.easeTo(t.e({ bearing: e2 }, i2), o2);
          }
          resetNorth(e2, i2) {
            return this.rotateTo(0, t.e({ duration: 1e3 }, e2), i2), this;
          }
          resetNorthPitch(e2, i2) {
            return this.easeTo(t.e({ bearing: 0, pitch: 0, roll: 0, duration: 1e3 }, e2), i2), this;
          }
          snapToNorth(e2, t2) {
            return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(e2, t2) : this;
          }
          getPitch() {
            return this.transform.pitch;
          }
          setPitch(e2, t2) {
            return this.jumpTo({ pitch: e2 }, t2), this;
          }
          getRoll() {
            return this.transform.roll;
          }
          setRoll(e2, t2) {
            return this.jumpTo({ roll: e2 }, t2), this;
          }
          cameraForBounds(e2, t2) {
            e2 = G.convert(e2).adjustAntiMeridian();
            const i2 = (null == t2 ? void 0 : t2.bearing) || 0;
            return this._cameraForBoxAndBearing(e2.getNorthWest(), e2.getSouthEast(), i2, t2);
          }
          _cameraForBoxAndBearing(e2, i2, o2, a2) {
            const r2 = { top: 0, bottom: 0, right: 0, left: 0 };
            if ("number" == typeof (a2 = t.e({ padding: r2, offset: [0, 0], maxZoom: this.transform.maxZoom }, a2)).padding) {
              const e3 = a2.padding;
              a2.padding = { top: e3, bottom: e3, right: e3, left: e3 };
            }
            const s2 = t.e(r2, a2.padding);
            a2.padding = s2;
            const n2 = this.transform, l2 = new G(e2, i2), c2 = this.cameraHelper.cameraForBoxAndBearing(a2, s2, l2, o2, n2);
            return c2 && this._zoomSnap && (c2.zoom = t.cw(c2.zoom, this._zoomSnap, -1)), c2;
          }
          fitBounds(e2, t2, i2) {
            return this._fitInternal(this.cameraForBounds(e2, t2), t2, i2);
          }
          fitScreenCoordinates(e2, i2, o2, a2, r2) {
            return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e2)), this.transform.screenPointToLocation(t.P.convert(i2)), o2, a2), a2, r2);
          }
          _fitInternal(e2, i2, o2) {
            return e2 ? (delete (i2 = t.e(e2, i2)).padding, i2.linear ? this.easeTo(i2, o2) : this.flyTo(i2, o2)) : this;
          }
          jumpTo(e2, i2) {
            this.stop(), "zoom" in e2 && this._zoomSnap && (e2.zoom = t.cw(e2.zoom, this._zoomSnap));
            const o2 = this._getTransformForUpdate();
            let a2 = false, r2 = false, s2 = false;
            const n2 = o2.zoom;
            this.terrain && o2.setElevation(this.terrain.getElevationForLngLatZoom(e2.center ? t.W.convert(e2.center) : o2.center, e2.zoom || o2.tileZoom)), this.cameraHelper.handleJumpToCenterZoom(o2, e2);
            const l2 = o2.zoom !== n2;
            return "elevation" in e2 && o2.elevation !== +e2.elevation && o2.setElevation(+e2.elevation), "bearing" in e2 && o2.bearing !== +e2.bearing && (a2 = true, o2.setBearing(+e2.bearing)), "pitch" in e2 && o2.pitch !== +e2.pitch && (r2 = true, o2.setPitch(+e2.pitch)), "roll" in e2 && o2.roll !== +e2.roll && (s2 = true, o2.setRoll(+e2.roll)), null == e2.padding || o2.isPaddingEqual(e2.padding) || o2.setPadding(e2.padding), this._applyUpdatedTransform(o2), this.fire(new t.n("movestart", i2)).fire(new t.n("move", i2)), l2 && this.fire(new t.n("zoomstart", i2)).fire(new t.n("zoom", i2)).fire(new t.n("zoomend", i2)), a2 && this.fire(new t.n("rotatestart", i2)).fire(new t.n("rotate", i2)).fire(new t.n("rotateend", i2)), r2 && this.fire(new t.n("pitchstart", i2)).fire(new t.n("pitch", i2)).fire(new t.n("pitchend", i2)), s2 && this.fire(new t.n("rollstart", i2)).fire(new t.n("roll", i2)).fire(new t.n("rollend", i2)), this.fire(new t.n("moveend", i2));
          }
          calculateCameraOptionsFromTo(e2, i2, o2, a2 = 0) {
            const r2 = t.a7.fromLngLat(e2, i2), s2 = t.a7.fromLngLat(o2, a2), n2 = s2.x - r2.x, l2 = s2.y - r2.y, c2 = s2.z - r2.z, h2 = Math.hypot(n2, l2, c2);
            if (0 === h2) throw new Error("Can't calculate camera options with same From and To");
            const u2 = Math.hypot(n2, l2), d2 = t.ar(this.transform.cameraToCenterDistance / h2 / this.transform.tileSize), _2 = 180 * Math.atan2(n2, -l2) / Math.PI;
            let p2 = 180 * Math.acos(u2 / h2) / Math.PI;
            return p2 = c2 < 0 ? 90 - p2 : 90 + p2, { center: s2.toLngLat(), elevation: a2, zoom: d2, pitch: p2, bearing: _2 };
          }
          calculateCameraOptionsFromCameraLngLatAltRotation(e2, t2, i2, o2, a2) {
            const r2 = this.transform.calculateCenterFromCameraLngLatAlt(e2, t2, i2, o2);
            return { center: r2.center, elevation: r2.elevation, zoom: r2.zoom, bearing: i2, pitch: o2, roll: a2 };
          }
          easeTo(e2, i2) {
            this._stop(false, e2.easeId), "zoom" in (e2 = t.e({ offset: [0, 0], duration: 500, easing: t.cy }, e2)) && this._zoomSnap && (e2.zoom = t.cw(e2.zoom, this._zoomSnap)), (false === e2.animate || !e2.essential && n.prefersReducedMotion) && (e2.duration = 0);
            const o2 = this._getTransformForUpdate(), a2 = this.getBearing(), r2 = o2.pitch, s2 = o2.roll, l2 = "bearing" in e2 ? this._normalizeBearing(e2.bearing, a2) : a2, c2 = "pitch" in e2 ? +e2.pitch : r2, h2 = "roll" in e2 ? this._normalizeBearing(e2.roll, s2) : s2, u2 = "padding" in e2 ? e2.padding : o2.padding, d2 = t.P.convert(e2.offset);
            let _2, p2;
            e2.around && (_2 = t.W.convert(e2.around), p2 = o2.locationToScreenPoint(_2));
            const m2 = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching, rolling: this._rolling }, f2 = this.cameraHelper.handleEaseTo(o2, { bearing: l2, pitch: c2, roll: h2, padding: u2, around: _2, aroundPoint: p2, offsetAsPoint: d2, offset: e2.offset, zoom: e2.zoom, center: e2.center });
            return this._rotating || (this._rotating = a2 !== l2), this._pitching || (this._pitching = c2 !== r2), this._rolling || (this._rolling = h2 !== s2), this._padding = !o2.isPaddingEqual(u2), this._zooming || (this._zooming = f2.isZooming), this._easeId = e2.easeId, this._prepareEase(i2, e2.noMoveStart, m2), this.terrain && this._prepareElevation(f2.elevationCenter), this._ease(((t2) => {
              f2.easeFunc(t2), this.terrain && !e2.freezeElevation && this._updateElevation(t2), this._applyUpdatedTransform(o2), this._fireMoveEvents(i2);
            }), ((t2) => {
              this.terrain && e2.freezeElevation && this._finalizeElevation(), this._afterEase(i2, t2);
            }), e2), this;
          }
          _prepareEase(e2, i2, o2 = {}) {
            this._moving = true, i2 || o2.moving || this.fire(new t.n("movestart", e2)), this._zooming && !o2.zooming && this.fire(new t.n("zoomstart", e2)), this._rotating && !o2.rotating && this.fire(new t.n("rotatestart", e2)), this._pitching && !o2.pitching && this.fire(new t.n("pitchstart", e2)), this._rolling && !o2.rolling && this.fire(new t.n("rollstart", e2));
          }
          _prepareElevation(e2) {
            this._elevationCenter = e2, this._elevationStart = this.transform.elevation, this._elevationTarget = this.terrain.getElevationForLngLatZoom(e2, this.transform.tileZoom), this._elevationFreeze = true;
          }
          _updateElevation(e2) {
            void 0 !== this._elevationStart && void 0 !== this._elevationCenter || this._prepareElevation(this.transform.center), this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom));
            const i2 = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
            if (e2 < 1 && i2 !== this._elevationTarget) {
              const t2 = this._elevationTarget - this._elevationStart;
              this._elevationStart += e2 * (t2 - (i2 - (t2 * e2 + this._elevationStart)) / (1 - e2)), this._elevationTarget = i2;
            }
            this.transform.setElevation(t.H.number(this._elevationStart, this._elevationTarget, e2));
          }
          _finalizeElevation() {
            this._elevationFreeze = false, 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(e2) {
            if (!this.terrain && e2.elevation >= 0 && e2.pitch <= 90) return {};
            const t2 = e2.getCameraLngLat(), i2 = e2.getCameraAltitude(), o2 = this.terrain ? this.terrain.getElevationForLngLatZoom(t2, e2.zoom) : 0;
            if (i2 < o2) {
              const i3 = this.calculateCameraOptionsFromTo(t2, o2, e2.center, e2.elevation);
              return { pitch: i3.pitch, zoom: i3.zoom };
            }
            return {};
          }
          _applyUpdatedTransform(e2) {
            const t2 = [];
            if (t2.push(((e3) => this._elevateCameraIfInsideTerrain(e3))), this.transformCameraUpdate && t2.push(((e3) => this.transformCameraUpdate(e3))), !t2.length) return;
            const i2 = e2.clone();
            for (const e3 of t2) {
              const t3 = i2.clone(), { center: o2, zoom: a2, roll: r2, pitch: s2, bearing: n2, elevation: l2 } = e3(t3);
              o2 && t3.setCenter(o2), void 0 !== l2 && t3.setElevation(l2), void 0 !== a2 && t3.setZoom(a2), void 0 !== r2 && t3.setRoll(r2), void 0 !== s2 && t3.setPitch(s2), void 0 !== n2 && t3.setBearing(n2), i2.apply(t3, false);
            }
            this.transform.apply(i2, false);
          }
          _fireMoveEvents(e2) {
            this.fire(new t.n("move", e2)), this._zooming && this.fire(new t.n("zoom", e2)), this._rotating && this.fire(new t.n("rotate", e2)), this._pitching && this.fire(new t.n("pitch", e2)), this._rolling && this.fire(new t.n("roll", e2));
          }
          _afterEase(e2, i2) {
            if (this._easeId && i2 && this._easeId === i2) return;
            delete this._easeId;
            const o2 = this._zooming, a2 = this._rotating, r2 = this._pitching, s2 = this._rolling;
            this._moving = false, this._zooming = false, this._rotating = false, this._pitching = false, this._rolling = false, this._padding = false, o2 && this.fire(new t.n("zoomend", e2)), a2 && this.fire(new t.n("rotateend", e2)), r2 && this.fire(new t.n("pitchend", e2)), s2 && this.fire(new t.n("rollend", e2)), this.fire(new t.n("moveend", e2));
          }
          flyTo(e2, i2) {
            if (!e2.essential && n.prefersReducedMotion) {
              const o3 = t.V(e2, ["center", "zoom", "bearing", "pitch", "roll", "elevation", "padding"]);
              return this.jumpTo(o3, i2);
            }
            this.stop(), "zoom" in (e2 = t.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: t.cy }, e2)) && this._zoomSnap && (e2.zoom = t.cw(e2.zoom, this._zoomSnap));
            const o2 = this._getTransformForUpdate(), a2 = o2.bearing, r2 = o2.pitch, s2 = o2.roll, l2 = o2.padding, c2 = "bearing" in e2 ? this._normalizeBearing(e2.bearing, a2) : a2, h2 = "pitch" in e2 ? +e2.pitch : r2, u2 = "roll" in e2 ? this._normalizeBearing(e2.roll, s2) : s2, d2 = "padding" in e2 ? e2.padding : o2.padding, _2 = t.P.convert(e2.offset);
            let p2 = o2.centerPoint.add(_2);
            const m2 = o2.screenPointToLocation(p2), f2 = this.cameraHelper.handleFlyTo(o2, { bearing: c2, pitch: h2, roll: u2, padding: d2, locationAtOffset: m2, offsetAsPoint: _2, center: e2.center, minZoom: e2.minZoom, zoom: e2.zoom });
            let g2 = e2.curve;
            const v2 = Math.max(o2.width, o2.height), x2 = v2 / f2.scaleOfZoom, b2 = f2.pixelPathLength;
            "number" == typeof f2.scaleOfMinZoom && (g2 = Math.sqrt(v2 / f2.scaleOfMinZoom / b2 * 2));
            const y2 = g2 * g2;
            function w2(e3) {
              const t2 = (x2 * x2 - v2 * v2 + (e3 ? -1 : 1) * y2 * y2 * b2 * b2) / (2 * (e3 ? x2 : v2) * y2 * b2);
              return Math.log(Math.sqrt(t2 * t2 + 1) - t2);
            }
            function T2(e3) {
              return (Math.exp(e3) - Math.exp(-e3)) / 2;
            }
            function P2(e3) {
              return (Math.exp(e3) + Math.exp(-e3)) / 2;
            }
            const C2 = w2(false);
            let M2 = function(e3) {
              return P2(C2) / P2(C2 + g2 * e3);
            }, I2 = function(e3) {
              return v2 * ((P2(C2) * (T2(t2 = C2 + g2 * e3) / P2(t2)) - T2(C2)) / y2) / b2;
              var t2;
            }, E2 = (w2(true) - C2) / g2;
            if (Math.abs(b2) < 2e-6 || !isFinite(E2)) {
              if (Math.abs(v2 - x2) < 1e-6) return this.easeTo(e2, i2);
              const t2 = x2 < v2 ? -1 : 1;
              E2 = Math.abs(Math.log(x2 / v2)) / g2, I2 = () => 0, M2 = (e3) => Math.exp(t2 * g2 * e3);
            }
            return e2.duration = "duration" in e2 ? +e2.duration : 1e3 * E2 / ("screenSpeed" in e2 ? +e2.screenSpeed / g2 : +e2.speed), e2.maxDuration && e2.duration > e2.maxDuration && (e2.duration = 0), this._zooming = true, this._rotating = a2 !== c2, this._pitching = h2 !== r2, this._rolling = u2 !== s2, this._padding = !o2.isPaddingEqual(d2), this._prepareEase(i2, false), this.terrain && this._prepareElevation(f2.targetCenter), this._ease(((n2) => {
              const m3 = n2 * E2, g3 = 1 / M2(m3), v3 = I2(m3);
              this._rotating && o2.setBearing(t.H.number(a2, c2, n2)), this._pitching && o2.setPitch(t.H.number(r2, h2, n2)), this._rolling && o2.setRoll(t.H.number(s2, u2, n2)), this._padding && (o2.interpolatePadding(l2, d2, n2), p2 = o2.centerPoint.add(_2)), f2.easeFunc(n2, g3, v3, p2), this.terrain && !e2.freezeElevation && this._updateElevation(n2), this._applyUpdatedTransform(o2), this._fireMoveEvents(i2);
            }), (() => {
              this.terrain && e2.freezeElevation && this._finalizeElevation(), this._afterEase(i2);
            }), e2), this;
          }
          isEasing() {
            return !!this._easeFrameId;
          }
          stop() {
            return this._stop();
          }
          _stop(e2, t2) {
            var i2;
            if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {
              const e3 = this._onEaseEnd;
              delete this._onEaseEnd, e3.call(this, t2);
            }
            return e2 || null === (i2 = this.handlers) || void 0 === i2 || i2.stop(false), this;
          }
          _ease(e2, t2, i2) {
            false === i2.animate || 0 === i2.duration ? (e2(1), t2()) : (this._easeStart = c(), this._easeOptions = i2, this._onEaseFrame = e2, this._onEaseEnd = t2, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));
          }
          _normalizeBearing(e2, i2) {
            e2 = t.X(e2, -180, 180);
            const o2 = Math.abs(e2 - i2);
            return Math.abs(e2 - 360 - i2) < o2 && (e2 -= 360), Math.abs(e2 + 360 - i2) < o2 && (e2 += 360), e2;
          }
          queryTerrainElevation(e2) {
            return this.terrain ? this.terrain.getElevationForLngLat(t.W.convert(e2), this.transform) : null;
          }
        }
        const Jr = { compact: true, customAttribution: '<a href="https://maplibre.org/" target="_blank">MapLibre</a>' };
        class es {
          constructor(e2 = Jr) {
            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 = (e3) => {
              !e3 || "metadata" !== e3.sourceDataType && "visibility" !== e3.sourceDataType && "style" !== e3.dataType && "terrain" !== e3.type || this._updateAttributions();
            }, this._updateCompact = () => {
              this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false === this._compact ? this._container.setAttribute("open", "") : this._container.classList.contains("maplibregl-compact") || this._container.classList.contains("maplibregl-attrib-empty") || (this._container.setAttribute("open", ""), this._container.classList.add("maplibregl-compact", "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 = e2;
          }
          getDefaultPosition() {
            return "bottom-right";
          }
          onAdd(e2) {
            return this._map = e2, this._compact = this.options.compact, this._container = d.create("details", "maplibregl-ctrl maplibregl-ctrl-attrib"), this._compactButton = d.create("summary", "maplibregl-ctrl-attrib-button", this._container), this._compactButton.addEventListener("click", this._toggleAttribution), this._setElementTitle(this._compactButton, "ToggleAttribution"), this._innerContainer = d.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() {
            this._container.remove(), 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(e2, t2) {
            const i2 = this._map._getUIString(`AttributionControl.${t2}`);
            e2.title = i2, e2.setAttribute("aria-label", i2);
          }
          _updateAttributions() {
            if (!this._map.style) return;
            let e2 = [];
            if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? e2 = e2.concat(this.options.customAttribution.map(((e3) => "string" != typeof e3 ? "" : e3))) : "string" == typeof this.options.customAttribution && e2.push(this.options.customAttribution)), this._map.style.stylesheet) {
              const e3 = this._map.style.stylesheet;
              this.styleOwner = e3.owner, this.styleId = e3.id;
            }
            const t2 = this._map.style.tileManagers;
            for (const i3 in t2) {
              const o2 = t2[i3];
              if (o2.used || o2.usedForTerrain) {
                const t3 = o2.getSource();
                t3.attribution && !e2.includes(t3.attribution) && e2.push(t3.attribution);
              }
            }
            e2 = e2.filter(((e3) => String(e3).trim())), e2.sort(((e3, t3) => e3.length - t3.length)), e2 = e2.filter(((t3, i3) => {
              for (let o2 = i3 + 1; o2 < e2.length; o2++) if (e2[o2].includes(t3)) return false;
              return true;
            }));
            const i2 = e2.join(" | ");
            i2 !== this._attribHTML && (this._attribHTML = i2, e2.length ? (this._innerContainer.innerHTML = d.sanitize(i2), this._container.classList.remove("maplibregl-attrib-empty")) : this._container.classList.add("maplibregl-attrib-empty"), this._updateCompact(), this._editLink = null);
          }
        }
        class ts {
          constructor(e2 = {}) {
            this._updateCompact = () => {
              const e3 = this._container.children;
              if (e3.length) {
                const t2 = e3[0];
                this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? false !== this._compact && t2.classList.add("maplibregl-compact") : t2.classList.remove("maplibregl-compact");
              }
            }, this.options = e2;
          }
          getDefaultPosition() {
            return "bottom-left";
          }
          onAdd(e2) {
            var t2;
            this._map = e2, this._compact = null === (t2 = this.options) || void 0 === t2 ? void 0 : t2.compact, this._container = d.create("div", "maplibregl-ctrl");
            const i2 = d.create("a", "maplibregl-ctrl-logo");
            return i2.target = "_blank", i2.rel = "noopener nofollow", i2.href = "https://maplibre.org/", i2.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), i2.setAttribute("rel", "noopener nofollow"), this._container.appendChild(i2), this._container.style.display = "block", this._map.on("resize", this._updateCompact), this._updateCompact(), this._container;
          }
          onRemove() {
            this._container.remove(), this._map.off("resize", this._updateCompact), this._map = void 0, this._compact = void 0;
          }
        }
        class is {
          constructor() {
            this._queue = [], this._id = 0, this._cleared = false, this._currentlyRunning = false;
          }
          add(e2) {
            const t2 = ++this._id;
            return this._queue.push({ callback: e2, id: t2, cancelled: false }), t2;
          }
          remove(e2) {
            const t2 = this._currentlyRunning, i2 = t2 ? this._queue.concat(t2) : this._queue;
            for (const t3 of i2) if (t3.id === e2) return void (t3.cancelled = true);
          }
          run(e2 = 0) {
            if (this._currentlyRunning) throw new Error("Attempting to run(), but is already running.");
            const t2 = this._currentlyRunning = this._queue;
            this._queue = [];
            for (const i2 of t2) if (!i2.cancelled && (i2.callback(e2), this._cleared)) break;
            this._cleared = false, this._currentlyRunning = false;
          }
          clear() {
            this._currentlyRunning && (this._cleared = true), this._queue = [];
          }
        }
        var os = t.aS([{ name: "a_pos3d", type: "Int16", components: 3 }]);
        class as extends t.E {
          constructor(e2) {
            super(), this._lastTilesetChange = c(), this.tileManager = e2, this._tiles = {}, this._renderableTilesKeys = [], this._sourceTileCache = {}, this.minzoom = 0, this.maxzoom = 22, this.deltaZoom = 1, this.tileSize = e2._source.tileSize * 2 ** this.deltaZoom, e2.usedForTerrain = true, e2.tileSize = this.tileSize;
          }
          destruct() {
            this.tileManager.usedForTerrain = false, this.tileManager.tileSize = null;
          }
          getSource() {
            return this.tileManager._source;
          }
          update(e2, i2) {
            this.tileManager.update(e2, i2), this._renderableTilesKeys = [];
            const o2 = {};
            for (const a2 of Me(e2, { tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: false, terrain: i2, calculateTileZoom: this.tileManager._source.calculateTileZoom })) o2[a2.key] = true, this._renderableTilesKeys.push(a2.key), this._tiles[a2.key] || (a2.terrainRttPosMatrix32f = new Float64Array(16), t.c7(a2.terrainRttPosMatrix32f, 0, t.a6, t.a6, 0, 0, 1), this._tiles[a2.key] = new de(a2, this.tileSize), this._lastTilesetChange = c());
            for (const e3 in this._tiles) o2[e3] || delete this._tiles[e3];
          }
          freeRtt(e2) {
            for (const t2 in this._tiles) {
              const i2 = this._tiles[t2];
              (!e2 || i2.tileID.equals(e2) || i2.tileID.isChildOf(e2) || e2.isChildOf(i2.tileID)) && (i2.rtt = []);
            }
          }
          getRenderableTiles() {
            return this._renderableTilesKeys.map(((e2) => this.getTileByID(e2)));
          }
          getTileByID(e2) {
            return this._tiles[e2];
          }
          getTerrainCoords(e2, t2) {
            return t2 ? this._getTerrainCoordsForTileRanges(e2, t2) : this._getTerrainCoordsForRegularTile(e2);
          }
          _getTerrainCoordsForRegularTile(e2) {
            const i2 = {};
            for (const o2 of this._renderableTilesKeys) {
              const a2 = this._tiles[o2].tileID, r2 = e2.clone(), s2 = t.bj();
              if (a2.canonical.equals(e2.canonical)) t.c7(s2, 0, t.a6, t.a6, 0, 0, 1);
              else if (a2.canonical.isChildOf(e2.canonical)) {
                const i3 = a2.canonical.z - e2.canonical.z, o3 = a2.canonical.x - (a2.canonical.x >> i3 << i3), r3 = a2.canonical.y - (a2.canonical.y >> i3 << i3), n2 = t.a6 >> i3;
                t.c7(s2, 0, n2, n2, 0, 0, 1), t.Q(s2, s2, [-o3 * n2, -r3 * n2, 0]);
              } else {
                if (!e2.canonical.isChildOf(a2.canonical)) continue;
                {
                  const i3 = e2.canonical.z - a2.canonical.z, o3 = e2.canonical.x - (e2.canonical.x >> i3 << i3), r3 = e2.canonical.y - (e2.canonical.y >> i3 << i3), n2 = t.a6 >> i3;
                  t.c7(s2, 0, t.a6, t.a6, 0, 0, 1), t.Q(s2, s2, [o3 * n2, r3 * n2, 0]), t.S(s2, s2, [1 / 2 ** i3, 1 / 2 ** i3, 0]);
                }
              }
              r2.terrainRttPosMatrix32f = new Float32Array(s2), i2[o2] = r2;
            }
            return i2;
          }
          _getTerrainCoordsForTileRanges(e2, i2) {
            const o2 = {};
            for (const a2 of this._renderableTilesKeys) {
              const r2 = this._tiles[a2].tileID;
              if (!this._isWithinTileRanges(r2, i2)) continue;
              const s2 = e2.clone(), n2 = t.bj();
              if (r2.canonical.z === e2.canonical.z) {
                const i3 = e2.canonical.x - r2.canonical.x + e2.wrap * (1 << e2.canonical.z), o3 = e2.canonical.y - r2.canonical.y;
                t.c7(n2, 0, t.a6, t.a6, 0, 0, 1), t.Q(n2, n2, [i3 * t.a6, o3 * t.a6, 0]);
              } else if (r2.canonical.z > e2.canonical.z) {
                const i3 = r2.canonical.z - e2.canonical.z, o3 = r2.canonical.x - (r2.canonical.x >> i3 << i3) + e2.wrap * (1 << r2.canonical.z), a3 = r2.canonical.y - (r2.canonical.y >> i3 << i3), s3 = e2.canonical.x - (r2.canonical.x >> i3), l2 = e2.canonical.y - (r2.canonical.y >> i3), c2 = t.a6 >> i3;
                t.c7(n2, 0, c2, c2, 0, 0, 1), t.Q(n2, n2, [-o3 * c2 + s3 * t.a6, -a3 * c2 + l2 * t.a6, 0]);
              } else {
                const i3 = e2.canonical.z - r2.canonical.z, o3 = e2.canonical.x - (e2.canonical.x >> i3 << i3) + e2.wrap * (1 << e2.canonical.z), a3 = e2.canonical.y - (e2.canonical.y >> i3 << i3), s3 = (e2.canonical.x >> i3) - r2.canonical.x, l2 = (e2.canonical.y >> i3) - r2.canonical.y, c2 = t.a6 << i3;
                t.c7(n2, 0, c2, c2, 0, 0, 1), t.Q(n2, n2, [o3 * t.a6 + s3 * c2, a3 * t.a6 + l2 * c2, 0]);
              }
              s2.terrainRttPosMatrix32f = new Float32Array(n2), o2[a2] = s2;
            }
            return o2;
          }
          getSourceTile(e2, t2) {
            var i2, o2;
            const a2 = this.tileManager._source;
            let r2 = e2.overscaledZ - this.deltaZoom;
            if (r2 > a2.maxzoom && (r2 = a2.maxzoom), r2 < a2.minzoom) return;
            (i2 = this._sourceTileCache)[o2 = e2.key] || (i2[o2] = e2.scaledTo(r2).key);
            let s2 = this.findTileInCaches(this._sourceTileCache[e2.key]);
            if (!(null == s2 ? void 0 : s2.dem) && t2) for (; r2 >= a2.minzoom && !(null == s2 ? void 0 : s2.dem); ) s2 = this.findTileInCaches(e2.scaledTo(r2--).key);
            return s2;
          }
          findTileInCaches(e2) {
            let t2 = this.tileManager.getTileByID(e2);
            return t2 || (t2 = this.tileManager._outOfViewCache.getByKey(e2), t2);
          }
          anyTilesAfterTime(e2 = Date.now()) {
            return this._lastTilesetChange >= e2;
          }
          _isWithinTileRanges(e2, t2) {
            const i2 = t2[e2.canonical.z];
            return !!i2 && (e2.wrap > i2.minWrap || e2.wrap < i2.maxWrap || e2.canonical.x >= i2.minTileXWrapped && e2.canonical.x <= i2.maxTileXWrapped && e2.canonical.y >= i2.minTileY && e2.canonical.y <= i2.maxTileY);
          }
        }
        class rs {
          constructor(e2, t2, i2) {
            this._meshCache = {}, this.painter = e2, this.tileManager = new as(t2), this.options = i2, this.exaggeration = "number" == typeof i2.exaggeration ? i2.exaggeration : 1, this.qualityFactor = 2, this.meshSize = 128, this._demMatrixCache = {}, this.coordsIndex = [], this._coordsTextureSize = 1024;
          }
          destroy() {
            this._fbo && (this._fbo.destroy(), this._fbo = null), this._fboCoordsTexture && (this._fboCoordsTexture.destroy(), this._fboCoordsTexture = null), this._fboDepthTexture && (this._fboDepthTexture.destroy(), this._fboDepthTexture = null), this._emptyDemTexture && (this._emptyDemTexture.destroy(), this._emptyDemTexture = null), this._emptyDepthTexture && (this._emptyDepthTexture.destroy(), this._emptyDepthTexture = null), this._coordsTexture && (this._coordsTexture.destroy(), this._coordsTexture = null);
            for (const e2 in this._meshCache) this._meshCache[e2].destroy();
            this._meshCache = {}, this.tileManager.destruct();
          }
          getDEMElevation(e2, i2, o2, a2 = t.a6) {
            var r2;
            const s2 = e2.normalizeCoordinates(i2, o2, a2);
            if (!s2) return 0;
            const n2 = this.getTerrainData(s2.tileID), l2 = null === (r2 = n2.tile) || void 0 === r2 ? void 0 : r2.dem;
            if (!l2) return 0;
            const c2 = t.cC([], [s2.x / a2 * t.a6, s2.y / a2 * t.a6], n2.u_terrain_matrix), h2 = [c2[0] * l2.dim, c2[1] * l2.dim], u2 = Math.floor(h2[0]), d2 = Math.floor(h2[1]), _2 = h2[0] - u2, p2 = h2[1] - d2;
            return l2.get(u2, d2) * (1 - _2) * (1 - p2) + l2.get(u2 + 1, d2) * _2 * (1 - p2) + l2.get(u2, d2 + 1) * (1 - _2) * p2 + l2.get(u2 + 1, d2 + 1) * _2 * p2;
          }
          getElevationForLngLatZoom(e2, i2) {
            if (!t.cD(i2, e2.wrap())) return 0;
            const { tileID: o2, mercatorX: a2, mercatorY: r2 } = this._getOverscaledTileIDFromLngLatZoom(e2, i2);
            return this.getElevation(o2, a2 % t.a6, r2 % t.a6, t.a6);
          }
          getElevationForLngLat(e2, t2) {
            const i2 = Me(t2, { maxzoom: this.tileManager.maxzoom, minzoom: this.tileManager.minzoom, tileSize: 512, terrain: this });
            let o2 = 0;
            for (const e3 of i2) e3.canonical.z > o2 && (o2 = Math.min(e3.canonical.z, this.tileManager.maxzoom));
            return this.getElevationForLngLatZoom(e2, o2);
          }
          getElevation(e2, i2, o2, a2 = t.a6) {
            return this.getDEMElevation(e2, i2, o2, a2) * this.exaggeration;
          }
          getTerrainData(e2) {
            var i2, o2;
            if (!this._emptyDemTexture) {
              const e3 = this.painter.context, i3 = new t.R({ width: 1, height: 1 }, new Uint8Array(4));
              this._emptyDepthTexture = new t.T(e3, i3, e3.gl.RGBA, { premultiply: false }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new t.T(e3, new t.R({ width: 1, height: 1 }), e3.gl.RGBA, { premultiply: false }), this._emptyDemTexture.bind(e3.gl.NEAREST, e3.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = t.ap([]);
            }
            const a2 = this.tileManager.getSourceTile(e2, true);
            if ((null == a2 ? void 0 : a2.dem) && (!a2.demTexture || a2.needsTerrainPrepare)) {
              const e3 = this.painter.context;
              a2.demTexture = this.painter.getTileTexture(a2.dem.stride), a2.demTexture ? a2.demTexture.update(a2.dem.getPixels(), { premultiply: false }) : a2.demTexture = new t.T(e3, a2.dem.getPixels(), e3.gl.RGBA, { premultiply: false }), a2.demTexture.bind(e3.gl.NEAREST, e3.gl.CLAMP_TO_EDGE), a2.needsTerrainPrepare = false;
            }
            const r2 = a2 && a2.toString() + a2.tileID.key + e2.key;
            if (r2 && !this._demMatrixCache[r2]) {
              const i3 = this.tileManager.getSource().maxzoom;
              let o3 = e2.canonical.z - a2.tileID.canonical.z;
              e2.overscaledZ > e2.canonical.z && (e2.canonical.z >= i3 ? o3 = e2.canonical.z - i3 : t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));
              const s2 = e2.canonical.x - (e2.canonical.x >> o3 << o3), n2 = e2.canonical.y - (e2.canonical.y >> o3 << o3), l2 = t.cE(new Float64Array(16), [1 / (t.a6 << o3), 1 / (t.a6 << o3), 0]);
              t.Q(l2, l2, [s2 * t.a6, n2 * t.a6, 0]), this._demMatrixCache[r2] = { matrix: l2, coord: e2 };
            }
            return { u_depth: 2, u_terrain: 3, u_terrain_dim: (null === (i2 = null == a2 ? void 0 : a2.dem) || void 0 === i2 ? void 0 : i2.dim) || 1, u_terrain_matrix: r2 ? this._demMatrixCache[r2].matrix : this._emptyDemMatrix, u_terrain_unpack: (null === (o2 = null == a2 ? void 0 : a2.dem) || void 0 === o2 ? void 0 : o2.getUnpackVector()) || this._emptyDemUnpack, u_terrain_exaggeration: this.exaggeration, texture: ((null == a2 ? void 0 : a2.demTexture) || this._emptyDemTexture).texture, depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture, tile: a2 };
          }
          getFramebuffer(e2) {
            const i2 = this.painter, o2 = i2.width / devicePixelRatio, a2 = i2.height / devicePixelRatio;
            return !this._fbo || this._fbo.width === o2 && this._fbo.height === a2 || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new t.T(i2.context, { width: o2, height: a2, data: null }, i2.context.gl.RGBA, { premultiply: false }), this._fboCoordsTexture.bind(i2.context.gl.NEAREST, i2.context.gl.CLAMP_TO_EDGE)), this._fboDepthTexture || (this._fboDepthTexture = new t.T(i2.context, { width: o2, height: a2, data: null }, i2.context.gl.RGBA, { premultiply: false }), this._fboDepthTexture.bind(i2.context.gl.NEAREST, i2.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = i2.context.createFramebuffer(o2, a2, true, false), this._fbo.depthAttachment.set(i2.context.createRenderbuffer(i2.context.gl.DEPTH_COMPONENT16, o2, a2))), this._fbo.colorAttachment.set("coords" === e2 ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture), this._fbo;
          }
          getCoordsTexture() {
            const e2 = this.painter.context;
            if (this._coordsTexture) return this._coordsTexture;
            const i2 = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);
            for (let e3 = 0, t2 = 0; e3 < this._coordsTextureSize; e3++) for (let o3 = 0; o3 < this._coordsTextureSize; o3++, t2 += 4) i2[t2 + 0] = 255 & o3, i2[t2 + 1] = 255 & e3, i2[t2 + 2] = o3 >> 8 << 4 | e3 >> 8, i2[t2 + 3] = 0;
            const o2 = new t.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(i2.buffer)), a2 = new t.T(e2, o2, e2.gl.RGBA, { premultiply: false });
            return a2.bind(e2.gl.NEAREST, e2.gl.CLAMP_TO_EDGE), this._coordsTexture = a2, a2;
          }
          pointCoordinate(e2) {
            this.painter.maybeDrawDepth(true), this.painter.maybeDrawCoords();
            const i2 = new Uint8Array(4), o2 = this.painter.context, a2 = o2.gl, r2 = Math.round(e2.x * this.painter.pixelRatio / devicePixelRatio), s2 = Math.round(e2.y * this.painter.pixelRatio / devicePixelRatio), n2 = Math.round(this.painter.height / devicePixelRatio);
            o2.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer), a2.readPixels(r2, n2 - s2 - 1, 1, 1, a2.RGBA, a2.UNSIGNED_BYTE, i2), o2.bindFramebuffer.set(null);
            const l2 = i2[0] + (i2[2] >> 4 << 8), c2 = i2[1] + ((15 & i2[2]) << 8), h2 = this.coordsIndex[255 - i2[3]], u2 = h2 && this.tileManager.getTileByID(h2);
            if (!u2) return null;
            const d2 = this._coordsTextureSize, _2 = (1 << u2.tileID.canonical.z) * d2;
            return new t.a7((u2.tileID.canonical.x * d2 + l2) / _2 + u2.tileID.wrap, (u2.tileID.canonical.y * d2 + c2) / _2, this.getElevation(u2.tileID, l2, c2, d2));
          }
          depthAtPoint(e2) {
            const t2 = new Uint8Array(4), i2 = this.painter.context, o2 = i2.gl;
            return i2.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer), o2.readPixels(e2.x, this.painter.height / devicePixelRatio - e2.y - 1, 1, 1, o2.RGBA, o2.UNSIGNED_BYTE, t2), i2.bindFramebuffer.set(null), (t2[0] / 16777216 + t2[1] / 65536 + t2[2] / 256 + t2[3]) / 256;
          }
          getTerrainMesh(e2) {
            var i2;
            const o2 = (null === (i2 = this.painter.style.projection) || void 0 === i2 ? void 0 : i2.transitionState) > 0, a2 = o2 && 0 === e2.canonical.y, r2 = o2 && e2.canonical.y === (1 << e2.canonical.z) - 1, s2 = `m_${a2 ? "n" : ""}_${r2 ? "s" : ""}`;
            if (this._meshCache[s2]) return this._meshCache[s2];
            const n2 = this.painter.context, l2 = new t.cF(), c2 = new t.aW(), h2 = this.meshSize, u2 = t.a6 / h2, d2 = h2 * h2;
            for (let e3 = 0; e3 <= h2; e3++) for (let t2 = 0; t2 <= h2; t2++) l2.emplaceBack(t2 * u2, e3 * u2, 0);
            for (let e3 = 0; e3 < d2; e3 += h2 + 1) for (let t2 = 0; t2 < h2; t2++) c2.emplaceBack(t2 + e3, h2 + t2 + e3 + 1, h2 + t2 + e3 + 2), c2.emplaceBack(t2 + e3, h2 + t2 + e3 + 2, t2 + e3 + 1);
            const _2 = l2.length, p2 = _2 + (h2 + 1), m2 = (h2 + 1) * h2, f2 = a2 ? t.bq : 0, g2 = a2 ? 0 : 1, v2 = r2 ? t.br : t.a6, x2 = r2 ? 0 : 1;
            for (let e3 = 0; e3 <= h2; e3++) l2.emplaceBack(e3 * u2, f2, g2);
            for (let e3 = 0; e3 <= h2; e3++) l2.emplaceBack(e3 * u2, v2, x2);
            for (let e3 = 0; e3 < h2; e3++) c2.emplaceBack(m2 + e3, p2 + e3, p2 + e3 + 1), c2.emplaceBack(m2 + e3, p2 + e3 + 1, m2 + e3 + 1), c2.emplaceBack(0 + e3, _2 + e3 + 1, _2 + e3), c2.emplaceBack(0 + e3, 0 + e3 + 1, _2 + e3 + 1);
            const b2 = l2.length, y2 = b2 + 2 * (h2 + 1);
            for (const e3 of [0, 1]) for (let i3 = 0; i3 <= h2; i3++) for (const o3 of [0, 1]) l2.emplaceBack(e3 * t.a6, i3 * u2, o3);
            for (let e3 = 0; e3 < 2 * h2; e3 += 2) c2.emplaceBack(b2 + e3, b2 + e3 + 1, b2 + e3 + 3), c2.emplaceBack(b2 + e3, b2 + e3 + 3, b2 + e3 + 2), c2.emplaceBack(y2 + e3, y2 + e3 + 3, y2 + e3 + 1), c2.emplaceBack(y2 + e3, y2 + e3 + 2, y2 + e3 + 3);
            const w2 = new Bt(n2.createVertexBuffer(l2, os.members), n2.createIndexBuffer(c2), t.aV.simpleSegment(0, 0, l2.length, c2.length));
            return this._meshCache[s2] = w2, w2;
          }
          getMeshFrameDelta(e2) {
            return 2 * Math.PI * t.bD / Math.pow(2, Math.max(e2, 0)) / 5;
          }
          getMinTileElevationForLngLatZoom(e2, i2) {
            var o2;
            if (!t.cD(i2, e2.wrap())) return 0;
            const { tileID: a2 } = this._getOverscaledTileIDFromLngLatZoom(e2, i2);
            return null !== (o2 = this.getMinMaxElevation(a2).minElevation) && void 0 !== o2 ? o2 : 0;
          }
          getMinMaxElevation(e2) {
            const t2 = this.getTerrainData(e2).tile, i2 = { minElevation: null, maxElevation: null };
            return (null == t2 ? void 0 : t2.dem) && (i2.minElevation = t2.dem.min * this.exaggeration, i2.maxElevation = t2.dem.max * this.exaggeration), i2;
          }
          _getOverscaledTileIDFromLngLatZoom(e2, i2) {
            const o2 = t.a7.fromLngLat(e2.wrap()), a2 = (1 << i2) * t.a6, r2 = o2.x * a2, s2 = o2.y * a2, n2 = Math.floor(r2 / t.a6), l2 = Math.floor(s2 / t.a6);
            return { tileID: new t.a3(i2, 0, i2, n2, l2), mercatorX: r2, mercatorY: s2 };
          }
        }
        class ss {
          constructor(e2, t2, i2) {
            this._context = e2, this._size = t2, this._tileSize = i2, this._objects = [], this._recentlyUsed = [], this._stamp = 0;
          }
          destruct() {
            for (const e2 of this._objects) e2.texture.destroy(), e2.fbo.destroy();
          }
          _createObject(e2) {
            const i2 = this._context.createFramebuffer(this._tileSize, this._tileSize, true, true), o2 = new t.T(this._context, { width: this._tileSize, height: this._tileSize, data: null }, this._context.gl.RGBA);
            return o2.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), i2.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL, this._tileSize, this._tileSize)), i2.colorAttachment.set(o2.texture), { id: e2, fbo: i2, texture: o2, stamp: -1, inUse: false };
          }
          getObjectForId(e2) {
            return this._objects[e2];
          }
          useObject(e2) {
            e2.inUse = true, this._recentlyUsed = this._recentlyUsed.filter(((t2) => e2.id !== t2)), this._recentlyUsed.push(e2.id);
          }
          stampObject(e2) {
            e2.stamp = ++this._stamp;
          }
          getOrCreateFreeObject() {
            for (const e3 of this._recentlyUsed) if (!this._objects[e3].inUse) return this._objects[e3];
            if (this._objects.length >= this._size) throw new Error("No free RenderPool available, call freeAllObjects() required!");
            const e2 = this._createObject(this._objects.length);
            return this._objects.push(e2), e2;
          }
          freeObject(e2) {
            e2.inUse = false;
          }
          freeAllObjects() {
            for (const e2 of this._objects) this.freeObject(e2);
          }
          isFull() {
            return !(this._objects.length < this._size) && false === this._objects.some(((e2) => !e2.inUse));
          }
        }
        const ns = { background: true, fill: true, line: true, raster: true, hillshade: true, "color-relief": true };
        class ls {
          constructor(e2, t2) {
            this.painter = e2, this.terrain = t2, this.pool = new ss(e2.context, 30, t2.tileManager.tileSize * t2.qualityFactor);
          }
          destruct() {
            this.pool.destruct();
          }
          getTexture(e2) {
            return this.pool.getObjectForId(e2.rtt[this._stacks.length - 1].id).texture;
          }
          prepareForRender(e2, t2) {
            var i2, o2, a2;
            this._stacks = [], this._prevType = null, this._rttTiles = [], this._renderableTiles = this.terrain.tileManager.getRenderableTiles(), this._renderableLayerIds = e2._order.filter(((i3) => !e2._layers[i3].isHidden(t2))), this._coordsAscending = {};
            for (const t3 in e2.tileManagers) {
              this._coordsAscending[t3] = {};
              const i3 = e2.tileManagers[t3].getVisibleCoordinates(), o3 = e2.tileManagers[t3].getSource(), r2 = o3 instanceof te ? o3.terrainTileRanges : null;
              for (const e3 of i3) {
                const i4 = this.terrain.tileManager.getTerrainCoords(e3, r2);
                for (const e4 in i4) (a2 = this._coordsAscending[t3])[e4] || (a2[e4] = []), this._coordsAscending[t3][e4].push(i4[e4]);
              }
            }
            this._rttFingerprints = {};
            for (const t3 of e2._order) {
              const a3 = e2._layers[t3], r2 = a3.source;
              if (ns[a3.type] && !this._rttFingerprints[r2]) {
                this._rttFingerprints[r2] = {};
                const t4 = null !== (o2 = null === (i2 = e2.tileManagers[r2]) || void 0 === i2 ? void 0 : i2.getState().revision) && void 0 !== o2 ? o2 : 0;
                for (const e3 in this._coordsAscending[r2]) this._rttFingerprints[r2][e3] = `${this._coordsAscending[r2][e3].map(((e4) => e4.key)).sort().join()}#${t4}`;
              }
            }
            for (const e3 of this._renderableTiles) for (const t3 in this._rttFingerprints) {
              const i3 = this._rttFingerprints[t3][e3.tileID.key];
              i3 && i3 !== e3.rttFingerprint[t3] && (e3.rtt = []);
            }
          }
          renderLayer(e2, i2) {
            if (e2.isHidden(this.painter.transform.zoom)) return false;
            const o2 = Object.assign(Object.assign({}, i2), { isRenderingToTexture: true }), a2 = e2.type, r2 = this.painter, s2 = this._renderableLayerIds[this._renderableLayerIds.length - 1] === e2.id;
            if (ns[a2] && (this._prevType && ns[this._prevType] || this._stacks.push([]), this._prevType = a2, this._stacks[this._stacks.length - 1].push(e2.id), !s2)) return true;
            if (ns[this._prevType] || ns[a2] && s2) {
              this._prevType = a2;
              const e3 = this._stacks.length - 1, i3 = this._stacks[e3] || [];
              for (const a3 of this._renderableTiles) {
                if (this.pool.isFull() && (qa(this.painter, this.terrain, this._rttTiles, o2), this._rttTiles = [], this.pool.freeAllObjects()), this._rttTiles.push(a3), a3.rtt[e3]) {
                  const t2 = this.pool.getObjectForId(a3.rtt[e3].id);
                  if (t2.stamp === a3.rtt[e3].stamp) {
                    this.pool.useObject(t2);
                    continue;
                  }
                }
                const s3 = this.pool.getOrCreateFreeObject();
                this.pool.useObject(s3), this.pool.stampObject(s3), a3.rtt[e3] = { id: s3.id, stamp: s3.stamp }, r2.context.bindFramebuffer.set(s3.fbo.framebuffer), r2.context.clear({ color: t.bo.transparent, stencil: 0 }), r2.currentStencilSource = void 0;
                for (const e4 of i3) {
                  const t2 = r2.style._layers[e4], i4 = t2.source ? this._coordsAscending[t2.source][a3.tileID.key] : [a3.tileID];
                  r2.context.viewport.set([0, 0, s3.fbo.width, s3.fbo.height]), r2._renderTileClippingMasks(t2, i4, true), r2.renderLayer(r2, r2.style.tileManagers[t2.source], t2, i4, o2), t2.source && (a3.rttFingerprint[t2.source] = this._rttFingerprints[t2.source][a3.tileID.key]);
                }
              }
              return qa(this.painter, this.terrain, this._rttTiles, o2), this._rttTiles = [], this.pool.freeAllObjects(), ns[a2];
            }
            return false;
          }
        }
        const cs = { "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": "Drag to rotate map, click to reset 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 \u2318 + scroll to zoom the map", "CooperativeGesturesHandler.MobileHelpText": "Use two fingers to move the map" }, hs = i, us = { hash: false, interactive: true, bearingSnap: 7, zoomSnap: 0, attributionControl: Jr, maplibreLogo: false, refreshExpiredTiles: true, canvasContextAttributes: { antialias: false, preserveDrawingBuffer: false, powerPreference: "high-performance", failIfMajorPerformanceCaveat: false, desynchronized: false, contextType: void 0 }, scrollZoom: true, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, cooperativeGestures: false, trackResize: true, center: [0, 0], elevation: 0, zoom: 0, bearing: 0, pitch: 0, roll: 0, renderWorldCopies: true, maxTileCacheSize: null, maxTileCacheZoomLevels: t.c.MAX_TILE_CACHE_ZOOM_LEVELS, transformRequest: null, transformCameraUpdate: null, transformConstrain: null, fadeDuration: 300, crossSourceCollisions: true, clickTolerance: 3, localIdeographFontFamily: "sans-serif", pitchWithRotate: true, rollEnabled: false, reduceMotion: void 0, validateStyle: true, maxCanvasSize: [4096, 4096], cancelPendingTileRequestsWhileZooming: true, centerClampedToGround: true, experimentalZoomLevelsToOverscale: void 0, anisotropicFilterPitch: 20 };
        let ds = class extends Qr {
          get _ownerWindow() {
            var e2, t2;
            return (null === (t2 = null === (e2 = this._container) || void 0 === e2 ? void 0 : e2.ownerDocument) || void 0 === t2 ? void 0 : t2.defaultView) || window;
          }
          constructor(e2) {
            var i2, o2, a2;
            const r2 = Object.assign(Object.assign(Object.assign({}, us), e2), { canvasContextAttributes: Object.assign(Object.assign({}, us.canvasContextAttributes), e2.canvasContextAttributes) });
            if (null != r2.minZoom && null != r2.maxZoom && r2.minZoom > r2.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom");
            if (null != r2.minPitch && null != r2.maxPitch && r2.minPitch > r2.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch");
            if (null != r2.minPitch && r2.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0");
            if (null != r2.maxPitch && r2.maxPitch > 180) throw new Error("maxPitch must be less than or equal to 180");
            const s2 = new Xt(), l2 = new Jt();
            void 0 !== r2.minZoom && s2.setMinZoom(r2.minZoom), void 0 !== r2.maxZoom && s2.setMaxZoom(r2.maxZoom), void 0 !== r2.minPitch && s2.setMinPitch(r2.minPitch), void 0 !== r2.maxPitch && s2.setMaxPitch(r2.maxPitch), void 0 !== r2.renderWorldCopies && s2.setRenderWorldCopies(r2.renderWorldCopies), null !== r2.transformConstrain && s2.setConstrainOverride(r2.transformConstrain), super(s2, l2, { bearingSnap: r2.bearingSnap, zoomSnap: r2.zoomSnap }), this._idleTriggered = false, this._crossFadingFactor = 1, this._renderTaskQueue = new is(), this._controls = [], this._mapId = t.ad(), this._lostContextStyle = { style: null, images: null }, this._contextLost = (e3) => {
              if (e3.preventDefault(), this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this.painter.destroy(), this._lostContextStyle = this._getStyleAndImages(), this.style) {
                for (const e4 of Object.values(this.style._layers)) if ("custom" === e4.type && console.warn(`Custom layer with id '${e4.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`), e4._listeners) for (const [t2] of Object.entries(e4._listeners)) console.warn(`Custom layer with id '${e4.id}' had event listeners for event '${t2}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);
                this.style.destroy(), this.style = null, this.fire(new t.n("webglcontextlost", { originalEvent: e3 }));
              } else this.fire(new t.n("webglcontextlost", { originalEvent: e3 }));
            }, this._contextRestored = (e3) => {
              this._lostContextStyle.style && this.setStyle(this._lostContextStyle.style, { diff: false }), this._lostContextStyle.images && this.style && (this.style.imageManager.images = this._lostContextStyle.images), this._lostContextStyle = { style: null, images: null }, this._setupPainter(), this.resize(), this._update(), this._resizeInternal(), this.fire(new t.n("webglcontextrestored", { originalEvent: e3 }));
            }, this._onMapScroll = (e3) => {
              if (e3.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, false;
            }, this._onWindowOnline = () => {
              this._update();
            }, this._interactive = r2.interactive, this._maxTileCacheSize = r2.maxTileCacheSize, this._maxTileCacheZoomLevels = r2.maxTileCacheZoomLevels, this._canvasContextAttributes = Object.assign({}, r2.canvasContextAttributes), this._trackResize = true === r2.trackResize, this._bearingSnap = r2.bearingSnap, this._zoomSnap = r2.zoomSnap, this._centerClampedToGround = r2.centerClampedToGround, this._refreshExpiredTiles = true === r2.refreshExpiredTiles, this._fadeDuration = r2.fadeDuration, this._crossSourceCollisions = true === r2.crossSourceCollisions, this._collectResourceTiming = true === r2.collectResourceTiming, this._locale = Object.assign(Object.assign({}, cs), r2.locale), this._clickTolerance = r2.clickTolerance, this._overridePixelRatio = r2.pixelRatio, this._maxCanvasSize = r2.maxCanvasSize, this._zoomLevelsToOverscale = r2.experimentalZoomLevelsToOverscale, this.transformCameraUpdate = r2.transformCameraUpdate, this.transformConstrain = r2.transformConstrain, this.cancelPendingTileRequestsWhileZooming = true === r2.cancelPendingTileRequestsWhileZooming, this.setAnisotropicFilterPitch(r2.anisotropicFilterPitch), void 0 !== r2.reduceMotion && (n.prefersReducedMotion = r2.reduceMotion), this._imageQueueHandle = u.addThrottleControl((() => this.isMoving())), this._requestManager = new _(r2.transformRequest), this._container = this._resolveContainer(r2.container), r2.maxBounds && this.setMaxBounds(r2.maxBounds), this._setupContainer(), this._setupPainter(), this.on("move", (() => this._update(false))), this.on("moveend", (() => this._update(false))), this.on("zoom", (() => this._update(true))), this.on("terrain", (() => {
              this.painter.terrainFacilitator.depthDirty = true, this._update(true);
            })), this.once("idle", (() => this._idleTriggered = true)), "undefined" != typeof window && (this._ownerWindow.addEventListener("online", this._onWindowOnline, false), this._setupResizeObserver()), this.handlers = new Yr(this, r2), this._hash = r2.hash ? new Ya("string" == typeof r2.hash && r2.hash || void 0).addTo(this) : void 0, (null === (i2 = this._hash) || void 0 === i2 ? void 0 : i2._onHashChange()) || (this.jumpTo({ center: r2.center, elevation: r2.elevation, zoom: r2.zoom, bearing: r2.bearing, pitch: r2.pitch, roll: r2.roll }), r2.bounds && (this.resize(), this.fitBounds(r2.bounds, t.e({}, r2.fitBoundsOptions, { duration: 0 }))));
            const c2 = "string" == typeof r2.style || !("globe" === (null === (a2 = null === (o2 = r2.style) || void 0 === o2 ? void 0 : o2.projection) || void 0 === a2 ? void 0 : a2.type));
            this.resize(null, c2), this._localIdeographFontFamily = r2.localIdeographFontFamily, this._validateStyle = r2.validateStyle, r2.style && this.setStyle(r2.style, { localIdeographFontFamily: r2.localIdeographFontFamily }), r2.attributionControl && this.addControl(new es("boolean" == typeof r2.attributionControl ? void 0 : r2.attributionControl)), r2.maplibreLogo && this.addControl(new ts(), r2.logoPosition), this.on("style.load", (() => {
              if (c2 || this._resizeTransform(), this.transform.unmodified) {
                const e3 = t.V(this.style.stylesheet, ["center", "zoom", "bearing", "pitch", "roll"]);
                this.jumpTo(e3);
              }
            })), this.on("data", ((e3) => {
              this._update("style" === e3.dataType), this.fire(new t.n(`${e3.dataType}data`, e3));
            })), this.on("dataloading", ((e3) => {
              this.fire(new t.n(`${e3.dataType}dataloading`, e3));
            })), this.on("dataabort", ((e3) => {
              this.fire(new t.n("sourcedataabort", e3));
            }));
          }
          _getMapId() {
            return this._mapId;
          }
          setGlobalStateProperty(e2, t2) {
            return this.style.setGlobalStateProperty(e2, t2), this._update(true);
          }
          getGlobalState() {
            return this.style.getGlobalState();
          }
          addControl(e2, i2) {
            if (void 0 === i2 && (i2 = e2.getDefaultPosition ? e2.getDefaultPosition() : "top-right"), !(null == e2 ? void 0 : e2.onAdd)) return this.fire(new t.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
            const o2 = e2.onAdd(this);
            this._controls.push(e2);
            const a2 = this._controlPositions[i2];
            return i2.includes("bottom") ? a2.insertBefore(o2, a2.firstChild) : a2.appendChild(o2), this;
          }
          removeControl(e2) {
            if (!(null == e2 ? void 0 : e2.onRemove)) return this.fire(new t.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
            const i2 = this._controls.indexOf(e2);
            return i2 > -1 && this._controls.splice(i2, 1), e2.onRemove(this), this;
          }
          hasControl(e2) {
            return this._controls.includes(e2);
          }
          coveringTiles(e2) {
            return Me(this.transform, e2);
          }
          calculateCameraOptionsFromTo(e2, t2, i2, o2) {
            return null == o2 && this.terrain && (o2 = this.terrain.getElevationForLngLat(i2, this.transform)), super.calculateCameraOptionsFromTo(e2, t2, i2, o2);
          }
          resize(e2, i2 = true) {
            if (null !== this._lostContextStyle.style) return this;
            this._resizeInternal(i2);
            const o2 = !this._moving;
            return o2 && (this.stop(), this.fire(new t.n("movestart", e2)).fire(new t.n("move", e2))), this.fire(new t.n("resize", e2)), o2 && this.fire(new t.n("moveend", e2)), this;
          }
          _resizeInternal(e2 = true) {
            const [t2, i2] = this._containerDimensions(), o2 = this._getClampedPixelRatio(t2, i2);
            if (this._resizeCanvas(t2, i2, o2), this.painter.resize(t2, i2, o2), this.painter.overLimit()) {
              const e3 = this.painter.context.gl;
              this._maxCanvasSize = [e3.drawingBufferWidth, e3.drawingBufferHeight];
              const o3 = this._getClampedPixelRatio(t2, i2);
              this._resizeCanvas(t2, i2, o3), this.painter.resize(t2, i2, o3);
            }
            this._resizeTransform(e2);
          }
          _resizeTransform(e2 = true) {
            var t2;
            const [i2, o2] = this._containerDimensions();
            this.transform.resize(i2, o2, e2), null === (t2 = this._requestedCameraState) || void 0 === t2 || t2.resize(i2, o2, e2);
          }
          _getClampedPixelRatio(e2, t2) {
            const { 0: i2, 1: o2 } = this._maxCanvasSize, a2 = this.getPixelRatio(), r2 = e2 * a2, s2 = t2 * a2;
            return Math.min(r2 > i2 ? i2 / r2 : 1, s2 > o2 ? o2 / s2 : 1) * a2;
          }
          getPixelRatio() {
            var e2;
            return null !== (e2 = this._overridePixelRatio) && void 0 !== e2 ? e2 : devicePixelRatio;
          }
          setPixelRatio(e2) {
            this._overridePixelRatio = e2, this.resize();
          }
          getBounds() {
            return this.transform.getBounds();
          }
          getMaxBounds() {
            return this.transform.getMaxBounds();
          }
          setMaxBounds(e2) {
            return this.transform.setMaxBounds(G.convert(e2)), this._update();
          }
          setMinZoom(e2) {
            if ((e2 = null == e2 ? -2 : e2) >= -2 && e2 <= this.transform.maxZoom) {
              const i2 = this.transform.zoom, o2 = this._getTransformForUpdate();
              return o2.setMinZoom(e2), this._applyUpdatedTransform(o2), this._update(), i2 !== this.transform.zoom && this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")), this;
            }
            throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
          }
          getMinZoom() {
            return this.transform.minZoom;
          }
          setMaxZoom(e2) {
            if ((e2 = null == e2 ? 22 : e2) >= this.transform.minZoom) {
              const i2 = this.transform.zoom, o2 = this._getTransformForUpdate();
              return o2.setMaxZoom(e2), this._applyUpdatedTransform(o2), this._update(), i2 !== this.transform.zoom && this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")), this;
            }
            throw new Error("maxZoom must be greater than the current minZoom");
          }
          getMaxZoom() {
            return this.transform.maxZoom;
          }
          setMinPitch(e2) {
            if ((e2 = null == e2 ? 0 : e2) < 0) throw new Error("minPitch must be greater than or equal to 0");
            if (e2 >= 0 && e2 <= this.transform.maxPitch) {
              const i2 = this.transform.pitch, o2 = this._getTransformForUpdate();
              return o2.setMinPitch(e2), this._applyUpdatedTransform(o2), this._update(), i2 !== this.transform.pitch && this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")), this;
            }
            throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
          }
          getMinPitch() {
            return this.transform.minPitch;
          }
          setMaxPitch(e2) {
            if ((e2 = null == e2 ? 60 : e2) > 180) throw new Error("maxPitch must be less than or equal to 180");
            if (e2 >= this.transform.minPitch) {
              const i2 = this.transform.pitch, o2 = this._getTransformForUpdate();
              return o2.setMaxPitch(e2), this._applyUpdatedTransform(o2), this._update(), i2 !== this.transform.pitch && this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")), this;
            }
            throw new Error("maxPitch must be greater than the current minPitch");
          }
          getMaxPitch() {
            return this.transform.maxPitch;
          }
          getAnisotropicFilterPitch() {
            return this._anisotropicFilterPitch;
          }
          setAnisotropicFilterPitch(e2) {
            if ((e2 = null == e2 ? 20 : e2) > 180) throw new Error("anisotropicFilterPitch must be less than or equal to 180");
            if (e2 < 0) throw new Error("anisotropicFilterPitch must be greater than or equal to 0");
            return this._anisotropicFilterPitch = e2, this._update();
          }
          getRenderWorldCopies() {
            return this.transform.renderWorldCopies;
          }
          setRenderWorldCopies(e2) {
            return this.transform.setRenderWorldCopies(e2), this._update();
          }
          setTransformConstrain(e2) {
            return this.transform.setConstrainOverride(e2), this._update();
          }
          project(e2) {
            return this.transform.locationToScreenPoint(t.W.convert(e2), this.style && this.terrain);
          }
          unproject(e2) {
            return this.transform.screenPointToLocation(t.P.convert(e2), this.terrain);
          }
          isMoving() {
            var e2;
            return this._moving || (null === (e2 = this.handlers) || void 0 === e2 ? void 0 : e2.isMoving());
          }
          isZooming() {
            var e2;
            return this._zooming || (null === (e2 = this.handlers) || void 0 === e2 ? void 0 : e2.isZooming());
          }
          isRotating() {
            var e2;
            return this._rotating || (null === (e2 = this.handlers) || void 0 === e2 ? void 0 : e2.isRotating());
          }
          _createDelegatedListener(e2, t2, i2) {
            if ("mouseenter" === e2 || "mouseover" === e2) {
              let o2 = false;
              const a2 = (a3) => {
                const r2 = t2.filter(((e3) => this.getLayer(e3))), s2 = 0 !== r2.length ? this.queryRenderedFeatures(a3.point, { layers: r2 }) : [];
                s2.length ? o2 || (o2 = true, i2.call(this, new nr(e2, this, a3.originalEvent, { features: s2 }))) : o2 = false;
              };
              return { layers: t2, listener: i2, delegates: { mousemove: a2, mouseout: () => {
                o2 = false;
              } } };
            }
            if ("mouseleave" === e2 || "mouseout" === e2) {
              let o2 = false;
              const a2 = (a3) => {
                const r3 = t2.filter(((e3) => this.getLayer(e3)));
                (0 !== r3.length ? this.queryRenderedFeatures(a3.point, { layers: r3 }) : []).length ? o2 = true : o2 && (o2 = false, i2.call(this, new nr(e2, this, a3.originalEvent)));
              }, r2 = (t3) => {
                o2 && (o2 = false, i2.call(this, new nr(e2, this, t3.originalEvent)));
              };
              return { layers: t2, listener: i2, delegates: { mousemove: a2, mouseout: r2 } };
            }
            {
              const o2 = (e3) => {
                const o3 = t2.filter(((e4) => this.getLayer(e4))), a2 = 0 !== o3.length ? this.queryRenderedFeatures(e3.point, { layers: o3 }) : [];
                a2.length && (e3.features = a2, i2.call(this, e3), delete e3.features);
              };
              return { layers: t2, listener: i2, delegates: { [e2]: o2 } };
            }
          }
          _saveDelegatedListener(e2, t2) {
            var i2;
            this._delegatedListeners || (this._delegatedListeners = {}), (i2 = this._delegatedListeners)[e2] || (i2[e2] = []), this._delegatedListeners[e2].push(t2);
          }
          _removeDelegatedListener(e2, t2, i2) {
            var o2;
            if (!(null === (o2 = this._delegatedListeners) || void 0 === o2 ? void 0 : o2[e2])) return;
            const a2 = this._delegatedListeners[e2];
            for (let e3 = 0; e3 < a2.length; e3++) {
              const o3 = a2[e3];
              if (o3.listener === i2 && o3.layers.length === t2.length && o3.layers.every(((e4) => t2.includes(e4)))) {
                for (const e4 in o3.delegates) this.off(e4, o3.delegates[e4]);
                return void a2.splice(e3, 1);
              }
            }
          }
          on(e2, t2, i2) {
            if (void 0 === i2) return super.on(e2, t2);
            const o2 = "string" == typeof t2 ? [t2] : t2, a2 = this._createDelegatedListener(e2, o2, i2);
            this._saveDelegatedListener(e2, a2);
            for (const e3 in a2.delegates) this.on(e3, a2.delegates[e3]);
            return { unsubscribe: () => {
              this._removeDelegatedListener(e2, o2, i2);
            } };
          }
          once(e2, t2, i2) {
            if (void 0 === i2) return super.once(e2, t2);
            const o2 = "string" == typeof t2 ? [t2] : t2, a2 = this._createDelegatedListener(e2, o2, i2);
            for (const t3 in a2.delegates) {
              const r2 = a2.delegates[t3];
              a2.delegates[t3] = (...t4) => {
                this._removeDelegatedListener(e2, o2, i2), r2(...t4);
              };
            }
            this._saveDelegatedListener(e2, a2);
            for (const e3 in a2.delegates) this.once(e3, a2.delegates[e3]);
            return this;
          }
          off(e2, t2, i2) {
            return void 0 === i2 ? super.off(e2, t2) : (this._removeDelegatedListener(e2, "string" == typeof t2 ? [t2] : t2, i2), this);
          }
          queryRenderedFeatures(e2, i2) {
            if (!this.style) return [];
            let o2;
            const a2 = e2 instanceof t.P || Array.isArray(e2), r2 = a2 ? e2 : [[0, 0], [this.transform.width, this.transform.height]];
            if (i2 || (i2 = (a2 ? {} : e2) || {}), r2 instanceof t.P || "number" == typeof r2[0]) o2 = [t.P.convert(r2)];
            else {
              const e3 = t.P.convert(r2[0]), i3 = t.P.convert(r2[1]);
              o2 = [e3, new t.P(i3.x, e3.y), i3, new t.P(e3.x, i3.y), e3];
            }
            return this.style.queryRenderedFeatures(o2, i2, this.transform);
          }
          querySourceFeatures(e2, t2) {
            return this.style.querySourceFeatures(e2, t2);
          }
          setStyle(e2, i2) {
            return false !== (i2 = t.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, i2)).diff && i2.localIdeographFontFamily === this._localIdeographFontFamily && this.style && e2 ? (this._diffStyle(e2, i2), this) : (this._localIdeographFontFamily = i2.localIdeographFontFamily, this._updateStyle(e2, i2));
          }
          setTransformRequest(e2) {
            return this._requestManager.setTransformRequest(e2), this;
          }
          _getUIString(e2) {
            const t2 = this._locale[e2];
            if (null == t2) throw new Error(`Missing UI string '${e2}'`);
            return t2;
          }
          _updateStyle(e2, t2) {
            var i2, o2, a2;
            if (null === (i2 = this._diffStyleRequest) || void 0 === i2 || i2.abort(), this._diffStyleRequest = null, t2.transformStyle && this.style && !this.style._loaded) return void this.style.once("style.load", (() => this._updateStyle(e2, t2)));
            const r2 = this.style && t2.transformStyle ? this.style.serialize() : void 0;
            return this.style && (this.style.setEventedParent(null), this.style._remove(!e2)), e2 ? (this.style = new ki(this, t2 || {}), this.style.setEventedParent(this, { style: this.style }), "string" == typeof e2 ? this.style.loadURL(e2, t2, r2) : this.style.loadJSON(e2, t2, r2), this) : (this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), null === (a2 = null === (o2 = this.style) || void 0 === o2 ? void 0 : o2.projection) || void 0 === a2 || a2.destroy(), delete this.style, this);
          }
          _lazyInitEmptyStyle() {
            this.style || (this.style = new ki(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());
          }
          _diffStyle(e2, i2) {
            return t._(this, void 0, void 0, (function* () {
              var o2;
              if (null === (o2 = this._diffStyleRequest) || void 0 === o2 || o2.abort(), "string" == typeof e2) {
                const o3 = e2;
                this._diffStyleRequest = new AbortController();
                const a2 = this._diffStyleRequest;
                try {
                  const e3 = yield this._requestManager.transformRequest(o3, "Style");
                  if (a2.signal.aborted) return void (this._diffStyleRequest = null);
                  const r2 = yield t.k(e3, a2);
                  this._diffStyleRequest = null, this._updateDiff(r2.data, i2);
                } catch (e3) {
                  this._diffStyleRequest = null, t.$(e3) || this.fire(new t.l(t.d(e3)));
                }
              } else "object" == typeof e2 && (this._diffStyleRequest = null, this._updateDiff(e2, i2));
            }));
          }
          _updateDiff(e2, i2) {
            try {
              this.style.setState(e2, i2) && this._update(true);
            } catch (o2) {
              t.w(`Unable to perform style diff: ${t.d(o2).message}.  Rebuilding the style from scratch.`), this._updateStyle(e2, i2);
            }
          }
          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() {
            if (this.style) return this.style.loaded();
            t.w("There is no style added to the map.");
          }
          addSource(e2, t2) {
            return this._lazyInitEmptyStyle(), this.style.addSource(e2, t2), this._update(true);
          }
          isSourceLoaded(e2) {
            var i2;
            const o2 = null === (i2 = this.style) || void 0 === i2 ? void 0 : i2.tileManagers[e2];
            if (void 0 !== o2) return o2.loaded();
            this.fire(new t.l(new Error(`There is no tile manager with ID '${e2}'`)));
          }
          setTerrain(e2) {
            if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off("data", this._terrainDataCallback), e2) {
              const i2 = this.style.tileManagers[e2.source];
              if (!i2) throw new Error(`cannot load terrain, because there exists no source with ID: ${e2.source}`);
              null === this.terrain && i2.reload();
              for (const i3 in this.style._layers) {
                const o2 = this.style._layers[i3];
                "hillshade" === o2.type && o2.source === e2.source && t.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."), "color-relief" === o2.type && o2.source === e2.source && t.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 rs(this.painter, i2, e2), this.painter.renderToTexture = new ls(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 = (t2) => {
                var i3;
                "style" === t2.dataType ? this.terrain.tileManager.freeRtt() : "source" === t2.dataType && t2.tile && (t2.sourceId !== e2.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))), "image" === (null === (i3 = t2.source) || void 0 === i3 ? void 0 : i3.type) ? this.terrain.tileManager.freeRtt() : this.terrain.tileManager.freeRtt(t2.tile.tileID));
              }, this.style.on("data", this._terrainDataCallback);
            } else this.terrain && this.terrain.destroy(), 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 t.n("terrain", { terrain: e2 })), this;
          }
          getTerrain() {
            var e2, t2;
            return null !== (t2 = null === (e2 = this.terrain) || void 0 === e2 ? void 0 : e2.options) && void 0 !== t2 ? t2 : null;
          }
          areTilesLoaded() {
            var e2;
            const t2 = null === (e2 = this.style) || void 0 === e2 ? void 0 : e2.tileManagers;
            for (const e3 of Object.values(t2)) if (!e3.areTilesLoaded()) return false;
            return true;
          }
          removeSource(e2) {
            return this.style.removeSource(e2), this._update(true);
          }
          getSource(e2) {
            return this.style.getSource(e2);
          }
          setSourceTileLodParams(e2, t2, i2) {
            if (i2) {
              const o2 = this.getSource(i2);
              if (!o2) throw new Error(`There is no source with ID "${i2}", cannot set LOD parameters`);
              o2.calculateTileZoom = Te(Math.max(1, e2), Math.max(1, t2));
            } else for (const i3 in this.style.tileManagers) this.style.tileManagers[i3].getSource().calculateTileZoom = Te(Math.max(1, e2), Math.max(1, t2));
            return this._update(true), this;
          }
          refreshTiles(e2, i2) {
            const o2 = this.style.tileManagers[e2];
            if (!o2) throw new Error(`There is no tile manager with ID "${e2}", cannot refresh tile`);
            void 0 === i2 ? o2.reload(true) : o2.refreshTiles(i2.map(((e3) => new t.aa(e3.z, e3.x, e3.y))));
          }
          addImage(e2, i2, o2 = {}) {
            const { pixelRatio: a2 = 1, sdf: r2 = false, stretchX: s2, stretchY: l2, content: c2, textFitWidth: h2, textFitHeight: u2 } = o2;
            if (this._lazyInitEmptyStyle(), !(i2 instanceof HTMLImageElement || t.b(i2))) {
              if (void 0 === i2.width || void 0 === i2.height) return this.fire(new t.l(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: o3, height: n2, data: d2 } = i2, _2 = i2;
                return this.style.addImage(e2, { data: new t.R({ width: o3, height: n2 }, new Uint8Array(d2)), pixelRatio: a2, stretchX: s2, stretchY: l2, content: c2, textFitWidth: h2, textFitHeight: u2, sdf: r2, version: 0, userImage: _2 }), _2.onAdd && _2.onAdd(this, e2), this;
              }
            }
            {
              const { width: o3, height: d2, data: _2 } = n.getImageData(i2);
              this.style.addImage(e2, { data: new t.R({ width: o3, height: d2 }, _2), pixelRatio: a2, stretchX: s2, stretchY: l2, content: c2, textFitWidth: h2, textFitHeight: u2, sdf: r2, version: 0 });
            }
          }
          updateImage(e2, i2) {
            const o2 = this.style.getImage(e2);
            if (!o2) return this.fire(new t.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
            const a2 = i2 instanceof HTMLImageElement || t.b(i2) ? n.getImageData(i2) : i2, { width: r2, height: s2, data: l2 } = a2;
            if (void 0 === r2 || void 0 === s2) return this.fire(new t.l(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 (r2 !== o2.data.width || s2 !== o2.data.height) return this.fire(new t.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));
            const c2 = !(i2 instanceof HTMLImageElement || t.b(i2));
            return o2.data.replace(l2, c2), this.style.updateImage(e2, o2), this;
          }
          getImage(e2) {
            return this.style.getImage(e2);
          }
          hasImage(e2) {
            return e2 ? !!this.style.getImage(e2) : (this.fire(new t.l(new Error("Missing required image id"))), false);
          }
          removeImage(e2) {
            this.style.removeImage(e2);
          }
          loadImage(e2) {
            return t._(this, void 0, void 0, (function* () {
              return u.getImage(yield this._requestManager.transformRequest(e2, "Image"), new AbortController());
            }));
          }
          listImages() {
            return this.style.listImages();
          }
          addLayer(e2, t2) {
            return this._lazyInitEmptyStyle(), this.style.addLayer(e2, t2), this._update(true);
          }
          moveLayer(e2, t2) {
            return this.style.moveLayer(e2, t2), this._update(true);
          }
          removeLayer(e2) {
            return this.style.removeLayer(e2), this._update(true);
          }
          getLayer(e2) {
            return this.style.getLayer(e2);
          }
          getLayersOrder() {
            return this.style.getLayersOrder();
          }
          setLayerZoomRange(e2, t2, i2) {
            return this.style.setLayerZoomRange(e2, t2, i2), this._update(true);
          }
          setFilter(e2, t2, i2 = {}) {
            return this.style.setFilter(e2, t2, i2), this._update(true);
          }
          getFilter(e2) {
            return this.style.getFilter(e2);
          }
          setPaintProperty(e2, t2, i2, o2 = {}) {
            return this.style.setPaintProperty(e2, t2, i2, o2), this._update(true);
          }
          getPaintProperty(e2, t2) {
            return this.style.getPaintProperty(e2, t2);
          }
          setLayoutProperty(e2, t2, i2, o2 = {}) {
            return this.style.setLayoutProperty(e2, t2, i2, o2), this._update(true);
          }
          getLayoutProperty(e2, t2) {
            return this.style.getLayoutProperty(e2, t2);
          }
          setGlyphs(e2, t2 = {}) {
            return this._lazyInitEmptyStyle(), this.style.setGlyphs(e2, t2), this._update(true);
          }
          getGlyphs() {
            return this.style.getGlyphsUrl();
          }
          addSprite(e2, t2, i2 = {}) {
            return this._lazyInitEmptyStyle(), this.style.addSprite(e2, t2, i2, ((e3) => {
              e3 || this._update(true);
            })), this;
          }
          removeSprite(e2) {
            return this._lazyInitEmptyStyle(), this.style.removeSprite(e2), this._update(true);
          }
          getSprite() {
            return this.style.getSprite();
          }
          setSprite(e2, t2 = {}) {
            return this._lazyInitEmptyStyle(), this.style.setSprite(e2, t2, ((e3) => {
              e3 || this._update(true);
            })), this;
          }
          setLight(e2, t2 = {}) {
            return this._lazyInitEmptyStyle(), this.style.setLight(e2, t2), this._update(true);
          }
          getLight() {
            return this.style.getLight();
          }
          setSky(e2, t2 = {}) {
            return this._lazyInitEmptyStyle(), this.style.setSky(e2, t2), this._update(true);
          }
          getSky() {
            return this.style.getSky();
          }
          setFeatureState(e2, t2) {
            return this.style.setFeatureState(e2, t2), this._update();
          }
          removeFeatureState(e2, t2) {
            return this.style.removeFeatureState(e2, t2), this._update();
          }
          getFeatureState(e2) {
            return this.style.getFeatureState(e2);
          }
          getContainer() {
            return this._container;
          }
          getCanvasContainer() {
            return this._canvasContainer;
          }
          getCanvas() {
            return this._canvas;
          }
          _containerDimensions() {
            let e2 = 0, t2 = 0;
            return this._container && (e2 = this._container.clientWidth || 400, t2 = this._container.clientHeight || 300), [e2, t2];
          }
          _setupResizeObserver() {
            var e2;
            let t2 = false;
            const i2 = Ka(((e3) => {
              this._trackResize && !this._removed && (this.resize(e3), this.redraw());
            }), 50), o2 = null !== (e2 = this._ownerWindow.ResizeObserver) && void 0 !== e2 ? e2 : ResizeObserver;
            this._resizeObserver = new o2(((e3) => {
              t2 ? i2(e3) : t2 = true;
            })), this._resizeObserver.observe(this._container);
          }
          _resolveContainer(e2) {
            if ("string" == typeof e2) {
              const t2 = document.getElementById(e2);
              if (!t2) throw new Error(`Container '${e2}' not found.`);
              return t2;
            }
            if (e2 instanceof HTMLElement) return e2;
            if (e2 && "object" == typeof e2 && 1 === e2.nodeType) return e2;
            throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
          }
          _setupContainer() {
            const e2 = this._container;
            e2.classList.add("maplibregl-map");
            const t2 = this._canvasContainer = d.create("div", "maplibregl-canvas-container", e2);
            this._interactive && t2.classList.add("maplibregl-interactive"), this._canvas = d.create("canvas", "maplibregl-canvas", t2), this._canvas.addEventListener("webglcontextlost", this._contextLost, false), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.setAttribute("tabindex", this._interactive ? "0" : "-1"), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region");
            const i2 = this._containerDimensions(), o2 = this._getClampedPixelRatio(i2[0], i2[1]);
            this._resizeCanvas(i2[0], i2[1], o2);
            const a2 = this._controlContainer = d.create("div", "maplibregl-control-container", e2), r2 = this._controlPositions = {};
            for (const e3 of ["top-left", "top-right", "bottom-left", "bottom-right"]) r2[e3] = d.create("div", `maplibregl-ctrl-${e3} `, a2);
            this._container.addEventListener("scroll", this._onMapScroll, false);
          }
          _resizeCanvas(e2, t2, i2) {
            this._canvas.width = Math.floor(i2 * e2), this._canvas.height = Math.floor(i2 * t2), this._canvas.style.width = `${e2}px`, this._canvas.style.height = `${t2}px`;
          }
          _setupPainter() {
            const e2 = Object.assign(Object.assign({}, this._canvasContextAttributes), { alpha: true, depth: true, stencil: true, premultipliedAlpha: true });
            let t2 = null;
            this._canvas.addEventListener("webglcontextcreationerror", ((i3) => {
              t2 = { requestedAttributes: e2 }, i3 && (t2.statusMessage = i3.statusMessage, t2.type = i3.type);
            }), { once: true });
            let i2 = null;
            if (i2 = this._canvasContextAttributes.contextType ? this._canvas.getContext(this._canvasContextAttributes.contextType, e2) : this._canvas.getContext("webgl2", e2) || this._canvas.getContext("webgl", e2), !i2) {
              const e3 = "Failed to initialize WebGL";
              throw t2 ? (t2.message = e3, new Error(JSON.stringify(t2))) : new Error(e3);
            }
            this.painter = new Xa(i2, this.transform);
          }
          migrateProjection(e2, i2) {
            super.migrateProjection(e2, i2), this.painter.transform = e2, this.fire(new t.n("projectiontransition", { newProjection: this.style.projection.name }));
          }
          loaded() {
            return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
          }
          _update(e2) {
            var t2;
            return (null === (t2 = this.style) || void 0 === t2 ? void 0 : t2._loaded) ? (this._styleDirty || (this._styleDirty = e2), this._sourcesDirty = true, this.triggerRepaint(), this) : this;
          }
          _requestRenderFrame(e2) {
            return this._update(), this._renderTaskQueue.add(e2);
          }
          _cancelRenderFrame(e2) {
            this._renderTaskQueue.remove(e2);
          }
          _render(e2) {
            var i2, o2, a2, r2, s2, n2;
            const l2 = this._idleTriggered ? this._fadeDuration : 0, h2 = (null === (i2 = this.style.projection) || void 0 === i2 ? void 0 : i2.transitionState) > 0;
            if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(e2), this._removed) return;
            let u2 = false;
            if (this.style && this._styleDirty) {
              this._styleDirty = false;
              const e3 = this.transform.zoom, i3 = c();
              this.style.zoomHistory.update(e3, i3);
              const o3 = new t.J(e3, { now: i3, fadeDuration: l2, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), a3 = o3.crossFadingFactor();
              1 === a3 && a3 === this._crossFadingFactor || (u2 = true, this._crossFadingFactor = a3), this.style.update(o3);
            }
            const d2 = (null === (o2 = this.style.projection) || void 0 === o2 ? void 0 : o2.transitionState) > 0 !== h2;
            null === (a2 = this.style.projection) || void 0 === a2 || a2.setErrorQueryLatitudeDegrees(this.transform.center.lat), this.transform.setTransitionState(null === (r2 = this.style.projection) || void 0 === r2 ? void 0 : r2.transitionState, null === (s2 = this.style.projection) || void 0 === s2 ? void 0 : s2.latitudeErrorCorrectionRadians), this.style && (this._sourcesDirty || d2) && (this._sourcesDirty = false, 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 = null === (n2 = this.style) || void 0 === n2 ? void 0 : n2._updatePlacement(this.transform, this.showCollisionBoxes, l2, this._crossSourceCollisions, d2), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: l2, showPadding: this.showPadding, anisotropicFilterPitch: this.getAnisotropicFilterPitch() }), this.fire(new t.n("render")), this.loaded() && !this._loaded && (this._loaded = true, this.fire(new t.n("load"))), this.style && (this.style.hasTransitions() || u2) && (this._styleDirty = true), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles();
            const _2 = this._sourcesDirty || this._styleDirty || this._placementDirty;
            return _2 || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new t.n("idle")), !this._loaded || this._fullyLoaded || _2 || (this._fullyLoaded = true), this;
          }
          redraw() {
            return this.style && (this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._render(0)), this;
          }
          remove() {
            var e2, i2;
            this._hash && this._hash.remove();
            for (const e3 of this._controls) e3.onRemove(this);
            this._controls = [], this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._renderTaskQueue.clear(), null === (e2 = this._diffStyleRequest) || void 0 === e2 || e2.abort(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), "undefined" != typeof window && this._ownerWindow.removeEventListener("online", this._onWindowOnline, false), u.removeThrottleControl(this._imageQueueHandle), null === (i2 = this._resizeObserver) || void 0 === i2 || i2.disconnect();
            const o2 = this.painter.context.gl.getExtension("WEBGL_lose_context");
            (null == o2 ? void 0 : o2.loseContext) && o2.loseContext(), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.removeEventListener("webglcontextlost", this._contextLost, false), this._canvasContainer.remove(), this._controlContainer.remove(), this._container.removeEventListener("scroll", this._onMapScroll, false), this._container.classList.remove("maplibregl-map"), this._removed = true, this.fire(new t.n("remove"));
          }
          triggerRepaint() {
            this.style && !this._frameRequest && (this._frameRequest = new AbortController(), n.frame(this._frameRequest, ((e2) => {
              this._frameRequest = null;
              try {
                this._render(e2);
              } catch (e3) {
                if (!t.$(e3) && !(function(e4) {
                  return e4.message === na;
                })(e3)) throw e3;
              }
            }), (() => {
            }), this._ownerWindow));
          }
          get showTileBoundaries() {
            return !!this._showTileBoundaries;
          }
          set showTileBoundaries(e2) {
            this._showTileBoundaries !== e2 && (this._showTileBoundaries = e2, this._update());
          }
          get showPadding() {
            return !!this._showPadding;
          }
          set showPadding(e2) {
            this._showPadding !== e2 && (this._showPadding = e2, this._update());
          }
          get showCollisionBoxes() {
            return !!this._showCollisionBoxes;
          }
          set showCollisionBoxes(e2) {
            this._showCollisionBoxes !== e2 && (this._showCollisionBoxes = e2, e2 ? this.style._generateCollisionBoxes() : this._update());
          }
          get showOverdrawInspector() {
            return !!this._showOverdrawInspector;
          }
          set showOverdrawInspector(e2) {
            this._showOverdrawInspector !== e2 && (this._showOverdrawInspector = e2, this._update());
          }
          get repaint() {
            return !!this._repaint;
          }
          set repaint(e2) {
            this._repaint !== e2 && (this._repaint = e2, this.triggerRepaint());
          }
          get vertices() {
            return !!this._vertices;
          }
          set vertices(e2) {
            this._vertices = e2, this._update();
          }
          get version() {
            return hs;
          }
          getCameraTargetElevation() {
            return this.transform.elevation;
          }
          getProjection() {
            return this.style.getProjection();
          }
          setProjection(e2) {
            return this._lazyInitEmptyStyle(), this.style.setProjection(e2), this._update(true);
          }
        };
        const _s = { showCompass: true, showZoom: true, visualizePitch: false, visualizeRoll: true };
        class ps {
          constructor(e2, i2, o2 = false) {
            this.mousedown = (e3) => {
              this.startMove(e3, d.mousePos(this.element, e3)), window.addEventListener("mousemove", this.mousemove), window.addEventListener("mouseup", this.mouseup);
            }, this.mousemove = (e3) => {
              this.move(e3, d.mousePos(this.element, e3));
            }, this.mouseup = (e3) => {
              this._rotatePitchHandler.dragEnd(e3), this.offTemp();
            }, this.touchstart = (e3) => {
              1 !== e3.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = d.touchPos(this.element, e3.targetTouches)[0], this.startMove(e3, this._startPos), window.addEventListener("touchmove", this.touchmove, { passive: false }), window.addEventListener("touchend", this.touchend));
            }, this.touchmove = (e3) => {
              1 !== e3.targetTouches.length ? this.reset() : (this._lastPos = d.touchPos(this.element, e3.targetTouches)[0], this.move(e3, this._lastPos));
            }, this.touchend = (e3) => {
              0 === e3.targetTouches.length && 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 = i2;
            const a2 = new Pr();
            this._rotatePitchHandler = new vr({ clickTolerance: 3, move: (e3, a3) => {
              const r2 = i2.getBoundingClientRect(), s2 = new t.P((r2.bottom - r2.top) / 2, (r2.right - r2.left) / 2);
              return { bearingDelta: t.cx(new t.P(e3.x, a3.y), a3, s2), pitchDelta: o2 ? -0.5 * (a3.y - e3.y) : void 0 };
            }, moveStateManager: a2, enable: true, assignEvents: () => {
            } }), this.map = e2, i2.addEventListener("mousedown", this.mousedown), i2.addEventListener("touchstart", this.touchstart, { passive: false }), i2.addEventListener("touchcancel", this.reset);
          }
          startMove(e2, t2) {
            this._rotatePitchHandler.dragStart(e2, t2), d.disableDrag();
          }
          move(e2, t2) {
            const i2 = this.map, { bearingDelta: o2, pitchDelta: a2 } = this._rotatePitchHandler.dragMove(e2, t2) || {};
            o2 && i2.setBearing(i2.getBearing() + o2), a2 && i2.setPitch(i2.getPitch() + a2);
          }
          off() {
            const e2 = this.element;
            e2.removeEventListener("mousedown", this.mousedown), e2.removeEventListener("touchstart", this.touchstart), window.removeEventListener("touchmove", this.touchmove), window.removeEventListener("touchend", this.touchend), e2.removeEventListener("touchcancel", this.reset), this.offTemp();
          }
          offTemp() {
            d.enableDrag(), window.removeEventListener("mousemove", this.mousemove), window.removeEventListener("mouseup", this.mouseup), window.removeEventListener("touchmove", this.touchmove), window.removeEventListener("touchend", this.touchend);
          }
        }
        let ms;
        function fs(e2, i2, o2, a2 = false) {
          if (a2 || !o2.getCoveringTilesDetailsProvider().allowWorldCopies()) return null == e2 ? void 0 : e2.wrap();
          const r2 = new t.W(e2.lng, e2.lat);
          if (e2 = new t.W(e2.lng, e2.lat), i2) {
            const a3 = new t.W(e2.lng - 360, e2.lat), r3 = new t.W(e2.lng + 360, e2.lat), s2 = o2.locationToScreenPoint(e2).distSqr(i2);
            o2.locationToScreenPoint(a3).distSqr(i2) < s2 ? e2 = a3 : o2.locationToScreenPoint(r3).distSqr(i2) < s2 && (e2 = r3);
          }
          for (; Math.abs(e2.lng - o2.center.lng) > 180; ) {
            const t2 = o2.locationToScreenPoint(e2);
            if (t2.x >= 0 && t2.y >= 0 && t2.x <= o2.width && t2.y <= o2.height) break;
            e2.lng > o2.center.lng ? e2.lng -= 360 : e2.lng += 360;
          }
          return e2.lng !== r2.lng && o2.isPointOnMapSurface(o2.locationToScreenPoint(e2)) ? e2 : r2;
        }
        const gs = { 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 vs(e2, t2, i2) {
          const o2 = e2.classList;
          for (const e3 in gs) o2.remove(`maplibregl-${i2}-anchor-${e3}`);
          o2.add(`maplibregl-${i2}-anchor-${t2}`);
        }
        class xs extends t.E {
          constructor(e2) {
            if (super(), this._onClick = (e3) => {
              this.fire(new t.n("click", { originalEvent: e3 }));
            }, this._onKeyPress = (e3) => {
              "Space" !== e3.code && "Enter" !== e3.code || this.togglePopup();
            }, this._onMapClick = (e3) => {
              const t2 = e3.originalEvent.target, i2 = this._element;
              this._popup && (t2 === i2 || i2.contains(t2)) && this.togglePopup();
            }, this._update = (e3) => {
              if (!this._map) return;
              const t2 = this._map.loaded() && !this._map.isMoving();
              ("terrain" === (null == e3 ? void 0 : e3.type) || "render" === (null == e3 ? void 0 : e3.type) && !t2) && this._map.once("render", this._update), this._lngLat = fs(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 i2 = "";
              "viewport" === this._rotationAlignment || "auto" === this._rotationAlignment ? i2 = `rotateZ(${this._rotation}deg)` : "map" === this._rotationAlignment && (i2 = `rotateZ(${this._rotation - this._map.getBearing()}deg)`);
              let o2 = "";
              "viewport" === this._pitchAlignment || "auto" === this._pitchAlignment ? o2 = "rotateX(0deg)" : "map" === this._pitchAlignment && (o2 = `rotateX(${this._map.getPitch()}deg)`), this._subpixelPositioning || e3 && "moveend" !== e3.type || (this._pos = this._pos.round()), this._element.style.transform = `${gs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${o2} ${i2}`, n.frameAsync(new AbortController(), this._map._ownerWindow).then((() => {
                this._updateOpacity("moveend" === (null == e3 ? void 0 : e3.type));
              })).catch((() => {
              }));
            }, this._onMove = (e3) => {
              if (!this._isDragging) {
                const t2 = this._clickTolerance || this._map._clickTolerance;
                this._isDragging = e3.point.dist(this._pointerdownPos) >= t2;
              }
              this._isDragging && (this._pos = e3.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new t.n("dragstart"))), this.fire(new t.n("drag")));
            }, this._onUp = () => {
              this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = false, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), "active" === this._state && this.fire(new t.n("dragend")), this._state = "inactive";
            }, this._addDragHandler = (e3) => {
              this._element.contains(e3.originalEvent.target) && (e3.preventDefault(), this._positionDelta = e3.point.sub(this._pos).add(this._offset), this._pointerdownPos = e3.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 = (null == e2 ? void 0 : e2.anchor) || "center", this._color = (null == e2 ? void 0 : e2.color) || "#3FB1CE", this._scale = (null == e2 ? void 0 : e2.scale) || 1, this._draggable = (null == e2 ? void 0 : e2.draggable) || false, this._clickTolerance = (null == e2 ? void 0 : e2.clickTolerance) || 0, this._subpixelPositioning = (null == e2 ? void 0 : e2.subpixelPositioning) || false, this._isDragging = false, this._state = "inactive", this._rotation = (null == e2 ? void 0 : e2.rotation) || 0, this._rotationAlignment = (null == e2 ? void 0 : e2.rotationAlignment) || "auto", this._pitchAlignment = (null == e2 ? void 0 : e2.pitchAlignment) && "auto" !== e2.pitchAlignment ? e2.pitchAlignment : this._rotationAlignment, this.setOpacity(null == e2 ? void 0 : e2.opacity, null == e2 ? void 0 : e2.opacityWhenCovered), null == e2 ? void 0 : e2.element) this._element = e2.element, this._offset = t.P.convert((null == e2 ? void 0 : e2.offset) || [0, 0]);
            else {
              this._defaultMarker = true, this._element = d.create("div");
              const i2 = d.createNS("http://www.w3.org/2000/svg", "svg"), o2 = 41, a2 = 27;
              i2.setAttributeNS(null, "display", "block"), i2.setAttributeNS(null, "height", `${o2}px`), i2.setAttributeNS(null, "width", `${a2}px`), i2.setAttributeNS(null, "viewBox", `0 0 ${a2} ${o2}`);
              const r2 = d.createNS("http://www.w3.org/2000/svg", "g");
              r2.setAttributeNS(null, "stroke", "none"), r2.setAttributeNS(null, "stroke-width", "1"), r2.setAttributeNS(null, "fill", "none"), r2.setAttributeNS(null, "fill-rule", "evenodd");
              const s2 = d.createNS("http://www.w3.org/2000/svg", "g");
              s2.setAttributeNS(null, "fill-rule", "nonzero");
              const n2 = d.createNS("http://www.w3.org/2000/svg", "g");
              n2.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), n2.setAttributeNS(null, "fill", "#000000");
              const l2 = [{ 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 e3 of l2) {
                const t2 = d.createNS("http://www.w3.org/2000/svg", "ellipse");
                t2.setAttributeNS(null, "opacity", "0.04"), t2.setAttributeNS(null, "cx", "10.5"), t2.setAttributeNS(null, "cy", "5.80029008"), t2.setAttributeNS(null, "rx", e3.rx), t2.setAttributeNS(null, "ry", e3.ry), n2.appendChild(t2);
              }
              const c2 = d.createNS("http://www.w3.org/2000/svg", "g");
              c2.setAttributeNS(null, "fill", this._color);
              const h2 = d.createNS("http://www.w3.org/2000/svg", "path");
              h2.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"), c2.appendChild(h2);
              const u2 = d.createNS("http://www.w3.org/2000/svg", "g");
              u2.setAttributeNS(null, "opacity", "0.25"), u2.setAttributeNS(null, "fill", "#000000");
              const _2 = d.createNS("http://www.w3.org/2000/svg", "path");
              _2.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"), u2.appendChild(_2);
              const p2 = d.createNS("http://www.w3.org/2000/svg", "g");
              p2.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), p2.setAttributeNS(null, "fill", "#FFFFFF");
              const m2 = d.createNS("http://www.w3.org/2000/svg", "g");
              m2.setAttributeNS(null, "transform", "translate(8.0, 8.0)");
              const f2 = d.createNS("http://www.w3.org/2000/svg", "circle");
              f2.setAttributeNS(null, "fill", "#000000"), f2.setAttributeNS(null, "opacity", "0.25"), f2.setAttributeNS(null, "cx", "5.5"), f2.setAttributeNS(null, "cy", "5.5"), f2.setAttributeNS(null, "r", "5.4999962");
              const g2 = d.createNS("http://www.w3.org/2000/svg", "circle");
              g2.setAttributeNS(null, "fill", "#FFFFFF"), g2.setAttributeNS(null, "cx", "5.5"), g2.setAttributeNS(null, "cy", "5.5"), g2.setAttributeNS(null, "r", "5.4999962"), m2.appendChild(f2), m2.appendChild(g2), s2.appendChild(n2), s2.appendChild(c2), s2.appendChild(u2), s2.appendChild(p2), s2.appendChild(m2), i2.appendChild(s2), i2.setAttributeNS(null, "height", o2 * this._scale + "px"), i2.setAttributeNS(null, "width", a2 * this._scale + "px"), this._element.appendChild(i2), this._offset = t.P.convert((null == e2 ? void 0 : e2.offset) || [0, -14]);
            }
            if (this._element.classList.add("maplibregl-marker"), this._element.addEventListener("dragstart", ((e3) => {
              e3.preventDefault();
            })), this._element.addEventListener("mousedown", ((e3) => {
              e3.preventDefault();
            })), vs(this._element, this._anchor, "marker"), null == e2 ? void 0 : e2.className) for (const t2 of e2.className.split(" ")) this._element.classList.add(t2);
            this._popup = null;
          }
          addTo(e2) {
            return this.remove(), this._map = e2, this._element.hasAttribute("aria-label") || this._element.setAttribute("aria-label", e2._getUIString("Marker.Title")), this._element.hasAttribute("role") || this._element.setAttribute("role", "button"), e2.getCanvasContainer().appendChild(this._element), e2.on("move", this._update), e2.on("moveend", this._update), e2.on("terrain", this._update), e2.on("projectiontransition", this._update), this._element.addEventListener("click", this._onClick), 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), this._element.removeEventListener("click", this._onClick), this._element.remove(), this._popup && this._popup.remove(), this;
          }
          getLngLat() {
            return this._lngLat;
          }
          setLngLat(e2) {
            return this._lngLat = t.W.convert(e2), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;
          }
          getElement() {
            return this._element;
          }
          setPopup(e2) {
            if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), e2) {
              if (!("offset" in e2.options)) {
                const t2 = 38.1, i2 = 13.5, o2 = Math.abs(i2) / Math.SQRT2;
                e2.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -t2], "bottom-left": [o2, -1 * (t2 - i2 + o2)], "bottom-right": [-o2, -1 * (t2 - i2 + o2)], left: [i2, -1 * (t2 - i2)], right: [-i2, -1 * (t2 - i2)] } : this._offset;
              }
              this._popup = e2, this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress);
            }
            return this;
          }
          setSubpixelPositioning(e2) {
            return this._subpixelPositioning = e2, this;
          }
          getPopup() {
            return this._popup;
          }
          togglePopup() {
            const e2 = this._popup;
            return this._element.style.opacity === this._opacityWhenCovered ? this : e2 ? (e2.isOpen() ? e2.remove() : (e2.setLngLat(this._lngLat), e2.addTo(this._map)), this) : this;
          }
          _updateOpacity(e2 = false) {
            var i2, o2;
            const a2 = null === (i2 = this._map) || void 0 === i2 ? void 0 : i2.terrain, r2 = this._map.transform.isLocationOccluded(this._lngLat);
            if (!a2 || r2) {
              const e3 = r2 ? this._opacityWhenCovered : this._opacity;
              return void (this._element.style.opacity !== e3 && (this._element.style.opacity = e3, this._element.classList.toggle("maplibregl-marker-covered", r2)));
            }
            if (e2) this._opacityTimeout = null;
            else {
              if (this._opacityTimeout) return;
              this._opacityTimeout = setTimeout((() => {
                this._opacityTimeout = null;
              }), 100);
            }
            const s2 = this._map, n2 = s2.terrain.depthAtPoint(this._pos), l2 = s2.terrain.getElevationForLngLat(this._lngLat, s2.transform);
            if (s2.transform.lngLatToCameraDepth(this._lngLat, l2) - n2 < 6e-3) return this._element.style.opacity = this._opacity, void this._element.classList.remove("maplibregl-marker-covered");
            const c2 = -this._offset.y / s2.transform.pixelsPerMeter, h2 = Math.sin(s2.getPitch() * Math.PI / 180) * c2, u2 = s2.terrain.depthAtPoint(new t.P(this._pos.x, this._pos.y - this._offset.y)), d2 = s2.transform.lngLatToCameraDepth(this._lngLat, l2 + h2) - u2 > 6e-3;
            (null === (o2 = this._popup) || void 0 === o2 ? void 0 : o2.isOpen()) && d2 && this._popup.remove(), this._element.style.opacity = d2 ? this._opacityWhenCovered : this._opacity, this._element.classList.toggle("maplibregl-marker-covered", d2);
          }
          getOffset() {
            return this._offset;
          }
          setOffset(e2) {
            return this._offset = t.P.convert(e2), this._update(), this;
          }
          addClassName(e2) {
            this._element.classList.add(e2);
          }
          removeClassName(e2) {
            this._element.classList.remove(e2);
          }
          toggleClassName(e2) {
            return this._element.classList.toggle(e2);
          }
          setDraggable(e2) {
            return this._draggable = !!e2, this._map && (e2 ? (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(e2) {
            return this._rotation = e2 || 0, this._update(), this;
          }
          getRotation() {
            return this._rotation;
          }
          setRotationAlignment(e2) {
            return this._rotationAlignment = e2 || "auto", this._update(), this;
          }
          getRotationAlignment() {
            return this._rotationAlignment;
          }
          setPitchAlignment(e2) {
            return this._pitchAlignment = e2 && "auto" !== e2 ? e2 : this._rotationAlignment, this._update(), this;
          }
          getPitchAlignment() {
            return this._pitchAlignment;
          }
          setOpacity(e2, t2) {
            return (void 0 === this._opacity || void 0 === e2 && void 0 === t2) && (this._opacity = "1", this._opacityWhenCovered = "0.2"), void 0 !== e2 && (this._opacity = String(e2)), void 0 !== t2 && (this._opacityWhenCovered = String(t2)), this._map && this._updateOpacity(true), this;
          }
        }
        const bs = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true };
        let ys = 0, ws = false;
        const Ts = { maxWidth: 100, unit: "metric" };
        function Ps(e2, t2, i2) {
          const o2 = (null == i2 ? void 0 : i2.maxWidth) || 100, a2 = e2._container.clientHeight / 2, r2 = e2._container.clientWidth / 2, s2 = e2.unproject([r2 - o2 / 2, a2]), n2 = e2.unproject([r2 + o2 / 2, a2]), l2 = Math.round(e2.project(n2).x - e2.project(s2).x), c2 = Math.min(o2, l2, e2._container.clientWidth), h2 = s2.distanceTo(n2);
          if ("imperial" === (null == i2 ? void 0 : i2.unit)) {
            const i3 = 3.2808 * h2;
            i3 > 5280 ? Cs(t2, c2, i3 / 5280, e2._getUIString("ScaleControl.Miles")) : Cs(t2, c2, i3, e2._getUIString("ScaleControl.Feet"));
          } else "nautical" === (null == i2 ? void 0 : i2.unit) ? Cs(t2, c2, h2 / 1852, e2._getUIString("ScaleControl.NauticalMiles")) : h2 >= 1e3 ? Cs(t2, c2, h2 / 1e3, e2._getUIString("ScaleControl.Kilometers")) : Cs(t2, c2, h2, e2._getUIString("ScaleControl.Meters"));
        }
        function Cs(e2, t2, i2, o2) {
          const a2 = (function(e3) {
            const t3 = Math.pow(10, `${Math.floor(e3)}`.length - 1);
            let i3 = e3 / t3;
            return i3 = i3 >= 10 ? 10 : i3 >= 5 ? 5 : i3 >= 3 ? 3 : i3 >= 2 ? 2 : i3 >= 1 ? 1 : (function(e4) {
              const t4 = Math.pow(10, Math.ceil(-Math.log(e4) / Math.LN10));
              return Math.round(e4 * t4) / t4;
            })(i3), t3 * i3;
          })(i2);
          e2.style.width = t2 * (a2 / i2) + "px", e2.innerHTML = `${a2}&nbsp;${o2}`;
        }
        const Ms = { closeButton: true, closeOnClick: true, focusAfterOpen: true, className: "", maxWidth: "240px", subpixelPositioning: false, locationOccludedOpacity: void 0, padding: void 0 }, Is = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
        function Es(e2) {
          if (e2) {
            if ("number" == typeof e2) {
              const i2 = Math.round(Math.abs(e2) / Math.SQRT2);
              return { center: new t.P(0, 0), top: new t.P(0, e2), "top-left": new t.P(i2, i2), "top-right": new t.P(-i2, i2), bottom: new t.P(0, -e2), "bottom-left": new t.P(i2, -i2), "bottom-right": new t.P(-i2, -i2), left: new t.P(e2, 0), right: new t.P(-e2, 0) };
            }
            if (e2 instanceof t.P || Array.isArray(e2)) {
              const i2 = t.P.convert(e2);
              return { center: i2, top: i2, "top-left": i2, "top-right": i2, bottom: i2, "bottom-left": i2, "bottom-right": i2, left: i2, right: i2 };
            }
            return { center: t.P.convert(e2.center || [0, 0]), top: t.P.convert(e2.top || [0, 0]), "top-left": t.P.convert(e2["top-left"] || [0, 0]), "top-right": t.P.convert(e2["top-right"] || [0, 0]), bottom: t.P.convert(e2.bottom || [0, 0]), "bottom-left": t.P.convert(e2["bottom-left"] || [0, 0]), "bottom-right": t.P.convert(e2["bottom-right"] || [0, 0]), left: t.P.convert(e2.left || [0, 0]), right: t.P.convert(e2.right || [0, 0]) };
          }
          return Es(new t.P(0, 0));
        }
        const Ss = i;
        e.AJAXError = t.cG, e.EXTENT = t.a6, e.Event = t.n, e.Evented = t.E, e.LngLat = t.W, e.MercatorCoordinate = t.a7, e.Point = t.P, e.addProtocol = t.cH, e.config = t.c, e.removeProtocol = t.cI, e.AttributionControl = es, e.BoxZoomHandler = _r, e.CanvasSource = oe, e.CooperativeGesturesHandler = $r, e.DoubleClickZoomHandler = Zr, e.DragPanHandler = Vr, e.DragRotateHandler = Wr, e.EdgeInsets = Ut, e.FullscreenControl = class extends t.E {
          constructor(e2 = {}) {
            var i2;
            super(), this._onFullscreenChange = () => {
              var e3;
              let t2 = window.document.fullscreenElement || window.document.webkitFullscreenElement;
              for (; null === (e3 = null == t2 ? void 0 : t2.shadowRoot) || void 0 === e3 ? void 0 : e3.fullscreenElement; ) t2 = t2.shadowRoot.fullscreenElement;
              t2 === this._container !== this._fullscreen && this._handleFullscreenChange();
            }, this._onClickFullscreen = () => {
              this._isFullscreen() ? this._exitFullscreen() : this._requestFullscreen();
            }, this._fullscreen = false, this._pseudo = null !== (i2 = e2.pseudo) && void 0 !== i2 && i2, (null == e2 ? void 0 : e2.container) && (e2.container instanceof HTMLElement ? this._container = e2.container : t.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(e2) {
            return this._map = e2, this._container || (this._container = this._map.getContainer()), this._controlContainer = d.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), this._controlContainer;
          }
          onRemove() {
            this._controlContainer.remove(), this._map = null, window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);
          }
          _setupUI() {
            const e2 = this._fullscreenButton = d.create("button", "maplibregl-ctrl-fullscreen", this._controlContainer);
            d.create("span", "maplibregl-ctrl-icon", e2).setAttribute("aria-hidden", "true"), e2.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);
          }
          _updateTitle() {
            const e2 = this._getTitle();
            this._fullscreenButton.setAttribute("aria-label", e2), this._fullscreenButton.title = e2;
          }
          _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 t.n("fullscreenstart")), this._prevCooperativeGesturesEnabled = this._map.cooperativeGestures.isEnabled(), this._map.cooperativeGestures.disable()) : (this.fire(new t.n("fullscreenend")), this._prevCooperativeGesturesEnabled && this._map.cooperativeGestures.enable());
          }
          _exitFullscreen() {
            this._pseudo ? this._togglePseudoFullScreen() : window.document.exitFullscreen ? window.document.exitFullscreen() : window.document.webkitCancelFullScreen ? window.document.webkitCancelFullScreen() : this._togglePseudoFullScreen();
          }
          _requestFullscreen() {
            this._pseudo ? this._togglePseudoFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.webkitRequestFullscreen ? this._container.webkitRequestFullscreen() : this._togglePseudoFullScreen();
          }
          _togglePseudoFullScreen() {
            this._container.classList.toggle("maplibregl-pseudo-fullscreen"), this._handleFullscreenChange(), this._map.resize();
          }
        }, e.GeoJSONSource = ee, e.GeolocateControl = class extends t.E {
          constructor(e2) {
            super(), this._onSuccess = (e3) => {
              if (this._map) {
                if (this._isOutOfMapMaxBounds(e3)) return this._setErrorState(), this.fire(new t.n("outofmaxbounds", e3)), this._updateMarker(), void this._finish();
                if (this.options.trackUserLocation) switch (this._lastKnownPosition = e3, 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 && "OFF" !== this._watchState && this._updateMarker(e3), this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(e3), this.options.showUserLocation && this._dotElement.classList.remove("maplibregl-user-location-dot-stale"), this.fire(new t.n("geolocate", e3)), this._finish();
              }
            }, this._updateCamera = (e3) => {
              const i2 = new t.W(e3.coords.longitude, e3.coords.latitude), o2 = e3.coords.accuracy, a2 = this._map.getBearing(), r2 = t.e({ bearing: a2 }, this.options.fitBoundsOptions), s2 = G.fromLngLat(i2, o2);
              this._map.fitBounds(s2, r2, { geolocateSource: true });
            }, this._updateMarker = (e3) => {
              if (e3) {
                const i2 = new t.W(e3.coords.longitude, e3.coords.latitude);
                this._accuracyCircleMarker.setLngLat(i2).addTo(this._map), this._userLocationDotMarker.setLngLat(i2).addTo(this._map), this._accuracy = e3.coords.accuracy, this._updateCircleRadiusIfNeeded();
              } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove();
            }, this._onUpdate = () => {
              this._updateCircleRadiusIfNeeded();
            }, this._onError = (e3) => {
              if (this._map) {
                if (1 === e3.code) {
                  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 = true;
                  const e4 = this._map._getUIString("GeolocateControl.LocationNotAvailable");
                  this._geolocateButton.title = e4, this._geolocateButton.setAttribute("aria-label", e4), void 0 !== this._geolocationWatchID && this._clearWatch();
                } else {
                  if (3 === e3.code && ws) return;
                  this._setErrorState();
                }
                "OFF" !== this._watchState && this.options.showUserLocation && this._dotElement.classList.add("maplibregl-user-location-dot-stale"), this.fire(new t.n("error", e3)), this._finish();
              }
            }, this._finish = () => {
              this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;
            }, this._onMoveStart = (e3) => {
              if (!this._map) return;
              const i2 = (null == e3 ? void 0 : e3[0]) instanceof ResizeObserverEntry;
              e3.geolocateSource || "ACTIVE_LOCK" !== this._watchState || i2 || 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 t.n("trackuserlocationend")), this.fire(new t.n("userlocationlostfocus")));
            }, this._setupUI = () => {
              this._map && (this._container.addEventListener("contextmenu", ((e3) => {
                e3.preventDefault();
              })), this._geolocateButton = d.create("button", "maplibregl-ctrl-geolocate", this._container), d.create("span", "maplibregl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", this._geolocateButton.disabled = true);
            }, this._finishSetupUI = (e3) => {
              if (this._map) {
                if (false === e3) {
                  t.w("Geolocation support is not available so the GeolocateControl will be disabled.");
                  const e4 = this._map._getUIString("GeolocateControl.LocationNotAvailable");
                  this._geolocateButton.disabled = true, this._geolocateButton.title = e4, this._geolocateButton.setAttribute("aria-label", e4);
                } else {
                  const e4 = this._map._getUIString("GeolocateControl.FindMyLocation");
                  this._geolocateButton.disabled = false, this._geolocateButton.title = e4, this._geolocateButton.setAttribute("aria-label", e4);
                }
                this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = d.create("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new xs({ element: this._dotElement }), this._circleElement = d.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new xs({ 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 = true, this.options.trackUserLocation && this._map.on("movestart", this._onMoveStart);
              }
            }, this.options = t.e({}, bs, e2);
          }
          onAdd(e2) {
            return this._map = e2, this._container = d.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), (function() {
              return t._(this, arguments, void 0, (function* (e3 = false) {
                if (void 0 !== ms && !e3) return ms;
                if (void 0 === window.navigator.permissions) return ms = !!window.navigator.geolocation, ms;
                try {
                  const e4 = yield window.navigator.permissions.query({ name: "geolocation" });
                  ms = "denied" !== e4.state;
                } catch (e4) {
                  ms = !!window.navigator.geolocation;
                }
                return ms;
              }));
            })().then(((e3) => this._finishSetupUI(e3))), this._container;
          }
          onRemove() {
            void 0 !== this._geolocationWatchID && (window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), this._container.remove(), this._map.off("movestart", this._onMoveStart), 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, ys = 0, ws = false;
          }
          _isOutOfMapMaxBounds(e2) {
            const t2 = this._map.getMaxBounds(), i2 = e2.coords;
            return t2 && (i2.longitude < t2.getWest() || i2.longitude > t2.getEast() || i2.latitude < t2.getSouth() || i2.latitude > t2.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 e2 = this._userLocationDotMarker.getLngLat();
            if (!(this.options.showUserLocation && this.options.showAccuracyCircle && this._accuracy && e2)) return;
            const t2 = this._map.project(e2), i2 = this._map.unproject([t2.x + 100, t2.y]), o2 = e2.distanceTo(i2) / 100, a2 = 2 * this._accuracy / o2;
            this._circleElement.style.width = `${a2.toFixed(2)}px`, this._circleElement.style.height = `${a2.toFixed(2)}px`;
          }
          trigger() {
            if (!this._setup) return t.w("Geolocate control triggered before added to a map"), false;
            if (this.options.trackUserLocation) {
              switch (this._watchState) {
                case "OFF":
                  this._watchState = "WAITING_ACTIVE", this.fire(new t.n("trackuserlocationstart"));
                  break;
                case "WAITING_ACTIVE":
                case "ACTIVE_LOCK":
                case "ACTIVE_ERROR":
                case "BACKGROUND_ERROR":
                  ys--, ws = false, 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 t.n("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 t.n("trackuserlocationstart")), this.fire(new t.n("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 ("OFF" === this._watchState && void 0 !== this._geolocationWatchID) this._clearWatch();
              else if (void 0 === this._geolocationWatchID) {
                let e2;
                this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), ys++, ys > 1 ? (e2 = { maximumAge: 6e5, timeout: 0 }, ws = true) : (e2 = this.options.positionOptions, ws = false), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, e2);
              }
            } else window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
            return true;
          }
          _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);
          }
        }, e.GlobeControl = class {
          constructor() {
            this._toggleProjection = () => {
              var e2;
              const t2 = null === (e2 = this._map.getProjection()) || void 0 === e2 ? void 0 : e2.type;
              this._map.setProjection("mercator" !== t2 && t2 ? { type: "mercator" } : { type: "globe" }), this._updateGlobeIcon();
            }, this._updateGlobeIcon = () => {
              var e2;
              this._globeButton.classList.remove("maplibregl-ctrl-globe"), this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"), "globe" === (null === (e2 = this._map.getProjection()) || void 0 === e2 ? void 0 : e2.type) ? (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(e2) {
            return this._map = e2, this._container = d.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._globeButton = d.create("button", "maplibregl-ctrl-globe", this._container), d.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._map.on("projectiontransition", this._updateGlobeIcon), this._container;
          }
          onRemove() {
            this._container.remove(), this._map.off("styledata", this._updateGlobeIcon), this._map.off("projectiontransition", this._updateGlobeIcon), this._globeButton.removeEventListener("click", this._toggleProjection), this._map = void 0;
          }
        }, e.Hash = Ya, e.ImageSource = te, e.KeyboardHandler = kr, e.LngLatBounds = G, e.LogoControl = ts, e.Map = ds, e.MapLibreMap = ds, e.MapMouseEvent = nr, e.MapTouchEvent = lr, e.MapWheelEvent = cr, e.Marker = xs, e.NavigationControl = class {
          constructor(e2) {
            this._updateZoomButtons = () => {
              const e3 = this._map.getZoom(), t2 = e3 === this._map.getMaxZoom(), i2 = e3 === this._map.getMinZoom();
              this._zoomInButton.disabled = t2, this._zoomOutButton.disabled = i2, this._zoomInButton.setAttribute("aria-disabled", t2.toString()), this._zoomOutButton.setAttribute("aria-disabled", i2.toString());
            }, this._rotateCompassArrow = () => {
              this._compassIcon.style.transform = this.options.visualizePitch && this.options.visualizeRoll ? `scale(${1 / Math.pow(Math.cos(this._map.transform.pitchInRadians), 0.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), 0.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 = (e3, t2) => {
              const i2 = this._map._getUIString(`NavigationControl.${t2}`);
              e3.title = i2, e3.setAttribute("aria-label", i2);
            }, this.options = t.e({}, _s, e2), this._container = d.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._container.addEventListener("contextmenu", ((e3) => e3.preventDefault())), this.options.showZoom && (this._zoomInButton = this._createButton("maplibregl-ctrl-zoom-in", ((e3) => this._map.zoomIn({}, { originalEvent: e3 }))), d.create("span", "maplibregl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("maplibregl-ctrl-zoom-out", ((e3) => this._map.zoomOut({}, { originalEvent: e3 }))), d.create("span", "maplibregl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (this._compass = this._createButton("maplibregl-ctrl-compass", ((e3) => {
              this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: e3 }) : this._map.resetNorth({}, { originalEvent: e3 });
            })), this._compassIcon = d.create("span", "maplibregl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true"));
          }
          onAdd(e2) {
            return this._map = e2, 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 ps(this._map, this._compass, this.options.visualizePitch)), this._container;
          }
          onRemove() {
            this._container.remove(), 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(e2, t2) {
            const i2 = d.create("button", e2, this._container);
            return i2.type = "button", i2.addEventListener("click", t2), i2;
          }
        }, e.Popup = class extends t.E {
          constructor(e2) {
            super(), this._updateOpacity = () => {
              void 0 !== this.options.locationOccludedOpacity && (this._container.style.opacity = this._map.transform.isLocationOccluded(this.getLngLat()) ? `${this.options.locationOccludedOpacity}` : "");
            }, this.remove = () => (this._content && this._content.remove(), this._container && (this._container.remove(), 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("terrain", this._update), this._map.off("projectiontransition", this._update), this._map.off("mousemove", this._update), this._map.off("mouseup", this._update), this._map.off("drag", this._update), this._map._canvasContainer.classList.remove("maplibregl-track-pointer"), delete this._map, this.fire(new t.n("close"))), this), this._update = (e3) => {
              if (!this._map || !this._lngLat && !this._trackPointer || !this._content) return;
              if (!this._container) {
                if (this._container = d.create("div", "maplibregl-popup", this._map.getContainer()), this._tip = d.create("div", "maplibregl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className) for (const e4 of this.options.className.split(" ")) this._container.classList.add(e4);
                this._closeButton && this._closeButton.setAttribute("aria-label", this._map._getUIString("Popup.Close")), this._trackPointer && this._container.classList.add("maplibregl-popup-track-pointer");
              }
              let t2;
              if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._lngLat = fs(this._lngLat, this._flatPos, this._map.transform, this._trackPointer), e3 && "point" in e3 && e3.point && (t2 = e3.point), this._trackPointer && !t2) return;
              const i2 = this._flatPos = this._pos = this._trackPointer && t2 ? t2 : this._map.project(this._lngLat);
              this._map.terrain && (this._flatPos = this._trackPointer && t2 ? t2 : this._map.transform.locationToScreenPoint(this._lngLat));
              let o2 = this.options.anchor;
              const a2 = Es(this.options.offset);
              if (!o2) {
                const e4 = this._container.offsetWidth, t3 = this._container.offsetHeight, r3 = (function(e5) {
                  var t4, i3, o3, a3;
                  return e5 ? { top: null !== (t4 = e5.top) && void 0 !== t4 ? t4 : 0, right: null !== (i3 = e5.right) && void 0 !== i3 ? i3 : 0, bottom: null !== (o3 = e5.bottom) && void 0 !== o3 ? o3 : 0, left: null !== (a3 = e5.left) && void 0 !== a3 ? a3 : 0 } : { top: 0, right: 0, bottom: 0, left: 0 };
                })(this.options.padding);
                let s2;
                s2 = i2.y + a2.bottom.y < t3 + r3.top ? ["top"] : i2.y > this._map.transform.height - t3 - r3.bottom ? ["bottom"] : [], i2.x < e4 / 2 + r3.left ? s2.push("left") : i2.x > this._map.transform.width - e4 / 2 - r3.right && s2.push("right"), o2 = 0 === s2.length ? "bottom" : s2.join("-");
              }
              let r2 = i2.add(a2[o2]);
              this.options.subpixelPositioning || (r2 = r2.round()), this._container.style.transform = `${gs[o2]} translate(${r2.x}px,${r2.y}px)`, vs(this._container, o2, "popup"), this._updateOpacity();
            }, this._onClose = () => {
              this.remove();
            }, this.options = t.e(Object.create(Ms), e2);
          }
          addTo(e2) {
            return this._map && this.remove(), this._map = e2, 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._map.on("terrain", this._update), this._map.on("projectiontransition", this._update), this._update(), this._focusFirstElement(), this._trackPointer ? (this._map.on("mousemove", this._update), this._map.on("mouseup", this._update), 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 t.n("open")), this;
          }
          isOpen() {
            return !!this._map;
          }
          getLngLat() {
            return this._lngLat;
          }
          setLngLat(e2) {
            return this._lngLat = t.W.convert(e2), this._pos = null, this._flatPos = null, this._trackPointer = false, this._update(), this._map && (this._map.on("move", this._update), this._map.off("mousemove", this._update), this._container && this._container.classList.remove("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.remove("maplibregl-track-pointer")), this;
          }
          trackPointer() {
            return this._trackPointer = true, this._pos = null, this._flatPos = null, this._update(), this._map && (this._map.off("move", this._update), this._map.on("mousemove", this._update), this._map.on("drag", this._update), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.add("maplibregl-track-pointer")), this;
          }
          getElement() {
            return this._container;
          }
          setText(e2) {
            return this.setDOMContent(document.createTextNode(e2));
          }
          setHTML(e2) {
            const t2 = document.createDocumentFragment(), i2 = document.createElement("body");
            let o2;
            for (i2.innerHTML = e2; o2 = i2.firstChild, o2; ) t2.appendChild(o2);
            return this.setDOMContent(t2);
          }
          getMaxWidth() {
            var e2;
            return null === (e2 = this._container) || void 0 === e2 ? void 0 : e2.style.maxWidth;
          }
          setMaxWidth(e2) {
            return this.options.maxWidth = e2, this._update(), this;
          }
          setDOMContent(e2) {
            if (this._content) for (; this._content.hasChildNodes(); ) this._content.firstChild && this._content.removeChild(this._content.firstChild);
            else this._content = d.create("div", "maplibregl-popup-content", this._container);
            return this._content.appendChild(e2), this._createCloseButton(), this._update(), this._focusFirstElement(), this;
          }
          addClassName(e2) {
            return this._container && this._container.classList.add(e2), this;
          }
          removeClassName(e2) {
            return this._container && this._container.classList.remove(e2), this;
          }
          setOffset(e2) {
            return this.options.offset = e2, this._update(), this;
          }
          toggleClassName(e2) {
            if (this._container) return this._container.classList.toggle(e2);
          }
          setSubpixelPositioning(e2) {
            this.options.subpixelPositioning = e2;
          }
          setPadding(e2) {
            this.options.padding = e2, this._update();
          }
          _createCloseButton() {
            this.options.closeButton && (this._closeButton = d.create("button", "maplibregl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.innerHTML = "&#215;", this._closeButton.addEventListener("click", this._onClose));
          }
          _focusFirstElement() {
            if (!this.options.focusAfterOpen || !this._container) return;
            const e2 = this._container.querySelector(Is);
            e2 && e2.focus();
          }
        }, e.RasterDEMTileSource = $, e.RasterTileSource = q, e.ScaleControl = class {
          constructor(e2) {
            this._onMove = () => {
              Ps(this._map, this._container, this.options);
            }, this.setUnit = (e3) => {
              this.options.unit = e3, Ps(this._map, this._container, this.options);
            }, this.options = Object.assign(Object.assign({}, Ts), e2);
          }
          getDefaultPosition() {
            return "bottom-left";
          }
          onAdd(e2) {
            return this._map = e2, this._container = d.create("div", "maplibregl-ctrl maplibregl-ctrl-scale", e2.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container;
          }
          onRemove() {
            this._container.remove(), this._map.off("move", this._onMove), this._map = void 0;
          }
        }, e.ScrollZoomHandler = Nr, e.Style = ki, e.TerrainControl = class {
          constructor(e2) {
            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 = e2;
          }
          onAdd(e2) {
            return this._map = e2, this._container = d.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._terrainButton = d.create("button", "maplibregl-ctrl-terrain", this._container), d.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() {
            this._container.remove(), this._map.off("terrain", this._updateTerrainIcon), this._map = void 0;
          }
        }, e.TwoFingersTouchPitchHandler = Lr, e.TwoFingersTouchRotateHandler = Dr, e.TwoFingersTouchZoomHandler = zr, e.TwoFingersTouchZoomRotateHandler = qr, e.VectorTileSource = W, e.VideoSource = ie, e.addSourceType = (e2, i2) => t._(void 0, void 0, void 0, (function* () {
          if (re(e2)) throw new Error(`A source type called "${e2}" already exists.`);
          ((e3, t2) => {
            ae[e3] = t2;
          })(e2, i2);
        })), e.clearPrewarmedResources = function() {
          const e2 = A;
          e2 && (e2.isPreloaded() && 1 === e2.numActive() ? (e2.release(z), A = 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()"));
        }, e.createTileMesh = ci, e.getGlobalDispatcher = B, e.getMaxParallelImageRequests = function() {
          return t.c.MAX_PARALLEL_IMAGE_REQUESTS;
        }, e.getRTLTextPluginStatus = function() {
          return ce().getRTLTextPluginStatus();
        }, e.getVersion = function() {
          return Ss;
        }, e.getWorkerCount = function() {
          return R.workerCount;
        }, e.getWorkerUrl = function() {
          return t.c.WORKER_URL;
        }, e.importScriptInWorkers = function(e2) {
          return B().broadcast("IS", e2);
        }, e.isTimeFrozen = function() {
          return l.isFrozen();
        }, e.now = c, e.prewarm = function() {
          F().acquire(z);
        }, e.restoreNow = function() {
          l.restoreNow();
        }, e.setMaxParallelImageRequests = function(e2) {
          t.c.MAX_PARALLEL_IMAGE_REQUESTS = e2;
        }, e.setNow = function(e2) {
          l.setNow(e2);
        }, e.setRTLTextPlugin = function(e2, t2) {
          return ce().setRTLTextPlugin(e2, t2);
        }, e.setWorkerCount = function(e2) {
          R.workerCount = e2;
        }, e.setWorkerUrl = function(e2) {
          t.c.WORKER_URL = e2;
        };
      }));
      var maplibregl$1 = maplibregl2;
      return maplibregl$1;
    }));
  }
});

// src/core/polyline.ts
function decodePolyline(str, precision = 6) {
  if (!str) return [];
  const factor = Math.pow(10, precision);
  let index = 0;
  let lat = 0;
  let lng = 0;
  const coordinates = [];
  while (index < str.length) {
    let result = 1;
    let shift = 0;
    let b;
    do {
      b = str.charCodeAt(index++) - 63 - 1;
      result += b << shift;
      shift += 5;
    } while (b >= 31);
    lat += result & 1 ? ~(result >> 1) : result >> 1;
    result = 1;
    shift = 0;
    do {
      b = str.charCodeAt(index++) - 63 - 1;
      result += b << shift;
      shift += 5;
    } while (b >= 31);
    lng += result & 1 ? ~(result >> 1) : result >> 1;
    coordinates.push([lng / factor, lat / factor]);
  }
  return coordinates;
}
function decodePolyline6(str) {
  return decodePolyline(str, 6);
}
function encodePolyline(coords, precision = 6) {
  if (!coords.length) return "";
  const factor = Math.pow(10, precision);
  let output = "";
  let prevLat = 0;
  let prevLng = 0;
  const encodeValue = (current, previous) => {
    let coordinate = Math.round(current * factor) - Math.round(previous * factor);
    coordinate <<= 1;
    if (coordinate < 0) coordinate = ~coordinate;
    let out = "";
    while (coordinate >= 32) {
      out += String.fromCharCode((32 | coordinate & 31) + 63);
      coordinate >>= 5;
    }
    out += String.fromCharCode(coordinate + 63);
    return out;
  };
  for (const [lng, lat] of coords) {
    output += encodeValue(lat, prevLat);
    output += encodeValue(lng, prevLng);
    prevLat = lat;
    prevLng = lng;
  }
  return output;
}

// src/core/coords.ts
function toLngLat(c) {
  if (Array.isArray(c)) {
    assertSane(c[0], c[1]);
    return [c[0], c[1]];
  }
  assertSane(c.lng, c.lat);
  return [c.lng, c.lat];
}
function toLatLonObj(c) {
  const [lng, lat] = toLngLat(c);
  return { lat, lon: lng };
}
function toLonLatObj(c, name) {
  const [lng, lat] = toLngLat(c);
  return name !== void 0 ? { lon: lng, lat, name } : { lon: lng, lat };
}
function toLatLngObj(c) {
  const [lng, lat] = toLngLat(c);
  return { lat, lng };
}
function parseWkt(wkt) {
  if (!wkt || typeof wkt !== "string") return null;
  const m = /POINT\s*\(\s*([-\d.eE]+)\s+([-\d.eE]+)\s*\)/i.exec(wkt);
  if (!m) return null;
  const lng = Number(m[1]);
  const lat = Number(m[2]);
  if (!Number.isFinite(lng) || !Number.isFinite(lat)) return null;
  return [lng, lat];
}
function bboxParam(b) {
  if (typeof b === "string") return b;
  if (Array.isArray(b)) {
    const [[w, s], [e, n]] = b;
    return `${w},${s},${e},${n}`;
  }
  return `${b.getWest()},${b.getSouth()},${b.getEast()},${b.getNorth()}`;
}
function latLonParams(c) {
  const [lng, lat] = toLngLat(c);
  return { lat: String(lat), lon: String(lng) };
}
function num(v) {
  if (typeof v === "number") return Number.isFinite(v) ? v : null;
  if (typeof v === "string" && v.trim() !== "") {
    const n = Number(v);
    return Number.isFinite(n) ? n : null;
  }
  return null;
}
function assertSane(lng, lat) {
  if (typeof lat === "number" && Math.abs(lat) > 90) {
    if (typeof console !== "undefined") {
      console.warn(
        `[NavvoMaps] Suspicious coordinate: latitude ${lat} is out of [-90, 90]. Did you pass [lat, lng] instead of [lng, lat]?`
      );
    }
  }
}

// src/core/errors.ts
var NavvoError = class extends Error {
  constructor(message, status = 0, code = "error", opts) {
    super(message);
    this.name = "NavvoError";
    this.status = status;
    this.code = code;
    this.path = opts?.path;
    this.body = opts?.body;
    Object.setPrototypeOf(this, new.target.prototype);
  }
};
var NavvoAuthError = class extends NavvoError {
  constructor(message = "Invalid or missing API key.", opts) {
    super(message, 401, "unauthorized", opts);
    this.name = "NavvoAuthError";
  }
};
var NavvoScopeError = class extends NavvoError {
  constructor(missingScope, opts) {
    super(
      opts?.message ?? (missingScope ? `API key is missing the "${missingScope}" scope.` : "API key is missing a required scope."),
      403,
      "missing_scope",
      opts
    );
    this.name = "NavvoScopeError";
    this.missingScope = missingScope;
  }
};
var NavvoForbiddenError = class extends NavvoError {
  constructor(message = "Forbidden \u2014 key revoked or access denied.", code = "forbidden", opts) {
    super(message, 403, code, opts);
    this.name = "NavvoForbiddenError";
  }
};
var NavvoNotFoundError = class extends NavvoError {
  constructor(message = "Not found.", opts) {
    super(message, 404, "not_found", opts);
    this.name = "NavvoNotFoundError";
  }
};
var NavvoRateLimitError = class extends NavvoError {
  constructor(message = "Rate limit / quota exceeded.", opts) {
    super(message, 429, opts?.code ?? "quota_exceeded", opts);
    this.name = "NavvoRateLimitError";
    this.retryAfterMs = opts?.retryAfterMs;
  }
};
var NavvoServerError = class extends NavvoError {
  constructor(message = "Navvo server error.", status = 500, opts) {
    super(message, status, "server_error", opts);
    this.name = "NavvoServerError";
  }
};
var NavvoNetworkError = class extends NavvoError {
  constructor(message = "Network error or timeout.", opts) {
    super(message, 0, "network_error", { path: opts?.path });
    this.name = "NavvoNetworkError";
    if (opts?.cause !== void 0) this.cause = opts.cause;
  }
};
var NavvoUnavailableError = class extends NavvoError {
  constructor(message = "Upstream service is temporarily unavailable.", opts) {
    super(message, 200, "unavailable", opts);
    this.name = "NavvoUnavailableError";
  }
};
function extractErrorInfo(body) {
  if (!body || typeof body !== "object") return {};
  const b = body;
  const message = typeof b.message === "string" && b.message || typeof b.error === "string" && b.error || typeof b.detail === "string" && b.detail || void 0;
  const code = typeof b.code === "string" && b.code || typeof b.error === "string" && b.error || void 0;
  let missingScope = typeof b.scope === "string" && b.scope || typeof b.requiredScope === "string" && b.requiredScope || typeof b.missingScope === "string" && b.missingScope || void 0;
  if (!missingScope && message) {
    const m = /scope[s]?[:\s"']*([a-z_]+)/i.exec(message);
    if (m) missingScope = m[1];
  }
  return { message, code, missingScope };
}

// src/core/http.ts
var DEFAULT_BASE_URL = "https://navvo.io/api/v1";
var SDK_VERSION = "0.1.0";
var DEFAULT_RETRY = {
  retries: 3,
  baseDelayMs: 500,
  factor: 2,
  jitter: true,
  maxDelayMs: 2e4
};
function sleep(ms, signal) {
  return new Promise((resolve, reject) => {
    const t = setTimeout(resolve, ms);
    if (signal) {
      const onAbort = () => {
        clearTimeout(t);
        reject(new DOMException("Aborted", "AbortError"));
      };
      if (signal.aborted) onAbort();
      else signal.addEventListener("abort", onAbort, { once: true });
    }
  });
}
function maskKey(key) {
  if (!key) return "(none)";
  return key.length > 8 ? `${key.slice(0, 5)}\u2026${key.slice(-4)}` : "nvvo_\u2026";
}
var HttpClient = class {
  constructor(config) {
    if (!config || !config.apiKey) {
      throw new NavvoError("A Navvo apiKey is required (nvvo_\u2026).", 0, "config_error");
    }
    const base = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
    if (!/^https:\/\//i.test(base)) {
      throw new NavvoError("baseUrl must be https://", 0, "config_error");
    }
    this.apiKey = config.apiKey;
    this.baseUrl = base;
    this.timeoutMs = config.timeoutMs ?? 15e3;
    this.retry = { ...DEFAULT_RETRY, ...config.retry ?? {} };
    this.userAgent = config.userAgent;
    this.language = config.language;
  }
  get maskedKey() {
    return maskKey(this.apiKey);
  }
  buildUrl(path, query) {
    const url = new URL(this.baseUrl + (path.startsWith("/") ? path : `/${path}`));
    if (query) {
      for (const [k, v] of Object.entries(query)) {
        if (v === void 0 || v === null) continue;
        url.searchParams.set(k, String(v));
      }
    }
    return url.toString();
  }
  async get(path, opts = {}) {
    return this.request("GET", path, { ...opts, idempotent: true });
  }
  async post(path, body, opts = {}) {
    return this.request("POST", path, { ...opts, body });
  }
  async request(method, path, opts = {}) {
    const url = this.buildUrl(path, opts.query);
    const okStatuses = opts.okStatuses ?? [200, 201];
    const retrySafe = method === "GET" || opts.idempotent === true;
    const maxAttempts = retrySafe ? this.retry.retries + 1 : 1;
    let lastErr;
    for (let attempt = 0; attempt < maxAttempts; attempt++) {
      try {
        const res = await this.doFetch(method, url, opts);
        const status = res.status;
        if (okStatuses.includes(status)) {
          return await this.parseBody(res);
        }
        const bodyText = await safeText(res);
        const parsed = safeJson(bodyText);
        const err = this.mapHttpError(status, parsed ?? bodyText, path, res.headers);
        if (this.isRetryable(status) && attempt < maxAttempts - 1) {
          lastErr = err;
          await sleep(this.backoff(attempt, err), opts.signal);
          continue;
        }
        throw err;
      } catch (e) {
        if (e instanceof NavvoError && !this.isRetryable(e.status)) throw e;
        lastErr = e instanceof NavvoError ? e : this.mapNetworkError(e, path);
        if (attempt < maxAttempts - 1) {
          await sleep(this.backoff(attempt), opts.signal);
          continue;
        }
        throw lastErr;
      }
    }
    throw lastErr instanceof Error ? lastErr : new NavvoError("Request failed", 0, "error", { path });
  }
  async doFetch(method, url, opts) {
    const controller = new AbortController();
    const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
    if (opts.signal) {
      if (opts.signal.aborted) controller.abort();
      else opts.signal.addEventListener("abort", () => controller.abort(), { once: true });
    }
    const headers = {
      "x-api-key": this.apiKey,
      accept: "application/json"
    };
    if (this.userAgent) headers["user-agent"] = this.userAgent;
    if (this.language) headers["accept-language"] = this.language;
    let bodyInit;
    if (opts.body !== void 0) {
      headers["content-type"] = "application/json";
      bodyInit = JSON.stringify(opts.body);
    }
    try {
      return await fetch(url, { method, headers, body: bodyInit, signal: controller.signal });
    } finally {
      clearTimeout(timeout);
    }
  }
  async parseBody(res) {
    const ct = res.headers.get("content-type") || "";
    if (res.status === 204) return null;
    if (ct.includes("application/json") || ct.includes("+json")) {
      return res.json();
    }
    const text = await res.text();
    return safeJson(text) ?? text;
  }
  mapHttpError(status, body, path, headers) {
    const info = extractErrorInfo(body);
    const opts = { path, body };
    if (status === 401) return new NavvoAuthError(info.message, opts);
    if (status === 403) {
      const code = (info.code || "").toLowerCase();
      const msg = (info.message || "").toLowerCase();
      if (code.includes("quota") || msg.includes("quota") || msg.includes("rate")) {
        return new NavvoRateLimitError(info.message, { ...opts, code: "quota_exceeded" });
      }
      if (info.missingScope || code.includes("scope") || msg.includes("scope")) {
        return new NavvoScopeError(info.missingScope, { ...opts, message: info.message });
      }
      return new NavvoForbiddenError(info.message || void 0, info.code || "forbidden", opts);
    }
    if (status === 404) return new NavvoNotFoundError(info.message, opts);
    if (status === 429) {
      return new NavvoRateLimitError(info.message, {
        ...opts,
        retryAfterMs: parseRetryAfter(headers.get("retry-after"))
      });
    }
    if (status >= 500) return new NavvoServerError(info.message, status, opts);
    return new NavvoError(info.message || `HTTP ${status}`, status, info.code || "http_error", opts);
  }
  mapNetworkError(e, path) {
    const name = e?.name;
    if (name === "AbortError") {
      return new NavvoNetworkError(`Request to ${path} timed out after ${this.timeoutMs}ms.`, { path, cause: e });
    }
    return new NavvoNetworkError(`Network error calling ${path}.`, { path, cause: e });
  }
  isRetryable(status) {
    return status === 0 || status === 429 || status >= 500;
  }
  backoff(attempt, err) {
    if (err instanceof NavvoRateLimitError && err.retryAfterMs) {
      return Math.min(err.retryAfterMs, this.retry.maxDelayMs);
    }
    const raw = this.retry.baseDelayMs * Math.pow(this.retry.factor, attempt);
    const capped = Math.min(raw, this.retry.maxDelayMs);
    return this.retry.jitter ? Math.random() * capped : capped;
  }
};
function parseRetryAfter(v) {
  if (!v) return void 0;
  const secs = Number(v);
  if (Number.isFinite(secs)) return secs * 1e3;
  const date = Date.parse(v);
  if (!Number.isNaN(date)) return Math.max(0, date - Date.now());
  return void 0;
}
async function safeText(res) {
  try {
    return await res.text();
  } catch {
    return "";
  }
}
function safeJson(text) {
  if (!text) return null;
  try {
    return JSON.parse(text);
  } catch {
    return null;
  }
}

// src/core/style-url.ts
function resolveStyleName(style) {
  const s = String(style).toLowerCase();
  switch (s) {
    case "road":
      return "standard";
    case "light":
      return "positron";
    default:
      return s;
  }
}
function styleUrl(style = "standard", opts) {
  const base = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
  if (/^https?:\/\//i.test(style)) {
    return injectApiKey(style, opts.apiKey);
  }
  const url = new URL(`${base}/tiles/style`);
  url.searchParams.set("style", resolveStyleName(style));
  if (opts.terrain) url.searchParams.set("terrain", "1");
  if (opts.version) url.searchParams.set("version", opts.version);
  if (opts.apiKey) url.searchParams.set("api_key", opts.apiKey);
  return url.toString();
}
function injectApiKey(rawUrl, apiKey) {
  if (!apiKey) return rawUrl;
  try {
    const u = new URL(rawUrl);
    if (!u.searchParams.has("api_key") && !u.searchParams.has("apiKey")) {
      u.searchParams.set("api_key", apiKey);
    }
    return u.toString();
  } catch {
    if (/[?&]api_?key=/i.test(rawUrl)) return rawUrl;
    return rawUrl + (rawUrl.includes("?") ? "&" : "?") + "api_key=" + encodeURIComponent(apiKey);
  }
}
var METHOD_SCOPES = {
  styles: ["tiles"],
  styleUrl: ["tiles"],
  mapConfig: ["tiles"],
  layers: ["tiles"],
  categoryStyles: ["tiles"],
  search: ["search"],
  geocode: ["geocode"],
  reverseGeocode: ["geocode"],
  geocodeBatch: ["geocode"],
  reverseGeocodeBatch: ["geocode"],
  place: ["places"],
  placeThumb: ["places"],
  placeHours: ["places"],
  placePhotos: ["places"],
  placeCategories: ["places"],
  placeFacets: ["places"],
  placesList: ["places"],
  reachable: ["places"],
  route: ["routing"],
  simpleRoute: ["routing"],
  matrix: ["routing"],
  isochrone: ["routing"],
  mapMatch: ["routing"],
  optimize: ["optimize", "routing"],
  trafficRoute: ["routing", "traffic"],
  trafficSummary: ["traffic"],
  trafficLayers: ["traffic"],
  incidents: ["traffic"],
  incidentTypes: ["traffic"],
  reportIncident: ["traffic"],
  voteIncident: ["traffic"],
  roadEdits: ["tiles"],
  routeRisk: ["routing"],
  routeEnforcement: ["routing"],
  weatherPoint: ["tiles"],
  weatherForecast: ["tiles"],
  weatherAlerts: ["tiles"],
  weatherCities: ["tiles"],
  airQualityCities: ["tiles"],
  overlay: ["tiles"],
  evStations: ["geo"],
  transitStops: ["geo"],
  gbfs: ["geo"],
  mapFeatures: ["imagery"]
};

// src/services/directions.ts
var Directions = class {
  constructor(services) {
    this.services = services;
  }
  /** POST /routing/plan — corridor-aware directions. Returns the normalised result. */
  plan(input) {
    return this.services.route(input);
  }
  /** POST /routing/route — simple/fast directions (no corridor avoidance). */
  simple(input) {
    return this.services.simpleRoute(input);
  }
  /** POST /traffic/route — traffic-aware ETA + congestion-coloured segments. */
  trafficRoute(input) {
    return this.services.trafficRoute(input);
  }
  /** Build a flat turn list from a route plan result (all legs concatenated). */
  getTurnList(route) {
    const items = [];
    for (const leg of route.legs) {
      for (const m of leg.maneuvers) {
        items.push({
          icon: maneuverIcon(m.type, m.roundaboutExitCount),
          text: m.instruction,
          distanceText: formatDistance(m.length),
          durationText: formatDuration(m.time),
          lengthKm: m.length,
          timeSec: m.time,
          type: m.type
        });
      }
    }
    return items;
  }
};
function maneuverIcon(type, roundaboutExit) {
  switch (type) {
    case 0:
      return "none";
    case 1:
    // start
    case 2:
    // start-right
    case 3:
      return "depart";
    case 4:
    // destination
    case 5:
    // destination-right
    case 6:
      return "arrive";
    case 7:
    // becomes
    case 8:
      return "straight";
    case 9:
      return "turn-slight-right";
    case 10:
      return "turn-right";
    case 11:
      return "turn-sharp-right";
    case 12:
    // uturn-right
    case 13:
      return "uturn";
    case 14:
      return "turn-sharp-left";
    case 15:
      return "turn-left";
    case 16:
      return "turn-slight-left";
    case 17:
      return "ramp-straight";
    case 18:
      return "ramp-right";
    case 19:
      return "ramp-left";
    case 20:
      return "exit-right";
    case 21:
      return "exit-left";
    case 22:
    // stay-straight
    case 23:
    // stay-right
    case 24:
      return "merge";
    case 25:
      return "merge";
    case 26:
    // roundabout-enter
    case 27:
      return roundaboutExit ? `roundabout-${roundaboutExit}` : "roundabout";
    case 37:
      return "merge-right";
    case 38:
      return "merge-left";
    default:
      return "straight";
  }
}
function formatDistance(km) {
  if (!Number.isFinite(km) || km <= 0) return "";
  if (km < 1) return `${Math.round(km * 1e3)} m`;
  return `${km.toFixed(km < 10 ? 1 : 0)} km`;
}
function formatDuration(sec) {
  if (!Number.isFinite(sec) || sec <= 0) return "";
  const mins = Math.round(sec / 60);
  if (mins < 60) return `${mins} min`;
  const h = Math.floor(mins / 60);
  const m = mins % 60;
  return m ? `${h} h ${m} min` : `${h} h`;
}

// src/services/services.ts
var NavvoServices = class {
  constructor(config) {
    this.http = new HttpClient(config);
    this.throwOnUnavailable = config.throwOnUnavailable ?? false;
    this.defaultLanguage = config.language;
    this.directions = new Directions(this);
  }
  // ---------------------------------------------------------------------------
  // Tiles / config
  // ---------------------------------------------------------------------------
  /** GET /tiles/styles — the style catalog (for a style switcher). */
  styles() {
    return this.http.get("/tiles/styles");
  }
  /** Build a tiles/style URL with the api_key query param. */
  styleUrl(style = "standard", opts) {
    return styleUrl(style, { apiKey: this.http.apiKey, baseUrl: this.http.baseUrl, ...opts });
  }
  /** GET /tiles/layers — logical layer catalog. */
  layers() {
    return this.http.get("/tiles/layers");
  }
  /** GET /map/config — the bootstrap manifest. Cached after the first call. */
  mapConfig() {
    if (!this.configCache) this.configCache = this.http.get("/map/config");
    return this.configCache;
  }
  /** GET /map/category-styles — renderer-ready category marker styling. */
  categoryStyles() {
    return this.http.get("/map/category-styles");
  }
  // ---------------------------------------------------------------------------
  // Search
  // ---------------------------------------------------------------------------
  /** GET /search — full-text place search. */
  async search(q, opts = {}) {
    const bbox = opts.bbox ? bboxParam(opts.bbox) : void 0;
    const raw = await this.http.get("/search", {
      query: {
        q,
        limit: opts.limit,
        page: opts.page,
        locale: opts.locale ?? opts.lang ?? this.defaultLanguage,
        bbox
      }
    });
    const places = raw.places ?? {};
    const items = (places.items ?? []).map((it) => this.normalizePlaceSummary(it));
    return {
      query: raw.query ?? q,
      locale: raw.locale ?? opts.locale ?? "en",
      items,
      total: places.total ?? items.length,
      page: places.page ?? 1,
      limit: places.limit ?? opts.limit ?? 25,
      understanding: raw.understanding,
      raw
    };
  }
  normalizePlaceSummary(it) {
    const center = parseWkt(it.center) ?? [0, 0];
    return {
      id: String(it.id ?? ""),
      slug: String(it.slug ?? ""),
      nameEn: String(it.nameEn ?? ""),
      nameAr: String(it.nameAr ?? ""),
      categories: it.categories ?? [],
      canonicalCategorySlug: it.canonicalCategorySlug,
      rawCategories: it.rawCategories,
      rating: Number(it.rating ?? 0),
      sponsored: Boolean(it.sponsored),
      lngLat: center
    };
  }
  // ---------------------------------------------------------------------------
  // Geocoding
  // ---------------------------------------------------------------------------
  /** GET /geocode/search — forward geocoding. */
  async geocode(q, opts = {}) {
    let lat;
    let lon;
    if (opts.near) {
      const [lng, la] = toLngLat(opts.near);
      lat = String(la);
      lon = String(lng);
    }
    const env = await this.http.get(
      "/geocode/search",
      {
        query: {
          q,
          limit: opts.limit,
          locale: opts.locale ?? this.defaultLanguage,
          bbox: opts.bbox ? bboxParam(opts.bbox) : void 0,
          lat,
          lon
        }
      }
    );
    return this.wrapGeocodeEnvelope(env, env.data ?? [], "/geocode/search");
  }
  /** GET /geocode/reverse — reverse geocoding (separate lat & lon params). */
  async reverseGeocode(coord) {
    const [lng, lat] = toLngLat(coord);
    const env = await this.http.get(
      "/geocode/reverse",
      { query: { lat: String(lat), lon: String(lng) } }
    );
    const list = env.data ? [env.data] : [];
    return this.wrapGeocodeEnvelope(env, list, "/geocode/reverse");
  }
  /** POST /geocode/batch — bulk forward geocode (max 50). */
  async geocodeBatch(queries, opts = {}) {
    const raw = await this.http.post(
      "/geocode/batch",
      { queries, locale: opts.locale ?? this.defaultLanguage, bbox: opts.bbox ? bboxParam(opts.bbox) : void 0 },
      { idempotent: true }
    );
    return {
      count: raw.count,
      found: raw.found,
      results: (raw.results ?? []).map((r) => ({
        query: String(r.query ?? ""),
        found: Boolean(r.found),
        lngLat: r.found ? [num(r.lng) ?? 0, num(r.lat) ?? 0] : null,
        displayName: r.displayName,
        type: r.type,
        category: r.category
      }))
    };
  }
  /** POST /geocode/reverse-batch — bulk reverse geocode (max 50). */
  async reverseGeocodeBatch(points) {
    const raw = await this.http.post(
      "/geocode/reverse-batch",
      { points: points.map((p) => toLatLngObj(p)) },
      { idempotent: true }
    );
    return {
      count: raw.count,
      found: raw.found,
      results: (raw.results ?? []).map((r) => ({
        lngLat: [num(r.lng) ?? 0, num(r.lat) ?? 0],
        found: Boolean(r.found),
        displayName: r.displayName,
        type: r.type,
        address: r.address
      }))
    };
  }
  wrapGeocodeEnvelope(env, rows, path) {
    if (!env.available) {
      this.maybeThrowUnavailable(path, env);
      return { provider: env.provider, available: false, results: [], status: env.status };
    }
    const results = rows.map((d) => {
      const lat = num(d.lat) ?? 0;
      const lon = num(d.lon) ?? 0;
      const bb = d.boundingbox;
      let bounds;
      if (bb && bb.length === 4) {
        const minLat = num(bb[0]) ?? 0;
        const maxLat = num(bb[1]) ?? 0;
        const minLon = num(bb[2]) ?? 0;
        const maxLon = num(bb[3]) ?? 0;
        bounds = [[minLon, minLat], [maxLon, maxLat]];
      }
      return {
        displayName: String(d.display_name ?? d.name ?? ""),
        lngLat: [lon, lat],
        bounds,
        type: d.type,
        category: d.category,
        name: d.name,
        address: d.address,
        raw: d
      };
    });
    return { provider: env.provider, available: true, results, status: env.status };
  }
  // ---------------------------------------------------------------------------
  // Places
  // ---------------------------------------------------------------------------
  /**
   * GET /places/{slug} — full place detail.
   *
   * Soft-null getter: returns `null` when the place is unknown (the API answers
   * HTTP 404, which the HTTP layer surfaces as a typed NavvoNotFoundError that we
   * catch here). Some deployments answer 200 with an empty/`null` body for an
   * unknown slug; that is normalised to `null` too. All other typed errors
   * (auth, scope, rate-limit, server, network) still propagate.
   */
  async place(slug) {
    let res;
    try {
      res = await this.http.get(`/places/${encodeURIComponent(slug)}`);
    } catch (err) {
      if (err instanceof NavvoNotFoundError) return null;
      throw err;
    }
    if (res == null || typeof res === "object" && Object.keys(res).length === 0) {
      return null;
    }
    return res;
  }
  /** GET /places/thumb?slug= — lightweight card thumbnail + open state. */
  placeThumb(slug) {
    return this.http.get("/places/thumb", { query: { slug } });
  }
  /** GET /places/{slug}/hours — opening-hours engine. */
  placeHours(slug, at) {
    return this.http.get(`/places/${encodeURIComponent(slug)}/hours`, { query: { at } });
  }
  /** GET /places/{slug}/popular-times — busyness. */
  placePopularTimes(slug) {
    return this.http.get(`/places/${encodeURIComponent(slug)}/popular-times`);
  }
  /** GET /places/{slug}/photos — gallery. */
  placePhotos(slug, opts = {}) {
    return this.http.get(`/places/${encodeURIComponent(slug)}/photos`, { query: { page: opts.page, limit: opts.limit } });
  }
  /** GET /places/categories — the category taxonomy. */
  placeCategories() {
    return this.http.get("/places/categories");
  }
  /** GET /places/facets — amenity facets. */
  placeFacets(q) {
    return this.http.get("/places/facets", { query: { q } });
  }
  /** GET /places — list places with filters. */
  placesList(opts = {}) {
    let near;
    if (opts.near) {
      const [lng, lat] = toLngLat(opts.near);
      near = `${lat},${lng}`;
    }
    return this.http.get("/places", {
      query: {
        q: opts.q,
        page: opts.page,
        limit: opts.limit,
        category: opts.category,
        amenities: opts.amenities,
        openNow: opts.openNow,
        sort: opts.sort,
        minRating: opts.minRating,
        near,
        radiusKm: opts.radiusKm
      }
    });
  }
  /** POST /places/reachable — places inside an isochrone. */
  reachable(input) {
    return this.http.post(
      "/places/reachable",
      {
        origin: toLatLngObj(input.origin),
        minutes: input.minutes,
        costing: input.costing,
        q: input.q,
        categories: Array.isArray(input.categories) ? input.categories.join(",") : input.categories,
        amenities: input.amenities,
        limit: input.limit
      },
      { idempotent: true }
    );
  }
  // ---------------------------------------------------------------------------
  // Routing
  // ---------------------------------------------------------------------------
  /** POST /routing/plan — corridor-aware high-level directions. */
  async route(input) {
    const body = this.buildPlanBody(input);
    const raw = await this.http.post("/routing/plan", body, {
      okStatuses: [200, 201],
      idempotent: true
    });
    return this.normalizePlan(raw);
  }
  /** POST /routing/route — simple/fast directions (no corridor avoidance). */
  async simpleRoute(input) {
    const payload = {
      locations: input.waypoints.map((w) => toLatLonObj(w.lngLat)),
      costing: input.costing ?? "auto",
      directions_options: { units: "kilometers", language: input.language ?? this.defaultLanguage ?? "en-US" }
    };
    const raw = await this.http.post("/routing/route", { payload }, {
      okStatuses: [200, 201],
      idempotent: true
    });
    return this.normalizePassthroughTrip(raw, raw);
  }
  /** POST /routing/matrix — travel-time/distance matrix. */
  async matrix(input) {
    const payload = {
      sources: input.origins.map((o) => toLatLonObj(o)),
      targets: input.destinations.map((d) => toLatLonObj(d)),
      costing: input.costing ?? "auto",
      units: input.units ?? "kilometers"
    };
    const env = await this.http.post(
      "/routing/matrix",
      { payload },
      { okStatuses: [200, 201], idempotent: true }
    );
    if (!env.available) {
      this.maybeThrowUnavailable("/routing/matrix", env);
      return { available: false, cells: [], raw: env };
    }
    const rows = (env.data?.sources_to_targets ?? []).map(
      (row) => row.map((cell) => ({
        distance: cell?.distance == null ? null : Number(cell.distance),
        time: cell?.time == null ? null : Number(cell.time)
      }))
    );
    return { available: true, cells: rows, raw: env };
  }
  /** POST /routing/isochrone — reachability polygons. */
  async isochrone(input) {
    const contours = input.contours.map((c) => {
      const o = {};
      if (c.minutes != null) o.time = c.minutes;
      if (c.km != null) o.distance = c.km;
      if (c.color) o.color = c.color;
      return o;
    });
    const payload = {
      locations: [toLatLonObj(input.origin)],
      costing: input.costing ?? "pedestrian",
      contours,
      polygons: input.polygons ?? true
    };
    const env = await this.http.post(
      "/routing/isochrone",
      { payload },
      { okStatuses: [200, 201], idempotent: true }
    );
    if (!env.available) {
      this.maybeThrowUnavailable("/routing/isochrone", env);
      return { available: false, geojson: null, raw: env };
    }
    return { available: true, geojson: env.data ?? null, raw: env };
  }
  /** POST /routing/map-match — snap a GPS trace to roads. */
  mapMatch(payload) {
    return this.http.post("/routing/map-match", { payload }, { okStatuses: [200, 201], idempotent: true });
  }
  /** POST /routing/optimize — optimal stop ordering (TSP). */
  async optimize(input) {
    const payload = {
      locations: input.stops.map((s) => toLatLonObj(s)),
      costing: input.costing ?? "auto"
    };
    const env = await this.http.post(
      "/routing/optimize",
      { payload },
      { okStatuses: [200, 201], idempotent: true }
    );
    if (!env.available) {
      this.maybeThrowUnavailable("/routing/optimize", env);
      return { available: false, order: [], raw: env };
    }
    const locs = env.data?.trip?.locations ?? [];
    const order = locs.map((l) => Number(l.original_index ?? 0));
    return { available: true, order, raw: env };
  }
  // ---------------------------------------------------------------------------
  // Traffic & incidents
  // ---------------------------------------------------------------------------
  /** POST /traffic/route — traffic-aware ETA + congestion-coloured segments. */
  async trafficRoute(input) {
    const raw = await this.http.post(
      "/traffic/route",
      {
        locations: input.waypoints.map((w) => toLonLatObj(w.lngLat, w.name)),
        costing: input.costing ?? "auto",
        departureTime: input.departureTime,
        language: input.language ?? this.defaultLanguage
      },
      { okStatuses: [200, 201], idempotent: true }
    );
    if (!raw.available) this.maybeThrowUnavailable("/traffic/route", raw);
    return {
      available: Boolean(raw.available),
      distanceKm: Number(raw.distanceKm ?? 0),
      baseDurationSeconds: Number(raw.baseDurationSeconds ?? 0),
      durationInTrafficSeconds: Number(raw.durationInTrafficSeconds ?? 0),
      delaySeconds: Number(raw.delaySeconds ?? 0),
      departureTime: raw.departureTime,
      arrivalTime: raw.arrivalTime,
      traffic: raw.traffic,
      segments: raw.segments ?? { type: "FeatureCollection", features: [] },
      legend: raw.legend,
      raw
    };
  }
  /** GET /traffic/summary — aggregate live conditions over a bbox. */
  trafficSummary(bbox) {
    return this.http.get("/traffic/summary", { query: { bbox: bbox ? bboxParam(bbox) : void 0 } });
  }
  /** GET /traffic/layers — live traffic layer descriptor + legend. */
  trafficLayers() {
    return this.http.get("/traffic/layers");
  }
  /** GET /incidents/geojson — active incidents as GeoJSON. */
  incidents(opts = {}) {
    return this.http.get("/incidents/geojson", {
      query: { bbox: opts.bbox ? bboxParam(opts.bbox) : void 0, type: opts.type, limit: opts.limit, zoom: opts.zoom }
    });
  }
  /** GET /incidents/types — the incident type catalog. */
  incidentTypes() {
    return this.http.get("/incidents/types");
  }
  /** POST /incidents/report — community report (auto-dedup). */
  reportIncident(input) {
    const [lng, lat] = toLngLat(input.lngLat);
    return this.http.post("/incidents/report", {
      type: input.type,
      lat,
      lng,
      title: input.title,
      description: input.description,
      severity: input.severity,
      ttlMinutes: input.ttlMinutes,
      dedupMeters: input.dedupMeters
    });
  }
  /** POST /incidents/{id}/votes — confirm/reject an incident. */
  voteIncident(id, vote, userId) {
    return this.http.post(`/incidents/${encodeURIComponent(id)}/votes`, { vote, userId });
  }
  // ---------------------------------------------------------------------------
  // Road edits & route risk
  // ---------------------------------------------------------------------------
  /** GET /road-edits/geojson — active closures/restrictions/custom roads. */
  roadEdits(bbox) {
    return this.http.get("/road-edits/geojson", { query: { bbox: bbox ? bboxParam(bbox) : void 0 } });
  }
  /** POST /map/route-risk — score a route geometry against live conditions. */
  routeRisk(geometry, opts = {}) {
    return this.http.post("/map/route-risk", { geometry, routeId: opts.routeId, timeOffset: opts.timeOffset });
  }
  /** POST /map/route-enforcement — cameras/lights along a route. */
  routeEnforcement(geometry, opts = {}) {
    return this.http.post("/map/route-enforcement", { geometry, routeId: opts.routeId });
  }
  // ---------------------------------------------------------------------------
  // Weather & air quality
  // ---------------------------------------------------------------------------
  /** GET /map/weather/point — current point weather + live air quality. */
  weatherPoint(coord, opts = {}) {
    const [lng, lat] = toLngLat(coord);
    return this.http.get("/map/weather/point", { query: { lat, lng, units: opts.units } });
  }
  /** GET /map/weather/forecast — hourly forecast. */
  weatherForecast(coord, opts = {}) {
    const [lng, lat] = toLngLat(coord);
    return this.http.get("/map/weather/forecast", { query: { lat, lng, hours: opts.hours, units: opts.units } });
  }
  /** GET /map/weather/alerts — derived warnings for a point. */
  weatherAlerts(coord, opts = {}) {
    const [lng, lat] = toLngLat(coord);
    return this.http.get("/map/weather/alerts", { query: { lat, lng, hours: opts.hours } });
  }
  /** GET /map/weather/cities — weather pins in a viewport (zoom >= 7). */
  weatherCities(bbox, zoom, opts = {}) {
    return this.http.get("/map/weather/cities", { query: { bbox: bboxParam(bbox), zoom, units: opts.units, limit: opts.limit } });
  }
  /** GET /map/airquality/cities — air-quality pins in a viewport (zoom >= 7). */
  airQualityCities(bbox, zoom, opts = {}) {
    return this.http.get("/map/airquality/cities", { query: { bbox: bboxParam(bbox), zoom, limit: opts.limit } });
  }
  // ---------------------------------------------------------------------------
  // Overlays (generic)
  // ---------------------------------------------------------------------------
  /** GET /map/overlays/{layerType} — one overlay as GeoJSON. */
  overlay(layerType, opts = {}) {
    return this.http.get(`/map/overlays/${encodeURIComponent(layerType)}`, {
      query: { bbox: opts.bbox ? bboxParam(opts.bbox) : void 0, limit: opts.limit, zoom: opts.zoom }
    });
  }
  // ---------------------------------------------------------------------------
  // Mobility (EV / transit / GBFS)
  // ---------------------------------------------------------------------------
  /** GET /ev/stations — charging stations in a viewport. */
  evStations(opts) {
    return this.http.get("/ev/stations", {
      query: {
        bbox: bboxParam(opts.bbox),
        minKw: opts.minKw,
        connector: opts.connector,
        limit: opts.limit,
        available: opts.availableOnly ? 1 : void 0
      }
    });
  }
  /** GET /transit/stops — transit stops near a point (radius in metres). */
  transitStops(coord, radius = 500) {
    const [lng, lat] = toLngLat(coord);
    return this.http.get("/transit/stops", { query: { lat, lng, radius } });
  }
  /** GET /transit/gbfs — shared docks/bikes/scooters near a point. */
  gbfs(coord, opts = {}) {
    const [lng, lat] = toLngLat(coord);
    return this.http.get("/transit/gbfs", { query: { lat, lng, radius: opts.radius, type: opts.type } });
  }
  // ---------------------------------------------------------------------------
  // Imagery
  // ---------------------------------------------------------------------------
  /** GET /imagery/map-features — signs/points from street-level imagery. */
  mapFeatures(opts = {}) {
    return this.http.get("/imagery/map-features", { query: { bbox: opts.bbox ? bboxParam(opts.bbox) : void 0 } });
  }
  // ---------------------------------------------------------------------------
  // Internal normalisers (shared with Directions)
  // ---------------------------------------------------------------------------
  buildPlanBody(input) {
    const body = {
      locations: input.waypoints.map((w) => toLonLatObj(w.lngLat, w.name)),
      costing: input.costing ?? "auto",
      preference: input.preference,
      avoid: input.avoid,
      optimize: input.optimize,
      avoidIncidents: input.avoidIncidents,
      avoidReported: input.avoidReported,
      disregard: input.disregard,
      constraintsText: input.constraintsText,
      includeLabels: input.includeLabels,
      language: input.language ?? this.defaultLanguage,
      departureTime: input.departureTime
    };
    if (input.truck) {
      body.truck = input.truck;
    }
    for (const k of Object.keys(body)) if (body[k] === void 0) delete body[k];
    return body;
  }
  /** Normalise a /routing/plan response (engine envelope), tolerant of a flat shape. */
  normalizePlan(raw) {
    const engine = raw.engine ?? raw;
    if (engine.available === false) this.maybeThrowUnavailable("/routing/plan", engine);
    const data = engine.data ?? {};
    const trip = data.trip ?? {};
    const base = this.tripToResult(trip);
    const alternatesRaw = data.alternates ?? [];
    const alternates = alternatesRaw.map((a) => this.tripToResult(a.trip ?? {}, raw));
    return {
      ...base,
      available: engine.available !== false,
      alternates,
      labels: raw.labels?.parsed ?? null,
      logistics: raw.logistics,
      signConstraints: raw.signConstraints,
      incidentConstraints: raw.incidentConstraints,
      reportedConstraints: raw.reportedConstraints,
      roadEditConstraints: raw.roadEditConstraints,
      routeProfile: raw.routeProfile,
      raw
    };
  }
  /** Normalise a passthrough /routing/route response (has `data.trip`). */
  normalizePassthroughTrip(env, raw) {
    if (env.available === false) this.maybeThrowUnavailable("/routing/route", env);
    const data = env.data ?? {};
    const trip = data.trip ?? {};
    const base = this.tripToResult(trip);
    return {
      ...base,
      available: env.available !== false,
      labels: env.labels?.parsed ?? null,
      raw
    };
  }
  /** Convert a raw engine `trip` object to a normalised RoutePlanResult (no envelope fields). */
  tripToResult(trip, raw = trip) {
    const legsRaw = trip.legs ?? [];
    const legs = legsRaw.map((leg) => {
      const shape = String(leg.shape ?? "");
      const geometry2 = shape ? decodePolyline6(shape) : [];
      const maneuvers = (leg.maneuvers ?? []).map((m) => ({
        type: Number(m.type ?? 0),
        instruction: String(m.instruction ?? ""),
        verbalInstruction: m.verbal_pre_transition_instruction ?? m.verbal_transition_alert_instruction ?? void 0,
        streetNames: m.street_names,
        length: Number(m.length ?? 0),
        time: Number(m.time ?? 0),
        roundaboutExitCount: m.roundabout_exit_count,
        beginShapeIndex: m.begin_shape_index,
        raw: m
      }));
      const summary = leg.summary ?? {};
      return {
        maneuvers,
        geometry: geometry2,
        shape,
        summary: { length: Number(summary.length ?? 0), time: Number(summary.time ?? 0) }
      };
    });
    const tripSummary = trip.summary ?? {};
    const geometry = legs.flatMap((l) => l.geometry);
    return {
      available: true,
      geometry,
      shape: legs[0]?.shape ?? "",
      summary: { length: Number(tripSummary.length ?? 0), time: Number(tripSummary.time ?? 0) },
      legs,
      alternates: [],
      raw
    };
  }
  maybeThrowUnavailable(path, body) {
    if (this.throwOnUnavailable) {
      throw new NavvoUnavailableError(`Service for ${path} is temporarily unavailable (available:false).`, { path, body });
    }
  }
};

// src/map/maplibre.ts
var import_maplibre_gl = __toESM(require_maplibre_gl());
var _engineOverride = null;
function __setMapEngine(engine) {
  _engineOverride = engine;
}
var resolveEngine = () => _engineOverride ?? import_maplibre_gl.default;
var maplibregl = new Proxy({}, {
  get: (_target, prop) => resolveEngine()[prop]
});
var engineVersion = String(resolveEngine().version ?? "unknown");
var rtlInitialised = false;
var DEFAULT_RTL_TEXT_PLUGIN_URL = "https://docs.navvo.io/sdks/assets/rtl-text.min.js";
function ensureRtlPlugin(pluginUrl = DEFAULT_RTL_TEXT_PLUGIN_URL) {
  if (rtlInitialised) return;
  const setRtl = maplibregl.setRTLTextPlugin;
  if (typeof setRtl !== "function") return;
  try {
    const status = maplibregl.getRTLTextPluginStatus?.();
    if (status && status !== "unavailable") {
      rtlInitialised = true;
      return;
    }
    setRtl(
      pluginUrl || DEFAULT_RTL_TEXT_PLUGIN_URL,
      (err) => {
        if (err && typeof console !== "undefined") {
          console.warn("[NavvoMaps] RTL text plugin failed to load:", err.message);
        }
      },
      true
      // lazy
    );
    rtlInitialised = true;
  } catch {
  }
}

// src/map/map.ts
var DEFAULT_CENTER = [35.9106, 31.9539];
var NavvoMap = class {
  constructor(options) {
    this.userSourceIds = /* @__PURE__ */ new Set();
    this.userLayerIds = /* @__PURE__ */ new Set();
    const apiKey = options.apiKey ?? options.mapKey ?? "";
    const baseUrl = (options.baseUrl ?? "https://navvo.io/api/v1").replace(/\/+$/, "");
    const styleOpt = options.style ?? "standard";
    const styleIsFullUrl = typeof styleOpt === "string" && /^https?:\/\//i.test(styleOpt);
    const styleIsObject = typeof styleOpt === "object";
    if (!apiKey && !styleIsFullUrl && !styleIsObject) {
      throw new NavvoError("NavvoMap requires an apiKey (or a full style URL with ?api_key=).", 0, "config_error");
    }
    this.apiKey = apiKey;
    this.baseUrl = baseUrl;
    this.terrainEnabled = options.terrain ?? false;
    this.currentStyle = styleOpt;
    if (options.rtl !== false) ensureRtlPlugin(options.rtlTextPluginUrl);
    const resolvedStyle = this.resolveStyle(styleOpt);
    const mapOptions = {
      container: options.container,
      style: resolvedStyle,
      center: options.center ?? DEFAULT_CENTER,
      zoom: options.zoom ?? 12,
      bearing: options.bearing ?? 0,
      pitch: options.pitch ?? 0,
      minZoom: options.minZoom,
      maxZoom: options.maxZoom,
      maxBounds: options.maxBounds,
      interactive: options.interactive ?? true,
      // Compact "ⓘ" Navvo attribution shown by default (comes from the style's source attribution).
      // Pass `false` only if you render the credit elsewhere in your own UI.
      attributionControl: options.attributionControl ?? { compact: true },
      pixelRatio: options.pixelRatio,
      // Inject the key into every browser-fetched map resource.
      transformRequest: this.makeTransformRequest()
    };
    if (options.enable3D || this.usesTerrain()) {
      mapOptions.maxPitch = 85;
    }
    for (const k of Object.keys(mapOptions)) if (mapOptions[k] === void 0) delete mapOptions[k];
    this.map = new maplibregl.Map(mapOptions);
    this.map.on("error", (e) => {
      if (typeof console !== "undefined") {
        console.warn("[NavvoMaps] map error:", e?.error?.message ?? e);
      }
    });
    if (options.terrain || options.enable3D) {
      this.map.on("style.load", () => this.setTerrain(this.terrainEnabled));
    }
  }
  usesTerrain() {
    const s = typeof this.currentStyle === "string" ? resolveStyleName(this.currentStyle) : "";
    return this.terrainEnabled || s === "3d" || s === "terrain";
  }
  /** Build the transformRequest that appends ?api_key= to Navvo-hosted URLs. */
  makeTransformRequest() {
    const key = this.apiKey;
    const host = (() => {
      try {
        return new URL(this.baseUrl).host;
      } catch {
        return "navvo.io";
      }
    })();
    return (url, _resourceType) => {
      if (!key) return { url };
      let isNavvo = false;
      try {
        isNavvo = new URL(url).host === host || url.includes("/api/v1/");
      } catch {
        isNavvo = url.includes("navvo.io") || url.includes("/api/v1/");
      }
      return { url: isNavvo ? injectApiKey(url, key) : url };
    };
  }
  resolveStyle(style) {
    if (typeof style === "object") return style;
    return styleUrl(style, { apiKey: this.apiKey, baseUrl: this.baseUrl, terrain: this.usesTerrain() });
  }
  // ---- Style switching (overlay-preserving) ----
  /**
   * Swap the style, preserving user-added sources/layers/overlays.
   * GL drops them on setStyle by default; we capture and re-apply.
   */
  setStyle(style, opts = {}) {
    if (opts.terrain !== void 0) this.terrainEnabled = opts.terrain;
    this.currentStyle = style;
    const preserved = this.captureUserLayers();
    const resolved = typeof style === "object" ? style : styleUrl(style, { apiKey: this.apiKey, baseUrl: this.baseUrl, terrain: opts.terrain ?? this.usesTerrain() });
    this.map.setStyle(resolved);
    this.map.once("styledata", () => {
      this.restoreUserLayers(preserved);
      if (this.usesTerrain()) this.setTerrain(true);
    });
  }
  captureUserLayers() {
    const style = this.map.getStyle?.();
    const sources = {};
    const layers = [];
    if (!style) return { sources, layers };
    for (const [id, src] of Object.entries(style.sources ?? {})) {
      if (this.userSourceIds.has(id)) sources[id] = src;
    }
    for (const layer of style.layers ?? []) {
      if (this.userLayerIds.has(layer.id)) layers.push(layer);
    }
    return { sources, layers };
  }
  restoreUserLayers(preserved) {
    for (const [id, src] of Object.entries(preserved.sources)) {
      if (!this.map.getSource(id)) this.map.addSource(id, src);
    }
    for (const layer of preserved.layers) {
      const id = layer.id;
      if (!this.map.getLayer(id)) this.map.addLayer(layer);
    }
  }
  /** Idempotently add a source we track for setStyle preservation. */
  addTrackedSource(id, source) {
    if (!this.map.getSource(id)) this.map.addSource(id, source);
    this.userSourceIds.add(id);
  }
  /** Idempotently add a layer we track for setStyle preservation. */
  addTrackedLayer(layer) {
    if (!this.map.getLayer(layer.id)) this.map.addLayer(layer);
    this.userLayerIds.add(layer.id);
  }
  // ---- 3D / terrain ----
  /** Enable the 3D feature set: extrusions + terrain (if present in the style). */
  enable3D(opts = {}) {
    this.map.setMaxPitch?.(85);
    if (opts.terrain !== false) this.setTerrain(true, opts.exaggeration);
    this.add3DBuildings();
  }
  /** Toggle terrain. Guards on the terrain source being present in the style. */
  setTerrain(on, exaggeration = 1.2) {
    this.terrainEnabled = on;
    const apply = () => {
      if (!on) {
        this.map.setTerrain?.(null);
        return;
      }
      const style = this.map.getStyle?.();
      const sources = style?.sources ?? {};
      const terrainSource = ["navvo-terrain", "terrain", "terrain-dem", "dem"].find((s) => sources[s]) || Object.keys(sources).find((s) => sources[s]?.type === "raster-dem");
      if (terrainSource) {
        this.map.setTerrain?.({ source: terrainSource, exaggeration });
      } else if (typeof console !== "undefined") {
        console.info("[NavvoMaps] No terrain source in the current style; staying flat.");
      }
    };
    if (this.map.isStyleLoaded?.()) apply();
    else this.map.once("style.load", apply);
  }
  /** Add a fill-extrusion buildings layer from the vector `building` source-layer. */
  add3DBuildings() {
    const add = () => {
      if (this.map.getLayer("navvo-3d-buildings")) return;
      if (!this.map.getSource("navvo")) return;
      this.addTrackedLayer({
        id: "navvo-3d-buildings",
        type: "fill-extrusion",
        source: "navvo",
        "source-layer": "building",
        minzoom: 14,
        paint: {
          "fill-extrusion-color": [
            "interpolate",
            ["linear"],
            ["coalesce", ["get", "render_height"], ["get", "height"], 6],
            0,
            "#d7dbe0",
            60,
            "#aeb6bf",
            200,
            "#8a94a3"
          ],
          "fill-extrusion-height": ["coalesce", ["get", "render_height"], ["get", "height"], 6],
          "fill-extrusion-base": ["coalesce", ["get", "render_min_height"], 0],
          "fill-extrusion-opacity": 0.92,
          "fill-extrusion-vertical-gradient": true
        }
      });
    };
    if (this.map.isStyleLoaded?.()) add();
    else this.map.once("style.load", add);
  }
  // ---- Convenience wrappers ----
  /** Add a default/symbol marker at a point and return it. */
  addMarker(lngLat, opts = {}) {
    const [lng, lat] = toTuple(lngLat);
    const m = new maplibregl.Marker(opts).setLngLat([lng, lat]).addTo(this.map);
    return m;
  }
  /** Add a popup with HTML at a point and return it. */
  addPopup(lngLat, html, opts = {}) {
    const [lng, lat] = toTuple(lngLat);
    const p = new maplibregl.Popup(opts).setLngLat([lng, lat]).setHTML(html).addTo(this.map);
    return p;
  }
  /** Add a GeoJSON source + a styled layer; returns a handle with setData/remove. */
  addGeoJSON(id, data, opts = {}) {
    this.addTrackedSource(id, { type: "geojson", data });
    const layerId = `${id}-layer`;
    this.addTrackedLayer({
      id: layerId,
      type: opts.type ?? "line",
      source: id,
      paint: opts.paint ?? {},
      layout: opts.layout ?? {}
    });
    return {
      setData: (d) => this.map.getSource(id)?.setData(d),
      remove: () => {
        if (this.map.getLayer(layerId)) this.map.removeLayer(layerId);
        if (this.map.getSource(id)) this.map.removeSource(id);
        this.userSourceIds.delete(id);
        this.userLayerIds.delete(layerId);
      }
    };
  }
  // ---- Live data overlay helpers (bbox-driven, refreshable) ----
  async fetchJson(path, query) {
    const url = new URL(this.baseUrl + path);
    for (const [k, v] of Object.entries(query)) if (v !== void 0) url.searchParams.set(k, String(v));
    const res = await fetch(url.toString(), { headers: { "x-api-key": this.apiKey } });
    if (!res.ok) throw new NavvoError(`Overlay fetch failed (${res.status}) for ${path}`, res.status, "overlay_error", { path });
    return await res.json();
  }
  currentBboxString() {
    return bboxParam(this.map.getBounds());
  }
  /**
   * Add the live traffic layer (congestion lines coloured by feature.color).
   * Returns a handle that can refresh() to the current viewport or remove().
   */
  async addTrafficLayer(opts = {}) {
    const id = opts.id ?? "navvo-traffic";
    return this.addColoredLineOverlay(id, () => this.fetchTrafficFC());
  }
  fetchTrafficFC() {
    return this.fetchJson("/map/overlays/traffic", { bbox: this.currentBboxString() });
  }
  /** Add the incidents layer (point symbols / circles by severity). */
  async addIncidentsLayer(opts = {}) {
    const id = opts.id ?? "navvo-incidents";
    const fetcher = () => this.fetchJson("/incidents/geojson", { bbox: this.currentBboxString() });
    const data = await fetcher();
    this.addTrackedSource(id, { type: "geojson", data });
    this.addTrackedLayer({
      id: `${id}-layer`,
      type: "circle",
      source: id,
      paint: {
        "circle-radius": 6,
        "circle-color": ["match", ["get", "type"], "closure", "#DC2626", "accident", "#DC2626", "jam", "#F59E0B", "#EF4444"],
        "circle-stroke-width": 2,
        "circle-stroke-color": "#fff"
      }
    });
    return this.makeOverlayHandle(id, fetcher);
  }
  /** Add the road-closures / road-edits layer (lines + polygons by color). */
  async addRoadClosuresLayer(opts = {}) {
    const id = opts.id ?? "navvo-road-edits";
    const fetcher = () => this.fetchJson("/road-edits/geojson", { bbox: this.currentBboxString() });
    const data = await fetcher();
    this.addTrackedSource(id, { type: "geojson", data });
    this.addTrackedLayer({
      id: `${id}-line`,
      type: "line",
      source: id,
      filter: ["==", ["geometry-type"], "LineString"],
      paint: {
        "line-color": ["coalesce", ["get", "color"], "#DC2626"],
        "line-width": 4,
        "line-dasharray": [2, 1]
      }
    });
    this.addTrackedLayer({
      id: `${id}-fill`,
      type: "fill",
      source: id,
      filter: ["==", ["geometry-type"], "Polygon"],
      paint: { "fill-color": ["coalesce", ["get", "color"], "#DC2626"], "fill-opacity": 0.2 }
    });
    const handle = this.makeOverlayHandle(id, fetcher);
    const origRemove = handle.remove;
    handle.remove = () => {
      if (this.map.getLayer(`${id}-fill`)) this.map.removeLayer(`${id}-fill`);
      this.userLayerIds.delete(`${id}-fill`);
      origRemove();
    };
    return handle;
  }
  /** Add the weather city-pins layer (symbols coloured by feature.color). */
  async addWeatherLayer(opts = {}) {
    const id = opts.id ?? "navvo-weather";
    const fetcher = () => this.fetchJson("/map/weather/cities", {
      bbox: this.currentBboxString(),
      zoom: Math.round(this.map.getZoom()),
      units: opts.units
    });
    const data = await fetcher();
    this.addTrackedSource(id, { type: "geojson", data });
    this.addTrackedLayer({
      id: `${id}-layer`,
      type: "circle",
      source: id,
      paint: {
        "circle-radius": 14,
        "circle-color": ["coalesce", ["get", "color"], "#386BFF"],
        "circle-opacity": 0.85
      }
    });
    this.addTrackedLayer({
      id: `${id}-label`,
      type: "symbol",
      source: id,
      layout: { "text-field": ["concat", ["to-string", ["get", "temperature"]], "\xB0"], "text-size": 11 },
      paint: { "text-color": "#fff" }
    });
    const handle = this.makeOverlayHandle(id, fetcher);
    const origRemove = handle.remove;
    handle.remove = () => {
      if (this.map.getLayer(`${id}-label`)) this.map.removeLayer(`${id}-label`);
      this.userLayerIds.delete(`${id}-label`);
      origRemove();
    };
    return handle;
  }
  /** Generic colored-line overlay used by traffic. */
  async addColoredLineOverlay(id, fetcher) {
    const data = await fetcher();
    this.addTrackedSource(id, { type: "geojson", data });
    this.addTrackedLayer({
      id: `${id}-layer`,
      type: "line",
      source: id,
      paint: { "line-color": ["coalesce", ["get", "color"], "#386BFF"], "line-width": 3 }
    });
    return this.makeOverlayHandle(id, fetcher);
  }
  makeOverlayHandle(id, fetcher) {
    const layerId = `${id}-layer`;
    return {
      id,
      refresh: async () => {
        const fc = await fetcher();
        this.map.getSource(id)?.setData(fc);
        return fc;
      },
      remove: () => {
        if (this.map.getLayer(layerId)) this.map.removeLayer(layerId);
        if (this.map.getSource(id)) this.map.removeSource(id);
        this.userSourceIds.delete(id);
        this.userLayerIds.delete(layerId);
      }
    };
  }
  // ---- Lifecycle passthroughs ----
  addControl(control, position) {
    this.map.addControl(control, position);
    return this;
  }
  on(type, layerOrHandler, handler) {
    this.map.on(type, layerOrHandler, handler);
    return this;
  }
  off(type, layerOrHandler, handler) {
    this.map.off(type, layerOrHandler, handler);
    return this;
  }
  once(type, handler) {
    this.map.once(type, handler);
    return this;
  }
  resize() {
    this.map.resize();
    return this;
  }
  remove() {
    this.map.remove();
  }
  getCanvas() {
    return this.map.getCanvas();
  }
  getContainer() {
    return this.map.getContainer();
  }
  isStyleLoaded() {
    return this.map.isStyleLoaded?.() ?? false;
  }
  /** The underlying GL map (documented escape hatch). */
  get engine() {
    return this.map;
  }
};
function toTuple(c) {
  return Array.isArray(c) ? [c[0], c[1]] : [c.lng, c.lat];
}

// src/map/namespace.ts
var ml = maplibregl;
var NavvoMaps = {
  version: "0.1.0",
  engineVersion,
  /** The Map wrapper. `new NavvoMaps.Map({ ... })`. */
  Map: NavvoMap,
  // ---- Re-exported GL primitives (Navvo-namespaced) ----
  Marker: ml.Marker,
  Popup: ml.Popup,
  /** Alias for Popup. */
  InfoWindow: ml.Popup,
  LngLat: ml.LngLat,
  LngLatBounds: ml.LngLatBounds,
  NavigationControl: ml.NavigationControl,
  GeolocateControl: ml.GeolocateControl,
  ScaleControl: ml.ScaleControl,
  FullscreenControl: ml.FullscreenControl,
  AttributionControl: ml.AttributionControl,
  // ---- Utilities ----
  decodePolyline,
  decodePolyline6,
  ensureRtlPlugin,
  /** Services constructor for `new NavvoMaps.Services({ apiKey })`. */
  Services: NavvoServices,
  /**
   * Configure the SDK once with one key — produces keyed map/services factories.
   * This is the recommended entry point (key given once, routed to both transports).
   */
  configure(config) {
    let services;
    return {
      apiKey: config.apiKey,
      baseUrl: config.baseUrl ?? "https://navvo.io/api/v1",
      map(options) {
        return new NavvoMap({ ...options, apiKey: config.apiKey, baseUrl: config.baseUrl });
      },
      get services() {
        if (!services) services = new NavvoServices(config);
        return services;
      }
    };
  },
  /** Direct access to the underlying engine namespace (escape hatch). */
  engine: maplibregl
};

// src/index.ts
var src_default = NavvoMaps;
/*! Bundled license information:

maplibre-gl/dist/maplibre-gl.js:
  (**
   * MapLibre GL JS
   * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.24.0/LICENSE.txt
   *)
*/

exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL;
exports.Directions = Directions;
exports.METHOD_SCOPES = METHOD_SCOPES;
exports.NavvoAuthError = NavvoAuthError;
exports.NavvoError = NavvoError;
exports.NavvoForbiddenError = NavvoForbiddenError;
exports.NavvoMap = NavvoMap;
exports.NavvoMaps = NavvoMaps;
exports.NavvoNetworkError = NavvoNetworkError;
exports.NavvoNotFoundError = NavvoNotFoundError;
exports.NavvoRateLimitError = NavvoRateLimitError;
exports.NavvoScopeError = NavvoScopeError;
exports.NavvoServerError = NavvoServerError;
exports.NavvoServices = NavvoServices;
exports.NavvoUnavailableError = NavvoUnavailableError;
exports.SDK_VERSION = SDK_VERSION;
exports.__setMapEngine = __setMapEngine;
exports.bboxParam = bboxParam;
exports.decodePolyline = decodePolyline;
exports.decodePolyline6 = decodePolyline6;
exports.default = src_default;
exports.encodePolyline = encodePolyline;
exports.engineVersion = engineVersion;
exports.ensureRtlPlugin = ensureRtlPlugin;
exports.formatDistance = formatDistance;
exports.formatDuration = formatDuration;
exports.injectApiKey = injectApiKey;
exports.latLonParams = latLonParams;
exports.maneuverIcon = maneuverIcon;
exports.parseWkt = parseWkt;
exports.resolveStyleName = resolveStyleName;
exports.styleUrl = styleUrl;
exports.toLatLngObj = toLatLngObj;
exports.toLatLonObj = toLatLonObj;
exports.toLngLat = toLngLat;
exports.toLonLatObj = toLonLatObj;
