import { getCurrentScope as Wj, onScopeDispose as XM, unref as vt, getCurrentInstance as G1, onMounted as W1, nextTick as i1, ref as Ie, readonly as Zj, watch as on, defineComponent as mr, openBlock as ce, createElementBlock as Ye, createElementVNode as je, warn as pet, watchEffect as qj, onBeforeUnmount as Rs, inject as ln, computed as Kt, isRef as g2, shallowRef as IQ, onBeforeMount as Tet, provide as $1, mergeProps as rl, renderSlot as Pr, toRef as K2, onUnmounted as fet, createBlock as Or, Transition as cd, withCtx as fe, withDirectives as Ti, normalizeClass as Be, normalizeStyle as M1, vShow as zo, Fragment as to, createVNode as Ce, reactive as u3, onActivated as Qet, onUpdated as met, resolveDynamicComponent as Ss, createCommentVNode as Fr, cloneVNode as get, Text as Xj, Comment as yet, Teleport as vet, onDeactivated as _et, toDisplayString as fi, useSlots as pg, toRaw as kh, withModifiers as m1, vModelCheckbox as PQ, createTextVNode as xn, toRefs as s0, vModelRadio as Kj, h as b7, createSlots as Yj, resolveComponent as xs, resolveDirective as bet, toHandlerKey as Let, renderList as t3, withKeys as au, vModelText as wet, createApp as xet, pushScopeId as KM, popScopeId as YM, createStaticVNode as Eet, hasInjectionContext as Met, markRaw as jo, effectScope as Het, isReactive as JM } from "vue";
import { MapSvgIcon as Aet, MapSvgSpriteColor as Oet } from "@abi-software/svg-sprite";
import { Tooltip as Cet, TreeControls as ket, DrawToolbar as Iet } from "@abi-software/map-utilities";
const s4 = (t, e, { checkForDefaultPrevented: r = !0 } = {}) => (i) => {
const o = t == null ? void 0 : t(i);
if (r === !1 || !o)
return e == null ? void 0 : e(i);
};
var uk;
const s1 = typeof window < "u", Pet = (t) => typeof t == "string", Jj = () => {
}, sx = s1 && ((uk = window == null ? void 0 : window.navigator) == null ? void 0 : uk.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function tS(t) {
return typeof t == "function" ? t() : vt(t);
}
function Vet(t) {
return t;
}
function ud(t) {
return Wj() ? (XM(t), !0) : !1;
}
function Ret(t, e = !0) {
G1() ? W1(t) : e ? t() : i1(t);
}
function hk(t, e, r = {}) {
const {
immediate: n = !0
} = r, i = Ie(!1);
let o = null;
function s() {
o && (clearTimeout(o), o = null);
}
function a() {
i.value = !1, s();
}
function u(...d) {
s(), i.value = !0, o = setTimeout(() => {
i.value = !1, o = null, t(...d);
}, tS(e));
}
return n && (i.value = !0, s1 && u()), ud(a), {
isPending: Zj(i),
start: u,
stop: a
};
}
function f4(t) {
var e;
const r = tS(t);
return (e = r == null ? void 0 : r.$el) != null ? e : r;
}
const Tg = s1 ? window : void 0;
function ea(...t) {
let e, r, n, i;
if (Pet(t[0]) || Array.isArray(t[0]) ? ([r, n, i] = t, e = Tg) : [e, r, n, i] = t, !e)
return Jj;
Array.isArray(r) || (r = [r]), Array.isArray(n) || (n = [n]);
const o = [], s = () => {
o.forEach((T) => T()), o.length = 0;
}, a = (T, f, Q, y) => (T.addEventListener(f, Q, y), () => T.removeEventListener(f, Q, y)), u = on(() => [f4(e), tS(i)], ([T, f]) => {
s(), T && o.push(...r.flatMap((Q) => n.map((y) => a(T, Q, y, f))));
}, { immediate: !0, flush: "post" }), d = () => {
u(), s();
};
return ud(d), d;
}
let dk = !1;
function Net(t, e, r = {}) {
const { window: n = Tg, ignore: i = [], capture: o = !0, detectIframe: s = !1 } = r;
if (!n)
return;
sx && !dk && (dk = !0, Array.from(n.document.body.children).forEach((Q) => Q.addEventListener("click", Jj)));
let a = !0;
const u = (Q) => i.some((y) => {
if (typeof y == "string")
return Array.from(n.document.querySelectorAll(y)).some((_) => _ === Q.target || Q.composedPath().includes(_));
{
const _ = f4(y);
return _ && (Q.target === _ || Q.composedPath().includes(_));
}
}), T = [
ea(n, "click", (Q) => {
const y = f4(t);
if (!(!y || y === Q.target || Q.composedPath().includes(y))) {
if (Q.detail === 0 && (a = !u(Q)), !a) {
a = !0;
return;
}
e(Q);
}
}, { passive: !0, capture: o }),
ea(n, "pointerdown", (Q) => {
const y = f4(t);
y && (a = !Q.composedPath().includes(y) && !u(Q));
}, { passive: !0 }),
s && ea(n, "blur", (Q) => {
var y;
const _ = f4(t);
((y = n.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !(_ != null && _.contains(n.document.activeElement)) && e(Q);
})
].filter(Boolean);
return () => T.forEach((Q) => Q());
}
function tz(t, e = !1) {
const r = Ie(), n = () => r.value = !!t();
return n(), Ret(n, e), r;
}
const pk = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Tk = "__vueuse_ssr_handlers__";
pk[Tk] = pk[Tk] || {};
var fk = Object.getOwnPropertySymbols, Det = Object.prototype.hasOwnProperty, Fet = Object.prototype.propertyIsEnumerable, Bet = (t, e) => {
var r = {};
for (var n in t)
Det.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
if (t != null && fk)
for (var n of fk(t))
e.indexOf(n) < 0 && Fet.call(t, n) && (r[n] = t[n]);
return r;
};
function B6(t, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Bet(n, ["window"]);
let s;
const a = tz(() => i && "ResizeObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = on(() => f4(t), (f) => {
u(), a.value && i && f && (s = new ResizeObserver(e), s.observe(f, o));
}, { immediate: !0, flush: "post" }), T = () => {
u(), d();
};
return ud(T), {
isSupported: a,
stop: T
};
}
var Qk = Object.getOwnPropertySymbols, jet = Object.prototype.hasOwnProperty, zet = Object.prototype.propertyIsEnumerable, Uet = (t, e) => {
var r = {};
for (var n in t)
jet.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
if (t != null && Qk)
for (var n of Qk(t))
e.indexOf(n) < 0 && zet.call(t, n) && (r[n] = t[n]);
return r;
};
function Get(t, e, r = {}) {
const n = r, { window: i = Tg } = n, o = Uet(n, ["window"]);
let s;
const a = tz(() => i && "MutationObserver" in i), u = () => {
s && (s.disconnect(), s = void 0);
}, d = on(() => f4(t), (f) => {
u(), a.value && i && f && (s = new MutationObserver(e), s.observe(f, o));
}, { immediate: !0 }), T = () => {
u(), d();
};
return ud(T), {
isSupported: a,
stop: T
};
}
var mk;
(function(t) {
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
})(mk || (mk = {}));
var $et = Object.defineProperty, gk = Object.getOwnPropertySymbols, Wet = Object.prototype.hasOwnProperty, Zet = Object.prototype.propertyIsEnumerable, yk = (t, e, r) => e in t ? $et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, qet = (t, e) => {
for (var r in e || (e = {}))
Wet.call(e, r) && yk(t, r, e[r]);
if (gk)
for (var r of gk(e))
Zet.call(e, r) && yk(t, r, e[r]);
return t;
};
const Xet = {
easeInSine: [0.12, 0, 0.39, 0],
easeOutSine: [0.61, 1, 0.88, 1],
easeInOutSine: [0.37, 0, 0.63, 1],
easeInQuad: [0.11, 0, 0.5, 0],
easeOutQuad: [0.5, 1, 0.89, 1],
easeInOutQuad: [0.45, 0, 0.55, 1],
easeInCubic: [0.32, 0, 0.67, 0],
easeOutCubic: [0.33, 1, 0.68, 1],
easeInOutCubic: [0.65, 0, 0.35, 1],
easeInQuart: [0.5, 0, 0.75, 0],
easeOutQuart: [0.25, 1, 0.5, 1],
easeInOutQuart: [0.76, 0, 0.24, 1],
easeInQuint: [0.64, 0, 0.78, 0],
easeOutQuint: [0.22, 1, 0.36, 1],
easeInOutQuint: [0.83, 0, 0.17, 1],
easeInExpo: [0.7, 0, 0.84, 0],
easeOutExpo: [0.16, 1, 0.3, 1],
easeInOutExpo: [0.87, 0, 0.13, 1],
easeInCirc: [0.55, 0, 1, 0.45],
easeOutCirc: [0, 0.55, 0.45, 1],
easeInOutCirc: [0.85, 0, 0.15, 1],
easeInBack: [0.36, 0, 0.66, -0.56],
easeOutBack: [0.34, 1.56, 0.64, 1],
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
qet({
linear: Vet
}, Xet);
/**
* @vue/shared v3.4.27
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
process.env.NODE_ENV !== "production" && Object.freeze({});
process.env.NODE_ENV !== "production" && Object.freeze([]);
const C5 = () => {
}, Ket = Object.prototype.hasOwnProperty, vk = (t, e) => Ket.call(t, e), p2 = Array.isArray, Zo = (t) => typeof t == "function", sa = (t) => typeof t == "string", T2 = (t) => t !== null && typeof t == "object", Yet = Object.prototype.toString, Jet = (t) => Yet.call(t), hb = (t) => Jet(t).slice(8, -1), ez = (t) => {
const e = /* @__PURE__ */ Object.create(null);
return (r) => e[r] || (e[r] = t(r));
}, trt = /-(\w)/g, ert = ez((t) => t.replace(trt, (e, r) => r ? r.toUpperCase() : "")), rrt = /\B([A-Z])/g, nrt = ez(
(t) => t.replace(rrt, "-$1").toLowerCase()
);
var rz = typeof global == "object" && global && global.Object === Object && global, irt = typeof self == "object" && self && self.Object === Object && self, v3 = rz || irt || Function("return this")(), h3 = v3.Symbol, nz = Object.prototype, ort = nz.hasOwnProperty, srt = nz.toString, lu = h3 ? h3.toStringTag : void 0;
function art(t) {
var e = ort.call(t, lu), r = t[lu];
try {
t[lu] = void 0;
var n = !0;
} catch {
}
var i = srt.call(t);
return n && (e ? t[lu] = r : delete t[lu]), i;
}
var lrt = Object.prototype, crt = lrt.toString;
function urt(t) {
return crt.call(t);
}
var hrt = "[object Null]", drt = "[object Undefined]", _k = h3 ? h3.toStringTag : void 0;
function Y8(t) {
return t == null ? t === void 0 ? drt : hrt : _k && _k in Object(t) ? art(t) : urt(t);
}
function _8(t) {
return t != null && typeof t == "object";
}
var prt = "[object Symbol]";
function fg(t) {
return typeof t == "symbol" || _8(t) && Y8(t) == prt;
}
function Trt(t, e) {
for (var r = -1, n = t == null ? 0 : t.length, i = Array(n); ++r < n; )
i[r] = e(t[r], r, t);
return i;
}
var aa = Array.isArray, frt = 1 / 0, bk = h3 ? h3.prototype : void 0, Lk = bk ? bk.toString : void 0;
function iz(t) {
if (typeof t == "string")
return t;
if (aa(t))
return Trt(t, iz) + "";
if (fg(t))
return Lk ? Lk.call(t) : "";
var e = t + "";
return e == "0" && 1 / t == -frt ? "-0" : e;
}
var Qrt = /\s/;
function mrt(t) {
for (var e = t.length; e-- && Qrt.test(t.charAt(e)); )
;
return e;
}
var grt = /^\s+/;
function yrt(t) {
return t && t.slice(0, mrt(t) + 1).replace(grt, "");
}
function a0(t) {
var e = typeof t;
return t != null && (e == "object" || e == "function");
}
var wk = NaN, vrt = /^[-+]0x[0-9a-f]+$/i, _rt = /^0b[01]+$/i, brt = /^0o[0-7]+$/i, Lrt = parseInt;
function xk(t) {
if (typeof t == "number")
return t;
if (fg(t))
return wk;
if (a0(t)) {
var e = typeof t.valueOf == "function" ? t.valueOf() : t;
t = a0(e) ? e + "" : e;
}
if (typeof t != "string")
return t === 0 ? t : +t;
t = yrt(t);
var r = _rt.test(t);
return r || brt.test(t) ? Lrt(t.slice(2), r ? 2 : 8) : vrt.test(t) ? wk : +t;
}
function oz(t) {
return t;
}
var wrt = "[object AsyncFunction]", xrt = "[object Function]", Ert = "[object GeneratorFunction]", Mrt = "[object Proxy]";
function sz(t) {
if (!a0(t))
return !1;
var e = Y8(t);
return e == xrt || e == Ert || e == wrt || e == Mrt;
}
var db = v3["__core-js_shared__"], Ek = function() {
var t = /[^.]+$/.exec(db && db.keys && db.keys.IE_PROTO || "");
return t ? "Symbol(src)_1." + t : "";
}();
function Srt(t) {
return !!Ek && Ek in t;
}
var Hrt = Function.prototype, Art = Hrt.toString;
function nl(t) {
if (t != null) {
try {
return Art.call(t);
} catch {
}
try {
return t + "";
} catch {
}
}
return "";
}
var Ort = /[\\^$.*+?()[\]{}|]/g, Crt = /^\[object .+?Constructor\]$/, krt = Function.prototype, Irt = Object.prototype, Prt = krt.toString, Vrt = Irt.hasOwnProperty, Rrt = RegExp(
"^" + Prt.call(Vrt).replace(Ort, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Nrt(t) {
if (!a0(t) || Srt(t))
return !1;
var e = sz(t) ? Rrt : Crt;
return e.test(nl(t));
}
function Drt(t, e) {
return t == null ? void 0 : t[e];
}
function il(t, e) {
var r = Drt(t, e);
return Nrt(r) ? r : void 0;
}
var ax = il(v3, "WeakMap");
function Frt(t, e, r) {
switch (r.length) {
case 0:
return t.call(e);
case 1:
return t.call(e, r[0]);
case 2:
return t.call(e, r[0], r[1]);
case 3:
return t.call(e, r[0], r[1], r[2]);
}
return t.apply(e, r);
}
var Brt = 800, jrt = 16, zrt = Date.now;
function Urt(t) {
var e = 0, r = 0;
return function() {
var n = zrt(), i = jrt - (n - r);
if (r = n, i > 0) {
if (++e >= Brt)
return arguments[0];
} else
e = 0;
return t.apply(void 0, arguments);
};
}
function Grt(t) {
return function() {
return t;
};
}
var VQ = function() {
try {
var t = il(Object, "defineProperty");
return t({}, "", {}), t;
} catch {
}
}(), $rt = VQ ? function(t, e) {
return VQ(t, "toString", {
configurable: !0,
enumerable: !1,
value: Grt(e),
writable: !0
});
} : oz, Wrt = Urt($rt);
function Zrt(t, e, r, n) {
t.length;
for (var i = r + 1; i--; )
if (e(t[i], i, t))
return i;
return -1;
}
var qrt = 9007199254740991, Xrt = /^(?:0|[1-9]\d*)$/;
function eS(t, e) {
var r = typeof t;
return e = e ?? qrt, !!e && (r == "number" || r != "symbol" && Xrt.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
function Krt(t, e, r) {
e == "__proto__" && VQ ? VQ(t, e, {
configurable: !0,
enumerable: !0,
value: r,
writable: !0
}) : t[e] = r;
}
function rS(t, e) {
return t === e || t !== t && e !== e;
}
var Yrt = Object.prototype, Jrt = Yrt.hasOwnProperty;
function tnt(t, e, r) {
var n = t[e];
(!(Jrt.call(t, e) && rS(n, r)) || r === void 0 && !(e in t)) && Krt(t, e, r);
}
var Mk = Math.max;
function ent(t, e, r) {
return e = Mk(e === void 0 ? t.length - 1 : e, 0), function() {
for (var n = arguments, i = -1, o = Mk(n.length - e, 0), s = Array(o); ++i < o; )
s[i] = n[e + i];
i = -1;
for (var a = Array(e + 1); ++i < e; )
a[i] = n[i];
return a[e] = r(s), Frt(t, this, a);
};
}
var rnt = 9007199254740991;
function nS(t) {
return typeof t == "number" && t > -1 && t % 1 == 0 && t <= rnt;
}
function nnt(t) {
return t != null && nS(t.length) && !sz(t);
}
var int = Object.prototype;
function ont(t) {
var e = t && t.constructor, r = typeof e == "function" && e.prototype || int;
return t === r;
}
function snt(t, e) {
for (var r = -1, n = Array(t); ++r < t; )
n[r] = e(r);
return n;
}
var ant = "[object Arguments]";
function Sk(t) {
return _8(t) && Y8(t) == ant;
}
var az = Object.prototype, lnt = az.hasOwnProperty, cnt = az.propertyIsEnumerable, iS = Sk(/* @__PURE__ */ function() {
return arguments;
}()) ? Sk : function(t) {
return _8(t) && lnt.call(t, "callee") && !cnt.call(t, "callee");
};
function unt() {
return !1;
}
var lz = typeof exports == "object" && exports && !exports.nodeType && exports, Hk = lz && typeof module == "object" && module && !module.nodeType && module, hnt = Hk && Hk.exports === lz, Ak = hnt ? v3.Buffer : void 0, dnt = Ak ? Ak.isBuffer : void 0, lx = dnt || unt, pnt = "[object Arguments]", Tnt = "[object Array]", fnt = "[object Boolean]", Qnt = "[object Date]", mnt = "[object Error]", gnt = "[object Function]", ynt = "[object Map]", vnt = "[object Number]", _nt = "[object Object]", bnt = "[object RegExp]", Lnt = "[object Set]", wnt = "[object String]", xnt = "[object WeakMap]", Ent = "[object ArrayBuffer]", Mnt = "[object DataView]", Snt = "[object Float32Array]", Hnt = "[object Float64Array]", Ant = "[object Int8Array]", Ont = "[object Int16Array]", Cnt = "[object Int32Array]", knt = "[object Uint8Array]", Int = "[object Uint8ClampedArray]", Pnt = "[object Uint16Array]", Vnt = "[object Uint32Array]", Mi = {};
Mi[Snt] = Mi[Hnt] = Mi[Ant] = Mi[Ont] = Mi[Cnt] = Mi[knt] = Mi[Int] = Mi[Pnt] = Mi[Vnt] = !0;
Mi[pnt] = Mi[Tnt] = Mi[Ent] = Mi[fnt] = Mi[Mnt] = Mi[Qnt] = Mi[mnt] = Mi[gnt] = Mi[ynt] = Mi[vnt] = Mi[_nt] = Mi[bnt] = Mi[Lnt] = Mi[wnt] = Mi[xnt] = !1;
function Rnt(t) {
return _8(t) && nS(t.length) && !!Mi[Y8(t)];
}
function Nnt(t) {
return function(e) {
return t(e);
};
}
var cz = typeof exports == "object" && exports && !exports.nodeType && exports, th = cz && typeof module == "object" && module && !module.nodeType && module, Dnt = th && th.exports === cz, pb = Dnt && rz.process, Ok = function() {
try {
var t = th && th.require && th.require("util").types;
return t || pb && pb.binding && pb.binding("util");
} catch {
}
}(), Ck = Ok && Ok.isTypedArray, uz = Ck ? Nnt(Ck) : Rnt, Fnt = Object.prototype, Bnt = Fnt.hasOwnProperty;
function jnt(t, e) {
var r = aa(t), n = !r && iS(t), i = !r && !n && lx(t), o = !r && !n && !i && uz(t), s = r || n || i || o, a = s ? snt(t.length, String) : [], u = a.length;
for (var d in t)
Bnt.call(t, d) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
(d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
i && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
o && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
eS(d, u))) && a.push(d);
return a;
}
function znt(t, e) {
return function(r) {
return t(e(r));
};
}
var Unt = znt(Object.keys, Object), Gnt = Object.prototype, $nt = Gnt.hasOwnProperty;
function Wnt(t) {
if (!ont(t))
return Unt(t);
var e = [];
for (var r in Object(t))
$nt.call(t, r) && r != "constructor" && e.push(r);
return e;
}
function hz(t) {
return nnt(t) ? jnt(t) : Wnt(t);
}
var Znt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, qnt = /^\w*$/;
function oS(t, e) {
if (aa(t))
return !1;
var r = typeof t;
return r == "number" || r == "symbol" || r == "boolean" || t == null || fg(t) ? !0 : qnt.test(t) || !Znt.test(t) || e != null && t in Object(e);
}
var Ih = il(Object, "create");
function Xnt() {
this.__data__ = Ih ? Ih(null) : {}, this.size = 0;
}
function Knt(t) {
var e = this.has(t) && delete this.__data__[t];
return this.size -= e ? 1 : 0, e;
}
var Ynt = "__lodash_hash_undefined__", Jnt = Object.prototype, tit = Jnt.hasOwnProperty;
function eit(t) {
var e = this.__data__;
if (Ih) {
var r = e[t];
return r === Ynt ? void 0 : r;
}
return tit.call(e, t) ? e[t] : void 0;
}
var rit = Object.prototype, nit = rit.hasOwnProperty;
function iit(t) {
var e = this.__data__;
return Ih ? e[t] !== void 0 : nit.call(e, t);
}
var oit = "__lodash_hash_undefined__";
function sit(t, e) {
var r = this.__data__;
return this.size += this.has(t) ? 0 : 1, r[t] = Ih && e === void 0 ? oit : e, this;
}
function j5(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
j5.prototype.clear = Xnt;
j5.prototype.delete = Knt;
j5.prototype.get = eit;
j5.prototype.has = iit;
j5.prototype.set = sit;
function ait() {
this.__data__ = [], this.size = 0;
}
function Qg(t, e) {
for (var r = t.length; r--; )
if (rS(t[r][0], e))
return r;
return -1;
}
var lit = Array.prototype, cit = lit.splice;
function uit(t) {
var e = this.__data__, r = Qg(e, t);
if (r < 0)
return !1;
var n = e.length - 1;
return r == n ? e.pop() : cit.call(e, r, 1), --this.size, !0;
}
function hit(t) {
var e = this.__data__, r = Qg(e, t);
return r < 0 ? void 0 : e[r][1];
}
function dit(t) {
return Qg(this.__data__, t) > -1;
}
function pit(t, e) {
var r = this.__data__, n = Qg(r, t);
return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
}
function C4(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
C4.prototype.clear = ait;
C4.prototype.delete = uit;
C4.prototype.get = hit;
C4.prototype.has = dit;
C4.prototype.set = pit;
var Ph = il(v3, "Map");
function Tit() {
this.size = 0, this.__data__ = {
hash: new j5(),
map: new (Ph || C4)(),
string: new j5()
};
}
function fit(t) {
var e = typeof t;
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
}
function mg(t, e) {
var r = t.__data__;
return fit(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
}
function Qit(t) {
var e = mg(this, t).delete(t);
return this.size -= e ? 1 : 0, e;
}
function mit(t) {
return mg(this, t).get(t);
}
function git(t) {
return mg(this, t).has(t);
}
function yit(t, e) {
var r = mg(this, t), n = r.size;
return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
}
function k4(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.clear(); ++e < r; ) {
var n = t[e];
this.set(n[0], n[1]);
}
}
k4.prototype.clear = Tit;
k4.prototype.delete = Qit;
k4.prototype.get = mit;
k4.prototype.has = git;
k4.prototype.set = yit;
var vit = "Expected a function";
function sS(t, e) {
if (typeof t != "function" || e != null && typeof e != "function")
throw new TypeError(vit);
var r = function() {
var n = arguments, i = e ? e.apply(this, n) : n[0], o = r.cache;
if (o.has(i))
return o.get(i);
var s = t.apply(this, n);
return r.cache = o.set(i, s) || o, s;
};
return r.cache = new (sS.Cache || k4)(), r;
}
sS.Cache = k4;
var _it = 500;
function bit(t) {
var e = sS(t, function(n) {
return r.size === _it && r.clear(), n;
}), r = e.cache;
return e;
}
var Lit = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, wit = /\\(\\)?/g, xit = bit(function(t) {
var e = [];
return t.charCodeAt(0) === 46 && e.push(""), t.replace(Lit, function(r, n, i, o) {
e.push(i ? o.replace(wit, "$1") : n || r);
}), e;
});
function Eit(t) {
return t == null ? "" : iz(t);
}
function gg(t, e) {
return aa(t) ? t : oS(t, e) ? [t] : xit(Eit(t));
}
var Mit = 1 / 0;
function hd(t) {
if (typeof t == "string" || fg(t))
return t;
var e = t + "";
return e == "0" && 1 / t == -Mit ? "-0" : e;
}
function aS(t, e) {
e = gg(e, t);
for (var r = 0, n = e.length; t != null && r < n; )
t = t[hd(e[r++])];
return r && r == n ? t : void 0;
}
function T4(t, e, r) {
var n = t == null ? void 0 : aS(t, e);
return n === void 0 ? r : n;
}
function dz(t, e) {
for (var r = -1, n = e.length, i = t.length; ++r < n; )
t[i + r] = e[r];
return t;
}
var kk = h3 ? h3.isConcatSpreadable : void 0;
function Sit(t) {
return aa(t) || iS(t) || !!(kk && t && t[kk]);
}
function Hit(t, e, r, n, i) {
var o = -1, s = t.length;
for (r || (r = Sit), i || (i = []); ++o < s; ) {
var a = t[o];
r(a) ? dz(i, a) : i[i.length] = a;
}
return i;
}
function Ait(t) {
var e = t == null ? 0 : t.length;
return e ? Hit(t) : [];
}
function Oit(t) {
return Wrt(ent(t, void 0, Ait), t + "");
}
function W6() {
if (!arguments.length)
return [];
var t = arguments[0];
return aa(t) ? t : [t];
}
function Cit() {
this.__data__ = new C4(), this.size = 0;
}
function kit(t) {
var e = this.__data__, r = e.delete(t);
return this.size = e.size, r;
}
function Iit(t) {
return this.__data__.get(t);
}
function Pit(t) {
return this.__data__.has(t);
}
var Vit = 200;
function Rit(t, e) {
var r = this.__data__;
if (r instanceof C4) {
var n = r.__data__;
if (!Ph || n.length < Vit - 1)
return n.push([t, e]), this.size = ++r.size, this;
r = this.__data__ = new k4(n);
}
return r.set(t, e), this.size = r.size, this;
}
function v4(t) {
var e = this.__data__ = new C4(t);
this.size = e.size;
}
v4.prototype.clear = Cit;
v4.prototype.delete = kit;
v4.prototype.get = Iit;
v4.prototype.has = Pit;
v4.prototype.set = Rit;
function Nit(t, e) {
for (var r = -1, n = t == null ? 0 : t.length, i = 0, o = []; ++r < n; ) {
var s = t[r];
e(s, r, t) && (o[i++] = s);
}
return o;
}
function Dit() {
return [];
}
var Fit = Object.prototype, Bit = Fit.propertyIsEnumerable, Ik = Object.getOwnPropertySymbols, jit = Ik ? function(t) {
return t == null ? [] : (t = Object(t), Nit(Ik(t), function(e) {
return Bit.call(t, e);
}));
} : Dit;
function zit(t, e, r) {
var n = e(t);
return aa(t) ? n : dz(n, r(t));
}
function Pk(t) {
return zit(t, hz, jit);
}
var cx = il(v3, "DataView"), ux = il(v3, "Promise"), hx = il(v3, "Set"), Vk = "[object Map]", Uit = "[object Object]", Rk = "[object Promise]", Nk = "[object Set]", Dk = "[object WeakMap]", Fk = "[object DataView]", Git = nl(cx), $it = nl(Ph), Wit = nl(ux), Zit = nl(hx), qit = nl(ax), j6 = Y8;
(cx && j6(new cx(new ArrayBuffer(1))) != Fk || Ph && j6(new Ph()) != Vk || ux && j6(ux.resolve()) != Rk || hx && j6(new hx()) != Nk || ax && j6(new ax()) != Dk) && (j6 = function(t) {
var e = Y8(t), r = e == Uit ? t.constructor : void 0, n = r ? nl(r) : "";
if (n)
switch (n) {
case Git:
return Fk;
case $it:
return Vk;
case Wit:
return Rk;
case Zit:
return Nk;
case qit:
return Dk;
}
return e;
});
var Bk = v3.Uint8Array, Xit = "__lodash_hash_undefined__";
function Kit(t) {
return this.__data__.set(t, Xit), this;
}
function Yit(t) {
return this.__data__.has(t);
}
function RQ(t) {
var e = -1, r = t == null ? 0 : t.length;
for (this.__data__ = new k4(); ++e < r; )
this.add(t[e]);
}
RQ.prototype.add = RQ.prototype.push = Kit;
RQ.prototype.has = Yit;
function Jit(t, e) {
for (var r = -1, n = t == null ? 0 : t.length; ++r < n; )
if (e(t[r], r, t))
return !0;
return !1;
}
function t1t(t, e) {
return t.has(e);
}
var e1t = 1, r1t = 2;
function pz(t, e, r, n, i, o) {
var s = r & e1t, a = t.length, u = e.length;
if (a != u && !(s && u > a))
return !1;
var d = o.get(t), T = o.get(e);
if (d && T)
return d == e && T == t;
var f = -1, Q = !0, y = r & r1t ? new RQ() : void 0;
for (o.set(t, e), o.set(e, t); ++f < a; ) {
var _ = t[f], L = e[f];
if (n)
var E = s ? n(L, _, f, e, t, o) : n(_, L, f, t, e, o);
if (E !== void 0) {
if (E)
continue;
Q = !1;
break;
}
if (y) {
if (!Jit(e, function(x, O) {
if (!t1t(y, O) && (_ === x || i(_, x, r, n, o)))
return y.push(O);
})) {
Q = !1;
break;
}
} else if (!(_ === L || i(_, L, r, n, o))) {
Q = !1;
break;
}
}
return o.delete(t), o.delete(e), Q;
}
function n1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n, i) {
r[++e] = [i, n];
}), r;
}
function i1t(t) {
var e = -1, r = Array(t.size);
return t.forEach(function(n) {
r[++e] = n;
}), r;
}
var o1t = 1, s1t = 2, a1t = "[object Boolean]", l1t = "[object Date]", c1t = "[object Error]", u1t = "[object Map]", h1t = "[object Number]", d1t = "[object RegExp]", p1t = "[object Set]", T1t = "[object String]", f1t = "[object Symbol]", Q1t = "[object ArrayBuffer]", m1t = "[object DataView]", jk = h3 ? h3.prototype : void 0, Tb = jk ? jk.valueOf : void 0;
function g1t(t, e, r, n, i, o, s) {
switch (r) {
case m1t:
if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
return !1;
t = t.buffer, e = e.buffer;
case Q1t:
return !(t.byteLength != e.byteLength || !o(new Bk(t), new Bk(e)));
case a1t:
case l1t:
case h1t:
return rS(+t, +e);
case c1t:
return t.name == e.name && t.message == e.message;
case d1t:
case T1t:
return t == e + "";
case u1t:
var a = n1t;
case p1t:
var u = n & o1t;
if (a || (a = i1t), t.size != e.size && !u)
return !1;
var d = s.get(t);
if (d)
return d == e;
n |= s1t, s.set(t, e);
var T = pz(a(t), a(e), n, i, o, s);
return s.delete(t), T;
case f1t:
if (Tb)
return Tb.call(t) == Tb.call(e);
}
return !1;
}
var y1t = 1, v1t = Object.prototype, _1t = v1t.hasOwnProperty;
function b1t(t, e, r, n, i, o) {
var s = r & y1t, a = Pk(t), u = a.length, d = Pk(e), T = d.length;
if (u != T && !s)
return !1;
for (var f = u; f--; ) {
var Q = a[f];
if (!(s ? Q in e : _1t.call(e, Q)))
return !1;
}
var y = o.get(t), _ = o.get(e);
if (y && _)
return y == e && _ == t;
var L = !0;
o.set(t, e), o.set(e, t);
for (var E = s; ++f < u; ) {
Q = a[f];
var x = t[Q], O = e[Q];
if (n)
var k = s ? n(O, x, Q, e, t, o) : n(x, O, Q, t, e, o);
if (!(k === void 0 ? x === O || i(x, O, r, n, o) : k)) {
L = !1;
break;
}
E || (E = Q == "constructor");
}
if (L && !E) {
var R = t.constructor, F = e.constructor;
R != F && "constructor" in t && "constructor" in e && !(typeof R == "function" && R instanceof R && typeof F == "function" && F instanceof F) && (L = !1);
}
return o.delete(t), o.delete(e), L;
}
var L1t = 1, zk = "[object Arguments]", Uk = "[object Array]", $p = "[object Object]", w1t = Object.prototype, Gk = w1t.hasOwnProperty;
function x1t(t, e, r, n, i, o) {
var s = aa(t), a = aa(e), u = s ? Uk : j6(t), d = a ? Uk : j6(e);
u = u == zk ? $p : u, d = d == zk ? $p : d;
var T = u == $p, f = d == $p, Q = u == d;
if (Q && lx(t)) {
if (!lx(e))
return !1;
s = !0, T = !1;
}
if (Q && !T)
return o || (o = new v4()), s || uz(t) ? pz(t, e, r, n, i, o) : g1t(t, e, u, r, n, i, o);
if (!(r & L1t)) {
var y = T && Gk.call(t, "__wrapped__"), _ = f && Gk.call(e, "__wrapped__");
if (y || _) {
var L = y ? t.value() : t, E = _ ? e.value() : e;
return o || (o = new v4()), i(L, E, r, n, o);
}
}
return Q ? (o || (o = new v4()), b1t(t, e, r, n, i, o)) : !1;
}
function yg(t, e, r, n, i) {
return t === e ? !0 : t == null || e == null || !_8(t) && !_8(e) ? t !== t && e !== e : x1t(t, e, r, n, yg, i);
}
var E1t = 1, M1t = 2;
function S1t(t, e, r, n) {
var i = r.length, o = i;
if (t == null)
return !o;
for (t = Object(t); i--; ) {
var s = r[i];
if (s[2] ? s[1] !== t[s[0]] : !(s[0] in t))
return !1;
}
for (; ++i < o; ) {
s = r[i];
var a = s[0], u = t[a], d = s[1];
if (s[2]) {
if (u === void 0 && !(a in t))
return !1;
} else {
var T = new v4(), f;
if (!(f === void 0 ? yg(d, u, E1t | M1t, n, T) : f))
return !1;
}
}
return !0;
}
function Tz(t) {
return t === t && !a0(t);
}
function H1t(t) {
for (var e = hz(t), r = e.length; r--; ) {
var n = e[r], i = t[n];
e[r] = [n, i, Tz(i)];
}
return e;
}
function fz(t, e) {
return function(r) {
return r == null ? !1 : r[t] === e && (e !== void 0 || t in Object(r));
};
}
function A1t(t) {
var e = H1t(t);
return e.length == 1 && e[0][2] ? fz(e[0][0], e[0][1]) : function(r) {
return r === t || S1t(r, t, e);
};
}
function O1t(t, e) {
return t != null && e in Object(t);
}
function C1t(t, e, r) {
e = gg(e, t);
for (var n = -1, i = e.length, o = !1; ++n < i; ) {
var s = hd(e[n]);
if (!(o = t != null && r(t, s)))
break;
t = t[s];
}
return o || ++n != i ? o : (i = t == null ? 0 : t.length, !!i && nS(i) && eS(s, i) && (aa(t) || iS(t)));
}
function Qz(t, e) {
return t != null && C1t(t, e, O1t);
}
var k1t = 1, I1t = 2;
function P1t(t, e) {
return oS(t) && Tz(e) ? fz(hd(t), e) : function(r) {
var n = T4(r, t);
return n === void 0 && n === e ? Qz(r, t) : yg(e, n, k1t | I1t);
};
}
function V1t(t) {
return function(e) {
return e == null ? void 0 : e[t];
};
}
function R1t(t) {
return function(e) {
return aS(e, t);
};
}
function N1t(t) {
return oS(t) ? V1t(hd(t)) : R1t(t);
}
function D1t(t) {
return typeof t == "function" ? t : t == null ? oz : typeof t == "object" ? aa(t) ? P1t(t[0], t[1]) : A1t(t) : N1t(t);
}
var fb = function() {
return v3.Date.now();
}, F1t = "Expected a function", B1t = Math.max, j1t = Math.min;
function z1t(t, e, r) {
var n, i, o, s, a, u, d = 0, T = !1, f = !1, Q = !0;
if (typeof t != "function")
throw new TypeError(F1t);
e = xk(e) || 0, a0(r) && (T = !!r.leading, f = "maxWait" in r, o = f ? B1t(xk(r.maxWait) || 0, e) : o, Q = "trailing" in r ? !!r.trailing : Q);
function y(U) {
var $ = n, et = i;
return n = i = void 0, d = U, s = t.apply(et, $), s;
}
function _(U) {
return d = U, a = setTimeout(x, e), T ? y(U) : s;
}
function L(U) {
var $ = U - u, et = U - d, nt = e - $;
return f ? j1t(nt, o - et) : nt;
}
function E(U) {
var $ = U - u, et = U - d;
return u === void 0 || $ >= e || $ < 0 || f && et >= o;
}
function x() {
var U = fb();
if (E(U))
return O(U);
a = setTimeout(x, L(U));
}
function O(U) {
return a = void 0, Q && n ? y(U) : (n = i = void 0, s);
}
function k() {
a !== void 0 && clearTimeout(a), d = 0, n = u = i = a = void 0;
}
function R() {
return a === void 0 ? s : O(fb());
}
function F() {
var U = fb(), $ = E(U);
if (n = arguments, i = this, u = U, $) {
if (a === void 0)
return _(u);
if (f)
return clearTimeout(a), a = setTimeout(x, e), y(u);
}
return a === void 0 && (a = setTimeout(x, e)), s;
}
return F.cancel = k, F.flush = R, F;
}
function U1t(t, e, r) {
var n = t == null ? 0 : t.length;
if (!n)
return -1;
var i = n - 1;
return Zrt(t, D1t(e), i);
}
function dx(t) {
for (var e = -1, r = t == null ? 0 : t.length, n = {}; ++e < r; ) {
var i = t[e];
n[i[0]] = i[1];
}
return n;
}
function NQ(t, e) {
return yg(t, e);
}
function vg(t) {
return t == null;
}
function mz(t) {
return t === void 0;
}
function G1t(t, e, r, n) {
if (!a0(t))
return t;
e = gg(e, t);
for (var i = -1, o = e.length, s = o - 1, a = t; a != null && ++i < o; ) {
var u = hd(e[i]), d = r;
if (u === "__proto__" || u === "constructor" || u === "prototype")
return t;
if (i != s) {
var T = a[u];
d = void 0, d === void 0 && (d = a0(T) ? T : eS(e[i + 1]) ? [] : {});
}
tnt(a, u, d), a = a[u];
}
return t;
}
function $1t(t, e, r) {
for (var n = -1, i = e.length, o = {}; ++n < i; ) {
var s = e[n], a = aS(t, s);
r(a, s) && G1t(o, gg(s, t), a);
}
return o;
}
function W1t(t, e) {
return $1t(t, e, function(r, n) {
return Qz(t, n);
});
}
var gz = Oit(function(t, e) {
return t == null ? {} : W1t(t, e);
});
const q6 = (t) => t === void 0, S4 = (t) => typeof t == "boolean", ro = (t) => typeof t == "number", k5 = (t) => typeof Element > "u" ? !1 : t instanceof Element, Vh = (t) => vg(t), Z1t = (t) => sa(t) ? !Number.isNaN(Number(t)) : !1, q1t = (t = "") => t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), $k = (t) => Object.keys(t);
class yz extends Error {
constructor(e) {
super(e), this.name = "ElementPlusError";
}
}
function vz(t, e) {
throw new yz(`[${t}] ${e}`);
}
function y2(t, e) {
if (process.env.NODE_ENV !== "production") {
const r = sa(t) ? new yz(`[${t}] ${e}`) : t;
console.warn(r);
}
}
const X1t = "utils/dom/style", _z = (t = "") => t.split(" ").filter((e) => !!e.trim()), Wk = (t, e) => {
if (!t || !e)
return !1;
if (e.includes(" "))
throw new Error("className should not contain space.");
return t.classList.contains(e);
}, px = (t, e) => {
!t || !e.trim() || t.classList.add(..._z(e));
}, Rh = (t, e) => {
!t || !e.trim() || t.classList.remove(..._z(e));
}, L7 = (t, e) => {
var r;
if (!s1 || !t || !e)
return "";
let n = ert(e);
n === "float" && (n = "cssFloat");
try {
const i = t.style[n];
if (i)
return i;
const o = (r = document.defaultView) == null ? void 0 : r.getComputedStyle(t, "");
return o ? o[n] : "";
} catch {
return t.style[n];
}
};
function z5(t, e = "px") {
if (!t)
return "";
if (ro(t) || Z1t(t))
return `${t}${e}`;
if (sa(t))
return t;
y2(X1t, "binding value must be a string or number");
}
let Wp;
const K1t = (t) => {
var e;
if (!s1)
return 0;
if (Wp !== void 0)
return Wp;
const r = document.createElement("div");
r.className = `${t}-scrollbar__wrap`, r.style.visibility = "hidden", r.style.width = "100px", r.style.position = "absolute", r.style.top = "-9999px", document.body.appendChild(r);
const n = r.offsetWidth;
r.style.overflow = "scroll";
const i = document.createElement("div");
i.style.width = "100%", r.appendChild(i);
const o = i.offsetWidth;
return (e = r.parentNode) == null || e.removeChild(r), Wp = n - o, Wp;
};
function Y1t(t, e) {
if (!s1)
return;
if (!e) {
t.scrollTop = 0;
return;
}
const r = [];
let n = e.offsetParent;
for (; n !== null && t !== n && t.contains(n); )
r.push(n), n = n.offsetParent;
const i = e.offsetTop + r.reduce((u, d) => u + d.offsetTop, 0), o = i + e.offsetHeight, s = t.scrollTop, a = s + t.clientHeight;
i < s ? t.scrollTop = i : o > a && (t.scrollTop = o - t.clientHeight);
}
/*! Element Plus Icons Vue v2.3.1 */
var J1t = /* @__PURE__ */ mr({
name: "ArrowDown",
__name: "arrow-down",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
})
]));
}
}), lS = J1t, tot = /* @__PURE__ */ mr({
name: "ArrowLeft",
__name: "arrow-left",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
})
]));
}
}), bz = tot, eot = /* @__PURE__ */ mr({
name: "CircleCheck",
__name: "circle-check",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
}),
je("path", {
fill: "currentColor",
d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
})
]));
}
}), rot = eot, not = /* @__PURE__ */ mr({
name: "CircleClose",
__name: "circle-close",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
}),
je("path", {
fill: "currentColor",
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
})
]));
}
}), Lz = not, iot = /* @__PURE__ */ mr({
name: "Close",
__name: "close",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
})
]));
}
}), Tx = iot, oot = /* @__PURE__ */ mr({
name: "Loading",
__name: "loading",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
})
]));
}
}), wz = oot, sot = /* @__PURE__ */ mr({
name: "WarningFilled",
__name: "warning-filled",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
})
]));
}
}), xz = sot, aot = /* @__PURE__ */ mr({
name: "Warning",
__name: "warning",
setup(t) {
return (e, r) => (ce(), Ye("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024"
}, [
je("path", {
fill: "currentColor",
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
})
]));
}
}), Ez = aot;
const Mz = "__epPropKey", Gr = (t) => t, lot = (t) => T2(t) && !!t[Mz], _g = (t, e) => {
if (!T2(t) || lot(t))
return t;
const { values: r, required: n, default: i, type: o, validator: s } = t, u = {
type: o,
required: !!n,
validator: r || s ? (d) => {
let T = !1, f = [];
if (r && (f = Array.from(r), vk(t, "default") && f.push(i), T || (T = f.includes(d))), s && (T || (T = s(d))), !T && f.length > 0) {
const Q = [...new Set(f)].map((y) => JSON.stringify(y)).join(", ");
pet(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${Q}], got value ${JSON.stringify(d)}.`);
}
return T;
} : void 0,
[Mz]: !0
};
return vk(t, "default") && (u.default = i), u;
}, Sn = (t) => dx(Object.entries(t).map(([e, r]) => [
e,
_g(r, e)
])), b8 = Gr([
String,
Object,
Function
]), cot = {
Close: Tx
}, uot = {
validating: wz,
success: rot,
error: Lz
}, v2 = (t, e) => {
if (t.install = (r) => {
for (const n of [t, ...Object.values(e ?? {})])
r.component(n.name, n);
}, e)
for (const [r, n] of Object.entries(e))
t[r] = n;
return t;
}, hot = (t, e) => (t.install = (r) => {
r.directive(e, t);
}, t), ol = (t) => (t.install = C5, t), dot = (...t) => (e) => {
t.forEach((r) => {
Zo(r) ? r(e) : r.value = e;
});
}, Nh = {
tab: "Tab",
enter: "Enter",
space: "Space",
left: "ArrowLeft",
up: "ArrowUp",
right: "ArrowRight",
down: "ArrowDown",
esc: "Escape",
delete: "Delete",
backspace: "Backspace",
numpadEnter: "NumpadEnter",
pageUp: "PageUp",
pageDown: "PageDown",
home: "Home",
end: "End"
}, Wo = "update:modelValue", cS = "change", Sz = ["", "default", "small", "large"];
var ff = /* @__PURE__ */ ((t) => (t[t.TEXT = 1] = "TEXT", t[t.CLASS = 2] = "CLASS", t[t.STYLE = 4] = "STYLE", t[t.PROPS = 8] = "PROPS", t[t.FULL_PROPS = 16] = "FULL_PROPS", t[t.HYDRATE_EVENTS = 32] = "HYDRATE_EVENTS", t[t.STABLE_FRAGMENT = 64] = "STABLE_FRAGMENT", t[t.KEYED_FRAGMENT = 128] = "KEYED_FRAGMENT", t[t.UNKEYED_FRAGMENT = 256] = "UNKEYED_FRAGMENT", t[t.NEED_PATCH = 512] = "NEED_PATCH", t[t.DYNAMIC_SLOTS = 1024] = "DYNAMIC_SLOTS", t[t.HOISTED = -1] = "HOISTED", t[t.BAIL = -2] = "BAIL", t))(ff || {});
const pot = (t) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(t), cu = (t) => t, h8 = ({ from: t, replacement: e, scope: r, version: n, ref: i, type: o = "API" }, s) => {
on(() => vt(s), (a) => {
a && y2(r, `[${o}] ${t} is about to be deprecated in version ${n}, please use ${e} instead.
For more detail, please visit: ${i}
`);
}, {
immediate: !0
});
}, Tot = (t, e, r, n) => {
let i = {
offsetX: 0,
offsetY: 0
};
const o = (d) => {
const T = d.clientX, f = d.clientY, { offsetX: Q, offsetY: y } = i, _ = t.value.getBoundingClientRect(), L = _.left, E = _.top, x = _.width, O = _.height, k = document.documentElement.clientWidth, R = document.documentElement.clientHeight, F = -L + Q, U = -E + y, $ = k - L - x + Q, et = R - E - O + y, nt = (rt) => {
let gt = Q + rt.clientX - T, It = y + rt.clientY - f;
n != null && n.value || (gt = Math.min(Math.max(gt, F), $), It = Math.min(Math.max(It, U), et)), i = {
offsetX: gt,
offsetY: It
}, t.value && (t.value.style.transform = `translate(${z5(gt)}, ${z5(It)})`);
}, ct = () => {
document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", ct);
};
document.addEventListener("mousemove", nt), document.addEventListener("mouseup", ct);
}, s = () => {
e.value && t.value && e.value.addEventListener("mousedown", o);
}, a = () => {
e.value && t.value && e.value.removeEventListener("mousedown", o);
}, u = () => {
i = {
offsetX: 0,
offsetY: 0
}, t.value && (t.value.style.transform = "none");
};
return W1(() => {
qj(() => {
r.value ? s() : a();
});
}), Rs(() => {
a();
}), {
resetPosition: u
};
};
var fot = {
name: "en",
el: {
breadcrumb: {
label: "Breadcrumb"
},
colorpicker: {
confirm: "OK",
clear: "Clear",
defaultLabel: "color picker",
description: "current color is {color}. press enter to select a new color.",
alphaLabel: "pick alpha value"
},
datepicker: {
now: "Now",
today: "Today",
cancel: "Cancel",
clear: "Clear",
confirm: "OK",
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
monthTablePrompt: "Use the arrow keys and enter to select the month",
yearTablePrompt: "Use the arrow keys and enter to select the year",
selectedDate: "Selected date",
selectDate: "Select date",
selectTime: "Select time",
startDate: "Start Date",
startTime: "Start Time",
endDate: "End Date",
endTime: "End Time",
prevYear: "Previous Year",
nextYear: "Next Year",
prevMonth: "Previous Month",
nextMonth: "Next Month",
year: "",
month1: "January",
month2: "February",
month3: "March",
month4: "April",
month5: "May",
month6: "June",
month7: "July",
month8: "August",
month9: "September",
month10: "October",
month11: "November",
month12: "December",
week: "week",
weeks: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
weeksFull: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
},
months: {
jan: "Jan",
feb: "Feb",
mar: "Mar",
apr: "Apr",
may: "May",
jun: "Jun",
jul: "Jul",
aug: "Aug",
sep: "Sep",
oct: "Oct",
nov: "Nov",
dec: "Dec"
}
},
inputNumber: {
decrease: "decrease number",
increase: "increase number"
},
select: {
loading: "Loading",
noMatch: "No matching data",
noData: "No data",
placeholder: "Select"
},
mention: {
loading: "Loading"
},
dropdown: {
toggleDropdown: "Toggle Dropdown"
},
cascader: {
noMatch: "No matching data",
loading: "Loading",
placeholder: "Select",
noData: "No data"
},
pagination: {
goto: "Go to",
pagesize: "/page",
total: "Total {total}",
pageClassifier: "",
page: "Page",
prev: "Go to previous page",
next: "Go to next page",
currentPage: "page {pager}",
prevPages: "Previous {pager} pages",
nextPages: "Next {pager} pages",
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
},
dialog: {
close: "Close this dialog"
},
drawer: {
close: "Close this dialog"
},
messagebox: {
title: "Message",
confirm: "OK",
cancel: "Cancel",
error: "Illegal input",
close: "Close this dialog"
},
upload: {
deleteTip: "press delete to remove",
delete: "Delete",
preview: "Preview",
continue: "Continue"
},
slider: {
defaultLabel: "slider between {min} and {max}",
defaultRangeStartLabel: "pick start value",
defaultRangeEndLabel: "pick end value"
},
table: {
emptyText: "No Data",
confirmFilter: "Confirm",
resetFilter: "Reset",
clearFilter: "All",
sumText: "Sum"
},
tour: {
next: "Next",
previous: "Previous",
finish: "Finish"
},
tree: {
emptyText: "No Data"
},
transfer: {
noMatch: "No matching data",
noData: "No data",
titles: ["List 1", "List 2"],
filterPlaceholder: "Enter keyword",
noCheckedFormat: "{total} items",
hasCheckedFormat: "{checked}/{total} checked"
},
image: {
error: "FAILED"
},
pageHeader: {
title: "Back"
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No"
},
carousel: {
leftArrow: "Carousel arrow left",
rightArrow: "Carousel arrow right",
indicator: "Carousel switch to index {index}"
}
}
};
const Qot = (t) => (e, r) => mot(e, r, vt(t)), mot = (t, e, r) => T4(r, t, t).replace(/\{(\w+)\}/g, (n, i) => {
var o;
return `${(o = e == null ? void 0 : e[i]) != null ? o : `{${i}}`}`;
}), got = (t) => {
const e = Kt(() => vt(t).name), r = g2(t) ? t : Ie(t);
return {
lang: e,
locale: r,
t: Qot(t)
};
}, Hz = Symbol("localeContextKey"), uS = (t) => {
const e = t || ln(Hz, Ie());
return got(Kt(() => e.value || fot));
}, eh = "el", yot = "is-", G0 = (t, e, r, n, i) => {
let o = `${t}-${e}`;
return r && (o += `-${r}`), n && (o += `__${n}`), i && (o += `--${i}`), o;
}, Az = Symbol("namespaceContextKey"), hS = (t) => {
const e = t || (G1() ? ln(Az, Ie(eh)) : Ie(eh));
return Kt(() => vt(e) || eh);
}, Bn = (t, e) => {
const r = hS(e);
return {
namespace: r,
b: (L = "") => G0(r.value, t, L, "", ""),
e: (L) => L ? G0(r.value, t, "", L, "") : "",
m: (L) => L ? G0(r.value, t, "", "", L) : "",
be: (L, E) => L && E ? G0(r.value, t, L, E, "") : "",
em: (L, E) => L && E ? G0(r.value, t, "", L, E) : "",
bm: (L, E) => L && E ? G0(r.value, t, L, "", E) : "",
bem: (L, E, x) => L && E && x ? G0(r.value, t, L, E, x) : "",
is: (L, ...E) => {
const x = E.length >= 1 ? E[0] : !0;
return L && x ? `${yot}${L}` : "";
},
cssVar: (L) => {
const E = {};
for (const x in L)
L[x] && (E[`--${r.value}-${x}`] = L[x]);
return E;
},
cssVarName: (L) => `--${r.value}-${L}`,
cssVarBlock: (L) => {
const E = {};
for (const x in L)
L[x] && (E[`--${r.value}-${t}-${x}`] = L[x]);
return E;
},
cssVarBlockName: (L) => `--${r.value}-${t}-${L}`
};
}, vot = (t, e = {}) => {
g2(t) || vz("[useLockscreen]", "You need to pass a ref param to this function");
const r = e.ns || Bn("popup"), n = Kt(() => r.bm("parent", "hidden"));
if (!s1 || Wk(document.body, n.value))
return;
let i = 0, o = !1, s = "0";
const a = () => {
setTimeout(() => {
Rh(document == null ? void 0 : document.body, n.value), o && document && (document.body.style.width = s);
}, 200);
};
on(t, (u) => {
if (!u) {
a();
return;
}
o = !Wk(document.body, n.value), o && (s = document.body.style.width), i = K1t(r.namespace.value);
const d = document.documentElement.clientHeight < document.body.scrollHeight, T = L7(document.body, "overflowY");
i > 0 && (d || T === "scroll") && o && (document.body.style.width = `calc(100% - ${i}px)`), px(document.body, n.value);
}), XM(() => a());
}, _ot = _g({
type: Gr(Boolean),
default: null
}), bot = _g({
type: Gr(Function)
}), Lot = (t) => {
const e = `update:${t}`, r = `onUpdate:${t}`, n = [e], i = {
[t]: _ot,
[r]: bot
};
return {
useModelToggle: ({
indicator: s,
toggleReason: a,
shouldHideWhenRouteChanges: u,
shouldProceed: d,
onShow: T,
onHide: f
}) => {
const Q = G1(), { emit: y } = Q, _ = Q.props, L = Kt(() => Zo(_[r])), E = Kt(() => _[t] === null), x = ($) => {
s.value !== !0 && (s.value = !0, a && (a.value = $), Zo(T) && T($));
}, O = ($) => {
s.value !== !1 && (s.value = !1, a && (a.value = $), Zo(f) && f($));
}, k = ($) => {
if (_.disabled === !0 || Zo(d) && !d())
return;
const et = L.value && s1;
et && y(e, !0), (E.value || !et) && x($);
}, R = ($) => {
if (_.disabled === !0 || !s1)
return;
const et = L.value && s1;
et && y(e, !1), (E.value || !et) && O($);
}, F = ($) => {
S4($) && (_.disabled && $ ? L.value && y(e, !1) : s.value !== $ && ($ ? x() : O()));
}, U = () => {
s.value ? R() : k();
};
return on(() => _[t], F), u && Q.appContext.config.globalProperties.$route !== void 0 && on(() => ({
...Q.proxy.$route
}), () => {
u.value && s.value && R();
}), W1(() => {
F(_[t]);
}), {
hide: R,
show: k,
toggle: U,
hasUpdateHandler: L
};
},
useModelToggleProps: i,
useModelToggleEmits: n
};
}, Oz = (t) => {
const e = G1();
return Kt(() => {
var r, n;
return (n = (r = e == null ? void 0 : e.proxy) == null ? void 0 : r.$props) == null ? void 0 : n[t];
});
};
var Q2 = "top", ks = "bottom", Is = "right", m2 = "left", dS = "auto", dd = [Q2, ks, Is, m2], L8 = "start", Dh = "end", wot = "clippingParents", Cz = "viewport", uu = "popper", xot = "reference", Zk = dd.reduce(function(t, e) {
return t.concat([e + "-" + L8, e + "-" + Dh]);
}, []), bg = [].concat(dd, [dS]).reduce(function(t, e) {
return t.concat([e, e + "-" + L8, e + "-" + Dh]);
}, []), Eot = "beforeRead", Mot = "read", Sot = "afterRead", Hot = "beforeMain", Aot = "main", Oot = "afterMain", Cot = "beforeWrite", kot = "write", Iot = "afterWrite", Pot = [Eot, Mot, Sot, Hot, Aot, Oot, Cot, kot, Iot];
function d3(t) {
return t ? (t.nodeName || "").toLowerCase() : null;
}
function ha(t) {
if (t == null) return window;
if (t.toString() !== "[object Window]") {
var e = t.ownerDocument;
return e && e.defaultView || window;
}
return t;
}
function w8(t) {
var e = ha(t).Element;
return t instanceof e || t instanceof Element;
}
function Hs(t) {
var e = ha(t).HTMLElement;
return t instanceof e || t instanceof HTMLElement;
}
function pS(t) {
if (typeof ShadowRoot > "u") return !1;
var e = ha(t).ShadowRoot;
return t instanceof e || t instanceof ShadowRoot;
}
function Vot(t) {
var e = t.state;
Object.keys(e.elements).forEach(function(r) {
var n = e.styles[r] || {}, i = e.attributes[r] || {}, o = e.elements[r];
!Hs(o) || !d3(o) || (Object.assign(o.style, n), Object.keys(i).forEach(function(s) {
var a = i[s];
a === !1 ? o.removeAttribute(s) : o.setAttribute(s, a === !0 ? "" : a);
}));
});
}
function Rot(t) {
var e = t.state, r = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
return Object.assign(e.elements.popper.style, r.popper), e.styles = r, e.elements.arrow && Object.assign(e.elements.arrow.style, r.arrow), function() {
Object.keys(e.elements).forEach(function(n) {
var i = e.elements[n], o = e.attributes[n] || {}, s = Object.keys(e.styles.hasOwnProperty(n) ? e.styles[n] : r[n]), a = s.reduce(function(u, d) {
return u[d] = "", u;
}, {});
!Hs(i) || !d3(i) || (Object.assign(i.style, a), Object.keys(o).forEach(function(u) {
i.removeAttribute(u);
}));
});
};
}
var kz = { name: "applyStyles", enabled: !0, phase: "write", fn: Vot, effect: Rot, requires: ["computeStyles"] };
function o3(t) {
return t.split("-")[0];
}
var I5 = Math.max, DQ = Math.min, x8 = Math.round;
function E8(t, e) {
e === void 0 && (e = !1);
var r = t.getBoundingClientRect(), n = 1, i = 1;
if (Hs(t) && e) {
var o = t.offsetHeight, s = t.offsetWidth;
s > 0 && (n = x8(r.width) / s || 1), o > 0 && (i = x8(r.height) / o || 1);
}
return { width: r.width / n, height: r.height / i, top: r.top / i, right: r.right / n, bottom: r.bottom / i, left: r.left / n, x: r.left / n, y: r.top / i };
}
function TS(t) {
var e = E8(t), r = t.offsetWidth, n = t.offsetHeight;
return Math.abs(e.width - r) <= 1 && (r = e.width), Math.abs(e.height - n) <= 1 && (n = e.height), { x: t.offsetLeft, y: t.offsetTop, width: r, height: n };
}
function Iz(t, e) {
var r = e.getRootNode && e.getRootNode();
if (t.contains(e)) return !0;
if (r && pS(r)) {
var n = e;
do {
if (n && t.isSameNode(n)) return !0;
n = n.parentNode || n.host;
} while (n);
}
return !1;
}
function H4(t) {
return ha(t).getComputedStyle(t);
}
function Not(t) {
return ["table", "td", "th"].indexOf(d3(t)) >= 0;
}
function d0(t) {
return ((w8(t) ? t.ownerDocument : t.document) || window.document).documentElement;
}
function Lg(t) {
return d3(t) === "html" ? t : t.assignedSlot || t.parentNode || (pS(t) ? t.host : null) || d0(t);
}
function qk(t) {
return !Hs(t) || H4(t).position === "fixed" ? null : t.offsetParent;
}
function Dot(t) {
var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, r = navigator.userAgent.indexOf("Trident") !== -1;
if (r && Hs(t)) {
var n = H4(t);
if (n.position === "fixed") return null;
}
var i = Lg(t);
for (pS(i) && (i = i.host); Hs(i) && ["html", "body"].indexOf(d3(i)) < 0; ) {
var o = H4(i);
if (o.transform !== "none" || o.perspective !== "none" || o.contain === "paint" || ["transform", "perspective"].indexOf(o.willChange) !== -1 || e && o.willChange === "filter" || e && o.filter && o.filter !== "none") return i;
i = i.parentNode;
}
return null;
}
function pd(t) {
for (var e = ha(t), r = qk(t); r && Not(r) && H4(r).position === "static"; ) r = qk(r);
return r && (d3(r) === "html" || d3(r) === "body" && H4(r).position === "static") ? e : r || Dot(t) || e;
}
function fS(t) {
return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
}
function rh(t, e, r) {
return I5(t, DQ(e, r));
}
function Fot(t, e, r) {
var n = rh(t, e, r);
return n > r ? r : n;
}
function Pz() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function Vz(t) {
return Object.assign({}, Pz(), t);
}
function Rz(t, e) {
return e.reduce(function(r, n) {
return r[n] = t, r;
}, {});
}
var Bot = function(t, e) {
return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, Vz(typeof t != "number" ? t : Rz(t, dd));
};
function jot(t) {
var e, r = t.state, n = t.name, i = t.options, o = r.elements.arrow, s = r.modifiersData.popperOffsets, a = o3(r.placement), u = fS(a), d = [m2, Is].indexOf(a) >= 0, T = d ? "height" : "width";
if (!(!o || !s)) {
var f = Bot(i.padding, r), Q = TS(o), y = u === "y" ? Q2 : m2, _ = u === "y" ? ks : Is, L = r.rects.reference[T] + r.rects.reference[u] - s[u] - r.rects.popper[T], E = s[u] - r.rects.reference[u], x = pd(o), O = x ? u === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, k = L / 2 - E / 2, R = f[y], F = O - Q[T] - f[_], U = O / 2 - Q[T] / 2 + k, $ = rh(R, U, F), et = u;
r.modifiersData[n] = (e = {}, e[et] = $, e.centerOffset = $ - U, e);
}
}
function zot(t) {
var e = t.state, r = t.options, n = r.element, i = n === void 0 ? "[data-popper-arrow]" : n;
i != null && (typeof i == "string" && (i = e.elements.popper.querySelector(i), !i) || !Iz(e.elements.popper, i) || (e.elements.arrow = i));
}
var Uot = { name: "arrow", enabled: !0, phase: "main", fn: jot, effect: zot, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function M8(t) {
return t.split("-")[1];
}
var Got = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function $ot(t) {
var e = t.x, r = t.y, n = window, i = n.devicePixelRatio || 1;
return { x: x8(e * i) / i || 0, y: x8(r * i) / i || 0 };
}
function Xk(t) {
var e, r = t.popper, n = t.popperRect, i = t.placement, o = t.variation, s = t.offsets, a = t.position, u = t.gpuAcceleration, d = t.adaptive, T = t.roundOffsets, f = t.isFixed, Q = s.x, y = Q === void 0 ? 0 : Q, _ = s.y, L = _ === void 0 ? 0 : _, E = typeof T == "function" ? T({ x: y, y: L }) : { x: y, y: L };
y = E.x, L = E.y;
var x = s.hasOwnProperty("x"), O = s.hasOwnProperty("y"), k = m2, R = Q2, F = window;
if (d) {
var U = pd(r), $ = "clientHeight", et = "clientWidth";
if (U === ha(r) && (U = d0(r), H4(U).position !== "static" && a === "absolute" && ($ = "scrollHeight", et = "scrollWidth")), U = U, i === Q2 || (i === m2 || i === Is) && o === Dh) {
R = ks;
var nt = f && U === F && F.visualViewport ? F.visualViewport.height : U[$];
L -= nt - n.height, L *= u ? 1 : -1;
}
if (i === m2 || (i === Q2 || i === ks) && o === Dh) {
k = Is;
var ct = f && U === F && F.visualViewport ? F.visualViewport.width : U[et];
y -= ct - n.width, y *= u ? 1 : -1;
}
}
var rt = Object.assign({ position: a }, d && Got), gt = T === !0 ? $ot({ x: y, y: L }) : { x: y, y: L };
if (y = gt.x, L = gt.y, u) {
var It;
return Object.assign({}, rt, (It = {}, It[R] = O ? "0" : "", It[k] = x ? "0" : "", It.transform = (F.devicePixelRatio || 1) <= 1 ? "translate(" + y + "px, " + L + "px)" : "translate3d(" + y + "px, " + L + "px, 0)", It));
}
return Object.assign({}, rt, (e = {}, e[R] = O ? L + "px" : "", e[k] = x ? y + "px" : "", e.transform = "", e));
}
function Wot(t) {
var e = t.state, r = t.options, n = r.gpuAcceleration, i = n === void 0 ? !0 : n, o = r.adaptive, s = o === void 0 ? !0 : o, a = r.roundOffsets, u = a === void 0 ? !0 : a, d = { placement: o3(e.placement), variation: M8(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: i, isFixed: e.options.strategy === "fixed" };
e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Xk(Object.assign({}, d, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: s, roundOffsets: u })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Xk(Object.assign({}, d, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: u })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var Nz = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: Wot, data: {} }, Zp = { passive: !0 };
function Zot(t) {
var e = t.state, r = t.instance, n = t.options, i = n.scroll, o = i === void 0 ? !0 : i, s = n.resize, a = s === void 0 ? !0 : s, u = ha(e.elements.popper), d = [].concat(e.scrollParents.reference, e.scrollParents.popper);
return o && d.forEach(function(T) {
T.addEventListener("scroll", r.update, Zp);
}), a && u.addEventListener("resize", r.update, Zp), function() {
o && d.forEach(function(T) {
T.removeEventListener("scroll", r.update, Zp);
}), a && u.removeEventListener("resize", r.update, Zp);
};
}
var Dz = { name: "eventListeners", enabled: !0, phase: "write", fn: function() {
}, effect: Zot, data: {} }, qot = { left: "right", right: "left", bottom: "top", top: "bottom" };
function Qf(t) {
return t.replace(/left|right|bottom|top/g, function(e) {
return qot[e];
});
}
var Xot = { start: "end", end: "start" };
function Kk(t) {
return t.replace(/start|end/g, function(e) {
return Xot[e];
});
}
function QS(t) {
var e = ha(t), r = e.pageXOffset, n = e.pageYOffset;
return { scrollLeft: r, scrollTop: n };
}
function mS(t) {
return E8(d0(t)).left + QS(t).scrollLeft;
}
function Kot(t) {
var e = ha(t), r = d0(t), n = e.visualViewport, i = r.clientWidth, o = r.clientHeight, s = 0, a = 0;
return n && (i = n.width, o = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (s = n.offsetLeft, a = n.offsetTop)), { width: i, height: o, x: s + mS(t), y: a };
}
function Yot(t) {
var e, r = d0(t), n = QS(t), i = (e = t.ownerDocument) == null ? void 0 : e.body, o = I5(r.scrollWidth, r.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = I5(r.scrollHeight, r.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), a = -n.scrollLeft + mS(t), u = -n.scrollTop;
return H4(i || r).direction === "rtl" && (a += I5(r.clientWidth, i ? i.clientWidth : 0) - o), { width: o, height: s, x: a, y: u };
}
function gS(t) {
var e = H4(t), r = e.overflow, n = e.overflowX, i = e.overflowY;
return /auto|scroll|overlay|hidden/.test(r + i + n);
}
function Fz(t) {
return ["html", "body", "#document"].indexOf(d3(t)) >= 0 ? t.ownerDocument.body : Hs(t) && gS(t) ? t : Fz(Lg(t));
}
function nh(t, e) {
var r;
e === void 0 && (e = []);
var n = Fz(t), i = n === ((r = t.ownerDocument) == null ? void 0 : r.body), o = ha(n), s = i ? [o].concat(o.visualViewport || [], gS(n) ? n : []) : n, a = e.concat(s);
return i ? a : a.concat(nh(Lg(s)));
}
function fx(t) {
return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height });
}
function Jot(t) {
var e = E8(t);
return e.top = e.top + t.clientTop, e.left = e.left + t.clientLeft, e.bottom = e.top + t.clientHeight, e.right = e.left + t.clientWidth, e.width = t.clientWidth, e.height = t.clientHeight, e.x = e.left, e.y = e.top, e;
}
function Yk(t, e) {
return e === Cz ? fx(Kot(t)) : w8(e) ? Jot(e) : fx(Yot(d0(t)));
}
function t2t(t) {
var e = nh(Lg(t)), r = ["absolute", "fixed"].indexOf(H4(t).position) >= 0, n = r && Hs(t) ? pd(t) : t;
return w8(n) ? e.filter(function(i) {
return w8(i) && Iz(i, n) && d3(i) !== "body";
}) : [];
}
function e2t(t, e, r) {
var n = e === "clippingParents" ? t2t(t) : [].concat(e), i = [].concat(n, [r]), o = i[0], s = i.reduce(function(a, u) {
var d = Yk(t, u);
return a.top = I5(d.top, a.top), a.right = DQ(d.right, a.right), a.bottom = DQ(d.bottom, a.bottom), a.left = I5(d.left, a.left), a;
}, Yk(t, o));
return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
}
function Bz(t) {
var e = t.reference, r = t.element, n = t.placement, i = n ? o3(n) : null, o = n ? M8(n) : null, s = e.x + e.width / 2 - r.width / 2, a = e.y + e.height / 2 - r.height / 2, u;
switch (i) {
case Q2:
u = { x: s, y: e.y - r.height };
break;
case ks:
u = { x: s, y: e.y + e.height };
break;
case Is:
u = { x: e.x + e.width, y: a };
break;
case m2:
u = { x: e.x - r.width, y: a };
break;
default:
u = { x: e.x, y: e.y };
}
var d = i ? fS(i) : null;
if (d != null) {
var T = d === "y" ? "height" : "width";
switch (o) {
case L8:
u[d] = u[d] - (e[T] / 2 - r[T] / 2);
break;
case Dh:
u[d] = u[d] + (e[T] / 2 - r[T] / 2);
break;
}
}
return u;
}
function Fh(t, e) {
e === void 0 && (e = {});
var r = e, n = r.placement, i = n === void 0 ? t.placement : n, o = r.boundary, s = o === void 0 ? wot : o, a = r.rootBoundary, u = a === void 0 ? Cz : a, d = r.elementContext, T = d === void 0 ? uu : d, f = r.altBoundary, Q = f === void 0 ? !1 : f, y = r.padding, _ = y === void 0 ? 0 : y, L = Vz(typeof _ != "number" ? _ : Rz(_, dd)), E = T === uu ? xot : uu, x = t.rects.popper, O = t.elements[Q ? E : T], k = e2t(w8(O) ? O : O.contextElement || d0(t.elements.popper), s, u), R = E8(t.elements.reference), F = Bz({ reference: R, element: x, strategy: "absolute", placement: i }), U = fx(Object.assign({}, x, F)), $ = T === uu ? U : R, et = { top: k.top - $.top + L.top, bottom: $.bottom - k.bottom + L.bottom, left: k.left - $.left + L.left, right: $.right - k.right + L.right }, nt = t.modifiersData.offset;
if (T === uu && nt) {
var ct = nt[i];
Object.keys(et).forEach(function(rt) {
var gt = [Is, ks].indexOf(rt) >= 0 ? 1 : -1, It = [Q2, ks].indexOf(rt) >= 0 ? "y" : "x";
et[rt] += ct[It] * gt;
});
}
return et;
}
function r2t(t, e) {
e === void 0 && (e = {});
var r = e, n = r.placement, i = r.boundary, o = r.rootBoundary, s = r.padding, a = r.flipVariations, u = r.allowedAutoPlacements, d = u === void 0 ? bg : u, T = M8(n), f = T ? a ? Zk : Zk.filter(function(_) {
return M8(_) === T;
}) : dd, Q = f.filter(function(_) {
return d.indexOf(_) >= 0;
});
Q.length === 0 && (Q = f);
var y = Q.reduce(function(_, L) {
return _[L] = Fh(t, { placement: L, boundary: i, rootBoundary: o, padding: s })[o3(L)], _;
}, {});
return Object.keys(y).sort(function(_, L) {
return y[_] - y[L];
});
}
function n2t(t) {
if (o3(t) === dS) return [];
var e = Qf(t);
return [Kk(t), e, Kk(e)];
}
function i2t(t) {
var e = t.state, r = t.options, n = t.name;
if (!e.modifiersData[n]._skip) {
for (var i = r.mainAxis, o = i === void 0 ? !0 : i, s = r.altAxis, a = s === void 0 ? !0 : s, u = r.fallbackPlacements, d = r.padding, T = r.boundary, f = r.rootBoundary, Q = r.altBoundary, y = r.flipVariations, _ = y === void 0 ? !0 : y, L = r.allowedAutoPlacements, E = e.options.placement, x = o3(E), O = x === E, k = u || (O || !_ ? [Qf(E)] : n2t(E)), R = [E].concat(k).reduce(function(er, Je) {
return er.concat(o3(Je) === dS ? r2t(e, { placement: Je, boundary: T, rootBoundary: f, padding: d, flipVariations: _, allowedAutoPlacements: L }) : Je);
}, []), F = e.rects.reference, U = e.rects.popper, $ = /* @__PURE__ */ new Map(), et = !0, nt = R[0], ct = 0; ct < R.length; ct++) {
var rt = R[ct], gt = o3(rt), It = M8(rt) === L8, Zt = [Q2, ks].indexOf(gt) >= 0, oe = Zt ? "width" : "height", re = Fh(e, { placement: rt, boundary: T, rootBoundary: f, altBoundary: Q, padding: d }), Ve = Zt ? It ? Is : m2 : It ? ks : Q2;
F[oe] > U[oe] && (Ve = Qf(Ve));
var yr = Qf(Ve), qr = [];
if (o && qr.push(re[gt] <= 0), a && qr.push(re[Ve] <= 0, re[yr] <= 0), qr.every(function(er) {
return er;
})) {
nt = rt, et = !1;
break;
}
$.set(rt, qr);
}
if (et) for (var ie = _ ? 3 : 1, Qe = function(er) {
var Je = R.find(function(Ne) {
var Gt = $.get(Ne);
if (Gt) return Gt.slice(0, er).every(function(te) {
return te;
});
});
if (Je) return nt = Je, "break";
}, Ke = ie; Ke > 0; Ke--) {
var He = Qe(Ke);
if (He === "break") break;
}
e.placement !== nt && (e.modifiersData[n]._skip = !0, e.placement = nt, e.reset = !0);
}
}
var o2t = { name: "flip", enabled: !0, phase: "main", fn: i2t, requiresIfExists: ["offset"], data: { _skip: !1 } };
function Jk(t, e, r) {
return r === void 0 && (r = { x: 0, y: 0 }), { top: t.top - e.height - r.y, right: t.right - e.width + r.x, bottom: t.bottom - e.height + r.y, left: t.left - e.width - r.x };
}
function tI(t) {
return [Q2, Is, ks, m2].some(function(e) {
return t[e] >= 0;
});
}
function s2t(t) {
var e = t.state, r = t.name, n = e.rects.reference, i = e.rects.popper, o = e.modifiersData.preventOverflow, s = Fh(e, { elementContext: "reference" }), a = Fh(e, { altBoundary: !0 }), u = Jk(s, n), d = Jk(a, i, o), T = tI(u), f = tI(d);
e.modifiersData[r] = { referenceClippingOffsets: u, popperEscapeOffsets: d, isReferenceHidden: T, hasPopperEscaped: f }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": T, "data-popper-escaped": f });
}
var a2t = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: s2t };
function l2t(t, e, r) {
var n = o3(t), i = [m2, Q2].indexOf(n) >= 0 ? -1 : 1, o = typeof r == "function" ? r(Object.assign({}, e, { placement: t })) : r, s = o[0], a = o[1];
return s = s || 0, a = (a || 0) * i, [m2, Is].indexOf(n) >= 0 ? { x: a, y: s } : { x: s, y: a };
}
function c2t(t) {
var e = t.state, r = t.options, n = t.name, i = r.offset, o = i === void 0 ? [0, 0] : i, s = bg.reduce(function(T, f) {
return T[f] = l2t(f, e.rects, o), T;
}, {}), a = s[e.placement], u = a.x, d = a.y;
e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += u, e.modifiersData.popperOffsets.y += d), e.modifiersData[n] = s;
}
var u2t = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: c2t };
function h2t(t) {
var e = t.state, r = t.name;
e.modifiersData[r] = Bz({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var jz = { name: "popperOffsets", enabled: !0, phase: "read", fn: h2t, data: {} };
function d2t(t) {
return t === "x" ? "y" : "x";
}
function p2t(t) {
var e = t.state, r = t.options, n = t.name, i = r.mainAxis, o = i === void 0 ? !0 : i, s = r.altAxis, a = s === void 0 ? !1 : s, u = r.boundary, d = r.rootBoundary, T = r.altBoundary, f = r.padding, Q = r.tether, y = Q === void 0 ? !0 : Q, _ = r.tetherOffset, L = _ === void 0 ? 0 : _, E = Fh(e, { boundary: u, rootBoundary: d, padding: f, altBoundary: T }), x = o3(e.placement), O = M8(e.placement), k = !O, R = fS(x), F = d2t(R), U = e.modifiersData.popperOffsets, $ = e.rects.reference, et = e.rects.popper, nt = typeof L == "function" ? L(Object.assign({}, e.rects, { placement: e.placement })) : L, ct = typeof nt == "number" ? { mainAxis: nt, altAxis: nt } : Object.assign({ mainAxis: 0, altAxis: 0 }, nt), rt = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, gt = { x: 0, y: 0 };
if (U) {
if (o) {
var It, Zt = R === "y" ? Q2 : m2, oe = R === "y" ? ks : Is, re = R === "y" ? "height" : "width", Ve = U[R], yr = Ve + E[Zt], qr = Ve - E[oe], ie = y ? -et[re] / 2 : 0, Qe = O === L8 ? $[re] : et[re], Ke = O === L8 ? -et[re] : -$[re], He = e.elements.arrow, er = y && He ? TS(He) : { width: 0, height: 0 }, Je = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Pz(), Ne = Je[Zt], Gt = Je[oe], te = rh(0, $[re], er[re]), me = k ? $[re] / 2 - ie - te - Ne - ct.mainAxis : Qe - te - Ne - ct.mainAxis, de = k ? -$[re] / 2 + ie + te + Gt + ct.mainAxis : Ke + te + Gt + ct.mainAxis, Ge = e.elements.arrow && pd(e.elements.arrow), Tr = Ge ? R === "y" ? Ge.clientTop || 0 : Ge.clientLeft || 0 : 0, qe = (It = rt == null ? void 0 : rt[R]) != null ? It : 0, $e = Ve + me - qe - Tr, ar = Ve + de - qe, Ct = rh(y ? DQ(yr, $e) : yr, Ve, y ? I5(qr, ar) : qr);
U[R] = Ct, gt[R] = Ct - Ve;
}
if (a) {
var en, Jr = R === "x" ? Q2 : m2, Hr = R === "x" ? ks : Is, Rr = U[F], dn = F === "y" ? "height" : "width", ji = Rr + E[Jr], Ji = Rr - E[Hr], ki = [Q2, m2].indexOf(x) !== -1, _i = (en = rt == null ? void 0 : rt[F]) != null ? en : 0, Ii = ki ? ji : Rr - $[dn] - et[dn] - _i + ct.altAxis, c1 = ki ? Rr + $[dn] + et[dn] - _i - ct.altAxis : Ji, ye = y && ki ? Fot(Ii, Rr, c1) : rh(y ? Ii : ji, Rr, y ? c1 : Ji);
U[F] = ye, gt[F] = ye - Rr;
}
e.modifiersData[n] = gt;
}
}
var T2t = { name: "preventOverflow", enabled: !0, phase: "main", fn: p2t, requiresIfExists: ["offset"] };
function f2t(t) {
return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
}
function Q2t(t) {
return t === ha(t) || !Hs(t) ? QS(t) : f2t(t);
}
function m2t(t) {
var e = t.getBoundingClientRect(), r = x8(e.width) / t.offsetWidth || 1, n = x8(e.height) / t.offsetHeight || 1;
return r !== 1 || n !== 1;
}
function g2t(t, e, r) {
r === void 0 && (r = !1);
var n = Hs(e), i = Hs(e) && m2t(e), o = d0(e), s = E8(t, i), a = { scrollLeft: 0, scrollTop: 0 }, u = { x: 0, y: 0 };
return (n || !n && !r) && ((d3(e) !== "body" || gS(o)) && (a = Q2t(e)), Hs(e) ? (u = E8(e, !0), u.x += e.clientLeft, u.y += e.clientTop) : o && (u.x = mS(o))), { x: s.left + a.scrollLeft - u.x, y: s.top + a.scrollTop - u.y, width: s.width, height: s.height };
}
function y2t(t) {
var e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), n = [];
t.forEach(function(o) {
e.set(o.name, o);
});
function i(o) {
r.add(o.name);
var s = [].concat(o.requires || [], o.requiresIfExists || []);
s.forEach(function(a) {
if (!r.has(a)) {
var u = e.get(a);
u && i(u);
}
}), n.push(o);
}
return t.forEach(function(o) {
r.has(o.name) || i(o);
}), n;
}
function v2t(t) {
var e = y2t(t);
return Pot.reduce(function(r, n) {
return r.concat(e.filter(function(i) {
return i.phase === n;
}));
}, []);
}
function _2t(t) {
var e;
return function() {
return e || (e = new Promise(function(r) {
Promise.resolve().then(function() {
e = void 0, r(t());
});
})), e;
};
}
function b2t(t) {
var e = t.reduce(function(r, n) {
var i = r[n.name];
return r[n.name] = i ? Object.assign({}, i, n, { options: Object.assign({}, i.options, n.options), data: Object.assign({}, i.data, n.data) }) : n, r;
}, {});
return Object.keys(e).map(function(r) {
return e[r];
});
}
var eI = { placement: "bottom", modifiers: [], strategy: "absolute" };
function rI() {
for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++) e[r] = arguments[r];
return !e.some(function(n) {
return !(n && typeof n.getBoundingClientRect == "function");
});
}
function yS(t) {
t === void 0 && (t = {});
var e = t, r = e.defaultModifiers, n = r === void 0 ? [] : r, i = e.defaultOptions, o = i === void 0 ? eI : i;
return function(s, a, u) {
u === void 0 && (u = o);
var d = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, eI, o), modifiersData: {}, elements: { reference: s, popper: a }, attributes: {}, styles: {} }, T = [], f = !1, Q = { state: d, setOptions: function(L) {
var E = typeof L == "function" ? L(d.options) : L;
_(), d.options = Object.assign({}, o, d.options, E), d.scrollParents = { reference: w8(s) ? nh(s) : s.contextElement ? nh(s.contextElement) : [], popper: nh(a) };
var x = v2t(b2t([].concat(n, d.options.modifiers)));
return d.orderedModifiers = x.filter(function(O) {
return O.enabled;
}), y(), Q.update();
}, forceUpdate: function() {
if (!f) {
var L = d.elements, E = L.reference, x = L.popper;
if (rI(E, x)) {
d.rects = { reference: g2t(E, pd(x), d.options.strategy === "fixed"), popper: TS(x) }, d.reset = !1, d.placement = d.options.placement, d.orderedModifiers.forEach(function(et) {
return d.modifiersData[et.name] = Object.assign({}, et.data);
});
for (var O = 0; O < d.orderedModifiers.length; O++) {
if (d.reset === !0) {
d.reset = !1, O = -1;
continue;
}
var k = d.orderedModifiers[O], R = k.fn, F = k.options, U = F === void 0 ? {} : F, $ = k.name;
typeof R == "function" && (d = R({ state: d, options: U, name: $, instance: Q }) || d);
}
}
}
}, update: _2t(function() {
return new Promise(function(L) {
Q.forceUpdate(), L(d);
});
}), destroy: function() {
_(), f = !0;
} };
if (!rI(s, a)) return Q;
Q.setOptions(u).then(function(L) {
!f && u.onFirstUpdate && u.onFirstUpdate(L);
});
function y() {
d.orderedModifiers.forEach(function(L) {
var E = L.name, x = L.options, O = x === void 0 ? {} : x, k = L.effect;
if (typeof k == "function") {
var R = k({ state: d, name: E, instance: Q, options: O }), F = function() {
};
T.push(R || F);
}
});
}
function _() {
T.forEach(function(L) {
return L();
}), T = [];
}
return Q;
};
}
yS();
var L2t = [Dz, jz, Nz, kz];
yS({ defaultModifiers: L2t });
var w2t = [Dz, jz, Nz, kz, u2t, o2t, T2t, Uot, a2t], x2t = yS({ defaultModifiers: w2t });
const E2t = (t, e, r = {}) => {
const n = {
name: "updateState",
enabled: !0,
phase: "write",
fn: ({ state: u }) => {
const d = M2t(u);
Object.assign(s.value, d);
},
requires: ["computeStyles"]
}, i = Kt(() => {
const { onFirstUpdate: u, placement: d, strategy: T, modifiers: f } = vt(r);
return {
onFirstUpdate: u,
placement: d || "bottom",
strategy: T || "absolute",
modifiers: [
...f || [],
n,
{ name: "applyStyles", enabled: !1 }
]
};
}), o = IQ(), s = Ie({
styles: {
popper: {
position: vt(i).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
}), a = () => {
o.value && (o.value.destroy(), o.value = void 0);
};
return on(i, (u) => {
const d = vt(o);
d && d.setOptions(u);
}, {
deep: !0
}), on([t, e], ([u, d]) => {
a(), !(!u || !d) && (o.value = x2t(u, d, vt(i)));
}), Rs(() => {
a();
}), {
state: Kt(() => {
var u;
return { ...((u = vt(o)) == null ? void 0 : u.state) || {} };
}),
styles: Kt(() => vt(s).styles),
attributes: Kt(() => vt(s).attributes),
update: () => {
var u;
return (u = vt(o)) == null ? void 0 : u.update();
},
forceUpdate: () => {
var u;
return (u = vt(o)) == null ? void 0 : u.forceUpdate();
},
instanceRef: Kt(() => vt(o))
};
};
function M2t(t) {
const e = Object.keys(t.elements), r = dx(e.map((i) => [i, t.styles[i] || {}])), n = dx(e.map((i) => [i, t.attributes[i]]));
return {
styles: r,
attributes: n
};
}
const zz = (t) => {
if (!t)
return { onClick: C5, onMousedown: C5, onMouseup: C5 };
let e = !1, r = !1;
return { onClick: (s) => {
e && r && t(s), e = r = !1;
}, onMousedown: (s) => {
e = s.target === s.currentTarget;
}, onMouseup: (s) => {
r = s.target === s.currentTarget;
} };
};
function nI() {
let t;
const e = (n, i) => {
r(), t = window.setTimeout(n, i);
}, r = () => window.clearTimeout(t);
return ud(() => r()), {
registerTimeout: e,
cancelTimeout: r
};
}
const Qx = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
}, S2t = Symbol("elIdInjection"), Uz = () => G1() ? ln(S2t, Qx) : Qx, U5 = (t) => {
const e = Uz();
!s1 && e === Qx && y2("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
usage: app.provide(ID_INJECTION_KEY, {
prefix: number,
current: number,
})`);
const r = hS();
return Kt(() => vt(t) || `${r.value}-id-${e.prefix}-${e.current++}`);
};
let w7 = [];
const iI = (t) => {
const e = t;
e.key === Nh.esc && w7.forEach((r) => r(e));
}, H2t = (t) => {
W1(() => {
w7.length === 0 && document.addEventListener("keydown", iI), s1 && w7.push(t);
}), Rs(() => {
w7 = w7.filter((e) => e !== t), w7.length === 0 && s1 && document.removeEventListener("keydown", iI);
});
};
let oI;
const Gz = () => {
const t = hS(), e = Uz(), r = Kt(() => `${t.value}-popper-container-${e.prefix}`), n = Kt(() => `#${r.value}`);
return {
id: r,
selector: n
};
}, A2t = (t) => {
const e = document.createElement("div");
return e.id = t, document.body.appendChild(e), e;
}, O2t = () => {
const { id: t, selector: e } = Gz();
return Tet(() => {
s1 && (process.env.NODE_ENV === "test" || !oI || !document.body.querySelector(e.value)) && (oI = A2t(t.value));
}), {
id: t,
selector: e
};
}, C2t = Sn({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
}), k2t = ({
showAfter: t,
hideAfter: e,
autoClose: r,
open: n,
close: i
}) => {
const { registerTimeout: o } = nI(), {
registerTimeout: s,
cancelTimeout: a
} = nI();
return {
onOpen: (T) => {
o(() => {
n(T);
const f = vt(r);
ro(f) && f > 0 && s(() => {
i(T);
}, f);
}, vt(t));
},
onClose: (T) => {
a(), o(() => {
i(T);
}, vt(e));
}
};
}, $z = Symbol("elForwardRef"), I2t = (t) => {
$1($z, {
setForwardRef: (r) => {
t.value = r;
}
});
}, P2t = (t) => ({
mounted(e) {
t(e);
},
updated(e) {
t(e);
},
unmounted() {
t(null);
}
}), sI = {
current: 0
}, aI = Ie(0), Wz = 2e3, lI = Symbol("elZIndexContextKey"), Zz = Symbol("zIndexContextKey"), vS = (t) => {
const e = G1() ? ln(lI, sI) : sI, r = t || (G1() ? ln(Zz, void 0) : void 0), n = Kt(() => {
const s = vt(r);
return ro(s) ? s : Wz;
}), i = Kt(() => n.value + aI.value), o = () => (e.current++, aI.value = e.current, i.value);
return !s1 && !ln(lI) && y2("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), {
initialZIndex: n,
currentZIndex: i,
nextZIndex: o
};
}, J8 = _g({
type: String,
values: Sz,
required: !1
}), qz = Symbol("size"), V2t = () => {
const t = ln(qz, {});
return Kt(() => vt(t.size) || "");
};
function R2t(t, {
beforeFocus: e,
afterFocus: r,
beforeBlur: n,
afterBlur: i
} = {}) {
const o = G1(), { emit: s } = o, a = IQ(), u = Ie(!1), d = (Q) => {
Zo(e) && e(Q) || u.value || (u.value = !0, s("focus", Q), r == null || r());
}, T = (Q) => {
var y;
Zo(n) && n(Q) || Q.relatedTarget && ((y = a.value) != null && y.contains(Q.relatedTarget)) || (u.value = !1, s("blur", Q), i == null || i());
}, f = () => {
var Q, y;
(Q = a.value) != null && Q.contains(document.activeElement) && a.value !== document.activeElement || (y = t.value) == null || y.focus();
};
return on(a, (Q) => {
Q && Q.setAttribute("tabindex", "-1");
}), ea(a, "focus", d, !0), ea(a, "blur", T, !0), ea(a, "click", f, !0), process.env.NODE_ENV === "test" && W1(() => {
const Q = k5(t.value) ? t.value : document.querySelector("input,textarea");
Q && (ea(Q, "focus", d, !0), ea(Q, "blur", T, !0));
}), {
isFocused: u,
wrapperRef: a,
handleFocus: d,
handleBlur: T
};
}
function N2t({
afterComposition: t,
emit: e
}) {
const r = Ie(!1), n = (a) => {
e == null || e("compositionstart", a), r.value = !0;
}, i = (a) => {
var u;
e == null || e("compositionupdate", a);
const d = (u = a.target) == null ? void 0 : u.value, T = d[d.length - 1] || "";
r.value = !pot(T);
}, o = (a) => {
e == null || e("compositionend", a), r.value && (r.value = !1, i1(() => t(a)));
};
return {
isComposing: r,
handleComposition: (a) => {
a.type === "compositionend" ? o(a) : i(a);
},
handleCompositionStart: n,
handleCompositionUpdate: i,
handleCompositionEnd: o
};
}
const Xz = Symbol("emptyValuesContextKey"), D2t = "use-empty-values", F2t = ["", void 0, null], B2t = void 0, j2t = Sn({
emptyValues: Array,
valueOnClear: {
type: [String, Number, Boolean, Function],
default: void 0,
validator: (t) => Zo(t) ? !t() : !t
}
}), z2t = (t, e) => {
const r = G1() ? ln(Xz, Ie({})) : Ie({}), n = Kt(() => t.emptyValues || r.value.emptyValues || F2t), i = Kt(() => Zo(t.valueOnClear) ? t.valueOnClear() : t.valueOnClear !== void 0 ? t.valueOnClear : Zo(r.value.valueOnClear) ? r.value.valueOnClear() : r.value.valueOnClear !== void 0 ? r.value.valueOnClear : B2t), o = (s) => n.value.includes(s);
return n.value.includes(i.value) || y2(D2t, "value-on-clear should be a value of empty-values"), {
emptyValues: n,
valueOnClear: i,
isEmptyValue: o
};
}, U2t = Sn({
ariaLabel: String,
ariaOrientation: {
type: String,
values: ["horizontal", "vertical", "undefined"]
},
ariaControls: String
}), sl = (t) => gz(U2t, t), Kz = Symbol(), FQ = Ie();
function wg(t, e = void 0) {
const r = G1() ? ln(Kz, FQ) : FQ;
return t ? Kt(() => {
var n, i;
return (i = (n = r.value) == null ? void 0 : n[t]) != null ? i : e;
}) : r;
}
function G2t(t, e) {
const r = wg(), n = Bn(t, Kt(() => {
var a;
return ((a = r.value) == null ? void 0 : a.namespace) || eh;
})), i = uS(Kt(() => {
var a;
return (a = r.value) == null ? void 0 : a.locale;
})), o = vS(Kt(() => {
var a;
return ((a = r.value) == null ? void 0 : a.zIndex) || Wz;
})), s = Kt(() => {
var a;
return vt(e) || ((a = r.value) == null ? void 0 : a.size) || "";
});
return $2t(Kt(() => vt(r) || {})), {
ns: n,
locale: i,
zIndex: o,
size: s
};
}
const $2t = (t, e, r = !1) => {
var n;
const i = !!G1(), o = i ? wg() : void 0, s = (n = void 0) != null ? n : i ? $1 : void 0;
if (!s) {
y2("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
return;
}
const a = Kt(() => {
const u = vt(t);
return o != null && o.value ? W2t(o.value, u) : u;
});
return s(Kz, a), s(Hz, Kt(() => a.value.locale)), s(Az, Kt(() => a.value.namespace)), s(Zz, Kt(() => a.value.zIndex)), s(qz, {
size: Kt(() => a.value.size || "")
}), s(Xz, Kt(() => ({
emptyValues: a.value.emptyValues,
valueOnClear: a.value.valueOnClear
}))), (r || !FQ.value) && (FQ.value = a.value), a;
}, W2t = (t, e) => {
const r = [.../* @__PURE__ */ new Set([...$k(t), ...$k(e)])], n = {};
for (const i of r)
n[i] = e[i] !== void 0 ? e[i] : t[i];
return n;
};
var Hn = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, i] of e)
r[n] = i;
return r;
};
const Z2t = Sn({
size: {
type: Gr([Number, String])
},
color: {
type: String
}
}), q2t = mr({
name: "ElIcon",
inheritAttrs: !1
}), X2t = /* @__PURE__ */ mr({
...q2t,
props: Z2t,
setup(t) {
const e = t, r = Bn("icon"), n = Kt(() => {
const { size: i, color: o } = e;
return !i && !o ? {} : {
fontSize: q6(i) ? void 0 : z5(i),
"--color": o
};
});
return (i, o) => (ce(), Ye("i", rl({
class: vt(r).b(),
style: vt(n)
}, i.$attrs), [
Pr(i.$slots, "default")
], 16));
}
});
var K2t = /* @__PURE__ */ Hn(X2t, [["__file", "icon.vue"]]);
const p3 = v2(K2t), _S = Symbol("formContextKey"), BQ = Symbol("formItemContextKey"), S8 = (t, e = {}) => {
const r = Ie(void 0), n = e.prop ? r : Oz("size"), i = e.global ? r : V2t(), o = e.form ? { size: void 0 } : ln(_S, void 0), s = e.formItem ? { size: void 0 } : ln(BQ, void 0);
return Kt(() => n.value || vt(t) || (s == null ? void 0 : s.size) || (o == null ? void 0 : o.size) || i.value || "");
}, xg = (t) => {
const e = Oz("disabled"), r = ln(_S, void 0);
return Kt(() => e.value || vt(t) || (r == null ? void 0 : r.disabled) || !1);
}, tc = () => {
const t = ln(_S, void 0), e = ln(BQ, void 0);
return {
form: t,
formItem: e
};
}, Eg = (t, {
formItemContext: e,
disableIdGeneration: r,
disableIdManagement: n
}) => {
r || (r = Ie(!1)), n || (n = Ie(!1));
const i = Ie();
let o;
const s = Kt(() => {
var a;
return !!(!(t.label || t.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1);
});
return W1(() => {
o = on([K2(t, "id"), r], ([a, u]) => {
const d = a ?? (u ? void 0 : U5().value);
d !== i.value && (e != null && e.removeInputId && (i.value && e.removeInputId(i.value), !(n != null && n.value) && !u && d && e.addInputId(d)), i.value = d);
}, { immediate: !0 });
}), fet(() => {
o && o(), e != null && e.removeInputId && i.value && e.removeInputId(i.value);
}), {
isLabeledByFormItem: s,
inputId: i
};
}, Xl = 4, Y2t = {
vertical: {
offset: "offsetHeight",
scroll: "scrollTop",
scrollSize: "scrollHeight",
size: "height",
key: "vertical",
axis: "Y",
client: "clientY",
direction: "top"
},
horizontal: {
offset: "offsetWidth",
scroll: "scrollLeft",
scrollSize: "scrollWidth",
size: "width",
key: "horizontal",
axis: "X",
client: "clientX",
direction: "left"
}
}, J2t = ({
move: t,
size: e,
bar: r
}) => ({
[r.size]: e,
transform: `translate${r.axis}(${t}%)`
}), bS = Symbol("scrollbarContextKey"), tst = Sn({
vertical: Boolean,
size: String,
move: Number,
ratio: {
type: Number,
required: !0
},
always: Boolean
}), est = "Thumb", rst = /* @__PURE__ */ mr({
__name: "thumb",
props: tst,
setup(t) {
const e = t, r = ln(bS), n = Bn("scrollbar");
r || vz(est, "can not inject scrollbar context");
const i = Ie(), o = Ie(), s = Ie({}), a = Ie(!1);
let u = !1, d = !1, T = s1 ? document.onselectstart : null;
const f = Kt(() => Y2t[e.vertical ? "vertical" : "horizontal"]), Q = Kt(() => J2t({
size: e.size,
move: e.move,
bar: f.value
})), y = Kt(() => i.value[f.value.offset] ** 2 / r.wrapElement[f.value.scrollSize] / e.ratio / o.value[f.value.offset]), _ = (U) => {
var $;
if (U.stopPropagation(), U.ctrlKey || [1, 2].includes(U.button))
return;
($ = window.getSelection()) == null || $.removeAllRanges(), E(U);
const et = U.currentTarget;
et && (s.value[f.value.axis] = et[f.value.offset] - (U[f.value.client] - et.getBoundingClientRect()[f.value.direction]));
}, L = (U) => {
if (!o.value || !i.value || !r.wrapElement)
return;
const $ = Math.abs(U.target.getBoundingClientRect()[f.value.direction] - U[f.value.client]), et = o.value[f.value.offset] / 2, nt = ($ - et) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = nt * r.wrapElement[f.value.scrollSize] / 100;
}, E = (U) => {
U.stopImmediatePropagation(), u = !0, document.addEventListener("mousemove", x), document.addEventListener("mouseup", O), T = document.onselectstart, document.onselectstart = () => !1;
}, x = (U) => {
if (!i.value || !o.value || u === !1)
return;
const $ = s.value[f.value.axis];
if (!$)
return;
const et = (i.value.getBoundingClientRect()[f.value.direction] - U[f.value.client]) * -1, nt = o.value[f.value.offset] - $, ct = (et - nt) * 100 * y.value / i.value[f.value.offset];
r.wrapElement[f.value.scroll] = ct * r.wrapElement[f.value.scrollSize] / 100;
}, O = () => {
u = !1, s.value[f.value.axis] = 0, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", O), F(), d && (a.value = !1);
}, k = () => {
d = !1, a.value = !!e.size;
}, R = () => {
d = !0, a.value = u;
};
Rs(() => {
F(), document.removeEventListener("mouseup", O);
});
const F = () => {
document.onselectstart !== T && (document.onselectstart = T);
};
return ea(K2(r, "scrollbarElement"), "mousemove", k), ea(K2(r, "scrollbarElement"), "mouseleave", R), (U, $) => (ce(), Or(cd, {
name: vt(n).b("fade"),
persisted: ""
}, {
default: fe(() => [
Ti(je("div", {
ref_key: "instance",
ref: i,
class: Be([vt(n).e("bar"), vt(n).is(vt(f).key)]),
onMousedown: L
}, [
je("div", {
ref_key: "thumb",
ref: o,
class: Be(vt(n).e("thumb")),
style: M1(vt(Q)),
onMousedown: _
}, null, 38)
], 34), [
[zo, U.always || a.value]
])
]),
_: 1
}, 8, ["name"]));
}
});
var cI = /* @__PURE__ */ Hn(rst, [["__file", "thumb.vue"]]);
const nst = Sn({
always: {
type: Boolean,
default: !0
},
minSize: {
type: Number,
required: !0
}
}), ist = /* @__PURE__ */ mr({
__name: "bar",
props: nst,
setup(t, { expose: e }) {
const r = t, n = ln(bS), i = Ie(0), o = Ie(0), s = Ie(""), a = Ie(""), u = Ie(1), d = Ie(1);
return e({
handleScroll: (Q) => {
if (Q) {
const y = Q.offsetHeight - Xl, _ = Q.offsetWidth - Xl;
o.value = Q.scrollTop * 100 / y * u.value, i.value = Q.scrollLeft * 100 / _ * d.value;
}
},
update: () => {
const Q = n == null ? void 0 : n.wrapElement;
if (!Q)
return;
const y = Q.offsetHeight - Xl, _ = Q.offsetWidth - Xl, L = y ** 2 / Q.scrollHeight, E = _ ** 2 / Q.scrollWidth, x = Math.max(L, r.minSize), O = Math.max(E, r.minSize);
u.value = L / (y - L) / (x / (y - x)), d.value = E / (_ - E) / (O / (_ - O)), a.value = x + Xl < y ? `${x}px` : "", s.value = O + Xl < _ ? `${O}px` : "";
}
}), (Q, y) => (ce(), Ye(to, null, [
Ce(cI, {
move: i.value,
ratio: d.value,
size: s.value,
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"]),
Ce(cI, {
move: o.value,
ratio: u.value,
size: a.value,
vertical: "",
always: Q.always
}, null, 8, ["move", "ratio", "size", "always"])
], 64));
}
});
var ost = /* @__PURE__ */ Hn(ist, [["__file", "bar.vue"]]);
const sst = Sn({
height: {
type: [String, Number],
default: ""
},
maxHeight: {
type: [String, Number],
default: ""
},
native: {
type: Boolean,
default: !1
},
wrapStyle: {
type: Gr([String, Object, Array]),
default: ""
},
wrapClass: {
type: [String, Array],
default: ""
},
viewClass: {
type: [String, Array],
default: ""
},
viewStyle: {
type: [String, Array, Object],
default: ""
},
noresize: Boolean,
tag: {
type: String,
default: "div"
},
always: Boolean,
minSize: {
type: Number,
default: 20
},
tabindex: {
type: [String, Number],
default: void 0
},
id: String,
role: String,
...sl(["ariaLabel", "ariaOrientation"])
}), ast = {
scroll: ({
scrollTop: t,
scrollLeft: e
}) => [t, e].every(ro)
}, mx = "ElScrollbar", lst = mr({
name: mx
}), cst = /* @__PURE__ */ mr({
...lst,
props: sst,
emits: ast,
setup(t, { expose: e, emit: r }) {
const n = t, i = Bn("scrollbar");
let o, s, a = 0, u = 0;
const d = Ie(), T = Ie(), f = Ie(), Q = Ie(), y = Kt(() => {
const F = {};
return n.height && (F.height = z5(n.height)), n.maxHeight && (F.maxHeight = z5(n.maxHeight)), [n.wrapStyle, F];
}), _ = Kt(() => [
n.wrapClass,
i.e("wrap"),
{ [i.em("wrap", "hidden-default")]: !n.native }
]), L = Kt(() => [i.e("view"), n.viewClass]), E = () => {
var F;
T.value && ((F = Q.value) == null || F.handleScroll(T.value), a = T.value.scrollTop, u = T.value.scrollLeft, r("scroll", {
scrollTop: T.value.scrollTop,
scrollLeft: T.value.scrollLeft
}));
};
function x(F, U) {
T2(F) ? T.value.scrollTo(F) : ro(F) && ro(U) && T.value.scrollTo(F, U);
}
const O = (F) => {
if (!ro(F)) {
y2(mx, "value must be a number");
return;
}
T.value.scrollTop = F;
}, k = (F) => {
if (!ro(F)) {
y2(mx, "value must be a number");
return;
}
T.value.scrollLeft = F;
}, R = () => {
var F;
(F = Q.value) == null || F.update();
};
return on(() => n.noresize, (F) => {
F ? (o == null || o(), s == null || s()) : ({ stop: o } = B6(f, R), s = ea("resize", R));
}, { immediate: !0 }), on(() => [n.maxHeight, n.height], () => {
n.native || i1(() => {
var F;
R(), T.value && ((F = Q.value) == null || F.handleScroll(T.value));
});
}), $1(bS, u3({
scrollbarElement: d,
wrapElement: T
})), Qet(() => {
T.value && (T.value.scrollTop = a, T.value.scrollLeft = u);
}), W1(() => {
n.native || i1(() => {
R();
});
}), met(() => R()), e({
wrapRef: T,
update: R,
scrollTo: x,
setScrollTop: O,
setScrollLeft: k,
handleScroll: E
}), (F, U) => (ce(), Ye("div", {
ref_key: "scrollbarRef",
ref: d,
class: Be(vt(i).b())
}, [
je("div", {
ref_key: "wrapRef",
ref: T,
class: Be(vt(_)),
style: M1(vt(y)),
tabindex: F.tabindex,
onScroll: E
}, [
(ce(), Or(Ss(F.tag), {
id: F.id,
ref_key: "resizeRef",
ref: f,
class: Be(vt(L)),
style: M1(F.viewStyle),
role: F.role,
"aria-label": F.ariaLabel,
"aria-orientation": F.ariaOrientation
}, {
default: fe(() => [
Pr(F.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
], 46, ["tabindex"]),
F.native ? Fr("v-if", !0) : (ce(), Or(ost, {
key: 0,
ref_key: "barRef",
ref: Q,
always: F.always,
"min-size": F.minSize
}, null, 8, ["always", "min-size"]))
], 2));
}
});
var ust = /* @__PURE__ */ Hn(cst, [["__file", "scrollbar.vue"]]);
const hst = v2(ust), LS = Symbol("popper"), Yz = Symbol("popperContent"), dst = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
], Jz = Sn({
role: {
type: String,
values: dst,
default: "tooltip"
}
}), pst = mr({
name: "ElPopper",
inheritAttrs: !1
}), Tst = /* @__PURE__ */ mr({
...pst,
props: Jz,
setup(t, { expose: e }) {
const r = t, n = Ie(), i = Ie(), o = Ie(), s = Ie(), a = Kt(() => r.role), u = {
triggerRef: n,
popperInstanceRef: i,
contentRef: o,
referenceRef: s,
role: a
};
return e(u), $1(LS, u), (d, T) => Pr(d.$slots, "default");
}
});
var fst = /* @__PURE__ */ Hn(Tst, [["__file", "popper.vue"]]);
const tU = Sn({
arrowOffset: {
type: Number,
default: 5
}
}), Qst = mr({
name: "ElPopperArrow",
inheritAttrs: !1
}), mst = /* @__PURE__ */ mr({
...Qst,
props: tU,
setup(t, { expose: e }) {
const r = t, n = Bn("popper"), { arrowOffset: i, arrowRef: o, arrowStyle: s } = ln(Yz, void 0);
return on(() => r.arrowOffset, (a) => {
i.value = a;
}), Rs(() => {
o.value = void 0;
}), e({
arrowRef: o
}), (a, u) => (ce(), Ye("span", {
ref_key: "arrowRef",
ref: o,
class: Be(vt(n).e("arrow")),
style: M1(vt(s)),
"data-popper-arrow": ""
}, null, 6));
}
});
var gst = /* @__PURE__ */ Hn(mst, [["__file", "arrow.vue"]]);
const Qb = "ElOnlyChild", yst = mr({
name: Qb,
setup(t, {
slots: e,
attrs: r
}) {
var n;
const i = ln($z), o = P2t((n = i == null ? void 0 : i.setForwardRef) != null ? n : C5);
return () => {
var s;
const a = (s = e.default) == null ? void 0 : s.call(e, r);
if (!a)
return null;
if (a.length > 1)
return y2(Qb, "requires exact only one valid child."), null;
const u = eU(a);
return u ? Ti(get(u, r), [[o]]) : (y2(Qb, "no valid child node found"), null);
};
}
});
function eU(t) {
if (!t)
return null;
const e = t;
for (const r of e) {
if (T2(r))
switch (r.type) {
case yet:
continue;
case Xj:
case "svg":
return uI(r);
case to:
return eU(r.children);
default:
return r;
}
return uI(r);
}
return null;
}
function uI(t) {
const e = Bn("only-child");
return Ce("span", {
class: e.e("content")
}, [t]);
}
const rU = Sn({
virtualRef: {
type: Gr(Object)
},
virtualTriggering: Boolean,
onMouseenter: {
type: Gr(Function)
},
onMouseleave: {
type: Gr(Function)
},
onClick: {
type: Gr(Function)
},
onKeydown: {
type: Gr(Function)
},
onFocus: {
type: Gr(Function)
},
onBlur: {
type: Gr(Function)
},
onContextmenu: {
type: Gr(Function)
},
id: String,
open: Boolean
}), vst = mr({
name: "ElPopperTrigger",
inheritAttrs: !1
}), _st = /* @__PURE__ */ mr({
...vst,
props: rU,
setup(t, { expose: e }) {
const r = t, { role: n, triggerRef: i } = ln(LS, void 0);
I2t(i);
const o = Kt(() => a.value ? r.id : void 0), s = Kt(() => {
if (n && n.value === "tooltip")
return r.open && r.id ? r.id : void 0;
}), a = Kt(() => {
if (n && n.value !== "tooltip")
return n.value;
}), u = Kt(() => a.value ? `${r.open}` : void 0);
let d;
const T = [
"onMouseenter",
"onMouseleave",
"onClick",
"onKeydown",
"onFocus",
"onBlur",
"onContextmenu"
];
return W1(() => {
on(() => r.virtualRef, (f) => {
f && (i.value = f4(f));
}, {
immediate: !0
}), on(i, (f, Q) => {
d == null || d(), d = void 0, k5(f) && (T.forEach((y) => {
var _;
const L = r[y];
L && (f.addEventListener(y.slice(2).toLowerCase(), L), (_ = Q == null ? void 0 : Q.removeEventListener) == null || _.call(Q, y.slice(2).toLowerCase(), L));
}), d = on([o, s, a, u], (y) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((_, L) => {
vg(y[L]) ? f.removeAttribute(_) : f.setAttribute(_, y[L]);
});
}, { immediate: !0 })), k5(Q) && [
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((y) => Q.removeAttribute(y));
}, {
immediate: !0
});
}), Rs(() => {
if (d == null || d(), d = void 0, i.value && k5(i.value)) {
const f = i.value;
T.forEach((Q) => {
const y = r[Q];
y && f.removeEventListener(Q.slice(2).toLowerCase(), y);
}), i.value = void 0;
}
}), e({
triggerRef: i
}), (f, Q) => f.virtualTriggering ? Fr("v-if", !0) : (ce(), Or(vt(yst), rl({ key: 0 }, f.$attrs, {
"aria-controls": vt(o),
"aria-describedby": vt(s),
"aria-expanded": vt(u),
"aria-haspopup": vt(a)
}), {
default: fe(() => [
Pr(f.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
}
});
var bst = /* @__PURE__ */ Hn(_st, [["__file", "trigger.vue"]]);
const mb = "focus-trap.focus-after-trapped", gb = "focus-trap.focus-after-released", Lst = "focus-trap.focusout-prevented", hI = {
cancelable: !0,
bubbles: !1
}, wst = {
cancelable: !0,
bubbles: !1
}, dI = "focusAfterTrapped", pI = "focusAfterReleased", nU = Symbol("elFocusTrap"), wS = Ie(), Mg = Ie(0), xS = Ie(0);
let qp = 0;
const iU = (t) => {
const e = [], r = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
acceptNode: (n) => {
const i = n.tagName === "INPUT" && n.type === "hidden";
return n.disabled || n.hidden || i ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 || n === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
for (; r.nextNode(); )
e.push(r.currentNode);
return e;
}, TI = (t, e) => {
for (const r of t)
if (!xst(r, e))
return r;
}, xst = (t, e) => {
if (process.env.NODE_ENV === "test")
return !1;
if (getComputedStyle(t).visibility === "hidden")
return !0;
for (; t; ) {
if (e && t === e)
return !1;
if (getComputedStyle(t).display === "none")
return !0;
t = t.parentElement;
}
return !1;
}, Est = (t) => {
const e = iU(t), r = TI(e, t), n = TI(e.reverse(), t);
return [r, n];
}, Mst = (t) => t instanceof HTMLInputElement && "select" in t, H6 = (t, e) => {
if (t && t.focus) {
const r = document.activeElement;
t.focus({ preventScroll: !0 }), xS.value = window.performance.now(), t !== r && Mst(t) && e && t.select();
}
};
function fI(t, e) {
const r = [...t], n = t.indexOf(e);
return n !== -1 && r.splice(n, 1), r;
}
const Sst = () => {
let t = [];
return {
push: (n) => {
const i = t[0];
i && n !== i && i.pause(), t = fI(t, n), t.unshift(n);
},
remove: (n) => {
var i, o;
t = fI(t, n), (o = (i = t[0]) == null ? void 0 : i.resume) == null || o.call(i);
}
};
}, Hst = (t, e = !1) => {
const r = document.activeElement;
for (const n of t)
if (H6(n, e), document.activeElement !== r)
return;
}, QI = Sst(), Ast = () => Mg.value > xS.value, Xp = () => {
wS.value = "pointer", Mg.value = window.performance.now();
}, mI = () => {
wS.value = "keyboard", Mg.value = window.performance.now();
}, Ost = () => (W1(() => {
qp === 0 && (document.addEventListener("mousedown", Xp), document.addEventListener("touchstart", Xp), document.addEventListener("keydown", mI)), qp++;
}), Rs(() => {
qp--, qp <= 0 && (document.removeEventListener("mousedown", Xp), document.removeEventListener("touchstart", Xp), document.removeEventListener("keydown", mI));
}), {
focusReason: wS,
lastUserFocusTimestamp: Mg,
lastAutomatedFocusTimestamp: xS
}), Kp = (t) => new CustomEvent(Lst, {
...wst,
detail: t
}), Cst = mr({
name: "ElFocusTrap",
inheritAttrs: !1,
props: {
loop: Boolean,
trapped: Boolean,
focusTrapEl: Object,
focusStartEl: {
type: [Object, String],
default: "first"
}
},
emits: [
dI,
pI,
"focusin",
"focusout",
"focusout-prevented",
"release-requested"
],
setup(t, { emit: e }) {
const r = Ie();
let n, i;
const { focusReason: o } = Ost();
H2t((_) => {
t.trapped && !s.paused && e("release-requested", _);
});
const s = {
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}, a = (_) => {
if (!t.loop && !t.trapped || s.paused)
return;
const { key: L, altKey: E, ctrlKey: x, metaKey: O, currentTarget: k, shiftKey: R } = _, { loop: F } = t, U = L === Nh.tab && !E && !x && !O, $ = document.activeElement;
if (U && $) {
const et = k, [nt, ct] = Est(et);
if (nt && ct) {
if (!R && $ === ct) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && H6(nt, !0));
} else if (R && [nt, et].includes($)) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || (_.preventDefault(), F && H6(ct, !0));
}
} else if ($ === et) {
const gt = Kp({
focusReason: o.value
});
e("focusout-prevented", gt), gt.defaultPrevented || _.preventDefault();
}
}
};
$1(nU, {
focusTrapRef: r,
onKeydown: a
}), on(() => t.focusTrapEl, (_) => {
_ && (r.value = _);
}, { immediate: !0 }), on([r], ([_], [L]) => {
_ && (_.addEventListener("keydown", a), _.addEventListener("focusin", T), _.addEventListener("focusout", f)), L && (L.removeEventListener("keydown", a), L.removeEventListener("focusin", T), L.removeEventListener("focusout", f));
});
const u = (_) => {
e(dI, _);
}, d = (_) => e(pI, _), T = (_) => {
const L = vt(r);
if (!L)
return;
const E = _.target, x = _.relatedTarget, O = E && L.contains(E);
t.trapped || x && L.contains(x) || (n = x), O && e("focusin", _), !s.paused && t.trapped && (O ? i = E : H6(i, !0));
}, f = (_) => {
const L = vt(r);
if (!(s.paused || !L))
if (t.trapped) {
const E = _.relatedTarget;
!vg(E) && !L.contains(E) && setTimeout(() => {
if (!s.paused && t.trapped) {
const x = Kp({
focusReason: o.value
});
e("focusout-prevented", x), x.defaultPrevented || H6(i, !0);
}
}, 0);
} else {
const E = _.target;
E && L.contains(E) || e("focusout", _);
}
};
async function Q() {
await i1();
const _ = vt(r);
if (_) {
QI.push(s);
const L = _.contains(document.activeElement) ? n : document.activeElement;
if (n = L, !_.contains(L)) {
const x = new Event(mb, hI);
_.addEventListener(mb, u), _.dispatchEvent(x), x.defaultPrevented || i1(() => {
let O = t.focusStartEl;
sa(O) || (H6(O), document.activeElement !== O && (O = "first")), O === "first" && Hst(iU(_), !0), (document.activeElement === L || O === "container") && H6(_);
});
}
}
}
function y() {
const _ = vt(r);
if (_) {
_.removeEventListener(mb, u);
const L = new CustomEvent(gb, {
...hI,
detail: {
focusReason: o.value
}
});
_.addEventListener(gb, d), _.dispatchEvent(L), !L.defaultPrevented && (o.value == "keyboard" || !Ast() || _.contains(document.activeElement)) && H6(n ?? document.body), _.removeEventListener(gb, d), QI.remove(s);
}
}
return W1(() => {
t.trapped && Q(), on(() => t.trapped, (_) => {
_ ? Q() : y();
});
}), Rs(() => {
t.trapped && y(), r.value && (r.value.removeEventListener("keydown", a), r.value.removeEventListener("focusin", T), r.value.removeEventListener("focusout", f), r.value = void 0);
}), {
onKeydown: a
};
}
});
function kst(t, e, r, n, i, o) {
return Pr(t.$slots, "default", { handleKeydown: t.onKeydown });
}
var oU = /* @__PURE__ */ Hn(Cst, [["render", kst], ["__file", "focus-trap.vue"]]);
const Ist = ["fixed", "absolute"], Pst = Sn({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: Gr(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: !0
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: bg,
default: "bottom"
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
strategy: {
type: String,
values: Ist,
default: "absolute"
}
}), sU = Sn({
...Pst,
id: String,
style: {
type: Gr([String, Array, Object])
},
className: {
type: Gr([String, Array, Object])
},
effect: {
type: Gr(String),
default: "dark"
},
visible: Boolean,
enterable: {
type: Boolean,
default: !0
},
pure: Boolean,
focusOnShow: {
type: Boolean,
default: !1
},
trapping: {
type: Boolean,
default: !1
},
popperClass: {
type: Gr([String, Array, Object])
},
popperStyle: {
type: Gr([String, Array, Object])
},
referenceEl: {
type: Gr(Object)
},
triggerTargetEl: {
type: Gr(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: !0
},
virtualTriggering: Boolean,
zIndex: Number,
...sl(["ariaLabel"])
}), Vst = {
mouseenter: (t) => t instanceof MouseEvent,
mouseleave: (t) => t instanceof MouseEvent,
focus: () => !0,
blur: () => !0,
close: () => !0
}, Rst = (t, e = []) => {
const { placement: r, strategy: n, popperOptions: i } = t, o = {
placement: r,
strategy: n,
...i,
modifiers: [...Dst(t), ...e]
};
return Fst(o, i == null ? void 0 : i.modifiers), o;
}, Nst = (t) => {
if (s1)
return f4(t);
};
function Dst(t) {
const { offset: e, gpuAcceleration: r, fallbackPlacements: n } = t;
return [
{
name: "offset",
options: {
offset: [0, e ?? 12]
}
},
{
name: "preventOverflow",
options: {
padding: {
top: 2,
bottom: 2,
left: 5,
right: 5
}
}
},
{
name: "flip",
options: {
padding: 5,
fallbackPlacements: n
}
},
{
name: "computeStyles",
options: {
gpuAcceleration: r
}
}
];
}
function Fst(t, e) {
e && (t.modifiers = [...t.modifiers, ...e ?? []]);
}
const Bst = 0, jst = (t) => {
const { popperInstanceRef: e, contentRef: r, triggerRef: n, role: i } = ln(LS, void 0), o = Ie(), s = Ie(), a = Kt(() => ({
name: "eventListeners",
enabled: !!t.visible
})), u = Kt(() => {
var x;
const O = vt(o), k = (x = vt(s)) != null ? x : Bst;
return {
name: "arrow",
enabled: !mz(O),
options: {
element: O,
padding: k
}
};
}), d = Kt(() => ({
onFirstUpdate: () => {
_();
},
...Rst(t, [
vt(u),
vt(a)
])
})), T = Kt(() => Nst(t.referenceEl) || vt(n)), { attributes: f, state: Q, styles: y, update: _, forceUpdate: L, instanceRef: E } = E2t(T, r, d);
return on(E, (x) => e.value = x), W1(() => {
on(() => {
var x;
return (x = vt(T)) == null ? void 0 : x.getBoundingClientRect();
}, () => {
_();
});
}), {
attributes: f,
arrowRef: o,
contentRef: r,
instanceRef: E,
state: Q,
styles: y,
role: i,
forceUpdate: L,
update: _
};
}, zst = (t, {
attributes: e,
styles: r,
role: n
}) => {
const { nextZIndex: i } = vS(), o = Bn("popper"), s = Kt(() => vt(e).popper), a = Ie(ro(t.zIndex) ? t.zIndex : i()), u = Kt(() => [
o.b(),
o.is("pure", t.pure),
o.is(t.effect),
t.popperClass
]), d = Kt(() => [
{ zIndex: vt(a) },
vt(r).popper,
t.popperStyle || {}
]), T = Kt(() => n.value === "dialog" ? "false" : void 0), f = Kt(() => vt(r).arrow || {});
return {
ariaModal: T,
arrowStyle: f,
contentAttrs: s,
contentClass: u,
contentStyle: d,
contentZIndex: a,
updateZIndex: () => {
a.value = ro(t.zIndex) ? t.zIndex : i();
}
};
}, Ust = (t, e) => {
const r = Ie(!1), n = Ie();
return {
focusStartRef: n,
trapped: r,
onFocusAfterReleased: (d) => {
var T;
((T = d.detail) == null ? void 0 : T.focusReason) !== "pointer" && (n.value = "first", e("blur"));
},
onFocusAfterTrapped: () => {
e("focus");
},
onFocusInTrap: (d) => {
t.visible && !r.value && (d.target && (n.value = d.target), r.value = !0);
},
onFocusoutPrevented: (d) => {
t.trapping || (d.detail.focusReason === "pointer" && d.preventDefault(), r.value = !1);
},
onReleaseRequested: () => {
r.value = !1, e("close");
}
};
}, Gst = mr({
name: "ElPopperContent"
}), $st = /* @__PURE__ */ mr({
...Gst,
props: sU,
emits: Vst,
setup(t, { expose: e, emit: r }) {
const n = t, {
focusStartRef: i,
trapped: o,
onFocusAfterReleased: s,
onFocusAfterTrapped: a,
onFocusInTrap: u,
onFocusoutPrevented: d,
onReleaseRequested: T
} = Ust(n, r), { attributes: f, arrowRef: Q, contentRef: y, styles: _, instanceRef: L, role: E, update: x } = jst(n), {
ariaModal: O,
arrowStyle: k,
contentAttrs: R,
contentClass: F,
contentStyle: U,
updateZIndex: $
} = zst(n, {
styles: _,
attributes: f,
role: E
}), et = ln(BQ, void 0), nt = Ie();
$1(Yz, {
arrowStyle: k,
arrowRef: Q,
arrowOffset: nt
}), et && $1(BQ, {
...et,
addInputId: C5,
removeInputId: C5
});
let ct;
const rt = (It = !0) => {
x(), It && $();
}, gt = () => {
rt(!1), n.visible && n.focusOnShow ? o.value = !0 : n.visible === !1 && (o.value = !1);
};
return W1(() => {
on(() => n.triggerTargetEl, (It, Zt) => {
ct == null || ct(), ct = void 0;
const oe = vt(It || y.value), re = vt(Zt || y.value);
k5(oe) && (ct = on([E, () => n.ariaLabel, O, () => n.id], (Ve) => {
["role", "aria-label", "aria-modal", "id"].forEach((yr, qr) => {
vg(Ve[qr]) ? oe.removeAttribute(yr) : oe.setAttribute(yr, Ve[qr]);
});
}, { immediate: !0 })), re !== oe && k5(re) && ["role", "aria-label", "aria-modal", "id"].forEach((Ve) => {
re.removeAttribute(Ve);
});
}, { immediate: !0 }), on(() => n.visible, gt, { immediate: !0 });
}), Rs(() => {
ct == null || ct(), ct = void 0;
}), e({
popperContentRef: y,
popperInstanceRef: L,
updatePopper: rt,
contentStyle: U
}), (It, Zt) => (ce(), Ye("div", rl({
ref_key: "contentRef",
ref: y
}, vt(R), {
style: vt(U),
class: vt(F),
tabindex: "-1",
onMouseenter: (oe) => It.$emit("mouseenter", oe),
onMouseleave: (oe) => It.$emit("mouseleave", oe)
}), [
Ce(vt(oU), {
trapped: vt(o),
"trap-on-focus-in": !0,
"focus-trap-el": vt(y),
"focus-start-el": vt(i),
onFocusAfterTrapped: vt(a),
onFocusAfterReleased: vt(s),
onFocusin: vt(u),
onFocusoutPrevented: vt(d),
onReleaseRequested: vt(T)
}, {
default: fe(() => [
Pr(It.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16, ["onMouseenter", "onMouseleave"]));
}
});
var Wst = /* @__PURE__ */ Hn($st, [["__file", "content.vue"]]);
const Zst = v2(fst), ES = Symbol("elTooltip"), Z2 = Sn({
...C2t,
...sU,
appendTo: {
type: Gr([String, Object])
},
content: {
type: String,
default: ""
},
rawContent: Boolean,
persistent: Boolean,
visible: {
type: Gr(Boolean),
default: null
},
transition: String,
teleported: {
type: Boolean,
default: !0
},
disabled: Boolean,
...sl(["ariaLabel"])
}), Bh = Sn({
...rU,
disabled: Boolean,
trigger: {
type: Gr([String, Array]),
default: "hover"
},
triggerKeys: {
type: Gr(Array),
default: () => [Nh.enter, Nh.space]
}
}), {
useModelToggleProps: qst,
useModelToggleEmits: Xst,
useModelToggle: Kst
} = Lot("visible"), Yst = Sn({
...Jz,
...qst,
...Z2,
...Bh,
...tU,
showArrow: {
type: Boolean,
default: !0
}
}), Jst = [
...Xst,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
], tat = (t, e) => p2(t) ? t.includes(e) : t === e, Kl = (t, e, r) => (n) => {
tat(vt(t), e) && r(n);
}, eat = mr({
name: "ElTooltipTrigger"
}), rat = /* @__PURE__ */ mr({
...eat,
props: Bh,
setup(t, { expose: e }) {
const r = t, n = Bn("tooltip"), { controlled: i, id: o, open: s, onOpen: a, onClose: u, onToggle: d } = ln(ES, void 0), T = Ie(null), f = () => {
if (vt(i) || r.disabled)
return !0;
}, Q = K2(r, "trigger"), y = s4(f, Kl(Q, "hover", a)), _ = s4(f, Kl(Q, "hover", u)), L = s4(f, Kl(Q, "click", (R) => {
R.button === 0 && d(R);
})), E = s4(f, Kl(Q, "focus", a)), x = s4(f, Kl(Q, "focus", u)), O = s4(f, Kl(Q, "contextmenu", (R) => {
R.preventDefault(), d(R);
})), k = s4(f, (R) => {
const { code: F } = R;
r.triggerKeys.includes(F) && (R.preventDefault(), d(R));
});
return e({
triggerRef: T
}), (R, F) => (ce(), Or(vt(bst), {
id: vt(o),
"virtual-ref": R.virtualRef,
open: vt(s),
"virtual-triggering": R.virtualTriggering,
class: Be(vt(n).e("trigger")),
onBlur: vt(x),
onClick: vt(L),
onContextmenu: vt(O),
onFocus: vt(E),
onMouseenter: vt(y),
onMouseleave: vt(_),
onKeydown: vt(k)
}, {
default: fe(() => [
Pr(R.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
}
});
var nat = /* @__PURE__ */ Hn(rat, [["__file", "trigger.vue"]]);
const iat = Sn({
to: {
type: Gr([String, Object]),
required: !0
},
disabled: Boolean
}), oat = /* @__PURE__ */ mr({
__name: "teleport",
props: iat,
setup(t) {
return (e, r) => e.disabled ? Pr(e.$slots, "default", { key: 0 }) : (ce(), Or(vet, {
key: 1,
to: e.to
}, [
Pr(e.$slots, "default")
], 8, ["to"]));
}
});
var sat = /* @__PURE__ */ Hn(oat, [["__file", "teleport.vue"]]);
const aU = v2(sat), aat = mr({
name: "ElTooltipContent",
inheritAttrs: !1
}), lat = /* @__PURE__ */ mr({
...aat,
props: Z2,
setup(t, { expose: e }) {
const r = t, { selector: n } = Gz(), i = Bn("tooltip"), o = Ie(null);
let s;
const {
controlled: a,
id: u,
open: d,
trigger: T,
onClose: f,
onOpen: Q,
onShow: y,
onHide: _,
onBeforeShow: L,
onBeforeHide: E
} = ln(ES, void 0), x = Kt(() => r.transition || `${i.namespace.value}-fade-in-linear`), O = Kt(() => process.env.NODE_ENV === "test" ? !0 : r.persistent);
Rs(() => {
s == null || s();
});
const k = Kt(() => vt(O) ? !0 : vt(d)), R = Kt(() => r.disabled ? !1 : vt(d)), F = Kt(() => r.appendTo || n.value), U = Kt(() => {
var re;
return (re = r.style) != null ? re : {};
}), $ = Ie(!0), et = () => {
_(), $.value = !0;
}, nt = () => {
if (vt(a))
return !0;
}, ct = s4(nt, () => {
r.enterable && vt(T) === "hover" && Q();
}), rt = s4(nt, () => {
vt(T) === "hover" && f();
}), gt = () => {
var re, Ve;
(Ve = (re = o.value) == null ? void 0 : re.updatePopper) == null || Ve.call(re), L == null || L();
}, It = () => {
E == null || E();
}, Zt = () => {
y(), s = Net(Kt(() => {
var re;
return (re = o.value) == null ? void 0 : re.popperContentRef;
}), () => {
if (vt(a))
return;
vt(T) !== "hover" && f();
});
}, oe = () => {
r.virtualTriggering || f();
};
return on(() => vt(d), (re) => {
re ? $.value = !1 : s == null || s();
}, {
flush: "post"
}), on(() => r.content, () => {
var re, Ve;
(Ve = (re = o.value) == null ? void 0 : re.updatePopper) == null || Ve.call(re);
}), e({
contentRef: o
}), (re, Ve) => (ce(), Or(vt(aU), {
disabled: !re.teleported,
to: vt(F)
}, {
default: fe(() => [
Ce(cd, {
name: vt(x),
onAfterLeave: et,
onBeforeEnter: gt,
onAfterEnter: Zt,
onBeforeLeave: It
}, {
default: fe(() => [
vt(k) ? Ti((ce(), Or(vt(Wst), rl({
key: 0,
id: vt(u),
ref_key: "contentRef",
ref: o
}, re.$attrs, {
"aria-label": re.ariaLabel,
"aria-hidden": $.value,
"boundaries-padding": re.boundariesPadding,
"fallback-placements": re.fallbackPlacements,
"gpu-acceleration": re.gpuAcceleration,
offset: re.offset,
placement: re.placement,
"popper-options": re.popperOptions,
strategy: re.strategy,
effect: re.effect,
enterable: re.enterable,
pure: re.pure,
"popper-class": re.popperClass,
"popper-style": [re.popperStyle, vt(U)],
"reference-el": re.referenceEl,
"trigger-target-el": re.triggerTargetEl,
visible: vt(R),
"z-index": re.zIndex,
onMouseenter: vt(ct),
onMouseleave: vt(rt),
onBlur: oe,
onClose: vt(f)
}), {
default: fe(() => [
Pr(re.$slots, "default")
]),
_: 3
}, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
[zo, vt(R)]
]) : Fr("v-if", !0)
]),
_: 3
}, 8, ["name"])
]),
_: 3
}, 8, ["disabled", "to"]));
}
});
var cat = /* @__PURE__ */ Hn(lat, [["__file", "content.vue"]]);
const uat = mr({
name: "ElTooltip"
}), hat = /* @__PURE__ */ mr({
...uat,
props: Yst,
emits: Jst,
setup(t, { expose: e, emit: r }) {
const n = t;
O2t();
const i = U5(), o = Ie(), s = Ie(), a = () => {
var x;
const O = vt(o);
O && ((x = O.popperInstanceRef) == null || x.update());
}, u = Ie(!1), d = Ie(), { show: T, hide: f, hasUpdateHandler: Q } = Kst({
indicator: u,
toggleReason: d
}), { onOpen: y, onClose: _ } = k2t({
showAfter: K2(n, "showAfter"),
hideAfter: K2(n, "hideAfter"),
autoClose: K2(n, "autoClose"),
open: T,
close: f
}), L = Kt(() => S4(n.visible) && !Q.value);
$1(ES, {
controlled: L,
id: i,
open: Zj(u),
trigger: K2(n, "trigger"),
onOpen: (x) => {
y(x);
},
onClose: (x) => {
_(x);
},
onToggle: (x) => {
vt(u) ? _(x) : y(x);
},
onShow: () => {
r("show", d.value);
},
onHide: () => {
r("hide", d.value);
},
onBeforeShow: () => {
r("before-show", d.value);
},
onBeforeHide: () => {
r("before-hide", d.value);
},
updatePopper: a
}), on(() => n.disabled, (x) => {
x && u.value && (u.value = !1);
});
const E = (x) => {
var O, k;
const R = (k = (O = s.value) == null ? void 0 : O.contentRef) == null ? void 0 : k.popperContentRef, F = (x == null ? void 0 : x.relatedTarget) || document.activeElement;
return R && R.contains(F);
};
return _et(() => u.value && f()), e({
popperRef: o,
contentRef: s,
isFocusInsideContent: E,
updatePopper: a,
onOpen: y,
onClose: _,
hide: f
}), (x, O) => (ce(), Or(vt(Zst), {
ref_key: "popperRef",
ref: o,
role: x.role
}, {
default: fe(() => [
Ce(nat, {
disabled: x.disabled,
trigger: x.trigger,
"trigger-keys": x.triggerKeys,
"virtual-ref": x.virtualRef,
"virtual-triggering": x.virtualTriggering
}, {
default: fe(() => [
x.$slots.default ? Pr(x.$slots, "default", { key: 0 }) : Fr("v-if", !0)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
Ce(cat, {
ref_key: "contentRef",
ref: s,
"aria-label": x.ariaLabel,
"boundaries-padding": x.boundariesPadding,
content: x.content,
disabled: x.disabled,
effect: x.effect,
enterable: x.enterable,
"fallback-placements": x.fallbackPlacements,
"hide-after": x.hideAfter,
"gpu-acceleration": x.gpuAcceleration,
offset: x.offset,
persistent: x.persistent,
"popper-class": x.popperClass,
"popper-style": x.popperStyle,
placement: x.placement,
"popper-options": x.popperOptions,
pure: x.pure,
"raw-content": x.rawContent,
"reference-el": x.referenceEl,
"trigger-target-el": x.triggerTargetEl,
"show-after": x.showAfter,
strategy: x.strategy,
teleported: x.teleported,
transition: x.transition,
"virtual-triggering": x.virtualTriggering,
"z-index": x.zIndex,
"append-to": x.appendTo
}, {
default: fe(() => [
Pr(x.$slots, "content", {}, () => [
x.rawContent ? (ce(), Ye("span", {
key: 0,
innerHTML: x.content
}, null, 8, ["innerHTML"])) : (ce(), Ye("span", { key: 1 }, fi(x.content), 1))
]),
x.showArrow ? (ce(), Or(vt(gst), {
key: 0,
"arrow-offset": x.arrowOffset
}, null, 8, ["arrow-offset"])) : Fr("v-if", !0)
]),
_: 3
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
]),
_: 3
}, 8, ["role"]));
}
});
var dat = /* @__PURE__ */ Hn(hat, [["__file", "tooltip.vue"]]);
const lU = v2(dat), cU = Symbol("buttonGroupContextKey"), pat = (t, e) => {
h8({
from: "type.text",
replacement: "link",
version: "3.0.0",
scope: "props",
ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
}, Kt(() => t.type === "text"));
const r = ln(cU, void 0), n = wg("button"), { form: i } = tc(), o = S8(Kt(() => r == null ? void 0 : r.size)), s = xg(), a = Ie(), u = pg(), d = Kt(() => t.type || (r == null ? void 0 : r.type) || ""), T = Kt(() => {
var _, L, E;
return (E = (L = t.autoInsertSpace) != null ? L : (_ = n.value) == null ? void 0 : _.autoInsertSpace) != null ? E : !1;
}), f = Kt(() => t.tag === "button" ? {
ariaDisabled: s.value || t.loading,
disabled: s.value || t.loading,
autofocus: t.autofocus,
type: t.nativeType
} : {}), Q = Kt(() => {
var _;
const L = (_ = u.default) == null ? void 0 : _.call(u);
if (T.value && (L == null ? void 0 : L.length) === 1) {
const E = L[0];
if ((E == null ? void 0 : E.type) === Xj) {
const x = E.children;
return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(x.trim());
}
}
return !1;
});
return {
_disabled: s,
_size: o,
_type: d,
_ref: a,
_props: f,
shouldAddSpace: Q,
handleClick: (_) => {
if (s.value || t.loading) {
_.stopPropagation();
return;
}
t.nativeType === "reset" && (i == null || i.resetFields()), e("click", _);
}
};
}, Tat = [
"default",
"primary",
"success",
"warning",
"info",
"danger",
"text",
""
], fat = ["button", "submit", "reset"], gx = Sn({
size: J8,
disabled: Boolean,
type: {
type: String,
values: Tat,
default: ""
},
icon: {
type: b8
},
nativeType: {
type: String,
values: fat,
default: "button"
},
loading: Boolean,
loadingIcon: {
type: b8,
default: () => wz
},
plain: Boolean,
text: Boolean,
link: Boolean,
bg: Boolean,
autofocus: Boolean,
round: Boolean,
circle: Boolean,
color: String,
dark: Boolean,
autoInsertSpace: {
type: Boolean,
default: void 0
},
tag: {
type: Gr([String, Object]),
default: "button"
}
}), Qat = {
click: (t) => t instanceof MouseEvent
};
function io(t, e) {
mat(t) && (t = "100%");
var r = gat(t);
return t = e === 360 ? t : Math.min(e, Math.max(0, parseFloat(t))), r && (t = parseInt(String(t * e), 10) / 100), Math.abs(t - e) < 1e-6 ? 1 : (e === 360 ? t = (t < 0 ? t % e + e : t % e) / parseFloat(String(e)) : t = t % e / parseFloat(String(e)), t);
}
function Yp(t) {
return Math.min(1, Math.max(0, t));
}
function mat(t) {
return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1;
}
function gat(t) {
return typeof t == "string" && t.indexOf("%") !== -1;
}
function uU(t) {
return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
}
function Jp(t) {
return t <= 1 ? "".concat(Number(t) * 100, "%") : t;
}
function M5(t) {
return t.length === 1 ? "0" + t : String(t);
}
function yat(t, e, r) {
return {
r: io(t, 255) * 255,
g: io(e, 255) * 255,
b: io(r, 255) * 255
};
}
function gI(t, e, r) {
t = io(t, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t, e, r), i = Math.min(t, e, r), o = 0, s = 0, a = (n + i) / 2;
if (n === i)
s = 0, o = 0;
else {
var u = n - i;
switch (s = a > 0.5 ? u / (2 - n - i) : u / (n + i), n) {
case t:
o = (e - r) / u + (e < r ? 6 : 0);
break;
case e:
o = (r - t) / u + 2;
break;
case r:
o = (t - e) / u + 4;
break;
}
o /= 6;
}
return { h: o, s, l: a };
}
function yb(t, e, r) {
return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * (6 * r) : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t;
}
function vat(t, e, r) {
var n, i, o;
if (t = io(t, 360), e = io(e, 100), r = io(r, 100), e === 0)
i = r, o = r, n = r;
else {
var s = r < 0.5 ? r * (1 + e) : r + e - r * e, a = 2 * r - s;
n = yb(a, s, t + 1 / 3), i = yb(a, s, t), o = yb(a, s, t - 1 / 3);
}
return { r: n * 255, g: i * 255, b: o * 255 };
}
function yI(t, e, r) {
t = io(t, 255), e = io(e, 255), r = io(r, 255);
var n = Math.max(t, e, r), i = Math.min(t, e, r), o = 0, s = n, a = n - i, u = n === 0 ? 0 : a / n;
if (n === i)
o = 0;
else {
switch (n) {
case t:
o = (e - r) / a + (e < r ? 6 : 0);
break;
case e:
o = (r - t) / a + 2;
break;
case r:
o = (t - e) / a + 4;
break;
}
o /= 6;
}
return { h: o, s: u, v: s };
}
function _at(t, e, r) {
t = io(t, 360) * 6, e = io(e, 100), r = io(r, 100);
var n = Math.floor(t), i = t - n, o = r * (1 - e), s = r * (1 - i * e), a = r * (1 - (1 - i) * e), u = n % 6, d = [r, s, o, o, a, r][u], T = [a, r, r, s, o, o][u], f = [o, o, a, r, r, s][u];
return { r: d * 255, g: T * 255, b: f * 255 };
}
function vI(t, e, r, n) {
var i = [
M5(Math.round(t).toString(16)),
M5(Math.round(e).toString(16)),
M5(Math.round(r).toString(16))
];
return n && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) : i.join("");
}
function bat(t, e, r, n, i) {
var o = [
M5(Math.round(t).toString(16)),
M5(Math.round(e).toString(16)),
M5(Math.round(r).toString(16)),
M5(Lat(n))
];
return i && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) && o[3].startsWith(o[3].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) + o[3].charAt(0) : o.join("");
}
function Lat(t) {
return Math.round(parseFloat(t) * 255).toString(16);
}
function _I(t) {
return U2(t) / 255;
}
function U2(t) {
return parseInt(t, 16);
}
function wat(t) {
return {
r: t >> 16,
g: (t & 65280) >> 8,
b: t & 255
};
}
var yx = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function xat(t) {
var e = { r: 0, g: 0, b: 0 }, r = 1, n = null, i = null, o = null, s = !1, a = !1;
return typeof t == "string" && (t = Sat(t)), typeof t == "object" && ($3(t.r) && $3(t.g) && $3(t.b) ? (e = yat(t.r, t.g, t.b), s = !0, a = String(t.r).substr(-1) === "%" ? "prgb" : "rgb") : $3(t.h) && $3(t.s) && $3(t.v) ? (n = Jp(t.s), i = Jp(t.v), e = _at(t.h, n, i), s = !0, a = "hsv") : $3(t.h) && $3(t.s) && $3(t.l) && (n = Jp(t.s), o = Jp(t.l), e = vat(t.h, n, o), s = !0, a = "hsl"), Object.prototype.hasOwnProperty.call(t, "a") && (r = t.a)), r = uU(r), {
ok: s,
format: t.format || a,
r: Math.min(255, Math.max(e.r, 0)),
g: Math.min(255, Math.max(e.g, 0)),
b: Math.min(255, Math.max(e.b, 0)),
a: r
};
}
var Eat = "[-\\+]?\\d+%?", Mat = "[-\\+]?\\d*\\.\\d+%?", X6 = "(?:".concat(Mat, ")|(?:").concat(Eat, ")"), vb = "[\\s|\\(]+(".concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")\\s*\\)?"), _b = "[\\s|\\(]+(".concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")[,|\\s]+(").concat(X6, ")\\s*\\)?"), Js = {
CSS_UNIT: new RegExp(X6),
rgb: new RegExp("rgb" + vb),
rgba: new RegExp("rgba" + _b),
hsl: new RegExp("hsl" + vb),
hsla: new RegExp("hsla" + _b),
hsv: new RegExp("hsv" + vb),
hsva: new RegExp("hsva" + _b),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function Sat(t) {
if (t = t.trim().toLowerCase(), t.length === 0)
return !1;
var e = !1;
if (yx[t])
t = yx[t], e = !0;
else if (t === "transparent")
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
var r = Js.rgb.exec(t);
return r ? { r: r[1], g: r[2], b: r[3] } : (r = Js.rgba.exec(t), r ? { r: r[1], g: r[2], b: r[3], a: r[4] } : (r = Js.hsl.exec(t), r ? { h: r[1], s: r[2], l: r[3] } : (r = Js.hsla.exec(t), r ? { h: r[1], s: r[2], l: r[3], a: r[4] } : (r = Js.hsv.exec(t), r ? { h: r[1], s: r[2], v: r[3] } : (r = Js.hsva.exec(t), r ? { h: r[1], s: r[2], v: r[3], a: r[4] } : (r = Js.hex8.exec(t), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
a: _I(r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex6.exec(t), r ? {
r: U2(r[1]),
g: U2(r[2]),
b: U2(r[3]),
format: e ? "name" : "hex"
} : (r = Js.hex4.exec(t), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
a: _I(r[4] + r[4]),
format: e ? "name" : "hex8"
} : (r = Js.hex3.exec(t), r ? {
r: U2(r[1] + r[1]),
g: U2(r[2] + r[2]),
b: U2(r[3] + r[3]),
format: e ? "name" : "hex"
} : !1)))))))));
}
function $3(t) {
return !!Js.CSS_UNIT.exec(String(t));
}
var Hat = (
/** @class */
function() {
function t(e, r) {
e === void 0 && (e = ""), r === void 0 && (r = {});
var n;
if (e instanceof t)
return e;
typeof e == "number" && (e = wat(e)), this.originalInput = e;
var i = xat(e);
this.originalInput = e, this.r = i.r, this.g = i.g, this.b = i.b, this.a = i.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (n = r.format) !== null && n !== void 0 ? n : i.format, this.gradientType = r.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = i.ok;
}
return t.prototype.isDark = function() {
return this.getBrightness() < 128;
}, t.prototype.isLight = function() {
return !this.isDark();
}, t.prototype.getBrightness = function() {
var e = this.toRgb();
return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
}, t.prototype.getLuminance = function() {
var e = this.toRgb(), r, n, i, o = e.r / 255, s = e.g / 255, a = e.b / 255;
return o <= 0.03928 ? r = o / 12.92 : r = Math.pow((o + 0.055) / 1.055, 2.4), s <= 0.03928 ? n = s / 12.92 : n = Math.pow((s + 0.055) / 1.055, 2.4), a <= 0.03928 ? i = a / 12.92 : i = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * r + 0.7152 * n + 0.0722 * i;
}, t.prototype.getAlpha = function() {
return this.a;
}, t.prototype.setAlpha = function(e) {
return this.a = uU(e), this.roundA = Math.round(100 * this.a) / 100, this;
}, t.prototype.isMonochrome = function() {
var e = this.toHsl().s;
return e === 0;
}, t.prototype.toHsv = function() {
var e = yI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
}, t.prototype.toHsvString = function() {
var e = yI(this.r, this.g, this.b), r = Math.round(e.h * 360), n = Math.round(e.s * 100), i = Math.round(e.v * 100);
return this.a === 1 ? "hsv(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsva(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
}, t.prototype.toHsl = function() {
var e = gI(this.r, this.g, this.b);
return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
}, t.prototype.toHslString = function() {
var e = gI(this.r, this.g, this.b), r = Math.round(e.h * 360), n = Math.round(e.s * 100), i = Math.round(e.l * 100);
return this.a === 1 ? "hsl(".concat(r, ", ").concat(n, "%, ").concat(i, "%)") : "hsla(".concat(r, ", ").concat(n, "%, ").concat(i, "%, ").concat(this.roundA, ")");
}, t.prototype.toHex = function(e) {
return e === void 0 && (e = !1), vI(this.r, this.g, this.b, e);
}, t.prototype.toHexString = function(e) {
return e === void 0 && (e = !1), "#" + this.toHex(e);
}, t.prototype.toHex8 = function(e) {
return e === void 0 && (e = !1), bat(this.r, this.g, this.b, this.a, e);
}, t.prototype.toHex8String = function(e) {
return e === void 0 && (e = !1), "#" + this.toHex8(e);
}, t.prototype.toHexShortString = function(e) {
return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
}, t.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
}, t.prototype.toRgbString = function() {
var e = Math.round(this.r), r = Math.round(this.g), n = Math.round(this.b);
return this.a === 1 ? "rgb(".concat(e, ", ").concat(r, ", ").concat(n, ")") : "rgba(".concat(e, ", ").concat(r, ", ").concat(n, ", ").concat(this.roundA, ")");
}, t.prototype.toPercentageRgb = function() {
var e = function(r) {
return "".concat(Math.round(io(r, 255) * 100), "%");
};
return {
r: e(this.r),
g: e(this.g),
b: e(this.b),
a: this.a
};
}, t.prototype.toPercentageRgbString = function() {
var e = function(r) {
return Math.round(io(r, 255) * 100);
};
return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")");
}, t.prototype.toName = function() {
if (this.a === 0)
return "transparent";
if (this.a < 1)
return !1;
for (var e = "#" + vI(this.r, this.g, this.b, !1), r = 0, n = Object.entries(yx); r < n.length; r++) {
var i = n[r], o = i[0], s = i[1];
if (e === s)
return o;
}
return !1;
}, t.prototype.toString = function(e) {
var r = !!e;
e = e ?? this.format;
var n = !1, i = this.a < 1 && this.a >= 0, o = !r && i && (e.startsWith("hex") || e === "name");
return o ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), n || this.toHexString());
}, t.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
}, t.prototype.clone = function() {
return new t(this.toString());
}, t.prototype.lighten = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l += e / 100, r.l = Yp(r.l), new t(r);
}, t.prototype.brighten = function(e) {
e === void 0 && (e = 10);
var r = this.toRgb();
return r.r = Math.max(0, Math.min(255, r.r - Math.round(255 * -(e / 100)))), r.g = Math.max(0, Math.min(255, r.g - Math.round(255 * -(e / 100)))), r.b = Math.max(0, Math.min(255, r.b - Math.round(255 * -(e / 100)))), new t(r);
}, t.prototype.darken = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.l -= e / 100, r.l = Yp(r.l), new t(r);
}, t.prototype.tint = function(e) {
return e === void 0 && (e = 10), this.mix("white", e);
}, t.prototype.shade = function(e) {
return e === void 0 && (e = 10), this.mix("black", e);
}, t.prototype.desaturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s -= e / 100, r.s = Yp(r.s), new t(r);
}, t.prototype.saturate = function(e) {
e === void 0 && (e = 10);
var r = this.toHsl();
return r.s += e / 100, r.s = Yp(r.s), new t(r);
}, t.prototype.greyscale = function() {
return this.desaturate(100);
}, t.prototype.spin = function(e) {
var r = this.toHsl(), n = (r.h + e) % 360;
return r.h = n < 0 ? 360 + n : n, new t(r);
}, t.prototype.mix = function(e, r) {
r === void 0 && (r = 50);
var n = this.toRgb(), i = new t(e).toRgb(), o = r / 100, s = {
r: (i.r - n.r) * o + n.r,
g: (i.g - n.g) * o + n.g,
b: (i.b - n.b) * o + n.b,
a: (i.a - n.a) * o + n.a
};
return new t(s);
}, t.prototype.analogous = function(e, r) {
e === void 0 && (e = 6), r === void 0 && (r = 30);
var n = this.toHsl(), i = 360 / r, o = [this];
for (n.h = (n.h - (i * e >> 1) + 720) % 360; --e; )
n.h = (n.h + i) % 360, o.push(new t(n));
return o;
}, t.prototype.complement = function() {
var e = this.toHsl();
return e.h = (e.h + 180) % 360, new t(e);
}, t.prototype.monochromatic = function(e) {
e === void 0 && (e = 6);
for (var r = this.toHsv(), n = r.h, i = r.s, o = r.v, s = [], a = 1 / e; e--; )
s.push(new t({ h: n, s: i, v: o })), o = (o + a) % 1;
return s;
}, t.prototype.splitcomplement = function() {
var e = this.toHsl(), r = e.h;
return [
this,
new t({ h: (r + 72) % 360, s: e.s, l: e.l }),
new t({ h: (r + 216) % 360, s: e.s, l: e.l })
];
}, t.prototype.onBackground = function(e) {
var r = this.toRgb(), n = new t(e).toRgb(), i = r.a + n.a * (1 - r.a);
return new t({
r: (r.r * r.a + n.r * n.a * (1 - r.a)) / i,
g: (r.g * r.a + n.g * n.a * (1 - r.a)) / i,
b: (r.b * r.a + n.b * n.a * (1 - r.a)) / i,
a: i
});
}, t.prototype.triad = function() {
return this.polyad(3);
}, t.prototype.tetrad = function() {
return this.polyad(4);
}, t.prototype.polyad = function(e) {
for (var r = this.toHsl(), n = r.h, i = [this], o = 360 / e, s = 1; s < e; s++)
i.push(new t({ h: (n + s * o) % 360, s: r.s, l: r.l }));
return i;
}, t.prototype.equals = function(e) {
return this.toRgbString() === new t(e).toRgbString();
}, t;
}()
);
function g6(t, e = 20) {
return t.mix("#141414", e).toString();
}
function Aat(t) {
const e = xg(), r = Bn("button");
return Kt(() => {
let n = {}, i = t.color;
if (i) {
const o = i.match(/var\((.*?)\)/);
o && (i = window.getComputedStyle(window.document.documentElement).getPropertyValue(o[1]));
const s = new Hat(i), a = t.dark ? s.tint(20).toString() : g6(s, 20);
if (t.plain)
n = r.cssVarBlock({
"bg-color": t.dark ? g6(s, 90) : s.tint(90).toString(),
"text-color": i,
"border-color": t.dark ? g6(s, 50) : s.tint(50).toString(),
"hover-text-color": `var(${r.cssVarName("color-white")})`,
"hover-bg-color": i,
"hover-border-color": i,
"active-bg-color": a,
"active-text-color": `var(${r.cssVarName("color-white")})`,
"active-border-color": a
}), e.value && (n[r.cssVarBlockName("disabled-bg-color")] = t.dark ? g6(s, 90) : s.tint(90).toString(), n[r.cssVarBlockName("disabled-text-color")] = t.dark ? g6(s, 50) : s.tint(50).toString(), n[r.cssVarBlockName("disabled-border-color")] = t.dark ? g6(s, 80) : s.tint(80).toString());
else {
const u = t.dark ? g6(s, 30) : s.tint(30).toString(), d = s.isDark() ? `var(${r.cssVarName("color-white")})` : `var(${r.cssVarName("color-black")})`;
if (n = r.cssVarBlock({
"bg-color": i,
"text-color": d,
"border-color": i,
"hover-bg-color": u,
"hover-text-color": d,
"hover-border-color": u,
"active-bg-color": a,
"active-border-color": a
}), e.value) {
const T = t.dark ? g6(s, 50) : s.tint(50).toString();
n[r.cssVarBlockName("disabled-bg-color")] = T, n[r.cssVarBlockName("disabled-text-color")] = t.dark ? "rgba(255, 255, 255, 0.5)" : `var(${r.cssVarName("color-white")})`, n[r.cssVarBlockName("disabled-border-color")] = T;
}
}
}
return n;
});
}
const Oat = mr({
name: "ElButton"
}), Cat = /* @__PURE__ */ mr({
...Oat,
props: gx,
emits: Qat,
setup(t, { expose: e, emit: r }) {
const n = t, i = Aat(n), o = Bn("button"), { _ref: s, _size: a, _type: u, _disabled: d, _props: T, shouldAddSpace: f, handleClick: Q } = pat(n, r), y = Kt(() => [
o.b(),
o.m(u.value),
o.m(a.value),
o.is("disabled", d.value),
o.is("loading", n.loading),
o.is("plain", n.plain),
o.is("round", n.round),
o.is("circle", n.circle),
o.is("text", n.text),
o.is("link", n.link),
o.is("has-bg", n.bg)
]);
return e({
ref: s,
size: a,
type: u,
disabled: d,
shouldAddSpace: f
}), (_, L) => (ce(), Or(Ss(_.tag), rl({
ref_key: "_ref",
ref: s
}, vt(T), {
class: vt(y),
style: vt(i),
onClick: vt(Q)
}), {
default: fe(() => [
_.loading ? (ce(), Ye(to, { key: 0 }, [
_.$slots.loading ? Pr(_.$slots, "loading", { key: 0 }) : (ce(), Or(vt(p3), {
key: 1,
class: Be(vt(o).is("loading"))
}, {
default: fe(() => [
(ce(), Or(Ss(_.loadingIcon)))
]),
_: 1
}, 8, ["class"]))
], 64)) : _.icon || _.$slots.icon ? (ce(), Or(vt(p3), { key: 1 }, {
default: fe(() => [
_.icon ? (ce(), Or(Ss(_.icon), { key: 0 })) : Pr(_.$slots, "icon", { key: 1 })
]),
_: 3
})) : Fr("v-if", !0),
_.$slots.default ? (ce(), Ye("span", {
key: 2,
class: Be({ [vt(o).em("text", "expand")]: vt(f) })
}, [
Pr(_.$slots, "default")
], 2)) : Fr("v-if", !0)
]),
_: 3
}, 16, ["class", "style", "onClick"]));
}
});
var kat = /* @__PURE__ */ Hn(Cat, [["__file", "button.vue"]]);
const Iat = {
size: gx.size,
type: gx.type
}, Pat = mr({
name: "ElButtonGroup"
}), Vat = /* @__PURE__ */ mr({
...Pat,
props: Iat,
setup(t) {
const e = t;
$1(cU, u3({
size: K2(e, "size"),
type: K2(e, "type")
}));
const r = Bn("button");
return (n, i) => (ce(), Ye("div", {
class: Be(vt(r).b("group"))
}, [
Pr(n.$slots, "default")
], 2));
}
});
var hU = /* @__PURE__ */ Hn(Vat, [["__file", "button-group.vue"]]);
const dU = v2(kat, {
ButtonGroup: hU
});
ol(hU);
var Rat = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Nat(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
const A6 = /* @__PURE__ */ new Map();
if (s1) {
let t;
document.addEventListener("mousedown", (e) => t = e), document.addEventListener("mouseup", (e) => {
if (t) {
for (const r of A6.values())
for (const { documentHandler: n } of r)
n(e, t);
t = void 0;
}
});
}
function bI(t, e) {
let r = [];
return Array.isArray(e.arg) ? r = e.arg : k5(e.arg) && r.push(e.arg), function(n, i) {
const o = e.instance.popperRef, s = n.target, a = i == null ? void 0 : i.target, u = !e || !e.instance, d = !s || !a, T = t.contains(s) || t.contains(a), f = t === s, Q = r.length && r.some((_) => _ == null ? void 0 : _.contains(s)) || r.length && r.includes(a), y = o && (o.contains(s) || o.contains(a));
u || d || T || f || Q || y || e.value(n, i);
};
}
const Dat = {
beforeMount(t, e) {
A6.has(t) || A6.set(t, []), A6.get(t).push({
documentHandler: bI(t, e),
bindingFn: e.value
});
},
updated(t, e) {
A6.has(t) || A6.set(t, []);
const r = A6.get(t), n = r.findIndex((o) => o.bindingFn === e.oldValue), i = {
documentHandler: bI(t, e),
bindingFn: e.value
};
n >= 0 ? r.splice(n, 1, i) : r.push(i);
},
unmounted(t) {
A6.delete(t);
}
}, pU = {
modelValue: {
type: [Number, String, Boolean],
default: void 0
},
label: {
type: [String, Boolean, Number, Object],
default: void 0
},
value: {
type: [String, Boolean, Number, Object],
default: void 0
},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: {
type: String,
default: void 0
},
trueValue: {
type: [String, Number],
default: void 0
},
falseValue: {
type: [String, Number],
default: void 0
},
trueLabel: {
type: [String, Number],
default: void 0
},
falseLabel: {
type: [String, Number],
default: void 0
},
id: {
type: String,
default: void 0
},
border: Boolean,
size: J8,
tabindex: [String, Number],
validateEvent: {
type: Boolean,
default: !0
},
...sl(["ariaControls"])
}, TU = {
[Wo]: (t) => sa(t) || ro(t) || S4(t),
change: (t) => sa(t) || ro(t) || S4(t)
}, ec = Symbol("checkboxGroupContextKey"), Fat = ({
model: t,
isChecked: e
}) => {
const r = ln(ec, void 0), n = Kt(() => {
var o, s;
const a = (o = r == null ? void 0 : r.max) == null ? void 0 : o.value, u = (s = r == null ? void 0 : r.min) == null ? void 0 : s.value;
return !q6(a) && t.value.length >= a && !e.value || !q6(u) && t.value.length <= u && e.value;
});
return {
isDisabled: xg(Kt(() => (r == null ? void 0 : r.disabled.value) || n.value)),
isLimitDisabled: n
};
}, Bat = (t, {
model: e,
isLimitExceeded: r,
hasOwnLabel: n,
isDisabled: i,
isLabeledByFormItem: o
}) => {
const s = ln(ec, void 0), { formItem: a } = tc(), { emit: u } = G1();
function d(_) {
var L, E, x, O;
return [!0, t.trueValue, t.trueLabel].includes(_) ? (E = (L = t.trueValue) != null ? L : t.trueLabel) != null ? E : !0 : (O = (x = t.falseValue) != null ? x : t.falseLabel) != null ? O : !1;
}
function T(_, L) {
u("change", d(_), L);
}
function f(_) {
if (r.value)
return;
const L = _.target;
u("change", d(L.checked), _);
}
async function Q(_) {
r.value || !n.value && !i.value && o.value && (_.composedPath().some((x) => x.tagName === "LABEL") || (e.value = d([!1, t.falseValue, t.falseLabel].includes(e.value)), await i1(), T(e.value, _)));
}
const y = Kt(() => (s == null ? void 0 : s.validateEvent) || t.validateEvent);
return on(() => t.modelValue, () => {
y.value && (a == null || a.validate("change").catch((_) => y2(_)));
}), {
handleChange: f,
onClickRoot: Q
};
}, jat = (t) => {
const e = Ie(!1), { emit: r } = G1(), n = ln(ec, void 0), i = Kt(() => q6(n) === !1), o = Ie(!1), s = Kt({
get() {
var a, u;
return i.value ? (a = n == null ? void 0 : n.modelValue) == null ? void 0 : a.value : (u = t.modelValue) != null ? u : e.value;
},
set(a) {
var u, d;
i.value && p2(a) ? (o.value = ((u = n == null ? void 0 : n.max) == null ? void 0 : u.value) !== void 0 && a.length > (n == null ? void 0 : n.max.value) && a.length > s.value.length, o.value === !1 && ((d = n == null ? void 0 : n.changeEvent) == null || d.call(n, a))) : (r(Wo, a), e.value = a);
}
});
return {
model: s,
isGroup: i,
isLimitExceeded: o
};
}, zat = (t, e, { model: r }) => {
const n = ln(ec, void 0), i = Ie(!1), o = Kt(() => Vh(t.value) ? t.label : t.value), s = Kt(() => {
const T = r.value;
return S4(T) ? T : p2(T) ? T2(o.value) ? T.map(kh).some((f) => NQ(f, o.value)) : T.map(kh).includes(o.value) : T != null ? T === t.trueValue || T === t.trueLabel : !!T;
}), a = S8(Kt(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
}), {
prop: !0
}), u = S8(Kt(() => {
var T;
return (T = n == null ? void 0 : n.size) == null ? void 0 : T.value;
})), d = Kt(() => !!e.default || !Vh(o.value));
return {
checkboxButtonSize: a,
isChecked: s,
isFocused: i,
checkboxSize: u,
hasOwnLabel: d,
actualValue: o
};
}, fU = (t, e) => {
const { formItem: r } = tc(), { model: n, isGroup: i, isLimitExceeded: o } = jat(t), {
isFocused: s,
isChecked: a,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
actualValue: f
} = zat(t, e, { model: n }), { isDisabled: Q } = Fat({ model: n, isChecked: a }), { inputId: y, isLabeledByFormItem: _ } = Eg(t, {
formItemContext: r,
disableIdGeneration: T,
disableIdManagement: i
}), { handleChange: L, onClickRoot: E } = Bat(t, {
model: n,
isLimitExceeded: o,
hasOwnLabel: T,
isDisabled: Q,
isLabeledByFormItem: _
});
return (() => {
function O() {
var k, R;
p2(n.value) && !n.value.includes(f.value) ? n.value.push(f.value) : n.value = (R = (k = t.trueValue) != null ? k : t.trueLabel) != null ? R : !0;
}
t.checked && O();
})(), h8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => i.value && Vh(t.value))), h8({
from: "true-label",
replacement: "true-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => !!t.trueLabel)), h8({
from: "false-label",
replacement: "false-value",
version: "3.0.0",
scope: "el-checkbox",
ref: "https://element-plus.org/en-US/component/checkbox.html"
}, Kt(() => !!t.falseLabel)), {
inputId: y,
isLabeledByFormItem: _,
isChecked: a,
isDisabled: Q,
isFocused: s,
checkboxButtonSize: u,
checkboxSize: d,
hasOwnLabel: T,
model: n,
actualValue: f,
handleChange: L,
onClickRoot: E
};
}, Uat = mr({
name: "ElCheckbox"
}), Gat = /* @__PURE__ */ mr({
...Uat,
props: pU,
emits: TU,
setup(t) {
const e = t, r = pg(), {
inputId: n,
isLabeledByFormItem: i,
isChecked: o,
isDisabled: s,
isFocused: a,
checkboxSize: u,
hasOwnLabel: d,
model: T,
actualValue: f,
handleChange: Q,
onClickRoot: y
} = fU(e, r), _ = Bn("checkbox"), L = Kt(() => [
_.b(),
_.m(u.value),
_.is("disabled", s.value),
_.is("bordered", e.border),
_.is("checked", o.value)
]), E = Kt(() => [
_.e("input"),
_.is("disabled", s.value),
_.is("checked", o.value),
_.is("indeterminate", e.indeterminate),
_.is("focus", a.value)
]);
return (x, O) => (ce(), Or(Ss(!vt(d) && vt(i) ? "span" : "label"), {
class: Be(vt(L)),
"aria-controls": x.indeterminate ? x.ariaControls : null,
onClick: vt(y)
}, {
default: fe(() => {
var k, R, F, U;
return [
je("span", {
class: Be(vt(E))
}, [
x.trueValue || x.falseValue || x.trueLabel || x.falseLabel ? Ti((ce(), Ye("input", {
key: 0,
id: vt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(vt(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
name: x.name,
tabindex: x.tabindex,
disabled: vt(s),
"true-value": (R = (k = x.trueValue) != null ? k : x.trueLabel) != null ? R : !0,
"false-value": (U = (F = x.falseValue) != null ? F : x.falseLabel) != null ? U : !1,
onChange: vt(Q),
onFocus: ($) => a.value = !0,
onBlur: ($) => a.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[PQ, vt(T)]
]) : Ti((ce(), Ye("input", {
key: 1,
id: vt(n),
"onUpdate:modelValue": ($) => g2(T) ? T.value = $ : null,
class: Be(vt(_).e("original")),
type: "checkbox",
indeterminate: x.indeterminate,
disabled: vt(s),
value: vt(f),
name: x.name,
tabindex: x.tabindex,
onChange: vt(Q),
onFocus: ($) => a.value = !0,
onBlur: ($) => a.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
[PQ, vt(T)]
]),
je("span", {
class: Be(vt(_).e("inner"))
}, null, 2)
], 2),
vt(d) ? (ce(), Ye("span", {
key: 0,
class: Be(vt(_).e("label"))
}, [
Pr(x.$slots, "default"),
x.$slots.default ? Fr("v-if", !0) : (ce(), Ye(to, { key: 0 }, [
xn(fi(x.label), 1)
], 64))
], 2)) : Fr("v-if", !0)
];
}),
_: 3
}, 8, ["class", "aria-controls", "onClick"]));
}
});
var $at = /* @__PURE__ */ Hn(Gat, [["__file", "checkbox.vue"]]);
const Wat = mr({
name: "ElCheckboxButton"
}), Zat = /* @__PURE__ */ mr({
...Wat,
props: pU,
emits: TU,
setup(t) {
const e = t, r = pg(), {
isFocused: n,
isChecked: i,
isDisabled: o,
checkboxButtonSize: s,
model: a,
actualValue: u,
handleChange: d
} = fU(e, r), T = ln(ec, void 0), f = Bn("checkbox"), Q = Kt(() => {
var _, L, E, x;
const O = (L = (_ = T == null ? void 0 : T.fill) == null ? void 0 : _.value) != null ? L : "";
return {
backgroundColor: O,
borderColor: O,
color: (x = (E = T == null ? void 0 : T.textColor) == null ? void 0 : E.value) != null ? x : "",
boxShadow: O ? `-1px 0 0 0 ${O}` : void 0
};
}), y = Kt(() => [
f.b("button"),
f.bm("button", s.value),
f.is("disabled", o.value),
f.is("checked", i.value),
f.is("focus", n.value)
]);
return (_, L) => {
var E, x, O, k;
return ce(), Ye("label", {
class: Be(vt(y))
}, [
_.trueValue || _.falseValue || _.trueLabel || _.falseLabel ? Ti((ce(), Ye("input", {
key: 0,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(vt(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: vt(o),
"true-value": (x = (E = _.trueValue) != null ? E : _.trueLabel) != null ? x : !0,
"false-value": (k = (O = _.falseValue) != null ? O : _.falseLabel) != null ? k : !1,
onChange: vt(d),
onFocus: (R) => n.value = !0,
onBlur: (R) => n.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
[PQ, vt(a)]
]) : Ti((ce(), Ye("input", {
key: 1,
"onUpdate:modelValue": (R) => g2(a) ? a.value = R : null,
class: Be(vt(f).be("button", "original")),
type: "checkbox",
name: _.name,
tabindex: _.tabindex,
disabled: vt(o),
value: vt(u),
onChange: vt(d),
onFocus: (R) => n.value = !0,
onBlur: (R) => n.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
[PQ, vt(a)]
]),
_.$slots.default || _.label ? (ce(), Ye("span", {
key: 2,
class: Be(vt(f).be("button", "inner")),
style: M1(vt(i) ? vt(Q) : void 0)
}, [
Pr(_.$slots, "default", {}, () => [
xn(fi(_.label), 1)
])
], 6)) : Fr("v-if", !0)
], 2);
};
}
});
var QU = /* @__PURE__ */ Hn(Zat, [["__file", "checkbox-button.vue"]]);
const qat = Sn({
modelValue: {
type: Gr(Array),
default: () => []
},
disabled: Boolean,
min: Number,
max: Number,
size: J8,
fill: String,
textColor: String,
tag: {
type: String,
default: "div"
},
validateEvent: {
type: Boolean,
default: !0
},
...sl(["ariaLabel"])
}), Xat = {
[Wo]: (t) => p2(t),
change: (t) => p2(t)
}, Kat = mr({
name: "ElCheckboxGroup"
}), Yat = /* @__PURE__ */ mr({
...Kat,
props: qat,
emits: Xat,
setup(t, { emit: e }) {
const r = t, n = Bn("checkbox"), { formItem: i } = tc(), { inputId: o, isLabeledByFormItem: s } = Eg(r, {
formItemContext: i
}), a = async (d) => {
e(Wo, d), await i1(), e("change", d);
}, u = Kt({
get() {
return r.modelValue;
},
set(d) {
a(d);
}
});
return $1(ec, {
...gz(s0(r), [
"size",
"min",
"max",
"disabled",
"validateEvent",
"fill",
"textColor"
]),
modelValue: u,
changeEvent: a
}), on(() => r.modelValue, () => {
r.validateEvent && (i == null || i.validate("change").catch((d) => y2(d)));
}), (d, T) => {
var f;
return ce(), Or(Ss(d.tag), {
id: vt(o),
class: Be(vt(n).b("group")),
role: "group",
"aria-label": vt(s) ? void 0 : d.ariaLabel || "checkbox-group",
"aria-labelledby": vt(s) ? (f = vt(i)) == null ? void 0 : f.labelId : void 0
}, {
default: fe(() => [
Pr(d.$slots, "default")
]),
_: 3
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
};
}
});
var mU = /* @__PURE__ */ Hn(Yat, [["__file", "checkbox-group.vue"]]);
const gU = v2($at, {
CheckboxButton: QU,
CheckboxGroup: mU
});
ol(QU);
const yU = ol(mU), vU = Sn({
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
size: J8,
disabled: Boolean,
label: {
type: [String, Number, Boolean],
default: void 0
},
value: {
type: [String, Number, Boolean],
default: void 0
},
name: {
type: String,
default: void 0
}
}), Jat = Sn({
...vU,
border: Boolean
}), _U = {
[Wo]: (t) => sa(t) || ro(t) || S4(t),
[cS]: (t) => sa(t) || ro(t) || S4(t)
}, bU = Symbol("radioGroupKey"), LU = (t, e) => {
const r = Ie(), n = ln(bU, void 0), i = Kt(() => !!n), o = Kt(() => Vh(t.value) ? t.label : t.value), s = Kt({
get() {
return i.value ? n.modelValue : t.modelValue;
},
set(f) {
i.value ? n.changeEvent(f) : e && e(Wo, f), r.value.checked = t.modelValue === o.value;
}
}), a = S8(Kt(() => n == null ? void 0 : n.size)), u = xg(Kt(() => n == null ? void 0 : n.disabled)), d = Ie(!1), T = Kt(() => u.value || i.value && s.value !== o.value ? -1 : 0);
return h8({
from: "label act as value",
replacement: "value",
version: "3.0.0",
scope: "el-radio",
ref: "https://element-plus.org/en-US/component/radio.html"
}, Kt(() => i.value && Vh(t.value))), {
radioRef: r,
isGroup: i,
radioGroup: n,
focus: d,
size: a,
disabled: u,
tabIndex: T,
modelValue: s,
actualValue: o
};
}, t3t = mr({
name: "ElRadio"
}), e3t = /* @__PURE__ */ mr({
...t3t,
props: Jat,
emits: _U,
setup(t, { emit: e }) {
const r = t, n = Bn("radio"), { radioRef: i, radioGroup: o, focus: s, size: a, disabled: u, modelValue: d, actualValue: T } = LU(r, e);
function f() {
i1(() => e("change", d.value));
}
return (Q, y) => {
var _;
return ce(), Ye("label", {
class: Be([
vt(n).b(),
vt(n).is("disabled", vt(u)),
vt(n).is("focus", vt(s)),
vt(n).is("bordered", Q.border),
vt(n).is("checked", vt(d) === vt(T)),
vt(n).m(vt(a))
])
}, [
je("span", {
class: Be([
vt(n).e("input"),
vt(n).is("disabled", vt(u)),
vt(n).is("checked", vt(d) === vt(T))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: i,
"onUpdate:modelValue": (L) => g2(d) ? d.value = L : null,
class: Be(vt(n).e("original")),
value: vt(T),
name: Q.name || ((_ = vt(o)) == null ? void 0 : _.name),
disabled: vt(u),
checked: vt(d) === vt(T),
type: "radio",
onFocus: (L) => s.value = !0,
onBlur: (L) => s.value = !1,
onChange: f,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
[Kj, vt(d)]
]),
je("span", {
class: Be(vt(n).e("inner"))
}, null, 2)
], 2),
je("span", {
class: Be(vt(n).e("label")),
onKeydown: m1(() => {
}, ["stop"])
}, [
Pr(Q.$slots, "default", {}, () => [
xn(fi(Q.label), 1)
])
], 42, ["onKeydown"])
], 2);
};
}
});
var r3t = /* @__PURE__ */ Hn(e3t, [["__file", "radio.vue"]]);
const n3t = Sn({
...vU
}), i3t = mr({
name: "ElRadioButton"
}), o3t = /* @__PURE__ */ mr({
...i3t,
props: n3t,
setup(t) {
const e = t, r = Bn("radio"), { radioRef: n, focus: i, size: o, disabled: s, modelValue: a, radioGroup: u, actualValue: d } = LU(e), T = Kt(() => ({
backgroundColor: (u == null ? void 0 : u.fill) || "",
borderColor: (u == null ? void 0 : u.fill) || "",
boxShadow: u != null && u.fill ? `-1px 0 0 0 ${u.fill}` : "",
color: (u == null ? void 0 : u.textColor) || ""
}));
return (f, Q) => {
var y;
return ce(), Ye("label", {
class: Be([
vt(r).b("button"),
vt(r).is("active", vt(a) === vt(d)),
vt(r).is("disabled", vt(s)),
vt(r).is("focus", vt(i)),
vt(r).bm("button", vt(o))
])
}, [
Ti(je("input", {
ref_key: "radioRef",
ref: n,
"onUpdate:modelValue": (_) => g2(a) ? a.value = _ : null,
class: Be(vt(r).be("button", "original-radio")),
value: vt(d),
type: "radio",
name: f.name || ((y = vt(u)) == null ? void 0 : y.name),
disabled: vt(s),
onFocus: (_) => i.value = !0,
onBlur: (_) => i.value = !1,
onClick: m1(() => {
}, ["stop"])
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
[Kj, vt(a)]
]),
je("span", {
class: Be(vt(r).be("button", "inner")),
style: M1(vt(a) === vt(d) ? vt(T) : {}),
onKeydown: m1(() => {
}, ["stop"])
}, [
Pr(f.$slots, "default", {}, () => [
xn(fi(f.label), 1)
])
], 46, ["onKeydown"])
], 2);
};
}
});
var wU = /* @__PURE__ */ Hn(o3t, [["__file", "radio-button.vue"]]);
const s3t = Sn({
id: {
type: String,
default: void 0
},
size: J8,
disabled: Boolean,
modelValue: {
type: [String, Number, Boolean],
default: void 0
},
fill: {
type: String,
default: ""
},
textColor: {
type: String,
default: ""
},
name: {
type: String,
default: void 0
},
validateEvent: {
type: Boolean,
default: !0
},
...sl(["ariaLabel"])
}), a3t = _U, l3t = mr({
name: "ElRadioGroup"
}), c3t = /* @__PURE__ */ mr({
...l3t,
props: s3t,
emits: a3t,
setup(t, { emit: e }) {
const r = t, n = Bn("radio"), i = U5(), o = Ie(), { formItem: s } = tc(), { inputId: a, isLabeledByFormItem: u } = Eg(r, {
formItemContext: s
}), d = (f) => {
e(Wo, f), i1(() => e("change", f));
};
W1(() => {
const f = o.value.querySelectorAll("[type=radio]"), Q = f[0];
!Array.from(f).some((y) => y.checked) && Q && (Q.tabIndex = 0);
});
const T = Kt(() => r.name || i.value);
return $1(bU, u3({
...s0(r),
changeEvent: d,
name: T
})), on(() => r.modelValue, () => {
r.validateEvent && (s == null || s.validate("change").catch((f) => y2(f)));
}), (f, Q) => (ce(), Ye("div", {
id: vt(a),
ref_key: "radioGroupRef",
ref: o,
class: Be(vt(n).b("group")),
role: "radiogroup",
"aria-label": vt(u) ? void 0 : f.ariaLabel || "radio-group",
"aria-labelledby": vt(u) ? vt(s).labelId : void 0
}, [
Pr(f.$slots, "default")
], 10, ["id", "aria-label", "aria-labelledby"]));
}
});
var xU = /* @__PURE__ */ Hn(c3t, [["__file", "radio-group.vue"]]);
const EU = v2(r3t, {
RadioButton: wU,
RadioGroup: xU
}), MU = ol(xU);
ol(wU);
const vx = Sn({
type: {
type: String,
values: ["primary", "success", "info", "warning", "danger"],
default: "primary"
},
closable: Boolean,
disableTransitions: Boolean,
hit: Boolean,
color: String,
size: {
type: String,
values: Sz
},
effect: {
type: String,
values: ["dark", "light", "plain"],
default: "light"
},
round: Boolean
}), u3t = {
close: (t) => t instanceof MouseEvent,
click: (t) => t instanceof MouseEvent
}, h3t = mr({
name: "ElTag"
}), d3t = /* @__PURE__ */ mr({
...h3t,
props: vx,
emits: u3t,
setup(t, { emit: e }) {
const r = t, n = S8(), i = Bn("tag"), o = Kt(() => {
const { type: d, hit: T, effect: f, closable: Q, round: y } = r;
return [
i.b(),
i.is("closable", Q),
i.m(d || "primary"),
i.m(n.value),
i.m(f),
i.is("hit", T),
i.is("round", y)
];
}), s = (d) => {
e("close", d);
}, a = (d) => {
e("click", d);
}, u = (d) => {
d.component.subTree.component.bum = null;
};
return (d, T) => d.disableTransitions ? (ce(), Ye("span", {
key: 0,
class: Be(vt(o)),
style: M1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(vt(i).e("content"))
}, [
Pr(d.$slots, "default")
], 2),
d.closable ? (ce(), Or(vt(p3), {
key: 0,
class: Be(vt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Ce(vt(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0)
], 6)) : (ce(), Or(cd, {
key: 1,
name: `${vt(i).namespace.value}-zoom-in-center`,
appear: "",
onVnodeMounted: u
}, {
default: fe(() => [
je("span", {
class: Be(vt(o)),
style: M1({ backgroundColor: d.color }),
onClick: a
}, [
je("span", {
class: Be(vt(i).e("content"))
}, [
Pr(d.$slots, "default")
], 2),
d.closable ? (ce(), Or(vt(p3), {
key: 0,
class: Be(vt(i).e("close")),
onClick: m1(s, ["stop"])
}, {
default: fe(() => [
Ce(vt(Tx))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0)
], 6)
]),
_: 3
}, 8, ["name"]));
}
});
var p3t = /* @__PURE__ */ Hn(d3t, [["__file", "tag.vue"]]);
const T3t = v2(p3t), SU = Symbol("rowContextKey"), f3t = [
"start",
"center",
"end",
"space-around",
"space-between",
"space-evenly"
], Q3t = ["top", "middle", "bottom"], m3t = Sn({
tag: {
type: String,
default: "div"
},
gutter: {
type: Number,
default: 0
},
justify: {
type: String,
values: f3t,
default: "start"
},
align: {
type: String,
values: Q3t
}
}), g3t = mr({
name: "ElRow"
}), y3t = /* @__PURE__ */ mr({
...g3t,
props: m3t,
setup(t) {
const e = t, r = Bn("row"), n = Kt(() => e.gutter);
$1(SU, {
gutter: n
});
const i = Kt(() => {
const s = {};
return e.gutter && (s.marginRight = s.marginLeft = `-${e.gutter / 2}px`), s;
}), o = Kt(() => [
r.b(),
r.is(`justify-${e.justify}`, e.justify !== "start"),
r.is(`align-${e.align}`, !!e.align)
]);
return (s, a) => (ce(), Or(Ss(s.tag), {
class: Be(vt(o)),
style: M1(vt(i))
}, {
default: fe(() => [
Pr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var v3t = /* @__PURE__ */ Hn(y3t, [["__file", "row.vue"]]);
const Td = v2(v3t), _3t = Sn({
tag: {
type: String,
default: "div"
},
span: {
type: Number,
default: 24
},
offset: {
type: Number,
default: 0
},
pull: {
type: Number,
default: 0
},
push: {
type: Number,
default: 0
},
xs: {
type: Gr([Number, Object]),
default: () => cu({})
},
sm: {
type: Gr([Number, Object]),
default: () => cu({})
},
md: {
type: Gr([Number, Object]),
default: () => cu({})
},
lg: {
type: Gr([Number, Object]),
default: () => cu({})
},
xl: {
type: Gr([Number, Object]),
default: () => cu({})
}
}), b3t = mr({
name: "ElCol"
}), L3t = /* @__PURE__ */ mr({
...b3t,
props: _3t,
setup(t) {
const e = t, { gutter: r } = ln(SU, { gutter: Kt(() => 0) }), n = Bn("col"), i = Kt(() => {
const s = {};
return r.value && (s.paddingLeft = s.paddingRight = `${r.value / 2}px`), s;
}), o = Kt(() => {
const s = [];
return ["span", "offset", "pull", "push"].forEach((d) => {
const T = e[d];
ro(T) && (d === "span" ? s.push(n.b(`${e[d]}`)) : T > 0 && s.push(n.b(`${d}-${e[d]}`)));
}), ["xs", "sm", "md", "lg", "xl"].forEach((d) => {
ro(e[d]) ? s.push(n.b(`${d}-${e[d]}`)) : T2(e[d]) && Object.entries(e[d]).forEach(([T, f]) => {
s.push(T !== "span" ? n.b(`${d}-${T}-${f}`) : n.b(`${d}-${f}`));
});
}), r.value && s.push(n.is("guttered")), [n.b(), s];
});
return (s, a) => (ce(), Or(Ss(s.tag), {
class: Be(vt(o)),
style: M1(vt(i))
}, {
default: fe(() => [
Pr(s.$slots, "default")
]),
_: 3
}, 8, ["class", "style"]));
}
});
var w3t = /* @__PURE__ */ Hn(L3t, [["__file", "col.vue"]]);
const fd = v2(w3t), x3t = Sn({
mask: {
type: Boolean,
default: !0
},
customMaskEvent: Boolean,
overlayClass: {
type: Gr([
String,
Array,
Object
])
},
zIndex: {
type: Gr([String, Number])
}
}), E3t = {
click: (t) => t instanceof MouseEvent
}, M3t = "overlay";
var S3t = mr({
name: "ElOverlay",
props: x3t,
emits: E3t,
setup(t, { slots: e, emit: r }) {
const n = Bn(M3t), i = (u) => {
r("click", u);
}, { onClick: o, onMousedown: s, onMouseup: a } = zz(t.customMaskEvent ? void 0 : i);
return () => t.mask ? Ce("div", {
class: [n.b(), t.overlayClass],
style: {
zIndex: t.zIndex
},
onClick: o,
onMousedown: s,
onMouseup: a
}, [Pr(e, "default")], ff.STYLE | ff.CLASS | ff.PROPS, ["onClick", "onMouseup", "onMousedown"]) : b7("div", {
class: t.overlayClass,
style: {
zIndex: t.zIndex,
position: "fixed",
top: "0px",
right: "0px",
bottom: "0px",
left: "0px"
}
}, [Pr(e, "default")]);
}
});
const H3t = S3t, HU = Symbol("dialogInjectionKey"), AU = Sn({
center: Boolean,
alignCenter: Boolean,
closeIcon: {
type: b8
},
draggable: Boolean,
overflow: Boolean,
fullscreen: Boolean,
showClose: {
type: Boolean,
default: !0
},
title: {
type: String,
default: ""
},
ariaLevel: {
type: String,
default: "2"
}
}), A3t = {
close: () => !0
}, O3t = mr({ name: "ElDialogContent" }), C3t = /* @__PURE__ */ mr({
...O3t,
props: AU,
emits: A3t,
setup(t, { expose: e }) {
const r = t, { t: n } = uS(), { Close: i } = cot, { dialogRef: o, headerRef: s, bodyId: a, ns: u, style: d } = ln(HU), { focusTrapRef: T } = ln(nU), f = Kt(() => [
u.b(),
u.is("fullscreen", r.fullscreen),
u.is("draggable", r.draggable),
u.is("align-center", r.alignCenter),
{ [u.m("center")]: r.center }
]), Q = dot(T, o), y = Kt(() => r.draggable), _ = Kt(() => r.overflow), { resetPosition: L } = Tot(o, s, y, _);
return e({
resetPosition: L
}), (E, x) => (ce(), Ye("div", {
ref: vt(Q),
class: Be(vt(f)),
style: M1(vt(d)),
tabindex: "-1"
}, [
je("header", {
ref_key: "headerRef",
ref: s,
class: Be([vt(u).e("header"), { "show-close": E.showClose }])
}, [
Pr(E.$slots, "header", {}, () => [
je("span", {
role: "heading",
"aria-level": E.ariaLevel,
class: Be(vt(u).e("title"))
}, fi(E.title), 11, ["aria-level"])
]),
E.showClose ? (ce(), Ye("button", {
key: 0,
"aria-label": vt(n)("el.dialog.close"),
class: Be(vt(u).e("headerbtn")),
type: "button",
onClick: (O) => E.$emit("close")
}, [
Ce(vt(p3), {
class: Be(vt(u).e("close"))
}, {
default: fe(() => [
(ce(), Or(Ss(E.closeIcon || vt(i))))
]),
_: 1
}, 8, ["class"])
], 10, ["aria-label", "onClick"])) : Fr("v-if", !0)
], 2),
je("div", {
id: vt(a),
class: Be(vt(u).e("body"))
}, [
Pr(E.$slots, "default")
], 10, ["id"]),
E.$slots.footer ? (ce(), Ye("footer", {
key: 0,
class: Be(vt(u).e("footer"))
}, [
Pr(E.$slots, "footer")
], 2)) : Fr("v-if", !0)
], 6));
}
});
var k3t = /* @__PURE__ */ Hn(C3t, [["__file", "dialog-content.vue"]]);
const I3t = Sn({
...AU,
appendToBody: Boolean,
appendTo: {
type: Gr([String, Object]),
default: "body"
},
beforeClose: {
type: Gr(Function)
},
destroyOnClose: Boolean,
closeOnClickModal: {
type: Boolean,
default: !0
},
closeOnPressEscape: {
type: Boolean,
default: !0
},
lockScroll: {
type: Boolean,
default: !0
},
modal: {
type: Boolean,
default: !0
},
openDelay: {
type: Number,
default: 0
},
closeDelay: {
type: Number,
default: 0
},
top: {
type: String
},
modelValue: Boolean,
modalClass: String,
width: {
type: [String, Number]
},
zIndex: {
type: Number
},
trapFocus: Boolean,
headerAriaLevel: {
type: String,
default: "2"
}
}), P3t = {
open: () => !0,
opened: () => !0,
close: () => !0,
closed: () => !0,
[Wo]: (t) => S4(t),
openAutoFocus: () => !0,
closeAutoFocus: () => !0
}, V3t = (t, e) => {
var r;
const i = G1().emit, { nextZIndex: o } = vS();
let s = "";
const a = U5(), u = U5(), d = Ie(!1), T = Ie(!1), f = Ie(!1), Q = Ie((r = t.zIndex) != null ? r : o());
let y, _;
const L = wg("namespace", eh), E = Kt(() => {
const oe = {}, re = `--${L.value}-dialog`;
return t.fullscreen || (t.top && (oe[`${re}-margin-top`] = t.top), t.width && (oe[`${re}-width`] = z5(t.width))), oe;
}), x = Kt(() => t.alignCenter ? { display: "flex" } : {});
function O() {
i("opened");
}
function k() {
i("closed"), i(Wo, !1), t.destroyOnClose && (f.value = !1);
}
function R() {
i("close");
}
function F() {
_ == null || _(), y == null || y(), t.openDelay && t.openDelay > 0 ? { stop: y } = hk(() => nt(), t.openDelay) : nt();
}
function U() {
y == null || y(), _ == null || _(), t.closeDelay && t.closeDelay > 0 ? { stop: _ } = hk(() => ct(), t.closeDelay) : ct();
}
function $() {
function oe(re) {
re || (T.value = !0, d.value = !1);
}
t.beforeClose ? t.beforeClose(oe) : U();
}
function et() {
t.closeOnClickModal && $();
}
function nt() {
s1 && (d.value = !0);
}
function ct() {
d.value = !1;
}
function rt() {
i("openAutoFocus");
}
function gt() {
i("closeAutoFocus");
}
function It(oe) {
var re;
((re = oe.detail) == null ? void 0 : re.focusReason) === "pointer" && oe.preventDefault();
}
t.lockScroll && vot(d);
function Zt() {
t.closeOnPressEscape && $();
}
return on(() => t.modelValue, (oe) => {
oe ? (T.value = !1, F(), f.value = !0, Q.value = mz(t.zIndex) ? o() : Q.value++, i1(() => {
i("open"), e.value && (e.value.scrollTop = 0);
})) : d.value && U();
}), on(() => t.fullscreen, (oe) => {
e.value && (oe ? (s = e.value.style.transform, e.value.style.transform = "") : e.value.style.transform = s);
}), W1(() => {
t.modelValue && (d.value = !0, f.value = !0, F());
}), {
afterEnter: O,
afterLeave: k,
beforeLeave: R,
handleClose: $,
onModalClick: et,
close: U,
doClose: ct,
onOpenAutoFocus: rt,
onCloseAutoFocus: gt,
onCloseRequested: Zt,
onFocusoutPrevented: It,
titleId: a,
bodyId: u,
closed: T,
style: E,
overlayDialogStyle: x,
rendered: f,
visible: d,
zIndex: Q
};
}, R3t = mr({
name: "ElDialog",
inheritAttrs: !1
}), N3t = /* @__PURE__ */ mr({
...R3t,
props: I3t,
emits: P3t,
setup(t, { expose: e }) {
const r = t, n = pg();
h8({
scope: "el-dialog",
from: "the title slot",
replacement: "the header slot",
version: "3.0.0",
ref: "https://element-plus.org/en-US/component/dialog.html#slots"
}, Kt(() => !!n.title));
const i = Bn("dialog"), o = Ie(), s = Ie(), a = Ie(), {
visible: u,
titleId: d,
bodyId: T,
style: f,
overlayDialogStyle: Q,
rendered: y,
zIndex: _,
afterEnter: L,
afterLeave: E,
beforeLeave: x,
handleClose: O,
onModalClick: k,
onOpenAutoFocus: R,
onCloseAutoFocus: F,
onCloseRequested: U,
onFocusoutPrevented: $
} = V3t(r, o);
$1(HU, {
dialogRef: o,
headerRef: s,
bodyId: T,
ns: i,
rendered: y,
style: f
});
const et = zz(k), nt = Kt(() => r.draggable && !r.fullscreen);
return e({
visible: u,
dialogContentRef: a,
resetPosition: () => {
var rt;
(rt = a.value) == null || rt.resetPosition();
}
}), (rt, gt) => (ce(), Or(vt(aU), {
to: rt.appendTo,
disabled: rt.appendTo !== "body" ? !1 : !rt.appendToBody
}, {
default: fe(() => [
Ce(cd, {
name: "dialog-fade",
onAfterEnter: vt(L),
onAfterLeave: vt(E),
onBeforeLeave: vt(x),
persisted: ""
}, {
default: fe(() => [
Ti(Ce(vt(H3t), {
"custom-mask-event": "",
mask: rt.modal,
"overlay-class": rt.modalClass,
"z-index": vt(_)
}, {
default: fe(() => [
je("div", {
role: "dialog",
"aria-modal": "true",
"aria-label": rt.title || void 0,
"aria-labelledby": rt.title ? void 0 : vt(d),
"aria-describedby": vt(T),
class: Be(`${vt(i).namespace.value}-overlay-dialog`),
style: M1(vt(Q)),
onClick: vt(et).onClick,
onMousedown: vt(et).onMousedown,
onMouseup: vt(et).onMouseup
}, [
Ce(vt(oU), {
loop: "",
trapped: vt(u),
"focus-start-el": "container",
onFocusAfterTrapped: vt(R),
onFocusAfterReleased: vt(F),
onFocusoutPrevented: vt($),
onReleaseRequested: vt(U)
}, {
default: fe(() => [
vt(y) ? (ce(), Or(k3t, rl({
key: 0,
ref_key: "dialogContentRef",
ref: a
}, rt.$attrs, {
center: rt.center,
"align-center": rt.alignCenter,
"close-icon": rt.closeIcon,
draggable: vt(nt),
overflow: rt.overflow,
fullscreen: rt.fullscreen,
"show-close": rt.showClose,
title: rt.title,
"aria-level": rt.headerAriaLevel,
onClose: vt(O)
}), Yj({
header: fe(() => [
rt.$slots.title ? Pr(rt.$slots, "title", { key: 1 }) : Pr(rt.$slots, "header", {
key: 0,
close: vt(O),
titleId: vt(d),
titleClass: vt(i).e("title")
})
]),
default: fe(() => [
Pr(rt.$slots, "default")
]),
_: 2
}, [
rt.$slots.footer ? {
name: "footer",
fn: fe(() => [
Pr(rt.$slots, "footer")
])
} : void 0
]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : Fr("v-if", !0)
]),
_: 3
}, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
]),
_: 3
}, 8, ["mask", "overlay-class", "z-index"]), [
[zo, vt(u)]
])
]),
_: 3
}, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
]),
_: 3
}, 8, ["to", "disabled"]));
}
});
var D3t = /* @__PURE__ */ Hn(N3t, [["__file", "dialog.vue"]]);
const F3t = v2(D3t), B3t = /* @__PURE__ */ mr({
inheritAttrs: !1
});
function j3t(t, e, r, n, i, o) {
return Pr(t.$slots, "default");
}
var z3t = /* @__PURE__ */ Hn(B3t, [["render", j3t], ["__file", "collection.vue"]]);
const U3t = /* @__PURE__ */ mr({
name: "ElCollectionItem",
inheritAttrs: !1
});
function G3t(t, e, r, n, i, o) {
return Pr(t.$slots, "default");
}
var $3t = /* @__PURE__ */ Hn(U3t, [["render", G3t], ["__file", "collection-item.vue"]]);
const W3t = "data-el-collection-item", Z3t = (t) => {
const e = `El${t}Collection`, r = `${e}Item`, n = Symbol(e), i = Symbol(r), o = {
...z3t,
name: e,
setup() {
const a = Ie(null), u = /* @__PURE__ */ new Map();
$1(n, {
itemMap: u,
getItems: () => {
const T = vt(a);
if (!T)
return [];
const f = Array.from(T.querySelectorAll(`[${W3t}]`));
return [...u.values()].sort((y, _) => f.indexOf(y.ref) - f.indexOf(_.ref));
},
collectionRef: a
});
}
}, s = {
...$3t,
name: r,
setup(a, { attrs: u }) {
const d = Ie(null), T = ln(n, void 0);
$1(i, {
collectionItemRef: d
}), W1(() => {
const f = vt(d);
f && T.itemMap.set(f, {
ref: f,
...u
});
}), Rs(() => {
const f = vt(d);
T.itemMap.delete(f);
});
}
};
return {
COLLECTION_INJECTION_KEY: n,
COLLECTION_ITEM_INJECTION_KEY: i,
ElCollection: o,
ElCollectionItem: s
};
}, bb = Sn({
trigger: Bh.trigger,
effect: {
...Z2.effect,
default: "light"
},
type: {
type: Gr(String)
},
placement: {
type: Gr(String),
default: "bottom"
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
id: String,
size: {
type: String,
default: ""
},
splitButton: Boolean,
hideOnClick: {
type: Boolean,
default: !0
},
loop: {
type: Boolean,
default: !0
},
showTimeout: {
type: Number,
default: 150
},
hideTimeout: {
type: Number,
default: 150
},
tabindex: {
type: Gr([Number, String]),
default: 0
},
maxHeight: {
type: Gr([Number, String]),
default: ""
},
popperClass: {
type: String,
default: ""
},
disabled: Boolean,
role: {
type: String,
default: "menu"
},
buttonProps: {
type: Gr(Object)
},
teleported: Z2.teleported
});
Sn({
command: {
type: [Object, String, Number],
default: () => ({})
},
disabled: Boolean,
divided: Boolean,
textValue: String,
icon: {
type: b8
}
});
Sn({
onKeydown: { type: Gr(Function) }
});
Z3t("Dropdown");
const OU = Symbol("ElSelectGroup"), Sg = Symbol("ElSelect");
function q3t(t, e) {
const r = ln(Sg), n = ln(OU, { disabled: !1 }), i = Kt(() => T(W6(r.props.modelValue), t.value)), o = Kt(() => {
var y;
if (r.props.multiple) {
const _ = W6((y = r.props.modelValue) != null ? y : []);
return !i.value && _.length >= r.props.multipleLimit && r.props.multipleLimit > 0;
} else
return !1;
}), s = Kt(() => t.label || (T2(t.value) ? "" : t.value)), a = Kt(() => t.value || t.label || ""), u = Kt(() => t.disabled || e.groupDisabled || o.value), d = G1(), T = (y = [], _) => {
if (T2(t.value)) {
const L = r.props.valueKey;
return y && y.some((E) => kh(T4(E, L)) === T4(_, L));
} else
return y && y.includes(_);
}, f = () => {
!t.disabled && !n.disabled && (r.states.hoveringIndex = r.optionsArray.indexOf(d.proxy));
}, Q = (y) => {
const _ = new RegExp(q1t(y), "i");
e.visible = _.test(s.value) || t.created;
};
return on(() => s.value, () => {
!t.created && !r.props.remote && r.setSelected();
}), on(() => t.value, (y, _) => {
const { remote: L, valueKey: E } = r.props;
if (y !== _ && (r.onOptionDestroy(_, d.proxy), r.onOptionCreate(d.proxy)), !t.created && !L) {
if (E && T2(y) && T2(_) && y[E] === _[E])
return;
r.setSelected();
}
}), on(() => n.disabled, () => {
e.groupDisabled = n.disabled;
}, { immediate: !0 }), {
select: r,
currentLabel: s,
currentValue: a,
itemSelected: i,
isDisabled: u,
hoverItem: f,
updateOption: Q
};
}
const X3t = mr({
name: "ElOption",
componentName: "ElOption",
props: {
value: {
required: !0,
type: [String, Number, Boolean, Object]
},
label: [String, Number],
created: Boolean,
disabled: Boolean
},
setup(t) {
const e = Bn("select"), r = U5(), n = Kt(() => [
e.be("dropdown", "item"),
e.is("disabled", vt(a)),
e.is("selected", vt(s)),
e.is("hovering", vt(Q))
]), i = u3({
index: -1,
groupDisabled: !1,
visible: !0,
hover: !1
}), {
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T
} = q3t(t, i), { visible: f, hover: Q } = s0(i), y = G1().proxy;
u.onOptionCreate(y), Rs(() => {
const L = y.value, { selected: E } = u.states, O = (u.props.multiple ? E : [E]).some((k) => k.value === y.value);
i1(() => {
u.states.cachedOptions.get(L) === y && !O && u.states.cachedOptions.delete(L);
}), u.onOptionDestroy(L, y);
});
function _() {
a.value || u.handleOptionSelect(y);
}
return {
ns: e,
id: r,
containerKls: n,
currentLabel: o,
itemSelected: s,
isDisabled: a,
select: u,
hoverItem: d,
updateOption: T,
visible: f,
hover: Q,
selectOptionClick: _,
states: i
};
}
});
function K3t(t, e, r, n, i, o) {
return Ti((ce(), Ye("li", {
id: t.id,
class: Be(t.containerKls),
role: "option",
"aria-disabled": t.isDisabled || void 0,
"aria-selected": t.itemSelected,
onMouseenter: t.hoverItem,
onClick: m1(t.selectOptionClick, ["stop"])
}, [
Pr(t.$slots, "default", {}, () => [
je("span", null, fi(t.currentLabel), 1)
])
], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
[zo, t.visible]
]);
}
var MS = /* @__PURE__ */ Hn(X3t, [["render", K3t], ["__file", "option.vue"]]);
const Y3t = mr({
name: "ElSelectDropdown",
componentName: "ElSelectDropdown",
setup() {
const t = ln(Sg), e = Bn("select"), r = Kt(() => t.props.popperClass), n = Kt(() => t.props.multiple), i = Kt(() => t.props.fitInputWidth), o = Ie("");
function s() {
var a;
o.value = `${(a = t.selectRef) == null ? void 0 : a.offsetWidth}px`;
}
return W1(() => {
s(), B6(t.selectRef, s);
}), {
ns: e,
minWidth: o,
popperClass: r,
isMultiple: n,
isFitInputWidth: i
};
}
});
function J3t(t, e, r, n, i, o) {
return ce(), Ye("div", {
class: Be([t.ns.b("dropdown"), t.ns.is("multiple", t.isMultiple), t.popperClass]),
style: M1({ [t.isFitInputWidth ? "width" : "minWidth"]: t.minWidth })
}, [
t.$slots.header ? (ce(), Ye("div", {
key: 0,
class: Be(t.ns.be("dropdown", "header"))
}, [
Pr(t.$slots, "header")
], 2)) : Fr("v-if", !0),
Pr(t.$slots, "default"),
t.$slots.footer ? (ce(), Ye("div", {
key: 1,
class: Be(t.ns.be("dropdown", "footer"))
}, [
Pr(t.$slots, "footer")
], 2)) : Fr("v-if", !0)
], 6);
}
var t4t = /* @__PURE__ */ Hn(Y3t, [["render", J3t], ["__file", "select-dropdown.vue"]]);
const e4t = 11, r4t = (t, e) => {
const { t: r } = uS(), n = U5(), i = Bn("select"), o = Bn("input"), s = u3({
inputValue: "",
options: /* @__PURE__ */ new Map(),
cachedOptions: /* @__PURE__ */ new Map(),
disabledOptions: /* @__PURE__ */ new Map(),
optionValues: [],
selected: [],
selectionWidth: 0,
calculatorWidth: 0,
collapseItemWidth: 0,
selectedLabel: "",
hoveringIndex: -1,
previousQuery: null,
inputHovering: !1,
menuVisibleOnFocus: !1,
isBeforeHide: !1
}), a = Ie(null), u = Ie(null), d = Ie(null), T = Ie(null), f = Ie(null), Q = Ie(null), y = Ie(null), _ = Ie(null), L = Ie(null), E = Ie(null), x = Ie(null), O = Ie(null), {
isComposing: k,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U
} = N2t({
afterComposition: (Rt) => c1(Rt)
}), { wrapperRef: $, isFocused: et } = R2t(f, {
beforeFocus() {
return re.value;
},
afterFocus() {
t.automaticDropdown && !nt.value && (nt.value = !0, s.menuVisibleOnFocus = !0);
},
beforeBlur(Rt) {
var Te, Se;
return ((Te = d.value) == null ? void 0 : Te.isFocusInsideContent(Rt)) || ((Se = T.value) == null ? void 0 : Se.isFocusInsideContent(Rt));
},
afterBlur() {
nt.value = !1, s.menuVisibleOnFocus = !1;
}
}), nt = Ie(!1), ct = Ie(), { form: rt, formItem: gt } = tc(), { inputId: It } = Eg(t, {
formItemContext: gt
}), { valueOnClear: Zt, isEmptyValue: oe } = z2t(t), re = Kt(() => t.disabled || (rt == null ? void 0 : rt.disabled)), Ve = Kt(() => p2(t.modelValue) ? t.modelValue.length > 0 : !oe(t.modelValue)), yr = Kt(() => t.clearable && !re.value && s.inputHovering && Ve.value), qr = Kt(() => t.remote && t.filterable && !t.remoteShowSuffix ? "" : t.suffixIcon), ie = Kt(() => i.is("reverse", qr.value && nt.value)), Qe = Kt(() => (gt == null ? void 0 : gt.validateState) || ""), Ke = Kt(() => uot[Qe.value]), He = Kt(() => t.remote ? 300 : 0), er = Kt(() => t.loading ? t.loadingText || r("el.select.loading") : t.remote && !s.inputValue && s.options.size === 0 ? !1 : t.filterable && s.inputValue && s.options.size > 0 && Je.value === 0 ? t.noMatchText || r("el.select.noMatch") : s.options.size === 0 ? t.noDataText || r("el.select.noData") : null), Je = Kt(() => Ne.value.filter((Rt) => Rt.visible).length), Ne = Kt(() => {
const Rt = Array.from(s.options.values()), Te = [];
return s.optionValues.forEach((Se) => {
const lr = Rt.findIndex((Ar) => Ar.value === Se);
lr > -1 && Te.push(Rt[lr]);
}), Te.length >= Rt.length ? Te : Rt;
}), Gt = Kt(() => Array.from(s.cachedOptions.values())), te = Kt(() => {
const Rt = Ne.value.filter((Te) => !Te.created).some((Te) => Te.currentLabel === s.inputValue);
return t.filterable && t.allowCreate && s.inputValue !== "" && !Rt;
}), me = () => {
t.filterable && Zo(t.filterMethod) || t.filterable && t.remote && Zo(t.remoteMethod) || Ne.value.forEach((Rt) => {
var Te;
(Te = Rt.updateOption) == null || Te.call(Rt, s.inputValue);
});
}, de = S8(), Ge = Kt(() => ["small"].includes(de.value) ? "small" : "default"), Tr = Kt({
get() {
return nt.value && er.value !== !1;
},
set(Rt) {
nt.value = Rt;
}
}), qe = Kt(() => {
if (t.multiple && !q6(t.modelValue))
return W6(t.modelValue).length === 0 && !s.inputValue;
const Rt = p2(t.modelValue) ? t.modelValue[0] : t.modelValue;
return t.filterable || q6(Rt) ? !s.inputValue : !0;
}), $e = Kt(() => {
var Rt;
const Te = (Rt = t.placeholder) != null ? Rt : r("el.select.placeholder");
return t.multiple || !Ve.value ? Te : s.selectedLabel;
}), ar = Kt(() => sx ? null : "mouseenter");
on(() => t.modelValue, (Rt, Te) => {
t.multiple && t.filterable && !t.reserveKeyword && (s.inputValue = "", Ct("")), Jr(), !NQ(Rt, Te) && t.validateEvent && (gt == null || gt.validate("change").catch((Se) => y2(Se)));
}, {
flush: "post",
deep: !0
}), on(() => nt.value, (Rt) => {
Rt ? Ct(s.inputValue) : (s.inputValue = "", s.previousQuery = null, s.isBeforeHide = !0), e("visible-change", Rt);
}), on(() => s.options.entries(), () => {
var Rt;
if (!s1)
return;
const Te = ((Rt = a.value) == null ? void 0 : Rt.querySelectorAll("input")) || [];
(!t.filterable && !t.defaultFirstOption && !q6(t.modelValue) || !Array.from(Te).includes(document.activeElement)) && Jr(), t.defaultFirstOption && (t.filterable || t.remote) && Je.value && en();
}, {
flush: "post"
}), on(() => s.hoveringIndex, (Rt) => {
ro(Rt) && Rt > -1 ? ct.value = Ne.value[Rt] || {} : ct.value = {}, Ne.value.forEach((Te) => {
Te.hover = ct.value === Te;
});
}), qj(() => {
s.isBeforeHide || me();
});
const Ct = (Rt) => {
s.previousQuery === Rt || k.value || (s.previousQuery = Rt, t.filterable && Zo(t.filterMethod) ? t.filterMethod(Rt) : t.filterable && t.remote && Zo(t.remoteMethod) && t.remoteMethod(Rt), t.defaultFirstOption && (t.filterable || t.remote) && Je.value ? i1(en) : i1(Rr));
}, en = () => {
const Rt = Ne.value.filter((lr) => lr.visible && !lr.disabled && !lr.states.groupDisabled), Te = Rt.find((lr) => lr.created), Se = Rt[0];
s.hoveringIndex = _r(Ne.value, Te || Se);
}, Jr = () => {
if (t.multiple)
s.selectedLabel = "";
else {
const Te = p2(t.modelValue) ? t.modelValue[0] : t.modelValue, Se = Hr(Te);
s.selectedLabel = Se.currentLabel, s.selected = [Se];
return;
}
const Rt = [];
q6(t.modelValue) || W6(t.modelValue).forEach((Te) => {
Rt.push(Hr(Te));
}), s.selected = Rt;
}, Hr = (Rt) => {
let Te;
const Se = hb(Rt).toLowerCase() === "object", lr = hb(Rt).toLowerCase() === "null", Ar = hb(Rt).toLowerCase() === "undefined";
for (let br = s.cachedOptions.size - 1; br >= 0; br--) {
const Br = Gt.value[br];
if (Se ? T4(Br.value, t.valueKey) === T4(Rt, t.valueKey) : Br.value === Rt) {
Te = {
value: Rt,
currentLabel: Br.currentLabel,
get isDisabled() {
return Br.isDisabled;
}
};
break;
}
}
if (Te)
return Te;
const vn = Se ? Rt.label : !lr && !Ar ? Rt : "";
return {
value: Rt,
currentLabel: vn
};
}, Rr = () => {
s.hoveringIndex = Ne.value.findIndex((Rt) => s.selected.some((Te) => At(Te) === At(Rt)));
}, dn = () => {
s.selectionWidth = u.value.getBoundingClientRect().width;
}, ji = () => {
s.calculatorWidth = Q.value.getBoundingClientRect().width;
}, Ji = () => {
s.collapseItemWidth = x.value.getBoundingClientRect().width;
}, ki = () => {
var Rt, Te;
(Te = (Rt = d.value) == null ? void 0 : Rt.updatePopper) == null || Te.call(Rt);
}, _i = () => {
var Rt, Te;
(Te = (Rt = T.value) == null ? void 0 : Rt.updatePopper) == null || Te.call(Rt);
}, Ii = () => {
s.inputValue.length > 0 && !nt.value && (nt.value = !0), Ct(s.inputValue);
}, c1 = (Rt) => {
if (s.inputValue = Rt.target.value, t.remote)
ye();
else
return Ii();
}, ye = z1t(() => {
Ii();
}, He.value), bi = (Rt) => {
NQ(t.modelValue, Rt) || e(cS, Rt);
}, Xn = (Rt) => U1t(Rt, (Te) => !s.disabledOptions.has(Te)), Hi = (Rt) => {
if (t.multiple && Rt.code !== Nh.delete && Rt.target.value.length <= 0) {
const Te = W6(t.modelValue).slice(), Se = Xn(Te);
if (Se < 0)
return;
const lr = Te[Se];
Te.splice(Se, 1), e(Wo, Te), bi(Te), e("remove-tag", lr);
}
}, t1 = (Rt, Te) => {
const Se = s.selected.indexOf(Te);
if (Se > -1 && !re.value) {
const lr = W6(t.modelValue).slice();
lr.splice(Se, 1), e(Wo, lr), bi(lr), e("remove-tag", Te.value);
}
Rt.stopPropagation(), Vi();
}, xe = (Rt) => {
Rt.stopPropagation();
const Te = t.multiple ? [] : Zt.value;
if (t.multiple)
for (const Se of s.selected)
Se.isDisabled && Te.push(Se.value);
e(Wo, Te), bi(Te), s.hoveringIndex = -1, nt.value = !1, e("clear"), Vi();
}, Dr = (Rt) => {
var Te;
if (t.multiple) {
const Se = W6((Te = t.modelValue) != null ? Te : []).slice(), lr = _r(Se, Rt.value);
lr > -1 ? Se.splice(lr, 1) : (t.multipleLimit <= 0 || Se.length < t.multipleLimit) && Se.push(Rt.value), e(Wo, Se), bi(Se), Rt.created && Ct(""), t.filterable && !t.reserveKeyword && (s.inputValue = "");
} else
e(Wo, Rt.value), bi(Rt.value), nt.value = !1;
Vi(), !nt.value && i1(() => {
Vn(Rt);
});
}, _r = (Rt = [], Te) => {
if (!T2(Te))
return Rt.indexOf(Te);
const Se = t.valueKey;
let lr = -1;
return Rt.some((Ar, vn) => kh(T4(Ar, Se)) === T4(Te, Se) ? (lr = vn, !0) : !1), lr;
}, Vn = (Rt) => {
var Te, Se, lr, Ar, vn;
const zr = p2(Rt) ? Rt[0] : Rt;
let br = null;
if (zr != null && zr.value) {
const Br = Ne.value.filter((cn) => cn.value === zr.value);
Br.length > 0 && (br = Br[0].$el);
}
if (d.value && br) {
const Br = (Ar = (lr = (Se = (Te = d.value) == null ? void 0 : Te.popperRef) == null ? void 0 : Se.contentRef) == null ? void 0 : lr.querySelector) == null ? void 0 : Ar.call(lr, `.${i.be("dropdown", "wrap")}`);
Br && Y1t(Br, br);
}
(vn = O.value) == null || vn.handleScroll();
}, y1 = (Rt) => {
s.options.set(Rt.value, Rt), s.cachedOptions.set(Rt.value, Rt), Rt.disabled && s.disabledOptions.set(Rt.value, Rt);
}, wr = (Rt, Te) => {
s.options.get(Rt) === Te && s.options.delete(Rt);
}, Pi = Kt(() => {
var Rt, Te;
return (Te = (Rt = d.value) == null ? void 0 : Rt.popperRef) == null ? void 0 : Te.contentRef;
}), H1 = () => {
s.isBeforeHide = !1, i1(() => Vn(s.selected));
}, Vi = () => {
var Rt;
(Rt = f.value) == null || Rt.focus();
}, Rn = () => {
var Rt;
(Rt = f.value) == null || Rt.blur();
}, xt = (Rt) => {
xe(Rt);
}, ot = () => {
nt.value = !1, et.value && Rn();
}, st = () => {
s.inputValue.length > 0 ? s.inputValue = "" : nt.value = !1;
}, pt = () => {
re.value || (sx && (s.inputHovering = !0), s.menuVisibleOnFocus ? s.menuVisibleOnFocus = !1 : nt.value = !nt.value);
}, yt = () => {
nt.value ? Ne.value[s.hoveringIndex] && Dr(Ne.value[s.hoveringIndex]) : pt();
}, At = (Rt) => T2(Rt.value) ? T4(Rt.value, t.valueKey) : Rt.value, Vt = Kt(() => Ne.value.filter((Rt) => Rt.visible).every((Rt) => Rt.disabled)), jt = Kt(() => t.multiple ? t.collapseTags ? s.selected.slice(0, t.maxCollapseTags) : s.selected : []), St = Kt(() => t.multiple ? t.collapseTags ? s.selected.slice(t.maxCollapseTags) : [] : []), Jt = (Rt) => {
if (!nt.value) {
nt.value = !0;
return;
}
if (!(s.options.size === 0 || s.filteredOptionsCount === 0 || k.value) && !Vt.value) {
Rt === "next" ? (s.hoveringIndex++, s.hoveringIndex === s.options.size && (s.hoveringIndex = 0)) : Rt === "prev" && (s.hoveringIndex--, s.hoveringIndex < 0 && (s.hoveringIndex = s.options.size - 1));
const Te = Ne.value[s.hoveringIndex];
(Te.disabled === !0 || Te.states.groupDisabled === !0 || !Te.visible) && Jt(Rt), i1(() => Vn(ct.value));
}
}, ae = () => {
if (!u.value)
return 0;
const Rt = window.getComputedStyle(u.value);
return Number.parseFloat(Rt.gap || "6px");
}, Xt = Kt(() => {
const Rt = ae();
return { maxWidth: `${x.value && t.maxCollapseTags === 1 ? s.selectionWidth - s.collapseItemWidth - Rt : s.selectionWidth}px` };
}), Le = Kt(() => ({ maxWidth: `${s.selectionWidth}px` })), or = Kt(() => ({
width: `${Math.max(s.calculatorWidth, e4t)}px`
}));
return B6(u, dn), B6(Q, ji), B6(L, ki), B6($, ki), B6(E, _i), B6(x, Ji), W1(() => {
Jr();
}), {
inputId: It,
contentId: n,
nsSelect: i,
nsInput: o,
states: s,
isFocused: et,
expanded: nt,
optionsArray: Ne,
hoverOption: ct,
selectSize: de,
filteredOptionsCount: Je,
resetCalculatorWidth: ji,
updateTooltip: ki,
updateTagTooltip: _i,
debouncedOnInputChange: ye,
onInput: c1,
deletePrevTag: Hi,
deleteTag: t1,
deleteSelected: xe,
handleOptionSelect: Dr,
scrollToOption: Vn,
hasModelValue: Ve,
shouldShowPlaceholder: qe,
currentPlaceholder: $e,
mouseEnterEventName: ar,
showClose: yr,
iconComponent: qr,
iconReverse: ie,
validateState: Qe,
validateIcon: Ke,
showNewOption: te,
updateOptions: me,
collapseTagSize: Ge,
setSelected: Jr,
selectDisabled: re,
emptyText: er,
handleCompositionStart: R,
handleCompositionUpdate: F,
handleCompositionEnd: U,
onOptionCreate: y1,
onOptionDestroy: wr,
handleMenuEnter: H1,
focus: Vi,
blur: Rn,
handleClearClick: xt,
handleClickOutside: ot,
handleEsc: st,
toggleMenu: pt,
selectOption: yt,
getValueKey: At,
navigateOptions: Jt,
dropdownMenuVisible: Tr,
showTagList: jt,
collapseTagList: St,
tagStyle: Xt,
collapseTagStyle: Le,
inputStyle: or,
popperRef: Pi,
inputRef: f,
tooltipRef: d,
tagTooltipRef: T,
calculatorRef: Q,
prefixRef: y,
suffixRef: _,
selectRef: a,
wrapperRef: $,
selectionRef: u,
scrollbarRef: O,
menuRef: L,
tagMenuRef: E,
collapseItemRef: x
};
};
var n4t = mr({
name: "ElOptions",
setup(t, { slots: e }) {
const r = ln(Sg);
let n = [];
return () => {
var i, o;
const s = (i = e.default) == null ? void 0 : i.call(e), a = [];
function u(d) {
p2(d) && d.forEach((T) => {
var f, Q, y, _;
const L = (f = (T == null ? void 0 : T.type) || {}) == null ? void 0 : f.name;
L === "ElOptionGroup" ? u(!sa(T.children) && !p2(T.children) && Zo((Q = T.children) == null ? void 0 : Q.default) ? (y = T.children) == null ? void 0 : y.default() : T.children) : L === "ElOption" ? a.push((_ = T.props) == null ? void 0 : _.value) : p2(T.children) && u(T.children);
});
}
return s.length && u((o = s[0]) == null ? void 0 : o.children), NQ(a, n) || (n = a, r && (r.states.optionValues = a)), s;
};
}
});
const i4t = Sn({
name: String,
id: String,
modelValue: {
type: [Array, String, Number, Boolean, Object],
default: void 0
},
autocomplete: {
type: String,
default: "off"
},
automaticDropdown: Boolean,
size: J8,
effect: {
type: Gr(String),
default: "light"
},
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperOptions: {
type: Gr(Object),
default: () => ({})
},
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String
},
defaultFirstOption: Boolean,
reserveKeyword: {
type: Boolean,
default: !0
},
valueKey: {
type: String,
default: "value"
},
collapseTags: Boolean,
collapseTagsTooltip: Boolean,
maxCollapseTags: {
type: Number,
default: 1
},
teleported: Z2.teleported,
persistent: {
type: Boolean,
default: !0
},
clearIcon: {
type: b8,
default: Lz
},
fitInputWidth: Boolean,
suffixIcon: {
type: b8,
default: lS
},
tagType: { ...vx.type, default: "info" },
tagEffect: { ...vx.effect, default: "light" },
validateEvent: {
type: Boolean,
default: !0
},
remoteShowSuffix: Boolean,
placement: {
type: Gr(String),
values: bg,
default: "bottom-start"
},
fallbackPlacements: {
type: Gr(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
appendTo: String,
...j2t,
...sl(["ariaLabel"])
}), LI = "ElSelect", o4t = mr({
name: LI,
componentName: LI,
components: {
ElSelectMenu: t4t,
ElOption: MS,
ElOptions: n4t,
ElTag: T3t,
ElScrollbar: hst,
ElTooltip: lU,
ElIcon: p3
},
directives: { ClickOutside: Dat },
props: i4t,
emits: [
Wo,
cS,
"remove-tag",
"clear",
"visible-change",
"focus",
"blur"
],
setup(t, { emit: e }) {
const r = Kt(() => {
const { modelValue: o, multiple: s } = t, a = s ? [] : void 0;
return p2(o) ? s ? o : a : s ? a : o;
}), n = u3({
...s0(t),
modelValue: r
}), i = r4t(n, e);
return $1(Sg, u3({
props: n,
states: i.states,
optionsArray: i.optionsArray,
handleOptionSelect: i.handleOptionSelect,
onOptionCreate: i.onOptionCreate,
onOptionDestroy: i.onOptionDestroy,
selectRef: i.selectRef,
setSelected: i.setSelected
})), {
...i,
modelValue: r
};
}
});
function s4t(t, e, r, n, i, o) {
const s = xs("el-tag"), a = xs("el-tooltip"), u = xs("el-icon"), d = xs("el-option"), T = xs("el-options"), f = xs("el-scrollbar"), Q = xs("el-select-menu"), y = bet("click-outside");
return Ti((ce(), Ye("div", {
ref: "selectRef",
class: Be([t.nsSelect.b(), t.nsSelect.m(t.selectSize)]),
[Let(t.mouseEnterEventName)]: (_) => t.states.inputHovering = !0,
onMouseleave: (_) => t.states.inputHovering = !1
}, [
Ce(a, {
ref: "tooltipRef",
visible: t.dropdownMenuVisible,
placement: t.placement,
teleported: t.teleported,
"popper-class": [t.nsSelect.e("popper"), t.popperClass],
"popper-options": t.popperOptions,
"fallback-placements": t.fallbackPlacements,
effect: t.effect,
pure: "",
trigger: "click",
transition: `${t.nsSelect.namespace.value}-zoom-in-top`,
"stop-popper-mouse-event": !1,
"gpu-acceleration": !1,
persistent: t.persistent,
"append-to": t.appendTo,
onBeforeShow: t.handleMenuEnter,
onHide: (_) => t.states.isBeforeHide = !1
}, {
default: fe(() => {
var _;
return [
je("div", {
ref: "wrapperRef",
class: Be([
t.nsSelect.e("wrapper"),
t.nsSelect.is("focused", t.isFocused),
t.nsSelect.is("hovering", t.states.inputHovering),
t.nsSelect.is("filterable", t.filterable),
t.nsSelect.is("disabled", t.selectDisabled)
]),
onClick: m1(t.toggleMenu, ["prevent"])
}, [
t.$slots.prefix ? (ce(), Ye("div", {
key: 0,
ref: "prefixRef",
class: Be(t.nsSelect.e("prefix"))
}, [
Pr(t.$slots, "prefix")
], 2)) : Fr("v-if", !0),
je("div", {
ref: "selectionRef",
class: Be([
t.nsSelect.e("selection"),
t.nsSelect.is("near", t.multiple && !t.$slots.prefix && !!t.states.selected.length)
])
}, [
t.multiple ? Pr(t.$slots, "tag", { key: 0 }, () => [
(ce(!0), Ye(to, null, t3(t.showTagList, (L) => (ce(), Ye("div", {
key: t.getValueKey(L),
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
closable: !t.selectDisabled && !L.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: M1(t.tagStyle),
onClose: (E) => t.deleteTag(E, L)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
Pr(t.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
xn(fi(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
], 2))), 128)),
t.collapseTags && t.states.selected.length > t.maxCollapseTags ? (ce(), Or(a, {
key: 0,
ref: "tagTooltipRef",
disabled: t.dropdownMenuVisible || !t.collapseTagsTooltip,
"fallback-placements": ["bottom", "top", "right", "left"],
effect: t.effect,
placement: "bottom",
teleported: t.teleported
}, {
default: fe(() => [
je("div", {
ref: "collapseItemRef",
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
closable: !1,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
style: M1(t.collapseTagStyle)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, " + " + fi(t.states.selected.length - t.maxCollapseTags), 3)
]),
_: 1
}, 8, ["size", "type", "effect", "style"])
], 2)
]),
content: fe(() => [
je("div", {
ref: "tagMenuRef",
class: Be(t.nsSelect.e("selection"))
}, [
(ce(!0), Ye(to, null, t3(t.collapseTagList, (L) => (ce(), Ye("div", {
key: t.getValueKey(L),
class: Be(t.nsSelect.e("selected-item"))
}, [
Ce(s, {
class: "in-tooltip",
closable: !t.selectDisabled && !L.isDisabled,
size: t.collapseTagSize,
type: t.tagType,
effect: t.tagEffect,
"disable-transitions": "",
onClose: (E) => t.deleteTag(E, L)
}, {
default: fe(() => [
je("span", {
class: Be(t.nsSelect.e("tags-text"))
}, [
Pr(t.$slots, "label", {
label: L.currentLabel,
value: L.value
}, () => [
xn(fi(L.currentLabel), 1)
])
], 2)
]),
_: 2
}, 1032, ["closable", "size", "type", "effect", "onClose"])
], 2))), 128))
], 2)
]),
_: 3
}, 8, ["disabled", "effect", "teleported"])) : Fr("v-if", !0)
]) : Fr("v-if", !0),
t.selectDisabled ? Fr("v-if", !0) : (ce(), Ye("div", {
key: 1,
class: Be([
t.nsSelect.e("selected-item"),
t.nsSelect.e("input-wrapper"),
t.nsSelect.is("hidden", !t.filterable)
])
}, [
Ti(je("input", {
id: t.inputId,
ref: "inputRef",
"onUpdate:modelValue": (L) => t.states.inputValue = L,
type: "text",
name: t.name,
class: Be([t.nsSelect.e("input"), t.nsSelect.is(t.selectSize)]),
disabled: t.selectDisabled,
autocomplete: t.autocomplete,
style: M1(t.inputStyle),
role: "combobox",
readonly: !t.filterable,
spellcheck: "false",
"aria-activedescendant": ((_ = t.hoverOption) == null ? void 0 : _.id) || "",
"aria-controls": t.contentId,
"aria-expanded": t.dropdownMenuVisible,
"aria-label": t.ariaLabel,
"aria-autocomplete": "none",
"aria-haspopup": "listbox",
onKeydown: [
au(m1((L) => t.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
au(m1((L) => t.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
au(m1(t.handleEsc, ["stop", "prevent"]), ["esc"]),
au(m1(t.selectOption, ["stop", "prevent"]), ["enter"]),
au(m1(t.deletePrevTag, ["stop"]), ["delete"])
],
onCompositionstart: t.handleCompositionStart,
onCompositionupdate: t.handleCompositionUpdate,
onCompositionend: t.handleCompositionEnd,
onInput: t.onInput,
onClick: m1(t.toggleMenu, ["stop"])
}, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
[wet, t.states.inputValue]
]),
t.filterable ? (ce(), Ye("span", {
key: 0,
ref: "calculatorRef",
"aria-hidden": "true",
class: Be(t.nsSelect.e("input-calculator")),
textContent: fi(t.states.inputValue)
}, null, 10, ["textContent"])) : Fr("v-if", !0)
], 2)),
t.shouldShowPlaceholder ? (ce(), Ye("div", {
key: 2,
class: Be([
t.nsSelect.e("selected-item"),
t.nsSelect.e("placeholder"),
t.nsSelect.is("transparent", !t.hasModelValue || t.expanded && !t.states.inputValue)
])
}, [
t.hasModelValue ? Pr(t.$slots, "label", {
key: 0,
label: t.currentPlaceholder,
value: t.modelValue
}, () => [
je("span", null, fi(t.currentPlaceholder), 1)
]) : (ce(), Ye("span", { key: 1 }, fi(t.currentPlaceholder), 1))
], 2)) : Fr("v-if", !0)
], 2),
je("div", {
ref: "suffixRef",
class: Be(t.nsSelect.e("suffix"))
}, [
t.iconComponent && !t.showClose ? (ce(), Or(u, {
key: 0,
class: Be([t.nsSelect.e("caret"), t.nsSelect.e("icon"), t.iconReverse])
}, {
default: fe(() => [
(ce(), Or(Ss(t.iconComponent)))
]),
_: 1
}, 8, ["class"])) : Fr("v-if", !0),
t.showClose && t.clearIcon ? (ce(), Or(u, {
key: 1,
class: Be([
t.nsSelect.e("caret"),
t.nsSelect.e("icon"),
t.nsSelect.e("clear")
]),
onClick: t.handleClearClick
}, {
default: fe(() => [
(ce(), Or(Ss(t.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : Fr("v-if", !0),
t.validateState && t.validateIcon ? (ce(), Or(u, {
key: 2,
class: Be([t.nsInput.e("icon"), t.nsInput.e("validateIcon")])
}, {
default: fe(() => [
(ce(), Or(Ss(t.validateIcon)))
]),
_: 1
}, 8, ["class"])) : Fr("v-if", !0)
], 2)
], 10, ["onClick"])
];
}),
content: fe(() => [
Ce(Q, { ref: "menuRef" }, {
default: fe(() => [
t.$slots.header ? (ce(), Ye("div", {
key: 0,
class: Be(t.nsSelect.be("dropdown", "header")),
onClick: m1(() => {
}, ["stop"])
}, [
Pr(t.$slots, "header")
], 10, ["onClick"])) : Fr("v-if", !0),
Ti(Ce(f, {
id: t.contentId,
ref: "scrollbarRef",
tag: "ul",
"wrap-class": t.nsSelect.be("dropdown", "wrap"),
"view-class": t.nsSelect.be("dropdown", "list"),
class: Be([t.nsSelect.is("empty", t.filteredOptionsCount === 0)]),
role: "listbox",
"aria-label": t.ariaLabel,
"aria-orientation": "vertical"
}, {
default: fe(() => [
t.showNewOption ? (ce(), Or(d, {
key: 0,
value: t.states.inputValue,
created: !0
}, null, 8, ["value"])) : Fr("v-if", !0),
Ce(T, null, {
default: fe(() => [
Pr(t.$slots, "default")
]),
_: 3
})
]),
_: 3
}, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
[zo, t.states.options.size > 0 && !t.loading]
]),
t.$slots.loading && t.loading ? (ce(), Ye("div", {
key: 1,
class: Be(t.nsSelect.be("dropdown", "loading"))
}, [
Pr(t.$slots, "loading")
], 2)) : t.loading || t.filteredOptionsCount === 0 ? (ce(), Ye("div", {
key: 2,
class: Be(t.nsSelect.be("dropdown", "empty"))
}, [
Pr(t.$slots, "empty", {}, () => [
je("span", null, fi(t.emptyText), 1)
])
], 2)) : Fr("v-if", !0),
t.$slots.footer ? (ce(), Ye("div", {
key: 3,
class: Be(t.nsSelect.be("dropdown", "footer")),
onClick: m1(() => {
}, ["stop"])
}, [
Pr(t.$slots, "footer")
], 10, ["onClick"])) : Fr("v-if", !0)
]),
_: 3
}, 512)
]),
_: 3
}, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"])
], 16, ["onMouseleave"])), [
[y, t.handleClickOutside, t.popperRef]
]);
}
var a4t = /* @__PURE__ */ Hn(o4t, [["render", s4t], ["__file", "select.vue"]]);
const l4t = mr({
name: "ElOptionGroup",
componentName: "ElOptionGroup",
props: {
label: String,
disabled: Boolean
},
setup(t) {
const e = Bn("select"), r = Ie(null), n = G1(), i = Ie([]);
$1(OU, u3({
...s0(t)
}));
const o = Kt(() => i.value.some((d) => d.visible === !0)), s = (d) => {
var T, f;
return ((T = d.type) == null ? void 0 : T.name) === "ElOption" && !!((f = d.component) != null && f.proxy);
}, a = (d) => {
const T = W6(d), f = [];
return T.forEach((Q) => {
var y, _;
s(Q) ? f.push(Q.component.proxy) : (y = Q.children) != null && y.length ? f.push(...a(Q.children)) : (_ = Q.component) != null && _.subTree && f.push(...a(Q.component.subTree));
}), f;
}, u = () => {
i.value = a(n.subTree);
};
return W1(() => {
u();
}), Get(r, u, {
attributes: !0,
subtree: !0,
childList: !0
}), {
groupRef: r,
visible: o,
ns: e
};
}
});
function c4t(t, e, r, n, i, o) {
return Ti((ce(), Ye("ul", {
ref: "groupRef",
class: Be(t.ns.be("group", "wrap"))
}, [
je("li", {
class: Be(t.ns.be("group", "title"))
}, fi(t.label), 3),
je("li", null, [
je("ul", {
class: Be(t.ns.b("group"))
}, [
Pr(t.$slots, "default")
], 2)
])
], 2)), [
[zo, t.visible]
]);
}
var CU = /* @__PURE__ */ Hn(l4t, [["render", c4t], ["__file", "option-group.vue"]]);
const Hg = v2(a4t, {
Option: MS,
OptionGroup: CU
}), SS = ol(MS);
ol(CU);
const u4t = Sn({
trigger: Bh.trigger,
placement: bb.placement,
disabled: Bh.disabled,
visible: Z2.visible,
transition: Z2.transition,
popperOptions: bb.popperOptions,
tabindex: bb.tabindex,
content: Z2.content,
popperStyle: Z2.popperStyle,
popperClass: Z2.popperClass,
enterable: {
...Z2.enterable,
default: !0
},
effect: {
...Z2.effect,
default: "light"
},
teleported: Z2.teleported,
title: String,
width: {
type: [String, Number],
default: 150
},
offset: {
type: Number,
default: void 0
},
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
},
showArrow: {
type: Boolean,
default: !0
},
persistent: {
type: Boolean,
default: !0
},
"onUpdate:visible": {
type: Function
}
}), h4t = {
"update:visible": (t) => S4(t),
"before-enter": () => !0,
"before-leave": () => !0,
"after-enter": () => !0,
"after-leave": () => !0
}, d4t = "onUpdate:visible", p4t = mr({
name: "ElPopover"
}), T4t = /* @__PURE__ */ mr({
...p4t,
props: u4t,
emits: h4t,
setup(t, { expose: e, emit: r }) {
const n = t, i = Kt(() => n[d4t]), o = Bn("popover"), s = Ie(), a = Kt(() => {
var E;
return (E = vt(s)) == null ? void 0 : E.popperRef;
}), u = Kt(() => [
{
width: z5(n.width)
},
n.popperStyle
]), d = Kt(() => [o.b(), n.popperClass, { [o.m("plain")]: !!n.content }]), T = Kt(() => n.transition === `${o.namespace.value}-fade-in-linear`), f = () => {
var E;
(E = s.value) == null || E.hide();
}, Q = () => {
r("before-enter");
}, y = () => {
r("before-leave");
}, _ = () => {
r("after-enter");
}, L = () => {
r("update:visible", !1), r("after-leave");
};
return e({
popperRef: a,
hide: f
}), (E, x) => (ce(), Or(vt(lU), rl({
ref_key: "tooltipRef",
ref: s
}, E.$attrs, {
trigger: E.trigger,
placement: E.placement,
disabled: E.disabled,
visible: E.visible,
transition: E.transition,
"popper-options": E.popperOptions,
tabindex: E.tabindex,
content: E.content,
offset: E.offset,
"show-after": E.showAfter,
"hide-after": E.hideAfter,
"auto-close": E.autoClose,
"show-arrow": E.showArrow,
"aria-label": E.title,
effect: E.effect,
enterable: E.enterable,
"popper-class": vt(d),
"popper-style": vt(u),
teleported: E.teleported,
persistent: E.persistent,
"gpu-acceleration": vt(T),
"onUpdate:visible": vt(i),
onBeforeShow: Q,
onBeforeHide: y,
onShow: _,
onHide: L
}), {
content: fe(() => [
E.title ? (ce(), Ye("div", {
key: 0,
class: Be(vt(o).e("title")),
role: "title"
}, fi(E.title), 3)) : Fr("v-if", !0),
Pr(E.$slots, "default", {}, () => [
xn(fi(E.content), 1)
])
]),
default: fe(() => [
E.$slots.reference ? Pr(E.$slots, "reference", { key: 0 }) : Fr("v-if", !0)
]),
_: 3
}, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]));
}
});
var f4t = /* @__PURE__ */ Hn(T4t, [["__file", "popover.vue"]]);
const wI = (t, e) => {
const r = e.arg || e.value, n = r == null ? void 0 : r.popperRef;
n && (n.triggerRef = t);
};
var Q4t = {
mounted(t, e) {
wI(t, e);
},
updated(t, e) {
wI(t, e);
}
};
const m4t = "popover", kU = hot(Q4t, m4t), Ag = v2(f4t, {
directive: kU
});
function g4t(t) {
let e;
const r = Ie(!1), n = u3({
...t,
originalPosition: "",
originalOverflow: "",
visible: !1
});
function i(Q) {
n.text = Q;
}
function o() {
const Q = n.parent, y = f.ns;
if (!Q.vLoadingAddClassList) {
let _ = Q.getAttribute("loading-number");
_ = Number.parseInt(_) - 1, _ ? Q.setAttribute("loading-number", _.toString()) : (Rh(Q, y.bm("parent", "relative")), Q.removeAttribute("loading-number")), Rh(Q, y.bm("parent", "hidden"));
}
s(), T.unmount();
}
function s() {
var Q, y;
(y = (Q = f.$el) == null ? void 0 : Q.parentNode) == null || y.removeChild(f.$el);
}
function a() {
var Q;
t.beforeClose && !t.beforeClose() || (r.value = !0, clearTimeout(e), e = setTimeout(u, 400), n.visible = !1, (Q = t.closed) == null || Q.call(t));
}
function u() {
if (!r.value)
return;
const Q = n.parent;
r.value = !1, Q.vLoadingAddClassList = void 0, o();
}
const d = mr({
name: "ElLoading",
setup(Q, { expose: y }) {
const { ns: _, zIndex: L } = G2t("loading");
return y({
ns: _,
zIndex: L
}), () => {
const E = n.spinner || n.svg, x = b7("svg", {
class: "circular",
viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50",
...E ? { innerHTML: E } : {}
}, [
b7("circle", {
class: "path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
]), O = n.text ? b7("p", { class: _.b("text") }, [n.text]) : void 0;
return b7(cd, {
name: _.b("fade"),
onAfterLeave: u
}, {
default: fe(() => [
Ti(Ce("div", {
style: {
backgroundColor: n.background || ""
},
class: [
_.b("mask"),
n.customClass,
n.fullscreen ? "is-fullscreen" : ""
]
}, [
b7("div", {
class: _.b("spinner")
}, [x, O])
]), [[zo, n.visible]])
])
});
};
}
}), T = xet(d), f = T.mount(document.createElement("div"));
return {
...s0(n),
setText: i,
removeElLoadingChild: s,
close: a,
handleAfterLeave: u,
vm: f,
get $el() {
return f.$el;
}
};
}
let tT;
const _x = function(t = {}) {
if (!s1)
return;
const e = y4t(t);
if (e.fullscreen && tT)
return tT;
const r = g4t({
...e,
closed: () => {
var i;
(i = e.closed) == null || i.call(e), e.fullscreen && (tT = void 0);
}
});
v4t(e, e.parent, r), xI(e, e.parent, r), e.parent.vLoadingAddClassList = () => xI(e, e.parent, r);
let n = e.parent.getAttribute("loading-number");
return n ? n = `${Number.parseInt(n) + 1}` : n = "1", e.parent.setAttribute("loading-number", n), e.parent.appendChild(r.$el), i1(() => r.visible.value = e.visible), e.fullscreen && (tT = r), r;
}, y4t = (t) => {
var e, r, n, i;
let o;
return sa(t.target) ? o = (e = document.querySelector(t.target)) != null ? e : document.body : o = t.target || document.body, {
parent: o === document.body || t.body ? document.body : o,
background: t.background || "",
svg: t.svg || "",
svgViewBox: t.svgViewBox || "",
spinner: t.spinner || !1,
text: t.text || "",
fullscreen: o === document.body && ((r = t.fullscreen) != null ? r : !0),
lock: (n = t.lock) != null ? n : !1,
customClass: t.customClass || "",
visible: (i = t.visible) != null ? i : !0,
beforeClose: t.beforeClose,
closed: t.closed,
target: o
};
}, v4t = async (t, e, r) => {
const { nextZIndex: n } = r.vm.zIndex || r.vm._.exposed.zIndex, i = {};
if (t.fullscreen)
r.originalPosition.value = L7(document.body, "position"), r.originalOverflow.value = L7(document.body, "overflow"), i.zIndex = n();
else if (t.parent === document.body) {
r.originalPosition.value = L7(document.body, "position"), await i1();
for (const o of ["top", "left"]) {
const s = o === "top" ? "scrollTop" : "scrollLeft";
i[o] = `${t.target.getBoundingClientRect()[o] + document.body[s] + document.documentElement[s] - Number.parseInt(L7(document.body, `margin-${o}`), 10)}px`;
}
for (const o of ["height", "width"])
i[o] = `${t.target.getBoundingClientRect()[o]}px`;
} else
r.originalPosition.value = L7(e, "position");
for (const [o, s] of Object.entries(i))
r.$el.style[o] = s;
}, xI = (t, e, r) => {
const n = r.vm.ns || r.vm._.exposed.ns;
["absolute", "fixed", "sticky"].includes(r.originalPosition.value) ? Rh(e, n.bm("parent", "relative")) : px(e, n.bm("parent", "relative")), t.fullscreen && t.lock ? px(e, n.bm("parent", "hidden")) : Rh(e, n.bm("parent", "hidden"));
}, mf = Symbol("ElLoading"), EI = (t, e) => {
var r, n, i, o;
const s = e.instance, a = (Q) => T2(e.value) ? e.value[Q] : void 0, u = (Q) => {
const y = sa(Q) && (s == null ? void 0 : s[Q]) || Q;
return y && Ie(y);
}, d = (Q) => u(a(Q) || t.getAttribute(`element-loading-${nrt(Q)}`)), T = (r = a("fullscreen")) != null ? r : e.modifiers.fullscreen, f = {
text: d("text"),
svg: d("svg"),
svgViewBox: d("svgViewBox"),
spinner: d("spinner"),
background: d("background"),
customClass: d("customClass"),
fullscreen: T,
target: (n = a("target")) != null ? n : T ? void 0 : t,
body: (i = a("body")) != null ? i : e.modifiers.body,
lock: (o = a("lock")) != null ? o : e.modifiers.lock
};
t[mf] = {
options: f,
instance: _x(f)
};
}, _4t = (t, e) => {
for (const r of Object.keys(e))
g2(e[r]) && (e[r].value = t[r]);
}, bx = {
mounted(t, e) {
e.value && EI(t, e);
},
updated(t, e) {
const r = t[mf];
e.oldValue !== e.value && (e.value && !e.oldValue ? EI(t, e) : e.value && e.oldValue ? T2(e.value) && _4t(e.value, r.options) : r == null || r.instance.close());
},
unmounted(t) {
var e;
(e = t[mf]) == null || e.instance.close(), t[mf] = null;
}
}, b4t = {
install(t) {
t.directive("loading", bx), t.config.globalProperties.$loading = _x;
},
directive: bx,
service: _x
}, Og = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, i] of e)
r[n] = i;
return r;
}, L4t = {
name: "SelectionsGroup",
components: {
Checkbox: gU,
CheckboxGroup: yU,
Col: fd,
Icon: p3,
Row: Td,
ElIconWarning: Ez
},
methods: {
/**
* Function to toggle paths to default.
* Also called when the associated button is pressed.
*/
reset: function() {
this.checkAll = !0, this.checkedItems = [], this.selections.forEach((t) => {
!("enabled" in t) || t.enabled === !0 ? this.checkedItems.push(t[this.identifierKey]) : this.checkAll = !1;
});
},
setCheckboxActionData: function(t, e) {
if (t) {
const r = t.querySelector('input[type="checkbox"]'), n = t.querySelector(".el-checkbox__label"), o = t.closest(".selections-container").querySelector(".checkall-display-text");
let s = "";
r && (s = r.checked ? "checked" : "unchecked"), this.checkboxActionData = {
selectionsTitle: o ? o.innerText : "",
property: r && e !== "all" ? r.value : "",
label: n ? n.innerText : "",
checked: s
};
} else
this.checkboxActionData = {
selectionsTitle: "",
property: "",
label: "",
checked: ""
};
},
onCheckboxNativeChange: function(t) {
const e = t.target.closest(".checkbox-container");
this.setCheckboxActionData(e, "individual");
},
onAllCheckboxNativeChange: function(t) {
const e = t.target.closest(".all-checkbox");
this.setCheckboxActionData(e, "all");
},
visibilityToggle: function(t, e) {
this.$emit("changed", { key: t, value: e }), t === this.checkboxActionData.property && (this.checkboxActionData.checked = e ? "checked" : "unchecked"), this.$emit("selections-data-changed", this.checkboxActionData);
},
checkboxMouseEnterEmit: function(t, e) {
this.$emit("checkboxMouseEnter", { key: t, value: e, selections: this.selections, checked: this.checkedItems });
},
handleCheckedItemsChange: function(t) {
let e = t.length;
this.checkAll = e === this.selections.length;
},
handleCheckAllChange: function(t) {
this.checkedItems = t ? this.selections.map((e) => e[this.identifierKey]) : [], this.$emit("checkAll", {
keys: this.selections.map((e) => e[this.identifierKey]),
value: t
}), this.checkboxActionData.property = this.identifierKey, this.checkboxActionData.checked = t ? "checked" : "unchecked", this.$emit("selections-data-changed", this.checkboxActionData);
},
getBackgroundStyles: function(t) {
return "colour" in t && this.colourStyle === "background" ? { background: t.colour } : {};
},
getState: function() {
const e = this.checkedItems.length === this.selections.length;
return {
checkAll: e,
checked: e ? [] : this.checkedItems
};
},
setState: function(t) {
var e;
if (this.checkAll = t.checkAll, this.checkedItems.length = 0, (e = t.checked) != null && e.length)
this.checkedItems.push(...t.checked), this.selections.forEach((r) => {
const n = r[this.identifierKey];
this.$emit("changed", { key: n, value: this.checkedItems.includes(n) });
});
else {
const r = this.selections.map((i) => i[this.identifierKey]);
let n = !1;
this.checkAll && (n = !0, this.checkedItems.push(...r)), this.$emit("checkAll", { keys: r, value: n });
}
},
hasLineStyles: function(t) {
return "colour" in t && this.colourStyle === "line";
},
getLineStyles: function(t) {
return "colour" in t && this.colourStyle === "line" ? "dashed" in t && t.dashed === !0 ? { background: `repeating-linear-gradient(90deg,${t.colour},${t.colour} 6px,transparent 0,transparent 9px)` } : { background: t.colour } : { display: "None" };
}
},
props: {
colourStyle: {
type: String,
default: "line"
},
helpMessage: {
type: String,
default: ""
},
identifierKey: {
type: String,
default: "id"
},
labelKey: {
type: String,
default: "label"
},
title: {
type: String,
default: ""
},
selections: {
type: Array,
default: function() {
return [];
}
}
},
computed: {
isIndeterminate: function() {
return !(this.checkedItems.length === 0 || this.checkAll);
}
},
data: function() {
return {
checkedItems: [],
checkAll: !0,
checkboxActionData: {
selectionsTitle: "",
property: "",
label: "",
checked: ""
}
};
},
mounted: function() {
this.reset();
}
}, w4t = { class: "selections-container" }, x4t = { class: "checkall-display-text" }, E4t = { style: { "word-break": "keep-all" } }, M4t = { class: "checkbox-group-inner" }, S4t = ["onMouseenter", "onMouseleave"];
function H4t(t, e, r, n, i, o) {
const s = Ez, a = p3, u = Ag, d = fd, T = gU, f = Td, Q = yU;
return ce(), Ye("div", w4t, [
Ce(f, null, {
default: fe(() => [
Ce(d, { span: 12 }, {
default: fe(() => [
je("span", x4t, fi(r.title), 1),
r.helpMessage ? (ce(), Or(u, {
key: 0,
width: "250",
trigger: "hover",
teleported: !1,
"popper-class": "popover-origin-help"
}, Yj({
default: fe(() => [
je("span", E4t, fi(r.helpMessage), 1)
]),
_: 2
}, [
r.helpMessage ? {
name: "reference",
fn: fe(() => [
Ce(a, { class: "info" }, {
default: fe(() => [
Ce(s)
]),
_: 1
})
]),
key: "0"
} : void 0
]), 1024)) : Fr("", !0)
]),
_: 1
}),
Ce(d, { span: 12 }, {
default: fe(() => [
r.selections && r.selections.length > 1 ? (ce(), Or(T, {
key: 0,
class: "all-checkbox",
indeterminate: o.isIndeterminate,
modelValue: t.checkAll,
"onUpdate:modelValue": e[0] || (e[0] = (y) => t.checkAll = y),
onChange: o.handleCheckAllChange,
onClick: o.onAllCheckboxNativeChange
}, {
default: fe(() => [
xn("Display all")
]),
_: 1
}, 8, ["indeterminate", "modelValue", "onChange", "onClick"])) : Fr("", !0)
]),
_: 1
})
]),
_: 1
}),
Ce(Q, {
modelValue: t.checkedItems,
"onUpdate:modelValue": e[1] || (e[1] = (y) => t.checkedItems = y),
size: "small",
class: "checkbox-group",
onChange: o.handleCheckedItemsChange
}, {
default: fe(() => [
je("div", M4t, [
(ce(!0), Ye(to, null, t3(r.selections, (y) => (ce(), Or(f, {
key: y[r.identifierKey],
label: y[r.identifierKey]
}, {
default: fe(() => [
je("div", {
class: "checkbox-container",
onMouseenter: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], !0),
onMouseleave: (_) => o.checkboxMouseEnterEmit(y[r.identifierKey], !1)
}, [
Ce(T, {
class: "my-checkbox",
label: y[r.identifierKey],
value: y[r.identifierKey],
onChange: (_) => o.visibilityToggle(y[r.identifierKey], _),
onClick: o.onCheckboxNativeChange,
checked: !("enabled" in y) || y.enabled === !0
}, {
default: fe(() => [
Ce(f, { class: "checkbox-row" }, {
default: fe(() => [
o.hasLineStyles(y) ? (ce(), Or(d, {
key: 0,
span: 4
}, {
default: fe(() => [
je("div", {
class: "path-visual",
style: M1(o.getLineStyles(y))
}, null, 4)
]),
_: 2
}, 1024)) : Fr("", !0),
Ce(d, { span: 20 }, {
default: fe(() => [
je("div", {
style: M1(o.getBackgroundStyles(y))
}, fi(y[r.labelKey]), 5)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["label", "value", "onChange", "onClick", "checked"])
], 40, S4t)
]),
_: 2
}, 1032, ["label"]))), 128))
])
]),
_: 1
}, 8, ["modelValue", "onChange"])
]);
}
const IU = /* @__PURE__ */ Og(L4t, [["render", H4t], ["__scopeId", "data-v-fb8c9eee"]]), A4t = {
name: "SvgLegends"
}, O4t = (t) => (KM("data-v-88079d87"), t = t(), YM(), t), C4t = { class: "legends-container" }, k4t = {
version: "1.1",
id: "Layer_1",
x: "0px",
y: "0px",
viewBox: "0 0 500 500",
style: { "enable-background": "new 0 0 500 500" },
xmlns: "http://www.w3.org/2000/svg",
"xmlns:bx": "https://boxy-svg.com"
}, I4t = /* @__PURE__ */ Eet(' Tissue region Brain nuclei Ganglia Ganglionated nerve plexus ', 9), P4t = [
I4t
], V4t = /* @__PURE__ */ O4t(() => /* @__PURE__ */ je("svg", {
width: "72px",
height: "72px",
viewBox: "0 0 24 24",
fill: "yellow"
}, null, -1));
function R4t(t, e, r, n, i, o) {
return ce(), Ye("div", C4t, [
(ce(), Ye("svg", k4t, P4t)),
V4t
]);
}
const PU = /* @__PURE__ */ Og(A4t, [["render", R4t], ["__scopeId", "data-v-88079d87"]]), N4t = `
`, Lb = function(t) {
return t ? [...new Set(t.map((e) => JSON.stringify(e)))].map(
(e) => JSON.parse(e)
) : [];
}, wb = [], Lx = async function(t, e) {
const r = e.filter(
(o) => wb.some((s) => s.taxon === o)
), n = wb.filter(
(o) => r.includes(o.taxon)
), i = e.filter(
(o) => !r.includes(o)
);
if (i.length) {
const o = await t.queryLabels(i);
if (o.length)
return o.forEach((s) => {
let { entity: a, label: u } = s;
u === "Mammalia" && (u = "Mammalia not otherwise specified");
const d = { taxon: a, label: u };
n.push(d), wb.push(d);
}), n;
} else
return n;
}, xb = function(t, e) {
if (!t || !e) return !1;
let r = JSON.stringify(t), n = JSON.stringify(e);
return r.indexOf(n) !== -1;
};
let D4t = function() {
this.initialise = function(t) {
this.flatmapApi = t, this.destinations = [], this.origins = [], this.components = [], this.urls = [], this.controller = void 0, this.uberons = [], this.lookUp = [];
}, this.createTooltipData = async function(t, e) {
let r = [];
e.feature.hyperlinks && e.feature.hyperlinks.length > 0 ? r = e.feature.hyperlinks : r = this.urls.map((o) => ({ url: o, id: "pubmed" }));
let n;
if (e.provenanceTaxonomy) {
n = [];
const o = await Lx(t, e.provenanceTaxonomy);
o.length && o.forEach((s) => {
const { label: a } = s;
n.push(a);
});
}
return {
destinations: this.destinations,
origins: this.origins,
components: this.components,
destinationsWithDatasets: this.destinationsWithDatasets,
originsWithDatasets: this.originsWithDatasets,
componentsWithDatasets: this.componentsWithDatasets,
title: e.label,
featureId: e.resource,
hyperlinks: r,
provenanceTaxonomy: e.provenanceTaxonomy,
provenanceTaxonomyLabel: n
};
}, this.createComponentsLabelList = function(t, e) {
let r = [];
return t.forEach((n) => {
r.push(this.createLabelFromNeuralNode(n[0]), e), n.length === 2 && r.push(this.createLabelFromNeuralNode(n[1]), e);
}), r;
}, this.createLabelLookup = function(t, e) {
return new Promise(async (r) => {
let n = {};
this.uberons = [];
const i = await Lx(t, e);
i.length && (i.forEach((o) => {
const { taxon: s, label: a } = o;
n[s] = a, this.uberons.push({
id: s,
name: a
});
}), r(n));
});
}, this.buildConnectivitySqlStatement = function(t) {
let e = "select knowledge from knowledge where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.buildLabelSqlStatement = function(t) {
let e = "select entity, label from labels where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.findAllIdsFromConnectivity = function(t) {
let e = t.connectivity.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), [...new Set(n.flat())];
}, this.flattenConntectivity = function(t) {
let e = t.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), n.flat();
}, this.findComponents = function(t) {
let e = t.connectivity.flat(), r = Lb(e), n = [], i = !1;
return r.forEach((o) => {
i = !1, xb(t.axons, o) && (i = !0), t.somas && xb(t.somas, o) && (i = !0), xb(t.dendrites, o) && (i = !0), i || n.push(o);
}), n;
}, this.retrieveFlatmapKnowledgeForEvent = async function(t, e) {
this.controller && this.controller.abort(), this.controller = new AbortController();
const r = this.controller.signal, n = e.resource;
if (this.destinations = [], this.origins = [], this.components = [], this.urls = [], !n || n.length == 0 || !n[0]) return;
let i = this.queryForConnectivityNew(t, n, r);
return await Promise.all([i]);
}, this.queryForConnectivityNew = function(t, e, r, n = !0) {
return new Promise((i) => {
t.queryKnowledge(e[0]).then((o) => {
if (this.checkConnectivityExists(o)) {
let s = o;
n ? this.processConnectivity(t, s).then((a) => {
o.references ? this.getURLsForPubMed(o.references).then((u) => {
this.urls = u, i(a);
}) : i(a);
}) : i(s);
} else
i(!1);
}).catch((o) => {
o.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${e[0]}.`), i(!1);
});
});
}, this.queryForConnectivity = function(t, e, r, n = !0) {
const i = { sql: this.buildConnectivitySqlStatement(e) }, o = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(i),
...r ? { signal: r } : {}
// add signal to header if it exists
};
return new Promise((s) => {
fetch(`${this.flatmapApi}knowledge/query/`, o).then((a) => a.json()).then((a) => {
if (this.connectivityExists(a)) {
let u = JSON.parse(a.values[0][0]);
n ? this.processConnectivity(t, u).then((d) => {
s(d);
}) : s(u);
} else
s(!1);
}).catch((a) => {
a.name === "AbortError" || console.error("Error:", a), s(!1);
});
});
}, this.checkConnectivityExists = function(t) {
var e;
return t && ((e = t.connectivity) == null ? void 0 : e.length);
}, this.connectivityExists = function(t) {
return !!(t.values && t.values.length > 0 && JSON.parse(t.values[0][0]).connectivity && JSON.parse(t.values[0][0]).connectivity.length > 0);
}, this.findIfNodeIsSingle = function(t) {
return t.length === 1 ? (console.error("Server returns a single node", t), t[0]) : t.length === 2 && t[1].length === 0 ? t[0] : !1;
}, this.createLabelFromNeuralNode = function(t, e) {
let r = this.findIfNodeIsSingle(t);
if (r)
return e[r];
let n = e[t[0]];
return t.length === 2 && t[1].length > 0 && t[1].forEach((i) => {
e[i] == null ? n += `, ${i}` : n += `, ${e[i]}`;
}), n;
}, this.flattenAndFindDatasets = function(t, e, r) {
let n = this.flattenConntectivity(t), i = this.flattenConntectivity(e), o = this.flattenConntectivity(r);
this.destinationsWithDatasets = this.uberons.filter(
(s) => i.indexOf(s.id) !== -1
), this.originsWithDatasets = this.uberons.filter(
(s) => o.indexOf(s.id) !== -1
), this.componentsWithDatasets = this.uberons.filter(
(s) => n.indexOf(s.id) !== -1
);
}, this.processConnectivity = function(t, e) {
return new Promise((r) => {
let n = this.findComponents(e), i = Lb(e.axons), o = [];
e.somas && e.somas.length > 0 && o.push(...e.somas), e.dendrites && e.dendrites.length > 0 && o.push(...e.dendrites), o = Lb(o);
let s = this.findAllIdsFromConnectivity(e);
this.createLabelLookup(t, s).then((a) => {
this.destinations = i.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.origins = o.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.components = n.map(
(u) => this.createLabelFromNeuralNode(u, a)
), this.flattenAndFindDatasets(n, i, o), r({
ids: {
axons: i,
dendrites: o,
components: n
},
labels: {
destinations: this.destinations,
origins: this.origins,
components: this.components
}
});
});
});
}, this.flattenConntectivity = function(t) {
let e = t.flat(), r = [...new Set(e)], n = [];
return r.forEach((i) => {
Array.isArray(i) ? n.push(i.flat()) : n.push(i);
}), n.flat();
}, this.stripPMIDPrefix = function(t) {
return t.split(":")[1];
}, this.getPMID = function(t) {
return new Promise((e) => {
if (t.length > 0) {
const r = [], n = [];
t.forEach((i) => {
const o = '"' + i + '"', s = new URLSearchParams({
db: "pubmed",
term: o,
format: "json"
}), a = fetch(`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?${s}`, {
method: "GET"
}).then((u) => u.json()).then((u) => {
const d = u.esearchresult ? u.esearchresult.idlist : [];
n.push(...d);
});
r.push(a);
}), Promise.all(r).then(() => {
e(n);
}).catch(() => {
e(n);
});
} else
e([]);
});
}, this.convertPublicationIds = function(t) {
return new Promise((e) => {
const r = [], n = [];
t.forEach((i) => {
i.type === "pmid" ? r.push(i.id) : (i.type === "doi" || i.type === "pmc") && n.push(i.id);
}), this.getPMID(n).then((i) => {
r.push(...i), e(r);
}).catch(() => {
e(r);
});
});
}, this.extractPublicationIdFromURLString = function(t) {
if (!t) return;
const e = decodeURIComponent(t);
let r = { id: "", type: "" };
return [
"doi.org/",
"nih.gov/pubmed/",
"pmc/articles/",
"pubmed.ncbi.nlm.nih.gov/"
].forEach((i) => {
const o = e.lastIndexOf(i);
o !== -1 && (r.id = e.slice(o + i.length), i === "doi.org/" ? r.type = "doi" : i === "pmc/articles/" ? r.type = "pmc" : r.type = "pmid");
}), r.id === "" && (t.includes("doi:") ? (r.id = this.stripPMIDPrefix(t), r.type = "doi") : t.includes("PMID:") && (r.id = this.stripPMIDPrefix(t), r.type = "pmid")), r.id.endsWith("/") && (r.id = r.id.slice(0, -1)), r;
}, this.getURLsForPubMed = function(t) {
return new Promise((e) => {
const r = t.map(
(n) => typeof n == "object" ? this.extractPublicationIdFromURLString(n[0]) : this.extractPublicationIdFromURLString(n)
);
this.convertPublicationIds(r).then((n) => {
if (n.length > 0) {
const i = n.join();
e([this.pubmedSearchUrl(i)]);
} else
e([]);
});
});
}, this.buildPubmedSqlStatement = function(t) {
let e = "select distinct publication from publications where entity in (";
if (t.length === 1)
e += `'${t[0]}')`;
else if (t.length > 1)
for (let r in t)
e += `'${t[r]}'${r >= t.length - 1 ? ")" : ","} `;
return e;
}, this.buildPubmedSqlStatementForModels = function(t) {
return `select distinct publication from publications where entity = '${t}'`;
}, this.flatmapQuery = function(t) {
const e = { sql: t };
return fetch(`${this.flatmapApi}knowledge/query/`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(e)
}).then((r) => r.json()).catch((r) => {
console.error("Error:", r);
});
}, this.pubmedQueryOnIds = function(t) {
return new Promise((e) => {
const r = t.resource, n = t.feature.source;
if (!r || r.length === 0) return;
const i = this.buildPubmedSqlStatement(r);
this.flatmapQuery(i).then((o) => {
o.values.length > 0 ? this.getURLsForPubMed(o.values).then((s) => {
this.urls = s, s.length ? e(!0) : e(!1);
}).catch(() => {
this.urls = [], e(!1);
}) : this.pubmedQueryOnModels(n).then((s) => {
e(s);
});
});
});
}, this.pubmedQueryOnModels = function(t) {
return this.flatmapQuery(
this.buildPubmedSqlStatementForModels(t)
).then((e) => (Array.isArray(e.values) && e.values.length > 0 ? this.getURLsForPubMed(e.values).then((r) => (this.urls = r, !0)).catch(() => (this.urls = [], !1)) : this.urls = [], !1));
}, this.pubmedSearchUrl = function(t) {
let e = "https://pubmed.ncbi.nlm.nih.gov/?", r = new URLSearchParams();
return r.append("term", t), e + r.toString();
};
};
const F4t = (t) => t && t.charAt(0).toUpperCase() + t.slice(1), B4t = '';
var VU = { exports: {} };
(function(t, e) {
(function(r, n) {
t.exports = n();
})(typeof window < "u" ? window : Rat, function() {
if (typeof window > "u")
return null;
var r = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")(), n = r.requestAnimationFrame || r.mozRequestAnimationFrame || r.webkitRequestAnimationFrame || function(T) {
return r.setTimeout(T, 20);
}, i = r.cancelAnimationFrame || r.mozCancelAnimationFrame || r.webkitCancelAnimationFrame || function(T) {
r.clearTimeout(T);
};
function o(T, f) {
var Q = Object.prototype.toString.call(T), y = Q === "[object Array]" || Q === "[object NodeList]" || Q === "[object HTMLCollection]" || Q === "[object Object]" || typeof jQuery < "u" && T instanceof jQuery || typeof Elements < "u" && T instanceof Elements, _ = 0, L = T.length;
if (y)
for (; _ < L; _++)
f(T[_]);
else
f(T);
}
function s(T) {
if (!T.getBoundingClientRect)
return {
width: T.offsetWidth,
height: T.offsetHeight
};
var f = T.getBoundingClientRect();
return {
width: Math.round(f.width),
height: Math.round(f.height)
};
}
function a(T, f) {
Object.keys(f).forEach(function(Q) {
T.style[Q] = f[Q];
});
}
var u = function(T, f) {
var Q = 0;
function y() {
var L = [];
this.add = function(O) {
L.push(O);
};
var E, x;
this.call = function(O) {
for (E = 0, x = L.length; E < x; E++)
L[E].call(this, O);
}, this.remove = function(O) {
var k = [];
for (E = 0, x = L.length; E < x; E++)
L[E] !== O && k.push(L[E]);
L = k;
}, this.length = function() {
return L.length;
};
}
function _(L, E) {
if (L) {
if (L.resizedAttached) {
L.resizedAttached.add(E);
return;
}
L.resizedAttached = new y(), L.resizedAttached.add(E), L.resizeSensor = document.createElement("div"), L.resizeSensor.dir = "ltr", L.resizeSensor.className = "resize-sensor";
var x = {
pointerEvents: "none",
position: "absolute",
left: "0px",
top: "0px",
right: "0px",
bottom: "0px",
overflow: "hidden",
zIndex: "-1",
visibility: "hidden",
maxWidth: "100%"
}, O = {
position: "absolute",
left: "0px",
top: "0px",
transition: "0s"
};
a(L.resizeSensor, x);
var k = document.createElement("div");
k.className = "resize-sensor-expand", a(k, x);
var R = document.createElement("div");
a(R, O), k.appendChild(R);
var F = document.createElement("div");
F.className = "resize-sensor-shrink", a(F, x);
var U = document.createElement("div");
a(U, O), a(U, { width: "200%", height: "200%" }), F.appendChild(U), L.resizeSensor.appendChild(k), L.resizeSensor.appendChild(F), L.appendChild(L.resizeSensor);
var $ = window.getComputedStyle(L), et = $ ? $.getPropertyValue("position") : null;
et !== "absolute" && et !== "relative" && et !== "fixed" && et !== "sticky" && (L.style.position = "relative");
var nt = !1, ct = 0, rt = s(L), gt = 0, It = 0, Zt = !0;
Q = 0;
var oe = function() {
var ie = L.offsetWidth, Qe = L.offsetHeight;
R.style.width = ie + 10 + "px", R.style.height = Qe + 10 + "px", k.scrollLeft = ie + 10, k.scrollTop = Qe + 10, F.scrollLeft = ie + 10, F.scrollTop = Qe + 10;
}, re = function() {
if (Zt) {
var ie = L.offsetWidth === 0 && L.offsetHeight === 0;
if (ie) {
Q || (Q = n(function() {
Q = 0, re();
}));
return;
} else
Zt = !1;
}
oe();
};
L.resizeSensor.resetSensor = re;
var Ve = function() {
ct = 0, nt && (gt = rt.width, It = rt.height, L.resizedAttached && L.resizedAttached.call(rt));
}, yr = function() {
rt = s(L), nt = rt.width !== gt || rt.height !== It, nt && !ct && (ct = n(Ve)), re();
}, qr = function(ie, Qe, Ke) {
ie.attachEvent ? ie.attachEvent("on" + Qe, Ke) : ie.addEventListener(Qe, Ke);
};
qr(k, "scroll", yr), qr(F, "scroll", yr), Q = n(function() {
Q = 0, re();
});
}
}
o(T, function(L) {
_(L, f);
}), this.detach = function(L) {
Q || (i(Q), Q = 0), u.detach(T, L);
}, this.reset = function() {
T.resizeSensor.resetSensor();
};
};
if (u.reset = function(T) {
o(T, function(f) {
f.resizeSensor.resetSensor();
});
}, u.detach = function(T, f) {
o(T, function(Q) {
Q && (Q.resizedAttached && typeof f == "function" && (Q.resizedAttached.remove(f), Q.resizedAttached.length()) || Q.resizeSensor && (Q.contains(Q.resizeSensor) && Q.removeChild(Q.resizeSensor), delete Q.resizeSensor, delete Q.resizedAttached));
});
}, typeof MutationObserver < "u") {
var d = new MutationObserver(function(T) {
for (var f in T)
if (T.hasOwnProperty(f))
for (var Q = T[f].addedNodes, y = 0; y < Q.length; y++)
Q[y].resizeSensor && u.reset(Q[y]);
});
document.addEventListener("DOMContentLoaded", function(T) {
d.observe(document.body, {
childList: !0,
subtree: !0
});
});
}
return u;
});
})(VU);
var j4t = VU.exports;
const z4t = /* @__PURE__ */ Nat(j4t);
var U4t = Object.defineProperty, G4t = (t, e, r) => e in t ? U4t(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, dt = (t, e, r) => (G4t(t, typeof e != "symbol" ? e + "" : e, r), r), HS = (t, e, r) => {
if (!e.has(t))
throw TypeError("Cannot " + r);
}, K = (t, e, r) => (HS(t, e, "read from private field"), r ? r.call(t) : e.get(t)), Ft = (t, e, r) => {
if (e.has(t))
throw TypeError("Cannot add the same private member more than once");
e instanceof WeakSet ? e.add(t) : e.set(t, r);
}, Yt = (t, e, r, n) => (HS(t, e, "write to private field"), e.set(t, r), r), se = (t, e, r) => (HS(t, e, "access private method"), r);
function $4t(t, e) {
for (var r = 0; r < e.length; r++) {
const n = e[r];
if (typeof n != "string" && !Array.isArray(n)) {
for (const i in n)
if (i !== "default" && !(i in t)) {
const o = Object.getOwnPropertyDescriptor(n, i);
o && Object.defineProperty(t, i, o.get ? o : {
enumerable: !0,
get: () => n[i]
});
}
}
}
return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
}
var P = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function p0(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
function W4t(t) {
if (t.__esModule)
return t;
var e = t.default;
if (typeof e == "function") {
var r = function n() {
return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
};
r.prototype = e.prototype;
} else
r = {};
return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) {
var i = Object.getOwnPropertyDescriptor(t, n);
Object.defineProperty(r, n, i.get ? i : {
enumerable: !0,
get: function() {
return t[n];
}
});
}), r;
}
var qo = function(t) {
try {
return !!t();
} catch {
return !0;
}
}, Z4t = qo, AS = !Z4t(function() {
var t = (function() {
}).bind();
return typeof t != "function" || t.hasOwnProperty("prototype");
}), RU = AS, NU = Function.prototype, wx = NU.call, q4t = RU && NU.bind.bind(wx, wx), oo = RU ? q4t : function(t) {
return function() {
return wx.apply(t, arguments);
};
}, DU = oo, X4t = DU({}.toString), K4t = DU("".slice), Qd = function(t) {
return K4t(X4t(t), 8, -1);
}, Y4t = oo, J4t = qo, t6t = Qd, Eb = Object, e6t = Y4t("".split), r6t = J4t(function() {
return !Eb("z").propertyIsEnumerable(0);
}) ? function(t) {
return t6t(t) === "String" ? e6t(t, "") : Eb(t);
} : Eb, md = function(t) {
return t == null;
}, n6t = md, i6t = TypeError, Cg = function(t) {
if (n6t(t))
throw new i6t("Can't call method on " + t);
return t;
}, o6t = r6t, s6t = Cg, rc = function(t) {
return o6t(s6t(t));
}, hu = function(t) {
return t && t.Math === Math && t;
}, J2 = (
// eslint-disable-next-line es/no-global-this -- safe
hu(typeof globalThis == "object" && globalThis) || hu(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe
hu(typeof self == "object" && self) || hu(typeof P == "object" && P) || hu(typeof P == "object" && P) || // eslint-disable-next-line no-new-func -- fallback
/* @__PURE__ */ function() {
return this;
}() || Function("return this")()
), FU = { exports: {} }, MI = J2, a6t = Object.defineProperty, OS = function(t, e) {
try {
a6t(MI, t, { value: e, configurable: !0, writable: !0 });
} catch {
MI[t] = e;
}
return e;
}, l6t = J2, c6t = OS, SI = "__core-js_shared__", HI = FU.exports = l6t[SI] || c6t(SI, {});
(HI.versions || (HI.versions = [])).push({
version: "3.37.0",
mode: "global",
copyright: "© 2014-2024 Denis Pushkarev (zloirock.ru)",
license: "https://github.com/zloirock/core-js/blob/v3.37.0/LICENSE",
source: "https://github.com/zloirock/core-js"
});
var CS = FU.exports, AI = CS, BU = function(t, e) {
return AI[t] || (AI[t] = e || {});
}, u6t = Cg, h6t = Object, jU = function(t) {
return h6t(u6t(t));
}, d6t = oo, p6t = jU, T6t = d6t({}.hasOwnProperty), _3 = Object.hasOwn || function(t, e) {
return T6t(p6t(t), e);
}, f6t = oo, Q6t = 0, m6t = Math.random(), g6t = f6t(1 .toString), kS = function(t) {
return "Symbol(" + (t === void 0 ? "" : t) + ")_" + g6t(++Q6t + m6t, 36);
}, y6t = typeof navigator < "u" && String(navigator.userAgent) || "", zU = J2, Mb = y6t, OI = zU.process, CI = zU.Deno, kI = OI && OI.versions || CI && CI.version, II = kI && kI.v8, ta, jQ;
II && (ta = II.split("."), jQ = ta[0] > 0 && ta[0] < 4 ? 1 : +(ta[0] + ta[1]));
!jQ && Mb && (ta = Mb.match(/Edge\/(\d+)/), (!ta || ta[1] >= 74) && (ta = Mb.match(/Chrome\/(\d+)/), ta && (jQ = +ta[1])));
var v6t = jQ, PI = v6t, _6t = qo, b6t = J2, L6t = b6t.String, UU = !!Object.getOwnPropertySymbols && !_6t(function() {
var t = Symbol("symbol detection");
return !L6t(t) || !(Object(t) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && PI && PI < 41;
}), w6t = UU, GU = w6t && !Symbol.sham && typeof Symbol.iterator == "symbol", x6t = J2, E6t = BU, VI = _3, M6t = kS, S6t = UU, H6t = GU, K7 = x6t.Symbol, Sb = E6t("wks"), A6t = H6t ? K7.for || K7 : K7 && K7.withoutSetter || M6t, Ns = function(t) {
return VI(Sb, t) || (Sb[t] = S6t && VI(K7, t) ? K7[t] : A6t("Symbol." + t)), Sb[t];
}, Hb = typeof document == "object" && document.all, Mo = typeof Hb > "u" && Hb !== void 0 ? function(t) {
return typeof t == "function" || t === Hb;
} : function(t) {
return typeof t == "function";
}, O6t = Mo, Ds = function(t) {
return typeof t == "object" ? t !== null : O6t(t);
}, C6t = Ds, k6t = String, I6t = TypeError, T0 = function(t) {
if (C6t(t))
return t;
throw new I6t(k6t(t) + " is not an object");
}, $U = {}, P6t = qo, da = !P6t(function() {
return Object.defineProperty({}, 1, { get: function() {
return 7;
} })[1] !== 7;
}), V6t = da, R6t = qo, WU = V6t && R6t(function() {
return Object.defineProperty(function() {
}, "prototype", {
value: 42,
writable: !1
}).prototype !== 42;
}), b3 = {}, N6t = J2, RI = Ds, xx = N6t.document, D6t = RI(xx) && RI(xx.createElement), IS = function(t) {
return D6t ? xx.createElement(t) : {};
}, F6t = da, B6t = qo, j6t = IS, ZU = !F6t && !B6t(function() {
return Object.defineProperty(j6t("div"), "a", {
get: function() {
return 7;
}
}).a !== 7;
}), z6t = AS, eT = Function.prototype.call, I4 = z6t ? eT.bind(eT) : function() {
return eT.apply(eT, arguments);
}, Ab = J2, U6t = Mo, G6t = function(t) {
return U6t(t) ? t : void 0;
}, gd = function(t, e) {
return arguments.length < 2 ? G6t(Ab[t]) : Ab[t] && Ab[t][e];
}, $6t = oo, PS = $6t({}.isPrototypeOf), W6t = gd, Z6t = Mo, q6t = PS, X6t = GU, K6t = Object, qU = X6t ? function(t) {
return typeof t == "symbol";
} : function(t) {
var e = W6t("Symbol");
return Z6t(e) && q6t(e.prototype, K6t(t));
}, Y6t = String, VS = function(t) {
try {
return Y6t(t);
} catch {
return "Object";
}
}, J6t = Mo, t0t = VS, e0t = TypeError, yd = function(t) {
if (J6t(t))
return t;
throw new e0t(t0t(t) + " is not a function");
}, r0t = yd, n0t = md, RS = function(t, e) {
var r = t[e];
return n0t(r) ? void 0 : r0t(r);
}, Ob = I4, Cb = Mo, kb = Ds, i0t = TypeError, o0t = function(t, e) {
var r, n;
if (e === "string" && Cb(r = t.toString) && !kb(n = Ob(r, t)) || Cb(r = t.valueOf) && !kb(n = Ob(r, t)) || e !== "string" && Cb(r = t.toString) && !kb(n = Ob(r, t)))
return n;
throw new i0t("Can't convert object to primitive value");
}, s0t = I4, NI = Ds, DI = qU, a0t = RS, l0t = o0t, c0t = Ns, u0t = TypeError, h0t = c0t("toPrimitive"), d0t = function(t, e) {
if (!NI(t) || DI(t))
return t;
var r = a0t(t, h0t), n;
if (r) {
if (e === void 0 && (e = "default"), n = s0t(r, t, e), !NI(n) || DI(n))
return n;
throw new u0t("Can't convert object to primitive value");
}
return e === void 0 && (e = "number"), l0t(t, e);
}, p0t = d0t, T0t = qU, XU = function(t) {
var e = p0t(t, "string");
return T0t(e) ? e : e + "";
}, f0t = da, Q0t = ZU, m0t = WU, rT = T0, FI = XU, g0t = TypeError, Ib = Object.defineProperty, y0t = Object.getOwnPropertyDescriptor, Pb = "enumerable", Vb = "configurable", Rb = "writable";
b3.f = f0t ? m0t ? function(t, e, r) {
if (rT(t), e = FI(e), rT(r), typeof t == "function" && e === "prototype" && "value" in r && Rb in r && !r[Rb]) {
var n = y0t(t, e);
n && n[Rb] && (t[e] = r.value, r = {
configurable: Vb in r ? r[Vb] : n[Vb],
enumerable: Pb in r ? r[Pb] : n[Pb],
writable: !1
});
}
return Ib(t, e, r);
} : Ib : function(t, e, r) {
if (rT(t), e = FI(e), rT(r), Q0t)
try {
return Ib(t, e, r);
} catch {
}
if ("get" in r || "set" in r)
throw new g0t("Accessors not supported");
return "value" in r && (t[e] = r.value), t;
};
var v0t = Math.ceil, _0t = Math.floor, b0t = Math.trunc || function(t) {
var e = +t;
return (e > 0 ? _0t : v0t)(e);
}, L0t = b0t, kg = function(t) {
var e = +t;
return e !== e || e === 0 ? 0 : L0t(e);
}, w0t = kg, x0t = Math.max, E0t = Math.min, M0t = function(t, e) {
var r = w0t(t);
return r < 0 ? x0t(r + e, 0) : E0t(r, e);
}, S0t = kg, H0t = Math.min, A0t = function(t) {
var e = S0t(t);
return e > 0 ? H0t(e, 9007199254740991) : 0;
}, O0t = A0t, KU = function(t) {
return O0t(t.length);
}, C0t = rc, k0t = M0t, I0t = KU, BI = function(t) {
return function(e, r, n) {
var i = C0t(e), o = I0t(i);
if (o === 0)
return !t && -1;
var s = k0t(n, o), a;
if (t && r !== r) {
for (; o > s; )
if (a = i[s++], a !== a)
return !0;
} else
for (; o > s; s++)
if ((t || s in i) && i[s] === r)
return t || s || 0;
return !t && -1;
};
}, P0t = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: BI(!0),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: BI(!1)
}, Ig = {}, V0t = oo, Nb = _3, R0t = rc, N0t = P0t.indexOf, D0t = Ig, jI = V0t([].push), YU = function(t, e) {
var r = R0t(t), n = 0, i = [], o;
for (o in r)
!Nb(D0t, o) && Nb(r, o) && jI(i, o);
for (; e.length > n; )
Nb(r, o = e[n++]) && (~N0t(i, o) || jI(i, o));
return i;
}, NS = [
"constructor",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"toString",
"valueOf"
], F0t = YU, B0t = NS, j0t = Object.keys || function(t) {
return F0t(t, B0t);
}, z0t = da, U0t = WU, G0t = b3, $0t = T0, W0t = rc, Z0t = j0t;
$U.f = z0t && !U0t ? Object.defineProperties : function(t, e) {
$0t(t);
for (var r = W0t(e), n = Z0t(e), i = n.length, o = 0, s; i > o; )
G0t.f(t, s = n[o++], r[s]);
return t;
};
var q0t = gd, X0t = q0t("document", "documentElement"), K0t = BU, Y0t = kS, zI = K0t("keys"), DS = function(t) {
return zI[t] || (zI[t] = Y0t(t));
}, J0t = T0, t5t = $U, UI = NS, e5t = Ig, r5t = X0t, n5t = IS, i5t = DS, GI = ">", $I = "<", Ex = "prototype", Mx = "script", JU = i5t("IE_PROTO"), Db = function() {
}, tG = function(t) {
return $I + Mx + GI + t + $I + "/" + Mx + GI;
}, WI = function(t) {
t.write(tG("")), t.close();
var e = t.parentWindow.Object;
return t = null, e;
}, o5t = function() {
var t = n5t("iframe"), e = "java" + Mx + ":", r;
return t.style.display = "none", r5t.appendChild(t), t.src = String(e), r = t.contentWindow.document, r.open(), r.write(tG("document.F=Object")), r.close(), r.F;
}, nT, gf = function() {
try {
nT = new ActiveXObject("htmlfile");
} catch {
}
gf = typeof document < "u" ? document.domain && nT ? WI(nT) : o5t() : WI(nT);
for (var t = UI.length; t--; )
delete gf[Ex][UI[t]];
return gf();
};
e5t[JU] = !0;
var FS = Object.create || function(t, e) {
var r;
return t !== null ? (Db[Ex] = J0t(t), r = new Db(), Db[Ex] = null, r[JU] = t) : r = gf(), e === void 0 ? r : t5t.f(r, e);
}, s5t = Ns, a5t = FS, l5t = b3.f, Sx = s5t("unscopables"), Hx = Array.prototype;
Hx[Sx] === void 0 && l5t(Hx, Sx, {
configurable: !0,
value: a5t(null)
});
var c5t = function(t) {
Hx[Sx][t] = !0;
}, vd = {}, u5t = J2, h5t = Mo, ZI = u5t.WeakMap, d5t = h5t(ZI) && /native code/.test(String(ZI)), BS = function(t, e) {
return {
enumerable: !(t & 1),
configurable: !(t & 2),
writable: !(t & 4),
value: e
};
}, p5t = da, T5t = b3, f5t = BS, Pg = p5t ? function(t, e, r) {
return T5t.f(t, e, f5t(1, r));
} : function(t, e, r) {
return t[e] = r, t;
}, Q5t = d5t, eG = J2, m5t = Ds, g5t = Pg, Fb = _3, Bb = CS, y5t = DS, v5t = Ig, qI = "Object already initialized", Ax = eG.TypeError, _5t = eG.WeakMap, zQ, jh, UQ, b5t = function(t) {
return UQ(t) ? jh(t) : zQ(t, {});
}, L5t = function(t) {
return function(e) {
var r;
if (!m5t(e) || (r = jh(e)).type !== t)
throw new Ax("Incompatible receiver, " + t + " required");
return r;
};
};
if (Q5t || Bb.state) {
var Ca = Bb.state || (Bb.state = new _5t());
Ca.get = Ca.get, Ca.has = Ca.has, Ca.set = Ca.set, zQ = function(t, e) {
if (Ca.has(t))
throw new Ax(qI);
return e.facade = t, Ca.set(t, e), e;
}, jh = function(t) {
return Ca.get(t) || {};
}, UQ = function(t) {
return Ca.has(t);
};
} else {
var Yl = y5t("state");
v5t[Yl] = !0, zQ = function(t, e) {
if (Fb(t, Yl))
throw new Ax(qI);
return e.facade = t, g5t(t, Yl, e), e;
}, jh = function(t) {
return Fb(t, Yl) ? t[Yl] : {};
}, UQ = function(t) {
return Fb(t, Yl);
};
}
var Vg = {
set: zQ,
get: jh,
has: UQ,
enforce: b5t,
getterFor: L5t
}, jS = {}, rG = {}, nG = {}.propertyIsEnumerable, iG = Object.getOwnPropertyDescriptor, w5t = iG && !nG.call({ 1: 2 }, 1);
rG.f = w5t ? function(t) {
var e = iG(this, t);
return !!e && e.enumerable;
} : nG;
var x5t = da, E5t = I4, M5t = rG, S5t = BS, H5t = rc, A5t = XU, O5t = _3, C5t = ZU, XI = Object.getOwnPropertyDescriptor;
jS.f = x5t ? XI : function(t, e) {
if (t = H5t(t), e = A5t(e), C5t)
try {
return XI(t, e);
} catch {
}
if (O5t(t, e))
return S5t(!E5t(M5t.f, t, e), t[e]);
};
var oG = { exports: {} }, Ox = da, k5t = _3, sG = Function.prototype, I5t = Ox && Object.getOwnPropertyDescriptor, zS = k5t(sG, "name"), P5t = zS && (function() {
}).name === "something", V5t = zS && (!Ox || Ox && I5t(sG, "name").configurable), aG = {
EXISTS: zS,
PROPER: P5t,
CONFIGURABLE: V5t
}, R5t = oo, N5t = Mo, Cx = CS, D5t = R5t(Function.toString);
N5t(Cx.inspectSource) || (Cx.inspectSource = function(t) {
return D5t(t);
});
var F5t = Cx.inspectSource, US = oo, B5t = qo, j5t = Mo, iT = _3, kx = da, z5t = aG.CONFIGURABLE, U5t = F5t, lG = Vg, G5t = lG.enforce, $5t = lG.get, KI = String, yf = Object.defineProperty, W5t = US("".slice), Z5t = US("".replace), q5t = US([].join), X5t = kx && !B5t(function() {
return yf(function() {
}, "length", { value: 8 }).length !== 8;
}), K5t = String(String).split("String"), Y5t = oG.exports = function(t, e, r) {
W5t(KI(e), 0, 7) === "Symbol(" && (e = "[" + Z5t(KI(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), r && r.getter && (e = "get " + e), r && r.setter && (e = "set " + e), (!iT(t, "name") || z5t && t.name !== e) && (kx ? yf(t, "name", { value: e, configurable: !0 }) : t.name = e), X5t && r && iT(r, "arity") && t.length !== r.arity && yf(t, "length", { value: r.arity });
try {
r && iT(r, "constructor") && r.constructor ? kx && yf(t, "prototype", { writable: !1 }) : t.prototype && (t.prototype = void 0);
} catch {
}
var n = G5t(t);
return iT(n, "source") || (n.source = q5t(K5t, typeof e == "string" ? e : "")), t;
};
Function.prototype.toString = Y5t(function() {
return j5t(this) && $5t(this).source || U5t(this);
}, "toString");
var cG = oG.exports, J5t = Mo, tlt = b3, elt = cG, rlt = OS, nc = function(t, e, r, n) {
n || (n = {});
var i = n.enumerable, o = n.name !== void 0 ? n.name : e;
if (J5t(r) && elt(r, o, n), n.global)
i ? t[e] = r : rlt(e, r);
else {
try {
n.unsafe ? t[e] && (i = !0) : delete t[e];
} catch {
}
i ? t[e] = r : tlt.f(t, e, {
value: r,
enumerable: !1,
configurable: !n.nonConfigurable,
writable: !n.nonWritable
});
}
return t;
}, Rg = {}, nlt = YU, ilt = NS, olt = ilt.concat("length", "prototype");
Rg.f = Object.getOwnPropertyNames || function(t) {
return nlt(t, olt);
};
var uG = {};
uG.f = Object.getOwnPropertySymbols;
var slt = gd, alt = oo, llt = Rg, clt = uG, ult = T0, hlt = alt([].concat), dlt = slt("Reflect", "ownKeys") || function(t) {
var e = llt.f(ult(t)), r = clt.f;
return r ? hlt(e, r(t)) : e;
}, YI = _3, plt = dlt, Tlt = jS, flt = b3, Qlt = function(t, e, r) {
for (var n = plt(e), i = flt.f, o = Tlt.f, s = 0; s < n.length; s++) {
var a = n[s];
!YI(t, a) && !(r && YI(r, a)) && i(t, a, o(e, a));
}
}, mlt = qo, glt = Mo, ylt = /#|\.prototype\./, _d = function(t, e) {
var r = _lt[vlt(t)];
return r === Llt ? !0 : r === blt ? !1 : glt(e) ? mlt(e) : !!e;
}, vlt = _d.normalize = function(t) {
return String(t).replace(ylt, ".").toLowerCase();
}, _lt = _d.data = {}, blt = _d.NATIVE = "N", Llt = _d.POLYFILL = "P", hG = _d, oT = J2, wlt = jS.f, xlt = Pg, Elt = nc, Mlt = OS, Slt = Qlt, Hlt = hG, L3 = function(t, e) {
var r = t.target, n = t.global, i = t.stat, o, s, a, u, d, T;
if (n ? s = oT : i ? s = oT[r] || Mlt(r, {}) : s = oT[r] && oT[r].prototype, s)
for (a in e) {
if (d = e[a], t.dontCallGetSet ? (T = wlt(s, a), u = T && T.value) : u = s[a], o = Hlt(n ? a : r + (i ? "." : "#") + a, t.forced), !o && u !== void 0) {
if (typeof d == typeof u)
continue;
Slt(d, u);
}
(t.sham || u && u.sham) && xlt(d, "sham", !0), Elt(s, a, d, t);
}
}, Alt = qo, Olt = !Alt(function() {
function t() {
}
return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
}), Clt = _3, klt = Mo, Ilt = jU, Plt = DS, Vlt = Olt, JI = Plt("IE_PROTO"), Ix = Object, Rlt = Ix.prototype, dG = Vlt ? Ix.getPrototypeOf : function(t) {
var e = Ilt(t);
if (Clt(e, JI))
return e[JI];
var r = e.constructor;
return klt(r) && e instanceof r ? r.prototype : e instanceof Ix ? Rlt : null;
}, Nlt = qo, Dlt = Mo, Flt = Ds, tP = dG, Blt = nc, jlt = Ns, Px = jlt("iterator"), pG = !1, G5, jb, zb;
[].keys && (zb = [].keys(), "next" in zb ? (jb = tP(tP(zb)), jb !== Object.prototype && (G5 = jb)) : pG = !0);
var zlt = !Flt(G5) || Nlt(function() {
var t = {};
return G5[Px].call(t) !== t;
});
zlt && (G5 = {});
Dlt(G5[Px]) || Blt(G5, Px, function() {
return this;
});
var TG = {
IteratorPrototype: G5,
BUGGY_SAFARI_ITERATORS: pG
}, Ult = b3.f, Glt = _3, $lt = Ns, eP = $lt("toStringTag"), Ng = function(t, e, r) {
t && !r && (t = t.prototype), t && !Glt(t, eP) && Ult(t, eP, { configurable: !0, value: e });
}, Wlt = TG.IteratorPrototype, Zlt = FS, qlt = BS, Xlt = Ng, Klt = vd, Ylt = function() {
return this;
}, Jlt = function(t, e, r, n) {
var i = e + " Iterator";
return t.prototype = Zlt(Wlt, { next: qlt(+!n, r) }), Xlt(t, i, !1), Klt[i] = Ylt, t;
}, t7t = oo, e7t = yd, fG = function(t, e, r) {
try {
return t7t(e7t(Object.getOwnPropertyDescriptor(t, e)[r]));
} catch {
}
}, r7t = Ds, n7t = function(t) {
return r7t(t) || t === null;
}, i7t = n7t, o7t = String, s7t = TypeError, a7t = function(t) {
if (i7t(t))
return t;
throw new s7t("Can't set " + o7t(t) + " as a prototype");
}, l7t = fG, c7t = Ds, u7t = Cg, h7t = a7t, QG = Object.setPrototypeOf || ("__proto__" in {} ? function() {
var t = !1, e = {}, r;
try {
r = l7t(Object.prototype, "__proto__", "set"), r(e, []), t = e instanceof Array;
} catch {
}
return function(n, i) {
return u7t(n), h7t(i), c7t(n) && (t ? r(n, i) : n.__proto__ = i), n;
};
}() : void 0), d7t = L3, p7t = I4, mG = aG, T7t = Mo, f7t = Jlt, rP = dG, nP = QG, Q7t = Ng, m7t = Pg, Ub = nc, g7t = Ns, y7t = vd, gG = TG, v7t = mG.PROPER, _7t = mG.CONFIGURABLE, iP = gG.IteratorPrototype, sT = gG.BUGGY_SAFARI_ITERATORS, du = g7t("iterator"), oP = "keys", pu = "values", sP = "entries", b7t = function() {
return this;
}, GS = function(t, e, r, n, i, o, s) {
f7t(r, e, n);
var a = function(x) {
if (x === i && Q)
return Q;
if (!sT && x && x in T)
return T[x];
switch (x) {
case oP:
return function() {
return new r(this, x);
};
case pu:
return function() {
return new r(this, x);
};
case sP:
return function() {
return new r(this, x);
};
}
return function() {
return new r(this);
};
}, u = e + " Iterator", d = !1, T = t.prototype, f = T[du] || T["@@iterator"] || i && T[i], Q = !sT && f || a(i), y = e === "Array" && T.entries || f, _, L, E;
if (y && (_ = rP(y.call(new t())), _ !== Object.prototype && _.next && (rP(_) !== iP && (nP ? nP(_, iP) : T7t(_[du]) || Ub(_, du, b7t)), Q7t(_, u, !0))), v7t && i === pu && f && f.name !== pu && (_7t ? m7t(T, "name", pu) : (d = !0, Q = function() {
return p7t(f, this);
})), i)
if (L = {
values: a(pu),
keys: o ? Q : a(oP),
entries: a(sP)
}, s)
for (E in L)
(sT || d || !(E in T)) && Ub(T, E, L[E]);
else
d7t({ target: e, proto: !0, forced: sT || d }, L);
return T[du] !== Q && Ub(T, du, Q, { name: i }), y7t[e] = Q, L;
}, $S = function(t, e) {
return { value: t, done: e };
}, L7t = rc, WS = c5t, aP = vd, yG = Vg, w7t = b3.f, x7t = GS, aT = $S, E7t = da, vG = "Array Iterator", M7t = yG.set, S7t = yG.getterFor(vG), H7t = x7t(Array, "Array", function(t, e) {
M7t(this, {
type: vG,
target: L7t(t),
// target
index: 0,
// next index
kind: e
// kind
});
}, function() {
var t = S7t(this), e = t.target, r = t.index++;
if (!e || r >= e.length)
return t.target = void 0, aT(void 0, !0);
switch (t.kind) {
case "keys":
return aT(r, !1);
case "values":
return aT(e[r], !1);
}
return aT([r, e[r]], !1);
}, "values"), lP = aP.Arguments = aP.Array;
WS("keys");
WS("values");
WS("entries");
if (E7t && lP.name !== "values")
try {
w7t(lP, "name", { value: "values" });
} catch {
}
var A7t = Ns, O7t = A7t("toStringTag"), _G = {};
_G[O7t] = "z";
var ZS = String(_G) === "[object z]", C7t = ZS, k7t = Mo, vf = Qd, I7t = Ns, P7t = I7t("toStringTag"), V7t = Object, R7t = vf(/* @__PURE__ */ function() {
return arguments;
}()) === "Arguments", N7t = function(t, e) {
try {
return t[e];
} catch {
}
}, qS = C7t ? vf : function(t) {
var e, r, n;
return t === void 0 ? "Undefined" : t === null ? "Null" : typeof (r = N7t(e = V7t(t), P7t)) == "string" ? r : R7t ? vf(e) : (n = vf(e)) === "Object" && k7t(e.callee) ? "Arguments" : n;
}, D7t = ZS, F7t = qS, B7t = D7t ? {}.toString : function() {
return "[object " + F7t(this) + "]";
}, j7t = ZS, z7t = nc, U7t = B7t;
j7t || z7t(Object.prototype, "toString", U7t, { unsafe: !0 });
var bG = { exports: {} }, LG = {}, G7t = oo, $7t = G7t([].slice), W7t = Qd, Z7t = rc, wG = Rg.f, q7t = $7t, xG = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], X7t = function(t) {
try {
return wG(t);
} catch {
return q7t(xG);
}
};
LG.f = function(t) {
return xG && W7t(t) === "Window" ? X7t(t) : wG(Z7t(t));
};
var K7t = qo, Y7t = K7t(function() {
if (typeof ArrayBuffer == "function") {
var t = new ArrayBuffer(8);
Object.isExtensible(t) && Object.defineProperty(t, "a", { value: 8 });
}
}), J7t = qo, t8t = Ds, e8t = Qd, cP = Y7t, _f = Object.isExtensible, r8t = J7t(function() {
_f(1);
}), n8t = r8t || cP ? function(t) {
return !t8t(t) || cP && e8t(t) === "ArrayBuffer" ? !1 : _f ? _f(t) : !0;
} : _f, i8t = qo, o8t = !i8t(function() {
return Object.isExtensible(Object.preventExtensions({}));
}), s8t = L3, a8t = oo, l8t = Ig, c8t = Ds, XS = _3, u8t = b3.f, uP = Rg, h8t = LG, KS = n8t, d8t = kS, p8t = o8t, EG = !1, A4 = d8t("meta"), T8t = 0, YS = function(t) {
u8t(t, A4, { value: {
objectID: "O" + T8t++,
// object ID
weakData: {}
// weak collections IDs
} });
}, f8t = function(t, e) {
if (!c8t(t))
return typeof t == "symbol" ? t : (typeof t == "string" ? "S" : "P") + t;
if (!XS(t, A4)) {
if (!KS(t))
return "F";
if (!e)
return "E";
YS(t);
}
return t[A4].objectID;
}, Q8t = function(t, e) {
if (!XS(t, A4)) {
if (!KS(t))
return !0;
if (!e)
return !1;
YS(t);
}
return t[A4].weakData;
}, m8t = function(t) {
return p8t && EG && KS(t) && !XS(t, A4) && YS(t), t;
}, g8t = function() {
y8t.enable = function() {
}, EG = !0;
var t = uP.f, e = a8t([].splice), r = {};
r[A4] = 1, t(r).length && (uP.f = function(n) {
for (var i = t(n), o = 0, s = i.length; o < s; o++)
if (i[o] === A4) {
e(i, o, 1);
break;
}
return i;
}, s8t({ target: "Object", stat: !0, forced: !0 }, {
getOwnPropertyNames: h8t.f
}));
}, y8t = bG.exports = {
enable: g8t,
fastKey: f8t,
getWeakData: Q8t,
onFreeze: m8t
};
l8t[A4] = !0;
var MG = bG.exports, v8t = Qd, _8t = oo, b8t = function(t) {
if (v8t(t) === "Function")
return _8t(t);
}, hP = b8t, L8t = yd, w8t = AS, x8t = hP(hP.bind), SG = function(t, e) {
return L8t(t), e === void 0 ? t : w8t ? x8t(t, e) : function() {
return t.apply(e, arguments);
};
}, E8t = Ns, M8t = vd, S8t = E8t("iterator"), H8t = Array.prototype, A8t = function(t) {
return t !== void 0 && (M8t.Array === t || H8t[S8t] === t);
}, O8t = qS, dP = RS, C8t = md, k8t = vd, I8t = Ns, P8t = I8t("iterator"), HG = function(t) {
if (!C8t(t))
return dP(t, P8t) || dP(t, "@@iterator") || k8t[O8t(t)];
}, V8t = I4, R8t = yd, N8t = T0, D8t = VS, F8t = HG, B8t = TypeError, j8t = function(t, e) {
var r = arguments.length < 2 ? F8t(t) : e;
if (R8t(r))
return N8t(V8t(r, t));
throw new B8t(D8t(t) + " is not iterable");
}, z8t = I4, pP = T0, U8t = RS, JS = function(t, e, r) {
var n, i;
pP(t);
try {
if (n = U8t(t, "return"), !n) {
if (e === "throw")
throw r;
return r;
}
n = z8t(n, t);
} catch (o) {
i = !0, n = o;
}
if (e === "throw")
throw r;
if (i)
throw n;
return pP(n), r;
}, G8t = SG, $8t = I4, W8t = T0, Z8t = VS, q8t = A8t, X8t = KU, TP = PS, K8t = j8t, Y8t = HG, fP = JS, J8t = TypeError, bf = function(t, e) {
this.stopped = t, this.result = e;
}, QP = bf.prototype, AG = function(t, e, r) {
var n = r && r.that, i = !!(r && r.AS_ENTRIES), o = !!(r && r.IS_RECORD), s = !!(r && r.IS_ITERATOR), a = !!(r && r.INTERRUPTED), u = G8t(e, n), d, T, f, Q, y, _, L, E = function(O) {
return d && fP(d, "normal", O), new bf(!0, O);
}, x = function(O) {
return i ? (W8t(O), a ? u(O[0], O[1], E) : u(O[0], O[1])) : a ? u(O, E) : u(O);
};
if (o)
d = t.iterator;
else if (s)
d = t;
else {
if (T = Y8t(t), !T)
throw new J8t(Z8t(t) + " is not iterable");
if (q8t(T)) {
for (f = 0, Q = X8t(t); Q > f; f++)
if (y = x(t[f]), y && TP(QP, y))
return y;
return new bf(!1);
}
d = K8t(t, T);
}
for (_ = o ? t.next : d.next; !(L = $8t(_, d)).done; ) {
try {
y = x(L.value);
} catch (O) {
fP(d, "throw", O);
}
if (typeof y == "object" && y && TP(QP, y))
return y;
}
return new bf(!1);
}, tct = PS, ect = TypeError, OG = function(t, e) {
if (tct(e, t))
return t;
throw new ect("Incorrect invocation");
}, rct = Ns, CG = rct("iterator"), kG = !1;
try {
var nct = 0, mP = {
next: function() {
return { done: !!nct++ };
},
return: function() {
kG = !0;
}
};
mP[CG] = function() {
return this;
}, Array.from(mP, function() {
throw 2;
});
} catch {
}
var ict = function(t, e) {
try {
if (!e && !kG)
return !1;
} catch {
return !1;
}
var r = !1;
try {
var n = {};
n[CG] = function() {
return {
next: function() {
return { done: r = !0 };
}
};
}, t(n);
} catch {
}
return r;
}, oct = Mo, sct = Ds, gP = QG, act = function(t, e, r) {
var n, i;
return (
// it can work only with native `setPrototypeOf`
gP && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
oct(n = e.constructor) && n !== r && sct(i = n.prototype) && i !== r.prototype && gP(t, i), t
);
}, lct = L3, cct = J2, uct = oo, yP = hG, hct = nc, dct = MG, pct = AG, Tct = OG, fct = Mo, Qct = md, Gb = Ds, $b = qo, mct = ict, gct = Ng, yct = act, vct = function(t, e, r) {
var n = t.indexOf("Map") !== -1, i = t.indexOf("Weak") !== -1, o = n ? "set" : "add", s = cct[t], a = s && s.prototype, u = s, d = {}, T = function(x) {
var O = uct(a[x]);
hct(
a,
x,
x === "add" ? function(k) {
return O(this, k === 0 ? 0 : k), this;
} : x === "delete" ? function(k) {
return i && !Gb(k) ? !1 : O(this, k === 0 ? 0 : k);
} : x === "get" ? function(k) {
return i && !Gb(k) ? void 0 : O(this, k === 0 ? 0 : k);
} : x === "has" ? function(k) {
return i && !Gb(k) ? !1 : O(this, k === 0 ? 0 : k);
} : function(k, R) {
return O(this, k === 0 ? 0 : k, R), this;
}
);
}, f = yP(
t,
!fct(s) || !(i || a.forEach && !$b(function() {
new s().entries().next();
}))
);
if (f)
u = r.getConstructor(e, t, n, o), dct.enable();
else if (yP(t, !0)) {
var Q = new u(), y = Q[o](i ? {} : -0, 1) !== Q, _ = $b(function() {
Q.has(1);
}), L = mct(function(x) {
new s(x);
}), E = !i && $b(function() {
for (var x = new s(), O = 5; O--; )
x[o](O, O);
return !x.has(-0);
});
L || (u = e(function(x, O) {
Tct(x, a);
var k = yct(new s(), x, u);
return Qct(O) || pct(O, k[o], { that: k, AS_ENTRIES: n }), k;
}), u.prototype = a, a.constructor = u), (_ || E) && (T("delete"), T("has"), n && T("get")), (E || y) && T(o), i && a.clear && delete a.clear;
}
return d[t] = u, lct({ global: !0, constructor: !0, forced: u !== s }, d), gct(u, t), i || r.setStrong(u, t, n), u;
}, vP = cG, _ct = b3, IG = function(t, e, r) {
return r.get && vP(r.get, e, { getter: !0 }), r.set && vP(r.set, e, { setter: !0 }), _ct.f(t, e, r);
}, bct = nc, Lct = function(t, e, r) {
for (var n in e)
bct(t, n, e[n], r);
return t;
}, wct = gd, xct = IG, Ect = Ns, Mct = da, _P = Ect("species"), Sct = function(t) {
var e = wct(t);
Mct && e && !e[_P] && xct(e, _P, {
configurable: !0,
get: function() {
return this;
}
});
}, bP = FS, Hct = IG, LP = Lct, Act = SG, Oct = OG, Cct = md, kct = AG, Ict = GS, wP = $S, Pct = Sct, Tu = da, xP = MG.fastKey, PG = Vg, EP = PG.set, Wb = PG.getterFor, Vct = {
getConstructor: function(t, e, r, n) {
var i = t(function(d, T) {
Oct(d, o), EP(d, {
type: e,
index: bP(null),
first: void 0,
last: void 0,
size: 0
}), Tu || (d.size = 0), Cct(T) || kct(T, d[n], { that: d, AS_ENTRIES: r });
}), o = i.prototype, s = Wb(e), a = function(d, T, f) {
var Q = s(d), y = u(d, T), _, L;
return y ? y.value = f : (Q.last = y = {
index: L = xP(T, !0),
key: T,
value: f,
previous: _ = Q.last,
next: void 0,
removed: !1
}, Q.first || (Q.first = y), _ && (_.next = y), Tu ? Q.size++ : d.size++, L !== "F" && (Q.index[L] = y)), d;
}, u = function(d, T) {
var f = s(d), Q = xP(T), y;
if (Q !== "F")
return f.index[Q];
for (y = f.first; y; y = y.next)
if (y.key === T)
return y;
};
return LP(o, {
// `{ Map, Set }.prototype.clear()` methods
// https://tc39.es/ecma262/#sec-map.prototype.clear
// https://tc39.es/ecma262/#sec-set.prototype.clear
clear: function() {
for (var d = this, T = s(d), f = T.first; f; )
f.removed = !0, f.previous && (f.previous = f.previous.next = void 0), f = f.next;
T.first = T.last = void 0, T.index = bP(null), Tu ? T.size = 0 : d.size = 0;
},
// `{ Map, Set }.prototype.delete(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.delete
// https://tc39.es/ecma262/#sec-set.prototype.delete
delete: function(d) {
var T = this, f = s(T), Q = u(T, d);
if (Q) {
var y = Q.next, _ = Q.previous;
delete f.index[Q.index], Q.removed = !0, _ && (_.next = y), y && (y.previous = _), f.first === Q && (f.first = y), f.last === Q && (f.last = _), Tu ? f.size-- : T.size--;
}
return !!Q;
},
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
// https://tc39.es/ecma262/#sec-map.prototype.foreach
// https://tc39.es/ecma262/#sec-set.prototype.foreach
forEach: function(d) {
for (var T = s(this), f = Act(d, arguments.length > 1 ? arguments[1] : void 0), Q; Q = Q ? Q.next : T.first; )
for (f(Q.value, Q.key, this); Q && Q.removed; )
Q = Q.previous;
},
// `{ Map, Set}.prototype.has(key)` methods
// https://tc39.es/ecma262/#sec-map.prototype.has
// https://tc39.es/ecma262/#sec-set.prototype.has
has: function(d) {
return !!u(this, d);
}
}), LP(o, r ? {
// `Map.prototype.get(key)` method
// https://tc39.es/ecma262/#sec-map.prototype.get
get: function(d) {
var T = u(this, d);
return T && T.value;
},
// `Map.prototype.set(key, value)` method
// https://tc39.es/ecma262/#sec-map.prototype.set
set: function(d, T) {
return a(this, d === 0 ? 0 : d, T);
}
} : {
// `Set.prototype.add(value)` method
// https://tc39.es/ecma262/#sec-set.prototype.add
add: function(d) {
return a(this, d = d === 0 ? 0 : d, d);
}
}), Tu && Hct(o, "size", {
configurable: !0,
get: function() {
return s(this).size;
}
}), i;
},
setStrong: function(t, e, r) {
var n = e + " Iterator", i = Wb(e), o = Wb(n);
Ict(t, e, function(s, a) {
EP(this, {
type: n,
target: s,
state: i(s),
kind: a,
last: void 0
});
}, function() {
for (var s = o(this), a = s.kind, u = s.last; u && u.removed; )
u = u.previous;
return !s.target || !(s.last = u = u ? u.next : s.state.first) ? (s.target = void 0, wP(void 0, !0)) : wP(a === "keys" ? u.key : a === "values" ? u.value : [u.key, u.value], !1);
}, r ? "entries" : "values", !r, !0), Pct(e);
}
}, Rct = vct, Nct = Vct;
Rct("Set", function(t) {
return function() {
return t(this, arguments.length ? arguments[0] : void 0);
};
}, Nct);
var Zb = oo, lT = Set.prototype, w3 = {
// eslint-disable-next-line es/no-set -- safe
Set,
add: Zb(lT.add),
has: Zb(lT.has),
remove: Zb(lT.delete),
proto: lT
}, Dct = w3.has, al = function(t) {
return Dct(t), t;
}, Fct = I4, ll = function(t, e, r) {
for (var n = r ? t : t.iterator, i = t.next, o, s; !(o = Fct(i, n)).done; )
if (s = e(o.value), s !== void 0)
return s;
}, VG = oo, Bct = ll, RG = w3, jct = RG.Set, NG = RG.proto, zct = VG(NG.forEach), DG = VG(NG.keys), Uct = DG(new jct()).next, bd = function(t, e, r) {
return r ? Bct({ iterator: DG(t), next: Uct }, e) : zct(t, e);
}, FG = w3, Gct = bd, $ct = FG.Set, Wct = FG.add, tH = function(t) {
var e = new $ct();
return Gct(t, function(r) {
Wct(e, r);
}), e;
}, Zct = fG, qct = w3, Ld = Zct(qct.proto, "size", "get") || function(t) {
return t.size;
}, Xct = function(t) {
return {
iterator: t,
next: t.next,
done: !1
};
}, MP = yd, BG = T0, SP = I4, Kct = kg, Yct = Xct, HP = "Invalid size", Jct = RangeError, tut = TypeError, eut = Math.max, jG = function(t, e) {
this.set = t, this.size = eut(e, 0), this.has = MP(t.has), this.keys = MP(t.keys);
};
jG.prototype = {
getIterator: function() {
return Yct(BG(SP(this.keys, this.set)));
},
includes: function(t) {
return SP(this.has, this.set, t);
}
};
var cl = function(t) {
BG(t);
var e = +t.size;
if (e !== e)
throw new tut(HP);
var r = Kct(e);
if (r < 0)
throw new Jct(HP);
return new jG(t, r);
}, rut = al, zG = w3, nut = tH, iut = Ld, out = cl, sut = bd, aut = ll, lut = zG.has, AP = zG.remove, cut = function(t) {
var e = rut(this), r = out(t), n = nut(e);
return iut(e) <= r.size ? sut(e, function(i) {
r.includes(i) && AP(n, i);
}) : aut(r.getIterator(), function(i) {
lut(e, i) && AP(n, i);
}), n;
}, uut = gd, OP = function(t) {
return {
size: t,
has: function() {
return !1;
},
keys: function() {
return {
next: function() {
return { done: !0 };
}
};
}
};
}, ul = function(t) {
var e = uut("Set");
try {
new e()[t](OP(0));
try {
return new e()[t](OP(-1)), !1;
} catch {
return !0;
}
} catch {
return !1;
}
}, hut = L3, dut = cut, put = ul;
hut({ target: "Set", proto: !0, real: !0, forced: !put("difference") }, {
difference: dut
});
var Tut = al, eH = w3, fut = Ld, Qut = cl, mut = bd, gut = ll, yut = eH.Set, CP = eH.add, vut = eH.has, _ut = function(t) {
var e = Tut(this), r = Qut(t), n = new yut();
return fut(e) > r.size ? gut(r.getIterator(), function(i) {
vut(e, i) && CP(n, i);
}) : mut(e, function(i) {
r.includes(i) && CP(n, i);
}), n;
}, but = L3, Lut = qo, wut = _ut, xut = ul, Eut = !xut("intersection") || Lut(function() {
return String(Array.from((/* @__PURE__ */ new Set([1, 2, 3])).intersection(/* @__PURE__ */ new Set([3, 2])))) !== "3,2";
});
but({ target: "Set", proto: !0, real: !0, forced: Eut }, {
intersection: wut
});
var Mut = al, Sut = w3.has, Hut = Ld, Aut = cl, Out = bd, Cut = ll, kut = JS, Iut = function(t) {
var e = Mut(this), r = Aut(t);
if (Hut(e) <= r.size)
return Out(e, function(i) {
if (r.includes(i))
return !1;
}, !0) !== !1;
var n = r.getIterator();
return Cut(n, function(i) {
if (Sut(e, i))
return kut(n, "normal", !1);
}) !== !1;
}, Put = L3, Vut = Iut, Rut = ul;
Put({ target: "Set", proto: !0, real: !0, forced: !Rut("isDisjointFrom") }, {
isDisjointFrom: Vut
});
var Nut = al, Dut = Ld, Fut = bd, But = cl, jut = function(t) {
var e = Nut(this), r = But(t);
return Dut(e) > r.size ? !1 : Fut(e, function(n) {
if (!r.includes(n))
return !1;
}, !0) !== !1;
}, zut = L3, Uut = jut, Gut = ul;
zut({ target: "Set", proto: !0, real: !0, forced: !Gut("isSubsetOf") }, {
isSubsetOf: Uut
});
var $ut = al, Wut = w3.has, Zut = Ld, qut = cl, Xut = ll, Kut = JS, Yut = function(t) {
var e = $ut(this), r = qut(t);
if (Zut(e) < r.size)
return !1;
var n = r.getIterator();
return Xut(n, function(i) {
if (!Wut(e, i))
return Kut(n, "normal", !1);
}) !== !1;
}, Jut = L3, t9t = Yut, e9t = ul;
Jut({ target: "Set", proto: !0, real: !0, forced: !e9t("isSupersetOf") }, {
isSupersetOf: t9t
});
var r9t = al, rH = w3, n9t = tH, i9t = cl, o9t = ll, s9t = rH.add, a9t = rH.has, l9t = rH.remove, c9t = function(t) {
var e = r9t(this), r = i9t(t).getIterator(), n = n9t(e);
return o9t(r, function(i) {
a9t(e, i) ? l9t(n, i) : s9t(n, i);
}), n;
}, u9t = L3, h9t = c9t, d9t = ul;
u9t({ target: "Set", proto: !0, real: !0, forced: !d9t("symmetricDifference") }, {
symmetricDifference: h9t
});
var p9t = al, T9t = w3.add, f9t = tH, Q9t = cl, m9t = ll, g9t = function(t) {
var e = p9t(this), r = Q9t(t).getIterator(), n = f9t(e);
return m9t(r, function(i) {
T9t(n, i);
}), n;
}, y9t = L3, v9t = g9t, _9t = ul;
y9t({ target: "Set", proto: !0, real: !0, forced: !_9t("union") }, {
union: v9t
});
var b9t = qS, L9t = String, UG = function(t) {
if (b9t(t) === "Symbol")
throw new TypeError("Cannot convert a Symbol value to a string");
return L9t(t);
}, nH = oo, w9t = kg, x9t = UG, E9t = Cg, M9t = nH("".charAt), kP = nH("".charCodeAt), S9t = nH("".slice), IP = function(t) {
return function(e, r) {
var n = x9t(E9t(e)), i = w9t(r), o = n.length, s, a;
return i < 0 || i >= o ? t ? "" : void 0 : (s = kP(n, i), s < 55296 || s > 56319 || i + 1 === o || (a = kP(n, i + 1)) < 56320 || a > 57343 ? t ? M9t(n, i) : s : t ? S9t(n, i, i + 2) : (s - 55296 << 10) + (a - 56320) + 65536);
};
}, H9t = {
// `String.prototype.codePointAt` method
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
codeAt: IP(!1),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: IP(!0)
}, A9t = H9t.charAt, O9t = UG, GG = Vg, C9t = GS, PP = $S, $G = "String Iterator", k9t = GG.set, I9t = GG.getterFor($G);
C9t(String, "String", function(t) {
k9t(this, {
type: $G,
string: O9t(t),
index: 0
});
}, function() {
var t = I9t(this), e = t.string, r = t.index, n;
return r >= e.length ? PP(void 0, !0) : (n = A9t(e, r), t.index += n.length, PP(n, !1));
});
var P9t = J2, V9t = P9t, R9t = V9t, N9t = R9t.Set, D9t = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
}, F9t = IS, qb = F9t("span").classList, VP = qb && qb.constructor && qb.constructor.prototype, B9t = VP === Object.prototype ? void 0 : VP, RP = J2, WG = D9t, j9t = B9t, l9 = H7t, NP = Pg, z9t = Ng, U9t = Ns, Xb = U9t("iterator"), Kb = l9.values, ZG = function(t, e) {
if (t) {
if (t[Xb] !== Kb)
try {
NP(t, Xb, Kb);
} catch {
t[Xb] = Kb;
}
if (z9t(t, e, !0), WG[e]) {
for (var r in l9)
if (t[r] !== l9[r])
try {
NP(t, r, l9[r]);
} catch {
t[r] = l9[r];
}
}
}
};
for (var Yb in WG)
ZG(RP[Yb] && RP[Yb].prototype, Yb);
ZG(j9t, "DOMTokenList");
var G9t = N9t, $9t = G9t, W9t = $9t, Z9t = W9t;
const z6 = /* @__PURE__ */ p0(Z9t);
var qG = { exports: {} };
/**
* MapLibre GL JS
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
*/
(function(t, e) {
(function(r, n) {
t.exports = n();
})(P, function() {
var r = {}, n = {};
function i(s, a, u) {
if (n[s] = u, s === "index") {
var d = "var sharedModule = {}; (" + n.shared + ")(sharedModule); (" + n.worker + ")(sharedModule);", T = {};
return n.shared(T), n.index(r, T), typeof window < "u" && r.setWorkerUrl(window.URL.createObjectURL(new Blob([d], { type: "text/javascript" }))), r;
}
}
i("shared", ["exports"], function(s) {
function a(h, c, p, g) {
return new (p || (p = Promise))(function(w, H) {
function A(z) {
try {
N(g.next(z));
} catch (W) {
H(W);
}
}
function C(z) {
try {
N(g.throw(z));
} catch (W) {
H(W);
}
}
function N(z) {
var W;
z.done ? w(z.value) : (W = z.value, W instanceof p ? W : new p(function(X) {
X(W);
})).then(A, C);
}
N((g = g.apply(h, c || [])).next());
});
}
function u(h) {
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
}
typeof SuppressedError == "function" && SuppressedError;
var d = T;
function T(h, c) {
this.x = h, this.y = c;
}
T.prototype = { clone: function() {
return new T(this.x, this.y);
}, add: function(h) {
return this.clone()._add(h);
}, sub: function(h) {
return this.clone()._sub(h);
}, multByPoint: function(h) {
return this.clone()._multByPoint(h);
}, divByPoint: function(h) {
return this.clone()._divByPoint(h);
}, mult: function(h) {
return this.clone()._mult(h);
}, div: function(h) {
return this.clone()._div(h);
}, rotate: function(h) {
return this.clone()._rotate(h);
}, rotateAround: function(h, c) {
return this.clone()._rotateAround(h, c);
}, matMult: function(h) {
return this.clone()._matMult(h);
}, unit: function() {
return this.clone()._unit();
}, perp: function() {
return this.clone()._perp();
}, round: function() {
return this.clone()._round();
}, mag: function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
}, equals: function(h) {
return this.x === h.x && this.y === h.y;
}, dist: function(h) {
return Math.sqrt(this.distSqr(h));
}, distSqr: function(h) {
var c = h.x - this.x, p = h.y - this.y;
return c * c + p * p;
}, angle: function() {
return Math.atan2(this.y, this.x);
}, angleTo: function(h) {
return Math.atan2(this.y - h.y, this.x - h.x);
}, angleWith: function(h) {
return this.angleWithSep(h.x, h.y);
}, angleWithSep: function(h, c) {
return Math.atan2(this.x * c - this.y * h, this.x * h + this.y * c);
}, _matMult: function(h) {
var c = h[2] * this.x + h[3] * this.y;
return this.x = h[0] * this.x + h[1] * this.y, this.y = c, this;
}, _add: function(h) {
return this.x += h.x, this.y += h.y, this;
}, _sub: function(h) {
return this.x -= h.x, this.y -= h.y, this;
}, _mult: function(h) {
return this.x *= h, this.y *= h, this;
}, _div: function(h) {
return this.x /= h, this.y /= h, this;
}, _multByPoint: function(h) {
return this.x *= h.x, this.y *= h.y, this;
}, _divByPoint: function(h) {
return this.x /= h.x, this.y /= h.y, this;
}, _unit: function() {
return this._div(this.mag()), this;
}, _perp: function() {
var h = this.y;
return this.y = this.x, this.x = -h, this;
}, _rotate: function(h) {
var c = Math.cos(h), p = Math.sin(h), g = p * this.x + c * this.y;
return this.x = c * this.x - p * this.y, this.y = g, this;
}, _rotateAround: function(h, c) {
var p = Math.cos(h), g = Math.sin(h), w = c.y + g * (this.x - c.x) + p * (this.y - c.y);
return this.x = c.x + p * (this.x - c.x) - g * (this.y - c.y), this.y = w, this;
}, _round: function() {
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
} }, T.convert = function(h) {
return h instanceof T ? h : Array.isArray(h) ? new T(h[0], h[1]) : h;
};
var f = u(d), Q = y;
function y(h, c, p, g) {
this.cx = 3 * h, this.bx = 3 * (p - h) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * c, this.by = 3 * (g - c) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = h, this.p1y = c, this.p2x = p, this.p2y = g;
}
y.prototype = { sampleCurveX: function(h) {
return ((this.ax * h + this.bx) * h + this.cx) * h;
}, sampleCurveY: function(h) {
return ((this.ay * h + this.by) * h + this.cy) * h;
}, sampleCurveDerivativeX: function(h) {
return (3 * this.ax * h + 2 * this.bx) * h + this.cx;
}, solveCurveX: function(h, c) {
if (c === void 0 && (c = 1e-6), h < 0)
return 0;
if (h > 1)
return 1;
for (var p = h, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h;
if (Math.abs(w) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= w / H;
}
var A = 0, C = 1;
for (p = h, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h) < c)); g++)
h > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var _ = u(Q);
let L, E;
function x() {
return L == null && (L = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") && typeof createImageBitmap == "function"), L;
}
function O() {
if (E == null && (E = !1, x())) {
const h = new OffscreenCanvas(5, 5).getContext("2d", { willReadFrequently: !0 });
if (h) {
for (let p = 0; p < 5 * 5; p++) {
const g = 4 * p;
h.fillStyle = `rgb(${g},${g + 1},${g + 2})`, h.fillRect(p % 5, Math.floor(p / 5), 1, 1);
}
const c = h.getImageData(0, 0, 5, 5).data;
for (let p = 0; p < 5 * 5 * 4; p++)
if (p % 4 != 3 && c[p] !== p) {
E = !0;
break;
}
}
}
return E || !1;
}
function k(h, c, p, g) {
const w = new _(h, c, p, g);
return (H) => w.solve(H);
}
const R = k(0.25, 0.1, 0.25, 1);
function F(h, c, p) {
return Math.min(p, Math.max(c, h));
}
function U(h, c, p) {
const g = p - c, w = ((h - c) % g + g) % g + c;
return w === c ? p : w;
}
function $(h, ...c) {
for (const p of c)
for (const g in p)
h[g] = p[g];
return h;
}
let et = 1;
function nt(h, c, p) {
const g = {};
for (const w in h)
g[w] = c.call(this, h[w], w, h);
return g;
}
function ct(h, c, p) {
const g = {};
for (const w in h)
c.call(this, h[w], w, h) && (g[w] = h[w]);
return g;
}
function rt(h) {
return Array.isArray(h) ? h.map(rt) : typeof h == "object" && h ? nt(h, rt) : h;
}
const gt = {};
function It(h) {
gt[h] || (typeof console < "u" && console.warn(h), gt[h] = !0);
}
function Zt(h, c, p) {
return (p.y - h.y) * (c.x - h.x) > (c.y - h.y) * (p.x - h.x);
}
function oe(h) {
return typeof WorkerGlobalScope < "u" && h !== void 0 && h instanceof WorkerGlobalScope;
}
let re = null;
function Ve(h) {
return typeof ImageBitmap < "u" && h instanceof ImageBitmap;
}
const yr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
function qr(h, c, p, g, w) {
return a(this, void 0, void 0, function* () {
if (typeof VideoFrame > "u")
throw new Error("VideoFrame not supported");
const H = new VideoFrame(h, { timestamp: 0 });
try {
const A = H == null ? void 0 : H.format;
if (!A || !A.startsWith("BGR") && !A.startsWith("RGB"))
throw new Error(`Unrecognized format ${A}`);
const C = A.startsWith("BGR"), N = new Uint8ClampedArray(g * w * 4);
if (yield H.copyTo(N, function(z, W, X, tt, at) {
const ut = 4 * Math.max(-W, 0), Tt = (Math.max(0, X) - X) * tt * 4 + ut, Lt = 4 * tt, Et = Math.max(0, W), $t = Math.max(0, X);
return { rect: { x: Et, y: $t, width: Math.min(z.width, W + tt) - Et, height: Math.min(z.height, X + at) - $t }, layout: [{ offset: Tt, stride: Lt }] };
}(h, c, p, g, w)), C)
for (let z = 0; z < N.length; z += 4) {
const W = N[z];
N[z] = N[z + 2], N[z + 2] = W;
}
return N;
} finally {
H.close();
}
});
}
let ie, Qe;
const Ke = "AbortError";
function He() {
return new Error(Ke);
}
const er = { MAX_PARALLEL_IMAGE_REQUESTS: 16, MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: 8, MAX_TILE_CACHE_ZOOM_LEVELS: 5, REGISTERED_PROTOCOLS: {}, WORKER_URL: "" };
function Je(h) {
return er.REGISTERED_PROTOCOLS[h.substring(0, h.indexOf("://"))];
}
const Ne = "global-dispatcher";
class Gt extends Error {
constructor(c, p, g, w) {
super(`AJAXError: ${p} (${c}): ${g}`), this.status = c, this.statusText = p, this.url = g, this.body = w;
}
}
const te = () => oe(self) ? self.worker && self.worker.referrer : (window.location.protocol === "blob:" ? window.parent : window).location.href, me = function(h, c) {
if (/:\/\//.test(h.url) && !/^https?:|^file:/.test(h.url)) {
const g = Je(h.url);
if (g)
return g(h, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h, targetMapId: Ne }, c);
}
if (!(/^file:/.test(p = h.url) || /^file:/.test(te()) && !/^\w+:/.test(p))) {
if (fetch && Request && AbortController && Object.prototype.hasOwnProperty.call(Request.prototype, "signal"))
return function(g, w) {
return a(this, void 0, void 0, function* () {
const H = new Request(g.url, { method: g.method || "GET", body: g.body, credentials: g.credentials, headers: g.headers, cache: g.cache, referrer: te(), signal: w.signal });
g.type !== "json" || H.headers.has("Accept") || H.headers.set("Accept", "application/json");
const A = yield fetch(H);
if (!A.ok) {
const z = yield A.blob();
throw new Gt(A.status, A.statusText, g.url, z);
}
let C;
C = g.type === "arrayBuffer" || g.type === "image" ? A.arrayBuffer() : g.type === "json" ? A.json() : A.text();
const N = yield C;
if (w.signal.aborted)
throw He();
return { data: N, cacheControl: A.headers.get("Cache-Control"), expires: A.headers.get("Expires") };
});
}(h, c);
if (oe(self) && self.worker && self.worker.actor)
return self.worker.actor.sendAsync({ type: "GR", data: h, mustQueue: !0, targetMapId: Ne }, c);
}
var p;
return function(g, w) {
return new Promise((H, A) => {
var C;
const N = new XMLHttpRequest();
N.open(g.method || "GET", g.url, !0), g.type !== "arrayBuffer" && g.type !== "image" || (N.responseType = "arraybuffer");
for (const z in g.headers)
N.setRequestHeader(z, g.headers[z]);
g.type === "json" && (N.responseType = "text", !((C = g.headers) === null || C === void 0) && C.Accept || N.setRequestHeader("Accept", "application/json")), N.withCredentials = g.credentials === "include", N.onerror = () => {
A(new Error(N.statusText));
}, N.onload = () => {
if (!w.signal.aborted)
if ((N.status >= 200 && N.status < 300 || N.status === 0) && N.response !== null) {
let z = N.response;
if (g.type === "json")
try {
z = JSON.parse(N.response);
} catch (W) {
return void A(W);
}
H({ data: z, cacheControl: N.getResponseHeader("Cache-Control"), expires: N.getResponseHeader("Expires") });
} else {
const z = new Blob([N.response], { type: N.getResponseHeader("Content-Type") });
A(new Gt(N.status, N.statusText, g.url, z));
}
}, w.signal.addEventListener("abort", () => {
N.abort(), A(He());
}), N.send(g.body);
});
}(h, c);
};
function de(h) {
if (!h || h.indexOf("://") <= 0 || h.indexOf("data:image/") === 0 || h.indexOf("blob:") === 0)
return !0;
const c = new URL(h), p = window.location;
return c.protocol === p.protocol && c.host === p.host;
}
function Ge(h, c, p) {
p[h] && p[h].indexOf(c) !== -1 || (p[h] = p[h] || [], p[h].push(c));
}
function Tr(h, c, p) {
if (p && p[h]) {
const g = p[h].indexOf(c);
g !== -1 && p[h].splice(g, 1);
}
}
class qe {
constructor(c, p = {}) {
$(this, p), this.type = c;
}
}
class $e extends qe {
constructor(c, p = {}) {
super("error", $({ error: c }, p));
}
}
class ar {
on(c, p) {
return this._listeners = this._listeners || {}, Ge(c, p, this._listeners), this;
}
off(c, p) {
return Tr(c, p, this._listeners), Tr(c, p, this._oneTimeListeners), this;
}
once(c, p) {
return p ? (this._oneTimeListeners = this._oneTimeListeners || {}, Ge(c, p, this._oneTimeListeners), this) : new Promise((g) => this.once(c, g));
}
fire(c, p) {
typeof c == "string" && (c = new qe(c, p || {}));
const g = c.type;
if (this.listens(g)) {
c.target = this;
const w = this._listeners && this._listeners[g] ? this._listeners[g].slice() : [];
for (const C of w)
C.call(this, c);
const H = this._oneTimeListeners && this._oneTimeListeners[g] ? this._oneTimeListeners[g].slice() : [];
for (const C of H)
Tr(g, C, this._oneTimeListeners), C.call(this, c);
const A = this._eventedParent;
A && ($(c, typeof this._eventedParentData == "function" ? this._eventedParentData() : this._eventedParentData), A.fire(c));
} else
c instanceof $e && console.error(c.error);
return this;
}
listens(c) {
return this._listeners && this._listeners[c] && this._listeners[c].length > 0 || this._oneTimeListeners && this._oneTimeListeners[c] && this._oneTimeListeners[c].length > 0 || this._eventedParent && this._eventedParent.listens(c);
}
setEventedParent(c, p) {
return this._eventedParent = c, this._eventedParentData = p, this;
}
}
var Ct = { $version: 8, $root: { version: { required: !0, type: "enum", values: [8] }, name: { type: "string" }, metadata: { type: "*" }, center: { type: "array", value: "number" }, zoom: { type: "number" }, bearing: { type: "number", default: 0, period: 360, units: "degrees" }, pitch: { type: "number", default: 0, units: "degrees" }, light: { type: "light" }, sky: { type: "sky" }, projection: { type: "projection" }, terrain: { type: "terrain" }, sources: { required: !0, type: "sources" }, sprite: { type: "sprite" }, glyphs: { type: "string" }, transition: { type: "transition" }, layers: { required: !0, type: "array", value: "layer" } }, sources: { "*": { type: "source" } }, source: ["source_vector", "source_raster", "source_raster_dem", "source_geojson", "source_video", "source_image"], source_vector: { type: { required: !0, type: "enum", values: { vector: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, attribution: { type: "string" }, promoteId: { type: "promoteId" }, volatile: { type: "boolean", default: !1 }, "*": { type: "*" } }, source_raster: { type: { required: !0, type: "enum", values: { raster: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, attribution: { type: "string" }, volatile: { type: "boolean", default: !1 }, "*": { type: "*" } }, source_raster_dem: { type: { required: !0, type: "enum", values: { "raster-dem": {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, attribution: { type: "string" }, encoding: { type: "enum", values: { terrarium: {}, mapbox: {}, custom: {} }, default: "mapbox" }, redFactor: { type: "number", default: 1 }, blueFactor: { type: "number", default: 1 }, greenFactor: { type: "number", default: 1 }, baseShift: { type: "number", default: 0 }, volatile: { type: "boolean", default: !1 }, "*": { type: "*" } }, source_geojson: { type: { required: !0, type: "enum", values: { geojson: {} } }, data: { required: !0, type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, filter: { type: "*" }, tolerance: { type: "number", default: 0.375 }, cluster: { type: "boolean", default: !1 }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterMinPoints: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: !1 }, generateId: { type: "boolean", default: !1 }, promoteId: { type: "promoteId" } }, source_video: { type: { required: !0, type: "enum", values: { video: {} } }, urls: { required: !0, type: "array", value: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: !0, type: "enum", values: { image: {} } }, url: { required: !0, type: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: !0 }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, background: {} }, required: !0 }, metadata: { type: "*" }, source: { type: "string" }, "source-layer": { type: "string" }, minzoom: { type: "number", minimum: 0, maximum: 24 }, maxzoom: { type: "number", minimum: 0, maximum: 24 }, filter: { type: "filter" }, layout: { type: "layout" }, paint: { type: "paint" } }, layout: ["layout_fill", "layout_line", "layout_circle", "layout_heatmap", "layout_fill-extrusion", "layout_symbol", "layout_raster", "layout_hillshade", "layout_background"], layout_background: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_fill: { "fill-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_circle: { "circle-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_heatmap: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, "layout_fill-extrusion": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_line: { "line-cap": { type: "enum", values: { butt: {}, round: {}, square: {} }, default: "butt", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_symbol: { "symbol-placement": { type: "enum", values: { point: {}, line: {}, "line-center": {} }, default: "point", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: !1, requires: ["icon-image", { "!": "icon-overlap" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: !1, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: !1, requires: ["icon-image", "text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-size": { type: "number", default: 1, minimum: 0, units: "factor of the original icon size", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-text-fit": { type: "enum", values: { none: {}, width: {}, height: {}, both: {} }, default: "none", requires: ["icon-image", "text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-text-fit-padding": { type: "array", value: "number", length: 4, default: [0, 0, 0, 0], units: "pixels", requires: ["icon-image", "text-field", { "icon-text-fit": ["both", "width", "height"] }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "padding", default: [2], units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-keep-upright": { type: "boolean", default: !1, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, "viewport-glyph": {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"], requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-radial-offset": { type: "number", units: "ems", default: 0, requires: ["text-field"], "property-type": "data-driven", expression: { interpolated: !0, parameters: ["zoom", "feature"] } }, "text-variable-anchor": { type: "array", value: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-variable-anchor-offset": { type: "variableAnchorOffsetCollection", requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["text-field", { "!": "text-variable-anchor" }], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-angle": { type: "number", default: 45, units: "degrees", requires: ["text-field", { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: !0, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-offset": { type: "array", value: "number", units: "ems", length: 2, default: [0, 0], requires: ["text-field", { "!": "text-radial-offset" }], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: !1, requires: ["text-field", { "!": "text-overlap" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-overlap": { type: "enum", values: { never: {}, always: {}, cooperative: {} }, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: !1, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: !1, requires: ["text-field", "icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_raster: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_hillshade: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, filter: { type: "array", value: "*" }, filter_operator: { type: "enum", values: { "==": {}, "!=": {}, ">": {}, ">=": {}, "<": {}, "<=": {}, in: {}, "!in": {}, all: {}, any: {}, none: {}, has: {}, "!has": {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: !1 } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "*", minimum: 1 }, light: { anchor: { type: "enum", default: "viewport", values: { map: {}, viewport: {} }, "property-type": "data-constant", transition: !1, expression: { interpolated: !1, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, intensity: { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 } }, sky: { "sky-color": { type: "color", "property-type": "data-constant", default: "#88C6FC", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "horizon-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "fog-color": { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "fog-ground-blend": { type: "number", "property-type": "data-constant", default: 0.5, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "horizon-fog-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "sky-horizon-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, "atmosphere-blend": { type: "number", "property-type": "data-constant", default: 0.8, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 } }, terrain: { source: { type: "string", required: !0 }, exaggeration: { type: "number", minimum: 0, default: 1 } }, projection: { type: { type: "enum", default: "mercator", values: { mercator: {}, globe: {} } } }, paint: ["paint_fill", "paint_line", "paint_circle", "paint_heatmap", "paint_fill-extrusion", "paint_symbol", "paint_raster", "paint_hillshade", "paint_background"], paint_fill: { "fill-antialias": { type: "boolean", default: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: !0, requires: [{ "!": "fill-pattern" }, { "fill-antialias": !0 }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, requires: ["fill-extrusion-height"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: !0, transition: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "line-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: !0, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "line-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: !1, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: !0 } }], expression: { interpolated: !0, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: !1, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "heatmap-color": { type: "color", default: ["interpolate", ["linear"], ["heatmap-density"], 0, "rgba(0, 0, 255, 0)", 0.1, "royalblue", 0.3, "cyan", 0.5, "lime", 0.7, "yellow", 1, "red"], transition: !1, expression: { interpolated: !0, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: !0, overridable: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: !0, units: "degrees", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: !1, units: "milliseconds", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "number", default: 335, minimum: 0, maximum: 359, transition: !1, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: 0.5, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "color", default: "#FFFFFF", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "background-pattern" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, transition: { duration: { type: "number", default: 300, minimum: 0, units: "milliseconds" }, delay: { type: "number", default: 0, minimum: 0, units: "milliseconds" } }, "property-type": { "data-driven": { type: "property-type" }, "cross-faded": { type: "property-type" }, "cross-faded-data-driven": { type: "property-type" }, "color-ramp": { type: "property-type" }, "data-constant": { type: "property-type" }, constant: { type: "property-type" } }, promoteId: { "*": { type: "string" } } };
const en = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
function Jr(h, c) {
const p = {};
for (const g in h)
g !== "ref" && (p[g] = h[g]);
return en.forEach((g) => {
g in c && (p[g] = c[g]);
}), p;
}
function Hr(h, c) {
if (Array.isArray(h)) {
if (!Array.isArray(c) || h.length !== c.length)
return !1;
for (let p = 0; p < h.length; p++)
if (!Hr(h[p], c[p]))
return !1;
return !0;
}
if (typeof h == "object" && h !== null && c !== null) {
if (typeof c != "object" || Object.keys(h).length !== Object.keys(c).length)
return !1;
for (const p in h)
if (!Hr(h[p], c[p]))
return !1;
return !0;
}
return h === c;
}
function Rr(h, c) {
h.push(c);
}
function dn(h, c, p) {
Rr(p, { command: "addSource", args: [h, c[h]] });
}
function ji(h, c, p) {
Rr(c, { command: "removeSource", args: [h] }), p[h] = !0;
}
function Ji(h, c, p, g) {
ji(h, p, g), dn(h, c, p);
}
function ki(h, c, p) {
let g;
for (g in h[p])
if (Object.prototype.hasOwnProperty.call(h[p], g) && g !== "data" && !Hr(h[p][g], c[p][g]))
return !1;
for (g in c[p])
if (Object.prototype.hasOwnProperty.call(c[p], g) && g !== "data" && !Hr(h[p][g], c[p][g]))
return !1;
return !0;
}
function _i(h, c, p, g, w, H) {
h = h || {}, c = c || {};
for (const A in h)
Object.prototype.hasOwnProperty.call(h, A) && (Hr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], w] }));
for (const A in c)
Object.prototype.hasOwnProperty.call(c, A) && !Object.prototype.hasOwnProperty.call(h, A) && (Hr(h[A], c[A]) || p.push({ command: H, args: [g, A, c[A], w] }));
}
function Ii(h) {
return h.id;
}
function c1(h, c) {
return h[c.id] = c, h;
}
class ye {
constructor(c, p, g, w) {
this.message = (c ? `${c}: ` : "") + g, w && (this.identifier = w), p != null && p.__line__ && (this.line = p.__line__);
}
}
function bi(h, ...c) {
for (const p of c)
for (const g in p)
h[g] = p[g];
return h;
}
class Xn extends Error {
constructor(c, p) {
super(p), this.message = p, this.key = c;
}
}
class Hi {
constructor(c, p = []) {
this.parent = c, this.bindings = {};
for (const [g, w] of p)
this.bindings[g] = w;
}
concat(c) {
return new Hi(this, c);
}
get(c) {
if (this.bindings[c])
return this.bindings[c];
if (this.parent)
return this.parent.get(c);
throw new Error(`${c} not found in scope.`);
}
has(c) {
return !!this.bindings[c] || !!this.parent && this.parent.has(c);
}
}
const t1 = { kind: "null" }, xe = { kind: "number" }, Dr = { kind: "string" }, _r = { kind: "boolean" }, Vn = { kind: "color" }, y1 = { kind: "object" }, wr = { kind: "value" }, Pi = { kind: "collator" }, H1 = { kind: "formatted" }, Vi = { kind: "padding" }, Rn = { kind: "resolvedImage" }, xt = { kind: "variableAnchorOffsetCollection" };
function ot(h, c) {
return { kind: "array", itemType: h, N: c };
}
function st(h) {
if (h.kind === "array") {
const c = st(h.itemType);
return typeof h.N == "number" ? `array<${c}, ${h.N}>` : h.itemType.kind === "value" ? "array" : `array<${c}>`;
}
return h.kind;
}
const pt = [t1, xe, Dr, _r, Vn, H1, y1, ot(wr), Vi, Rn, xt];
function yt(h, c) {
if (c.kind === "error")
return null;
if (h.kind === "array") {
if (c.kind === "array" && (c.N === 0 && c.itemType.kind === "value" || !yt(h.itemType, c.itemType)) && (typeof h.N != "number" || h.N === c.N))
return null;
} else {
if (h.kind === c.kind)
return null;
if (h.kind === "value") {
for (const p of pt)
if (!yt(p, c))
return null;
}
}
return `Expected ${st(h)} but found ${st(c)} instead.`;
}
function At(h, c) {
return c.some((p) => p.kind === h.kind);
}
function Vt(h, c) {
return c.some((p) => p === "null" ? h === null : p === "array" ? Array.isArray(h) : p === "object" ? h && !Array.isArray(h) && typeof h == "object" : p === typeof h);
}
function jt(h, c) {
return h.kind === "array" && c.kind === "array" ? h.itemType.kind === c.itemType.kind && typeof h.N == "number" : h.kind === c.kind;
}
const St = 0.96422, Jt = 0.82521, ae = 4 / 29, Xt = 6 / 29, Le = 3 * Xt * Xt, or = Xt * Xt * Xt, Rt = Math.PI / 180, Te = 180 / Math.PI;
function Se(h) {
return (h %= 360) < 0 && (h += 360), h;
}
function lr([h, c, p, g]) {
let w, H;
const A = vn((0.2225045 * (h = Ar(h)) + 0.7168786 * (c = Ar(c)) + 0.0606169 * (p = Ar(p))) / 1);
h === c && c === p ? w = H = A : (w = vn((0.4360747 * h + 0.3850649 * c + 0.1430804 * p) / St), H = vn((0.0139322 * h + 0.0971045 * c + 0.7141733 * p) / Jt));
const C = 116 * A - 16;
return [C < 0 ? 0 : C, 500 * (w - A), 200 * (A - H), g];
}
function Ar(h) {
return h <= 0.04045 ? h / 12.92 : Math.pow((h + 0.055) / 1.055, 2.4);
}
function vn(h) {
return h > or ? Math.pow(h, 1 / 3) : h / Le + ae;
}
function zr([h, c, p, g]) {
let w = (h + 16) / 116, H = isNaN(c) ? w : w + c / 500, A = isNaN(p) ? w : w - p / 200;
return w = 1 * Br(w), H = St * Br(H), A = Jt * Br(A), [br(3.1338561 * H - 1.6168667 * w - 0.4906146 * A), br(-0.9787684 * H + 1.9161415 * w + 0.033454 * A), br(0.0719453 * H - 0.2289914 * w + 1.4052427 * A), g];
}
function br(h) {
return (h = h <= 304e-5 ? 12.92 * h : 1.055 * Math.pow(h, 1 / 2.4) - 0.055) < 0 ? 0 : h > 1 ? 1 : h;
}
function Br(h) {
return h > Xt ? h * h * h : Le * (h - ae);
}
function cn(h) {
return parseInt(h.padEnd(2, h), 16) / 255;
}
function Kn(h, c) {
return Li(c ? h / 100 : h, 0, 1);
}
function Li(h, c, p) {
return Math.min(Math.max(c, h), p);
}
function Ri(h) {
return !h.some(Number.isNaN);
}
const rs = { 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] };
class tn {
constructor(c, p, g, w = 1, H = !0) {
this.r = c, this.g = p, this.b = g, this.a = w, H || (this.r *= w, this.g *= w, this.b *= w, w || this.overwriteGetter("rgb", [c, p, g, w]));
}
static parse(c) {
if (c instanceof tn)
return c;
if (typeof c != "string")
return;
const p = function(g) {
if ((g = g.toLowerCase().trim()) === "transparent")
return [0, 0, 0, 0];
const w = rs[g];
if (w) {
const [A, C, N] = w;
return [A / 255, C / 255, N / 255, 1];
}
if (g.startsWith("#") && /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(g)) {
const A = g.length < 6 ? 1 : 2;
let C = 1;
return [cn(g.slice(C, C += A)), cn(g.slice(C, C += A)), cn(g.slice(C, C += A)), cn(g.slice(C, C + A) || "ff")];
}
if (g.startsWith("rgb")) {
const A = g.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
if (A) {
const [C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t] = A, Pt = [W || " ", at || " ", Lt].join("");
if (Pt === " " || Pt === " /" || Pt === ",," || Pt === ",,,") {
const Bt = [z, tt, Tt].join(""), ee = Bt === "%%%" ? 100 : Bt === "" ? 255 : 0;
if (ee) {
const _e = [Li(+N / ee, 0, 1), Li(+X / ee, 0, 1), Li(+ut / ee, 0, 1), Et ? Kn(+Et, $t) : 1];
if (Ri(_e))
return _e;
}
}
return;
}
}
const H = g.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);
if (H) {
const [A, C, N, z, W, X, tt, at, ut] = H, Tt = [N || " ", W || " ", tt].join("");
if (Tt === " " || Tt === " /" || Tt === ",," || Tt === ",,,") {
const Lt = [+C, Li(+z, 0, 100), Li(+X, 0, 100), at ? Kn(+at, ut) : 1];
if (Ri(Lt))
return function([Et, $t, Pt, Bt]) {
function ee(_e) {
const Xe = (_e + Et / 30) % 12, Er = $t * Math.min(Pt, 1 - Pt);
return Pt - Er * Math.max(-1, Math.min(Xe - 3, 9 - Xe, 1));
}
return Et = Se(Et), $t /= 100, Pt /= 100, [ee(0), ee(8), ee(4), Bt];
}(Lt);
}
}
}(c);
return p ? new tn(...p, !1) : void 0;
}
get rgb() {
const { r: c, g: p, b: g, a: w } = this, H = w || 1 / 0;
return this.overwriteGetter("rgb", [c / H, p / H, g / H, w]);
}
get hcl() {
return this.overwriteGetter("hcl", function(c) {
const [p, g, w, H] = lr(c), A = Math.sqrt(g * g + w * w);
return [Math.round(1e4 * A) ? Se(Math.atan2(w, g) * Te) : NaN, A, p, H];
}(this.rgb));
}
get lab() {
return this.overwriteGetter("lab", lr(this.rgb));
}
overwriteGetter(c, p) {
return Object.defineProperty(this, c, { value: p }), p;
}
toString() {
const [c, p, g, w] = this.rgb;
return `rgba(${[c, p, g].map((H) => Math.round(255 * H)).join(",")},${w})`;
}
}
tn.black = new tn(0, 0, 0, 1), tn.white = new tn(1, 1, 1, 1), tn.transparent = new tn(0, 0, 0, 0), tn.red = new tn(1, 0, 0, 1);
class zi {
constructor(c, p, g) {
this.sensitivity = c ? p ? "variant" : "case" : p ? "accent" : "base", this.locale = g, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" });
}
compare(c, p) {
return this.collator.compare(c, p);
}
resolvedLocale() {
return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;
}
}
class co {
constructor(c, p, g, w, H) {
this.text = c, this.image = p, this.scale = g, this.fontStack = w, this.textColor = H;
}
}
class Xr {
constructor(c) {
this.sections = c;
}
static fromString(c) {
return new Xr([new co(c, null, null, null, null)]);
}
isEmpty() {
return this.sections.length === 0 || !this.sections.some((c) => c.text.length !== 0 || c.image && c.image.name.length !== 0);
}
static factory(c) {
return c instanceof Xr ? c : Xr.fromString(c);
}
toString() {
return this.sections.length === 0 ? "" : this.sections.map((c) => c.text).join("");
}
}
class Yn {
constructor(c) {
this.values = c.slice();
}
static parse(c) {
if (c instanceof Yn)
return c;
if (typeof c == "number")
return new Yn([c, c, c, c]);
if (Array.isArray(c) && !(c.length < 1 || c.length > 4)) {
for (const p of c)
if (typeof p != "number")
return;
switch (c.length) {
case 1:
c = [c[0], c[0], c[0], c[0]];
break;
case 2:
c = [c[0], c[1], c[0], c[1]];
break;
case 3:
c = [c[0], c[1], c[2], c[1]];
}
return new Yn(c);
}
}
toString() {
return JSON.stringify(this.values);
}
}
const ns = /* @__PURE__ */ new Set(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]);
class _n {
constructor(c) {
this.values = c.slice();
}
static parse(c) {
if (c instanceof _n)
return c;
if (Array.isArray(c) && !(c.length < 1) && c.length % 2 == 0) {
for (let p = 0; p < c.length; p += 2) {
const g = c[p], w = c[p + 1];
if (typeof g != "string" || !ns.has(g) || !Array.isArray(w) || w.length !== 2 || typeof w[0] != "number" || typeof w[1] != "number")
return;
}
return new _n(c);
}
}
toString() {
return JSON.stringify(this.values);
}
}
class pn {
constructor(c) {
this.name = c.name, this.available = c.available;
}
toString() {
return this.name;
}
static fromString(c) {
return c ? new pn({ name: c, available: !1 }) : null;
}
}
function uo(h, c, p, g) {
return typeof h == "number" && h >= 0 && h <= 255 && typeof c == "number" && c >= 0 && c <= 255 && typeof p == "number" && p >= 0 && p <= 255 ? g === void 0 || typeof g == "number" && g >= 0 && g <= 1 ? null : `Invalid rgba value [${[h, c, p, g].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${(typeof g == "number" ? [h, c, p, g] : [h, c, p]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`;
}
function u1(h) {
if (h === null || typeof h == "string" || typeof h == "boolean" || typeof h == "number" || h instanceof tn || h instanceof zi || h instanceof Xr || h instanceof Yn || h instanceof _n || h instanceof pn)
return !0;
if (Array.isArray(h)) {
for (const c of h)
if (!u1(c))
return !1;
return !0;
}
if (typeof h == "object") {
for (const c in h)
if (!u1(h[c]))
return !1;
return !0;
}
return !1;
}
function Qn(h) {
if (h === null)
return t1;
if (typeof h == "string")
return Dr;
if (typeof h == "boolean")
return _r;
if (typeof h == "number")
return xe;
if (h instanceof tn)
return Vn;
if (h instanceof zi)
return Pi;
if (h instanceof Xr)
return H1;
if (h instanceof Yn)
return Vi;
if (h instanceof _n)
return xt;
if (h instanceof pn)
return Rn;
if (Array.isArray(h)) {
const c = h.length;
let p;
for (const g of h) {
const w = Qn(g);
if (p) {
if (p === w)
continue;
p = wr;
break;
}
p = w;
}
return ot(p || wr, c);
}
return y1;
}
function Ui(h) {
const c = typeof h;
return h === null ? "" : c === "string" || c === "number" || c === "boolean" ? String(h) : h instanceof tn || h instanceof Xr || h instanceof Yn || h instanceof _n || h instanceof pn ? h.toString() : JSON.stringify(h);
}
class h1 {
constructor(c, p) {
this.type = c, this.value = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'literal' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (!u1(c[1]))
return p.error("invalid value");
const g = c[1];
let w = Qn(g);
const H = p.expectedType;
return w.kind !== "array" || w.N !== 0 || !H || H.kind !== "array" || typeof H.N == "number" && H.N !== 0 || (w = H), new h1(w, g);
}
evaluate() {
return this.value;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
class jn {
constructor(c) {
this.name = "ExpressionEvaluationError", this.message = c;
}
toJSON() {
return this.message;
}
}
const is = { string: Dr, number: xe, boolean: _r, object: y1 };
class d1 {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
let g, w = 1;
const H = c[0];
if (H === "array") {
let C, N;
if (c.length > 2) {
const z = c[1];
if (typeof z != "string" || !(z in is) || z === "object")
return p.error('The item type argument of "array" must be one of string, number, boolean', 1);
C = is[z], w++;
} else
C = wr;
if (c.length > 3) {
if (c[2] !== null && (typeof c[2] != "number" || c[2] < 0 || c[2] !== Math.floor(c[2])))
return p.error('The length argument to "array" must be a positive integer literal', 2);
N = c[2], w++;
}
g = ot(C, N);
} else {
if (!is[H])
throw new Error(`Types doesn't contain name = ${H}`);
g = is[H];
}
const A = [];
for (; w < c.length; w++) {
const C = p.parse(c[w], w, wr);
if (!C)
return null;
A.push(C);
}
return new d1(g, A);
}
evaluate(c) {
for (let p = 0; p < this.args.length; p++) {
const g = this.args[p].evaluate(c);
if (!yt(this.type, Qn(g)))
return g;
if (p === this.args.length - 1)
throw new jn(`Expected value to be of type ${st(this.type)}, but found ${st(Qn(g))} instead.`);
}
throw new Error();
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
const b2 = { "to-boolean": _r, "to-color": Vn, "to-number": xe, "to-string": Dr };
class e1 {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
const g = c[0];
if (!b2[g])
throw new Error(`Can't parse ${g} as it is not part of the known types`);
if ((g === "to-boolean" || g === "to-string") && c.length !== 2)
return p.error("Expected one argument.");
const w = b2[g], H = [];
for (let A = 1; A < c.length; A++) {
const C = p.parse(c[A], A, wr);
if (!C)
return null;
H.push(C);
}
return new e1(w, H);
}
evaluate(c) {
switch (this.type.kind) {
case "boolean":
return !!this.args[0].evaluate(c);
case "color": {
let p, g;
for (const w of this.args) {
if (p = w.evaluate(c), g = null, p instanceof tn)
return p;
if (typeof p == "string") {
const H = c.parseColor(p);
if (H)
return H;
} else if (Array.isArray(p) && (g = p.length < 3 || p.length > 4 ? `Invalid rbga value ${JSON.stringify(p)}: expected an array containing either three or four numeric values.` : uo(p[0], p[1], p[2], p[3]), !g))
return new tn(p[0] / 255, p[1] / 255, p[2] / 255, p[3]);
}
throw new jn(g || `Could not parse color from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "padding": {
let p;
for (const g of this.args) {
p = g.evaluate(c);
const w = Yn.parse(p);
if (w)
return w;
}
throw new jn(`Could not parse padding from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "variableAnchorOffsetCollection": {
let p;
for (const g of this.args) {
p = g.evaluate(c);
const w = _n.parse(p);
if (w)
return w;
}
throw new jn(`Could not parse variableAnchorOffsetCollection from value '${typeof p == "string" ? p : JSON.stringify(p)}'`);
}
case "number": {
let p = null;
for (const g of this.args) {
if (p = g.evaluate(c), p === null)
return 0;
const w = Number(p);
if (!isNaN(w))
return w;
}
throw new jn(`Could not convert ${JSON.stringify(p)} to number.`);
}
case "formatted":
return Xr.fromString(Ui(this.args[0].evaluate(c)));
case "resolvedImage":
return pn.fromString(Ui(this.args[0].evaluate(c)));
default:
return Ui(this.args[0].evaluate(c));
}
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
const Ho = ["Unknown", "Point", "LineString", "Polygon"];
class ma {
constructor() {
this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null, this.canonical = null;
}
id() {
return this.feature && "id" in this.feature ? this.feature.id : null;
}
geometryType() {
return this.feature ? typeof this.feature.type == "number" ? Ho[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(c) {
let p = this._parseColorCache[c];
return p || (p = this._parseColorCache[c] = tn.parse(c)), p;
}
}
class Xo {
constructor(c, p, g = [], w, H = new Hi(), A = []) {
this.registry = c, this.path = g, this.key = g.map((C) => `[${C}]`).join(""), this.scope = H, this.errors = A, this.expectedType = w, this._isConstant = p;
}
parse(c, p, g, w, H = {}) {
return p ? this.concat(p, g, w)._parse(c, H) : this._parse(c, H);
}
_parse(c, p) {
function g(w, H, A) {
return A === "assert" ? new d1(H, [w]) : A === "coerce" ? new e1(H, [w]) : w;
}
if (c !== null && typeof c != "string" && typeof c != "boolean" && typeof c != "number" || (c = ["literal", c]), Array.isArray(c)) {
if (c.length === 0)
return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
const w = c[0];
if (typeof w != "string")
return this.error(`Expression name must be a string, but found ${typeof w} instead. If you wanted a literal array, use ["literal", [...]].`, 0), null;
const H = this.registry[w];
if (H) {
let A = H.parse(c, this);
if (!A)
return null;
if (this.expectedType) {
const C = this.expectedType, N = A.type;
if (C.kind !== "string" && C.kind !== "number" && C.kind !== "boolean" && C.kind !== "object" && C.kind !== "array" || N.kind !== "value")
if (C.kind !== "color" && C.kind !== "formatted" && C.kind !== "resolvedImage" || N.kind !== "value" && N.kind !== "string")
if (C.kind !== "padding" || N.kind !== "value" && N.kind !== "number" && N.kind !== "array")
if (C.kind !== "variableAnchorOffsetCollection" || N.kind !== "value" && N.kind !== "array") {
if (this.checkSubtype(C, N))
return null;
} else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "coerce");
else
A = g(A, C, p.typeAnnotation || "assert");
}
if (!(A instanceof h1) && A.type.kind !== "resolvedImage" && this._isConstant(A)) {
const C = new ma();
try {
A = new h1(A.type, A.evaluate(C));
} catch (N) {
return this.error(N.message), null;
}
}
return A;
}
return this.error(`Unknown expression "${w}". If you wanted a literal array, use ["literal", [...]].`, 0);
}
return this.error(c === void 0 ? "'undefined' value invalid. Use null instead." : typeof c == "object" ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof c} instead.`);
}
concat(c, p, g) {
const w = typeof c == "number" ? this.path.concat(c) : this.path, H = g ? this.scope.concat(g) : this.scope;
return new Xo(this.registry, this._isConstant, w, p || null, H, this.errors);
}
error(c, ...p) {
const g = `${this.key}${p.map((w) => `[${w}]`).join("")}`;
this.errors.push(new Xn(g, c));
}
checkSubtype(c, p) {
const g = yt(c, p);
return g && this.error(g), g;
}
}
class ho {
constructor(c, p) {
this.type = p.type, this.bindings = [].concat(c), this.result = p;
}
evaluate(c) {
return this.result.evaluate(c);
}
eachChild(c) {
for (const p of this.bindings)
c(p[1]);
c(this.result);
}
static parse(c, p) {
if (c.length < 4)
return p.error(`Expected at least 3 arguments, but found ${c.length - 1} instead.`);
const g = [];
for (let H = 1; H < c.length - 1; H += 2) {
const A = c[H];
if (typeof A != "string")
return p.error(`Expected string, but found ${typeof A} instead.`, H);
if (/[^a-zA-Z0-9_]/.test(A))
return p.error("Variable names must contain only alphanumeric characters or '_'.", H);
const C = p.parse(c[H + 1], H + 1);
if (!C)
return null;
g.push([A, C]);
}
const w = p.parse(c[c.length - 1], c.length - 1, p.expectedType, g);
return w ? new ho(g, w) : null;
}
outputDefined() {
return this.result.outputDefined();
}
}
class Yr {
constructor(c, p) {
this.type = p.type, this.name = c, this.boundExpression = p;
}
static parse(c, p) {
if (c.length !== 2 || typeof c[1] != "string")
return p.error("'var' expression requires exactly one string literal argument.");
const g = c[1];
return p.scope.has(g) ? new Yr(g, p.scope.get(g)) : p.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`, 1);
}
evaluate(c) {
return this.boundExpression.evaluate(c);
}
eachChild() {
}
outputDefined() {
return !1;
}
}
class I {
constructor(c, p, g) {
this.type = c, this.index = p, this.input = g;
}
static parse(c, p) {
if (c.length !== 3)
return p.error(`Expected 2 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, xe), w = p.parse(c[2], 2, ot(p.expectedType || wr));
return g && w ? new I(w.type.itemType, g, w) : null;
}
evaluate(c) {
const p = this.index.evaluate(c), g = this.input.evaluate(c);
if (p < 0)
throw new jn(`Array index out of bounds: ${p} < 0.`);
if (p >= g.length)
throw new jn(`Array index out of bounds: ${p} > ${g.length - 1}.`);
if (p !== Math.floor(p))
throw new jn(`Array index must be an integer, but found ${p} instead.`);
return g[p];
}
eachChild(c) {
c(this.index), c(this.input);
}
outputDefined() {
return !1;
}
}
class G {
constructor(c, p) {
this.type = _r, this.needle = c, this.haystack = p;
}
static parse(c, p) {
if (c.length !== 3)
return p.error(`Expected 2 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, wr);
return g && w ? At(g.type, [_r, Dr, xe, t1, wr]) ? new G(g, w) : p.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(g.type)} instead`) : null;
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!g)
return !1;
if (!Vt(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${st(Qn(p))} instead.`);
if (!Vt(g, ["string", "array"]))
throw new jn(`Expected second argument to be of type array or string, but found ${st(Qn(g))} instead.`);
return g.indexOf(p) >= 0;
}
eachChild(c) {
c(this.needle), c(this.haystack);
}
outputDefined() {
return !0;
}
}
class B {
constructor(c, p, g) {
this.type = xe, this.needle = c, this.haystack = p, this.fromIndex = g;
}
static parse(c, p) {
if (c.length <= 2 || c.length >= 5)
return p.error(`Expected 3 or 4 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, wr);
if (!g || !w)
return null;
if (!At(g.type, [_r, Dr, xe, t1, wr]))
return p.error(`Expected first argument to be of type boolean, string, number or null, but found ${st(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new B(g, w, H) : null;
}
return new B(g, w);
}
evaluate(c) {
const p = this.needle.evaluate(c), g = this.haystack.evaluate(c);
if (!Vt(p, ["boolean", "string", "number", "null"]))
throw new jn(`Expected first argument to be of type boolean, string, number or null, but found ${st(Qn(p))} instead.`);
let w;
if (this.fromIndex && (w = this.fromIndex.evaluate(c)), Vt(g, ["string"])) {
const H = g.indexOf(p, w);
return H === -1 ? -1 : [...g.slice(0, H)].length;
}
if (Vt(g, ["array"]))
return g.indexOf(p, w);
throw new jn(`Expected second argument to be of type array or string, but found ${st(Qn(g))} instead.`);
}
eachChild(c) {
c(this.needle), c(this.haystack), this.fromIndex && c(this.fromIndex);
}
outputDefined() {
return !1;
}
}
class q {
constructor(c, p, g, w, H, A) {
this.inputType = c, this.type = p, this.input = g, this.cases = w, this.outputs = H, this.otherwise = A;
}
static parse(c, p) {
if (c.length < 5)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if (c.length % 2 != 1)
return p.error("Expected an even number of arguments.");
let g, w;
p.expectedType && p.expectedType.kind !== "value" && (w = p.expectedType);
const H = {}, A = [];
for (let z = 2; z < c.length - 1; z += 2) {
let W = c[z];
const X = c[z + 1];
Array.isArray(W) || (W = [W]);
const tt = p.concat(z);
if (W.length === 0)
return tt.error("Expected at least one branch label.");
for (const ut of W) {
if (typeof ut != "number" && typeof ut != "string")
return tt.error("Branch labels must be numbers or strings.");
if (typeof ut == "number" && Math.abs(ut) > Number.MAX_SAFE_INTEGER)
return tt.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
if (typeof ut == "number" && Math.floor(ut) !== ut)
return tt.error("Numeric branch labels must be integer values.");
if (g) {
if (tt.checkSubtype(g, Qn(ut)))
return null;
} else
g = Qn(ut);
if (H[String(ut)] !== void 0)
return tt.error("Branch labels must be unique.");
H[String(ut)] = A.length;
}
const at = p.parse(X, z, w);
if (!at)
return null;
w = w || at.type, A.push(at);
}
const C = p.parse(c[1], 1, wr);
if (!C)
return null;
const N = p.parse(c[c.length - 1], c.length - 1, w);
return N ? C.type.kind !== "value" && p.concat(1).checkSubtype(g, C.type) ? null : new q(g, w, C, H, A, N) : null;
}
evaluate(c) {
const p = this.input.evaluate(c);
return (Qn(p) === this.inputType && this.outputs[this.cases[p]] || this.otherwise).evaluate(c);
}
eachChild(c) {
c(this.input), this.outputs.forEach(c), c(this.otherwise);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined()) && this.otherwise.outputDefined();
}
}
class it {
constructor(c, p, g) {
this.type = c, this.branches = p, this.otherwise = g;
}
static parse(c, p) {
if (c.length < 4)
return p.error(`Expected at least 3 arguments, but found only ${c.length - 1}.`);
if (c.length % 2 != 0)
return p.error("Expected an odd number of arguments.");
let g;
p.expectedType && p.expectedType.kind !== "value" && (g = p.expectedType);
const w = [];
for (let A = 1; A < c.length - 1; A += 2) {
const C = p.parse(c[A], A, _r);
if (!C)
return null;
const N = p.parse(c[A + 1], A + 1, g);
if (!N)
return null;
w.push([C, N]), g = g || N.type;
}
const H = p.parse(c[c.length - 1], c.length - 1, g);
if (!H)
return null;
if (!g)
throw new Error("Can't infer output type");
return new it(g, w, H);
}
evaluate(c) {
for (const [p, g] of this.branches)
if (p.evaluate(c))
return g.evaluate(c);
return this.otherwise.evaluate(c);
}
eachChild(c) {
for (const [p, g] of this.branches)
c(p), c(g);
c(this.otherwise);
}
outputDefined() {
return this.branches.every(([c, p]) => p.outputDefined()) && this.otherwise.outputDefined();
}
}
class ht {
constructor(c, p, g, w) {
this.type = c, this.input = p, this.beginIndex = g, this.endIndex = w;
}
static parse(c, p) {
if (c.length <= 2 || c.length >= 5)
return p.error(`Expected 3 or 4 arguments, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1, wr), w = p.parse(c[2], 2, xe);
if (!g || !w)
return null;
if (!At(g.type, [ot(wr), Dr, wr]))
return p.error(`Expected first argument to be of type array or string, but found ${st(g.type)} instead`);
if (c.length === 4) {
const H = p.parse(c[3], 3, xe);
return H ? new ht(g.type, g, w, H) : null;
}
return new ht(g.type, g, w);
}
evaluate(c) {
const p = this.input.evaluate(c), g = this.beginIndex.evaluate(c);
let w;
if (this.endIndex && (w = this.endIndex.evaluate(c)), Vt(p, ["string"]))
return [...p].slice(g, w).join("");
if (Vt(p, ["array"]))
return p.slice(g, w);
throw new jn(`Expected first argument to be of type array or string, but found ${st(Qn(p))} instead.`);
}
eachChild(c) {
c(this.input), c(this.beginIndex), this.endIndex && c(this.endIndex);
}
outputDefined() {
return !1;
}
}
function mt(h, c) {
const p = h.length - 1;
let g, w, H = 0, A = p, C = 0;
for (; H <= A; )
if (C = Math.floor((H + A) / 2), g = h[C], w = h[C + 1], g <= c) {
if (C === p || c < w)
return C;
H = C + 1;
} else {
if (!(g > c))
throw new jn("Input is not a number.");
A = C - 1;
}
return 0;
}
class qt {
constructor(c, p, g) {
this.type = c, this.input = p, this.labels = [], this.outputs = [];
for (const [w, H] of g)
this.labels.push(w), this.outputs.push(H);
}
static parse(c, p) {
if (c.length - 1 < 4)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if ((c.length - 1) % 2 != 0)
return p.error("Expected an even number of arguments.");
const g = p.parse(c[1], 1, xe);
if (!g)
return null;
const w = [];
let H = null;
p.expectedType && p.expectedType.kind !== "value" && (H = p.expectedType);
for (let A = 1; A < c.length; A += 2) {
const C = A === 1 ? -1 / 0 : c[A], N = c[A + 1], z = A, W = A + 1;
if (typeof C != "number")
return p.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', z);
if (w.length && w[w.length - 1][0] >= C)
return p.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', z);
const X = p.parse(N, W, H);
if (!X)
return null;
H = H || X.type, w.push([C, X]);
}
return new qt(H, g, w);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const w = this.input.evaluate(c);
if (w <= p[0])
return g[0].evaluate(c);
const H = p.length;
return w >= p[H - 1] ? g[H - 1].evaluate(c) : g[mt(p, w)].evaluate(c);
}
eachChild(c) {
c(this.input);
for (const p of this.outputs)
c(p);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined());
}
}
function le(h) {
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
}
var ve = Me;
function Me(h, c, p, g) {
this.cx = 3 * h, this.bx = 3 * (p - h) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * c, this.by = 3 * (g - c) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = h, this.p1y = c, this.p2x = p, this.p2y = g;
}
Me.prototype = { sampleCurveX: function(h) {
return ((this.ax * h + this.bx) * h + this.cx) * h;
}, sampleCurveY: function(h) {
return ((this.ay * h + this.by) * h + this.cy) * h;
}, sampleCurveDerivativeX: function(h) {
return (3 * this.ax * h + 2 * this.bx) * h + this.cx;
}, solveCurveX: function(h, c) {
if (c === void 0 && (c = 1e-6), h < 0)
return 0;
if (h > 1)
return 1;
for (var p = h, g = 0; g < 8; g++) {
var w = this.sampleCurveX(p) - h;
if (Math.abs(w) < c)
return p;
var H = this.sampleCurveDerivativeX(p);
if (Math.abs(H) < 1e-6)
break;
p -= w / H;
}
var A = 0, C = 1;
for (p = h, g = 0; g < 20 && (w = this.sampleCurveX(p), !(Math.abs(w - h) < c)); g++)
h > w ? A = p : C = p, p = 0.5 * (C - A) + A;
return p;
}, solve: function(h, c) {
return this.sampleCurveY(this.solveCurveX(h, c));
} };
var be = le(ve);
function fr(h, c, p) {
return h + p * (c - h);
}
function kn(h, c, p) {
return h.map((g, w) => fr(g, c[w], p));
}
const xr = { number: fr, color: function(h, c, p, g = "rgb") {
switch (g) {
case "rgb": {
const [w, H, A, C] = kn(h.rgb, c.rgb, p);
return new tn(w, H, A, C, !1);
}
case "hcl": {
const [w, H, A, C] = h.hcl, [N, z, W, X] = c.hcl;
let tt, at;
if (isNaN(w) || isNaN(N))
isNaN(w) ? isNaN(N) ? tt = NaN : (tt = N, A !== 1 && A !== 0 || (at = z)) : (tt = w, W !== 1 && W !== 0 || (at = H));
else {
let $t = N - w;
N > w && $t > 180 ? $t -= 360 : N < w && w - N > 180 && ($t += 360), tt = w + p * $t;
}
const [ut, Tt, Lt, Et] = function([$t, Pt, Bt, ee]) {
return $t = isNaN($t) ? 0 : $t * Rt, zr([Bt, Math.cos($t) * Pt, Math.sin($t) * Pt, ee]);
}([tt, at ?? fr(H, z, p), fr(A, W, p), fr(C, X, p)]);
return new tn(ut, Tt, Lt, Et, !1);
}
case "lab": {
const [w, H, A, C] = zr(kn(h.lab, c.lab, p));
return new tn(w, H, A, C, !1);
}
}
}, array: kn, padding: function(h, c, p) {
return new Yn(kn(h.values, c.values, p));
}, variableAnchorOffsetCollection: function(h, c, p) {
const g = h.values, w = c.values;
if (g.length !== w.length)
throw new jn(`Cannot interpolate values of different length. from: ${h.toString()}, to: ${c.toString()}`);
const H = [];
for (let A = 0; A < g.length; A += 2) {
if (g[A] !== w[A])
throw new jn(`Cannot interpolate values containing mismatched anchors. from[${A}]: ${g[A]}, to[${A}]: ${w[A]}`);
H.push(g[A]);
const [C, N] = g[A + 1], [z, W] = w[A + 1];
H.push([fr(C, z, p), fr(N, W, p)]);
}
return new _n(H);
} };
class un {
constructor(c, p, g, w, H) {
this.type = c, this.operator = p, this.interpolation = g, this.input = w, this.labels = [], this.outputs = [];
for (const [A, C] of H)
this.labels.push(A), this.outputs.push(C);
}
static interpolationFactor(c, p, g, w) {
let H = 0;
if (c.name === "exponential")
H = pe(p, c.base, g, w);
else if (c.name === "linear")
H = pe(p, 1, g, w);
else if (c.name === "cubic-bezier") {
const A = c.controlPoints;
H = new be(A[0], A[1], A[2], A[3]).solve(pe(p, 1, g, w));
}
return H;
}
static parse(c, p) {
let [g, w, H, ...A] = c;
if (!Array.isArray(w) || w.length === 0)
return p.error("Expected an interpolation type expression.", 1);
if (w[0] === "linear")
w = { name: "linear" };
else if (w[0] === "exponential") {
const z = w[1];
if (typeof z != "number")
return p.error("Exponential interpolation requires a numeric base.", 1, 1);
w = { name: "exponential", base: z };
} else {
if (w[0] !== "cubic-bezier")
return p.error(`Unknown interpolation type ${String(w[0])}`, 1, 0);
{
const z = w.slice(1);
if (z.length !== 4 || z.some((W) => typeof W != "number" || W < 0 || W > 1))
return p.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
w = { name: "cubic-bezier", controlPoints: z };
}
}
if (c.length - 1 < 4)
return p.error(`Expected at least 4 arguments, but found only ${c.length - 1}.`);
if ((c.length - 1) % 2 != 0)
return p.error("Expected an even number of arguments.");
if (H = p.parse(H, 2, xe), !H)
return null;
const C = [];
let N = null;
g === "interpolate-hcl" || g === "interpolate-lab" ? N = Vn : p.expectedType && p.expectedType.kind !== "value" && (N = p.expectedType);
for (let z = 0; z < A.length; z += 2) {
const W = A[z], X = A[z + 1], tt = z + 3, at = z + 4;
if (typeof W != "number")
return p.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', tt);
if (C.length && C[C.length - 1][0] >= W)
return p.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', tt);
const ut = p.parse(X, at, N);
if (!ut)
return null;
N = N || ut.type, C.push([W, ut]);
}
return jt(N, xe) || jt(N, Vn) || jt(N, Vi) || jt(N, xt) || jt(N, ot(xe)) ? new un(N, g, w, H, C) : p.error(`Type ${st(N)} is not interpolatable.`);
}
evaluate(c) {
const p = this.labels, g = this.outputs;
if (p.length === 1)
return g[0].evaluate(c);
const w = this.input.evaluate(c);
if (w <= p[0])
return g[0].evaluate(c);
const H = p.length;
if (w >= p[H - 1])
return g[H - 1].evaluate(c);
const A = mt(p, w), C = un.interpolationFactor(this.interpolation, w, p[A], p[A + 1]), N = g[A].evaluate(c), z = g[A + 1].evaluate(c);
switch (this.operator) {
case "interpolate":
return xr[this.type.kind](N, z, C);
case "interpolate-hcl":
return xr.color(N, z, C, "hcl");
case "interpolate-lab":
return xr.color(N, z, C, "lab");
}
}
eachChild(c) {
c(this.input);
for (const p of this.outputs)
c(p);
}
outputDefined() {
return this.outputs.every((c) => c.outputDefined());
}
}
function pe(h, c, p, g) {
const w = g - p, H = h - p;
return w === 0 ? 0 : c === 1 ? H / w : (Math.pow(c, H) - 1) / (Math.pow(c, w) - 1);
}
class dr {
constructor(c, p) {
this.type = c, this.args = p;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expectected at least one argument.");
let g = null;
const w = p.expectedType;
w && w.kind !== "value" && (g = w);
const H = [];
for (const C of c.slice(1)) {
const N = p.parse(C, 1 + H.length, g, void 0, { typeAnnotation: "omit" });
if (!N)
return null;
g = g || N.type, H.push(N);
}
if (!g)
throw new Error("No output type");
const A = w && H.some((C) => yt(w, C.type));
return new dr(A ? wr : g, H);
}
evaluate(c) {
let p, g = null, w = 0;
for (const H of this.args)
if (w++, g = H.evaluate(c), g && g instanceof pn && !g.available && (p || (p = g.name), g = null, w === this.args.length && (g = p)), g !== null)
break;
return g;
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return this.args.every((c) => c.outputDefined());
}
}
function Tn(h, c) {
return h === "==" || h === "!=" ? c.kind === "boolean" || c.kind === "string" || c.kind === "number" || c.kind === "null" || c.kind === "value" : c.kind === "string" || c.kind === "number" || c.kind === "value";
}
function Ni(h, c, p, g) {
return g.compare(c, p) === 0;
}
function zn(h, c, p) {
const g = h !== "==" && h !== "!=";
return class XG {
constructor(H, A, C) {
this.type = _r, this.lhs = H, this.rhs = A, this.collator = C, this.hasUntypedArgument = H.type.kind === "value" || A.type.kind === "value";
}
static parse(H, A) {
if (H.length !== 3 && H.length !== 4)
return A.error("Expected two or three arguments.");
const C = H[0];
let N = A.parse(H[1], 1, wr);
if (!N)
return null;
if (!Tn(C, N.type))
return A.concat(1).error(`"${C}" comparisons are not supported for type '${st(N.type)}'.`);
let z = A.parse(H[2], 2, wr);
if (!z)
return null;
if (!Tn(C, z.type))
return A.concat(2).error(`"${C}" comparisons are not supported for type '${st(z.type)}'.`);
if (N.type.kind !== z.type.kind && N.type.kind !== "value" && z.type.kind !== "value")
return A.error(`Cannot compare types '${st(N.type)}' and '${st(z.type)}'.`);
g && (N.type.kind === "value" && z.type.kind !== "value" ? N = new d1(z.type, [N]) : N.type.kind !== "value" && z.type.kind === "value" && (z = new d1(N.type, [z])));
let W = null;
if (H.length === 4) {
if (N.type.kind !== "string" && z.type.kind !== "string" && N.type.kind !== "value" && z.type.kind !== "value")
return A.error("Cannot use collator to compare non-string types.");
if (W = A.parse(H[3], 3, Pi), !W)
return null;
}
return new XG(N, z, W);
}
evaluate(H) {
const A = this.lhs.evaluate(H), C = this.rhs.evaluate(H);
if (g && this.hasUntypedArgument) {
const N = Qn(A), z = Qn(C);
if (N.kind !== z.kind || N.kind !== "string" && N.kind !== "number")
throw new jn(`Expected arguments for "${h}" to be (string, string) or (number, number), but found (${N.kind}, ${z.kind}) instead.`);
}
if (this.collator && !g && this.hasUntypedArgument) {
const N = Qn(A), z = Qn(C);
if (N.kind !== "string" || z.kind !== "string")
return c(H, A, C);
}
return this.collator ? p(H, A, C, this.collator.evaluate(H)) : c(H, A, C);
}
eachChild(H) {
H(this.lhs), H(this.rhs), this.collator && H(this.collator);
}
outputDefined() {
return !0;
}
};
}
const b0 = zn("==", function(h, c, p) {
return c === p;
}, Ni), _l = zn("!=", function(h, c, p) {
return c !== p;
}, function(h, c, p, g) {
return !Ni(0, c, p, g);
}), Nn = zn("<", function(h, c, p) {
return c < p;
}, function(h, c, p, g) {
return g.compare(c, p) < 0;
}), bl = zn(">", function(h, c, p) {
return c > p;
}, function(h, c, p, g) {
return g.compare(c, p) > 0;
}), vc = zn("<=", function(h, c, p) {
return c <= p;
}, function(h, c, p, g) {
return g.compare(c, p) <= 0;
}), Ko = zn(">=", function(h, c, p) {
return c >= p;
}, function(h, c, p, g) {
return g.compare(c, p) >= 0;
});
class ga {
constructor(c, p, g) {
this.type = Pi, this.locale = g, this.caseSensitive = c, this.diacriticSensitive = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error("Expected one argument.");
const g = c[1];
if (typeof g != "object" || Array.isArray(g))
return p.error("Collator options argument must be an object.");
const w = p.parse(g["case-sensitive"] !== void 0 && g["case-sensitive"], 1, _r);
if (!w)
return null;
const H = p.parse(g["diacritic-sensitive"] !== void 0 && g["diacritic-sensitive"], 1, _r);
if (!H)
return null;
let A = null;
return g.locale && (A = p.parse(g.locale, 1, Dr), !A) ? null : new ga(w, H, A);
}
evaluate(c) {
return new zi(this.caseSensitive.evaluate(c), this.diacriticSensitive.evaluate(c), this.locale ? this.locale.evaluate(c) : null);
}
eachChild(c) {
c(this.caseSensitive), c(this.diacriticSensitive), this.locale && c(this.locale);
}
outputDefined() {
return !1;
}
}
class D4 {
constructor(c, p, g, w, H) {
this.type = Dr, this.number = c, this.locale = p, this.currency = g, this.minFractionDigits = w, this.maxFractionDigits = H;
}
static parse(c, p) {
if (c.length !== 3)
return p.error("Expected two arguments.");
const g = p.parse(c[1], 1, xe);
if (!g)
return null;
const w = c[2];
if (typeof w != "object" || Array.isArray(w))
return p.error("NumberFormat options argument must be an object.");
let H = null;
if (w.locale && (H = p.parse(w.locale, 1, Dr), !H))
return null;
let A = null;
if (w.currency && (A = p.parse(w.currency, 1, Dr), !A))
return null;
let C = null;
if (w["min-fraction-digits"] && (C = p.parse(w["min-fraction-digits"], 1, xe), !C))
return null;
let N = null;
return w["max-fraction-digits"] && (N = p.parse(w["max-fraction-digits"], 1, xe), !N) ? null : new D4(g, H, A, C, N);
}
evaluate(c) {
return new Intl.NumberFormat(this.locale ? this.locale.evaluate(c) : [], { style: this.currency ? "currency" : "decimal", currency: this.currency ? this.currency.evaluate(c) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(c) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(c) : void 0 }).format(this.number.evaluate(c));
}
eachChild(c) {
c(this.number), this.locale && c(this.locale), this.currency && c(this.currency), this.minFractionDigits && c(this.minFractionDigits), this.maxFractionDigits && c(this.maxFractionDigits);
}
outputDefined() {
return !1;
}
}
class A3 {
constructor(c) {
this.type = H1, this.sections = c;
}
static parse(c, p) {
if (c.length < 2)
return p.error("Expected at least one argument.");
const g = c[1];
if (!Array.isArray(g) && typeof g == "object")
return p.error("First argument must be an image or text section.");
const w = [];
let H = !1;
for (let A = 1; A <= c.length - 1; ++A) {
const C = c[A];
if (H && typeof C == "object" && !Array.isArray(C)) {
H = !1;
let N = null;
if (C["font-scale"] && (N = p.parse(C["font-scale"], 1, xe), !N))
return null;
let z = null;
if (C["text-font"] && (z = p.parse(C["text-font"], 1, ot(Dr)), !z))
return null;
let W = null;
if (C["text-color"] && (W = p.parse(C["text-color"], 1, Vn), !W))
return null;
const X = w[w.length - 1];
X.scale = N, X.font = z, X.textColor = W;
} else {
const N = p.parse(c[A], 1, wr);
if (!N)
return null;
const z = N.type.kind;
if (z !== "string" && z !== "value" && z !== "null" && z !== "resolvedImage")
return p.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
H = !0, w.push({ content: N, scale: null, font: null, textColor: null });
}
}
return new A3(w);
}
evaluate(c) {
return new Xr(this.sections.map((p) => {
const g = p.content.evaluate(c);
return Qn(g) === Rn ? new co("", g, null, null, null) : new co(Ui(g), null, p.scale ? p.scale.evaluate(c) : null, p.font ? p.font.evaluate(c).join(",") : null, p.textColor ? p.textColor.evaluate(c) : null);
}));
}
eachChild(c) {
for (const p of this.sections)
c(p.content), p.scale && c(p.scale), p.font && c(p.font), p.textColor && c(p.textColor);
}
outputDefined() {
return !1;
}
}
class O3 {
constructor(c) {
this.type = Rn, this.input = c;
}
static parse(c, p) {
if (c.length !== 2)
return p.error("Expected two arguments.");
const g = p.parse(c[1], 1, Dr);
return g ? new O3(g) : p.error("No image name provided.");
}
evaluate(c) {
const p = this.input.evaluate(c), g = pn.fromString(p);
return g && c.availableImages && (g.available = c.availableImages.indexOf(p) > -1), g;
}
eachChild(c) {
c(this.input);
}
outputDefined() {
return !1;
}
}
class F4 {
constructor(c) {
this.type = xe, this.input = c;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`Expected 1 argument, but found ${c.length - 1} instead.`);
const g = p.parse(c[1], 1);
return g ? g.type.kind !== "array" && g.type.kind !== "string" && g.type.kind !== "value" ? p.error(`Expected argument of type string or array, but found ${st(g.type)} instead.`) : new F4(g) : null;
}
evaluate(c) {
const p = this.input.evaluate(c);
if (typeof p == "string")
return [...p].length;
if (Array.isArray(p))
return p.length;
throw new jn(`Expected value to be of type string or array, but found ${st(Qn(p))} instead.`);
}
eachChild(c) {
c(this.input);
}
outputDefined() {
return !1;
}
}
const Ao = 8192;
function _c(h, c) {
const p = (180 + h[0]) / 360, g = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h[1] * Math.PI / 360))) / 360, w = Math.pow(2, c.z);
return [Math.round(p * w * Ao), Math.round(g * w * Ao)];
}
function L0(h, c) {
const p = Math.pow(2, c.z);
return [(w = (h[0] / Ao + c.x) / p, 360 * w - 180), (g = (h[1] / Ao + c.y) / p, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * g) * Math.PI / 180)) - 90)];
var g, w;
}
function Bs(h, c) {
h[0] = Math.min(h[0], c[0]), h[1] = Math.min(h[1], c[1]), h[2] = Math.max(h[2], c[0]), h[3] = Math.max(h[3], c[1]);
}
function L2(h, c) {
return !(h[0] <= c[0] || h[2] >= c[2] || h[1] <= c[1] || h[3] >= c[3]);
}
function hn(h, c, p) {
const g = h[0] - c[0], w = h[1] - c[1], H = h[0] - p[0], A = h[1] - p[1];
return g * A - H * w == 0 && g * H <= 0 && w * A <= 0;
}
function C3(h, c, p, g) {
return (w = [g[0] - p[0], g[1] - p[1]])[0] * (H = [c[0] - h[0], c[1] - h[1]])[1] - w[1] * H[0] != 0 && !(!Oo(h, c, p, g) || !Oo(p, g, h, c));
var w, H;
}
function bc(h, c, p) {
for (const g of p)
for (let w = 0; w < g.length - 1; ++w)
if (C3(h, c, g[w], g[w + 1]))
return !0;
return !1;
}
function ya(h, c, p = !1) {
let g = !1;
for (const C of c)
for (let N = 0; N < C.length - 1; N++) {
if (hn(h, C[N], C[N + 1]))
return p;
(H = C[N])[1] > (w = h)[1] != (A = C[N + 1])[1] > w[1] && w[0] < (A[0] - H[0]) * (w[1] - H[1]) / (A[1] - H[1]) + H[0] && (g = !g);
}
var w, H, A;
return g;
}
function B4(h, c) {
for (const p of c)
if (ya(h, p))
return !0;
return !1;
}
function j4(h, c) {
for (const p of h)
if (!ya(p, c))
return !1;
for (let p = 0; p < h.length - 1; ++p)
if (bc(h[p], h[p + 1], c))
return !1;
return !0;
}
function Ll(h, c) {
for (const p of c)
if (j4(h, p))
return !0;
return !1;
}
function Oo(h, c, p, g) {
const w = g[0] - p[0], H = g[1] - p[1], A = (h[0] - p[0]) * H - w * (h[1] - p[1]), C = (c[0] - p[0]) * H - w * (c[1] - p[1]);
return A > 0 && C < 0 || A < 0 && C > 0;
}
function z4(h, c, p) {
const g = [];
for (let w = 0; w < h.length; w++) {
const H = [];
for (let A = 0; A < h[w].length; A++) {
const C = _c(h[w][A], p);
Bs(c, C), H.push(C);
}
g.push(H);
}
return g;
}
function w0(h, c, p) {
const g = [];
for (let w = 0; w < h.length; w++) {
const H = z4(h[w], c, p);
g.push(H);
}
return g;
}
function wl(h, c, p, g) {
if (h[0] < p[0] || h[0] > p[2]) {
const w = 0.5 * g;
let H = h[0] - p[0] > w ? -g : p[0] - h[0] > w ? g : 0;
H === 0 && (H = h[0] - p[2] > w ? -g : p[2] - h[0] > w ? g : 0), h[0] += H;
}
Bs(c, h);
}
function x0(h, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const C of h)
for (const N of C) {
const z = [N.x + H[0], N.y + H[1]];
wl(z, c, p, w), A.push(z);
}
return A;
}
function k3(h, c, p, g) {
const w = Math.pow(2, g.z) * Ao, H = [g.x * Ao, g.y * Ao], A = [];
for (const N of h) {
const z = [];
for (const W of N) {
const X = [W.x + H[0], W.y + H[1]];
Bs(c, X), z.push(X);
}
A.push(z);
}
if (c[2] - c[0] <= w / 2) {
(C = c)[0] = C[1] = 1 / 0, C[2] = C[3] = -1 / 0;
for (const N of A)
for (const z of N)
wl(z, c, p, w);
}
var C;
return A;
}
class os {
constructor(c, p) {
this.type = _r, this.geojson = c, this.geometries = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'within' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (u1(c[1])) {
const g = c[1];
if (g.type === "FeatureCollection") {
const w = [];
for (const H of g.features) {
const { type: A, coordinates: C } = H.geometry;
A === "Polygon" && w.push(C), A === "MultiPolygon" && w.push(...C);
}
if (w.length)
return new os(g, { type: "MultiPolygon", coordinates: w });
} else if (g.type === "Feature") {
const w = g.geometry.type;
if (w === "Polygon" || w === "MultiPolygon")
return new os(g, g.geometry);
} else if (g.type === "Polygon" || g.type === "MultiPolygon")
return new os(g, g);
}
return p.error("'within' expression requires valid geojson object that contains polygon geometry type.");
}
evaluate(c) {
if (c.geometry() != null && c.canonicalID() != null) {
if (c.geometryType() === "Point")
return function(p, g) {
const w = [1 / 0, 1 / 0, -1 / 0, -1 / 0], H = [1 / 0, 1 / 0, -1 / 0, -1 / 0], A = p.canonicalID();
if (g.type === "Polygon") {
const C = z4(g.coordinates, H, A), N = x0(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!ya(z, C))
return !1;
}
if (g.type === "MultiPolygon") {
const C = w0(g.coordinates, H, A), N = x0(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!B4(z, C))
return !1;
}
return !0;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const w = [1 / 0, 1 / 0, -1 / 0, -1 / 0], H = [1 / 0, 1 / 0, -1 / 0, -1 / 0], A = p.canonicalID();
if (g.type === "Polygon") {
const C = z4(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!j4(z, C))
return !1;
}
if (g.type === "MultiPolygon") {
const C = w0(g.coordinates, H, A), N = k3(p.geometry(), w, H, A);
if (!L2(w, H))
return !1;
for (const z of N)
if (!Ll(z, C))
return !1;
}
return !0;
}(c, this.geometries);
}
return !1;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
let E0 = class {
constructor(h = [], c = (p, g) => p < g ? -1 : p > g ? 1 : 0) {
if (this.data = h, this.length = this.data.length, this.compare = c, this.length > 0)
for (let p = (this.length >> 1) - 1; p >= 0; p--)
this._down(p);
}
push(h) {
this.data.push(h), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const h = this.data[0], c = this.data.pop();
return --this.length > 0 && (this.data[0] = c, this._down(0)), h;
}
peek() {
return this.data[0];
}
_up(h) {
const { data: c, compare: p } = this, g = c[h];
for (; h > 0; ) {
const w = h - 1 >> 1, H = c[w];
if (p(g, H) >= 0)
break;
c[h] = H, h = w;
}
c[h] = g;
}
_down(h) {
const { data: c, compare: p } = this, g = this.length >> 1, w = c[h];
for (; h < g; ) {
let H = 1 + (h << 1);
const A = H + 1;
if (A < this.length && p(c[A], c[H]) < 0 && (H = A), p(c[H], w) >= 0)
break;
c[h] = c[H], h = H;
}
c[h] = w;
}
};
function Lc(h, c, p, g, w) {
ss(h, c, p, g || h.length - 1, w || wc);
}
function ss(h, c, p, g, w) {
for (; g > p; ) {
if (g - p > 600) {
var H = g - p + 1, A = c - p + 1, C = Math.log(H), N = 0.5 * Math.exp(2 * C / 3), z = 0.5 * Math.sqrt(C * N * (H - N) / H) * (A - H / 2 < 0 ? -1 : 1);
ss(h, c, Math.max(p, Math.floor(c - A * N / H + z)), Math.min(g, Math.floor(c + (H - A) * N / H + z)), w);
}
var W = h[c], X = p, tt = g;
for (va(h, p, c), w(h[g], W) > 0 && va(h, p, g); X < tt; ) {
for (va(h, X, tt), X++, tt--; w(h[X], W) < 0; )
X++;
for (; w(h[tt], W) > 0; )
tt--;
}
w(h[p], W) === 0 ? va(h, p, tt) : va(h, ++tt, g), tt <= c && (p = tt + 1), c <= tt && (g = tt - 1);
}
}
function va(h, c, p) {
var g = h[c];
h[c] = h[p], h[p] = g;
}
function wc(h, c) {
return h < c ? -1 : h > c ? 1 : 0;
}
function U4(h, c) {
if (h.length <= 1)
return [h];
const p = [];
let g, w;
for (const H of h) {
const A = I3(H);
A !== 0 && (H.area = Math.abs(A), w === void 0 && (w = A < 0), w === A < 0 ? (g && p.push(g), g = [H]) : g.push(H));
}
if (g && p.push(g), c > 1)
for (let H = 0; H < p.length; H++)
p[H].length <= c || (Lc(p[H], c, 1, p[H].length - 1, M0), p[H] = p[H].slice(0, c));
return p;
}
function M0(h, c) {
return c.area - h.area;
}
function I3(h) {
let c = 0;
for (let p, g, w = 0, H = h.length, A = H - 1; w < H; A = w++)
p = h[w], g = h[A], c += (g.x - p.x) * (p.y + g.y);
return c;
}
const G4 = 1 / 298.257223563, $4 = G4 * (2 - G4), W4 = Math.PI / 180;
class js {
constructor(c) {
const p = 6378.137 * W4 * 1e3, g = Math.cos(c * W4), w = 1 / (1 - $4 * (1 - g * g)), H = Math.sqrt(w);
this.kx = p * H * g, this.ky = p * H * w * (1 - $4);
}
distance(c, p) {
const g = this.wrap(c[0] - p[0]) * this.kx, w = (c[1] - p[1]) * this.ky;
return Math.sqrt(g * g + w * w);
}
pointOnLine(c, p) {
let g, w, H, A, C = 1 / 0;
for (let N = 0; N < c.length - 1; N++) {
let z = c[N][0], W = c[N][1], X = this.wrap(c[N + 1][0] - z) * this.kx, tt = (c[N + 1][1] - W) * this.ky, at = 0;
X === 0 && tt === 0 || (at = (this.wrap(p[0] - z) * this.kx * X + (p[1] - W) * this.ky * tt) / (X * X + tt * tt), at > 1 ? (z = c[N + 1][0], W = c[N + 1][1]) : at > 0 && (z += X / this.kx * at, W += tt / this.ky * at)), X = this.wrap(p[0] - z) * this.kx, tt = (p[1] - W) * this.ky;
const ut = X * X + tt * tt;
ut < C && (C = ut, g = z, w = W, H = N, A = at);
}
return { point: [g, w], index: H, t: Math.max(0, Math.min(1, A)) };
}
wrap(c) {
for (; c < -180; )
c += 360;
for (; c > 180; )
c -= 360;
return c;
}
}
function xl(h, c) {
return c[0] - h[0];
}
function Z4(h) {
return h[1] - h[0] + 1;
}
function w2(h, c) {
return h[1] >= h[0] && h[1] < c;
}
function S0(h, c) {
if (h[0] > h[1])
return [null, null];
const p = Z4(h);
if (c) {
if (p === 2)
return [h, null];
const w = Math.floor(p / 2);
return [[h[0], h[0] + w], [h[0] + w, h[1]]];
}
if (p === 1)
return [h, null];
const g = Math.floor(p / 2) - 1;
return [[h[0], h[0] + g], [h[0] + g + 1, h[1]]];
}
function H0(h, c) {
if (!w2(c, h.length))
return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
const p = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let g = c[0]; g <= c[1]; ++g)
Bs(p, h[g]);
return p;
}
function q4(h) {
const c = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (const p of h)
for (const g of p)
Bs(c, g);
return c;
}
function _a(h) {
return h[0] !== -1 / 0 && h[1] !== -1 / 0 && h[2] !== 1 / 0 && h[3] !== 1 / 0;
}
function x2(h, c, p) {
if (!_a(h) || !_a(c))
return NaN;
let g = 0, w = 0;
return h[2] < c[0] && (g = c[0] - h[2]), h[0] > c[2] && (g = h[0] - c[2]), h[1] > c[3] && (w = h[1] - c[3]), h[3] < c[1] && (w = c[1] - h[3]), p.distance([0, 0], [g, w]);
}
function v1(h, c, p) {
const g = p.pointOnLine(c, h);
return p.distance(h, g.point);
}
function E2(h, c, p, g, w) {
const H = Math.min(v1(h, [p, g], w), v1(c, [p, g], w)), A = Math.min(v1(p, [h, c], w), v1(g, [h, c], w));
return Math.min(H, A);
}
function X4(h, c, p, g, w) {
if (!w2(c, h.length) || !w2(g, p.length))
return 1 / 0;
let H = 1 / 0;
for (let A = c[0]; A < c[1]; ++A) {
const C = h[A], N = h[A + 1];
for (let z = g[0]; z < g[1]; ++z) {
const W = p[z], X = p[z + 1];
if (C3(C, N, W, X))
return 0;
H = Math.min(H, E2(C, N, W, X, w));
}
}
return H;
}
function Mn(h, c, p, g, w) {
if (!w2(c, h.length) || !w2(g, p.length))
return NaN;
let H = 1 / 0;
for (let A = c[0]; A <= c[1]; ++A)
for (let C = g[0]; C <= g[1]; ++C)
if (H = Math.min(H, w.distance(h[A], p[C])), H === 0)
return H;
return H;
}
function xc(h, c, p) {
if (ya(h, c, !0))
return 0;
let g = 1 / 0;
for (const w of c) {
const H = w[0], A = w[w.length - 1];
if (H !== A && (g = Math.min(g, v1(h, [A, H], p)), g === 0))
return g;
const C = p.pointOnLine(w, h);
if (g = Math.min(g, p.distance(h, C.point)), g === 0)
return g;
}
return g;
}
function $r(h, c, p, g) {
if (!w2(c, h.length))
return NaN;
for (let H = c[0]; H <= c[1]; ++H)
if (ya(h[H], p, !0))
return 0;
let w = 1 / 0;
for (let H = c[0]; H < c[1]; ++H) {
const A = h[H], C = h[H + 1];
for (const N of p)
for (let z = 0, W = N.length, X = W - 1; z < W; X = z++) {
const tt = N[X], at = N[z];
if (C3(A, C, tt, at))
return 0;
w = Math.min(w, E2(A, C, tt, at, g));
}
}
return w;
}
function as(h, c) {
for (const p of h)
for (const g of p)
if (ya(g, c, !0))
return !0;
return !1;
}
function An(h, c, p, g = 1 / 0) {
const w = q4(h), H = q4(c);
if (g !== 1 / 0 && x2(w, H, p) >= g)
return g;
if (L2(w, H)) {
if (as(h, c))
return 0;
} else if (as(c, h))
return 0;
let A = 1 / 0;
for (const C of h)
for (let N = 0, z = C.length, W = z - 1; N < z; W = N++) {
const X = C[W], tt = C[N];
for (const at of c)
for (let ut = 0, Tt = at.length, Lt = Tt - 1; ut < Tt; Lt = ut++) {
const Et = at[Lt], $t = at[ut];
if (C3(X, tt, Et, $t))
return 0;
A = Math.min(A, E2(X, tt, Et, $t, p));
}
}
return A;
}
function bn(h, c, p, g, w, H) {
if (!H)
return;
const A = x2(H0(g, H), w, p);
A < c && h.push([A, H, [0, 0]]);
}
function zs(h, c, p, g, w, H, A) {
if (!H || !A)
return;
const C = x2(H0(g, H), H0(w, A), p);
C < c && h.push([C, H, A]);
}
function P3(h, c, p, g, w = 1 / 0) {
let H = Math.min(g.distance(h[0], p[0][0]), w);
if (H === 0)
return H;
const A = new E0([[0, [0, h.length - 1], [0, 0]]], xl), C = q4(p);
for (; A.length > 0; ) {
const N = A.pop();
if (N[0] >= H)
continue;
const z = N[1], W = c ? 50 : 100;
if (Z4(z) <= W) {
if (!w2(z, h.length))
return NaN;
if (c) {
const X = $r(h, z, p, g);
if (isNaN(X) || X === 0)
return X;
H = Math.min(H, X);
} else
for (let X = z[0]; X <= z[1]; ++X) {
const tt = xc(h[X], p, g);
if (H = Math.min(H, tt), H === 0)
return 0;
}
} else {
const X = S0(z, c);
bn(A, H, g, h, C, X[0]), bn(A, H, g, h, C, X[1]);
}
}
return H;
}
function ba(h, c, p, g, w, H = 1 / 0) {
let A = Math.min(H, w.distance(h[0], p[0]));
if (A === 0)
return A;
const C = new E0([[0, [0, h.length - 1], [0, p.length - 1]]], xl);
for (; C.length > 0; ) {
const N = C.pop();
if (N[0] >= A)
continue;
const z = N[1], W = N[2], X = c ? 50 : 100, tt = g ? 50 : 100;
if (Z4(z) <= X && Z4(W) <= tt) {
if (!w2(z, h.length) && w2(W, p.length))
return NaN;
let at;
if (c && g)
at = X4(h, z, p, W, w), A = Math.min(A, at);
else if (c && !g) {
const ut = h.slice(z[0], z[1] + 1);
for (let Tt = W[0]; Tt <= W[1]; ++Tt)
if (at = v1(p[Tt], ut, w), A = Math.min(A, at), A === 0)
return A;
} else if (!c && g) {
const ut = p.slice(W[0], W[1] + 1);
for (let Tt = z[0]; Tt <= z[1]; ++Tt)
if (at = v1(h[Tt], ut, w), A = Math.min(A, at), A === 0)
return A;
} else
at = Mn(h, z, p, W, w), A = Math.min(A, at);
} else {
const at = S0(z, c), ut = S0(W, g);
zs(C, A, w, h, p, at[0], ut[0]), zs(C, A, w, h, p, at[0], ut[1]), zs(C, A, w, h, p, at[1], ut[0]), zs(C, A, w, h, p, at[1], ut[1]);
}
}
return A;
}
function K4(h) {
return h.type === "MultiPolygon" ? h.coordinates.map((c) => ({ type: "Polygon", coordinates: c })) : h.type === "MultiLineString" ? h.coordinates.map((c) => ({ type: "LineString", coordinates: c })) : h.type === "MultiPoint" ? h.coordinates.map((c) => ({ type: "Point", coordinates: c })) : [h];
}
class Yo {
constructor(c, p) {
this.type = xe, this.geojson = c, this.geometries = p;
}
static parse(c, p) {
if (c.length !== 2)
return p.error(`'distance' expression requires exactly one argument, but found ${c.length - 1} instead.`);
if (u1(c[1])) {
const g = c[1];
if (g.type === "FeatureCollection")
return new Yo(g, g.features.map((w) => K4(w.geometry)).flat());
if (g.type === "Feature")
return new Yo(g, K4(g.geometry));
if ("type" in g && "coordinates" in g)
return new Yo(g, K4(g));
}
return p.error("'distance' expression requires valid geojson object that contains polygon geometry type.");
}
evaluate(c) {
if (c.geometry() != null && c.canonicalID() != null) {
if (c.geometryType() === "Point")
return function(p, g) {
const w = p.geometry(), H = w.flat().map((N) => L0([N.x, N.y], p.canonical));
if (w.length === 0)
return NaN;
const A = new js(H[0][1]);
let C = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
C = Math.min(C, ba(H, !1, [N.coordinates], !1, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, !1, N.coordinates, !0, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, !1, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
if (c.geometryType() === "LineString")
return function(p, g) {
const w = p.geometry(), H = w.flat().map((N) => L0([N.x, N.y], p.canonical));
if (w.length === 0)
return NaN;
const A = new js(H[0][1]);
let C = 1 / 0;
for (const N of g) {
switch (N.type) {
case "Point":
C = Math.min(C, ba(H, !0, [N.coordinates], !1, A, C));
break;
case "LineString":
C = Math.min(C, ba(H, !0, N.coordinates, !0, A, C));
break;
case "Polygon":
C = Math.min(C, P3(H, !0, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
if (c.geometryType() === "Polygon")
return function(p, g) {
const w = p.geometry();
if (w.length === 0 || w[0].length === 0)
return NaN;
const H = U4(w, 0).map((N) => N.map((z) => z.map((W) => L0([W.x, W.y], p.canonical)))), A = new js(H[0][0][0][1]);
let C = 1 / 0;
for (const N of g)
for (const z of H) {
switch (N.type) {
case "Point":
C = Math.min(C, P3([N.coordinates], !1, z, A, C));
break;
case "LineString":
C = Math.min(C, P3(N.coordinates, !0, z, A, C));
break;
case "Polygon":
C = Math.min(C, An(z, N.coordinates, A, C));
}
if (C === 0)
return C;
}
return C;
}(c, this.geometries);
}
return NaN;
}
eachChild() {
}
outputDefined() {
return !0;
}
}
const Co = { "==": b0, "!=": _l, ">": bl, "<": Nn, ">=": Ko, "<=": vc, array: d1, at: I, boolean: d1, case: it, coalesce: dr, collator: ga, format: A3, image: O3, in: G, "index-of": B, interpolate: un, "interpolate-hcl": un, "interpolate-lab": un, length: F4, let: ho, literal: h1, match: q, number: d1, "number-format": D4, object: d1, slice: ht, step: qt, string: d1, "to-boolean": e1, "to-color": e1, "to-number": e1, "to-string": e1, var: Yr, within: os, distance: Yo };
class po {
constructor(c, p, g, w) {
this.name = c, this.type = p, this._evaluate = g, this.args = w;
}
evaluate(c) {
return this._evaluate(c, this.args);
}
eachChild(c) {
this.args.forEach(c);
}
outputDefined() {
return !1;
}
static parse(c, p) {
const g = c[0], w = po.definitions[g];
if (!w)
return p.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`, 0);
const H = Array.isArray(w) ? w[0] : w.type, A = Array.isArray(w) ? [[w[1], w[2]]] : w.overloads, C = A.filter(([z]) => !Array.isArray(z) || z.length === c.length - 1);
let N = null;
for (const [z, W] of C) {
N = new Xo(p.registry, V3, p.path, null, p.scope);
const X = [];
let tt = !1;
for (let at = 1; at < c.length; at++) {
const ut = c[at], Tt = Array.isArray(z) ? z[at - 1] : z.type, Lt = N.parse(ut, 1 + X.length, Tt);
if (!Lt) {
tt = !0;
break;
}
X.push(Lt);
}
if (!tt)
if (Array.isArray(z) && z.length !== X.length)
N.error(`Expected ${z.length} arguments, but found ${X.length} instead.`);
else {
for (let at = 0; at < X.length; at++) {
const ut = Array.isArray(z) ? z[at] : z.type, Tt = X[at];
N.concat(at + 1).checkSubtype(ut, Tt.type);
}
if (N.errors.length === 0)
return new po(g, H, W, X);
}
}
if (C.length === 1)
p.errors.push(...N.errors);
else {
const z = (C.length ? C : A).map(([X]) => {
return tt = X, Array.isArray(tt) ? `(${tt.map(st).join(", ")})` : `(${st(tt.type)}...)`;
var tt;
}).join(" | "), W = [];
for (let X = 1; X < c.length; X++) {
const tt = p.parse(c[X], 1 + W.length);
if (!tt)
return null;
W.push(st(tt.type));
}
p.error(`Expected arguments of type ${z}, but found (${W.join(", ")}) instead.`);
}
return null;
}
static register(c, p) {
po.definitions = p;
for (const g in p)
c[g] = po;
}
}
function Jo(h, [c, p, g, w]) {
c = c.evaluate(h), p = p.evaluate(h), g = g.evaluate(h);
const H = w ? w.evaluate(h) : 1, A = uo(c, p, g, H);
if (A)
throw new jn(A);
return new tn(c / 255, p / 255, g / 255, H, !1);
}
function A0(h, c) {
return h in c;
}
function M2(h, c) {
const p = c[h];
return p === void 0 ? null : p;
}
function ls(h) {
return { type: h };
}
function V3(h) {
if (h instanceof Yr)
return V3(h.boundExpression);
if (h instanceof po && h.name === "error" || h instanceof ga || h instanceof os || h instanceof Yo)
return !1;
const c = h instanceof e1 || h instanceof d1;
let p = !0;
return h.eachChild((g) => {
p = c ? p && V3(g) : p && g instanceof h1;
}), !!p && cs(h) && La(h, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]);
}
function cs(h) {
if (h instanceof po && (h.name === "get" && h.args.length === 1 || h.name === "feature-state" || h.name === "has" && h.args.length === 1 || h.name === "properties" || h.name === "geometry-type" || h.name === "id" || /^filter-/.test(h.name)) || h instanceof os || h instanceof Yo)
return !1;
let c = !0;
return h.eachChild((p) => {
c && !cs(p) && (c = !1);
}), c;
}
function us(h) {
if (h instanceof po && h.name === "feature-state")
return !1;
let c = !0;
return h.eachChild((p) => {
c && !us(p) && (c = !1);
}), c;
}
function La(h, c) {
if (h instanceof po && c.indexOf(h.name) >= 0)
return !1;
let p = !0;
return h.eachChild((g) => {
p && !La(g, c) && (p = !1);
}), p;
}
function R3(h) {
return { result: "success", value: h };
}
function Us(h) {
return { result: "error", value: h };
}
function t2(h) {
return h["property-type"] === "data-driven" || h["property-type"] === "cross-faded-data-driven";
}
function O0(h) {
return !!h.expression && h.expression.parameters.indexOf("zoom") > -1;
}
function C0(h) {
return !!h.expression && h.expression.interpolated;
}
function kt(h) {
return h instanceof Number ? "number" : h instanceof String ? "string" : h instanceof Boolean ? "boolean" : Array.isArray(h) ? "array" : h === null ? "null" : typeof h;
}
function ne(h) {
return typeof h == "object" && h !== null && !Array.isArray(h);
}
function Fe(h) {
return h;
}
function Lr(h, c) {
const p = c.type === "color", g = h.stops && typeof h.stops[0][0] == "object", w = g || !(g || h.property !== void 0), H = h.type || (C0(c) ? "exponential" : "interval");
if (p || c.type === "padding") {
const W = p ? tn.parse : Yn.parse;
(h = bi({}, h)).stops && (h.stops = h.stops.map((X) => [X[0], W(X[1])])), h.default = W(h.default ? h.default : c.default);
}
if (h.colorSpace && (A = h.colorSpace) !== "rgb" && A !== "hcl" && A !== "lab")
throw new Error(`Unknown color space: "${h.colorSpace}"`);
var A;
let C, N, z;
if (H === "exponential")
C = wi;
else if (H === "interval")
C = Jn;
else if (H === "categorical") {
C = rn, N = /* @__PURE__ */ Object.create(null);
for (const W of h.stops)
N[W[0]] = W[1];
z = typeof h.stops[0][0];
} else {
if (H !== "identity")
throw new Error(`Unknown function type "${H}"`);
C = To;
}
if (g) {
const W = {}, X = [];
for (let ut = 0; ut < h.stops.length; ut++) {
const Tt = h.stops[ut], Lt = Tt[0].zoom;
W[Lt] === void 0 && (W[Lt] = { zoom: Lt, type: h.type, property: h.property, default: h.default, stops: [] }, X.push(Lt)), W[Lt].stops.push([Tt[0].value, Tt[1]]);
}
const tt = [];
for (const ut of X)
tt.push([W[ut].zoom, Lr(W[ut], c)]);
const at = { name: "linear" };
return { kind: "composite", interpolationType: at, interpolationFactor: un.interpolationFactor.bind(void 0, at), zoomStops: tt.map((ut) => ut[0]), evaluate: ({ zoom: ut }, Tt) => wi({ stops: tt, base: h.base }, c, ut).evaluate(ut, Tt) };
}
if (w) {
const W = H === "exponential" ? { name: "exponential", base: h.base !== void 0 ? h.base : 1 } : null;
return { kind: "camera", interpolationType: W, interpolationFactor: un.interpolationFactor.bind(void 0, W), zoomStops: h.stops.map((X) => X[0]), evaluate: ({ zoom: X }) => C(h, c, X, N, z) };
}
return { kind: "source", evaluate(W, X) {
const tt = X && X.properties ? X.properties[h.property] : void 0;
return tt === void 0 ? Ln(h.default, c.default) : C(h, c, tt, N, z);
} };
}
function Ln(h, c, p) {
return h !== void 0 ? h : c !== void 0 ? c : p !== void 0 ? p : void 0;
}
function rn(h, c, p, g, w) {
return Ln(typeof p === w ? g[p] : void 0, h.default, c.default);
}
function Jn(h, c, p) {
if (kt(p) !== "number")
return Ln(h.default, c.default);
const g = h.stops.length;
if (g === 1 || p <= h.stops[0][0])
return h.stops[0][1];
if (p >= h.stops[g - 1][0])
return h.stops[g - 1][1];
const w = mt(h.stops.map((H) => H[0]), p);
return h.stops[w][1];
}
function wi(h, c, p) {
const g = h.base !== void 0 ? h.base : 1;
if (kt(p) !== "number")
return Ln(h.default, c.default);
const w = h.stops.length;
if (w === 1 || p <= h.stops[0][0])
return h.stops[0][1];
if (p >= h.stops[w - 1][0])
return h.stops[w - 1][1];
const H = mt(h.stops.map((W) => W[0]), p), A = function(W, X, tt, at) {
const ut = at - tt, Tt = W - tt;
return ut === 0 ? 0 : X === 1 ? Tt / ut : (Math.pow(X, Tt) - 1) / (Math.pow(X, ut) - 1);
}(p, g, h.stops[H][0], h.stops[H + 1][0]), C = h.stops[H][1], N = h.stops[H + 1][1], z = xr[c.type] || Fe;
return typeof C.evaluate == "function" ? { evaluate(...W) {
const X = C.evaluate.apply(void 0, W), tt = N.evaluate.apply(void 0, W);
if (X !== void 0 && tt !== void 0)
return z(X, tt, A, h.colorSpace);
} } : z(C, N, A, h.colorSpace);
}
function To(h, c, p) {
switch (c.type) {
case "color":
p = tn.parse(p);
break;
case "formatted":
p = Xr.fromString(p.toString());
break;
case "resolvedImage":
p = pn.fromString(p.toString());
break;
case "padding":
p = Yn.parse(p);
break;
default:
kt(p) === c.type || c.type === "enum" && c.values[p] || (p = void 0);
}
return Ln(p, h.default, c.default);
}
po.register(Co, { error: [{ kind: "error" }, [Dr], (h, [c]) => {
throw new jn(c.evaluate(h));
}], typeof: [Dr, [wr], (h, [c]) => st(Qn(c.evaluate(h)))], "to-rgba": [ot(xe, 4), [Vn], (h, [c]) => {
const [p, g, w, H] = c.evaluate(h).rgb;
return [255 * p, 255 * g, 255 * w, H];
}], rgb: [Vn, [xe, xe, xe], Jo], rgba: [Vn, [xe, xe, xe, xe], Jo], has: { type: _r, overloads: [[[Dr], (h, [c]) => A0(c.evaluate(h), h.properties())], [[Dr, y1], (h, [c, p]) => A0(c.evaluate(h), p.evaluate(h))]] }, get: { type: wr, overloads: [[[Dr], (h, [c]) => M2(c.evaluate(h), h.properties())], [[Dr, y1], (h, [c, p]) => M2(c.evaluate(h), p.evaluate(h))]] }, "feature-state": [wr, [Dr], (h, [c]) => M2(c.evaluate(h), h.featureState || {})], properties: [y1, [], (h) => h.properties()], "geometry-type": [Dr, [], (h) => h.geometryType()], id: [wr, [], (h) => h.id()], zoom: [xe, [], (h) => h.globals.zoom], "heatmap-density": [xe, [], (h) => h.globals.heatmapDensity || 0], "line-progress": [xe, [], (h) => h.globals.lineProgress || 0], accumulated: [wr, [], (h) => h.globals.accumulated === void 0 ? null : h.globals.accumulated], "+": [xe, ls(xe), (h, c) => {
let p = 0;
for (const g of c)
p += g.evaluate(h);
return p;
}], "*": [xe, ls(xe), (h, c) => {
let p = 1;
for (const g of c)
p *= g.evaluate(h);
return p;
}], "-": { type: xe, overloads: [[[xe, xe], (h, [c, p]) => c.evaluate(h) - p.evaluate(h)], [[xe], (h, [c]) => -c.evaluate(h)]] }, "/": [xe, [xe, xe], (h, [c, p]) => c.evaluate(h) / p.evaluate(h)], "%": [xe, [xe, xe], (h, [c, p]) => c.evaluate(h) % p.evaluate(h)], ln2: [xe, [], () => Math.LN2], pi: [xe, [], () => Math.PI], e: [xe, [], () => Math.E], "^": [xe, [xe, xe], (h, [c, p]) => Math.pow(c.evaluate(h), p.evaluate(h))], sqrt: [xe, [xe], (h, [c]) => Math.sqrt(c.evaluate(h))], log10: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h)) / Math.LN10], ln: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h))], log2: [xe, [xe], (h, [c]) => Math.log(c.evaluate(h)) / Math.LN2], sin: [xe, [xe], (h, [c]) => Math.sin(c.evaluate(h))], cos: [xe, [xe], (h, [c]) => Math.cos(c.evaluate(h))], tan: [xe, [xe], (h, [c]) => Math.tan(c.evaluate(h))], asin: [xe, [xe], (h, [c]) => Math.asin(c.evaluate(h))], acos: [xe, [xe], (h, [c]) => Math.acos(c.evaluate(h))], atan: [xe, [xe], (h, [c]) => Math.atan(c.evaluate(h))], min: [xe, ls(xe), (h, c) => Math.min(...c.map((p) => p.evaluate(h)))], max: [xe, ls(xe), (h, c) => Math.max(...c.map((p) => p.evaluate(h)))], abs: [xe, [xe], (h, [c]) => Math.abs(c.evaluate(h))], round: [xe, [xe], (h, [c]) => {
const p = c.evaluate(h);
return p < 0 ? -Math.round(-p) : Math.round(p);
}], floor: [xe, [xe], (h, [c]) => Math.floor(c.evaluate(h))], ceil: [xe, [xe], (h, [c]) => Math.ceil(c.evaluate(h))], "filter-==": [_r, [Dr, wr], (h, [c, p]) => h.properties()[c.value] === p.value], "filter-id-==": [_r, [wr], (h, [c]) => h.id() === c.value], "filter-type-==": [_r, [Dr], (h, [c]) => h.geometryType() === c.value], "filter-<": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g < w;
}], "filter-id-<": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p < g;
}], "filter->": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g > w;
}], "filter-id->": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p > g;
}], "filter-<=": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g <= w;
}], "filter-id-<=": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p <= g;
}], "filter->=": [_r, [Dr, wr], (h, [c, p]) => {
const g = h.properties()[c.value], w = p.value;
return typeof g == typeof w && g >= w;
}], "filter-id->=": [_r, [wr], (h, [c]) => {
const p = h.id(), g = c.value;
return typeof p == typeof g && p >= g;
}], "filter-has": [_r, [wr], (h, [c]) => c.value in h.properties()], "filter-has-id": [_r, [], (h) => h.id() !== null && h.id() !== void 0], "filter-type-in": [_r, [ot(Dr)], (h, [c]) => c.value.indexOf(h.geometryType()) >= 0], "filter-id-in": [_r, [ot(wr)], (h, [c]) => c.value.indexOf(h.id()) >= 0], "filter-in-small": [_r, [Dr, ot(wr)], (h, [c, p]) => p.value.indexOf(h.properties()[c.value]) >= 0], "filter-in-large": [_r, [Dr, ot(wr)], (h, [c, p]) => function(g, w, H, A) {
for (; H <= A; ) {
const C = H + A >> 1;
if (w[C] === g)
return !0;
w[C] > g ? A = C - 1 : H = C + 1;
}
return !1;
}(h.properties()[c.value], p.value, 0, p.value.length - 1)], all: { type: _r, overloads: [[[_r, _r], (h, [c, p]) => c.evaluate(h) && p.evaluate(h)], [ls(_r), (h, c) => {
for (const p of c)
if (!p.evaluate(h))
return !1;
return !0;
}]] }, any: { type: _r, overloads: [[[_r, _r], (h, [c, p]) => c.evaluate(h) || p.evaluate(h)], [ls(_r), (h, c) => {
for (const p of c)
if (p.evaluate(h))
return !0;
return !1;
}]] }, "!": [_r, [_r], (h, [c]) => !c.evaluate(h)], "is-supported-script": [_r, [Dr], (h, [c]) => {
const p = h.globals && h.globals.isSupportedScript;
return !p || p(c.evaluate(h));
}], upcase: [Dr, [Dr], (h, [c]) => c.evaluate(h).toUpperCase()], downcase: [Dr, [Dr], (h, [c]) => c.evaluate(h).toLowerCase()], concat: [Dr, ls(wr), (h, c) => c.map((p) => Ui(p.evaluate(h))).join("")], "resolved-locale": [Dr, [Pi], (h, [c]) => c.evaluate(h).resolvedLocale()] });
class gi {
constructor(c, p) {
var g;
this.expression = c, this._warningHistory = {}, this._evaluator = new ma(), this._defaultValue = p ? (g = p).type === "color" && ne(g.default) ? new tn(0, 0, 0, 0) : g.type === "color" ? tn.parse(g.default) || null : g.type === "padding" ? Yn.parse(g.default) || null : g.type === "variableAnchorOffsetCollection" ? _n.parse(g.default) || null : g.default === void 0 ? null : g.default : null, this._enumValues = p && p.type === "enum" ? p.values : null;
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._evaluator.globals = c, this._evaluator.feature = p, this._evaluator.featureState = g, this._evaluator.canonical = w, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A, this.expression.evaluate(this._evaluator);
}
evaluate(c, p, g, w, H, A) {
this._evaluator.globals = c, this._evaluator.feature = p || null, this._evaluator.featureState = g || null, this._evaluator.canonical = w, this._evaluator.availableImages = H || null, this._evaluator.formattedSection = A || null;
try {
const C = this.expression.evaluate(this._evaluator);
if (C == null || typeof C == "number" && C != C)
return this._defaultValue;
if (this._enumValues && !(C in this._enumValues))
throw new jn(`Expected value to be one of ${Object.keys(this._enumValues).map((N) => JSON.stringify(N)).join(", ")}, but found ${JSON.stringify(C)} instead.`);
return C;
} catch (C) {
return this._warningHistory[C.message] || (this._warningHistory[C.message] = !0, typeof console < "u" && console.warn(C.message)), this._defaultValue;
}
}
}
function yi(h) {
return Array.isArray(h) && h.length > 0 && typeof h[0] == "string" && h[0] in Co;
}
function _1(h, c) {
const p = new Xo(Co, V3, [], c ? function(w) {
const H = { color: Vn, string: Dr, number: xe, enum: Dr, boolean: _r, formatted: H1, padding: Vi, resolvedImage: Rn, variableAnchorOffsetCollection: xt };
return w.type === "array" ? ot(H[w.value] || wr, w.length) : H[w.type];
}(c) : void 0), g = p.parse(h, void 0, void 0, void 0, c && c.type === "string" ? { typeAnnotation: "coerce" } : void 0);
return g ? R3(new gi(g, c)) : Us(p.errors);
}
class A1 {
constructor(c, p) {
this.kind = c, this._styleExpression = p, this.isStateDependent = c !== "constant" && !us(p.expression);
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, w, H, A);
}
evaluate(c, p, g, w, H, A) {
return this._styleExpression.evaluate(c, p, g, w, H, A);
}
}
class Ai {
constructor(c, p, g, w) {
this.kind = c, this.zoomStops = g, this._styleExpression = p, this.isStateDependent = c !== "camera" && !us(p.expression), this.interpolationType = w;
}
evaluateWithoutErrorHandling(c, p, g, w, H, A) {
return this._styleExpression.evaluateWithoutErrorHandling(c, p, g, w, H, A);
}
evaluate(c, p, g, w, H, A) {
return this._styleExpression.evaluate(c, p, g, w, H, A);
}
interpolationFactor(c, p, g) {
return this.interpolationType ? un.interpolationFactor(this.interpolationType, c, p, g) : 0;
}
}
function ko(h, c) {
const p = _1(h, c);
if (p.result === "error")
return p;
const g = p.value.expression, w = cs(g);
if (!w && !t2(c))
return Us([new Xn("", "data expressions not supported")]);
const H = La(g, ["zoom"]);
if (!H && !O0(c))
return Us([new Xn("", "zoom expressions not supported")]);
const A = hs(g);
return A || H ? A instanceof Xn ? Us([A]) : A instanceof un && !C0(c) ? Us([new Xn("", '"interpolate" expressions cannot be used with this property')]) : R3(A ? new Ai(w ? "camera" : "composite", p.value, A.labels, A instanceof un ? A.interpolation : void 0) : new A1(w ? "constant" : "source", p.value)) : Us([new Xn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);
}
class Io {
constructor(c, p) {
this._parameters = c, this._specification = p, bi(this, Lr(this._parameters, this._specification));
}
static deserialize(c) {
return new Io(c._parameters, c._specification);
}
static serialize(c) {
return { _parameters: c._parameters, _specification: c._specification };
}
}
function hs(h) {
let c = null;
if (h instanceof ho)
c = hs(h.result);
else if (h instanceof dr) {
for (const p of h.args)
if (c = hs(p), c)
break;
} else
(h instanceof qt || h instanceof un) && h.input instanceof po && h.input.name === "zoom" && (c = h);
return c instanceof Xn || h.eachChild((p) => {
const g = hs(p);
g instanceof Xn ? c = g : !c && g ? c = new Xn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : c && g && c !== g && (c = new Xn("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));
}), c;
}
function S2(h) {
if (h === !0 || h === !1)
return !0;
if (!Array.isArray(h) || h.length === 0)
return !1;
switch (h[0]) {
case "has":
return h.length >= 2 && h[1] !== "$id" && h[1] !== "$type";
case "in":
return h.length >= 3 && (typeof h[1] != "string" || Array.isArray(h[2]));
case "!in":
case "!has":
case "none":
return !1;
case "==":
case "!=":
case ">":
case ">=":
case "<":
case "<=":
return h.length !== 3 || Array.isArray(h[1]) || Array.isArray(h[2]);
case "any":
case "all":
for (const c of h.slice(1))
if (!S2(c) && typeof c != "boolean")
return !1;
return !0;
default:
return !0;
}
}
const ds = { type: "boolean", default: !1, transition: !1, "property-type": "data-driven", expression: { interpolated: !1, parameters: ["zoom", "feature"] } };
function Y4(h) {
if (h == null)
return { filter: () => !0, needGeometry: !1 };
S2(h) || (h = wn(h));
const c = _1(h, ds);
if (c.result === "error")
throw new Error(c.value.map((p) => `${p.key}: ${p.message}`).join(", "));
return { filter: (p, g, w) => c.value.evaluate(p, g, {}, w), needGeometry: El(h) };
}
function Ec(h, c) {
return h < c ? -1 : h > c ? 1 : 0;
}
function El(h) {
if (!Array.isArray(h))
return !1;
if (h[0] === "within" || h[0] === "distance")
return !0;
for (let c = 1; c < h.length; c++)
if (El(h[c]))
return !0;
return !1;
}
function wn(h) {
if (!h)
return !0;
const c = h[0];
return h.length <= 1 ? c !== "any" : c === "==" ? mn(h[1], h[2], "==") : c === "!=" ? Gi(mn(h[1], h[2], "==")) : c === "<" || c === ">" || c === "<=" || c === ">=" ? mn(h[1], h[2], c) : c === "any" ? (p = h.slice(1), ["any"].concat(p.map(wn))) : c === "all" ? ["all"].concat(h.slice(1).map(wn)) : c === "none" ? ["all"].concat(h.slice(1).map(wn).map(Gi)) : c === "in" ? ps(h[1], h.slice(2)) : c === "!in" ? Gi(ps(h[1], h.slice(2))) : c === "has" ? fo(h[1]) : c !== "!has" || Gi(fo(h[1]));
var p;
}
function mn(h, c, p) {
switch (h) {
case "$type":
return [`filter-type-${p}`, c];
case "$id":
return [`filter-id-${p}`, c];
default:
return [`filter-${p}`, h, c];
}
}
function ps(h, c) {
if (c.length === 0)
return !1;
switch (h) {
case "$type":
return ["filter-type-in", ["literal", c]];
case "$id":
return ["filter-id-in", ["literal", c]];
default:
return c.length > 200 && !c.some((p) => typeof p != typeof c[0]) ? ["filter-in-large", h, ["literal", c.sort(Ec)]] : ["filter-in-small", h, ["literal", c]];
}
}
function fo(h) {
switch (h) {
case "$type":
return !0;
case "$id":
return ["filter-has-id"];
default:
return ["filter-has", h];
}
}
function Gi(h) {
return ["!", h];
}
function $i(h) {
const c = typeof h;
if (c === "number" || c === "boolean" || c === "string" || h == null)
return JSON.stringify(h);
if (Array.isArray(h)) {
let w = "[";
for (const H of h)
w += `${$i(H)},`;
return `${w}]`;
}
const p = Object.keys(h).sort();
let g = "{";
for (let w = 0; w < p.length; w++)
g += `${JSON.stringify(p[w])}:${$i(h[p[w]])},`;
return `${g}}`;
}
function e2(h) {
let c = "";
for (const p of en)
c += `/${$i(h[p])}`;
return c;
}
function H2(h) {
const c = h.value;
return c ? [new ye(h.key, c, "constants have been deprecated as of v8")] : [];
}
function Dn(h) {
return h instanceof Number || h instanceof String || h instanceof Boolean ? h.valueOf() : h;
}
function O1(h) {
if (Array.isArray(h))
return h.map(O1);
if (h instanceof Object && !(h instanceof Number || h instanceof String || h instanceof Boolean)) {
const c = {};
for (const p in h)
c[p] = O1(h[p]);
return c;
}
return Dn(h);
}
function Wi(h) {
const c = h.key, p = h.value, g = h.valueSpec || {}, w = h.objectElementValidators || {}, H = h.style, A = h.styleSpec, C = h.validateSpec;
let N = [];
const z = kt(p);
if (z !== "object")
return [new ye(c, p, `object expected, ${z} found`)];
for (const W in p) {
const X = W.split(".")[0], tt = g[X] || g["*"];
let at;
if (w[X])
at = w[X];
else if (g[X])
at = C;
else if (w["*"])
at = w["*"];
else {
if (!g["*"]) {
N.push(new ye(c, p[W], `unknown property "${W}"`));
continue;
}
at = C;
}
N = N.concat(at({ key: (c && `${c}.`) + W, value: p[W], valueSpec: tt, style: H, styleSpec: A, object: p, objectKey: W, validateSpec: C }, p));
}
for (const W in g)
w[W] || g[W].required && g[W].default === void 0 && p[W] === void 0 && N.push(new ye(c, p, `missing required property "${W}"`));
return N;
}
function Po(h) {
const c = h.value, p = h.valueSpec, g = h.style, w = h.styleSpec, H = h.key, A = h.arrayElementValidator || h.validateSpec;
if (kt(c) !== "array")
return [new ye(H, c, `array expected, ${kt(c)} found`)];
if (p.length && c.length !== p.length)
return [new ye(H, c, `array length ${p.length} expected, length ${c.length} found`)];
if (p["min-length"] && c.length < p["min-length"])
return [new ye(H, c, `array length at least ${p["min-length"]} expected, length ${c.length} found`)];
let C = { type: p.value, values: p.values };
w.$version < 7 && (C.function = p.function), kt(p.value) === "object" && (C = p.value);
let N = [];
for (let z = 0; z < c.length; z++)
N = N.concat(A({ array: c, arrayIndex: z, value: c[z], valueSpec: C, validateSpec: h.validateSpec, style: g, styleSpec: w, key: `${H}[${z}]` }));
return N;
}
function J4(h) {
const c = h.key, p = h.value, g = h.valueSpec;
let w = kt(p);
return w === "number" && p != p && (w = "NaN"), w !== "number" ? [new ye(c, p, `number expected, ${w} found`)] : "minimum" in g && p < g.minimum ? [new ye(c, p, `${p} is less than the minimum value ${g.minimum}`)] : "maximum" in g && p > g.maximum ? [new ye(c, p, `${p} is greater than the maximum value ${g.maximum}`)] : [];
}
function Gs(h) {
const c = h.valueSpec, p = Dn(h.value.type);
let g, w, H, A = {};
const C = p !== "categorical" && h.value.property === void 0, N = !C, z = kt(h.value.stops) === "array" && kt(h.value.stops[0]) === "array" && kt(h.value.stops[0][0]) === "object", W = Wi({ key: h.key, value: h.value, valueSpec: h.styleSpec.function, validateSpec: h.validateSpec, style: h.style, styleSpec: h.styleSpec, objectElementValidators: { stops: function(at) {
if (p === "identity")
return [new ye(at.key, at.value, 'identity function may not have a "stops" property')];
let ut = [];
const Tt = at.value;
return ut = ut.concat(Po({ key: at.key, value: Tt, valueSpec: at.valueSpec, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec, arrayElementValidator: X })), kt(Tt) === "array" && Tt.length === 0 && ut.push(new ye(at.key, Tt, "array must have at least one stop")), ut;
}, default: function(at) {
return at.validateSpec({ key: at.key, value: at.value, valueSpec: c, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec });
} } });
return p === "identity" && C && W.push(new ye(h.key, h.value, 'missing required property "property"')), p === "identity" || h.value.stops || W.push(new ye(h.key, h.value, 'missing required property "stops"')), p === "exponential" && h.valueSpec.expression && !C0(h.valueSpec) && W.push(new ye(h.key, h.value, "exponential functions not supported")), h.styleSpec.$version >= 8 && (N && !t2(h.valueSpec) ? W.push(new ye(h.key, h.value, "property functions not supported")) : C && !O0(h.valueSpec) && W.push(new ye(h.key, h.value, "zoom functions not supported"))), p !== "categorical" && !z || h.value.property !== void 0 || W.push(new ye(h.key, h.value, '"property" property is required')), W;
function X(at) {
let ut = [];
const Tt = at.value, Lt = at.key;
if (kt(Tt) !== "array")
return [new ye(Lt, Tt, `array expected, ${kt(Tt)} found`)];
if (Tt.length !== 2)
return [new ye(Lt, Tt, `array length 2 expected, length ${Tt.length} found`)];
if (z) {
if (kt(Tt[0]) !== "object")
return [new ye(Lt, Tt, `object expected, ${kt(Tt[0])} found`)];
if (Tt[0].zoom === void 0)
return [new ye(Lt, Tt, "object stop key must have zoom")];
if (Tt[0].value === void 0)
return [new ye(Lt, Tt, "object stop key must have value")];
if (H && H > Dn(Tt[0].zoom))
return [new ye(Lt, Tt[0].zoom, "stop zoom values must appear in ascending order")];
Dn(Tt[0].zoom) !== H && (H = Dn(Tt[0].zoom), w = void 0, A = {}), ut = ut.concat(Wi({ key: `${Lt}[0]`, value: Tt[0], valueSpec: { zoom: {} }, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec, objectElementValidators: { zoom: J4, value: tt } }));
} else
ut = ut.concat(tt({ key: `${Lt}[0]`, value: Tt[0], valueSpec: {}, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec }, Tt));
return yi(O1(Tt[1])) ? ut.concat([new ye(`${Lt}[1]`, Tt[1], "expressions are not allowed in function stops.")]) : ut.concat(at.validateSpec({ key: `${Lt}[1]`, value: Tt[1], valueSpec: c, validateSpec: at.validateSpec, style: at.style, styleSpec: at.styleSpec }));
}
function tt(at, ut) {
const Tt = kt(at.value), Lt = Dn(at.value), Et = at.value !== null ? at.value : ut;
if (g) {
if (Tt !== g)
return [new ye(at.key, Et, `${Tt} stop domain type must match previous stop domain type ${g}`)];
} else
g = Tt;
if (Tt !== "number" && Tt !== "string" && Tt !== "boolean")
return [new ye(at.key, Et, "stop domain value must be a number, string, or boolean")];
if (Tt !== "number" && p !== "categorical") {
let $t = `number expected, ${Tt} found`;
return t2(c) && p === void 0 && ($t += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new ye(at.key, Et, $t)];
}
return p !== "categorical" || Tt !== "number" || isFinite(Lt) && Math.floor(Lt) === Lt ? p !== "categorical" && Tt === "number" && w !== void 0 && Lt < w ? [new ye(at.key, Et, "stop domain values must appear in ascending order")] : (w = Lt, p === "categorical" && Lt in A ? [new ye(at.key, Et, "stop domain values must be unique")] : (A[Lt] = !0, [])) : [new ye(at.key, Et, `integer expected, found ${Lt}`)];
}
}
function Ts(h) {
const c = (h.expressionContext === "property" ? ko : _1)(O1(h.value), h.valueSpec);
if (c.result === "error")
return c.value.map((g) => new ye(`${h.key}${g.key}`, h.value, g.message));
const p = c.value.expression || c.value._styleExpression.expression;
if (h.expressionContext === "property" && h.propertyKey === "text-font" && !p.outputDefined())
return [new ye(h.key, h.value, `Invalid data expression for "${h.propertyKey}". Output values must be contained as literals within the expression.`)];
if (h.expressionContext === "property" && h.propertyType === "layout" && !us(p))
return [new ye(h.key, h.value, '"feature-state" data expressions are not supported with layout properties.')];
if (h.expressionContext === "filter" && !us(p))
return [new ye(h.key, h.value, '"feature-state" data expressions are not supported with filters.')];
if (h.expressionContext && h.expressionContext.indexOf("cluster") === 0) {
if (!La(p, ["zoom", "feature-state"]))
return [new ye(h.key, h.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')];
if (h.expressionContext === "cluster-initial" && !cs(p))
return [new ye(h.key, h.value, "Feature data expressions are not supported with initial expression part of cluster properties.")];
}
return [];
}
function Qo(h) {
const c = h.key, p = h.value, g = h.valueSpec, w = [];
return Array.isArray(g.values) ? g.values.indexOf(Dn(p)) === -1 && w.push(new ye(c, p, `expected one of [${g.values.join(", ")}], ${JSON.stringify(p)} found`)) : Object.keys(g.values).indexOf(Dn(p)) === -1 && w.push(new ye(c, p, `expected one of [${Object.keys(g.values).join(", ")}], ${JSON.stringify(p)} found`)), w;
}
function wa(h) {
return S2(O1(h.value)) ? Ts(bi({}, h, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : N3(h);
}
function N3(h) {
const c = h.value, p = h.key;
if (kt(c) !== "array")
return [new ye(p, c, `array expected, ${kt(c)} found`)];
const g = h.styleSpec;
let w, H = [];
if (c.length < 1)
return [new ye(p, c, "filter array must have at least 1 element")];
switch (H = H.concat(Qo({ key: `${p}[0]`, value: c[0], valueSpec: g.filter_operator, style: h.style, styleSpec: h.styleSpec })), Dn(c[0])) {
case "<":
case "<=":
case ">":
case ">=":
c.length >= 2 && Dn(c[1]) === "$type" && H.push(new ye(p, c, `"$type" cannot be use with operator "${c[0]}"`));
case "==":
case "!=":
c.length !== 3 && H.push(new ye(p, c, `filter array for operator "${c[0]}" must have 3 elements`));
case "in":
case "!in":
c.length >= 2 && (w = kt(c[1]), w !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${w} found`)));
for (let A = 2; A < c.length; A++)
w = kt(c[A]), Dn(c[1]) === "$type" ? H = H.concat(Qo({ key: `${p}[${A}]`, value: c[A], valueSpec: g.geometry_type, style: h.style, styleSpec: h.styleSpec })) : w !== "string" && w !== "number" && w !== "boolean" && H.push(new ye(`${p}[${A}]`, c[A], `string, number, or boolean expected, ${w} found`));
break;
case "any":
case "all":
case "none":
for (let A = 1; A < c.length; A++)
H = H.concat(N3({ key: `${p}[${A}]`, value: c[A], style: h.style, styleSpec: h.styleSpec }));
break;
case "has":
case "!has":
w = kt(c[1]), c.length !== 2 ? H.push(new ye(p, c, `filter array for "${c[0]}" operator must have 2 elements`)) : w !== "string" && H.push(new ye(`${p}[1]`, c[1], `string expected, ${w} found`));
}
return H;
}
function xa(h, c) {
const p = h.key, g = h.validateSpec, w = h.style, H = h.styleSpec, A = h.value, C = h.objectKey, N = H[`${c}_${h.layerType}`];
if (!N)
return [];
const z = C.match(/^(.*)-transition$/);
if (c === "paint" && z && N[z[1]] && N[z[1]].transition)
return g({ key: p, value: A, valueSpec: H.transition, style: w, styleSpec: H });
const W = h.valueSpec || N[C];
if (!W)
return [new ye(p, A, `unknown property "${C}"`)];
let X;
if (kt(A) === "string" && t2(W) && !W.tokens && (X = /^{([^}]+)}$/.exec(A)))
return [new ye(p, A, `"${C}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(X[1])} }\`.`)];
const tt = [];
return h.layerType === "symbol" && (C === "text-field" && w && !w.glyphs && tt.push(new ye(p, A, 'use of "text-field" requires a style "glyphs" property')), C === "text-font" && ne(O1(A)) && Dn(A.type) === "identity" && tt.push(new ye(p, A, '"text-font" does not support identity functions'))), tt.concat(g({ key: h.key, value: A, valueSpec: W, style: w, styleSpec: H, expressionContext: "property", propertyType: c, propertyKey: C }));
}
function $s(h) {
return xa(h, "paint");
}
function Mc(h) {
return xa(h, "layout");
}
function Sc(h) {
let c = [];
const p = h.value, g = h.key, w = h.style, H = h.styleSpec;
p.type || p.ref || c.push(new ye(g, p, 'either "type" or "ref" is required'));
let A = Dn(p.type);
const C = Dn(p.ref);
if (p.id) {
const N = Dn(p.id);
for (let z = 0; z < h.arrayIndex; z++) {
const W = w.layers[z];
Dn(W.id) === N && c.push(new ye(g, p.id, `duplicate layer id "${p.id}", previously used at line ${W.id.__line__}`));
}
}
if ("ref" in p) {
let N;
["type", "source", "source-layer", "filter", "layout"].forEach((z) => {
z in p && c.push(new ye(g, p[z], `"${z}" is prohibited for ref layers`));
}), w.layers.forEach((z) => {
Dn(z.id) === C && (N = z);
}), N ? N.ref ? c.push(new ye(g, p.ref, "ref cannot reference another ref layer")) : A = Dn(N.type) : c.push(new ye(g, p.ref, `ref layer "${C}" not found`));
} else if (A !== "background")
if (p.source) {
const N = w.sources && w.sources[p.source], z = N && Dn(N.type);
N ? z === "vector" && A === "raster" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a raster source`)) : z !== "raster-dem" && A === "hillshade" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a raster-dem source`)) : z === "raster" && A !== "raster" ? c.push(new ye(g, p.source, `layer "${p.id}" requires a vector source`)) : z !== "vector" || p["source-layer"] ? z === "raster-dem" && A !== "hillshade" ? c.push(new ye(g, p.source, "raster-dem source can only be used with layer type 'hillshade'.")) : A !== "line" || !p.paint || !p.paint["line-gradient"] || z === "geojson" && N.lineMetrics || c.push(new ye(g, p, `layer "${p.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : c.push(new ye(g, p, `layer "${p.id}" must specify a "source-layer"`)) : c.push(new ye(g, p.source, `source "${p.source}" not found`));
} else
c.push(new ye(g, p, 'missing required property "source"'));
return c = c.concat(Wi({ key: g, value: p, valueSpec: H.layer, style: h.style, styleSpec: h.styleSpec, validateSpec: h.validateSpec, objectElementValidators: { "*": () => [], type: () => h.validateSpec({ key: `${g}.type`, value: p.type, valueSpec: H.layer.type, style: h.style, styleSpec: h.styleSpec, validateSpec: h.validateSpec, object: p, objectKey: "type" }), filter: wa, layout: (N) => Wi({ layer: p, key: N.key, value: N.value, style: N.style, styleSpec: N.styleSpec, validateSpec: N.validateSpec, objectElementValidators: { "*": (z) => Mc(bi({ layerType: A }, z)) } }), paint: (N) => Wi({ layer: p, key: N.key, value: N.value, style: N.style, styleSpec: N.styleSpec, validateSpec: N.validateSpec, objectElementValidators: { "*": (z) => $s(bi({ layerType: A }, z)) } }) } })), c;
}
function D3(h) {
const c = h.value, p = h.key, g = kt(c);
return g !== "string" ? [new ye(p, c, `string expected, ${g} found`)] : [];
}
const Ml = { promoteId: function({ key: h, value: c }) {
if (kt(c) === "string")
return D3({ key: h, value: c });
{
const p = [];
for (const g in c)
p.push(...D3({ key: `${h}.${g}`, value: c[g] }));
return p;
}
} };
function k0(h) {
const c = h.value, p = h.key, g = h.styleSpec, w = h.style, H = h.validateSpec;
if (!c.type)
return [new ye(p, c, '"type" is required')];
const A = Dn(c.type);
let C;
switch (A) {
case "vector":
case "raster":
return C = Wi({ key: p, value: c, valueSpec: g[`source_${A.replace("-", "_")}`], style: h.style, styleSpec: g, objectElementValidators: Ml, validateSpec: H }), C;
case "raster-dem":
return C = function(N) {
var z;
const W = (z = N.sourceName) !== null && z !== void 0 ? z : "", X = N.value, tt = N.styleSpec, at = tt.source_raster_dem, ut = N.style;
let Tt = [];
const Lt = kt(X);
if (X === void 0)
return Tt;
if (Lt !== "object")
return Tt.push(new ye("source_raster_dem", X, `object expected, ${Lt} found`)), Tt;
const Et = Dn(X.encoding) === "custom", $t = ["redFactor", "greenFactor", "blueFactor", "baseShift"], Pt = N.value.encoding ? `"${N.value.encoding}"` : "Default";
for (const Bt in X)
!Et && $t.includes(Bt) ? Tt.push(new ye(Bt, X[Bt], `In "${W}": "${Bt}" is only valid when "encoding" is set to "custom". ${Pt} encoding found`)) : at[Bt] ? Tt = Tt.concat(N.validateSpec({ key: Bt, value: X[Bt], valueSpec: at[Bt], validateSpec: N.validateSpec, style: ut, styleSpec: tt })) : Tt.push(new ye(Bt, X[Bt], `unknown property "${Bt}"`));
return Tt;
}({ sourceName: p, value: c, style: h.style, styleSpec: g, validateSpec: H }), C;
case "geojson":
if (C = Wi({ key: p, value: c, valueSpec: g.source_geojson, style: w, styleSpec: g, validateSpec: H, objectElementValidators: Ml }), c.cluster)
for (const N in c.clusterProperties) {
const [z, W] = c.clusterProperties[N], X = typeof z == "string" ? [z, ["accumulated"], ["get", N]] : z;
C.push(...Ts({ key: `${p}.${N}.map`, value: W, validateSpec: H, expressionContext: "cluster-map" })), C.push(...Ts({ key: `${p}.${N}.reduce`, value: X, validateSpec: H, expressionContext: "cluster-reduce" }));
}
return C;
case "video":
return Wi({ key: p, value: c, valueSpec: g.source_video, style: w, validateSpec: H, styleSpec: g });
case "image":
return Wi({ key: p, value: c, valueSpec: g.source_image, style: w, validateSpec: H, styleSpec: g });
case "canvas":
return [new ye(p, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")];
default:
return Qo({ key: `${p}.type`, value: c.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] }, style: w, validateSpec: H, styleSpec: g });
}
}
function Hc(h) {
const c = h.value, p = h.styleSpec, g = p.light, w = h.style;
let H = [];
const A = kt(c);
if (c === void 0)
return H;
if (A !== "object")
return H = H.concat([new ye("light", c, `object expected, ${A} found`)]), H;
for (const C in c) {
const N = C.match(/^(.*)-transition$/);
H = H.concat(N && g[N[1]] && g[N[1]].transition ? h.validateSpec({ key: C, value: c[C], valueSpec: p.transition, validateSpec: h.validateSpec, style: w, styleSpec: p }) : g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
}
return H;
}
function Ac(h) {
const c = h.value, p = h.styleSpec, g = p.sky, w = h.style, H = kt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("sky", c, `object expected, ${H} found`)];
let A = [];
for (const C in c)
A = A.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return A;
}
function Oc(h) {
const c = h.value, p = h.styleSpec, g = p.terrain, w = h.style;
let H = [];
const A = kt(c);
if (c === void 0)
return H;
if (A !== "object")
return H = H.concat([new ye("terrain", c, `object expected, ${A} found`)]), H;
for (const C in c)
H = H.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], validateSpec: h.validateSpec, style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return H;
}
function Cc(h) {
let c = [];
const p = h.value, g = h.key;
if (Array.isArray(p)) {
const w = [], H = [];
for (const A in p)
p[A].id && w.includes(p[A].id) && c.push(new ye(g, p, `all the sprites' ids must be unique, but ${p[A].id} is duplicated`)), w.push(p[A].id), p[A].url && H.includes(p[A].url) && c.push(new ye(g, p, `all the sprites' URLs must be unique, but ${p[A].url} is duplicated`)), H.push(p[A].url), c = c.concat(Wi({ key: `${g}[${A}]`, value: p[A], valueSpec: { id: { type: "string", required: !0 }, url: { type: "string", required: !0 } }, validateSpec: h.validateSpec }));
return c;
}
return D3({ key: g, value: p });
}
const Sl = { "*": () => [], array: Po, boolean: function(h) {
const c = h.value, p = h.key, g = kt(c);
return g !== "boolean" ? [new ye(p, c, `boolean expected, ${g} found`)] : [];
}, number: J4, color: function(h) {
const c = h.key, p = h.value, g = kt(p);
return g !== "string" ? [new ye(c, p, `color expected, ${g} found`)] : tn.parse(String(p)) ? [] : [new ye(c, p, `color expected, "${p}" found`)];
}, constants: H2, enum: Qo, filter: wa, function: Gs, layer: Sc, object: Wi, source: k0, light: Hc, sky: Ac, terrain: Oc, projection: function(h) {
const c = h.value, p = h.styleSpec, g = p.projection, w = h.style, H = kt(c);
if (c === void 0)
return [];
if (H !== "object")
return [new ye("projection", c, `object expected, ${H} found`)];
let A = [];
for (const C in c)
A = A.concat(g[C] ? h.validateSpec({ key: C, value: c[C], valueSpec: g[C], style: w, styleSpec: p }) : [new ye(C, c[C], `unknown property "${C}"`)]);
return A;
}, string: D3, formatted: function(h) {
return D3(h).length === 0 ? [] : Ts(h);
}, resolvedImage: function(h) {
return D3(h).length === 0 ? [] : Ts(h);
}, padding: function(h) {
const c = h.key, p = h.value;
if (kt(p) === "array") {
if (p.length < 1 || p.length > 4)
return [new ye(c, p, `padding requires 1 to 4 values; ${p.length} values found`)];
const g = { type: "number" };
let w = [];
for (let H = 0; H < p.length; H++)
w = w.concat(h.validateSpec({ key: `${c}[${H}]`, value: p[H], validateSpec: h.validateSpec, valueSpec: g }));
return w;
}
return J4({ key: c, value: p, valueSpec: {} });
}, variableAnchorOffsetCollection: function(h) {
const c = h.key, p = h.value, g = kt(p), w = h.styleSpec;
if (g !== "array" || p.length < 1 || p.length % 2 != 0)
return [new ye(c, p, "variableAnchorOffsetCollection requires a non-empty array of even length")];
let H = [];
for (let A = 0; A < p.length; A += 2)
H = H.concat(Qo({ key: `${c}[${A}]`, value: p[A], valueSpec: w.layout_symbol["text-anchor"] })), H = H.concat(Po({ key: `${c}[${A + 1}]`, value: p[A + 1], valueSpec: { length: 2, value: "number" }, validateSpec: h.validateSpec, style: h.style, styleSpec: w }));
return H;
}, sprite: Cc };
function t6(h) {
const c = h.value, p = h.valueSpec, g = h.styleSpec;
return h.validateSpec = t6, p.expression && ne(Dn(c)) ? Gs(h) : p.expression && yi(O1(c)) ? Ts(h) : p.type && Sl[p.type] ? Sl[p.type](h) : Wi(bi({}, h, { valueSpec: p.type ? g[p.type] : p }));
}
function Qp(h) {
const c = h.value, p = h.key, g = D3(h);
return g.length || (c.indexOf("{fontstack}") === -1 && g.push(new ye(p, c, '"glyphs" url must include a "{fontstack}" token')), c.indexOf("{range}") === -1 && g.push(new ye(p, c, '"glyphs" url must include a "{range}" token'))), g;
}
function r2(h, c = Ct) {
let p = [];
return p = p.concat(t6({ key: "", value: h, valueSpec: c.$root, styleSpec: c, style: h, validateSpec: t6, objectElementValidators: { glyphs: Qp, "*": () => [] } })), h.constants && (p = p.concat(H2({ key: "constants", value: h.constants, style: h, styleSpec: c, validateSpec: t6 }))), kc(p);
}
function fs(h) {
return function(c) {
return h({ ...c, validateSpec: t6 });
};
}
function kc(h) {
return [].concat(h).sort((c, p) => c.line - p.line);
}
function A2(h) {
return function(...c) {
return kc(h.apply(this, c));
};
}
r2.source = A2(fs(k0)), r2.sprite = A2(fs(Cc)), r2.glyphs = A2(fs(Qp)), r2.light = A2(fs(Hc)), r2.sky = A2(fs(Ac)), r2.terrain = A2(fs(Oc)), r2.layer = A2(fs(Sc)), r2.filter = A2(fs(wa)), r2.paintProperty = A2(fs($s)), r2.layoutProperty = A2(fs(Mc));
const F3 = r2, f_ = F3.light, Q_ = F3.sky, mp = F3.paintProperty, gp = F3.layoutProperty;
function Ic(h, c) {
let p = !1;
if (c && c.length)
for (const g of c)
h.fire(new $e(new Error(g.message))), p = !0;
return p;
}
class e6 {
constructor(c, p, g) {
const w = this.cells = [];
if (c instanceof ArrayBuffer) {
this.arrayBuffer = c;
const A = new Int32Array(this.arrayBuffer);
c = A[0], this.d = (p = A[1]) + 2 * (g = A[2]);
for (let N = 0; N < this.d * this.d; N++) {
const z = A[3 + N], W = A[3 + N + 1];
w.push(z === W ? null : A.subarray(z, W));
}
const C = A[3 + w.length + 1];
this.keys = A.subarray(A[3 + w.length], C), this.bboxes = A.subarray(C), this.insert = this._insertReadonly;
} else {
this.d = p + 2 * g;
for (let A = 0; A < this.d * this.d; A++)
w.push([]);
this.keys = [], this.bboxes = [];
}
this.n = p, this.extent = c, this.padding = g, this.scale = p / c, this.uid = 0;
const H = g / p * c;
this.min = -H, this.max = c + H;
}
insert(c, p, g, w, H) {
this._forEachCell(p, g, w, H, this._insertCell, this.uid++, void 0, void 0), this.keys.push(c), this.bboxes.push(p), this.bboxes.push(g), this.bboxes.push(w), this.bboxes.push(H);
}
_insertReadonly() {
throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.");
}
_insertCell(c, p, g, w, H, A) {
this.cells[H].push(A);
}
query(c, p, g, w, H) {
const A = this.min, C = this.max;
if (c <= A && p <= A && C <= g && C <= w && !H)
return Array.prototype.slice.call(this.keys);
{
const N = [];
return this._forEachCell(c, p, g, w, this._queryCell, N, {}, H), N;
}
}
_queryCell(c, p, g, w, H, A, C, N) {
const z = this.cells[H];
if (z !== null) {
const W = this.keys, X = this.bboxes;
for (let tt = 0; tt < z.length; tt++) {
const at = z[tt];
if (C[at] === void 0) {
const ut = 4 * at;
(N ? N(X[ut + 0], X[ut + 1], X[ut + 2], X[ut + 3]) : c <= X[ut + 2] && p <= X[ut + 3] && g >= X[ut + 0] && w >= X[ut + 1]) ? (C[at] = !0, A.push(W[at])) : C[at] = !1;
}
}
}
}
_forEachCell(c, p, g, w, H, A, C, N) {
const z = this._convertToCellCoord(c), W = this._convertToCellCoord(p), X = this._convertToCellCoord(g), tt = this._convertToCellCoord(w);
for (let at = z; at <= X; at++)
for (let ut = W; ut <= tt; ut++) {
const Tt = this.d * ut + at;
if ((!N || N(this._convertFromCellCoord(at), this._convertFromCellCoord(ut), this._convertFromCellCoord(at + 1), this._convertFromCellCoord(ut + 1))) && H.call(this, c, p, g, w, Tt, A, C, N))
return;
}
}
_convertFromCellCoord(c) {
return (c - this.padding) / this.scale;
}
_convertToCellCoord(c) {
return Math.max(0, Math.min(this.d - 1, Math.floor(c * this.scale) + this.padding));
}
toArrayBuffer() {
if (this.arrayBuffer)
return this.arrayBuffer;
const c = this.cells, p = 3 + this.cells.length + 1 + 1;
let g = 0;
for (let A = 0; A < this.cells.length; A++)
g += this.cells[A].length;
const w = new Int32Array(p + g + this.keys.length + this.bboxes.length);
w[0] = this.extent, w[1] = this.n, w[2] = this.padding;
let H = p;
for (let A = 0; A < c.length; A++) {
const C = c[A];
w[3 + A] = H, w.set(C, H), H += C.length;
}
return w[3 + c.length] = H, w.set(this.keys, H), H += this.keys.length, w[3 + c.length + 1] = H, w.set(this.bboxes, H), H += this.bboxes.length, w.buffer;
}
static serialize(c, p) {
const g = c.toArrayBuffer();
return p && p.push(g), { buffer: g };
}
static deserialize(c) {
return new e6(c.buffer);
}
}
const n2 = {};
function nr(h, c, p = {}) {
if (n2[h])
throw new Error(`${h} is already registered.`);
Object.defineProperty(c, "_classRegistryKey", { value: h, writeable: !1 }), n2[h] = { klass: c, omit: p.omit || [], shallow: p.shallow || [] };
}
nr("Object", Object), nr("TransferableGridIndex", e6), nr("Color", tn), nr("Error", Error), nr("AJAXError", Gt), nr("ResolvedImage", pn), nr("StylePropertyFunction", Io), nr("StyleExpression", gi, { omit: ["_evaluator"] }), nr("ZoomDependentExpression", Ai), nr("ZoomConstantExpression", A1), nr("CompoundExpression", po, { omit: ["_evaluate"] });
for (const h in Co)
Co[h]._classRegistryKey || nr(`Expression_${h}`, Co[h]);
function Hl(h) {
return h && typeof ArrayBuffer < "u" && (h instanceof ArrayBuffer || h.constructor && h.constructor.name === "ArrayBuffer");
}
function Pc(h) {
return h.$name || h.constructor._classRegistryKey;
}
function yp(h) {
return !function(c) {
if (c === null || typeof c != "object")
return !1;
const p = Pc(c);
return !(!p || p === "Object");
}(h) && (h == null || typeof h == "boolean" || typeof h == "number" || typeof h == "string" || h instanceof Boolean || h instanceof Number || h instanceof String || h instanceof Date || h instanceof RegExp || h instanceof Blob || h instanceof Error || Hl(h) || Ve(h) || ArrayBuffer.isView(h) || h instanceof ImageData);
}
function r6(h, c) {
if (yp(h))
return (Hl(h) || Ve(h)) && c && c.push(h), ArrayBuffer.isView(h) && c && c.push(h.buffer), h instanceof ImageData && c && c.push(h.data.buffer), h;
if (Array.isArray(h)) {
const H = [];
for (const A of h)
H.push(r6(A, c));
return H;
}
if (typeof h != "object")
throw new Error("can't serialize object of type " + typeof h);
const p = Pc(h);
if (!p)
throw new Error(`can't serialize object of unregistered class ${h.constructor.name}`);
if (!n2[p])
throw new Error(`${p} is not registered.`);
const { klass: g } = n2[p], w = g.serialize ? g.serialize(h, c) : {};
if (g.serialize) {
if (c && w === c[c.length - 1])
throw new Error("statically serialized object won't survive transfer of $name property");
} else {
for (const H in h) {
if (!h.hasOwnProperty(H) || n2[p].omit.indexOf(H) >= 0)
continue;
const A = h[H];
w[H] = n2[p].shallow.indexOf(H) >= 0 ? A : r6(A, c);
}
h instanceof Error && (w.message = h.message);
}
if (w.$name)
throw new Error("$name property is reserved for worker serialization logic.");
return p !== "Object" && (w.$name = p), w;
}
function n6(h) {
if (yp(h))
return h;
if (Array.isArray(h))
return h.map(n6);
if (typeof h != "object")
throw new Error("can't deserialize object of type " + typeof h);
const c = Pc(h) || "Object";
if (!n2[c])
throw new Error(`can't deserialize unregistered class ${c}`);
const { klass: p } = n2[c];
if (!p)
throw new Error(`can't deserialize unregistered class ${c}`);
if (p.deserialize)
return p.deserialize(h);
const g = Object.create(p.prototype);
for (const w of Object.keys(h)) {
if (w === "$name")
continue;
const H = h[w];
g[w] = n2[c].shallow.indexOf(w) >= 0 ? H : n6(H);
}
return g;
}
class Vc {
constructor() {
this.first = !0;
}
update(c, p) {
const g = Math.floor(c);
return this.first ? (this.first = !1, this.lastIntegerZoom = g, this.lastIntegerZoomTime = 0, this.lastZoom = c, this.lastFloorZoom = g, !0) : (this.lastFloorZoom > g ? (this.lastIntegerZoom = g + 1, this.lastIntegerZoomTime = p) : this.lastFloorZoom < g && (this.lastIntegerZoom = g, this.lastIntegerZoomTime = p), c !== this.lastZoom && (this.lastZoom = c, this.lastFloorZoom = g, !0));
}
}
const sn = { "Latin-1 Supplement": (h) => h >= 128 && h <= 255, "Hangul Jamo": (h) => h >= 4352 && h <= 4607, Khmer: (h) => h >= 6016 && h <= 6143, "General Punctuation": (h) => h >= 8192 && h <= 8303, "Letterlike Symbols": (h) => h >= 8448 && h <= 8527, "Number Forms": (h) => h >= 8528 && h <= 8591, "Miscellaneous Technical": (h) => h >= 8960 && h <= 9215, "Control Pictures": (h) => h >= 9216 && h <= 9279, "Optical Character Recognition": (h) => h >= 9280 && h <= 9311, "Enclosed Alphanumerics": (h) => h >= 9312 && h <= 9471, "Geometric Shapes": (h) => h >= 9632 && h <= 9727, "Miscellaneous Symbols": (h) => h >= 9728 && h <= 9983, "Miscellaneous Symbols and Arrows": (h) => h >= 11008 && h <= 11263, "Ideographic Description Characters": (h) => h >= 12272 && h <= 12287, "CJK Symbols and Punctuation": (h) => h >= 12288 && h <= 12351, Katakana: (h) => h >= 12448 && h <= 12543, Kanbun: (h) => h >= 12688 && h <= 12703, "CJK Strokes": (h) => h >= 12736 && h <= 12783, "Enclosed CJK Letters and Months": (h) => h >= 12800 && h <= 13055, "CJK Compatibility": (h) => h >= 13056 && h <= 13311, "Yijing Hexagram Symbols": (h) => h >= 19904 && h <= 19967, "Private Use Area": (h) => h >= 57344 && h <= 63743, "Vertical Forms": (h) => h >= 65040 && h <= 65055, "CJK Compatibility Forms": (h) => h >= 65072 && h <= 65103, "Small Form Variants": (h) => h >= 65104 && h <= 65135, "Halfwidth and Fullwidth Forms": (h) => h >= 65280 && h <= 65519 };
function Rc(h) {
for (const c of h)
if (Dc(c.charCodeAt(0)))
return !0;
return !1;
}
function m_(h) {
for (const c of h)
if (!i6(c.charCodeAt(0)))
return !1;
return !0;
}
function Nc(h) {
const c = h.map((p) => {
try {
return new RegExp(`\\p{sc=${p}}`, "u").source;
} catch {
return null;
}
}).filter((p) => p);
return new RegExp(c.join("|"), "u");
}
const g_ = Nc(["Arab", "Dupl", "Mong", "Ougr", "Syrc"]);
function i6(h) {
return !g_.test(String.fromCodePoint(h));
}
const vp = Nc(["Bopo", "Hani", "Hira", "Kana", "Kits", "Nshu", "Tang", "Yiii"]);
function Dc(h) {
return !(h !== 746 && h !== 747 && (h < 4352 || !(sn["CJK Compatibility Forms"](h) && !(h >= 65097 && h <= 65103) || sn["CJK Compatibility"](h) || sn["CJK Strokes"](h) || !(!sn["CJK Symbols and Punctuation"](h) || h >= 12296 && h <= 12305 || h >= 12308 && h <= 12319 || h === 12336) || sn["Enclosed CJK Letters and Months"](h) || sn["Ideographic Description Characters"](h) || sn.Kanbun(h) || sn.Katakana(h) && h !== 12540 || !(!sn["Halfwidth and Fullwidth Forms"](h) || h === 65288 || h === 65289 || h === 65293 || h >= 65306 && h <= 65310 || h === 65339 || h === 65341 || h === 65343 || h >= 65371 && h <= 65503 || h === 65507 || h >= 65512 && h <= 65519) || !(!sn["Small Form Variants"](h) || h >= 65112 && h <= 65118 || h >= 65123 && h <= 65126) || sn["Vertical Forms"](h) || sn["Yijing Hexagram Symbols"](h) || new RegExp("\\p{sc=Cans}", "u").test(String.fromCodePoint(h)) || new RegExp("\\p{sc=Hang}", "u").test(String.fromCodePoint(h)) || vp.test(String.fromCodePoint(h)))));
}
function _p(h) {
return !(Dc(h) || function(c) {
return !!(sn["Latin-1 Supplement"](c) && (c === 167 || c === 169 || c === 174 || c === 177 || c === 188 || c === 189 || c === 190 || c === 215 || c === 247) || sn["General Punctuation"](c) && (c === 8214 || c === 8224 || c === 8225 || c === 8240 || c === 8241 || c === 8251 || c === 8252 || c === 8258 || c === 8263 || c === 8264 || c === 8265 || c === 8273) || sn["Letterlike Symbols"](c) || sn["Number Forms"](c) || sn["Miscellaneous Technical"](c) && (c >= 8960 && c <= 8967 || c >= 8972 && c <= 8991 || c >= 8996 && c <= 9e3 || c === 9003 || c >= 9085 && c <= 9114 || c >= 9150 && c <= 9165 || c === 9167 || c >= 9169 && c <= 9179 || c >= 9186 && c <= 9215) || sn["Control Pictures"](c) && c !== 9251 || sn["Optical Character Recognition"](c) || sn["Enclosed Alphanumerics"](c) || sn["Geometric Shapes"](c) || sn["Miscellaneous Symbols"](c) && !(c >= 9754 && c <= 9759) || sn["Miscellaneous Symbols and Arrows"](c) && (c >= 11026 && c <= 11055 || c >= 11088 && c <= 11097 || c >= 11192 && c <= 11243) || sn["CJK Symbols and Punctuation"](c) || sn.Katakana(c) || sn["Private Use Area"](c) || sn["CJK Compatibility Forms"](c) || sn["Small Form Variants"](c) || sn["Halfwidth and Fullwidth Forms"](c) || c === 8734 || c === 8756 || c === 8757 || c >= 9984 && c <= 10087 || c >= 10102 && c <= 10131 || c === 65532 || c === 65533);
}(h));
}
const y_ = Nc(["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 Fc(h) {
return y_.test(String.fromCodePoint(h));
}
function v_(h, c) {
return !(!c && Fc(h) || h >= 2304 && h <= 3583 || h >= 3840 && h <= 4255 || sn.Khmer(h));
}
function __(h) {
for (const c of h)
if (Fc(c.charCodeAt(0)))
return !0;
return !1;
}
const Vo = new class {
constructor() {
this.applyArabicShaping = null, this.processBidirectionalText = null, this.processStyledBidirectionalText = null, this.pluginStatus = "unavailable", this.pluginURL = null;
}
setState(h) {
this.pluginStatus = h.pluginStatus, this.pluginURL = h.pluginURL;
}
getState() {
return { pluginStatus: this.pluginStatus, pluginURL: this.pluginURL };
}
setMethods(h) {
this.applyArabicShaping = h.applyArabicShaping, this.processBidirectionalText = h.processBidirectionalText, this.processStyledBidirectionalText = h.processStyledBidirectionalText;
}
isParsed() {
return this.applyArabicShaping != null && this.processBidirectionalText != null && this.processStyledBidirectionalText != null;
}
getPluginURL() {
return this.pluginURL;
}
getRTLTextPluginStatus() {
return this.pluginStatus;
}
}();
class ti {
constructor(c, p) {
this.zoom = c, p ? (this.now = p.now, this.fadeDuration = p.fadeDuration, this.zoomHistory = p.zoomHistory, this.transition = p.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Vc(), this.transition = {});
}
isSupportedScript(c) {
return function(p, g) {
for (const w of p)
if (!v_(w.charCodeAt(0), g))
return !1;
return !0;
}(c, Vo.getRTLTextPluginStatus() === "loaded");
}
crossFadingFactor() {
return this.fadeDuration === 0 ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1);
}
getCrossfadeParameters() {
const c = this.zoom, p = c - Math.floor(c), g = this.crossFadingFactor();
return c > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: p + (1 - p) * g } : { fromScale: 0.5, toScale: 1, t: 1 - (1 - g) * p };
}
}
class o6 {
constructor(c, p) {
this.property = c, this.value = p, this.expression = function(g, w) {
if (ne(g))
return new Io(g, w);
if (yi(g)) {
const H = ko(g, w);
if (H.result === "error")
throw new Error(H.value.map((A) => `${A.key}: ${A.message}`).join(", "));
return H.value;
}
{
let H = g;
return w.type === "color" && typeof g == "string" ? H = tn.parse(g) : w.type !== "padding" || typeof g != "number" && !Array.isArray(g) ? w.type === "variableAnchorOffsetCollection" && Array.isArray(g) && (H = _n.parse(g)) : H = Yn.parse(g), { kind: "constant", evaluate: () => H };
}
}(p === void 0 ? c.specification.default : p, c.specification);
}
isDataDriven() {
return this.expression.kind === "source" || this.expression.kind === "composite";
}
possiblyEvaluate(c, p, g) {
return this.property.possiblyEvaluate(this, c, p, g);
}
}
class Al {
constructor(c) {
this.property = c, this.value = new o6(c, void 0);
}
transitioned(c, p) {
return new bp(this.property, this.value, p, $({}, c.transition, this.transition), c.now);
}
untransitioned() {
return new bp(this.property, this.value, null, {}, 0);
}
}
class Ol {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitionablePropertyValues);
}
getValue(c) {
return rt(this._values[c].value.value);
}
setValue(c, p) {
Object.prototype.hasOwnProperty.call(this._values, c) || (this._values[c] = new Al(this._values[c].property)), this._values[c].value = new o6(this._values[c].property, p === null ? void 0 : rt(p));
}
getTransition(c) {
return rt(this._values[c].transition);
}
setTransition(c, p) {
Object.prototype.hasOwnProperty.call(this._values, c) || (this._values[c] = new Al(this._values[c].property)), this._values[c].transition = rt(p) || void 0;
}
serialize() {
const c = {};
for (const p of Object.keys(this._values)) {
const g = this.getValue(p);
g !== void 0 && (c[p] = g);
const w = this.getTransition(p);
w !== void 0 && (c[`${p}-transition`] = w);
}
return c;
}
transitioned(c, p) {
const g = new I0(this._properties);
for (const w of Object.keys(this._values))
g._values[w] = this._values[w].transitioned(c, p._values[w]);
return g;
}
untransitioned() {
const c = new I0(this._properties);
for (const p of Object.keys(this._values))
c._values[p] = this._values[p].untransitioned();
return c;
}
}
class bp {
constructor(c, p, g, w, H) {
this.property = c, this.value = p, this.begin = H + w.delay || 0, this.end = this.begin + w.duration || 0, c.specification.transition && (w.delay || w.duration) && (this.prior = g);
}
possiblyEvaluate(c, p, g) {
const w = c.now || 0, H = this.value.possiblyEvaluate(c, p, g), A = this.prior;
if (A) {
if (w > this.end)
return this.prior = null, H;
if (this.value.isDataDriven())
return this.prior = null, H;
if (w < this.begin)
return A.possiblyEvaluate(c, p, g);
{
const C = (w - this.begin) / (this.end - this.begin);
return this.property.interpolate(A.possiblyEvaluate(c, p, g), H, function(N) {
if (N <= 0)
return 0;
if (N >= 1)
return 1;
const z = N * N, W = z * N;
return 4 * (N < 0.5 ? W : 3 * (N - z) + W - 0.75);
}(C));
}
}
return H;
}
}
class I0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultTransitioningPropertyValues);
}
possiblyEvaluate(c, p, g) {
const w = new V0(this._properties);
for (const H of Object.keys(this._values))
w._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return w;
}
hasTransition() {
for (const c of Object.keys(this._values))
if (this._values[c].prior)
return !0;
return !1;
}
}
class P0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultPropertyValues);
}
hasValue(c) {
return this._values[c].value !== void 0;
}
getValue(c) {
return rt(this._values[c].value);
}
setValue(c, p) {
this._values[c] = new o6(this._values[c].property, p === null ? void 0 : rt(p));
}
serialize() {
const c = {};
for (const p of Object.keys(this._values)) {
const g = this.getValue(p);
g !== void 0 && (c[p] = g);
}
return c;
}
possiblyEvaluate(c, p, g) {
const w = new V0(this._properties);
for (const H of Object.keys(this._values))
w._values[H] = this._values[H].possiblyEvaluate(c, p, g);
return w;
}
}
class Qs {
constructor(c, p, g) {
this.property = c, this.value = p, this.parameters = g;
}
isConstant() {
return this.value.kind === "constant";
}
constantOr(c) {
return this.value.kind === "constant" ? this.value.value : c;
}
evaluate(c, p, g, w) {
return this.property.evaluate(this.value, this.parameters, c, p, g, w);
}
}
class V0 {
constructor(c) {
this._properties = c, this._values = Object.create(c.defaultPossiblyEvaluatedValues);
}
get(c) {
return this._values[c];
}
}
class cr {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p) {
if (c.isDataDriven())
throw new Error("Value should not be data driven");
return c.expression.evaluate(p);
}
interpolate(c, p, g) {
const w = xr[this.specification.type];
return w ? w(c, p, g) : c;
}
}
class Mr {
constructor(c, p) {
this.specification = c, this.overrides = p;
}
possiblyEvaluate(c, p, g, w) {
return new Qs(this, c.expression.kind === "constant" || c.expression.kind === "camera" ? { kind: "constant", value: c.expression.evaluate(p, null, {}, g, w) } : c.expression, p);
}
interpolate(c, p, g) {
if (c.value.kind !== "constant" || p.value.kind !== "constant")
return c;
if (c.value.value === void 0 || p.value.value === void 0)
return new Qs(this, { kind: "constant", value: void 0 }, c.parameters);
const w = xr[this.specification.type];
if (w) {
const H = w(c.value.value, p.value.value, g);
return new Qs(this, { kind: "constant", value: H }, c.parameters);
}
return c;
}
evaluate(c, p, g, w, H, A) {
return c.kind === "constant" ? c.value : c.evaluate(p, g, w, H, A);
}
}
class Cl extends Mr {
possiblyEvaluate(c, p, g, w) {
if (c.value === void 0)
return new Qs(this, { kind: "constant", value: void 0 }, p);
if (c.expression.kind === "constant") {
const H = c.expression.evaluate(p, null, {}, g, w), A = c.property.specification.type === "resolvedImage" && typeof H != "string" ? H.name : H, C = this._calculate(A, A, A, p);
return new Qs(this, { kind: "constant", value: C }, p);
}
if (c.expression.kind === "camera") {
const H = this._calculate(c.expression.evaluate({ zoom: p.zoom - 1 }), c.expression.evaluate({ zoom: p.zoom }), c.expression.evaluate({ zoom: p.zoom + 1 }), p);
return new Qs(this, { kind: "constant", value: H }, p);
}
return new Qs(this, c.expression, p);
}
evaluate(c, p, g, w, H, A) {
if (c.kind === "source") {
const C = c.evaluate(p, g, w, H, A);
return this._calculate(C, C, C, p);
}
return c.kind === "composite" ? this._calculate(c.evaluate({ zoom: Math.floor(p.zoom) - 1 }, g, w), c.evaluate({ zoom: Math.floor(p.zoom) }, g, w), c.evaluate({ zoom: Math.floor(p.zoom) + 1 }, g, w), p) : c.value;
}
_calculate(c, p, g, w) {
return w.zoom > w.zoomHistory.lastIntegerZoom ? { from: c, to: p } : { from: g, to: p };
}
interpolate(c) {
return c;
}
}
class kl {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, w) {
if (c.value !== void 0) {
if (c.expression.kind === "constant") {
const H = c.expression.evaluate(p, null, {}, g, w);
return this._calculate(H, H, H, p);
}
return this._calculate(c.expression.evaluate(new ti(Math.floor(p.zoom - 1), p)), c.expression.evaluate(new ti(Math.floor(p.zoom), p)), c.expression.evaluate(new ti(Math.floor(p.zoom + 1), p)), p);
}
}
_calculate(c, p, g, w) {
return w.zoom > w.zoomHistory.lastIntegerZoom ? { from: c, to: p } : { from: g, to: p };
}
interpolate(c) {
return c;
}
}
class Bc {
constructor(c) {
this.specification = c;
}
possiblyEvaluate(c, p, g, w) {
return !!c.expression.evaluate(p, null, {}, g, w);
}
interpolate() {
return !1;
}
}
class S {
constructor(c) {
this.properties = c, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [];
for (const p in c) {
const g = c[p];
g.specification.overridable && this.overridableProperties.push(p);
const w = this.defaultPropertyValues[p] = new o6(g, void 0), H = this.defaultTransitionablePropertyValues[p] = new Al(g);
this.defaultTransitioningPropertyValues[p] = H.untransitioned(), this.defaultPossiblyEvaluatedValues[p] = w.possiblyEvaluate({});
}
}
}
nr("DataDrivenProperty", Mr), nr("DataConstantProperty", cr), nr("CrossFadedDataDrivenProperty", Cl), nr("CrossFadedProperty", kl), nr("ColorRampProperty", Bc);
const l = "-transition";
class m extends ar {
constructor(c, p) {
if (super(), this.id = c.id, this.type = c.type, this._featureFilter = { filter: () => !0, needGeometry: !1 }, c.type !== "custom" && (this.metadata = c.metadata, this.minzoom = c.minzoom, this.maxzoom = c.maxzoom, c.type !== "background" && (this.source = c.source, this.sourceLayer = c["source-layer"], this.filter = c.filter), p.layout && (this._unevaluatedLayout = new P0(p.layout)), p.paint)) {
this._transitionablePaint = new Ol(p.paint);
for (const g in c.paint)
this.setPaintProperty(g, c.paint[g], { validate: !1 });
for (const g in c.layout)
this.setLayoutProperty(g, c.layout[g], { validate: !1 });
this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new V0(p.paint);
}
}
getCrossfadeParameters() {
return this._crossfadeParameters;
}
getLayoutProperty(c) {
return c === "visibility" ? this.visibility : this._unevaluatedLayout.getValue(c);
}
setLayoutProperty(c, p, g = {}) {
p != null && this._validate(gp, `layers.${this.id}.layout.${c}`, c, p, g) || (c !== "visibility" ? this._unevaluatedLayout.setValue(c, p) : this.visibility = p);
}
getPaintProperty(c) {
return c.endsWith(l) ? this._transitionablePaint.getTransition(c.slice(0, -11)) : this._transitionablePaint.getValue(c);
}
setPaintProperty(c, p, g = {}) {
if (p != null && this._validate(mp, `layers.${this.id}.paint.${c}`, c, p, g))
return !1;
if (c.endsWith(l))
return this._transitionablePaint.setTransition(c.slice(0, -11), p || void 0), !1;
{
const w = this._transitionablePaint._values[c], H = w.property.specification["property-type"] === "cross-faded-data-driven", A = w.value.isDataDriven(), C = w.value;
this._transitionablePaint.setValue(c, p), this._handleSpecialPaintPropertyUpdate(c);
const N = this._transitionablePaint._values[c].value;
return N.isDataDriven() || A || H || this._handleOverridablePaintPropertyUpdate(c, C, N);
}
}
_handleSpecialPaintPropertyUpdate(c) {
}
_handleOverridablePaintPropertyUpdate(c, p, g) {
return !1;
}
isHidden(c) {
return !!(this.minzoom && c < this.minzoom) || !!(this.maxzoom && c >= this.maxzoom) || this.visibility === "none";
}
updateTransitions(c) {
this._transitioningPaint = this._transitionablePaint.transitioned(c, this._transitioningPaint);
}
hasTransition() {
return this._transitioningPaint.hasTransition();
}
recalculate(c, p) {
c.getCrossfadeParameters && (this._crossfadeParameters = c.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(c, void 0, p)), this.paint = this._transitioningPaint.possiblyEvaluate(c, void 0, p);
}
serialize() {
const c = { id: this.id, type: this.type, source: this.source, "source-layer": this.sourceLayer, metadata: this.metadata, minzoom: this.minzoom, maxzoom: this.maxzoom, filter: this.filter, layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), paint: this._transitionablePaint && this._transitionablePaint.serialize() };
return this.visibility && (c.layout = c.layout || {}, c.layout.visibility = this.visibility), ct(c, (p, g) => !(p === void 0 || g === "layout" && !Object.keys(p).length || g === "paint" && !Object.keys(p).length));
}
_validate(c, p, g, w, H = {}) {
return (!H || H.validate !== !1) && Ic(this, c.call(F3, { key: p, layerType: this.type, objectKey: g, value: w, styleSpec: Ct, style: { glyphs: !0, sprite: !0 } }));
}
is3D() {
return !1;
}
isTileClipped() {
return !1;
}
hasOffscreenPass() {
return !1;
}
resize() {
}
isStateDependent() {
for (const c in this.paint._values) {
const p = this.paint.get(c);
if (p instanceof Qs && t2(p.property.specification) && (p.value.kind === "source" || p.value.kind === "composite") && p.value.isStateDependent)
return !0;
}
return !1;
}
}
const v = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array };
class b {
constructor(c, p) {
this._structArray = c, this._pos1 = p * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8;
}
}
class M {
constructor() {
this.isTransferred = !1, this.capacity = -1, this.resize(0);
}
static serialize(c, p) {
return c._trim(), p && (c.isTransferred = !0, p.push(c.arrayBuffer)), { length: c.length, arrayBuffer: c.arrayBuffer };
}
static deserialize(c) {
const p = Object.create(this.prototype);
return p.arrayBuffer = c.arrayBuffer, p.length = c.length, p.capacity = c.arrayBuffer.byteLength / p.bytesPerElement, p._refreshViews(), p;
}
_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(c) {
this.reserve(c), this.length = c;
}
reserve(c) {
if (c > this.capacity) {
this.capacity = Math.max(c, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
const p = this.uint8;
this._refreshViews(), p && this.uint8.set(p);
}
}
_refreshViews() {
throw new Error("_refreshViews() must be implemented by each concrete StructArray layout");
}
}
function V(h, c = 1) {
let p = 0, g = 0;
return { members: h.map((w) => {
const H = v[w.type].BYTES_PER_ELEMENT, A = p = D(p, Math.max(c, H)), C = w.components || 1;
return g = Math.max(g, H), p += H * C, { name: w.name, type: w.type, components: C, offset: A };
}), size: D(p, Math.max(g, c)), alignment: c };
}
function D(h, c) {
return Math.ceil(h / c) * c;
}
class j extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.int16[w + 0] = p, this.int16[w + 1] = g, c;
}
}
j.prototype.bytesPerElement = 4, nr("StructArrayLayout2i4", j);
class Z extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.int16[H + 0] = p, this.int16[H + 1] = g, this.int16[H + 2] = w, c;
}
}
Z.prototype.bytesPerElement = 6, nr("StructArrayLayout3i6", Z);
class Y extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, w);
}
emplace(c, p, g, w, H) {
const A = 4 * c;
return this.int16[A + 0] = p, this.int16[A + 1] = g, this.int16[A + 2] = w, this.int16[A + 3] = H, c;
}
}
Y.prototype.bytesPerElement = 8, nr("StructArrayLayout4i8", Y);
class J extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = w, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = C, c;
}
}
J.prototype.bytesPerElement = 12, nr("StructArrayLayout2i4i12", J);
class lt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 4 * c, z = 8 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.uint8[z + 4] = w, this.uint8[z + 5] = H, this.uint8[z + 6] = A, this.uint8[z + 7] = C, c;
}
}
lt.prototype.bytesPerElement = 8, nr("StructArrayLayout2i4ub8", lt);
class ft extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.float32[w + 0] = p, this.float32[w + 1] = g, c;
}
}
ft.prototype.bytesPerElement = 8, nr("StructArrayLayout2f8", ft);
class Qt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A, C, N, z, W) {
const X = this.length;
return this.resize(X + 1), this.emplace(X, c, p, g, w, H, A, C, N, z, W);
}
emplace(c, p, g, w, H, A, C, N, z, W, X) {
const tt = 10 * c;
return this.uint16[tt + 0] = p, this.uint16[tt + 1] = g, this.uint16[tt + 2] = w, this.uint16[tt + 3] = H, this.uint16[tt + 4] = A, this.uint16[tt + 5] = C, this.uint16[tt + 6] = N, this.uint16[tt + 7] = z, this.uint16[tt + 8] = W, this.uint16[tt + 9] = X, c;
}
}
Qt.prototype.bytesPerElement = 20, nr("StructArrayLayout10ui20", Qt);
class wt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = this.length;
return this.resize(at + 1), this.emplace(at, c, p, g, w, H, A, C, N, z, W, X, tt);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at) {
const ut = 12 * c;
return this.int16[ut + 0] = p, this.int16[ut + 1] = g, this.int16[ut + 2] = w, this.int16[ut + 3] = H, this.uint16[ut + 4] = A, this.uint16[ut + 5] = C, this.uint16[ut + 6] = N, this.uint16[ut + 7] = z, this.int16[ut + 8] = W, this.int16[ut + 9] = X, this.int16[ut + 10] = tt, this.int16[ut + 11] = at, c;
}
}
wt.prototype.bytesPerElement = 24, nr("StructArrayLayout4i4ui4i24", wt);
class Mt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.float32[H + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = w, c;
}
}
Mt.prototype.bytesPerElement = 12, nr("StructArrayLayout3f12", Mt);
class Ht extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.uint32[1 * c + 0] = p, c;
}
}
Ht.prototype.bytesPerElement = 4, nr("StructArrayLayout1ul4", Ht);
class Ot extends M {
_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(c, p, g, w, H, A, C, N, z) {
const W = this.length;
return this.resize(W + 1), this.emplace(W, c, p, g, w, H, A, C, N, z);
}
emplace(c, p, g, w, H, A, C, N, z, W) {
const X = 10 * c, tt = 5 * c;
return this.int16[X + 0] = p, this.int16[X + 1] = g, this.int16[X + 2] = w, this.int16[X + 3] = H, this.int16[X + 4] = A, this.int16[X + 5] = C, this.uint32[tt + 3] = N, this.uint16[X + 8] = z, this.uint16[X + 9] = W, c;
}
}
Ot.prototype.bytesPerElement = 20, nr("StructArrayLayout6i1ul2ui20", Ot);
class bt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 6 * c;
return this.int16[N + 0] = p, this.int16[N + 1] = g, this.int16[N + 2] = w, this.int16[N + 3] = H, this.int16[N + 4] = A, this.int16[N + 5] = C, c;
}
}
bt.prototype.bytesPerElement = 12, nr("StructArrayLayout2i2i2i12", bt);
class Nt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H) {
const A = this.length;
return this.resize(A + 1), this.emplace(A, c, p, g, w, H);
}
emplace(c, p, g, w, H, A) {
const C = 4 * c, N = 8 * c;
return this.float32[C + 0] = p, this.float32[C + 1] = g, this.float32[C + 2] = w, this.int16[N + 6] = H, this.int16[N + 7] = A, c;
}
}
Nt.prototype.bytesPerElement = 16, nr("StructArrayLayout2f1f2i16", Nt);
class Dt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w, H, A) {
const C = this.length;
return this.resize(C + 1), this.emplace(C, c, p, g, w, H, A);
}
emplace(c, p, g, w, H, A, C) {
const N = 16 * c, z = 4 * c, W = 8 * c;
return this.uint8[N + 0] = p, this.uint8[N + 1] = g, this.float32[z + 1] = w, this.float32[z + 2] = H, this.int16[W + 6] = A, this.int16[W + 7] = C, c;
}
}
Dt.prototype.bytesPerElement = 16, nr("StructArrayLayout2ub2f2i16", Dt);
class Wt extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.uint16[H + 0] = p, this.uint16[H + 1] = g, this.uint16[H + 2] = w, c;
}
}
Wt.prototype.bytesPerElement = 6, nr("StructArrayLayout3ui6", Wt);
class he extends M {
_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(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et) {
const $t = this.length;
return this.resize($t + 1), this.emplace($t, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t) {
const Pt = 24 * c, Bt = 12 * c, ee = 48 * c;
return this.int16[Pt + 0] = p, this.int16[Pt + 1] = g, this.uint16[Pt + 2] = w, this.uint16[Pt + 3] = H, this.uint32[Bt + 2] = A, this.uint32[Bt + 3] = C, this.uint32[Bt + 4] = N, this.uint16[Pt + 10] = z, this.uint16[Pt + 11] = W, this.uint16[Pt + 12] = X, this.float32[Bt + 7] = tt, this.float32[Bt + 8] = at, this.uint8[ee + 36] = ut, this.uint8[ee + 37] = Tt, this.uint8[ee + 38] = Lt, this.uint32[Bt + 10] = Et, this.int16[Pt + 22] = $t, c;
}
}
he.prototype.bytesPerElement = 48, nr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", he);
class we extends M {
_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(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr) {
const rr = this.length;
return this.resize(rr + 1), this.emplace(rr, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr);
}
emplace(c, p, g, w, H, A, C, N, z, W, X, tt, at, ut, Tt, Lt, Et, $t, Pt, Bt, ee, _e, Xe, Er, ze, Re, Qr, sr, rr) {
const ue = 32 * c, gr = 16 * c;
return this.int16[ue + 0] = p, this.int16[ue + 1] = g, this.int16[ue + 2] = w, this.int16[ue + 3] = H, this.int16[ue + 4] = A, this.int16[ue + 5] = C, this.int16[ue + 6] = N, this.int16[ue + 7] = z, this.uint16[ue + 8] = W, this.uint16[ue + 9] = X, this.uint16[ue + 10] = tt, this.uint16[ue + 11] = at, this.uint16[ue + 12] = ut, this.uint16[ue + 13] = Tt, this.uint16[ue + 14] = Lt, this.uint16[ue + 15] = Et, this.uint16[ue + 16] = $t, this.uint16[ue + 17] = Pt, this.uint16[ue + 18] = Bt, this.uint16[ue + 19] = ee, this.uint16[ue + 20] = _e, this.uint16[ue + 21] = Xe, this.uint16[ue + 22] = Er, this.uint32[gr + 12] = ze, this.float32[gr + 13] = Re, this.float32[gr + 14] = Qr, this.uint16[ue + 30] = sr, this.uint16[ue + 31] = rr, c;
}
}
we.prototype.bytesPerElement = 64, nr("StructArrayLayout8i15ui1ul2f2ui64", we);
class De extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.float32[1 * c + 0] = p, c;
}
}
De.prototype.bytesPerElement = 4, nr("StructArrayLayout1f4", De);
class tr extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 3 * c;
return this.uint16[6 * c + 0] = p, this.float32[H + 1] = g, this.float32[H + 2] = w, c;
}
}
tr.prototype.bytesPerElement = 12, nr("StructArrayLayout1ui2f12", tr);
class Oe extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p, g) {
const w = this.length;
return this.resize(w + 1), this.emplace(w, c, p, g);
}
emplace(c, p, g, w) {
const H = 4 * c;
return this.uint32[2 * c + 0] = p, this.uint16[H + 2] = g, this.uint16[H + 3] = w, c;
}
}
Oe.prototype.bytesPerElement = 8, nr("StructArrayLayout1ul2ui8", Oe);
class Ae extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c, p) {
const g = this.length;
return this.resize(g + 1), this.emplace(g, c, p);
}
emplace(c, p, g) {
const w = 2 * c;
return this.uint16[w + 0] = p, this.uint16[w + 1] = g, c;
}
}
Ae.prototype.bytesPerElement = 4, nr("StructArrayLayout2ui4", Ae);
class ur extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer);
}
emplaceBack(c) {
const p = this.length;
return this.resize(p + 1), this.emplace(p, c);
}
emplace(c, p) {
return this.uint16[1 * c + 0] = p, c;
}
}
ur.prototype.bytesPerElement = 2, nr("StructArrayLayout1ui2", ur);
class Nr extends M {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer);
}
emplaceBack(c, p, g, w) {
const H = this.length;
return this.resize(H + 1), this.emplace(H, c, p, g, w);
}
emplace(c, p, g, w, H) {
const A = 4 * c;
return this.float32[A + 0] = p, this.float32[A + 1] = g, this.float32[A + 2] = w, this.float32[A + 3] = H, c;
}
}
Nr.prototype.bytesPerElement = 16, nr("StructArrayLayout4f16", Nr);
class Pe extends b {
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 f(this.anchorPointX, this.anchorPointY);
}
}
Pe.prototype.size = 20;
class We extends Ot {
get(c) {
return new Pe(this, c);
}
}
nr("CollisionBoxArray", We);
class kr extends b {
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(c) {
this._structArray.uint8[this._pos1 + 37] = c;
}
get hidden() {
return this._structArray.uint8[this._pos1 + 38];
}
set hidden(c) {
this._structArray.uint8[this._pos1 + 38] = c;
}
get crossTileID() {
return this._structArray.uint32[this._pos4 + 10];
}
set crossTileID(c) {
this._structArray.uint32[this._pos4 + 10] = c;
}
get associatedIconIndex() {
return this._structArray.int16[this._pos2 + 22];
}
}
kr.prototype.size = 48;
class ei extends he {
get(c) {
return new kr(this, c);
}
}
nr("PlacedSymbolArray", ei);
class Wr extends b {
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(c) {
this._structArray.uint32[this._pos4 + 12] = c;
}
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];
}
}
Wr.prototype.size = 64;
class nn extends we {
get(c) {
return new Wr(this, c);
}
}
nr("SymbolInstanceArray", nn);
class ri extends De {
getoffsetX(c) {
return this.float32[1 * c + 0];
}
}
nr("GlyphOffsetArray", ri);
class C1 extends Z {
getx(c) {
return this.int16[3 * c + 0];
}
gety(c) {
return this.int16[3 * c + 1];
}
gettileUnitDistanceFromAnchor(c) {
return this.int16[3 * c + 2];
}
}
nr("SymbolLineVertexArray", C1);
class O2 extends b {
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];
}
}
O2.prototype.size = 12;
class ni extends tr {
get(c) {
return new O2(this, c);
}
}
nr("TextAnchorOffsetArray", ni);
class mo extends b {
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];
}
}
mo.prototype.size = 8;
class q1 extends Oe {
get(c) {
return new mo(this, c);
}
}
nr("FeatureIndexArray", q1);
class k1 extends j {
}
class X1 extends j {
}
class ms extends j {
}
class s6 extends J {
}
class Il extends lt {
}
class a6 extends ft {
}
class i2 extends Qt {
}
class Pl extends wt {
}
class jc extends Mt {
}
class o2 extends Ht {
}
class s2 extends bt {
}
class Ea extends Dt {
}
class C2 extends Wt {
}
class b1 extends Ae {
}
const I1 = V([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: Ro } = I1;
class an {
constructor(c = []) {
this.segments = c;
}
prepareSegment(c, p, g, w) {
let H = this.segments[this.segments.length - 1];
return c > an.MAX_VERTEX_ARRAY_LENGTH && It(`Max vertices per segment is ${an.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`), (!H || H.vertexLength + c > an.MAX_VERTEX_ARRAY_LENGTH || H.sortKey !== w) && (H = { vertexOffset: p.length, primitiveOffset: g.length, vertexLength: 0, primitiveLength: 0 }, w !== void 0 && (H.sortKey = w), this.segments.push(H)), H;
}
get() {
return this.segments;
}
destroy() {
for (const c of this.segments)
for (const p in c.vaos)
c.vaos[p].destroy();
}
static simpleSegment(c, p, g, w) {
return new an([{ vertexOffset: c, primitiveOffset: p, vertexLength: g, primitiveLength: w, vaos: {}, sortKey: 0 }]);
}
}
function B3(h, c) {
return 256 * (h = F(Math.floor(h), 0, 255)) + F(Math.floor(c), 0, 255);
}
an.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, nr("SegmentVector", an);
const l6 = V([{ name: "a_pattern_from", components: 4, type: "Uint16" }, { name: "a_pattern_to", components: 4, type: "Uint16" }, { name: "a_pixel_ratio_from", components: 1, type: "Uint16" }, { name: "a_pixel_ratio_to", components: 1, type: "Uint16" }]);
var c6 = { exports: {} }, Lp = { exports: {} };
Lp.exports = function(h, c) {
var p, g, w, H, A, C, N, z;
for (g = h.length - (p = 3 & h.length), w = c, A = 3432918353, C = 461845907, z = 0; z < g; )
N = 255 & h.charCodeAt(z) | (255 & h.charCodeAt(++z)) << 8 | (255 & h.charCodeAt(++z)) << 16 | (255 & h.charCodeAt(++z)) << 24, ++z, w = 27492 + (65535 & (H = 5 * (65535 & (w = (w ^= N = (65535 & (N = (N = (65535 & N) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * C + (((N >>> 16) * C & 65535) << 16) & 4294967295) << 13 | w >>> 19)) + ((5 * (w >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (H >>> 16) & 65535) << 16);
switch (N = 0, p) {
case 3:
N ^= (255 & h.charCodeAt(z + 2)) << 16;
case 2:
N ^= (255 & h.charCodeAt(z + 1)) << 8;
case 1:
w ^= N = (65535 & (N = (N = (65535 & (N ^= 255 & h.charCodeAt(z))) * A + (((N >>> 16) * A & 65535) << 16) & 4294967295) << 15 | N >>> 17)) * C + (((N >>> 16) * C & 65535) << 16) & 4294967295;
}
return w ^= h.length, w = 2246822507 * (65535 & (w ^= w >>> 16)) + ((2246822507 * (w >>> 16) & 65535) << 16) & 4294967295, w = 3266489909 * (65535 & (w ^= w >>> 13)) + ((3266489909 * (w >>> 16) & 65535) << 16) & 4294967295, (w ^= w >>> 16) >>> 0;
};
var b_ = Lp.exports, wp = { exports: {} };
wp.exports = function(h, c) {
for (var p, g = h.length, w = c ^ g, H = 0; g >= 4; )
p = 1540483477 * (65535 & (p = 255 & h.charCodeAt(H) | (255 & h.charCodeAt(++H)) << 8 | (255 & h.charCodeAt(++H)) << 16 | (255 & h.charCodeAt(++H)) << 24)) + ((1540483477 * (p >>> 16) & 65535) << 16), w = 1540483477 * (65535 & w) + ((1540483477 * (w >>> 16) & 65535) << 16) ^ (p = 1540483477 * (65535 & (p ^= p >>> 24)) + ((1540483477 * (p >>> 16) & 65535) << 16)), g -= 4, ++H;
switch (g) {
case 3:
w ^= (255 & h.charCodeAt(H + 2)) << 16;
case 2:
w ^= (255 & h.charCodeAt(H + 1)) << 8;
case 1:
w = 1540483477 * (65535 & (w ^= 255 & h.charCodeAt(H))) + ((1540483477 * (w >>> 16) & 65535) << 16);
}
return w = 1540483477 * (65535 & (w ^= w >>> 13)) + ((1540483477 * (w >>> 16) & 65535) << 16), (w ^= w >>> 15) >>> 0;
};
var Ma = b_, xp = wp.exports;
c6.exports = Ma, c6.exports.murmur3 = Ma, c6.exports.murmur2 = xp;
var Vl = u(c6.exports);
class R0 {
constructor() {
this.ids = [], this.positions = [], this.indexed = !1;
}
add(c, p, g, w) {
this.ids.push(Rl(c)), this.positions.push(p, g, w);
}
getPositions(c) {
if (!this.indexed)
throw new Error("Trying to get index, but feature positions are not indexed");
const p = Rl(c);
let g = 0, w = this.ids.length - 1;
for (; g < w; ) {
const A = g + w >> 1;
this.ids[A] >= p ? w = A : g = A + 1;
}
const H = [];
for (; this.ids[g] === p; )
H.push({ index: this.positions[3 * g], start: this.positions[3 * g + 1], end: this.positions[3 * g + 2] }), g++;
return H;
}
static serialize(c, p) {
const g = new Float64Array(c.ids), w = new Uint32Array(c.positions);
return Nl(g, w, 0, g.length - 1), p && p.push(g.buffer, w.buffer), { ids: g, positions: w };
}
static deserialize(c) {
const p = new R0();
return p.ids = c.ids, p.positions = c.positions, p.indexed = !0, p;
}
}
function Rl(h) {
const c = +h;
return !isNaN(c) && c <= Number.MAX_SAFE_INTEGER ? c : Vl(String(h));
}
function Nl(h, c, p, g) {
for (; p < g; ) {
const w = h[p + g >> 1];
let H = p - 1, A = g + 1;
for (; ; ) {
do
H++;
while (h[H] < w);
do
A--;
while (h[A] > w);
if (H >= A)
break;
u6(h, H, A), u6(c, 3 * H, 3 * A), u6(c, 3 * H + 1, 3 * A + 1), u6(c, 3 * H + 2, 3 * A + 2);
}
A - p < g - A ? (Nl(h, c, p, A), p = A + 1) : (Nl(h, c, A + 1, g), g = A);
}
}
function u6(h, c, p) {
const g = h[c];
h[c] = h[p], h[p] = g;
}
nr("FeaturePositionMap", R0);
class N0 {
constructor(c, p) {
this.gl = c.gl, this.location = p;
}
}
class Ep extends N0 {
constructor(c, p) {
super(c, p), this.current = 0;
}
set(c) {
this.current !== c && (this.current = c, this.gl.uniform1f(this.location, c));
}
}
class MO extends N0 {
constructor(c, p) {
super(c, p), this.current = [0, 0, 0, 0];
}
set(c) {
c[0] === this.current[0] && c[1] === this.current[1] && c[2] === this.current[2] && c[3] === this.current[3] || (this.current = c, this.gl.uniform4f(this.location, c[0], c[1], c[2], c[3]));
}
}
class SO extends N0 {
constructor(c, p) {
super(c, p), this.current = tn.transparent;
}
set(c) {
c.r === this.current.r && c.g === this.current.g && c.b === this.current.b && c.a === this.current.a || (this.current = c, this.gl.uniform4f(this.location, c.r, c.g, c.b, c.a));
}
}
const yJ = new Float32Array(16);
function L_(h) {
return [B3(255 * h.r, 255 * h.g), B3(255 * h.b, 255 * h.a)];
}
class zc {
constructor(c, p, g) {
this.value = c, this.uniformNames = p.map((w) => `u_${w}`), this.type = g;
}
setUniform(c, p, g) {
c.set(g.constantOr(this.value));
}
getBinding(c, p, g) {
return this.type === "color" ? new SO(c, p) : new Ep(c, p);
}
}
class Dl {
constructor(c, p) {
this.uniformNames = p.map((g) => `u_${g}`), this.patternFrom = null, this.patternTo = null, this.pixelRatioFrom = 1, this.pixelRatioTo = 1;
}
setConstantPatternPositions(c, p) {
this.pixelRatioFrom = p.pixelRatio, this.pixelRatioTo = c.pixelRatio, this.patternFrom = p.tlbr, this.patternTo = c.tlbr;
}
setUniform(c, p, g, w) {
const H = w === "u_pattern_to" ? this.patternTo : w === "u_pattern_from" ? this.patternFrom : w === "u_pixel_ratio_to" ? this.pixelRatioTo : w === "u_pixel_ratio_from" ? this.pixelRatioFrom : null;
H && c.set(H);
}
getBinding(c, p, g) {
return g.substr(0, 9) === "u_pattern" ? new MO(c, p) : new Ep(c, p);
}
}
class j3 {
constructor(c, p, g, w) {
this.expression = c, this.type = g, this.maxValue = 0, this.paintVertexAttributes = p.map((H) => ({ name: `a_${H}`, type: "Float32", components: g === "color" ? 2 : 1, offset: 0 })), this.paintVertexArray = new w();
}
populatePaintArray(c, p, g, w, H) {
const A = this.paintVertexArray.length, C = this.expression.evaluate(new ti(0), p, {}, w, [], H);
this.paintVertexArray.resize(c), this._setPaintValue(A, c, C);
}
updatePaintArray(c, p, g, w) {
const H = this.expression.evaluate({ zoom: 0 }, g, w);
this._setPaintValue(c, p, H);
}
_setPaintValue(c, p, g) {
if (this.type === "color") {
const w = L_(g);
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, w[0], w[1]);
} else {
for (let w = c; w < p; w++)
this.paintVertexArray.emplace(w, g);
this.maxValue = Math.max(this.maxValue, Math.abs(g));
}
}
upload(c) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = c.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
}
}
class Ws {
constructor(c, p, g, w, H, A) {
this.expression = c, this.uniformNames = p.map((C) => `u_${C}_t`), this.type = g, this.useIntegerZoom = w, this.zoom = H, this.maxValue = 0, this.paintVertexAttributes = p.map((C) => ({ name: `a_${C}`, type: "Float32", components: g === "color" ? 4 : 2, offset: 0 })), this.paintVertexArray = new A();
}
populatePaintArray(c, p, g, w, H) {
const A = this.expression.evaluate(new ti(this.zoom), p, {}, w, [], H), C = this.expression.evaluate(new ti(this.zoom + 1), p, {}, w, [], H), N = this.paintVertexArray.length;
this.paintVertexArray.resize(c), this._setPaintValue(N, c, A, C);
}
updatePaintArray(c, p, g, w) {
const H = this.expression.evaluate({ zoom: this.zoom }, g, w), A = this.expression.evaluate({ zoom: this.zoom + 1 }, g, w);
this._setPaintValue(c, p, H, A);
}
_setPaintValue(c, p, g, w) {
if (this.type === "color") {
const H = L_(g), A = L_(w);
for (let C = c; C < p; C++)
this.paintVertexArray.emplace(C, H[0], H[1], A[0], A[1]);
} else {
for (let H = c; H < p; H++)
this.paintVertexArray.emplace(H, g, w);
this.maxValue = Math.max(this.maxValue, Math.abs(g), Math.abs(w));
}
}
upload(c) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = c.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent));
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy();
}
setUniform(c, p) {
const g = this.useIntegerZoom ? Math.floor(p.zoom) : p.zoom, w = F(this.expression.interpolationFactor(g, this.zoom, this.zoom + 1), 0, 1);
c.set(w);
}
getBinding(c, p, g) {
return new Ep(c, p);
}
}
class h6 {
constructor(c, p, g, w, H, A) {
this.expression = c, this.type = p, this.useIntegerZoom = g, this.zoom = w, this.layerId = A, this.zoomInPaintVertexArray = new H(), this.zoomOutPaintVertexArray = new H();
}
populatePaintArray(c, p, g) {
const w = this.zoomInPaintVertexArray.length;
this.zoomInPaintVertexArray.resize(c), this.zoomOutPaintVertexArray.resize(c), this._setPaintValues(w, c, p.patterns && p.patterns[this.layerId], g);
}
updatePaintArray(c, p, g, w, H) {
this._setPaintValues(c, p, g.patterns && g.patterns[this.layerId], H);
}
_setPaintValues(c, p, g, w) {
if (!w || !g)
return;
const { min: H, mid: A, max: C } = g, N = w[H], z = w[A], W = w[C];
if (N && z && W)
for (let X = c; X < p; X++)
this.zoomInPaintVertexArray.emplace(X, z.tl[0], z.tl[1], z.br[0], z.br[1], N.tl[0], N.tl[1], N.br[0], N.br[1], z.pixelRatio, N.pixelRatio), this.zoomOutPaintVertexArray.emplace(X, z.tl[0], z.tl[1], z.br[0], z.br[1], W.tl[0], W.tl[1], W.br[0], W.br[1], z.pixelRatio, W.pixelRatio);
}
upload(c) {
this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = c.createVertexBuffer(this.zoomInPaintVertexArray, l6.members, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = c.createVertexBuffer(this.zoomOutPaintVertexArray, l6.members, this.expression.isStateDependent));
}
destroy() {
this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy();
}
}
class HO {
constructor(c, p, g) {
this.binders = {}, this._buffers = [];
const w = [];
for (const H in c.paint._values) {
if (!g(H))
continue;
const A = c.paint.get(H);
if (!(A instanceof Qs && t2(A.property.specification)))
continue;
const C = vJ(H, c.type), N = A.value, z = A.property.specification.type, W = A.property.useIntegerZoom, X = A.property.specification["property-type"], tt = X === "cross-faded" || X === "cross-faded-data-driven";
if (N.kind === "constant")
this.binders[H] = tt ? new Dl(N.value, C) : new zc(N.value, C, z), w.push(`/u_${H}`);
else if (N.kind === "source" || tt) {
const at = AO(H, z, "source");
this.binders[H] = tt ? new h6(N, z, W, p, at, c.id) : new j3(N, C, z, at), w.push(`/a_${H}`);
} else {
const at = AO(H, z, "composite");
this.binders[H] = new Ws(N, C, z, W, p, at), w.push(`/z_${H}`);
}
}
this.cacheKey = w.sort().join("");
}
getMaxValue(c) {
const p = this.binders[c];
return p instanceof j3 || p instanceof Ws ? p.maxValue : 0;
}
populatePaintArrays(c, p, g, w, H) {
for (const A in this.binders) {
const C = this.binders[A];
(C instanceof j3 || C instanceof Ws || C instanceof h6) && C.populatePaintArray(c, p, g, w, H);
}
}
setConstantPatternPositions(c, p) {
for (const g in this.binders) {
const w = this.binders[g];
w instanceof Dl && w.setConstantPatternPositions(c, p);
}
}
updatePaintArrays(c, p, g, w, H) {
let A = !1;
for (const C in c) {
const N = p.getPositions(C);
for (const z of N) {
const W = g.feature(z.index);
for (const X in this.binders) {
const tt = this.binders[X];
if ((tt instanceof j3 || tt instanceof Ws || tt instanceof h6) && tt.expression.isStateDependent === !0) {
const at = w.paint.get(X);
tt.expression = at.value, tt.updatePaintArray(z.start, z.end, W, c[C], H), A = !0;
}
}
}
}
return A;
}
defines() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
(g instanceof zc || g instanceof Dl) && c.push(...g.uniformNames.map((w) => `#define HAS_UNIFORM_${w}`));
}
return c;
}
getBinderAttributes() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof j3 || g instanceof Ws)
for (let w = 0; w < g.paintVertexAttributes.length; w++)
c.push(g.paintVertexAttributes[w].name);
else if (g instanceof h6)
for (let w = 0; w < l6.members.length; w++)
c.push(l6.members[w].name);
}
return c;
}
getBinderUniforms() {
const c = [];
for (const p in this.binders) {
const g = this.binders[p];
if (g instanceof zc || g instanceof Dl || g instanceof Ws)
for (const w of g.uniformNames)
c.push(w);
}
return c;
}
getPaintVertexBuffers() {
return this._buffers;
}
getUniforms(c, p) {
const g = [];
for (const w in this.binders) {
const H = this.binders[w];
if (H instanceof zc || H instanceof Dl || H instanceof Ws) {
for (const A of H.uniformNames)
if (p[A]) {
const C = H.getBinding(c, p[A], A);
g.push({ name: A, property: w, binding: C });
}
}
}
return g;
}
setUniforms(c, p, g, w) {
for (const { name: H, property: A, binding: C } of p)
this.binders[A].setUniform(C, w, g.get(A), H);
}
updatePaintBuffers(c) {
this._buffers = [];
for (const p in this.binders) {
const g = this.binders[p];
if (c && g instanceof h6) {
const w = c.fromScale === 2 ? g.zoomInPaintVertexBuffer : g.zoomOutPaintVertexBuffer;
w && this._buffers.push(w);
} else
(g instanceof j3 || g instanceof Ws) && g.paintVertexBuffer && this._buffers.push(g.paintVertexBuffer);
}
}
upload(c) {
for (const p in this.binders) {
const g = this.binders[p];
(g instanceof j3 || g instanceof Ws || g instanceof h6) && g.upload(c);
}
this.updatePaintBuffers();
}
destroy() {
for (const c in this.binders) {
const p = this.binders[c];
(p instanceof j3 || p instanceof Ws || p instanceof h6) && p.destroy();
}
}
}
class D0 {
constructor(c, p, g = () => !0) {
this.programConfigurations = {};
for (const w of c)
this.programConfigurations[w.id] = new HO(w, p, g);
this.needsUpload = !1, this._featureMap = new R0(), this._bufferOffset = 0;
}
populatePaintArrays(c, p, g, w, H, A) {
for (const C in this.programConfigurations)
this.programConfigurations[C].populatePaintArrays(c, p, w, H, A);
p.id !== void 0 && this._featureMap.add(p.id, g, this._bufferOffset, c), this._bufferOffset = c, this.needsUpload = !0;
}
updatePaintArrays(c, p, g, w) {
for (const H of g)
this.needsUpload = this.programConfigurations[H.id].updatePaintArrays(c, this._featureMap, p, H, w) || this.needsUpload;
}
get(c) {
return this.programConfigurations[c];
}
upload(c) {
if (this.needsUpload) {
for (const p in this.programConfigurations)
this.programConfigurations[p].upload(c);
this.needsUpload = !1;
}
}
destroy() {
for (const c in this.programConfigurations)
this.programConfigurations[c].destroy();
}
}
function vJ(h, c) {
return { "text-opacity": ["opacity"], "icon-opacity": ["opacity"], "text-color": ["fill_color"], "icon-color": ["fill_color"], "text-halo-color": ["halo_color"], "icon-halo-color": ["halo_color"], "text-halo-blur": ["halo_blur"], "icon-halo-blur": ["halo_blur"], "text-halo-width": ["halo_width"], "icon-halo-width": ["halo_width"], "line-gap-width": ["gapwidth"], "line-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"], "fill-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"], "fill-extrusion-pattern": ["pattern_to", "pattern_from", "pixel_ratio_to", "pixel_ratio_from"] }[h] || [h.replace(`${c}-`, "").replace(/-/g, "_")];
}
function AO(h, c, p) {
const g = { color: { source: ft, composite: Nr }, number: { source: De, composite: ft } }, w = function(H) {
return { "line-pattern": { source: i2, composite: i2 }, "fill-pattern": { source: i2, composite: i2 }, "fill-extrusion-pattern": { source: i2, composite: i2 } }[H];
}(h);
return w && w[p] || g[c][p];
}
nr("ConstantBinder", zc), nr("CrossFadedConstantBinder", Dl), nr("SourceExpressionBinder", j3), nr("CrossFadedCompositeBinder", h6), nr("CompositeExpressionBinder", Ws), nr("ProgramConfiguration", HO, { omit: ["_buffers"] }), nr("ProgramConfigurationSet", D0);
const Zi = 8192, w_ = Math.pow(2, 14) - 1, OO = -w_ - 1;
function F0(h) {
const c = Zi / h.extent, p = h.loadGeometry();
for (let g = 0; g < p.length; g++) {
const w = p[g];
for (let H = 0; H < w.length; H++) {
const A = w[H], C = Math.round(A.x * c), N = Math.round(A.y * c);
A.x = F(C, OO, w_), A.y = F(N, OO, w_), (C < A.x || C > A.x + 1 || N < A.y || N > A.y + 1) && It("Geometry exceeds allowed extent, reduce your vector tile buffer size");
}
}
return p;
}
function B0(h, c) {
return { type: h.type, id: h.id, properties: h.properties, geometry: c ? F0(h) : [] };
}
function Mp(h, c, p, g, w) {
h.emplaceBack(2 * c + (g + 1) / 2, 2 * p + (w + 1) / 2);
}
class x_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.layoutVertexArray = new X1(), this.indexArray = new C2(), this.segments = new an(), this.programConfigurations = new D0(c.layers, c.zoom), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
const w = this.layers[0], H = [];
let A = null, C = !1;
w.type === "circle" && (A = w.layout.get("circle-sort-key"), C = !A.isConstant());
for (const { feature: N, id: z, index: W, sourceLayerIndex: X } of c) {
const tt = this.layers[0]._featureFilter.needGeometry, at = B0(N, tt);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), at, g))
continue;
const ut = C ? A.evaluate(at, {}, g) : void 0, Tt = { id: z, properties: N.properties, type: N.type, sourceLayerIndex: X, index: W, geometry: tt ? at.geometry : F0(N), patterns: {}, sortKey: ut };
H.push(Tt);
}
C && H.sort((N, z) => N.sortKey - z.sortKey);
for (const N of H) {
const { geometry: z, index: W, sourceLayerIndex: X } = N, tt = c[W].feature;
this.addFeature(N, z, W, g), p.featureIndex.insert(tt, z, W, X, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, Ro), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
}
addFeature(c, p, g, w) {
for (const H of p)
for (const A of H) {
const C = A.x, N = A.y;
if (C < 0 || C >= Zi || N < 0 || N >= Zi)
continue;
const z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, c.sortKey), W = z.vertexLength;
Mp(this.layoutVertexArray, C, N, -1, -1), Mp(this.layoutVertexArray, C, N, 1, -1), Mp(this.layoutVertexArray, C, N, 1, 1), Mp(this.layoutVertexArray, C, N, -1, 1), this.indexArray.emplaceBack(W, W + 1, W + 2), this.indexArray.emplaceBack(W, W + 3, W + 2), z.vertexLength += 4, z.primitiveLength += 2;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, {}, w);
}
}
function CO(h, c) {
for (let p = 0; p < h.length; p++)
if (Fl(c, h[p]))
return !0;
for (let p = 0; p < c.length; p++)
if (Fl(h, c[p]))
return !0;
return !!E_(h, c);
}
function _J(h, c, p) {
return !!Fl(h, c) || !!M_(c, h, p);
}
function kO(h, c) {
if (h.length === 1)
return PO(c, h[0]);
for (let p = 0; p < c.length; p++) {
const g = c[p];
for (let w = 0; w < g.length; w++)
if (Fl(h, g[w]))
return !0;
}
for (let p = 0; p < h.length; p++)
if (PO(c, h[p]))
return !0;
for (let p = 0; p < c.length; p++)
if (E_(h, c[p]))
return !0;
return !1;
}
function bJ(h, c, p) {
if (h.length > 1) {
if (E_(h, c))
return !0;
for (let g = 0; g < c.length; g++)
if (M_(c[g], h, p))
return !0;
}
for (let g = 0; g < h.length; g++)
if (M_(h[g], c, p))
return !0;
return !1;
}
function E_(h, c) {
if (h.length === 0 || c.length === 0)
return !1;
for (let p = 0; p < h.length - 1; p++) {
const g = h[p], w = h[p + 1];
for (let H = 0; H < c.length - 1; H++)
if (LJ(g, w, c[H], c[H + 1]))
return !0;
}
return !1;
}
function LJ(h, c, p, g) {
return Zt(h, p, g) !== Zt(c, p, g) && Zt(h, c, p) !== Zt(h, c, g);
}
function M_(h, c, p) {
const g = p * p;
if (c.length === 1)
return h.distSqr(c[0]) < g;
for (let w = 1; w < c.length; w++)
if (IO(h, c[w - 1], c[w]) < g)
return !0;
return !1;
}
function IO(h, c, p) {
const g = c.distSqr(p);
if (g === 0)
return h.distSqr(c);
const w = ((h.x - c.x) * (p.x - c.x) + (h.y - c.y) * (p.y - c.y)) / g;
return h.distSqr(w < 0 ? c : w > 1 ? p : p.sub(c)._mult(w)._add(c));
}
function PO(h, c) {
let p, g, w, H = !1;
for (let A = 0; A < h.length; A++) {
p = h[A];
for (let C = 0, N = p.length - 1; C < p.length; N = C++)
g = p[C], w = p[N], g.y > c.y != w.y > c.y && c.x < (w.x - g.x) * (c.y - g.y) / (w.y - g.y) + g.x && (H = !H);
}
return H;
}
function Fl(h, c) {
let p = !1;
for (let g = 0, w = h.length - 1; g < h.length; w = g++) {
const H = h[g], A = h[w];
H.y > c.y != A.y > c.y && c.x < (A.x - H.x) * (c.y - H.y) / (A.y - H.y) + H.x && (p = !p);
}
return p;
}
function wJ(h, c, p) {
const g = p[0], w = p[2];
if (h.x < g.x && c.x < g.x || h.x > w.x && c.x > w.x || h.y < g.y && c.y < g.y || h.y > w.y && c.y > w.y)
return !1;
const H = Zt(h, c, p[0]);
return H !== Zt(h, c, p[1]) || H !== Zt(h, c, p[2]) || H !== Zt(h, c, p[3]);
}
function Uc(h, c, p) {
const g = c.paint.get(h).value;
return g.kind === "constant" ? g.value : p.programConfigurations.get(c.id).getMaxValue(h);
}
function Sp(h) {
return Math.sqrt(h[0] * h[0] + h[1] * h[1]);
}
function Hp(h, c, p, g, w) {
if (!c[0] && !c[1])
return h;
const H = f.convert(c)._mult(w);
p === "viewport" && H._rotate(-g);
const A = [];
for (let C = 0; C < h.length; C++)
A.push(h[C].sub(H));
return A;
}
let VO, RO;
nr("CircleBucket", x_, { omit: ["layers"] });
var xJ = { get paint() {
return RO = RO || new S({ "circle-radius": new Mr(Ct.paint_circle["circle-radius"]), "circle-color": new Mr(Ct.paint_circle["circle-color"]), "circle-blur": new Mr(Ct.paint_circle["circle-blur"]), "circle-opacity": new Mr(Ct.paint_circle["circle-opacity"]), "circle-translate": new cr(Ct.paint_circle["circle-translate"]), "circle-translate-anchor": new cr(Ct.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new cr(Ct.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new cr(Ct.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new Mr(Ct.paint_circle["circle-stroke-width"]), "circle-stroke-color": new Mr(Ct.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new Mr(Ct.paint_circle["circle-stroke-opacity"]) });
}, get layout() {
return VO = VO || new S({ "circle-sort-key": new Mr(Ct.layout_circle["circle-sort-key"]) });
} }, go = 1e-6, Bl = typeof Float32Array < "u" ? Float32Array : Array;
function S_(h) {
return h[0] = 1, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = 1, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = 1, h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0, h[15] = 1, h;
}
function NO(h, c, p) {
var g = c[0], w = c[1], H = c[2], A = c[3], C = c[4], N = c[5], z = c[6], W = c[7], X = c[8], tt = c[9], at = c[10], ut = c[11], Tt = c[12], Lt = c[13], Et = c[14], $t = c[15], Pt = p[0], Bt = p[1], ee = p[2], _e = p[3];
return h[0] = Pt * g + Bt * C + ee * X + _e * Tt, h[1] = Pt * w + Bt * N + ee * tt + _e * Lt, h[2] = Pt * H + Bt * z + ee * at + _e * Et, h[3] = Pt * A + Bt * W + ee * ut + _e * $t, h[4] = (Pt = p[4]) * g + (Bt = p[5]) * C + (ee = p[6]) * X + (_e = p[7]) * Tt, h[5] = Pt * w + Bt * N + ee * tt + _e * Lt, h[6] = Pt * H + Bt * z + ee * at + _e * Et, h[7] = Pt * A + Bt * W + ee * ut + _e * $t, h[8] = (Pt = p[8]) * g + (Bt = p[9]) * C + (ee = p[10]) * X + (_e = p[11]) * Tt, h[9] = Pt * w + Bt * N + ee * tt + _e * Lt, h[10] = Pt * H + Bt * z + ee * at + _e * Et, h[11] = Pt * A + Bt * W + ee * ut + _e * $t, h[12] = (Pt = p[12]) * g + (Bt = p[13]) * C + (ee = p[14]) * X + (_e = p[15]) * Tt, h[13] = Pt * w + Bt * N + ee * tt + _e * Lt, h[14] = Pt * H + Bt * z + ee * at + _e * Et, h[15] = Pt * A + Bt * W + ee * ut + _e * $t, h;
}
Math.hypot || (Math.hypot = function() {
for (var h = 0, c = arguments.length; c--; )
h += arguments[c] * arguments[c];
return Math.sqrt(h);
});
var Gc, EJ = NO;
function Ap(h, c, p) {
var g = c[0], w = c[1], H = c[2], A = c[3];
return h[0] = p[0] * g + p[4] * w + p[8] * H + p[12] * A, h[1] = p[1] * g + p[5] * w + p[9] * H + p[13] * A, h[2] = p[2] * g + p[6] * w + p[10] * H + p[14] * A, h[3] = p[3] * g + p[7] * w + p[11] * H + p[15] * A, h;
}
Gc = new Bl(4), Bl != Float32Array && (Gc[0] = 0, Gc[1] = 0, Gc[2] = 0, Gc[3] = 0);
class MJ extends m {
constructor(c) {
super(c, xJ);
}
createBucket(c) {
return new x_(c);
}
queryRadius(c) {
const p = c;
return Uc("circle-radius", this, p) + Uc("circle-stroke-width", this, p) + Sp(this.paint.get("circle-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Hp(c, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), A.angle, C), W = this.paint.get("circle-radius").evaluate(p, g) + this.paint.get("circle-stroke-width").evaluate(p, g), X = this.paint.get("circle-pitch-alignment") === "map", tt = X ? z : function(ut, Tt) {
return ut.map((Lt) => DO(Lt, Tt));
}(z, N), at = X ? W * C : W;
for (const ut of w)
for (const Tt of ut) {
const Lt = X ? Tt : DO(Tt, N);
let Et = at;
const $t = Ap([], [Tt.x, Tt.y, 0, 1], N);
if (this.paint.get("circle-pitch-scale") === "viewport" && this.paint.get("circle-pitch-alignment") === "map" ? Et *= $t[3] / A.cameraToCenterDistance : this.paint.get("circle-pitch-scale") === "map" && this.paint.get("circle-pitch-alignment") === "viewport" && (Et *= A.cameraToCenterDistance / $t[3]), _J(tt, Lt, Et))
return !0;
}
return !1;
}
}
function DO(h, c) {
const p = Ap([], [h.x, h.y, 0, 1], c);
return new f(p[0] / p[3], p[1] / p[3]);
}
class FO extends x_ {
}
let BO;
nr("HeatmapBucket", FO, { omit: ["layers"] });
var SJ = { get paint() {
return BO = BO || new S({ "heatmap-radius": new Mr(Ct.paint_heatmap["heatmap-radius"]), "heatmap-weight": new Mr(Ct.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new cr(Ct.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Bc(Ct.paint_heatmap["heatmap-color"]), "heatmap-opacity": new cr(Ct.paint_heatmap["heatmap-opacity"]) });
} };
function H_(h, { width: c, height: p }, g, w) {
if (w) {
if (w instanceof Uint8ClampedArray)
w = new Uint8Array(w.buffer);
else if (w.length !== c * p * g)
throw new RangeError(`mismatched image size. expected: ${w.length} but got: ${c * p * g}`);
} else
w = new Uint8Array(c * p * g);
return h.width = c, h.height = p, h.data = w, h;
}
function jO(h, { width: c, height: p }, g) {
if (c === h.width && p === h.height)
return;
const w = H_({}, { width: c, height: p }, g);
A_(h, w, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(h.width, c), height: Math.min(h.height, p) }, g), h.width = c, h.height = p, h.data = w.data;
}
function A_(h, c, p, g, w, H) {
if (w.width === 0 || w.height === 0)
return c;
if (w.width > h.width || w.height > h.height || p.x > h.width - w.width || p.y > h.height - w.height)
throw new RangeError("out of range source coordinates for image copy");
if (w.width > c.width || w.height > c.height || g.x > c.width - w.width || g.y > c.height - w.height)
throw new RangeError("out of range destination coordinates for image copy");
const A = h.data, C = c.data;
if (A === C)
throw new Error("srcData equals dstData, so image is already copied");
for (let N = 0; N < w.height; N++) {
const z = ((p.y + N) * h.width + p.x) * H, W = ((g.y + N) * c.width + g.x) * H;
for (let X = 0; X < w.width * H; X++)
C[W + X] = A[z + X];
}
return c;
}
class $c {
constructor(c, p) {
H_(this, c, 1, p);
}
resize(c) {
jO(this, c, 1);
}
clone() {
return new $c({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, w, H) {
A_(c, p, g, w, H, 1);
}
}
class k2 {
constructor(c, p) {
H_(this, c, 4, p);
}
resize(c) {
jO(this, c, 4);
}
replace(c, p) {
p ? this.data.set(c) : this.data = c instanceof Uint8ClampedArray ? new Uint8Array(c.buffer) : c;
}
clone() {
return new k2({ width: this.width, height: this.height }, new Uint8Array(this.data));
}
static copy(c, p, g, w, H) {
A_(c, p, g, w, H, 4);
}
}
function zO(h) {
const c = {}, p = h.resolution || 256, g = h.clips ? h.clips.length : 1, w = h.image || new k2({ width: p, height: g });
if (Math.log(p) / Math.LN2 % 1 != 0)
throw new Error(`width is not a power of 2 - ${p}`);
const H = (A, C, N) => {
c[h.evaluationKey] = N;
const z = h.expression.evaluate(c);
w.data[A + C + 0] = Math.floor(255 * z.r / z.a), w.data[A + C + 1] = Math.floor(255 * z.g / z.a), w.data[A + C + 2] = Math.floor(255 * z.b / z.a), w.data[A + C + 3] = Math.floor(255 * z.a);
};
if (h.clips)
for (let A = 0, C = 0; A < g; ++A, C += 4 * p)
for (let N = 0, z = 0; N < p; N++, z += 4) {
const W = N / (p - 1), { start: X, end: tt } = h.clips[A];
H(C, z, X * (1 - W) + tt * W);
}
else
for (let A = 0, C = 0; A < p; A++, C += 4)
H(0, C, A / (p - 1));
return w;
}
nr("AlphaImage", $c), nr("RGBAImage", k2);
const O_ = "big-fb";
class HJ extends m {
createBucket(c) {
return new FO(c);
}
constructor(c) {
super(c, SJ), this.heatmapFbos = /* @__PURE__ */ new Map(), this._updateColorRamp();
}
_handleSpecialPaintPropertyUpdate(c) {
c === "heatmap-color" && this._updateColorRamp();
}
_updateColorRamp() {
this.colorRamp = zO({ expression: this._transitionablePaint._values["heatmap-color"].value.expression, evaluationKey: "heatmapDensity", image: this.colorRamp }), this.colorRampTexture = null;
}
resize() {
this.heatmapFbos.has(O_) && this.heatmapFbos.delete(O_);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
return !1;
}
hasOffscreenPass() {
return this.paint.get("heatmap-opacity") !== 0 && this.visibility !== "none";
}
}
let UO;
var AJ = { get paint() {
return UO = UO || new S({ "hillshade-illumination-direction": new cr(Ct.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new cr(Ct.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new cr(Ct.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new cr(Ct.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new cr(Ct.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new cr(Ct.paint_hillshade["hillshade-accent-color"]) });
} };
class OJ extends m {
constructor(c) {
super(c, AJ);
}
hasOffscreenPass() {
return this.paint.get("hillshade-exaggeration") !== 0 && this.visibility !== "none";
}
}
const CJ = V([{ name: "a_pos", components: 2, type: "Int16" }], 4), { members: kJ } = CJ;
function GO(h, c, p = 2) {
const g = c && c.length, w = g ? c[0] * p : h.length;
let H = $O(h, 0, w, p, !0);
const A = [];
if (!H || H.next === H.prev)
return A;
let C, N, z;
if (g && (H = function(W, X, tt, at) {
const ut = [];
for (let Tt = 0, Lt = X.length; Tt < Lt; Tt++) {
const Et = $O(W, X[Tt] * at, Tt < Lt - 1 ? X[Tt + 1] * at : W.length, at, !1);
Et === Et.next && (Et.steiner = !0), ut.push(BJ(Et));
}
ut.sort(NJ);
for (let Tt = 0; Tt < ut.length; Tt++)
tt = DJ(ut[Tt], tt);
return tt;
}(h, c, H, p)), h.length > 80 * p) {
C = 1 / 0, N = 1 / 0;
let W = -1 / 0, X = -1 / 0;
for (let tt = p; tt < w; tt += p) {
const at = h[tt], ut = h[tt + 1];
at < C && (C = at), ut < N && (N = ut), at > W && (W = at), ut > X && (X = ut);
}
z = Math.max(W - C, X - N), z = z !== 0 ? 32767 / z : 0;
}
return Wc(H, A, p, C, N, z, 0), A;
}
function $O(h, c, p, g, w) {
let H;
if (w === function(A, C, N, z) {
let W = 0;
for (let X = C, tt = N - z; X < N; X += z)
W += (A[tt] - A[X]) * (A[X + 1] + A[tt + 1]), tt = X;
return W;
}(h, c, p, g) > 0)
for (let A = c; A < p; A += g)
H = qO(A / g | 0, h[A], h[A + 1], H);
else
for (let A = p - g; A >= c; A -= g)
H = qO(A / g | 0, h[A], h[A + 1], H);
return H && Op(H, H.next) && (qc(H), H = H.next), H;
}
function j0(h, c) {
if (!h)
return h;
c || (c = h);
let p, g = h;
do
if (p = !1, g.steiner || !Op(g, g.next) && Di(g.prev, g, g.next) !== 0)
g = g.next;
else {
if (qc(g), g = c = g.prev, g === g.next)
break;
p = !0;
}
while (p || g !== c);
return c;
}
function Wc(h, c, p, g, w, H, A) {
if (!h)
return;
!A && H && function(N, z, W, X) {
let tt = N;
do
tt.z === 0 && (tt.z = C_(tt.x, tt.y, z, W, X)), tt.prevZ = tt.prev, tt.nextZ = tt.next, tt = tt.next;
while (tt !== N);
tt.prevZ.nextZ = null, tt.prevZ = null, function(at) {
let ut, Tt = 1;
do {
let Lt, Et = at;
at = null;
let $t = null;
for (ut = 0; Et; ) {
ut++;
let Pt = Et, Bt = 0;
for (let _e = 0; _e < Tt && (Bt++, Pt = Pt.nextZ, Pt); _e++)
;
let ee = Tt;
for (; Bt > 0 || ee > 0 && Pt; )
Bt !== 0 && (ee === 0 || !Pt || Et.z <= Pt.z) ? (Lt = Et, Et = Et.nextZ, Bt--) : (Lt = Pt, Pt = Pt.nextZ, ee--), $t ? $t.nextZ = Lt : at = Lt, Lt.prevZ = $t, $t = Lt;
Et = Pt;
}
$t.nextZ = null, Tt *= 2;
} while (ut > 1);
}(tt);
}(h, g, w, H);
let C = h;
for (; h.prev !== h.next; ) {
const N = h.prev, z = h.next;
if (H ? PJ(h, g, w, H) : IJ(h))
c.push(N.i, h.i, z.i), qc(h), h = z.next, C = z.next;
else if ((h = z) === C) {
A ? A === 1 ? Wc(h = VJ(j0(h), c), c, p, g, w, H, 2) : A === 2 && RJ(h, c, p, g, w, H) : Wc(j0(h), c, p, g, w, H, 1);
break;
}
}
}
function IJ(h) {
const c = h.prev, p = h, g = h.next;
if (Di(c, p, g) >= 0)
return !1;
const w = c.x, H = p.x, A = g.x, C = c.y, N = p.y, z = g.y, W = w < H ? w < A ? w : A : H < A ? H : A, X = C < N ? C < z ? C : z : N < z ? N : z, tt = w > H ? w > A ? w : A : H > A ? H : A, at = C > N ? C > z ? C : z : N > z ? N : z;
let ut = g.next;
for (; ut !== c; ) {
if (ut.x >= W && ut.x <= tt && ut.y >= X && ut.y <= at && jl(w, C, H, N, A, z, ut.x, ut.y) && Di(ut.prev, ut, ut.next) >= 0)
return !1;
ut = ut.next;
}
return !0;
}
function PJ(h, c, p, g) {
const w = h.prev, H = h, A = h.next;
if (Di(w, H, A) >= 0)
return !1;
const C = w.x, N = H.x, z = A.x, W = w.y, X = H.y, tt = A.y, at = C < N ? C < z ? C : z : N < z ? N : z, ut = W < X ? W < tt ? W : tt : X < tt ? X : tt, Tt = C > N ? C > z ? C : z : N > z ? N : z, Lt = W > X ? W > tt ? W : tt : X > tt ? X : tt, Et = C_(at, ut, c, p, g), $t = C_(Tt, Lt, c, p, g);
let Pt = h.prevZ, Bt = h.nextZ;
for (; Pt && Pt.z >= Et && Bt && Bt.z <= $t; ) {
if (Pt.x >= at && Pt.x <= Tt && Pt.y >= ut && Pt.y <= Lt && Pt !== w && Pt !== A && jl(C, W, N, X, z, tt, Pt.x, Pt.y) && Di(Pt.prev, Pt, Pt.next) >= 0 || (Pt = Pt.prevZ, Bt.x >= at && Bt.x <= Tt && Bt.y >= ut && Bt.y <= Lt && Bt !== w && Bt !== A && jl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0))
return !1;
Bt = Bt.nextZ;
}
for (; Pt && Pt.z >= Et; ) {
if (Pt.x >= at && Pt.x <= Tt && Pt.y >= ut && Pt.y <= Lt && Pt !== w && Pt !== A && jl(C, W, N, X, z, tt, Pt.x, Pt.y) && Di(Pt.prev, Pt, Pt.next) >= 0)
return !1;
Pt = Pt.prevZ;
}
for (; Bt && Bt.z <= $t; ) {
if (Bt.x >= at && Bt.x <= Tt && Bt.y >= ut && Bt.y <= Lt && Bt !== w && Bt !== A && jl(C, W, N, X, z, tt, Bt.x, Bt.y) && Di(Bt.prev, Bt, Bt.next) >= 0)
return !1;
Bt = Bt.nextZ;
}
return !0;
}
function VJ(h, c) {
let p = h;
do {
const g = p.prev, w = p.next.next;
!Op(g, w) && WO(g, p, p.next, w) && Zc(g, w) && Zc(w, g) && (c.push(g.i, p.i, w.i), qc(p), qc(p.next), p = h = w), p = p.next;
} while (p !== h);
return j0(p);
}
function RJ(h, c, p, g, w, H) {
let A = h;
do {
let C = A.next.next;
for (; C !== A.prev; ) {
if (A.i !== C.i && jJ(A, C)) {
let N = ZO(A, C);
return A = j0(A, A.next), N = j0(N, N.next), Wc(A, c, p, g, w, H, 0), void Wc(N, c, p, g, w, H, 0);
}
C = C.next;
}
A = A.next;
} while (A !== h);
}
function NJ(h, c) {
return h.x - c.x;
}
function DJ(h, c) {
const p = function(w, H) {
let A = H;
const C = w.x, N = w.y;
let z, W = -1 / 0;
do {
if (N <= A.y && N >= A.next.y && A.next.y !== A.y) {
const Tt = A.x + (N - A.y) * (A.next.x - A.x) / (A.next.y - A.y);
if (Tt <= C && Tt > W && (W = Tt, z = A.x < A.next.x ? A : A.next, Tt === C))
return z;
}
A = A.next;
} while (A !== H);
if (!z)
return null;
const X = z, tt = z.x, at = z.y;
let ut = 1 / 0;
A = z;
do {
if (C >= A.x && A.x >= tt && C !== A.x && jl(N < at ? C : W, N, tt, at, N < at ? W : C, N, A.x, A.y)) {
const Tt = Math.abs(N - A.y) / (C - A.x);
Zc(A, w) && (Tt < ut || Tt === ut && (A.x > z.x || A.x === z.x && FJ(z, A))) && (z = A, ut = Tt);
}
A = A.next;
} while (A !== X);
return z;
}(h, c);
if (!p)
return c;
const g = ZO(p, h);
return j0(g, g.next), j0(p, p.next);
}
function FJ(h, c) {
return Di(h.prev, h, c.prev) < 0 && Di(c.next, h, h.next) < 0;
}
function C_(h, c, p, g, w) {
return (h = 1431655765 & ((h = 858993459 & ((h = 252645135 & ((h = 16711935 & ((h = (h - p) * w | 0) | h << 8)) | h << 4)) | h << 2)) | h << 1)) | (c = 1431655765 & ((c = 858993459 & ((c = 252645135 & ((c = 16711935 & ((c = (c - g) * w | 0) | c << 8)) | c << 4)) | c << 2)) | c << 1)) << 1;
}
function BJ(h) {
let c = h, p = h;
do
(c.x < p.x || c.x === p.x && c.y < p.y) && (p = c), c = c.next;
while (c !== h);
return p;
}
function jl(h, c, p, g, w, H, A, C) {
return (w - A) * (c - C) >= (h - A) * (H - C) && (h - A) * (g - C) >= (p - A) * (c - C) && (p - A) * (H - C) >= (w - A) * (g - C);
}
function jJ(h, c) {
return h.next.i !== c.i && h.prev.i !== c.i && !function(p, g) {
let w = p;
do {
if (w.i !== p.i && w.next.i !== p.i && w.i !== g.i && w.next.i !== g.i && WO(w, w.next, p, g))
return !0;
w = w.next;
} while (w !== p);
return !1;
}(h, c) && (Zc(h, c) && Zc(c, h) && function(p, g) {
let w = p, H = !1;
const A = (p.x + g.x) / 2, C = (p.y + g.y) / 2;
do
w.y > C != w.next.y > C && w.next.y !== w.y && A < (w.next.x - w.x) * (C - w.y) / (w.next.y - w.y) + w.x && (H = !H), w = w.next;
while (w !== p);
return H;
}(h, c) && (Di(h.prev, h, c.prev) || Di(h, c.prev, c)) || Op(h, c) && Di(h.prev, h, h.next) > 0 && Di(c.prev, c, c.next) > 0);
}
function Di(h, c, p) {
return (c.y - h.y) * (p.x - c.x) - (c.x - h.x) * (p.y - c.y);
}
function Op(h, c) {
return h.x === c.x && h.y === c.y;
}
function WO(h, c, p, g) {
const w = kp(Di(h, c, p)), H = kp(Di(h, c, g)), A = kp(Di(p, g, h)), C = kp(Di(p, g, c));
return w !== H && A !== C || !(w !== 0 || !Cp(h, p, c)) || !(H !== 0 || !Cp(h, g, c)) || !(A !== 0 || !Cp(p, h, g)) || !(C !== 0 || !Cp(p, c, g));
}
function Cp(h, c, p) {
return c.x <= Math.max(h.x, p.x) && c.x >= Math.min(h.x, p.x) && c.y <= Math.max(h.y, p.y) && c.y >= Math.min(h.y, p.y);
}
function kp(h) {
return h > 0 ? 1 : h < 0 ? -1 : 0;
}
function Zc(h, c) {
return Di(h.prev, h, h.next) < 0 ? Di(h, c, h.next) >= 0 && Di(h, h.prev, c) >= 0 : Di(h, c, h.prev) < 0 || Di(h, h.next, c) < 0;
}
function ZO(h, c) {
const p = k_(h.i, h.x, h.y), g = k_(c.i, c.x, c.y), w = h.next, H = c.prev;
return h.next = c, c.prev = h, p.next = w, w.prev = p, g.next = p, p.prev = g, H.next = g, g.prev = H, g;
}
function qO(h, c, p, g) {
const w = k_(h, c, p);
return g ? (w.next = g.next, w.prev = g, g.next.prev = w, g.next = w) : (w.prev = w, w.next = w), w;
}
function qc(h) {
h.next.prev = h.prev, h.prev.next = h.next, h.prevZ && (h.prevZ.nextZ = h.nextZ), h.nextZ && (h.nextZ.prevZ = h.prevZ);
}
function k_(h, c, p) {
return { i: h, x: c, y: p, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: !1 };
}
function I_(h, c, p) {
const g = p.patternDependencies;
let w = !1;
for (const H of c) {
const A = H.paint.get(`${h}-pattern`);
A.isConstant() || (w = !0);
const C = A.constantOr(null);
C && (w = !0, g[C.to] = !0, g[C.from] = !0);
}
return w;
}
function P_(h, c, p, g, w) {
const H = w.patternDependencies;
for (const A of c) {
const C = A.paint.get(`${h}-pattern`).value;
if (C.kind !== "constant") {
let N = C.evaluate({ zoom: g - 1 }, p, {}, w.availableImages), z = C.evaluate({ zoom: g }, p, {}, w.availableImages), W = C.evaluate({ zoom: g + 1 }, p, {}, w.availableImages);
N = N && N.name ? N.name : N, z = z && z.name ? z.name : z, W = W && W.name ? W.name : W, H[N] = !0, H[z] = !0, H[W] = !0, p.patterns[A.id] = { min: N, mid: z, max: W };
}
}
return p;
}
class V_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.patternFeatures = [], this.layoutVertexArray = new ms(), this.indexArray = new C2(), this.indexArray2 = new b1(), this.programConfigurations = new D0(c.layers, c.zoom), this.segments = new an(), this.segments2 = new an(), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.hasPattern = I_("fill", this.layers, p);
const w = this.layers[0].layout.get("fill-sort-key"), H = !w.isConstant(), A = [];
for (const { feature: C, id: N, index: z, sourceLayerIndex: W } of c) {
const X = this.layers[0]._featureFilter.needGeometry, tt = B0(C, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), tt, g))
continue;
const at = H ? w.evaluate(tt, {}, g, p.availableImages) : void 0, ut = { id: N, properties: C.properties, type: C.type, sourceLayerIndex: W, index: z, geometry: X ? tt.geometry : F0(C), patterns: {}, sortKey: at };
A.push(ut);
}
H && A.sort((C, N) => C.sortKey - N.sortKey);
for (const C of A) {
const { geometry: N, index: z, sourceLayerIndex: W } = C;
if (this.hasPattern) {
const X = P_("fill", this.layers, C, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(C, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, W, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const w of this.patternFeatures)
this.addFeature(w, w.geometry, w.index, p, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, kJ), this.indexBuffer = c.createIndexBuffer(this.indexArray), this.indexBuffer2 = c.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy());
}
addFeature(c, p, g, w, H) {
for (const A of U4(p, 500)) {
let C = 0;
for (const at of A)
C += at.length;
const N = this.segments.prepareSegment(C, this.layoutVertexArray, this.indexArray), z = N.vertexLength, W = [], X = [];
for (const at of A) {
if (at.length === 0)
continue;
at !== A[0] && X.push(W.length / 2);
const ut = this.segments2.prepareSegment(at.length, this.layoutVertexArray, this.indexArray2), Tt = ut.vertexLength;
this.layoutVertexArray.emplaceBack(at[0].x, at[0].y), this.indexArray2.emplaceBack(Tt + at.length - 1, Tt), W.push(at[0].x), W.push(at[0].y);
for (let Lt = 1; Lt < at.length; Lt++)
this.layoutVertexArray.emplaceBack(at[Lt].x, at[Lt].y), this.indexArray2.emplaceBack(Tt + Lt - 1, Tt + Lt), W.push(at[Lt].x), W.push(at[Lt].y);
ut.vertexLength += at.length, ut.primitiveLength += at.length;
}
const tt = GO(W, X);
for (let at = 0; at < tt.length; at += 3)
this.indexArray.emplaceBack(z + tt[at], z + tt[at + 1], z + tt[at + 2]);
N.vertexLength += C, N.primitiveLength += tt.length / 3;
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
}
let XO, KO;
nr("FillBucket", V_, { omit: ["layers", "patternFeatures"] });
var zJ = { get paint() {
return KO = KO || new S({ "fill-antialias": new cr(Ct.paint_fill["fill-antialias"]), "fill-opacity": new Mr(Ct.paint_fill["fill-opacity"]), "fill-color": new Mr(Ct.paint_fill["fill-color"]), "fill-outline-color": new Mr(Ct.paint_fill["fill-outline-color"]), "fill-translate": new cr(Ct.paint_fill["fill-translate"]), "fill-translate-anchor": new cr(Ct.paint_fill["fill-translate-anchor"]), "fill-pattern": new Cl(Ct.paint_fill["fill-pattern"]) });
}, get layout() {
return XO = XO || new S({ "fill-sort-key": new Mr(Ct.layout_fill["fill-sort-key"]) });
} };
class UJ extends m {
constructor(c) {
super(c, zJ);
}
recalculate(c, p) {
super.recalculate(c, p);
const g = this.paint._values["fill-outline-color"];
g.value.kind === "constant" && g.value.value === void 0 && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]);
}
createBucket(c) {
return new V_(c);
}
queryRadius() {
return Sp(this.paint.get("fill-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
return kO(Hp(c, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), A.angle, C), w);
}
isTileClipped() {
return !0;
}
}
const GJ = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4), $J = V([{ name: "a_centroid", components: 2, type: "Int16" }], 4), { members: WJ } = GJ;
var d6 = {}, ZJ = d, YO = zl;
function zl(h, c, p, g, w) {
this.properties = {}, this.extent = p, this.type = 0, this._pbf = h, this._geometry = -1, this._keys = g, this._values = w, h.readFields(qJ, this, c);
}
function qJ(h, c, p) {
h == 1 ? c.id = p.readVarint() : h == 2 ? function(g, w) {
for (var H = g.readVarint() + g.pos; g.pos < H; ) {
var A = w._keys[g.readVarint()], C = w._values[g.readVarint()];
w.properties[A] = C;
}
}(p, c) : h == 3 ? c.type = p.readVarint() : h == 4 && (c._geometry = p.pos);
}
function XJ(h) {
for (var c, p, g = 0, w = 0, H = h.length, A = H - 1; w < H; A = w++)
g += ((p = h[A]).x - (c = h[w]).x) * (c.y + p.y);
return g;
}
zl.types = ["Unknown", "Point", "LineString", "Polygon"], zl.prototype.loadGeometry = function() {
var h = this._pbf;
h.pos = this._geometry;
for (var c, p = h.readVarint() + h.pos, g = 1, w = 0, H = 0, A = 0, C = []; h.pos < p; ) {
if (w <= 0) {
var N = h.readVarint();
g = 7 & N, w = N >> 3;
}
if (w--, g === 1 || g === 2)
H += h.readSVarint(), A += h.readSVarint(), g === 1 && (c && C.push(c), c = []), c.push(new ZJ(H, A));
else {
if (g !== 7)
throw new Error("unknown command " + g);
c && c.push(c[0].clone());
}
}
return c && C.push(c), C;
}, zl.prototype.bbox = function() {
var h = this._pbf;
h.pos = this._geometry;
for (var c = h.readVarint() + h.pos, p = 1, g = 0, w = 0, H = 0, A = 1 / 0, C = -1 / 0, N = 1 / 0, z = -1 / 0; h.pos < c; ) {
if (g <= 0) {
var W = h.readVarint();
p = 7 & W, g = W >> 3;
}
if (g--, p === 1 || p === 2)
(w += h.readSVarint()) < A && (A = w), w > C && (C = w), (H += h.readSVarint()) < N && (N = H), H > z && (z = H);
else if (p !== 7)
throw new Error("unknown command " + p);
}
return [A, N, C, z];
}, zl.prototype.toGeoJSON = function(h, c, p) {
var g, w, H = this.extent * Math.pow(2, p), A = this.extent * h, C = this.extent * c, N = this.loadGeometry(), z = zl.types[this.type];
function W(at) {
for (var ut = 0; ut < at.length; ut++) {
var Tt = at[ut];
at[ut] = [360 * (Tt.x + A) / H - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (Tt.y + C) / H) * Math.PI / 180)) - 90];
}
}
switch (this.type) {
case 1:
var X = [];
for (g = 0; g < N.length; g++)
X[g] = N[g][0];
W(N = X);
break;
case 2:
for (g = 0; g < N.length; g++)
W(N[g]);
break;
case 3:
for (N = function(at) {
var ut = at.length;
if (ut <= 1)
return [at];
for (var Tt, Lt, Et = [], $t = 0; $t < ut; $t++) {
var Pt = XJ(at[$t]);
Pt !== 0 && (Lt === void 0 && (Lt = Pt < 0), Lt === Pt < 0 ? (Tt && Et.push(Tt), Tt = [at[$t]]) : Tt.push(at[$t]));
}
return Tt && Et.push(Tt), Et;
}(N), g = 0; g < N.length; g++)
for (w = 0; w < N[g].length; w++)
W(N[g][w]);
}
N.length === 1 ? N = N[0] : z = "Multi" + z;
var tt = { type: "Feature", geometry: { type: z, coordinates: N }, properties: this.properties };
return "id" in this && (tt.id = this.id), tt;
};
var KJ = YO, JO = tC;
function tC(h, c) {
this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = h, this._keys = [], this._values = [], this._features = [], h.readFields(YJ, this, c), this.length = this._features.length;
}
function YJ(h, c, p) {
h === 15 ? c.version = p.readVarint() : h === 1 ? c.name = p.readString() : h === 5 ? c.extent = p.readVarint() : h === 2 ? c._features.push(p.pos) : h === 3 ? c._keys.push(p.readString()) : h === 4 && c._values.push(function(g) {
for (var w = null, H = g.readVarint() + g.pos; g.pos < H; ) {
var A = g.readVarint() >> 3;
w = A === 1 ? g.readString() : A === 2 ? g.readFloat() : A === 3 ? g.readDouble() : A === 4 ? g.readVarint64() : A === 5 ? g.readVarint() : A === 6 ? g.readSVarint() : A === 7 ? g.readBoolean() : null;
}
return w;
}(p));
}
tC.prototype.feature = function(h) {
if (h < 0 || h >= this._features.length)
throw new Error("feature index out of bounds");
this._pbf.pos = this._features[h];
var c = this._pbf.readVarint() + this._pbf.pos;
return new KJ(this._pbf, c, this.extent, this._keys, this._values);
};
var JJ = JO;
function ttt(h, c, p) {
if (h === 3) {
var g = new JJ(p, p.readVarint() + p.pos);
g.length && (c[g.name] = g);
}
}
d6.VectorTile = function(h, c) {
this.layers = h.readFields(ttt, {}, c);
}, d6.VectorTileFeature = YO, d6.VectorTileLayer = JO;
const ett = d6.VectorTileFeature.types, R_ = Math.pow(2, 13);
function Xc(h, c, p, g, w, H, A, C) {
h.emplaceBack(c, p, 2 * Math.floor(g * R_) + A, w * R_ * 2, H * R_ * 2, Math.round(C));
}
class N_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.layoutVertexArray = new s6(), this.centroidVertexArray = new k1(), this.indexArray = new C2(), this.programConfigurations = new D0(c.layers, c.zoom), this.segments = new an(), this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.features = [], this.hasPattern = I_("fill-extrusion", this.layers, p);
for (const { feature: w, id: H, index: A, sourceLayerIndex: C } of c) {
const N = this.layers[0]._featureFilter.needGeometry, z = B0(w, N);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), z, g))
continue;
const W = { id: H, sourceLayerIndex: C, index: A, geometry: N ? z.geometry : F0(w), properties: w.properties, type: w.type, patterns: {} };
this.hasPattern ? this.features.push(P_("fill-extrusion", this.layers, W, this.zoom, p)) : this.addFeature(W, W.geometry, A, g, {}), p.featureIndex.insert(w, W.geometry, A, C, this.index, !0);
}
}
addFeatures(c, p, g) {
for (const w of this.features) {
const { geometry: H } = w;
this.addFeature(w, H, w.index, p, g);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0 && this.centroidVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, WJ), this.centroidVertexBuffer = c.createVertexBuffer(this.centroidVertexArray, $J.members, !0), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.centroidVertexBuffer.destroy());
}
addFeature(c, p, g, w, H) {
for (const A of U4(p, 500)) {
const C = { x: 0, y: 0, vertexCount: 0 };
let N = 0;
for (const ut of A)
N += ut.length;
let z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
for (const ut of A) {
if (ut.length === 0 || ntt(ut))
continue;
let Tt = 0;
for (let Lt = 0; Lt < ut.length; Lt++) {
const Et = ut[Lt];
if (Lt >= 1) {
const $t = ut[Lt - 1];
if (!rtt(Et, $t)) {
z.vertexLength + 4 > an.MAX_VERTEX_ARRAY_LENGTH && (z = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray));
const Pt = Et.sub($t)._perp()._unit(), Bt = $t.dist(Et);
Tt + Bt > 32768 && (Tt = 0), Xc(this.layoutVertexArray, Et.x, Et.y, Pt.x, Pt.y, 0, 0, Tt), Xc(this.layoutVertexArray, Et.x, Et.y, Pt.x, Pt.y, 0, 1, Tt), C.x += 2 * Et.x, C.y += 2 * Et.y, C.vertexCount += 2, Tt += Bt, Xc(this.layoutVertexArray, $t.x, $t.y, Pt.x, Pt.y, 0, 0, Tt), Xc(this.layoutVertexArray, $t.x, $t.y, Pt.x, Pt.y, 0, 1, Tt), C.x += 2 * $t.x, C.y += 2 * $t.y, C.vertexCount += 2;
const ee = z.vertexLength;
this.indexArray.emplaceBack(ee, ee + 2, ee + 1), this.indexArray.emplaceBack(ee + 1, ee + 2, ee + 3), z.vertexLength += 4, z.primitiveLength += 2;
}
}
}
}
if (z.vertexLength + N > an.MAX_VERTEX_ARRAY_LENGTH && (z = this.segments.prepareSegment(N, this.layoutVertexArray, this.indexArray)), ett[c.type] !== "Polygon")
continue;
const W = [], X = [], tt = z.vertexLength;
for (const ut of A)
if (ut.length !== 0) {
ut !== A[0] && X.push(W.length / 2);
for (let Tt = 0; Tt < ut.length; Tt++) {
const Lt = ut[Tt];
Xc(this.layoutVertexArray, Lt.x, Lt.y, 0, 0, 1, 1, 0), C.x += Lt.x, C.y += Lt.y, C.vertexCount += 1, W.push(Lt.x), W.push(Lt.y);
}
}
const at = GO(W, X);
for (let ut = 0; ut < at.length; ut += 3)
this.indexArray.emplaceBack(tt + at[ut], tt + at[ut + 2], tt + at[ut + 1]);
z.primitiveLength += at.length / 3, z.vertexLength += N;
for (let ut = 0; ut < C.vertexCount; ut++) {
const Tt = Math.floor(C.x / C.vertexCount), Lt = Math.floor(C.y / C.vertexCount);
this.centroidVertexArray.emplaceBack(Tt, Lt);
}
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
}
function rtt(h, c) {
return h.x === c.x && (h.x < 0 || h.x > Zi) || h.y === c.y && (h.y < 0 || h.y > Zi);
}
function ntt(h) {
return h.every((c) => c.x < 0) || h.every((c) => c.x > Zi) || h.every((c) => c.y < 0) || h.every((c) => c.y > Zi);
}
let eC;
nr("FillExtrusionBucket", N_, { omit: ["layers", "features"] });
var itt = { get paint() {
return eC = eC || new S({ "fill-extrusion-opacity": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new Cl(Ct["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new Mr(Ct["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new cr(Ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) });
} };
class ott extends m {
constructor(c) {
super(c, itt);
}
createBucket(c) {
return new N_(c);
}
queryRadius() {
return Sp(this.paint.get("fill-extrusion-translate"));
}
is3D() {
return !0;
}
queryIntersectsFeature(c, p, g, w, H, A, C, N) {
const z = Hp(c, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), A.angle, C), W = this.paint.get("fill-extrusion-height").evaluate(p, g), X = this.paint.get("fill-extrusion-base").evaluate(p, g), tt = function(ut, Tt, Lt, Et) {
const $t = [];
for (const Pt of ut) {
const Bt = [Pt.x, Pt.y, 0, 1];
Ap(Bt, Bt, Tt), $t.push(new f(Bt[0] / Bt[3], Bt[1] / Bt[3]));
}
return $t;
}(z, N), at = function(ut, Tt, Lt, Et) {
const $t = [], Pt = [], Bt = Et[8] * Tt, ee = Et[9] * Tt, _e = Et[10] * Tt, Xe = Et[11] * Tt, Er = Et[8] * Lt, ze = Et[9] * Lt, Re = Et[10] * Lt, Qr = Et[11] * Lt;
for (const sr of ut) {
const rr = [], ue = [];
for (const gr of sr) {
const pr = gr.x, Ir = gr.y, Fn = Et[0] * pr + Et[4] * Ir + Et[12], Pn = Et[1] * pr + Et[5] * Ir + Et[13], p1 = Et[2] * pr + Et[6] * Ir + Et[14], gs = Et[3] * pr + Et[7] * Ir + Et[15], V1 = p1 + _e, T1 = gs + Xe, yo = Fn + Er, vo = Pn + ze, _o = p1 + Re, Oi = gs + Qr, f1 = new f((Fn + Bt) / T1, (Pn + ee) / T1);
f1.z = V1 / T1, rr.push(f1);
const K1 = new f(yo / Oi, vo / Oi);
K1.z = _o / Oi, ue.push(K1);
}
$t.push(rr), Pt.push(ue);
}
return [$t, Pt];
}(w, X, W, N);
return function(ut, Tt, Lt) {
let Et = 1 / 0;
kO(Lt, Tt) && (Et = rC(Lt, Tt[0]));
for (let $t = 0; $t < Tt.length; $t++) {
const Pt = Tt[$t], Bt = ut[$t];
for (let ee = 0; ee < Pt.length - 1; ee++) {
const _e = Pt[ee], Xe = [_e, Pt[ee + 1], Bt[ee + 1], Bt[ee], _e];
CO(Lt, Xe) && (Et = Math.min(Et, rC(Lt, Xe)));
}
}
return Et !== 1 / 0 && Et;
}(at[0], at[1], tt);
}
}
function Kc(h, c) {
return h.x * c.x + h.y * c.y;
}
function rC(h, c) {
if (h.length === 1) {
let p = 0;
const g = c[p++];
let w;
for (; !w || g.equals(w); )
if (w = c[p++], !w)
return 1 / 0;
for (; p < c.length; p++) {
const H = c[p], A = h[0], C = w.sub(g), N = H.sub(g), z = A.sub(g), W = Kc(C, C), X = Kc(C, N), tt = Kc(N, N), at = Kc(z, C), ut = Kc(z, N), Tt = W * tt - X * X, Lt = (tt * at - X * ut) / Tt, Et = (W * ut - X * at) / Tt, $t = g.z * (1 - Lt - Et) + w.z * Lt + H.z * Et;
if (isFinite($t))
return $t;
}
return 1 / 0;
}
{
let p = 1 / 0;
for (const g of c)
p = Math.min(p, g.z);
return p;
}
}
const stt = V([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4), { members: att } = stt, ltt = V([{ name: "a_uv_x", components: 1, type: "Float32" }, { name: "a_split_index", components: 1, type: "Float32" }]), { members: ctt } = ltt, utt = d6.VectorTileFeature.types, htt = Math.cos(Math.PI / 180 * 37.5), nC = Math.pow(2, 14) / 0.5;
class D_ {
constructor(c) {
this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((p) => p.id), this.index = c.index, this.hasPattern = !1, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach((p) => {
this.gradients[p.id] = {};
}), this.layoutVertexArray = new Il(), this.layoutVertexArray2 = new a6(), this.indexArray = new C2(), this.programConfigurations = new D0(c.layers, c.zoom), this.segments = new an(), this.maxLineLength = 0, this.stateDependentLayerIds = this.layers.filter((p) => p.isStateDependent()).map((p) => p.id);
}
populate(c, p, g) {
this.hasPattern = I_("line", this.layers, p);
const w = this.layers[0].layout.get("line-sort-key"), H = !w.isConstant(), A = [];
for (const { feature: C, id: N, index: z, sourceLayerIndex: W } of c) {
const X = this.layers[0]._featureFilter.needGeometry, tt = B0(C, X);
if (!this.layers[0]._featureFilter.filter(new ti(this.zoom), tt, g))
continue;
const at = H ? w.evaluate(tt, {}, g) : void 0, ut = { id: N, properties: C.properties, type: C.type, sourceLayerIndex: W, index: z, geometry: X ? tt.geometry : F0(C), patterns: {}, sortKey: at };
A.push(ut);
}
H && A.sort((C, N) => C.sortKey - N.sortKey);
for (const C of A) {
const { geometry: N, index: z, sourceLayerIndex: W } = C;
if (this.hasPattern) {
const X = P_("line", this.layers, C, this.zoom, p);
this.patternFeatures.push(X);
} else
this.addFeature(C, N, z, g, {});
p.featureIndex.insert(c[z].feature, N, z, W, this.index);
}
}
update(c, p, g) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(c, p, this.stateDependentLayers, g);
}
addFeatures(c, p, g) {
for (const w of this.patternFeatures)
this.addFeature(w, w.geometry, w.index, p, g);
}
isEmpty() {
return this.layoutVertexArray.length === 0;
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload;
}
upload(c) {
this.uploaded || (this.layoutVertexArray2.length !== 0 && (this.layoutVertexBuffer2 = c.createVertexBuffer(this.layoutVertexArray2, ctt)), this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, att), this.indexBuffer = c.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(c), this.uploaded = !0;
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy());
}
lineFeatureClips(c) {
if (c.properties && Object.prototype.hasOwnProperty.call(c.properties, "mapbox_clip_start") && Object.prototype.hasOwnProperty.call(c.properties, "mapbox_clip_end"))
return { start: +c.properties.mapbox_clip_start, end: +c.properties.mapbox_clip_end };
}
addFeature(c, p, g, w, H) {
const A = this.layers[0].layout, C = A.get("line-join").evaluate(c, {}), N = A.get("line-cap"), z = A.get("line-miter-limit"), W = A.get("line-round-limit");
this.lineClips = this.lineFeatureClips(c);
for (const X of p)
this.addLine(X, c, C, N, z, W);
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, c, g, H, w);
}
addLine(c, p, g, w, H, A) {
if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.lineClips) {
this.lineClipsArray.push(this.lineClips);
for (let Et = 0; Et < c.length - 1; Et++)
this.totalDistance += c[Et].dist(c[Et + 1]);
this.updateScaledDistance(), this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance);
}
const C = utt[p.type] === "Polygon";
let N = c.length;
for (; N >= 2 && c[N - 1].equals(c[N - 2]); )
N--;
let z = 0;
for (; z < N - 1 && c[z].equals(c[z + 1]); )
z++;
if (N < (C ? 3 : 2))
return;
g === "bevel" && (H = 1.05);
const W = this.overscaling <= 16 ? 15 * Zi / (512 * this.overscaling) : 0, X = this.segments.prepareSegment(10 * N, this.layoutVertexArray, this.indexArray);
let tt, at, ut, Tt, Lt;
this.e1 = this.e2 = -1, C && (tt = c[N - 2], Lt = c[z].sub(tt)._unit()._perp());
for (let Et = z; Et < N; Et++) {
if (ut = Et === N - 1 ? C ? c[z + 1] : void 0 : c[Et + 1], ut && c[Et].equals(ut))
continue;
Lt && (Tt = Lt), tt && (at = tt), tt = c[Et], Lt = ut ? ut.sub(tt)._unit()._perp() : Tt, Tt = Tt || Lt;
let $t = Tt.add(Lt);
$t.x === 0 && $t.y === 0 || $t._unit();
const Pt = Tt.x * Lt.x + Tt.y * Lt.y, Bt = $t.x * Lt.x + $t.y * Lt.y, ee = Bt !== 0 ? 1 / Bt : 1 / 0, _e = 2 * Math.sqrt(2 - 2 * Bt), Xe = Bt < htt && at && ut, Er = Tt.x * Lt.y - Tt.y * Lt.x > 0;
if (Xe && Et > z) {
const Qr = tt.dist(at);
if (Qr > 2 * W) {
const sr = tt.sub(tt.sub(at)._mult(W / Qr)._round());
this.updateDistance(at, sr), this.addCurrentVertex(sr, Tt, 0, 0, X), at = sr;
}
}
const ze = at && ut;
let Re = ze ? g : C ? "butt" : w;
if (ze && Re === "round" && (ee < A ? Re = "miter" : ee <= 2 && (Re = "fakeround")), Re === "miter" && ee > H && (Re = "bevel"), Re === "bevel" && (ee > 2 && (Re = "flipbevel"), ee < H && (Re = "miter")), at && this.updateDistance(at, tt), Re === "miter")
$t._mult(ee), this.addCurrentVertex(tt, $t, 0, 0, X);
else if (Re === "flipbevel") {
if (ee > 100)
$t = Lt.mult(-1);
else {
const Qr = ee * Tt.add(Lt).mag() / Tt.sub(Lt).mag();
$t._perp()._mult(Qr * (Er ? -1 : 1));
}
this.addCurrentVertex(tt, $t, 0, 0, X), this.addCurrentVertex(tt, $t.mult(-1), 0, 0, X);
} else if (Re === "bevel" || Re === "fakeround") {
const Qr = -Math.sqrt(ee * ee - 1), sr = Er ? Qr : 0, rr = Er ? 0 : Qr;
if (at && this.addCurrentVertex(tt, Tt, sr, rr, X), Re === "fakeround") {
const ue = Math.round(180 * _e / Math.PI / 20);
for (let gr = 1; gr < ue; gr++) {
let pr = gr / ue;
if (pr !== 0.5) {
const Fn = pr - 0.5;
pr += pr * Fn * (pr - 1) * ((1.0904 + Pt * (Pt * (3.55645 - 1.43519 * Pt) - 3.2452)) * Fn * Fn + (0.848013 + Pt * (0.215638 * Pt - 1.06021)));
}
const Ir = Lt.sub(Tt)._mult(pr)._add(Tt)._unit()._mult(Er ? -1 : 1);
this.addHalfVertex(tt, Ir.x, Ir.y, !1, Er, 0, X);
}
}
ut && this.addCurrentVertex(tt, Lt, -sr, -rr, X);
} else if (Re === "butt")
this.addCurrentVertex(tt, $t, 0, 0, X);
else if (Re === "square") {
const Qr = at ? 1 : -1;
this.addCurrentVertex(tt, $t, Qr, Qr, X);
} else
Re === "round" && (at && (this.addCurrentVertex(tt, Tt, 0, 0, X), this.addCurrentVertex(tt, Tt, 1, 1, X, !0)), ut && (this.addCurrentVertex(tt, Lt, -1, -1, X, !0), this.addCurrentVertex(tt, Lt, 0, 0, X)));
if (Xe && Et < N - 1) {
const Qr = tt.dist(ut);
if (Qr > 2 * W) {
const sr = tt.add(ut.sub(tt)._mult(W / Qr)._round());
this.updateDistance(tt, sr), this.addCurrentVertex(sr, Lt, 0, 0, X), tt = sr;
}
}
}
}
addCurrentVertex(c, p, g, w, H, A = !1) {
const C = p.y * w - p.x, N = -p.y - p.x * w;
this.addHalfVertex(c, p.x + p.y * g, p.y - p.x * g, A, !1, g, H), this.addHalfVertex(c, C, N, A, !0, -w, H), this.distance > nC / 2 && this.totalDistance === 0 && (this.distance = 0, this.updateScaledDistance(), this.addCurrentVertex(c, p, g, w, H, A));
}
addHalfVertex({ x: c, y: p }, g, w, H, A, C, N) {
const z = 0.5 * (this.lineClips ? this.scaledDistance * (nC - 1) : this.scaledDistance);
this.layoutVertexArray.emplaceBack((c << 1) + (H ? 1 : 0), (p << 1) + (A ? 1 : 0), Math.round(63 * g) + 128, Math.round(63 * w) + 128, 1 + (C === 0 ? 0 : C < 0 ? -1 : 1) | (63 & z) << 2, z >> 6), this.lineClips && this.layoutVertexArray2.emplaceBack((this.scaledDistance - this.lineClips.start) / (this.lineClips.end - this.lineClips.start), this.lineClipsArray.length);
const W = N.vertexLength++;
this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, W), N.primitiveLength++), A ? this.e2 = W : this.e1 = W;
}
updateScaledDistance() {
this.scaledDistance = this.lineClips ? this.lineClips.start + (this.lineClips.end - this.lineClips.start) * this.distance / this.totalDistance : this.distance;
}
updateDistance(c, p) {
this.distance += c.dist(p), this.updateScaledDistance();
}
}
let iC, oC;
nr("LineBucket", D_, { omit: ["layers", "patternFeatures"] });
var sC = { get paint() {
return oC = oC || new S({ "line-opacity": new Mr(Ct.paint_line["line-opacity"]), "line-color": new Mr(Ct.paint_line["line-color"]), "line-translate": new cr(Ct.paint_line["line-translate"]), "line-translate-anchor": new cr(Ct.paint_line["line-translate-anchor"]), "line-width": new Mr(Ct.paint_line["line-width"]), "line-gap-width": new Mr(Ct.paint_line["line-gap-width"]), "line-offset": new Mr(Ct.paint_line["line-offset"]), "line-blur": new Mr(Ct.paint_line["line-blur"]), "line-dasharray": new kl(Ct.paint_line["line-dasharray"]), "line-pattern": new Cl(Ct.paint_line["line-pattern"]), "line-gradient": new Bc(Ct.paint_line["line-gradient"]) });
}, get layout() {
return iC = iC || new S({ "line-cap": new cr(Ct.layout_line["line-cap"]), "line-join": new Mr(Ct.layout_line["line-join"]), "line-miter-limit": new cr(Ct.layout_line["line-miter-limit"]), "line-round-limit": new cr(Ct.layout_line["line-round-limit"]), "line-sort-key": new Mr(Ct.layout_line["line-sort-key"]) });
} };
class dtt extends Mr {
possiblyEvaluate(c, p) {
return p = new ti(Math.floor(p.zoom), { now: p.now, fadeDuration: p.fadeDuration, zoomHistory: p.zoomHistory, transition: p.transition }), super.possiblyEvaluate(c, p);
}
evaluate(c, p, g, w) {
return p = $({}, p, { zoom: Math.floor(p.zoom) }), super.evaluate(c, p, g, w);
}
}
let Ip;
class ptt extends m {
constructor(c) {
super(c, sC), this.gradientVersion = 0, Ip || (Ip = new dtt(sC.paint.properties["line-width"].specification), Ip.useIntegerZoom = !0);
}
_handleSpecialPaintPropertyUpdate(c) {
if (c === "line-gradient") {
const p = this.gradientExpression();
this.stepInterpolant = !!function(g) {
return g._styleExpression !== void 0;
}(p) && p._styleExpression.expression instanceof qt, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER;
}
}
gradientExpression() {
return this._transitionablePaint._values["line-gradient"].value.expression;
}
recalculate(c, p) {
super.recalculate(c, p), this.paint._values["line-floorwidth"] = Ip.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, c);
}
createBucket(c) {
return new D_(c);
}
queryRadius(c) {
const p = c, g = aC(Uc("line-width", this, p), Uc("line-gap-width", this, p)), w = Uc("line-offset", this, p);
return g / 2 + Math.abs(w) + Sp(this.paint.get("line-translate"));
}
queryIntersectsFeature(c, p, g, w, H, A, C) {
const N = Hp(c, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), A.angle, C), z = C / 2 * aC(this.paint.get("line-width").evaluate(p, g), this.paint.get("line-gap-width").evaluate(p, g)), W = this.paint.get("line-offset").evaluate(p, g);
return W && (w = function(X, tt) {
const at = [];
for (let ut = 0; ut < X.length; ut++) {
const Tt = X[ut], Lt = [];
for (let Et = 0; Et < Tt.length; Et++) {
const $t = Tt[Et - 1], Pt = Tt[Et], Bt = Tt[Et + 1], ee = Et === 0 ? new f(0, 0) : Pt.sub($t)._unit()._perp(), _e = Et === Tt.length - 1 ? new f(0, 0) : Bt.sub(Pt)._unit()._perp(), Xe = ee._add(_e)._unit(), Er = Xe.x * _e.x + Xe.y * _e.y;
Er !== 0 && Xe._mult(1 / Er), Lt.push(Xe._mult(tt)._add(Pt));
}
at.push(Lt);
}
return at;
}(w, W * C)), function(X, tt, at) {
for (let ut = 0; ut < tt.length; ut++) {
const Tt = tt[ut];
if (X.length >= 3) {
for (let Lt = 0; Lt < Tt.length; Lt++)
if (Fl(X, Tt[Lt]))
return !0;
}
if (bJ(X, Tt, at))
return !0;
}
return !1;
}(N, w, z);
}
isTileClipped() {
return !0;
}
}
function aC(h, c) {
return c > 0 ? c + 2 * h : h;
}
const Ttt = V([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), ftt = V([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4);
V([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4);
const Qtt = V([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }, { name: "a_box_real", components: 2, type: "Int16" }]);
V([{ 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 lC = V([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), mtt = V([{ name: "a_pos", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4);
function gtt(h, c, p) {
return h.sections.forEach((g) => {
g.text = function(w, H, A) {
const C = H.layout.get("text-transform").evaluate(A, {});
return C === "uppercase" ? w = w.toLocaleUpperCase() : C === "lowercase" && (w = w.toLocaleLowerCase()), Vo.applyArabicShaping && (w = Vo.applyArabicShaping(w)), w;
}(g.text, c, p);
}), h;
}
V([{ name: "triangle", components: 3, type: "Uint16" }]), V([{ 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" }]), V([{ 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" }]), V([{ type: "Float32", name: "offsetX" }]), V([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]), V([{ type: "Uint16", name: "textAnchor" }, { type: "Float32", components: 2, name: "textOffset" }]);
const Yc = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" };
var r1 = 24, cC = In, uC = function(h, c, p, g, w) {
var H, A, C = 8 * w - g - 1, N = (1 << C) - 1, z = N >> 1, W = -7, X = w - 1, tt = -1, at = h[c + X];
for (X += tt, H = at & (1 << -W) - 1, at >>= -W, W += C; W > 0; H = 256 * H + h[c + X], X += tt, W -= 8)
;
for (A = H & (1 << -W) - 1, H >>= -W, W += g; W > 0; A = 256 * A + h[c + X], X += tt, W -= 8)
;
if (H === 0)
H = 1 - z;
else {
if (H === N)
return A ? NaN : 1 / 0 * (at ? -1 : 1);
A += Math.pow(2, g), H -= z;
}
return (at ? -1 : 1) * A * Math.pow(2, H - g);
}, hC = function(h, c, p, g, w, H) {
var A, C, N, z = 8 * H - w - 1, W = (1 << z) - 1, X = W >> 1, tt = w === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, at = 0, ut = 1, Tt = c < 0 || c === 0 && 1 / c < 0 ? 1 : 0;
for (c = Math.abs(c), isNaN(c) || c === 1 / 0 ? (C = isNaN(c) ? 1 : 0, A = W) : (A = Math.floor(Math.log(c) / Math.LN2), c * (N = Math.pow(2, -A)) < 1 && (A--, N *= 2), (c += A + X >= 1 ? tt / N : tt * Math.pow(2, 1 - X)) * N >= 2 && (A++, N /= 2), A + X >= W ? (C = 0, A = W) : A + X >= 1 ? (C = (c * N - 1) * Math.pow(2, w), A += X) : (C = c * Math.pow(2, X - 1) * Math.pow(2, w), A = 0)); w >= 8; h[p + at] = 255 & C, at += ut, C /= 256, w -= 8)
;
for (A = A << w | C, z += w; z > 0; h[p + at] = 255 & A, at += ut, A /= 256, z -= 8)
;
h[p + at - ut] |= 128 * Tt;
};
function In(h) {
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(h) ? h : new Uint8Array(h || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
}
In.Varint = 0, In.Fixed64 = 1, In.Bytes = 2, In.Fixed32 = 5;
var F_ = 4294967296, dC = 1 / F_, pC = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
function z3(h) {
return h.type === In.Bytes ? h.readVarint() + h.pos : h.pos + 1;
}
function ytt(h, c, p) {
return p ? 4294967296 * c + (h >>> 0) : 4294967296 * (c >>> 0) + (h >>> 0);
}
function TC(h, c, p) {
var g = c <= 16383 ? 1 : c <= 2097151 ? 2 : c <= 268435455 ? 3 : Math.floor(Math.log(c) / (7 * Math.LN2));
p.realloc(g);
for (var w = p.pos - 1; w >= h; w--)
p.buf[w + g] = p.buf[w];
}
function vtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeVarint(h[p]);
}
function _tt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSVarint(h[p]);
}
function btt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFloat(h[p]);
}
function Ltt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeDouble(h[p]);
}
function wtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeBoolean(h[p]);
}
function xtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFixed32(h[p]);
}
function Ett(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSFixed32(h[p]);
}
function Mtt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeFixed64(h[p]);
}
function Stt(h, c) {
for (var p = 0; p < h.length; p++)
c.writeSFixed64(h[p]);
}
function Pp(h, c) {
return (h[c] | h[c + 1] << 8 | h[c + 2] << 16) + 16777216 * h[c + 3];
}
function Ul(h, c, p) {
h[p] = c, h[p + 1] = c >>> 8, h[p + 2] = c >>> 16, h[p + 3] = c >>> 24;
}
function fC(h, c) {
return (h[c] | h[c + 1] << 8 | h[c + 2] << 16) + (h[c + 3] << 24);
}
In.prototype = { destroy: function() {
this.buf = null;
}, readFields: function(h, c, p) {
for (p = p || this.length; this.pos < p; ) {
var g = this.readVarint(), w = g >> 3, H = this.pos;
this.type = 7 & g, h(w, c, this), this.pos === H && this.skip(g);
}
return c;
}, readMessage: function(h, c) {
return this.readFields(h, c, this.readVarint() + this.pos);
}, readFixed32: function() {
var h = Pp(this.buf, this.pos);
return this.pos += 4, h;
}, readSFixed32: function() {
var h = fC(this.buf, this.pos);
return this.pos += 4, h;
}, readFixed64: function() {
var h = Pp(this.buf, this.pos) + Pp(this.buf, this.pos + 4) * F_;
return this.pos += 8, h;
}, readSFixed64: function() {
var h = Pp(this.buf, this.pos) + fC(this.buf, this.pos + 4) * F_;
return this.pos += 8, h;
}, readFloat: function() {
var h = uC(this.buf, this.pos, !0, 23, 4);
return this.pos += 4, h;
}, readDouble: function() {
var h = uC(this.buf, this.pos, !0, 52, 8);
return this.pos += 8, h;
}, readVarint: function(h) {
var c, p, g = this.buf;
return c = 127 & (p = g[this.pos++]), p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 7, p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 14, p < 128 ? c : (c |= (127 & (p = g[this.pos++])) << 21, p < 128 ? c : function(w, H, A) {
var C, N, z = A.buf;
if (C = (112 & (N = z[A.pos++])) >> 4, N < 128 || (C |= (127 & (N = z[A.pos++])) << 3, N < 128) || (C |= (127 & (N = z[A.pos++])) << 10, N < 128) || (C |= (127 & (N = z[A.pos++])) << 17, N < 128) || (C |= (127 & (N = z[A.pos++])) << 24, N < 128) || (C |= (1 & (N = z[A.pos++])) << 31, N < 128))
return ytt(w, C, H);
throw new Error("Expected varint not more than 10 bytes");
}(c |= (15 & (p = g[this.pos])) << 28, h, this))));
}, readVarint64: function() {
return this.readVarint(!0);
}, readSVarint: function() {
var h = this.readVarint();
return h % 2 == 1 ? (h + 1) / -2 : h / 2;
}, readBoolean: function() {
return !!this.readVarint();
}, readString: function() {
var h = this.readVarint() + this.pos, c = this.pos;
return this.pos = h, h - c >= 12 && pC ? function(p, g, w) {
return pC.decode(p.subarray(g, w));
}(this.buf, c, h) : function(p, g, w) {
for (var H = "", A = g; A < w; ) {
var C, N, z, W = p[A], X = null, tt = W > 239 ? 4 : W > 223 ? 3 : W > 191 ? 2 : 1;
if (A + tt > w)
break;
tt === 1 ? W < 128 && (X = W) : tt === 2 ? (192 & (C = p[A + 1])) == 128 && (X = (31 & W) << 6 | 63 & C) <= 127 && (X = null) : tt === 3 ? (N = p[A + 2], (192 & (C = p[A + 1])) == 128 && (192 & N) == 128 && ((X = (15 & W) << 12 | (63 & C) << 6 | 63 & N) <= 2047 || X >= 55296 && X <= 57343) && (X = null)) : tt === 4 && (N = p[A + 2], z = p[A + 3], (192 & (C = p[A + 1])) == 128 && (192 & N) == 128 && (192 & z) == 128 && ((X = (15 & W) << 18 | (63 & C) << 12 | (63 & N) << 6 | 63 & z) <= 65535 || X >= 1114112) && (X = null)), X === null ? (X = 65533, tt = 1) : X > 65535 && (X -= 65536, H += String.fromCharCode(X >>> 10 & 1023 | 55296), X = 56320 | 1023 & X), H += String.fromCharCode(X), A += tt;
}
return H;
}(this.buf, c, h);
}, readBytes: function() {
var h = this.readVarint() + this.pos, c = this.buf.subarray(this.pos, h);
return this.pos = h, c;
}, readPackedVarint: function(h, c) {
if (this.type !== In.Bytes)
return h.push(this.readVarint(c));
var p = z3(this);
for (h = h || []; this.pos < p; )
h.push(this.readVarint(c));
return h;
}, readPackedSVarint: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSVarint());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSVarint());
return h;
}, readPackedBoolean: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readBoolean());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readBoolean());
return h;
}, readPackedFloat: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFloat());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFloat());
return h;
}, readPackedDouble: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readDouble());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readDouble());
return h;
}, readPackedFixed32: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFixed32());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFixed32());
return h;
}, readPackedSFixed32: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSFixed32());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSFixed32());
return h;
}, readPackedFixed64: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readFixed64());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readFixed64());
return h;
}, readPackedSFixed64: function(h) {
if (this.type !== In.Bytes)
return h.push(this.readSFixed64());
var c = z3(this);
for (h = h || []; this.pos < c; )
h.push(this.readSFixed64());
return h;
}, skip: function(h) {
var c = 7 & h;
if (c === In.Varint)
for (; this.buf[this.pos++] > 127; )
;
else if (c === In.Bytes)
this.pos = this.readVarint() + this.pos;
else if (c === In.Fixed32)
this.pos += 4;
else {
if (c !== In.Fixed64)
throw new Error("Unimplemented type: " + c);
this.pos += 8;
}
}, writeTag: function(h, c) {
this.writeVarint(h << 3 | c);
}, realloc: function(h) {
for (var c = this.length || 16; c < this.pos + h; )
c *= 2;
if (c !== this.length) {
var p = new Uint8Array(c);
p.set(this.buf), this.buf = p, this.length = c;
}
}, finish: function() {
return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
}, writeFixed32: function(h) {
this.realloc(4), Ul(this.buf, h, this.pos), this.pos += 4;
}, writeSFixed32: function(h) {
this.realloc(4), Ul(this.buf, h, this.pos), this.pos += 4;
}, writeFixed64: function(h) {
this.realloc(8), Ul(this.buf, -1 & h, this.pos), Ul(this.buf, Math.floor(h * dC), this.pos + 4), this.pos += 8;
}, writeSFixed64: function(h) {
this.realloc(8), Ul(this.buf, -1 & h, this.pos), Ul(this.buf, Math.floor(h * dC), this.pos + 4), this.pos += 8;
}, writeVarint: function(h) {
(h = +h || 0) > 268435455 || h < 0 ? function(c, p) {
var g, w;
if (c >= 0 ? (g = c % 4294967296 | 0, w = c / 4294967296 | 0) : (w = ~(-c / 4294967296), 4294967295 ^ (g = ~(-c % 4294967296)) ? g = g + 1 | 0 : (g = 0, w = w + 1 | 0)), c >= 18446744073709552e3 || c < -18446744073709552e3)
throw new Error("Given varint doesn't fit into 10 bytes");
p.realloc(10), function(H, A, C) {
C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, H >>>= 7, C.buf[C.pos++] = 127 & H | 128, C.buf[C.pos] = 127 & (H >>>= 7);
}(g, 0, p), function(H, A) {
var C = (7 & H) << 4;
A.buf[A.pos++] |= C | ((H >>>= 3) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H | ((H >>>= 7) ? 128 : 0), H && (A.buf[A.pos++] = 127 & H)))));
}(w, p);
}(h, this) : (this.realloc(4), this.buf[this.pos++] = 127 & h | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = 127 & (h >>>= 7) | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = 127 & (h >>>= 7) | (h > 127 ? 128 : 0), h <= 127 || (this.buf[this.pos++] = h >>> 7 & 127))));
}, writeSVarint: function(h) {
this.writeVarint(h < 0 ? 2 * -h - 1 : 2 * h);
}, writeBoolean: function(h) {
this.writeVarint(!!h);
}, writeString: function(h) {
h = String(h), this.realloc(4 * h.length), this.pos++;
var c = this.pos;
this.pos = function(g, w, H) {
for (var A, C, N = 0; N < w.length; N++) {
if ((A = w.charCodeAt(N)) > 55295 && A < 57344) {
if (!C) {
A > 56319 || N + 1 === w.length ? (g[H++] = 239, g[H++] = 191, g[H++] = 189) : C = A;
continue;
}
if (A < 56320) {
g[H++] = 239, g[H++] = 191, g[H++] = 189, C = A;
continue;
}
A = C - 55296 << 10 | A - 56320 | 65536, C = null;
} else
C && (g[H++] = 239, g[H++] = 191, g[H++] = 189, C = null);
A < 128 ? g[H++] = A : (A < 2048 ? g[H++] = A >> 6 | 192 : (A < 65536 ? g[H++] = A >> 12 | 224 : (g[H++] = A >> 18 | 240, g[H++] = A >> 12 & 63 | 128), g[H++] = A >> 6 & 63 | 128), g[H++] = 63 & A | 128);
}
return H;
}(this.buf, h, this.pos);
var p = this.pos - c;
p >= 128 && TC(c, p, this), this.pos = c - 1, this.writeVarint(p), this.pos += p;
}, writeFloat: function(h) {
this.realloc(4), hC(this.buf, h, this.pos, !0, 23, 4), this.pos += 4;
}, writeDouble: function(h) {
this.realloc(8), hC(this.buf, h, this.pos, !0, 52, 8), this.pos += 8;
}, writeBytes: function(h) {
var c = h.length;
this.writeVarint(c), this.realloc(c);
for (var p = 0; p < c; p++)
this.buf[this.pos++] = h[p];
}, writeRawMessage: function(h, c) {
this.pos++;
var p = this.pos;
h(c, this);
var g = this.pos - p;
g >= 128 && TC(p, g, this), this.pos = p - 1, this.writeVarint(g), this.pos += g;
}, writeMessage: function(h, c, p) {
this.writeTag(h, In.Bytes), this.writeRawMessage(c, p);
}, writePackedVarint: function(h, c) {
c.length && this.writeMessage(h, vtt, c);
}, writePackedSVarint: function(h, c) {
c.length && this.writeMessage(h, _tt, c);
}, writePackedBoolean: function(h, c) {
c.length && this.writeMessage(h, wtt, c);
}, writePackedFloat: function(h, c) {
c.length && this.writeMessage(h, btt, c);
}, writePackedDouble: function(h, c) {
c.length && this.writeMessage(h, Ltt, c);
}, writePackedFixed32: function(h, c) {
c.length && this.writeMessage(h, xtt, c);
}, writePackedSFixed32: function(h, c) {
c.length && this.writeMessage(h, Ett, c);
}, writePackedFixed64: function(h, c) {
c.length && this.writeMessage(h, Mtt, c);
}, writePackedSFixed64: function(h, c) {
c.length && this.writeMessage(h, Stt, c);
}, writeBytesField: function(h, c) {
this.writeTag(h, In.Bytes), this.writeBytes(c);
}, writeFixed32Field: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeFixed32(c);
}, writeSFixed32Field: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeSFixed32(c);
}, writeFixed64Field: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeFixed64(c);
}, writeSFixed64Field: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeSFixed64(c);
}, writeVarintField: function(h, c) {
this.writeTag(h, In.Varint), this.writeVarint(c);
}, writeSVarintField: function(h, c) {
this.writeTag(h, In.Varint), this.writeSVarint(c);
}, writeStringField: function(h, c) {
this.writeTag(h, In.Bytes), this.writeString(c);
}, writeFloatField: function(h, c) {
this.writeTag(h, In.Fixed32), this.writeFloat(c);
}, writeDoubleField: function(h, c) {
this.writeTag(h, In.Fixed64), this.writeDouble(c);
}, writeBooleanField: function(h, c) {
this.writeVarintField(h, !!c);
} };
var B_ = u(cC);
const j_ = 3;
function Htt(h, c, p) {
h === 1 && p.readMessage(Att, c);
}
function Att(h, c, p) {
if (h === 3) {
const { id: g, bitmap: w, width: H, height: A, left: C, top: N, advance: z } = p.readMessage(Ott, {});
c.push({ id: g, bitmap: new $c({ width: H + 2 * j_, height: A + 2 * j_ }, w), metrics: { width: H, height: A, left: C, top: N, advance: z } });
}
}
function Ott(h, c, p) {
h === 1 ? c.id = p.readVarint() : h === 2 ? c.bitmap = p.readBytes() : h === 3 ? c.width = p.readVarint() : h === 4 ? c.height = p.readVarint() : h === 5 ? c.left = p.readSVarint() : h === 6 ? c.top = p.readSVarint() : h === 7 && (c.advance = p.readVarint());
}
const QC = j_;
function mC(h) {
let c = 0, p = 0;
for (const A of h)
c += A.w * A.h, p = Math.max(p, A.w);
h.sort((A, C) => C.h - A.h);
const g = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(c / 0.95)), p), h: 1 / 0 }];
let w = 0, H = 0;
for (const A of h)
for (let C = g.length - 1; C >= 0; C--) {
const N = g[C];
if (!(A.w > N.w || A.h > N.h)) {
if (A.x = N.x, A.y = N.y, H = Math.max(H, A.y + A.h), w = Math.max(w, A.x + A.w), A.w === N.w && A.h === N.h) {
const z = g.pop();
C < g.length && (g[C] = z);
} else
A.h === N.h ? (N.x += A.w, N.w -= A.w) : A.w === N.w ? (N.y += A.h, N.h -= A.h) : (g.push({ x: N.x + A.w, y: N.y, w: N.w - A.w, h: A.h }), N.y += A.h, N.h -= A.h);
break;
}
}
return { w, h: H, fill: c / (w * H) || 0 };
}
const No = 1;
class z_ {
constructor(c, { pixelRatio: p, version: g, stretchX: w, stretchY: H, content: A, textFitWidth: C, textFitHeight: N }) {
this.paddedRect = c, this.pixelRatio = p, this.stretchX = w, this.stretchY = H, this.content = A, this.version = g, this.textFitWidth = C, this.textFitHeight = N;
}
get tl() {
return [this.paddedRect.x + No, this.paddedRect.y + No];
}
get br() {
return [this.paddedRect.x + this.paddedRect.w - No, this.paddedRect.y + this.paddedRect.h - No];
}
get tlbr() {
return this.tl.concat(this.br);
}
get displaySize() {
return [(this.paddedRect.w - 2 * No) / this.pixelRatio, (this.paddedRect.h - 2 * No) / this.pixelRatio];
}
}
class gC {
constructor(c, p) {
const g = {}, w = {};
this.haveRenderCallbacks = [];
const H = [];
this.addImages(c, g, H), this.addImages(p, w, H);
const { w: A, h: C } = mC(H), N = new k2({ width: A || 1, height: C || 1 });
for (const z in c) {
const W = c[z], X = g[z].paddedRect;
k2.copy(W.data, N, { x: 0, y: 0 }, { x: X.x + No, y: X.y + No }, W.data);
}
for (const z in p) {
const W = p[z], X = w[z].paddedRect, tt = X.x + No, at = X.y + No, ut = W.data.width, Tt = W.data.height;
k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt, y: at }, W.data), k2.copy(W.data, N, { x: 0, y: Tt - 1 }, { x: tt, y: at - 1 }, { width: ut, height: 1 }), k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt, y: at + Tt }, { width: ut, height: 1 }), k2.copy(W.data, N, { x: ut - 1, y: 0 }, { x: tt - 1, y: at }, { width: 1, height: Tt }), k2.copy(W.data, N, { x: 0, y: 0 }, { x: tt + ut, y: at }, { width: 1, height: Tt });
}
this.image = N, this.iconPositions = g, this.patternPositions = w;
}
addImages(c, p, g) {
for (const w in c) {
const H = c[w], A = { x: 0, y: 0, w: H.data.width + 2 * No, h: H.data.height + 2 * No };
g.push(A), p[w] = new z_(A, H), H.hasRenderCallback && this.haveRenderCallbacks.push(w);
}
}
patchUpdatedImages(c, p) {
c.dispatchRenderCallbacks(this.haveRenderCallbacks);
for (const g in c.updatedImages)
this.patchUpdatedImage(this.iconPositions[g], c.getImage(g), p), this.patchUpdatedImage(this.patternPositions[g], c.getImage(g), p);
}
patchUpdatedImage(c, p, g) {
if (!c || !p || c.version === p.version)
return;
c.version = p.version;
const [w, H] = c.tl;
g.update(p.data, void 0, { x: w, y: H });
}
}
var p6;
nr("ImagePosition", z_), nr("ImageAtlas", gC), s.ah = void 0, (p6 = s.ah || (s.ah = {}))[p6.none = 0] = "none", p6[p6.horizontal = 1] = "horizontal", p6[p6.vertical = 2] = "vertical", p6[p6.horizontalOnly = 3] = "horizontalOnly";
const Jc = -17;
class tu {
constructor() {
this.scale = 1, this.fontStack = "", this.imageName = null;
}
static forText(c, p) {
const g = new tu();
return g.scale = c || 1, g.fontStack = p, g;
}
static forImage(c) {
const p = new tu();
return p.imageName = c, p;
}
}
class Gl {
constructor() {
this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null;
}
static fromFeature(c, p) {
const g = new Gl();
for (let w = 0; w < c.sections.length; w++) {
const H = c.sections[w];
H.image ? g.addImageSection(H) : g.addTextSection(H, p);
}
return g;
}
length() {
return this.text.length;
}
getSection(c) {
return this.sections[this.sectionIndex[c]];
}
getSectionIndex(c) {
return this.sectionIndex[c];
}
getCharCode(c) {
return this.text.charCodeAt(c);
}
verticalizePunctuation() {
this.text = function(c) {
let p = "";
for (let g = 0; g < c.length; g++) {
const w = c.charCodeAt(g + 1) || null, H = c.charCodeAt(g - 1) || null;
p += w && _p(w) && !Yc[c[g + 1]] || H && _p(H) && !Yc[c[g - 1]] || !Yc[c[g]] ? c[g] : Yc[c[g]];
}
return p;
}(this.text);
}
trim() {
let c = 0;
for (let g = 0; g < this.text.length && Rp[this.text.charCodeAt(g)]; g++)
c++;
let p = this.text.length;
for (let g = this.text.length - 1; g >= 0 && g >= c && Rp[this.text.charCodeAt(g)]; g--)
p--;
this.text = this.text.substring(c, p), this.sectionIndex = this.sectionIndex.slice(c, p);
}
substring(c, p) {
const g = new Gl();
return g.text = this.text.substring(c, p), g.sectionIndex = this.sectionIndex.slice(c, p), g.sections = this.sections, g;
}
toString() {
return this.text;
}
getMaxScale() {
return this.sectionIndex.reduce((c, p) => Math.max(c, this.sections[p].scale), 0);
}
addTextSection(c, p) {
this.text += c.text, this.sections.push(tu.forText(c.scale, c.fontStack || p));
const g = this.sections.length - 1;
for (let w = 0; w < c.text.length; ++w)
this.sectionIndex.push(g);
}
addImageSection(c) {
const p = c.image ? c.image.name : "";
if (p.length === 0)
return void It("Can't add FormattedSection with an empty image.");
const g = this.getNextImageSectionCharCode();
g ? (this.text += String.fromCharCode(g), this.sections.push(tu.forImage(p)), this.sectionIndex.push(this.sections.length - 1)) : It("Reached maximum number of images 6401");
}
getNextImageSectionCharCode() {
return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID);
}
}
function Vp(h, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut) {
const Tt = Gl.fromFeature(h, w);
let Lt;
X === s.ah.vertical && Tt.verticalizePunctuation();
const { processBidirectionalText: Et, processStyledBidirectionalText: $t } = Vo;
if (Et && Tt.sections.length === 1) {
Lt = [];
const ee = Et(Tt.toString(), U_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Gl();
Xe.text = _e, Xe.sections = Tt.sections;
for (let Er = 0; Er < _e.length; Er++)
Xe.sectionIndex.push(0);
Lt.push(Xe);
}
} else if ($t) {
Lt = [];
const ee = $t(Tt.text, Tt.sectionIndex, U_(Tt, z, H, c, g, at));
for (const _e of ee) {
const Xe = new Gl();
Xe.text = _e[0], Xe.sectionIndex = _e[1], Xe.sections = Tt.sections, Lt.push(Xe);
}
} else
Lt = function(ee, _e) {
const Xe = [], Er = ee.text;
let ze = 0;
for (const Re of _e)
Xe.push(ee.substring(ze, Re)), ze = Re;
return ze < Er.length && Xe.push(ee.substring(ze, Er.length)), Xe;
}(Tt, U_(Tt, z, H, c, g, at));
const Pt = [], Bt = { positionedLines: Pt, text: Tt.toString(), top: W[1], bottom: W[1], left: W[0], right: W[0], writingMode: X, iconsInText: !1, verticalizable: !1 };
return function(ee, _e, Xe, Er, ze, Re, Qr, sr, rr, ue, gr, pr) {
let Ir = 0, Fn = Jc, Pn = 0, p1 = 0;
const gs = sr === "right" ? 1 : sr === "left" ? 0 : 0.5;
let V1 = 0;
for (const Oi of ze) {
Oi.trim();
const f1 = Oi.getMaxScale(), K1 = (f1 - 1) * r1, R1 = { positionedGlyphs: [], lineOffset: 0 };
ee.positionedLines[V1] = R1;
const bo = R1.positionedGlyphs;
let N1 = 0;
if (!Oi.length()) {
Fn += Re, ++V1;
continue;
}
for (let Do = 0; Do < Oi.length(); Do++) {
const fn = Oi.getSection(Do), Un = Oi.getSectionIndex(Do), ii = Oi.getCharCode(Do);
let a2 = 0, xi = null, ql = null, Ha = null, Aa = r1;
const ys = !(rr === s.ah.horizontal || !gr && !Dc(ii) || gr && (Rp[ii] || (T1 = ii, new RegExp("\\p{sc=Arab}", "u").test(String.fromCodePoint(T1)))));
if (fn.imageName) {
const V2 = Er[fn.imageName];
if (!V2)
continue;
Ha = fn.imageName, ee.iconsInText = ee.iconsInText || !0, ql = V2.paddedRect;
const L1 = V2.displaySize;
fn.scale = fn.scale * r1 / pr, xi = { width: L1[0], height: L1[1], left: No, top: -QC, advance: ys ? L1[1] : L1[0] }, a2 = K1 + (r1 - L1[1] * fn.scale), Aa = xi.advance;
const U3 = ys ? L1[0] * fn.scale - r1 * f1 : L1[1] * fn.scale - r1 * f1;
U3 > 0 && U3 > N1 && (N1 = U3);
} else {
const V2 = Xe[fn.fontStack], L1 = V2 && V2[ii];
if (L1 && L1.rect)
ql = L1.rect, xi = L1.metrics;
else {
const U3 = _e[fn.fontStack], su = U3 && U3[ii];
if (!su)
continue;
xi = su.metrics;
}
a2 = (f1 - fn.scale) * r1;
}
ys ? (ee.verticalizable = !0, bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Ir += Aa * fn.scale + ue) : (bo.push({ glyph: ii, imageName: Ha, x: Ir, y: Fn + a2, vertical: ys, scale: fn.scale, fontStack: fn.fontStack, sectionIndex: Un, metrics: xi, rect: ql }), Ir += xi.advance * fn.scale + ue);
}
bo.length !== 0 && (Pn = Math.max(Ir - ue, Pn), Ptt(bo, 0, bo.length - 1, gs, N1)), Ir = 0;
const P2 = Re * f1 + N1;
R1.lineOffset = Math.max(N1, K1), Fn += P2, p1 = Math.max(P2, p1), ++V1;
}
var T1;
const yo = Fn - Jc, { horizontalAlign: vo, verticalAlign: _o } = G_(Qr);
(function(Oi, f1, K1, R1, bo, N1, P2, Do, fn) {
const Un = (f1 - K1) * bo;
let ii = 0;
ii = N1 !== P2 ? -Do * R1 - Jc : (-R1 * fn + 0.5) * P2;
for (const a2 of Oi)
for (const xi of a2.positionedGlyphs)
xi.x += Un, xi.y += ii;
})(ee.positionedLines, gs, vo, _o, Pn, p1, Re, yo, ze.length), ee.top += -_o * yo, ee.bottom = ee.top + yo, ee.left += -vo * Pn, ee.right = ee.left + Pn;
}(Bt, c, p, g, Lt, A, C, N, X, z, tt, ut), !function(ee) {
for (const _e of ee)
if (_e.positionedGlyphs.length !== 0)
return !1;
return !0;
}(Pt) && Bt;
}
const Rp = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, Ctt = { 10: !0, 32: !0, 38: !0, 41: !0, 43: !0, 45: !0, 47: !0, 173: !0, 183: !0, 8203: !0, 8208: !0, 8211: !0, 8231: !0 }, ktt = { 40: !0 };
function yC(h, c, p, g, w, H) {
if (c.imageName) {
const A = g[c.imageName];
return A ? A.displaySize[0] * c.scale * r1 / H + w : 0;
}
{
const A = p[c.fontStack], C = A && A[h];
return C ? C.metrics.advance * c.scale + w : 0;
}
}
function vC(h, c, p, g) {
const w = Math.pow(h - c, 2);
return g ? h < c ? w / 2 : 2 * w : w + Math.abs(p) * p;
}
function Itt(h, c, p) {
let g = 0;
return h === 10 && (g -= 1e4), p && (g += 150), h !== 40 && h !== 65288 || (g += 50), c !== 41 && c !== 65289 || (g += 50), g;
}
function _C(h, c, p, g, w, H) {
let A = null, C = vC(c, p, w, H);
for (const N of g) {
const z = vC(c - N.x, p, w, H) + N.badness;
z <= C && (A = N, C = z);
}
return { index: h, x: c, priorBreak: A, badness: C };
}
function bC(h) {
return h ? bC(h.priorBreak).concat(h.index) : [];
}
function U_(h, c, p, g, w, H) {
if (!h)
return [];
const A = [], C = function(X, tt, at, ut, Tt, Lt) {
let Et = 0;
for (let $t = 0; $t < X.length(); $t++) {
const Pt = X.getSection($t);
Et += yC(X.getCharCode($t), Pt, ut, Tt, tt, Lt);
}
return Et / Math.max(1, Math.ceil(Et / at));
}(h, c, p, g, w, H), N = h.text.indexOf("") >= 0;
let z = 0;
for (let X = 0; X < h.length(); X++) {
const tt = h.getSection(X), at = h.getCharCode(X);
if (Rp[at] || (z += yC(at, tt, g, w, c, H)), X < h.length() - 1) {
const ut = !((W = at) < 11904) && (!!sn["CJK Compatibility Forms"](W) || !!sn["CJK Compatibility"](W) || !!sn["CJK Strokes"](W) || !!sn["CJK Symbols and Punctuation"](W) || !!sn["Enclosed CJK Letters and Months"](W) || !!sn["Halfwidth and Fullwidth Forms"](W) || !!sn["Ideographic Description Characters"](W) || !!sn["Vertical Forms"](W) || vp.test(String.fromCodePoint(W)));
(Ctt[at] || ut || tt.imageName || X !== h.length() - 2 && ktt[h.getCharCode(X + 1)]) && A.push(_C(X + 1, z, C, A, Itt(at, h.getCharCode(X + 1), ut && N), !1));
}
}
var W;
return bC(_C(h.length(), z, C, A, 0, !0));
}
function G_(h) {
let c = 0.5, p = 0.5;
switch (h) {
case "right":
case "top-right":
case "bottom-right":
c = 1;
break;
case "left":
case "top-left":
case "bottom-left":
c = 0;
}
switch (h) {
case "bottom":
case "bottom-right":
case "bottom-left":
p = 1;
break;
case "top":
case "top-right":
case "top-left":
p = 0;
}
return { horizontalAlign: c, verticalAlign: p };
}
function Ptt(h, c, p, g, w) {
if (!g && !w)
return;
const H = h[p], A = (h[p].x + H.metrics.advance * H.scale) * g;
for (let C = c; C <= p; C++)
h[C].x -= A, h[C].y += w;
}
function Vtt(h, c, p) {
const { horizontalAlign: g, verticalAlign: w } = G_(p), H = c[0] - h.displaySize[0] * g, A = c[1] - h.displaySize[1] * w;
return { image: h, top: A, bottom: A + h.displaySize[1], left: H, right: H + h.displaySize[0] };
}
function LC(h) {
var c, p;
let g = h.left, w = h.top, H = h.right - g, A = h.bottom - w;
const C = (c = h.image.textFitWidth) !== null && c !== void 0 ? c : "stretchOrShrink", N = (p = h.image.textFitHeight) !== null && p !== void 0 ? p : "stretchOrShrink", z = (h.image.content[2] - h.image.content[0]) / (h.image.content[3] - h.image.content[1]);
if (N === "proportional") {
if (C === "stretchOnly" && H / A < z || C === "proportional") {
const W = Math.ceil(A * z);
g *= W / H, H = W;
}
} else if (C === "proportional" && N === "stretchOnly" && z !== 0 && H / A > z) {
const W = Math.ceil(H / z);
w *= W / A, A = W;
}
return { x1: g, y1: w, x2: g + H, y2: w + A };
}
function wC(h, c, p, g, w, H) {
const A = h.image;
let C;
if (A.content) {
const Lt = A.content, Et = A.pixelRatio || 1;
C = [Lt[0] / Et, Lt[1] / Et, A.displaySize[0] - Lt[2] / Et, A.displaySize[1] - Lt[3] / Et];
}
const N = c.left * H, z = c.right * H;
let W, X, tt, at;
p === "width" || p === "both" ? (at = w[0] + N - g[3], X = w[0] + z + g[1]) : (at = w[0] + (N + z - A.displaySize[0]) / 2, X = at + A.displaySize[0]);
const ut = c.top * H, Tt = c.bottom * H;
return p === "height" || p === "both" ? (W = w[1] + ut - g[0], tt = w[1] + Tt + g[2]) : (W = w[1] + (ut + Tt - A.displaySize[1]) / 2, tt = W + A.displaySize[1]), { image: A, top: W, right: X, bottom: tt, left: at, collisionPadding: C };
}
const eu = 255, Sa = 128, T6 = eu * Sa;
function xC(h, c) {
const { expression: p } = c;
if (p.kind === "constant")
return { kind: "constant", layoutSize: p.evaluate(new ti(h + 1)) };
if (p.kind === "source")
return { kind: "source" };
{
const { zoomStops: g, interpolationType: w } = p;
let H = 0;
for (; H < g.length && g[H] <= h; )
H++;
H = Math.max(0, H - 1);
let A = H;
for (; A < g.length && g[A] < h + 1; )
A++;
A = Math.min(g.length - 1, A);
const C = g[H], N = g[A];
return p.kind === "composite" ? { kind: "composite", minZoom: C, maxZoom: N, interpolationType: w } : { kind: "camera", minZoom: C, maxZoom: N, minSize: p.evaluate(new ti(C)), maxSize: p.evaluate(new ti(N)), interpolationType: w };
}
}
function $_(h, c, p) {
let g = "never";
const w = h.get(c);
return w ? g = w : h.get(p) && (g = "always"), g;
}
const Rtt = d6.VectorTileFeature.types, Ntt = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }];
function Np(h, c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = C ? Math.min(T6, Math.round(C[0])) : 0, ut = C ? Math.min(T6, Math.round(C[1])) : 0;
h.emplaceBack(c, p, Math.round(32 * g), Math.round(32 * w), H, A, (at << 1) + (N ? 1 : 0), ut, 16 * z, 16 * W, 256 * X, 256 * tt);
}
function W_(h, c, p) {
h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p), h.emplaceBack(c.x, c.y, p);
}
function Dtt(h) {
for (const c of h.sections)
if (__(c.text))
return !0;
return !1;
}
class Z_ {
constructor(c) {
this.layoutVertexArray = new Pl(), this.indexArray = new C2(), this.programConfigurations = c, this.segments = new an(), this.dynamicLayoutVertexArray = new jc(), this.opacityVertexArray = new o2(), this.hasVisibleVertices = !1, this.placedSymbolArray = new ei();
}
isEmpty() {
return this.layoutVertexArray.length === 0 && this.indexArray.length === 0 && this.dynamicLayoutVertexArray.length === 0 && this.opacityVertexArray.length === 0;
}
upload(c, p, g, w) {
this.isEmpty() || (g && (this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, Ttt.members), this.indexBuffer = c.createIndexBuffer(this.indexArray, p), this.dynamicLayoutVertexBuffer = c.createVertexBuffer(this.dynamicLayoutVertexArray, ftt.members, !0), this.opacityVertexBuffer = c.createVertexBuffer(this.opacityVertexArray, Ntt, !0), this.opacityVertexBuffer.itemSize = 1), (g || w) && this.programConfigurations.upload(c));
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy());
}
}
nr("SymbolBuffers", Z_);
class q_ {
constructor(c, p, g) {
this.layoutVertexArray = new c(), this.layoutAttributes = p, this.indexArray = new g(), this.segments = new an(), this.collisionVertexArray = new Ea();
}
upload(c) {
this.layoutVertexBuffer = c.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = c.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = c.createVertexBuffer(this.collisionVertexArray, Qtt.members, !0);
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy());
}
}
nr("CollisionBuffers", q_);
class $l {
constructor(c) {
this.collisionBoxArray = c.collisionBoxArray, this.zoom = c.zoom, this.overscaling = c.overscaling, this.layers = c.layers, this.layerIds = this.layers.map((A) => A.id), this.index = c.index, this.pixelRatio = c.pixelRatio, this.sourceLayerIndex = c.sourceLayerIndex, this.hasPattern = !1, this.hasRTLText = !1, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = S_([]), this.placementViewportMatrix = S_([]);
const p = this.layers[0]._unevaluatedLayout._values;
this.textSizeData = xC(this.zoom, p["text-size"]), this.iconSizeData = xC(this.zoom, p["icon-size"]);
const g = this.layers[0].layout, w = g.get("symbol-sort-key"), H = g.get("symbol-z-order");
this.canOverlap = $_(g, "text-overlap", "text-allow-overlap") !== "never" || $_(g, "icon-overlap", "icon-allow-overlap") !== "never" || g.get("text-ignore-placement") || g.get("icon-ignore-placement"), this.sortFeaturesByKey = H !== "viewport-y" && !w.isConstant(), this.sortFeaturesByY = (H === "viewport-y" || H === "auto" && !this.sortFeaturesByKey) && this.canOverlap, g.get("symbol-placement") === "point" && (this.writingModes = g.get("text-writing-mode").map((A) => s.ah[A])), this.stateDependentLayerIds = this.layers.filter((A) => A.isStateDependent()).map((A) => A.id), this.sourceID = c.sourceID;
}
createArrays() {
this.text = new Z_(new D0(this.layers, this.zoom, (c) => /^text/.test(c))), this.icon = new Z_(new D0(this.layers, this.zoom, (c) => /^icon/.test(c))), this.glyphOffsetArray = new ri(), this.lineVertexArray = new C1(), this.symbolInstances = new nn(), this.textAnchorOffsets = new ni();
}
calculateGlyphDependencies(c, p, g, w, H) {
for (let A = 0; A < c.length; A++)
if (p[c.charCodeAt(A)] = !0, (g || w) && H) {
const C = Yc[c.charAt(A)];
C && (p[C.charCodeAt(0)] = !0);
}
}
populate(c, p, g) {
const w = this.layers[0], H = w.layout, A = H.get("text-font"), C = H.get("text-field"), N = H.get("icon-image"), z = (C.value.kind !== "constant" || C.value.value instanceof Xr && !C.value.value.isEmpty() || C.value.value.toString().length > 0) && (A.value.kind !== "constant" || A.value.value.length > 0), W = N.value.kind !== "constant" || !!N.value.value || Object.keys(N.parameters).length > 0, X = H.get("symbol-sort-key");
if (this.features = [], !z && !W)
return;
const tt = p.iconDependencies, at = p.glyphDependencies, ut = p.availableImages, Tt = new ti(this.zoom);
for (const { feature: Lt, id: Et, index: $t, sourceLayerIndex: Pt } of c) {
const Bt = w._featureFilter.needGeometry, ee = B0(Lt, Bt);
if (!w._featureFilter.filter(Tt, ee, g))
continue;
let _e, Xe;
if (Bt || (ee.geometry = F0(Lt)), z) {
const ze = w.getValueAndResolveTokens("text-field", ee, g, ut), Re = Xr.factory(ze), Qr = this.hasRTLText = this.hasRTLText || Dtt(Re);
(!Qr || Vo.getRTLTextPluginStatus() === "unavailable" || Qr && Vo.isParsed()) && (_e = gtt(Re, w, ee));
}
if (W) {
const ze = w.getValueAndResolveTokens("icon-image", ee, g, ut);
Xe = ze instanceof pn ? ze : pn.fromString(ze);
}
if (!_e && !Xe)
continue;
const Er = this.sortFeaturesByKey ? X.evaluate(ee, {}, g) : void 0;
if (this.features.push({ id: Et, text: _e, icon: Xe, index: $t, sourceLayerIndex: Pt, geometry: ee.geometry, properties: Lt.properties, type: Rtt[Lt.type], sortKey: Er }), Xe && (tt[Xe.name] = !0), _e) {
const ze = A.evaluate(ee, {}, g).join(","), Re = H.get("text-rotation-alignment") !== "viewport" && H.get("symbol-placement") !== "point";
this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(s.ah.vertical) >= 0;
for (const Qr of _e.sections)
if (Qr.image)
tt[Qr.image.name] = !0;
else {
const sr = Rc(_e.toString()), rr = Qr.fontStack || ze, ue = at[rr] = at[rr] || {};
this.calculateGlyphDependencies(Qr.text, ue, Re, this.allowVerticalPlacement, sr);
}
}
}
H.get("symbol-placement") === "line" && (this.features = function(Lt) {
const Et = {}, $t = {}, Pt = [];
let Bt = 0;
function ee(ze) {
Pt.push(Lt[ze]), Bt++;
}
function _e(ze, Re, Qr) {
const sr = $t[ze];
return delete $t[ze], $t[Re] = sr, Pt[sr].geometry[0].pop(), Pt[sr].geometry[0] = Pt[sr].geometry[0].concat(Qr[0]), sr;
}
function Xe(ze, Re, Qr) {
const sr = Et[Re];
return delete Et[Re], Et[ze] = sr, Pt[sr].geometry[0].shift(), Pt[sr].geometry[0] = Qr[0].concat(Pt[sr].geometry[0]), sr;
}
function Er(ze, Re, Qr) {
const sr = Qr ? Re[0][Re[0].length - 1] : Re[0][0];
return `${ze}:${sr.x}:${sr.y}`;
}
for (let ze = 0; ze < Lt.length; ze++) {
const Re = Lt[ze], Qr = Re.geometry, sr = Re.text ? Re.text.toString() : null;
if (!sr) {
ee(ze);
continue;
}
const rr = Er(sr, Qr), ue = Er(sr, Qr, !0);
if (rr in $t && ue in Et && $t[rr] !== Et[ue]) {
const gr = Xe(rr, ue, Qr), pr = _e(rr, ue, Pt[gr].geometry);
delete Et[rr], delete $t[ue], $t[Er(sr, Pt[pr].geometry, !0)] = pr, Pt[gr].geometry = null;
} else
rr in $t ? _e(rr, ue, Qr) : ue in Et ? Xe(rr, ue, Qr) : (ee(ze), Et[rr] = Bt - 1, $t[ue] = Bt - 1);
}
return Pt.filter((ze) => ze.geometry);
}(this.features)), this.sortFeaturesByKey && this.features.sort((Lt, Et) => Lt.sortKey - Et.sortKey);
}
update(c, p, g) {
this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(c, p, this.layers, g), this.icon.programConfigurations.updatePaintArrays(c, p, this.layers, g));
}
isEmpty() {
return this.symbolInstances.length === 0 && !this.hasRTLText;
}
uploadPending() {
return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload;
}
upload(c) {
!this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(c), this.iconCollisionBox.upload(c)), this.text.upload(c, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(c, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = !0;
}
destroyDebugData() {
this.textCollisionBox.destroy(), this.iconCollisionBox.destroy();
}
destroy() {
this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData();
}
addToLineVertexArray(c, p) {
const g = this.lineVertexArray.length;
if (c.segment !== void 0) {
let w = c.dist(p[c.segment + 1]), H = c.dist(p[c.segment]);
const A = {};
for (let C = c.segment + 1; C < p.length; C++)
A[C] = { x: p[C].x, y: p[C].y, tileUnitDistanceFromAnchor: w }, C < p.length - 1 && (w += p[C + 1].dist(p[C]));
for (let C = c.segment || 0; C >= 0; C--)
A[C] = { x: p[C].x, y: p[C].y, tileUnitDistanceFromAnchor: H }, C > 0 && (H += p[C - 1].dist(p[C]));
for (let C = 0; C < p.length; C++) {
const N = A[C];
this.lineVertexArray.emplaceBack(N.x, N.y, N.tileUnitDistanceFromAnchor);
}
}
return { lineStartIndex: g, lineLength: this.lineVertexArray.length - g };
}
addSymbols(c, p, g, w, H, A, C, N, z, W, X, tt) {
const at = c.indexArray, ut = c.layoutVertexArray, Tt = c.segments.prepareSegment(4 * p.length, ut, at, this.canOverlap ? A.sortKey : void 0), Lt = this.glyphOffsetArray.length, Et = Tt.vertexLength, $t = this.allowVerticalPlacement && C === s.ah.vertical ? Math.PI / 2 : 0, Pt = A.text && A.text.sections;
for (let Bt = 0; Bt < p.length; Bt++) {
const { tl: ee, tr: _e, bl: Xe, br: Er, tex: ze, pixelOffsetTL: Re, pixelOffsetBR: Qr, minFontScaleX: sr, minFontScaleY: rr, glyphOffset: ue, isSDF: gr, sectionIndex: pr } = p[Bt], Ir = Tt.vertexLength, Fn = ue[1];
Np(ut, N.x, N.y, ee.x, Fn + ee.y, ze.x, ze.y, g, gr, Re.x, Re.y, sr, rr), Np(ut, N.x, N.y, _e.x, Fn + _e.y, ze.x + ze.w, ze.y, g, gr, Qr.x, Re.y, sr, rr), Np(ut, N.x, N.y, Xe.x, Fn + Xe.y, ze.x, ze.y + ze.h, g, gr, Re.x, Qr.y, sr, rr), Np(ut, N.x, N.y, Er.x, Fn + Er.y, ze.x + ze.w, ze.y + ze.h, g, gr, Qr.x, Qr.y, sr, rr), W_(c.dynamicLayoutVertexArray, N, $t), at.emplaceBack(Ir, Ir + 1, Ir + 2), at.emplaceBack(Ir + 1, Ir + 2, Ir + 3), Tt.vertexLength += 4, Tt.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(ue[0]), Bt !== p.length - 1 && pr === p[Bt + 1].sectionIndex || c.programConfigurations.populatePaintArrays(ut.length, A, A.index, {}, tt, Pt && Pt[pr]);
}
c.placedSymbolArray.emplaceBack(N.x, N.y, Lt, this.glyphOffsetArray.length - Lt, Et, z, W, N.segment, g ? g[0] : 0, g ? g[1] : 0, w[0], w[1], C, 0, !1, 0, X);
}
_addCollisionDebugVertex(c, p, g, w, H, A) {
return p.emplaceBack(0, 0), c.emplaceBack(g.x, g.y, w, H, Math.round(A.x), Math.round(A.y));
}
addCollisionDebugVertices(c, p, g, w, H, A, C) {
const N = H.segments.prepareSegment(4, H.layoutVertexArray, H.indexArray), z = N.vertexLength, W = H.layoutVertexArray, X = H.collisionVertexArray, tt = C.anchorX, at = C.anchorY;
this._addCollisionDebugVertex(W, X, A, tt, at, new f(c, p)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(g, p)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(g, w)), this._addCollisionDebugVertex(W, X, A, tt, at, new f(c, w)), N.vertexLength += 4;
const ut = H.indexArray;
ut.emplaceBack(z, z + 1), ut.emplaceBack(z + 1, z + 2), ut.emplaceBack(z + 2, z + 3), ut.emplaceBack(z + 3, z), N.primitiveLength += 4;
}
addDebugCollisionBoxes(c, p, g, w) {
for (let H = c; H < p; H++) {
const A = this.collisionBoxArray.get(H);
this.addCollisionDebugVertices(A.x1, A.y1, A.x2, A.y2, w ? this.textCollisionBox : this.iconCollisionBox, A.anchorPoint, g);
}
}
generateCollisionDebugBuffers() {
this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new q_(s2, lC.members, b1), this.iconCollisionBox = new q_(s2, lC.members, b1);
for (let c = 0; c < this.symbolInstances.length; c++) {
const p = this.symbolInstances.get(c);
this.addDebugCollisionBoxes(p.textBoxStartIndex, p.textBoxEndIndex, p, !0), this.addDebugCollisionBoxes(p.verticalTextBoxStartIndex, p.verticalTextBoxEndIndex, p, !0), this.addDebugCollisionBoxes(p.iconBoxStartIndex, p.iconBoxEndIndex, p, !1), this.addDebugCollisionBoxes(p.verticalIconBoxStartIndex, p.verticalIconBoxEndIndex, p, !1);
}
}
_deserializeCollisionBoxesForSymbol(c, p, g, w, H, A, C, N, z) {
const W = {};
for (let X = p; X < g; X++) {
const tt = c.get(X);
W.textBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.textFeatureIndex = tt.featureIndex;
break;
}
for (let X = w; X < H; X++) {
const tt = c.get(X);
W.verticalTextBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.verticalTextFeatureIndex = tt.featureIndex;
break;
}
for (let X = A; X < C; X++) {
const tt = c.get(X);
W.iconBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.iconFeatureIndex = tt.featureIndex;
break;
}
for (let X = N; X < z; X++) {
const tt = c.get(X);
W.verticalIconBox = { x1: tt.x1, y1: tt.y1, x2: tt.x2, y2: tt.y2, anchorPointX: tt.anchorPointX, anchorPointY: tt.anchorPointY }, W.verticalIconFeatureIndex = tt.featureIndex;
break;
}
return W;
}
deserializeCollisionBoxes(c) {
this.collisionArrays = [];
for (let p = 0; p < this.symbolInstances.length; p++) {
const g = this.symbolInstances.get(p);
this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(c, g.textBoxStartIndex, g.textBoxEndIndex, g.verticalTextBoxStartIndex, g.verticalTextBoxEndIndex, g.iconBoxStartIndex, g.iconBoxEndIndex, g.verticalIconBoxStartIndex, g.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(c, p) {
const g = c.placedSymbolArray.get(p), w = g.vertexStartIndex + 4 * g.numGlyphs;
for (let H = g.vertexStartIndex; H < w; H += 4)
c.indexArray.emplaceBack(H, H + 1, H + 2), c.indexArray.emplaceBack(H + 1, H + 2, H + 3);
}
getSortedSymbolIndexes(c) {
if (this.sortedAngle === c && this.symbolInstanceIndexes !== void 0)
return this.symbolInstanceIndexes;
const p = Math.sin(c), g = Math.cos(c), w = [], H = [], A = [];
for (let C = 0; C < this.symbolInstances.length; ++C) {
A.push(C);
const N = this.symbolInstances.get(C);
w.push(0 | Math.round(p * N.anchorX + g * N.anchorY)), H.push(N.featureIndex);
}
return A.sort((C, N) => w[C] - w[N] || H[N] - H[C]), A;
}
addToSortKeyRanges(c, p) {
const g = this.sortKeyRanges[this.sortKeyRanges.length - 1];
g && g.sortKey === p ? g.symbolInstanceEnd = c + 1 : this.sortKeyRanges.push({ sortKey: p, symbolInstanceStart: c, symbolInstanceEnd: c + 1 });
}
sortFeatures(c) {
if (this.sortFeaturesByY && this.sortedAngle !== c && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
this.symbolInstanceIndexes = this.getSortedSymbolIndexes(c), this.sortedAngle = c, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = [];
for (const p of this.symbolInstanceIndexes) {
const g = this.symbolInstances.get(p);
this.featureSortOrder.push(g.featureIndex), [g.rightJustifiedTextSymbolIndex, g.centerJustifiedTextSymbolIndex, g.leftJustifiedTextSymbolIndex].forEach((w, H, A) => {
w >= 0 && A.indexOf(w) === H && this.addIndicesForPlacedSymbol(this.text, w);
}), g.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, g.verticalPlacedTextSymbolIndex), g.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, g.placedIconSymbolIndex), g.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, g.verticalPlacedIconSymbolIndex);
}
this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray);
}
}
}
let EC, MC;
nr("SymbolBucket", $l, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), $l.MAX_GLYPHS = 65535, $l.addDynamicAttributes = W_;
var X_ = { get paint() {
return MC = MC || new S({ "icon-opacity": new Mr(Ct.paint_symbol["icon-opacity"]), "icon-color": new Mr(Ct.paint_symbol["icon-color"]), "icon-halo-color": new Mr(Ct.paint_symbol["icon-halo-color"]), "icon-halo-width": new Mr(Ct.paint_symbol["icon-halo-width"]), "icon-halo-blur": new Mr(Ct.paint_symbol["icon-halo-blur"]), "icon-translate": new cr(Ct.paint_symbol["icon-translate"]), "icon-translate-anchor": new cr(Ct.paint_symbol["icon-translate-anchor"]), "text-opacity": new Mr(Ct.paint_symbol["text-opacity"]), "text-color": new Mr(Ct.paint_symbol["text-color"], { runtimeType: Vn, getOverride: (h) => h.textColor, hasOverride: (h) => !!h.textColor }), "text-halo-color": new Mr(Ct.paint_symbol["text-halo-color"]), "text-halo-width": new Mr(Ct.paint_symbol["text-halo-width"]), "text-halo-blur": new Mr(Ct.paint_symbol["text-halo-blur"]), "text-translate": new cr(Ct.paint_symbol["text-translate"]), "text-translate-anchor": new cr(Ct.paint_symbol["text-translate-anchor"]) });
}, get layout() {
return EC = EC || new S({ "symbol-placement": new cr(Ct.layout_symbol["symbol-placement"]), "symbol-spacing": new cr(Ct.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new cr(Ct.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new Mr(Ct.layout_symbol["symbol-sort-key"]), "symbol-z-order": new cr(Ct.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new cr(Ct.layout_symbol["icon-allow-overlap"]), "icon-overlap": new cr(Ct.layout_symbol["icon-overlap"]), "icon-ignore-placement": new cr(Ct.layout_symbol["icon-ignore-placement"]), "icon-optional": new cr(Ct.layout_symbol["icon-optional"]), "icon-rotation-alignment": new cr(Ct.layout_symbol["icon-rotation-alignment"]), "icon-size": new Mr(Ct.layout_symbol["icon-size"]), "icon-text-fit": new cr(Ct.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new cr(Ct.layout_symbol["icon-text-fit-padding"]), "icon-image": new Mr(Ct.layout_symbol["icon-image"]), "icon-rotate": new Mr(Ct.layout_symbol["icon-rotate"]), "icon-padding": new Mr(Ct.layout_symbol["icon-padding"]), "icon-keep-upright": new cr(Ct.layout_symbol["icon-keep-upright"]), "icon-offset": new Mr(Ct.layout_symbol["icon-offset"]), "icon-anchor": new Mr(Ct.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new cr(Ct.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new cr(Ct.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new cr(Ct.layout_symbol["text-rotation-alignment"]), "text-field": new Mr(Ct.layout_symbol["text-field"]), "text-font": new Mr(Ct.layout_symbol["text-font"]), "text-size": new Mr(Ct.layout_symbol["text-size"]), "text-max-width": new Mr(Ct.layout_symbol["text-max-width"]), "text-line-height": new cr(Ct.layout_symbol["text-line-height"]), "text-letter-spacing": new Mr(Ct.layout_symbol["text-letter-spacing"]), "text-justify": new Mr(Ct.layout_symbol["text-justify"]), "text-radial-offset": new Mr(Ct.layout_symbol["text-radial-offset"]), "text-variable-anchor": new cr(Ct.layout_symbol["text-variable-anchor"]), "text-variable-anchor-offset": new Mr(Ct.layout_symbol["text-variable-anchor-offset"]), "text-anchor": new Mr(Ct.layout_symbol["text-anchor"]), "text-max-angle": new cr(Ct.layout_symbol["text-max-angle"]), "text-writing-mode": new cr(Ct.layout_symbol["text-writing-mode"]), "text-rotate": new Mr(Ct.layout_symbol["text-rotate"]), "text-padding": new cr(Ct.layout_symbol["text-padding"]), "text-keep-upright": new cr(Ct.layout_symbol["text-keep-upright"]), "text-transform": new Mr(Ct.layout_symbol["text-transform"]), "text-offset": new Mr(Ct.layout_symbol["text-offset"]), "text-allow-overlap": new cr(Ct.layout_symbol["text-allow-overlap"]), "text-overlap": new cr(Ct.layout_symbol["text-overlap"]), "text-ignore-placement": new cr(Ct.layout_symbol["text-ignore-placement"]), "text-optional": new cr(Ct.layout_symbol["text-optional"]) });
} };
class SC {
constructor(c) {
if (c.property.overrides === void 0)
throw new Error("overrides must be provided to instantiate FormatSectionOverride class");
this.type = c.property.overrides ? c.property.overrides.runtimeType : t1, this.defaultValue = c;
}
evaluate(c) {
if (c.formattedSection) {
const p = this.defaultValue.property.overrides;
if (p && p.hasOverride(c.formattedSection))
return p.getOverride(c.formattedSection);
}
return c.feature && c.featureState ? this.defaultValue.evaluate(c.feature, c.featureState) : this.defaultValue.property.specification.default;
}
eachChild(c) {
this.defaultValue.isConstant() || c(this.defaultValue.value._styleExpression.expression);
}
outputDefined() {
return !1;
}
serialize() {
return null;
}
}
nr("FormatSectionOverride", SC, { omit: ["defaultValue"] });
class Dp extends m {
constructor(c) {
super(c, X_);
}
recalculate(c, p) {
if (super.recalculate(c, p), this.layout.get("icon-rotation-alignment") === "auto" && (this.layout._values["icon-rotation-alignment"] = this.layout.get("symbol-placement") !== "point" ? "map" : "viewport"), this.layout.get("text-rotation-alignment") === "auto" && (this.layout._values["text-rotation-alignment"] = this.layout.get("symbol-placement") !== "point" ? "map" : "viewport"), this.layout.get("text-pitch-alignment") === "auto" && (this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment") === "map" ? "map" : "viewport"), this.layout.get("icon-pitch-alignment") === "auto" && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")), this.layout.get("symbol-placement") === "point") {
const g = this.layout.get("text-writing-mode");
if (g) {
const w = [];
for (const H of g)
w.indexOf(H) < 0 && w.push(H);
this.layout._values["text-writing-mode"] = w;
} else
this.layout._values["text-writing-mode"] = ["horizontal"];
}
this._setPaintOverrides();
}
getValueAndResolveTokens(c, p, g, w) {
const H = this.layout.get(c).evaluate(p, {}, g, w), A = this._unevaluatedLayout._values[c];
return A.isDataDriven() || yi(A.value) || !H ? H : function(C, N) {
return N.replace(/{([^{}]+)}/g, (z, W) => C && W in C ? String(C[W]) : "");
}(p.properties, H);
}
createBucket(c) {
return new $l(c);
}
queryRadius() {
return 0;
}
queryIntersectsFeature() {
throw new Error("Should take a different path in FeatureIndex");
}
_setPaintOverrides() {
for (const c of X_.paint.overridableProperties) {
if (!Dp.hasPaintOverride(this.layout, c))
continue;
const p = this.paint.get(c), g = new SC(p), w = new gi(g, p.property.specification);
let H = null;
H = p.value.kind === "constant" || p.value.kind === "source" ? new A1("source", w) : new Ai("composite", w, p.value.zoomStops), this.paint._values[c] = new Qs(p.property, H, p.parameters);
}
}
_handleOverridablePaintPropertyUpdate(c, p, g) {
return !(!this.layout || p.isDataDriven() || g.isDataDriven()) && Dp.hasPaintOverride(this.layout, c);
}
static hasPaintOverride(c, p) {
const g = c.get("text-field"), w = X_.paint.properties[p];
let H = !1;
const A = (C) => {
for (const N of C)
if (w.overrides && w.overrides.hasOverride(N))
return void (H = !0);
};
if (g.value.kind === "constant" && g.value.value instanceof Xr)
A(g.value.value.sections);
else if (g.value.kind === "source") {
const C = (z) => {
H || (z instanceof h1 && Qn(z.value) === H1 ? A(z.value.sections) : z instanceof A3 ? A(z.sections) : z.eachChild(C));
}, N = g.value;
N._styleExpression && C(N._styleExpression.expression);
}
return H;
}
}
let HC;
var Ftt = { get paint() {
return HC = HC || new S({ "background-color": new cr(Ct.paint_background["background-color"]), "background-pattern": new kl(Ct.paint_background["background-pattern"]), "background-opacity": new cr(Ct.paint_background["background-opacity"]) });
} };
class Btt extends m {
constructor(c) {
super(c, Ftt);
}
}
let AC;
var jtt = { get paint() {
return AC = AC || new S({ "raster-opacity": new cr(Ct.paint_raster["raster-opacity"]), "raster-hue-rotate": new cr(Ct.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new cr(Ct.paint_raster["raster-brightness-min"]), "raster-brightness-max": new cr(Ct.paint_raster["raster-brightness-max"]), "raster-saturation": new cr(Ct.paint_raster["raster-saturation"]), "raster-contrast": new cr(Ct.paint_raster["raster-contrast"]), "raster-resampling": new cr(Ct.paint_raster["raster-resampling"]), "raster-fade-duration": new cr(Ct.paint_raster["raster-fade-duration"]) });
} };
class ztt extends m {
constructor(c) {
super(c, jtt);
}
}
class Utt extends m {
constructor(c) {
super(c, {}), this.onAdd = (p) => {
this.implementation.onAdd && this.implementation.onAdd(p, p.painter.context.gl);
}, this.onRemove = (p) => {
this.implementation.onRemove && this.implementation.onRemove(p, p.painter.context.gl);
}, this.implementation = c;
}
is3D() {
return this.implementation.renderingMode === "3d";
}
hasOffscreenPass() {
return this.implementation.prerender !== void 0;
}
recalculate() {
}
updateTransitions() {
}
hasTransition() {
return !1;
}
serialize() {
throw new Error("Custom layers cannot be serialized");
}
}
class Gtt {
constructor(c) {
this._methodToThrottle = c, this._triggered = !1, typeof MessageChannel < "u" && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => {
this._triggered = !1, this._methodToThrottle();
});
}
trigger() {
this._triggered || (this._triggered = !0, this._channel ? this._channel.port1.postMessage(!0) : setTimeout(() => {
this._triggered = !1, this._methodToThrottle();
}, 0));
}
remove() {
delete this._channel, this._methodToThrottle = () => {
};
}
}
const K_ = 63710088e-1;
class f6 {
constructor(c, p) {
if (isNaN(c) || isNaN(p))
throw new Error(`Invalid LngLat object: (${c}, ${p})`);
if (this.lng = +c, this.lat = +p, this.lat > 90 || this.lat < -90)
throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
}
wrap() {
return new f6(U(this.lng, -180, 180), this.lat);
}
toArray() {
return [this.lng, this.lat];
}
toString() {
return `LngLat(${this.lng}, ${this.lat})`;
}
distanceTo(c) {
const p = Math.PI / 180, g = this.lat * p, w = c.lat * p, H = Math.sin(g) * Math.sin(w) + Math.cos(g) * Math.cos(w) * Math.cos((c.lng - this.lng) * p);
return K_ * Math.acos(Math.min(H, 1));
}
static convert(c) {
if (c instanceof f6)
return c;
if (Array.isArray(c) && (c.length === 2 || c.length === 3))
return new f6(Number(c[0]), Number(c[1]));
if (!Array.isArray(c) && typeof c == "object" && c !== null)
return new f6(Number("lng" in c ? c.lng : c.lon), Number(c.lat));
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]");
}
}
const OC = 2 * Math.PI * K_;
function CC(h) {
return OC * Math.cos(h * Math.PI / 180);
}
function kC(h) {
return (180 + h) / 360;
}
function IC(h) {
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + h * Math.PI / 360))) / 360;
}
function PC(h, c) {
return h / CC(c);
}
function Y_(h) {
return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * h) * Math.PI / 180)) - 90;
}
class ru {
constructor(c, p, g = 0) {
this.x = +c, this.y = +p, this.z = +g;
}
static fromLngLat(c, p = 0) {
const g = f6.convert(c);
return new ru(kC(g.lng), IC(g.lat), PC(p, g.lat));
}
toLngLat() {
return new f6(360 * this.x - 180, Y_(this.y));
}
toAltitude() {
return this.z * CC(Y_(this.y));
}
meterInMercatorCoordinateUnits() {
return 1 / OC * (c = Y_(this.y), 1 / Math.cos(c * Math.PI / 180));
var c;
}
}
function VC(h, c, p) {
var g = 2 * Math.PI * 6378137 / 256 / Math.pow(2, p);
return [h * g - 2 * Math.PI * 6378137 / 2, c * g - 2 * Math.PI * 6378137 / 2];
}
class J_ {
constructor(c, p, g) {
if (!function(w, H, A) {
return !(w < 0 || w > 25 || A < 0 || A >= Math.pow(2, w) || H < 0 || H >= Math.pow(2, w));
}(c, p, g))
throw new Error(`x=${p}, y=${g}, z=${c} outside of bounds. 0<=x<${Math.pow(2, c)}, 0<=y<${Math.pow(2, c)} 0<=z<=25 `);
this.z = c, this.x = p, this.y = g, this.key = nu(0, c, c, p, g);
}
equals(c) {
return this.z === c.z && this.x === c.x && this.y === c.y;
}
url(c, p, g) {
const w = (A = this.y, C = this.z, N = VC(256 * (H = this.x), 256 * (A = Math.pow(2, C) - A - 1), C), z = VC(256 * (H + 1), 256 * (A + 1), C), N[0] + "," + N[1] + "," + z[0] + "," + z[1]);
var H, A, C, N, z;
const W = function(X, tt, at) {
let ut, Tt = "";
for (let Lt = X; Lt > 0; Lt--)
ut = 1 << Lt - 1, Tt += (tt & ut ? 1 : 0) + (at & ut ? 2 : 0);
return Tt;
}(this.z, this.x, this.y);
return c[(this.x + this.y) % c.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(g === "tms" ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace(/{ratio}/g, p > 1 ? "@2x" : "").replace(/{quadkey}/g, W).replace(/{bbox-epsg-3857}/g, w);
}
isChildOf(c) {
const p = this.z - c.z;
return p > 0 && c.x === this.x >> p && c.y === this.y >> p;
}
getTilePoint(c) {
const p = Math.pow(2, this.z);
return new f((c.x * p - this.x) * Zi, (c.y * p - this.y) * Zi);
}
toString() {
return `${this.z}/${this.x}/${this.y}`;
}
}
class RC {
constructor(c, p) {
this.wrap = c, this.canonical = p, this.key = nu(c, p.z, p.z, p.x, p.y);
}
}
class I2 {
constructor(c, p, g, w, H) {
if (c < g)
throw new Error(`overscaledZ should be >= z; overscaledZ = ${c}; z = ${g}`);
this.overscaledZ = c, this.wrap = p, this.canonical = new J_(g, +w, +H), this.key = nu(p, c, g, w, H);
}
clone() {
return new I2(this.overscaledZ, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y);
}
equals(c) {
return this.overscaledZ === c.overscaledZ && this.wrap === c.wrap && this.canonical.equals(c.canonical);
}
scaledTo(c) {
if (c > this.overscaledZ)
throw new Error(`targetZ > this.overscaledZ; targetZ = ${c}; overscaledZ = ${this.overscaledZ}`);
const p = this.canonical.z - c;
return c > this.canonical.z ? new I2(c, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new I2(c, this.wrap, c, this.canonical.x >> p, this.canonical.y >> p);
}
calculateScaledKey(c, p) {
if (c > this.overscaledZ)
throw new Error(`targetZ > this.overscaledZ; targetZ = ${c}; overscaledZ = ${this.overscaledZ}`);
const g = this.canonical.z - c;
return c > this.canonical.z ? nu(this.wrap * +p, c, this.canonical.z, this.canonical.x, this.canonical.y) : nu(this.wrap * +p, c, c, this.canonical.x >> g, this.canonical.y >> g);
}
isChildOf(c) {
if (c.wrap !== this.wrap)
return !1;
const p = this.canonical.z - c.canonical.z;
return c.overscaledZ === 0 || c.overscaledZ < this.overscaledZ && c.canonical.x === this.canonical.x >> p && c.canonical.y === this.canonical.y >> p;
}
children(c) {
if (this.overscaledZ >= c)
return [new I2(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)];
const p = this.canonical.z + 1, g = 2 * this.canonical.x, w = 2 * this.canonical.y;
return [new I2(p, this.wrap, p, g, w), new I2(p, this.wrap, p, g + 1, w), new I2(p, this.wrap, p, g, w + 1), new I2(p, this.wrap, p, g + 1, w + 1)];
}
isLessThan(c) {
return this.wrap < c.wrap || !(this.wrap > c.wrap) && (this.overscaledZ < c.overscaledZ || !(this.overscaledZ > c.overscaledZ) && (this.canonical.x < c.canonical.x || !(this.canonical.x > c.canonical.x) && this.canonical.y < c.canonical.y));
}
wrapped() {
return new I2(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y);
}
unwrapTo(c) {
return new I2(this.overscaledZ, c, this.canonical.z, this.canonical.x, this.canonical.y);
}
overscaleFactor() {
return Math.pow(2, this.overscaledZ - this.canonical.z);
}
toUnwrapped() {
return new RC(this.wrap, this.canonical);
}
toString() {
return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`;
}
getTilePoint(c) {
return this.canonical.getTilePoint(new ru(c.x - this.wrap, c.y));
}
}
function nu(h, c, p, g, w) {
(h *= 2) < 0 && (h = -1 * h - 1);
const H = 1 << p;
return (H * H * h + H * w + g).toString(36) + p.toString(36) + c.toString(36);
}
nr("CanonicalTileID", J_), nr("OverscaledTileID", I2, { omit: ["posMatrix"] });
class NC {
constructor(c, p, g, w = 1, H = 1, A = 1, C = 0) {
if (this.uid = c, p.height !== p.width)
throw new RangeError("DEM tiles must be square");
if (g && !["mapbox", "terrarium", "custom"].includes(g))
return void It(`"${g}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);
this.stride = p.height;
const N = this.dim = p.height - 2;
switch (this.data = new Uint32Array(p.data.buffer), g) {
case "terrarium":
this.redFactor = 256, this.greenFactor = 1, this.blueFactor = 1 / 256, this.baseShift = 32768;
break;
case "custom":
this.redFactor = w, this.greenFactor = H, this.blueFactor = A, this.baseShift = C;
break;
default:
this.redFactor = 6553.6, this.greenFactor = 25.6, this.blueFactor = 0.1, this.baseShift = 1e4;
}
for (let z = 0; z < N; z++)
this.data[this._idx(-1, z)] = this.data[this._idx(0, z)], this.data[this._idx(N, z)] = this.data[this._idx(N - 1, z)], this.data[this._idx(z, -1)] = this.data[this._idx(z, 0)], this.data[this._idx(z, N)] = this.data[this._idx(z, N - 1)];
this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(N, -1)] = this.data[this._idx(N - 1, 0)], this.data[this._idx(-1, N)] = this.data[this._idx(0, N - 1)], this.data[this._idx(N, N)] = this.data[this._idx(N - 1, N - 1)], this.min = Number.MAX_SAFE_INTEGER, this.max = Number.MIN_SAFE_INTEGER;
for (let z = 0; z < N; z++)
for (let W = 0; W < N; W++) {
const X = this.get(z, W);
X > this.max && (this.max = X), X < this.min && (this.min = X);
}
}
get(c, p) {
const g = new Uint8Array(this.data.buffer), w = 4 * this._idx(c, p);
return this.unpack(g[w], g[w + 1], g[w + 2]);
}
getUnpackVector() {
return [this.redFactor, this.greenFactor, this.blueFactor, this.baseShift];
}
_idx(c, p) {
if (c < -1 || c >= this.dim + 1 || p < -1 || p >= this.dim + 1)
throw new RangeError("out of range source coordinates for DEM data");
return (p + 1) * this.stride + (c + 1);
}
unpack(c, p, g) {
return c * this.redFactor + p * this.greenFactor + g * this.blueFactor - this.baseShift;
}
getPixels() {
return new k2({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer));
}
backfillBorder(c, p, g) {
if (this.dim !== c.dim)
throw new Error("dem dimension mismatch");
let w = p * this.dim, H = p * this.dim + this.dim, A = g * this.dim, C = g * this.dim + this.dim;
switch (p) {
case -1:
w = H - 1;
break;
case 1:
H = w + 1;
}
switch (g) {
case -1:
A = C - 1;
break;
case 1:
C = A + 1;
}
const N = -p * this.dim, z = -g * this.dim;
for (let W = A; W < C; W++)
for (let X = w; X < H; X++)
this.data[this._idx(X, W)] = c.data[this._idx(X + N, W + z)];
}
}
nr("DEMData", NC);
class DC {
constructor(c) {
this._stringToNumber = {}, this._numberToString = [];
for (let p = 0; p < c.length; p++) {
const g = c[p];
this._stringToNumber[g] = p, this._numberToString[p] = g;
}
}
encode(c) {
return this._stringToNumber[c];
}
decode(c) {
if (c >= this._numberToString.length)
throw new Error(`Out of bounds. Index requested n=${c} can't be >= this._numberToString.length ${this._numberToString.length}`);
return this._numberToString[c];
}
}
class FC {
constructor(c, p, g, w, H) {
this.type = "Feature", this._vectorTileFeature = c, c._z = p, c._x = g, c._y = w, this.properties = c.properties, this.id = H;
}
get geometry() {
return this._geometry === void 0 && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry;
}
set geometry(c) {
this._geometry = c;
}
toJSON() {
const c = { geometry: this.geometry };
for (const p in this)
p !== "_geometry" && p !== "_vectorTileFeature" && (c[p] = this[p]);
return c;
}
}
class BC {
constructor(c, p) {
this.tileID = c, this.x = c.canonical.x, this.y = c.canonical.y, this.z = c.canonical.z, this.grid = new e6(Zi, 16, 0), this.grid3D = new e6(Zi, 16, 0), this.featureIndexArray = new q1(), this.promoteId = p;
}
insert(c, p, g, w, H, A) {
const C = this.featureIndexArray.length;
this.featureIndexArray.emplaceBack(g, w, H);
const N = A ? this.grid3D : this.grid;
for (let z = 0; z < p.length; z++) {
const W = p[z], X = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let tt = 0; tt < W.length; tt++) {
const at = W[tt];
X[0] = Math.min(X[0], at.x), X[1] = Math.min(X[1], at.y), X[2] = Math.max(X[2], at.x), X[3] = Math.max(X[3], at.y);
}
X[0] < Zi && X[1] < Zi && X[2] >= 0 && X[3] >= 0 && N.insert(C, X[0], X[1], X[2], X[3]);
}
}
loadVTLayers() {
return this.vtLayers || (this.vtLayers = new d6.VectorTile(new B_(this.rawTileData)).layers, this.sourceLayerCoder = new DC(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers;
}
query(c, p, g, w) {
this.loadVTLayers();
const H = c.params || {}, A = Zi / c.tileSize / c.scale, C = Y4(H.filter), N = c.queryGeometry, z = c.queryPadding * A, W = zC(N), X = this.grid.query(W.minX - z, W.minY - z, W.maxX + z, W.maxY + z), tt = zC(c.cameraQueryGeometry), at = this.grid3D.query(tt.minX - z, tt.minY - z, tt.maxX + z, tt.maxY + z, (Lt, Et, $t, Pt) => function(Bt, ee, _e, Xe, Er) {
for (const Re of Bt)
if (ee <= Re.x && _e <= Re.y && Xe >= Re.x && Er >= Re.y)
return !0;
const ze = [new f(ee, _e), new f(ee, Er), new f(Xe, Er), new f(Xe, _e)];
if (Bt.length > 2) {
for (const Re of ze)
if (Fl(Bt, Re))
return !0;
}
for (let Re = 0; Re < Bt.length - 1; Re++)
if (wJ(Bt[Re], Bt[Re + 1], ze))
return !0;
return !1;
}(c.cameraQueryGeometry, Lt - z, Et - z, $t + z, Pt + z));
for (const Lt of at)
X.push(Lt);
X.sort($tt);
const ut = {};
let Tt;
for (let Lt = 0; Lt < X.length; Lt++) {
const Et = X[Lt];
if (Et === Tt)
continue;
Tt = Et;
const $t = this.featureIndexArray.get(Et);
let Pt = null;
this.loadMatchingFeature(ut, $t.bucketIndex, $t.sourceLayerIndex, $t.featureIndex, C, H.layers, H.availableImages, p, g, w, (Bt, ee, _e) => (Pt || (Pt = F0(Bt)), ee.queryIntersectsFeature(N, Bt, _e, Pt, this.z, c.transform, A, c.pixelPosMatrix)));
}
return ut;
}
loadMatchingFeature(c, p, g, w, H, A, C, N, z, W, X) {
const tt = this.bucketLayerIDs[p];
if (A && !function(Lt, Et) {
for (let $t = 0; $t < Lt.length; $t++)
if (Et.indexOf(Lt[$t]) >= 0)
return !0;
return !1;
}(A, tt))
return;
const at = this.sourceLayerCoder.decode(g), ut = this.vtLayers[at].feature(w);
if (H.needGeometry) {
const Lt = B0(ut, !0);
if (!H.filter(new ti(this.tileID.overscaledZ), Lt, this.tileID.canonical))
return;
} else if (!H.filter(new ti(this.tileID.overscaledZ), ut))
return;
const Tt = this.getId(ut, at);
for (let Lt = 0; Lt < tt.length; Lt++) {
const Et = tt[Lt];
if (A && A.indexOf(Et) < 0)
continue;
const $t = N[Et];
if (!$t)
continue;
let Pt = {};
Tt && W && (Pt = W.getState($t.sourceLayer || "_geojsonTileLayer", Tt));
const Bt = $({}, z[Et]);
Bt.paint = jC(Bt.paint, $t.paint, ut, Pt, C), Bt.layout = jC(Bt.layout, $t.layout, ut, Pt, C);
const ee = !X || X(ut, $t, Pt);
if (!ee)
continue;
const _e = new FC(ut, this.z, this.x, this.y, Tt);
_e.layer = Bt;
let Xe = c[Et];
Xe === void 0 && (Xe = c[Et] = []), Xe.push({ featureIndex: w, feature: _e, intersectionZ: ee });
}
}
lookupSymbolFeatures(c, p, g, w, H, A, C, N) {
const z = {};
this.loadVTLayers();
const W = Y4(H);
for (const X of c)
this.loadMatchingFeature(z, g, w, X, W, A, C, N, p);
return z;
}
hasLayer(c) {
for (const p of this.bucketLayerIDs)
for (const g of p)
if (c === g)
return !0;
return !1;
}
getId(c, p) {
let g = c.id;
return this.promoteId && (g = c.properties[typeof this.promoteId == "string" ? this.promoteId : this.promoteId[p]], typeof g == "boolean" && (g = Number(g))), g;
}
}
function jC(h, c, p, g, w) {
return nt(h, (H, A) => {
const C = c instanceof V0 ? c.get(A) : null;
return C && C.evaluate ? C.evaluate(p, g, w) : C;
});
}
function zC(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h)
c = Math.min(c, H.x), p = Math.min(p, H.y), g = Math.max(g, H.x), w = Math.max(w, H.y);
return { minX: c, minY: p, maxX: g, maxY: w };
}
function $tt(h, c) {
return c - h;
}
function UC(h, c, p, g, w) {
const H = [];
for (let A = 0; A < h.length; A++) {
const C = h[A];
let N;
for (let z = 0; z < C.length - 1; z++) {
let W = C[z], X = C[z + 1];
W.x < c && X.x < c || (W.x < c ? W = new f(c, W.y + (c - W.x) / (X.x - W.x) * (X.y - W.y))._round() : X.x < c && (X = new f(c, W.y + (c - W.x) / (X.x - W.x) * (X.y - W.y))._round()), W.y < p && X.y < p || (W.y < p ? W = new f(W.x + (p - W.y) / (X.y - W.y) * (X.x - W.x), p)._round() : X.y < p && (X = new f(W.x + (p - W.y) / (X.y - W.y) * (X.x - W.x), p)._round()), W.x >= g && X.x >= g || (W.x >= g ? W = new f(g, W.y + (g - W.x) / (X.x - W.x) * (X.y - W.y))._round() : X.x >= g && (X = new f(g, W.y + (g - W.x) / (X.x - W.x) * (X.y - W.y))._round()), W.y >= w && X.y >= w || (W.y >= w ? W = new f(W.x + (w - W.y) / (X.y - W.y) * (X.x - W.x), w)._round() : X.y >= w && (X = new f(W.x + (w - W.y) / (X.y - W.y) * (X.x - W.x), w)._round()), N && W.equals(N[N.length - 1]) || (N = [W], H.push(N)), N.push(X)))));
}
}
return H;
}
nr("FeatureIndex", BC, { omit: ["rawTileData", "sourceLayerCoder"] });
class Q6 extends f {
constructor(c, p, g, w) {
super(c, p), this.angle = g, w !== void 0 && (this.segment = w);
}
clone() {
return new Q6(this.x, this.y, this.angle, this.segment);
}
}
function GC(h, c, p, g, w) {
if (c.segment === void 0 || p === 0)
return !0;
let H = c, A = c.segment + 1, C = 0;
for (; C > -p / 2; ) {
if (A--, A < 0)
return !1;
C -= h[A].dist(H), H = h[A];
}
C += h[A].dist(h[A + 1]), A++;
const N = [];
let z = 0;
for (; C < p / 2; ) {
const W = h[A], X = h[A + 1];
if (!X)
return !1;
let tt = h[A - 1].angleTo(W) - W.angleTo(X);
for (tt = Math.abs((tt + 3 * Math.PI) % (2 * Math.PI) - Math.PI), N.push({ distance: C, angleDelta: tt }), z += tt; C - N[0].distance > g; )
z -= N.shift().angleDelta;
if (z > w)
return !1;
A++, C += W.dist(X);
}
return !0;
}
function $C(h) {
let c = 0;
for (let p = 0; p < h.length - 1; p++)
c += h[p].dist(h[p + 1]);
return c;
}
function WC(h, c, p) {
return h ? 0.6 * c * p : 0;
}
function ZC(h, c) {
return Math.max(h ? h.right - h.left : 0, c ? c.right - c.left : 0);
}
function Wtt(h, c, p, g, w, H) {
const A = WC(p, w, H), C = ZC(p, g) * H;
let N = 0;
const z = $C(h) / 2;
for (let W = 0; W < h.length - 1; W++) {
const X = h[W], tt = h[W + 1], at = X.dist(tt);
if (N + at > z) {
const ut = (z - N) / at, Tt = xr.number(X.x, tt.x, ut), Lt = xr.number(X.y, tt.y, ut), Et = new Q6(Tt, Lt, tt.angleTo(X), W);
return Et._round(), !A || GC(h, Et, C, A, c) ? Et : void 0;
}
N += at;
}
}
function Ztt(h, c, p, g, w, H, A, C, N) {
const z = WC(g, H, A), W = ZC(g, w), X = W * A, tt = h[0].x === 0 || h[0].x === N || h[0].y === 0 || h[0].y === N;
return c - X < c / 4 && (c = X + c / 4), qC(h, tt ? c / 2 * C % c : (W / 2 + 2 * H) * A * C % c, c, z, p, X, tt, !1, N);
}
function qC(h, c, p, g, w, H, A, C, N) {
const z = H / 2, W = $C(h);
let X = 0, tt = c - p, at = [];
for (let ut = 0; ut < h.length - 1; ut++) {
const Tt = h[ut], Lt = h[ut + 1], Et = Tt.dist(Lt), $t = Lt.angleTo(Tt);
for (; tt + p < X + Et; ) {
tt += p;
const Pt = (tt - X) / Et, Bt = xr.number(Tt.x, Lt.x, Pt), ee = xr.number(Tt.y, Lt.y, Pt);
if (Bt >= 0 && Bt < N && ee >= 0 && ee < N && tt - z >= 0 && tt + z <= W) {
const _e = new Q6(Bt, ee, $t, ut);
_e._round(), g && !GC(h, _e, H, g, w) || at.push(_e);
}
}
X += Et;
}
return C || at.length || A || (at = qC(h, X / 2, p, g, w, H, A, !0, N)), at;
}
nr("Anchor", Q6);
const Wl = No;
function XC(h, c, p, g) {
const w = [], H = h.image, A = H.pixelRatio, C = H.paddedRect.w - 2 * Wl, N = H.paddedRect.h - 2 * Wl;
let z = { x1: h.left, y1: h.top, x2: h.right, y2: h.bottom };
const W = H.stretchX || [[0, C]], X = H.stretchY || [[0, N]], tt = (ue, gr) => ue + gr[1] - gr[0], at = W.reduce(tt, 0), ut = X.reduce(tt, 0), Tt = C - at, Lt = N - ut;
let Et = 0, $t = at, Pt = 0, Bt = ut, ee = 0, _e = Tt, Xe = 0, Er = Lt;
if (H.content && g) {
const ue = H.content, gr = ue[2] - ue[0], pr = ue[3] - ue[1];
(H.textFitWidth || H.textFitHeight) && (z = LC(h)), Et = Fp(W, 0, ue[0]), Pt = Fp(X, 0, ue[1]), $t = Fp(W, ue[0], ue[2]), Bt = Fp(X, ue[1], ue[3]), ee = ue[0] - Et, Xe = ue[1] - Pt, _e = gr - $t, Er = pr - Bt;
}
const ze = z.x1, Re = z.y1, Qr = z.x2 - ze, sr = z.y2 - Re, rr = (ue, gr, pr, Ir) => {
const Fn = Bp(ue.stretch - Et, $t, Qr, ze), Pn = jp(ue.fixed - ee, _e, ue.stretch, at), p1 = Bp(gr.stretch - Pt, Bt, sr, Re), gs = jp(gr.fixed - Xe, Er, gr.stretch, ut), V1 = Bp(pr.stretch - Et, $t, Qr, ze), T1 = jp(pr.fixed - ee, _e, pr.stretch, at), yo = Bp(Ir.stretch - Pt, Bt, sr, Re), vo = jp(Ir.fixed - Xe, Er, Ir.stretch, ut), _o = new f(Fn, p1), Oi = new f(V1, p1), f1 = new f(V1, yo), K1 = new f(Fn, yo), R1 = new f(Pn / A, gs / A), bo = new f(T1 / A, vo / A), N1 = c * Math.PI / 180;
if (N1) {
const fn = Math.sin(N1), Un = Math.cos(N1), ii = [Un, -fn, fn, Un];
_o._matMult(ii), Oi._matMult(ii), K1._matMult(ii), f1._matMult(ii);
}
const P2 = ue.stretch + ue.fixed, Do = gr.stretch + gr.fixed;
return { tl: _o, tr: Oi, bl: K1, br: f1, tex: { x: H.paddedRect.x + Wl + P2, y: H.paddedRect.y + Wl + Do, w: pr.stretch + pr.fixed - P2, h: Ir.stretch + Ir.fixed - Do }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: R1, pixelOffsetBR: bo, minFontScaleX: _e / A / Qr, minFontScaleY: Er / A / sr, isSDF: p };
};
if (g && (H.stretchX || H.stretchY)) {
const ue = KC(W, Tt, at), gr = KC(X, Lt, ut);
for (let pr = 0; pr < ue.length - 1; pr++) {
const Ir = ue[pr], Fn = ue[pr + 1];
for (let Pn = 0; Pn < gr.length - 1; Pn++)
w.push(rr(Ir, gr[Pn], Fn, gr[Pn + 1]));
}
} else
w.push(rr({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: C + 1 }, { fixed: 0, stretch: N + 1 }));
return w;
}
function Fp(h, c, p) {
let g = 0;
for (const w of h)
g += Math.max(c, Math.min(p, w[1])) - Math.max(c, Math.min(p, w[0]));
return g;
}
function KC(h, c, p) {
const g = [{ fixed: -Wl, stretch: 0 }];
for (const [w, H] of h) {
const A = g[g.length - 1];
g.push({ fixed: w - A.stretch, stretch: A.stretch }), g.push({ fixed: w - A.stretch, stretch: A.stretch + (H - w) });
}
return g.push({ fixed: c + Wl, stretch: p }), g;
}
function Bp(h, c, p, g) {
return h / c * p + g;
}
function jp(h, c, p, g) {
return h - c * p / g;
}
class zp {
constructor(c, p, g, w, H, A, C, N, z, W) {
var X;
if (this.boxStartIndex = c.length, z) {
let tt = A.top, at = A.bottom;
const ut = A.collisionPadding;
ut && (tt -= ut[1], at += ut[3]);
let Tt = at - tt;
Tt > 0 && (Tt = Math.max(10, Tt), this.circleDiameter = Tt);
} else {
const tt = !((X = A.image) === null || X === void 0) && X.content && (A.image.textFitWidth || A.image.textFitHeight) ? LC(A) : { x1: A.left, y1: A.top, x2: A.right, y2: A.bottom };
tt.y1 = tt.y1 * C - N[0], tt.y2 = tt.y2 * C + N[2], tt.x1 = tt.x1 * C - N[3], tt.x2 = tt.x2 * C + N[1];
const at = A.collisionPadding;
if (at && (tt.x1 -= at[0] * C, tt.y1 -= at[1] * C, tt.x2 += at[2] * C, tt.y2 += at[3] * C), W) {
const ut = new f(tt.x1, tt.y1), Tt = new f(tt.x2, tt.y1), Lt = new f(tt.x1, tt.y2), Et = new f(tt.x2, tt.y2), $t = W * Math.PI / 180;
ut._rotate($t), Tt._rotate($t), Lt._rotate($t), Et._rotate($t), tt.x1 = Math.min(ut.x, Tt.x, Lt.x, Et.x), tt.x2 = Math.max(ut.x, Tt.x, Lt.x, Et.x), tt.y1 = Math.min(ut.y, Tt.y, Lt.y, Et.y), tt.y2 = Math.max(ut.y, Tt.y, Lt.y, Et.y);
}
c.emplaceBack(p.x, p.y, tt.x1, tt.y1, tt.x2, tt.y2, g, w, H);
}
this.boxEndIndex = c.length;
}
}
class qtt {
constructor(c = [], p = (g, w) => g < w ? -1 : g > w ? 1 : 0) {
if (this.data = c, this.length = this.data.length, this.compare = p, this.length > 0)
for (let g = (this.length >> 1) - 1; g >= 0; g--)
this._down(g);
}
push(c) {
this.data.push(c), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const c = this.data[0], p = this.data.pop();
return --this.length > 0 && (this.data[0] = p, this._down(0)), c;
}
peek() {
return this.data[0];
}
_up(c) {
const { data: p, compare: g } = this, w = p[c];
for (; c > 0; ) {
const H = c - 1 >> 1, A = p[H];
if (g(w, A) >= 0)
break;
p[c] = A, c = H;
}
p[c] = w;
}
_down(c) {
const { data: p, compare: g } = this, w = this.length >> 1, H = p[c];
for (; c < w; ) {
let A = 1 + (c << 1);
const C = A + 1;
if (C < this.length && g(p[C], p[A]) < 0 && (A = C), g(p[A], H) >= 0)
break;
p[c] = p[A], c = A;
}
p[c] = H;
}
}
function Xtt(h, c = 1, p = !1) {
let g = 1 / 0, w = 1 / 0, H = -1 / 0, A = -1 / 0;
const C = h[0];
for (let at = 0; at < C.length; at++) {
const ut = C[at];
(!at || ut.x < g) && (g = ut.x), (!at || ut.y < w) && (w = ut.y), (!at || ut.x > H) && (H = ut.x), (!at || ut.y > A) && (A = ut.y);
}
const N = Math.min(H - g, A - w);
let z = N / 2;
const W = new qtt([], Ktt);
if (N === 0)
return new f(g, w);
for (let at = g; at < H; at += N)
for (let ut = w; ut < A; ut += N)
W.push(new Zl(at + z, ut + z, z, h));
let X = function(at) {
let ut = 0, Tt = 0, Lt = 0;
const Et = at[0];
for (let $t = 0, Pt = Et.length, Bt = Pt - 1; $t < Pt; Bt = $t++) {
const ee = Et[$t], _e = Et[Bt], Xe = ee.x * _e.y - _e.x * ee.y;
Tt += (ee.x + _e.x) * Xe, Lt += (ee.y + _e.y) * Xe, ut += 3 * Xe;
}
return new Zl(Tt / ut, Lt / ut, 0, at);
}(h), tt = W.length;
for (; W.length; ) {
const at = W.pop();
(at.d > X.d || !X.d) && (X = at, p && console.log("found best %d after %d probes", Math.round(1e4 * at.d) / 1e4, tt)), at.max - X.d <= c || (z = at.h / 2, W.push(new Zl(at.p.x - z, at.p.y - z, z, h)), W.push(new Zl(at.p.x + z, at.p.y - z, z, h)), W.push(new Zl(at.p.x - z, at.p.y + z, z, h)), W.push(new Zl(at.p.x + z, at.p.y + z, z, h)), tt += 4);
}
return p && (console.log(`num probes: ${tt}`), console.log(`best distance: ${X.d}`)), X.p;
}
function Ktt(h, c) {
return c.max - h.max;
}
function Zl(h, c, p, g) {
this.p = new f(h, c), this.h = p, this.d = function(w, H) {
let A = !1, C = 1 / 0;
for (let N = 0; N < H.length; N++) {
const z = H[N];
for (let W = 0, X = z.length, tt = X - 1; W < X; tt = W++) {
const at = z[W], ut = z[tt];
at.y > w.y != ut.y > w.y && w.x < (ut.x - at.x) * (w.y - at.y) / (ut.y - at.y) + at.x && (A = !A), C = Math.min(C, IO(w, at, ut));
}
}
return (A ? 1 : -1) * Math.sqrt(C);
}(this.p, g), this.max = this.d + this.h * Math.SQRT2;
}
var P1;
s.aq = void 0, (P1 = s.aq || (s.aq = {}))[P1.center = 1] = "center", P1[P1.left = 2] = "left", P1[P1.right = 3] = "right", P1[P1.top = 4] = "top", P1[P1.bottom = 5] = "bottom", P1[P1["top-left"] = 6] = "top-left", P1[P1["top-right"] = 7] = "top-right", P1[P1["bottom-left"] = 8] = "bottom-left", P1[P1["bottom-right"] = 9] = "bottom-right";
const m6 = 7, tb = Number.POSITIVE_INFINITY;
function YC(h, c) {
return c[1] !== tb ? function(p, g, w) {
let H = 0, A = 0;
switch (g = Math.abs(g), w = Math.abs(w), p) {
case "top-right":
case "top-left":
case "top":
A = w - m6;
break;
case "bottom-right":
case "bottom-left":
case "bottom":
A = -w + m6;
}
switch (p) {
case "top-right":
case "bottom-right":
case "right":
H = -g;
break;
case "top-left":
case "bottom-left":
case "left":
H = g;
}
return [H, A];
}(h, c[0], c[1]) : function(p, g) {
let w = 0, H = 0;
g < 0 && (g = 0);
const A = g / Math.SQRT2;
switch (p) {
case "top-right":
case "top-left":
H = A - m6;
break;
case "bottom-right":
case "bottom-left":
H = -A + m6;
break;
case "bottom":
H = -g + m6;
break;
case "top":
H = g - m6;
}
switch (p) {
case "top-right":
case "bottom-right":
w = -A;
break;
case "top-left":
case "bottom-left":
w = A;
break;
case "left":
w = g;
break;
case "right":
w = -g;
}
return [w, H];
}(h, c[0]);
}
function JC(h, c, p) {
var g;
const w = h.layout, H = (g = w.get("text-variable-anchor-offset")) === null || g === void 0 ? void 0 : g.evaluate(c, {}, p);
if (H) {
const C = H.values, N = [];
for (let z = 0; z < C.length; z += 2) {
const W = N[z] = C[z], X = C[z + 1].map((tt) => tt * r1);
W.startsWith("top") ? X[1] -= m6 : W.startsWith("bottom") && (X[1] += m6), N[z + 1] = X;
}
return new _n(N);
}
const A = w.get("text-variable-anchor");
if (A) {
let C;
C = h._unevaluatedLayout.getValue("text-radial-offset") !== void 0 ? [w.get("text-radial-offset").evaluate(c, {}, p) * r1, tb] : w.get("text-offset").evaluate(c, {}, p).map((z) => z * r1);
const N = [];
for (const z of A)
N.push(z, YC(z, C));
return new _n(N);
}
return null;
}
function eb(h) {
switch (h) {
case "right":
case "top-right":
case "bottom-right":
return "right";
case "left":
case "top-left":
case "bottom-left":
return "left";
}
return "center";
}
function Ytt(h, c, p, g, w, H, A, C, N, z, W) {
let X = H.textMaxSize.evaluate(c, {});
X === void 0 && (X = A);
const tt = h.layers[0].layout, at = tt.get("icon-offset").evaluate(c, {}, W), ut = ek(p.horizontal), Tt = A / 24, Lt = h.tilePixelRatio * Tt, Et = h.tilePixelRatio * X / 24, $t = h.tilePixelRatio * C, Pt = h.tilePixelRatio * tt.get("symbol-spacing"), Bt = tt.get("text-padding") * h.tilePixelRatio, ee = function(ue, gr, pr, Ir = 1) {
const Fn = ue.get("icon-padding").evaluate(gr, {}, pr), Pn = Fn && Fn.values;
return [Pn[0] * Ir, Pn[1] * Ir, Pn[2] * Ir, Pn[3] * Ir];
}(tt, c, W, h.tilePixelRatio), _e = tt.get("text-max-angle") / 180 * Math.PI, Xe = tt.get("text-rotation-alignment") !== "viewport" && tt.get("symbol-placement") !== "point", Er = tt.get("icon-rotation-alignment") === "map" && tt.get("symbol-placement") !== "point", ze = tt.get("symbol-placement"), Re = Pt / 2, Qr = tt.get("icon-text-fit");
let sr;
g && Qr !== "none" && (h.allowVerticalPlacement && p.vertical && (sr = wC(g, p.vertical, Qr, tt.get("icon-text-fit-padding"), at, Tt)), ut && (g = wC(g, ut, Qr, tt.get("icon-text-fit-padding"), at, Tt)));
const rr = (ue, gr) => {
gr.x < 0 || gr.x >= Zi || gr.y < 0 || gr.y >= Zi || function(pr, Ir, Fn, Pn, p1, gs, V1, T1, yo, vo, _o, Oi, f1, K1, R1, bo, N1, P2, Do, fn, Un, ii, a2, xi, ql) {
const Ha = pr.addToLineVertexArray(Ir, Fn);
let Aa, ys, V2, L1, U3 = 0, su = 0, ok = 0, sk = 0, cb = -1, ub = -1;
const G3 = {};
let ak = Vl("");
if (pr.allowVerticalPlacement && Pn.vertical) {
const Y1 = T1.layout.get("text-rotate").evaluate(Un, {}, xi) + 90;
V2 = new zp(yo, Ir, vo, _o, Oi, Pn.vertical, f1, K1, R1, Y1), V1 && (L1 = new zp(yo, Ir, vo, _o, Oi, V1, N1, P2, R1, Y1));
}
if (p1) {
const Y1 = T1.layout.get("icon-rotate").evaluate(Un, {}), R2 = T1.layout.get("icon-text-fit") !== "none", z0 = XC(p1, Y1, a2, R2), qs = V1 ? XC(V1, Y1, a2, R2) : void 0;
ys = new zp(yo, Ir, vo, _o, Oi, p1, N1, P2, !1, Y1), U3 = 4 * z0.length;
const U0 = pr.iconSizeData;
let Oa = null;
U0.kind === "source" ? (Oa = [Sa * T1.layout.get("icon-size").evaluate(Un, {})], Oa[0] > T6 && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)) : U0.kind === "composite" && (Oa = [Sa * ii.compositeIconSizes[0].evaluate(Un, {}, xi), Sa * ii.compositeIconSizes[1].evaluate(Un, {}, xi)], (Oa[0] > T6 || Oa[1] > T6) && It(`${pr.layerIds[0]}: Value for "icon-size" is >= ${eu}. Reduce your "icon-size".`)), pr.addSymbols(pr.icon, z0, Oa, fn, Do, Un, s.ah.none, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), cb = pr.icon.placedSymbolArray.length - 1, qs && (su = 4 * qs.length, pr.addSymbols(pr.icon, qs, Oa, fn, Do, Un, s.ah.vertical, Ir, Ha.lineStartIndex, Ha.lineLength, -1, xi), ub = pr.icon.placedSymbolArray.length - 1);
}
const lk = Object.keys(Pn.horizontal);
for (const Y1 of lk) {
const R2 = Pn.horizontal[Y1];
if (!Aa) {
ak = Vl(R2.text);
const qs = T1.layout.get("text-rotate").evaluate(Un, {}, xi);
Aa = new zp(yo, Ir, vo, _o, Oi, R2, f1, K1, R1, qs);
}
const z0 = R2.positionedLines.length === 1;
if (ok += tk(pr, Ir, R2, gs, T1, R1, Un, bo, Ha, Pn.vertical ? s.ah.horizontal : s.ah.horizontalOnly, z0 ? lk : [Y1], G3, cb, ii, xi), z0)
break;
}
Pn.vertical && (sk += tk(pr, Ir, Pn.vertical, gs, T1, R1, Un, bo, Ha, s.ah.vertical, ["vertical"], G3, ub, ii, xi));
const eet = Aa ? Aa.boxStartIndex : pr.collisionBoxArray.length, ret = Aa ? Aa.boxEndIndex : pr.collisionBoxArray.length, net = V2 ? V2.boxStartIndex : pr.collisionBoxArray.length, iet = V2 ? V2.boxEndIndex : pr.collisionBoxArray.length, oet = ys ? ys.boxStartIndex : pr.collisionBoxArray.length, set = ys ? ys.boxEndIndex : pr.collisionBoxArray.length, aet = L1 ? L1.boxStartIndex : pr.collisionBoxArray.length, cet = L1 ? L1.boxEndIndex : pr.collisionBoxArray.length;
let Zs = -1;
const Gp = (Y1, R2) => Y1 && Y1.circleDiameter ? Math.max(Y1.circleDiameter, R2) : R2;
Zs = Gp(Aa, Zs), Zs = Gp(V2, Zs), Zs = Gp(ys, Zs), Zs = Gp(L1, Zs);
const ck = Zs > -1 ? 1 : 0;
ck && (Zs *= ql / r1), pr.glyphOffsetArray.length >= $l.MAX_GLYPHS && It("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), Un.sortKey !== void 0 && pr.addToSortKeyRanges(pr.symbolInstances.length, Un.sortKey);
const uet = JC(T1, Un, xi), [het, det] = function(Y1, R2) {
const z0 = Y1.length, qs = R2 == null ? void 0 : R2.values;
if ((qs == null ? void 0 : qs.length) > 0)
for (let U0 = 0; U0 < qs.length; U0 += 2) {
const Oa = qs[U0 + 1];
Y1.emplaceBack(s.aq[qs[U0]], Oa[0], Oa[1]);
}
return [z0, Y1.length];
}(pr.textAnchorOffsets, uet);
pr.symbolInstances.emplaceBack(Ir.x, Ir.y, G3.right >= 0 ? G3.right : -1, G3.center >= 0 ? G3.center : -1, G3.left >= 0 ? G3.left : -1, G3.vertical || -1, cb, ub, ak, eet, ret, net, iet, oet, set, aet, cet, vo, ok, sk, U3, su, ck, 0, f1, Zs, het, det);
}(h, gr, ue, p, g, w, sr, h.layers[0], h.collisionBoxArray, c.index, c.sourceLayerIndex, h.index, Lt, [Bt, Bt, Bt, Bt], Xe, N, $t, ee, Er, at, c, H, z, W, A);
};
if (ze === "line")
for (const ue of UC(c.geometry, 0, 0, Zi, Zi)) {
const gr = Ztt(ue, Pt, _e, p.vertical || ut, g, 24, Et, h.overscaling, Zi);
for (const pr of gr)
ut && Jtt(h, ut.text, Re, pr) || rr(ue, pr);
}
else if (ze === "line-center") {
for (const ue of c.geometry)
if (ue.length > 1) {
const gr = Wtt(ue, _e, p.vertical || ut, g, 24, Et);
gr && rr(ue, gr);
}
} else if (c.type === "Polygon")
for (const ue of U4(c.geometry, 0)) {
const gr = Xtt(ue, 16);
rr(ue[0], new Q6(gr.x, gr.y, 0));
}
else if (c.type === "LineString")
for (const ue of c.geometry)
rr(ue, new Q6(ue[0].x, ue[0].y, 0));
else if (c.type === "Point")
for (const ue of c.geometry)
for (const gr of ue)
rr([gr], new Q6(gr.x, gr.y, 0));
}
function tk(h, c, p, g, w, H, A, C, N, z, W, X, tt, at, ut) {
const Tt = function($t, Pt, Bt, ee, _e, Xe, Er, ze) {
const Re = ee.layout.get("text-rotate").evaluate(Xe, {}) * Math.PI / 180, Qr = [];
for (const sr of Pt.positionedLines)
for (const rr of sr.positionedGlyphs) {
if (!rr.rect)
continue;
const ue = rr.rect || {};
let gr = QC + 1, pr = !0, Ir = 1, Fn = 0;
const Pn = (_e || ze) && rr.vertical, p1 = rr.metrics.advance * rr.scale / 2;
if (ze && Pt.verticalizable && (Fn = sr.lineOffset / 2 - (rr.imageName ? -(r1 - rr.metrics.width * rr.scale) / 2 : (rr.scale - 1) * r1)), rr.imageName) {
const fn = Er[rr.imageName];
pr = fn.sdf, Ir = fn.pixelRatio, gr = No / Ir;
}
const gs = _e ? [rr.x + p1, rr.y] : [0, 0];
let V1 = _e ? [0, 0] : [rr.x + p1 + Bt[0], rr.y + Bt[1] - Fn], T1 = [0, 0];
Pn && (T1 = V1, V1 = [0, 0]);
const yo = rr.metrics.isDoubleResolution ? 2 : 1, vo = (rr.metrics.left - gr) * rr.scale - p1 + V1[0], _o = (-rr.metrics.top - gr) * rr.scale + V1[1], Oi = vo + ue.w / yo * rr.scale / Ir, f1 = _o + ue.h / yo * rr.scale / Ir, K1 = new f(vo, _o), R1 = new f(Oi, _o), bo = new f(vo, f1), N1 = new f(Oi, f1);
if (Pn) {
const fn = new f(-p1, p1 - Jc), Un = -Math.PI / 2, ii = r1 / 2 - p1, a2 = new f(5 - Jc - ii, -(rr.imageName ? ii : 0)), xi = new f(...T1);
K1._rotateAround(Un, fn)._add(a2)._add(xi), R1._rotateAround(Un, fn)._add(a2)._add(xi), bo._rotateAround(Un, fn)._add(a2)._add(xi), N1._rotateAround(Un, fn)._add(a2)._add(xi);
}
if (Re) {
const fn = Math.sin(Re), Un = Math.cos(Re), ii = [Un, -fn, fn, Un];
K1._matMult(ii), R1._matMult(ii), bo._matMult(ii), N1._matMult(ii);
}
const P2 = new f(0, 0), Do = new f(0, 0);
Qr.push({ tl: K1, tr: R1, bl: bo, br: N1, tex: ue, writingMode: Pt.writingMode, glyphOffset: gs, sectionIndex: rr.sectionIndex, isSDF: pr, pixelOffsetTL: P2, pixelOffsetBR: Do, minFontScaleX: 0, minFontScaleY: 0 });
}
return Qr;
}(0, p, C, w, H, A, g, h.allowVerticalPlacement), Lt = h.textSizeData;
let Et = null;
Lt.kind === "source" ? (Et = [Sa * w.layout.get("text-size").evaluate(A, {})], Et[0] > T6 && It(`${h.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)) : Lt.kind === "composite" && (Et = [Sa * at.compositeTextSizes[0].evaluate(A, {}, ut), Sa * at.compositeTextSizes[1].evaluate(A, {}, ut)], (Et[0] > T6 || Et[1] > T6) && It(`${h.layerIds[0]}: Value for "text-size" is >= ${eu}. Reduce your "text-size".`)), h.addSymbols(h.text, Tt, Et, C, H, A, z, c, N.lineStartIndex, N.lineLength, tt, ut);
for (const $t of W)
X[$t] = h.text.placedSymbolArray.length - 1;
return 4 * Tt.length;
}
function ek(h) {
for (const c in h)
return h[c];
return null;
}
function Jtt(h, c, p, g) {
const w = h.compareText;
if (c in w) {
const H = w[c];
for (let A = H.length - 1; A >= 0; A--)
if (g.dist(H[A]) < p)
return !0;
} else
w[c] = [];
return w[c].push(g), !1;
}
const rk = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
class rb {
static from(c) {
if (!(c instanceof ArrayBuffer))
throw new Error("Data must be an instance of ArrayBuffer.");
const [p, g] = new Uint8Array(c, 0, 2);
if (p !== 219)
throw new Error("Data does not appear to be in a KDBush format.");
const w = g >> 4;
if (w !== 1)
throw new Error(`Got v${w} data when expected v1.`);
const H = rk[15 & g];
if (!H)
throw new Error("Unrecognized array type.");
const [A] = new Uint16Array(c, 2, 1), [C] = new Uint32Array(c, 4, 1);
return new rb(C, A, H, c);
}
constructor(c, p = 64, g = Float64Array, w) {
if (isNaN(c) || c < 0)
throw new Error(`Unpexpected numItems value: ${c}.`);
this.numItems = +c, this.nodeSize = Math.min(Math.max(+p, 2), 65535), this.ArrayType = g, this.IndexArrayType = c < 65536 ? Uint16Array : Uint32Array;
const H = rk.indexOf(this.ArrayType), A = 2 * c * this.ArrayType.BYTES_PER_ELEMENT, C = c * this.IndexArrayType.BYTES_PER_ELEMENT, N = (8 - C % 8) % 8;
if (H < 0)
throw new Error(`Unexpected typed array class: ${g}.`);
w && w instanceof ArrayBuffer ? (this.data = w, this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + C + N, 2 * c), this._pos = 2 * c, this._finished = !0) : (this.data = new ArrayBuffer(8 + A + C + N), this.ids = new this.IndexArrayType(this.data, 8, c), this.coords = new this.ArrayType(this.data, 8 + C + N, 2 * c), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, 16 + H]), new Uint16Array(this.data, 2, 1)[0] = p, new Uint32Array(this.data, 4, 1)[0] = c);
}
add(c, p) {
const g = this._pos >> 1;
return this.ids[g] = g, this.coords[this._pos++] = c, this.coords[this._pos++] = p, g;
}
finish() {
const c = this._pos >> 1;
if (c !== this.numItems)
throw new Error(`Added ${c} items when expected ${this.numItems}.`);
return nb(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
}
range(c, p, g, w) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: H, coords: A, nodeSize: C } = this, N = [0, H.length - 1, 0], z = [];
for (; N.length; ) {
const W = N.pop() || 0, X = N.pop() || 0, tt = N.pop() || 0;
if (X - tt <= C) {
for (let Lt = tt; Lt <= X; Lt++) {
const Et = A[2 * Lt], $t = A[2 * Lt + 1];
Et >= c && Et <= g && $t >= p && $t <= w && z.push(H[Lt]);
}
continue;
}
const at = tt + X >> 1, ut = A[2 * at], Tt = A[2 * at + 1];
ut >= c && ut <= g && Tt >= p && Tt <= w && z.push(H[at]), (W === 0 ? c <= ut : p <= Tt) && (N.push(tt), N.push(at - 1), N.push(1 - W)), (W === 0 ? g >= ut : w >= Tt) && (N.push(at + 1), N.push(X), N.push(1 - W));
}
return z;
}
within(c, p, g) {
if (!this._finished)
throw new Error("Data not yet indexed - call index.finish().");
const { ids: w, coords: H, nodeSize: A } = this, C = [0, w.length - 1, 0], N = [], z = g * g;
for (; C.length; ) {
const W = C.pop() || 0, X = C.pop() || 0, tt = C.pop() || 0;
if (X - tt <= A) {
for (let Lt = tt; Lt <= X; Lt++)
ik(H[2 * Lt], H[2 * Lt + 1], c, p) <= z && N.push(w[Lt]);
continue;
}
const at = tt + X >> 1, ut = H[2 * at], Tt = H[2 * at + 1];
ik(ut, Tt, c, p) <= z && N.push(w[at]), (W === 0 ? c - g <= ut : p - g <= Tt) && (C.push(tt), C.push(at - 1), C.push(1 - W)), (W === 0 ? c + g >= ut : p + g >= Tt) && (C.push(at + 1), C.push(X), C.push(1 - W));
}
return N;
}
}
function nb(h, c, p, g, w, H) {
if (w - g <= p)
return;
const A = g + w >> 1;
nk(h, c, A, g, w, H), nb(h, c, p, g, A - 1, 1 - H), nb(h, c, p, A + 1, w, 1 - H);
}
function nk(h, c, p, g, w, H) {
for (; w > g; ) {
if (w - g > 600) {
const z = w - g + 1, W = p - g + 1, X = Math.log(z), tt = 0.5 * Math.exp(2 * X / 3), at = 0.5 * Math.sqrt(X * tt * (z - tt) / z) * (W - z / 2 < 0 ? -1 : 1);
nk(h, c, p, Math.max(g, Math.floor(p - W * tt / z + at)), Math.min(w, Math.floor(p + (z - W) * tt / z + at)), H);
}
const A = c[2 * p + H];
let C = g, N = w;
for (iu(h, c, g, p), c[2 * w + H] > A && iu(h, c, g, w); C < N; ) {
for (iu(h, c, C, N), C++, N--; c[2 * C + H] < A; )
C++;
for (; c[2 * N + H] > A; )
N--;
}
c[2 * g + H] === A ? iu(h, c, g, N) : (N++, iu(h, c, N, w)), N <= p && (g = N + 1), p <= N && (w = N - 1);
}
}
function iu(h, c, p, g) {
ib(h, p, g), ib(c, 2 * p, 2 * g), ib(c, 2 * p + 1, 2 * g + 1);
}
function ib(h, c, p) {
const g = h[c];
h[c] = h[p], h[p] = g;
}
function ik(h, c, p, g) {
const w = h - p, H = c - g;
return w * w + H * H;
}
var ob;
s.bg = void 0, (ob = s.bg || (s.bg = {})).create = "create", ob.load = "load", ob.fullLoad = "fullLoad";
let Up = null, ou = [];
const sb = 1e3 / 60, ab = "loadTime", lb = "fullLoadTime", tet = { mark(h) {
performance.mark(h);
}, frame(h) {
const c = h;
Up != null && ou.push(c - Up), Up = c;
}, clearMetrics() {
Up = null, ou = [], performance.clearMeasures(ab), performance.clearMeasures(lb);
for (const h in s.bg)
performance.clearMarks(s.bg[h]);
}, getPerformanceMetrics() {
performance.measure(ab, s.bg.create, s.bg.load), performance.measure(lb, s.bg.create, s.bg.fullLoad);
const h = performance.getEntriesByName(ab)[0].duration, c = performance.getEntriesByName(lb)[0].duration, p = ou.length, g = 1 / (ou.reduce((H, A) => H + A, 0) / p / 1e3), w = ou.filter((H) => H > sb).reduce((H, A) => H + (A - sb) / sb, 0);
return { loadTime: h, fullLoadTime: c, fps: g, percentDroppedFrames: w / (p + w) * 100, totalFrames: p };
} };
s.$ = class extends Y {
}, s.A = Bl, s.B = Q_, s.C = function(h) {
if (re == null) {
const c = h.navigator ? h.navigator.userAgent : null;
re = !!h.safari || !(!c || !(/\b(iPad|iPhone|iPod)\b/.test(c) || c.match("Safari") && !c.match("Chrome")));
}
return re;
}, s.D = cr, s.E = ar, s.F = class {
constructor(h, c) {
this.target = h, this.mapId = c, this.resolveRejects = {}, this.tasks = {}, this.taskQueue = [], this.abortControllers = {}, this.messageHandlers = {}, this.invoker = new Gtt(() => this.process()), this.subscription = function(p, g, w, H) {
return p.addEventListener(g, w, !1), { unsubscribe: () => {
p.removeEventListener(g, w, !1);
} };
}(this.target, "message", (p) => this.receive(p)), this.globalScope = oe(self) ? h : window;
}
registerMessageHandler(h, c) {
this.messageHandlers[h] = c;
}
sendAsync(h, c) {
return new Promise((p, g) => {
const w = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
this.resolveRejects[w] = { resolve: p, reject: g }, c && c.signal.addEventListener("abort", () => {
delete this.resolveRejects[w];
const C = { id: w, type: "", origin: location.origin, targetMapId: h.targetMapId, sourceMapId: this.mapId };
this.target.postMessage(C);
}, { once: !0 });
const H = [], A = Object.assign(Object.assign({}, h), { id: w, sourceMapId: this.mapId, origin: location.origin, data: r6(h.data, H) });
this.target.postMessage(A, { transfer: H });
});
}
receive(h) {
const c = h.data, p = c.id;
if (!(c.origin !== "file://" && location.origin !== "file://" && c.origin !== "resource://android" && location.origin !== "resource://android" && c.origin !== location.origin || c.targetMapId && this.mapId !== c.targetMapId)) {
if (c.type === "") {
delete this.tasks[p];
const g = this.abortControllers[p];
return delete this.abortControllers[p], void (g && g.abort());
}
if (oe(self) || c.mustQueue)
return this.tasks[p] = c, this.taskQueue.push(p), void this.invoker.trigger();
this.processTask(p, c);
}
}
process() {
if (this.taskQueue.length === 0)
return;
const h = this.taskQueue.shift(), c = this.tasks[h];
delete this.tasks[h], this.taskQueue.length > 0 && this.invoker.trigger(), c && this.processTask(h, c);
}
processTask(h, c) {
return a(this, void 0, void 0, function* () {
if (c.type === "") {
const w = this.resolveRejects[h];
return delete this.resolveRejects[h], w ? void (c.error ? w.reject(n6(c.error)) : w.resolve(n6(c.data))) : void 0;
}
if (!this.messageHandlers[c.type])
return void this.completeTask(h, new Error(`Could not find a registered handler for ${c.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));
const p = n6(c.data), g = new AbortController();
this.abortControllers[h] = g;
try {
const w = yield this.messageHandlers[c.type](c.sourceMapId, p, g);
this.completeTask(h, null, w);
} catch (w) {
this.completeTask(h, w);
}
});
}
completeTask(h, c, p) {
const g = [];
delete this.abortControllers[h];
const w = { id: h, type: "", sourceMapId: this.mapId, origin: location.origin, error: c ? r6(c) : null, data: r6(p, g) };
this.target.postMessage(w, { transfer: g });
}
remove() {
this.invoker.remove(), this.subscription.unsubscribe();
}
}, s.G = Ne, s.H = function() {
var h = new Bl(16);
return Bl != Float32Array && (h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0), h[0] = 1, h[5] = 1, h[10] = 1, h[15] = 1, h;
}, s.I = z_, s.J = function(h, c, p) {
var g, w, H, A, C, N, z, W, X, tt, at, ut, Tt = p[0], Lt = p[1], Et = p[2];
return c === h ? (h[12] = c[0] * Tt + c[4] * Lt + c[8] * Et + c[12], h[13] = c[1] * Tt + c[5] * Lt + c[9] * Et + c[13], h[14] = c[2] * Tt + c[6] * Lt + c[10] * Et + c[14], h[15] = c[3] * Tt + c[7] * Lt + c[11] * Et + c[15]) : (w = c[1], H = c[2], A = c[3], C = c[4], N = c[5], z = c[6], W = c[7], X = c[8], tt = c[9], at = c[10], ut = c[11], h[0] = g = c[0], h[1] = w, h[2] = H, h[3] = A, h[4] = C, h[5] = N, h[6] = z, h[7] = W, h[8] = X, h[9] = tt, h[10] = at, h[11] = ut, h[12] = g * Tt + C * Lt + X * Et + c[12], h[13] = w * Tt + N * Lt + tt * Et + c[13], h[14] = H * Tt + z * Lt + at * Et + c[14], h[15] = A * Tt + W * Lt + ut * Et + c[15]), h;
}, s.K = function(h, c, p) {
var g = p[0], w = p[1], H = p[2];
return h[0] = c[0] * g, h[1] = c[1] * g, h[2] = c[2] * g, h[3] = c[3] * g, h[4] = c[4] * w, h[5] = c[5] * w, h[6] = c[6] * w, h[7] = c[7] * w, h[8] = c[8] * H, h[9] = c[9] * H, h[10] = c[10] * H, h[11] = c[11] * H, h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15], h;
}, s.L = NO, s.M = function(h, c) {
const p = {};
for (let g = 0; g < c.length; g++) {
const w = c[g];
w in h && (p[w] = h[w]);
}
return p;
}, s.N = f6, s.O = kC, s.P = f, s.Q = IC, s.R = k2, s.S = I2, s.T = Ol, s.U = x, s.V = O, s.W = qr, s.X = Zi, s.Y = V, s.Z = ru, s._ = a, s.a = er, s.a$ = function(h, c) {
var p = h[0], g = h[1], w = h[2], H = h[3], A = h[4], C = h[5], N = h[6], z = h[7], W = h[8], X = h[9], tt = h[10], at = h[11], ut = h[12], Tt = h[13], Lt = h[14], Et = h[15], $t = c[0], Pt = c[1], Bt = c[2], ee = c[3], _e = c[4], Xe = c[5], Er = c[6], ze = c[7], Re = c[8], Qr = c[9], sr = c[10], rr = c[11], ue = c[12], gr = c[13], pr = c[14], Ir = c[15];
return Math.abs(p - $t) <= go * Math.max(1, Math.abs(p), Math.abs($t)) && Math.abs(g - Pt) <= go * Math.max(1, Math.abs(g), Math.abs(Pt)) && Math.abs(w - Bt) <= go * Math.max(1, Math.abs(w), Math.abs(Bt)) && Math.abs(H - ee) <= go * Math.max(1, Math.abs(H), Math.abs(ee)) && Math.abs(A - _e) <= go * Math.max(1, Math.abs(A), Math.abs(_e)) && Math.abs(C - Xe) <= go * Math.max(1, Math.abs(C), Math.abs(Xe)) && Math.abs(N - Er) <= go * Math.max(1, Math.abs(N), Math.abs(Er)) && Math.abs(z - ze) <= go * Math.max(1, Math.abs(z), Math.abs(ze)) && Math.abs(W - Re) <= go * Math.max(1, Math.abs(W), Math.abs(Re)) && Math.abs(X - Qr) <= go * Math.max(1, Math.abs(X), Math.abs(Qr)) && Math.abs(tt - sr) <= go * Math.max(1, Math.abs(tt), Math.abs(sr)) && Math.abs(at - rr) <= go * Math.max(1, Math.abs(at), Math.abs(rr)) && Math.abs(ut - ue) <= go * Math.max(1, Math.abs(ut), Math.abs(ue)) && Math.abs(Tt - gr) <= go * Math.max(1, Math.abs(Tt), Math.abs(gr)) && Math.abs(Lt - pr) <= go * Math.max(1, Math.abs(Lt), Math.abs(pr)) && Math.abs(Et - Ir) <= go * Math.max(1, Math.abs(Et), Math.abs(Ir));
}, s.a0 = an, s.a1 = J_, s.a2 = ye, s.a3 = (h) => {
const c = window.document.createElement("video");
return c.muted = !0, new Promise((p) => {
c.onloadstart = () => {
p(c);
};
for (const g of h) {
const w = window.document.createElement("source");
de(g) || (c.crossOrigin = "Anonymous"), w.src = g, c.appendChild(w);
}
});
}, s.a4 = function() {
return et++;
}, s.a5 = We, s.a6 = $l, s.a7 = Y4, s.a8 = B0, s.a9 = FC, s.aA = function(h) {
if (h.type === "custom")
return new Utt(h);
switch (h.type) {
case "background":
return new Btt(h);
case "circle":
return new MJ(h);
case "fill":
return new UJ(h);
case "fill-extrusion":
return new ott(h);
case "heatmap":
return new HJ(h);
case "hillshade":
return new OJ(h);
case "line":
return new ptt(h);
case "raster":
return new ztt(h);
case "symbol":
return new Dp(h);
}
}, s.aB = rt, s.aC = function(h, c) {
if (!h)
return [{ command: "setStyle", args: [c] }];
let p = [];
try {
if (!Hr(h.version, c.version))
return [{ command: "setStyle", args: [c] }];
Hr(h.center, c.center) || p.push({ command: "setCenter", args: [c.center] }), Hr(h.zoom, c.zoom) || p.push({ command: "setZoom", args: [c.zoom] }), Hr(h.bearing, c.bearing) || p.push({ command: "setBearing", args: [c.bearing] }), Hr(h.pitch, c.pitch) || p.push({ command: "setPitch", args: [c.pitch] }), Hr(h.sprite, c.sprite) || p.push({ command: "setSprite", args: [c.sprite] }), Hr(h.glyphs, c.glyphs) || p.push({ command: "setGlyphs", args: [c.glyphs] }), Hr(h.transition, c.transition) || p.push({ command: "setTransition", args: [c.transition] }), Hr(h.light, c.light) || p.push({ command: "setLight", args: [c.light] }), Hr(h.terrain, c.terrain) || p.push({ command: "setTerrain", args: [c.terrain] }), Hr(h.sky, c.sky) || p.push({ command: "setSky", args: [c.sky] }), Hr(h.projection, c.projection) || p.push({ command: "setProjection", args: [c.projection] });
const g = {}, w = [];
(function(A, C, N, z) {
let W;
for (W in C = C || {}, A = A || {})
Object.prototype.hasOwnProperty.call(A, W) && (Object.prototype.hasOwnProperty.call(C, W) || ji(W, N, z));
for (W in C)
Object.prototype.hasOwnProperty.call(C, W) && (Object.prototype.hasOwnProperty.call(A, W) ? Hr(A[W], C[W]) || (A[W].type === "geojson" && C[W].type === "geojson" && ki(A, C, W) ? Rr(N, { command: "setGeoJSONSourceData", args: [W, C[W].data] }) : Ji(W, C, N, z)) : dn(W, C, N));
})(h.sources, c.sources, w, g);
const H = [];
h.layers && h.layers.forEach((A) => {
"source" in A && g[A.source] ? p.push({ command: "removeLayer", args: [A.id] }) : H.push(A);
}), p = p.concat(w), function(A, C, N) {
C = C || [];
const z = (A = A || []).map(Ii), W = C.map(Ii), X = A.reduce(c1, {}), tt = C.reduce(c1, {}), at = z.slice(), ut = /* @__PURE__ */ Object.create(null);
let Tt, Lt, Et, $t, Pt;
for (let Bt = 0, ee = 0; Bt < z.length; Bt++)
Tt = z[Bt], Object.prototype.hasOwnProperty.call(tt, Tt) ? ee++ : (Rr(N, { command: "removeLayer", args: [Tt] }), at.splice(at.indexOf(Tt, ee), 1));
for (let Bt = 0, ee = 0; Bt < W.length; Bt++)
Tt = W[W.length - 1 - Bt], at[at.length - 1 - Bt] !== Tt && (Object.prototype.hasOwnProperty.call(X, Tt) ? (Rr(N, { command: "removeLayer", args: [Tt] }), at.splice(at.lastIndexOf(Tt, at.length - ee), 1)) : ee++, $t = at[at.length - Bt], Rr(N, { command: "addLayer", args: [tt[Tt], $t] }), at.splice(at.length - Bt, 0, Tt), ut[Tt] = !0);
for (let Bt = 0; Bt < W.length; Bt++)
if (Tt = W[Bt], Lt = X[Tt], Et = tt[Tt], !ut[Tt] && !Hr(Lt, Et))
if (Hr(Lt.source, Et.source) && Hr(Lt["source-layer"], Et["source-layer"]) && Hr(Lt.type, Et.type)) {
for (Pt in _i(Lt.layout, Et.layout, N, Tt, null, "setLayoutProperty"), _i(Lt.paint, Et.paint, N, Tt, null, "setPaintProperty"), Hr(Lt.filter, Et.filter) || Rr(N, { command: "setFilter", args: [Tt, Et.filter] }), Hr(Lt.minzoom, Et.minzoom) && Hr(Lt.maxzoom, Et.maxzoom) || Rr(N, { command: "setLayerZoomRange", args: [Tt, Et.minzoom, Et.maxzoom] }), Lt)
Object.prototype.hasOwnProperty.call(Lt, Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? _i(Lt[Pt], Et[Pt], N, Tt, Pt.slice(6), "setPaintProperty") : Hr(Lt[Pt], Et[Pt]) || Rr(N, { command: "setLayerProperty", args: [Tt, Pt, Et[Pt]] }));
for (Pt in Et)
Object.prototype.hasOwnProperty.call(Et, Pt) && !Object.prototype.hasOwnProperty.call(Lt, Pt) && Pt !== "layout" && Pt !== "paint" && Pt !== "filter" && Pt !== "metadata" && Pt !== "minzoom" && Pt !== "maxzoom" && (Pt.indexOf("paint.") === 0 ? _i(Lt[Pt], Et[Pt], N, Tt, Pt.slice(6), "setPaintProperty") : Hr(Lt[Pt], Et[Pt]) || Rr(N, { command: "setLayerProperty", args: [Tt, Pt, Et[Pt]] }));
} else
Rr(N, { command: "removeLayer", args: [Tt] }), $t = at[at.lastIndexOf(Tt) + 1], Rr(N, { command: "addLayer", args: [Et, $t] });
}(H, c.layers, p);
} catch (g) {
console.warn("Unable to compute style diff:", g), p = [{ command: "setStyle", args: [c] }];
}
return p;
}, s.aD = function(h) {
const c = [], p = h.id;
return p === void 0 && c.push({ message: `layers.${p}: missing required property "id"` }), h.render === void 0 && c.push({ message: `layers.${p}: missing required method "render"` }), h.renderingMode && h.renderingMode !== "2d" && h.renderingMode !== "3d" && c.push({ message: `layers.${p}: property "renderingMode" must be either "2d" or "3d"` }), c;
}, s.aE = function h(c, p) {
if (Array.isArray(c)) {
if (!Array.isArray(p) || c.length !== p.length)
return !1;
for (let g = 0; g < c.length; g++)
if (!h(c[g], p[g]))
return !1;
return !0;
}
if (typeof c == "object" && c !== null && p !== null) {
if (typeof p != "object" || Object.keys(c).length !== Object.keys(p).length)
return !1;
for (const g in c)
if (!h(c[g], p[g]))
return !1;
return !0;
}
return c === p;
}, s.aF = nt, s.aG = ct, s.aH = class extends N0 {
constructor(h, c) {
super(h, c), this.current = 0;
}
set(h) {
this.current !== h && (this.current = h, this.gl.uniform1i(this.location, h));
}
}, s.aI = Ep, s.aJ = class extends N0 {
constructor(h, c) {
super(h, c), this.current = yJ;
}
set(h) {
if (h[12] !== this.current[12] || h[0] !== this.current[0])
return this.current = h, void this.gl.uniformMatrix4fv(this.location, !1, h);
for (let c = 1; c < 16; c++)
if (h[c] !== this.current[c]) {
this.current = h, this.gl.uniformMatrix4fv(this.location, !1, h);
break;
}
}
}, s.aK = MO, s.aL = SO, s.aM = tn, s.aN = class extends N0 {
constructor(h, c) {
super(h, c), this.current = [0, 0, 0];
}
set(h) {
h[0] === this.current[0] && h[1] === this.current[1] && h[2] === this.current[2] || (this.current = h, this.gl.uniform3f(this.location, h[0], h[1], h[2]));
}
}, s.aO = class extends N0 {
constructor(h, c) {
super(h, c), this.current = [0, 0];
}
set(h) {
h[0] === this.current[0] && h[1] === this.current[1] || (this.current = h, this.gl.uniform2f(this.location, h[0], h[1]));
}
}, s.aP = function(h, c, p, g, w, H, A) {
var C = 1 / (c - p), N = 1 / (g - w), z = 1 / (H - A);
return h[0] = -2 * C, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = -2 * N, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = 2 * z, h[11] = 0, h[12] = (c + p) * C, h[13] = (w + g) * N, h[14] = (A + H) * z, h[15] = 1, h;
}, s.aQ = EJ, s.aR = class extends Nt {
}, s.aS = mtt, s.aT = class extends Wt {
}, s.aU = O_, s.aV = function(h) {
return h <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(h) / Math.LN2));
}, s.aW = zO, s.aX = k1, s.aY = C2, s.aZ = class extends ur {
}, s.a_ = function(h, c) {
return h[0] === c[0] && h[1] === c[1] && h[2] === c[2] && h[3] === c[3] && h[4] === c[4] && h[5] === c[5] && h[6] === c[6] && h[7] === c[7] && h[8] === c[8] && h[9] === c[9] && h[10] === c[10] && h[11] === c[11] && h[12] === c[12] && h[13] === c[13] && h[14] === c[14] && h[15] === c[15];
}, s.aa = function(h) {
const c = {};
if (h.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, (p, g, w, H) => {
const A = w || H;
return c[g] = !A || A.toLowerCase(), "";
}), c["max-age"]) {
const p = parseInt(c["max-age"], 10);
isNaN(p) ? delete c["max-age"] : c["max-age"] = p;
}
return c;
}, s.ab = function(h, c) {
const p = [];
for (const g in h)
g in c || p.push(g);
return p;
}, s.ac = F, s.ad = function(h, c, p) {
var g = Math.sin(p), w = Math.cos(p), H = c[0], A = c[1], C = c[2], N = c[3], z = c[4], W = c[5], X = c[6], tt = c[7];
return c !== h && (h[8] = c[8], h[9] = c[9], h[10] = c[10], h[11] = c[11], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15]), h[0] = H * w + z * g, h[1] = A * w + W * g, h[2] = C * w + X * g, h[3] = N * w + tt * g, h[4] = z * w - H * g, h[5] = W * w - A * g, h[6] = X * w - C * g, h[7] = tt * w - N * g, h;
}, s.ae = function(h) {
var c = new Bl(16);
return c[0] = h[0], c[1] = h[1], c[2] = h[2], c[3] = h[3], c[4] = h[4], c[5] = h[5], c[6] = h[6], c[7] = h[7], c[8] = h[8], c[9] = h[9], c[10] = h[10], c[11] = h[11], c[12] = h[12], c[13] = h[13], c[14] = h[14], c[15] = h[15], c;
}, s.af = Ap, s.ag = function(h, c) {
let p = 0, g = 0;
if (h.kind === "constant")
g = h.layoutSize;
else if (h.kind !== "source") {
const { interpolationType: w, minZoom: H, maxZoom: A } = h, C = w ? F(un.interpolationFactor(w, c, H, A), 0, 1) : 0;
h.kind === "camera" ? g = xr.number(h.minSize, h.maxSize, C) : p = C;
}
return { uSizeT: p, uSize: g };
}, s.ai = function(h, { uSize: c, uSizeT: p }, { lowerSize: g, upperSize: w }) {
return h.kind === "source" ? g / Sa : h.kind === "composite" ? xr.number(g / Sa, w / Sa, p) : c;
}, s.aj = W_, s.ak = function(h, c, p, g) {
const w = c.y - h.y, H = c.x - h.x, A = g.y - p.y, C = g.x - p.x, N = A * H - C * w;
if (N === 0)
return null;
const z = (C * (h.y - p.y) - A * (h.x - p.x)) / N;
return new f(h.x + z * H, h.y + z * w);
}, s.al = UC, s.am = CO, s.an = S_, s.ao = function(h) {
let c = 1 / 0, p = 1 / 0, g = -1 / 0, w = -1 / 0;
for (const H of h)
c = Math.min(c, H.x), p = Math.min(p, H.y), g = Math.max(g, H.x), w = Math.max(w, H.y);
return [c, p, g, w];
}, s.ap = r1, s.ar = $_, s.as = function(h, c) {
var p = c[0], g = c[1], w = c[2], H = c[3], A = c[4], C = c[5], N = c[6], z = c[7], W = c[8], X = c[9], tt = c[10], at = c[11], ut = c[12], Tt = c[13], Lt = c[14], Et = c[15], $t = p * C - g * A, Pt = p * N - w * A, Bt = p * z - H * A, ee = g * N - w * C, _e = g * z - H * C, Xe = w * z - H * N, Er = W * Tt - X * ut, ze = W * Lt - tt * ut, Re = W * Et - at * ut, Qr = X * Lt - tt * Tt, sr = X * Et - at * Tt, rr = tt * Et - at * Lt, ue = $t * rr - Pt * sr + Bt * Qr + ee * Re - _e * ze + Xe * Er;
return ue ? (h[0] = (C * rr - N * sr + z * Qr) * (ue = 1 / ue), h[1] = (w * sr - g * rr - H * Qr) * ue, h[2] = (Tt * Xe - Lt * _e + Et * ee) * ue, h[3] = (tt * _e - X * Xe - at * ee) * ue, h[4] = (N * Re - A * rr - z * ze) * ue, h[5] = (p * rr - w * Re + H * ze) * ue, h[6] = (Lt * Bt - ut * Xe - Et * Pt) * ue, h[7] = (W * Xe - tt * Bt + at * Pt) * ue, h[8] = (A * sr - C * Re + z * Er) * ue, h[9] = (g * Re - p * sr - H * Er) * ue, h[10] = (ut * _e - Tt * Bt + Et * $t) * ue, h[11] = (X * Bt - W * _e - at * $t) * ue, h[12] = (C * ze - A * Qr - N * Er) * ue, h[13] = (p * Qr - g * ze + w * Er) * ue, h[14] = (Tt * Pt - ut * ee - Lt * $t) * ue, h[15] = (W * ee - X * Pt + tt * $t) * ue, h) : null;
}, s.at = eb, s.au = G_, s.av = rb, s.aw = function() {
const h = {}, c = Ct.$version;
for (const p in Ct.$root) {
const g = Ct.$root[p];
if (g.required) {
let w = null;
w = p === "version" ? c : g.type === "array" ? [] : {}, w != null && (h[p] = w);
}
}
return h;
}, s.ax = Vc, s.ay = te, s.az = function(h) {
h = h.slice();
const c = /* @__PURE__ */ Object.create(null);
for (let p = 0; p < h.length; p++)
c[h[p].id] = h[p];
for (let p = 0; p < h.length; p++)
"ref" in h[p] && (h[p] = Jr(h[p], c[h[p].ref]));
return h;
}, s.b = Ve, s.b0 = function(h, c) {
return h[0] = c[0], h[1] = c[1], h[2] = c[2], h[3] = c[3], h[4] = c[4], h[5] = c[5], h[6] = c[6], h[7] = c[7], h[8] = c[8], h[9] = c[9], h[10] = c[10], h[11] = c[11], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15], h;
}, s.b1 = function(h, c, p) {
return h[0] = c[0] * p[0], h[1] = c[1] * p[1], h[2] = c[2] * p[2], h[3] = c[3] * p[3], h;
}, s.b2 = function(h, c) {
return h[0] * c[0] + h[1] * c[1] + h[2] * c[2] + h[3] * c[3];
}, s.b3 = U, s.b4 = RC, s.b5 = PC, s.b6 = function(h, c, p, g, w) {
var H, A = 1 / Math.tan(c / 2);
return h[0] = A / p, h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = A, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[11] = -1, h[12] = 0, h[13] = 0, h[15] = 0, w != null && w !== 1 / 0 ? (h[10] = (w + g) * (H = 1 / (g - w)), h[14] = 2 * w * g * H) : (h[10] = -1, h[14] = -2 * g), h;
}, s.b7 = function(h, c, p) {
var g = Math.sin(p), w = Math.cos(p), H = c[4], A = c[5], C = c[6], N = c[7], z = c[8], W = c[9], X = c[10], tt = c[11];
return c !== h && (h[0] = c[0], h[1] = c[1], h[2] = c[2], h[3] = c[3], h[12] = c[12], h[13] = c[13], h[14] = c[14], h[15] = c[15]), h[4] = H * w + z * g, h[5] = A * w + W * g, h[6] = C * w + X * g, h[7] = N * w + tt * g, h[8] = z * w - H * g, h[9] = W * w - A * g, h[10] = X * w - C * g, h[11] = tt * w - N * g, h;
}, s.b8 = k, s.b9 = R, s.bA = cC, s.bB = function(h) {
return h.message === Ke;
}, s.bC = _1, s.bD = Vo, s.ba = function(h) {
return h * Math.PI / 180;
}, s.bb = function(h, c) {
const { x: p, y: g } = ru.fromLngLat(c);
return !(h < 0 || h > 25 || g < 0 || g >= 1 || p < 0 || p >= 1);
}, s.bc = function(h, c) {
return h[0] = c[0], h[1] = 0, h[2] = 0, h[3] = 0, h[4] = 0, h[5] = c[1], h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = c[2], h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0, h[15] = 1, h;
}, s.bd = class extends Z {
}, s.be = K_, s.bf = tet, s.bh = Gt, s.bi = function(h, c) {
er.REGISTERED_PROTOCOLS[h] = c;
}, s.bj = function(h) {
delete er.REGISTERED_PROTOCOLS[h];
}, s.bk = function(h, c) {
const p = {};
for (let w = 0; w < h.length; w++) {
const H = c && c[h[w].id] || e2(h[w]);
c && (c[h[w].id] = H);
let A = p[H];
A || (A = p[H] = []), A.push(h[w]);
}
const g = [];
for (const w in p)
g.push(p[w]);
return g;
}, s.bl = nr, s.bm = DC, s.bn = BC, s.bo = gC, s.bp = function(h) {
h.bucket.createArrays(), h.bucket.tilePixelRatio = Zi / (512 * h.bucket.overscaling), h.bucket.compareText = {}, h.bucket.iconsNeedLinear = !1;
const c = h.bucket.layers[0], p = c.layout, g = c._unevaluatedLayout._values, w = { layoutIconSize: g["icon-size"].possiblyEvaluate(new ti(h.bucket.zoom + 1), h.canonical), layoutTextSize: g["text-size"].possiblyEvaluate(new ti(h.bucket.zoom + 1), h.canonical), textMaxSize: g["text-size"].possiblyEvaluate(new ti(18)) };
if (h.bucket.textSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h.bucket.textSizeData;
w.compositeTextSizes = [g["text-size"].possiblyEvaluate(new ti(z), h.canonical), g["text-size"].possiblyEvaluate(new ti(W), h.canonical)];
}
if (h.bucket.iconSizeData.kind === "composite") {
const { minZoom: z, maxZoom: W } = h.bucket.iconSizeData;
w.compositeIconSizes = [g["icon-size"].possiblyEvaluate(new ti(z), h.canonical), g["icon-size"].possiblyEvaluate(new ti(W), h.canonical)];
}
const H = p.get("text-line-height") * r1, A = p.get("text-rotation-alignment") !== "viewport" && p.get("symbol-placement") !== "point", C = p.get("text-keep-upright"), N = p.get("text-size");
for (const z of h.bucket.features) {
const W = p.get("text-font").evaluate(z, {}, h.canonical).join(","), X = N.evaluate(z, {}, h.canonical), tt = w.layoutTextSize.evaluate(z, {}, h.canonical), at = w.layoutIconSize.evaluate(z, {}, h.canonical), ut = { horizontal: {}, vertical: void 0 }, Tt = z.text;
let Lt, Et = [0, 0];
if (Tt) {
const Bt = Tt.toString(), ee = p.get("text-letter-spacing").evaluate(z, {}, h.canonical) * r1, _e = m_(Bt) ? ee : 0, Xe = p.get("text-anchor").evaluate(z, {}, h.canonical), Er = JC(c, z, h.canonical);
if (!Er) {
const sr = p.get("text-radial-offset").evaluate(z, {}, h.canonical);
Et = sr ? YC(Xe, [sr * r1, tb]) : p.get("text-offset").evaluate(z, {}, h.canonical).map((rr) => rr * r1);
}
let ze = A ? "center" : p.get("text-justify").evaluate(z, {}, h.canonical);
const Re = p.get("symbol-placement") === "point" ? p.get("text-max-width").evaluate(z, {}, h.canonical) * r1 : 1 / 0, Qr = () => {
h.bucket.allowVerticalPlacement && Rc(Bt) && (ut.vertical = Vp(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, "left", _e, Et, s.ah.vertical, !0, tt, X));
};
if (!A && Er) {
const sr = /* @__PURE__ */ new Set();
if (ze === "auto")
for (let ue = 0; ue < Er.values.length; ue += 2)
sr.add(eb(Er.values[ue]));
else
sr.add(ze);
let rr = !1;
for (const ue of sr)
if (!ut.horizontal[ue])
if (rr)
ut.horizontal[ue] = ut.horizontal[0];
else {
const gr = Vp(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, "center", ue, _e, Et, s.ah.horizontal, !1, tt, X);
gr && (ut.horizontal[ue] = gr, rr = gr.positionedLines.length === 1);
}
Qr();
} else {
ze === "auto" && (ze = eb(Xe));
const sr = Vp(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.horizontal, !1, tt, X);
sr && (ut.horizontal[ze] = sr), Qr(), Rc(Bt) && A && C && (ut.vertical = Vp(Tt, h.glyphMap, h.glyphPositions, h.imagePositions, W, Re, H, Xe, ze, _e, Et, s.ah.vertical, !1, tt, X));
}
}
let $t = !1;
if (z.icon && z.icon.name) {
const Bt = h.imageMap[z.icon.name];
Bt && (Lt = Vtt(h.imagePositions[z.icon.name], p.get("icon-offset").evaluate(z, {}, h.canonical), p.get("icon-anchor").evaluate(z, {}, h.canonical)), $t = !!Bt.sdf, h.bucket.sdfIcons === void 0 ? h.bucket.sdfIcons = $t : h.bucket.sdfIcons !== $t && It("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (Bt.pixelRatio !== h.bucket.pixelRatio || p.get("icon-rotate").constantOr(1) !== 0) && (h.bucket.iconsNeedLinear = !0));
}
const Pt = ek(ut.horizontal) || ut.vertical;
h.bucket.iconsInText = !!Pt && Pt.iconsInText, (Pt || Lt) && Ytt(h.bucket, z, ut, Lt, h.imageMap, w, tt, at, Et, $t, h.canonical);
}
h.showCollisionBoxes && h.bucket.generateCollisionDebugBuffers();
}, s.bq = D_, s.br = V_, s.bs = N_, s.bt = d6, s.bu = B_, s.bv = class {
constructor(h) {
this._marks = { start: [h.url, "start"].join("#"), end: [h.url, "end"].join("#"), measure: h.url.toString() }, performance.mark(this._marks.start);
}
finish() {
performance.mark(this._marks.end);
let h = performance.getEntriesByName(this._marks.measure);
return h.length === 0 && (performance.measure(this._marks.measure, this._marks.start, this._marks.end), h = performance.getEntriesByName(this._marks.measure), performance.clearMarks(this._marks.start), performance.clearMarks(this._marks.end), performance.clearMeasures(this._marks.measure)), h;
}
}, s.bw = function(h, c, p, g, w) {
return a(this, void 0, void 0, function* () {
if (O())
try {
return yield qr(h, c, p, g, w);
} catch {
}
return function(H, A, C, N, z) {
const W = H.width, X = H.height;
ie && Qe || (ie = new OffscreenCanvas(W, X), Qe = ie.getContext("2d", { willReadFrequently: !0 })), ie.width = W, ie.height = X, Qe.drawImage(H, 0, 0, W, X);
const tt = Qe.getImageData(A, C, N, z);
return Qe.clearRect(0, 0, W, X), tt.data;
}(h, c, p, g, w);
});
}, s.bx = NC, s.by = u, s.bz = d, s.c = He, s.d = (h) => a(void 0, void 0, void 0, function* () {
if (h.byteLength === 0)
return createImageBitmap(new ImageData(1, 1));
const c = new Blob([new Uint8Array(h)], { type: "image/png" });
try {
return createImageBitmap(c);
} catch (p) {
throw new Error(`Could not load image because of ${p.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`);
}
}), s.e = $, s.f = (h) => new Promise((c, p) => {
const g = new Image();
g.onload = () => {
c(g), URL.revokeObjectURL(g.src), g.onload = null, window.requestAnimationFrame(() => {
g.src = yr;
});
}, g.onerror = () => p(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 w = new Blob([new Uint8Array(h)], { type: "image/png" });
g.src = h.byteLength ? URL.createObjectURL(w) : yr;
}), s.g = Je, s.h = (h, c) => me($(h, { type: "json" }), c), s.i = oe, s.j = $e, s.k = qe, s.l = (h, c) => me($(h, { type: "arrayBuffer" }), c), s.m = me, s.n = function(h) {
return new B_(h).readFields(Htt, []);
}, s.o = $c, s.p = mC, s.q = S, s.r = f_, s.s = de, s.t = Ic, s.u = F3, s.v = Ct, s.w = It, s.x = function([h, c, p]) {
return c += 90, c *= Math.PI / 180, p *= Math.PI / 180, { x: h * Math.cos(c) * Math.sin(p), y: h * Math.sin(c) * Math.sin(p), z: h * Math.cos(p) };
}, s.y = xr, s.z = ti;
}), i("worker", ["./shared"], function(s) {
class a {
constructor(ot) {
this.keyCache = {}, ot && this.replace(ot);
}
replace(ot) {
this._layerConfigs = {}, this._layers = {}, this.update(ot, []);
}
update(ot, st) {
for (const yt of ot) {
this._layerConfigs[yt.id] = yt;
const At = this._layers[yt.id] = s.aA(yt);
At._featureFilter = s.a7(At.filter), this.keyCache[yt.id] && delete this.keyCache[yt.id];
}
for (const yt of st)
delete this.keyCache[yt], delete this._layerConfigs[yt], delete this._layers[yt];
this.familiesBySource = {};
const pt = s.bk(Object.values(this._layerConfigs), this.keyCache);
for (const yt of pt) {
const At = yt.map((Xt) => this._layers[Xt.id]), Vt = At[0];
if (Vt.visibility === "none")
continue;
const jt = Vt.source || "";
let St = this.familiesBySource[jt];
St || (St = this.familiesBySource[jt] = {});
const Jt = Vt.sourceLayer || "_geojsonTileLayer";
let ae = St[Jt];
ae || (ae = St[Jt] = []), ae.push(At);
}
}
}
class u {
constructor(ot) {
const st = {}, pt = [];
for (const jt in ot) {
const St = ot[jt], Jt = st[jt] = {};
for (const ae in St) {
const Xt = St[+ae];
if (!Xt || Xt.bitmap.width === 0 || Xt.bitmap.height === 0)
continue;
const Le = { x: 0, y: 0, w: Xt.bitmap.width + 2, h: Xt.bitmap.height + 2 };
pt.push(Le), Jt[ae] = { rect: Le, metrics: Xt.metrics };
}
}
const { w: yt, h: At } = s.p(pt), Vt = new s.o({ width: yt || 1, height: At || 1 });
for (const jt in ot) {
const St = ot[jt];
for (const Jt in St) {
const ae = St[+Jt];
if (!ae || ae.bitmap.width === 0 || ae.bitmap.height === 0)
continue;
const Xt = st[jt][Jt].rect;
s.o.copy(ae.bitmap, Vt, { x: 0, y: 0 }, { x: Xt.x + 1, y: Xt.y + 1 }, ae.bitmap);
}
}
this.image = Vt, this.positions = st;
}
}
s.bl("GlyphAtlas", u);
class d {
constructor(ot) {
this.tileID = new s.S(ot.tileID.overscaledZ, ot.tileID.wrap, ot.tileID.canonical.z, ot.tileID.canonical.x, ot.tileID.canonical.y), this.uid = ot.uid, this.zoom = ot.zoom, this.pixelRatio = ot.pixelRatio, this.tileSize = ot.tileSize, this.source = ot.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = ot.showCollisionBoxes, this.collectResourceTiming = !!ot.collectResourceTiming, this.returnDependencies = !!ot.returnDependencies, this.promoteId = ot.promoteId, this.inFlightDependencies = [];
}
parse(ot, st, pt, yt) {
return s._(this, void 0, void 0, function* () {
this.status = "parsing", this.data = ot, this.collisionBoxArray = new s.a5();
const At = new s.bm(Object.keys(ot.layers).sort()), Vt = new s.bn(this.tileID, this.promoteId);
Vt.bucketLayerIDs = [];
const jt = {}, St = { featureIndex: Vt, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: pt }, Jt = st.familiesBySource[this.source];
for (const br in Jt) {
const Br = ot.layers[br];
if (!Br)
continue;
Br.version === 1 && s.w(`Vector tile source "${this.source}" layer "${br}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
const cn = At.encode(br), Kn = [];
for (let Li = 0; Li < Br.length; Li++) {
const Ri = Br.feature(Li), rs = Vt.getId(Ri, br);
Kn.push({ feature: Ri, id: rs, index: Li, sourceLayerIndex: cn });
}
for (const Li of Jt[br]) {
const Ri = Li[0];
Ri.source !== this.source && s.w(`layer.source = ${Ri.source} does not equal this.source = ${this.source}`), Ri.minzoom && this.zoom < Math.floor(Ri.minzoom) || Ri.maxzoom && this.zoom >= Ri.maxzoom || Ri.visibility !== "none" && (T(Li, this.zoom, pt), (jt[Ri.id] = Ri.createBucket({ index: Vt.bucketLayerIDs.length, layers: Li, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: cn, sourceID: this.source })).populate(Kn, St, this.tileID.canonical), Vt.bucketLayerIDs.push(Li.map((rs) => rs.id)));
}
}
const ae = s.aF(St.glyphDependencies, (br) => Object.keys(br).map(Number));
this.inFlightDependencies.forEach((br) => br == null ? void 0 : br.abort()), this.inFlightDependencies = [];
let Xt = Promise.resolve({});
if (Object.keys(ae).length) {
const br = new AbortController();
this.inFlightDependencies.push(br), Xt = yt.sendAsync({ type: "GG", data: { stacks: ae, source: this.source, tileID: this.tileID, type: "glyphs" } }, br);
}
const Le = Object.keys(St.iconDependencies);
let or = Promise.resolve({});
if (Le.length) {
const br = new AbortController();
this.inFlightDependencies.push(br), or = yt.sendAsync({ type: "GI", data: { icons: Le, source: this.source, tileID: this.tileID, type: "icons" } }, br);
}
const Rt = Object.keys(St.patternDependencies);
let Te = Promise.resolve({});
if (Rt.length) {
const br = new AbortController();
this.inFlightDependencies.push(br), Te = yt.sendAsync({ type: "GI", data: { icons: Rt, source: this.source, tileID: this.tileID, type: "patterns" } }, br);
}
const [Se, lr, Ar] = yield Promise.all([Xt, or, Te]), vn = new u(Se), zr = new s.bo(lr, Ar);
for (const br in jt) {
const Br = jt[br];
Br instanceof s.a6 ? (T(Br.layers, this.zoom, pt), s.bp({ bucket: Br, glyphMap: Se, glyphPositions: vn.positions, imageMap: lr, imagePositions: zr.iconPositions, showCollisionBoxes: this.showCollisionBoxes, canonical: this.tileID.canonical })) : Br.hasPattern && (Br instanceof s.bq || Br instanceof s.br || Br instanceof s.bs) && (T(Br.layers, this.zoom, pt), Br.addFeatures(St, this.tileID.canonical, zr.patternPositions));
}
return this.status = "done", { buckets: Object.values(jt).filter((br) => !br.isEmpty()), featureIndex: Vt, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: vn.image, imageAtlas: zr, glyphMap: this.returnDependencies ? Se : null, iconMap: this.returnDependencies ? lr : null, glyphPositions: this.returnDependencies ? vn.positions : null };
});
}
}
function T(xt, ot, st) {
const pt = new s.z(ot);
for (const yt of xt)
yt.recalculate(pt, st);
}
class f {
constructor(ot, st, pt) {
this.actor = ot, this.layerIndex = st, this.availableImages = pt, this.fetching = {}, this.loading = {}, this.loaded = {};
}
loadVectorTile(ot, st) {
return s._(this, void 0, void 0, function* () {
const pt = yield s.l(ot.request, st);
try {
return { vectorTile: new s.bt.VectorTile(new s.bu(pt.data)), rawData: pt.data, cacheControl: pt.cacheControl, expires: pt.expires };
} catch (yt) {
const At = new Uint8Array(pt.data);
let Vt = `Unable to parse the tile at ${ot.request.url}, `;
throw Vt += At[0] === 31 && At[1] === 139 ? "please make sure the data is not gzipped and that you have configured the relevant header in the server" : `got error: ${yt.message}`, new Error(Vt);
}
});
}
loadTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = ot.uid, pt = !!(ot && ot.request && ot.request.collectResourceTiming) && new s.bv(ot.request), yt = new d(ot);
this.loading[st] = yt;
const At = new AbortController();
yt.abort = At;
try {
const Vt = yield this.loadVectorTile(ot, At);
if (delete this.loading[st], !Vt)
return null;
const jt = Vt.rawData, St = {};
Vt.expires && (St.expires = Vt.expires), Vt.cacheControl && (St.cacheControl = Vt.cacheControl);
const Jt = {};
if (pt) {
const Xt = pt.finish();
Xt && (Jt.resourceTiming = JSON.parse(JSON.stringify(Xt)));
}
yt.vectorTile = Vt.vectorTile;
const ae = yt.parse(Vt.vectorTile, this.layerIndex, this.availableImages, this.actor);
this.loaded[st] = yt, this.fetching[st] = { rawTileData: jt, cacheControl: St, resourceTiming: Jt };
try {
const Xt = yield ae;
return s.e({ rawTileData: jt.slice(0) }, Xt, St, Jt);
} finally {
delete this.fetching[st];
}
} catch (Vt) {
throw delete this.loading[st], yt.status = "done", this.loaded[st] = yt, Vt;
}
});
}
reloadTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = ot.uid;
if (!this.loaded || !this.loaded[st])
throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");
const pt = this.loaded[st];
if (pt.showCollisionBoxes = ot.showCollisionBoxes, pt.status === "parsing") {
const yt = yield pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
let At;
if (this.fetching[st]) {
const { rawTileData: Vt, cacheControl: jt, resourceTiming: St } = this.fetching[st];
delete this.fetching[st], At = s.e({ rawTileData: Vt.slice(0) }, yt, jt, St);
} else
At = yt;
return At;
}
if (pt.status === "done" && pt.vectorTile)
return pt.parse(pt.vectorTile, this.layerIndex, this.availableImages, this.actor);
});
}
abortTile(ot) {
return s._(this, void 0, void 0, function* () {
const st = this.loading, pt = ot.uid;
st && st[pt] && st[pt].abort && (st[pt].abort.abort(), delete st[pt]);
});
}
removeTile(ot) {
return s._(this, void 0, void 0, function* () {
this.loaded && this.loaded[ot.uid] && delete this.loaded[ot.uid];
});
}
}
class Q {
constructor() {
this.loaded = {};
}
loadTile(ot) {
return s._(this, void 0, void 0, function* () {
const { uid: st, encoding: pt, rawImageData: yt, redFactor: At, greenFactor: Vt, blueFactor: jt, baseShift: St } = ot, Jt = yt.width + 2, ae = yt.height + 2, Xt = s.b(yt) ? new s.R({ width: Jt, height: ae }, yield s.bw(yt, -1, -1, Jt, ae)) : yt, Le = new s.bx(st, Xt, pt, At, Vt, jt, St);
return this.loaded = this.loaded || {}, this.loaded[st] = Le, Le;
});
}
removeTile(ot) {
const st = this.loaded, pt = ot.uid;
st && st[pt] && delete st[pt];
}
}
function y(xt, ot) {
if (xt.length !== 0) {
_(xt[0], ot);
for (var st = 1; st < xt.length; st++)
_(xt[st], !ot);
}
}
function _(xt, ot) {
for (var st = 0, pt = 0, yt = 0, At = xt.length, Vt = At - 1; yt < At; Vt = yt++) {
var jt = (xt[yt][0] - xt[Vt][0]) * (xt[Vt][1] + xt[yt][1]), St = st + jt;
pt += Math.abs(st) >= Math.abs(jt) ? st - St + jt : jt - St + st, st = St;
}
st + pt >= 0 != !!ot && xt.reverse();
}
var L = s.by(function xt(ot, st) {
var pt, yt = ot && ot.type;
if (yt === "FeatureCollection")
for (pt = 0; pt < ot.features.length; pt++)
xt(ot.features[pt], st);
else if (yt === "GeometryCollection")
for (pt = 0; pt < ot.geometries.length; pt++)
xt(ot.geometries[pt], st);
else if (yt === "Feature")
xt(ot.geometry, st);
else if (yt === "Polygon")
y(ot.coordinates, st);
else if (yt === "MultiPolygon")
for (pt = 0; pt < ot.coordinates.length; pt++)
y(ot.coordinates[pt], st);
return ot;
});
const E = s.bt.VectorTileFeature.prototype.toGeoJSON;
var x = { exports: {} }, O = s.bz, k = s.bt.VectorTileFeature, R = F;
function F(xt, ot) {
this.options = ot || {}, this.features = xt, this.length = xt.length;
}
function U(xt, ot) {
this.id = typeof xt.id == "number" ? xt.id : void 0, this.type = xt.type, this.rawGeometry = xt.type === 1 ? [xt.geometry] : xt.geometry, this.properties = xt.tags, this.extent = ot || 4096;
}
F.prototype.feature = function(xt) {
return new U(this.features[xt], this.options.extent);
}, U.prototype.loadGeometry = function() {
var xt = this.rawGeometry;
this.geometry = [];
for (var ot = 0; ot < xt.length; ot++) {
for (var st = xt[ot], pt = [], yt = 0; yt < st.length; yt++)
pt.push(new O(st[yt][0], st[yt][1]));
this.geometry.push(pt);
}
return this.geometry;
}, U.prototype.bbox = function() {
this.geometry || this.loadGeometry();
for (var xt = this.geometry, ot = 1 / 0, st = -1 / 0, pt = 1 / 0, yt = -1 / 0, At = 0; At < xt.length; At++)
for (var Vt = xt[At], jt = 0; jt < Vt.length; jt++) {
var St = Vt[jt];
ot = Math.min(ot, St.x), st = Math.max(st, St.x), pt = Math.min(pt, St.y), yt = Math.max(yt, St.y);
}
return [ot, pt, st, yt];
}, U.prototype.toGeoJSON = k.prototype.toGeoJSON;
var $ = s.bA, et = R;
function nt(xt) {
var ot = new $();
return function(st, pt) {
for (var yt in st.layers)
pt.writeMessage(3, ct, st.layers[yt]);
}(xt, ot), ot.finish();
}
function ct(xt, ot) {
var st;
ot.writeVarintField(15, xt.version || 1), ot.writeStringField(1, xt.name || ""), ot.writeVarintField(5, xt.extent || 4096);
var pt = { keys: [], values: [], keycache: {}, valuecache: {} };
for (st = 0; st < xt.length; st++)
pt.feature = xt.feature(st), ot.writeMessage(2, rt, pt);
var yt = pt.keys;
for (st = 0; st < yt.length; st++)
ot.writeStringField(3, yt[st]);
var At = pt.values;
for (st = 0; st < At.length; st++)
ot.writeMessage(4, re, At[st]);
}
function rt(xt, ot) {
var st = xt.feature;
st.id !== void 0 && ot.writeVarintField(1, st.id), ot.writeMessage(2, gt, xt), ot.writeVarintField(3, st.type), ot.writeMessage(4, oe, st);
}
function gt(xt, ot) {
var st = xt.feature, pt = xt.keys, yt = xt.values, At = xt.keycache, Vt = xt.valuecache;
for (var jt in st.properties) {
var St = st.properties[jt], Jt = At[jt];
if (St !== null) {
Jt === void 0 && (pt.push(jt), At[jt] = Jt = pt.length - 1), ot.writeVarint(Jt);
var ae = typeof St;
ae !== "string" && ae !== "boolean" && ae !== "number" && (St = JSON.stringify(St));
var Xt = ae + ":" + St, Le = Vt[Xt];
Le === void 0 && (yt.push(St), Vt[Xt] = Le = yt.length - 1), ot.writeVarint(Le);
}
}
}
function It(xt, ot) {
return (ot << 3) + (7 & xt);
}
function Zt(xt) {
return xt << 1 ^ xt >> 31;
}
function oe(xt, ot) {
for (var st = xt.loadGeometry(), pt = xt.type, yt = 0, At = 0, Vt = st.length, jt = 0; jt < Vt; jt++) {
var St = st[jt], Jt = 1;
pt === 1 && (Jt = St.length), ot.writeVarint(It(1, Jt));
for (var ae = pt === 3 ? St.length - 1 : St.length, Xt = 0; Xt < ae; Xt++) {
Xt === 1 && pt !== 1 && ot.writeVarint(It(2, ae - 1));
var Le = St[Xt].x - yt, or = St[Xt].y - At;
ot.writeVarint(Zt(Le)), ot.writeVarint(Zt(or)), yt += Le, At += or;
}
pt === 3 && ot.writeVarint(It(7, 1));
}
}
function re(xt, ot) {
var st = typeof xt;
st === "string" ? ot.writeStringField(1, xt) : st === "boolean" ? ot.writeBooleanField(7, xt) : st === "number" && (xt % 1 != 0 ? ot.writeDoubleField(3, xt) : xt < 0 ? ot.writeSVarintField(6, xt) : ot.writeVarintField(5, xt));
}
x.exports = nt, x.exports.fromVectorTileJs = nt, x.exports.fromGeojsonVt = function(xt, ot) {
ot = ot || {};
var st = {};
for (var pt in xt)
st[pt] = new et(xt[pt].features, ot), st[pt].name = pt, st[pt].version = ot.version, st[pt].extent = ot.extent;
return nt({ layers: st });
}, x.exports.GeoJSONWrapper = et;
var Ve = s.by(x.exports);
const yr = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: !1, generateId: !1, reduce: null, map: (xt) => xt }, qr = Math.fround || (ie = new Float32Array(1), (xt) => (ie[0] = +xt, ie[0]));
var ie;
const Qe = 3, Ke = 5, He = 6;
class er {
constructor(ot) {
this.options = Object.assign(Object.create(yr), ot), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
}
load(ot) {
const { log: st, minZoom: pt, maxZoom: yt } = this.options;
st && console.time("total time");
const At = `prepare ${ot.length} points`;
st && console.time(At), this.points = ot;
const Vt = [];
for (let St = 0; St < ot.length; St++) {
const Jt = ot[St];
if (!Jt.geometry)
continue;
const [ae, Xt] = Jt.geometry.coordinates, Le = qr(Gt(ae)), or = qr(te(Xt));
Vt.push(Le, or, 1 / 0, St, -1, 1), this.options.reduce && Vt.push(0);
}
let jt = this.trees[yt + 1] = this._createTree(Vt);
st && console.timeEnd(At);
for (let St = yt; St >= pt; St--) {
const Jt = +Date.now();
jt = this.trees[St] = this._createTree(this._cluster(jt, St)), st && console.log("z%d: %d clusters in %dms", St, jt.numItems, +Date.now() - Jt);
}
return st && console.timeEnd("total time"), this;
}
getClusters(ot, st) {
let pt = ((ot[0] + 180) % 360 + 360) % 360 - 180;
const yt = Math.max(-90, Math.min(90, ot[1]));
let At = ot[2] === 180 ? 180 : ((ot[2] + 180) % 360 + 360) % 360 - 180;
const Vt = Math.max(-90, Math.min(90, ot[3]));
if (ot[2] - ot[0] >= 360)
pt = -180, At = 180;
else if (pt > At) {
const Xt = this.getClusters([pt, yt, 180, Vt], st), Le = this.getClusters([-180, yt, At, Vt], st);
return Xt.concat(Le);
}
const jt = this.trees[this._limitZoom(st)], St = jt.range(Gt(pt), te(Vt), Gt(At), te(yt)), Jt = jt.data, ae = [];
for (const Xt of St) {
const Le = this.stride * Xt;
ae.push(Jt[Le + Ke] > 1 ? Je(Jt, Le, this.clusterProps) : this.points[Jt[Le + Qe]]);
}
return ae;
}
getChildren(ot) {
const st = this._getOriginId(ot), pt = this._getOriginZoom(ot), yt = "No cluster with the specified id.", At = this.trees[pt];
if (!At)
throw new Error(yt);
const Vt = At.data;
if (st * this.stride >= Vt.length)
throw new Error(yt);
const jt = this.options.radius / (this.options.extent * Math.pow(2, pt - 1)), St = At.within(Vt[st * this.stride], Vt[st * this.stride + 1], jt), Jt = [];
for (const ae of St) {
const Xt = ae * this.stride;
Vt[Xt + 4] === ot && Jt.push(Vt[Xt + Ke] > 1 ? Je(Vt, Xt, this.clusterProps) : this.points[Vt[Xt + Qe]]);
}
if (Jt.length === 0)
throw new Error(yt);
return Jt;
}
getLeaves(ot, st, pt) {
const yt = [];
return this._appendLeaves(yt, ot, st = st || 10, pt = pt || 0, 0), yt;
}
getTile(ot, st, pt) {
const yt = this.trees[this._limitZoom(ot)], At = Math.pow(2, ot), { extent: Vt, radius: jt } = this.options, St = jt / Vt, Jt = (pt - St) / At, ae = (pt + 1 + St) / At, Xt = { features: [] };
return this._addTileFeatures(yt.range((st - St) / At, Jt, (st + 1 + St) / At, ae), yt.data, st, pt, At, Xt), st === 0 && this._addTileFeatures(yt.range(1 - St / At, Jt, 1, ae), yt.data, At, pt, At, Xt), st === At - 1 && this._addTileFeatures(yt.range(0, Jt, St / At, ae), yt.data, -1, pt, At, Xt), Xt.features.length ? Xt : null;
}
getClusterExpansionZoom(ot) {
let st = this._getOriginZoom(ot) - 1;
for (; st <= this.options.maxZoom; ) {
const pt = this.getChildren(ot);
if (st++, pt.length !== 1)
break;
ot = pt[0].properties.cluster_id;
}
return st;
}
_appendLeaves(ot, st, pt, yt, At) {
const Vt = this.getChildren(st);
for (const jt of Vt) {
const St = jt.properties;
if (St && St.cluster ? At + St.point_count <= yt ? At += St.point_count : At = this._appendLeaves(ot, St.cluster_id, pt, yt, At) : At < yt ? At++ : ot.push(jt), ot.length === pt)
break;
}
return At;
}
_createTree(ot) {
const st = new s.av(ot.length / this.stride | 0, this.options.nodeSize, Float32Array);
for (let pt = 0; pt < ot.length; pt += this.stride)
st.add(ot[pt], ot[pt + 1]);
return st.finish(), st.data = ot, st;
}
_addTileFeatures(ot, st, pt, yt, At, Vt) {
for (const jt of ot) {
const St = jt * this.stride, Jt = st[St + Ke] > 1;
let ae, Xt, Le;
if (Jt)
ae = Ne(st, St, this.clusterProps), Xt = st[St], Le = st[St + 1];
else {
const Te = this.points[st[St + Qe]];
ae = Te.properties;
const [Se, lr] = Te.geometry.coordinates;
Xt = Gt(Se), Le = te(lr);
}
const or = { type: 1, geometry: [[Math.round(this.options.extent * (Xt * At - pt)), Math.round(this.options.extent * (Le * At - yt))]], tags: ae };
let Rt;
Rt = Jt || this.options.generateId ? st[St + Qe] : this.points[st[St + Qe]].id, Rt !== void 0 && (or.id = Rt), Vt.features.push(or);
}
}
_limitZoom(ot) {
return Math.max(this.options.minZoom, Math.min(Math.floor(+ot), this.options.maxZoom + 1));
}
_cluster(ot, st) {
const { radius: pt, extent: yt, reduce: At, minPoints: Vt } = this.options, jt = pt / (yt * Math.pow(2, st)), St = ot.data, Jt = [], ae = this.stride;
for (let Xt = 0; Xt < St.length; Xt += ae) {
if (St[Xt + 2] <= st)
continue;
St[Xt + 2] = st;
const Le = St[Xt], or = St[Xt + 1], Rt = ot.within(St[Xt], St[Xt + 1], jt), Te = St[Xt + Ke];
let Se = Te;
for (const lr of Rt) {
const Ar = lr * ae;
St[Ar + 2] > st && (Se += St[Ar + Ke]);
}
if (Se > Te && Se >= Vt) {
let lr, Ar = Le * Te, vn = or * Te, zr = -1;
const br = ((Xt / ae | 0) << 5) + (st + 1) + this.points.length;
for (const Br of Rt) {
const cn = Br * ae;
if (St[cn + 2] <= st)
continue;
St[cn + 2] = st;
const Kn = St[cn + Ke];
Ar += St[cn] * Kn, vn += St[cn + 1] * Kn, St[cn + 4] = br, At && (lr || (lr = this._map(St, Xt, !0), zr = this.clusterProps.length, this.clusterProps.push(lr)), At(lr, this._map(St, cn)));
}
St[Xt + 4] = br, Jt.push(Ar / Se, vn / Se, 1 / 0, br, -1, Se), At && Jt.push(zr);
} else {
for (let lr = 0; lr < ae; lr++)
Jt.push(St[Xt + lr]);
if (Se > 1)
for (const lr of Rt) {
const Ar = lr * ae;
if (!(St[Ar + 2] <= st)) {
St[Ar + 2] = st;
for (let vn = 0; vn < ae; vn++)
Jt.push(St[Ar + vn]);
}
}
}
}
return Jt;
}
_getOriginId(ot) {
return ot - this.points.length >> 5;
}
_getOriginZoom(ot) {
return (ot - this.points.length) % 32;
}
_map(ot, st, pt) {
if (ot[st + Ke] > 1) {
const Vt = this.clusterProps[ot[st + He]];
return pt ? Object.assign({}, Vt) : Vt;
}
const yt = this.points[ot[st + Qe]].properties, At = this.options.map(yt);
return pt && At === yt ? Object.assign({}, At) : At;
}
}
function Je(xt, ot, st) {
return { type: "Feature", id: xt[ot + Qe], properties: Ne(xt, ot, st), geometry: { type: "Point", coordinates: [(pt = xt[ot], 360 * (pt - 0.5)), me(xt[ot + 1])] } };
var pt;
}
function Ne(xt, ot, st) {
const pt = xt[ot + Ke], yt = pt >= 1e4 ? `${Math.round(pt / 1e3)}k` : pt >= 1e3 ? Math.round(pt / 100) / 10 + "k" : pt, At = xt[ot + He], Vt = At === -1 ? {} : Object.assign({}, st[At]);
return Object.assign(Vt, { cluster: !0, cluster_id: xt[ot + Qe], point_count: pt, point_count_abbreviated: yt });
}
function Gt(xt) {
return xt / 360 + 0.5;
}
function te(xt) {
const ot = Math.sin(xt * Math.PI / 180), st = 0.5 - 0.25 * Math.log((1 + ot) / (1 - ot)) / Math.PI;
return st < 0 ? 0 : st > 1 ? 1 : st;
}
function me(xt) {
const ot = (180 - 360 * xt) * Math.PI / 180;
return 360 * Math.atan(Math.exp(ot)) / Math.PI - 90;
}
function de(xt, ot, st, pt) {
let yt = pt;
const At = ot + (st - ot >> 1);
let Vt, jt = st - ot;
const St = xt[ot], Jt = xt[ot + 1], ae = xt[st], Xt = xt[st + 1];
for (let Le = ot + 3; Le < st; Le += 3) {
const or = Ge(xt[Le], xt[Le + 1], St, Jt, ae, Xt);
if (or > yt)
Vt = Le, yt = or;
else if (or === yt) {
const Rt = Math.abs(Le - At);
Rt < jt && (Vt = Le, jt = Rt);
}
}
yt > pt && (Vt - ot > 3 && de(xt, ot, Vt, pt), xt[Vt + 2] = yt, st - Vt > 3 && de(xt, Vt, st, pt));
}
function Ge(xt, ot, st, pt, yt, At) {
let Vt = yt - st, jt = At - pt;
if (Vt !== 0 || jt !== 0) {
const St = ((xt - st) * Vt + (ot - pt) * jt) / (Vt * Vt + jt * jt);
St > 1 ? (st = yt, pt = At) : St > 0 && (st += Vt * St, pt += jt * St);
}
return Vt = xt - st, jt = ot - pt, Vt * Vt + jt * jt;
}
function Tr(xt, ot, st, pt) {
const yt = { id: xt ?? null, type: ot, geometry: st, tags: pt, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
if (ot === "Point" || ot === "MultiPoint" || ot === "LineString")
qe(yt, st);
else if (ot === "Polygon")
qe(yt, st[0]);
else if (ot === "MultiLineString")
for (const At of st)
qe(yt, At);
else if (ot === "MultiPolygon")
for (const At of st)
qe(yt, At[0]);
return yt;
}
function qe(xt, ot) {
for (let st = 0; st < ot.length; st += 3)
xt.minX = Math.min(xt.minX, ot[st]), xt.minY = Math.min(xt.minY, ot[st + 1]), xt.maxX = Math.max(xt.maxX, ot[st]), xt.maxY = Math.max(xt.maxY, ot[st + 1]);
}
function $e(xt, ot, st, pt) {
if (!ot.geometry)
return;
const yt = ot.geometry.coordinates;
if (yt && yt.length === 0)
return;
const At = ot.geometry.type, Vt = Math.pow(st.tolerance / ((1 << st.maxZoom) * st.extent), 2);
let jt = [], St = ot.id;
if (st.promoteId ? St = ot.properties[st.promoteId] : st.generateId && (St = pt || 0), At === "Point")
ar(yt, jt);
else if (At === "MultiPoint")
for (const Jt of yt)
ar(Jt, jt);
else if (At === "LineString")
Ct(yt, jt, Vt, !1);
else if (At === "MultiLineString") {
if (st.lineMetrics) {
for (const Jt of yt)
jt = [], Ct(Jt, jt, Vt, !1), xt.push(Tr(St, "LineString", jt, ot.properties));
return;
}
en(yt, jt, Vt, !1);
} else if (At === "Polygon")
en(yt, jt, Vt, !0);
else {
if (At !== "MultiPolygon") {
if (At === "GeometryCollection") {
for (const Jt of ot.geometry.geometries)
$e(xt, { id: St, geometry: Jt, properties: ot.properties }, st, pt);
return;
}
throw new Error("Input data is not a valid GeoJSON object.");
}
for (const Jt of yt) {
const ae = [];
en(Jt, ae, Vt, !0), jt.push(ae);
}
}
xt.push(Tr(St, At, jt, ot.properties));
}
function ar(xt, ot) {
ot.push(Jr(xt[0]), Hr(xt[1]), 0);
}
function Ct(xt, ot, st, pt) {
let yt, At, Vt = 0;
for (let St = 0; St < xt.length; St++) {
const Jt = Jr(xt[St][0]), ae = Hr(xt[St][1]);
ot.push(Jt, ae, 0), St > 0 && (Vt += pt ? (yt * ae - Jt * At) / 2 : Math.sqrt(Math.pow(Jt - yt, 2) + Math.pow(ae - At, 2))), yt = Jt, At = ae;
}
const jt = ot.length - 3;
ot[2] = 1, de(ot, 0, jt, st), ot[jt + 2] = 1, ot.size = Math.abs(Vt), ot.start = 0, ot.end = ot.size;
}
function en(xt, ot, st, pt) {
for (let yt = 0; yt < xt.length; yt++) {
const At = [];
Ct(xt[yt], At, st, pt), ot.push(At);
}
}
function Jr(xt) {
return xt / 360 + 0.5;
}
function Hr(xt) {
const ot = Math.sin(xt * Math.PI / 180), st = 0.5 - 0.25 * Math.log((1 + ot) / (1 - ot)) / Math.PI;
return st < 0 ? 0 : st > 1 ? 1 : st;
}
function Rr(xt, ot, st, pt, yt, At, Vt, jt) {
if (pt /= ot, At >= (st /= ot) && Vt < pt)
return xt;
if (Vt < st || At >= pt)
return null;
const St = [];
for (const Jt of xt) {
const ae = Jt.geometry;
let Xt = Jt.type;
const Le = yt === 0 ? Jt.minX : Jt.minY, or = yt === 0 ? Jt.maxX : Jt.maxY;
if (Le >= st && or < pt) {
St.push(Jt);
continue;
}
if (or < st || Le >= pt)
continue;
let Rt = [];
if (Xt === "Point" || Xt === "MultiPoint")
dn(ae, Rt, st, pt, yt);
else if (Xt === "LineString")
ji(ae, Rt, st, pt, yt, !1, jt.lineMetrics);
else if (Xt === "MultiLineString")
ki(ae, Rt, st, pt, yt, !1);
else if (Xt === "Polygon")
ki(ae, Rt, st, pt, yt, !0);
else if (Xt === "MultiPolygon")
for (const Te of ae) {
const Se = [];
ki(Te, Se, st, pt, yt, !0), Se.length && Rt.push(Se);
}
if (Rt.length) {
if (jt.lineMetrics && Xt === "LineString") {
for (const Te of Rt)
St.push(Tr(Jt.id, Xt, Te, Jt.tags));
continue;
}
Xt !== "LineString" && Xt !== "MultiLineString" || (Rt.length === 1 ? (Xt = "LineString", Rt = Rt[0]) : Xt = "MultiLineString"), Xt !== "Point" && Xt !== "MultiPoint" || (Xt = Rt.length === 3 ? "Point" : "MultiPoint"), St.push(Tr(Jt.id, Xt, Rt, Jt.tags));
}
}
return St.length ? St : null;
}
function dn(xt, ot, st, pt, yt) {
for (let At = 0; At < xt.length; At += 3) {
const Vt = xt[At + yt];
Vt >= st && Vt <= pt && _i(ot, xt[At], xt[At + 1], xt[At + 2]);
}
}
function ji(xt, ot, st, pt, yt, At, Vt) {
let jt = Ji(xt);
const St = yt === 0 ? Ii : c1;
let Jt, ae, Xt = xt.start;
for (let Se = 0; Se < xt.length - 3; Se += 3) {
const lr = xt[Se], Ar = xt[Se + 1], vn = xt[Se + 2], zr = xt[Se + 3], br = xt[Se + 4], Br = yt === 0 ? lr : Ar, cn = yt === 0 ? zr : br;
let Kn = !1;
Vt && (Jt = Math.sqrt(Math.pow(lr - zr, 2) + Math.pow(Ar - br, 2))), Br < st ? cn > st && (ae = St(jt, lr, Ar, zr, br, st), Vt && (jt.start = Xt + Jt * ae)) : Br > pt ? cn < pt && (ae = St(jt, lr, Ar, zr, br, pt), Vt && (jt.start = Xt + Jt * ae)) : _i(jt, lr, Ar, vn), cn < st && Br >= st && (ae = St(jt, lr, Ar, zr, br, st), Kn = !0), cn > pt && Br <= pt && (ae = St(jt, lr, Ar, zr, br, pt), Kn = !0), !At && Kn && (Vt && (jt.end = Xt + Jt * ae), ot.push(jt), jt = Ji(xt)), Vt && (Xt += Jt);
}
let Le = xt.length - 3;
const or = xt[Le], Rt = xt[Le + 1], Te = yt === 0 ? or : Rt;
Te >= st && Te <= pt && _i(jt, or, Rt, xt[Le + 2]), Le = jt.length - 3, At && Le >= 3 && (jt[Le] !== jt[0] || jt[Le + 1] !== jt[1]) && _i(jt, jt[0], jt[1], jt[2]), jt.length && ot.push(jt);
}
function Ji(xt) {
const ot = [];
return ot.size = xt.size, ot.start = xt.start, ot.end = xt.end, ot;
}
function ki(xt, ot, st, pt, yt, At) {
for (const Vt of xt)
ji(Vt, ot, st, pt, yt, At, !1);
}
function _i(xt, ot, st, pt) {
xt.push(ot, st, pt);
}
function Ii(xt, ot, st, pt, yt, At) {
const Vt = (At - ot) / (pt - ot);
return _i(xt, At, st + (yt - st) * Vt, 1), Vt;
}
function c1(xt, ot, st, pt, yt, At) {
const Vt = (At - st) / (yt - st);
return _i(xt, ot + (pt - ot) * Vt, At, 1), Vt;
}
function ye(xt, ot) {
const st = [];
for (let pt = 0; pt < xt.length; pt++) {
const yt = xt[pt], At = yt.type;
let Vt;
if (At === "Point" || At === "MultiPoint" || At === "LineString")
Vt = bi(yt.geometry, ot);
else if (At === "MultiLineString" || At === "Polygon") {
Vt = [];
for (const jt of yt.geometry)
Vt.push(bi(jt, ot));
} else if (At === "MultiPolygon") {
Vt = [];
for (const jt of yt.geometry) {
const St = [];
for (const Jt of jt)
St.push(bi(Jt, ot));
Vt.push(St);
}
}
st.push(Tr(yt.id, At, Vt, yt.tags));
}
return st;
}
function bi(xt, ot) {
const st = [];
st.size = xt.size, xt.start !== void 0 && (st.start = xt.start, st.end = xt.end);
for (let pt = 0; pt < xt.length; pt += 3)
st.push(xt[pt] + ot, xt[pt + 1], xt[pt + 2]);
return st;
}
function Xn(xt, ot) {
if (xt.transformed)
return xt;
const st = 1 << xt.z, pt = xt.x, yt = xt.y;
for (const At of xt.features) {
const Vt = At.geometry, jt = At.type;
if (At.geometry = [], jt === 1)
for (let St = 0; St < Vt.length; St += 2)
At.geometry.push(Hi(Vt[St], Vt[St + 1], ot, st, pt, yt));
else
for (let St = 0; St < Vt.length; St++) {
const Jt = [];
for (let ae = 0; ae < Vt[St].length; ae += 2)
Jt.push(Hi(Vt[St][ae], Vt[St][ae + 1], ot, st, pt, yt));
At.geometry.push(Jt);
}
}
return xt.transformed = !0, xt;
}
function Hi(xt, ot, st, pt, yt, At) {
return [Math.round(st * (xt * pt - yt)), Math.round(st * (ot * pt - At))];
}
function t1(xt, ot, st, pt, yt) {
const At = ot === yt.maxZoom ? 0 : yt.tolerance / ((1 << ot) * yt.extent), Vt = { features: [], numPoints: 0, numSimplified: 0, numFeatures: xt.length, source: null, x: st, y: pt, z: ot, transformed: !1, minX: 2, minY: 1, maxX: -1, maxY: 0 };
for (const jt of xt)
xe(Vt, jt, At, yt);
return Vt;
}
function xe(xt, ot, st, pt) {
const yt = ot.geometry, At = ot.type, Vt = [];
if (xt.minX = Math.min(xt.minX, ot.minX), xt.minY = Math.min(xt.minY, ot.minY), xt.maxX = Math.max(xt.maxX, ot.maxX), xt.maxY = Math.max(xt.maxY, ot.maxY), At === "Point" || At === "MultiPoint")
for (let jt = 0; jt < yt.length; jt += 3)
Vt.push(yt[jt], yt[jt + 1]), xt.numPoints++, xt.numSimplified++;
else if (At === "LineString")
Dr(Vt, yt, xt, st, !1, !1);
else if (At === "MultiLineString" || At === "Polygon")
for (let jt = 0; jt < yt.length; jt++)
Dr(Vt, yt[jt], xt, st, At === "Polygon", jt === 0);
else if (At === "MultiPolygon")
for (let jt = 0; jt < yt.length; jt++) {
const St = yt[jt];
for (let Jt = 0; Jt < St.length; Jt++)
Dr(Vt, St[Jt], xt, st, !0, Jt === 0);
}
if (Vt.length) {
let jt = ot.tags || null;
if (At === "LineString" && pt.lineMetrics) {
jt = {};
for (const Jt in ot.tags)
jt[Jt] = ot.tags[Jt];
jt.mapbox_clip_start = yt.start / yt.size, jt.mapbox_clip_end = yt.end / yt.size;
}
const St = { geometry: Vt, type: At === "Polygon" || At === "MultiPolygon" ? 3 : At === "LineString" || At === "MultiLineString" ? 2 : 1, tags: jt };
ot.id !== null && (St.id = ot.id), xt.features.push(St);
}
}
function Dr(xt, ot, st, pt, yt, At) {
const Vt = pt * pt;
if (pt > 0 && ot.size < (yt ? Vt : pt))
return void (st.numPoints += ot.length / 3);
const jt = [];
for (let St = 0; St < ot.length; St += 3)
(pt === 0 || ot[St + 2] > Vt) && (st.numSimplified++, jt.push(ot[St], ot[St + 1])), st.numPoints++;
yt && function(St, Jt) {
let ae = 0;
for (let Xt = 0, Le = St.length, or = Le - 2; Xt < Le; or = Xt, Xt += 2)
ae += (St[Xt] - St[or]) * (St[Xt + 1] + St[or + 1]);
if (ae > 0 === Jt)
for (let Xt = 0, Le = St.length; Xt < Le / 2; Xt += 2) {
const or = St[Xt], Rt = St[Xt + 1];
St[Xt] = St[Le - 2 - Xt], St[Xt + 1] = St[Le - 1 - Xt], St[Le - 2 - Xt] = or, St[Le - 1 - Xt] = Rt;
}
}(jt, At), xt.push(jt);
}
const _r = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: !1, promoteId: null, generateId: !1, debug: 0 };
class Vn {
constructor(ot, st) {
const pt = (st = this.options = function(At, Vt) {
for (const jt in Vt)
At[jt] = Vt[jt];
return At;
}(Object.create(_r), st)).debug;
if (pt && console.time("preprocess data"), st.maxZoom < 0 || st.maxZoom > 24)
throw new Error("maxZoom should be in the 0-24 range");
if (st.promoteId && st.generateId)
throw new Error("promoteId and generateId cannot be used together.");
let yt = function(At, Vt) {
const jt = [];
if (At.type === "FeatureCollection")
for (let St = 0; St < At.features.length; St++)
$e(jt, At.features[St], Vt, St);
else
$e(jt, At.type === "Feature" ? At : { geometry: At }, Vt);
return jt;
}(ot, st);
this.tiles = {}, this.tileCoords = [], pt && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", st.indexMaxZoom, st.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), yt = function(At, Vt) {
const jt = Vt.buffer / Vt.extent;
let St = At;
const Jt = Rr(At, 1, -1 - jt, jt, 0, -1, 2, Vt), ae = Rr(At, 1, 1 - jt, 2 + jt, 0, -1, 2, Vt);
return (Jt || ae) && (St = Rr(At, 1, -jt, 1 + jt, 0, -1, 2, Vt) || [], Jt && (St = ye(Jt, 1).concat(St)), ae && (St = St.concat(ye(ae, -1)))), St;
}(yt, st), yt.length && this.splitTile(yt, 0, 0, 0), pt && (yt.length && console.log("features: %d, points: %d", this.tiles[0].numFeatures, this.tiles[0].numPoints), console.timeEnd("generate tiles"), console.log("tiles generated:", this.total, JSON.stringify(this.stats)));
}
splitTile(ot, st, pt, yt, At, Vt, jt) {
const St = [ot, st, pt, yt], Jt = this.options, ae = Jt.debug;
for (; St.length; ) {
yt = St.pop(), pt = St.pop(), st = St.pop(), ot = St.pop();
const Xt = 1 << st, Le = y1(st, pt, yt);
let or = this.tiles[Le];
if (!or && (ae > 1 && console.time("creation"), or = this.tiles[Le] = t1(ot, st, pt, yt, Jt), this.tileCoords.push({ z: st, x: pt, y: yt }), ae)) {
ae > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", st, pt, yt, or.numFeatures, or.numPoints, or.numSimplified), console.timeEnd("creation"));
const Kn = `z${st}`;
this.stats[Kn] = (this.stats[Kn] || 0) + 1, this.total++;
}
if (or.source = ot, At == null) {
if (st === Jt.indexMaxZoom || or.numPoints <= Jt.indexMaxPoints)
continue;
} else {
if (st === Jt.maxZoom || st === At)
continue;
if (At != null) {
const Kn = At - st;
if (pt !== Vt >> Kn || yt !== jt >> Kn)
continue;
}
}
if (or.source = null, ot.length === 0)
continue;
ae > 1 && console.time("clipping");
const Rt = 0.5 * Jt.buffer / Jt.extent, Te = 0.5 - Rt, Se = 0.5 + Rt, lr = 1 + Rt;
let Ar = null, vn = null, zr = null, br = null, Br = Rr(ot, Xt, pt - Rt, pt + Se, 0, or.minX, or.maxX, Jt), cn = Rr(ot, Xt, pt + Te, pt + lr, 0, or.minX, or.maxX, Jt);
ot = null, Br && (Ar = Rr(Br, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Jt), vn = Rr(Br, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Jt), Br = null), cn && (zr = Rr(cn, Xt, yt - Rt, yt + Se, 1, or.minY, or.maxY, Jt), br = Rr(cn, Xt, yt + Te, yt + lr, 1, or.minY, or.maxY, Jt), cn = null), ae > 1 && console.timeEnd("clipping"), St.push(Ar || [], st + 1, 2 * pt, 2 * yt), St.push(vn || [], st + 1, 2 * pt, 2 * yt + 1), St.push(zr || [], st + 1, 2 * pt + 1, 2 * yt), St.push(br || [], st + 1, 2 * pt + 1, 2 * yt + 1);
}
}
getTile(ot, st, pt) {
ot = +ot, st = +st, pt = +pt;
const yt = this.options, { extent: At, debug: Vt } = yt;
if (ot < 0 || ot > 24)
return null;
const jt = 1 << ot, St = y1(ot, st = st + jt & jt - 1, pt);
if (this.tiles[St])
return Xn(this.tiles[St], At);
Vt > 1 && console.log("drilling down to z%d-%d-%d", ot, st, pt);
let Jt, ae = ot, Xt = st, Le = pt;
for (; !Jt && ae > 0; )
ae--, Xt >>= 1, Le >>= 1, Jt = this.tiles[y1(ae, Xt, Le)];
return Jt && Jt.source ? (Vt > 1 && (console.log("found parent tile z%d-%d-%d", ae, Xt, Le), console.time("drilling down")), this.splitTile(Jt.source, ae, Xt, Le, ot, st, pt), Vt > 1 && console.timeEnd("drilling down"), this.tiles[St] ? Xn(this.tiles[St], At) : null) : null;
}
}
function y1(xt, ot, st) {
return 32 * ((1 << xt) * st + ot) + xt;
}
function wr(xt, ot) {
return ot ? xt.properties[ot] : xt.id;
}
function Pi(xt, ot) {
if (xt == null)
return !0;
if (xt.type === "Feature")
return wr(xt, ot) != null;
if (xt.type === "FeatureCollection") {
const st = /* @__PURE__ */ new Set();
for (const pt of xt.features) {
const yt = wr(pt, ot);
if (yt == null || st.has(yt))
return !1;
st.add(yt);
}
return !0;
}
return !1;
}
function H1(xt, ot) {
const st = /* @__PURE__ */ new Map();
if (xt != null)
if (xt.type === "Feature")
st.set(wr(xt, ot), xt);
else
for (const pt of xt.features)
st.set(wr(pt, ot), pt);
return st;
}
class Vi extends f {
constructor() {
super(...arguments), this._dataUpdateable = /* @__PURE__ */ new Map();
}
loadVectorTile(ot, st) {
return s._(this, void 0, void 0, function* () {
const pt = ot.tileID.canonical;
if (!this._geoJSONIndex)
throw new Error("Unable to parse the data into a cluster or geojson");
const yt = this._geoJSONIndex.getTile(pt.z, pt.x, pt.y);
if (!yt)
return null;
const At = new class {
constructor(jt) {
this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = s.X, this.length = jt.length, this._features = jt;
}
feature(jt) {
return new class {
constructor(St) {
this._feature = St, this.extent = s.X, this.type = St.type, this.properties = St.tags, "id" in St && !isNaN(St.id) && (this.id = parseInt(St.id, 10));
}
loadGeometry() {
if (this._feature.type === 1) {
const St = [];
for (const Jt of this._feature.geometry)
St.push([new s.P(Jt[0], Jt[1])]);
return St;
}
{
const St = [];
for (const Jt of this._feature.geometry) {
const ae = [];
for (const Xt of Jt)
ae.push(new s.P(Xt[0], Xt[1]));
St.push(ae);
}
return St;
}
}
toGeoJSON(St, Jt, ae) {
return E.call(this, St, Jt, ae);
}
}(this._features[jt]);
}
}(yt.features);
let Vt = Ve(At);
return Vt.byteOffset === 0 && Vt.byteLength === Vt.buffer.byteLength || (Vt = new Uint8Array(Vt)), { vectorTile: At, rawData: Vt.buffer };
});
}
loadData(ot) {
return s._(this, void 0, void 0, function* () {
var st;
(st = this._pendingRequest) === null || st === void 0 || st.abort();
const pt = !!(ot && ot.request && ot.request.collectResourceTiming) && new s.bv(ot.request);
this._pendingRequest = new AbortController();
try {
this._pendingData = this.loadAndProcessGeoJSON(ot, this._pendingRequest), this._geoJSONIndex = ot.cluster ? new er(function({ superclusterOptions: Vt, clusterProperties: jt }) {
if (!jt || !Vt)
return Vt;
const St = {}, Jt = {}, ae = { accumulated: null, zoom: 0 }, Xt = { properties: null }, Le = Object.keys(jt);
for (const or of Le) {
const [Rt, Te] = jt[or], Se = s.bC(Te), lr = s.bC(typeof Rt == "string" ? [Rt, ["accumulated"], ["get", or]] : Rt);
St[or] = Se.value, Jt[or] = lr.value;
}
return Vt.map = (or) => {
Xt.properties = or;
const Rt = {};
for (const Te of Le)
Rt[Te] = St[Te].evaluate(ae, Xt);
return Rt;
}, Vt.reduce = (or, Rt) => {
Xt.properties = Rt;
for (const Te of Le)
ae.accumulated = or[Te], or[Te] = Jt[Te].evaluate(ae, Xt);
}, Vt;
}(ot)).load((yield this._pendingData).features) : (yt = yield this._pendingData, new Vn(yt, ot.geojsonVtOptions)), this.loaded = {};
const At = {};
if (pt) {
const Vt = pt.finish();
Vt && (At.resourceTiming = {}, At.resourceTiming[ot.source] = JSON.parse(JSON.stringify(Vt)));
}
return At;
} catch (At) {
if (delete this._pendingRequest, s.bB(At))
return { abandoned: !0 };
throw At;
}
var yt;
});
}
getData() {
return s._(this, void 0, void 0, function* () {
return this._pendingData;
});
}
reloadTile(ot) {
const st = this.loaded;
return st && st[ot.uid] ? super.reloadTile(ot) : this.loadTile(ot);
}
loadAndProcessGeoJSON(ot, st) {
return s._(this, void 0, void 0, function* () {
let pt = yield this.loadGeoJSON(ot, st);
if (delete this._pendingRequest, typeof pt != "object")
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
if (L(pt, !0), ot.filter) {
const yt = s.bC(ot.filter, { type: "boolean", "property-type": "data-driven", overridable: !1, transition: !1 });
if (yt.result === "error")
throw new Error(yt.value.map((At) => `${At.key}: ${At.message}`).join(", "));
pt = { type: "FeatureCollection", features: pt.features.filter((At) => yt.value.evaluate({ zoom: 0 }, At)) };
}
return pt;
});
}
loadGeoJSON(ot, st) {
return s._(this, void 0, void 0, function* () {
const { promoteId: pt } = ot;
if (ot.request) {
const yt = yield s.h(ot.request, st);
return this._dataUpdateable = Pi(yt.data, pt) ? H1(yt.data, pt) : void 0, yt.data;
}
if (typeof ot.data == "string")
try {
const yt = JSON.parse(ot.data);
return this._dataUpdateable = Pi(yt, pt) ? H1(yt, pt) : void 0, yt;
} catch {
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
}
if (!ot.dataDiff)
throw new Error(`Input data given to '${ot.source}' is not a valid GeoJSON object.`);
if (!this._dataUpdateable)
throw new Error(`Cannot update existing geojson data in ${ot.source}`);
return function(yt, At, Vt) {
var jt, St, Jt, ae;
if (At.removeAll && yt.clear(), At.remove)
for (const Xt of At.remove)
yt.delete(Xt);
if (At.add)
for (const Xt of At.add) {
const Le = wr(Xt, Vt);
Le != null && yt.set(Le, Xt);
}
if (At.update)
for (const Xt of At.update) {
let Le = yt.get(Xt.id);
if (Le == null)
continue;
const or = !Xt.removeAllProperties && (((jt = Xt.removeProperties) === null || jt === void 0 ? void 0 : jt.length) > 0 || ((St = Xt.addOrUpdateProperties) === null || St === void 0 ? void 0 : St.length) > 0);
if ((Xt.newGeometry || Xt.removeAllProperties || or) && (Le = Object.assign({}, Le), yt.set(Xt.id, Le), or && (Le.properties = Object.assign({}, Le.properties))), Xt.newGeometry && (Le.geometry = Xt.newGeometry), Xt.removeAllProperties)
Le.properties = {};
else if (((Jt = Xt.removeProperties) === null || Jt === void 0 ? void 0 : Jt.length) > 0)
for (const Rt of Xt.removeProperties)
Object.prototype.hasOwnProperty.call(Le.properties, Rt) && delete Le.properties[Rt];
if (((ae = Xt.addOrUpdateProperties) === null || ae === void 0 ? void 0 : ae.length) > 0)
for (const { key: Rt, value: Te } of Xt.addOrUpdateProperties)
Le.properties[Rt] = Te;
}
}(this._dataUpdateable, ot.dataDiff, pt), { type: "FeatureCollection", features: Array.from(this._dataUpdateable.values()) };
});
}
removeSource(ot) {
return s._(this, void 0, void 0, function* () {
this._pendingRequest && this._pendingRequest.abort();
});
}
getClusterExpansionZoom(ot) {
return this._geoJSONIndex.getClusterExpansionZoom(ot.clusterId);
}
getClusterChildren(ot) {
return this._geoJSONIndex.getChildren(ot.clusterId);
}
getClusterLeaves(ot) {
return this._geoJSONIndex.getLeaves(ot.clusterId, ot.limit, ot.offset);
}
}
class Rn {
constructor(ot) {
this.self = ot, this.actor = new s.F(ot), this.layerIndexes = {}, this.availableImages = {}, this.workerSources = {}, this.demWorkerSources = {}, this.externalWorkerSourceTypes = {}, this.self.registerWorkerSource = (st, pt) => {
if (this.externalWorkerSourceTypes[st])
throw new Error(`Worker source with name "${st}" already registered.`);
this.externalWorkerSourceTypes[st] = pt;
}, this.self.addProtocol = s.bi, this.self.removeProtocol = s.bj, this.self.registerRTLTextPlugin = (st) => {
if (s.bD.isParsed())
throw new Error("RTL text plugin already registered.");
s.bD.setMethods(st);
}, this.actor.registerMessageHandler("LDT", (st, pt) => this._getDEMWorkerSource(st, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RDT", (st, pt) => s._(this, void 0, void 0, function* () {
this._getDEMWorkerSource(st, pt.source).removeTile(pt);
})), this.actor.registerMessageHandler("GCEZ", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterExpansionZoom(pt);
})), this.actor.registerMessageHandler("GCC", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterChildren(pt);
})), this.actor.registerMessageHandler("GCL", (st, pt) => s._(this, void 0, void 0, function* () {
return this._getWorkerSource(st, pt.type, pt.source).getClusterLeaves(pt);
})), this.actor.registerMessageHandler("LD", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).loadData(pt)), this.actor.registerMessageHandler("GD", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).getData()), this.actor.registerMessageHandler("LT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).loadTile(pt)), this.actor.registerMessageHandler("RT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).reloadTile(pt)), this.actor.registerMessageHandler("AT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).abortTile(pt)), this.actor.registerMessageHandler("RMT", (st, pt) => this._getWorkerSource(st, pt.type, pt.source).removeTile(pt)), this.actor.registerMessageHandler("RS", (st, pt) => s._(this, void 0, void 0, function* () {
if (!this.workerSources[st] || !this.workerSources[st][pt.type] || !this.workerSources[st][pt.type][pt.source])
return;
const yt = this.workerSources[st][pt.type][pt.source];
delete this.workerSources[st][pt.type][pt.source], yt.removeSource !== void 0 && yt.removeSource(pt);
})), this.actor.registerMessageHandler("RM", (st) => s._(this, void 0, void 0, function* () {
delete this.layerIndexes[st], delete this.availableImages[st], delete this.workerSources[st], delete this.demWorkerSources[st];
})), this.actor.registerMessageHandler("SR", (st, pt) => s._(this, void 0, void 0, function* () {
this.referrer = pt;
})), this.actor.registerMessageHandler("SRPS", (st, pt) => this._syncRTLPluginState(st, pt)), this.actor.registerMessageHandler("IS", (st, pt) => s._(this, void 0, void 0, function* () {
this.self.importScripts(pt);
})), this.actor.registerMessageHandler("SI", (st, pt) => this._setImages(st, pt)), this.actor.registerMessageHandler("UL", (st, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(st).update(pt.layers, pt.removedIds);
})), this.actor.registerMessageHandler("SL", (st, pt) => s._(this, void 0, void 0, function* () {
this._getLayerIndex(st).replace(pt);
}));
}
_setImages(ot, st) {
return s._(this, void 0, void 0, function* () {
this.availableImages[ot] = st;
for (const pt in this.workerSources[ot]) {
const yt = this.workerSources[ot][pt];
for (const At in yt)
yt[At].availableImages = st;
}
});
}
_syncRTLPluginState(ot, st) {
return s._(this, void 0, void 0, function* () {
if (s.bD.isParsed())
return s.bD.getState();
if (st.pluginStatus !== "loading")
return s.bD.setState(st), st;
const pt = st.pluginURL;
if (this.self.importScripts(pt), s.bD.isParsed()) {
const yt = { pluginStatus: "loaded", pluginURL: pt };
return s.bD.setState(yt), yt;
}
throw s.bD.setState({ pluginStatus: "error", pluginURL: "" }), new Error(`RTL Text Plugin failed to import scripts from ${pt}`);
});
}
_getAvailableImages(ot) {
let st = this.availableImages[ot];
return st || (st = []), st;
}
_getLayerIndex(ot) {
let st = this.layerIndexes[ot];
return st || (st = this.layerIndexes[ot] = new a()), st;
}
_getWorkerSource(ot, st, pt) {
if (this.workerSources[ot] || (this.workerSources[ot] = {}), this.workerSources[ot][st] || (this.workerSources[ot][st] = {}), !this.workerSources[ot][st][pt]) {
const yt = { sendAsync: (At, Vt) => (At.targetMapId = ot, this.actor.sendAsync(At, Vt)) };
switch (st) {
case "vector":
this.workerSources[ot][st][pt] = new f(yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
break;
case "geojson":
this.workerSources[ot][st][pt] = new Vi(yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
break;
default:
this.workerSources[ot][st][pt] = new this.externalWorkerSourceTypes[st](yt, this._getLayerIndex(ot), this._getAvailableImages(ot));
}
}
return this.workerSources[ot][st][pt];
}
_getDEMWorkerSource(ot, st) {
return this.demWorkerSources[ot] || (this.demWorkerSources[ot] = {}), this.demWorkerSources[ot][st] || (this.demWorkerSources[ot][st] = new Q()), this.demWorkerSources[ot][st];
}
}
return s.i(self) && (self.worker = new Rn(self)), Rn;
}), i("index", ["exports", "./shared"], function(s, a) {
var u = "4.7.1";
let d, T;
const f = { now: typeof performance < "u" && performance && performance.now ? performance.now.bind(performance) : Date.now.bind(Date), frameAsync: (S) => new Promise((l, m) => {
const v = requestAnimationFrame(l);
S.signal.addEventListener("abort", () => {
cancelAnimationFrame(v), m(a.c());
});
}), getImageData(S, l = 0) {
return this.getImageCanvasContext(S).getImageData(-l, -l, S.width + 2 * l, S.height + 2 * l);
}, getImageCanvasContext(S) {
const l = window.document.createElement("canvas"), m = l.getContext("2d", { willReadFrequently: !0 });
if (!m)
throw new Error("failed to create canvas 2d context");
return l.width = S.width, l.height = S.height, m.drawImage(S, 0, 0, S.width, S.height), m;
}, resolveURL: (S) => (d || (d = document.createElement("a")), d.href = S, d.href), hardwareConcurrency: typeof navigator < "u" && navigator.hardwareConcurrency || 4, get prefersReducedMotion() {
return !!matchMedia && (T == null && (T = matchMedia("(prefers-reduced-motion: reduce)")), T.matches);
} };
class Q {
static testProp(l) {
if (!Q.docStyle)
return l[0];
for (let m = 0; m < l.length; m++)
if (l[m] in Q.docStyle)
return l[m];
return l[0];
}
static create(l, m, v) {
const b = window.document.createElement(l);
return m !== void 0 && (b.className = m), v && v.appendChild(b), b;
}
static createNS(l, m) {
return window.document.createElementNS(l, m);
}
static disableDrag() {
Q.docStyle && Q.selectProp && (Q.userSelect = Q.docStyle[Q.selectProp], Q.docStyle[Q.selectProp] = "none");
}
static enableDrag() {
Q.docStyle && Q.selectProp && (Q.docStyle[Q.selectProp] = Q.userSelect);
}
static setTransform(l, m) {
l.style[Q.transformProp] = m;
}
static addEventListener(l, m, v, b = {}) {
l.addEventListener(m, v, "passive" in b ? b : b.capture);
}
static removeEventListener(l, m, v, b = {}) {
l.removeEventListener(m, v, "passive" in b ? b : b.capture);
}
static suppressClickInternal(l) {
l.preventDefault(), l.stopPropagation(), window.removeEventListener("click", Q.suppressClickInternal, !0);
}
static suppressClick() {
window.addEventListener("click", Q.suppressClickInternal, !0), window.setTimeout(() => {
window.removeEventListener("click", Q.suppressClickInternal, !0);
}, 0);
}
static getScale(l) {
const m = l.getBoundingClientRect();
return { x: m.width / l.offsetWidth || 1, y: m.height / l.offsetHeight || 1, boundingClientRect: m };
}
static getPoint(l, m, v) {
const b = m.boundingClientRect;
return new a.P((v.clientX - b.left) / m.x - l.clientLeft, (v.clientY - b.top) / m.y - l.clientTop);
}
static mousePos(l, m) {
const v = Q.getScale(l);
return Q.getPoint(l, v, m);
}
static touchPos(l, m) {
const v = [], b = Q.getScale(l);
for (let M = 0; M < m.length; M++)
v.push(Q.getPoint(l, b, m[M]));
return v;
}
static mouseButton(l) {
return l.button;
}
static remove(l) {
l.parentNode && l.parentNode.removeChild(l);
}
}
Q.docStyle = typeof window < "u" && window.document && window.document.documentElement.style, Q.selectProp = Q.testProp(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]), Q.transformProp = Q.testProp(["transform", "WebkitTransform"]);
const y = { supported: !1, testSupport: function(S) {
!E && L && (x ? O(S) : _ = S);
} };
let _, L, E = !1, x = !1;
function O(S) {
const l = S.createTexture();
S.bindTexture(S.TEXTURE_2D, l);
try {
if (S.texImage2D(S.TEXTURE_2D, 0, S.RGBA, S.RGBA, S.UNSIGNED_BYTE, L), S.isContextLost())
return;
y.supported = !0;
} catch {
}
S.deleteTexture(l), E = !0;
}
var k;
typeof document < "u" && (L = document.createElement("img"), L.onload = () => {
_ && O(_), _ = null, x = !0;
}, L.onerror = () => {
E = !0, _ = null;
}, L.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="), function(S) {
let l, m, v, b;
S.resetRequestQueue = () => {
l = [], m = 0, v = 0, b = {};
}, S.addThrottleControl = (j) => {
const Z = v++;
return b[Z] = j, Z;
}, S.removeThrottleControl = (j) => {
delete b[j], V();
}, S.getImage = (j, Z, Y = !0) => new Promise((J, lt) => {
y.supported && (j.headers || (j.headers = {}), j.headers.accept = "image/webp,*/*"), a.e(j, { type: "image" }), l.push({ abortController: Z, requestParameters: j, supportImageRefresh: Y, state: "queued", onError: (ft) => {
lt(ft);
}, onSuccess: (ft) => {
J(ft);
} }), V();
});
const M = (j) => a._(this, void 0, void 0, function* () {
j.state = "running";
const { requestParameters: Z, supportImageRefresh: Y, onError: J, onSuccess: lt, abortController: ft } = j, Qt = Y === !1 && !a.i(self) && !a.g(Z.url) && (!Z.headers || Object.keys(Z.headers).reduce((Ht, Ot) => Ht && Ot === "accept", !0));
m++;
const wt = Qt ? D(Z, ft) : a.m(Z, ft);
try {
const Ht = yield wt;
delete j.abortController, j.state = "completed", Ht.data instanceof HTMLImageElement || a.b(Ht.data) ? lt(Ht) : Ht.data && lt({ data: yield (Mt = Ht.data, typeof createImageBitmap == "function" ? a.d(Mt) : a.f(Mt)), cacheControl: Ht.cacheControl, expires: Ht.expires });
} catch (Ht) {
delete j.abortController, J(Ht);
} finally {
m--, V();
}
var Mt;
}), V = () => {
const j = (() => {
for (const Z of Object.keys(b))
if (b[Z]())
return !0;
return !1;
})() ? a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME : a.a.MAX_PARALLEL_IMAGE_REQUESTS;
for (let Z = m; Z < j && l.length > 0; Z++) {
const Y = l.shift();
Y.abortController.signal.aborted ? Z-- : M(Y);
}
}, D = (j, Z) => new Promise((Y, J) => {
const lt = new Image(), ft = j.url, Qt = j.credentials;
Qt && Qt === "include" ? lt.crossOrigin = "use-credentials" : (Qt && Qt === "same-origin" || !a.s(ft)) && (lt.crossOrigin = "anonymous"), Z.signal.addEventListener("abort", () => {
lt.src = "", J(a.c());
}), lt.fetchPriority = "high", lt.onload = () => {
lt.onerror = lt.onload = null, Y({ data: lt });
}, lt.onerror = () => {
lt.onerror = lt.onload = null, Z.signal.aborted || J(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."));
}, lt.src = ft;
});
}(k || (k = {})), k.resetRequestQueue();
class R {
constructor(l) {
this._transformRequestFn = l;
}
transformRequest(l, m) {
return this._transformRequestFn && this._transformRequestFn(l, m) || { url: l };
}
setTransformRequest(l) {
this._transformRequestFn = l;
}
}
function F(S) {
var l = new a.A(3);
return l[0] = S[0], l[1] = S[1], l[2] = S[2], l;
}
var U, $ = function(S, l, m) {
return S[0] = l[0] - m[0], S[1] = l[1] - m[1], S[2] = l[2] - m[2], S;
};
U = new a.A(3), a.A != Float32Array && (U[0] = 0, U[1] = 0, U[2] = 0);
var et = function(S) {
var l = S[0], m = S[1];
return l * l + m * m;
};
function nt(S) {
const l = [];
if (typeof S == "string")
l.push({ id: "default", url: S });
else if (S && S.length > 0) {
const m = [];
for (const { id: v, url: b } of S) {
const M = `${v}${b}`;
m.indexOf(M) === -1 && (m.push(M), l.push({ id: v, url: b }));
}
}
return l;
}
function ct(S, l, m) {
const v = S.split("?");
return v[0] += `${l}${m}`, v.join("?");
}
(function() {
var S = new a.A(2);
a.A != Float32Array && (S[0] = 0, S[1] = 0);
})();
class rt {
constructor(l, m, v, b) {
this.context = l, this.format = v, this.texture = l.gl.createTexture(), this.update(m, b);
}
update(l, m, v) {
const { width: b, height: M } = l, V = !(this.size && this.size[0] === b && this.size[1] === M || v), { context: D } = this, { gl: j } = D;
if (this.useMipmap = !!(m && m.useMipmap), j.bindTexture(j.TEXTURE_2D, this.texture), D.pixelStoreUnpackFlipY.set(!1), D.pixelStoreUnpack.set(1), D.pixelStoreUnpackPremultiplyAlpha.set(this.format === j.RGBA && (!m || m.premultiply !== !1)), V)
this.size = [b, M], l instanceof HTMLImageElement || l instanceof HTMLCanvasElement || l instanceof HTMLVideoElement || l instanceof ImageData || a.b(l) ? j.texImage2D(j.TEXTURE_2D, 0, this.format, this.format, j.UNSIGNED_BYTE, l) : j.texImage2D(j.TEXTURE_2D, 0, this.format, b, M, 0, this.format, j.UNSIGNED_BYTE, l.data);
else {
const { x: Z, y: Y } = v || { x: 0, y: 0 };
l instanceof HTMLImageElement || l instanceof HTMLCanvasElement || l instanceof HTMLVideoElement || l instanceof ImageData || a.b(l) ? j.texSubImage2D(j.TEXTURE_2D, 0, Z, Y, j.RGBA, j.UNSIGNED_BYTE, l) : j.texSubImage2D(j.TEXTURE_2D, 0, Z, Y, b, M, j.RGBA, j.UNSIGNED_BYTE, l.data);
}
this.useMipmap && this.isSizePowerOfTwo() && j.generateMipmap(j.TEXTURE_2D);
}
bind(l, m, v) {
const { context: b } = this, { gl: M } = b;
M.bindTexture(M.TEXTURE_2D, this.texture), v !== M.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (v = M.LINEAR), l !== this.filter && (M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MAG_FILTER, l), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MIN_FILTER, v || l), this.filter = l), m !== this.wrap && (M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_S, m), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_T, m), this.wrap = m);
}
isSizePowerOfTwo() {
return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0;
}
destroy() {
const { gl: l } = this.context;
l.deleteTexture(this.texture), this.texture = null;
}
}
function gt(S) {
const { userImage: l } = S;
return !!(l && l.render && l.render()) && (S.data.replace(new Uint8Array(l.data.buffer)), !0);
}
class It extends a.E {
constructor() {
super(), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = !1, this.requestors = [], this.patterns = {}, this.atlasImage = new a.R({ width: 1, height: 1 }), this.dirty = !0;
}
isLoaded() {
return this.loaded;
}
setLoaded(l) {
if (this.loaded !== l && (this.loaded = l, l)) {
for (const { ids: m, promiseResolve: v } of this.requestors)
v(this._getImagesForIds(m));
this.requestors = [];
}
}
getImage(l) {
const m = this.images[l];
if (m && !m.data && m.spriteData) {
const v = m.spriteData;
m.data = new a.R({ width: v.width, height: v.height }, v.context.getImageData(v.x, v.y, v.width, v.height).data), m.spriteData = null;
}
return m;
}
addImage(l, m) {
if (this.images[l])
throw new Error(`Image id ${l} already exist, use updateImage instead`);
this._validate(l, m) && (this.images[l] = m);
}
_validate(l, m) {
let v = !0;
const b = m.data || m.spriteData;
return this._validateStretch(m.stretchX, b && b.width) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchX" value`))), v = !1), this._validateStretch(m.stretchY, b && b.height) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "stretchY" value`))), v = !1), this._validateContent(m.content, m) || (this.fire(new a.j(new Error(`Image "${l}" has invalid "content" value`))), v = !1), v;
}
_validateStretch(l, m) {
if (!l)
return !0;
let v = 0;
for (const b of l) {
if (b[0] < v || b[1] < b[0] || m < b[1])
return !1;
v = b[1];
}
return !0;
}
_validateContent(l, m) {
if (!l)
return !0;
if (l.length !== 4)
return !1;
const v = m.spriteData, b = v && v.width || m.data.width, M = v && v.height || m.data.height;
return !(l[0] < 0 || b < l[0] || l[1] < 0 || M < l[1] || l[2] < 0 || b < l[2] || l[3] < 0 || M < l[3] || l[2] < l[0] || l[3] < l[1]);
}
updateImage(l, m, v = !0) {
const b = this.getImage(l);
if (v && (b.data.width !== m.data.width || b.data.height !== m.data.height))
throw new Error(`size mismatch between old image (${b.data.width}x${b.data.height}) and new image (${m.data.width}x${m.data.height}).`);
m.version = b.version + 1, this.images[l] = m, this.updatedImages[l] = !0;
}
removeImage(l) {
const m = this.images[l];
delete this.images[l], delete this.patterns[l], m.userImage && m.userImage.onRemove && m.userImage.onRemove();
}
listImages() {
return Object.keys(this.images);
}
getImages(l) {
return new Promise((m, v) => {
let b = !0;
if (!this.isLoaded())
for (const M of l)
this.images[M] || (b = !1);
this.isLoaded() || b ? m(this._getImagesForIds(l)) : this.requestors.push({ ids: l, promiseResolve: m });
});
}
_getImagesForIds(l) {
const m = {};
for (const v of l) {
let b = this.getImage(v);
b || (this.fire(new a.k("styleimagemissing", { id: v })), b = this.getImage(v)), b ? m[v] = { data: b.data.clone(), pixelRatio: b.pixelRatio, sdf: b.sdf, version: b.version, stretchX: b.stretchX, stretchY: b.stretchY, content: b.content, textFitWidth: b.textFitWidth, textFitHeight: b.textFitHeight, hasRenderCallback: !!(b.userImage && b.userImage.render) } : a.w(`Image "${v}" 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 m;
}
getPixelSize() {
const { width: l, height: m } = this.atlasImage;
return { width: l, height: m };
}
getPattern(l) {
const m = this.patterns[l], v = this.getImage(l);
if (!v)
return null;
if (m && m.position.version === v.version)
return m.position;
if (m)
m.position.version = v.version;
else {
const b = { w: v.data.width + 2, h: v.data.height + 2, x: 0, y: 0 }, M = new a.I(b, v);
this.patterns[l] = { bin: b, position: M };
}
return this._updatePatternAtlas(), this.patterns[l].position;
}
bind(l) {
const m = l.gl;
this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = !1) : this.atlasTexture = new rt(l, this.atlasImage, m.RGBA), this.atlasTexture.bind(m.LINEAR, m.CLAMP_TO_EDGE);
}
_updatePatternAtlas() {
const l = [];
for (const M in this.patterns)
l.push(this.patterns[M].bin);
const { w: m, h: v } = a.p(l), b = this.atlasImage;
b.resize({ width: m || 1, height: v || 1 });
for (const M in this.patterns) {
const { bin: V } = this.patterns[M], D = V.x + 1, j = V.y + 1, Z = this.getImage(M).data, Y = Z.width, J = Z.height;
a.R.copy(Z, b, { x: 0, y: 0 }, { x: D, y: j }, { width: Y, height: J }), a.R.copy(Z, b, { x: 0, y: J - 1 }, { x: D, y: j - 1 }, { width: Y, height: 1 }), a.R.copy(Z, b, { x: 0, y: 0 }, { x: D, y: j + J }, { width: Y, height: 1 }), a.R.copy(Z, b, { x: Y - 1, y: 0 }, { x: D - 1, y: j }, { width: 1, height: J }), a.R.copy(Z, b, { x: 0, y: 0 }, { x: D + Y, y: j }, { width: 1, height: J });
}
this.dirty = !0;
}
beginFrame() {
this.callbackDispatchedThisFrame = {};
}
dispatchRenderCallbacks(l) {
for (const m of l) {
if (this.callbackDispatchedThisFrame[m])
continue;
this.callbackDispatchedThisFrame[m] = !0;
const v = this.getImage(m);
v || a.w(`Image with ID: "${m}" was not found`), gt(v) && this.updateImage(m, v);
}
}
}
const Zt = 1e20;
function oe(S, l, m, v, b, M, V, D, j) {
for (let Z = l; Z < l + v; Z++)
re(S, m * M + Z, M, b, V, D, j);
for (let Z = m; Z < m + b; Z++)
re(S, Z * M + l, 1, v, V, D, j);
}
function re(S, l, m, v, b, M, V) {
M[0] = 0, V[0] = -Zt, V[1] = Zt, b[0] = S[l];
for (let D = 1, j = 0, Z = 0; D < v; D++) {
b[D] = S[l + D * m];
const Y = D * D;
do {
const J = M[j];
Z = (b[D] - b[J] + Y - J * J) / (D - J) / 2;
} while (Z <= V[j] && --j > -1);
j++, M[j] = D, V[j] = Z, V[j + 1] = Zt;
}
for (let D = 0, j = 0; D < v; D++) {
for (; V[j + 1] < D; )
j++;
const Z = M[j], Y = D - Z;
S[l + D * m] = b[Z] + Y * Y;
}
}
class Ve {
constructor(l, m) {
this.requestManager = l, this.localIdeographFontFamily = m, this.entries = {};
}
setURL(l) {
this.url = l;
}
getGlyphs(l) {
return a._(this, void 0, void 0, function* () {
const m = [];
for (const M in l)
for (const V of l[M])
m.push(this._getAndCacheGlyphsPromise(M, V));
const v = yield Promise.all(m), b = {};
for (const { stack: M, id: V, glyph: D } of v)
b[M] || (b[M] = {}), b[M][V] = D && { id: D.id, bitmap: D.bitmap.clone(), metrics: D.metrics };
return b;
});
}
_getAndCacheGlyphsPromise(l, m) {
return a._(this, void 0, void 0, function* () {
let v = this.entries[l];
v || (v = this.entries[l] = { glyphs: {}, requests: {}, ranges: {} });
let b = v.glyphs[m];
if (b !== void 0)
return { stack: l, id: m, glyph: b };
if (b = this._tinySDF(v, l, m), b)
return v.glyphs[m] = b, { stack: l, id: m, glyph: b };
const M = Math.floor(m / 256);
if (256 * M > 65535)
throw new Error("glyphs > 65535 not supported");
if (v.ranges[M])
return { stack: l, id: m, glyph: b };
if (!this.url)
throw new Error("glyphsUrl is not set");
if (!v.requests[M]) {
const D = Ve.loadGlyphRange(l, M, this.url, this.requestManager);
v.requests[M] = D;
}
const V = yield v.requests[M];
for (const D in V)
this._doesCharSupportLocalGlyph(+D) || (v.glyphs[+D] = V[+D]);
return v.ranges[M] = !0, { stack: l, id: m, glyph: V[m] || null };
});
}
_doesCharSupportLocalGlyph(l) {
return !!this.localIdeographFontFamily && new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}", "u").test(String.fromCodePoint(l));
}
_tinySDF(l, m, v) {
const b = this.localIdeographFontFamily;
if (!b || !this._doesCharSupportLocalGlyph(v))
return;
let M = l.tinySDF;
if (!M) {
let D = "400";
/bold/i.test(m) ? D = "900" : /medium/i.test(m) ? D = "500" : /light/i.test(m) && (D = "200"), M = l.tinySDF = new Ve.TinySDF({ fontSize: 48, buffer: 6, radius: 16, cutoff: 0.25, fontFamily: b, fontWeight: D });
}
const V = M.draw(String.fromCharCode(v));
return { id: v, bitmap: new a.o({ width: V.width || 60, height: V.height || 60 }, V.data), metrics: { width: V.glyphWidth / 2 || 24, height: V.glyphHeight / 2 || 24, left: V.glyphLeft / 2 + 0.5 || 0, top: V.glyphTop / 2 - 27.5 || -8, advance: V.glyphAdvance / 2 || 24, isDoubleResolution: !0 } };
}
}
Ve.loadGlyphRange = function(S, l, m, v) {
return a._(this, void 0, void 0, function* () {
const b = 256 * l, M = b + 255, V = v.transformRequest(m.replace("{fontstack}", S).replace("{range}", `${b}-${M}`), "Glyphs"), D = yield a.l(V, new AbortController());
if (!D || !D.data)
throw new Error(`Could not load glyph range. range: ${l}, ${b}-${M}`);
const j = {};
for (const Z of a.n(D.data))
j[Z.id] = Z;
return j;
});
}, Ve.TinySDF = class {
constructor({ fontSize: S = 24, buffer: l = 3, radius: m = 8, cutoff: v = 0.25, fontFamily: b = "sans-serif", fontWeight: M = "normal", fontStyle: V = "normal" } = {}) {
this.buffer = l, this.cutoff = v, this.radius = m;
const D = this.size = S + 4 * l, j = this._createCanvas(D), Z = this.ctx = j.getContext("2d", { willReadFrequently: !0 });
Z.font = `${V} ${M} ${S}px ${b}`, Z.textBaseline = "alphabetic", Z.textAlign = "left", Z.fillStyle = "black", this.gridOuter = new Float64Array(D * D), this.gridInner = new Float64Array(D * D), this.f = new Float64Array(D), this.z = new Float64Array(D + 1), this.v = new Uint16Array(D);
}
_createCanvas(S) {
const l = document.createElement("canvas");
return l.width = l.height = S, l;
}
draw(S) {
const { width: l, actualBoundingBoxAscent: m, actualBoundingBoxDescent: v, actualBoundingBoxLeft: b, actualBoundingBoxRight: M } = this.ctx.measureText(S), V = Math.ceil(m), D = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(M - b))), j = Math.min(this.size - this.buffer, V + Math.ceil(v)), Z = D + 2 * this.buffer, Y = j + 2 * this.buffer, J = Math.max(Z * Y, 0), lt = new Uint8ClampedArray(J), ft = { data: lt, width: Z, height: Y, glyphWidth: D, glyphHeight: j, glyphTop: V, glyphLeft: 0, glyphAdvance: l };
if (D === 0 || j === 0)
return ft;
const { ctx: Qt, buffer: wt, gridInner: Mt, gridOuter: Ht } = this;
Qt.clearRect(wt, wt, D, j), Qt.fillText(S, wt, wt + V);
const Ot = Qt.getImageData(wt, wt, D, j);
Ht.fill(Zt, 0, J), Mt.fill(0, 0, J);
for (let bt = 0; bt < j; bt++)
for (let Nt = 0; Nt < D; Nt++) {
const Dt = Ot.data[4 * (bt * D + Nt) + 3] / 255;
if (Dt === 0)
continue;
const Wt = (bt + wt) * Z + Nt + wt;
if (Dt === 1)
Ht[Wt] = 0, Mt[Wt] = Zt;
else {
const he = 0.5 - Dt;
Ht[Wt] = he > 0 ? he * he : 0, Mt[Wt] = he < 0 ? he * he : 0;
}
}
oe(Ht, 0, 0, Z, Y, Z, this.f, this.v, this.z), oe(Mt, wt, wt, D, j, Z, this.f, this.v, this.z);
for (let bt = 0; bt < J; bt++) {
const Nt = Math.sqrt(Ht[bt]) - Math.sqrt(Mt[bt]);
lt[bt] = Math.round(255 - 255 * (Nt / this.radius + this.cutoff));
}
return ft;
}
};
class yr {
constructor() {
this.specification = a.v.light.position;
}
possiblyEvaluate(l, m) {
return a.x(l.expression.evaluate(m));
}
interpolate(l, m, v) {
return { x: a.y.number(l.x, m.x, v), y: a.y.number(l.y, m.y, v), z: a.y.number(l.z, m.z, v) };
}
}
let qr;
class ie extends a.E {
constructor(l) {
super(), qr = qr || new a.q({ anchor: new a.D(a.v.light.anchor), position: new yr(), color: new a.D(a.v.light.color), intensity: new a.D(a.v.light.intensity) }), this._transitionable = new a.T(qr), this.setLight(l), this._transitioning = this._transitionable.untransitioned();
}
getLight() {
return this._transitionable.serialize();
}
setLight(l, m = {}) {
if (!this._validate(a.r, l, m))
for (const v in l) {
const b = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), b) : this._transitionable.setValue(v, b);
}
}
updateTransitions(l) {
this._transitioning = this._transitionable.transitioned(l, this._transitioning);
}
hasTransition() {
return this._transitioning.hasTransition();
}
recalculate(l) {
this.properties = this._transitioning.possiblyEvaluate(l);
}
_validate(l, m, v) {
return (!v || v.validate !== !1) && a.t(this, l.call(a.u, { value: m, style: { glyphs: !0, sprite: !0 }, styleSpec: a.v }));
}
}
const Qe = new a.q({ "sky-color": new a.D(a.v.sky["sky-color"]), "horizon-color": new a.D(a.v.sky["horizon-color"]), "fog-color": new a.D(a.v.sky["fog-color"]), "fog-ground-blend": new a.D(a.v.sky["fog-ground-blend"]), "horizon-fog-blend": new a.D(a.v.sky["horizon-fog-blend"]), "sky-horizon-blend": new a.D(a.v.sky["sky-horizon-blend"]), "atmosphere-blend": new a.D(a.v.sky["atmosphere-blend"]) });
class Ke extends a.E {
constructor(l) {
super(), this._transitionable = new a.T(Qe), this.setSky(l), this._transitioning = this._transitionable.untransitioned(), this.recalculate(new a.z(0));
}
setSky(l, m = {}) {
if (!this._validate(a.B, l, m)) {
l || (l = { "sky-color": "transparent", "horizon-color": "transparent", "fog-color": "transparent", "fog-ground-blend": 1, "atmosphere-blend": 0 });
for (const v in l) {
const b = l[v];
v.endsWith("-transition") ? this._transitionable.setTransition(v.slice(0, -11), b) : this._transitionable.setValue(v, b);
}
}
}
getSky() {
return this._transitionable.serialize();
}
updateTransitions(l) {
this._transitioning = this._transitionable.transitioned(l, this._transitioning);
}
hasTransition() {
return this._transitioning.hasTransition();
}
recalculate(l) {
this.properties = this._transitioning.possiblyEvaluate(l);
}
_validate(l, m, v = {}) {
return (v == null ? void 0 : v.validate) !== !1 && a.t(this, l.call(a.u, a.e({ value: m, style: { glyphs: !0, sprite: !0 }, styleSpec: a.v })));
}
calculateFogBlendOpacity(l) {
return l < 60 ? 0 : l < 70 ? (l - 60) / 10 : 1;
}
}
class He {
constructor(l, m) {
this.width = l, this.height = m, this.nextRow = 0, this.data = new Uint8Array(this.width * this.height), this.dashEntry = {};
}
getDash(l, m) {
const v = l.join(",") + String(m);
return this.dashEntry[v] || (this.dashEntry[v] = this.addDash(l, m)), this.dashEntry[v];
}
getDashRanges(l, m, v) {
const b = [];
let M = l.length % 2 == 1 ? -l[l.length - 1] * v : 0, V = l[0] * v, D = !0;
b.push({ left: M, right: V, isDash: D, zeroLength: l[0] === 0 });
let j = l[0];
for (let Z = 1; Z < l.length; Z++) {
D = !D;
const Y = l[Z];
M = j * v, j += Y, V = j * v, b.push({ left: M, right: V, isDash: D, zeroLength: Y === 0 });
}
return b;
}
addRoundDash(l, m, v) {
const b = m / 2;
for (let M = -v; M <= v; M++) {
const V = this.width * (this.nextRow + v + M);
let D = 0, j = l[D];
for (let Z = 0; Z < this.width; Z++) {
Z / j.right > 1 && (j = l[++D]);
const Y = Math.abs(Z - j.left), J = Math.abs(Z - j.right), lt = Math.min(Y, J);
let ft;
const Qt = M / v * (b + 1);
if (j.isDash) {
const wt = b - Math.abs(Qt);
ft = Math.sqrt(lt * lt + wt * wt);
} else
ft = b - Math.sqrt(lt * lt + Qt * Qt);
this.data[V + Z] = Math.max(0, Math.min(255, ft + 128));
}
}
}
addRegularDash(l) {
for (let D = l.length - 1; D >= 0; --D) {
const j = l[D], Z = l[D + 1];
j.zeroLength ? l.splice(D, 1) : Z && Z.isDash === j.isDash && (Z.left = j.left, l.splice(D, 1));
}
const m = l[0], v = l[l.length - 1];
m.isDash === v.isDash && (m.left = v.left - this.width, v.right = m.right + this.width);
const b = this.width * this.nextRow;
let M = 0, V = l[M];
for (let D = 0; D < this.width; D++) {
D / V.right > 1 && (V = l[++M]);
const j = Math.abs(D - V.left), Z = Math.abs(D - V.right), Y = Math.min(j, Z);
this.data[b + D] = Math.max(0, Math.min(255, (V.isDash ? Y : -Y) + 128));
}
}
addDash(l, m) {
const v = m ? 7 : 0, b = 2 * v + 1;
if (this.nextRow + b > this.height)
return a.w("LineAtlas out of space"), null;
let M = 0;
for (let D = 0; D < l.length; D++)
M += l[D];
if (M !== 0) {
const D = this.width / M, j = this.getDashRanges(l, this.width, D);
m ? this.addRoundDash(j, D, v) : this.addRegularDash(j);
}
const V = { y: (this.nextRow + v + 0.5) / this.height, height: 2 * v / this.height, width: M };
return this.nextRow += b, this.dirty = !0, V;
}
bind(l) {
const m = l.gl;
this.texture ? (m.bindTexture(m.TEXTURE_2D, this.texture), this.dirty && (this.dirty = !1, m.texSubImage2D(m.TEXTURE_2D, 0, 0, 0, this.width, this.height, m.ALPHA, m.UNSIGNED_BYTE, this.data))) : (this.texture = m.createTexture(), m.bindTexture(m.TEXTURE_2D, this.texture), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_S, m.REPEAT), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_T, m.REPEAT), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MIN_FILTER, m.LINEAR), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MAG_FILTER, m.LINEAR), m.texImage2D(m.TEXTURE_2D, 0, m.ALPHA, this.width, this.height, 0, m.ALPHA, m.UNSIGNED_BYTE, this.data));
}
}
const er = "maplibre_preloaded_worker_pool";
class Je {
constructor() {
this.active = {};
}
acquire(l) {
if (!this.workers)
for (this.workers = []; this.workers.length < Je.workerCount; )
this.workers.push(new Worker(a.a.WORKER_URL));
return this.active[l] = !0, this.workers.slice();
}
release(l) {
delete this.active[l], this.numActive() === 0 && (this.workers.forEach((m) => {
m.terminate();
}), this.workers = null);
}
isPreloaded() {
return !!this.active[er];
}
numActive() {
return Object.keys(this.active).length;
}
}
const Ne = Math.floor(f.hardwareConcurrency / 2);
let Gt, te;
function me() {
return Gt || (Gt = new Je()), Gt;
}
Je.workerCount = a.C(globalThis) ? Math.max(Math.min(Ne, 3), 1) : 1;
class de {
constructor(l, m) {
this.workerPool = l, this.actors = [], this.currentActor = 0, this.id = m;
const v = this.workerPool.acquire(m);
for (let b = 0; b < v.length; b++) {
const M = new a.F(v[b], m);
M.name = `Worker ${b}`, this.actors.push(M);
}
if (!this.actors.length)
throw new Error("No actors found");
}
broadcast(l, m) {
const v = [];
for (const b of this.actors)
v.push(b.sendAsync({ type: l, data: m }));
return Promise.all(v);
}
getActor() {
return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor];
}
remove(l = !0) {
this.actors.forEach((m) => {
m.remove();
}), this.actors = [], l && this.workerPool.release(this.id);
}
registerMessageHandler(l, m) {
for (const v of this.actors)
v.registerMessageHandler(l, m);
}
}
function Ge() {
return te || (te = new de(me(), a.G), te.registerMessageHandler("GR", (S, l, m) => a.m(l, m))), te;
}
function Tr(S, l) {
const m = a.H();
return a.J(m, m, [1, 1, 0]), a.K(m, m, [0.5 * S.width, 0.5 * S.height, 1]), a.L(m, m, S.calculatePosMatrix(l.toUnwrapped()));
}
function qe(S, l, m, v, b, M) {
const V = function(J, lt, ft) {
if (J)
for (const Qt of J) {
const wt = lt[Qt];
if (wt && wt.source === ft && wt.type === "fill-extrusion")
return !0;
}
else
for (const Qt in lt) {
const wt = lt[Qt];
if (wt.source === ft && wt.type === "fill-extrusion")
return !0;
}
return !1;
}(b && b.layers, l, S.id), D = M.maxPitchScaleFactor(), j = S.tilesIn(v, D, V);
j.sort($e);
const Z = [];
for (const J of j)
Z.push({ wrappedTileID: J.tileID.wrapped().key, queryResults: J.tile.queryRenderedFeatures(l, m, S._state, J.queryGeometry, J.cameraQueryGeometry, J.scale, b, M, D, Tr(S.transform, J.tileID)) });
const Y = function(J) {
const lt = {}, ft = {};
for (const Qt of J) {
const wt = Qt.queryResults, Mt = Qt.wrappedTileID, Ht = ft[Mt] = ft[Mt] || {};
for (const Ot in wt) {
const bt = wt[Ot], Nt = Ht[Ot] = Ht[Ot] || {}, Dt = lt[Ot] = lt[Ot] || [];
for (const Wt of bt)
Nt[Wt.featureIndex] || (Nt[Wt.featureIndex] = !0, Dt.push(Wt));
}
}
return lt;
}(Z);
for (const J in Y)
Y[J].forEach((lt) => {
const ft = lt.feature, Qt = S.getFeatureState(ft.layer["source-layer"], ft.id);
ft.source = ft.layer.source, ft.layer["source-layer"] && (ft.sourceLayer = ft.layer["source-layer"]), ft.state = Qt;
});
return Y;
}
function $e(S, l) {
const m = S.tileID, v = l.tileID;
return m.overscaledZ - v.overscaledZ || m.canonical.y - v.canonical.y || m.wrap - v.wrap || m.canonical.x - v.canonical.x;
}
function ar(S, l, m) {
return a._(this, void 0, void 0, function* () {
let v = S;
if (S.url ? v = (yield a.h(l.transformRequest(S.url, "Source"), m)).data : yield f.frameAsync(m), !v)
return null;
const b = a.M(a.e(v, S), ["tiles", "minzoom", "maxzoom", "attribution", "bounds", "scheme", "tileSize", "encoding"]);
return "vector_layers" in v && v.vector_layers && (b.vectorLayerIds = v.vector_layers.map((M) => M.id)), b;
});
}
class Ct {
constructor(l, m) {
l && (m ? this.setSouthWest(l).setNorthEast(m) : Array.isArray(l) && (l.length === 4 ? this.setSouthWest([l[0], l[1]]).setNorthEast([l[2], l[3]]) : this.setSouthWest(l[0]).setNorthEast(l[1])));
}
setNorthEast(l) {
return this._ne = l instanceof a.N ? new a.N(l.lng, l.lat) : a.N.convert(l), this;
}
setSouthWest(l) {
return this._sw = l instanceof a.N ? new a.N(l.lng, l.lat) : a.N.convert(l), this;
}
extend(l) {
const m = this._sw, v = this._ne;
let b, M;
if (l instanceof a.N)
b = l, M = l;
else {
if (!(l instanceof Ct))
return Array.isArray(l) ? l.length === 4 || l.every(Array.isArray) ? this.extend(Ct.convert(l)) : this.extend(a.N.convert(l)) : l && ("lng" in l || "lon" in l) && "lat" in l ? this.extend(a.N.convert(l)) : this;
if (b = l._sw, M = l._ne, !b || !M)
return this;
}
return m || v ? (m.lng = Math.min(b.lng, m.lng), m.lat = Math.min(b.lat, m.lat), v.lng = Math.max(M.lng, v.lng), v.lat = Math.max(M.lat, v.lat)) : (this._sw = new a.N(b.lng, b.lat), this._ne = new a.N(M.lng, M.lat)), this;
}
getCenter() {
return new a.N((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 a.N(this.getWest(), this.getNorth());
}
getSouthEast() {
return new a.N(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(l) {
const { lng: m, lat: v } = a.N.convert(l);
let b = this._sw.lng <= m && m <= this._ne.lng;
return this._sw.lng > this._ne.lng && (b = this._sw.lng >= m && m >= this._ne.lng), this._sw.lat <= v && v <= this._ne.lat && b;
}
static convert(l) {
return l instanceof Ct ? l : l && new Ct(l);
}
static fromLngLat(l, m = 0) {
const v = 360 * m / 40075017, b = v / Math.cos(Math.PI / 180 * l.lat);
return new Ct(new a.N(l.lng - b, l.lat - v), new a.N(l.lng + b, l.lat + v));
}
adjustAntiMeridian() {
const l = new a.N(this._sw.lng, this._sw.lat), m = new a.N(this._ne.lng, this._ne.lat);
return new Ct(l, l.lng > m.lng ? new a.N(m.lng + 360, m.lat) : m);
}
}
class en {
constructor(l, m, v) {
this.bounds = Ct.convert(this.validateBounds(l)), this.minzoom = m || 0, this.maxzoom = v || 24;
}
validateBounds(l) {
return Array.isArray(l) && l.length === 4 ? [Math.max(-180, l[0]), Math.max(-90, l[1]), Math.min(180, l[2]), Math.min(90, l[3])] : [-180, -90, 180, 90];
}
contains(l) {
const m = Math.pow(2, l.z), v = Math.floor(a.O(this.bounds.getWest()) * m), b = Math.floor(a.Q(this.bounds.getNorth()) * m), M = Math.ceil(a.O(this.bounds.getEast()) * m), V = Math.ceil(a.Q(this.bounds.getSouth()) * m);
return l.x >= v && l.x < M && l.y >= b && l.y < V;
}
}
class Jr extends a.E {
constructor(l, m, v, b) {
if (super(), this.id = l, this.dispatcher = v, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = !0, this.isTileClipped = !0, this._loaded = !1, a.e(this, a.M(m, ["url", "scheme", "tileSize", "promoteId"])), this._options = a.e({ type: "vector" }, m), this._collectResourceTiming = m.collectResourceTiming, this.tileSize !== 512)
throw new Error("vector tile sources must have a tileSize of 512");
this.setEventedParent(b);
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
try {
const l = yield ar(this._options, this.map._requestManager, this._tileJSONRequest);
this._tileJSONRequest = null, this._loaded = !0, this.map.style.sourceCaches[this.id].clearTiles(), l && (a.e(this, l), l.bounds && (this.tileBounds = new en(l.bounds, this.minzoom, this.maxzoom)), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })));
} catch (l) {
this._tileJSONRequest = null, this.fire(new a.j(l));
}
});
}
loaded() {
return this._loaded;
}
hasTile(l) {
return !this.tileBounds || this.tileBounds.contains(l.canonical);
}
onAdd(l) {
this.map = l, this.load();
}
setSourceProperty(l) {
this._tileJSONRequest && this._tileJSONRequest.abort(), l(), this.load();
}
setTiles(l) {
return this.setSourceProperty(() => {
this._options.tiles = l;
}), this;
}
setUrl(l) {
return this.setSourceProperty(() => {
this.url = l, this._options.url = l;
}), this;
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
}
serialize() {
return a.e({}, this._options);
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), v = { request: this.map._requestManager.transformRequest(m, "Tile"), uid: l.uid, tileID: l.tileID, zoom: l.tileID.overscaledZ, tileSize: this.tileSize * l.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
v.request.collectResourceTiming = this._collectResourceTiming;
let b = "RT";
if (l.actor && l.state !== "expired") {
if (l.state === "loading")
return new Promise((M, V) => {
l.reloadPromise = { resolve: M, reject: V };
});
} else
l.actor = this.dispatcher.getActor(), b = "LT";
l.abortController = new AbortController();
try {
const M = yield l.actor.sendAsync({ type: b, data: v }, l.abortController);
if (delete l.abortController, l.aborted)
return;
this._afterTileLoadWorkerResponse(l, M);
} catch (M) {
if (delete l.abortController, l.aborted)
return;
if (M && M.status !== 404)
throw M;
this._afterTileLoadWorkerResponse(l, null);
}
});
}
_afterTileLoadWorkerResponse(l, m) {
if (m && m.resourceTiming && (l.resourceTiming = m.resourceTiming), m && this.map._refreshExpiredTiles && l.setExpiryData(m), l.loadVectorData(m, this.map.painter), l.reloadPromise) {
const v = l.reloadPromise;
l.reloadPromise = null, this.loadTile(l).then(v.resolve).catch(v.reject);
}
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController), l.actor && (yield l.actor.sendAsync({ type: "AT", data: { uid: l.uid, type: this.type, source: this.id } }));
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.unloadVectorData(), l.actor && (yield l.actor.sendAsync({ type: "RMT", data: { uid: l.uid, type: this.type, source: this.id } }));
});
}
hasTransition() {
return !1;
}
}
class Hr extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.dispatcher = v, this.setEventedParent(b), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = !0, this.scheme = "xyz", this.tileSize = 512, this._loaded = !1, this._options = a.e({ type: "raster" }, m), a.e(this, a.M(m, ["url", "scheme", "tileSize"]));
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this._tileJSONRequest = new AbortController();
try {
const l = yield ar(this._options, this.map._requestManager, this._tileJSONRequest);
this._tileJSONRequest = null, this._loaded = !0, l && (a.e(this, l), l.bounds && (this.tileBounds = new en(l.bounds, this.minzoom, this.maxzoom)), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })));
} catch (l) {
this._tileJSONRequest = null, this.fire(new a.j(l));
}
});
}
loaded() {
return this._loaded;
}
onAdd(l) {
this.map = l, this.load();
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null);
}
setSourceProperty(l) {
this._tileJSONRequest && (this._tileJSONRequest.abort(), this._tileJSONRequest = null), l(), this.load();
}
setTiles(l) {
return this.setSourceProperty(() => {
this._options.tiles = l;
}), this;
}
setUrl(l) {
return this.setSourceProperty(() => {
this.url = l, this._options.url = l;
}), this;
}
serialize() {
return a.e({}, this._options);
}
hasTile(l) {
return !this.tileBounds || this.tileBounds.contains(l.canonical);
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme);
l.abortController = new AbortController();
try {
const v = yield k.getImage(this.map._requestManager.transformRequest(m, "Tile"), l.abortController, this.map._refreshExpiredTiles);
if (delete l.abortController, l.aborted)
return void (l.state = "unloaded");
if (v && v.data) {
this.map._refreshExpiredTiles && v.cacheControl && v.expires && l.setExpiryData({ cacheControl: v.cacheControl, expires: v.expires });
const b = this.map.painter.context, M = b.gl, V = v.data;
l.texture = this.map.painter.getTileTexture(V.width), l.texture ? l.texture.update(V, { useMipmap: !0 }) : (l.texture = new rt(b, V, M.RGBA, { useMipmap: !0 }), l.texture.bind(M.LINEAR, M.CLAMP_TO_EDGE, M.LINEAR_MIPMAP_NEAREST)), l.state = "loaded";
}
} catch (v) {
if (delete l.abortController, l.aborted)
l.state = "unloaded";
else if (v)
throw l.state = "errored", v;
}
});
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController);
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.texture && this.map.painter.saveTileTexture(l.texture);
});
}
hasTransition() {
return !1;
}
}
class Rr extends Hr {
constructor(l, m, v, b) {
super(l, m, v, b), this.type = "raster-dem", this.maxzoom = 22, this._options = a.e({ type: "raster-dem" }, m), this.encoding = m.encoding || "mapbox", this.redFactor = m.redFactor, this.greenFactor = m.greenFactor, this.blueFactor = m.blueFactor, this.baseShift = m.baseShift;
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.tileID.canonical.url(this.tiles, this.map.getPixelRatio(), this.scheme), v = this.map._requestManager.transformRequest(m, "Tile");
l.neighboringTiles = this._getNeighboringTiles(l.tileID), l.abortController = new AbortController();
try {
const b = yield k.getImage(v, l.abortController, this.map._refreshExpiredTiles);
if (delete l.abortController, l.aborted)
return void (l.state = "unloaded");
if (b && b.data) {
const M = b.data;
this.map._refreshExpiredTiles && b.cacheControl && b.expires && l.setExpiryData({ cacheControl: b.cacheControl, expires: b.expires });
const V = a.b(M) && a.U() ? M : yield this.readImageNow(M), D = { type: this.type, uid: l.uid, source: this.id, rawImageData: V, encoding: this.encoding, redFactor: this.redFactor, greenFactor: this.greenFactor, blueFactor: this.blueFactor, baseShift: this.baseShift };
if (!l.actor || l.state === "expired") {
l.actor = this.dispatcher.getActor();
const j = yield l.actor.sendAsync({ type: "LDT", data: D });
l.dem = j, l.needsHillshadePrepare = !0, l.needsTerrainPrepare = !0, l.state = "loaded";
}
}
} catch (b) {
if (delete l.abortController, l.aborted)
l.state = "unloaded";
else if (b)
throw l.state = "errored", b;
}
});
}
readImageNow(l) {
return a._(this, void 0, void 0, function* () {
if (typeof VideoFrame < "u" && a.V()) {
const m = l.width + 2, v = l.height + 2;
try {
return new a.R({ width: m, height: v }, yield a.W(l, -1, -1, m, v));
} catch {
}
}
return f.getImageData(l, 1);
});
}
_getNeighboringTiles(l) {
const m = l.canonical, v = Math.pow(2, m.z), b = (m.x - 1 + v) % v, M = m.x === 0 ? l.wrap - 1 : l.wrap, V = (m.x + 1 + v) % v, D = m.x + 1 === v ? l.wrap + 1 : l.wrap, j = {};
return j[new a.S(l.overscaledZ, M, m.z, b, m.y).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y).key] = { backfilled: !1 }, m.y > 0 && (j[new a.S(l.overscaledZ, M, m.z, b, m.y - 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y - 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y - 1).key] = { backfilled: !1 }), m.y + 1 < v && (j[new a.S(l.overscaledZ, M, m.z, b, m.y + 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, l.wrap, m.z, m.x, m.y + 1).key] = { backfilled: !1 }, j[new a.S(l.overscaledZ, D, m.z, V, m.y + 1).key] = { backfilled: !1 }), j;
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.demTexture && this.map.painter.saveTileTexture(l.demTexture), l.fbo && (l.fbo.destroy(), delete l.fbo), l.dem && delete l.dem, delete l.neighboringTiles, l.state = "unloaded", l.actor && (yield l.actor.sendAsync({ type: "RDT", data: { type: this.type, uid: l.uid, source: this.id } }));
});
}
}
class dn extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = !0, this.reparseOverscaled = !0, this._removed = !1, this._pendingLoads = 0, this.actor = v.getActor(), this.setEventedParent(b), this._data = m.data, this._options = a.e({}, m), this._collectResourceTiming = m.collectResourceTiming, m.maxzoom !== void 0 && (this.maxzoom = m.maxzoom), m.type && (this.type = m.type), m.attribution && (this.attribution = m.attribution), this.promoteId = m.promoteId;
const M = a.X / this.tileSize;
m.clusterMaxZoom !== void 0 && this.maxzoom <= m.clusterMaxZoom && a.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${m.clusterMaxZoom}".`), this.workerOptions = a.e({ source: this.id, cluster: m.cluster || !1, geojsonVtOptions: { buffer: (m.buffer !== void 0 ? m.buffer : 128) * M, tolerance: (m.tolerance !== void 0 ? m.tolerance : 0.375) * M, extent: a.X, maxZoom: this.maxzoom, lineMetrics: m.lineMetrics || !1, generateId: m.generateId || !1 }, superclusterOptions: { maxZoom: m.clusterMaxZoom !== void 0 ? m.clusterMaxZoom : this.maxzoom - 1, minPoints: Math.max(2, m.clusterMinPoints || 2), extent: a.X, radius: (m.clusterRadius || 50) * M, log: !1, generateId: m.generateId || !1 }, clusterProperties: m.clusterProperties, filter: m.filter }, m.workerOptions), typeof this.promoteId == "string" && (this.workerOptions.promoteId = this.promoteId);
}
load() {
return a._(this, void 0, void 0, function* () {
yield this._updateWorkerData();
});
}
onAdd(l) {
this.map = l, this.load();
}
setData(l) {
return this._data = l, this._updateWorkerData(), this;
}
updateData(l) {
return this._updateWorkerData(l), this;
}
getData() {
return a._(this, void 0, void 0, function* () {
const l = a.e({ type: this.type }, this.workerOptions);
return this.actor.sendAsync({ type: "GD", data: l });
});
}
setClusterOptions(l) {
return this.workerOptions.cluster = l.cluster, l && (l.clusterRadius !== void 0 && (this.workerOptions.superclusterOptions.radius = l.clusterRadius), l.clusterMaxZoom !== void 0 && (this.workerOptions.superclusterOptions.maxZoom = l.clusterMaxZoom)), this._updateWorkerData(), this;
}
getClusterExpansionZoom(l) {
return this.actor.sendAsync({ type: "GCEZ", data: { type: this.type, clusterId: l, source: this.id } });
}
getClusterChildren(l) {
return this.actor.sendAsync({ type: "GCC", data: { type: this.type, clusterId: l, source: this.id } });
}
getClusterLeaves(l, m, v) {
return this.actor.sendAsync({ type: "GCL", data: { type: this.type, source: this.id, clusterId: l, limit: m, offset: v } });
}
_updateWorkerData(l) {
return a._(this, void 0, void 0, function* () {
const m = a.e({ type: this.type }, this.workerOptions);
l ? m.dataDiff = l : typeof this._data == "string" ? (m.request = this.map._requestManager.transformRequest(f.resolveURL(this._data), "Source"), m.request.collectResourceTiming = this._collectResourceTiming) : m.data = JSON.stringify(this._data), this._pendingLoads++, this.fire(new a.k("dataloading", { dataType: "source" }));
try {
const v = yield this.actor.sendAsync({ type: "LD", data: m });
if (this._pendingLoads--, this._removed || v.abandoned)
return void this.fire(new a.k("dataabort", { dataType: "source" }));
let b = null;
v.resourceTiming && v.resourceTiming[this.id] && (b = v.resourceTiming[this.id].slice(0));
const M = { dataType: "source" };
this._collectResourceTiming && b && b.length > 0 && a.e(M, { resourceTiming: b }), this.fire(new a.k("data", Object.assign(Object.assign({}, M), { sourceDataType: "metadata" }))), this.fire(new a.k("data", Object.assign(Object.assign({}, M), { sourceDataType: "content" })));
} catch (v) {
if (this._pendingLoads--, this._removed)
return void this.fire(new a.k("dataabort", { dataType: "source" }));
this.fire(new a.j(v));
}
});
}
loaded() {
return this._pendingLoads === 0;
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
const m = l.actor ? "RT" : "LT";
l.actor = this.actor;
const v = { type: this.type, uid: l.uid, tileID: l.tileID, zoom: l.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: this.map.getPixelRatio(), showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId };
l.abortController = new AbortController();
const b = yield this.actor.sendAsync({ type: m, data: v }, l.abortController);
delete l.abortController, l.unloadVectorData(), l.aborted || l.loadVectorData(b, this.map.painter, m === "RT");
});
}
abortTile(l) {
return a._(this, void 0, void 0, function* () {
l.abortController && (l.abortController.abort(), delete l.abortController), l.aborted = !0;
});
}
unloadTile(l) {
return a._(this, void 0, void 0, function* () {
l.unloadVectorData(), yield this.actor.sendAsync({ type: "RMT", data: { uid: l.uid, type: this.type, source: this.id } });
});
}
onRemove() {
this._removed = !0, this.actor.sendAsync({ type: "RS", data: { type: this.type, source: this.id } });
}
serialize() {
return a.e({}, this._options, { type: this.type, data: this._data });
}
hasTransition() {
return !1;
}
}
var ji = a.Y([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]);
class Ji extends a.E {
constructor(l, m, v, b) {
super(), this.id = l, this.dispatcher = v, this.coordinates = m.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = !1, this.setEventedParent(b), this.options = m;
}
load(l) {
return a._(this, void 0, void 0, function* () {
this._loaded = !1, this.fire(new a.k("dataloading", { dataType: "source" })), this.url = this.options.url, this._request = new AbortController();
try {
const m = yield k.getImage(this.map._requestManager.transformRequest(this.url, "Image"), this._request);
this._request = null, this._loaded = !0, m && m.data && (this.image = m.data, l && (this.coordinates = l), this._finishLoading());
} catch (m) {
this._request = null, this._loaded = !0, this.fire(new a.j(m));
}
});
}
loaded() {
return this._loaded;
}
updateImage(l) {
return l.url ? (this._request && (this._request.abort(), this._request = null), this.options.url = l.url, this.load(l.coordinates).finally(() => {
this.texture = null;
}), this) : this;
}
_finishLoading() {
this.map && (this.setCoordinates(this.coordinates), this.fire(new a.k("data", { dataType: "source", sourceDataType: "metadata" })));
}
onAdd(l) {
this.map = l, this.load();
}
onRemove() {
this._request && (this._request.abort(), this._request = null);
}
setCoordinates(l) {
this.coordinates = l;
const m = l.map(a.Z.fromLngLat);
this.tileID = function(b) {
let M = 1 / 0, V = 1 / 0, D = -1 / 0, j = -1 / 0;
for (const lt of b)
M = Math.min(M, lt.x), V = Math.min(V, lt.y), D = Math.max(D, lt.x), j = Math.max(j, lt.y);
const Z = Math.max(D - M, j - V), Y = Math.max(0, Math.floor(-Math.log(Z) / Math.LN2)), J = Math.pow(2, Y);
return new a.a1(Y, Math.floor((M + D) / 2 * J), Math.floor((V + j) / 2 * J));
}(m), this.minzoom = this.maxzoom = this.tileID.z;
const v = m.map((b) => this.tileID.getTilePoint(b)._round());
return this._boundsArray = new a.$(), this._boundsArray.emplaceBack(v[0].x, v[0].y, 0, 0), this._boundsArray.emplaceBack(v[1].x, v[1].y, a.X, 0), this._boundsArray.emplaceBack(v[3].x, v[3].y, 0, a.X), this._boundsArray.emplaceBack(v[2].x, v[2].y, a.X, a.X), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new a.k("data", { dataType: "source", sourceDataType: "content" })), this;
}
prepare() {
if (Object.keys(this.tiles).length === 0 || !this.image)
return;
const l = this.map.painter.context, m = l.gl;
this.boundsBuffer || (this.boundsBuffer = l.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new rt(l, this.image, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = !0);
}
v && this.fire(new a.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
}
loadTile(l) {
return a._(this, void 0, void 0, function* () {
this.tileID && this.tileID.equals(l.tileID.canonical) ? (this.tiles[String(l.tileID.wrap)] = l, l.buckets = {}) : l.state = "errored";
});
}
serialize() {
return { type: "image", url: this.options.url, coordinates: this.coordinates };
}
hasTransition() {
return !1;
}
}
class ki extends Ji {
constructor(l, m, v, b) {
super(l, m, v, b), this.roundZoom = !0, this.type = "video", this.options = m;
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !1;
const l = this.options;
this.urls = [];
for (const m of l.urls)
this.urls.push(this.map._requestManager.transformRequest(m, "Source").url);
try {
const m = yield a.a3(this.urls);
if (this._loaded = !0, !m)
return;
this.video = m, this.video.loop = !0, this.video.addEventListener("playing", () => {
this.map.triggerRepaint();
}), this.map && this.video.play(), this._finishLoading();
} catch (m) {
this.fire(new a.j(m));
}
});
}
pause() {
this.video && this.video.pause();
}
play() {
this.video && this.video.play();
}
seek(l) {
if (this.video) {
const m = this.video.seekable;
l < m.start(0) || l > m.end(0) ? this.fire(new a.j(new a.a2(`sources.${this.id}`, null, `Playback for this video can be set only between the ${m.start(0)} and ${m.end(0)}-second mark.`))) : this.video.currentTime = l;
}
}
getVideo() {
return this.video;
}
onAdd(l) {
this.map || (this.map = l, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates)));
}
prepare() {
if (Object.keys(this.tiles).length === 0 || this.video.readyState < 2)
return;
const l = this.map.painter.context, m = l.gl;
this.boundsBuffer || (this.boundsBuffer = l.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture ? this.video.paused || (this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE), m.texSubImage2D(m.TEXTURE_2D, 0, 0, 0, m.RGBA, m.UNSIGNED_BYTE, this.video)) : (this.texture = new rt(l, this.video, m.RGBA), this.texture.bind(m.LINEAR, m.CLAMP_TO_EDGE));
let v = !1;
for (const b in this.tiles) {
const M = this.tiles[b];
M.state !== "loaded" && (M.state = "loaded", M.texture = this.texture, v = !0);
}
v && this.fire(new a.k("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 _i extends Ji {
constructor(l, m, v, b) {
super(l, m, v, b), m.coordinates ? Array.isArray(m.coordinates) && m.coordinates.length === 4 && !m.coordinates.some((M) => !Array.isArray(M) || M.length !== 2 || M.some((V) => typeof V != "number")) || this.fire(new a.j(new a.a2(`sources.${l}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new a.j(new a.a2(`sources.${l}`, null, 'missing required property "coordinates"'))), m.animate && typeof m.animate != "boolean" && this.fire(new a.j(new a.a2(`sources.${l}`, null, 'optional "animate" property must be a boolean value'))), m.canvas ? typeof m.canvas == "string" || m.canvas instanceof HTMLCanvasElement || this.fire(new a.j(new a.a2(`sources.${l}`, 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 a.j(new a.a2(`sources.${l}`, null, 'missing required property "canvas"'))), this.options = m, this.animate = m.animate === void 0 || m.animate;
}
load() {
return a._(this, void 0, void 0, function* () {
this._loaded = !0, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new a.j(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
this._playing = !0, this.map.triggerRepaint();
}, this.pause = function() {
this._playing && (this.prepare(), this._playing = !1);
}, this._finishLoading());
});
}
getCanvas() {
return this.canvas;
}
onAdd(l) {
this.map = l, this.load(), this.canvas && this.animate && this.play();
}
onRemove() {
this.pause();
}
prepare() {
let l = !1;
if (this.canvas.width !== this.width && (this.width = this.canvas.width, l = !0), this.canvas.height !== this.height && (this.height = this.canvas.height, l = !0), this._hasInvalidDimensions() || Object.keys(this.tiles).length === 0)
return;
const m = this.map.painter.context, v = m.gl;
this.boundsBuffer || (this.boundsBuffer = m.createVertexBuffer(this._boundsArray, ji.members)), this.boundsSegments || (this.boundsSegments = a.a0.simpleSegment(0, 0, 4, 2)), this.texture ? (l || this._playing) && this.texture.update(this.canvas, { premultiply: !0 }) : this.texture = new rt(m, this.canvas, v.RGBA, { premultiply: !0 });
let b = !1;
for (const M in this.tiles) {
const V = this.tiles[M];
V.state !== "loaded" && (V.state = "loaded", V.texture = this.texture, b = !0);
}
b && this.fire(new a.k("data", { dataType: "source", sourceDataType: "idle", sourceId: this.id }));
}
serialize() {
return { type: "canvas", coordinates: this.coordinates };
}
hasTransition() {
return this._playing;
}
_hasInvalidDimensions() {
for (const l of [this.canvas.width, this.canvas.height])
if (isNaN(l) || l <= 0)
return !0;
return !1;
}
}
const Ii = {}, c1 = (S) => {
switch (S) {
case "geojson":
return dn;
case "image":
return Ji;
case "raster":
return Hr;
case "raster-dem":
return Rr;
case "vector":
return Jr;
case "video":
return ki;
case "canvas":
return _i;
}
return Ii[S];
}, ye = "RTLPluginLoaded";
class bi extends a.E {
constructor() {
super(...arguments), this.status = "unavailable", this.url = null, this.dispatcher = Ge();
}
_syncState(l) {
return this.status = l, this.dispatcher.broadcast("SRPS", { pluginStatus: l, pluginURL: this.url }).catch((m) => {
throw this.status = "error", m;
});
}
getRTLTextPluginStatus() {
return this.status;
}
clearRTLTextPlugin() {
this.status = "unavailable", this.url = null;
}
setRTLTextPlugin(l) {
return a._(this, arguments, void 0, function* (m, v = !1) {
if (this.url)
throw new Error("setRTLTextPlugin cannot be called multiple times.");
if (this.url = f.resolveURL(m), !this.url)
throw new Error(`requested url ${m} is invalid`);
if (this.status === "unavailable") {
if (!v)
return this._requestImport();
this.status = "deferred", this._syncState(this.status);
} else if (this.status === "requested")
return this._requestImport();
});
}
_requestImport() {
return a._(this, void 0, void 0, function* () {
yield this._syncState("loading"), this.status = "loaded", this.fire(new a.k(ye));
});
}
lazyLoad() {
this.status === "unavailable" ? this.status = "requested" : this.status === "deferred" && this._requestImport();
}
}
let Xn = null;
function Hi() {
return Xn || (Xn = new bi()), Xn;
}
class t1 {
constructor(l, m) {
this.timeAdded = 0, this.fadeEndTime = 0, this.tileID = l, this.uid = a.a4(), this.uses = 0, this.tileSize = m, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = !1, this.hasRTLText = !1, this.dependencies = {}, this.rtt = [], this.rttCoords = {}, this.expiredRequestCount = 0, this.state = "loading";
}
registerFadeDuration(l) {
const m = l + this.timeAdded;
m < this.fadeEndTime || (this.fadeEndTime = m);
}
wasRequested() {
return this.state === "errored" || this.state === "loaded" || this.state === "reloading";
}
clearTextures(l) {
this.demTexture && l.saveTileTexture(this.demTexture), this.demTexture = null;
}
loadVectorData(l, m, v) {
if (this.hasData() && this.unloadVectorData(), this.state = "loaded", l) {
l.featureIndex && (this.latestFeatureIndex = l.featureIndex, l.rawTileData ? (this.latestRawTileData = l.rawTileData, this.latestFeatureIndex.rawTileData = l.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = l.collisionBoxArray, this.buckets = function(b, M) {
const V = {};
if (!M)
return V;
for (const D of b) {
const j = D.layerIds.map((Z) => M.getLayer(Z)).filter(Boolean);
if (j.length !== 0) {
D.layers = j, D.stateDependentLayerIds && (D.stateDependentLayers = D.stateDependentLayerIds.map((Z) => j.filter((Y) => Y.id === Z)[0]));
for (const Z of j)
V[Z.id] = D;
}
}
return V;
}(l.buckets, m.style), this.hasSymbolBuckets = !1;
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6) {
if (this.hasSymbolBuckets = !0, !v)
break;
M.justReloaded = !0;
}
}
if (this.hasRTLText = !1, this.hasSymbolBuckets)
for (const b in this.buckets) {
const M = this.buckets[b];
if (M instanceof a.a6 && M.hasRTLText) {
this.hasRTLText = !0, Hi().lazyLoad();
break;
}
}
this.queryPadding = 0;
for (const b in this.buckets) {
const M = this.buckets[b];
this.queryPadding = Math.max(this.queryPadding, m.style.getLayer(b).queryRadius(M));
}
l.imageAtlas && (this.imageAtlas = l.imageAtlas), l.glyphAtlasImage && (this.glyphAtlasImage = l.glyphAtlasImage);
} else
this.collisionBoxArray = new a.a5();
}
unloadVectorData() {
for (const l in this.buckets)
this.buckets[l].destroy();
this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.imageAtlas && (this.imageAtlas = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.latestFeatureIndex = null, this.state = "unloaded";
}
getBucket(l) {
return this.buckets[l.id];
}
upload(l) {
for (const v in this.buckets) {
const b = this.buckets[v];
b.uploadPending() && b.upload(l);
}
const m = l.gl;
this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new rt(l, this.imageAtlas.image, m.RGBA), this.imageAtlas.uploaded = !0), this.glyphAtlasImage && (this.glyphAtlasTexture = new rt(l, this.glyphAtlasImage, m.ALPHA), this.glyphAtlasImage = null);
}
prepare(l) {
this.imageAtlas && this.imageAtlas.patchUpdatedImages(l, this.imageAtlasTexture);
}
queryRenderedFeatures(l, m, v, b, M, V, D, j, Z, Y) {
return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: b, cameraQueryGeometry: M, scale: V, tileSize: this.tileSize, pixelPosMatrix: Y, transform: j, params: D, queryPadding: this.queryPadding * Z }, l, m, v) : {};
}
querySourceFeatures(l, m) {
const v = this.latestFeatureIndex;
if (!v || !v.rawTileData)
return;
const b = v.loadVTLayers(), M = m && m.sourceLayer ? m.sourceLayer : "", V = b._geojsonTileLayer || b[M];
if (!V)
return;
const D = a.a7(m && m.filter), { z: j, x: Z, y: Y } = this.tileID.canonical, J = { z: j, x: Z, y: Y };
for (let lt = 0; lt < V.length; lt++) {
const ft = V.feature(lt);
if (D.needGeometry) {
const Mt = a.a8(ft, !0);
if (!D.filter(new a.z(this.tileID.overscaledZ), Mt, this.tileID.canonical))
continue;
} else if (!D.filter(new a.z(this.tileID.overscaledZ), ft))
continue;
const Qt = v.getId(ft, M), wt = new a.a9(ft, j, Z, Y, Qt);
wt.tile = J, l.push(wt);
}
}
hasData() {
return this.state === "loaded" || this.state === "reloading" || this.state === "expired";
}
patternsLoaded() {
return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length;
}
setExpiryData(l) {
const m = this.expirationTime;
if (l.cacheControl) {
const v = a.aa(l.cacheControl);
v["max-age"] && (this.expirationTime = Date.now() + 1e3 * v["max-age"]);
} else
l.expires && (this.expirationTime = new Date(l.expires).getTime());
if (this.expirationTime) {
const v = Date.now();
let b = !1;
if (this.expirationTime > v)
b = !1;
else if (m)
if (this.expirationTime < m)
b = !0;
else {
const M = this.expirationTime - m;
M ? this.expirationTime = v + Math.max(M, 3e4) : b = !0;
}
else
b = !0;
b ? (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(l, m) {
if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || Object.keys(l).length === 0)
return;
const v = this.latestFeatureIndex.loadVTLayers();
for (const b in this.buckets) {
if (!m.style.hasLayer(b))
continue;
const M = this.buckets[b], V = M.layers[0].sourceLayer || "_geojsonTileLayer", D = v[V], j = l[V];
if (!D || !j || Object.keys(j).length === 0)
continue;
M.update(j, D, this.imageAtlas && this.imageAtlas.patternPositions || {});
const Z = m && m.style && m.style.getLayer(b);
Z && (this.queryPadding = Math.max(this.queryPadding, Z.queryRadius(M)));
}
}
holdingForFade() {
return this.symbolFadeHoldUntil !== void 0;
}
symbolFadeFinished() {
return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < f.now();
}
clearFadeHold() {
this.symbolFadeHoldUntil = void 0;
}
setHoldDuration(l) {
this.symbolFadeHoldUntil = f.now() + l;
}
setDependencies(l, m) {
const v = {};
for (const b of m)
v[b] = !0;
this.dependencies[l] = v;
}
hasDependency(l, m) {
for (const v of l) {
const b = this.dependencies[v];
if (b) {
for (const M of m)
if (b[M])
return !0;
}
}
return !1;
}
}
class xe {
constructor(l, m) {
this.max = l, this.onRemove = m, this.reset();
}
reset() {
for (const l in this.data)
for (const m of this.data[l])
m.timeout && clearTimeout(m.timeout), this.onRemove(m.value);
return this.data = {}, this.order = [], this;
}
add(l, m, v) {
const b = l.wrapped().key;
this.data[b] === void 0 && (this.data[b] = []);
const M = { value: m, timeout: void 0 };
if (v !== void 0 && (M.timeout = setTimeout(() => {
this.remove(l, M);
}, v)), this.data[b].push(M), this.order.push(b), this.order.length > this.max) {
const V = this._getAndRemoveByKey(this.order[0]);
V && this.onRemove(V);
}
return this;
}
has(l) {
return l.wrapped().key in this.data;
}
getAndRemove(l) {
return this.has(l) ? this._getAndRemoveByKey(l.wrapped().key) : null;
}
_getAndRemoveByKey(l) {
const m = this.data[l].shift();
return m.timeout && clearTimeout(m.timeout), this.data[l].length === 0 && delete this.data[l], this.order.splice(this.order.indexOf(l), 1), m.value;
}
getByKey(l) {
const m = this.data[l];
return m ? m[0].value : null;
}
get(l) {
return this.has(l) ? this.data[l.wrapped().key][0].value : null;
}
remove(l, m) {
if (!this.has(l))
return this;
const v = l.wrapped().key, b = m === void 0 ? 0 : this.data[v].indexOf(m), M = this.data[v][b];
return this.data[v].splice(b, 1), M.timeout && clearTimeout(M.timeout), this.data[v].length === 0 && delete this.data[v], this.onRemove(M.value), this.order.splice(this.order.indexOf(v), 1), this;
}
setMaxSize(l) {
for (this.max = l; this.order.length > this.max; ) {
const m = this._getAndRemoveByKey(this.order[0]);
m && this.onRemove(m);
}
return this;
}
filter(l) {
const m = [];
for (const v in this.data)
for (const b of this.data[v])
l(b.value) || m.push(b);
for (const v of m)
this.remove(v.value.tileID, v);
}
}
class Dr {
constructor() {
this.state = {}, this.stateChanges = {}, this.deletedStates = {};
}
updateState(l, m, v) {
const b = String(m);
if (this.stateChanges[l] = this.stateChanges[l] || {}, this.stateChanges[l][b] = this.stateChanges[l][b] || {}, a.e(this.stateChanges[l][b], v), this.deletedStates[l] === null) {
this.deletedStates[l] = {};
for (const M in this.state[l])
M !== b && (this.deletedStates[l][M] = null);
} else if (this.deletedStates[l] && this.deletedStates[l][b] === null) {
this.deletedStates[l][b] = {};
for (const M in this.state[l][b])
v[M] || (this.deletedStates[l][b][M] = null);
} else
for (const M in v)
this.deletedStates[l] && this.deletedStates[l][b] && this.deletedStates[l][b][M] === null && delete this.deletedStates[l][b][M];
}
removeFeatureState(l, m, v) {
if (this.deletedStates[l] === null)
return;
const b = String(m);
if (this.deletedStates[l] = this.deletedStates[l] || {}, v && m !== void 0)
this.deletedStates[l][b] !== null && (this.deletedStates[l][b] = this.deletedStates[l][b] || {}, this.deletedStates[l][b][v] = null);
else if (m !== void 0)
if (this.stateChanges[l] && this.stateChanges[l][b])
for (v in this.deletedStates[l][b] = {}, this.stateChanges[l][b])
this.deletedStates[l][b][v] = null;
else
this.deletedStates[l][b] = null;
else
this.deletedStates[l] = null;
}
getState(l, m) {
const v = String(m), b = a.e({}, (this.state[l] || {})[v], (this.stateChanges[l] || {})[v]);
if (this.deletedStates[l] === null)
return {};
if (this.deletedStates[l]) {
const M = this.deletedStates[l][m];
if (M === null)
return {};
for (const V in M)
delete b[V];
}
return b;
}
initializeTileState(l, m) {
l.setFeatureState(this.state, m);
}
coalesceChanges(l, m) {
const v = {};
for (const b in this.stateChanges) {
this.state[b] = this.state[b] || {};
const M = {};
for (const V in this.stateChanges[b])
this.state[b][V] || (this.state[b][V] = {}), a.e(this.state[b][V], this.stateChanges[b][V]), M[V] = this.state[b][V];
v[b] = M;
}
for (const b in this.deletedStates) {
this.state[b] = this.state[b] || {};
const M = {};
if (this.deletedStates[b] === null)
for (const V in this.state[b])
M[V] = {}, this.state[b][V] = {};
else
for (const V in this.deletedStates[b]) {
if (this.deletedStates[b][V] === null)
this.state[b][V] = {};
else
for (const D of Object.keys(this.deletedStates[b][V]))
delete this.state[b][V][D];
M[V] = this.state[b][V];
}
v[b] = v[b] || {}, a.e(v[b], M);
}
if (this.stateChanges = {}, this.deletedStates = {}, Object.keys(v).length !== 0)
for (const b in l)
l[b].setFeatureState(v, m);
}
}
class _r extends a.E {
constructor(l, m, v) {
super(), this.id = l, this.dispatcher = v, this.on("data", (b) => this._dataHandler(b)), this.on("dataloading", () => {
this._sourceErrored = !1;
}), this.on("error", () => {
this._sourceErrored = this._source.loaded();
}), this._source = ((b, M, V, D) => {
const j = new (c1(M.type))(b, M, V, D);
if (j.id !== b)
throw new Error(`Expected Source id to be ${b} instead of ${j.id}`);
return j;
})(l, m, v, this), this._tiles = {}, this._cache = new xe(0, (b) => this._unloadTile(b)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._maxTileCacheZoomLevels = null, this._loadedParentTiles = {}, this._coveredTiles = {}, this._state = new Dr(), this._didEmitContent = !1, this._updated = !1;
}
onAdd(l) {
this.map = l, this._maxTileCacheSize = l ? l._maxTileCacheSize : null, this._maxTileCacheZoomLevels = l ? l._maxTileCacheZoomLevels : null, this._source && this._source.onAdd && this._source.onAdd(l);
}
onRemove(l) {
this.clearTiles(), this._source && this._source.onRemove && this._source.onRemove(l);
}
loaded() {
if (this._sourceErrored)
return !0;
if (!this._sourceLoaded || !this._source.loaded())
return !1;
if (!(this.used === void 0 && this.usedForTerrain === void 0 || this.used || this.usedForTerrain))
return !0;
if (!this._updated)
return !1;
for (const l in this._tiles) {
const m = this._tiles[l];
if (m.state !== "loaded" && m.state !== "errored")
return !1;
}
return !0;
}
getSource() {
return this._source;
}
pause() {
this._paused = !0;
}
resume() {
if (!this._paused)
return;
const l = this._shouldReloadOnResume;
this._paused = !1, this._shouldReloadOnResume = !1, l && this.reload(), this.transform && this.update(this.transform, this.terrain);
}
_loadTile(l, m, v) {
return a._(this, void 0, void 0, function* () {
try {
yield this._source.loadTile(l), this._tileLoaded(l, m, v);
} catch (b) {
l.state = "errored", b.status !== 404 ? this._source.fire(new a.j(b, { tile: l })) : this.update(this.transform, this.terrain);
}
});
}
_unloadTile(l) {
this._source.unloadTile && this._source.unloadTile(l);
}
_abortTile(l) {
this._source.abortTile && this._source.abortTile(l), this._source.fire(new a.k("dataabort", { tile: l, coord: l.tileID, dataType: "source" }));
}
serialize() {
return this._source.serialize();
}
prepare(l) {
this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null);
for (const m in this._tiles) {
const v = this._tiles[m];
v.upload(l), v.prepare(this.map.style.imageManager);
}
}
getIds() {
return Object.values(this._tiles).map((l) => l.tileID).sort(Vn).map((l) => l.key);
}
getRenderableIds(l) {
const m = [];
for (const v in this._tiles)
this._isIdRenderable(v, l) && m.push(this._tiles[v]);
return l ? m.sort((v, b) => {
const M = v.tileID, V = b.tileID, D = new a.P(M.canonical.x, M.canonical.y)._rotate(this.transform.angle), j = new a.P(V.canonical.x, V.canonical.y)._rotate(this.transform.angle);
return M.overscaledZ - V.overscaledZ || j.y - D.y || j.x - D.x;
}).map((v) => v.tileID.key) : m.map((v) => v.tileID).sort(Vn).map((v) => v.key);
}
hasRenderableParent(l) {
const m = this.findLoadedParent(l, 0);
return !!m && this._isIdRenderable(m.tileID.key);
}
_isIdRenderable(l, m) {
return this._tiles[l] && this._tiles[l].hasData() && !this._coveredTiles[l] && (m || !this._tiles[l].holdingForFade());
}
reload() {
if (this._paused)
this._shouldReloadOnResume = !0;
else {
this._cache.reset();
for (const l in this._tiles)
this._tiles[l].state !== "errored" && this._reloadTile(l, "reloading");
}
}
_reloadTile(l, m) {
return a._(this, void 0, void 0, function* () {
const v = this._tiles[l];
v && (v.state !== "loading" && (v.state = m), yield this._loadTile(v, l, m));
});
}
_tileLoaded(l, m, v) {
l.timeAdded = f.now(), v === "expired" && (l.refreshedUponExpiration = !0), this._setTileReloadTimer(m, l), this.getSource().type === "raster-dem" && l.dem && this._backfillDEM(l), this._state.initializeTileState(l, this.map ? this.map.painter : null), l.aborted || this._source.fire(new a.k("data", { dataType: "source", tile: l, coord: l.tileID }));
}
_backfillDEM(l) {
const m = this.getRenderableIds();
for (let b = 0; b < m.length; b++) {
const M = m[b];
if (l.neighboringTiles && l.neighboringTiles[M]) {
const V = this.getTileByID(M);
v(l, V), v(V, l);
}
}
function v(b, M) {
b.needsHillshadePrepare = !0, b.needsTerrainPrepare = !0;
let V = M.tileID.canonical.x - b.tileID.canonical.x;
const D = M.tileID.canonical.y - b.tileID.canonical.y, j = Math.pow(2, b.tileID.canonical.z), Z = M.tileID.key;
V === 0 && D === 0 || Math.abs(D) > 1 || (Math.abs(V) > 1 && (Math.abs(V + j) === 1 ? V += j : Math.abs(V - j) === 1 && (V -= j)), M.dem && b.dem && (b.dem.backfillBorder(M.dem, V, D), b.neighboringTiles && b.neighboringTiles[Z] && (b.neighboringTiles[Z].backfilled = !0)));
}
}
getTile(l) {
return this.getTileByID(l.key);
}
getTileByID(l) {
return this._tiles[l];
}
_retainLoadedChildren(l, m, v, b) {
for (const M in this._tiles) {
let V = this._tiles[M];
if (b[M] || !V.hasData() || V.tileID.overscaledZ <= m || V.tileID.overscaledZ > v)
continue;
let D = V.tileID;
for (; V && V.tileID.overscaledZ > m + 1; ) {
const Z = V.tileID.scaledTo(V.tileID.overscaledZ - 1);
V = this._tiles[Z.key], V && V.hasData() && (D = Z);
}
let j = D;
for (; j.overscaledZ > m; )
if (j = j.scaledTo(j.overscaledZ - 1), l[j.key]) {
b[D.key] = D;
break;
}
}
}
findLoadedParent(l, m) {
if (l.key in this._loadedParentTiles) {
const v = this._loadedParentTiles[l.key];
return v && v.tileID.overscaledZ >= m ? v : null;
}
for (let v = l.overscaledZ - 1; v >= m; v--) {
const b = l.scaledTo(v), M = this._getLoadedTile(b);
if (M)
return M;
}
}
findLoadedSibling(l) {
return this._getLoadedTile(l);
}
_getLoadedTile(l) {
const m = this._tiles[l.key];
return m && m.hasData() ? m : this._cache.getByKey(l.wrapped().key);
}
updateCacheSize(l) {
const m = Math.ceil(l.width / this._source.tileSize) + 1, v = Math.ceil(l.height / this._source.tileSize) + 1, b = Math.floor(m * v * (this._maxTileCacheZoomLevels === null ? a.a.MAX_TILE_CACHE_ZOOM_LEVELS : this._maxTileCacheZoomLevels)), M = typeof this._maxTileCacheSize == "number" ? Math.min(this._maxTileCacheSize, b) : b;
this._cache.setMaxSize(M);
}
handleWrapJump(l) {
const m = Math.round((l - (this._prevLng === void 0 ? l : this._prevLng)) / 360);
if (this._prevLng = l, m) {
const v = {};
for (const b in this._tiles) {
const M = this._tiles[b];
M.tileID = M.tileID.unwrapTo(M.tileID.wrap + m), v[M.tileID.key] = M;
}
this._tiles = v;
for (const b in this._timers)
clearTimeout(this._timers[b]), delete this._timers[b];
for (const b in this._tiles)
this._setTileReloadTimer(b, this._tiles[b]);
}
}
_updateCoveredAndRetainedTiles(l, m, v, b, M, V) {
const D = {}, j = {}, Z = Object.keys(l), Y = f.now();
for (const J of Z) {
const lt = l[J], ft = this._tiles[J];
if (!ft || ft.fadeEndTime !== 0 && ft.fadeEndTime <= Y)
continue;
const Qt = this.findLoadedParent(lt, m), wt = this.findLoadedSibling(lt), Mt = Qt || wt || null;
Mt && (this._addTile(Mt.tileID), D[Mt.tileID.key] = Mt.tileID), j[J] = lt;
}
this._retainLoadedChildren(j, b, v, l);
for (const J in D)
l[J] || (this._coveredTiles[J] = !0, l[J] = D[J]);
if (V) {
const J = {}, lt = {};
for (const ft of M)
this._tiles[ft.key].hasData() ? J[ft.key] = ft : lt[ft.key] = ft;
for (const ft in lt) {
const Qt = lt[ft].children(this._source.maxzoom);
this._tiles[Qt[0].key] && this._tiles[Qt[1].key] && this._tiles[Qt[2].key] && this._tiles[Qt[3].key] && (J[Qt[0].key] = l[Qt[0].key] = Qt[0], J[Qt[1].key] = l[Qt[1].key] = Qt[1], J[Qt[2].key] = l[Qt[2].key] = Qt[2], J[Qt[3].key] = l[Qt[3].key] = Qt[3], delete lt[ft]);
}
for (const ft in lt) {
const Qt = lt[ft], wt = this.findLoadedParent(Qt, this._source.minzoom), Mt = this.findLoadedSibling(Qt), Ht = wt || Mt || null;
if (Ht) {
J[Ht.tileID.key] = l[Ht.tileID.key] = Ht.tileID;
for (const Ot in J)
J[Ot].isChildOf(Ht.tileID) && delete J[Ot];
}
}
for (const ft in this._tiles)
J[ft] || (this._coveredTiles[ft] = !0);
}
}
update(l, m) {
if (!this._sourceLoaded || this._paused)
return;
let v;
this.transform = l, this.terrain = m, this.updateCacheSize(l), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used || this.usedForTerrain ? this._source.tileID ? v = l.getVisibleUnwrappedCoordinates(this._source.tileID).map((Y) => new a.S(Y.canonical.z, Y.wrap, Y.canonical.z, Y.canonical.x, Y.canonical.y)) : (v = l.coveringTiles({ tileSize: this.usedForTerrain ? this.tileSize : this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: !this.usedForTerrain && this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled, terrain: m }), this._source.hasTile && (v = v.filter((Y) => this._source.hasTile(Y)))) : v = [];
const b = l.coveringZoomLevel(this._source), M = Math.max(b - _r.maxOverzooming, this._source.minzoom), V = Math.max(b + _r.maxUnderzooming, this._source.minzoom);
if (this.usedForTerrain) {
const Y = {};
for (const J of v)
if (J.canonical.z > this._source.minzoom) {
const lt = J.scaledTo(J.canonical.z - 1);
Y[lt.key] = lt;
const ft = J.scaledTo(Math.max(this._source.minzoom, Math.min(J.canonical.z, 5)));
Y[ft.key] = ft;
}
v = v.concat(Object.values(Y));
}
const D = v.length === 0 && !this._updated && this._didEmitContent;
this._updated = !0, D && this.fire(new a.k("data", { sourceDataType: "idle", dataType: "source", sourceId: this.id }));
const j = this._updateRetainedTiles(v, b);
y1(this._source.type) && this._updateCoveredAndRetainedTiles(j, M, V, b, v, m);
for (const Y in j)
this._tiles[Y].clearFadeHold();
const Z = a.ab(this._tiles, j);
for (const Y of Z) {
const J = this._tiles[Y];
J.hasSymbolBuckets && !J.holdingForFade() ? J.setHoldDuration(this.map._fadeDuration) : J.hasSymbolBuckets && !J.symbolFadeFinished() || this._removeTile(Y);
}
this._updateLoadedParentTileCache(), this._updateLoadedSiblingTileCache();
}
releaseSymbolFadeTiles() {
for (const l in this._tiles)
this._tiles[l].holdingForFade() && this._removeTile(l);
}
_updateRetainedTiles(l, m) {
var v;
const b = {}, M = {}, V = Math.max(m - _r.maxOverzooming, this._source.minzoom), D = Math.max(m + _r.maxUnderzooming, this._source.minzoom), j = {};
for (const Z of l) {
const Y = this._addTile(Z);
b[Z.key] = Z, Y.hasData() || m < this._source.maxzoom && (j[Z.key] = Z);
}
this._retainLoadedChildren(j, m, D, b);
for (const Z of l) {
let Y = this._tiles[Z.key];
if (Y.hasData())
continue;
if (m + 1 > this._source.maxzoom) {
const lt = Z.children(this._source.maxzoom)[0], ft = this.getTile(lt);
if (ft && ft.hasData()) {
b[lt.key] = lt;
continue;
}
} else {
const lt = Z.children(this._source.maxzoom);
if (b[lt[0].key] && b[lt[1].key] && b[lt[2].key] && b[lt[3].key])
continue;
}
let J = Y.wasRequested();
for (let lt = Z.overscaledZ - 1; lt >= V; --lt) {
const ft = Z.scaledTo(lt);
if (M[ft.key])
break;
if (M[ft.key] = !0, Y = this.getTile(ft), !Y && J && (Y = this._addTile(ft)), Y) {
const Qt = Y.hasData();
if ((Qt || !(!((v = this.map) === null || v === void 0) && v.cancelPendingTileRequestsWhileZooming) || J) && (b[ft.key] = ft), J = Y.wasRequested(), Qt)
break;
}
}
}
return b;
}
_updateLoadedParentTileCache() {
this._loadedParentTiles = {};
for (const l in this._tiles) {
const m = [];
let v, b = this._tiles[l].tileID;
for (; b.overscaledZ > 0; ) {
if (b.key in this._loadedParentTiles) {
v = this._loadedParentTiles[b.key];
break;
}
m.push(b.key);
const M = b.scaledTo(b.overscaledZ - 1);
if (v = this._getLoadedTile(M), v)
break;
b = M;
}
for (const M of m)
this._loadedParentTiles[M] = v;
}
}
_updateLoadedSiblingTileCache() {
this._loadedSiblingTiles = {};
for (const l in this._tiles) {
const m = this._tiles[l].tileID, v = this._getLoadedTile(m);
this._loadedSiblingTiles[m.key] = v;
}
}
_addTile(l) {
let m = this._tiles[l.key];
if (m)
return m;
m = this._cache.getAndRemove(l), m && (this._setTileReloadTimer(l.key, m), m.tileID = l, this._state.initializeTileState(m, this.map ? this.map.painter : null), this._cacheTimers[l.key] && (clearTimeout(this._cacheTimers[l.key]), delete this._cacheTimers[l.key], this._setTileReloadTimer(l.key, m)));
const v = m;
return m || (m = new t1(l, this._source.tileSize * l.overscaleFactor()), this._loadTile(m, l.key, m.state)), m.uses++, this._tiles[l.key] = m, v || this._source.fire(new a.k("dataloading", { tile: m, coord: m.tileID, dataType: "source" })), m;
}
_setTileReloadTimer(l, m) {
l in this._timers && (clearTimeout(this._timers[l]), delete this._timers[l]);
const v = m.getExpiryTimeout();
v && (this._timers[l] = setTimeout(() => {
this._reloadTile(l, "expired"), delete this._timers[l];
}, v));
}
_removeTile(l) {
const m = this._tiles[l];
m && (m.uses--, delete this._tiles[l], this._timers[l] && (clearTimeout(this._timers[l]), delete this._timers[l]), m.uses > 0 || (m.hasData() && m.state !== "reloading" ? this._cache.add(m.tileID, m, m.getExpiryTimeout()) : (m.aborted = !0, this._abortTile(m), this._unloadTile(m))));
}
_dataHandler(l) {
const m = l.sourceDataType;
l.dataType === "source" && m === "metadata" && (this._sourceLoaded = !0), this._sourceLoaded && !this._paused && l.dataType === "source" && m === "content" && (this.reload(), this.transform && this.update(this.transform, this.terrain), this._didEmitContent = !0);
}
clearTiles() {
this._shouldReloadOnResume = !1, this._paused = !1;
for (const l in this._tiles)
this._removeTile(l);
this._cache.reset();
}
tilesIn(l, m, v) {
const b = [], M = this.transform;
if (!M)
return b;
const V = v ? M.getCameraQueryGeometry(l) : l, D = l.map((Qt) => M.pointCoordinate(Qt, this.terrain)), j = V.map((Qt) => M.pointCoordinate(Qt, this.terrain)), Z = this.getIds();
let Y = 1 / 0, J = 1 / 0, lt = -1 / 0, ft = -1 / 0;
for (const Qt of j)
Y = Math.min(Y, Qt.x), J = Math.min(J, Qt.y), lt = Math.max(lt, Qt.x), ft = Math.max(ft, Qt.y);
for (let Qt = 0; Qt < Z.length; Qt++) {
const wt = this._tiles[Z[Qt]];
if (wt.holdingForFade())
continue;
const Mt = wt.tileID, Ht = Math.pow(2, M.zoom - wt.tileID.overscaledZ), Ot = m * wt.queryPadding * a.X / wt.tileSize / Ht, bt = [Mt.getTilePoint(new a.Z(Y, J)), Mt.getTilePoint(new a.Z(lt, ft))];
if (bt[0].x - Ot < a.X && bt[0].y - Ot < a.X && bt[1].x + Ot >= 0 && bt[1].y + Ot >= 0) {
const Nt = D.map((Wt) => Mt.getTilePoint(Wt)), Dt = j.map((Wt) => Mt.getTilePoint(Wt));
b.push({ tile: wt, tileID: Mt, queryGeometry: Nt, cameraQueryGeometry: Dt, scale: Ht });
}
}
return b;
}
getVisibleCoordinates(l) {
const m = this.getRenderableIds(l).map((v) => this._tiles[v].tileID);
for (const v of m)
v.posMatrix = this.transform.calculatePosMatrix(v.toUnwrapped());
return m;
}
hasTransition() {
if (this._source.hasTransition())
return !0;
if (y1(this._source.type)) {
const l = f.now();
for (const m in this._tiles)
if (this._tiles[m].fadeEndTime >= l)
return !0;
}
return !1;
}
setFeatureState(l, m, v) {
this._state.updateState(l = l || "_geojsonTileLayer", m, v);
}
removeFeatureState(l, m, v) {
this._state.removeFeatureState(l = l || "_geojsonTileLayer", m, v);
}
getFeatureState(l, m) {
return this._state.getState(l = l || "_geojsonTileLayer", m);
}
setDependencies(l, m, v) {
const b = this._tiles[l];
b && b.setDependencies(m, v);
}
reloadTilesForDependencies(l, m) {
for (const v in this._tiles)
this._tiles[v].hasDependency(l, m) && this._reloadTile(v, "reloading");
this._cache.filter((v) => !v.hasDependency(l, m));
}
}
function Vn(S, l) {
const m = Math.abs(2 * S.wrap) - +(S.wrap < 0), v = Math.abs(2 * l.wrap) - +(l.wrap < 0);
return S.overscaledZ - l.overscaledZ || v - m || l.canonical.y - S.canonical.y || l.canonical.x - S.canonical.x;
}
function y1(S) {
return S === "raster" || S === "image" || S === "video";
}
_r.maxOverzooming = 10, _r.maxUnderzooming = 3;
class wr {
constructor(l, m) {
this.reset(l, m);
}
reset(l, m) {
this.points = l || [], this._distances = [0];
for (let v = 1; v < this.points.length; v++)
this._distances[v] = this._distances[v - 1] + this.points[v].dist(this.points[v - 1]);
this.length = this._distances[this._distances.length - 1], this.padding = Math.min(m || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding;
}
lerp(l) {
if (this.points.length === 1)
return this.points[0];
l = a.ac(l, 0, 1);
let m = 1, v = this._distances[m];
const b = l * this.paddedLength + this.padding;
for (; v < b && m < this._distances.length; )
v = this._distances[++m];
const M = m - 1, V = this._distances[M], D = v - V, j = D > 0 ? (b - V) / D : 0;
return this.points[M].mult(1 - j).add(this.points[m].mult(j));
}
}
function Pi(S, l) {
let m = !0;
return S === "always" || S !== "never" && l !== "never" || (m = !1), m;
}
class H1 {
constructor(l, m, v) {
const b = this.boxCells = [], M = this.circleCells = [];
this.xCellCount = Math.ceil(l / v), this.yCellCount = Math.ceil(m / v);
for (let V = 0; V < this.xCellCount * this.yCellCount; V++)
b.push([]), M.push([]);
this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = l, this.height = m, this.xScale = this.xCellCount / l, this.yScale = this.yCellCount / m, this.boxUid = 0, this.circleUid = 0;
}
keysLength() {
return this.boxKeys.length + this.circleKeys.length;
}
insert(l, m, v, b, M) {
this._forEachCell(m, v, b, M, this._insertBoxCell, this.boxUid++), this.boxKeys.push(l), this.bboxes.push(m), this.bboxes.push(v), this.bboxes.push(b), this.bboxes.push(M);
}
insertCircle(l, m, v, b) {
this._forEachCell(m - b, v - b, m + b, v + b, this._insertCircleCell, this.circleUid++), this.circleKeys.push(l), this.circles.push(m), this.circles.push(v), this.circles.push(b);
}
_insertBoxCell(l, m, v, b, M, V) {
this.boxCells[M].push(V);
}
_insertCircleCell(l, m, v, b, M, V) {
this.circleCells[M].push(V);
}
_query(l, m, v, b, M, V, D) {
if (v < 0 || l > this.width || b < 0 || m > this.height)
return [];
const j = [];
if (l <= 0 && m <= 0 && this.width <= v && this.height <= b) {
if (M)
return [{ key: null, x1: l, y1: m, x2: v, y2: b }];
for (let Z = 0; Z < this.boxKeys.length; Z++)
j.push({ key: this.boxKeys[Z], x1: this.bboxes[4 * Z], y1: this.bboxes[4 * Z + 1], x2: this.bboxes[4 * Z + 2], y2: this.bboxes[4 * Z + 3] });
for (let Z = 0; Z < this.circleKeys.length; Z++) {
const Y = this.circles[3 * Z], J = this.circles[3 * Z + 1], lt = this.circles[3 * Z + 2];
j.push({ key: this.circleKeys[Z], x1: Y - lt, y1: J - lt, x2: Y + lt, y2: J + lt });
}
} else
this._forEachCell(l, m, v, b, this._queryCell, j, { hitTest: M, overlapMode: V, seenUids: { box: {}, circle: {} } }, D);
return j;
}
query(l, m, v, b) {
return this._query(l, m, v, b, !1, null);
}
hitTest(l, m, v, b, M, V) {
return this._query(l, m, v, b, !0, M, V).length > 0;
}
hitTestCircle(l, m, v, b, M) {
const V = l - v, D = l + v, j = m - v, Z = m + v;
if (D < 0 || V > this.width || Z < 0 || j > this.height)
return !1;
const Y = [];
return this._forEachCell(V, j, D, Z, this._queryCellCircle, Y, { hitTest: !0, overlapMode: b, circle: { x: l, y: m, radius: v }, seenUids: { box: {}, circle: {} } }, M), Y.length > 0;
}
_queryCell(l, m, v, b, M, V, D, j) {
const { seenUids: Z, hitTest: Y, overlapMode: J } = D, lt = this.boxCells[M];
if (lt !== null) {
const Qt = this.bboxes;
for (const wt of lt)
if (!Z.box[wt]) {
Z.box[wt] = !0;
const Mt = 4 * wt, Ht = this.boxKeys[wt];
if (l <= Qt[Mt + 2] && m <= Qt[Mt + 3] && v >= Qt[Mt + 0] && b >= Qt[Mt + 1] && (!j || j(Ht)) && (!Y || !Pi(J, Ht.overlapMode)) && (V.push({ key: Ht, x1: Qt[Mt], y1: Qt[Mt + 1], x2: Qt[Mt + 2], y2: Qt[Mt + 3] }), Y))
return !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Z.circle[wt]) {
Z.circle[wt] = !0;
const Mt = 3 * wt, Ht = this.circleKeys[wt];
if (this._circleAndRectCollide(Qt[Mt], Qt[Mt + 1], Qt[Mt + 2], l, m, v, b) && (!j || j(Ht)) && (!Y || !Pi(J, Ht.overlapMode))) {
const Ot = Qt[Mt], bt = Qt[Mt + 1], Nt = Qt[Mt + 2];
if (V.push({ key: Ht, x1: Ot - Nt, y1: bt - Nt, x2: Ot + Nt, y2: bt + Nt }), Y)
return !0;
}
}
}
return !1;
}
_queryCellCircle(l, m, v, b, M, V, D, j) {
const { circle: Z, seenUids: Y, overlapMode: J } = D, lt = this.boxCells[M];
if (lt !== null) {
const Qt = this.bboxes;
for (const wt of lt)
if (!Y.box[wt]) {
Y.box[wt] = !0;
const Mt = 4 * wt, Ht = this.boxKeys[wt];
if (this._circleAndRectCollide(Z.x, Z.y, Z.radius, Qt[Mt + 0], Qt[Mt + 1], Qt[Mt + 2], Qt[Mt + 3]) && (!j || j(Ht)) && !Pi(J, Ht.overlapMode))
return V.push(!0), !0;
}
}
const ft = this.circleCells[M];
if (ft !== null) {
const Qt = this.circles;
for (const wt of ft)
if (!Y.circle[wt]) {
Y.circle[wt] = !0;
const Mt = 3 * wt, Ht = this.circleKeys[wt];
if (this._circlesCollide(Qt[Mt], Qt[Mt + 1], Qt[Mt + 2], Z.x, Z.y, Z.radius) && (!j || j(Ht)) && !Pi(J, Ht.overlapMode))
return V.push(!0), !0;
}
}
}
_forEachCell(l, m, v, b, M, V, D, j) {
const Z = this._convertToXCellCoord(l), Y = this._convertToYCellCoord(m), J = this._convertToXCellCoord(v), lt = this._convertToYCellCoord(b);
for (let ft = Z; ft <= J; ft++)
for (let Qt = Y; Qt <= lt; Qt++)
if (M.call(this, l, m, v, b, this.xCellCount * Qt + ft, V, D, j))
return;
}
_convertToXCellCoord(l) {
return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(l * this.xScale)));
}
_convertToYCellCoord(l) {
return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(l * this.yScale)));
}
_circlesCollide(l, m, v, b, M, V) {
const D = b - l, j = M - m, Z = v + V;
return Z * Z > D * D + j * j;
}
_circleAndRectCollide(l, m, v, b, M, V, D) {
const j = (V - b) / 2, Z = Math.abs(l - (b + j));
if (Z > j + v)
return !1;
const Y = (D - M) / 2, J = Math.abs(m - (M + Y));
if (J > Y + v)
return !1;
if (Z <= j || J <= Y)
return !0;
const lt = Z - j, ft = J - Y;
return lt * lt + ft * ft <= v * v;
}
}
function Vi(S, l, m, v, b) {
const M = a.H();
return l ? (a.K(M, M, [1 / b, 1 / b, 1]), m || a.ad(M, M, v.angle)) : a.L(M, v.labelPlaneMatrix, S), M;
}
function Rn(S, l, m, v, b) {
if (l) {
const M = a.ae(S);
return a.K(M, M, [b, b, 1]), m || a.ad(M, M, -v.angle), M;
}
return v.glCoordMatrix;
}
function xt(S, l, m, v) {
let b;
v ? (b = [S, l, v(S, l), 1], a.af(b, b, m)) : (b = [S, l, 0, 1], Te(b, b, m));
const M = b[3];
return { point: new a.P(b[0] / M, b[1] / M), signedDistanceFromCamera: M, isOccluded: !1 };
}
function ot(S, l) {
return 0.5 + S / l * 0.5;
}
function st(S, l) {
return S.x >= -l[0] && S.x <= l[0] && S.y >= -l[1] && S.y <= l[1];
}
function pt(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt) {
const wt = v ? S.textSizeData : S.iconSizeData, Mt = a.ag(wt, m.transform.zoom), Ht = [256 / m.width * 2 + 1, 256 / m.height * 2 + 1], Ot = v ? S.text.dynamicLayoutVertexArray : S.icon.dynamicLayoutVertexArray;
Ot.clear();
const bt = S.lineVertexArray, Nt = v ? S.text.placedSymbolArray : S.icon.placedSymbolArray, Dt = m.transform.width / m.transform.height;
let Wt = !1;
for (let he = 0; he < Nt.length; he++) {
const we = Nt.get(he);
if (we.hidden || we.writingMode === a.ah.vertical && !Wt) {
Rt(we.numGlyphs, Ot);
continue;
}
Wt = !1;
const De = xt(we.anchorX, we.anchorY, l, Qt);
if (!st(De.point, Ht)) {
Rt(we.numGlyphs, Ot);
continue;
}
const tr = ot(m.transform.cameraToCenterDistance, De.signedDistanceFromCamera), Oe = a.ai(wt, Mt, we), Ae = V ? Oe / tr : Oe * tr, ur = { getElevation: Qt, labelPlaneMatrix: b, lineVertexArray: bt, pitchWithMap: V, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: Z, tileAnchorPoint: new a.P(we.anchorX, we.anchorY), unwrappedTileID: Y, width: J, height: lt, translation: ft }, Nr = Vt(ur, we, Ae, !1, D, l, M, S.glyphOffsetArray, Ot, Dt, j);
Wt = Nr.useVertical, (Nr.notEnoughRoom || Wt || Nr.needsFlipping && Vt(ur, we, Ae, !0, D, l, M, S.glyphOffsetArray, Ot, Dt, j).notEnoughRoom) && Rt(we.numGlyphs, Ot);
}
v ? S.text.dynamicLayoutVertexBuffer.updateData(Ot) : S.icon.dynamicLayoutVertexBuffer.updateData(Ot);
}
function yt(S, l, m, v, b, M, V, D) {
const j = M.glyphStartIndex + M.numGlyphs, Z = M.lineStartIndex, Y = M.lineStartIndex + M.lineLength, J = l.getoffsetX(M.glyphStartIndex), lt = l.getoffsetX(j - 1), ft = Le(S * J, m, v, b, M.segment, Z, Y, D, V);
if (!ft)
return null;
const Qt = Le(S * lt, m, v, b, M.segment, Z, Y, D, V);
return Qt ? D.projectionCache.anyProjectionOccluded ? null : { first: ft, last: Qt } : null;
}
function At(S, l, m, v) {
return S === a.ah.horizontal && Math.abs(m.y - l.y) > Math.abs(m.x - l.x) * v ? { useVertical: !0 } : (S === a.ah.vertical ? l.y < m.y : l.x > m.x) ? { needsFlipping: !0 } : null;
}
function Vt(S, l, m, v, b, M, V, D, j, Z, Y) {
const J = m / 24, lt = l.lineOffsetX * J, ft = l.lineOffsetY * J;
let Qt;
if (l.numGlyphs > 1) {
const wt = l.glyphStartIndex + l.numGlyphs, Mt = l.lineStartIndex, Ht = l.lineStartIndex + l.lineLength, Ot = yt(J, D, lt, ft, v, l, Y, S);
if (!Ot)
return { notEnoughRoom: !0 };
const bt = xt(Ot.first.point.x, Ot.first.point.y, V, S.getElevation).point, Nt = xt(Ot.last.point.x, Ot.last.point.y, V, S.getElevation).point;
if (b && !v) {
const Dt = At(l.writingMode, bt, Nt, Z);
if (Dt)
return Dt;
}
Qt = [Ot.first];
for (let Dt = l.glyphStartIndex + 1; Dt < wt - 1; Dt++)
Qt.push(Le(J * D.getoffsetX(Dt), lt, ft, v, l.segment, Mt, Ht, S, Y));
Qt.push(Ot.last);
} else {
if (b && !v) {
const Mt = xt(S.tileAnchorPoint.x, S.tileAnchorPoint.y, M, S.getElevation).point, Ht = l.lineStartIndex + l.segment + 1, Ot = new a.P(S.lineVertexArray.getx(Ht), S.lineVertexArray.gety(Ht)), bt = xt(Ot.x, Ot.y, M, S.getElevation), Nt = bt.signedDistanceFromCamera > 0 ? bt.point : function(Wt, he, we, De, tr, Oe) {
return jt(Wt, he, we, 1, tr, Oe);
}(S.tileAnchorPoint, Ot, Mt, 0, M, S), Dt = At(l.writingMode, Mt, Nt, Z);
if (Dt)
return Dt;
}
const wt = Le(J * D.getoffsetX(l.glyphStartIndex), lt, ft, v, l.segment, l.lineStartIndex, l.lineStartIndex + l.lineLength, S, Y);
if (!wt || S.projectionCache.anyProjectionOccluded)
return { notEnoughRoom: !0 };
Qt = [wt];
}
for (const wt of Qt)
a.aj(j, wt.point, wt.angle);
return {};
}
function jt(S, l, m, v, b, M) {
const V = S.add(S.sub(l)._unit()), D = b !== void 0 ? xt(V.x, V.y, b, M.getElevation).point : Jt(V.x, V.y, M).point, j = m.sub(D);
return m.add(j._mult(v / j.mag()));
}
function St(S, l, m) {
const v = l.projectionCache;
if (v.projections[S])
return v.projections[S];
const b = new a.P(l.lineVertexArray.getx(S), l.lineVertexArray.gety(S)), M = Jt(b.x, b.y, l);
if (M.signedDistanceFromCamera > 0)
return v.projections[S] = M.point, v.anyProjectionOccluded = v.anyProjectionOccluded || M.isOccluded, M.point;
const V = S - m.direction;
return function(D, j, Z, Y, J) {
return jt(D, j, Z, Y, void 0, J);
}(m.distanceFromAnchor === 0 ? l.tileAnchorPoint : new a.P(l.lineVertexArray.getx(V), l.lineVertexArray.gety(V)), b, m.previousVertex, m.absOffsetX - m.distanceFromAnchor + 1, l);
}
function Jt(S, l, m) {
const v = S + m.translation[0], b = l + m.translation[1];
let M;
return !m.pitchWithMap && m.projection.useSpecialProjectionForSymbols ? (M = m.projection.projectTileCoordinates(v, b, m.unwrappedTileID, m.getElevation), M.point.x = (0.5 * M.point.x + 0.5) * m.width, M.point.y = (0.5 * -M.point.y + 0.5) * m.height) : (M = xt(v, b, m.labelPlaneMatrix, m.getElevation), M.isOccluded = !1), M;
}
function ae(S, l, m) {
return S._unit()._perp()._mult(l * m);
}
function Xt(S, l, m, v, b, M, V, D, j) {
if (D.projectionCache.offsets[S])
return D.projectionCache.offsets[S];
const Z = m.add(l);
if (S + j.direction < v || S + j.direction >= b)
return D.projectionCache.offsets[S] = Z, Z;
const Y = St(S + j.direction, D, j), J = ae(Y.sub(m), V, j.direction), lt = m.add(J), ft = Y.add(J);
return D.projectionCache.offsets[S] = a.ak(M, Z, lt, ft) || Z, D.projectionCache.offsets[S];
}
function Le(S, l, m, v, b, M, V, D, j) {
const Z = v ? S - l : S + l;
let Y = Z > 0 ? 1 : -1, J = 0;
v && (Y *= -1, J = Math.PI), Y < 0 && (J += Math.PI);
let lt, ft = Y > 0 ? M + b : M + b + 1;
D.projectionCache.cachedAnchorPoint ? lt = D.projectionCache.cachedAnchorPoint : (lt = Jt(D.tileAnchorPoint.x, D.tileAnchorPoint.y, D).point, D.projectionCache.cachedAnchorPoint = lt);
let Qt, wt, Mt = lt, Ht = lt, Ot = 0, bt = 0;
const Nt = Math.abs(Z), Dt = [];
let Wt;
for (; Ot + bt <= Nt; ) {
if (ft += Y, ft < M || ft >= V)
return null;
Ot += bt, Ht = Mt, wt = Qt;
const De = { absOffsetX: Nt, direction: Y, distanceFromAnchor: Ot, previousVertex: Ht };
if (Mt = St(ft, D, De), m === 0)
Dt.push(Ht), Wt = Mt.sub(Ht);
else {
let tr;
const Oe = Mt.sub(Ht);
tr = Oe.mag() === 0 ? ae(St(ft + Y, D, De).sub(Mt), m, Y) : ae(Oe, m, Y), wt || (wt = Ht.add(tr)), Qt = Xt(ft, tr, Mt, M, V, wt, m, D, De), Dt.push(wt), Wt = Qt.sub(wt);
}
bt = Wt.mag();
}
const he = Wt._mult((Nt - Ot) / bt)._add(wt || Ht), we = J + Math.atan2(Mt.y - Ht.y, Mt.x - Ht.x);
return Dt.push(he), { point: he, angle: j ? we : 0, path: Dt };
}
const or = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
function Rt(S, l) {
for (let m = 0; m < S; m++) {
const v = l.length;
l.resize(v + 4), l.float32.set(or, 3 * v);
}
}
function Te(S, l, m) {
const v = l[0], b = l[1];
return S[0] = m[0] * v + m[4] * b + m[12], S[1] = m[1] * v + m[5] * b + m[13], S[3] = m[3] * v + m[7] * b + m[15], S;
}
const Se = 100;
class lr {
constructor(l, m, v = new H1(l.width + 200, l.height + 200, 25), b = new H1(l.width + 200, l.height + 200, 25)) {
this.transform = l, this.mapProjection = m, this.grid = v, this.ignoredGrid = b, this.pitchFactor = Math.cos(l._pitch) * l.cameraToCenterDistance, this.screenRightBoundary = l.width + Se, this.screenBottomBoundary = l.height + Se, this.gridRightBoundary = l.width + 200, this.gridBottomBoundary = l.height + 200, this.perspectiveRatioCutoff = 0.6;
}
placeCollisionBox(l, m, v, b, M, V, D, j, Z, Y, J) {
const lt = l.anchorPointX + j[0], ft = l.anchorPointY + j[1], Qt = this.projectAndGetPerspectiveRatio(b, lt, ft, M, Y), wt = v * Qt.perspectiveRatio;
let Mt;
if (V || D)
Mt = this._projectCollisionBox(l, wt, b, M, V, D, j, Qt, Y, J);
else {
const Dt = Qt.point.x + (J ? J.x * wt : 0), Wt = Qt.point.y + (J ? J.y * wt : 0);
Mt = { allPointsOccluded: !1, box: [Dt + l.x1 * wt, Wt + l.y1 * wt, Dt + l.x2 * wt, Wt + l.y2 * wt] };
}
const [Ht, Ot, bt, Nt] = Mt.box;
return this.mapProjection.useSpecialProjectionForSymbols && (V ? Mt.allPointsOccluded : this.mapProjection.isOccluded(lt, ft, M)) || Qt.perspectiveRatio < this.perspectiveRatioCutoff || !this.isInsideGrid(Ht, Ot, bt, Nt) || m !== "always" && this.grid.hitTest(Ht, Ot, bt, Nt, m, Z) ? { box: [Ht, Ot, bt, Nt], placeable: !1, offscreen: !1 } : { box: [Ht, Ot, bt, Nt], placeable: !0, offscreen: this.isOffscreen(Ht, Ot, bt, Nt) };
}
placeCollisionCircles(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt) {
const Ht = [], Ot = new a.P(m.anchorX, m.anchorY), bt = this.getPerspectiveRatio(V, Ot.x, Ot.y, D, Mt), Nt = (J ? M / bt : M * bt) / a.ap, Dt = { getElevation: Mt, labelPlaneMatrix: j, lineVertexArray: v, pitchWithMap: J, projectionCache: { projections: {}, offsets: {}, cachedAnchorPoint: void 0, anyProjectionOccluded: !1 }, projection: this.mapProjection, tileAnchorPoint: Ot, unwrappedTileID: D, width: this.transform.width, height: this.transform.height, translation: wt }, Wt = yt(Nt, b, m.lineOffsetX * Nt, m.lineOffsetY * Nt, !1, m, !1, Dt);
let he = !1, we = !1, De = !0;
if (Wt) {
const tr = 0.5 * ft * bt + Qt, Oe = new a.P(-100, -100), Ae = new a.P(this.screenRightBoundary, this.screenBottomBoundary), ur = new wr(), Nr = Wt.first, Pe = Wt.last;
let We = [];
for (let Wr = Nr.path.length - 1; Wr >= 1; Wr--)
We.push(Nr.path[Wr]);
for (let Wr = 1; Wr < Pe.path.length; Wr++)
We.push(Pe.path[Wr]);
const kr = 2.5 * tr;
if (Z) {
const Wr = this.projectPathToScreenSpace(We, Dt, Z);
We = Wr.some((nn) => nn.signedDistanceFromCamera <= 0) ? [] : Wr.map((nn) => nn.point);
}
let ei = [];
if (We.length > 0) {
const Wr = We[0].clone(), nn = We[0].clone();
for (let ri = 1; ri < We.length; ri++)
Wr.x = Math.min(Wr.x, We[ri].x), Wr.y = Math.min(Wr.y, We[ri].y), nn.x = Math.max(nn.x, We[ri].x), nn.y = Math.max(nn.y, We[ri].y);
ei = Wr.x >= Oe.x && nn.x <= Ae.x && Wr.y >= Oe.y && nn.y <= Ae.y ? [We] : nn.x < Oe.x || Wr.x > Ae.x || nn.y < Oe.y || Wr.y > Ae.y ? [] : a.al([We], Oe.x, Oe.y, Ae.x, Ae.y);
}
for (const Wr of ei) {
ur.reset(Wr, 0.25 * tr);
let nn = 0;
nn = ur.length <= 0.5 * tr ? 1 : Math.ceil(ur.paddedLength / kr) + 1;
for (let ri = 0; ri < nn; ri++) {
const C1 = ri / Math.max(nn - 1, 1), O2 = ur.lerp(C1), ni = O2.x + Se, mo = O2.y + Se;
Ht.push(ni, mo, tr, 0);
const q1 = ni - tr, k1 = mo - tr, X1 = ni + tr, ms = mo + tr;
if (De = De && this.isOffscreen(q1, k1, X1, ms), we = we || this.isInsideGrid(q1, k1, X1, ms), l !== "always" && this.grid.hitTestCircle(ni, mo, tr, l, lt) && (he = !0, !Y))
return { circles: [], offscreen: !1, collisionDetected: he };
}
}
}
return { circles: !Y && he || !we || bt < this.perspectiveRatioCutoff ? [] : Ht, offscreen: De, collisionDetected: he };
}
projectPathToScreenSpace(l, m, v) {
return l.map((b) => xt(b.x, b.y, v, m.getElevation));
}
queryRenderedSymbols(l) {
if (l.length === 0 || this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)
return {};
const m = [];
let v = 1 / 0, b = 1 / 0, M = -1 / 0, V = -1 / 0;
for (const Y of l) {
const J = new a.P(Y.x + Se, Y.y + Se);
v = Math.min(v, J.x), b = Math.min(b, J.y), M = Math.max(M, J.x), V = Math.max(V, J.y), m.push(J);
}
const D = this.grid.query(v, b, M, V).concat(this.ignoredGrid.query(v, b, M, V)), j = {}, Z = {};
for (const Y of D) {
const J = Y.key;
if (j[J.bucketInstanceId] === void 0 && (j[J.bucketInstanceId] = {}), j[J.bucketInstanceId][J.featureIndex])
continue;
const lt = [new a.P(Y.x1, Y.y1), new a.P(Y.x2, Y.y1), new a.P(Y.x2, Y.y2), new a.P(Y.x1, Y.y2)];
a.am(m, lt) && (j[J.bucketInstanceId][J.featureIndex] = !0, Z[J.bucketInstanceId] === void 0 && (Z[J.bucketInstanceId] = []), Z[J.bucketInstanceId].push(J.featureIndex));
}
return Z;
}
insertCollisionBox(l, m, v, b, M, V) {
(v ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: b, featureIndex: M, collisionGroupID: V, overlapMode: m }, l[0], l[1], l[2], l[3]);
}
insertCollisionCircles(l, m, v, b, M, V) {
const D = v ? this.ignoredGrid : this.grid, j = { bucketInstanceId: b, featureIndex: M, collisionGroupID: V, overlapMode: m };
for (let Z = 0; Z < l.length; Z += 4)
D.insertCircle(j, l[Z], l[Z + 1], l[Z + 2]);
}
projectAndGetPerspectiveRatio(l, m, v, b, M) {
let V;
M ? (V = [m, v, M(m, v), 1], a.af(V, V, l)) : (V = [m, v, 0, 1], Te(V, V, l));
const D = V[3];
return { point: new a.P((V[0] / D + 1) / 2 * this.transform.width + Se, (-V[1] / D + 1) / 2 * this.transform.height + Se), perspectiveRatio: 0.5 + this.transform.cameraToCenterDistance / D * 0.5, isOccluded: !1, signedDistanceFromCamera: D };
}
getPerspectiveRatio(l, m, v, b, M) {
const V = this.mapProjection.useSpecialProjectionForSymbols ? this.mapProjection.projectTileCoordinates(m, v, b, M) : xt(m, v, l, M);
return 0.5 + this.transform.cameraToCenterDistance / V.signedDistanceFromCamera * 0.5;
}
isOffscreen(l, m, v, b) {
return v < Se || l >= this.screenRightBoundary || b < Se || m > this.screenBottomBoundary;
}
isInsideGrid(l, m, v, b) {
return v >= 0 && l < this.gridRightBoundary && b >= 0 && m < this.gridBottomBoundary;
}
getViewportMatrix() {
const l = a.an([]);
return a.J(l, l, [-100, -100, 0]), l;
}
_projectCollisionBox(l, m, v, b, M, V, D, j, Z, Y) {
let J = new a.P(1, 0), lt = new a.P(0, 1);
const ft = new a.P(l.anchorPointX + D[0], l.anchorPointY + D[1]);
if (V && !M) {
const De = this.projectAndGetPerspectiveRatio(v, ft.x + 1, ft.y, b, Z).point.sub(j.point).unit(), tr = Math.atan(De.y / De.x) + (De.x < 0 ? Math.PI : 0), Oe = Math.sin(tr), Ae = Math.cos(tr);
J = new a.P(Ae, Oe), lt = new a.P(-Oe, Ae);
} else if (!V && M) {
const De = -this.transform.angle, tr = Math.sin(De), Oe = Math.cos(De);
J = new a.P(Oe, tr), lt = new a.P(-tr, Oe);
}
let Qt = j.point, wt = m;
if (M) {
Qt = ft;
const De = this.transform.zoom - Math.floor(this.transform.zoom);
wt = Math.pow(2, -De), wt *= this.mapProjection.getPitchedTextCorrection(this.transform, ft, b), Y || (wt *= a.ac(0.5 + j.signedDistanceFromCamera / this.transform.cameraToCenterDistance * 0.5, 0, 4));
}
Y && (Qt = Qt.add(J.mult(Y.x * wt)).add(lt.mult(Y.y * wt)));
const Mt = l.x1 * wt, Ht = l.x2 * wt, Ot = (Mt + Ht) / 2, bt = l.y1 * wt, Nt = l.y2 * wt, Dt = (bt + Nt) / 2, Wt = [{ offsetX: Mt, offsetY: bt }, { offsetX: Ot, offsetY: bt }, { offsetX: Ht, offsetY: bt }, { offsetX: Ht, offsetY: Dt }, { offsetX: Ht, offsetY: Nt }, { offsetX: Ot, offsetY: Nt }, { offsetX: Mt, offsetY: Nt }, { offsetX: Mt, offsetY: Dt }];
let he = [];
for (const { offsetX: De, offsetY: tr } of Wt)
he.push(new a.P(Qt.x + J.x * De + lt.x * tr, Qt.y + J.y * De + lt.y * tr));
let we = !1;
if (M) {
const De = he.map((tr) => this.projectAndGetPerspectiveRatio(v, tr.x, tr.y, b, Z));
we = De.some((tr) => !tr.isOccluded), he = De.map((tr) => tr.point);
} else
we = !0;
return { box: a.ao(he), allPointsOccluded: !we };
}
}
function Ar(S, l, m) {
return l * (a.X / (S.tileSize * Math.pow(2, m - S.tileID.overscaledZ)));
}
class vn {
constructor(l, m, v, b) {
this.opacity = l ? Math.max(0, Math.min(1, l.opacity + (l.placed ? m : -m))) : b && v ? 1 : 0, this.placed = v;
}
isHidden() {
return this.opacity === 0 && !this.placed;
}
}
class zr {
constructor(l, m, v, b, M) {
this.text = new vn(l ? l.text : null, m, v, M), this.icon = new vn(l ? l.icon : null, m, b, M);
}
isHidden() {
return this.text.isHidden() && this.icon.isHidden();
}
}
class br {
constructor(l, m, v) {
this.text = l, this.icon = m, this.skipFade = v;
}
}
class Br {
constructor() {
this.invProjMatrix = a.H(), this.viewportMatrix = a.H(), this.circles = [];
}
}
class cn {
constructor(l, m, v, b, M) {
this.bucketInstanceId = l, this.featureIndex = m, this.sourceLayerIndex = v, this.bucketIndex = b, this.tileID = M;
}
}
class Kn {
constructor(l) {
this.crossSourceCollisions = l, this.maxGroupID = 0, this.collisionGroups = {};
}
get(l) {
if (this.crossSourceCollisions)
return { ID: 0, predicate: null };
if (!this.collisionGroups[l]) {
const m = ++this.maxGroupID;
this.collisionGroups[l] = { ID: m, predicate: (v) => v.collisionGroupID === m };
}
return this.collisionGroups[l];
}
}
function Li(S, l, m, v, b) {
const { horizontalAlign: M, verticalAlign: V } = a.au(S);
return new a.P(-(M - 0.5) * l + v[0] * b, -(V - 0.5) * m + v[1] * b);
}
class Ri {
constructor(l, m, v, b, M, V) {
this.transform = l.clone(), this.terrain = v, this.collisionIndex = new lr(this.transform, m), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = !1, this.commitTime = 0, this.fadeDuration = b, this.retainedQueryData = {}, this.collisionGroups = new Kn(M), this.collisionCircleArrays = {}, this.collisionBoxArrays = /* @__PURE__ */ new Map(), this.prevPlacement = V, V && (V.prevPlacement = void 0), this.placedOrientations = {};
}
_getTerrainElevationFunc(l) {
const m = this.terrain;
return m ? (v, b) => m.getElevation(l, v, b) : null;
}
getBucketParts(l, m, v, b) {
const M = v.getBucket(m), V = v.latestFeatureIndex;
if (!M || !V || m.id !== M.layerIds[0])
return;
const D = v.collisionBoxArray, j = M.layers[0].layout, Z = M.layers[0].paint, Y = Math.pow(2, this.transform.zoom - v.tileID.overscaledZ), J = v.tileSize / a.X, lt = v.tileID.toUnwrapped(), ft = this.transform.calculatePosMatrix(lt), Qt = j.get("text-pitch-alignment") === "map", wt = j.get("text-rotation-alignment") === "map", Mt = Ar(v, 1, this.transform.zoom), Ht = this.collisionIndex.mapProjection.translatePosition(this.transform, v, Z.get("text-translate"), Z.get("text-translate-anchor")), Ot = this.collisionIndex.mapProjection.translatePosition(this.transform, v, Z.get("icon-translate"), Z.get("icon-translate-anchor")), bt = Vi(ft, Qt, wt, this.transform, Mt);
let Nt = null;
if (Qt) {
const Wt = Rn(ft, Qt, wt, this.transform, Mt);
Nt = a.L([], this.transform.labelPlaneMatrix, Wt);
}
this.retainedQueryData[M.bucketInstanceId] = new cn(M.bucketInstanceId, V, M.sourceLayerIndex, M.index, v.tileID);
const Dt = { bucket: M, layout: j, translationText: Ht, translationIcon: Ot, posMatrix: ft, unwrappedTileID: lt, textLabelPlaneMatrix: bt, labelToScreenMatrix: Nt, scale: Y, textPixelRatio: J, holdingForFade: v.holdingForFade(), collisionBoxArray: D, partiallyEvaluatedTextSize: a.ag(M.textSizeData, this.transform.zoom), collisionGroup: this.collisionGroups.get(M.sourceID) };
if (b)
for (const Wt of M.sortKeyRanges) {
const { sortKey: he, symbolInstanceStart: we, symbolInstanceEnd: De } = Wt;
l.push({ sortKey: he, symbolInstanceStart: we, symbolInstanceEnd: De, parameters: Dt });
}
else
l.push({ symbolInstanceStart: 0, symbolInstanceEnd: M.symbolInstances.length, parameters: Dt });
}
attemptAnchorPlacement(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt, Ht, Ot, bt) {
const Nt = a.aq[l.textAnchor], Dt = [l.textOffset0, l.textOffset1], Wt = Li(Nt, v, b, Dt, M), he = this.collisionIndex.placeCollisionBox(m, lt, j, Z, Y, D, V, Mt, J.predicate, bt, Wt);
if ((!Ot || this.collisionIndex.placeCollisionBox(Ot, lt, j, Z, Y, D, V, Ht, J.predicate, bt, Wt).placeable) && he.placeable) {
let we;
if (this.prevPlacement && this.prevPlacement.variableOffsets[ft.crossTileID] && this.prevPlacement.placements[ft.crossTileID] && this.prevPlacement.placements[ft.crossTileID].text && (we = this.prevPlacement.variableOffsets[ft.crossTileID].anchor), ft.crossTileID === 0)
throw new Error("symbolInstance.crossTileID can't be 0");
return this.variableOffsets[ft.crossTileID] = { textOffset: Dt, width: v, height: b, anchor: Nt, textBoxScale: M, prevAnchor: we }, this.markUsedJustification(Qt, Nt, ft, wt), Qt.allowVerticalPlacement && (this.markUsedOrientation(Qt, wt, ft), this.placedOrientations[ft.crossTileID] = wt), { shift: Wt, placedGlyphBoxes: he };
}
}
placeLayerBucketPart(l, m, v) {
const { bucket: b, layout: M, translationText: V, translationIcon: D, posMatrix: j, unwrappedTileID: Z, textLabelPlaneMatrix: Y, labelToScreenMatrix: J, textPixelRatio: lt, holdingForFade: ft, collisionBoxArray: Qt, partiallyEvaluatedTextSize: wt, collisionGroup: Mt } = l.parameters, Ht = M.get("text-optional"), Ot = M.get("icon-optional"), bt = a.ar(M, "text-overlap", "text-allow-overlap"), Nt = bt === "always", Dt = a.ar(M, "icon-overlap", "icon-allow-overlap"), Wt = Dt === "always", he = M.get("text-rotation-alignment") === "map", we = M.get("text-pitch-alignment") === "map", De = M.get("icon-text-fit") !== "none", tr = M.get("symbol-z-order") === "viewport-y", Oe = Nt && (Wt || !b.hasIconData() || Ot), Ae = Wt && (Nt || !b.hasTextData() || Ht);
!b.collisionArrays && Qt && b.deserializeCollisionBoxes(Qt);
const ur = this._getTerrainElevationFunc(this.retainedQueryData[b.bucketInstanceId].tileID), Nr = (Pe, We, kr) => {
var ei, Wr;
if (m[Pe.crossTileID])
return;
if (ft)
return void (this.placements[Pe.crossTileID] = new br(!1, !1, !1));
let nn = !1, ri = !1, C1 = !0, O2 = null, ni = { box: null, placeable: !1, offscreen: null }, mo = { box: null, placeable: !1, offscreen: null }, q1 = null, k1 = null, X1 = null, ms = 0, s6 = 0, Il = 0;
We.textFeatureIndex ? ms = We.textFeatureIndex : Pe.useRuntimeCollisionCircles && (ms = Pe.featureIndex), We.verticalTextFeatureIndex && (s6 = We.verticalTextFeatureIndex);
const a6 = We.textBox;
if (a6) {
const o2 = (b1) => {
let I1 = a.ah.horizontal;
if (b.allowVerticalPlacement && !b1 && this.prevPlacement) {
const Ro = this.prevPlacement.placedOrientations[Pe.crossTileID];
Ro && (this.placedOrientations[Pe.crossTileID] = Ro, I1 = Ro, this.markUsedOrientation(b, I1, Pe));
}
return I1;
}, s2 = (b1, I1) => {
if (b.allowVerticalPlacement && Pe.numVerticalGlyphVertices > 0 && We.verticalTextBox) {
for (const Ro of b.writingModes)
if (Ro === a.ah.vertical ? (ni = I1(), mo = ni) : ni = b1(), ni && ni.placeable)
break;
} else
ni = b1();
}, Ea = Pe.textAnchorOffsetStartIndex, C2 = Pe.textAnchorOffsetEndIndex;
if (C2 === Ea) {
const b1 = (I1, Ro) => {
const an = this.collisionIndex.placeCollisionBox(I1, bt, lt, j, Z, we, he, V, Mt.predicate, ur);
return an && an.placeable && (this.markUsedOrientation(b, Ro, Pe), this.placedOrientations[Pe.crossTileID] = Ro), an;
};
s2(() => b1(a6, a.ah.horizontal), () => {
const I1 = We.verticalTextBox;
return b.allowVerticalPlacement && Pe.numVerticalGlyphVertices > 0 && I1 ? b1(I1, a.ah.vertical) : { box: null, offscreen: null };
}), o2(ni && ni.placeable);
} else {
let b1 = a.aq[(Wr = (ei = this.prevPlacement) === null || ei === void 0 ? void 0 : ei.variableOffsets[Pe.crossTileID]) === null || Wr === void 0 ? void 0 : Wr.anchor];
const I1 = (an, B3, l6) => {
const c6 = an.x2 - an.x1, Lp = an.y2 - an.y1, b_ = Pe.textBoxScale, wp = De && Dt === "never" ? B3 : null;
let Ma = null, xp = bt === "never" ? 1 : 2, Vl = "never";
b1 && xp++;
for (let R0 = 0; R0 < xp; R0++) {
for (let Rl = Ea; Rl < C2; Rl++) {
const Nl = b.textAnchorOffsets.get(Rl);
if (b1 && Nl.textAnchor !== b1)
continue;
const u6 = this.attemptAnchorPlacement(Nl, an, c6, Lp, b_, he, we, lt, j, Z, Mt, Vl, Pe, b, l6, V, D, wp, ur);
if (u6 && (Ma = u6.placedGlyphBoxes, Ma && Ma.placeable))
return nn = !0, O2 = u6.shift, Ma;
}
b1 ? b1 = null : Vl = bt;
}
return v && !Ma && (Ma = { box: this.collisionIndex.placeCollisionBox(a6, "always", lt, j, Z, we, he, V, Mt.predicate, ur, new a.P(0, 0)).box, offscreen: !1, placeable: !1 }), Ma;
};
s2(() => I1(a6, We.iconBox, a.ah.horizontal), () => {
const an = We.verticalTextBox;
return b.allowVerticalPlacement && (!ni || !ni.placeable) && Pe.numVerticalGlyphVertices > 0 && an ? I1(an, We.verticalIconBox, a.ah.vertical) : { box: null, occluded: !0, offscreen: null };
}), ni && (nn = ni.placeable, C1 = ni.offscreen);
const Ro = o2(ni && ni.placeable);
if (!nn && this.prevPlacement) {
const an = this.prevPlacement.variableOffsets[Pe.crossTileID];
an && (this.variableOffsets[Pe.crossTileID] = an, this.markUsedJustification(b, an.anchor, Pe, Ro));
}
}
}
if (q1 = ni, nn = q1 && q1.placeable, C1 = q1 && q1.offscreen, Pe.useRuntimeCollisionCircles) {
const o2 = b.text.placedSymbolArray.get(Pe.centerJustifiedTextSymbolIndex), s2 = a.ai(b.textSizeData, wt, o2), Ea = M.get("text-padding");
k1 = this.collisionIndex.placeCollisionCircles(bt, o2, b.lineVertexArray, b.glyphOffsetArray, s2, j, Z, Y, J, v, we, Mt.predicate, Pe.collisionCircleDiameter, Ea, V, ur), k1.circles.length && k1.collisionDetected && !v && a.w("Collisions detected, but collision boxes are not shown"), nn = Nt || k1.circles.length > 0 && !k1.collisionDetected, C1 = C1 && k1.offscreen;
}
if (We.iconFeatureIndex && (Il = We.iconFeatureIndex), We.iconBox) {
const o2 = (s2) => this.collisionIndex.placeCollisionBox(s2, Dt, lt, j, Z, we, he, D, Mt.predicate, ur, De && O2 ? O2 : void 0);
mo && mo.placeable && We.verticalIconBox ? (X1 = o2(We.verticalIconBox), ri = X1.placeable) : (X1 = o2(We.iconBox), ri = X1.placeable), C1 = C1 && X1.offscreen;
}
const i2 = Ht || Pe.numHorizontalGlyphVertices === 0 && Pe.numVerticalGlyphVertices === 0, Pl = Ot || Pe.numIconVertices === 0;
i2 || Pl ? Pl ? i2 || (ri = ri && nn) : nn = ri && nn : ri = nn = ri && nn;
const jc = ri && X1.placeable;
if (nn && q1.placeable && this.collisionIndex.insertCollisionBox(q1.box, bt, M.get("text-ignore-placement"), b.bucketInstanceId, mo && mo.placeable && s6 ? s6 : ms, Mt.ID), jc && this.collisionIndex.insertCollisionBox(X1.box, Dt, M.get("icon-ignore-placement"), b.bucketInstanceId, Il, Mt.ID), k1 && nn && this.collisionIndex.insertCollisionCircles(k1.circles, bt, M.get("text-ignore-placement"), b.bucketInstanceId, ms, Mt.ID), v && this.storeCollisionData(b.bucketInstanceId, kr, We, q1, X1, k1), Pe.crossTileID === 0)
throw new Error("symbolInstance.crossTileID can't be 0");
if (b.bucketInstanceId === 0)
throw new Error("bucket.bucketInstanceId can't be 0");
this.placements[Pe.crossTileID] = new br(nn || Oe, ri || Ae, C1 || b.justReloaded), m[Pe.crossTileID] = !0;
};
if (tr) {
if (l.symbolInstanceStart !== 0)
throw new Error("bucket.bucketInstanceId should be 0");
const Pe = b.getSortedSymbolIndexes(this.transform.angle);
for (let We = Pe.length - 1; We >= 0; --We) {
const kr = Pe[We];
Nr(b.symbolInstances.get(kr), b.collisionArrays[kr], kr);
}
} else
for (let Pe = l.symbolInstanceStart; Pe < l.symbolInstanceEnd; Pe++)
Nr(b.symbolInstances.get(Pe), b.collisionArrays[Pe], Pe);
if (v && b.bucketInstanceId in this.collisionCircleArrays) {
const Pe = this.collisionCircleArrays[b.bucketInstanceId];
a.as(Pe.invProjMatrix, j), Pe.viewportMatrix = this.collisionIndex.getViewportMatrix();
}
b.justReloaded = !1;
}
storeCollisionData(l, m, v, b, M, V) {
if (v.textBox || v.iconBox) {
let D, j;
this.collisionBoxArrays.has(l) ? D = this.collisionBoxArrays.get(l) : (D = /* @__PURE__ */ new Map(), this.collisionBoxArrays.set(l, D)), D.has(m) ? j = D.get(m) : (j = { text: null, icon: null }, D.set(m, j)), v.textBox && (j.text = b.box), v.iconBox && (j.icon = M.box);
}
if (V) {
let D = this.collisionCircleArrays[l];
D === void 0 && (D = this.collisionCircleArrays[l] = new Br());
for (let j = 0; j < V.circles.length; j += 4)
D.circles.push(V.circles[j + 0]), D.circles.push(V.circles[j + 1]), D.circles.push(V.circles[j + 2]), D.circles.push(V.collisionDetected ? 1 : 0);
}
}
markUsedJustification(l, m, v, b) {
let M;
M = b === a.ah.vertical ? v.verticalPlacedTextSymbolIndex : { left: v.leftJustifiedTextSymbolIndex, center: v.centerJustifiedTextSymbolIndex, right: v.rightJustifiedTextSymbolIndex }[a.at(m)];
const V = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex, v.verticalPlacedTextSymbolIndex];
for (const D of V)
D >= 0 && (l.text.placedSymbolArray.get(D).crossTileID = M >= 0 && D !== M ? 0 : v.crossTileID);
}
markUsedOrientation(l, m, v) {
const b = m === a.ah.horizontal || m === a.ah.horizontalOnly ? m : 0, M = m === a.ah.vertical ? m : 0, V = [v.leftJustifiedTextSymbolIndex, v.centerJustifiedTextSymbolIndex, v.rightJustifiedTextSymbolIndex];
for (const D of V)
l.text.placedSymbolArray.get(D).placedOrientation = b;
v.verticalPlacedTextSymbolIndex && (l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation = M);
}
commit(l) {
this.commitTime = l, this.zoomAtLastRecencyCheck = this.transform.zoom;
const m = this.prevPlacement;
let v = !1;
this.prevZoomAdjustment = m ? m.zoomAdjustment(this.transform.zoom) : 0;
const b = m ? m.symbolFadeChange(l) : 1, M = m ? m.opacities : {}, V = m ? m.variableOffsets : {}, D = m ? m.placedOrientations : {};
for (const j in this.placements) {
const Z = this.placements[j], Y = M[j];
Y ? (this.opacities[j] = new zr(Y, b, Z.text, Z.icon), v = v || Z.text !== Y.text.placed || Z.icon !== Y.icon.placed) : (this.opacities[j] = new zr(null, b, Z.text, Z.icon, Z.skipFade), v = v || Z.text || Z.icon);
}
for (const j in M) {
const Z = M[j];
if (!this.opacities[j]) {
const Y = new zr(Z, b, !1, !1);
Y.isHidden() || (this.opacities[j] = Y, v = v || Z.text.placed || Z.icon.placed);
}
}
for (const j in V)
this.variableOffsets[j] || !this.opacities[j] || this.opacities[j].isHidden() || (this.variableOffsets[j] = V[j]);
for (const j in D)
this.placedOrientations[j] || !this.opacities[j] || this.opacities[j].isHidden() || (this.placedOrientations[j] = D[j]);
if (m && m.lastPlacementChangeTime === void 0)
throw new Error("Last placement time for previous placement is not defined");
v ? this.lastPlacementChangeTime = l : typeof this.lastPlacementChangeTime != "number" && (this.lastPlacementChangeTime = m ? m.lastPlacementChangeTime : l);
}
updateLayerOpacities(l, m) {
const v = {};
for (const b of m) {
const M = b.getBucket(l);
M && b.latestFeatureIndex && l.id === M.layerIds[0] && this.updateBucketOpacities(M, b.tileID, v, b.collisionBoxArray);
}
}
updateBucketOpacities(l, m, v, b) {
l.hasTextData() && (l.text.opacityVertexArray.clear(), l.text.hasVisibleVertices = !1), l.hasIconData() && (l.icon.opacityVertexArray.clear(), l.icon.hasVisibleVertices = !1), l.hasIconCollisionBoxData() && l.iconCollisionBox.collisionVertexArray.clear(), l.hasTextCollisionBoxData() && l.textCollisionBox.collisionVertexArray.clear();
const M = l.layers[0], V = M.layout, D = new zr(null, 0, !1, !1, !0), j = V.get("text-allow-overlap"), Z = V.get("icon-allow-overlap"), Y = M._unevaluatedLayout.hasValue("text-variable-anchor") || M._unevaluatedLayout.hasValue("text-variable-anchor-offset"), J = V.get("text-rotation-alignment") === "map", lt = V.get("text-pitch-alignment") === "map", ft = V.get("icon-text-fit") !== "none", Qt = new zr(null, 0, j && (Z || !l.hasIconData() || V.get("icon-optional")), Z && (j || !l.hasTextData() || V.get("text-optional")), !0);
!l.collisionArrays && b && (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) && l.deserializeCollisionBoxes(b);
const wt = (Ht, Ot, bt) => {
for (let Nt = 0; Nt < Ot / 4; Nt++)
Ht.opacityVertexArray.emplaceBack(bt);
Ht.hasVisibleVertices = Ht.hasVisibleVertices || bt !== uo;
}, Mt = this.collisionBoxArrays.get(l.bucketInstanceId);
for (let Ht = 0; Ht < l.symbolInstances.length; Ht++) {
const Ot = l.symbolInstances.get(Ht), { numHorizontalGlyphVertices: bt, numVerticalGlyphVertices: Nt, crossTileID: Dt } = Ot;
let Wt = this.opacities[Dt];
v[Dt] ? Wt = D : Wt || (Wt = Qt, this.opacities[Dt] = Wt), v[Dt] = !0;
const he = Ot.numIconVertices > 0, we = this.placedOrientations[Ot.crossTileID], De = we === a.ah.vertical, tr = we === a.ah.horizontal || we === a.ah.horizontalOnly;
if (bt > 0 || Nt > 0) {
const Ae = pn(Wt.text);
wt(l.text, bt, De ? uo : Ae), wt(l.text, Nt, tr ? uo : Ae);
const ur = Wt.text.isHidden();
[Ot.rightJustifiedTextSymbolIndex, Ot.centerJustifiedTextSymbolIndex, Ot.leftJustifiedTextSymbolIndex].forEach((We) => {
We >= 0 && (l.text.placedSymbolArray.get(We).hidden = ur || De ? 1 : 0);
}), Ot.verticalPlacedTextSymbolIndex >= 0 && (l.text.placedSymbolArray.get(Ot.verticalPlacedTextSymbolIndex).hidden = ur || tr ? 1 : 0);
const Nr = this.variableOffsets[Ot.crossTileID];
Nr && this.markUsedJustification(l, Nr.anchor, Ot, we);
const Pe = this.placedOrientations[Ot.crossTileID];
Pe && (this.markUsedJustification(l, "left", Ot, Pe), this.markUsedOrientation(l, Pe, Ot));
}
if (he) {
const Ae = pn(Wt.icon), ur = !(ft && Ot.verticalPlacedIconSymbolIndex && De);
Ot.placedIconSymbolIndex >= 0 && (wt(l.icon, Ot.numIconVertices, ur ? Ae : uo), l.icon.placedSymbolArray.get(Ot.placedIconSymbolIndex).hidden = Wt.icon.isHidden()), Ot.verticalPlacedIconSymbolIndex >= 0 && (wt(l.icon, Ot.numVerticalIconVertices, ur ? uo : Ae), l.icon.placedSymbolArray.get(Ot.verticalPlacedIconSymbolIndex).hidden = Wt.icon.isHidden());
}
const Oe = Mt && Mt.has(Ht) ? Mt.get(Ht) : { text: null, icon: null };
if (l.hasIconCollisionBoxData() || l.hasTextCollisionBoxData()) {
const Ae = l.collisionArrays[Ht];
if (Ae) {
let ur = new a.P(0, 0);
if (Ae.textBox || Ae.verticalTextBox) {
let Nr = !0;
if (Y) {
const Pe = this.variableOffsets[Dt];
Pe ? (ur = Li(Pe.anchor, Pe.width, Pe.height, Pe.textOffset, Pe.textBoxScale), J && ur._rotate(lt ? this.transform.angle : -this.transform.angle)) : Nr = !1;
}
if (Ae.textBox || Ae.verticalTextBox) {
let Pe;
Ae.textBox && (Pe = De), Ae.verticalTextBox && (Pe = tr), rs(l.textCollisionBox.collisionVertexArray, Wt.text.placed, !Nr || Pe, Oe.text, ur.x, ur.y);
}
}
if (Ae.iconBox || Ae.verticalIconBox) {
const Nr = !!(!tr && Ae.verticalIconBox);
let Pe;
Ae.iconBox && (Pe = Nr), Ae.verticalIconBox && (Pe = !Nr), rs(l.iconCollisionBox.collisionVertexArray, Wt.icon.placed, Pe, Oe.icon, ft ? ur.x : 0, ft ? ur.y : 0);
}
}
}
}
if (l.sortFeatures(this.transform.angle), this.retainedQueryData[l.bucketInstanceId] && (this.retainedQueryData[l.bucketInstanceId].featureSortOrder = l.featureSortOrder), l.hasTextData() && l.text.opacityVertexBuffer && l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray), l.hasIconData() && l.icon.opacityVertexBuffer && l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray), l.hasIconCollisionBoxData() && l.iconCollisionBox.collisionVertexBuffer && l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray), l.hasTextCollisionBoxData() && l.textCollisionBox.collisionVertexBuffer && l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray), l.text.opacityVertexArray.length !== l.text.layoutVertexArray.length / 4)
throw new Error(`bucket.text.opacityVertexArray.length (= ${l.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${l.text.layoutVertexArray.length}) / 4`);
if (l.icon.opacityVertexArray.length !== l.icon.layoutVertexArray.length / 4)
throw new Error(`bucket.icon.opacityVertexArray.length (= ${l.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${l.icon.layoutVertexArray.length}) / 4`);
if (l.bucketInstanceId in this.collisionCircleArrays) {
const Ht = this.collisionCircleArrays[l.bucketInstanceId];
l.placementInvProjMatrix = Ht.invProjMatrix, l.placementViewportMatrix = Ht.viewportMatrix, l.collisionCircleArray = Ht.circles, delete this.collisionCircleArrays[l.bucketInstanceId];
}
}
symbolFadeChange(l) {
return this.fadeDuration === 0 ? 1 : (l - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment;
}
zoomAdjustment(l) {
return Math.max(0, (this.transform.zoom - l) / 1.5);
}
hasTransitions(l) {
return this.stale || l - this.lastPlacementChangeTime < this.fadeDuration;
}
stillRecent(l, m) {
const v = this.zoomAtLastRecencyCheck === m ? 1 - this.zoomAdjustment(m) : 1;
return this.zoomAtLastRecencyCheck = m, this.commitTime + this.fadeDuration * v > l;
}
setStale() {
this.stale = !0;
}
}
function rs(S, l, m, v, b, M) {
v && v.length !== 0 || (v = [0, 0, 0, 0]);
const V = v[0] - Se, D = v[1] - Se, j = v[2] - Se, Z = v[3] - Se;
S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, V, D), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, j, D), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, j, Z), S.emplaceBack(l ? 1 : 0, m ? 1 : 0, b || 0, M || 0, V, Z);
}
const tn = Math.pow(2, 25), zi = Math.pow(2, 24), co = Math.pow(2, 17), Xr = Math.pow(2, 16), Yn = Math.pow(2, 9), ns = Math.pow(2, 8), _n = Math.pow(2, 1);
function pn(S) {
if (S.opacity === 0 && !S.placed)
return 0;
if (S.opacity === 1 && S.placed)
return 4294967295;
const l = S.placed ? 1 : 0, m = Math.floor(127 * S.opacity);
return m * tn + l * zi + m * co + l * Xr + m * Yn + l * ns + m * _n + l;
}
const uo = 0;
function u1() {
return { isOccluded: (S, l, m) => !1, getPitchedTextCorrection: (S, l, m) => 1, get useSpecialProjectionForSymbols() {
return !1;
}, projectTileCoordinates(S, l, m, v) {
throw new Error("Not implemented.");
}, translatePosition: (S, l, m, v) => function(b, M, V, D, j = !1) {
if (!V[0] && !V[1])
return [0, 0];
const Z = j ? D === "map" ? b.angle : 0 : D === "viewport" ? -b.angle : 0;
if (Z) {
const Y = Math.sin(Z), J = Math.cos(Z);
V = [V[0] * J - V[1] * Y, V[0] * Y + V[1] * J];
}
return [j ? V[0] : Ar(M, V[0], b.zoom), j ? V[1] : Ar(M, V[1], b.zoom)];
}(S, l, m, v), getCircleRadiusCorrection: (S) => 1 };
}
class Qn {
constructor(l) {
this._sortAcrossTiles = l.layout.get("symbol-z-order") !== "viewport-y" && !l.layout.get("symbol-sort-key").isConstant(), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = {}, this._bucketParts = [];
}
continuePlacement(l, m, v, b, M) {
const V = this._bucketParts;
for (; this._currentTileIndex < l.length; )
if (m.getBucketParts(V, b, l[this._currentTileIndex], this._sortAcrossTiles), this._currentTileIndex++, M())
return !0;
for (this._sortAcrossTiles && (this._sortAcrossTiles = !1, V.sort((D, j) => D.sortKey - j.sortKey)); this._currentPartIndex < V.length; )
if (m.placeLayerBucketPart(V[this._currentPartIndex], this._seenCrossTileIDs, v), this._currentPartIndex++, M())
return !0;
return !1;
}
}
class Ui {
constructor(l, m, v, b, M, V, D, j) {
this.placement = new Ri(l, u1(), m, V, D, j), this._currentPlacementIndex = v.length - 1, this._forceFullPlacement = b, this._showCollisionBoxes = M, this._done = !1;
}
isDone() {
return this._done;
}
continuePlacement(l, m, v) {
const b = f.now(), M = () => !this._forceFullPlacement && f.now() - b > 2;
for (; this._currentPlacementIndex >= 0; ) {
const V = m[l[this._currentPlacementIndex]], D = this.placement.collisionIndex.transform.zoom;
if (V.type === "symbol" && (!V.minzoom || V.minzoom <= D) && (!V.maxzoom || V.maxzoom > D)) {
if (this._inProgressLayer || (this._inProgressLayer = new Qn(V)), this._inProgressLayer.continuePlacement(v[V.source], this.placement, this._showCollisionBoxes, V, M))
return;
delete this._inProgressLayer;
}
this._currentPlacementIndex--;
}
this._done = !0;
}
commit(l) {
return this.placement.commit(l), this.placement;
}
}
const h1 = 512 / a.X / 2;
class jn {
constructor(l, m, v) {
this.tileID = l, this.bucketInstanceId = v, this._symbolsByKey = {};
const b = /* @__PURE__ */ new Map();
for (let M = 0; M < m.length; M++) {
const V = m.get(M), D = V.key, j = b.get(D);
j ? j.push(V) : b.set(D, [V]);
}
for (const [M, V] of b) {
const D = { positions: V.map((j) => ({ x: Math.floor(j.anchorX * h1), y: Math.floor(j.anchorY * h1) })), crossTileIDs: V.map((j) => j.crossTileID) };
if (D.positions.length > 128) {
const j = new a.av(D.positions.length, 16, Uint16Array);
for (const { x: Z, y: Y } of D.positions)
j.add(Z, Y);
j.finish(), delete D.positions, D.index = j;
}
this._symbolsByKey[M] = D;
}
}
getScaledCoordinates(l, m) {
const { x: v, y: b, z: M } = this.tileID.canonical, { x: V, y: D, z: j } = m.canonical, Z = h1 / Math.pow(2, j - M), Y = (D * a.X + l.anchorY) * Z, J = b * a.X * h1;
return { x: Math.floor((V * a.X + l.anchorX) * Z - v * a.X * h1), y: Math.floor(Y - J) };
}
findMatches(l, m, v) {
const b = this.tileID.canonical.z < m.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - m.canonical.z);
for (let M = 0; M < l.length; M++) {
const V = l.get(M);
if (V.crossTileID)
continue;
const D = this._symbolsByKey[V.key];
if (!D)
continue;
const j = this.getScaledCoordinates(V, m);
if (D.index) {
const Z = D.index.range(j.x - b, j.y - b, j.x + b, j.y + b).sort();
for (const Y of Z) {
const J = D.crossTileIDs[Y];
if (!v[J]) {
v[J] = !0, V.crossTileID = J;
break;
}
}
} else if (D.positions)
for (let Z = 0; Z < D.positions.length; Z++) {
const Y = D.positions[Z], J = D.crossTileIDs[Z];
if (Math.abs(Y.x - j.x) <= b && Math.abs(Y.y - j.y) <= b && !v[J]) {
v[J] = !0, V.crossTileID = J;
break;
}
}
}
}
getCrossTileIDsLists() {
return Object.values(this._symbolsByKey).map(({ crossTileIDs: l }) => l);
}
}
class is {
constructor() {
this.maxCrossTileID = 0;
}
generate() {
return ++this.maxCrossTileID;
}
}
class d1 {
constructor() {
this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0;
}
handleWrapJump(l) {
const m = Math.round((l - this.lng) / 360);
if (m !== 0)
for (const v in this.indexes) {
const b = this.indexes[v], M = {};
for (const V in b) {
const D = b[V];
D.tileID = D.tileID.unwrapTo(D.tileID.wrap + m), M[D.tileID.key] = D;
}
this.indexes[v] = M;
}
this.lng = l;
}
addBucket(l, m, v) {
if (this.indexes[l.overscaledZ] && this.indexes[l.overscaledZ][l.key]) {
if (this.indexes[l.overscaledZ][l.key].bucketInstanceId === m.bucketInstanceId)
return !1;
this.removeBucketCrossTileIDs(l.overscaledZ, this.indexes[l.overscaledZ][l.key]);
}
for (let M = 0; M < m.symbolInstances.length; M++)
m.symbolInstances.get(M).crossTileID = 0;
this.usedCrossTileIDs[l.overscaledZ] || (this.usedCrossTileIDs[l.overscaledZ] = {});
const b = this.usedCrossTileIDs[l.overscaledZ];
for (const M in this.indexes) {
const V = this.indexes[M];
if (Number(M) > l.overscaledZ)
for (const D in V) {
const j = V[D];
j.tileID.isChildOf(l) && j.findMatches(m.symbolInstances, l, b);
}
else {
const D = V[l.scaledTo(Number(M)).key];
D && D.findMatches(m.symbolInstances, l, b);
}
}
for (let M = 0; M < m.symbolInstances.length; M++) {
const V = m.symbolInstances.get(M);
V.crossTileID || (V.crossTileID = v.generate(), b[V.crossTileID] = !0);
}
return this.indexes[l.overscaledZ] === void 0 && (this.indexes[l.overscaledZ] = {}), this.indexes[l.overscaledZ][l.key] = new jn(l, m.symbolInstances, m.bucketInstanceId), !0;
}
removeBucketCrossTileIDs(l, m) {
for (const v of m.getCrossTileIDsLists())
for (const b of v)
delete this.usedCrossTileIDs[l][b];
}
removeStaleBuckets(l) {
let m = !1;
for (const v in this.indexes) {
const b = this.indexes[v];
for (const M in b)
l[b[M].bucketInstanceId] || (this.removeBucketCrossTileIDs(v, b[M]), delete b[M], m = !0);
}
return m;
}
}
class b2 {
constructor() {
this.layerIndexes = {}, this.crossTileIDs = new is(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {};
}
addLayer(l, m, v) {
let b = this.layerIndexes[l.id];
b === void 0 && (b = this.layerIndexes[l.id] = new d1());
let M = !1;
const V = {};
b.handleWrapJump(v);
for (const D of m) {
const j = D.getBucket(l);
j && l.id === j.layerIds[0] && (j.bucketInstanceId || (j.bucketInstanceId = ++this.maxBucketInstanceId), b.addBucket(D.tileID, j, this.crossTileIDs) && (M = !0), V[j.bucketInstanceId] = !0);
}
return b.removeStaleBuckets(V) && (M = !0), M;
}
pruneUnusedLayers(l) {
const m = {};
l.forEach((v) => {
m[v] = !0;
});
for (const v in this.layerIndexes)
m[v] || delete this.layerIndexes[v];
}
}
const e1 = (S, l) => a.t(S, l && l.filter((m) => m.identifier !== "source.canvas")), Ho = a.aw();
class ma extends a.E {
constructor(l, m = {}) {
super(), this._rtlPluginLoaded = () => {
for (const v in this.sourceCaches) {
const b = this.sourceCaches[v].getSource().type;
b !== "vector" && b !== "geojson" || this.sourceCaches[v].reload();
}
}, this.map = l, this.dispatcher = new de(me(), l._getMapId()), this.dispatcher.registerMessageHandler("GG", (v, b) => this.getGlyphs(v, b)), this.dispatcher.registerMessageHandler("GI", (v, b) => this.getImages(v, b)), this.imageManager = new It(), this.imageManager.setEventedParent(this), this.glyphManager = new Ve(l._requestManager, m.localIdeographFontFamily), this.lineAtlas = new He(256, 512), this.crossTileSymbolIndex = new b2(), this._spritesImagesIds = {}, this._layers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new a.ax(), this._loaded = !1, this._availableImages = [], this._resetUpdates(), this.dispatcher.broadcast("SR", a.ay()), Hi().on(ye, this._rtlPluginLoaded), this.on("data", (v) => {
if (v.dataType !== "source" || v.sourceDataType !== "metadata")
return;
const b = this.sourceCaches[v.sourceId];
if (!b)
return;
const M = b.getSource();
if (M && M.vectorLayerIds)
for (const V in this._layers) {
const D = this._layers[V];
D.source === M.id && this._validateLayer(D);
}
});
}
loadURL(l, m = {}, v) {
this.fire(new a.k("dataloading", { dataType: "style" })), m.validate = typeof m.validate != "boolean" || m.validate;
const b = this.map._requestManager.transformRequest(l, "Style");
this._loadStyleRequest = new AbortController();
const M = this._loadStyleRequest;
a.h(b, this._loadStyleRequest).then((V) => {
this._loadStyleRequest = null, this._load(V.data, m, v);
}).catch((V) => {
this._loadStyleRequest = null, V && !M.signal.aborted && this.fire(new a.j(V));
});
}
loadJSON(l, m = {}, v) {
this.fire(new a.k("dataloading", { dataType: "style" })), this._frameRequest = new AbortController(), f.frameAsync(this._frameRequest).then(() => {
this._frameRequest = null, m.validate = m.validate !== !1, this._load(l, m, v);
}).catch(() => {
});
}
loadEmpty() {
this.fire(new a.k("dataloading", { dataType: "style" })), this._load(Ho, { validate: !1 });
}
_load(l, m, v) {
var b;
const M = m.transformStyle ? m.transformStyle(v, l) : l;
if (!m.validate || !e1(this, a.u(M))) {
this._loaded = !0, this.stylesheet = M;
for (const V in M.sources)
this.addSource(V, M.sources[V], { validate: !1 });
M.sprite ? this._loadSprite(M.sprite) : this.imageManager.setLoaded(!0), this.glyphManager.setURL(M.glyphs), this._createLayers(), this.light = new ie(this.stylesheet.light), this.sky = new Ke(this.stylesheet.sky), this.map.setTerrain((b = this.stylesheet.terrain) !== null && b !== void 0 ? b : null), this.fire(new a.k("data", { dataType: "style" })), this.fire(new a.k("style.load"));
}
}
_createLayers() {
const l = a.az(this.stylesheet.layers);
this.dispatcher.broadcast("SL", l), this._order = l.map((m) => m.id), this._layers = {}, this._serializedLayers = null;
for (const m of l) {
const v = a.aA(m);
v.setEventedParent(this, { layer: { id: m.id } }), this._layers[m.id] = v;
}
}
_loadSprite(l, m = !1, v = void 0) {
let b;
this.imageManager.setLoaded(!1), this._spriteRequest = new AbortController(), function(M, V, D, j) {
return a._(this, void 0, void 0, function* () {
const Z = nt(M), Y = D > 1 ? "@2x" : "", J = {}, lt = {};
for (const { id: ft, url: Qt } of Z) {
const wt = V.transformRequest(ct(Qt, Y, ".json"), "SpriteJSON");
J[ft] = a.h(wt, j);
const Mt = V.transformRequest(ct(Qt, Y, ".png"), "SpriteImage");
lt[ft] = k.getImage(Mt, j);
}
return yield Promise.all([...Object.values(J), ...Object.values(lt)]), function(ft, Qt) {
return a._(this, void 0, void 0, function* () {
const wt = {};
for (const Mt in ft) {
wt[Mt] = {};
const Ht = f.getImageCanvasContext((yield Qt[Mt]).data), Ot = (yield ft[Mt]).data;
for (const bt in Ot) {
const { width: Nt, height: Dt, x: Wt, y: he, sdf: we, pixelRatio: De, stretchX: tr, stretchY: Oe, content: Ae, textFitWidth: ur, textFitHeight: Nr } = Ot[bt];
wt[Mt][bt] = { data: null, pixelRatio: De, sdf: we, stretchX: tr, stretchY: Oe, content: Ae, textFitWidth: ur, textFitHeight: Nr, spriteData: { width: Nt, height: Dt, x: Wt, y: he, context: Ht } };
}
}
return wt;
});
}(J, lt);
});
}(l, this.map._requestManager, this.map.getPixelRatio(), this._spriteRequest).then((M) => {
if (this._spriteRequest = null, M)
for (const V in M) {
this._spritesImagesIds[V] = [];
const D = this._spritesImagesIds[V] ? this._spritesImagesIds[V].filter((j) => !(j in M)) : [];
for (const j of D)
this.imageManager.removeImage(j), this._changedImages[j] = !0;
for (const j in M[V]) {
const Z = V === "default" ? j : `${V}:${j}`;
this._spritesImagesIds[V].push(Z), Z in this.imageManager.images ? this.imageManager.updateImage(Z, M[V][j], !1) : this.imageManager.addImage(Z, M[V][j]), m && (this._changedImages[Z] = !0);
}
}
}).catch((M) => {
this._spriteRequest = null, b = M, this.fire(new a.j(b));
}).finally(() => {
this.imageManager.setLoaded(!0), this._availableImages = this.imageManager.listImages(), m && (this._changed = !0), this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" })), v && v(b);
});
}
_unloadSprite() {
for (const l of Object.values(this._spritesImagesIds).flat())
this.imageManager.removeImage(l), this._changedImages[l] = !0;
this._spritesImagesIds = {}, this._availableImages = this.imageManager.listImages(), this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
}
_validateLayer(l) {
const m = this.sourceCaches[l.source];
if (!m)
return;
const v = l.sourceLayer;
if (!v)
return;
const b = m.getSource();
(b.type === "geojson" || b.vectorLayerIds && b.vectorLayerIds.indexOf(v) === -1) && this.fire(new a.j(new Error(`Source layer "${v}" does not exist on source "${b.id}" as specified by style layer "${l.id}".`)));
}
loaded() {
if (!this._loaded || Object.keys(this._updatedSources).length)
return !1;
for (const l in this.sourceCaches)
if (!this.sourceCaches[l].loaded())
return !1;
return !!this.imageManager.isLoaded();
}
_serializeByIds(l, m = !1) {
const v = this._serializedAllLayers();
if (!l || l.length === 0)
return Object.values(m ? a.aB(v) : v);
const b = [];
for (const M of l)
if (v[M]) {
const V = m ? a.aB(v[M]) : v[M];
b.push(V);
}
return b;
}
_serializedAllLayers() {
let l = this._serializedLayers;
if (l)
return l;
l = this._serializedLayers = {};
const m = Object.keys(this._layers);
for (const v of m) {
const b = this._layers[v];
b.type !== "custom" && (l[v] = b.serialize());
}
return l;
}
hasTransitions() {
if (this.light && this.light.hasTransition() || this.sky && this.sky.hasTransition())
return !0;
for (const l in this.sourceCaches)
if (this.sourceCaches[l].hasTransition())
return !0;
for (const l in this._layers)
if (this._layers[l].hasTransition())
return !0;
return !1;
}
_checkLoaded() {
if (!this._loaded)
throw new Error("Style is not done loading.");
}
update(l) {
if (!this._loaded)
return;
const m = this._changed;
if (m) {
const b = Object.keys(this._updatedLayers), M = Object.keys(this._removedLayers);
(b.length || M.length) && this._updateWorkerLayers(b, M);
for (const V in this._updatedSources) {
const D = this._updatedSources[V];
if (D === "reload")
this._reloadSource(V);
else {
if (D !== "clear")
throw new Error(`Invalid action ${D}`);
this._clearSource(V);
}
}
this._updateTilesForChangedImages(), this._updateTilesForChangedGlyphs();
for (const V in this._updatedPaintProps)
this._layers[V].updateTransitions(l);
this.light.updateTransitions(l), this.sky.updateTransitions(l), this._resetUpdates();
}
const v = {};
for (const b in this.sourceCaches) {
const M = this.sourceCaches[b];
v[b] = M.used, M.used = !1;
}
for (const b of this._order) {
const M = this._layers[b];
M.recalculate(l, this._availableImages), !M.isHidden(l.zoom) && M.source && (this.sourceCaches[M.source].used = !0);
}
for (const b in v) {
const M = this.sourceCaches[b];
!!v[b] != !!M.used && M.fire(new a.k("data", { sourceDataType: "visibility", dataType: "source", sourceId: b }));
}
this.light.recalculate(l), this.sky.recalculate(l), this.z = l.zoom, m && this.fire(new a.k("data", { dataType: "style" }));
}
_updateTilesForChangedImages() {
const l = Object.keys(this._changedImages);
if (l.length) {
for (const m in this.sourceCaches)
this.sourceCaches[m].reloadTilesForDependencies(["icons", "patterns"], l);
this._changedImages = {};
}
}
_updateTilesForChangedGlyphs() {
if (this._glyphsDidChange) {
for (const l in this.sourceCaches)
this.sourceCaches[l].reloadTilesForDependencies(["glyphs"], [""]);
this._glyphsDidChange = !1;
}
}
_updateWorkerLayers(l, m) {
this.dispatcher.broadcast("UL", { layers: this._serializeByIds(l, !1), removedIds: m });
}
_resetUpdates() {
this._changed = !1, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}, this._glyphsDidChange = !1;
}
setState(l, m = {}) {
var v;
this._checkLoaded();
const b = this.serialize();
if (l = m.transformStyle ? m.transformStyle(b, l) : l, ((v = m.validate) === null || v === void 0 || v) && e1(this, a.u(l)))
return !1;
(l = a.aB(l)).layers = a.az(l.layers);
const M = a.aC(b, l), V = this._getOperationsToPerform(M);
if (V.unimplemented.length > 0)
throw new Error(`Unimplemented: ${V.unimplemented.join(", ")}.`);
if (V.operations.length === 0)
return !1;
for (const D of V.operations)
D();
return this.stylesheet = l, this._serializedLayers = null, !0;
}
_getOperationsToPerform(l) {
const m = [], v = [];
for (const b of l)
switch (b.command) {
case "setCenter":
case "setZoom":
case "setBearing":
case "setPitch":
continue;
case "addLayer":
m.push(() => this.addLayer.apply(this, b.args));
break;
case "removeLayer":
m.push(() => this.removeLayer.apply(this, b.args));
break;
case "setPaintProperty":
m.push(() => this.setPaintProperty.apply(this, b.args));
break;
case "setLayoutProperty":
m.push(() => this.setLayoutProperty.apply(this, b.args));
break;
case "setFilter":
m.push(() => this.setFilter.apply(this, b.args));
break;
case "addSource":
m.push(() => this.addSource.apply(this, b.args));
break;
case "removeSource":
m.push(() => this.removeSource.apply(this, b.args));
break;
case "setLayerZoomRange":
m.push(() => this.setLayerZoomRange.apply(this, b.args));
break;
case "setLight":
m.push(() => this.setLight.apply(this, b.args));
break;
case "setGeoJSONSourceData":
m.push(() => this.setGeoJSONSourceData.apply(this, b.args));
break;
case "setGlyphs":
m.push(() => this.setGlyphs.apply(this, b.args));
break;
case "setSprite":
m.push(() => this.setSprite.apply(this, b.args));
break;
case "setSky":
m.push(() => this.setSky.apply(this, b.args));
break;
case "setTerrain":
m.push(() => this.map.setTerrain.apply(this, b.args));
break;
case "setTransition":
m.push(() => {
});
break;
default:
v.push(b.command);
}
return { operations: m, unimplemented: v };
}
addImage(l, m) {
if (this.getImage(l))
return this.fire(new a.j(new Error(`An image named "${l}" already exists.`)));
this.imageManager.addImage(l, m), this._afterImageUpdated(l);
}
updateImage(l, m) {
this.imageManager.updateImage(l, m);
}
getImage(l) {
return this.imageManager.getImage(l);
}
removeImage(l) {
if (!this.getImage(l))
return this.fire(new a.j(new Error(`An image named "${l}" does not exist.`)));
this.imageManager.removeImage(l), this._afterImageUpdated(l);
}
_afterImageUpdated(l) {
this._availableImages = this.imageManager.listImages(), this._changedImages[l] = !0, this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
}
listImages() {
return this._checkLoaded(), this.imageManager.listImages();
}
addSource(l, m, v = {}) {
if (this._checkLoaded(), this.sourceCaches[l] !== void 0)
throw new Error(`Source "${l}" already exists.`);
if (!m.type)
throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);
if (["vector", "raster", "geojson", "video", "image"].indexOf(m.type) >= 0 && this._validate(a.u.source, `sources.${l}`, m, null, v))
return;
this.map && this.map._collectResourceTiming && (m.collectResourceTiming = !0);
const b = this.sourceCaches[l] = new _r(l, m, this.dispatcher);
b.style = this, b.setEventedParent(this, () => ({ isSourceLoaded: b.loaded(), source: b.serialize(), sourceId: l })), b.onAdd(this.map), this._changed = !0;
}
removeSource(l) {
if (this._checkLoaded(), this.sourceCaches[l] === void 0)
throw new Error("There is no source with this ID");
for (const v in this._layers)
if (this._layers[v].source === l)
return this.fire(new a.j(new Error(`Source "${l}" cannot be removed while layer "${v}" is using it.`)));
const m = this.sourceCaches[l];
delete this.sourceCaches[l], delete this._updatedSources[l], m.fire(new a.k("data", { sourceDataType: "metadata", dataType: "source", sourceId: l })), m.setEventedParent(null), m.onRemove(this.map), this._changed = !0;
}
setGeoJSONSourceData(l, m) {
if (this._checkLoaded(), this.sourceCaches[l] === void 0)
throw new Error(`There is no source with this ID=${l}`);
const v = this.sourceCaches[l].getSource();
if (v.type !== "geojson")
throw new Error(`geojsonSource.type is ${v.type}, which is !== 'geojson`);
v.setData(m), this._changed = !0;
}
getSource(l) {
return this.sourceCaches[l] && this.sourceCaches[l].getSource();
}
addLayer(l, m, v = {}) {
this._checkLoaded();
const b = l.id;
if (this.getLayer(b))
return void this.fire(new a.j(new Error(`Layer "${b}" already exists on this map.`)));
let M;
if (l.type === "custom") {
if (e1(this, a.aD(l)))
return;
M = a.aA(l);
} else {
if ("source" in l && typeof l.source == "object" && (this.addSource(b, l.source), l = a.aB(l), l = a.e(l, { source: b })), this._validate(a.u.layer, `layers.${b}`, l, { arrayIndex: -1 }, v))
return;
M = a.aA(l), this._validateLayer(M), M.setEventedParent(this, { layer: { id: b } });
}
const V = m ? this._order.indexOf(m) : this._order.length;
if (m && V === -1)
this.fire(new a.j(new Error(`Cannot add layer "${b}" before non-existing layer "${m}".`)));
else {
if (this._order.splice(V, 0, b), this._layerOrderChanged = !0, this._layers[b] = M, this._removedLayers[b] && M.source && M.type !== "custom") {
const D = this._removedLayers[b];
delete this._removedLayers[b], D.type !== M.type ? this._updatedSources[M.source] = "clear" : (this._updatedSources[M.source] = "reload", this.sourceCaches[M.source].pause());
}
this._updateLayer(M), M.onAdd && M.onAdd(this.map);
}
}
moveLayer(l, m) {
if (this._checkLoaded(), this._changed = !0, !this._layers[l])
return void this.fire(new a.j(new Error(`The layer '${l}' does not exist in the map's style and cannot be moved.`)));
if (l === m)
return;
const v = this._order.indexOf(l);
this._order.splice(v, 1);
const b = m ? this._order.indexOf(m) : this._order.length;
m && b === -1 ? this.fire(new a.j(new Error(`Cannot move layer "${l}" before non-existing layer "${m}".`))) : (this._order.splice(b, 0, l), this._layerOrderChanged = !0);
}
removeLayer(l) {
this._checkLoaded();
const m = this._layers[l];
if (!m)
return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${l}".`)));
m.setEventedParent(null);
const v = this._order.indexOf(l);
this._order.splice(v, 1), this._layerOrderChanged = !0, this._changed = !0, this._removedLayers[l] = m, delete this._layers[l], this._serializedLayers && delete this._serializedLayers[l], delete this._updatedLayers[l], delete this._updatedPaintProps[l], m.onRemove && m.onRemove(this.map);
}
getLayer(l) {
return this._layers[l];
}
getLayersOrder() {
return [...this._order];
}
hasLayer(l) {
return l in this._layers;
}
setLayerZoomRange(l, m, v) {
this._checkLoaded();
const b = this.getLayer(l);
b ? b.minzoom === m && b.maxzoom === v || (m != null && (b.minzoom = m), v != null && (b.maxzoom = v), this._updateLayer(b)) : this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${l}".`)));
}
setFilter(l, m, v = {}) {
this._checkLoaded();
const b = this.getLayer(l);
if (b) {
if (!a.aE(b.filter, m))
return m == null ? (b.filter = void 0, void this._updateLayer(b)) : void (this._validate(a.u.filter, `layers.${b.id}.filter`, m, null, v) || (b.filter = a.aB(m), this._updateLayer(b)));
} else
this.fire(new a.j(new Error(`Cannot filter non-existing layer "${l}".`)));
}
getFilter(l) {
return a.aB(this.getLayer(l).filter);
}
setLayoutProperty(l, m, v, b = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getLayoutProperty(m), v) || (M.setLayoutProperty(m, v, b), this._updateLayer(M)) : this.fire(new a.j(new Error(`Cannot style non-existing layer "${l}".`)));
}
getLayoutProperty(l, m) {
const v = this.getLayer(l);
if (v)
return v.getLayoutProperty(m);
this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${l}".`)));
}
setPaintProperty(l, m, v, b = {}) {
this._checkLoaded();
const M = this.getLayer(l);
M ? a.aE(M.getPaintProperty(m), v) || (M.setPaintProperty(m, v, b) && this._updateLayer(M), this._changed = !0, this._updatedPaintProps[l] = !0, this._serializedLayers = null) : this.fire(new a.j(new Error(`Cannot style non-existing layer "${l}".`)));
}
getPaintProperty(l, m) {
return this.getLayer(l).getPaintProperty(m);
}
setFeatureState(l, m) {
this._checkLoaded();
const v = l.source, b = l.sourceLayer, M = this.sourceCaches[v];
if (M === void 0)
return void this.fire(new a.j(new Error(`The source '${v}' does not exist in the map's style.`)));
const V = M.getSource().type;
V === "geojson" && b ? this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : V !== "vector" || b ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), M.setFeatureState(b, l.id, m)) : this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
}
removeFeatureState(l, m) {
this._checkLoaded();
const v = l.source, b = this.sourceCaches[v];
if (b === void 0)
return void this.fire(new a.j(new Error(`The source '${v}' does not exist in the map's style.`)));
const M = b.getSource().type, V = M === "vector" ? l.sourceLayer : void 0;
M !== "vector" || V ? m && typeof l.id != "string" && typeof l.id != "number" ? this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))) : b.removeFeatureState(V, l.id, m) : this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
}
getFeatureState(l) {
this._checkLoaded();
const m = l.source, v = l.sourceLayer, b = this.sourceCaches[m];
if (b !== void 0)
return b.getSource().type !== "vector" || v ? (l.id === void 0 && this.fire(new a.j(new Error("The feature id parameter must be provided."))), b.getFeatureState(v, l.id)) : void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));
this.fire(new a.j(new Error(`The source '${m}' does not exist in the map's style.`)));
}
getTransition() {
return a.e({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition);
}
serialize() {
if (!this._loaded)
return;
const l = a.aF(this.sourceCaches, (M) => M.serialize()), m = this._serializeByIds(this._order, !0), v = this.map.getTerrain() || void 0, b = this.stylesheet;
return a.aG({ version: b.version, name: b.name, metadata: b.metadata, light: b.light, sky: b.sky, center: b.center, zoom: b.zoom, bearing: b.bearing, pitch: b.pitch, sprite: b.sprite, glyphs: b.glyphs, transition: b.transition, sources: l, layers: m, terrain: v }, (M) => M !== void 0);
}
_updateLayer(l) {
this._updatedLayers[l.id] = !0, l.source && !this._updatedSources[l.source] && this.sourceCaches[l.source].getSource().type !== "raster" && (this._updatedSources[l.source] = "reload", this.sourceCaches[l.source].pause()), this._serializedLayers = null, this._changed = !0;
}
_flattenAndSortRenderedFeatures(l) {
const m = (V) => this._layers[V].type === "fill-extrusion", v = {}, b = [];
for (let V = this._order.length - 1; V >= 0; V--) {
const D = this._order[V];
if (m(D)) {
v[D] = V;
for (const j of l) {
const Z = j[D];
if (Z)
for (const Y of Z)
b.push(Y);
}
}
}
b.sort((V, D) => D.intersectionZ - V.intersectionZ);
const M = [];
for (let V = this._order.length - 1; V >= 0; V--) {
const D = this._order[V];
if (m(D))
for (let j = b.length - 1; j >= 0; j--) {
const Z = b[j].feature;
if (v[Z.layer.id] < V)
break;
M.push(Z), b.pop();
}
else
for (const j of l) {
const Z = j[D];
if (Z)
for (const Y of Z)
M.push(Y.feature);
}
}
return M;
}
queryRenderedFeatures(l, m, v) {
m && m.filter && this._validate(a.u.filter, "queryRenderedFeatures.filter", m.filter, null, m);
const b = {};
if (m && m.layers) {
if (!Array.isArray(m.layers))
return this.fire(new a.j(new Error("parameters.layers must be an Array."))), [];
for (const D of m.layers) {
const j = this._layers[D];
if (!j)
return this.fire(new a.j(new Error(`The layer '${D}' does not exist in the map's style and cannot be queried for features.`))), [];
b[j.source] = !0;
}
}
const M = [];
m.availableImages = this._availableImages;
const V = this._serializedAllLayers();
for (const D in this.sourceCaches)
m.layers && !b[D] || M.push(qe(this.sourceCaches[D], this._layers, V, l, m, v));
return this.placement && M.push(function(D, j, Z, Y, J, lt, ft) {
const Qt = {}, wt = lt.queryRenderedSymbols(Y), Mt = [];
for (const Ht of Object.keys(wt).map(Number))
Mt.push(ft[Ht]);
Mt.sort($e);
for (const Ht of Mt) {
const Ot = Ht.featureIndex.lookupSymbolFeatures(wt[Ht.bucketInstanceId], j, Ht.bucketIndex, Ht.sourceLayerIndex, J.filter, J.layers, J.availableImages, D);
for (const bt in Ot) {
const Nt = Qt[bt] = Qt[bt] || [], Dt = Ot[bt];
Dt.sort((Wt, he) => {
const we = Ht.featureSortOrder;
if (we) {
const De = we.indexOf(Wt.featureIndex);
return we.indexOf(he.featureIndex) - De;
}
return he.featureIndex - Wt.featureIndex;
});
for (const Wt of Dt)
Nt.push(Wt);
}
}
for (const Ht in Qt)
Qt[Ht].forEach((Ot) => {
const bt = Ot.feature, Nt = Z[D[Ht].source].getFeatureState(bt.layer["source-layer"], bt.id);
bt.source = bt.layer.source, bt.layer["source-layer"] && (bt.sourceLayer = bt.layer["source-layer"]), bt.state = Nt;
});
return Qt;
}(this._layers, V, this.sourceCaches, l, m, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(M);
}
querySourceFeatures(l, m) {
m && m.filter && this._validate(a.u.filter, "querySourceFeatures.filter", m.filter, null, m);
const v = this.sourceCaches[l];
return v ? function(b, M) {
const V = b.getRenderableIds().map((Z) => b.getTileByID(Z)), D = [], j = {};
for (let Z = 0; Z < V.length; Z++) {
const Y = V[Z], J = Y.tileID.canonical.key;
j[J] || (j[J] = !0, Y.querySourceFeatures(D, M));
}
return D;
}(v, m) : [];
}
getLight() {
return this.light.getLight();
}
setLight(l, m = {}) {
this._checkLoaded();
const v = this.light.getLight();
let b = !1;
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = !0;
break;
}
if (!b)
return;
const M = { now: f.now(), transition: a.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
this.light.setLight(l, m), this.light.updateTransitions(M);
}
getSky() {
var l;
return (l = this.stylesheet) === null || l === void 0 ? void 0 : l.sky;
}
setSky(l, m = {}) {
const v = this.getSky();
let b = !1;
if (!l && !v)
return;
if (l && !v)
b = !0;
else if (!l && v)
b = !0;
else
for (const V in l)
if (!a.aE(l[V], v[V])) {
b = !0;
break;
}
if (!b)
return;
const M = { now: f.now(), transition: a.e({ duration: 300, delay: 0 }, this.stylesheet.transition) };
this.stylesheet.sky = l, this.sky.setSky(l, m), this.sky.updateTransitions(M);
}
_validate(l, m, v, b, M = {}) {
return (!M || M.validate !== !1) && e1(this, l.call(a.u, a.e({ key: m, style: this.serialize(), value: v, styleSpec: a.v }, b)));
}
_remove(l = !0) {
this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._loadStyleRequest && (this._loadStyleRequest.abort(), this._loadStyleRequest = null), this._spriteRequest && (this._spriteRequest.abort(), this._spriteRequest = null), Hi().off(ye, this._rtlPluginLoaded);
for (const m in this._layers)
this._layers[m].setEventedParent(null);
for (const m in this.sourceCaches) {
const v = this.sourceCaches[m];
v.setEventedParent(null), v.onRemove(this.map);
}
this.imageManager.setEventedParent(null), this.setEventedParent(null), l && this.dispatcher.broadcast("RM", void 0), this.dispatcher.remove(l);
}
_clearSource(l) {
this.sourceCaches[l].clearTiles();
}
_reloadSource(l) {
this.sourceCaches[l].resume(), this.sourceCaches[l].reload();
}
_updateSources(l) {
for (const m in this.sourceCaches)
this.sourceCaches[m].update(l, this.map.terrain);
}
_generateCollisionBoxes() {
for (const l in this.sourceCaches)
this._reloadSource(l);
}
_updatePlacement(l, m, v, b, M = !1) {
let V = !1, D = !1;
const j = {};
for (const Z of this._order) {
const Y = this._layers[Z];
if (Y.type !== "symbol")
continue;
if (!j[Y.source]) {
const lt = this.sourceCaches[Y.source];
j[Y.source] = lt.getRenderableIds(!0).map((ft) => lt.getTileByID(ft)).sort((ft, Qt) => Qt.tileID.overscaledZ - ft.tileID.overscaledZ || (ft.tileID.isLessThan(Qt.tileID) ? -1 : 1));
}
const J = this.crossTileSymbolIndex.addLayer(Y, j[Y.source], l.center.lng);
V = V || J;
}
if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order), ((M = M || this._layerOrderChanged || v === 0) || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(f.now(), l.zoom)) && (this.pauseablePlacement = new Ui(l, this.map.terrain, this._order, M, m, v, b, this.placement), this._layerOrderChanged = !1), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, j), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(f.now()), D = !0), V && this.pauseablePlacement.placement.setStale()), D || V)
for (const Z of this._order) {
const Y = this._layers[Z];
Y.type === "symbol" && this.placement.updateLayerOpacities(Y, j[Y.source]);
}
return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(f.now());
}
_releaseSymbolFadeTiles() {
for (const l in this.sourceCaches)
this.sourceCaches[l].releaseSymbolFadeTiles();
}
getImages(l, m) {
return a._(this, void 0, void 0, function* () {
const v = yield this.imageManager.getImages(m.icons);
this._updateTilesForChangedImages();
const b = this.sourceCaches[m.source];
return b && b.setDependencies(m.tileID.key, m.type, m.icons), v;
});
}
getGlyphs(l, m) {
return a._(this, void 0, void 0, function* () {
const v = yield this.glyphManager.getGlyphs(m.stacks), b = this.sourceCaches[m.source];
return b && b.setDependencies(m.tileID.key, m.type, [""]), v;
});
}
getGlyphsUrl() {
return this.stylesheet.glyphs || null;
}
setGlyphs(l, m = {}) {
this._checkLoaded(), l && this._validate(a.u.glyphs, "glyphs", l, null, m) || (this._glyphsDidChange = !0, this.stylesheet.glyphs = l, this.glyphManager.entries = {}, this.glyphManager.setURL(l));
}
addSprite(l, m, v = {}, b) {
this._checkLoaded();
const M = [{ id: l, url: m }], V = [...nt(this.stylesheet.sprite), ...M];
this._validate(a.u.sprite, "sprite", V, null, v) || (this.stylesheet.sprite = V, this._loadSprite(M, !0, b));
}
removeSprite(l) {
this._checkLoaded();
const m = nt(this.stylesheet.sprite);
if (m.find((v) => v.id === l)) {
if (this._spritesImagesIds[l])
for (const v of this._spritesImagesIds[l])
this.imageManager.removeImage(v), this._changedImages[v] = !0;
m.splice(m.findIndex((v) => v.id === l), 1), this.stylesheet.sprite = m.length > 0 ? m : void 0, delete this._spritesImagesIds[l], this._availableImages = this.imageManager.listImages(), this._changed = !0, this.dispatcher.broadcast("SI", this._availableImages), this.fire(new a.k("data", { dataType: "style" }));
} else
this.fire(new a.j(new Error(`Sprite "${l}" doesn't exists on this map.`)));
}
getSprite() {
return nt(this.stylesheet.sprite);
}
setSprite(l, m = {}, v) {
this._checkLoaded(), l && this._validate(a.u.sprite, "sprite", l, null, m) || (this.stylesheet.sprite = l, l ? this._loadSprite(l, !0, v) : (this._unloadSprite(), v && v(null)));
}
}
var Xo = a.Y([{ name: "a_pos", type: "Int16", components: 2 }]);
const ho = { prelude: Yr(`#ifdef GL_ES
precision mediump float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
`, `#ifdef GL_ES
precision highp float;
#else
#if !defined(lowp)
#define lowp
#endif
#if !defined(mediump)
#define mediump
#endif
#if !defined(highp)
#define highp
#endif
#endif
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
);}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;}
#ifdef TERRAIN3D
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
#endif
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
#ifdef TERRAIN3D
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
#else
return 1.0;
#endif
}float calculate_visibility(vec4 pos) {
#ifdef TERRAIN3D
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
#else
return 1.0;
#endif
}float ele(vec2 pos) {
#ifdef TERRAIN3D
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
#else
return 0.0;
#endif
}float get_elevation(vec2 pos) {
#ifdef TERRAIN3D
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
#else
return 0.0;
#endif
}`), background: Yr(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), backgroundPattern: Yr(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"), circle: Yr(`varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define highp vec4 stroke_color
#pragma mapbox: define mediump float stroke_width
#pragma mapbox: define lowp float stroke_opacity
void main(void) {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize highp vec4 stroke_color
#pragma mapbox: initialize mediump float stroke_width
#pragma mapbox: initialize lowp float stroke_opacity
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`), clippingMask: Yr("void main() {gl_FragColor=vec4(1.0);}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), heatmap: Yr(`uniform highp float u_intensity;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#define GAUSS_COEF 0.3989422804014327
void main() {
#pragma mapbox: initialize highp float weight
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius
const highp float ZERO=1.0/255.0/16.0;
#define GAUSS_COEF 0.3989422804014327
void main(void) {
#pragma mapbox: initialize highp float weight
#pragma mapbox: initialize mediump float radius
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`), heatmapTexture: Yr(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(0.0);
#endif
}`, "uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"), collisionBox: Yr("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}", "attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}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: Yr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}", "attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"), debug: Yr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}", "attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"), fill: Yr(`#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor=color*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);}`), fillOutline: Yr(`varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 outline_color
#pragma mapbox: initialize lowp float opacity
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`), fillOutlinePattern: Yr(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`), fillPattern: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`), fillExtrusion: Yr(`varying vec4 v_color;void main() {gl_FragColor=v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec4 v_color;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height
#pragma mapbox: define highp vec4 color
void main() {
#pragma mapbox: initialize highp float base
#pragma mapbox: initialize highp float height
#pragma mapbox: initialize highp vec4 color
vec3 normal=a_normal_ed.xyz;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`), fillExtrusionPattern: Yr(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
#ifdef TERRAIN3D
attribute vec2 a_centroid;
#endif
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
#ifdef TERRAIN3D
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
#else
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
#endif
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
? a_pos
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`), hillshadePrepare: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"), hillshade: Yr(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
#define PI 3.141592653589793
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"), line: Yr(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
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);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`), lineGradient: Yr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_width2=vec2(outset,inset);}`), linePattern: Yr(`#ifdef GL_ES
precision highp float;
#endif
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
#pragma mapbox: define lowp float pixel_ratio_from
#pragma mapbox: define lowp float pixel_ratio_to
void main() {
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
#pragma mapbox: initialize mediump vec4 pattern_from
#pragma mapbox: initialize mediump vec4 pattern_to
#pragma mapbox: initialize lowp float pixel_ratio_from
#pragma mapbox: initialize lowp float pixel_ratio_to
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`), lineSDF: Yr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `
#define scale 0.015873016
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
#pragma mapbox: define mediump float gapwidth
#pragma mapbox: define lowp float offset
#pragma mapbox: define mediump float width
#pragma mapbox: define lowp float floorwidth
void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize mediump float gapwidth
#pragma mapbox: initialize lowp float offset
#pragma mapbox: initialize mediump float width
#pragma mapbox: initialize lowp float floorwidth
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
#ifdef TERRAIN3D
v_gamma_scale=1.0;
#else
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
#endif
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`), raster: Yr(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, "uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"), symbolIcon: Yr(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define lowp float opacity
void main() {
#pragma mapbox: initialize lowp float opacity
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`), symbolSDF: Yr(`#define SDF_PX 8.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`), symbolTextAndIcon: Yr(`#define SDF_PX 8.0
#define SDF 1.0
#define ICON 0.0
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor=vec4(1.0);
#endif
}`, `attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}
#pragma mapbox: define highp vec4 fill_color
#pragma mapbox: define highp vec4 halo_color
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp float halo_width
#pragma mapbox: define lowp float halo_blur
void main() {
#pragma mapbox: initialize highp vec4 fill_color
#pragma mapbox: initialize highp vec4 halo_color
#pragma mapbox: initialize lowp float opacity
#pragma mapbox: initialize lowp float halo_width
#pragma mapbox: initialize lowp float halo_blur
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
camera_to_anchor_distance/u_camera_to_center_distance :
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`), terrain: Yr("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;varying vec2 v_texture_pos;varying 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=texture2D(u_texture,v_texture_pos);if (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);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"), terrainDepth: Yr("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"), terrainCoords: Yr("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}", "attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"), sky: Yr("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}", "attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}") };
function Yr(S, l) {
const m = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, v = l.match(/attribute ([\w]+) ([\w]+)/g), b = S.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), M = l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g), V = M ? M.concat(b) : b, D = {};
return { fragmentSource: S = S.replace(m, (j, Z, Y, J, lt) => (D[lt] = !0, Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
varying ${Y} ${J} ${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : `
#ifdef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = u_${lt};
#endif
`)), vertexSource: l = l.replace(m, (j, Z, Y, J, lt) => {
const ft = J === "float" ? "vec2" : "vec4", Qt = lt.match(/color/) ? "color" : ft;
return D[lt] ? Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
uniform lowp float u_${lt}_t;
attribute ${Y} ${ft} a_${lt};
varying ${Y} ${J} ${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${lt}
${lt} = a_${lt};
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : `
#ifndef HAS_UNIFORM_u_${lt}
${lt} = unpack_mix_${Qt}(a_${lt}, u_${lt}_t);
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : Z === "define" ? `
#ifndef HAS_UNIFORM_u_${lt}
uniform lowp float u_${lt}_t;
attribute ${Y} ${ft} a_${lt};
#else
uniform ${Y} ${J} u_${lt};
#endif
` : Qt === "vec4" ? `
#ifndef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = a_${lt};
#else
${Y} ${J} ${lt} = u_${lt};
#endif
` : `
#ifndef HAS_UNIFORM_u_${lt}
${Y} ${J} ${lt} = unpack_mix_${Qt}(a_${lt}, u_${lt}_t);
#else
${Y} ${J} ${lt} = u_${lt};
#endif
`;
}), staticAttributes: v, staticUniforms: V };
}
class I {
constructor() {
this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null;
}
bind(l, m, v, b, M, V, D, j, Z) {
this.context = l;
let Y = this.boundPaintVertexBuffers.length !== b.length;
for (let J = 0; !Y && J < b.length; J++)
this.boundPaintVertexBuffers[J] !== b[J] && (Y = !0);
!this.vao || this.boundProgram !== m || this.boundLayoutVertexBuffer !== v || Y || this.boundIndexBuffer !== M || this.boundVertexOffset !== V || this.boundDynamicVertexBuffer !== D || this.boundDynamicVertexBuffer2 !== j || this.boundDynamicVertexBuffer3 !== Z ? this.freshBind(m, v, b, M, V, D, j, Z) : (l.bindVertexArray.set(this.vao), D && D.bind(), M && M.dynamicDraw && M.bind(), j && j.bind(), Z && Z.bind());
}
freshBind(l, m, v, b, M, V, D, j) {
const Z = l.numAttributes, Y = this.context, J = Y.gl;
this.vao && this.destroy(), this.vao = Y.createVertexArray(), Y.bindVertexArray.set(this.vao), this.boundProgram = l, this.boundLayoutVertexBuffer = m, this.boundPaintVertexBuffers = v, this.boundIndexBuffer = b, this.boundVertexOffset = M, this.boundDynamicVertexBuffer = V, this.boundDynamicVertexBuffer2 = D, this.boundDynamicVertexBuffer3 = j, m.enableAttributes(J, l);
for (const lt of v)
lt.enableAttributes(J, l);
V && V.enableAttributes(J, l), D && D.enableAttributes(J, l), j && j.enableAttributes(J, l), m.bind(), m.setVertexAttribPointers(J, l, M);
for (const lt of v)
lt.bind(), lt.setVertexAttribPointers(J, l, M);
V && (V.bind(), V.setVertexAttribPointers(J, l, M)), b && b.bind(), D && (D.bind(), D.setVertexAttribPointers(J, l, M)), j && (j.bind(), j.setVertexAttribPointers(J, l, M)), Y.currentNumAttributes = Z;
}
destroy() {
this.vao && (this.context.deleteVertexArray(this.vao), this.vao = null);
}
}
const G = (S, l, m, v, b) => ({ u_matrix: S, u_texture: 0, u_ele_delta: l, u_fog_matrix: m, u_fog_color: v ? v.properties.get("fog-color") : a.aM.white, u_fog_ground_blend: v ? v.properties.get("fog-ground-blend") : 1, u_fog_ground_blend_opacity: v ? v.calculateFogBlendOpacity(b) : 0, u_horizon_color: v ? v.properties.get("horizon-color") : a.aM.white, u_horizon_fog_blend: v ? v.properties.get("horizon-fog-blend") : 1 });
function B(S) {
const l = [];
for (let m = 0; m < S.length; m++) {
if (S[m] === null)
continue;
const v = S[m].split(" ");
l.push(v.pop());
}
return l;
}
class q {
constructor(l, m, v, b, M, V) {
const D = l.gl;
this.program = D.createProgram();
const j = B(m.staticAttributes), Z = v ? v.getBinderAttributes() : [], Y = j.concat(Z), J = ho.prelude.staticUniforms ? B(ho.prelude.staticUniforms) : [], lt = m.staticUniforms ? B(m.staticUniforms) : [], ft = v ? v.getBinderUniforms() : [], Qt = J.concat(lt).concat(ft), wt = [];
for (const Wt of Qt)
wt.indexOf(Wt) < 0 && wt.push(Wt);
const Mt = v ? v.defines() : [];
M && Mt.push("#define OVERDRAW_INSPECTOR;"), V && Mt.push("#define TERRAIN3D;");
const Ht = Mt.concat(ho.prelude.fragmentSource, m.fragmentSource).join(`
`), Ot = Mt.concat(ho.prelude.vertexSource, m.vertexSource).join(`
`), bt = D.createShader(D.FRAGMENT_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(bt, Ht), D.compileShader(bt), !D.getShaderParameter(bt, D.COMPILE_STATUS))
throw new Error(`Could not compile fragment shader: ${D.getShaderInfoLog(bt)}`);
D.attachShader(this.program, bt);
const Nt = D.createShader(D.VERTEX_SHADER);
if (D.isContextLost())
return void (this.failedToCreate = !0);
if (D.shaderSource(Nt, Ot), D.compileShader(Nt), !D.getShaderParameter(Nt, D.COMPILE_STATUS))
throw new Error(`Could not compile vertex shader: ${D.getShaderInfoLog(Nt)}`);
D.attachShader(this.program, Nt), this.attributes = {};
const Dt = {};
this.numAttributes = Y.length;
for (let Wt = 0; Wt < this.numAttributes; Wt++)
Y[Wt] && (D.bindAttribLocation(this.program, Wt, Y[Wt]), this.attributes[Y[Wt]] = Wt);
if (D.linkProgram(this.program), !D.getProgramParameter(this.program, D.LINK_STATUS))
throw new Error(`Program failed to link: ${D.getProgramInfoLog(this.program)}`);
D.deleteShader(Nt), D.deleteShader(bt);
for (let Wt = 0; Wt < wt.length; Wt++) {
const he = wt[Wt];
if (he && !Dt[he]) {
const we = D.getUniformLocation(this.program, he);
we && (Dt[he] = we);
}
}
this.fixedUniforms = b(l, Dt), this.terrainUniforms = ((Wt, he) => ({ u_depth: new a.aH(Wt, he.u_depth), u_terrain: new a.aH(Wt, he.u_terrain), u_terrain_dim: new a.aI(Wt, he.u_terrain_dim), u_terrain_matrix: new a.aJ(Wt, he.u_terrain_matrix), u_terrain_unpack: new a.aK(Wt, he.u_terrain_unpack), u_terrain_exaggeration: new a.aI(Wt, he.u_terrain_exaggeration) }))(l, Dt), this.binderUniforms = v ? v.getUniforms(l, Dt) : [];
}
draw(l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt, wt, Mt, Ht, Ot) {
const bt = l.gl;
if (this.failedToCreate)
return;
if (l.program.set(this.program), l.setDepthMode(v), l.setStencilMode(b), l.setColorMode(M), l.setCullFace(V), j) {
l.activeTexture.set(bt.TEXTURE2), bt.bindTexture(bt.TEXTURE_2D, j.depthTexture), l.activeTexture.set(bt.TEXTURE3), bt.bindTexture(bt.TEXTURE_2D, j.texture);
for (const Dt in this.terrainUniforms)
this.terrainUniforms[Dt].set(j[Dt]);
}
for (const Dt in this.fixedUniforms)
this.fixedUniforms[Dt].set(D[Dt]);
wt && wt.setUniforms(l, this.binderUniforms, ft, { zoom: Qt });
let Nt = 0;
switch (m) {
case bt.LINES:
Nt = 2;
break;
case bt.TRIANGLES:
Nt = 3;
break;
case bt.LINE_STRIP:
Nt = 1;
}
for (const Dt of lt.get()) {
const Wt = Dt.vaos || (Dt.vaos = {});
(Wt[Z] || (Wt[Z] = new I())).bind(l, this, Y, wt ? wt.getPaintVertexBuffers() : [], J, Dt.vertexOffset, Mt, Ht, Ot), bt.drawElements(m, Dt.primitiveLength * Nt, bt.UNSIGNED_SHORT, Dt.primitiveOffset * Nt * 2);
}
}
}
function it(S, l, m) {
const v = 1 / Ar(m, 1, l.transform.tileZoom), b = Math.pow(2, m.tileID.overscaledZ), M = m.tileSize * Math.pow(2, l.transform.tileZoom) / b, V = M * (m.tileID.canonical.x + m.tileID.wrap * b), D = M * m.tileID.canonical.y;
return { u_image: 0, u_texsize: m.imageAtlasTexture.size, u_scale: [v, S.fromScale, S.toScale], u_fade: S.t, u_pixel_coord_upper: [V >> 16, D >> 16], u_pixel_coord_lower: [65535 & V, 65535 & D] };
}
const ht = (S, l, m, v) => {
const b = l.style.light, M = b.properties.get("position"), V = [M.x, M.y, M.z], D = function() {
var Z = new a.A(9);
return a.A != Float32Array && (Z[1] = 0, Z[2] = 0, Z[3] = 0, Z[5] = 0, Z[6] = 0, Z[7] = 0), Z[0] = 1, Z[4] = 1, Z[8] = 1, Z;
}();
b.properties.get("anchor") === "viewport" && function(Z, Y) {
var J = Math.sin(Y), lt = Math.cos(Y);
Z[0] = lt, Z[1] = J, Z[2] = 0, Z[3] = -J, Z[4] = lt, Z[5] = 0, Z[6] = 0, Z[7] = 0, Z[8] = 1;
}(D, -l.transform.angle), function(Z, Y, J) {
var lt = Y[0], ft = Y[1], Qt = Y[2];
Z[0] = lt * J[0] + ft * J[3] + Qt * J[6], Z[1] = lt * J[1] + ft * J[4] + Qt * J[7], Z[2] = lt * J[2] + ft * J[5] + Qt * J[8];
}(V, V, D);
const j = b.properties.get("color");
return { u_matrix: S, u_lightpos: V, u_lightintensity: b.properties.get("intensity"), u_lightcolor: [j.r, j.g, j.b], u_vertical_gradient: +m, u_opacity: v };
}, mt = (S, l, m, v, b, M, V) => a.e(ht(S, l, m, v), it(M, l, V), { u_height_factor: -Math.pow(2, b.overscaledZ) / V.tileSize / 8 }), qt = (S) => ({ u_matrix: S }), le = (S, l, m, v) => a.e(qt(S), it(m, l, v)), ve = (S, l) => ({ u_matrix: S, u_world: l }), Me = (S, l, m, v, b) => a.e(le(S, l, m, v), { u_world: b }), be = (S, l, m, v) => {
const b = S.transform;
let M, V;
if (v.paint.get("circle-pitch-alignment") === "map") {
const D = Ar(m, 1, b.zoom);
M = !0, V = [D, D];
} else
M = !1, V = b.pixelsToGLUnits;
return { u_camera_to_center_distance: b.cameraToCenterDistance, u_scale_with_map: +(v.paint.get("circle-pitch-scale") === "map"), u_matrix: S.translatePosMatrix(l.posMatrix, m, v.paint.get("circle-translate"), v.paint.get("circle-translate-anchor")), u_pitch_with_map: +M, u_device_pixel_ratio: S.pixelRatio, u_extrude_scale: V };
}, fr = (S, l, m) => ({ u_matrix: S, u_inv_matrix: l, u_camera_to_center_distance: m.cameraToCenterDistance, u_viewport_size: [m.width, m.height] }), kn = (S, l, m = 1) => ({ u_matrix: S, u_color: l, u_overlay: 0, u_overlay_scale: m }), xr = (S) => ({ u_matrix: S }), un = (S, l, m, v) => ({ u_matrix: S, u_extrude_scale: Ar(l, 1, m), u_intensity: v }), pe = (S, l, m, v) => {
const b = a.H();
a.aP(b, 0, S.width, S.height, 0, 0, 1);
const M = S.context.gl;
return { u_matrix: b, u_world: [M.drawingBufferWidth, M.drawingBufferHeight], u_image: m, u_color_ramp: v, u_opacity: l.paint.get("heatmap-opacity") };
};
function dr(S, l) {
const m = Math.pow(2, l.canonical.z), v = l.canonical.y;
return [new a.Z(0, v / m).toLngLat().lat, new a.Z(0, (v + 1) / m).toLngLat().lat];
}
const Tn = (S, l, m, v) => {
const b = S.transform;
return { u_matrix: Nn(S, l, m, v), u_ratio: 1 / Ar(l, 1, b.zoom), u_device_pixel_ratio: S.pixelRatio, u_units_to_pixels: [1 / b.pixelsToGLUnits[0], 1 / b.pixelsToGLUnits[1]] };
}, Ni = (S, l, m, v, b) => a.e(Tn(S, l, m, b), { u_image: 0, u_image_height: v }), zn = (S, l, m, v, b) => {
const M = S.transform, V = _l(l, M);
return { u_matrix: Nn(S, l, m, b), u_texsize: l.imageAtlasTexture.size, u_ratio: 1 / Ar(l, 1, M.zoom), u_device_pixel_ratio: S.pixelRatio, u_image: 0, u_scale: [V, v.fromScale, v.toScale], u_fade: v.t, u_units_to_pixels: [1 / M.pixelsToGLUnits[0], 1 / M.pixelsToGLUnits[1]] };
}, b0 = (S, l, m, v, b, M) => {
const V = S.lineAtlas, D = _l(l, S.transform), j = m.layout.get("line-cap") === "round", Z = V.getDash(v.from, j), Y = V.getDash(v.to, j), J = Z.width * b.fromScale, lt = Y.width * b.toScale;
return a.e(Tn(S, l, m, M), { u_patternscale_a: [D / J, -Z.height / 2], u_patternscale_b: [D / lt, -Y.height / 2], u_sdfgamma: V.width / (256 * Math.min(J, lt) * S.pixelRatio) / 2, u_image: 0, u_tex_y_a: Z.y, u_tex_y_b: Y.y, u_mix: b.t });
};
function _l(S, l) {
return 1 / Ar(S, 1, l.tileZoom);
}
function Nn(S, l, m, v) {
return S.translatePosMatrix(v ? v.posMatrix : l.tileID.posMatrix, l, m.paint.get("line-translate"), m.paint.get("line-translate-anchor"));
}
const bl = (S, l, m, v, b) => {
return { u_matrix: S, u_tl_parent: l, u_scale_parent: m, u_buffer_scale: 1, u_fade_t: v.mix, u_opacity: v.opacity * b.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: b.paint.get("raster-brightness-min"), u_brightness_high: b.paint.get("raster-brightness-max"), u_saturation_factor: (V = b.paint.get("raster-saturation"), V > 0 ? 1 - 1 / (1.001 - V) : -V), u_contrast_factor: (M = b.paint.get("raster-contrast"), M > 0 ? 1 / (1 - M) : 1 + M), u_spin_weights: vc(b.paint.get("raster-hue-rotate")) };
var M, V;
};
function vc(S) {
S *= Math.PI / 180;
const l = Math.sin(S), m = Math.cos(S);
return [(2 * m + 1) / 3, (-Math.sqrt(3) * l - m + 1) / 3, (Math.sqrt(3) * l - m + 1) / 3];
}
const Ko = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) => {
const Qt = V.transform;
return { u_is_size_zoom_constant: +(S === "constant" || S === "source"), u_is_size_feature_constant: +(S === "constant" || S === "camera"), u_size_t: l ? l.uSizeT : 0, u_size: l ? l.uSize : 0, u_camera_to_center_distance: Qt.cameraToCenterDistance, u_pitch: Qt.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +m, u_aspect_ratio: Qt.width / Qt.height, u_fade_change: V.options.fadeDuration ? V.symbolFadeChange : 1, u_matrix: D, u_label_plane_matrix: j, u_coord_matrix: Z, u_is_text: +J, u_pitch_with_map: +v, u_is_along_line: b, u_is_variable_anchor: M, u_texsize: lt, u_texture: 0, u_translation: Y, u_pitched_scale: ft };
}, ga = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft, Qt) => {
const wt = V.transform;
return a.e(Ko(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, Qt), { u_gamma_scale: v ? Math.cos(wt._pitch) * wt.cameraToCenterDistance : 1, u_device_pixel_ratio: V.pixelRatio, u_is_halo: +ft });
}, D4 = (S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) => a.e(ga(S, l, m, v, b, M, V, D, j, Z, Y, !0, J, !0, ft), { u_texsize_icon: lt, u_texture_icon: 1 }), A3 = (S, l, m) => ({ u_matrix: S, u_opacity: l, u_color: m }), O3 = (S, l, m, v, b, M) => a.e(function(V, D, j, Z) {
const Y = j.imageManager.getPattern(V.from.toString()), J = j.imageManager.getPattern(V.to.toString()), { width: lt, height: ft } = j.imageManager.getPixelSize(), Qt = Math.pow(2, Z.tileID.overscaledZ), wt = Z.tileSize * Math.pow(2, j.transform.tileZoom) / Qt, Mt = wt * (Z.tileID.canonical.x + Z.tileID.wrap * Qt), Ht = wt * Z.tileID.canonical.y;
return { u_image: 0, u_pattern_tl_a: Y.tl, u_pattern_br_a: Y.br, u_pattern_tl_b: J.tl, u_pattern_br_b: J.br, u_texsize: [lt, ft], u_mix: D.t, u_pattern_size_a: Y.displaySize, u_pattern_size_b: J.displaySize, u_scale_a: D.fromScale, u_scale_b: D.toScale, u_tile_units_to_pixels: 1 / Ar(Z, 1, j.transform.tileZoom), u_pixel_coord_upper: [Mt >> 16, Ht >> 16], u_pixel_coord_lower: [65535 & Mt, 65535 & Ht] };
}(v, M, m, b), { u_matrix: S, u_opacity: l }), F4 = { fillExtrusion: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_lightpos: new a.aN(S, l.u_lightpos), u_lightintensity: new a.aI(S, l.u_lightintensity), u_lightcolor: new a.aN(S, l.u_lightcolor), u_vertical_gradient: new a.aI(S, l.u_vertical_gradient), u_opacity: new a.aI(S, l.u_opacity) }), fillExtrusionPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_lightpos: new a.aN(S, l.u_lightpos), u_lightintensity: new a.aI(S, l.u_lightintensity), u_lightcolor: new a.aN(S, l.u_lightcolor), u_vertical_gradient: new a.aI(S, l.u_vertical_gradient), u_height_factor: new a.aI(S, l.u_height_factor), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade), u_opacity: new a.aI(S, l.u_opacity) }), fill: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix) }), fillPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), fillOutline: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world) }), fillOutlinePattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world), u_image: new a.aH(S, l.u_image), u_texsize: new a.aO(S, l.u_texsize), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), circle: (S, l) => ({ u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_scale_with_map: new a.aH(S, l.u_scale_with_map), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_extrude_scale: new a.aO(S, l.u_extrude_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_matrix: new a.aJ(S, l.u_matrix) }), collisionBox: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_pixel_extrude_scale: new a.aO(S, l.u_pixel_extrude_scale) }), collisionCircle: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_inv_matrix: new a.aJ(S, l.u_inv_matrix), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_viewport_size: new a.aO(S, l.u_viewport_size) }), debug: (S, l) => ({ u_color: new a.aL(S, l.u_color), u_matrix: new a.aJ(S, l.u_matrix), u_overlay: new a.aH(S, l.u_overlay), u_overlay_scale: new a.aI(S, l.u_overlay_scale) }), clippingMask: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix) }), heatmap: (S, l) => ({ u_extrude_scale: new a.aI(S, l.u_extrude_scale), u_intensity: new a.aI(S, l.u_intensity), u_matrix: new a.aJ(S, l.u_matrix) }), heatmapTexture: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_world: new a.aO(S, l.u_world), u_image: new a.aH(S, l.u_image), u_color_ramp: new a.aH(S, l.u_color_ramp), u_opacity: new a.aI(S, l.u_opacity) }), hillshade: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_latrange: new a.aO(S, l.u_latrange), u_light: new a.aO(S, l.u_light), u_shadow: new a.aL(S, l.u_shadow), u_highlight: new a.aL(S, l.u_highlight), u_accent: new a.aL(S, l.u_accent) }), hillshadePrepare: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_image: new a.aH(S, l.u_image), u_dimension: new a.aO(S, l.u_dimension), u_zoom: new a.aI(S, l.u_zoom), u_unpack: new a.aK(S, l.u_unpack) }), line: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels) }), lineGradient: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_image: new a.aH(S, l.u_image), u_image_height: new a.aI(S, l.u_image_height) }), linePattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texsize: new a.aO(S, l.u_texsize), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_image: new a.aH(S, l.u_image), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_scale: new a.aN(S, l.u_scale), u_fade: new a.aI(S, l.u_fade) }), lineSDF: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ratio: new a.aI(S, l.u_ratio), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_units_to_pixels: new a.aO(S, l.u_units_to_pixels), u_patternscale_a: new a.aO(S, l.u_patternscale_a), u_patternscale_b: new a.aO(S, l.u_patternscale_b), u_sdfgamma: new a.aI(S, l.u_sdfgamma), u_image: new a.aH(S, l.u_image), u_tex_y_a: new a.aI(S, l.u_tex_y_a), u_tex_y_b: new a.aI(S, l.u_tex_y_b), u_mix: new a.aI(S, l.u_mix) }), raster: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_tl_parent: new a.aO(S, l.u_tl_parent), u_scale_parent: new a.aI(S, l.u_scale_parent), u_buffer_scale: new a.aI(S, l.u_buffer_scale), u_fade_t: new a.aI(S, l.u_fade_t), u_opacity: new a.aI(S, l.u_opacity), u_image0: new a.aH(S, l.u_image0), u_image1: new a.aH(S, l.u_image1), u_brightness_low: new a.aI(S, l.u_brightness_low), u_brightness_high: new a.aI(S, l.u_brightness_high), u_saturation_factor: new a.aI(S, l.u_saturation_factor), u_contrast_factor: new a.aI(S, l.u_contrast_factor), u_spin_weights: new a.aN(S, l.u_spin_weights) }), symbolIcon: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texture: new a.aH(S, l.u_texture), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), symbolSDF: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texture: new a.aH(S, l.u_texture), u_gamma_scale: new a.aI(S, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_is_halo: new a.aH(S, l.u_is_halo), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), symbolTextAndIcon: (S, l) => ({ u_is_size_zoom_constant: new a.aH(S, l.u_is_size_zoom_constant), u_is_size_feature_constant: new a.aH(S, l.u_is_size_feature_constant), u_size_t: new a.aI(S, l.u_size_t), u_size: new a.aI(S, l.u_size), u_camera_to_center_distance: new a.aI(S, l.u_camera_to_center_distance), u_pitch: new a.aI(S, l.u_pitch), u_rotate_symbol: new a.aH(S, l.u_rotate_symbol), u_aspect_ratio: new a.aI(S, l.u_aspect_ratio), u_fade_change: new a.aI(S, l.u_fade_change), u_matrix: new a.aJ(S, l.u_matrix), u_label_plane_matrix: new a.aJ(S, l.u_label_plane_matrix), u_coord_matrix: new a.aJ(S, l.u_coord_matrix), u_is_text: new a.aH(S, l.u_is_text), u_pitch_with_map: new a.aH(S, l.u_pitch_with_map), u_is_along_line: new a.aH(S, l.u_is_along_line), u_is_variable_anchor: new a.aH(S, l.u_is_variable_anchor), u_texsize: new a.aO(S, l.u_texsize), u_texsize_icon: new a.aO(S, l.u_texsize_icon), u_texture: new a.aH(S, l.u_texture), u_texture_icon: new a.aH(S, l.u_texture_icon), u_gamma_scale: new a.aI(S, l.u_gamma_scale), u_device_pixel_ratio: new a.aI(S, l.u_device_pixel_ratio), u_is_halo: new a.aH(S, l.u_is_halo), u_translation: new a.aO(S, l.u_translation), u_pitched_scale: new a.aI(S, l.u_pitched_scale) }), background: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_opacity: new a.aI(S, l.u_opacity), u_color: new a.aL(S, l.u_color) }), backgroundPattern: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_opacity: new a.aI(S, l.u_opacity), u_image: new a.aH(S, l.u_image), u_pattern_tl_a: new a.aO(S, l.u_pattern_tl_a), u_pattern_br_a: new a.aO(S, l.u_pattern_br_a), u_pattern_tl_b: new a.aO(S, l.u_pattern_tl_b), u_pattern_br_b: new a.aO(S, l.u_pattern_br_b), u_texsize: new a.aO(S, l.u_texsize), u_mix: new a.aI(S, l.u_mix), u_pattern_size_a: new a.aO(S, l.u_pattern_size_a), u_pattern_size_b: new a.aO(S, l.u_pattern_size_b), u_scale_a: new a.aI(S, l.u_scale_a), u_scale_b: new a.aI(S, l.u_scale_b), u_pixel_coord_upper: new a.aO(S, l.u_pixel_coord_upper), u_pixel_coord_lower: new a.aO(S, l.u_pixel_coord_lower), u_tile_units_to_pixels: new a.aI(S, l.u_tile_units_to_pixels) }), terrain: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texture: new a.aH(S, l.u_texture), u_ele_delta: new a.aI(S, l.u_ele_delta), u_fog_matrix: new a.aJ(S, l.u_fog_matrix), u_fog_color: new a.aL(S, l.u_fog_color), u_fog_ground_blend: new a.aI(S, l.u_fog_ground_blend), u_fog_ground_blend_opacity: new a.aI(S, l.u_fog_ground_blend_opacity), u_horizon_color: new a.aL(S, l.u_horizon_color), u_horizon_fog_blend: new a.aI(S, l.u_horizon_fog_blend) }), terrainDepth: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_ele_delta: new a.aI(S, l.u_ele_delta) }), terrainCoords: (S, l) => ({ u_matrix: new a.aJ(S, l.u_matrix), u_texture: new a.aH(S, l.u_texture), u_terrain_coords_id: new a.aI(S, l.u_terrain_coords_id), u_ele_delta: new a.aI(S, l.u_ele_delta) }), sky: (S, l) => ({ u_sky_color: new a.aL(S, l.u_sky_color), u_horizon_color: new a.aL(S, l.u_horizon_color), u_horizon: new a.aI(S, l.u_horizon), u_sky_horizon_blend: new a.aI(S, l.u_sky_horizon_blend) }) };
class Ao {
constructor(l, m, v) {
this.context = l;
const b = l.gl;
this.buffer = b.createBuffer(), this.dynamicDraw = !!v, this.context.unbindVAO(), l.bindElementBuffer.set(this.buffer), b.bufferData(b.ELEMENT_ARRAY_BUFFER, m.arrayBuffer, this.dynamicDraw ? b.DYNAMIC_DRAW : b.STATIC_DRAW), this.dynamicDraw || delete m.arrayBuffer;
}
bind() {
this.context.bindElementBuffer.set(this.buffer);
}
updateData(l) {
const m = this.context.gl;
if (!this.dynamicDraw)
throw new Error("Attempted to update data while not in dynamic mode.");
this.context.unbindVAO(), this.bind(), m.bufferSubData(m.ELEMENT_ARRAY_BUFFER, 0, l.arrayBuffer);
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
}
}
const _c = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" };
class L0 {
constructor(l, m, v, b) {
this.length = m.length, this.attributes = v, this.itemSize = m.bytesPerElement, this.dynamicDraw = b, this.context = l;
const M = l.gl;
this.buffer = M.createBuffer(), l.bindVertexBuffer.set(this.buffer), M.bufferData(M.ARRAY_BUFFER, m.arrayBuffer, this.dynamicDraw ? M.DYNAMIC_DRAW : M.STATIC_DRAW), this.dynamicDraw || delete m.arrayBuffer;
}
bind() {
this.context.bindVertexBuffer.set(this.buffer);
}
updateData(l) {
if (l.length !== this.length)
throw new Error(`Length of new data is ${l.length}, which doesn't match current length of ${this.length}`);
const m = this.context.gl;
this.bind(), m.bufferSubData(m.ARRAY_BUFFER, 0, l.arrayBuffer);
}
enableAttributes(l, m) {
for (let v = 0; v < this.attributes.length; v++) {
const b = m.attributes[this.attributes[v].name];
b !== void 0 && l.enableVertexAttribArray(b);
}
}
setVertexAttribPointers(l, m, v) {
for (let b = 0; b < this.attributes.length; b++) {
const M = this.attributes[b], V = m.attributes[M.name];
V !== void 0 && l.vertexAttribPointer(V, M.components, l[_c[M.type]], !1, this.itemSize, M.offset + this.itemSize * (v || 0));
}
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer);
}
}
const Bs = /* @__PURE__ */ new WeakMap();
function L2(S) {
var l;
if (Bs.has(S))
return Bs.get(S);
{
const m = (l = S.getParameter(S.VERSION)) === null || l === void 0 ? void 0 : l.startsWith("WebGL 2.0");
return Bs.set(S, m), m;
}
}
class hn {
constructor(l) {
this.gl = l.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = !1;
}
get() {
return this.current;
}
set(l) {
}
getDefault() {
return this.default;
}
setDefault() {
this.set(this.default);
}
}
class C3 extends hn {
getDefault() {
return a.aM.transparent;
}
set(l) {
const m = this.current;
(l.r !== m.r || l.g !== m.g || l.b !== m.b || l.a !== m.a || this.dirty) && (this.gl.clearColor(l.r, l.g, l.b, l.a), this.current = l, this.dirty = !1);
}
}
class bc extends hn {
getDefault() {
return 1;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearDepth(l), this.current = l, this.dirty = !1);
}
}
class ya extends hn {
getDefault() {
return 0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.clearStencil(l), this.current = l, this.dirty = !1);
}
}
class B4 extends hn {
getDefault() {
return [!0, !0, !0, !0];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || l[3] !== m[3] || this.dirty) && (this.gl.colorMask(l[0], l[1], l[2], l[3]), this.current = l, this.dirty = !1);
}
}
class j4 extends hn {
getDefault() {
return !0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthMask(l), this.current = l, this.dirty = !1);
}
}
class Ll extends hn {
getDefault() {
return 255;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.stencilMask(l), this.current = l, this.dirty = !1);
}
}
class Oo extends hn {
getDefault() {
return { func: this.gl.ALWAYS, ref: 0, mask: 255 };
}
set(l) {
const m = this.current;
(l.func !== m.func || l.ref !== m.ref || l.mask !== m.mask || this.dirty) && (this.gl.stencilFunc(l.func, l.ref, l.mask), this.current = l, this.dirty = !1);
}
}
class z4 extends hn {
getDefault() {
const l = this.gl;
return [l.KEEP, l.KEEP, l.KEEP];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || this.dirty) && (this.gl.stencilOp(l[0], l[1], l[2]), this.current = l, this.dirty = !1);
}
}
class w0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.STENCIL_TEST) : m.disable(m.STENCIL_TEST), this.current = l, this.dirty = !1;
}
}
class wl extends hn {
getDefault() {
return [0, 1];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || this.dirty) && (this.gl.depthRange(l[0], l[1]), this.current = l, this.dirty = !1);
}
}
class x0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.DEPTH_TEST) : m.disable(m.DEPTH_TEST), this.current = l, this.dirty = !1;
}
}
class k3 extends hn {
getDefault() {
return this.gl.LESS;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.depthFunc(l), this.current = l, this.dirty = !1);
}
}
class os extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.BLEND) : m.disable(m.BLEND), this.current = l, this.dirty = !1;
}
}
class E0 extends hn {
getDefault() {
const l = this.gl;
return [l.ONE, l.ZERO];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || this.dirty) && (this.gl.blendFunc(l[0], l[1]), this.current = l, this.dirty = !1);
}
}
class Lc extends hn {
getDefault() {
return a.aM.transparent;
}
set(l) {
const m = this.current;
(l.r !== m.r || l.g !== m.g || l.b !== m.b || l.a !== m.a || this.dirty) && (this.gl.blendColor(l.r, l.g, l.b, l.a), this.current = l, this.dirty = !1);
}
}
class ss extends hn {
getDefault() {
return this.gl.FUNC_ADD;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.blendEquation(l), this.current = l, this.dirty = !1);
}
}
class va extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
l ? m.enable(m.CULL_FACE) : m.disable(m.CULL_FACE), this.current = l, this.dirty = !1;
}
}
class wc extends hn {
getDefault() {
return this.gl.BACK;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.cullFace(l), this.current = l, this.dirty = !1);
}
}
class U4 extends hn {
getDefault() {
return this.gl.CCW;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.frontFace(l), this.current = l, this.dirty = !1);
}
}
class M0 extends hn {
getDefault() {
return null;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.useProgram(l), this.current = l, this.dirty = !1);
}
}
class I3 extends hn {
getDefault() {
return this.gl.TEXTURE0;
}
set(l) {
(l !== this.current || this.dirty) && (this.gl.activeTexture(l), this.current = l, this.dirty = !1);
}
}
class G4 extends hn {
getDefault() {
const l = this.gl;
return [0, 0, l.drawingBufferWidth, l.drawingBufferHeight];
}
set(l) {
const m = this.current;
(l[0] !== m[0] || l[1] !== m[1] || l[2] !== m[2] || l[3] !== m[3] || this.dirty) && (this.gl.viewport(l[0], l[1], l[2], l[3]), this.current = l, this.dirty = !1);
}
}
class $4 extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindFramebuffer(m.FRAMEBUFFER, l), this.current = l, this.dirty = !1;
}
}
class W4 extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindRenderbuffer(m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class js extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindTexture(m.TEXTURE_2D, l), this.current = l, this.dirty = !1;
}
}
class xl extends hn {
getDefault() {
return null;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.bindBuffer(m.ARRAY_BUFFER, l), this.current = l, this.dirty = !1;
}
}
class Z4 extends hn {
getDefault() {
return null;
}
set(l) {
const m = this.gl;
m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, l), this.current = l, this.dirty = !1;
}
}
class w2 extends hn {
getDefault() {
return null;
}
set(l) {
var m;
if (l === this.current && !this.dirty)
return;
const v = this.gl;
L2(v) ? v.bindVertexArray(l) : (m = v.getExtension("OES_vertex_array_object")) === null || m === void 0 || m.bindVertexArrayOES(l), this.current = l, this.dirty = !1;
}
}
class S0 extends hn {
getDefault() {
return 4;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_ALIGNMENT, l), this.current = l, this.dirty = !1;
}
}
class H0 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL, l), this.current = l, this.dirty = !1;
}
}
class q4 extends hn {
getDefault() {
return !1;
}
set(l) {
if (l === this.current && !this.dirty)
return;
const m = this.gl;
m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL, l), this.current = l, this.dirty = !1;
}
}
class _a extends hn {
constructor(l, m) {
super(l), this.context = l, this.parent = m;
}
getDefault() {
return null;
}
}
class x2 extends _a {
setDirty() {
this.dirty = !0;
}
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferTexture2D(m.FRAMEBUFFER, m.COLOR_ATTACHMENT0, m.TEXTURE_2D, l, 0), this.current = l, this.dirty = !1;
}
}
class v1 extends _a {
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferRenderbuffer(m.FRAMEBUFFER, m.DEPTH_ATTACHMENT, m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class E2 extends _a {
set(l) {
if (l === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const m = this.gl;
m.framebufferRenderbuffer(m.FRAMEBUFFER, m.DEPTH_STENCIL_ATTACHMENT, m.RENDERBUFFER, l), this.current = l, this.dirty = !1;
}
}
class X4 {
constructor(l, m, v, b, M) {
this.context = l, this.width = m, this.height = v;
const V = l.gl, D = this.framebuffer = V.createFramebuffer();
if (this.colorAttachment = new x2(l, D), b)
this.depthAttachment = M ? new E2(l, D) : new v1(l, D);
else if (M)
throw new Error("Stencil cannot be set without depth");
if (V.checkFramebufferStatus(V.FRAMEBUFFER) !== V.FRAMEBUFFER_COMPLETE)
throw new Error("Framebuffer is not complete");
}
destroy() {
const l = this.context.gl, m = this.colorAttachment.get();
if (m && l.deleteTexture(m), this.depthAttachment) {
const v = this.depthAttachment.get();
v && l.deleteRenderbuffer(v);
}
l.deleteFramebuffer(this.framebuffer);
}
}
class Mn {
constructor(l, m, v) {
this.blendFunction = l, this.blendColor = m, this.mask = v;
}
}
Mn.Replace = [1, 0], Mn.disabled = new Mn(Mn.Replace, a.aM.transparent, [!1, !1, !1, !1]), Mn.unblended = new Mn(Mn.Replace, a.aM.transparent, [!0, !0, !0, !0]), Mn.alphaBlended = new Mn([1, 771], a.aM.transparent, [!0, !0, !0, !0]);
class xc {
constructor(l) {
var m, v;
if (this.gl = l, this.clearColor = new C3(this), this.clearDepth = new bc(this), this.clearStencil = new ya(this), this.colorMask = new B4(this), this.depthMask = new j4(this), this.stencilMask = new Ll(this), this.stencilFunc = new Oo(this), this.stencilOp = new z4(this), this.stencilTest = new w0(this), this.depthRange = new wl(this), this.depthTest = new x0(this), this.depthFunc = new k3(this), this.blend = new os(this), this.blendFunc = new E0(this), this.blendColor = new Lc(this), this.blendEquation = new ss(this), this.cullFace = new va(this), this.cullFaceSide = new wc(this), this.frontFace = new U4(this), this.program = new M0(this), this.activeTexture = new I3(this), this.viewport = new G4(this), this.bindFramebuffer = new $4(this), this.bindRenderbuffer = new W4(this), this.bindTexture = new js(this), this.bindVertexBuffer = new xl(this), this.bindElementBuffer = new Z4(this), this.bindVertexArray = new w2(this), this.pixelStoreUnpack = new S0(this), this.pixelStoreUnpackPremultiplyAlpha = new H0(this), this.pixelStoreUnpackFlipY = new q4(this), this.extTextureFilterAnisotropic = l.getExtension("EXT_texture_filter_anisotropic") || l.getExtension("MOZ_EXT_texture_filter_anisotropic") || l.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = l.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.maxTextureSize = l.getParameter(l.MAX_TEXTURE_SIZE), L2(l)) {
this.HALF_FLOAT = l.HALF_FLOAT;
const b = l.getExtension("EXT_color_buffer_half_float");
this.RGBA16F = (m = l.RGBA16F) !== null && m !== void 0 ? m : b == null ? void 0 : b.RGBA16F_EXT, this.RGB16F = (v = l.RGB16F) !== null && v !== void 0 ? v : b == null ? void 0 : b.RGB16F_EXT, l.getExtension("EXT_color_buffer_float");
} else {
l.getExtension("EXT_color_buffer_half_float"), l.getExtension("OES_texture_half_float_linear");
const b = l.getExtension("OES_texture_half_float");
this.HALF_FLOAT = b == null ? void 0 : b.HALF_FLOAT_OES;
}
}
setDefault() {
this.unbindVAO(), this.clearColor.setDefault(), this.clearDepth.setDefault(), this.clearStencil.setDefault(), this.colorMask.setDefault(), this.depthMask.setDefault(), this.stencilMask.setDefault(), this.stencilFunc.setDefault(), this.stencilOp.setDefault(), this.stencilTest.setDefault(), this.depthRange.setDefault(), this.depthTest.setDefault(), this.depthFunc.setDefault(), this.blend.setDefault(), this.blendFunc.setDefault(), this.blendColor.setDefault(), this.blendEquation.setDefault(), this.cullFace.setDefault(), this.cullFaceSide.setDefault(), this.frontFace.setDefault(), this.program.setDefault(), this.activeTexture.setDefault(), this.bindFramebuffer.setDefault(), this.pixelStoreUnpack.setDefault(), this.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.pixelStoreUnpackFlipY.setDefault();
}
setDirty() {
this.clearColor.dirty = !0, this.clearDepth.dirty = !0, this.clearStencil.dirty = !0, this.colorMask.dirty = !0, this.depthMask.dirty = !0, this.stencilMask.dirty = !0, this.stencilFunc.dirty = !0, this.stencilOp.dirty = !0, this.stencilTest.dirty = !0, this.depthRange.dirty = !0, this.depthTest.dirty = !0, this.depthFunc.dirty = !0, this.blend.dirty = !0, this.blendFunc.dirty = !0, this.blendColor.dirty = !0, this.blendEquation.dirty = !0, this.cullFace.dirty = !0, this.cullFaceSide.dirty = !0, this.frontFace.dirty = !0, this.program.dirty = !0, this.activeTexture.dirty = !0, this.viewport.dirty = !0, this.bindFramebuffer.dirty = !0, this.bindRenderbuffer.dirty = !0, this.bindTexture.dirty = !0, this.bindVertexBuffer.dirty = !0, this.bindElementBuffer.dirty = !0, this.bindVertexArray.dirty = !0, this.pixelStoreUnpack.dirty = !0, this.pixelStoreUnpackPremultiplyAlpha.dirty = !0, this.pixelStoreUnpackFlipY.dirty = !0;
}
createIndexBuffer(l, m) {
return new Ao(this, l, m);
}
createVertexBuffer(l, m, v) {
return new L0(this, l, m, v);
}
createRenderbuffer(l, m, v) {
const b = this.gl, M = b.createRenderbuffer();
return this.bindRenderbuffer.set(M), b.renderbufferStorage(b.RENDERBUFFER, l, m, v), this.bindRenderbuffer.set(null), M;
}
createFramebuffer(l, m, v, b) {
return new X4(this, l, m, v, b);
}
clear({ color: l, depth: m, stencil: v }) {
const b = this.gl;
let M = 0;
l && (M |= b.COLOR_BUFFER_BIT, this.clearColor.set(l), this.colorMask.set([!0, !0, !0, !0])), m !== void 0 && (M |= b.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(m), this.depthMask.set(!0)), v !== void 0 && (M |= b.STENCIL_BUFFER_BIT, this.clearStencil.set(v), this.stencilMask.set(255)), b.clear(M);
}
setCullFace(l) {
l.enable === !1 ? this.cullFace.set(!1) : (this.cullFace.set(!0), this.cullFaceSide.set(l.mode), this.frontFace.set(l.frontFace));
}
setDepthMode(l) {
l.func !== this.gl.ALWAYS || l.mask ? (this.depthTest.set(!0), this.depthFunc.set(l.func), this.depthMask.set(l.mask), this.depthRange.set(l.range)) : this.depthTest.set(!1);
}
setStencilMode(l) {
l.test.func !== this.gl.ALWAYS || l.mask ? (this.stencilTest.set(!0), this.stencilMask.set(l.mask), this.stencilOp.set([l.fail, l.depthFail, l.pass]), this.stencilFunc.set({ func: l.test.func, ref: l.ref, mask: l.test.mask })) : this.stencilTest.set(!1);
}
setColorMode(l) {
a.aE(l.blendFunction, Mn.Replace) ? this.blend.set(!1) : (this.blend.set(!0), this.blendFunc.set(l.blendFunction), this.blendColor.set(l.blendColor)), this.colorMask.set(l.mask);
}
createVertexArray() {
var l;
return L2(this.gl) ? this.gl.createVertexArray() : (l = this.gl.getExtension("OES_vertex_array_object")) === null || l === void 0 ? void 0 : l.createVertexArrayOES();
}
deleteVertexArray(l) {
var m;
return L2(this.gl) ? this.gl.deleteVertexArray(l) : (m = this.gl.getExtension("OES_vertex_array_object")) === null || m === void 0 ? void 0 : m.deleteVertexArrayOES(l);
}
unbindVAO() {
this.bindVertexArray.set(null);
}
}
class $r {
constructor(l, m, v) {
this.func = l, this.mask = m, this.range = v;
}
}
$r.ReadOnly = !1, $r.ReadWrite = !0, $r.disabled = new $r(519, $r.ReadOnly, [0, 1]);
const as = 7680;
class An {
constructor(l, m, v, b, M, V) {
this.test = l, this.ref = m, this.mask = v, this.fail = b, this.depthFail = M, this.pass = V;
}
}
An.disabled = new An({ func: 519, mask: 0 }, 0, 0, as, as, as);
class bn {
constructor(l, m, v) {
this.enable = l, this.mode = m, this.frontFace = v;
}
}
let zs;
function P3(S, l, m, v, b) {
const M = S.context, V = M.gl, D = S.useProgram("collisionBox"), j = [];
let Z = 0, Y = 0;
for (let Ht = 0; Ht < v.length; Ht++) {
const Ot = v[Ht], bt = l.getTile(Ot).getBucket(m);
if (!bt)
continue;
const Nt = b ? bt.textCollisionBox : bt.iconCollisionBox, Dt = bt.collisionCircleArray;
if (Dt.length > 0) {
const Wt = a.H();
a.aQ(Wt, bt.placementInvProjMatrix, S.transform.glCoordMatrix), a.aQ(Wt, Wt, bt.placementViewportMatrix), j.push({ circleArray: Dt, circleOffset: Y, transform: Ot.posMatrix, invTransform: Wt, coord: Ot }), Z += Dt.length / 4, Y = Z;
}
Nt && D.draw(M, V.LINES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, { u_matrix: Ot.posMatrix, u_pixel_extrude_scale: [1 / (J = S.transform).width, 1 / J.height] }, S.style.map.terrain && S.style.map.terrain.getTerrainData(Ot), m.id, Nt.layoutVertexBuffer, Nt.indexBuffer, Nt.segments, null, S.transform.zoom, null, null, Nt.collisionVertexBuffer);
}
var J;
if (!b || !j.length)
return;
const lt = S.useProgram("collisionCircle"), ft = new a.aR();
ft.resize(4 * Z), ft._trim();
let Qt = 0;
for (const Ht of j)
for (let Ot = 0; Ot < Ht.circleArray.length / 4; Ot++) {
const bt = 4 * Ot, Nt = Ht.circleArray[bt + 0], Dt = Ht.circleArray[bt + 1], Wt = Ht.circleArray[bt + 2], he = Ht.circleArray[bt + 3];
ft.emplace(Qt++, Nt, Dt, Wt, he, 0), ft.emplace(Qt++, Nt, Dt, Wt, he, 1), ft.emplace(Qt++, Nt, Dt, Wt, he, 2), ft.emplace(Qt++, Nt, Dt, Wt, he, 3);
}
(!zs || zs.length < 2 * Z) && (zs = function(Ht) {
const Ot = 2 * Ht, bt = new a.aT();
bt.resize(Ot), bt._trim();
for (let Nt = 0; Nt < Ot; Nt++) {
const Dt = 6 * Nt;
bt.uint16[Dt + 0] = 4 * Nt + 0, bt.uint16[Dt + 1] = 4 * Nt + 1, bt.uint16[Dt + 2] = 4 * Nt + 2, bt.uint16[Dt + 3] = 4 * Nt + 2, bt.uint16[Dt + 4] = 4 * Nt + 3, bt.uint16[Dt + 5] = 4 * Nt + 0;
}
return bt;
}(Z));
const wt = M.createIndexBuffer(zs, !0), Mt = M.createVertexBuffer(ft, a.aS.members, !0);
for (const Ht of j) {
const Ot = fr(Ht.transform, Ht.invTransform, S.transform);
lt.draw(M, V.TRIANGLES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, Ot, S.style.map.terrain && S.style.map.terrain.getTerrainData(Ht.coord), m.id, Mt, wt, a.a0.simpleSegment(0, 2 * Ht.circleOffset, Ht.circleArray.length, Ht.circleArray.length / 2), null, S.transform.zoom, null, null, null);
}
Mt.destroy(), wt.destroy();
}
bn.disabled = new bn(!1, 1029, 2305), bn.backCCW = new bn(!0, 1029, 2305);
const ba = a.an(new Float32Array(16));
function K4(S, l, m, v, b, M) {
const { horizontalAlign: V, verticalAlign: D } = a.au(S);
return new a.P((-(V - 0.5) * l / b + v[0]) * M, (-(D - 0.5) * m / b + v[1]) * M);
}
function Yo(S, l, m, v, b, M) {
const V = l.tileAnchorPoint.add(new a.P(l.translation[0], l.translation[1]));
if (l.pitchWithMap) {
let D = v.mult(M);
m || (D = D.rotate(-b));
const j = V.add(D);
return xt(j.x, j.y, l.labelPlaneMatrix, l.getElevation).point;
}
if (m) {
const D = Jt(l.tileAnchorPoint.x + 1, l.tileAnchorPoint.y, l).point.sub(S), j = Math.atan(D.y / D.x) + (D.x < 0 ? Math.PI : 0);
return S.add(v.rotate(j));
}
return S.add(v);
}
function Co(S, l, m, v, b, M, V, D, j, Z, Y, J, lt, ft) {
const Qt = S.text.placedSymbolArray, wt = S.text.dynamicLayoutVertexArray, Mt = S.icon.dynamicLayoutVertexArray, Ht = {};
wt.clear();
for (let Ot = 0; Ot < Qt.length; Ot++) {
const bt = Qt.get(Ot), Nt = bt.hidden || !bt.crossTileID || S.allowVerticalPlacement && !bt.placedOrientation ? null : v[bt.crossTileID];
if (Nt) {
const Dt = new a.P(bt.anchorX, bt.anchorY), Wt = { getElevation: ft, width: b.width, height: b.height, labelPlaneMatrix: M, lineVertexArray: null, pitchWithMap: m, projection: Y, projectionCache: null, tileAnchorPoint: Dt, translation: J, unwrappedTileID: lt }, he = m ? xt(Dt.x, Dt.y, V, ft) : Jt(Dt.x, Dt.y, Wt), we = ot(b.cameraToCenterDistance, he.signedDistanceFromCamera);
let De = a.ai(S.textSizeData, j, bt) * we / a.ap;
m && (De *= S.tilePixelRatio / D);
const { width: tr, height: Oe, anchor: Ae, textOffset: ur, textBoxScale: Nr } = Nt, Pe = K4(Ae, tr, Oe, ur, Nr, De), We = Y.getPitchedTextCorrection(b, Dt.add(new a.P(J[0], J[1])), lt), kr = Yo(he.point, Wt, l, Pe, b.angle, We), ei = S.allowVerticalPlacement && bt.placedOrientation === a.ah.vertical ? Math.PI / 2 : 0;
for (let Wr = 0; Wr < bt.numGlyphs; Wr++)
a.aj(wt, kr, ei);
Z && bt.associatedIconIndex >= 0 && (Ht[bt.associatedIconIndex] = { shiftedAnchor: kr, angle: ei });
} else
Rt(bt.numGlyphs, wt);
}
if (Z) {
Mt.clear();
const Ot = S.icon.placedSymbolArray;
for (let bt = 0; bt < Ot.length; bt++) {
const Nt = Ot.get(bt);
if (Nt.hidden)
Rt(Nt.numGlyphs, Mt);
else {
const Dt = Ht[bt];
if (Dt)
for (let Wt = 0; Wt < Nt.numGlyphs; Wt++)
a.aj(Mt, Dt.shiftedAnchor, Dt.angle);
else
Rt(Nt.numGlyphs, Mt);
}
}
S.icon.dynamicLayoutVertexBuffer.updateData(Mt);
}
S.text.dynamicLayoutVertexBuffer.updateData(wt);
}
function po(S, l, m) {
return m.iconsInText && l ? "symbolTextAndIcon" : S ? "symbolSDF" : "symbolIcon";
}
function Jo(S, l, m, v, b, M, V, D, j, Z, Y, J) {
const lt = S.context, ft = lt.gl, Qt = S.transform, wt = u1(), Mt = D === "map", Ht = j === "map", Ot = D !== "viewport" && m.layout.get("symbol-placement") !== "point", bt = Mt && !Ht && !Ot, Nt = !Ht && Ot, Dt = !m.layout.get("symbol-sort-key").isConstant();
let Wt = !1;
const he = S.depthModeForSublayer(0, $r.ReadOnly), we = m._unevaluatedLayout.hasValue("text-variable-anchor") || m._unevaluatedLayout.hasValue("text-variable-anchor-offset"), De = [], tr = wt.getCircleRadiusCorrection(Qt);
for (const Oe of v) {
const Ae = l.getTile(Oe), ur = Ae.getBucket(m);
if (!ur)
continue;
const Nr = b ? ur.text : ur.icon;
if (!Nr || !Nr.segments.get().length || !Nr.hasVisibleVertices)
continue;
const Pe = Nr.programConfigurations.get(m.id), We = b || ur.sdfIcons, kr = b ? ur.textSizeData : ur.iconSizeData, ei = Ht || Qt.pitch !== 0, Wr = S.useProgram(po(We, b, ur), Pe), nn = a.ag(kr, Qt.zoom), ri = S.style.map.terrain && S.style.map.terrain.getTerrainData(Oe);
let C1, O2, ni, mo, q1 = [0, 0], k1 = null;
if (b)
O2 = Ae.glyphAtlasTexture, ni = ft.LINEAR, C1 = Ae.glyphAtlasTexture.size, ur.iconsInText && (q1 = Ae.imageAtlasTexture.size, k1 = Ae.imageAtlasTexture, mo = ei || S.options.rotating || S.options.zooming || kr.kind === "composite" || kr.kind === "camera" ? ft.LINEAR : ft.NEAREST);
else {
const an = m.layout.get("icon-size").constantOr(0) !== 1 || ur.iconsNeedLinear;
O2 = Ae.imageAtlasTexture, ni = We || S.options.rotating || S.options.zooming || an || ei ? ft.LINEAR : ft.NEAREST, C1 = Ae.imageAtlasTexture.size;
}
const X1 = Ar(Ae, 1, S.transform.zoom), ms = Nt ? Oe.posMatrix : ba, s6 = Vi(ms, Ht, Mt, S.transform, X1), Il = Rn(ms, Ht, Mt, S.transform, X1), a6 = Rn(Oe.posMatrix, Ht, Mt, S.transform, X1), i2 = wt.translatePosition(S.transform, Ae, M, V), Pl = we && ur.hasTextData(), jc = m.layout.get("icon-text-fit") !== "none" && Pl && ur.hasIconData();
if (Ot) {
const an = S.style.map.terrain ? (l6, c6) => S.style.map.terrain.getElevation(Oe, l6, c6) : null, B3 = m.layout.get("text-rotation-alignment") === "map";
pt(ur, Oe.posMatrix, S, b, s6, a6, Ht, Z, B3, wt, Oe.toUnwrapped(), Qt.width, Qt.height, i2, an);
}
const o2 = Oe.posMatrix, s2 = b && we || jc, Ea = Ot || s2 ? ba : s6, C2 = Il, b1 = We && m.paint.get(b ? "text-halo-width" : "icon-halo-width").constantOr(1) !== 0;
let I1;
I1 = We ? ur.iconsInText ? D4(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, C1, q1, tr) : ga(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, b, C1, !0, tr) : Ko(kr.kind, nn, bt, Ht, Ot, s2, S, o2, Ea, C2, i2, b, C1, tr);
const Ro = { program: Wr, buffers: Nr, uniformValues: I1, atlasTexture: O2, atlasTextureIcon: k1, atlasInterpolation: ni, atlasInterpolationIcon: mo, isSDF: We, hasHalo: b1 };
if (Dt && ur.canOverlap) {
Wt = !0;
const an = Nr.segments.get();
for (const B3 of an)
De.push({ segments: new a.a0([B3]), sortKey: B3.sortKey, state: Ro, terrainData: ri });
} else
De.push({ segments: Nr.segments, sortKey: 0, state: Ro, terrainData: ri });
}
Wt && De.sort((Oe, Ae) => Oe.sortKey - Ae.sortKey);
for (const Oe of De) {
const Ae = Oe.state;
if (lt.activeTexture.set(ft.TEXTURE0), Ae.atlasTexture.bind(Ae.atlasInterpolation, ft.CLAMP_TO_EDGE), Ae.atlasTextureIcon && (lt.activeTexture.set(ft.TEXTURE1), Ae.atlasTextureIcon && Ae.atlasTextureIcon.bind(Ae.atlasInterpolationIcon, ft.CLAMP_TO_EDGE)), Ae.isSDF) {
const ur = Ae.uniformValues;
Ae.hasHalo && (ur.u_is_halo = 1, A0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, ur, Oe.terrainData)), ur.u_is_halo = 0;
}
A0(Ae.buffers, Oe.segments, m, S, Ae.program, he, Y, J, Ae.uniformValues, Oe.terrainData);
}
}
function A0(S, l, m, v, b, M, V, D, j, Z) {
const Y = v.context;
b.draw(Y, Y.gl.TRIANGLES, M, V, D, bn.disabled, j, Z, m.id, S.layoutVertexBuffer, S.indexBuffer, l, m.paint, v.transform.zoom, S.programConfigurations.get(m.id), S.dynamicLayoutVertexBuffer, S.opacityVertexBuffer);
}
function M2(S, l, m, v) {
const b = S.context, M = b.gl, V = An.disabled, D = new Mn([M.ONE, M.ONE], a.aM.transparent, [!0, !0, !0, !0]), j = l.getBucket(m);
if (!j)
return;
const Z = v.key;
let Y = m.heatmapFbos.get(Z);
Y || (Y = V3(b, l.tileSize, l.tileSize), m.heatmapFbos.set(Z, Y)), b.bindFramebuffer.set(Y.framebuffer), b.viewport.set([0, 0, l.tileSize, l.tileSize]), b.clear({ color: a.aM.transparent });
const J = j.programConfigurations.get(m.id), lt = S.useProgram("heatmap", J), ft = S.style.map.terrain.getTerrainData(v);
lt.draw(b, M.TRIANGLES, $r.disabled, V, D, bn.disabled, un(v.posMatrix, l, S.transform.zoom, m.paint.get("heatmap-intensity")), ft, m.id, j.layoutVertexBuffer, j.indexBuffer, j.segments, m.paint, S.transform.zoom, J);
}
function ls(S, l, m) {
const v = S.context, b = v.gl;
v.setColorMode(S.colorModeForRenderPass());
const M = cs(v, l), V = m.key, D = l.heatmapFbos.get(V);
D && (v.activeTexture.set(b.TEXTURE0), b.bindTexture(b.TEXTURE_2D, D.colorAttachment.get()), v.activeTexture.set(b.TEXTURE1), M.bind(b.LINEAR, b.CLAMP_TO_EDGE), S.useProgram("heatmapTexture").draw(v, b.TRIANGLES, $r.disabled, An.disabled, S.colorModeForRenderPass(), bn.disabled, pe(S, l, 0, 1), null, l.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments, l.paint, S.transform.zoom), D.destroy(), l.heatmapFbos.delete(V));
}
function V3(S, l, m) {
var v, b;
const M = S.gl, V = M.createTexture();
M.bindTexture(M.TEXTURE_2D, V), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_S, M.CLAMP_TO_EDGE), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_WRAP_T, M.CLAMP_TO_EDGE), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MIN_FILTER, M.LINEAR), M.texParameteri(M.TEXTURE_2D, M.TEXTURE_MAG_FILTER, M.LINEAR);
const D = (v = S.HALF_FLOAT) !== null && v !== void 0 ? v : M.UNSIGNED_BYTE, j = (b = S.RGBA16F) !== null && b !== void 0 ? b : M.RGBA;
M.texImage2D(M.TEXTURE_2D, 0, j, l, m, 0, M.RGBA, D, null);
const Z = S.createFramebuffer(l, m, !1, !1);
return Z.colorAttachment.set(V), Z;
}
function cs(S, l) {
return l.colorRampTexture || (l.colorRampTexture = new rt(S, l.colorRamp, S.gl.RGBA)), l.colorRampTexture;
}
function us(S, l, m, v, b) {
if (!m || !v || !v.imageAtlas)
return;
const M = v.imageAtlas.patternPositions;
let V = M[m.to.toString()], D = M[m.from.toString()];
if (!V && D && (V = D), !D && V && (D = V), !V || !D) {
const j = b.getPaintProperty(l);
V = M[j], D = M[j];
}
V && D && S.setConstantPatternPositions(V, D);
}
function La(S, l, m, v, b, M, V) {
const D = S.context.gl, j = "fill-pattern", Z = m.paint.get(j), Y = Z && Z.constantOr(1), J = m.getCrossfadeParameters();
let lt, ft, Qt, wt, Mt;
V ? (ft = Y && !m.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", lt = D.LINES) : (ft = Y ? "fillPattern" : "fill", lt = D.TRIANGLES);
const Ht = Z.constantOr(null);
for (const Ot of v) {
const bt = l.getTile(Ot);
if (Y && !bt.patternsLoaded())
continue;
const Nt = bt.getBucket(m);
if (!Nt)
continue;
const Dt = Nt.programConfigurations.get(m.id), Wt = S.useProgram(ft, Dt), he = S.style.map.terrain && S.style.map.terrain.getTerrainData(Ot);
Y && (S.context.activeTexture.set(D.TEXTURE0), bt.imageAtlasTexture.bind(D.LINEAR, D.CLAMP_TO_EDGE), Dt.updatePaintBuffers(J)), us(Dt, j, Ht, bt, m);
const we = he ? Ot : null, De = S.translatePosMatrix(we ? we.posMatrix : Ot.posMatrix, bt, m.paint.get("fill-translate"), m.paint.get("fill-translate-anchor"));
if (V) {
wt = Nt.indexBuffer2, Mt = Nt.segments2;
const tr = [D.drawingBufferWidth, D.drawingBufferHeight];
Qt = ft === "fillOutlinePattern" && Y ? Me(De, S, J, bt, tr) : ve(De, tr);
} else
wt = Nt.indexBuffer, Mt = Nt.segments, Qt = Y ? le(De, S, J, bt) : qt(De);
Wt.draw(S.context, lt, b, S.stencilModeForClipping(Ot), M, bn.disabled, Qt, he, m.id, Nt.layoutVertexBuffer, wt, Mt, m.paint, S.transform.zoom, Dt);
}
}
function R3(S, l, m, v, b, M, V) {
const D = S.context, j = D.gl, Z = "fill-extrusion-pattern", Y = m.paint.get(Z), J = Y.constantOr(1), lt = m.getCrossfadeParameters(), ft = m.paint.get("fill-extrusion-opacity"), Qt = Y.constantOr(null);
for (const wt of v) {
const Mt = l.getTile(wt), Ht = Mt.getBucket(m);
if (!Ht)
continue;
const Ot = S.style.map.terrain && S.style.map.terrain.getTerrainData(wt), bt = Ht.programConfigurations.get(m.id), Nt = S.useProgram(J ? "fillExtrusionPattern" : "fillExtrusion", bt);
J && (S.context.activeTexture.set(j.TEXTURE0), Mt.imageAtlasTexture.bind(j.LINEAR, j.CLAMP_TO_EDGE), bt.updatePaintBuffers(lt)), us(bt, Z, Qt, Mt, m);
const Dt = S.translatePosMatrix(wt.posMatrix, Mt, m.paint.get("fill-extrusion-translate"), m.paint.get("fill-extrusion-translate-anchor")), Wt = m.paint.get("fill-extrusion-vertical-gradient"), he = J ? mt(Dt, S, Wt, ft, wt, lt, Mt) : ht(Dt, S, Wt, ft);
Nt.draw(D, D.gl.TRIANGLES, b, M, V, bn.backCCW, he, Ot, m.id, Ht.layoutVertexBuffer, Ht.indexBuffer, Ht.segments, m.paint, S.transform.zoom, bt, S.style.map.terrain && Ht.centroidVertexBuffer);
}
}
function Us(S, l, m, v, b, M, V) {
const D = S.context, j = D.gl, Z = m.fbo;
if (!Z)
return;
const Y = S.useProgram("hillshade"), J = S.style.map.terrain && S.style.map.terrain.getTerrainData(l);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, Z.colorAttachment.get()), Y.draw(D, j.TRIANGLES, b, M, V, bn.disabled, ((lt, ft, Qt, wt) => {
const Mt = Qt.paint.get("hillshade-shadow-color"), Ht = Qt.paint.get("hillshade-highlight-color"), Ot = Qt.paint.get("hillshade-accent-color");
let bt = Qt.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
Qt.paint.get("hillshade-illumination-anchor") === "viewport" && (bt -= lt.transform.angle);
const Nt = !lt.options.moving;
return { u_matrix: wt ? wt.posMatrix : lt.transform.calculatePosMatrix(ft.tileID.toUnwrapped(), Nt), u_image: 0, u_latrange: dr(0, ft.tileID), u_light: [Qt.paint.get("hillshade-exaggeration"), bt], u_shadow: Mt, u_highlight: Ht, u_accent: Ot };
})(S, m, v, J ? l : null), J, v.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments);
}
function t2(S, l, m, v, b, M) {
const V = S.context, D = V.gl, j = l.dem;
if (j && j.data) {
const Z = j.dim, Y = j.stride, J = j.getPixels();
if (V.activeTexture.set(D.TEXTURE1), V.pixelStoreUnpackPremultiplyAlpha.set(!1), l.demTexture = l.demTexture || S.getTileTexture(Y), l.demTexture) {
const ft = l.demTexture;
ft.update(J, { premultiply: !1 }), ft.bind(D.NEAREST, D.CLAMP_TO_EDGE);
} else
l.demTexture = new rt(V, J, D.RGBA, { premultiply: !1 }), l.demTexture.bind(D.NEAREST, D.CLAMP_TO_EDGE);
V.activeTexture.set(D.TEXTURE0);
let lt = l.fbo;
if (!lt) {
const ft = new rt(V, { width: Z, height: Z, data: null }, D.RGBA);
ft.bind(D.LINEAR, D.CLAMP_TO_EDGE), lt = l.fbo = V.createFramebuffer(Z, Z, !0, !1), lt.colorAttachment.set(ft.texture);
}
V.bindFramebuffer.set(lt.framebuffer), V.viewport.set([0, 0, Z, Z]), S.useProgram("hillshadePrepare").draw(V, D.TRIANGLES, v, b, M, bn.disabled, ((ft, Qt) => {
const wt = Qt.stride, Mt = a.H();
return a.aP(Mt, 0, a.X, -a.X, 0, 0, 1), a.J(Mt, Mt, [0, -a.X, 0]), { u_matrix: Mt, u_image: 1, u_dimension: [wt, wt], u_zoom: ft.overscaledZ, u_unpack: Qt.getUnpackVector() };
})(l.tileID, j), null, m.id, S.rasterBoundsBuffer, S.quadTriangleIndexBuffer, S.rasterBoundsSegments), l.needsHillshadePrepare = !1;
}
}
function O0(S, l, m, v, b, M) {
const V = v.paint.get("raster-fade-duration");
if (!M && V > 0) {
const D = f.now(), j = (D - S.timeAdded) / V, Z = l ? (D - l.timeAdded) / V : -1, Y = m.getSource(), J = b.coveringZoomLevel({ tileSize: Y.tileSize, roundZoom: Y.roundZoom }), lt = !l || Math.abs(l.tileID.overscaledZ - J) > Math.abs(S.tileID.overscaledZ - J), ft = lt && S.refreshedUponExpiration ? 1 : a.ac(lt ? j : 1 - Z, 0, 1);
return S.refreshedUponExpiration && j >= 1 && (S.refreshedUponExpiration = !1), l ? { opacity: 1, mix: 1 - ft } : { opacity: ft, mix: 0 };
}
return { opacity: 1, mix: 0 };
}
const C0 = new a.aM(1, 0, 0, 1), kt = new a.aM(0, 1, 0, 1), ne = new a.aM(0, 0, 1, 1), Fe = new a.aM(1, 0, 1, 1), Lr = new a.aM(0, 1, 1, 1);
function Ln(S, l, m, v) {
Jn(S, 0, l + m / 2, S.transform.width, m, v);
}
function rn(S, l, m, v) {
Jn(S, l - m / 2, 0, m, S.transform.height, v);
}
function Jn(S, l, m, v, b, M) {
const V = S.context, D = V.gl;
D.enable(D.SCISSOR_TEST), D.scissor(l * S.pixelRatio, m * S.pixelRatio, v * S.pixelRatio, b * S.pixelRatio), V.clear({ color: M }), D.disable(D.SCISSOR_TEST);
}
function wi(S, l, m) {
const v = S.context, b = v.gl, M = m.posMatrix, V = S.useProgram("debug"), D = $r.disabled, j = An.disabled, Z = S.colorModeForRenderPass(), Y = "$debug", J = S.style.map.terrain && S.style.map.terrain.getTerrainData(m);
v.activeTexture.set(b.TEXTURE0);
const lt = l.getTileByID(m.key).latestRawTileData, ft = Math.floor((lt && lt.byteLength || 0) / 1024), Qt = l.getTile(m).tileSize, wt = 512 / Math.min(Qt, 512) * (m.overscaledZ / S.transform.zoom) * 0.5;
let Mt = m.canonical.toString();
m.overscaledZ !== m.canonical.z && (Mt += ` => ${m.overscaledZ}`), function(Ht, Ot) {
Ht.initDebugOverlayCanvas();
const bt = Ht.debugOverlayCanvas, Nt = Ht.context.gl, Dt = Ht.debugOverlayCanvas.getContext("2d");
Dt.clearRect(0, 0, bt.width, bt.height), Dt.shadowColor = "white", Dt.shadowBlur = 2, Dt.lineWidth = 1.5, Dt.strokeStyle = "white", Dt.textBaseline = "top", Dt.font = "bold 36px Open Sans, sans-serif", Dt.fillText(Ot, 5, 5), Dt.strokeText(Ot, 5, 5), Ht.debugOverlayTexture.update(bt), Ht.debugOverlayTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}(S, `${Mt} ${ft}kB`), V.draw(v, b.TRIANGLES, D, j, Mn.alphaBlended, bn.disabled, kn(M, a.aM.transparent, wt), null, Y, S.debugBuffer, S.quadTriangleIndexBuffer, S.debugSegments), V.draw(v, b.LINE_STRIP, D, j, Z, bn.disabled, kn(M, a.aM.red), J, Y, S.debugBuffer, S.tileBorderIndexBuffer, S.debugSegments);
}
function To(S, l, m) {
const v = S.context, b = v.gl, M = S.colorModeForRenderPass(), V = new $r(b.LEQUAL, $r.ReadWrite, S.depthRangeFor3D), D = S.useProgram("terrain"), j = l.getTerrainMesh();
v.bindFramebuffer.set(null), v.viewport.set([0, 0, S.width, S.height]);
for (const Z of m) {
const Y = S.renderToTexture.getTexture(Z), J = l.getTerrainData(Z.tileID);
v.activeTexture.set(b.TEXTURE0), b.bindTexture(b.TEXTURE_2D, Y.texture);
const lt = S.transform.calculatePosMatrix(Z.tileID.toUnwrapped()), ft = l.getMeshFrameDelta(S.transform.zoom), Qt = S.transform.calculateFogMatrix(Z.tileID.toUnwrapped()), wt = G(lt, ft, Qt, S.style.sky, S.transform.pitch);
D.draw(v, b.TRIANGLES, V, An.disabled, M, bn.backCCW, wt, J, "terrain", j.vertexBuffer, j.indexBuffer, j.segments);
}
}
class gi {
constructor(l, m, v) {
this.vertexBuffer = l, this.indexBuffer = m, this.segments = v;
}
destroy() {
this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.vertexBuffer = null, this.indexBuffer = null, this.segments = null;
}
}
class yi {
constructor(l, m) {
this.context = new xc(l), this.transform = m, this._tileTextures = {}, this.terrainFacilitator = { dirty: !0, matrix: a.an(new Float64Array(16)), renderTime: 0 }, this.setup(), this.numSublayers = _r.maxUnderzooming + _r.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.crossTileSymbolIndex = new b2();
}
resize(l, m, v) {
if (this.width = Math.floor(l * v), this.height = Math.floor(m * v), this.pixelRatio = v, this.context.viewport.set([0, 0, this.width, this.height]), this.style)
for (const b of this.style._order)
this.style._layers[b].resize();
}
setup() {
const l = this.context, m = new a.aX();
m.emplaceBack(0, 0), m.emplaceBack(a.X, 0), m.emplaceBack(0, a.X), m.emplaceBack(a.X, a.X), this.tileExtentBuffer = l.createVertexBuffer(m, Xo.members), this.tileExtentSegments = a.a0.simpleSegment(0, 0, 4, 2);
const v = new a.aX();
v.emplaceBack(0, 0), v.emplaceBack(a.X, 0), v.emplaceBack(0, a.X), v.emplaceBack(a.X, a.X), this.debugBuffer = l.createVertexBuffer(v, Xo.members), this.debugSegments = a.a0.simpleSegment(0, 0, 4, 5);
const b = new a.$();
b.emplaceBack(0, 0, 0, 0), b.emplaceBack(a.X, 0, a.X, 0), b.emplaceBack(0, a.X, 0, a.X), b.emplaceBack(a.X, a.X, a.X, a.X), this.rasterBoundsBuffer = l.createVertexBuffer(b, ji.members), this.rasterBoundsSegments = a.a0.simpleSegment(0, 0, 4, 2);
const M = new a.aX();
M.emplaceBack(0, 0), M.emplaceBack(1, 0), M.emplaceBack(0, 1), M.emplaceBack(1, 1), this.viewportBuffer = l.createVertexBuffer(M, Xo.members), this.viewportSegments = a.a0.simpleSegment(0, 0, 4, 2);
const V = new a.aZ();
V.emplaceBack(0), V.emplaceBack(1), V.emplaceBack(3), V.emplaceBack(2), V.emplaceBack(0), this.tileBorderIndexBuffer = l.createIndexBuffer(V);
const D = new a.aY();
D.emplaceBack(0, 1, 2), D.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = l.createIndexBuffer(D);
const j = this.context.gl;
this.stencilClearMode = new An({ func: j.ALWAYS, mask: 0 }, 0, 255, j.ZERO, j.ZERO, j.ZERO);
}
clearStencil() {
const l = this.context, m = l.gl;
this.nextStencilID = 1, this.currentStencilSource = void 0;
const v = a.H();
a.aP(v, 0, this.width, this.height, 0, 0, 1), a.K(v, v, [m.drawingBufferWidth, m.drawingBufferHeight, 0]), this.useProgram("clippingMask").draw(l, m.TRIANGLES, $r.disabled, this.stencilClearMode, Mn.disabled, bn.disabled, xr(v), null, "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments);
}
_renderTileClippingMasks(l, m) {
if (this.currentStencilSource === l.source || !l.isTileClipped() || !m || !m.length)
return;
this.currentStencilSource = l.source;
const v = this.context, b = v.gl;
this.nextStencilID + m.length > 256 && this.clearStencil(), v.setColorMode(Mn.disabled), v.setDepthMode($r.disabled);
const M = this.useProgram("clippingMask");
this._tileClippingMaskIDs = {};
for (const V of m) {
const D = this._tileClippingMaskIDs[V.key] = this.nextStencilID++, j = this.style.map.terrain && this.style.map.terrain.getTerrainData(V);
M.draw(v, b.TRIANGLES, $r.disabled, new An({ func: b.ALWAYS, mask: 0 }, D, 255, b.KEEP, b.KEEP, b.REPLACE), Mn.disabled, bn.disabled, xr(V.posMatrix), j, "$clipping", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments);
}
}
stencilModeFor3D() {
this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil();
const l = this.nextStencilID++, m = this.context.gl;
return new An({ func: m.NOTEQUAL, mask: 255 }, l, 255, m.KEEP, m.KEEP, m.REPLACE);
}
stencilModeForClipping(l) {
const m = this.context.gl;
return new An({ func: m.EQUAL, mask: 255 }, this._tileClippingMaskIDs[l.key], 0, m.KEEP, m.KEEP, m.REPLACE);
}
stencilConfigForOverlap(l) {
const m = this.context.gl, v = l.sort((V, D) => D.overscaledZ - V.overscaledZ), b = v[v.length - 1].overscaledZ, M = v[0].overscaledZ - b + 1;
if (M > 1) {
this.currentStencilSource = void 0, this.nextStencilID + M > 256 && this.clearStencil();
const V = {};
for (let D = 0; D < M; D++)
V[D + b] = new An({ func: m.GEQUAL, mask: 255 }, D + this.nextStencilID, 255, m.KEEP, m.KEEP, m.REPLACE);
return this.nextStencilID += M, [V, v];
}
return [{ [b]: An.disabled }, v];
}
colorModeForRenderPass() {
const l = this.context.gl;
return this._showOverdrawInspector ? new Mn([l.CONSTANT_COLOR, l.ONE], new a.aM(0.125, 0.125, 0.125, 0), [!0, !0, !0, !0]) : this.renderPass === "opaque" ? Mn.unblended : Mn.alphaBlended;
}
depthModeForSublayer(l, m, v) {
if (!this.opaquePassEnabledForLayer())
return $r.disabled;
const b = 1 - ((1 + this.currentLayer) * this.numSublayers + l) * this.depthEpsilon;
return new $r(v || this.context.gl.LEQUAL, m, [b, b]);
}
opaquePassEnabledForLayer() {
return this.currentLayer < this.opaquePassCutoff;
}
render(l, m) {
this.style = l, this.options = m, this.lineAtlas = l.lineAtlas, this.imageManager = l.imageManager, this.glyphManager = l.glyphManager, this.symbolFadeChange = l.placement.symbolFadeChange(f.now()), this.imageManager.beginFrame();
const v = this.style._order, b = this.style.sourceCaches, M = {}, V = {}, D = {};
for (const j in b) {
const Z = b[j];
Z.used && Z.prepare(this.context), M[j] = Z.getVisibleCoordinates(), V[j] = M[j].slice().reverse(), D[j] = Z.getVisibleCoordinates(!0).reverse();
}
this.opaquePassCutoff = 1 / 0;
for (let j = 0; j < v.length; j++)
if (this.style._layers[v[j]].is3D()) {
this.opaquePassCutoff = j;
break;
}
this.maybeDrawDepthAndCoords(!1), this.renderToTexture && (this.renderToTexture.prepareForRender(this.style, this.transform.zoom), this.opaquePassCutoff = 0), this.renderPass = "offscreen";
for (const j of v) {
const Z = this.style._layers[j];
if (!Z.hasOffscreenPass() || Z.isHidden(this.transform.zoom))
continue;
const Y = V[Z.source];
(Z.type === "custom" || Y.length) && this.renderLayer(this, b[Z.source], Z, Y);
}
if (this.context.bindFramebuffer.set(null), this.context.clear({ color: m.showOverdrawInspector ? a.aM.black : a.aM.transparent, depth: 1 }), this.clearStencil(), this.style.sky && function(j, Z) {
const Y = j.context, J = Y.gl, lt = ((Ht, Ot, bt) => ({ u_sky_color: Ht.properties.get("sky-color"), u_horizon_color: Ht.properties.get("horizon-color"), u_horizon: (Ot.height / 2 + Ot.getHorizon()) * bt, u_sky_horizon_blend: Ht.properties.get("sky-horizon-blend") * Ot.height / 2 * bt }))(Z, j.style.map.transform, j.pixelRatio), ft = new $r(J.LEQUAL, $r.ReadWrite, [0, 1]), Qt = An.disabled, wt = j.colorModeForRenderPass(), Mt = j.useProgram("sky");
if (!Z.mesh) {
const Ht = new a.aX();
Ht.emplaceBack(-1, -1), Ht.emplaceBack(1, -1), Ht.emplaceBack(1, 1), Ht.emplaceBack(-1, 1);
const Ot = new a.aY();
Ot.emplaceBack(0, 1, 2), Ot.emplaceBack(0, 2, 3), Z.mesh = new gi(Y.createVertexBuffer(Ht, Xo.members), Y.createIndexBuffer(Ot), a.a0.simpleSegment(0, 0, Ht.length, Ot.length));
}
Mt.draw(Y, J.TRIANGLES, ft, Qt, wt, bn.disabled, lt, void 0, "sky", Z.mesh.vertexBuffer, Z.mesh.indexBuffer, Z.mesh.segments);
}(this, this.style.sky), this._showOverdrawInspector = m.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (l._order.length + 2) * this.numSublayers * this.depthEpsilon], !this.renderToTexture)
for (this.renderPass = "opaque", this.currentLayer = v.length - 1; this.currentLayer >= 0; this.currentLayer--) {
const j = this.style._layers[v[this.currentLayer]], Z = b[j.source], Y = M[j.source];
this._renderTileClippingMasks(j, Y), this.renderLayer(this, Z, j, Y);
}
for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < v.length; this.currentLayer++) {
const j = this.style._layers[v[this.currentLayer]], Z = b[j.source];
if (this.renderToTexture && this.renderToTexture.renderLayer(j))
continue;
const Y = (j.type === "symbol" ? D : V)[j.source];
this._renderTileClippingMasks(j, M[j.source]), this.renderLayer(this, Z, j, Y);
}
if (this.options.showTileBoundaries) {
const j = function(Z, Y) {
let J = null;
const lt = Object.values(Z._layers).flatMap((Mt) => Mt.source && !Mt.isHidden(Y) ? [Z.sourceCaches[Mt.source]] : []), ft = lt.filter((Mt) => Mt.getSource().type === "vector"), Qt = lt.filter((Mt) => Mt.getSource().type !== "vector"), wt = (Mt) => {
(!J || J.getSource().maxzoom < Mt.getSource().maxzoom) && (J = Mt);
};
return ft.forEach((Mt) => wt(Mt)), J || Qt.forEach((Mt) => wt(Mt)), J;
}(this.style, this.transform.zoom);
j && function(Z, Y, J) {
for (let lt = 0; lt < J.length; lt++)
wi(Z, Y, J[lt]);
}(this, j, j.getVisibleCoordinates());
}
this.options.showPadding && function(j) {
const Z = j.transform.padding;
Ln(j, j.transform.height - (Z.top || 0), 3, C0), Ln(j, Z.bottom || 0, 3, kt), rn(j, Z.left || 0, 3, ne), rn(j, j.transform.width - (Z.right || 0), 3, Fe);
const Y = j.transform.centerPoint;
(function(J, lt, ft, Qt) {
Jn(J, lt - 1, ft - 10, 2, 20, Qt), Jn(J, lt - 10, ft - 1, 20, 2, Qt);
})(j, Y.x, j.transform.height - Y.y, Lr);
}(this), this.context.setDefault();
}
maybeDrawDepthAndCoords(l) {
if (!this.style || !this.style.map || !this.style.map.terrain)
return;
const m = this.terrainFacilitator.matrix, v = this.transform.modelViewProjectionMatrix;
let b = this.terrainFacilitator.dirty;
b || (b = l ? !a.a_(m, v) : !a.a$(m, v)), b || (b = this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length > 0), b && (a.b0(m, v), this.terrainFacilitator.renderTime = Date.now(), this.terrainFacilitator.dirty = !1, function(M, V) {
const D = M.context, j = D.gl, Z = Mn.unblended, Y = new $r(j.LEQUAL, $r.ReadWrite, [0, 1]), J = V.getTerrainMesh(), lt = V.sourceCache.getRenderableTiles(), ft = M.useProgram("terrainDepth");
D.bindFramebuffer.set(V.getFramebuffer("depth").framebuffer), D.viewport.set([0, 0, M.width / devicePixelRatio, M.height / devicePixelRatio]), D.clear({ color: a.aM.transparent, depth: 1 });
for (const Qt of lt) {
const wt = V.getTerrainData(Qt.tileID), Mt = { u_matrix: M.transform.calculatePosMatrix(Qt.tileID.toUnwrapped()), u_ele_delta: V.getMeshFrameDelta(M.transform.zoom) };
ft.draw(D, j.TRIANGLES, Y, An.disabled, Z, bn.backCCW, Mt, wt, "terrain", J.vertexBuffer, J.indexBuffer, J.segments);
}
D.bindFramebuffer.set(null), D.viewport.set([0, 0, M.width, M.height]);
}(this, this.style.map.terrain), function(M, V) {
const D = M.context, j = D.gl, Z = Mn.unblended, Y = new $r(j.LEQUAL, $r.ReadWrite, [0, 1]), J = V.getTerrainMesh(), lt = V.getCoordsTexture(), ft = V.sourceCache.getRenderableTiles(), Qt = M.useProgram("terrainCoords");
D.bindFramebuffer.set(V.getFramebuffer("coords").framebuffer), D.viewport.set([0, 0, M.width / devicePixelRatio, M.height / devicePixelRatio]), D.clear({ color: a.aM.transparent, depth: 1 }), V.coordsIndex = [];
for (const wt of ft) {
const Mt = V.getTerrainData(wt.tileID);
D.activeTexture.set(j.TEXTURE0), j.bindTexture(j.TEXTURE_2D, lt.texture);
const Ht = { u_matrix: M.transform.calculatePosMatrix(wt.tileID.toUnwrapped()), u_terrain_coords_id: (255 - V.coordsIndex.length) / 255, u_texture: 0, u_ele_delta: V.getMeshFrameDelta(M.transform.zoom) };
Qt.draw(D, j.TRIANGLES, Y, An.disabled, Z, bn.backCCW, Ht, Mt, "terrain", J.vertexBuffer, J.indexBuffer, J.segments), V.coordsIndex.push(wt.tileID.key);
}
D.bindFramebuffer.set(null), D.viewport.set([0, 0, M.width, M.height]);
}(this, this.style.map.terrain));
}
renderLayer(l, m, v, b) {
if (!v.isHidden(this.transform.zoom) && (v.type === "background" || v.type === "custom" || (b || []).length))
switch (this.id = v.id, v.type) {
case "symbol":
(function(M, V, D, j, Z) {
if (M.renderPass !== "translucent")
return;
const Y = An.disabled, J = M.colorModeForRenderPass();
(D._unevaluatedLayout.hasValue("text-variable-anchor") || D._unevaluatedLayout.hasValue("text-variable-anchor-offset")) && function(lt, ft, Qt, wt, Mt, Ht, Ot, bt, Nt) {
const Dt = ft.transform, Wt = u1(), he = Mt === "map", we = Ht === "map";
for (const De of lt) {
const tr = wt.getTile(De), Oe = tr.getBucket(Qt);
if (!Oe || !Oe.text || !Oe.text.segments.get().length)
continue;
const Ae = a.ag(Oe.textSizeData, Dt.zoom), ur = Ar(tr, 1, ft.transform.zoom), Nr = Vi(De.posMatrix, we, he, ft.transform, ur), Pe = Qt.layout.get("icon-text-fit") !== "none" && Oe.hasIconData();
if (Ae) {
const We = Math.pow(2, Dt.zoom - tr.tileID.overscaledZ), kr = ft.style.map.terrain ? (Wr, nn) => ft.style.map.terrain.getElevation(De, Wr, nn) : null, ei = Wt.translatePosition(Dt, tr, Ot, bt);
Co(Oe, he, we, Nt, Dt, Nr, De.posMatrix, We, Ae, Pe, Wt, ei, De.toUnwrapped(), kr);
}
}
}(j, M, D, V, D.layout.get("text-rotation-alignment"), D.layout.get("text-pitch-alignment"), D.paint.get("text-translate"), D.paint.get("text-translate-anchor"), Z), D.paint.get("icon-opacity").constantOr(1) !== 0 && Jo(M, V, D, j, !1, D.paint.get("icon-translate"), D.paint.get("icon-translate-anchor"), D.layout.get("icon-rotation-alignment"), D.layout.get("icon-pitch-alignment"), D.layout.get("icon-keep-upright"), Y, J), D.paint.get("text-opacity").constantOr(1) !== 0 && Jo(M, V, D, j, !0, D.paint.get("text-translate"), D.paint.get("text-translate-anchor"), D.layout.get("text-rotation-alignment"), D.layout.get("text-pitch-alignment"), D.layout.get("text-keep-upright"), Y, J), V.map.showCollisionBoxes && (P3(M, V, D, j, !0), P3(M, V, D, j, !1));
})(l, m, v, b, this.style.placement.variableOffsets);
break;
case "circle":
(function(M, V, D, j) {
if (M.renderPass !== "translucent")
return;
const Z = D.paint.get("circle-opacity"), Y = D.paint.get("circle-stroke-width"), J = D.paint.get("circle-stroke-opacity"), lt = !D.layout.get("circle-sort-key").isConstant();
if (Z.constantOr(1) === 0 && (Y.constantOr(1) === 0 || J.constantOr(1) === 0))
return;
const ft = M.context, Qt = ft.gl, wt = M.depthModeForSublayer(0, $r.ReadOnly), Mt = An.disabled, Ht = M.colorModeForRenderPass(), Ot = [];
for (let bt = 0; bt < j.length; bt++) {
const Nt = j[bt], Dt = V.getTile(Nt), Wt = Dt.getBucket(D);
if (!Wt)
continue;
const he = Wt.programConfigurations.get(D.id), we = M.useProgram("circle", he), De = Wt.layoutVertexBuffer, tr = Wt.indexBuffer, Oe = M.style.map.terrain && M.style.map.terrain.getTerrainData(Nt), Ae = { programConfiguration: he, program: we, layoutVertexBuffer: De, indexBuffer: tr, uniformValues: be(M, Nt, Dt, D), terrainData: Oe };
if (lt) {
const ur = Wt.segments.get();
for (const Nr of ur)
Ot.push({ segments: new a.a0([Nr]), sortKey: Nr.sortKey, state: Ae });
} else
Ot.push({ segments: Wt.segments, sortKey: 0, state: Ae });
}
lt && Ot.sort((bt, Nt) => bt.sortKey - Nt.sortKey);
for (const bt of Ot) {
const { programConfiguration: Nt, program: Dt, layoutVertexBuffer: Wt, indexBuffer: he, uniformValues: we, terrainData: De } = bt.state;
Dt.draw(ft, Qt.TRIANGLES, wt, Mt, Ht, bn.disabled, we, De, D.id, Wt, he, bt.segments, D.paint, M.transform.zoom, Nt);
}
})(l, m, v, b);
break;
case "heatmap":
(function(M, V, D, j) {
if (D.paint.get("heatmap-opacity") === 0)
return;
const Z = M.context;
if (M.style.map.terrain) {
for (const Y of j) {
const J = V.getTile(Y);
V.hasRenderableParent(Y) || (M.renderPass === "offscreen" ? M2(M, J, D, Y) : M.renderPass === "translucent" && ls(M, D, Y));
}
Z.viewport.set([0, 0, M.width, M.height]);
} else
M.renderPass === "offscreen" ? function(Y, J, lt, ft) {
const Qt = Y.context, wt = Qt.gl, Mt = An.disabled, Ht = new Mn([wt.ONE, wt.ONE], a.aM.transparent, [!0, !0, !0, !0]);
(function(Ot, bt, Nt) {
const Dt = Ot.gl;
Ot.activeTexture.set(Dt.TEXTURE1), Ot.viewport.set([0, 0, bt.width / 4, bt.height / 4]);
let Wt = Nt.heatmapFbos.get(a.aU);
Wt ? (Dt.bindTexture(Dt.TEXTURE_2D, Wt.colorAttachment.get()), Ot.bindFramebuffer.set(Wt.framebuffer)) : (Wt = V3(Ot, bt.width / 4, bt.height / 4), Nt.heatmapFbos.set(a.aU, Wt));
})(Qt, Y, lt), Qt.clear({ color: a.aM.transparent });
for (let Ot = 0; Ot < ft.length; Ot++) {
const bt = ft[Ot];
if (J.hasRenderableParent(bt))
continue;
const Nt = J.getTile(bt), Dt = Nt.getBucket(lt);
if (!Dt)
continue;
const Wt = Dt.programConfigurations.get(lt.id), he = Y.useProgram("heatmap", Wt), { zoom: we } = Y.transform;
he.draw(Qt, wt.TRIANGLES, $r.disabled, Mt, Ht, bn.disabled, un(bt.posMatrix, Nt, we, lt.paint.get("heatmap-intensity")), null, lt.id, Dt.layoutVertexBuffer, Dt.indexBuffer, Dt.segments, lt.paint, Y.transform.zoom, Wt);
}
Qt.viewport.set([0, 0, Y.width, Y.height]);
}(M, V, D, j) : M.renderPass === "translucent" && function(Y, J) {
const lt = Y.context, ft = lt.gl;
lt.setColorMode(Y.colorModeForRenderPass());
const Qt = J.heatmapFbos.get(a.aU);
Qt && (lt.activeTexture.set(ft.TEXTURE0), ft.bindTexture(ft.TEXTURE_2D, Qt.colorAttachment.get()), lt.activeTexture.set(ft.TEXTURE1), cs(lt, J).bind(ft.LINEAR, ft.CLAMP_TO_EDGE), Y.useProgram("heatmapTexture").draw(lt, ft.TRIANGLES, $r.disabled, An.disabled, Y.colorModeForRenderPass(), bn.disabled, pe(Y, J, 0, 1), null, J.id, Y.viewportBuffer, Y.quadTriangleIndexBuffer, Y.viewportSegments, J.paint, Y.transform.zoom));
}(M, D);
})(l, m, v, b);
break;
case "line":
(function(M, V, D, j) {
if (M.renderPass !== "translucent")
return;
const Z = D.paint.get("line-opacity"), Y = D.paint.get("line-width");
if (Z.constantOr(1) === 0 || Y.constantOr(1) === 0)
return;
const J = M.depthModeForSublayer(0, $r.ReadOnly), lt = M.colorModeForRenderPass(), ft = D.paint.get("line-dasharray"), Qt = D.paint.get("line-pattern"), wt = Qt.constantOr(1), Mt = D.paint.get("line-gradient"), Ht = D.getCrossfadeParameters(), Ot = wt ? "linePattern" : ft ? "lineSDF" : Mt ? "lineGradient" : "line", bt = M.context, Nt = bt.gl;
let Dt = !0;
for (const Wt of j) {
const he = V.getTile(Wt);
if (wt && !he.patternsLoaded())
continue;
const we = he.getBucket(D);
if (!we)
continue;
const De = we.programConfigurations.get(D.id), tr = M.context.program.get(), Oe = M.useProgram(Ot, De), Ae = Dt || Oe.program !== tr, ur = M.style.map.terrain && M.style.map.terrain.getTerrainData(Wt), Nr = Qt.constantOr(null);
if (Nr && he.imageAtlas) {
const kr = he.imageAtlas, ei = kr.patternPositions[Nr.to.toString()], Wr = kr.patternPositions[Nr.from.toString()];
ei && Wr && De.setConstantPatternPositions(ei, Wr);
}
const Pe = ur ? Wt : null, We = wt ? zn(M, he, D, Ht, Pe) : ft ? b0(M, he, D, ft, Ht, Pe) : Mt ? Ni(M, he, D, we.lineClipsArray.length, Pe) : Tn(M, he, D, Pe);
if (wt)
bt.activeTexture.set(Nt.TEXTURE0), he.imageAtlasTexture.bind(Nt.LINEAR, Nt.CLAMP_TO_EDGE), De.updatePaintBuffers(Ht);
else if (ft && (Ae || M.lineAtlas.dirty))
bt.activeTexture.set(Nt.TEXTURE0), M.lineAtlas.bind(bt);
else if (Mt) {
const kr = we.gradients[D.id];
let ei = kr.texture;
if (D.gradientVersion !== kr.version) {
let Wr = 256;
if (D.stepInterpolant) {
const nn = V.getSource().maxzoom, ri = Wt.canonical.z === nn ? Math.ceil(1 << M.transform.maxZoom - Wt.canonical.z) : 1;
Wr = a.ac(a.aV(we.maxLineLength / a.X * 1024 * ri), 256, bt.maxTextureSize);
}
kr.gradient = a.aW({ expression: D.gradientExpression(), evaluationKey: "lineProgress", resolution: Wr, image: kr.gradient || void 0, clips: we.lineClipsArray }), kr.texture ? kr.texture.update(kr.gradient) : kr.texture = new rt(bt, kr.gradient, Nt.RGBA), kr.version = D.gradientVersion, ei = kr.texture;
}
bt.activeTexture.set(Nt.TEXTURE0), ei.bind(D.stepInterpolant ? Nt.NEAREST : Nt.LINEAR, Nt.CLAMP_TO_EDGE);
}
Oe.draw(bt, Nt.TRIANGLES, J, M.stencilModeForClipping(Wt), lt, bn.disabled, We, ur, D.id, we.layoutVertexBuffer, we.indexBuffer, we.segments, D.paint, M.transform.zoom, De, we.layoutVertexBuffer2), Dt = !1;
}
})(l, m, v, b);
break;
case "fill":
(function(M, V, D, j) {
const Z = D.paint.get("fill-color"), Y = D.paint.get("fill-opacity");
if (Y.constantOr(1) === 0)
return;
const J = M.colorModeForRenderPass(), lt = D.paint.get("fill-pattern"), ft = M.opaquePassEnabledForLayer() && !lt.constantOr(1) && Z.constantOr(a.aM.transparent).a === 1 && Y.constantOr(0) === 1 ? "opaque" : "translucent";
if (M.renderPass === ft) {
const Qt = M.depthModeForSublayer(1, M.renderPass === "opaque" ? $r.ReadWrite : $r.ReadOnly);
La(M, V, D, j, Qt, J, !1);
}
if (M.renderPass === "translucent" && D.paint.get("fill-antialias")) {
const Qt = M.depthModeForSublayer(D.getPaintProperty("fill-outline-color") ? 2 : 0, $r.ReadOnly);
La(M, V, D, j, Qt, J, !0);
}
})(l, m, v, b);
break;
case "fill-extrusion":
(function(M, V, D, j) {
const Z = D.paint.get("fill-extrusion-opacity");
if (Z !== 0 && M.renderPass === "translucent") {
const Y = new $r(M.context.gl.LEQUAL, $r.ReadWrite, M.depthRangeFor3D);
if (Z !== 1 || D.paint.get("fill-extrusion-pattern").constantOr(1))
R3(M, V, D, j, Y, An.disabled, Mn.disabled), R3(M, V, D, j, Y, M.stencilModeFor3D(), M.colorModeForRenderPass());
else {
const J = M.colorModeForRenderPass();
R3(M, V, D, j, Y, An.disabled, J);
}
}
})(l, m, v, b);
break;
case "hillshade":
(function(M, V, D, j) {
if (M.renderPass !== "offscreen" && M.renderPass !== "translucent")
return;
const Z = M.context, Y = M.depthModeForSublayer(0, $r.ReadOnly), J = M.colorModeForRenderPass(), [lt, ft] = M.renderPass === "translucent" ? M.stencilConfigForOverlap(j) : [{}, j];
for (const Qt of ft) {
const wt = V.getTile(Qt);
wt.needsHillshadePrepare !== void 0 && wt.needsHillshadePrepare && M.renderPass === "offscreen" ? t2(M, wt, D, Y, An.disabled, J) : M.renderPass === "translucent" && Us(M, Qt, wt, D, Y, lt[Qt.overscaledZ], J);
}
Z.viewport.set([0, 0, M.width, M.height]);
})(l, m, v, b);
break;
case "raster":
(function(M, V, D, j) {
if (M.renderPass !== "translucent" || D.paint.get("raster-opacity") === 0 || !j.length)
return;
const Z = M.context, Y = Z.gl, J = V.getSource(), lt = M.useProgram("raster"), ft = M.colorModeForRenderPass(), [Qt, wt] = J instanceof Ji ? [{}, j] : M.stencilConfigForOverlap(j), Mt = wt[wt.length - 1].overscaledZ, Ht = !M.options.moving;
for (const Ot of wt) {
const bt = M.depthModeForSublayer(Ot.overscaledZ - Mt, D.paint.get("raster-opacity") === 1 ? $r.ReadWrite : $r.ReadOnly, Y.LESS), Nt = V.getTile(Ot);
Nt.registerFadeDuration(D.paint.get("raster-fade-duration"));
const Dt = V.findLoadedParent(Ot, 0), Wt = V.findLoadedSibling(Ot), he = O0(Nt, Dt || Wt || null, V, D, M.transform, M.style.map.terrain);
let we, De;
const tr = D.paint.get("raster-resampling") === "nearest" ? Y.NEAREST : Y.LINEAR;
Z.activeTexture.set(Y.TEXTURE0), Nt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), Z.activeTexture.set(Y.TEXTURE1), Dt ? (Dt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), we = Math.pow(2, Dt.tileID.overscaledZ - Nt.tileID.overscaledZ), De = [Nt.tileID.canonical.x * we % 1, Nt.tileID.canonical.y * we % 1]) : Nt.texture.bind(tr, Y.CLAMP_TO_EDGE, Y.LINEAR_MIPMAP_NEAREST), Nt.texture.useMipmap && Z.extTextureFilterAnisotropic && M.transform.pitch > 20 && Y.texParameterf(Y.TEXTURE_2D, Z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, Z.extTextureFilterAnisotropicMax);
const Oe = M.style.map.terrain && M.style.map.terrain.getTerrainData(Ot), Ae = Oe ? Ot : null, ur = Ae ? Ae.posMatrix : M.transform.calculatePosMatrix(Ot.toUnwrapped(), Ht), Nr = bl(ur, De || [0, 0], we || 1, he, D);
J instanceof Ji ? lt.draw(Z, Y.TRIANGLES, bt, An.disabled, ft, bn.disabled, Nr, Oe, D.id, J.boundsBuffer, M.quadTriangleIndexBuffer, J.boundsSegments) : lt.draw(Z, Y.TRIANGLES, bt, Qt[Ot.overscaledZ], ft, bn.disabled, Nr, Oe, D.id, M.rasterBoundsBuffer, M.quadTriangleIndexBuffer, M.rasterBoundsSegments);
}
})(l, m, v, b);
break;
case "background":
(function(M, V, D, j) {
const Z = D.paint.get("background-color"), Y = D.paint.get("background-opacity");
if (Y === 0)
return;
const J = M.context, lt = J.gl, ft = M.transform, Qt = ft.tileSize, wt = D.paint.get("background-pattern");
if (M.isPatternMissing(wt))
return;
const Mt = !wt && Z.a === 1 && Y === 1 && M.opaquePassEnabledForLayer() ? "opaque" : "translucent";
if (M.renderPass !== Mt)
return;
const Ht = An.disabled, Ot = M.depthModeForSublayer(0, Mt === "opaque" ? $r.ReadWrite : $r.ReadOnly), bt = M.colorModeForRenderPass(), Nt = M.useProgram(wt ? "backgroundPattern" : "background"), Dt = j || ft.coveringTiles({ tileSize: Qt, terrain: M.style.map.terrain });
wt && (J.activeTexture.set(lt.TEXTURE0), M.imageManager.bind(M.context));
const Wt = D.getCrossfadeParameters();
for (const he of Dt) {
const we = j ? he.posMatrix : M.transform.calculatePosMatrix(he.toUnwrapped()), De = wt ? O3(we, Y, M, wt, { tileID: he, tileSize: Qt }, Wt) : A3(we, Y, Z), tr = M.style.map.terrain && M.style.map.terrain.getTerrainData(he);
Nt.draw(J, lt.TRIANGLES, Ot, Ht, bt, bn.disabled, De, tr, D.id, M.tileExtentBuffer, M.quadTriangleIndexBuffer, M.tileExtentSegments);
}
})(l, 0, v, b);
break;
case "custom":
(function(M, V, D) {
const j = M.context, Z = D.implementation;
if (M.renderPass === "offscreen") {
const Y = Z.prerender;
Y && (M.setCustomLayerDefaults(), j.setColorMode(M.colorModeForRenderPass()), Y.call(Z, j.gl, M.transform.customLayerMatrix()), j.setDirty(), M.setBaseState());
} else if (M.renderPass === "translucent") {
M.setCustomLayerDefaults(), j.setColorMode(M.colorModeForRenderPass()), j.setStencilMode(An.disabled);
const Y = Z.renderingMode === "3d" ? new $r(M.context.gl.LEQUAL, $r.ReadWrite, M.depthRangeFor3D) : M.depthModeForSublayer(0, $r.ReadOnly);
j.setDepthMode(Y), Z.render(j.gl, M.transform.customLayerMatrix(), { farZ: M.transform.farZ, nearZ: M.transform.nearZ, fov: M.transform._fov, modelViewProjectionMatrix: M.transform.modelViewProjectionMatrix, projectionMatrix: M.transform.projectionMatrix }), j.setDirty(), M.setBaseState(), j.bindFramebuffer.set(null);
}
})(l, 0, v);
}
}
translatePosMatrix(l, m, v, b, M) {
if (!v[0] && !v[1])
return l;
const V = M ? b === "map" ? this.transform.angle : 0 : b === "viewport" ? -this.transform.angle : 0;
if (V) {
const Z = Math.sin(V), Y = Math.cos(V);
v = [v[0] * Y - v[1] * Z, v[0] * Z + v[1] * Y];
}
const D = [M ? v[0] : Ar(m, v[0], this.transform.zoom), M ? v[1] : Ar(m, v[1], this.transform.zoom), 0], j = new Float32Array(16);
return a.J(j, l, D), j;
}
saveTileTexture(l) {
const m = this._tileTextures[l.size[0]];
m ? m.push(l) : this._tileTextures[l.size[0]] = [l];
}
getTileTexture(l) {
const m = this._tileTextures[l];
return m && m.length > 0 ? m.pop() : null;
}
isPatternMissing(l) {
if (!l)
return !1;
if (!l.from || !l.to)
return !0;
const m = this.imageManager.getPattern(l.from.toString()), v = this.imageManager.getPattern(l.to.toString());
return !m || !v;
}
useProgram(l, m) {
this.cache = this.cache || {};
const v = l + (m ? m.cacheKey : "") + (this._showOverdrawInspector ? "/overdraw" : "") + (this.style.map.terrain ? "/terrain" : "");
return this.cache[v] || (this.cache[v] = new q(this.context, ho[l], m, F4[l], this._showOverdrawInspector, this.style.map.terrain)), this.cache[v];
}
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 l = this.context.gl;
this.context.cullFace.set(!1), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(l.FUNC_ADD);
}
initDebugOverlayCanvas() {
this.debugOverlayCanvas == null && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new rt(this.context, this.debugOverlayCanvas, this.context.gl.RGBA));
}
destroy() {
this.debugOverlayTexture && this.debugOverlayTexture.destroy();
}
overLimit() {
const { drawingBufferWidth: l, drawingBufferHeight: m } = this.context.gl;
return this.width !== l || this.height !== m;
}
}
class _1 {
constructor(l, m) {
this.points = l, this.planes = m;
}
static fromInvProjectionMatrix(l, m, v) {
const b = Math.pow(2, v), M = [[-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((D) => {
const j = 1 / (D = a.af([], D, l))[3] / m * b;
return a.b1(D, D, [j, j, 1 / D[3], j]);
}), V = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((D) => {
const j = function(lt, ft) {
var Qt = ft[0], wt = ft[1], Mt = ft[2], Ht = Qt * Qt + wt * wt + Mt * Mt;
return Ht > 0 && (Ht = 1 / Math.sqrt(Ht)), lt[0] = ft[0] * Ht, lt[1] = ft[1] * Ht, lt[2] = ft[2] * Ht, lt;
}([], function(lt, ft, Qt) {
var wt = ft[0], Mt = ft[1], Ht = ft[2], Ot = Qt[0], bt = Qt[1], Nt = Qt[2];
return lt[0] = Mt * Nt - Ht * bt, lt[1] = Ht * Ot - wt * Nt, lt[2] = wt * bt - Mt * Ot, lt;
}([], $([], M[D[0]], M[D[1]]), $([], M[D[2]], M[D[1]]))), Z = -((Y = j)[0] * (J = M[D[1]])[0] + Y[1] * J[1] + Y[2] * J[2]);
var Y, J;
return j.concat(Z);
});
return new _1(M, V);
}
}
class A1 {
constructor(l, m) {
this.min = l, this.max = m, this.center = function(v, b, M) {
return v[0] = 0.5 * b[0], v[1] = 0.5 * b[1], v[2] = 0.5 * b[2], v;
}([], function(v, b, M) {
return v[0] = b[0] + M[0], v[1] = b[1] + M[1], v[2] = b[2] + M[2], v;
}([], this.min, this.max));
}
quadrant(l) {
const m = [l % 2 == 0, l < 2], v = F(this.min), b = F(this.max);
for (let M = 0; M < m.length; M++)
v[M] = m[M] ? this.min[M] : this.center[M], b[M] = m[M] ? this.center[M] : this.max[M];
return b[2] = this.max[2], new A1(v, b);
}
distanceX(l) {
return Math.max(Math.min(this.max[0], l[0]), this.min[0]) - l[0];
}
distanceY(l) {
return Math.max(Math.min(this.max[1], l[1]), this.min[1]) - l[1];
}
intersects(l) {
const m = [[this.min[0], this.min[1], this.min[2], 1], [this.max[0], this.min[1], this.min[2], 1], [this.max[0], this.max[1], this.min[2], 1], [this.min[0], this.max[1], this.min[2], 1], [this.min[0], this.min[1], this.max[2], 1], [this.max[0], this.min[1], this.max[2], 1], [this.max[0], this.max[1], this.max[2], 1], [this.min[0], this.max[1], this.max[2], 1]];
let v = !0;
for (let b = 0; b < l.planes.length; b++) {
const M = l.planes[b];
let V = 0;
for (let D = 0; D < m.length; D++)
a.b2(M, m[D]) >= 0 && V++;
if (V === 0)
return 0;
V !== m.length && (v = !1);
}
if (v)
return 2;
for (let b = 0; b < 3; b++) {
let M = Number.MAX_VALUE, V = -Number.MAX_VALUE;
for (let D = 0; D < l.points.length; D++) {
const j = l.points[D][b] - this.min[b];
M = Math.min(M, j), V = Math.max(V, j);
}
if (V < 0 || M > this.max[b] - this.min[b])
return 0;
}
return 1;
}
}
class Ai {
constructor(l = 0, m = 0, v = 0, b = 0) {
if (isNaN(l) || l < 0 || isNaN(m) || m < 0 || isNaN(v) || v < 0 || isNaN(b) || b < 0)
throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
this.top = l, this.bottom = m, this.left = v, this.right = b;
}
interpolate(l, m, v) {
return m.top != null && l.top != null && (this.top = a.y.number(l.top, m.top, v)), m.bottom != null && l.bottom != null && (this.bottom = a.y.number(l.bottom, m.bottom, v)), m.left != null && l.left != null && (this.left = a.y.number(l.left, m.left, v)), m.right != null && l.right != null && (this.right = a.y.number(l.right, m.right, v)), this;
}
getCenter(l, m) {
const v = a.ac((this.left + l - this.right) / 2, 0, l), b = a.ac((this.top + m - this.bottom) / 2, 0, m);
return new a.P(v, b);
}
equals(l) {
return this.top === l.top && this.bottom === l.bottom && this.left === l.left && this.right === l.right;
}
clone() {
return new Ai(this.top, this.bottom, this.left, this.right);
}
toJSON() {
return { top: this.top, bottom: this.bottom, left: this.left, right: this.right };
}
}
const ko = 85.051129;
class Io {
constructor(l, m, v, b, M) {
this.tileSize = 512, this._renderWorldCopies = M === void 0 || !!M, this._minZoom = l || 0, this._maxZoom = m || 22, this._minPitch = v ?? 0, this._maxPitch = b ?? 60, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new a.N(0, 0), this._elevation = 0, this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._unmodified = !0, this._edgeInsets = new Ai(), this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {}, this.minElevationForCurrentTile = 0;
}
clone() {
const l = new Io(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies);
return l.apply(this), l;
}
apply(l) {
this.tileSize = l.tileSize, this.latRange = l.latRange, this.lngRange = l.lngRange, this.width = l.width, this.height = l.height, this._center = l._center, this._elevation = l._elevation, this.minElevationForCurrentTile = l.minElevationForCurrentTile, this.zoom = l.zoom, this.angle = l.angle, this._fov = l._fov, this._pitch = l._pitch, this._unmodified = l._unmodified, this._edgeInsets = l._edgeInsets.clone(), this._calcMatrices();
}
get minZoom() {
return this._minZoom;
}
set minZoom(l) {
this._minZoom !== l && (this._minZoom = l, this.zoom = Math.max(this.zoom, l));
}
get maxZoom() {
return this._maxZoom;
}
set maxZoom(l) {
this._maxZoom !== l && (this._maxZoom = l, this.zoom = Math.min(this.zoom, l));
}
get minPitch() {
return this._minPitch;
}
set minPitch(l) {
this._minPitch !== l && (this._minPitch = l, this.pitch = Math.max(this.pitch, l));
}
get maxPitch() {
return this._maxPitch;
}
set maxPitch(l) {
this._maxPitch !== l && (this._maxPitch = l, this.pitch = Math.min(this.pitch, l));
}
get renderWorldCopies() {
return this._renderWorldCopies;
}
set renderWorldCopies(l) {
l === void 0 ? l = !0 : l === null && (l = !1), this._renderWorldCopies = l;
}
get worldSize() {
return this.tileSize * this.scale;
}
get centerOffset() {
return this.centerPoint._sub(this.size._div(2));
}
get size() {
return new a.P(this.width, this.height);
}
get bearing() {
return -this.angle / Math.PI * 180;
}
set bearing(l) {
const m = -a.b3(l, -180, 180) * Math.PI / 180;
this.angle !== m && (this._unmodified = !1, this.angle = m, this._calcMatrices(), this.rotationMatrix = function() {
var v = new a.A(4);
return a.A != Float32Array && (v[1] = 0, v[2] = 0), v[0] = 1, v[3] = 1, v;
}(), function(v, b, M) {
var V = b[0], D = b[1], j = b[2], Z = b[3], Y = Math.sin(M), J = Math.cos(M);
v[0] = V * J + j * Y, v[1] = D * J + Z * Y, v[2] = V * -Y + j * J, v[3] = D * -Y + Z * J;
}(this.rotationMatrix, this.rotationMatrix, this.angle));
}
get pitch() {
return this._pitch / Math.PI * 180;
}
set pitch(l) {
const m = a.ac(l, this.minPitch, this.maxPitch) / 180 * Math.PI;
this._pitch !== m && (this._unmodified = !1, this._pitch = m, this._calcMatrices());
}
get fov() {
return this._fov / Math.PI * 180;
}
set fov(l) {
l = Math.max(0.01, Math.min(60, l)), this._fov !== l && (this._unmodified = !1, this._fov = l / 180 * Math.PI, this._calcMatrices());
}
get zoom() {
return this._zoom;
}
set zoom(l) {
const m = Math.min(Math.max(l, this.minZoom), this.maxZoom);
this._zoom !== m && (this._unmodified = !1, this._zoom = m, this.tileZoom = Math.max(0, Math.floor(m)), this.scale = this.zoomScale(m), this._constrain(), this._calcMatrices());
}
get center() {
return this._center;
}
set center(l) {
l.lat === this._center.lat && l.lng === this._center.lng || (this._unmodified = !1, this._center = l, this._constrain(), this._calcMatrices());
}
get elevation() {
return this._elevation;
}
set elevation(l) {
l !== this._elevation && (this._elevation = l, this._constrain(), this._calcMatrices());
}
get padding() {
return this._edgeInsets.toJSON();
}
set padding(l) {
this._edgeInsets.equals(l) || (this._unmodified = !1, this._edgeInsets.interpolate(this._edgeInsets, l, 1), this._calcMatrices());
}
get centerPoint() {
return this._edgeInsets.getCenter(this.width, this.height);
}
isPaddingEqual(l) {
return this._edgeInsets.equals(l);
}
interpolatePadding(l, m, v) {
this._unmodified = !1, this._edgeInsets.interpolate(l, m, v), this._constrain(), this._calcMatrices();
}
coveringZoomLevel(l) {
const m = (l.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / l.tileSize));
return Math.max(0, m);
}
getVisibleUnwrappedCoordinates(l) {
const m = [new a.b4(0, l)];
if (this._renderWorldCopies) {
const v = this.pointCoordinate(new a.P(0, 0)), b = this.pointCoordinate(new a.P(this.width, 0)), M = this.pointCoordinate(new a.P(this.width, this.height)), V = this.pointCoordinate(new a.P(0, this.height)), D = Math.floor(Math.min(v.x, b.x, M.x, V.x)), j = Math.floor(Math.max(v.x, b.x, M.x, V.x)), Z = 1;
for (let Y = D - Z; Y <= j + Z; Y++)
Y !== 0 && m.push(new a.b4(Y, l));
}
return m;
}
coveringTiles(l) {
var m, v;
let b = this.coveringZoomLevel(l);
const M = b;
if (l.minzoom !== void 0 && b < l.minzoom)
return [];
l.maxzoom !== void 0 && b > l.maxzoom && (b = l.maxzoom);
const V = this.pointCoordinate(this.getCameraPoint()), D = a.Z.fromLngLat(this.center), j = Math.pow(2, b), Z = [j * V.x, j * V.y, 0], Y = [j * D.x, j * D.y, 0], J = _1.fromInvProjectionMatrix(this.invModelViewProjectionMatrix, this.worldSize, b);
let lt = l.minzoom || 0;
!l.terrain && this.pitch <= 60 && this._edgeInsets.top < 0.1 && (lt = b);
const ft = l.terrain ? 2 / Math.min(this.tileSize, l.tileSize) * this.tileSize : 3, Qt = (bt) => ({ aabb: new A1([bt * j, 0, 0], [(bt + 1) * j, j, 0]), zoom: 0, x: 0, y: 0, wrap: bt, fullyVisible: !1 }), wt = [], Mt = [], Ht = b, Ot = l.reparseOverscaled ? M : b;
if (this._renderWorldCopies)
for (let bt = 1; bt <= 3; bt++)
wt.push(Qt(-bt)), wt.push(Qt(bt));
for (wt.push(Qt(0)); wt.length > 0; ) {
const bt = wt.pop(), Nt = bt.x, Dt = bt.y;
let Wt = bt.fullyVisible;
if (!Wt) {
const Oe = bt.aabb.intersects(J);
if (Oe === 0)
continue;
Wt = Oe === 2;
}
const he = l.terrain ? Z : Y, we = bt.aabb.distanceX(he), De = bt.aabb.distanceY(he), tr = Math.max(Math.abs(we), Math.abs(De));
if (bt.zoom === Ht || tr > ft + (1 << Ht - bt.zoom) - 2 && bt.zoom >= lt) {
const Oe = Ht - bt.zoom, Ae = Z[0] - 0.5 - (Nt << Oe), ur = Z[1] - 0.5 - (Dt << Oe);
Mt.push({ tileID: new a.S(bt.zoom === Ht ? Ot : bt.zoom, bt.wrap, bt.zoom, Nt, Dt), distanceSq: et([Y[0] - 0.5 - Nt, Y[1] - 0.5 - Dt]), tileDistanceToCamera: Math.sqrt(Ae * Ae + ur * ur) });
} else
for (let Oe = 0; Oe < 4; Oe++) {
const Ae = (Nt << 1) + Oe % 2, ur = (Dt << 1) + (Oe >> 1), Nr = bt.zoom + 1;
let Pe = bt.aabb.quadrant(Oe);
if (l.terrain) {
const We = new a.S(Nr, bt.wrap, Nr, Ae, ur), kr = l.terrain.getMinMaxElevation(We), ei = (m = kr.minElevation) !== null && m !== void 0 ? m : this.elevation, Wr = (v = kr.maxElevation) !== null && v !== void 0 ? v : this.elevation;
Pe = new A1([Pe.min[0], Pe.min[1], ei], [Pe.max[0], Pe.max[1], Wr]);
}
wt.push({ aabb: Pe, zoom: Nr, x: Ae, y: ur, wrap: bt.wrap, fullyVisible: Wt });
}
}
return Mt.sort((bt, Nt) => bt.distanceSq - Nt.distanceSq).map((bt) => bt.tileID);
}
resize(l, m) {
this.width = l, this.height = m, this.pixelsToGLUnits = [2 / l, -2 / m], this._constrain(), this._calcMatrices();
}
get unmodified() {
return this._unmodified;
}
zoomScale(l) {
return Math.pow(2, l);
}
scaleZoom(l) {
return Math.log(l) / Math.LN2;
}
project(l) {
const m = a.ac(l.lat, -85.051129, ko);
return new a.P(a.O(l.lng) * this.worldSize, a.Q(m) * this.worldSize);
}
unproject(l) {
return new a.Z(l.x / this.worldSize, l.y / this.worldSize).toLngLat();
}
get point() {
return this.project(this.center);
}
getCameraPosition() {
return { lngLat: this.pointLocation(this.getCameraPoint()), altitude: Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter + this.elevation };
}
recalculateZoom(l) {
const m = this.elevation, v = Math.cos(this._pitch) * this.cameraToCenterDistance / this._pixelPerMeter, b = this.pointLocation(this.centerPoint, l), M = l.getElevationForLngLatZoom(b, this.tileZoom);
if (!(this.elevation - M))
return;
const V = v + m - M, D = Math.cos(this._pitch) * this.cameraToCenterDistance / V / a.b5(1, b.lat), j = this.scaleZoom(D / this.tileSize);
this._elevation = M, this._center = b, this.zoom = j;
}
setLocationAtPoint(l, m) {
const v = this.pointCoordinate(m), b = this.pointCoordinate(this.centerPoint), M = this.locationCoordinate(l), V = new a.Z(M.x - (v.x - b.x), M.y - (v.y - b.y));
this.center = this.coordinateLocation(V), this._renderWorldCopies && (this.center = this.center.wrap());
}
locationPoint(l, m) {
return m ? this.coordinatePoint(this.locationCoordinate(l), m.getElevationForLngLatZoom(l, this.tileZoom), this.pixelMatrix3D) : this.coordinatePoint(this.locationCoordinate(l));
}
pointLocation(l, m) {
return this.coordinateLocation(this.pointCoordinate(l, m));
}
locationCoordinate(l) {
return a.Z.fromLngLat(l);
}
coordinateLocation(l) {
return l && l.toLngLat();
}
pointCoordinate(l, m) {
if (m) {
const lt = m.pointCoordinate(l);
if (lt != null)
return lt;
}
const v = [l.x, l.y, 0, 1], b = [l.x, l.y, 1, 1];
a.af(v, v, this.pixelMatrixInverse), a.af(b, b, this.pixelMatrixInverse);
const M = v[3], V = b[3], D = v[1] / M, j = b[1] / V, Z = v[2] / M, Y = b[2] / V, J = Z === Y ? 0 : (0 - Z) / (Y - Z);
return new a.Z(a.y.number(v[0] / M, b[0] / V, J) / this.worldSize, a.y.number(D, j, J) / this.worldSize);
}
coordinatePoint(l, m = 0, v = this.pixelMatrix) {
const b = [l.x * this.worldSize, l.y * this.worldSize, m, 1];
return a.af(b, b, v), new a.P(b[0] / b[3], b[1] / b[3]);
}
getBounds() {
const l = Math.max(0, this.height / 2 - this.getHorizon());
return new Ct().extend(this.pointLocation(new a.P(0, l))).extend(this.pointLocation(new a.P(this.width, l))).extend(this.pointLocation(new a.P(this.width, this.height))).extend(this.pointLocation(new a.P(0, this.height)));
}
getMaxBounds() {
return this.latRange && this.latRange.length === 2 && this.lngRange && this.lngRange.length === 2 ? new Ct([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]) : null;
}
getHorizon() {
return Math.tan(Math.PI / 2 - this._pitch) * this.cameraToCenterDistance * 0.85;
}
setMaxBounds(l) {
l ? (this.lngRange = [l.getWest(), l.getEast()], this.latRange = [l.getSouth(), l.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-85.051129, ko]);
}
calculateTileMatrix(l) {
const m = l.canonical, v = this.worldSize / this.zoomScale(m.z), b = m.x + Math.pow(2, m.z) * l.wrap, M = a.an(new Float64Array(16));
return a.J(M, M, [b * v, m.y * v, 0]), a.K(M, M, [v / a.X, v / a.X, 1]), M;
}
calculatePosMatrix(l, m = !1) {
const v = l.key, b = m ? this._alignedPosMatrixCache : this._posMatrixCache;
if (b[v])
return b[v];
const M = this.calculateTileMatrix(l);
return a.L(M, m ? this.alignedModelViewProjectionMatrix : this.modelViewProjectionMatrix, M), b[v] = new Float32Array(M), b[v];
}
calculateFogMatrix(l) {
const m = l.key, v = this._fogMatrixCache;
if (v[m])
return v[m];
const b = this.calculateTileMatrix(l);
return a.L(b, this.fogMatrix, b), v[m] = new Float32Array(b), v[m];
}
customLayerMatrix() {
return this.mercatorMatrix.slice();
}
getConstrained(l, m) {
m = a.ac(+m, this.minZoom, this.maxZoom);
const v = { center: new a.N(l.lng, l.lat), zoom: m };
let b = this.lngRange;
if (!this._renderWorldCopies && b === null) {
const bt = 179.9999999999;
b = [-bt, bt];
}
const M = this.tileSize * this.zoomScale(v.zoom);
let V = 0, D = M, j = 0, Z = M, Y = 0, J = 0;
const { x: lt, y: ft } = this.size;
if (this.latRange) {
const bt = this.latRange;
V = a.Q(bt[1]) * M, D = a.Q(bt[0]) * M, D - V < ft && (Y = ft / (D - V));
}
b && (j = a.b3(a.O(b[0]) * M, 0, M), Z = a.b3(a.O(b[1]) * M, 0, M), Z < j && (Z += M), Z - j < lt && (J = lt / (Z - j)));
const { x: Qt, y: wt } = this.project.call({ worldSize: M }, l);
let Mt, Ht;
const Ot = Math.max(J || 0, Y || 0);
if (Ot) {
const bt = new a.P(J ? (Z + j) / 2 : Qt, Y ? (D + V) / 2 : wt);
return v.center = this.unproject.call({ worldSize: M }, bt).wrap(), v.zoom += this.scaleZoom(Ot), v;
}
if (this.latRange) {
const bt = ft / 2;
wt - bt < V && (Ht = V + bt), wt + bt > D && (Ht = D - bt);
}
if (b) {
const bt = (j + Z) / 2;
let Nt = Qt;
this._renderWorldCopies && (Nt = a.b3(Qt, bt - M / 2, bt + M / 2));
const Dt = lt / 2;
Nt - Dt < j && (Mt = j + Dt), Nt + Dt > Z && (Mt = Z - Dt);
}
if (Mt !== void 0 || Ht !== void 0) {
const bt = new a.P(Mt ?? Qt, Ht ?? wt);
v.center = this.unproject.call({ worldSize: M }, bt).wrap();
}
return v;
}
_constrain() {
if (!this.center || !this.width || !this.height || this._constraining)
return;
this._constraining = !0;
const l = this._unmodified, { center: m, zoom: v } = this.getConstrained(this.center, this.zoom);
this.center = m, this.zoom = v, this._unmodified = l, this._constraining = !1;
}
_calcMatrices() {
if (!this.height)
return;
const l = this.centerOffset, m = this.point.x, v = this.point.y;
this.cameraToCenterDistance = 0.5 / Math.tan(this._fov / 2) * this.height, this._pixelPerMeter = a.b5(1, this.center.lat) * this.worldSize;
let b = a.an(new Float64Array(16));
a.K(b, b, [this.width / 2, -this.height / 2, 1]), a.J(b, b, [1, -1, 0]), this.labelPlaneMatrix = b, b = a.an(new Float64Array(16)), a.K(b, b, [1, -1, 1]), a.J(b, b, [-1, -1, 0]), a.K(b, b, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = b;
const M = this.cameraToCenterDistance + this._elevation * this._pixelPerMeter / Math.cos(this._pitch), V = Math.min(this.elevation, this.minElevationForCurrentTile), D = M - V * this._pixelPerMeter / Math.cos(this._pitch), j = V < 0 ? D : M, Z = Math.PI / 2 + this._pitch, Y = this._fov * (0.5 + l.y / this.height), J = Math.sin(Y) * j / Math.sin(a.ac(Math.PI - Z - Y, 0.01, Math.PI - 0.01)), lt = this.getHorizon(), ft = 2 * Math.atan(lt / this.cameraToCenterDistance) * (0.5 + l.y / (2 * lt)), Qt = Math.sin(ft) * j / Math.sin(a.ac(Math.PI - Z - ft, 0.01, Math.PI - 0.01)), wt = Math.min(J, Qt);
this.farZ = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * wt + j), this.nearZ = this.height / 50, b = new Float64Array(16), a.b6(b, this._fov, this.width / this.height, this.nearZ, this.farZ), b[8] = 2 * -l.x / this.width, b[9] = 2 * l.y / this.height, this.projectionMatrix = a.ae(b), a.K(b, b, [1, -1, 1]), a.J(b, b, [0, 0, -this.cameraToCenterDistance]), a.b7(b, b, this._pitch), a.ad(b, b, this.angle), a.J(b, b, [-m, -v, 0]), this.mercatorMatrix = a.K([], b, [this.worldSize, this.worldSize, this.worldSize]), a.K(b, b, [1, 1, this._pixelPerMeter]), this.pixelMatrix = a.L(new Float64Array(16), this.labelPlaneMatrix, b), a.J(b, b, [0, 0, -this.elevation]), this.modelViewProjectionMatrix = b, this.invModelViewProjectionMatrix = a.as([], b), this.fogMatrix = new Float64Array(16), a.b6(this.fogMatrix, this._fov, this.width / this.height, M, this.farZ), this.fogMatrix[8] = 2 * -l.x / this.width, this.fogMatrix[9] = 2 * l.y / this.height, a.K(this.fogMatrix, this.fogMatrix, [1, -1, 1]), a.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.cameraToCenterDistance]), a.b7(this.fogMatrix, this.fogMatrix, this._pitch), a.ad(this.fogMatrix, this.fogMatrix, this.angle), a.J(this.fogMatrix, this.fogMatrix, [-m, -v, 0]), a.K(this.fogMatrix, this.fogMatrix, [1, 1, this._pixelPerMeter]), a.J(this.fogMatrix, this.fogMatrix, [0, 0, -this.elevation]), this.pixelMatrix3D = a.L(new Float64Array(16), this.labelPlaneMatrix, b);
const Mt = this.width % 2 / 2, Ht = this.height % 2 / 2, Ot = Math.cos(this.angle), bt = Math.sin(this.angle), Nt = m - Math.round(m) + Ot * Mt + bt * Ht, Dt = v - Math.round(v) + Ot * Ht + bt * Mt, Wt = new Float64Array(b);
if (a.J(Wt, Wt, [Nt > 0.5 ? Nt - 1 : Nt, Dt > 0.5 ? Dt - 1 : Dt, 0]), this.alignedModelViewProjectionMatrix = Wt, b = a.as(new Float64Array(16), this.pixelMatrix), !b)
throw new Error("failed to invert matrix");
this.pixelMatrixInverse = b, this._posMatrixCache = {}, this._alignedPosMatrixCache = {}, this._fogMatrixCache = {};
}
maxPitchScaleFactor() {
if (!this.pixelMatrixInverse)
return 1;
const l = this.pointCoordinate(new a.P(0, 0)), m = [l.x * this.worldSize, l.y * this.worldSize, 0, 1];
return a.af(m, m, this.pixelMatrix)[3] / this.cameraToCenterDistance;
}
getCameraPoint() {
const l = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1);
return this.centerPoint.add(new a.P(0, l));
}
getCameraQueryGeometry(l) {
const m = this.getCameraPoint();
if (l.length === 1)
return [l[0], m];
{
let v = m.x, b = m.y, M = m.x, V = m.y;
for (const D of l)
v = Math.min(v, D.x), b = Math.min(b, D.y), M = Math.max(M, D.x), V = Math.max(V, D.y);
return [new a.P(v, b), new a.P(M, b), new a.P(M, V), new a.P(v, V), new a.P(v, b)];
}
}
lngLatToCameraDepth(l, m) {
const v = this.locationCoordinate(l), b = [v.x * this.worldSize, v.y * this.worldSize, m, 1];
return a.af(b, b, this.modelViewProjectionMatrix), b[2] / b[3];
}
}
function hs(S, l) {
let m, v = !1, b = null, M = null;
const V = () => {
b = null, v && (S.apply(M, m), b = setTimeout(V, l), v = !1);
};
return (...D) => (v = !0, M = this, m = D, b || V(), b);
}
class S2 {
constructor(l) {
this._getCurrentHash = () => {
const m = window.location.hash.replace("#", "");
if (this._hashName) {
let v;
return m.split("&").map((b) => b.split("=")).forEach((b) => {
b[0] === this._hashName && (v = b);
}), (v && v[1] || "").split("/");
}
return m.split("/");
}, this._onHashChange = () => {
const m = this._getCurrentHash();
if (m.length >= 3 && !m.some((v) => isNaN(v))) {
const v = this._map.dragRotate.isEnabled() && this._map.touchZoomRotate.isEnabled() ? +(m[3] || 0) : this._map.getBearing();
return this._map.jumpTo({ center: [+m[2], +m[1]], zoom: +m[0], bearing: v, pitch: +(m[4] || 0) }), !0;
}
return !1;
}, this._updateHashUnthrottled = () => {
const m = window.location.href.replace(/(#.*)?$/, this.getHashString());
window.history.replaceState(window.history.state, null, m);
}, this._removeHash = () => {
const m = this._getCurrentHash();
if (m.length === 0)
return;
const v = m.join("/");
let b = v;
b.split("&").length > 0 && (b = b.split("&")[0]), this._hashName && (b = `${this._hashName}=${v}`);
let M = window.location.hash.replace(b, "");
M.startsWith("#&") ? M = M.slice(0, 1) + M.slice(2) : M === "#" && (M = "");
let V = window.location.href.replace(/(#.+)?$/, M);
V = V.replace("&&", "&"), window.history.replaceState(window.history.state, null, V);
}, this._updateHash = hs(this._updateHashUnthrottled, 300), this._hashName = l && encodeURIComponent(l);
}
addTo(l) {
return this._map = l, addEventListener("hashchange", this._onHashChange, !1), this._map.on("moveend", this._updateHash), this;
}
remove() {
return removeEventListener("hashchange", this._onHashChange, !1), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), this._removeHash(), delete this._map, this;
}
getHashString(l) {
const m = this._map.getCenter(), v = Math.round(100 * this._map.getZoom()) / 100, b = Math.ceil((v * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), M = Math.pow(10, b), V = Math.round(m.lng * M) / M, D = Math.round(m.lat * M) / M, j = this._map.getBearing(), Z = this._map.getPitch();
let Y = "";
if (Y += l ? `/${V}/${D}/${v}` : `${v}/${D}/${V}`, (j || Z) && (Y += "/" + Math.round(10 * j) / 10), Z && (Y += `/${Math.round(Z)}`), this._hashName) {
const J = this._hashName;
let lt = !1;
const ft = window.location.hash.slice(1).split("&").map((Qt) => {
const wt = Qt.split("=")[0];
return wt === J ? (lt = !0, `${wt}=${Y}`) : Qt;
}).filter((Qt) => Qt);
return lt || ft.push(`${J}=${Y}`), `#${ft.join("&")}`;
}
return `#${Y}`;
}
}
const ds = { linearity: 0.3, easing: a.b8(0, 0, 0.3, 1) }, Y4 = a.e({ deceleration: 2500, maxSpeed: 1400 }, ds), Ec = a.e({ deceleration: 20, maxSpeed: 1400 }, ds), El = a.e({ deceleration: 1e3, maxSpeed: 360 }, ds), wn = a.e({ deceleration: 1e3, maxSpeed: 90 }, ds);
class mn {
constructor(l) {
this._map = l, this.clear();
}
clear() {
this._inertiaBuffer = [];
}
record(l) {
this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: f.now(), settings: l });
}
_drainInertiaBuffer() {
const l = this._inertiaBuffer, m = f.now();
for (; l.length > 0 && m - l[0].time > 160; )
l.shift();
}
_onMoveEnd(l) {
if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2)
return;
const m = { zoom: 0, bearing: 0, pitch: 0, pan: new a.P(0, 0), pinchAround: void 0, around: void 0 };
for (const { settings: M } of this._inertiaBuffer)
m.zoom += M.zoomDelta || 0, m.bearing += M.bearingDelta || 0, m.pitch += M.pitchDelta || 0, M.panDelta && m.pan._add(M.panDelta), M.around && (m.around = M.around), M.pinchAround && (m.pinchAround = M.pinchAround);
const v = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, b = {};
if (m.pan.mag()) {
const M = fo(m.pan.mag(), v, a.e({}, Y4, l || {}));
b.offset = m.pan.mult(M.amount / m.pan.mag()), b.center = this._map.transform.center, ps(b, M);
}
if (m.zoom) {
const M = fo(m.zoom, v, Ec);
b.zoom = this._map.transform.zoom + M.amount, ps(b, M);
}
if (m.bearing) {
const M = fo(m.bearing, v, El);
b.bearing = this._map.transform.bearing + a.ac(M.amount, -179, 179), ps(b, M);
}
if (m.pitch) {
const M = fo(m.pitch, v, wn);
b.pitch = this._map.transform.pitch + M.amount, ps(b, M);
}
if (b.zoom || b.bearing) {
const M = m.pinchAround === void 0 ? m.around : m.pinchAround;
b.around = M ? this._map.unproject(M) : this._map.getCenter();
}
return this.clear(), a.e(b, { noMoveStart: !0 });
}
}
function ps(S, l) {
(!S.duration || S.duration < l.duration) && (S.duration = l.duration, S.easing = l.easing);
}
function fo(S, l, m) {
const { maxSpeed: v, linearity: b, deceleration: M } = m, V = a.ac(S * b / (l / 1e3), -v, v), D = Math.abs(V) / (M * b);
return { easing: m.easing, duration: 1e3 * D, amount: V * (D / 2) };
}
class Gi extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v, b = {}) {
const M = Q.mousePos(m.getCanvas(), v), V = m.unproject(M);
super(l, a.e({ point: M, lngLat: V, originalEvent: v }, b)), this._defaultPrevented = !1, this.target = m;
}
}
class $i extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v) {
const b = l === "touchend" ? v.changedTouches : v.touches, M = Q.touchPos(m.getCanvasContainer(), b), V = M.map((j) => m.unproject(j)), D = M.reduce((j, Z, Y, J) => j.add(Z.div(J.length)), new a.P(0, 0));
super(l, { points: M, point: D, lngLats: V, lngLat: m.unproject(D), originalEvent: v }), this._defaultPrevented = !1;
}
}
class e2 extends a.k {
preventDefault() {
this._defaultPrevented = !0;
}
get defaultPrevented() {
return this._defaultPrevented;
}
constructor(l, m, v) {
super(l, { originalEvent: v }), this._defaultPrevented = !1;
}
}
class H2 {
constructor(l, m) {
this._map = l, this._clickTolerance = m.clickTolerance;
}
reset() {
delete this._mousedownPos;
}
wheel(l) {
return this._firePreventable(new e2(l.type, this._map, l));
}
mousedown(l, m) {
return this._mousedownPos = m, this._firePreventable(new Gi(l.type, this._map, l));
}
mouseup(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
click(l, m) {
this._mousedownPos && this._mousedownPos.dist(m) >= this._clickTolerance || this._map.fire(new Gi(l.type, this._map, l));
}
dblclick(l) {
return this._firePreventable(new Gi(l.type, this._map, l));
}
mouseover(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
mouseout(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
touchstart(l) {
return this._firePreventable(new $i(l.type, this._map, l));
}
touchmove(l) {
this._map.fire(new $i(l.type, this._map, l));
}
touchend(l) {
this._map.fire(new $i(l.type, this._map, l));
}
touchcancel(l) {
this._map.fire(new $i(l.type, this._map, l));
}
_firePreventable(l) {
if (this._map.fire(l), l.defaultPrevented)
return {};
}
isEnabled() {
return !0;
}
isActive() {
return !1;
}
enable() {
}
disable() {
}
}
class Dn {
constructor(l) {
this._map = l;
}
reset() {
this._delayContextMenu = !1, this._ignoreContextMenu = !0, delete this._contextMenuEvent;
}
mousemove(l) {
this._map.fire(new Gi(l.type, this._map, l));
}
mousedown() {
this._delayContextMenu = !0, this._ignoreContextMenu = !1;
}
mouseup() {
this._delayContextMenu = !1, this._contextMenuEvent && (this._map.fire(new Gi("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent);
}
contextmenu(l) {
this._delayContextMenu ? this._contextMenuEvent = l : this._ignoreContextMenu || this._map.fire(new Gi(l.type, this._map, l)), this._map.listens("contextmenu") && l.preventDefault();
}
isEnabled() {
return !0;
}
isActive() {
return !1;
}
enable() {
}
disable() {
}
}
class O1 {
constructor(l) {
this._map = l;
}
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(l) {
return this.transform.pointLocation(a.P.convert(l), this._map.terrain);
}
}
class Wi {
constructor(l, m) {
this._map = l, this._tr = new O1(l), this._el = l.getCanvasContainer(), this._container = l.getContainer(), this._clickTolerance = m.clickTolerance || 1;
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active;
}
enable() {
this.isEnabled() || (this._enabled = !0);
}
disable() {
this.isEnabled() && (this._enabled = !1);
}
mousedown(l, m) {
this.isEnabled() && l.shiftKey && l.button === 0 && (Q.disableDrag(), this._startPos = this._lastPos = m, this._active = !0);
}
mousemoveWindow(l, m) {
if (!this._active)
return;
const v = m;
if (this._lastPos.equals(v) || !this._box && v.dist(this._startPos) < this._clickTolerance)
return;
const b = this._startPos;
this._lastPos = v, this._box || (this._box = Q.create("div", "maplibregl-boxzoom", this._container), this._container.classList.add("maplibregl-crosshair"), this._fireEvent("boxzoomstart", l));
const M = Math.min(b.x, v.x), V = Math.max(b.x, v.x), D = Math.min(b.y, v.y), j = Math.max(b.y, v.y);
Q.setTransform(this._box, `translate(${M}px,${D}px)`), this._box.style.width = V - M + "px", this._box.style.height = j - D + "px";
}
mouseupWindow(l, m) {
if (!this._active || l.button !== 0)
return;
const v = this._startPos, b = m;
if (this.reset(), Q.suppressClick(), v.x !== b.x || v.y !== b.y)
return this._map.fire(new a.k("boxzoomend", { originalEvent: l })), { cameraAnimation: (M) => M.fitScreenCoordinates(v, b, this._tr.bearing, { linear: !0 }) };
this._fireEvent("boxzoomcancel", l);
}
keydown(l) {
this._active && l.keyCode === 27 && (this.reset(), this._fireEvent("boxzoomcancel", l));
}
reset() {
this._active = !1, this._container.classList.remove("maplibregl-crosshair"), this._box && (Q.remove(this._box), this._box = null), Q.enableDrag(), delete this._startPos, delete this._lastPos;
}
_fireEvent(l, m) {
return this._map.fire(new a.k(l, { originalEvent: m }));
}
}
function Po(S, l) {
if (S.length !== l.length)
throw new Error(`The number of touches and points are not equal - touches ${S.length}, points ${l.length}`);
const m = {};
for (let v = 0; v < S.length; v++)
m[S[v].identifier] = l[v];
return m;
}
class J4 {
constructor(l) {
this.reset(), this.numTouches = l.numTouches;
}
reset() {
delete this.centroid, delete this.startTime, delete this.touches, this.aborted = !1;
}
touchstart(l, m, v) {
(this.centroid || v.length > this.numTouches) && (this.aborted = !0), this.aborted || (this.startTime === void 0 && (this.startTime = l.timeStamp), v.length === this.numTouches && (this.centroid = function(b) {
const M = new a.P(0, 0);
for (const V of b)
M._add(V);
return M.div(b.length);
}(m), this.touches = Po(v, m)));
}
touchmove(l, m, v) {
if (this.aborted || !this.centroid)
return;
const b = Po(v, m);
for (const M in this.touches) {
const V = b[M];
(!V || V.dist(this.touches[M]) > 30) && (this.aborted = !0);
}
}
touchend(l, m, v) {
if ((!this.centroid || l.timeStamp - this.startTime > 500) && (this.aborted = !0), v.length === 0) {
const b = !this.aborted && this.centroid;
if (this.reset(), b)
return b;
}
}
}
class Gs {
constructor(l) {
this.singleTap = new J4(l), this.numTaps = l.numTaps, this.reset();
}
reset() {
this.lastTime = 1 / 0, delete this.lastTap, this.count = 0, this.singleTap.reset();
}
touchstart(l, m, v) {
this.singleTap.touchstart(l, m, v);
}
touchmove(l, m, v) {
this.singleTap.touchmove(l, m, v);
}
touchend(l, m, v) {
const b = this.singleTap.touchend(l, m, v);
if (b) {
const M = l.timeStamp - this.lastTime < 500, V = !this.lastTap || this.lastTap.dist(b) < 30;
if (M && V || this.reset(), this.count++, this.lastTime = l.timeStamp, this.lastTap = b, this.count === this.numTaps)
return this.reset(), b;
}
}
}
class Ts {
constructor(l) {
this._tr = new O1(l), this._zoomIn = new Gs({ numTouches: 1, numTaps: 2 }), this._zoomOut = new Gs({ numTouches: 2, numTaps: 1 }), this.reset();
}
reset() {
this._active = !1, this._zoomIn.reset(), this._zoomOut.reset();
}
touchstart(l, m, v) {
this._zoomIn.touchstart(l, m, v), this._zoomOut.touchstart(l, m, v);
}
touchmove(l, m, v) {
this._zoomIn.touchmove(l, m, v), this._zoomOut.touchmove(l, m, v);
}
touchend(l, m, v) {
const b = this._zoomIn.touchend(l, m, v), M = this._zoomOut.touchend(l, m, v), V = this._tr;
return b ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: V.zoom + 1, around: V.unproject(b) }, { originalEvent: l }) }) : M ? (this._active = !0, l.preventDefault(), setTimeout(() => this.reset(), 0), { cameraAnimation: (D) => D.easeTo({ duration: 300, zoom: V.zoom - 1, around: V.unproject(M) }, { originalEvent: l }) }) : void 0;
}
touchcancel() {
this.reset();
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Qo {
constructor(l) {
this._enabled = !!l.enable, this._moveStateManager = l.moveStateManager, this._clickTolerance = l.clickTolerance || 1, this._moveFunction = l.move, this._activateOnStart = !!l.activateOnStart, l.assignEvents(this), this.reset();
}
reset(l) {
this._active = !1, this._moved = !1, delete this._lastPoint, this._moveStateManager.endMove(l);
}
_move(...l) {
const m = this._moveFunction(...l);
if (m.bearingDelta || m.pitchDelta || m.around || m.panDelta)
return this._active = !0, m;
}
dragStart(l, m) {
this.isEnabled() && !this._lastPoint && this._moveStateManager.isValidStartEvent(l) && (this._moveStateManager.startMove(l), this._lastPoint = m.length ? m[0] : m, this._activateOnStart && this._lastPoint && (this._active = !0));
}
dragMove(l, m) {
if (!this.isEnabled())
return;
const v = this._lastPoint;
if (!v)
return;
if (l.preventDefault(), !this._moveStateManager.isValidMoveEvent(l))
return void this.reset(l);
const b = m.length ? m[0] : m;
return !this._moved && b.dist(v) < this._clickTolerance ? void 0 : (this._moved = !0, this._lastPoint = b, this._move(v, b));
}
dragEnd(l) {
this.isEnabled() && this._lastPoint && this._moveStateManager.isValidEndEvent(l) && (this._moved && Q.suppressClick(), this.reset(l));
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
getClickTolerance() {
return this._clickTolerance;
}
}
const wa = { 0: 1, 2: 2 };
class N3 {
constructor(l) {
this._correctEvent = l.checkCorrectEvent;
}
startMove(l) {
const m = Q.mouseButton(l);
this._eventButton = m;
}
endMove(l) {
delete this._eventButton;
}
isValidStartEvent(l) {
return this._correctEvent(l);
}
isValidMoveEvent(l) {
return !function(m, v) {
const b = wa[v];
return m.buttons === void 0 || (m.buttons & b) !== b;
}(l, this._eventButton);
}
isValidEndEvent(l) {
return Q.mouseButton(l) === this._eventButton;
}
}
class xa {
constructor() {
this._firstTouch = void 0;
}
_isOneFingerTouch(l) {
return l.targetTouches.length === 1;
}
_isSameTouchEvent(l) {
return l.targetTouches[0].identifier === this._firstTouch;
}
startMove(l) {
this._firstTouch = l.targetTouches[0].identifier;
}
endMove(l) {
delete this._firstTouch;
}
isValidStartEvent(l) {
return this._isOneFingerTouch(l);
}
isValidMoveEvent(l) {
return this._isOneFingerTouch(l) && this._isSameTouchEvent(l);
}
isValidEndEvent(l) {
return this._isOneFingerTouch(l) && this._isSameTouchEvent(l);
}
}
const $s = (S) => {
S.mousedown = S.dragStart, S.mousemoveWindow = S.dragMove, S.mouseup = S.dragEnd, S.contextmenu = (l) => {
l.preventDefault();
};
}, Mc = ({ enable: S, clickTolerance: l, bearingDegreesPerPixelMoved: m = 0.8 }) => {
const v = new N3({ checkCorrectEvent: (b) => Q.mouseButton(b) === 0 && b.ctrlKey || Q.mouseButton(b) === 2 });
return new Qo({ clickTolerance: l, move: (b, M) => ({ bearingDelta: (M.x - b.x) * m }), moveStateManager: v, enable: S, assignEvents: $s });
}, Sc = ({ enable: S, clickTolerance: l, pitchDegreesPerPixelMoved: m = -0.5 }) => {
const v = new N3({ checkCorrectEvent: (b) => Q.mouseButton(b) === 0 && b.ctrlKey || Q.mouseButton(b) === 2 });
return new Qo({ clickTolerance: l, move: (b, M) => ({ pitchDelta: (M.y - b.y) * m }), moveStateManager: v, enable: S, assignEvents: $s });
};
class D3 {
constructor(l, m) {
this._clickTolerance = l.clickTolerance || 1, this._map = m, this.reset();
}
reset() {
this._active = !1, this._touches = {}, this._sum = new a.P(0, 0);
}
_shouldBePrevented(l) {
return l < (this._map.cooperativeGestures.isEnabled() ? 2 : 1);
}
touchstart(l, m, v) {
return this._calculateTransform(l, m, v);
}
touchmove(l, m, v) {
if (this._active) {
if (!this._shouldBePrevented(v.length))
return l.preventDefault(), this._calculateTransform(l, m, v);
this._map.cooperativeGestures.notifyGestureBlocked("touch_pan", l);
}
}
touchend(l, m, v) {
this._calculateTransform(l, m, v), this._active && this._shouldBePrevented(v.length) && this.reset();
}
touchcancel() {
this.reset();
}
_calculateTransform(l, m, v) {
v.length > 0 && (this._active = !0);
const b = Po(v, m), M = new a.P(0, 0), V = new a.P(0, 0);
let D = 0;
for (const Z in b) {
const Y = b[Z], J = this._touches[Z];
J && (M._add(Y), V._add(Y.sub(J)), D++, b[Z] = Y);
}
if (this._touches = b, this._shouldBePrevented(D) || !V.mag())
return;
const j = V.div(D);
return this._sum._add(j), this._sum.mag() < this._clickTolerance ? void 0 : { around: M.div(D), panDelta: j };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Ml {
constructor() {
this.reset();
}
reset() {
this._active = !1, delete this._firstTwoTouches;
}
touchstart(l, m, v) {
this._firstTwoTouches || v.length < 2 || (this._firstTwoTouches = [v[0].identifier, v[1].identifier], this._start([m[0], m[1]]));
}
touchmove(l, m, v) {
if (!this._firstTwoTouches)
return;
l.preventDefault();
const [b, M] = this._firstTwoTouches, V = k0(v, m, b), D = k0(v, m, M);
if (!V || !D)
return;
const j = this._aroundCenter ? null : V.add(D).div(2);
return this._move([V, D], j, l);
}
touchend(l, m, v) {
if (!this._firstTwoTouches)
return;
const [b, M] = this._firstTwoTouches, V = k0(v, m, b), D = k0(v, m, M);
V && D || (this._active && Q.suppressClick(), this.reset());
}
touchcancel() {
this.reset();
}
enable(l) {
this._enabled = !0, this._aroundCenter = !!l && l.around === "center";
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active;
}
}
function k0(S, l, m) {
for (let v = 0; v < S.length; v++)
if (S[v].identifier === m)
return l[v];
}
function Hc(S, l) {
return Math.log(S / l) / Math.LN2;
}
class Ac extends Ml {
reset() {
super.reset(), delete this._distance, delete this._startDistance;
}
_start(l) {
this._startDistance = this._distance = l[0].dist(l[1]);
}
_move(l, m) {
const v = this._distance;
if (this._distance = l[0].dist(l[1]), this._active || !(Math.abs(Hc(this._distance, this._startDistance)) < 0.1))
return this._active = !0, { zoomDelta: Hc(this._distance, v), pinchAround: m };
}
}
function Oc(S, l) {
return 180 * S.angleWith(l) / Math.PI;
}
class Cc extends Ml {
reset() {
super.reset(), delete this._minDiameter, delete this._startVector, delete this._vector;
}
_start(l) {
this._startVector = this._vector = l[0].sub(l[1]), this._minDiameter = l[0].dist(l[1]);
}
_move(l, m, v) {
const b = this._vector;
if (this._vector = l[0].sub(l[1]), this._active || !this._isBelowThreshold(this._vector))
return this._active = !0, { bearingDelta: Oc(this._vector, b), pinchAround: m };
}
_isBelowThreshold(l) {
this._minDiameter = Math.min(this._minDiameter, l.mag());
const m = 25 / (Math.PI * this._minDiameter) * 360, v = Oc(l, this._startVector);
return Math.abs(v) < m;
}
}
function Sl(S) {
return Math.abs(S.y) > Math.abs(S.x);
}
class t6 extends Ml {
constructor(l) {
super(), this._currentTouchCount = 0, this._map = l;
}
reset() {
super.reset(), this._valid = void 0, delete this._firstMove, delete this._lastPoints;
}
touchstart(l, m, v) {
super.touchstart(l, m, v), this._currentTouchCount = v.length;
}
_start(l) {
this._lastPoints = l, Sl(l[0].sub(l[1])) && (this._valid = !1);
}
_move(l, m, v) {
if (this._map.cooperativeGestures.isEnabled() && this._currentTouchCount < 3)
return;
const b = l[0].sub(this._lastPoints[0]), M = l[1].sub(this._lastPoints[1]);
return this._valid = this.gestureBeginsVertically(b, M, v.timeStamp), this._valid ? (this._lastPoints = l, this._active = !0, { pitchDelta: (b.y + M.y) / 2 * -0.5 }) : void 0;
}
gestureBeginsVertically(l, m, v) {
if (this._valid !== void 0)
return this._valid;
const b = l.mag() >= 2, M = m.mag() >= 2;
if (!b && !M)
return;
if (!b || !M)
return this._firstMove === void 0 && (this._firstMove = v), v - this._firstMove < 100 && void 0;
const V = l.y > 0 == m.y > 0;
return Sl(l) && Sl(m) && V;
}
}
const Qp = { panStep: 100, bearingStep: 15, pitchStep: 10 };
class r2 {
constructor(l) {
this._tr = new O1(l);
const m = Qp;
this._panStep = m.panStep, this._bearingStep = m.bearingStep, this._pitchStep = m.pitchStep, this._rotationDisabled = !1;
}
reset() {
this._active = !1;
}
keydown(l) {
if (l.altKey || l.ctrlKey || l.metaKey)
return;
let m = 0, v = 0, b = 0, M = 0, V = 0;
switch (l.keyCode) {
case 61:
case 107:
case 171:
case 187:
m = 1;
break;
case 189:
case 109:
case 173:
m = -1;
break;
case 37:
l.shiftKey ? v = -1 : (l.preventDefault(), M = -1);
break;
case 39:
l.shiftKey ? v = 1 : (l.preventDefault(), M = 1);
break;
case 38:
l.shiftKey ? b = 1 : (l.preventDefault(), V = -1);
break;
case 40:
l.shiftKey ? b = -1 : (l.preventDefault(), V = 1);
break;
default:
return;
}
return this._rotationDisabled && (v = 0, b = 0), { cameraAnimation: (D) => {
const j = this._tr;
D.easeTo({ duration: 300, easeId: "keyboardHandler", easing: fs, zoom: m ? Math.round(j.zoom) + m * (l.shiftKey ? 2 : 1) : j.zoom, bearing: j.bearing + v * this._bearingStep, pitch: j.pitch + b * this._pitchStep, offset: [-M * this._panStep, -V * this._panStep], center: j.center }, { originalEvent: l });
} };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
disableRotation() {
this._rotationDisabled = !0;
}
enableRotation() {
this._rotationDisabled = !1;
}
}
function fs(S) {
return S * (2 - S);
}
const kc = 4.000244140625;
class A2 {
constructor(l, m) {
this._onTimeout = (v) => {
this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(v);
}, this._map = l, this._tr = new O1(l), this._triggerRenderFrame = m, this._delta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = 0.0022222222222222222;
}
setZoomRate(l) {
this._defaultZoomRate = l;
}
setWheelZoomRate(l) {
this._wheelZoomRate = l;
}
isEnabled() {
return !!this._enabled;
}
isActive() {
return !!this._active || this._finishTimeout !== void 0;
}
isZooming() {
return !!this._zooming;
}
enable(l) {
this.isEnabled() || (this._enabled = !0, this._aroundCenter = !!l && l.around === "center");
}
disable() {
this.isEnabled() && (this._enabled = !1);
}
_shouldBePrevented(l) {
return !!this._map.cooperativeGestures.isEnabled() && !(l.ctrlKey || this._map.cooperativeGestures.isBypassed(l));
}
wheel(l) {
if (!this.isEnabled())
return;
if (this._shouldBePrevented(l))
return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom", l);
let m = l.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * l.deltaY : l.deltaY;
const v = f.now(), b = v - (this._lastWheelEventTime || 0);
this._lastWheelEventTime = v, m !== 0 && m % kc == 0 ? this._type = "wheel" : m !== 0 && Math.abs(m) < 4 ? this._type = "trackpad" : b > 400 ? (this._type = null, this._lastValue = m, this._timeout = setTimeout(this._onTimeout, 40, l)) : this._type || (this._type = Math.abs(b * m) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, m += this._lastValue)), l.shiftKey && m && (m /= 4), this._type && (this._lastWheelEvent = l, this._delta -= m, this._active || this._start(l)), l.preventDefault();
}
_start(l) {
if (!this._delta)
return;
this._frameId && (this._frameId = null), this._active = !0, this.isZooming() || (this._zooming = !0), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
const m = Q.mousePos(this._map.getCanvas(), l), v = this._tr;
this._around = m.y > v.transform.height / 2 - v.transform.getHorizon() ? a.N.convert(this._aroundCenter ? v.center : v.unproject(m)) : a.N.convert(v.center), this._aroundPoint = v.transform.locationPoint(this._around), this._frameId || (this._frameId = !0, this._triggerRenderFrame());
}
renderFrame() {
if (!this._frameId || (this._frameId = null, !this.isActive()))
return;
const l = this._tr.transform;
if (this._delta !== 0) {
const j = this._type === "wheel" && Math.abs(this._delta) > kc ? this._wheelZoomRate : this._defaultZoomRate;
let Z = 2 / (1 + Math.exp(-Math.abs(this._delta * j)));
this._delta < 0 && Z !== 0 && (Z = 1 / Z);
const Y = typeof this._targetZoom == "number" ? l.zoomScale(this._targetZoom) : l.scale;
this._targetZoom = Math.min(l.maxZoom, Math.max(l.minZoom, l.scaleZoom(Y * Z))), this._type === "wheel" && (this._startZoom = l.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0;
}
const m = typeof this._targetZoom == "number" ? this._targetZoom : l.zoom, v = this._startZoom, b = this._easing;
let M, V = !1;
const D = f.now() - this._lastWheelEventTime;
if (this._type === "wheel" && v && b && D) {
const j = Math.min(D / 200, 1), Z = b(j);
M = a.y.number(v, m, Z), j < 1 ? this._frameId || (this._frameId = !0) : V = !0;
} else
M = m, V = !0;
return this._active = !0, V && (this._active = !1, this._finishTimeout = setTimeout(() => {
this._zooming = !1, this._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout;
}, 200)), { noInertia: !0, needsRenderFrame: !V, zoomDelta: M - l.zoom, around: this._aroundPoint, originalEvent: this._lastWheelEvent };
}
_smoothOutEasing(l) {
let m = a.b9;
if (this._prevEase) {
const v = this._prevEase, b = (f.now() - v.start) / v.duration, M = v.easing(b + 0.01) - v.easing(b), V = 0.27 / Math.sqrt(M * M + 1e-4) * 0.01, D = Math.sqrt(0.0729 - V * V);
m = a.b8(V, D, 0.25, 1);
}
return this._prevEase = { start: f.now(), duration: l, easing: m }, m;
}
reset() {
this._active = !1, this._zooming = !1, delete this._targetZoom, this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout);
}
}
class F3 {
constructor(l, m) {
this._clickZoom = l, this._tapZoom = m;
}
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 f_ {
constructor(l) {
this._tr = new O1(l), this.reset();
}
reset() {
this._active = !1;
}
dblclick(l, m) {
return l.preventDefault(), { cameraAnimation: (v) => {
v.easeTo({ duration: 300, zoom: this._tr.zoom + (l.shiftKey ? -1 : 1), around: this._tr.unproject(m) }, { originalEvent: l });
} };
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class Q_ {
constructor() {
this._tap = new Gs({ numTouches: 1, numTaps: 1 }), this.reset();
}
reset() {
this._active = !1, delete this._swipePoint, delete this._swipeTouch, delete this._tapTime, delete this._tapPoint, this._tap.reset();
}
touchstart(l, m, v) {
if (!this._swipePoint)
if (this._tapTime) {
const b = m[0], M = l.timeStamp - this._tapTime < 500, V = this._tapPoint.dist(b) < 30;
M && V ? v.length > 0 && (this._swipePoint = b, this._swipeTouch = v[0].identifier) : this.reset();
} else
this._tap.touchstart(l, m, v);
}
touchmove(l, m, v) {
if (this._tapTime) {
if (this._swipePoint) {
if (v[0].identifier !== this._swipeTouch)
return;
const b = m[0], M = b.y - this._swipePoint.y;
return this._swipePoint = b, l.preventDefault(), this._active = !0, { zoomDelta: M / 128 };
}
} else
this._tap.touchmove(l, m, v);
}
touchend(l, m, v) {
if (this._tapTime)
this._swipePoint && v.length === 0 && this.reset();
else {
const b = this._tap.touchend(l, m, v);
b && (this._tapTime = l.timeStamp, this._tapPoint = b);
}
}
touchcancel() {
this.reset();
}
enable() {
this._enabled = !0;
}
disable() {
this._enabled = !1, this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
class mp {
constructor(l, m, v) {
this._el = l, this._mousePan = m, this._touchPan = v;
}
enable(l) {
this._inertiaOptions = l || {}, 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 gp {
constructor(l, m, v) {
this._pitchWithRotate = l.pitchWithRotate, this._mouseRotate = m, this._mousePitch = v;
}
enable() {
this._mouseRotate.enable(), this._pitchWithRotate && this._mousePitch.enable();
}
disable() {
this._mouseRotate.disable(), this._mousePitch.disable();
}
isEnabled() {
return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());
}
isActive() {
return this._mouseRotate.isActive() || this._mousePitch.isActive();
}
}
class Ic {
constructor(l, m, v, b) {
this._el = l, this._touchZoom = m, this._touchRotate = v, this._tapDragZoom = b, this._rotationDisabled = !1, this._enabled = !0;
}
enable(l) {
this._touchZoom.enable(l), this._rotationDisabled || this._touchRotate.enable(l), this._tapDragZoom.enable(), this._el.classList.add("maplibregl-touch-zoom-rotate");
}
disable() {
this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove("maplibregl-touch-zoom-rotate");
}
isEnabled() {
return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();
}
isActive() {
return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();
}
disableRotation() {
this._rotationDisabled = !0, this._touchRotate.disable();
}
enableRotation() {
this._rotationDisabled = !1, this._touchZoom.isEnabled() && this._touchRotate.enable();
}
}
class e6 {
constructor(l, m) {
this._bypassKey = navigator.userAgent.indexOf("Mac") !== -1 ? "metaKey" : "ctrlKey", this._map = l, this._options = m, this._enabled = !1;
}
isActive() {
return !1;
}
reset() {
}
_setupUI() {
if (this._container)
return;
const l = this._map.getCanvasContainer();
l.classList.add("maplibregl-cooperative-gestures"), this._container = Q.create("div", "maplibregl-cooperative-gesture-screen", l);
let m = this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");
this._bypassKey === "metaKey" && (m = this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));
const v = this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"), b = document.createElement("div");
b.className = "maplibregl-desktop-message", b.textContent = m, this._container.appendChild(b);
const M = document.createElement("div");
M.className = "maplibregl-mobile-message", M.textContent = v, this._container.appendChild(M), this._container.setAttribute("aria-hidden", "true");
}
_destroyUI() {
this._container && (Q.remove(this._container), this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")), delete this._container;
}
enable() {
this._setupUI(), this._enabled = !0;
}
disable() {
this._enabled = !1, this._destroyUI();
}
isEnabled() {
return this._enabled;
}
isBypassed(l) {
return l[this._bypassKey];
}
notifyGestureBlocked(l, m) {
this._enabled && (this._map.fire(new a.k("cooperativegestureprevented", { gestureType: l, originalEvent: m })), this._container.classList.add("maplibregl-show"), setTimeout(() => {
this._container.classList.remove("maplibregl-show");
}, 100));
}
}
const n2 = (S) => S.zoom || S.drag || S.pitch || S.rotate;
class nr extends a.k {
}
function Hl(S) {
return S.panDelta && S.panDelta.mag() || S.zoomDelta || S.bearingDelta || S.pitchDelta;
}
class Pc {
constructor(l, m) {
this.handleWindowEvent = (b) => {
this.handleEvent(b, `${b.type}Window`);
}, this.handleEvent = (b, M) => {
if (b.type === "blur")
return void this.stop(!0);
this._updatingCamera = !0;
const V = b.type === "renderFrame" ? void 0 : b, D = { needsRenderFrame: !1 }, j = {}, Z = {}, Y = b.touches, J = Y ? this._getMapTouches(Y) : void 0, lt = J ? Q.touchPos(this._map.getCanvas(), J) : Q.mousePos(this._map.getCanvas(), b);
for (const { handlerName: wt, handler: Mt, allowed: Ht } of this._handlers) {
if (!Mt.isEnabled())
continue;
let Ot;
this._blockedByActive(Z, Ht, wt) ? Mt.reset() : Mt[M || b.type] && (Ot = Mt[M || b.type](b, lt, J), this.mergeHandlerResult(D, j, Ot, wt, V), Ot && Ot.needsRenderFrame && this._triggerRenderFrame()), (Ot || Mt.isActive()) && (Z[wt] = Mt);
}
const ft = {};
for (const wt in this._previousActiveHandlers)
Z[wt] || (ft[wt] = V);
this._previousActiveHandlers = Z, (Object.keys(ft).length || Hl(D)) && (this._changes.push([D, j, ft]), this._triggerRenderFrame()), (Object.keys(Z).length || Hl(D)) && this._map._stop(!0), this._updatingCamera = !1;
const { cameraAnimation: Qt } = D;
Qt && (this._inertia.clear(), this._fireEvents({}, {}, !0), this._changes = [], Qt(this._map));
}, this._map = l, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new mn(l), this._bearingSnap = m.bearingSnap, this._previousActiveHandlers = {}, this._eventsInProgress = {}, this._addDefaultHandlers(m);
const v = this._el;
this._listeners = [[v, "touchstart", { passive: !0 }], [v, "touchmove", { passive: !1 }], [v, "touchend", void 0], [v, "touchcancel", void 0], [v, "mousedown", void 0], [v, "mousemove", void 0], [v, "mouseup", void 0], [document, "mousemove", { capture: !0 }], [document, "mouseup", void 0], [v, "mouseover", void 0], [v, "mouseout", void 0], [v, "dblclick", void 0], [v, "click", void 0], [v, "keydown", { capture: !1 }], [v, "keyup", void 0], [v, "wheel", { passive: !1 }], [v, "contextmenu", void 0], [window, "blur", void 0]];
for (const [b, M, V] of this._listeners)
Q.addEventListener(b, M, b === document ? this.handleWindowEvent : this.handleEvent, V);
}
destroy() {
for (const [l, m, v] of this._listeners)
Q.removeEventListener(l, m, l === document ? this.handleWindowEvent : this.handleEvent, v);
}
_addDefaultHandlers(l) {
const m = this._map, v = m.getCanvasContainer();
this._add("mapEvent", new H2(m, l));
const b = m.boxZoom = new Wi(m, l);
this._add("boxZoom", b), l.interactive && l.boxZoom && b.enable();
const M = m.cooperativeGestures = new e6(m, l.cooperativeGestures);
this._add("cooperativeGestures", M), l.cooperativeGestures && M.enable();
const V = new Ts(m), D = new f_(m);
m.doubleClickZoom = new F3(D, V), this._add("tapZoom", V), this._add("clickZoom", D), l.interactive && l.doubleClickZoom && m.doubleClickZoom.enable();
const j = new Q_();
this._add("tapDragZoom", j);
const Z = m.touchPitch = new t6(m);
this._add("touchPitch", Z), l.interactive && l.touchPitch && m.touchPitch.enable(l.touchPitch);
const Y = Mc(l), J = Sc(l);
m.dragRotate = new gp(l, Y, J), this._add("mouseRotate", Y, ["mousePitch"]), this._add("mousePitch", J, ["mouseRotate"]), l.interactive && l.dragRotate && m.dragRotate.enable();
const lt = (({ enable: Ot, clickTolerance: bt }) => {
const Nt = new N3({ checkCorrectEvent: (Dt) => Q.mouseButton(Dt) === 0 && !Dt.ctrlKey });
return new Qo({ clickTolerance: bt, move: (Dt, Wt) => ({ around: Wt, panDelta: Wt.sub(Dt) }), activateOnStart: !0, moveStateManager: Nt, enable: Ot, assignEvents: $s });
})(l), ft = new D3(l, m);
m.dragPan = new mp(v, lt, ft), this._add("mousePan", lt), this._add("touchPan", ft, ["touchZoom", "touchRotate"]), l.interactive && l.dragPan && m.dragPan.enable(l.dragPan);
const Qt = new Cc(), wt = new Ac();
m.touchZoomRotate = new Ic(v, wt, Qt, j), this._add("touchRotate", Qt, ["touchPan", "touchZoom"]), this._add("touchZoom", wt, ["touchPan", "touchRotate"]), l.interactive && l.touchZoomRotate && m.touchZoomRotate.enable(l.touchZoomRotate);
const Mt = m.scrollZoom = new A2(m, () => this._triggerRenderFrame());
this._add("scrollZoom", Mt, ["mousePan"]), l.interactive && l.scrollZoom && m.scrollZoom.enable(l.scrollZoom);
const Ht = m.keyboard = new r2(m);
this._add("keyboard", Ht), l.interactive && l.keyboard && m.keyboard.enable(), this._add("blockableMapEvent", new Dn(m));
}
_add(l, m, v) {
this._handlers.push({ handlerName: l, handler: m, allowed: v }), this._handlersById[l] = m;
}
stop(l) {
if (!this._updatingCamera) {
for (const { handler: m } of this._handlers)
m.reset();
this._inertia.clear(), this._fireEvents({}, {}, l), this._changes = [];
}
}
isActive() {
for (const { handler: l } of this._handlers)
if (l.isActive())
return !0;
return !1;
}
isZooming() {
return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
}
isRotating() {
return !!this._eventsInProgress.rotate;
}
isMoving() {
return !!n2(this._eventsInProgress) || this.isZooming();
}
_blockedByActive(l, m, v) {
for (const b in l)
if (b !== v && (!m || m.indexOf(b) < 0))
return !0;
return !1;
}
_getMapTouches(l) {
const m = [];
for (const v of l)
this._el.contains(v.target) && m.push(v);
return m;
}
mergeHandlerResult(l, m, v, b, M) {
if (!v)
return;
a.e(l, v);
const V = { handlerName: b, originalEvent: v.originalEvent || M };
v.zoomDelta !== void 0 && (m.zoom = V), v.panDelta !== void 0 && (m.drag = V), v.pitchDelta !== void 0 && (m.pitch = V), v.bearingDelta !== void 0 && (m.rotate = V);
}
_applyChanges() {
const l = {}, m = {}, v = {};
for (const [b, M, V] of this._changes)
b.panDelta && (l.panDelta = (l.panDelta || new a.P(0, 0))._add(b.panDelta)), b.zoomDelta && (l.zoomDelta = (l.zoomDelta || 0) + b.zoomDelta), b.bearingDelta && (l.bearingDelta = (l.bearingDelta || 0) + b.bearingDelta), b.pitchDelta && (l.pitchDelta = (l.pitchDelta || 0) + b.pitchDelta), b.around !== void 0 && (l.around = b.around), b.pinchAround !== void 0 && (l.pinchAround = b.pinchAround), b.noInertia && (l.noInertia = b.noInertia), a.e(m, M), a.e(v, V);
this._updateMapTransform(l, m, v), this._changes = [];
}
_updateMapTransform(l, m, v) {
const b = this._map, M = b._getTransformForUpdate(), V = b.terrain;
if (!(Hl(l) || V && this._terrainMovement))
return this._fireEvents(m, v, !0);
let { panDelta: D, zoomDelta: j, bearingDelta: Z, pitchDelta: Y, around: J, pinchAround: lt } = l;
lt !== void 0 && (J = lt), b._stop(!0), J = J || b.transform.centerPoint;
const ft = M.pointLocation(D ? J.sub(D) : J);
Z && (M.bearing += Z), Y && (M.pitch += Y), j && (M.zoom += j), V ? this._terrainMovement || !m.drag && !m.zoom ? m.drag && this._terrainMovement ? M.center = M.pointLocation(M.centerPoint.sub(D)) : M.setLocationAtPoint(ft, J) : (this._terrainMovement = !0, this._map._elevationFreeze = !0, M.setLocationAtPoint(ft, J)) : M.setLocationAtPoint(ft, J), b._applyUpdatedTransform(M), this._map._update(), l.noInertia || this._inertia.record(l), this._fireEvents(m, v, !0);
}
_fireEvents(l, m, v) {
const b = n2(this._eventsInProgress), M = n2(l), V = {};
for (const J in l) {
const { originalEvent: lt } = l[J];
this._eventsInProgress[J] || (V[`${J}start`] = lt), this._eventsInProgress[J] = l[J];
}
!b && M && this._fireEvent("movestart", M.originalEvent);
for (const J in V)
this._fireEvent(J, V[J]);
M && this._fireEvent("move", M.originalEvent);
for (const J in l) {
const { originalEvent: lt } = l[J];
this._fireEvent(J, lt);
}
const D = {};
let j;
for (const J in this._eventsInProgress) {
const { handlerName: lt, originalEvent: ft } = this._eventsInProgress[J];
this._handlersById[lt].isActive() || (delete this._eventsInProgress[J], j = m[lt] || ft, D[`${J}end`] = j);
}
for (const J in D)
this._fireEvent(J, D[J]);
const Z = n2(this._eventsInProgress), Y = (b || M) && !Z;
if (Y && this._terrainMovement) {
this._map._elevationFreeze = !1, this._terrainMovement = !1;
const J = this._map._getTransformForUpdate();
J.recalculateZoom(this._map.terrain), this._map._applyUpdatedTransform(J);
}
if (v && Y) {
this._updatingCamera = !0;
const J = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), lt = (ft) => ft !== 0 && -this._bearingSnap < ft && ft < this._bearingSnap;
!J || !J.essential && f.prefersReducedMotion ? (this._map.fire(new a.k("moveend", { originalEvent: j })), lt(this._map.getBearing()) && this._map.resetNorth()) : (lt(J.bearing || this._map.getBearing()) && (J.bearing = 0), J.freezeElevation = !0, this._map.easeTo(J, { originalEvent: j })), this._updatingCamera = !1;
}
}
_fireEvent(l, m) {
this._map.fire(new a.k(l, m ? { originalEvent: m } : {}));
}
_requestFrame() {
return this._map.triggerRepaint(), this._map._renderTaskQueue.add((l) => {
delete this._frameId, this.handleEvent(new nr("renderFrame", { timeStamp: l })), this._applyChanges();
});
}
_triggerRenderFrame() {
this._frameId === void 0 && (this._frameId = this._requestFrame());
}
}
class yp extends a.E {
constructor(l, m) {
super(), this._renderFrameCallback = () => {
const v = Math.min((f.now() - this._easeStart) / this._easeOptions.duration, 1);
this._onEaseFrame(this._easeOptions.easing(v)), v < 1 && this._easeFrameId ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop();
}, this._moving = !1, this._zooming = !1, this.transform = l, this._bearingSnap = m.bearingSnap, this.on("moveend", () => {
delete this._requestedCameraState;
});
}
getCenter() {
return new a.N(this.transform.center.lng, this.transform.center.lat);
}
setCenter(l, m) {
return this.jumpTo({ center: l }, m);
}
panBy(l, m, v) {
return l = a.P.convert(l).mult(-1), this.panTo(this.transform.center, a.e({ offset: l }, m), v);
}
panTo(l, m, v) {
return this.easeTo(a.e({ center: l }, m), v);
}
getZoom() {
return this.transform.zoom;
}
setZoom(l, m) {
return this.jumpTo({ zoom: l }, m), this;
}
zoomTo(l, m, v) {
return this.easeTo(a.e({ zoom: l }, m), v);
}
zoomIn(l, m) {
return this.zoomTo(this.getZoom() + 1, l, m), this;
}
zoomOut(l, m) {
return this.zoomTo(this.getZoom() - 1, l, m), this;
}
getBearing() {
return this.transform.bearing;
}
setBearing(l, m) {
return this.jumpTo({ bearing: l }, m), this;
}
getPadding() {
return this.transform.padding;
}
setPadding(l, m) {
return this.jumpTo({ padding: l }, m), this;
}
rotateTo(l, m, v) {
return this.easeTo(a.e({ bearing: l }, m), v);
}
resetNorth(l, m) {
return this.rotateTo(0, a.e({ duration: 1e3 }, l), m), this;
}
resetNorthPitch(l, m) {
return this.easeTo(a.e({ bearing: 0, pitch: 0, duration: 1e3 }, l), m), this;
}
snapToNorth(l, m) {
return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(l, m) : this;
}
getPitch() {
return this.transform.pitch;
}
setPitch(l, m) {
return this.jumpTo({ pitch: l }, m), this;
}
cameraForBounds(l, m) {
l = Ct.convert(l).adjustAntiMeridian();
const v = m && m.bearing || 0;
return this._cameraForBoxAndBearing(l.getNorthWest(), l.getSouthEast(), v, m);
}
_cameraForBoxAndBearing(l, m, v, b) {
const M = { top: 0, bottom: 0, right: 0, left: 0 };
if (typeof (b = a.e({ padding: M, offset: [0, 0], maxZoom: this.transform.maxZoom }, b)).padding == "number") {
const Oe = b.padding;
b.padding = { top: Oe, bottom: Oe, right: Oe, left: Oe };
}
b.padding = a.e(M, b.padding);
const V = this.transform, D = V.padding, j = new Ct(l, m), Z = V.project(j.getNorthWest()), Y = V.project(j.getNorthEast()), J = V.project(j.getSouthEast()), lt = V.project(j.getSouthWest()), ft = a.ba(-v), Qt = Z.rotate(ft), wt = Y.rotate(ft), Mt = J.rotate(ft), Ht = lt.rotate(ft), Ot = new a.P(Math.max(Qt.x, wt.x, Ht.x, Mt.x), Math.max(Qt.y, wt.y, Ht.y, Mt.y)), bt = new a.P(Math.min(Qt.x, wt.x, Ht.x, Mt.x), Math.min(Qt.y, wt.y, Ht.y, Mt.y)), Nt = Ot.sub(bt), Dt = (V.width - (D.left + D.right + b.padding.left + b.padding.right)) / Nt.x, Wt = (V.height - (D.top + D.bottom + b.padding.top + b.padding.bottom)) / Nt.y;
if (Wt < 0 || Dt < 0)
return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
const he = Math.min(V.scaleZoom(V.scale * Math.min(Dt, Wt)), b.maxZoom), we = a.P.convert(b.offset), De = new a.P((b.padding.left - b.padding.right) / 2, (b.padding.top - b.padding.bottom) / 2).rotate(a.ba(v)), tr = we.add(De).mult(V.scale / V.zoomScale(he));
return { center: V.unproject(Z.add(J).div(2).sub(tr)), zoom: he, bearing: v };
}
fitBounds(l, m, v) {
return this._fitInternal(this.cameraForBounds(l, m), m, v);
}
fitScreenCoordinates(l, m, v, b, M) {
return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.P.convert(l)), this.transform.pointLocation(a.P.convert(m)), v, b), b, M);
}
_fitInternal(l, m, v) {
return l ? (delete (m = a.e(l, m)).padding, m.linear ? this.easeTo(m, v) : this.flyTo(m, v)) : this;
}
jumpTo(l, m) {
this.stop();
const v = this._getTransformForUpdate();
let b = !1, M = !1, V = !1;
return "zoom" in l && v.zoom !== +l.zoom && (b = !0, v.zoom = +l.zoom), l.center !== void 0 && (v.center = a.N.convert(l.center)), "bearing" in l && v.bearing !== +l.bearing && (M = !0, v.bearing = +l.bearing), "pitch" in l && v.pitch !== +l.pitch && (V = !0, v.pitch = +l.pitch), l.padding == null || v.isPaddingEqual(l.padding) || (v.padding = l.padding), this._applyUpdatedTransform(v), this.fire(new a.k("movestart", m)).fire(new a.k("move", m)), b && this.fire(new a.k("zoomstart", m)).fire(new a.k("zoom", m)).fire(new a.k("zoomend", m)), M && this.fire(new a.k("rotatestart", m)).fire(new a.k("rotate", m)).fire(new a.k("rotateend", m)), V && this.fire(new a.k("pitchstart", m)).fire(new a.k("pitch", m)).fire(new a.k("pitchend", m)), this.fire(new a.k("moveend", m));
}
calculateCameraOptionsFromTo(l, m, v, b = 0) {
const M = a.Z.fromLngLat(l, m), V = a.Z.fromLngLat(v, b), D = V.x - M.x, j = V.y - M.y, Z = V.z - M.z, Y = Math.hypot(D, j, Z);
if (Y === 0)
throw new Error("Can't calculate camera options with same From and To");
const J = Math.hypot(D, j), lt = this.transform.scaleZoom(this.transform.cameraToCenterDistance / Y / this.transform.tileSize), ft = 180 * Math.atan2(D, -j) / Math.PI;
let Qt = 180 * Math.acos(J / Y) / Math.PI;
return Qt = Z < 0 ? 90 - Qt : 90 + Qt, { center: V.toLngLat(), zoom: lt, pitch: Qt, bearing: ft };
}
easeTo(l, m) {
var v;
this._stop(!1, l.easeId), ((l = a.e({ offset: [0, 0], duration: 500, easing: a.b9 }, l)).animate === !1 || !l.essential && f.prefersReducedMotion) && (l.duration = 0);
const b = this._getTransformForUpdate(), M = b.zoom, V = b.bearing, D = b.pitch, j = b.padding, Z = "bearing" in l ? this._normalizeBearing(l.bearing, V) : V, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : b.padding, lt = a.P.convert(l.offset);
let ft = b.centerPoint.add(lt);
const Qt = b.pointLocation(ft), { center: wt, zoom: Mt } = b.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(wt, b);
const Ht = b.project(Qt), Ot = b.project(wt).sub(Ht), bt = b.zoomScale(Mt - M);
let Nt, Dt;
l.around && (Nt = a.N.convert(l.around), Dt = b.locationPoint(Nt));
const Wt = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching };
return this._zooming = this._zooming || Mt !== M, this._rotating = this._rotating || V !== Z, this._pitching = this._pitching || Y !== D, this._padding = !b.isPaddingEqual(J), this._easeId = l.easeId, this._prepareEase(m, l.noMoveStart, Wt), this.terrain && this._prepareElevation(wt), this._ease((he) => {
if (this._zooming && (b.zoom = a.y.number(M, Mt, he)), this._rotating && (b.bearing = a.y.number(V, Z, he)), this._pitching && (b.pitch = a.y.number(D, Y, he)), this._padding && (b.interpolatePadding(j, J, he), ft = b.centerPoint.add(lt)), this.terrain && !l.freezeElevation && this._updateElevation(he), Nt)
b.setLocationAtPoint(Nt, Dt);
else {
const we = b.zoomScale(b.zoom - M), De = Mt > M ? Math.min(2, bt) : Math.max(0.5, bt), tr = Math.pow(De, 1 - he), Oe = b.unproject(Ht.add(Ot.mult(he * tr)).mult(we));
b.setLocationAtPoint(b.renderWorldCopies ? Oe.wrap() : Oe, ft);
}
this._applyUpdatedTransform(b), this._fireMoveEvents(m);
}, (he) => {
this.terrain && l.freezeElevation && this._finalizeElevation(), this._afterEase(m, he);
}, l), this;
}
_prepareEase(l, m, v = {}) {
this._moving = !0, m || v.moving || this.fire(new a.k("movestart", l)), this._zooming && !v.zooming && this.fire(new a.k("zoomstart", l)), this._rotating && !v.rotating && this.fire(new a.k("rotatestart", l)), this._pitching && !v.pitching && this.fire(new a.k("pitchstart", l));
}
_prepareElevation(l) {
this._elevationCenter = l, this._elevationStart = this.transform.elevation, this._elevationTarget = this.terrain.getElevationForLngLatZoom(l, this.transform.tileZoom), this._elevationFreeze = !0;
}
_updateElevation(l) {
this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
const m = this.terrain.getElevationForLngLatZoom(this._elevationCenter, this.transform.tileZoom);
if (l < 1 && m !== this._elevationTarget) {
const v = this._elevationTarget - this._elevationStart;
this._elevationStart += l * (v - (m - (v * l + this._elevationStart)) / (1 - l)), this._elevationTarget = m;
}
this.transform.elevation = a.y.number(this._elevationStart, this._elevationTarget, l);
}
_finalizeElevation() {
this._elevationFreeze = !1, this.transform.recalculateZoom(this.terrain);
}
_getTransformForUpdate() {
return this.transformCameraUpdate || this.terrain ? (this._requestedCameraState || (this._requestedCameraState = this.transform.clone()), this._requestedCameraState) : this.transform;
}
_elevateCameraIfInsideTerrain(l) {
const m = l.getCameraPosition(), v = this.terrain.getElevationForLngLatZoom(m.lngLat, l.zoom);
if (m.altitude < v) {
const b = this.calculateCameraOptionsFromTo(m.lngLat, v, l.center, l.elevation);
return { pitch: b.pitch, zoom: b.zoom };
}
return {};
}
_applyUpdatedTransform(l) {
const m = [];
if (this.terrain && m.push((b) => this._elevateCameraIfInsideTerrain(b)), this.transformCameraUpdate && m.push((b) => this.transformCameraUpdate(b)), !m.length)
return;
const v = l.clone();
for (const b of m) {
const M = v.clone(), { center: V, zoom: D, pitch: j, bearing: Z, elevation: Y } = b(M);
V && (M.center = V), D !== void 0 && (M.zoom = D), j !== void 0 && (M.pitch = j), Z !== void 0 && (M.bearing = Z), Y !== void 0 && (M.elevation = Y), v.apply(M);
}
this.transform.apply(v);
}
_fireMoveEvents(l) {
this.fire(new a.k("move", l)), this._zooming && this.fire(new a.k("zoom", l)), this._rotating && this.fire(new a.k("rotate", l)), this._pitching && this.fire(new a.k("pitch", l));
}
_afterEase(l, m) {
if (this._easeId && m && this._easeId === m)
return;
delete this._easeId;
const v = this._zooming, b = this._rotating, M = this._pitching;
this._moving = !1, this._zooming = !1, this._rotating = !1, this._pitching = !1, this._padding = !1, v && this.fire(new a.k("zoomend", l)), b && this.fire(new a.k("rotateend", l)), M && this.fire(new a.k("pitchend", l)), this.fire(new a.k("moveend", l));
}
flyTo(l, m) {
var v;
if (!l.essential && f.prefersReducedMotion) {
const We = a.M(l, ["center", "zoom", "bearing", "pitch", "around"]);
return this.jumpTo(We, m);
}
this.stop(), l = a.e({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: a.b9 }, l);
const b = this._getTransformForUpdate(), M = b.zoom, V = b.bearing, D = b.pitch, j = b.padding, Z = "bearing" in l ? this._normalizeBearing(l.bearing, V) : V, Y = "pitch" in l ? +l.pitch : D, J = "padding" in l ? l.padding : b.padding, lt = a.P.convert(l.offset);
let ft = b.centerPoint.add(lt);
const Qt = b.pointLocation(ft), { center: wt, zoom: Mt } = b.getConstrained(a.N.convert(l.center || Qt), (v = l.zoom) !== null && v !== void 0 ? v : M);
this._normalizeCenter(wt, b);
const Ht = b.zoomScale(Mt - M), Ot = b.project(Qt), bt = b.project(wt).sub(Ot);
let Nt = l.curve;
const Dt = Math.max(b.width, b.height), Wt = Dt / Ht, he = bt.mag();
if ("minZoom" in l) {
const We = a.ac(Math.min(l.minZoom, M, Mt), b.minZoom, b.maxZoom), kr = Dt / b.zoomScale(We - M);
Nt = Math.sqrt(kr / he * 2);
}
const we = Nt * Nt;
function De(We) {
const kr = (Wt * Wt - Dt * Dt + (We ? -1 : 1) * we * we * he * he) / (2 * (We ? Wt : Dt) * we * he);
return Math.log(Math.sqrt(kr * kr + 1) - kr);
}
function tr(We) {
return (Math.exp(We) - Math.exp(-We)) / 2;
}
function Oe(We) {
return (Math.exp(We) + Math.exp(-We)) / 2;
}
const Ae = De(!1);
let ur = function(We) {
return Oe(Ae) / Oe(Ae + Nt * We);
}, Nr = function(We) {
return Dt * ((Oe(Ae) * (tr(kr = Ae + Nt * We) / Oe(kr)) - tr(Ae)) / we) / he;
var kr;
}, Pe = (De(!0) - Ae) / Nt;
if (Math.abs(he) < 1e-6 || !isFinite(Pe)) {
if (Math.abs(Dt - Wt) < 1e-6)
return this.easeTo(l, m);
const We = Wt < Dt ? -1 : 1;
Pe = Math.abs(Math.log(Wt / Dt)) / Nt, Nr = () => 0, ur = (kr) => Math.exp(We * Nt * kr);
}
return l.duration = "duration" in l ? +l.duration : 1e3 * Pe / ("screenSpeed" in l ? +l.screenSpeed / Nt : +l.speed), l.maxDuration && l.duration > l.maxDuration && (l.duration = 0), this._zooming = !0, this._rotating = V !== Z, this._pitching = Y !== D, this._padding = !b.isPaddingEqual(J), this._prepareEase(m, !1), this.terrain && this._prepareElevation(wt), this._ease((We) => {
const kr = We * Pe, ei = 1 / ur(kr);
b.zoom = We === 1 ? Mt : M + b.scaleZoom(ei), this._rotating && (b.bearing = a.y.number(V, Z, We)), this._pitching && (b.pitch = a.y.number(D, Y, We)), this._padding && (b.interpolatePadding(j, J, We), ft = b.centerPoint.add(lt)), this.terrain && !l.freezeElevation && this._updateElevation(We);
const Wr = We === 1 ? wt : b.unproject(Ot.add(bt.mult(Nr(kr))).mult(ei));
b.setLocationAtPoint(b.renderWorldCopies ? Wr.wrap() : Wr, ft), this._applyUpdatedTransform(b), this._fireMoveEvents(m);
}, () => {
this.terrain && l.freezeElevation && this._finalizeElevation(), this._afterEase(m);
}, l), this;
}
isEasing() {
return !!this._easeFrameId;
}
stop() {
return this._stop();
}
_stop(l, m) {
var v;
if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) {
const b = this._onEaseEnd;
delete this._onEaseEnd, b.call(this, m);
}
return l || (v = this.handlers) === null || v === void 0 || v.stop(!1), this;
}
_ease(l, m, v) {
v.animate === !1 || v.duration === 0 ? (l(1), m()) : (this._easeStart = f.now(), this._easeOptions = v, this._onEaseFrame = l, this._onEaseEnd = m, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback));
}
_normalizeBearing(l, m) {
l = a.b3(l, -180, 180);
const v = Math.abs(l - m);
return Math.abs(l - 360 - m) < v && (l -= 360), Math.abs(l + 360 - m) < v && (l += 360), l;
}
_normalizeCenter(l, m) {
if (!m.renderWorldCopies || m.lngRange)
return;
const v = l.lng - m.center.lng;
l.lng += v > 180 ? -360 : v < -180 ? 360 : 0;
}
queryTerrainElevation(l) {
return this.terrain ? this.terrain.getElevationForLngLatZoom(a.N.convert(l), this.transform.tileZoom) - this.transform.elevation : null;
}
}
const r6 = { compact: !0, customAttribution: 'MapLibre' };
class n6 {
constructor(l = r6) {
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 = (m) => {
!m || m.sourceDataType !== "metadata" && m.sourceDataType !== "visibility" && m.dataType !== "style" && m.type !== "terrain" || this._updateAttributions();
}, this._updateCompact = () => {
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? this._compact === !1 ? this._container.setAttribute("open", "") : this._container.classList.contains("maplibregl-compact") || this._container.classList.contains("maplibregl-attrib-empty") || (this._container.setAttribute("open", ""), this._container.classList.add("maplibregl-compact", "maplibregl-compact-show")) : (this._container.setAttribute("open", ""), this._container.classList.contains("maplibregl-compact") && this._container.classList.remove("maplibregl-compact", "maplibregl-compact-show"));
}, this._updateCompactMinimize = () => {
this._container.classList.contains("maplibregl-compact") && this._container.classList.contains("maplibregl-compact-show") && this._container.classList.remove("maplibregl-compact-show");
}, this.options = l;
}
getDefaultPosition() {
return "bottom-right";
}
onAdd(l) {
return this._map = l, this._compact = this.options.compact, this._container = Q.create("details", "maplibregl-ctrl maplibregl-ctrl-attrib"), this._compactButton = Q.create("summary", "maplibregl-ctrl-attrib-button", this._container), this._compactButton.addEventListener("click", this._toggleAttribution), this._setElementTitle(this._compactButton, "ToggleAttribution"), this._innerContainer = Q.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() {
Q.remove(this._container), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("terrain", this._updateData), this._map.off("resize", this._updateCompact), this._map.off("drag", this._updateCompactMinimize), this._map = void 0, this._compact = void 0, this._attribHTML = void 0;
}
_setElementTitle(l, m) {
const v = this._map._getUIString(`AttributionControl.${m}`);
l.title = v, l.setAttribute("aria-label", v);
}
_updateAttributions() {
if (!this._map.style)
return;
let l = [];
if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? l = l.concat(this.options.customAttribution.map((b) => typeof b != "string" ? "" : b)) : typeof this.options.customAttribution == "string" && l.push(this.options.customAttribution)), this._map.style.stylesheet) {
const b = this._map.style.stylesheet;
this.styleOwner = b.owner, this.styleId = b.id;
}
const m = this._map.style.sourceCaches;
for (const b in m) {
const M = m[b];
if (M.used || M.usedForTerrain) {
const V = M.getSource();
V.attribution && l.indexOf(V.attribution) < 0 && l.push(V.attribution);
}
}
l = l.filter((b) => String(b).trim()), l.sort((b, M) => b.length - M.length), l = l.filter((b, M) => {
for (let V = M + 1; V < l.length; V++)
if (l[V].indexOf(b) >= 0)
return !1;
return !0;
});
const v = l.join(" | ");
v !== this._attribHTML && (this._attribHTML = v, l.length ? (this._innerContainer.innerHTML = v, this._container.classList.remove("maplibregl-attrib-empty")) : this._container.classList.add("maplibregl-attrib-empty"), this._updateCompact(), this._editLink = null);
}
}
class Vc {
constructor(l = {}) {
this._updateCompact = () => {
const m = this._container.children;
if (m.length) {
const v = m[0];
this._map.getCanvasContainer().offsetWidth <= 640 || this._compact ? this._compact !== !1 && v.classList.add("maplibregl-compact") : v.classList.remove("maplibregl-compact");
}
}, this.options = l;
}
getDefaultPosition() {
return "bottom-left";
}
onAdd(l) {
this._map = l, this._compact = this.options && this.options.compact, this._container = Q.create("div", "maplibregl-ctrl");
const m = Q.create("a", "maplibregl-ctrl-logo");
return m.target = "_blank", m.rel = "noopener nofollow", m.href = "https://maplibre.org/", m.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), m.setAttribute("rel", "noopener nofollow"), this._container.appendChild(m), this._container.style.display = "block", this._map.on("resize", this._updateCompact), this._updateCompact(), this._container;
}
onRemove() {
Q.remove(this._container), this._map.off("resize", this._updateCompact), this._map = void 0, this._compact = void 0;
}
}
class sn {
constructor() {
this._queue = [], this._id = 0, this._cleared = !1, this._currentlyRunning = !1;
}
add(l) {
const m = ++this._id;
return this._queue.push({ callback: l, id: m, cancelled: !1 }), m;
}
remove(l) {
const m = this._currentlyRunning, v = m ? this._queue.concat(m) : this._queue;
for (const b of v)
if (b.id === l)
return void (b.cancelled = !0);
}
run(l = 0) {
if (this._currentlyRunning)
throw new Error("Attempting to run(), but is already running.");
const m = this._currentlyRunning = this._queue;
this._queue = [];
for (const v of m)
if (!v.cancelled && (v.callback(l), this._cleared))
break;
this._cleared = !1, this._currentlyRunning = !1;
}
clear() {
this._currentlyRunning && (this._cleared = !0), this._queue = [];
}
}
var Rc = a.Y([{ name: "a_pos3d", type: "Int16", components: 3 }]);
class m_ extends a.E {
constructor(l) {
super(), this.sourceCache = l, this._tiles = {}, this._renderableTilesKeys = [], this._sourceTileCache = {}, this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.deltaZoom = 1, l.usedForTerrain = !0, l.tileSize = this.tileSize * 2 ** this.deltaZoom;
}
destruct() {
this.sourceCache.usedForTerrain = !1, this.sourceCache.tileSize = null;
}
update(l, m) {
this.sourceCache.update(l, m), this._renderableTilesKeys = [];
const v = {};
for (const b of l.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, reparseOverscaled: !1, terrain: m }))
v[b.key] = !0, this._renderableTilesKeys.push(b.key), this._tiles[b.key] || (b.posMatrix = new Float64Array(16), a.aP(b.posMatrix, 0, a.X, 0, a.X, 0, 1), this._tiles[b.key] = new t1(b, this.tileSize));
for (const b in this._tiles)
v[b] || delete this._tiles[b];
}
freeRtt(l) {
for (const m in this._tiles) {
const v = this._tiles[m];
(!l || v.tileID.equals(l) || v.tileID.isChildOf(l) || l.isChildOf(v.tileID)) && (v.rtt = []);
}
}
getRenderableTiles() {
return this._renderableTilesKeys.map((l) => this.getTileByID(l));
}
getTileByID(l) {
return this._tiles[l];
}
getTerrainCoords(l) {
const m = {};
for (const v of this._renderableTilesKeys) {
const b = this._tiles[v].tileID;
if (b.canonical.equals(l.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16), a.aP(M.posMatrix, 0, a.X, 0, a.X, 0, 1), m[v] = M;
} else if (b.canonical.isChildOf(l.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const V = b.canonical.z - l.canonical.z, D = b.canonical.x - (b.canonical.x >> V << V), j = b.canonical.y - (b.canonical.y >> V << V), Z = a.X >> V;
a.aP(M.posMatrix, 0, Z, 0, Z, 0, 1), a.J(M.posMatrix, M.posMatrix, [-D * Z, -j * Z, 0]), m[v] = M;
} else if (l.canonical.isChildOf(b.canonical)) {
const M = l.clone();
M.posMatrix = new Float64Array(16);
const V = l.canonical.z - b.canonical.z, D = l.canonical.x - (l.canonical.x >> V << V), j = l.canonical.y - (l.canonical.y >> V << V), Z = a.X >> V;
a.aP(M.posMatrix, 0, a.X, 0, a.X, 0, 1), a.J(M.posMatrix, M.posMatrix, [D * Z, j * Z, 0]), a.K(M.posMatrix, M.posMatrix, [1 / 2 ** V, 1 / 2 ** V, 0]), m[v] = M;
}
}
return m;
}
getSourceTile(l, m) {
const v = this.sourceCache._source;
let b = l.overscaledZ - this.deltaZoom;
if (b > v.maxzoom && (b = v.maxzoom), b < v.minzoom)
return null;
this._sourceTileCache[l.key] || (this._sourceTileCache[l.key] = l.scaledTo(b).key);
let M = this.sourceCache.getTileByID(this._sourceTileCache[l.key]);
if ((!M || !M.dem) && m)
for (; b >= v.minzoom && (!M || !M.dem); )
M = this.sourceCache.getTileByID(l.scaledTo(b--).key);
return M;
}
tilesAfterTime(l = Date.now()) {
return Object.values(this._tiles).filter((m) => m.timeAdded >= l);
}
}
class Nc {
constructor(l, m, v) {
this.painter = l, this.sourceCache = new m_(m), this.options = v, this.exaggeration = typeof v.exaggeration == "number" ? v.exaggeration : 1, this.qualityFactor = 2, this.meshSize = 128, this._demMatrixCache = {}, this.coordsIndex = [], this._coordsTextureSize = 1024;
}
getDEMElevation(l, m, v, b = a.X) {
var M;
if (!(m >= 0 && m < b && v >= 0 && v < b))
return 0;
const V = this.getTerrainData(l), D = (M = V.tile) === null || M === void 0 ? void 0 : M.dem;
if (!D)
return 0;
const j = function(Qt, wt, Mt) {
var Ht = wt[0], Ot = wt[1];
return Qt[0] = Mt[0] * Ht + Mt[4] * Ot + Mt[12], Qt[1] = Mt[1] * Ht + Mt[5] * Ot + Mt[13], Qt;
}([], [m / b * a.X, v / b * a.X], V.u_terrain_matrix), Z = [j[0] * D.dim, j[1] * D.dim], Y = Math.floor(Z[0]), J = Math.floor(Z[1]), lt = Z[0] - Y, ft = Z[1] - J;
return D.get(Y, J) * (1 - lt) * (1 - ft) + D.get(Y + 1, J) * lt * (1 - ft) + D.get(Y, J + 1) * (1 - lt) * ft + D.get(Y + 1, J + 1) * lt * ft;
}
getElevationForLngLatZoom(l, m) {
if (!a.bb(m, l.wrap()))
return 0;
const { tileID: v, mercatorX: b, mercatorY: M } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return this.getElevation(v, b % a.X, M % a.X, a.X);
}
getElevation(l, m, v, b = a.X) {
return this.getDEMElevation(l, m, v, b) * this.exaggeration;
}
getTerrainData(l) {
if (!this._emptyDemTexture) {
const b = this.painter.context, M = new a.R({ width: 1, height: 1 }, new Uint8Array(4));
this._emptyDepthTexture = new rt(b, M, b.gl.RGBA, { premultiply: !1 }), this._emptyDemUnpack = [0, 0, 0, 0], this._emptyDemTexture = new rt(b, new a.R({ width: 1, height: 1 }), b.gl.RGBA, { premultiply: !1 }), this._emptyDemTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), this._emptyDemMatrix = a.an([]);
}
const m = this.sourceCache.getSourceTile(l, !0);
if (m && m.dem && (!m.demTexture || m.needsTerrainPrepare)) {
const b = this.painter.context;
m.demTexture = this.painter.getTileTexture(m.dem.stride), m.demTexture ? m.demTexture.update(m.dem.getPixels(), { premultiply: !1 }) : m.demTexture = new rt(b, m.dem.getPixels(), b.gl.RGBA, { premultiply: !1 }), m.demTexture.bind(b.gl.NEAREST, b.gl.CLAMP_TO_EDGE), m.needsTerrainPrepare = !1;
}
const v = m && m + m.tileID.key + l.key;
if (v && !this._demMatrixCache[v]) {
const b = this.sourceCache.sourceCache._source.maxzoom;
let M = l.canonical.z - m.tileID.canonical.z;
l.overscaledZ > l.canonical.z && (l.canonical.z >= b ? M = l.canonical.z - b : a.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));
const V = l.canonical.x - (l.canonical.x >> M << M), D = l.canonical.y - (l.canonical.y >> M << M), j = a.bc(new Float64Array(16), [1 / (a.X << M), 1 / (a.X << M), 0]);
a.J(j, j, [V * a.X, D * a.X, 0]), this._demMatrixCache[l.key] = { matrix: j, coord: l };
}
return { u_depth: 2, u_terrain: 3, u_terrain_dim: m && m.dem && m.dem.dim || 1, u_terrain_matrix: v ? this._demMatrixCache[l.key].matrix : this._emptyDemMatrix, u_terrain_unpack: m && m.dem && m.dem.getUnpackVector() || this._emptyDemUnpack, u_terrain_exaggeration: this.exaggeration, texture: (m && m.demTexture || this._emptyDemTexture).texture, depthTexture: (this._fboDepthTexture || this._emptyDepthTexture).texture, tile: m };
}
getFramebuffer(l) {
const m = this.painter, v = m.width / devicePixelRatio, b = m.height / devicePixelRatio;
return !this._fbo || this._fbo.width === v && this._fbo.height === b || (this._fbo.destroy(), this._fboCoordsTexture.destroy(), this._fboDepthTexture.destroy(), delete this._fbo, delete this._fboDepthTexture, delete this._fboCoordsTexture), this._fboCoordsTexture || (this._fboCoordsTexture = new rt(m.context, { width: v, height: b, data: null }, m.context.gl.RGBA, { premultiply: !1 }), this._fboCoordsTexture.bind(m.context.gl.NEAREST, m.context.gl.CLAMP_TO_EDGE)), this._fboDepthTexture || (this._fboDepthTexture = new rt(m.context, { width: v, height: b, data: null }, m.context.gl.RGBA, { premultiply: !1 }), this._fboDepthTexture.bind(m.context.gl.NEAREST, m.context.gl.CLAMP_TO_EDGE)), this._fbo || (this._fbo = m.context.createFramebuffer(v, b, !0, !1), this._fbo.depthAttachment.set(m.context.createRenderbuffer(m.context.gl.DEPTH_COMPONENT16, v, b))), this._fbo.colorAttachment.set(l === "coords" ? this._fboCoordsTexture.texture : this._fboDepthTexture.texture), this._fbo;
}
getCoordsTexture() {
const l = this.painter.context;
if (this._coordsTexture)
return this._coordsTexture;
const m = new Uint8Array(this._coordsTextureSize * this._coordsTextureSize * 4);
for (let M = 0, V = 0; M < this._coordsTextureSize; M++)
for (let D = 0; D < this._coordsTextureSize; D++, V += 4)
m[V + 0] = 255 & D, m[V + 1] = 255 & M, m[V + 2] = D >> 8 << 4 | M >> 8, m[V + 3] = 0;
const v = new a.R({ width: this._coordsTextureSize, height: this._coordsTextureSize }, new Uint8Array(m.buffer)), b = new rt(l, v, l.gl.RGBA, { premultiply: !1 });
return b.bind(l.gl.NEAREST, l.gl.CLAMP_TO_EDGE), this._coordsTexture = b, b;
}
pointCoordinate(l) {
this.painter.maybeDrawDepthAndCoords(!0);
const m = new Uint8Array(4), v = this.painter.context, b = v.gl, M = Math.round(l.x * this.painter.pixelRatio / devicePixelRatio), V = Math.round(l.y * this.painter.pixelRatio / devicePixelRatio), D = Math.round(this.painter.height / devicePixelRatio);
v.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer), b.readPixels(M, D - V - 1, 1, 1, b.RGBA, b.UNSIGNED_BYTE, m), v.bindFramebuffer.set(null);
const j = m[0] + (m[2] >> 4 << 8), Z = m[1] + ((15 & m[2]) << 8), Y = this.coordsIndex[255 - m[3]], J = Y && this.sourceCache.getTileByID(Y);
if (!J)
return null;
const lt = this._coordsTextureSize, ft = (1 << J.tileID.canonical.z) * lt;
return new a.Z((J.tileID.canonical.x * lt + j) / ft + J.tileID.wrap, (J.tileID.canonical.y * lt + Z) / ft, this.getElevation(J.tileID, j, Z, lt));
}
depthAtPoint(l) {
const m = new Uint8Array(4), v = this.painter.context, b = v.gl;
return v.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer), b.readPixels(l.x, this.painter.height / devicePixelRatio - l.y - 1, 1, 1, b.RGBA, b.UNSIGNED_BYTE, m), v.bindFramebuffer.set(null), (m[0] / 16777216 + m[1] / 65536 + m[2] / 256 + m[3]) / 256;
}
getTerrainMesh() {
if (this._mesh)
return this._mesh;
const l = this.painter.context, m = new a.bd(), v = new a.aY(), b = this.meshSize, M = a.X / b, V = b * b;
for (let J = 0; J <= b; J++)
for (let lt = 0; lt <= b; lt++)
m.emplaceBack(lt * M, J * M, 0);
for (let J = 0; J < V; J += b + 1)
for (let lt = 0; lt < b; lt++)
v.emplaceBack(lt + J, b + lt + J + 1, b + lt + J + 2), v.emplaceBack(lt + J, b + lt + J + 2, lt + J + 1);
const D = m.length, j = D + 2 * (b + 1);
for (const J of [0, 1])
for (let lt = 0; lt <= b; lt++)
for (const ft of [0, 1])
m.emplaceBack(lt * M, J * a.X, ft);
for (let J = 0; J < 2 * b; J += 2)
v.emplaceBack(j + J, j + J + 1, j + J + 3), v.emplaceBack(j + J, j + J + 3, j + J + 2), v.emplaceBack(D + J, D + J + 3, D + J + 1), v.emplaceBack(D + J, D + J + 2, D + J + 3);
const Z = m.length, Y = Z + 2 * (b + 1);
for (const J of [0, 1])
for (let lt = 0; lt <= b; lt++)
for (const ft of [0, 1])
m.emplaceBack(J * a.X, lt * M, ft);
for (let J = 0; J < 2 * b; J += 2)
v.emplaceBack(Z + J, Z + J + 1, Z + J + 3), v.emplaceBack(Z + J, Z + J + 3, Z + J + 2), v.emplaceBack(Y + J, Y + J + 3, Y + J + 1), v.emplaceBack(Y + J, Y + J + 2, Y + J + 3);
return this._mesh = new gi(l.createVertexBuffer(m, Rc.members), l.createIndexBuffer(v), a.a0.simpleSegment(0, 0, m.length, v.length)), this._mesh;
}
getMeshFrameDelta(l) {
return 2 * Math.PI * a.be / Math.pow(2, l) / 5;
}
getMinTileElevationForLngLatZoom(l, m) {
var v;
const { tileID: b } = this._getOverscaledTileIDFromLngLatZoom(l, m);
return (v = this.getMinMaxElevation(b).minElevation) !== null && v !== void 0 ? v : 0;
}
getMinMaxElevation(l) {
const m = this.getTerrainData(l).tile, v = { minElevation: null, maxElevation: null };
return m && m.dem && (v.minElevation = m.dem.min * this.exaggeration, v.maxElevation = m.dem.max * this.exaggeration), v;
}
_getOverscaledTileIDFromLngLatZoom(l, m) {
const v = a.Z.fromLngLat(l.wrap()), b = (1 << m) * a.X, M = v.x * b, V = v.y * b, D = Math.floor(M / a.X), j = Math.floor(V / a.X);
return { tileID: new a.S(m, 0, m, D, j), mercatorX: M, mercatorY: V };
}
}
class g_ {
constructor(l, m, v) {
this._context = l, this._size = m, this._tileSize = v, this._objects = [], this._recentlyUsed = [], this._stamp = 0;
}
destruct() {
for (const l of this._objects)
l.texture.destroy(), l.fbo.destroy();
}
_createObject(l) {
const m = this._context.createFramebuffer(this._tileSize, this._tileSize, !0, !0), v = new rt(this._context, { width: this._tileSize, height: this._tileSize, data: null }, this._context.gl.RGBA);
return v.bind(this._context.gl.LINEAR, this._context.gl.CLAMP_TO_EDGE), m.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL, this._tileSize, this._tileSize)), m.colorAttachment.set(v.texture), { id: l, fbo: m, texture: v, stamp: -1, inUse: !1 };
}
getObjectForId(l) {
return this._objects[l];
}
useObject(l) {
l.inUse = !0, this._recentlyUsed = this._recentlyUsed.filter((m) => l.id !== m), this._recentlyUsed.push(l.id);
}
stampObject(l) {
l.stamp = ++this._stamp;
}
getOrCreateFreeObject() {
for (const m of this._recentlyUsed)
if (!this._objects[m].inUse)
return this._objects[m];
if (this._objects.length >= this._size)
throw new Error("No free RenderPool available, call freeAllObjects() required!");
const l = this._createObject(this._objects.length);
return this._objects.push(l), l;
}
freeObject(l) {
l.inUse = !1;
}
freeAllObjects() {
for (const l of this._objects)
this.freeObject(l);
}
isFull() {
return !(this._objects.length < this._size) && this._objects.some((l) => !l.inUse) === !1;
}
}
const i6 = { background: !0, fill: !0, line: !0, raster: !0, hillshade: !0 };
class vp {
constructor(l, m) {
this.painter = l, this.terrain = m, this.pool = new g_(l.context, 30, m.sourceCache.tileSize * m.qualityFactor);
}
destruct() {
this.pool.destruct();
}
getTexture(l) {
return this.pool.getObjectForId(l.rtt[this._stacks.length - 1].id).texture;
}
prepareForRender(l, m) {
this._stacks = [], this._prevType = null, this._rttTiles = [], this._renderableTiles = this.terrain.sourceCache.getRenderableTiles(), this._renderableLayerIds = l._order.filter((v) => !l._layers[v].isHidden(m)), this._coordsDescendingInv = {};
for (const v in l.sourceCaches) {
this._coordsDescendingInv[v] = {};
const b = l.sourceCaches[v].getVisibleCoordinates();
for (const M of b) {
const V = this.terrain.sourceCache.getTerrainCoords(M);
for (const D in V)
this._coordsDescendingInv[v][D] || (this._coordsDescendingInv[v][D] = []), this._coordsDescendingInv[v][D].push(V[D]);
}
}
this._coordsDescendingInvStr = {};
for (const v of l._order) {
const b = l._layers[v], M = b.source;
if (i6[b.type] && !this._coordsDescendingInvStr[M]) {
this._coordsDescendingInvStr[M] = {};
for (const V in this._coordsDescendingInv[M])
this._coordsDescendingInvStr[M][V] = this._coordsDescendingInv[M][V].map((D) => D.key).sort().join();
}
}
for (const v of this._renderableTiles)
for (const b in this._coordsDescendingInvStr) {
const M = this._coordsDescendingInvStr[b][v.tileID.key];
M && M !== v.rttCoords[b] && (v.rtt = []);
}
}
renderLayer(l) {
if (l.isHidden(this.painter.transform.zoom))
return !1;
const m = l.type, v = this.painter, b = this._renderableLayerIds[this._renderableLayerIds.length - 1] === l.id;
if (i6[m] && (this._prevType && i6[this._prevType] || this._stacks.push([]), this._prevType = m, this._stacks[this._stacks.length - 1].push(l.id), !b))
return !0;
if (i6[this._prevType] || i6[m] && b) {
this._prevType = m;
const M = this._stacks.length - 1, V = this._stacks[M] || [];
for (const D of this._renderableTiles) {
if (this.pool.isFull() && (To(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects()), this._rttTiles.push(D), D.rtt[M]) {
const Z = this.pool.getObjectForId(D.rtt[M].id);
if (Z.stamp === D.rtt[M].stamp) {
this.pool.useObject(Z);
continue;
}
}
const j = this.pool.getOrCreateFreeObject();
this.pool.useObject(j), this.pool.stampObject(j), D.rtt[M] = { id: j.id, stamp: j.stamp }, v.context.bindFramebuffer.set(j.fbo.framebuffer), v.context.clear({ color: a.aM.transparent, stencil: 0 }), v.currentStencilSource = void 0;
for (let Z = 0; Z < V.length; Z++) {
const Y = v.style._layers[V[Z]], J = Y.source ? this._coordsDescendingInv[Y.source][D.tileID.key] : [D.tileID];
v.context.viewport.set([0, 0, j.fbo.width, j.fbo.height]), v._renderTileClippingMasks(Y, J), v.renderLayer(v, v.style.sourceCaches[Y.source], Y, J), Y.source && (D.rttCoords[Y.source] = this._coordsDescendingInvStr[Y.source][D.tileID.key]);
}
}
return To(this.painter, this.terrain, this._rttTiles), this._rttTiles = [], this.pool.freeAllObjects(), i6[m];
}
return !1;
}
}
const Dc = { "AttributionControl.ToggleAttribution": "Toggle attribution", "AttributionControl.MapFeedback": "Map feedback", "FullscreenControl.Enter": "Enter fullscreen", "FullscreenControl.Exit": "Exit fullscreen", "GeolocateControl.FindMyLocation": "Find my location", "GeolocateControl.LocationNotAvailable": "Location not available", "LogoControl.Title": "MapLibre logo", "Map.Title": "Map", "Marker.Title": "Map marker", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "Popup.Close": "Close popup", "ScaleControl.Feet": "ft", "ScaleControl.Meters": "m", "ScaleControl.Kilometers": "km", "ScaleControl.Miles": "mi", "ScaleControl.NauticalMiles": "nm", "TerrainControl.Enable": "Enable terrain", "TerrainControl.Disable": "Disable terrain", "CooperativeGesturesHandler.WindowsHelpText": "Use Ctrl + scroll to zoom the map", "CooperativeGesturesHandler.MacHelpText": "Use ⌘ + scroll to zoom the map", "CooperativeGesturesHandler.MobileHelpText": "Use two fingers to move the map" }, _p = u, y_ = { hash: !1, interactive: !0, bearingSnap: 7, attributionControl: r6, maplibreLogo: !1, failIfMajorPerformanceCaveat: !1, preserveDrawingBuffer: !1, refreshExpiredTiles: !0, scrollZoom: !0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 60, boxZoom: !0, dragRotate: !0, dragPan: !0, keyboard: !0, doubleClickZoom: !0, touchZoomRotate: !0, touchPitch: !0, cooperativeGestures: !1, trackResize: !0, center: [0, 0], zoom: 0, bearing: 0, pitch: 0, renderWorldCopies: !0, maxTileCacheSize: null, maxTileCacheZoomLevels: a.a.MAX_TILE_CACHE_ZOOM_LEVELS, transformRequest: null, transformCameraUpdate: null, fadeDuration: 300, crossSourceCollisions: !0, clickTolerance: 3, localIdeographFontFamily: "sans-serif", pitchWithRotate: !0, validateStyle: !0, maxCanvasSize: [4096, 4096], cancelPendingTileRequestsWhileZooming: !0 }, Fc = (S) => {
S.touchstart = S.dragStart, S.touchmoveWindow = S.dragMove, S.touchend = S.dragEnd;
}, v_ = { showCompass: !0, showZoom: !0, visualizePitch: !1 };
class __ {
constructor(l, m, v = !1) {
this.mousedown = (V) => {
this.startMouse(a.e({}, V, { ctrlKey: !0, preventDefault: () => V.preventDefault() }), Q.mousePos(this.element, V)), Q.addEventListener(window, "mousemove", this.mousemove), Q.addEventListener(window, "mouseup", this.mouseup);
}, this.mousemove = (V) => {
this.moveMouse(V, Q.mousePos(this.element, V));
}, this.mouseup = (V) => {
this.mouseRotate.dragEnd(V), this.mousePitch && this.mousePitch.dragEnd(V), this.offTemp();
}, this.touchstart = (V) => {
V.targetTouches.length !== 1 ? this.reset() : (this._startPos = this._lastPos = Q.touchPos(this.element, V.targetTouches)[0], this.startTouch(V, this._startPos), Q.addEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.addEventListener(window, "touchend", this.touchend));
}, this.touchmove = (V) => {
V.targetTouches.length !== 1 ? this.reset() : (this._lastPos = Q.touchPos(this.element, V.targetTouches)[0], this.moveTouch(V, this._lastPos));
}, this.touchend = (V) => {
V.targetTouches.length === 0 && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), delete this._startPos, delete this._lastPos, this.offTemp();
}, this.reset = () => {
this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), this.touchRotate.reset(), this.touchPitch && this.touchPitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp();
}, this._clickTolerance = 10;
const b = l.dragRotate._mouseRotate.getClickTolerance(), M = l.dragRotate._mousePitch.getClickTolerance();
this.element = m, this.mouseRotate = Mc({ clickTolerance: b, enable: !0 }), this.touchRotate = (({ enable: V, clickTolerance: D, bearingDegreesPerPixelMoved: j = 0.8 }) => {
const Z = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ bearingDelta: (J.x - Y.x) * j }), moveStateManager: Z, enable: V, assignEvents: Fc });
})({ clickTolerance: b, enable: !0 }), this.map = l, v && (this.mousePitch = Sc({ clickTolerance: M, enable: !0 }), this.touchPitch = (({ enable: V, clickTolerance: D, pitchDegreesPerPixelMoved: j = -0.5 }) => {
const Z = new xa();
return new Qo({ clickTolerance: D, move: (Y, J) => ({ pitchDelta: (J.y - Y.y) * j }), moveStateManager: Z, enable: V, assignEvents: Fc });
})({ clickTolerance: M, enable: !0 })), Q.addEventListener(m, "mousedown", this.mousedown), Q.addEventListener(m, "touchstart", this.touchstart, { passive: !1 }), Q.addEventListener(m, "touchcancel", this.reset);
}
startMouse(l, m) {
this.mouseRotate.dragStart(l, m), this.mousePitch && this.mousePitch.dragStart(l, m), Q.disableDrag();
}
startTouch(l, m) {
this.touchRotate.dragStart(l, m), this.touchPitch && this.touchPitch.dragStart(l, m), Q.disableDrag();
}
moveMouse(l, m) {
const v = this.map, { bearingDelta: b } = this.mouseRotate.dragMove(l, m) || {};
if (b && v.setBearing(v.getBearing() + b), this.mousePitch) {
const { pitchDelta: M } = this.mousePitch.dragMove(l, m) || {};
M && v.setPitch(v.getPitch() + M);
}
}
moveTouch(l, m) {
const v = this.map, { bearingDelta: b } = this.touchRotate.dragMove(l, m) || {};
if (b && v.setBearing(v.getBearing() + b), this.touchPitch) {
const { pitchDelta: M } = this.touchPitch.dragMove(l, m) || {};
M && v.setPitch(v.getPitch() + M);
}
}
off() {
const l = this.element;
Q.removeEventListener(l, "mousedown", this.mousedown), Q.removeEventListener(l, "touchstart", this.touchstart, { passive: !1 }), Q.removeEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.removeEventListener(window, "touchend", this.touchend), Q.removeEventListener(l, "touchcancel", this.reset), this.offTemp();
}
offTemp() {
Q.enableDrag(), Q.removeEventListener(window, "mousemove", this.mousemove), Q.removeEventListener(window, "mouseup", this.mouseup), Q.removeEventListener(window, "touchmove", this.touchmove, { passive: !1 }), Q.removeEventListener(window, "touchend", this.touchend);
}
}
let Vo;
function ti(S, l, m) {
const v = new a.N(S.lng, S.lat);
if (S = new a.N(S.lng, S.lat), l) {
const b = new a.N(S.lng - 360, S.lat), M = new a.N(S.lng + 360, S.lat), V = m.locationPoint(S).distSqr(l);
m.locationPoint(b).distSqr(l) < V ? S = b : m.locationPoint(M).distSqr(l) < V && (S = M);
}
for (; Math.abs(S.lng - m.center.lng) > 180; ) {
const b = m.locationPoint(S);
if (b.x >= 0 && b.y >= 0 && b.x <= m.width && b.y <= m.height)
break;
S.lng > m.center.lng ? S.lng -= 360 : S.lng += 360;
}
return S.lng !== v.lng && m.locationPoint(S).y > m.height / 2 - m.getHorizon() ? S : v;
}
const o6 = { 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 Al(S, l, m) {
const v = S.classList;
for (const b in o6)
v.remove(`maplibregl-${m}-anchor-${b}`);
v.add(`maplibregl-${m}-anchor-${l}`);
}
class Ol extends a.E {
constructor(l) {
if (super(), this._onKeyPress = (m) => {
const v = m.code, b = m.charCode || m.keyCode;
v !== "Space" && v !== "Enter" && b !== 32 && b !== 13 || this.togglePopup();
}, this._onMapClick = (m) => {
const v = m.originalEvent.target, b = this._element;
this._popup && (v === b || b.contains(v)) && this.togglePopup();
}, this._update = (m) => {
var v;
if (!this._map)
return;
const b = this._map.loaded() && !this._map.isMoving();
((m == null ? void 0 : m.type) === "terrain" || (m == null ? void 0 : m.type) === "render" && !b) && this._map.once("render", this._update), this._lngLat = this._map.transform.renderWorldCopies ? ti(this._lngLat, this._flatPos, this._map.transform) : (v = this._lngLat) === null || v === void 0 ? void 0 : v.wrap(), this._flatPos = this._pos = this._map.project(this._lngLat)._add(this._offset), this._map.terrain && (this._flatPos = this._map.transform.locationPoint(this._lngLat)._add(this._offset));
let M = "";
this._rotationAlignment === "viewport" || this._rotationAlignment === "auto" ? M = `rotateZ(${this._rotation}deg)` : this._rotationAlignment === "map" && (M = `rotateZ(${this._rotation - this._map.getBearing()}deg)`);
let V = "";
this._pitchAlignment === "viewport" || this._pitchAlignment === "auto" ? V = "rotateX(0deg)" : this._pitchAlignment === "map" && (V = `rotateX(${this._map.getPitch()}deg)`), this._subpixelPositioning || m && m.type !== "moveend" || (this._pos = this._pos.round()), Q.setTransform(this._element, `${o6[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${V} ${M}`), f.frameAsync(new AbortController()).then(() => {
this._updateOpacity(m && m.type === "moveend");
}).catch(() => {
});
}, this._onMove = (m) => {
if (!this._isDragging) {
const v = this._clickTolerance || this._map._clickTolerance;
this._isDragging = m.point.dist(this._pointerdownPos) >= v;
}
this._isDragging && (this._pos = m.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", this._state === "pending" && (this._state = "active", this.fire(new a.k("dragstart"))), this.fire(new a.k("drag")));
}, this._onUp = () => {
this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = !1, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), this._state === "active" && this.fire(new a.k("dragend")), this._state = "inactive";
}, this._addDragHandler = (m) => {
this._element.contains(m.originalEvent.target) && (m.preventDefault(), this._positionDelta = m.point.sub(this._pos).add(this._offset), this._pointerdownPos = m.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 = l && l.anchor || "center", this._color = l && l.color || "#3FB1CE", this._scale = l && l.scale || 1, this._draggable = l && l.draggable || !1, this._clickTolerance = l && l.clickTolerance || 0, this._subpixelPositioning = l && l.subpixelPositioning || !1, this._isDragging = !1, this._state = "inactive", this._rotation = l && l.rotation || 0, this._rotationAlignment = l && l.rotationAlignment || "auto", this._pitchAlignment = l && l.pitchAlignment && l.pitchAlignment !== "auto" ? l.pitchAlignment : this._rotationAlignment, this.setOpacity(), this.setOpacity(l == null ? void 0 : l.opacity, l == null ? void 0 : l.opacityWhenCovered), l && l.element)
this._element = l.element, this._offset = a.P.convert(l && l.offset || [0, 0]);
else {
this._defaultMarker = !0, this._element = Q.create("div");
const m = Q.createNS("http://www.w3.org/2000/svg", "svg"), v = 41, b = 27;
m.setAttributeNS(null, "display", "block"), m.setAttributeNS(null, "height", `${v}px`), m.setAttributeNS(null, "width", `${b}px`), m.setAttributeNS(null, "viewBox", `0 0 ${b} ${v}`);
const M = Q.createNS("http://www.w3.org/2000/svg", "g");
M.setAttributeNS(null, "stroke", "none"), M.setAttributeNS(null, "stroke-width", "1"), M.setAttributeNS(null, "fill", "none"), M.setAttributeNS(null, "fill-rule", "evenodd");
const V = Q.createNS("http://www.w3.org/2000/svg", "g");
V.setAttributeNS(null, "fill-rule", "nonzero");
const D = Q.createNS("http://www.w3.org/2000/svg", "g");
D.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), D.setAttributeNS(null, "fill", "#000000");
const j = [{ 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 Ht of j) {
const Ot = Q.createNS("http://www.w3.org/2000/svg", "ellipse");
Ot.setAttributeNS(null, "opacity", "0.04"), Ot.setAttributeNS(null, "cx", "10.5"), Ot.setAttributeNS(null, "cy", "5.80029008"), Ot.setAttributeNS(null, "rx", Ht.rx), Ot.setAttributeNS(null, "ry", Ht.ry), D.appendChild(Ot);
}
const Z = Q.createNS("http://www.w3.org/2000/svg", "g");
Z.setAttributeNS(null, "fill", this._color);
const Y = Q.createNS("http://www.w3.org/2000/svg", "path");
Y.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"), Z.appendChild(Y);
const J = Q.createNS("http://www.w3.org/2000/svg", "g");
J.setAttributeNS(null, "opacity", "0.25"), J.setAttributeNS(null, "fill", "#000000");
const lt = Q.createNS("http://www.w3.org/2000/svg", "path");
lt.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"), J.appendChild(lt);
const ft = Q.createNS("http://www.w3.org/2000/svg", "g");
ft.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), ft.setAttributeNS(null, "fill", "#FFFFFF");
const Qt = Q.createNS("http://www.w3.org/2000/svg", "g");
Qt.setAttributeNS(null, "transform", "translate(8.0, 8.0)");
const wt = Q.createNS("http://www.w3.org/2000/svg", "circle");
wt.setAttributeNS(null, "fill", "#000000"), wt.setAttributeNS(null, "opacity", "0.25"), wt.setAttributeNS(null, "cx", "5.5"), wt.setAttributeNS(null, "cy", "5.5"), wt.setAttributeNS(null, "r", "5.4999962");
const Mt = Q.createNS("http://www.w3.org/2000/svg", "circle");
Mt.setAttributeNS(null, "fill", "#FFFFFF"), Mt.setAttributeNS(null, "cx", "5.5"), Mt.setAttributeNS(null, "cy", "5.5"), Mt.setAttributeNS(null, "r", "5.4999962"), Qt.appendChild(wt), Qt.appendChild(Mt), V.appendChild(D), V.appendChild(Z), V.appendChild(J), V.appendChild(ft), V.appendChild(Qt), m.appendChild(V), m.setAttributeNS(null, "height", v * this._scale + "px"), m.setAttributeNS(null, "width", b * this._scale + "px"), this._element.appendChild(m), this._offset = a.P.convert(l && l.offset || [0, -14]);
}
if (this._element.classList.add("maplibregl-marker"), this._element.addEventListener("dragstart", (m) => {
m.preventDefault();
}), this._element.addEventListener("mousedown", (m) => {
m.preventDefault();
}), Al(this._element, this._anchor, "marker"), l && l.className)
for (const m of l.className.split(" "))
this._element.classList.add(m);
this._popup = null;
}
addTo(l) {
return this.remove(), this._map = l, this._element.setAttribute("aria-label", l._getUIString("Marker.Title")), l.getCanvasContainer().appendChild(this._element), l.on("move", this._update), l.on("moveend", this._update), l.on("terrain", this._update), this.setDraggable(this._draggable), this._update(), this._map.on("click", this._onMapClick), this;
}
remove() {
return this._opacityTimeout && (clearTimeout(this._opacityTimeout), delete this._opacityTimeout), this._map && (this._map.off("click", this._onMapClick), this._map.off("move", this._update), this._map.off("moveend", this._update), this._map.off("terrain", this._update), this._map.off("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), Q.remove(this._element), this._popup && this._popup.remove(), this;
}
getLngLat() {
return this._lngLat;
}
setLngLat(l) {
return this._lngLat = a.N.convert(l), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this;
}
getElement() {
return this._element;
}
setPopup(l) {
if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), l) {
if (!("offset" in l.options)) {
const m = Math.abs(13.5) / Math.SQRT2;
l.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -38.1], "bottom-left": [m, -1 * (38.1 - 13.5 + m)], "bottom-right": [-m, -1 * (38.1 - 13.5 + m)], left: [13.5, -1 * (38.1 - 13.5)], right: [-13.5, -1 * (38.1 - 13.5)] } : this._offset;
}
this._popup = l, this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress);
}
return this;
}
setSubpixelPositioning(l) {
return this._subpixelPositioning = l, this;
}
getPopup() {
return this._popup;
}
togglePopup() {
const l = this._popup;
return this._element.style.opacity === this._opacityWhenCovered ? this : l ? (l.isOpen() ? l.remove() : (l.setLngLat(this._lngLat), l.addTo(this._map)), this) : this;
}
_updateOpacity(l = !1) {
var m, v;
if (!(!((m = this._map) === null || m === void 0) && m.terrain))
return void (this._element.style.opacity !== this._opacity && (this._element.style.opacity = this._opacity));
if (l)
this._opacityTimeout = null;
else {
if (this._opacityTimeout)
return;
this._opacityTimeout = setTimeout(() => {
this._opacityTimeout = null;
}, 100);
}
const b = this._map, M = b.terrain.depthAtPoint(this._pos), V = b.terrain.getElevationForLngLatZoom(this._lngLat, b.transform.tileZoom);
if (b.transform.lngLatToCameraDepth(this._lngLat, V) - M < 6e-3)
return void (this._element.style.opacity = this._opacity);
const D = -this._offset.y / b.transform._pixelPerMeter, j = Math.sin(b.getPitch() * Math.PI / 180) * D, Z = b.terrain.depthAtPoint(new a.P(this._pos.x, this._pos.y - this._offset.y)), Y = b.transform.lngLatToCameraDepth(this._lngLat, V + j) - Z > 6e-3;
!((v = this._popup) === null || v === void 0) && v.isOpen() && Y && this._popup.remove(), this._element.style.opacity = Y ? this._opacityWhenCovered : this._opacity;
}
getOffset() {
return this._offset;
}
setOffset(l) {
return this._offset = a.P.convert(l), this._update(), this;
}
addClassName(l) {
this._element.classList.add(l);
}
removeClassName(l) {
this._element.classList.remove(l);
}
toggleClassName(l) {
return this._element.classList.toggle(l);
}
setDraggable(l) {
return this._draggable = !!l, this._map && (l ? (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(l) {
return this._rotation = l || 0, this._update(), this;
}
getRotation() {
return this._rotation;
}
setRotationAlignment(l) {
return this._rotationAlignment = l || "auto", this._update(), this;
}
getRotationAlignment() {
return this._rotationAlignment;
}
setPitchAlignment(l) {
return this._pitchAlignment = l && l !== "auto" ? l : this._rotationAlignment, this._update(), this;
}
getPitchAlignment() {
return this._pitchAlignment;
}
setOpacity(l, m) {
return l === void 0 && m === void 0 && (this._opacity = "1", this._opacityWhenCovered = "0.2"), l !== void 0 && (this._opacity = l), m !== void 0 && (this._opacityWhenCovered = m), this._map && this._updateOpacity(!0), this;
}
}
const bp = { positionOptions: { enableHighAccuracy: !1, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: !1, showAccuracyCircle: !0, showUserLocation: !0 };
let I0 = 0, P0 = !1;
const Qs = { maxWidth: 100, unit: "metric" };
function V0(S, l, m) {
const v = m && m.maxWidth || 100, b = S._container.clientHeight / 2, M = S.unproject([0, b]), V = S.unproject([v, b]), D = M.distanceTo(V);
if (m && m.unit === "imperial") {
const j = 3.2808 * D;
j > 5280 ? cr(l, v, j / 5280, S._getUIString("ScaleControl.Miles")) : cr(l, v, j, S._getUIString("ScaleControl.Feet"));
} else
m && m.unit === "nautical" ? cr(l, v, D / 1852, S._getUIString("ScaleControl.NauticalMiles")) : D >= 1e3 ? cr(l, v, D / 1e3, S._getUIString("ScaleControl.Kilometers")) : cr(l, v, D, S._getUIString("ScaleControl.Meters"));
}
function cr(S, l, m, v) {
const b = function(M) {
const V = Math.pow(10, `${Math.floor(M)}`.length - 1);
let D = M / V;
return D = D >= 10 ? 10 : D >= 5 ? 5 : D >= 3 ? 3 : D >= 2 ? 2 : D >= 1 ? 1 : function(j) {
const Z = Math.pow(10, Math.ceil(-Math.log(j) / Math.LN10));
return Math.round(j * Z) / Z;
}(D), V * D;
}(m);
S.style.width = l * (b / m) + "px", S.innerHTML = `${b} ${v}`;
}
const Mr = { closeButton: !0, closeOnClick: !0, focusAfterOpen: !0, className: "", maxWidth: "240px", subpixelPositioning: !1 }, Cl = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
function kl(S) {
if (S) {
if (typeof S == "number") {
const l = Math.round(Math.abs(S) / Math.SQRT2);
return { center: new a.P(0, 0), top: new a.P(0, S), "top-left": new a.P(l, l), "top-right": new a.P(-l, l), bottom: new a.P(0, -S), "bottom-left": new a.P(l, -l), "bottom-right": new a.P(-l, -l), left: new a.P(S, 0), right: new a.P(-S, 0) };
}
if (S instanceof a.P || Array.isArray(S)) {
const l = a.P.convert(S);
return { center: l, top: l, "top-left": l, "top-right": l, bottom: l, "bottom-left": l, "bottom-right": l, left: l, right: l };
}
return { center: a.P.convert(S.center || [0, 0]), top: a.P.convert(S.top || [0, 0]), "top-left": a.P.convert(S["top-left"] || [0, 0]), "top-right": a.P.convert(S["top-right"] || [0, 0]), bottom: a.P.convert(S.bottom || [0, 0]), "bottom-left": a.P.convert(S["bottom-left"] || [0, 0]), "bottom-right": a.P.convert(S["bottom-right"] || [0, 0]), left: a.P.convert(S.left || [0, 0]), right: a.P.convert(S.right || [0, 0]) };
}
return kl(new a.P(0, 0));
}
const Bc = u;
s.AJAXError = a.bh, s.Evented = a.E, s.LngLat = a.N, s.MercatorCoordinate = a.Z, s.Point = a.P, s.addProtocol = a.bi, s.config = a.a, s.removeProtocol = a.bj, s.AttributionControl = n6, s.BoxZoomHandler = Wi, s.CanvasSource = _i, s.CooperativeGesturesHandler = e6, s.DoubleClickZoomHandler = F3, s.DragPanHandler = mp, s.DragRotateHandler = gp, s.EdgeInsets = Ai, s.FullscreenControl = class extends a.E {
constructor(S = {}) {
super(), this._onFullscreenChange = () => {
var l;
let m = window.document.fullscreenElement || window.document.mozFullScreenElement || window.document.webkitFullscreenElement || window.document.msFullscreenElement;
for (; !((l = m == null ? void 0 : m.shadowRoot) === null || l === void 0) && l.fullscreenElement; )
m = m.shadowRoot.fullscreenElement;
m === this._container !== this._fullscreen && this._handleFullscreenChange();
}, this._onClickFullscreen = () => {
this._isFullscreen() ? this._exitFullscreen() : this._requestFullscreen();
}, this._fullscreen = !1, S && S.container && (S.container instanceof HTMLElement ? this._container = S.container : a.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(S) {
return this._map = S, this._container || (this._container = this._map.getContainer()), this._controlContainer = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), this._controlContainer;
}
onRemove() {
Q.remove(this._controlContainer), this._map = null, window.document.removeEventListener(this._fullscreenchange, this._onFullscreenChange);
}
_setupUI() {
const S = this._fullscreenButton = Q.create("button", "maplibregl-ctrl-fullscreen", this._controlContainer);
Q.create("span", "maplibregl-ctrl-icon", S).setAttribute("aria-hidden", "true"), S.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), window.document.addEventListener(this._fullscreenchange, this._onFullscreenChange);
}
_updateTitle() {
const S = this._getTitle();
this._fullscreenButton.setAttribute("aria-label", S), this._fullscreenButton.title = S;
}
_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 a.k("fullscreenstart")), this._prevCooperativeGesturesEnabled = this._map.cooperativeGestures.isEnabled(), this._map.cooperativeGestures.disable()) : (this.fire(new a.k("fullscreenend")), this._prevCooperativeGesturesEnabled && this._map.cooperativeGestures.enable());
}
_exitFullscreen() {
window.document.exitFullscreen ? window.document.exitFullscreen() : window.document.mozCancelFullScreen ? window.document.mozCancelFullScreen() : window.document.msExitFullscreen ? window.document.msExitFullscreen() : window.document.webkitCancelFullScreen ? window.document.webkitCancelFullScreen() : this._togglePseudoFullScreen();
}
_requestFullscreen() {
this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.mozRequestFullScreen ? this._container.mozRequestFullScreen() : this._container.msRequestFullscreen ? this._container.msRequestFullscreen() : this._container.webkitRequestFullscreen ? this._container.webkitRequestFullscreen() : this._togglePseudoFullScreen();
}
_togglePseudoFullScreen() {
this._container.classList.toggle("maplibregl-pseudo-fullscreen"), this._handleFullscreenChange(), this._map.resize();
}
}, s.GeoJSONSource = dn, s.GeolocateControl = class extends a.E {
constructor(S) {
super(), this._onSuccess = (l) => {
if (this._map) {
if (this._isOutOfMapMaxBounds(l))
return this._setErrorState(), this.fire(new a.k("outofmaxbounds", l)), this._updateMarker(), void this._finish();
if (this.options.trackUserLocation)
switch (this._lastKnownPosition = l, this._watchState) {
case "WAITING_ACTIVE":
case "ACTIVE_LOCK":
case "ACTIVE_ERROR":
this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
break;
case "BACKGROUND":
case "BACKGROUND_ERROR":
this._watchState = "BACKGROUND", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");
break;
default:
throw new Error(`Unexpected watchState ${this._watchState}`);
}
this.options.showUserLocation && this._watchState !== "OFF" && this._updateMarker(l), this.options.trackUserLocation && this._watchState !== "ACTIVE_LOCK" || this._updateCamera(l), this.options.showUserLocation && this._dotElement.classList.remove("maplibregl-user-location-dot-stale"), this.fire(new a.k("geolocate", l)), this._finish();
}
}, this._updateCamera = (l) => {
const m = new a.N(l.coords.longitude, l.coords.latitude), v = l.coords.accuracy, b = this._map.getBearing(), M = a.e({ bearing: b }, this.options.fitBoundsOptions), V = Ct.fromLngLat(m, v);
this._map.fitBounds(V, M, { geolocateSource: !0 });
}, this._updateMarker = (l) => {
if (l) {
const m = new a.N(l.coords.longitude, l.coords.latitude);
this._accuracyCircleMarker.setLngLat(m).addTo(this._map), this._userLocationDotMarker.setLngLat(m).addTo(this._map), this._accuracy = l.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
} else
this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove();
}, this._onZoom = () => {
this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius();
}, this._onError = (l) => {
if (this._map) {
if (this.options.trackUserLocation)
if (l.code === 1) {
this._watchState = "OFF", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this._geolocateButton.disabled = !0;
const m = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m), this._geolocationWatchID !== void 0 && this._clearWatch();
} else {
if (l.code === 3 && P0)
return;
this._setErrorState();
}
this._watchState !== "OFF" && this.options.showUserLocation && this._dotElement.classList.add("maplibregl-user-location-dot-stale"), this.fire(new a.k("error", l)), this._finish();
}
}, this._finish = () => {
this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0;
}, this._setupUI = () => {
this._map && (this._container.addEventListener("contextmenu", (l) => l.preventDefault()), this._geolocateButton = Q.create("button", "maplibregl-ctrl-geolocate", this._container), Q.create("span", "maplibregl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", this._geolocateButton.disabled = !0);
}, this._finishSetupUI = (l) => {
if (this._map) {
if (l === !1) {
a.w("Geolocation support is not available so the GeolocateControl will be disabled.");
const m = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.disabled = !0, this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m);
} else {
const m = this._map._getUIString("GeolocateControl.FindMyLocation");
this._geolocateButton.disabled = !1, this._geolocateButton.title = m, this._geolocateButton.setAttribute("aria-label", m);
}
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = Q.create("div", "maplibregl-user-location-dot"), this._userLocationDotMarker = new Ol({ element: this._dotElement }), this._circleElement = Q.create("div", "maplibregl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Ol({ element: this._circleElement, pitchAlignment: "map" }), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("zoom", this._onZoom)), this._geolocateButton.addEventListener("click", () => this.trigger()), this._setup = !0, this.options.trackUserLocation && this._map.on("movestart", (m) => {
m.geolocateSource || this._watchState !== "ACTIVE_LOCK" || m.originalEvent && m.originalEvent.type === "resize" || (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this.fire(new a.k("trackuserlocationend")), this.fire(new a.k("userlocationlostfocus")));
});
}
}, this.options = a.e({}, bp, S);
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._setupUI(), function() {
return a._(this, arguments, void 0, function* (l = !1) {
if (Vo !== void 0 && !l)
return Vo;
if (window.navigator.permissions === void 0)
return Vo = !!window.navigator.geolocation, Vo;
try {
Vo = (yield window.navigator.permissions.query({ name: "geolocation" })).state !== "denied";
} catch {
Vo = !!window.navigator.geolocation;
}
return Vo;
});
}().then((l) => this._finishSetupUI(l)), this._container;
}
onRemove() {
this._geolocationWatchID !== void 0 && (window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), Q.remove(this._container), this._map.off("zoom", this._onZoom), this._map = void 0, I0 = 0, P0 = !1;
}
_isOutOfMapMaxBounds(S) {
const l = this._map.getMaxBounds(), m = S.coords;
return l && (m.longitude < l.getWest() || m.longitude > l.getEast() || m.latitude < l.getSouth() || m.latitude > l.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":
break;
default:
throw new Error(`Unexpected watchState ${this._watchState}`);
}
}
_updateCircleRadius() {
const S = this._map.getBounds(), l = S.getSouthEast(), m = S.getNorthEast(), v = l.distanceTo(m), b = Math.ceil(this._accuracy / (v / this._map._container.clientHeight) * 2);
this._circleElement.style.width = `${b}px`, this._circleElement.style.height = `${b}px`;
}
trigger() {
if (!this._setup)
return a.w("Geolocate control triggered before added to a map"), !1;
if (this.options.trackUserLocation) {
switch (this._watchState) {
case "OFF":
this._watchState = "WAITING_ACTIVE", this.fire(new a.k("trackuserlocationstart"));
break;
case "WAITING_ACTIVE":
case "ACTIVE_LOCK":
case "ACTIVE_ERROR":
case "BACKGROUND_ERROR":
I0--, P0 = !1, this._watchState = "OFF", this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"), this.fire(new a.k("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 a.k("trackuserlocationstart")), this.fire(new a.k("userlocationfocus"));
break;
default:
throw new Error(`Unexpected watchState ${this._watchState}`);
}
switch (this._watchState) {
case "WAITING_ACTIVE":
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
break;
case "ACTIVE_LOCK":
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");
break;
case "OFF":
break;
default:
throw new Error(`Unexpected watchState ${this._watchState}`);
}
if (this._watchState === "OFF" && this._geolocationWatchID !== void 0)
this._clearWatch();
else if (this._geolocationWatchID === void 0) {
let S;
this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), I0++, I0 > 1 ? (S = { maximumAge: 6e5, timeout: 0 }, P0 = !0) : (S = this.options.positionOptions, P0 = !1), this._geolocationWatchID = window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, S);
}
} else
window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4);
return !0;
}
_clearWatch() {
window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null);
}
}, s.Hash = S2, s.ImageSource = Ji, s.KeyboardHandler = r2, s.LngLatBounds = Ct, s.LogoControl = Vc, s.Map = class extends yp {
constructor(S) {
a.bf.mark(a.bg.create);
const l = Object.assign(Object.assign({}, y_), S);
if (l.minZoom != null && l.maxZoom != null && l.minZoom > l.maxZoom)
throw new Error("maxZoom must be greater than or equal to minZoom");
if (l.minPitch != null && l.maxPitch != null && l.minPitch > l.maxPitch)
throw new Error("maxPitch must be greater than or equal to minPitch");
if (l.minPitch != null && l.minPitch < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (l.maxPitch != null && l.maxPitch > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (super(new Io(l.minZoom, l.maxZoom, l.minPitch, l.maxPitch, l.renderWorldCopies), { bearingSnap: l.bearingSnap }), this._idleTriggered = !1, this._crossFadingFactor = 1, this._renderTaskQueue = new sn(), this._controls = [], this._mapId = a.a4(), this._contextLost = (m) => {
m.preventDefault(), this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this.fire(new a.k("webglcontextlost", { originalEvent: m }));
}, this._contextRestored = (m) => {
this._setupPainter(), this.resize(), this._update(), this.fire(new a.k("webglcontextrestored", { originalEvent: m }));
}, this._onMapScroll = (m) => {
if (m.target === this._container)
return this._container.scrollTop = 0, this._container.scrollLeft = 0, !1;
}, this._onWindowOnline = () => {
this._update();
}, this._interactive = l.interactive, this._maxTileCacheSize = l.maxTileCacheSize, this._maxTileCacheZoomLevels = l.maxTileCacheZoomLevels, this._failIfMajorPerformanceCaveat = l.failIfMajorPerformanceCaveat === !0, this._preserveDrawingBuffer = l.preserveDrawingBuffer === !0, this._antialias = l.antialias === !0, this._trackResize = l.trackResize === !0, this._bearingSnap = l.bearingSnap, this._refreshExpiredTiles = l.refreshExpiredTiles === !0, this._fadeDuration = l.fadeDuration, this._crossSourceCollisions = l.crossSourceCollisions === !0, this._collectResourceTiming = l.collectResourceTiming === !0, this._locale = Object.assign(Object.assign({}, Dc), l.locale), this._clickTolerance = l.clickTolerance, this._overridePixelRatio = l.pixelRatio, this._maxCanvasSize = l.maxCanvasSize, this.transformCameraUpdate = l.transformCameraUpdate, this.cancelPendingTileRequestsWhileZooming = l.cancelPendingTileRequestsWhileZooming === !0, this._imageQueueHandle = k.addThrottleControl(() => this.isMoving()), this._requestManager = new R(l.transformRequest), typeof l.container == "string") {
if (this._container = document.getElementById(l.container), !this._container)
throw new Error(`Container '${l.container}' not found.`);
} else {
if (!(l.container instanceof HTMLElement))
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
this._container = l.container;
}
if (l.maxBounds && this.setMaxBounds(l.maxBounds), this._setupContainer(), this._setupPainter(), this.on("move", () => this._update(!1)).on("moveend", () => this._update(!1)).on("zoom", () => this._update(!0)).on("terrain", () => {
this.painter.terrainFacilitator.dirty = !0, this._update(!0);
}).once("idle", () => {
this._idleTriggered = !0;
}), typeof window < "u") {
addEventListener("online", this._onWindowOnline, !1);
let m = !1;
const v = hs((b) => {
this._trackResize && !this._removed && (this.resize(b), this.redraw());
}, 50);
this._resizeObserver = new ResizeObserver((b) => {
m ? v(b) : m = !0;
}), this._resizeObserver.observe(this._container);
}
this.handlers = new Pc(this, l), this._hash = l.hash && new S2(typeof l.hash == "string" && l.hash || void 0).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: l.center, zoom: l.zoom, bearing: l.bearing, pitch: l.pitch }), l.bounds && (this.resize(), this.fitBounds(l.bounds, a.e({}, l.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = l.localIdeographFontFamily, this._validateStyle = l.validateStyle, l.style && this.setStyle(l.style, { localIdeographFontFamily: l.localIdeographFontFamily }), l.attributionControl && this.addControl(new n6(typeof l.attributionControl == "boolean" ? void 0 : l.attributionControl)), l.maplibreLogo && this.addControl(new Vc(), l.logoPosition), this.on("style.load", () => {
this.transform.unmodified && this.jumpTo(this.style.stylesheet);
}), this.on("data", (m) => {
this._update(m.dataType === "style"), this.fire(new a.k(`${m.dataType}data`, m));
}), this.on("dataloading", (m) => {
this.fire(new a.k(`${m.dataType}dataloading`, m));
}), this.on("dataabort", (m) => {
this.fire(new a.k("sourcedataabort", m));
});
}
_getMapId() {
return this._mapId;
}
addControl(S, l) {
if (l === void 0 && (l = S.getDefaultPosition ? S.getDefaultPosition() : "top-right"), !S || !S.onAdd)
return this.fire(new a.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
const m = S.onAdd(this);
this._controls.push(S);
const v = this._controlPositions[l];
return l.indexOf("bottom") !== -1 ? v.insertBefore(m, v.firstChild) : v.appendChild(m), this;
}
removeControl(S) {
if (!S || !S.onRemove)
return this.fire(new a.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
const l = this._controls.indexOf(S);
return l > -1 && this._controls.splice(l, 1), S.onRemove(this), this;
}
hasControl(S) {
return this._controls.indexOf(S) > -1;
}
calculateCameraOptionsFromTo(S, l, m, v) {
return v == null && this.terrain && (v = this.terrain.getElevationForLngLatZoom(m, this.transform.tileZoom)), super.calculateCameraOptionsFromTo(S, l, m, v);
}
resize(S) {
var l;
const m = this._containerDimensions(), v = m[0], b = m[1], M = this._getClampedPixelRatio(v, b);
if (this._resizeCanvas(v, b, M), this.painter.resize(v, b, M), this.painter.overLimit()) {
const D = this.painter.context.gl;
this._maxCanvasSize = [D.drawingBufferWidth, D.drawingBufferHeight];
const j = this._getClampedPixelRatio(v, b);
this._resizeCanvas(v, b, j), this.painter.resize(v, b, j);
}
this.transform.resize(v, b), (l = this._requestedCameraState) === null || l === void 0 || l.resize(v, b);
const V = !this._moving;
return V && (this.stop(), this.fire(new a.k("movestart", S)).fire(new a.k("move", S))), this.fire(new a.k("resize", S)), V && this.fire(new a.k("moveend", S)), this;
}
_getClampedPixelRatio(S, l) {
const { 0: m, 1: v } = this._maxCanvasSize, b = this.getPixelRatio(), M = S * b, V = l * b;
return Math.min(M > m ? m / M : 1, V > v ? v / V : 1) * b;
}
getPixelRatio() {
var S;
return (S = this._overridePixelRatio) !== null && S !== void 0 ? S : devicePixelRatio;
}
setPixelRatio(S) {
this._overridePixelRatio = S, this.resize();
}
getBounds() {
return this.transform.getBounds();
}
getMaxBounds() {
return this.transform.getMaxBounds();
}
setMaxBounds(S) {
return this.transform.setMaxBounds(Ct.convert(S)), this._update();
}
setMinZoom(S) {
if ((S = S ?? -2) >= -2 && S <= this.transform.maxZoom)
return this.transform.minZoom = S, this._update(), this.getZoom() < S && this.setZoom(S), this;
throw new Error("minZoom must be between -2 and the current maxZoom, inclusive");
}
getMinZoom() {
return this.transform.minZoom;
}
setMaxZoom(S) {
if ((S = S ?? 22) >= this.transform.minZoom)
return this.transform.maxZoom = S, this._update(), this.getZoom() > S && this.setZoom(S), this;
throw new Error("maxZoom must be greater than the current minZoom");
}
getMaxZoom() {
return this.transform.maxZoom;
}
setMinPitch(S) {
if ((S = S ?? 0) < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (S >= 0 && S <= this.transform.maxPitch)
return this.transform.minPitch = S, this._update(), this.getPitch() < S && this.setPitch(S), this;
throw new Error("minPitch must be between 0 and the current maxPitch, inclusive");
}
getMinPitch() {
return this.transform.minPitch;
}
setMaxPitch(S) {
if ((S = S ?? 60) > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (S >= this.transform.minPitch)
return this.transform.maxPitch = S, this._update(), this.getPitch() > S && this.setPitch(S), this;
throw new Error("maxPitch must be greater than the current minPitch");
}
getMaxPitch() {
return this.transform.maxPitch;
}
getRenderWorldCopies() {
return this.transform.renderWorldCopies;
}
setRenderWorldCopies(S) {
return this.transform.renderWorldCopies = S, this._update();
}
project(S) {
return this.transform.locationPoint(a.N.convert(S), this.style && this.terrain);
}
unproject(S) {
return this.transform.pointLocation(a.P.convert(S), this.terrain);
}
isMoving() {
var S;
return this._moving || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isMoving());
}
isZooming() {
var S;
return this._zooming || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isZooming());
}
isRotating() {
var S;
return this._rotating || ((S = this.handlers) === null || S === void 0 ? void 0 : S.isRotating());
}
_createDelegatedListener(S, l, m) {
if (S === "mouseenter" || S === "mouseover") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (b) => {
const M = l.filter((D) => this.getLayer(D)), V = M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : [];
V.length ? v || (v = !0, m.call(this, new Gi(S, this, b.originalEvent, { features: V }))) : v = !1;
}, mouseout: () => {
v = !1;
} } };
}
if (S === "mouseleave" || S === "mouseout") {
let v = !1;
return { layers: l, listener: m, delegates: { mousemove: (b) => {
const M = l.filter((V) => this.getLayer(V));
(M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : []).length ? v = !0 : v && (v = !1, m.call(this, new Gi(S, this, b.originalEvent)));
}, mouseout: (b) => {
v && (v = !1, m.call(this, new Gi(S, this, b.originalEvent)));
} } };
}
{
const v = (b) => {
const M = l.filter((D) => this.getLayer(D)), V = M.length !== 0 ? this.queryRenderedFeatures(b.point, { layers: M }) : [];
V.length && (b.features = V, m.call(this, b), delete b.features);
};
return { layers: l, listener: m, delegates: { [S]: v } };
}
}
_saveDelegatedListener(S, l) {
this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[S] = this._delegatedListeners[S] || [], this._delegatedListeners[S].push(l);
}
_removeDelegatedListener(S, l, m) {
if (!this._delegatedListeners || !this._delegatedListeners[S])
return;
const v = this._delegatedListeners[S];
for (let b = 0; b < v.length; b++) {
const M = v[b];
if (M.listener === m && M.layers.length === l.length && M.layers.every((V) => l.includes(V))) {
for (const V in M.delegates)
this.off(V, M.delegates[V]);
return void v.splice(b, 1);
}
}
}
on(S, l, m) {
if (m === void 0)
return super.on(S, l);
const v = this._createDelegatedListener(S, typeof l == "string" ? [l] : l, m);
this._saveDelegatedListener(S, v);
for (const b in v.delegates)
this.on(b, v.delegates[b]);
return this;
}
once(S, l, m) {
if (m === void 0)
return super.once(S, l);
const v = typeof l == "string" ? [l] : l, b = this._createDelegatedListener(S, v, m);
for (const M in b.delegates) {
const V = b.delegates[M];
b.delegates[M] = (...D) => {
this._removeDelegatedListener(S, v, m), V(...D);
};
}
this._saveDelegatedListener(S, b);
for (const M in b.delegates)
this.once(M, b.delegates[M]);
return this;
}
off(S, l, m) {
return m === void 0 ? super.off(S, l) : (this._removeDelegatedListener(S, typeof l == "string" ? [l] : l, m), this);
}
queryRenderedFeatures(S, l) {
if (!this.style)
return [];
let m;
const v = S instanceof a.P || Array.isArray(S), b = v ? S : [[0, 0], [this.transform.width, this.transform.height]];
if (l = l || (v ? {} : S) || {}, b instanceof a.P || typeof b[0] == "number")
m = [a.P.convert(b)];
else {
const M = a.P.convert(b[0]), V = a.P.convert(b[1]);
m = [M, new a.P(V.x, M.y), V, new a.P(M.x, V.y), M];
}
return this.style.queryRenderedFeatures(m, l, this.transform);
}
querySourceFeatures(S, l) {
return this.style.querySourceFeatures(S, l);
}
setStyle(S, l) {
return (l = a.e({}, { localIdeographFontFamily: this._localIdeographFontFamily, validate: this._validateStyle }, l)).diff !== !1 && l.localIdeographFontFamily === this._localIdeographFontFamily && this.style && S ? (this._diffStyle(S, l), this) : (this._localIdeographFontFamily = l.localIdeographFontFamily, this._updateStyle(S, l));
}
setTransformRequest(S) {
return this._requestManager.setTransformRequest(S), this;
}
_getUIString(S) {
const l = this._locale[S];
if (l == null)
throw new Error(`Missing UI string '${S}'`);
return l;
}
_updateStyle(S, l) {
if (l.transformStyle && this.style && !this.style._loaded)
return void this.style.once("style.load", () => this._updateStyle(S, l));
const m = this.style && l.transformStyle ? this.style.serialize() : void 0;
return this.style && (this.style.setEventedParent(null), this.style._remove(!S)), S ? (this.style = new ma(this, l || {}), this.style.setEventedParent(this, { style: this.style }), typeof S == "string" ? this.style.loadURL(S, l, m) : this.style.loadJSON(S, l, m), this) : (delete this.style, this);
}
_lazyInitEmptyStyle() {
this.style || (this.style = new ma(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty());
}
_diffStyle(S, l) {
if (typeof S == "string") {
const m = this._requestManager.transformRequest(S, "Style");
a.h(m, new AbortController()).then((v) => {
this._updateDiff(v.data, l);
}).catch((v) => {
v && this.fire(new a.j(v));
});
} else
typeof S == "object" && this._updateDiff(S, l);
}
_updateDiff(S, l) {
try {
this.style.setState(S, l) && this._update(!0);
} catch (m) {
a.w(`Unable to perform style diff: ${m.message || m.error || m}. Rebuilding the style from scratch.`), this._updateStyle(S, l);
}
}
getStyle() {
if (this.style)
return this.style.serialize();
}
isStyleLoaded() {
return this.style ? this.style.loaded() : a.w("There is no style added to the map.");
}
addSource(S, l) {
return this._lazyInitEmptyStyle(), this.style.addSource(S, l), this._update(!0);
}
isSourceLoaded(S) {
const l = this.style && this.style.sourceCaches[S];
if (l !== void 0)
return l.loaded();
this.fire(new a.j(new Error(`There is no source with ID '${S}'`)));
}
setTerrain(S) {
if (this.style._checkLoaded(), this._terrainDataCallback && this.style.off("data", this._terrainDataCallback), S) {
const l = this.style.sourceCaches[S.source];
if (!l)
throw new Error(`cannot load terrain, because there exists no source with ID: ${S.source}`);
this.terrain === null && l.reload();
for (const m in this.style._layers) {
const v = this.style._layers[m];
v.type === "hillshade" && v.source === S.source && a.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.");
}
this.terrain = new Nc(this.painter, l, S), this.painter.renderToTexture = new vp(this.painter, this.terrain), this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._terrainDataCallback = (m) => {
m.dataType === "style" ? this.terrain.sourceCache.freeRtt() : m.dataType === "source" && m.tile && (m.sourceId !== S.source || this._elevationFreeze || (this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom)), this.terrain.sourceCache.freeRtt(m.tile.tileID));
}, this.style.on("data", this._terrainDataCallback);
} else
this.terrain && this.terrain.sourceCache.destruct(), this.terrain = null, this.painter.renderToTexture && this.painter.renderToTexture.destruct(), this.painter.renderToTexture = null, this.transform.minElevationForCurrentTile = 0, this.transform.elevation = 0;
return this.fire(new a.k("terrain", { terrain: S })), this;
}
getTerrain() {
var S, l;
return (l = (S = this.terrain) === null || S === void 0 ? void 0 : S.options) !== null && l !== void 0 ? l : null;
}
areTilesLoaded() {
const S = this.style && this.style.sourceCaches;
for (const l in S) {
const m = S[l]._tiles;
for (const v in m) {
const b = m[v];
if (b.state !== "loaded" && b.state !== "errored")
return !1;
}
}
return !0;
}
removeSource(S) {
return this.style.removeSource(S), this._update(!0);
}
getSource(S) {
return this.style.getSource(S);
}
addImage(S, l, m = {}) {
const { pixelRatio: v = 1, sdf: b = !1, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z } = m;
if (this._lazyInitEmptyStyle(), !(l instanceof HTMLImageElement || a.b(l))) {
if (l.width === void 0 || l.height === void 0)
return this.fire(new a.j(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: Y, height: J, data: lt } = l, ft = l;
return this.style.addImage(S, { data: new a.R({ width: Y, height: J }, new Uint8Array(lt)), pixelRatio: v, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z, sdf: b, version: 0, userImage: ft }), ft.onAdd && ft.onAdd(this, S), this;
}
}
{
const { width: Y, height: J, data: lt } = f.getImageData(l);
this.style.addImage(S, { data: new a.R({ width: Y, height: J }, lt), pixelRatio: v, stretchX: M, stretchY: V, content: D, textFitWidth: j, textFitHeight: Z, sdf: b, version: 0 });
}
}
updateImage(S, l) {
const m = this.style.getImage(S);
if (!m)
return this.fire(new a.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
const v = l instanceof HTMLImageElement || a.b(l) ? f.getImageData(l) : l, { width: b, height: M, data: V } = v;
if (b === void 0 || M === void 0)
return this.fire(new a.j(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 (b !== m.data.width || M !== m.data.height)
return this.fire(new a.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));
const D = !(l instanceof HTMLImageElement || a.b(l));
return m.data.replace(V, D), this.style.updateImage(S, m), this;
}
getImage(S) {
return this.style.getImage(S);
}
hasImage(S) {
return S ? !!this.style.getImage(S) : (this.fire(new a.j(new Error("Missing required image id"))), !1);
}
removeImage(S) {
this.style.removeImage(S);
}
loadImage(S) {
return k.getImage(this._requestManager.transformRequest(S, "Image"), new AbortController());
}
listImages() {
return this.style.listImages();
}
addLayer(S, l) {
return this._lazyInitEmptyStyle(), this.style.addLayer(S, l), this._update(!0);
}
moveLayer(S, l) {
return this.style.moveLayer(S, l), this._update(!0);
}
removeLayer(S) {
return this.style.removeLayer(S), this._update(!0);
}
getLayer(S) {
return this.style.getLayer(S);
}
getLayersOrder() {
return this.style.getLayersOrder();
}
setLayerZoomRange(S, l, m) {
return this.style.setLayerZoomRange(S, l, m), this._update(!0);
}
setFilter(S, l, m = {}) {
return this.style.setFilter(S, l, m), this._update(!0);
}
getFilter(S) {
return this.style.getFilter(S);
}
setPaintProperty(S, l, m, v = {}) {
return this.style.setPaintProperty(S, l, m, v), this._update(!0);
}
getPaintProperty(S, l) {
return this.style.getPaintProperty(S, l);
}
setLayoutProperty(S, l, m, v = {}) {
return this.style.setLayoutProperty(S, l, m, v), this._update(!0);
}
getLayoutProperty(S, l) {
return this.style.getLayoutProperty(S, l);
}
setGlyphs(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setGlyphs(S, l), this._update(!0);
}
getGlyphs() {
return this.style.getGlyphsUrl();
}
addSprite(S, l, m = {}) {
return this._lazyInitEmptyStyle(), this.style.addSprite(S, l, m, (v) => {
v || this._update(!0);
}), this;
}
removeSprite(S) {
return this._lazyInitEmptyStyle(), this.style.removeSprite(S), this._update(!0);
}
getSprite() {
return this.style.getSprite();
}
setSprite(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setSprite(S, l, (m) => {
m || this._update(!0);
}), this;
}
setLight(S, l = {}) {
return this._lazyInitEmptyStyle(), this.style.setLight(S, l), this._update(!0);
}
getLight() {
return this.style.getLight();
}
setSky(S) {
return this._lazyInitEmptyStyle(), this.style.setSky(S), this._update(!0);
}
getSky() {
return this.style.getSky();
}
setFeatureState(S, l) {
return this.style.setFeatureState(S, l), this._update();
}
removeFeatureState(S, l) {
return this.style.removeFeatureState(S, l), this._update();
}
getFeatureState(S) {
return this.style.getFeatureState(S);
}
getContainer() {
return this._container;
}
getCanvasContainer() {
return this._canvasContainer;
}
getCanvas() {
return this._canvas;
}
_containerDimensions() {
let S = 0, l = 0;
return this._container && (S = this._container.clientWidth || 400, l = this._container.clientHeight || 300), [S, l];
}
_setupContainer() {
const S = this._container;
S.classList.add("maplibregl-map");
const l = this._canvasContainer = Q.create("div", "maplibregl-canvas-container", S);
this._interactive && l.classList.add("maplibregl-interactive"), this._canvas = Q.create("canvas", "maplibregl-canvas", l), this._canvas.addEventListener("webglcontextlost", this._contextLost, !1), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.setAttribute("tabindex", this._interactive ? "0" : "-1"), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region");
const m = this._containerDimensions(), v = this._getClampedPixelRatio(m[0], m[1]);
this._resizeCanvas(m[0], m[1], v);
const b = this._controlContainer = Q.create("div", "maplibregl-control-container", S), M = this._controlPositions = {};
["top-left", "top-right", "bottom-left", "bottom-right"].forEach((V) => {
M[V] = Q.create("div", `maplibregl-ctrl-${V} `, b);
}), this._container.addEventListener("scroll", this._onMapScroll, !1);
}
_resizeCanvas(S, l, m) {
this._canvas.width = Math.floor(m * S), this._canvas.height = Math.floor(m * l), this._canvas.style.width = `${S}px`, this._canvas.style.height = `${l}px`;
}
_setupPainter() {
const S = { alpha: !0, stencil: !0, depth: !0, failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || !1 };
let l = null;
this._canvas.addEventListener("webglcontextcreationerror", (v) => {
l = { requestedAttributes: S }, v && (l.statusMessage = v.statusMessage, l.type = v.type);
}, { once: !0 });
const m = this._canvas.getContext("webgl2", S) || this._canvas.getContext("webgl", S);
if (!m) {
const v = "Failed to initialize WebGL";
throw l ? (l.message = v, new Error(JSON.stringify(l))) : new Error(v);
}
this.painter = new yi(m, this.transform), y.testSupport(m);
}
loaded() {
return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
}
_update(S) {
return this.style && this.style._loaded ? (this._styleDirty = this._styleDirty || S, this._sourcesDirty = !0, this.triggerRepaint(), this) : this;
}
_requestRenderFrame(S) {
return this._update(), this._renderTaskQueue.add(S);
}
_cancelRenderFrame(S) {
this._renderTaskQueue.remove(S);
}
_render(S) {
const l = this._idleTriggered ? this._fadeDuration : 0;
if (this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(S), this._removed)
return;
let m = !1;
if (this.style && this._styleDirty) {
this._styleDirty = !1;
const b = this.transform.zoom, M = f.now();
this.style.zoomHistory.update(b, M);
const V = new a.z(b, { now: M, fadeDuration: l, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), D = V.crossFadingFactor();
D === 1 && D === this._crossFadingFactor || (m = !0, this._crossFadingFactor = D), this.style.update(V);
}
this.style && this._sourcesDirty && (this._sourcesDirty = !1, this.style._updateSources(this.transform)), this.terrain ? (this.terrain.sourceCache.update(this.transform, this.terrain), this.transform.minElevationForCurrentTile = this.terrain.getMinTileElevationForLngLatZoom(this.transform.center, this.transform.tileZoom), this._elevationFreeze || (this.transform.elevation = this.terrain.getElevationForLngLatZoom(this.transform.center, this.transform.tileZoom))) : (this.transform.minElevationForCurrentTile = 0, this.transform.elevation = 0), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, l, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: l, showPadding: this.showPadding }), this.fire(new a.k("render")), this.loaded() && !this._loaded && (this._loaded = !0, a.bf.mark(a.bg.load), this.fire(new a.k("load"))), this.style && (this.style.hasTransitions() || m) && (this._styleDirty = !0), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles();
const v = this._sourcesDirty || this._styleDirty || this._placementDirty;
return v || this._repaint ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new a.k("idle")), !this._loaded || this._fullyLoaded || v || (this._fullyLoaded = !0, a.bf.mark(a.bg.fullLoad)), this;
}
redraw() {
return this.style && (this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._render(0)), this;
}
remove() {
var S;
this._hash && this._hash.remove();
for (const m of this._controls)
m.onRemove(this);
this._controls = [], this._frameRequest && (this._frameRequest.abort(), this._frameRequest = null), this._renderTaskQueue.clear(), this.painter.destroy(), this.handlers.destroy(), delete this.handlers, this.setStyle(null), typeof window < "u" && removeEventListener("online", this._onWindowOnline, !1), k.removeThrottleControl(this._imageQueueHandle), (S = this._resizeObserver) === null || S === void 0 || S.disconnect();
const l = this.painter.context.gl.getExtension("WEBGL_lose_context");
l != null && l.loseContext && l.loseContext(), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.removeEventListener("webglcontextlost", this._contextLost, !1), Q.remove(this._canvasContainer), Q.remove(this._controlContainer), this._container.classList.remove("maplibregl-map"), a.bf.clearMetrics(), this._removed = !0, this.fire(new a.k("remove"));
}
triggerRepaint() {
this.style && !this._frameRequest && (this._frameRequest = new AbortController(), f.frameAsync(this._frameRequest).then((S) => {
a.bf.frame(S), this._frameRequest = null, this._render(S);
}).catch(() => {
}));
}
get showTileBoundaries() {
return !!this._showTileBoundaries;
}
set showTileBoundaries(S) {
this._showTileBoundaries !== S && (this._showTileBoundaries = S, this._update());
}
get showPadding() {
return !!this._showPadding;
}
set showPadding(S) {
this._showPadding !== S && (this._showPadding = S, this._update());
}
get showCollisionBoxes() {
return !!this._showCollisionBoxes;
}
set showCollisionBoxes(S) {
this._showCollisionBoxes !== S && (this._showCollisionBoxes = S, S ? this.style._generateCollisionBoxes() : this._update());
}
get showOverdrawInspector() {
return !!this._showOverdrawInspector;
}
set showOverdrawInspector(S) {
this._showOverdrawInspector !== S && (this._showOverdrawInspector = S, this._update());
}
get repaint() {
return !!this._repaint;
}
set repaint(S) {
this._repaint !== S && (this._repaint = S, this.triggerRepaint());
}
get vertices() {
return !!this._vertices;
}
set vertices(S) {
this._vertices = S, this._update();
}
get version() {
return _p;
}
getCameraTargetElevation() {
return this.transform.elevation;
}
}, s.MapMouseEvent = Gi, s.MapTouchEvent = $i, s.MapWheelEvent = e2, s.Marker = Ol, s.NavigationControl = class {
constructor(S) {
this._updateZoomButtons = () => {
const l = this._map.getZoom(), m = l === this._map.getMaxZoom(), v = l === this._map.getMinZoom();
this._zoomInButton.disabled = m, this._zoomOutButton.disabled = v, this._zoomInButton.setAttribute("aria-disabled", m.toString()), this._zoomOutButton.setAttribute("aria-disabled", v.toString());
}, this._rotateCompassArrow = () => {
const l = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle * (180 / Math.PI)}deg)` : `rotate(${this._map.transform.angle * (180 / Math.PI)}deg)`;
this._compassIcon.style.transform = l;
}, this._setButtonTitle = (l, m) => {
const v = this._map._getUIString(`NavigationControl.${m}`);
l.title = v, l.setAttribute("aria-label", v);
}, this.options = a.e({}, v_, S), this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._container.addEventListener("contextmenu", (l) => l.preventDefault()), this.options.showZoom && (this._zoomInButton = this._createButton("maplibregl-ctrl-zoom-in", (l) => this._map.zoomIn({}, { originalEvent: l })), Q.create("span", "maplibregl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("maplibregl-ctrl-zoom-out", (l) => this._map.zoomOut({}, { originalEvent: l })), Q.create("span", "maplibregl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (this._compass = this._createButton("maplibregl-ctrl-compass", (l) => {
this.options.visualizePitch ? this._map.resetNorthPitch({}, { originalEvent: l }) : this._map.resetNorth({}, { originalEvent: l });
}), this._compassIcon = Q.create("span", "maplibregl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true"));
}
onAdd(S) {
return this._map = S, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), this._map.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && this._map.on("pitch", this._rotateCompassArrow), this._map.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new __(this._map, this._compass, this.options.visualizePitch)), this._container;
}
onRemove() {
Q.remove(this._container), this.options.showZoom && this._map.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && this._map.off("pitch", this._rotateCompassArrow), this._map.off("rotate", this._rotateCompassArrow), this._handler.off(), delete this._handler), delete this._map;
}
_createButton(S, l) {
const m = Q.create("button", S, this._container);
return m.type = "button", m.addEventListener("click", l), m;
}
}, s.Popup = class extends a.E {
constructor(S) {
super(), this.remove = () => (this._content && Q.remove(this._content), this._container && (Q.remove(this._container), delete this._container), this._map && (this._map.off("move", this._update), this._map.off("move", this._onClose), this._map.off("click", this._onClose), this._map.off("remove", this.remove), this._map.off("mousemove", this._onMouseMove), this._map.off("mouseup", this._onMouseUp), this._map.off("drag", this._onDrag), this._map._canvasContainer.classList.remove("maplibregl-track-pointer"), delete this._map, this.fire(new a.k("close"))), this), this._onMouseUp = (l) => {
this._update(l.point);
}, this._onMouseMove = (l) => {
this._update(l.point);
}, this._onDrag = (l) => {
this._update(l.point);
}, this._update = (l) => {
var m;
if (!this._map || !this._lngLat && !this._trackPointer || !this._content)
return;
if (!this._container) {
if (this._container = Q.create("div", "maplibregl-popup", this._map.getContainer()), this._tip = Q.create("div", "maplibregl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className)
for (const D of this.options.className.split(" "))
this._container.classList.add(D);
this._closeButton && this._closeButton.setAttribute("aria-label", this._map._getUIString("Popup.Close")), this._trackPointer && this._container.classList.add("maplibregl-popup-track-pointer");
}
if (this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._lngLat = this._map.transform.renderWorldCopies && !this._trackPointer ? ti(this._lngLat, this._flatPos, this._map.transform) : (m = this._lngLat) === null || m === void 0 ? void 0 : m.wrap(), this._trackPointer && !l)
return;
const v = this._flatPos = this._pos = this._trackPointer && l ? l : this._map.project(this._lngLat);
this._map.terrain && (this._flatPos = this._trackPointer && l ? l : this._map.transform.locationPoint(this._lngLat));
let b = this.options.anchor;
const M = kl(this.options.offset);
if (!b) {
const D = this._container.offsetWidth, j = this._container.offsetHeight;
let Z;
Z = v.y + M.bottom.y < j ? ["top"] : v.y > this._map.transform.height - j ? ["bottom"] : [], v.x < D / 2 ? Z.push("left") : v.x > this._map.transform.width - D / 2 && Z.push("right"), b = Z.length === 0 ? "bottom" : Z.join("-");
}
let V = v.add(M[b]);
this.options.subpixelPositioning || (V = V.round()), Q.setTransform(this._container, `${o6[b]} translate(${V.x}px,${V.y}px)`), Al(this._container, b, "popup");
}, this._onClose = () => {
this.remove();
}, this.options = a.e(Object.create(Mr), S);
}
addTo(S) {
return this._map && this.remove(), this._map = S, this.options.closeOnClick && this._map.on("click", this._onClose), this.options.closeOnMove && this._map.on("move", this._onClose), this._map.on("remove", this.remove), this._update(), this._focusFirstElement(), this._trackPointer ? (this._map.on("mousemove", this._onMouseMove), this._map.on("mouseup", this._onMouseUp), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.add("maplibregl-track-pointer")) : this._map.on("move", this._update), this.fire(new a.k("open")), this;
}
isOpen() {
return !!this._map;
}
getLngLat() {
return this._lngLat;
}
setLngLat(S) {
return this._lngLat = a.N.convert(S), this._pos = null, this._flatPos = null, this._trackPointer = !1, this._update(), this._map && (this._map.on("move", this._update), this._map.off("mousemove", this._onMouseMove), this._container && this._container.classList.remove("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.remove("maplibregl-track-pointer")), this;
}
trackPointer() {
return this._trackPointer = !0, this._pos = null, this._flatPos = null, this._update(), this._map && (this._map.off("move", this._update), this._map.on("mousemove", this._onMouseMove), this._map.on("drag", this._onDrag), this._container && this._container.classList.add("maplibregl-popup-track-pointer"), this._map._canvasContainer.classList.add("maplibregl-track-pointer")), this;
}
getElement() {
return this._container;
}
setText(S) {
return this.setDOMContent(document.createTextNode(S));
}
setHTML(S) {
const l = document.createDocumentFragment(), m = document.createElement("body");
let v;
for (m.innerHTML = S; v = m.firstChild, v; )
l.appendChild(v);
return this.setDOMContent(l);
}
getMaxWidth() {
var S;
return (S = this._container) === null || S === void 0 ? void 0 : S.style.maxWidth;
}
setMaxWidth(S) {
return this.options.maxWidth = S, this._update(), this;
}
setDOMContent(S) {
if (this._content)
for (; this._content.hasChildNodes(); )
this._content.firstChild && this._content.removeChild(this._content.firstChild);
else
this._content = Q.create("div", "maplibregl-popup-content", this._container);
return this._content.appendChild(S), this._createCloseButton(), this._update(), this._focusFirstElement(), this;
}
addClassName(S) {
return this._container && this._container.classList.add(S), this;
}
removeClassName(S) {
return this._container && this._container.classList.remove(S), this;
}
setOffset(S) {
return this.options.offset = S, this._update(), this;
}
toggleClassName(S) {
if (this._container)
return this._container.classList.toggle(S);
}
setSubpixelPositioning(S) {
this.options.subpixelPositioning = S;
}
_createCloseButton() {
this.options.closeButton && (this._closeButton = Q.create("button", "maplibregl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.innerHTML = "×", this._closeButton.addEventListener("click", this._onClose));
}
_focusFirstElement() {
if (!this.options.focusAfterOpen || !this._container)
return;
const S = this._container.querySelector(Cl);
S && S.focus();
}
}, s.RasterDEMTileSource = Rr, s.RasterTileSource = Hr, s.ScaleControl = class {
constructor(S) {
this._onMove = () => {
V0(this._map, this._container, this.options);
}, this.setUnit = (l) => {
this.options.unit = l, V0(this._map, this._container, this.options);
}, this.options = Object.assign(Object.assign({}, Qs), S);
}
getDefaultPosition() {
return "bottom-left";
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-scale", S.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container;
}
onRemove() {
Q.remove(this._container), this._map.off("move", this._onMove), this._map = void 0;
}
}, s.ScrollZoomHandler = A2, s.Style = ma, s.TerrainControl = class {
constructor(S) {
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 = S;
}
onAdd(S) {
return this._map = S, this._container = Q.create("div", "maplibregl-ctrl maplibregl-ctrl-group"), this._terrainButton = Q.create("button", "maplibregl-ctrl-terrain", this._container), Q.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() {
Q.remove(this._container), this._map.off("terrain", this._updateTerrainIcon), this._map = void 0;
}
}, s.TwoFingersTouchPitchHandler = t6, s.TwoFingersTouchRotateHandler = Cc, s.TwoFingersTouchZoomHandler = Ac, s.TwoFingersTouchZoomRotateHandler = Ic, s.VectorTileSource = Jr, s.VideoSource = ki, s.addSourceType = (S, l) => a._(void 0, void 0, void 0, function* () {
if (c1(S))
throw new Error(`A source type called "${S}" already exists.`);
((m, v) => {
Ii[m] = v;
})(S, l);
}), s.clearPrewarmedResources = function() {
const S = Gt;
S && (S.isPreloaded() && S.numActive() === 1 ? (S.release(er), Gt = 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()"));
}, s.getMaxParallelImageRequests = function() {
return a.a.MAX_PARALLEL_IMAGE_REQUESTS;
}, s.getRTLTextPluginStatus = function() {
return Hi().getRTLTextPluginStatus();
}, s.getVersion = function() {
return Bc;
}, s.getWorkerCount = function() {
return Je.workerCount;
}, s.getWorkerUrl = function() {
return a.a.WORKER_URL;
}, s.importScriptInWorkers = function(S) {
return Ge().broadcast("IS", S);
}, s.prewarm = function() {
me().acquire(er);
}, s.setMaxParallelImageRequests = function(S) {
a.a.MAX_PARALLEL_IMAGE_REQUESTS = S;
}, s.setRTLTextPlugin = function(S, l) {
return Hi().setRTLTextPlugin(S, l);
}, s.setWorkerCount = function(S) {
Je.workerCount = S;
}, s.setWorkerUrl = function(S) {
a.a.WORKER_URL = S;
};
});
var o = r;
return o;
});
})(qG);
var q9t = qG.exports;
const Uo = /* @__PURE__ */ p0(q9t);
function ic(t, e, r) {
r === void 0 && (r = {});
var n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = {}, n.geometry = t, n;
}
function KG(t, e, r) {
switch (t) {
case "Point":
return iH(e).geometry;
case "LineString":
return YG(e).geometry;
case "Polygon":
return X9t(e).geometry;
case "MultiPoint":
return Y9t(e).geometry;
case "MultiLineString":
return K9t(e).geometry;
case "MultiPolygon":
return J9t(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
function iH(t, e, r) {
if (r === void 0 && (r = {}), !t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!Vx(t[0]) || !Vx(t[1]))
throw new Error("coordinates must contain numbers");
var n = {
type: "Point",
coordinates: t
};
return ic(n, e, r);
}
function X9t(t, e, r) {
r === void 0 && (r = {});
for (var n = 0, i = t; n < i.length; n++) {
var o = i[n];
if (o.length < 4)
throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
for (var s = 0; s < o[o.length - 1].length; s++)
if (o[o.length - 1][s] !== o[0][s])
throw new Error("First and last Position are not equivalent.");
}
var a = {
type: "Polygon",
coordinates: t
};
return ic(a, e, r);
}
function YG(t, e, r) {
if (r === void 0 && (r = {}), t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
var n = {
type: "LineString",
coordinates: t
};
return ic(n, e, r);
}
function K9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiLineString",
coordinates: t
};
return ic(n, e, r);
}
function Y9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPoint",
coordinates: t
};
return ic(n, e, r);
}
function J9t(t, e, r) {
r === void 0 && (r = {});
var n = {
type: "MultiPolygon",
coordinates: t
};
return ic(n, e, r);
}
function Vx(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
var N2 = 63710088e-1, tht = {
centimeters: N2 * 100,
centimetres: N2 * 100,
degrees: 360 / (2 * Math.PI),
feet: N2 * 3.28084,
inches: N2 * 39.37,
kilometers: N2 / 1e3,
kilometres: N2 / 1e3,
meters: N2,
metres: N2,
miles: N2 / 1609.344,
millimeters: N2 * 1e3,
millimetres: N2 * 1e3,
nauticalmiles: N2 / 1852,
radians: 1,
yards: N2 * 1.0936
};
function eht(t, e = "kilometers") {
const r = tht[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
function cT(t) {
return t % 360 * Math.PI / 180;
}
function DP(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function g5(t, e, r = {}) {
var n = DP(t), i = DP(e), o = cT(i[1] - n[1]), s = cT(i[0] - n[0]), a = cT(n[1]), u = cT(i[1]), d = Math.pow(Math.sin(o / 2), 2) + Math.pow(Math.sin(s / 2), 2) * Math.cos(a) * Math.cos(u);
return eht(
2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)),
r.units
);
}
var FP = Object.prototype.toString, JG = function(t) {
var e = FP.call(t), r = e === "[object Arguments]";
return r || (r = e !== "[object Array]" && t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && FP.call(t.callee) === "[object Function]"), r;
}, Jb, BP;
function rht() {
if (BP)
return Jb;
BP = 1;
var t;
if (!Object.keys) {
var e = Object.prototype.hasOwnProperty, r = Object.prototype.toString, n = JG, i = Object.prototype.propertyIsEnumerable, o = !i.call({ toString: null }, "toString"), s = i.call(function() {
}, "prototype"), a = [
"toString",
"toLocaleString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"constructor"
], u = function(Q) {
var y = Q.constructor;
return y && y.prototype === Q;
}, d = {
$applicationCache: !0,
$console: !0,
$external: !0,
$frame: !0,
$frameElement: !0,
$frames: !0,
$innerHeight: !0,
$innerWidth: !0,
$onmozfullscreenchange: !0,
$onmozfullscreenerror: !0,
$outerHeight: !0,
$outerWidth: !0,
$pageXOffset: !0,
$pageYOffset: !0,
$parent: !0,
$scrollLeft: !0,
$scrollTop: !0,
$scrollX: !0,
$scrollY: !0,
$self: !0,
$webkitIndexedDB: !0,
$webkitStorageInfo: !0,
$window: !0
}, T = function() {
if (typeof window > "u")
return !1;
for (var Q in window)
try {
if (!d["$" + Q] && e.call(window, Q) && window[Q] !== null && typeof window[Q] == "object")
try {
u(window[Q]);
} catch {
return !0;
}
} catch {
return !0;
}
return !1;
}(), f = function(Q) {
if (typeof window > "u" || !T)
return u(Q);
try {
return u(Q);
} catch {
return !1;
}
};
t = function(Q) {
var y = Q !== null && typeof Q == "object", _ = r.call(Q) === "[object Function]", L = n(Q), E = y && r.call(Q) === "[object String]", x = [];
if (!y && !_ && !L)
throw new TypeError("Object.keys called on a non-object");
var O = s && _;
if (E && Q.length > 0 && !e.call(Q, 0))
for (var k = 0; k < Q.length; ++k)
x.push(String(k));
if (L && Q.length > 0)
for (var R = 0; R < Q.length; ++R)
x.push(String(R));
else
for (var F in Q)
!(O && F === "prototype") && e.call(Q, F) && x.push(String(F));
if (o)
for (var U = f(Q), $ = 0; $ < a.length; ++$)
!(U && a[$] === "constructor") && e.call(Q, a[$]) && x.push(a[$]);
return x;
};
}
return Jb = t, Jb;
}
var nht = Array.prototype.slice, iht = JG, jP = Object.keys, Lf = jP ? function(t) {
return jP(t);
} : rht(), zP = Object.keys;
Lf.shim = function() {
if (Object.keys) {
var t = function() {
var e = Object.keys(arguments);
return e && e.length === arguments.length;
}(1, 2);
t || (Object.keys = function(e) {
return iht(e) ? zP(nht.call(e)) : zP(e);
});
} else
Object.keys = Lf;
return Object.keys || Lf;
};
var oH = Lf, oht = Error, sht = EvalError, aht = RangeError, lht = ReferenceError, t$ = SyntaxError, f0 = TypeError, cht = URIError, Dg = function() {
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
return !1;
if (typeof Symbol.iterator == "symbol")
return !0;
var t = {}, e = Symbol("test"), r = Object(e);
if (typeof e == "string" || Object.prototype.toString.call(e) !== "[object Symbol]" || Object.prototype.toString.call(r) !== "[object Symbol]")
return !1;
var n = 42;
t[e] = n;
for (e in t)
return !1;
if (typeof Object.keys == "function" && Object.keys(t).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(t).length !== 0)
return !1;
var i = Object.getOwnPropertySymbols(t);
if (i.length !== 1 || i[0] !== e || !Object.prototype.propertyIsEnumerable.call(t, e))
return !1;
if (typeof Object.getOwnPropertyDescriptor == "function") {
var o = Object.getOwnPropertyDescriptor(t, e);
if (o.value !== n || o.enumerable !== !0)
return !1;
}
return !0;
}, UP = typeof Symbol < "u" && Symbol, uht = Dg, sH = function() {
return typeof UP != "function" || typeof Symbol != "function" || typeof UP("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : uht();
}, tL = {
__proto__: null,
foo: {}
}, hht = Object, dht = function() {
return { __proto__: tL }.foo === tL.foo && !(tL instanceof hht);
}, pht = "Function.prototype.bind called on incompatible ", Tht = Object.prototype.toString, fht = Math.max, Qht = "[object Function]", GP = function(t, e) {
for (var r = [], n = 0; n < t.length; n += 1)
r[n] = t[n];
for (var i = 0; i < e.length; i += 1)
r[i + t.length] = e[i];
return r;
}, mht = function(t, e) {
for (var r = [], n = e, i = 0; n < t.length; n += 1, i += 1)
r[i] = t[n];
return r;
}, ght = function(t, e) {
for (var r = "", n = 0; n < t.length; n += 1)
r += t[n], n + 1 < t.length && (r += e);
return r;
}, yht = function(t) {
var e = this;
if (typeof e != "function" || Tht.apply(e) !== Qht)
throw new TypeError(pht + e);
for (var r = mht(arguments, 1), n, i = function() {
if (this instanceof n) {
var d = e.apply(
this,
GP(r, arguments)
);
return Object(d) === d ? d : this;
}
return e.apply(
t,
GP(r, arguments)
);
}, o = fht(0, e.length - r.length), s = [], a = 0; a < o; a++)
s[a] = "$" + a;
if (n = Function("binder", "return function (" + ght(s, ",") + "){ return binder.apply(this,arguments); }")(i), e.prototype) {
var u = function() {
};
u.prototype = e.prototype, n.prototype = new u(), u.prototype = null;
}
return n;
}, vht = yht, aH = Function.prototype.bind || vht, _ht = Function.prototype.call, bht = Object.prototype.hasOwnProperty, Lht = aH, e$ = Lht.call(_ht, bht), gn, wht = oht, xht = sht, Eht = aht, Mht = lht, H8 = t$, d8 = f0, Sht = cht, r$ = Function, eL = function(t) {
try {
return r$('"use strict"; return (' + t + ").constructor;")();
} catch {
}
}, P5 = Object.getOwnPropertyDescriptor;
if (P5)
try {
P5({}, "");
} catch {
P5 = null;
}
var rL = function() {
throw new d8();
}, Hht = P5 ? function() {
try {
return arguments.callee, rL;
} catch {
try {
return P5(arguments, "callee").get;
} catch {
return rL;
}
}
}() : rL, Jl = sH(), Aht = dht(), B1 = Object.getPrototypeOf || (Aht ? function(t) {
return t.__proto__;
} : null), x7 = {}, Oht = typeof Uint8Array > "u" || !B1 ? gn : B1(Uint8Array), V5 = {
__proto__: null,
"%AggregateError%": typeof AggregateError > "u" ? gn : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer > "u" ? gn : ArrayBuffer,
"%ArrayIteratorPrototype%": Jl && B1 ? B1([][Symbol.iterator]()) : gn,
"%AsyncFromSyncIteratorPrototype%": gn,
"%AsyncFunction%": x7,
"%AsyncGenerator%": x7,
"%AsyncGeneratorFunction%": x7,
"%AsyncIteratorPrototype%": x7,
"%Atomics%": typeof Atomics > "u" ? gn : Atomics,
"%BigInt%": typeof BigInt > "u" ? gn : BigInt,
"%BigInt64Array%": typeof BigInt64Array > "u" ? gn : BigInt64Array,
"%BigUint64Array%": typeof BigUint64Array > "u" ? gn : BigUint64Array,
"%Boolean%": Boolean,
"%DataView%": typeof DataView > "u" ? gn : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": wht,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": xht,
"%Float32Array%": typeof Float32Array > "u" ? gn : Float32Array,
"%Float64Array%": typeof Float64Array > "u" ? gn : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? gn : FinalizationRegistry,
"%Function%": r$,
"%GeneratorFunction%": x7,
"%Int8Array%": typeof Int8Array > "u" ? gn : Int8Array,
"%Int16Array%": typeof Int16Array > "u" ? gn : Int16Array,
"%Int32Array%": typeof Int32Array > "u" ? gn : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": Jl && B1 ? B1(B1([][Symbol.iterator]())) : gn,
"%JSON%": typeof JSON == "object" ? JSON : gn,
"%Map%": typeof Map > "u" ? gn : Map,
"%MapIteratorPrototype%": typeof Map > "u" || !Jl || !B1 ? gn : B1((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise > "u" ? gn : Promise,
"%Proxy%": typeof Proxy > "u" ? gn : Proxy,
"%RangeError%": Eht,
"%ReferenceError%": Mht,
"%Reflect%": typeof Reflect > "u" ? gn : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set > "u" ? gn : Set,
"%SetIteratorPrototype%": typeof Set > "u" || !Jl || !B1 ? gn : B1((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? gn : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": Jl && B1 ? B1(""[Symbol.iterator]()) : gn,
"%Symbol%": Jl ? Symbol : gn,
"%SyntaxError%": H8,
"%ThrowTypeError%": Hht,
"%TypedArray%": Oht,
"%TypeError%": d8,
"%Uint8Array%": typeof Uint8Array > "u" ? gn : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? gn : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array > "u" ? gn : Uint16Array,
"%Uint32Array%": typeof Uint32Array > "u" ? gn : Uint32Array,
"%URIError%": Sht,
"%WeakMap%": typeof WeakMap > "u" ? gn : WeakMap,
"%WeakRef%": typeof WeakRef > "u" ? gn : WeakRef,
"%WeakSet%": typeof WeakSet > "u" ? gn : WeakSet
};
if (B1)
try {
null.error;
} catch (t) {
var Cht = B1(B1(t));
V5["%Error.prototype%"] = Cht;
}
var kht = function t(e) {
var r;
if (e === "%AsyncFunction%")
r = eL("async function () {}");
else if (e === "%GeneratorFunction%")
r = eL("function* () {}");
else if (e === "%AsyncGeneratorFunction%")
r = eL("async function* () {}");
else if (e === "%AsyncGenerator%") {
var n = t("%AsyncGeneratorFunction%");
n && (r = n.prototype);
} else if (e === "%AsyncIteratorPrototype%") {
var i = t("%AsyncGenerator%");
i && B1 && (r = B1(i.prototype));
}
return V5[e] = r, r;
}, $P = {
__proto__: null,
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
}, wd = aH, GQ = e$, Iht = wd.call(Function.call, Array.prototype.concat), Pht = wd.call(Function.apply, Array.prototype.splice), WP = wd.call(Function.call, String.prototype.replace), $Q = wd.call(Function.call, String.prototype.slice), Vht = wd.call(Function.call, RegExp.prototype.exec), Rht = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Nht = /\\(\\)?/g, Dht = function(t) {
var e = $Q(t, 0, 1), r = $Q(t, -1);
if (e === "%" && r !== "%")
throw new H8("invalid intrinsic syntax, expected closing `%`");
if (r === "%" && e !== "%")
throw new H8("invalid intrinsic syntax, expected opening `%`");
var n = [];
return WP(t, Rht, function(i, o, s, a) {
n[n.length] = s ? WP(a, Nht, "$1") : o || i;
}), n;
}, Fht = function(t, e) {
var r = t, n;
if (GQ($P, r) && (n = $P[r], r = "%" + n[0] + "%"), GQ(V5, r)) {
var i = V5[r];
if (i === x7 && (i = kht(r)), typeof i > "u" && !e)
throw new d8("intrinsic " + t + " exists, but is not available. Please file an issue!");
return {
alias: n,
name: r,
value: i
};
}
throw new H8("intrinsic " + t + " does not exist!");
}, x3 = function(t, e) {
if (typeof t != "string" || t.length === 0)
throw new d8("intrinsic name must be a non-empty string");
if (arguments.length > 1 && typeof e != "boolean")
throw new d8('"allowMissing" argument must be a boolean');
if (Vht(/^%?[^%]*%?$/, t) === null)
throw new H8("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
var r = Dht(t), n = r.length > 0 ? r[0] : "", i = Fht("%" + n + "%", e), o = i.name, s = i.value, a = !1, u = i.alias;
u && (n = u[0], Pht(r, Iht([0, 1], u)));
for (var d = 1, T = !0; d < r.length; d += 1) {
var f = r[d], Q = $Q(f, 0, 1), y = $Q(f, -1);
if ((Q === '"' || Q === "'" || Q === "`" || y === '"' || y === "'" || y === "`") && Q !== y)
throw new H8("property names with quotes must have matching quotes");
if ((f === "constructor" || !T) && (a = !0), n += "." + f, o = "%" + n + "%", GQ(V5, o))
s = V5[o];
else if (s != null) {
if (!(f in s)) {
if (!e)
throw new d8("base intrinsic for " + t + " exists, but the property is not available.");
return;
}
if (P5 && d + 1 >= r.length) {
var _ = P5(s, f);
T = !!_, T && "get" in _ && !("originalValue" in _.get) ? s = _.get : s = s[f];
} else
T = GQ(s, f), s = s[f];
T && !a && (V5[o] = s);
}
}
return s;
}, Bht = x3, wf = Bht("%Object.defineProperty%", !0) || !1;
if (wf)
try {
wf({}, "a", { value: 1 });
} catch {
wf = !1;
}
var lH = wf, jht = x3, xf = jht("%Object.getOwnPropertyDescriptor%", !0);
if (xf)
try {
xf([], "length");
} catch {
xf = null;
}
var cH = xf, ZP = lH, zht = t$, t7 = f0, qP = cH, uH = function(t, e, r) {
if (!t || typeof t != "object" && typeof t != "function")
throw new t7("`obj` must be an object or a function`");
if (typeof e != "string" && typeof e != "symbol")
throw new t7("`property` must be a string or a symbol`");
if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
throw new t7("`nonEnumerable`, if provided, must be a boolean or null");
if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
throw new t7("`nonWritable`, if provided, must be a boolean or null");
if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
throw new t7("`nonConfigurable`, if provided, must be a boolean or null");
if (arguments.length > 6 && typeof arguments[6] != "boolean")
throw new t7("`loose`, if provided, must be a boolean");
var n = arguments.length > 3 ? arguments[3] : null, i = arguments.length > 4 ? arguments[4] : null, o = arguments.length > 5 ? arguments[5] : null, s = arguments.length > 6 ? arguments[6] : !1, a = !!qP && qP(t, e);
if (ZP)
ZP(t, e, {
configurable: o === null && a ? a.configurable : !o,
enumerable: n === null && a ? a.enumerable : !n,
value: r,
writable: i === null && a ? a.writable : !i
});
else if (s || !n && !i && !o)
t[e] = r;
else
throw new zht("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
}, Rx = lH, n$ = function() {
return !!Rx;
};
n$.hasArrayLengthDefineBug = function() {
if (!Rx)
return null;
try {
return Rx([], "length", { value: 1 }).length !== 1;
} catch {
return !0;
}
};
var hH = n$, Uht = oH, Ght = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", $ht = Object.prototype.toString, Wht = Array.prototype.concat, XP = uH, Zht = function(t) {
return typeof t == "function" && $ht.call(t) === "[object Function]";
}, i$ = hH(), qht = function(t, e, r, n) {
if (e in t) {
if (n === !0) {
if (t[e] === r)
return;
} else if (!Zht(n) || !n())
return;
}
i$ ? XP(t, e, r, !0) : XP(t, e, r);
}, o$ = function(t, e) {
var r = arguments.length > 2 ? arguments[2] : {}, n = Uht(e);
Ght && (n = Wht.call(n, Object.getOwnPropertySymbols(e)));
for (var i = 0; i < n.length; i += 1)
qht(t, n[i], e[n[i]], r[n[i]]);
};
o$.supportsDescriptors = !!i$;
var hl = o$, s$ = { exports: {} }, Xht = x3, KP = uH, Kht = hH(), YP = cH, JP = f0, Yht = Xht("%Math.floor%"), Jht = function(t, e) {
if (typeof t != "function")
throw new JP("`fn` is not a function");
if (typeof e != "number" || e < 0 || e > 4294967295 || Yht(e) !== e)
throw new JP("`length` must be a positive 32-bit integer");
var r = arguments.length > 2 && !!arguments[2], n = !0, i = !0;
if ("length" in t && YP) {
var o = YP(t, "length");
o && !o.configurable && (n = !1), o && !o.writable && (i = !1);
}
return (n || i || !r) && (Kht ? KP(
/** @type {Parameters[0]} */
t,
"length",
e,
!0,
!0
) : KP(
/** @type {Parameters[0]} */
t,
"length",
e
)), t;
};
(function(t) {
var e = aH, r = x3, n = Jht, i = f0, o = r("%Function.prototype.apply%"), s = r("%Function.prototype.call%"), a = r("%Reflect.apply%", !0) || e.call(s, o), u = lH, d = r("%Math.max%");
t.exports = function(f) {
if (typeof f != "function")
throw new i("a function is required");
var Q = a(e, s, arguments);
return n(
Q,
1 + d(0, f.length - (arguments.length - 1)),
!0
);
};
var T = function() {
return a(e, o, arguments);
};
u ? u(t.exports, "apply", { value: T }) : t.exports.apply = T;
})(s$);
var oc = s$.exports, a$ = x3, l$ = oc, tdt = l$(a$("String.prototype.indexOf")), Fs = function(t, e) {
var r = a$(t, !!e);
return typeof r == "function" && tdt(t, ".prototype.") > -1 ? l$(r) : r;
}, edt = oH, c$ = Dg(), u$ = Fs, tV = Object, rdt = u$("Array.prototype.push"), eV = u$("Object.prototype.propertyIsEnumerable"), ndt = c$ ? Object.getOwnPropertySymbols : null, h$ = function(t, e) {
if (t == null)
throw new TypeError("target must be an object");
var r = tV(t);
if (arguments.length === 1)
return r;
for (var n = 1; n < arguments.length; ++n) {
var i = tV(arguments[n]), o = edt(i), s = c$ && (Object.getOwnPropertySymbols || ndt);
if (s)
for (var a = s(i), u = 0; u < a.length; ++u) {
var d = a[u];
eV(i, d) && rdt(o, d);
}
for (var T = 0; T < o.length; ++T) {
var f = o[T];
if (eV(i, f)) {
var Q = i[f];
r[f] = Q;
}
}
}
return r;
}, idt = h$, odt = function() {
if (!Object.assign)
return !1;
for (var t = "abcdefghijklmnopqrst", e = t.split(""), r = {}, n = 0; n < e.length; ++n)
r[e[n]] = e[n];
var i = Object.assign({}, r), o = "";
for (var s in i)
o += s;
return t !== o;
}, sdt = function() {
if (!Object.assign || !Object.preventExtensions)
return !1;
var t = Object.preventExtensions({ 1: 2 });
try {
Object.assign(t, "xy");
} catch {
return t[1] === "y";
}
return !1;
}, d$ = function() {
return !Object.assign || odt() || sdt() ? idt : Object.assign;
}, adt = hl, ldt = d$, cdt = function() {
var t = ldt();
return adt(
Object,
{ assign: t },
{ assign: function() {
return Object.assign !== t;
} }
), t;
}, udt = hl, hdt = oc, ddt = h$, p$ = d$, pdt = cdt, Tdt = hdt.apply(p$()), T$ = function(t, e) {
return Tdt(Object, arguments);
};
udt(T$, {
getPolyfill: p$,
implementation: ddt,
shim: pdt
});
var fdt = T$, zh = function() {
return typeof (function() {
}).name == "string";
}, ih = Object.getOwnPropertyDescriptor;
if (ih)
try {
ih([], "length");
} catch {
ih = null;
}
zh.functionsHaveConfigurableNames = function() {
if (!zh() || !ih)
return !1;
var t = ih(function() {
}, "name");
return !!t && !!t.configurable;
};
var Qdt = Function.prototype.bind;
zh.boundFunctionsHaveNames = function() {
return zh() && typeof Qdt == "function" && (function() {
}).bind().name !== "";
};
var mdt = zh, rV = uH, gdt = hH(), ydt = mdt.functionsHaveConfigurableNames(), vdt = f0, _dt = function(t, e) {
if (typeof t != "function")
throw new vdt("`fn` is not a function");
var r = arguments.length > 2 && !!arguments[2];
return (!r || ydt) && (gdt ? rV(
/** @type {Parameters[0]} */
t,
"name",
e,
!0,
!0
) : rV(
/** @type {Parameters[0]} */
t,
"name",
e
)), t;
}, bdt = _dt, Ldt = f0, wdt = Object, f$ = bdt(function() {
if (this == null || this !== wdt(this))
throw new Ldt("RegExp.prototype.flags getter called on non-object");
var t = "";
return this.hasIndices && (t += "d"), this.global && (t += "g"), this.ignoreCase && (t += "i"), this.multiline && (t += "m"), this.dotAll && (t += "s"), this.unicode && (t += "u"), this.unicodeSets && (t += "v"), this.sticky && (t += "y"), t;
}, "get flags", !0), xdt = f$, Edt = hl.supportsDescriptors, Mdt = Object.getOwnPropertyDescriptor, Q$ = function() {
if (Edt && /a/mig.flags === "gim") {
var t = Mdt(RegExp.prototype, "flags");
if (t && typeof t.get == "function" && typeof RegExp.prototype.dotAll == "boolean" && typeof RegExp.prototype.hasIndices == "boolean") {
var e = "", r = {};
if (Object.defineProperty(r, "hasIndices", {
get: function() {
e += "d";
}
}), Object.defineProperty(r, "sticky", {
get: function() {
e += "y";
}
}), e === "dy")
return t.get;
}
}
return xdt;
}, Sdt = hl.supportsDescriptors, Hdt = Q$, Adt = Object.getOwnPropertyDescriptor, Odt = Object.defineProperty, Cdt = TypeError, nV = Object.getPrototypeOf, kdt = /a/, Idt = function() {
if (!Sdt || !nV)
throw new Cdt("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");
var t = Hdt(), e = nV(kdt), r = Adt(e, "flags");
return (!r || r.get !== t) && Odt(e, "flags", {
configurable: !0,
enumerable: !1,
get: t
}), t;
}, Pdt = hl, Vdt = oc, Rdt = f$, m$ = Q$, Ndt = Idt, g$ = Vdt(m$());
Pdt(g$, {
getPolyfill: m$,
implementation: Rdt,
shim: Ndt
});
var Ddt = g$, Ef = { exports: {} }, Fdt = Dg, dl = function() {
return Fdt() && !!Symbol.toStringTag;
}, Bdt = dl(), jdt = Fs, Nx = jdt("Object.prototype.toString"), Fg = function(t) {
return Bdt && t && typeof t == "object" && Symbol.toStringTag in t ? !1 : Nx(t) === "[object Arguments]";
}, y$ = function(t) {
return Fg(t) ? !0 : t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && Nx(t) !== "[object Array]" && Nx(t.callee) === "[object Function]";
}, zdt = function() {
return Fg(arguments);
}();
Fg.isLegacyArguments = y$;
var v$ = zdt ? Fg : y$;
const Udt = {}, Gdt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Udt
}, Symbol.toStringTag, { value: "Module" })), $dt = /* @__PURE__ */ W4t(Gdt);
var dH = typeof Map == "function" && Map.prototype, nL = Object.getOwnPropertyDescriptor && dH ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, WQ = dH && nL && typeof nL.get == "function" ? nL.get : null, iV = dH && Map.prototype.forEach, pH = typeof Set == "function" && Set.prototype, iL = Object.getOwnPropertyDescriptor && pH ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, ZQ = pH && iL && typeof iL.get == "function" ? iL.get : null, oV = pH && Set.prototype.forEach, Wdt = typeof WeakMap == "function" && WeakMap.prototype, oh = Wdt ? WeakMap.prototype.has : null, Zdt = typeof WeakSet == "function" && WeakSet.prototype, sh = Zdt ? WeakSet.prototype.has : null, qdt = typeof WeakRef == "function" && WeakRef.prototype, sV = qdt ? WeakRef.prototype.deref : null, Xdt = Boolean.prototype.valueOf, Kdt = Object.prototype.toString, Ydt = Function.prototype.toString, Jdt = String.prototype.match, TH = String.prototype.slice, K6 = String.prototype.replace, tpt = String.prototype.toUpperCase, aV = String.prototype.toLowerCase, _$ = RegExp.prototype.test, lV = Array.prototype.concat, Ja = Array.prototype.join, ept = Array.prototype.slice, cV = Math.floor, Dx = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, oL = Object.getOwnPropertySymbols, Fx = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, A8 = typeof Symbol == "function" && typeof Symbol.iterator == "object", Eo = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === A8 || !0) ? Symbol.toStringTag : null, b$ = Object.prototype.propertyIsEnumerable, uV = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
return t.__proto__;
} : null);
function hV(t, e) {
if (t === 1 / 0 || t === -1 / 0 || t !== t || t && t > -1e3 && t < 1e3 || _$.call(/e/, e))
return e;
var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof t == "number") {
var n = t < 0 ? -cV(-t) : cV(t);
if (n !== t) {
var i = String(n), o = TH.call(e, i.length + 1);
return K6.call(i, r, "$&_") + "." + K6.call(K6.call(o, /([0-9]{3})/g, "$&_"), /_$/, "");
}
}
return K6.call(e, r, "$&_");
}
var Bx = $dt, dV = Bx.custom, pV = w$(dV) ? dV : null, rpt = function t(e, r, n, i) {
var o = r || {};
if (U6(o, "quoteStyle") && o.quoteStyle !== "single" && o.quoteStyle !== "double")
throw new TypeError('option "quoteStyle" must be "single" or "double"');
if (U6(o, "maxStringLength") && (typeof o.maxStringLength == "number" ? o.maxStringLength < 0 && o.maxStringLength !== 1 / 0 : o.maxStringLength !== null))
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
var s = U6(o, "customInspect") ? o.customInspect : !0;
if (typeof s != "boolean" && s !== "symbol")
throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
if (U6(o, "indent") && o.indent !== null && o.indent !== " " && !(parseInt(o.indent, 10) === o.indent && o.indent > 0))
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
if (U6(o, "numericSeparator") && typeof o.numericSeparator != "boolean")
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
var a = o.numericSeparator;
if (typeof e > "u")
return "undefined";
if (e === null)
return "null";
if (typeof e == "boolean")
return e ? "true" : "false";
if (typeof e == "string")
return E$(e, o);
if (typeof e == "number") {
if (e === 0)
return 1 / 0 / e > 0 ? "0" : "-0";
var u = String(e);
return a ? hV(e, u) : u;
}
if (typeof e == "bigint") {
var d = String(e) + "n";
return a ? hV(e, d) : d;
}
var T = typeof o.depth > "u" ? 5 : o.depth;
if (typeof n > "u" && (n = 0), n >= T && T > 0 && typeof e == "object")
return jx(e) ? "[Array]" : "[Object]";
var f = vpt(o, n);
if (typeof i > "u")
i = [];
else if (x$(i, e) >= 0)
return "[Circular]";
function Q(It, Zt, oe) {
if (Zt && (i = ept.call(i), i.push(Zt)), oe) {
var re = {
depth: o.depth
};
return U6(o, "quoteStyle") && (re.quoteStyle = o.quoteStyle), t(It, re, n + 1, i);
}
return t(It, o, n + 1, i);
}
if (typeof e == "function" && !TV(e)) {
var y = hpt(e), _ = uT(e, Q);
return "[Function" + (y ? ": " + y : " (anonymous)") + "]" + (_.length > 0 ? " { " + Ja.call(_, ", ") + " }" : "");
}
if (w$(e)) {
var L = A8 ? K6.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Fx.call(e);
return typeof e == "object" && !A8 ? fu(L) : L;
}
if (mpt(e)) {
for (var E = "<" + aV.call(String(e.nodeName)), x = e.attributes || [], O = 0; O < x.length; O++)
E += " " + x[O].name + "=" + L$(npt(x[O].value), "double", o);
return E += ">", e.childNodes && e.childNodes.length && (E += "..."), E += "" + aV.call(String(e.nodeName)) + ">", E;
}
if (jx(e)) {
if (e.length === 0)
return "[]";
var k = uT(e, Q);
return f && !ypt(k) ? "[" + zx(k, f) + "]" : "[ " + Ja.call(k, ", ") + " ]";
}
if (opt(e)) {
var R = uT(e, Q);
return !("cause" in Error.prototype) && "cause" in e && !b$.call(e, "cause") ? "{ [" + String(e) + "] " + Ja.call(lV.call("[cause]: " + Q(e.cause), R), ", ") + " }" : R.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + Ja.call(R, ", ") + " }";
}
if (typeof e == "object" && s) {
if (pV && typeof e[pV] == "function" && Bx)
return Bx(e, { depth: T - n });
if (s !== "symbol" && typeof e.inspect == "function")
return e.inspect();
}
if (dpt(e)) {
var F = [];
return iV && iV.call(e, function(It, Zt) {
F.push(Q(Zt, e, !0) + " => " + Q(It, e));
}), fV("Map", WQ.call(e), F, f);
}
if (fpt(e)) {
var U = [];
return oV && oV.call(e, function(It) {
U.push(Q(It, e));
}), fV("Set", ZQ.call(e), U, f);
}
if (ppt(e))
return sL("WeakMap");
if (Qpt(e))
return sL("WeakSet");
if (Tpt(e))
return sL("WeakRef");
if (apt(e))
return fu(Q(Number(e)));
if (cpt(e))
return fu(Q(Dx.call(e)));
if (lpt(e))
return fu(Xdt.call(e));
if (spt(e))
return fu(Q(String(e)));
if (typeof window < "u" && e === window)
return "{ [object Window] }";
if (e === P)
return "{ [object globalThis] }";
if (!ipt(e) && !TV(e)) {
var $ = uT(e, Q), et = uV ? uV(e) === Object.prototype : e instanceof Object || e.constructor === Object, nt = e instanceof Object ? "" : "null prototype", ct = !et && Eo && Object(e) === e && Eo in e ? TH.call(Q0(e), 8, -1) : nt ? "Object" : "", rt = et || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", gt = rt + (ct || nt ? "[" + Ja.call(lV.call([], ct || [], nt || []), ": ") + "] " : "");
return $.length === 0 ? gt + "{}" : f ? gt + "{" + zx($, f) + "}" : gt + "{ " + Ja.call($, ", ") + " }";
}
return String(e);
};
function L$(t, e, r) {
var n = (r.quoteStyle || e) === "double" ? '"' : "'";
return n + t + n;
}
function npt(t) {
return K6.call(String(t), /"/g, """);
}
function jx(t) {
return Q0(t) === "[object Array]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function ipt(t) {
return Q0(t) === "[object Date]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function TV(t) {
return Q0(t) === "[object RegExp]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function opt(t) {
return Q0(t) === "[object Error]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function spt(t) {
return Q0(t) === "[object String]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function apt(t) {
return Q0(t) === "[object Number]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function lpt(t) {
return Q0(t) === "[object Boolean]" && (!Eo || !(typeof t == "object" && Eo in t));
}
function w$(t) {
if (A8)
return t && typeof t == "object" && t instanceof Symbol;
if (typeof t == "symbol")
return !0;
if (!t || typeof t != "object" || !Fx)
return !1;
try {
return Fx.call(t), !0;
} catch {
}
return !1;
}
function cpt(t) {
if (!t || typeof t != "object" || !Dx)
return !1;
try {
return Dx.call(t), !0;
} catch {
}
return !1;
}
var upt = Object.prototype.hasOwnProperty || function(t) {
return t in this;
};
function U6(t, e) {
return upt.call(t, e);
}
function Q0(t) {
return Kdt.call(t);
}
function hpt(t) {
if (t.name)
return t.name;
var e = Jdt.call(Ydt.call(t), /^function\s*([\w$]+)/);
return e ? e[1] : null;
}
function x$(t, e) {
if (t.indexOf)
return t.indexOf(e);
for (var r = 0, n = t.length; r < n; r++)
if (t[r] === e)
return r;
return -1;
}
function dpt(t) {
if (!WQ || !t || typeof t != "object")
return !1;
try {
WQ.call(t);
try {
ZQ.call(t);
} catch {
return !0;
}
return t instanceof Map;
} catch {
}
return !1;
}
function ppt(t) {
if (!oh || !t || typeof t != "object")
return !1;
try {
oh.call(t, oh);
try {
sh.call(t, sh);
} catch {
return !0;
}
return t instanceof WeakMap;
} catch {
}
return !1;
}
function Tpt(t) {
if (!sV || !t || typeof t != "object")
return !1;
try {
return sV.call(t), !0;
} catch {
}
return !1;
}
function fpt(t) {
if (!ZQ || !t || typeof t != "object")
return !1;
try {
ZQ.call(t);
try {
WQ.call(t);
} catch {
return !0;
}
return t instanceof Set;
} catch {
}
return !1;
}
function Qpt(t) {
if (!sh || !t || typeof t != "object")
return !1;
try {
sh.call(t, sh);
try {
oh.call(t, oh);
} catch {
return !0;
}
return t instanceof WeakSet;
} catch {
}
return !1;
}
function mpt(t) {
return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
}
function E$(t, e) {
if (t.length > e.maxStringLength) {
var r = t.length - e.maxStringLength, n = "... " + r + " more character" + (r > 1 ? "s" : "");
return E$(TH.call(t, 0, e.maxStringLength), e) + n;
}
var i = K6.call(K6.call(t, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, gpt);
return L$(i, "single", e);
}
function gpt(t) {
var e = t.charCodeAt(0), r = {
8: "b",
9: "t",
10: "n",
12: "f",
13: "r"
}[e];
return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + tpt.call(e.toString(16));
}
function fu(t) {
return "Object(" + t + ")";
}
function sL(t) {
return t + " { ? }";
}
function fV(t, e, r, n) {
var i = n ? zx(r, n) : Ja.call(r, ", ");
return t + " (" + e + ") {" + i + "}";
}
function ypt(t) {
for (var e = 0; e < t.length; e++)
if (x$(t[e], `
`) >= 0)
return !1;
return !0;
}
function vpt(t, e) {
var r;
if (t.indent === " ")
r = " ";
else if (typeof t.indent == "number" && t.indent > 0)
r = Ja.call(Array(t.indent + 1), " ");
else
return null;
return {
base: r,
prev: Ja.call(Array(e + 1), r)
};
}
function zx(t, e) {
if (t.length === 0)
return "";
var r = `
` + e.prev + e.base;
return r + Ja.call(t, "," + r) + `
` + e.prev;
}
function uT(t, e) {
var r = jx(t), n = [];
if (r) {
n.length = t.length;
for (var i = 0; i < t.length; i++)
n[i] = U6(t, i) ? e(t[i], t) : "";
}
var o = typeof oL == "function" ? oL(t) : [], s;
if (A8) {
s = {};
for (var a = 0; a < o.length; a++)
s["$" + o[a]] = o[a];
}
for (var u in t)
U6(t, u) && (r && String(Number(u)) === u && u < t.length || A8 && s["$" + u] instanceof Symbol || (_$.call(/[^\w$]/, u) ? n.push(e(u, t) + ": " + e(t[u], t)) : n.push(u + ": " + e(t[u], t))));
if (typeof oL == "function")
for (var d = 0; d < o.length; d++)
b$.call(t, o[d]) && n.push("[" + e(o[d]) + "]: " + e(t[o[d]], t));
return n;
}
var M$ = x3, sc = Fs, _pt = rpt, bpt = f0, hT = M$("%WeakMap%", !0), dT = M$("%Map%", !0), Lpt = sc("WeakMap.prototype.get", !0), wpt = sc("WeakMap.prototype.set", !0), xpt = sc("WeakMap.prototype.has", !0), Ept = sc("Map.prototype.get", !0), Mpt = sc("Map.prototype.set", !0), Spt = sc("Map.prototype.has", !0), fH = function(t, e) {
for (var r = t, n; (n = r.next) !== null; r = n)
if (n.key === e)
return r.next = n.next, n.next = /** @type {NonNullable} */
t.next, t.next = n, n;
}, Hpt = function(t, e) {
var r = fH(t, e);
return r && r.value;
}, Apt = function(t, e, r) {
var n = fH(t, e);
n ? n.value = r : t.next = /** @type {import('.').ListNode} */
{
// eslint-disable-line no-param-reassign, no-extra-parens
key: e,
next: t.next,
value: r
};
}, Opt = function(t, e) {
return !!fH(t, e);
}, S$ = function() {
var t, e, r, n = {
assert: function(i) {
if (!n.has(i))
throw new bpt("Side channel does not contain " + _pt(i));
},
get: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return Lpt(t, i);
} else if (dT) {
if (e)
return Ept(e, i);
} else if (r)
return Hpt(r, i);
},
has: function(i) {
if (hT && i && (typeof i == "object" || typeof i == "function")) {
if (t)
return xpt(t, i);
} else if (dT) {
if (e)
return Spt(e, i);
} else if (r)
return Opt(r, i);
return !1;
},
set: function(i, o) {
hT && i && (typeof i == "object" || typeof i == "function") ? (t || (t = new hT()), wpt(t, i, o)) : dT ? (e || (e = new dT()), Mpt(e, i, o)) : (r || (r = { key: {}, next: null }), Apt(r, i, o));
}
};
return n;
}, Cpt = e$, Qu = S$(), W3 = f0, QH = {
assert: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
if (Qu.assert(t), !QH.has(t, e))
throw new W3("`" + e + "` is not present on `O`");
},
get: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = Qu.get(t);
return r && r["$" + e];
},
has: function(t, e) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var r = Qu.get(t);
return !!r && Cpt(r, "$" + e);
},
set: function(t, e, r) {
if (!t || typeof t != "object" && typeof t != "function")
throw new W3("`O` is not an object");
if (typeof e != "string")
throw new W3("`slot` must be a string");
var n = Qu.get(t);
n || (n = {}, Qu.set(t, n)), n["$" + e] = r;
}
};
Object.freeze && Object.freeze(QH);
var kpt = QH, mu = kpt, Ipt = SyntaxError, QV = typeof StopIteration == "object" ? StopIteration : null, Ppt = function(t) {
if (!QV)
throw new Ipt("this environment lacks StopIteration");
mu.set(t, "[[Done]]", !1);
var e = {
next: function() {
var r = mu.get(this, "[[Iterator]]"), n = mu.get(r, "[[Done]]");
try {
return {
done: n,
value: n ? void 0 : r.next()
};
} catch (i) {
if (mu.set(r, "[[Done]]", !0), i !== QV)
throw i;
return {
done: !0,
value: void 0
};
}
}
};
return mu.set(e, "[[Iterator]]", t), e;
}, Vpt = {}.toString, H$ = Array.isArray || function(t) {
return Vpt.call(t) == "[object Array]";
}, Rpt = String.prototype.valueOf, Npt = function(t) {
try {
return Rpt.call(t), !0;
} catch {
return !1;
}
}, Dpt = Object.prototype.toString, Fpt = "[object String]", Bpt = dl(), A$ = function(t) {
return typeof t == "string" ? !0 : typeof t != "object" ? !1 : Bpt ? Npt(t) : Dpt.call(t) === Fpt;
}, mH = typeof Map == "function" && Map.prototype ? Map : null, jpt = typeof Set == "function" && Set.prototype ? Set : null, qQ;
mH || (qQ = function(t) {
return !1;
});
var O$ = mH ? Map.prototype.has : null, mV = jpt ? Set.prototype.has : null;
!qQ && !O$ && (qQ = function(t) {
return !1;
});
var C$ = qQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (O$.call(t), mV)
try {
mV.call(t);
} catch {
return !0;
}
return t instanceof mH;
} catch {
}
return !1;
}, zpt = typeof Map == "function" && Map.prototype ? Map : null, gH = typeof Set == "function" && Set.prototype ? Set : null, XQ;
gH || (XQ = function(t) {
return !1;
});
var gV = zpt ? Map.prototype.has : null, k$ = gH ? Set.prototype.has : null;
!XQ && !k$ && (XQ = function(t) {
return !1;
});
var I$ = XQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (k$.call(t), gV)
try {
gV.call(t);
} catch {
return !0;
}
return t instanceof gH;
} catch {
}
return !1;
}, yV = v$, vV = Ppt;
if (sH() || Dg()) {
var aL = Symbol.iterator;
Ef.exports = function(t) {
if (t != null && typeof t[aL] < "u")
return t[aL]();
if (yV(t))
return Array.prototype[aL].call(t);
};
} else {
var Upt = H$, Gpt = A$, _V = x3, $pt = _V("%Map%", !0), Wpt = _V("%Set%", !0), Xs = Fs, bV = Xs("Array.prototype.push"), LV = Xs("String.prototype.charCodeAt"), Zpt = Xs("String.prototype.slice"), qpt = function(t, e) {
var r = t.length;
if (e + 1 >= r)
return e + 1;
var n = LV(t, e);
if (n < 55296 || n > 56319)
return e + 1;
var i = LV(t, e + 1);
return i < 56320 || i > 57343 ? e + 1 : e + 2;
}, lL = function(t) {
var e = 0;
return {
next: function() {
var r = e >= t.length, n;
return r || (n = t[e], e += 1), {
done: r,
value: n
};
}
};
}, wV = function(t, e) {
if (Upt(t) || yV(t))
return lL(t);
if (Gpt(t)) {
var r = 0;
return {
next: function() {
var n = qpt(t, r), i = Zpt(t, r, n);
return r = n, {
done: n > t.length,
value: i
};
}
};
}
if (e && typeof t["_es6-shim iterator_"] < "u")
return t["_es6-shim iterator_"]();
};
if (!$pt && !Wpt)
Ef.exports = function(t) {
if (t != null)
return wV(t, !0);
};
else {
var Xpt = C$, Kpt = I$, xV = Xs("Map.prototype.forEach", !0), EV = Xs("Set.prototype.forEach", !0);
if (typeof process > "u" || !process.versions || !process.versions.node)
var MV = Xs("Map.prototype.iterator", !0), SV = Xs("Set.prototype.iterator", !0);
var HV = Xs("Map.prototype.@@iterator", !0) || Xs("Map.prototype._es6-shim iterator_", !0), AV = Xs("Set.prototype.@@iterator", !0) || Xs("Set.prototype._es6-shim iterator_", !0), Ypt = function(t) {
if (Xpt(t)) {
if (MV)
return vV(MV(t));
if (HV)
return HV(t);
if (xV) {
var e = [];
return xV(t, function(n, i) {
bV(e, [i, n]);
}), lL(e);
}
}
if (Kpt(t)) {
if (SV)
return vV(SV(t));
if (AV)
return AV(t);
if (EV) {
var r = [];
return EV(t, function(n) {
bV(r, n);
}), lL(r);
}
}
};
Ef.exports = function(t) {
return Ypt(t) || wV(t);
};
}
}
var Jpt = Ef.exports, OV = function(t) {
return t !== t;
}, P$ = function(t, e) {
return t === 0 && e === 0 ? 1 / t === 1 / e : !!(t === e || OV(t) && OV(e));
}, tTt = P$, V$ = function() {
return typeof Object.is == "function" ? Object.is : tTt;
}, eTt = V$, rTt = hl, nTt = function() {
var t = eTt();
return rTt(Object, { is: t }, {
is: function() {
return Object.is !== t;
}
}), t;
}, iTt = hl, oTt = oc, sTt = P$, R$ = V$, aTt = nTt, N$ = oTt(R$(), Object);
iTt(N$, {
getPolyfill: R$,
implementation: sTt,
shim: aTt
});
var lTt = N$, cTt = oc, D$ = Fs, uTt = x3, Ux = uTt("%ArrayBuffer%", !0), Mf = D$("ArrayBuffer.prototype.byteLength", !0), hTt = D$("Object.prototype.toString"), CV = !!Ux && !Mf && new Ux(0).slice, kV = !!CV && cTt(CV), F$ = Mf || kV ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return Mf ? Mf(t) : kV(t, 0), !0;
} catch {
return !1;
}
} : Ux ? function(t) {
return hTt(t) === "[object ArrayBuffer]";
} : function(t) {
return !1;
}, dTt = Date.prototype.getDay, pTt = function(t) {
try {
return dTt.call(t), !0;
} catch {
return !1;
}
}, TTt = Object.prototype.toString, fTt = "[object Date]", QTt = dl(), mTt = function(t) {
return typeof t != "object" || t === null ? !1 : QTt ? pTt(t) : TTt.call(t) === fTt;
}, Gx = Fs, B$ = dl(), j$, z$, $x, Wx;
if (B$) {
j$ = Gx("Object.prototype.hasOwnProperty"), z$ = Gx("RegExp.prototype.exec"), $x = {};
var cL = function() {
throw $x;
};
Wx = {
toString: cL,
valueOf: cL
}, typeof Symbol.toPrimitive == "symbol" && (Wx[Symbol.toPrimitive] = cL);
}
var gTt = Gx("Object.prototype.toString"), yTt = Object.getOwnPropertyDescriptor, vTt = "[object RegExp]", _Tt = B$ ? function(t) {
if (!t || typeof t != "object")
return !1;
var e = yTt(t, "lastIndex"), r = e && j$(e, "value");
if (!r)
return !1;
try {
z$(t, Wx);
} catch (n) {
return n === $x;
}
} : function(t) {
return !t || typeof t != "object" && typeof t != "function" ? !1 : gTt(t) === vTt;
}, bTt = Fs, IV = bTt("SharedArrayBuffer.prototype.byteLength", !0), LTt = IV ? function(t) {
if (!t || typeof t != "object")
return !1;
try {
return IV(t), !0;
} catch {
return !1;
}
} : function(t) {
return !1;
}, wTt = Number.prototype.toString, xTt = function(t) {
try {
return wTt.call(t), !0;
} catch {
return !1;
}
}, ETt = Object.prototype.toString, MTt = "[object Number]", STt = dl(), HTt = function(t) {
return typeof t == "number" ? !0 : typeof t != "object" ? !1 : STt ? xTt(t) : ETt.call(t) === MTt;
}, U$ = Fs, ATt = U$("Boolean.prototype.toString"), OTt = U$("Object.prototype.toString"), CTt = function(t) {
try {
return ATt(t), !0;
} catch {
return !1;
}
}, kTt = "[object Boolean]", ITt = dl(), PTt = function(t) {
return typeof t == "boolean" ? !0 : t === null || typeof t != "object" ? !1 : ITt && Symbol.toStringTag in t ? CTt(t) : OTt(t) === kTt;
}, Zx = { exports: {} }, VTt = Object.prototype.toString, RTt = sH();
if (RTt) {
var NTt = Symbol.prototype.toString, DTt = /^Symbol\(.*\)$/, FTt = function(t) {
return typeof t.valueOf() != "symbol" ? !1 : DTt.test(NTt.call(t));
};
Zx.exports = function(t) {
if (typeof t == "symbol")
return !0;
if (VTt.call(t) !== "[object Symbol]")
return !1;
try {
return FTt(t);
} catch {
return !1;
}
};
} else
Zx.exports = function(t) {
return !1;
};
var BTt = Zx.exports, qx = { exports: {} }, PV = typeof BigInt < "u" && BigInt, jTt = function() {
return typeof PV == "function" && typeof BigInt == "function" && typeof PV(42) == "bigint" && typeof BigInt(42) == "bigint";
}, zTt = jTt();
if (zTt) {
var UTt = BigInt.prototype.valueOf, GTt = function(t) {
try {
return UTt.call(t), !0;
} catch {
}
return !1;
};
qx.exports = function(t) {
return t === null || typeof t > "u" || typeof t == "boolean" || typeof t == "string" || typeof t == "number" || typeof t == "symbol" || typeof t == "function" ? !1 : typeof t == "bigint" ? !0 : GTt(t);
};
} else
qx.exports = function(t) {
return !1;
};
var $Tt = qx.exports, WTt = A$, ZTt = HTt, qTt = PTt, XTt = BTt, KTt = $Tt, YTt = function(t) {
if (t == null || typeof t != "object" && typeof t != "function")
return null;
if (WTt(t))
return "String";
if (ZTt(t))
return "Number";
if (qTt(t))
return "Boolean";
if (XTt(t))
return "Symbol";
if (KTt(t))
return "BigInt";
}, KQ = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap : null, VV = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet : null, YQ;
KQ || (YQ = function(t) {
return !1;
});
var Xx = KQ ? KQ.prototype.has : null, uL = VV ? VV.prototype.has : null;
!YQ && !Xx && (YQ = function(t) {
return !1;
});
var JTt = YQ || function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (Xx.call(t, Xx), uL)
try {
uL.call(t, uL);
} catch {
return !0;
}
return t instanceof KQ;
} catch {
}
return !1;
}, Kx = { exports: {} }, tft = x3, G$ = Fs, eft = tft("%WeakSet%", !0), hL = G$("WeakSet.prototype.has", !0);
if (hL) {
var dL = G$("WeakMap.prototype.has", !0);
Kx.exports = function(t) {
if (!t || typeof t != "object")
return !1;
try {
if (hL(t, hL), dL)
try {
dL(t, dL);
} catch {
return !0;
}
return t instanceof eft;
} catch {
}
return !1;
};
} else
Kx.exports = function(t) {
return !1;
};
var rft = Kx.exports, nft = C$, ift = I$, oft = JTt, sft = rft, aft = function(t) {
if (t && typeof t == "object") {
if (nft(t))
return "Map";
if (ift(t))
return "Set";
if (oft(t))
return "WeakMap";
if (sft(t))
return "WeakSet";
}
return !1;
}, $$ = Function.prototype.toString, Y7 = typeof Reflect == "object" && Reflect !== null && Reflect.apply, Yx, Sf;
if (typeof Y7 == "function" && typeof Object.defineProperty == "function")
try {
Yx = Object.defineProperty({}, "length", {
get: function() {
throw Sf;
}
}), Sf = {}, Y7(function() {
throw 42;
}, null, Yx);
} catch (t) {
t !== Sf && (Y7 = null);
}
else
Y7 = null;
var lft = /^\s*class\b/, Jx = function(t) {
try {
var e = $$.call(t);
return lft.test(e);
} catch {
return !1;
}
}, pL = function(t) {
try {
return Jx(t) ? !1 : ($$.call(t), !0);
} catch {
return !1;
}
}, Hf = Object.prototype.toString, cft = "[object Object]", uft = "[object Function]", hft = "[object GeneratorFunction]", dft = "[object HTMLAllCollection]", pft = "[object HTML document.all class]", Tft = "[object HTMLCollection]", fft = typeof Symbol == "function" && !!Symbol.toStringTag, Qft = !(0 in [,]), tE = function() {
return !1;
};
if (typeof document == "object") {
var mft = document.all;
Hf.call(mft) === Hf.call(document.all) && (tE = function(t) {
if ((Qft || !t) && (typeof t > "u" || typeof t == "object"))
try {
var e = Hf.call(t);
return (e === dft || e === pft || e === Tft || e === cft) && t("") == null;
} catch {
}
return !1;
});
}
var gft = Y7 ? function(t) {
if (tE(t))
return !0;
if (!t || typeof t != "function" && typeof t != "object")
return !1;
try {
Y7(t, null, Yx);
} catch (e) {
if (e !== Sf)
return !1;
}
return !Jx(t) && pL(t);
} : function(t) {
if (tE(t))
return !0;
if (!t || typeof t != "function" && typeof t != "object")
return !1;
if (fft)
return pL(t);
if (Jx(t))
return !1;
var e = Hf.call(t);
return e !== uft && e !== hft && !/^\[object HTML/.test(e) ? !1 : pL(t);
}, yft = gft, vft = Object.prototype.toString, W$ = Object.prototype.hasOwnProperty, _ft = function(t, e, r) {
for (var n = 0, i = t.length; n < i; n++)
W$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, bft = function(t, e, r) {
for (var n = 0, i = t.length; n < i; n++)
r == null ? e(t.charAt(n), n, t) : e.call(r, t.charAt(n), n, t);
}, Lft = function(t, e, r) {
for (var n in t)
W$.call(t, n) && (r == null ? e(t[n], n, t) : e.call(r, t[n], n, t));
}, wft = function(t, e, r) {
if (!yft(e))
throw new TypeError("iterator must be a function");
var n;
arguments.length >= 3 && (n = r), vft.call(t) === "[object Array]" ? _ft(t, e, n) : typeof t == "string" ? bft(t, e, n) : Lft(t, e, n);
}, xft = wft, Eft = [
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
], TL = Eft, Mft = typeof globalThis > "u" ? P : globalThis, Sft = function() {
for (var t = [], e = 0; e < TL.length; e++)
typeof Mft[TL[e]] == "function" && (t[t.length] = TL[e]);
return t;
}, JQ = xft, Hft = Sft, RV = oc, yH = Fs, Af = cH, Aft = yH("Object.prototype.toString"), Z$ = dl(), NV = typeof globalThis > "u" ? P : globalThis, eE = Hft(), vH = yH("String.prototype.slice"), fL = Object.getPrototypeOf, Oft = yH("Array.prototype.indexOf", !0) || function(t, e) {
for (var r = 0; r < t.length; r += 1)
if (t[r] === e)
return r;
return -1;
}, tm = { __proto__: null };
Z$ && Af && fL ? JQ(eE, function(t) {
var e = new NV[t]();
if (Symbol.toStringTag in e) {
var r = fL(e), n = Af(r, Symbol.toStringTag);
if (!n) {
var i = fL(r);
n = Af(i, Symbol.toStringTag);
}
tm["$" + t] = RV(n.get);
}
}) : JQ(eE, function(t) {
var e = new NV[t](), r = e.slice || e.set;
r && (tm["$" + t] = RV(r));
});
var Cft = function(t) {
var e = !1;
return JQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
tm,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
"$" + r(t) === n && (e = vH(n, 1));
} catch {
}
}
), e;
}, kft = function(t) {
var e = !1;
return JQ(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
tm,
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
function(r, n) {
if (!e)
try {
r(t), e = vH(n, 1);
} catch {
}
}
), e;
}, Ift = function(t) {
if (!t || typeof t != "object")
return !1;
if (!Z$) {
var e = vH(Aft(t), 8, -1);
return Oft(eE, e) > -1 ? e : e !== "Object" ? !1 : kft(t);
}
return Af ? Cft(t) : null;
}, Pft = Fs, DV = Pft("ArrayBuffer.prototype.byteLength", !0), Vft = F$, Rft = function(t) {
return Vft(t) ? DV ? DV(t) : t.byteLength : NaN;
}, q$ = fdt, E3 = Fs, FV = Ddt, Nft = x3, O8 = Jpt, Dft = S$, BV = lTt, jV = v$, zV = H$, UV = F$, GV = mTt, $V = _Tt, WV = LTt, ZV = oH, qV = YTt, XV = aft, KV = Ift, YV = Rft, JV = E3("SharedArrayBuffer.prototype.byteLength", !0), tR = E3("Date.prototype.getTime"), QL = Object.getPrototypeOf, eR = E3("Object.prototype.toString"), em = Nft("%Set%", !0), rE = E3("Map.prototype.has", !0), rm = E3("Map.prototype.get", !0), rR = E3("Map.prototype.size", !0), nm = E3("Set.prototype.add", !0), X$ = E3("Set.prototype.delete", !0), im = E3("Set.prototype.has", !0), Of = E3("Set.prototype.size", !0);
function nR(t, e, r, n) {
for (var i = O8(t), o; (o = i.next()) && !o.done; )
if (oa(e, o.value, r, n))
return X$(t, o.value), !0;
return !1;
}
function K$(t) {
if (typeof t > "u")
return null;
if (typeof t != "object")
return typeof t == "symbol" ? !1 : typeof t == "string" || typeof t == "number" ? +t == +t : !0;
}
function Fft(t, e, r, n, i, o) {
var s = K$(r);
if (s != null)
return s;
var a = rm(e, s), u = q$({}, i, { strict: !1 });
return typeof a > "u" && !rE(e, s) || !oa(n, a, u, o) ? !1 : !rE(t, s) && oa(n, a, u, o);
}
function Bft(t, e, r) {
var n = K$(r);
return n ?? (im(e, n) && !im(t, n));
}
function iR(t, e, r, n, i, o) {
for (var s = O8(t), a, u; (a = s.next()) && !a.done; )
if (u = a.value, // eslint-disable-next-line no-use-before-define
oa(r, u, i, o) && oa(n, rm(e, u), i, o))
return X$(t, u), !0;
return !1;
}
function oa(t, e, r, n) {
var i = r || {};
if (i.strict ? BV(t, e) : t === e)
return !0;
var o = qV(t), s = qV(e);
if (o !== s)
return !1;
if (!t || !e || typeof t != "object" && typeof e != "object")
return i.strict ? BV(t, e) : t == e;
var a = n.has(t), u = n.has(e), d;
if (a && u) {
if (n.get(t) === n.get(e))
return !0;
} else
d = {};
return a || n.set(t, d), u || n.set(e, d), Uft(t, e, i, n);
}
function oR(t) {
return !t || typeof t != "object" || typeof t.length != "number" || typeof t.copy != "function" || typeof t.slice != "function" || t.length > 0 && typeof t[0] != "number" ? !1 : !!(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t));
}
function jft(t, e, r, n) {
if (Of(t) !== Of(e))
return !1;
for (var i = O8(t), o = O8(e), s, a, u; (s = i.next()) && !s.done; )
if (s.value && typeof s.value == "object")
u || (u = new em()), nm(u, s.value);
else if (!im(e, s.value)) {
if (r.strict || !Bft(t, e, s.value))
return !1;
u || (u = new em()), nm(u, s.value);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (a.value && typeof a.value == "object") {
if (!nR(u, a.value, r.strict, n))
return !1;
} else if (!r.strict && !im(t, a.value) && !nR(u, a.value, r.strict, n))
return !1;
return Of(u) === 0;
}
return !0;
}
function zft(t, e, r, n) {
if (rR(t) !== rR(e))
return !1;
for (var i = O8(t), o = O8(e), s, a, u, d, T, f; (s = i.next()) && !s.done; )
if (d = s.value[0], T = s.value[1], d && typeof d == "object")
u || (u = new em()), nm(u, d);
else if (f = rm(e, d), typeof f > "u" && !rE(e, d) || !oa(T, f, r, n)) {
if (r.strict || !Fft(t, e, d, T, r, n))
return !1;
u || (u = new em()), nm(u, d);
}
if (u) {
for (; (a = o.next()) && !a.done; )
if (d = a.value[0], f = a.value[1], d && typeof d == "object") {
if (!iR(u, t, d, f, r, n))
return !1;
} else if (!r.strict && (!t.has(d) || !oa(rm(t, d), f, r, n)) && !iR(u, t, d, f, q$({}, r, { strict: !1 }), n))
return !1;
return Of(u) === 0;
}
return !0;
}
function Uft(t, e, r, n) {
var i, o;
if (typeof t != typeof e || t == null || e == null || eR(t) !== eR(e) || jV(t) !== jV(e))
return !1;
var s = zV(t), a = zV(e);
if (s !== a)
return !1;
var u = t instanceof Error, d = e instanceof Error;
if (u !== d || (u || d) && (t.name !== e.name || t.message !== e.message))
return !1;
var T = $V(t), f = $V(e);
if (T !== f || (T || f) && (t.source !== e.source || FV(t) !== FV(e)))
return !1;
var Q = GV(t), y = GV(e);
if (Q !== y || (Q || y) && tR(t) !== tR(e) || r.strict && QL && QL(t) !== QL(e))
return !1;
var _ = KV(t), L = KV(e);
if (_ !== L)
return !1;
if (_ || L) {
if (t.length !== e.length)
return !1;
for (i = 0; i < t.length; i++)
if (t[i] !== e[i])
return !1;
return !0;
}
var E = oR(t), x = oR(e);
if (E !== x)
return !1;
if (E || x) {
if (t.length !== e.length)
return !1;
for (i = 0; i < t.length; i++)
if (t[i] !== e[i])
return !1;
return !0;
}
var O = UV(t), k = UV(e);
if (O !== k)
return !1;
if (O || k)
return YV(t) !== YV(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
var R = WV(t), F = WV(e);
if (R !== F)
return !1;
if (R || F)
return JV(t) !== JV(e) ? !1 : typeof Uint8Array == "function" && oa(new Uint8Array(t), new Uint8Array(e), r, n);
if (typeof t != typeof e)
return !1;
var U = ZV(t), $ = ZV(e);
if (U.length !== $.length)
return !1;
for (U.sort(), $.sort(), i = U.length - 1; i >= 0; i--)
if (U[i] != $[i])
return !1;
for (i = U.length - 1; i >= 0; i--)
if (o = U[i], !oa(t[o], e[o], r, n))
return !1;
var et = XV(t), nt = XV(e);
return et !== nt ? !1 : et === "Set" || nt === "Set" ? jft(t, e, r, n) : et === "Map" ? zft(t, e, r, n) : !0;
}
var Gft = function(t, e, r) {
return oa(t, e, r, Dft());
};
const _H = /* @__PURE__ */ p0(Gft);
var $ft = Object.defineProperty, $n = (t, e) => $ft(t, "name", { value: e, configurable: !0 }), Wft = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !c9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = nE(t), n = nE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!c9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return c9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? _H(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return c9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
$n(Wft, "GeojsonEquality");
function c9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
$n(c9, "sameLength");
function nE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
$n(nE, "explode");
var D2 = 63710088e-1, Y$ = {
centimeters: D2 * 100,
centimetres: D2 * 100,
degrees: 360 / (2 * Math.PI),
feet: D2 * 3.28084,
inches: D2 * 39.37,
kilometers: D2 / 1e3,
kilometres: D2 / 1e3,
meters: D2,
metres: D2,
miles: D2 / 1609.344,
millimeters: D2 * 1e3,
millimetres: D2 * 1e3,
nauticalmiles: D2 / 1852,
radians: 1,
yards: D2 * 1.0936
}, sR = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function T3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
$n(T3, "feature");
function Zft(t, e, r = {}) {
switch (t) {
case "Point":
return c4(e).geometry;
case "LineString":
return Q4(e).geometry;
case "Polygon":
return bH(e).geometry;
case "MultiPoint":
return tW(e).geometry;
case "MultiLineString":
return J$(e).geometry;
case "MultiPolygon":
return eW(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
$n(Zft, "geometry");
function c4(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!om(t[0]) || !om(t[1]))
throw new Error("coordinates must contain numbers");
return T3({
type: "Point",
coordinates: t
}, e, r);
}
$n(c4, "point");
function qft(t, e, r = {}) {
return Bg(
t.map((n) => c4(n, e)),
r
);
}
$n(qft, "points");
function bH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return T3({
type: "Polygon",
coordinates: t
}, e, r);
}
$n(bH, "polygon");
function Xft(t, e, r = {}) {
return Bg(
t.map((n) => bH(n, e)),
r
);
}
$n(Xft, "polygons");
function Q4(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return T3({
type: "LineString",
coordinates: t
}, e, r);
}
$n(Q4, "lineString");
function Kft(t, e, r = {}) {
return Bg(
t.map((n) => Q4(n, e)),
r
);
}
$n(Kft, "lineStrings");
function Bg(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
$n(Bg, "featureCollection");
function J$(t, e, r = {}) {
return T3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
$n(J$, "multiLineString");
function tW(t, e, r = {}) {
return T3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
$n(tW, "multiPoint");
function eW(t, e, r = {}) {
return T3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
$n(eW, "multiPolygon");
function Yft(t, e, r = {}) {
return T3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
$n(Yft, "geometryCollection");
function Jft(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
$n(Jft, "round");
function rW(t, e = "kilometers") {
const r = Y$[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
$n(rW, "radiansToLength");
function LH(t, e = "kilometers") {
const r = Y$[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
$n(LH, "lengthToRadians");
function tQt(t, e) {
return nW(LH(t, e));
}
$n(tQt, "lengthToDegrees");
function eQt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
$n(eQt, "bearingToAzimuth");
function nW(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
$n(nW, "radiansToDegrees");
function rQt(t) {
return t % 360 * Math.PI / 180;
}
$n(rQt, "degreesToRadians");
function nQt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return rW(LH(t, e), r);
}
$n(nQt, "convertLength");
function iQt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = sR[e];
if (!n)
throw new Error("invalid original units");
const i = sR[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
$n(iQt, "convertArea");
function om(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
$n(om, "isNumber");
function wH(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
$n(wH, "isObject");
function oQt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!om(e))
throw new Error("bbox must only contain numbers");
});
}
$n(oQt, "validateBBox");
function sQt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
$n(sQt, "validateId");
var aQt = Object.defineProperty, so = (t, e) => aQt(t, "name", { value: e, configurable: !0 });
function xd(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = r && (F === "Polygon" || F === "MultiPolygon") ? 1 : 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (xd(s.geometries[n], e, r) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
so(xd, "coordEach");
function lQt(t, e, r, n) {
var i = r;
return xd(
t,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
so(lQt, "coordReduce");
function iW(t, e) {
var r;
switch (t.type) {
case "FeatureCollection":
for (r = 0; r < t.features.length && e(t.features[r].properties, r) !== !1; r++)
;
break;
case "Feature":
e(t.properties, 0);
break;
}
}
so(iW, "propEach");
function cQt(t, e, r) {
var n = r;
return iW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(cQt, "propReduce");
function oW(t, e) {
if (t.type === "Feature")
e(t, 0);
else if (t.type === "FeatureCollection")
for (var r = 0; r < t.features.length && e(t.features[r], r) !== !1; r++)
;
}
so(oW, "featureEach");
function uQt(t, e, r) {
var n = r;
return oW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
so(uQt, "featureReduce");
function hQt(t) {
var e = [];
return xd(t, function(r) {
e.push(r);
}), e;
}
so(hQt, "coordAll");
function xH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
so(xH, "geomEach");
function dQt(t, e, r) {
var n = r;
return xH(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
so(dQt, "geomReduce");
function jg(t, e) {
xH(t, function(r, n, i, o, s) {
var a = r === null ? null : r.type;
switch (a) {
case null:
case "Point":
case "LineString":
case "Polygon":
return e(
T3(r, i, { bbox: o, id: s }),
n,
0
) === !1 ? !1 : void 0;
}
var u;
switch (a) {
case "MultiPoint":
u = "Point";
break;
case "MultiLineString":
u = "LineString";
break;
case "MultiPolygon":
u = "Polygon";
break;
}
for (var d = 0; d < r.coordinates.length; d++) {
var T = r.coordinates[d], f = {
type: u,
coordinates: T
};
if (e(T3(f, i), n, d) === !1)
return !1;
}
});
}
so(jg, "flattenEach");
function pQt(t, e, r) {
var n = r;
return jg(
t,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
so(pQt, "flattenReduce");
function sW(t, e) {
jg(t, function(r, n, i) {
var o = 0;
if (r.geometry) {
var s = r.geometry.type;
if (!(s === "Point" || s === "MultiPoint")) {
var a, u = 0, d = 0, T = 0;
if (xd(
r,
function(f, Q, y, _, L) {
if (a === void 0 || n > u || _ > d || L > T) {
a = f, u = n, d = _, T = L, o = 0;
return;
}
var E = Q4(
[a, f],
r.properties
);
if (e(
E,
n,
i,
L,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
so(sW, "segmentEach");
function aW(t, e, r) {
var n = r, i = !1;
return sW(
t,
function(o, s, a, u, d) {
i === !1 && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = !0;
}
), n;
}
so(aW, "segmentReduce");
function lW(t, e) {
if (!t)
throw new Error("geojson is required");
jg(t, function(r, n, i) {
if (r.geometry !== null) {
var o = r.geometry.type, s = r.geometry.coordinates;
switch (o) {
case "LineString":
if (e(r, n, i, 0, 0) === !1)
return !1;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
Q4(s[a], r.properties),
n,
i,
a
) === !1)
return !1;
break;
}
}
});
}
so(lW, "lineEach");
function TQt(t, e, r) {
var n = r;
return lW(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
so(TQt, "lineReduce");
function fQt(t, e) {
if (e = e || {}, !wH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.segmentIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
case "MultiPoint":
return null;
case "LineString":
return o < 0 && (o = u.length + o - 1), Q4(
[u[o], u[o + 1]],
s,
e
);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o - 1), Q4(
[
u[i][o],
u[i][o + 1]
],
s,
e
);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o - 1), Q4(
[
u[n][o],
u[n][o + 1]
],
s,
e
);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o - 1), Q4(
[
u[n][i][o],
u[n][i][o + 1]
],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(fQt, "findSegment");
function QQt(t, e) {
if (e = e || {}, !wH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.coordIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
return c4(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), c4(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), c4(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), c4(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), c4(u[n][o], s, e);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o), c4(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
so(QQt, "findPoint");
var mQt = Object.defineProperty, gQt = (t, e) => mQt(t, "name", { value: e, configurable: !0 });
function cW(t, e = {}) {
return aW(
t,
(r, n) => {
const i = n.geometry.coordinates;
return r + g5(i[0], i[1], e);
},
0
);
}
gQt(cW, "length");
const mL = 1.3;
var Cf, kf, If, u9;
class yQt {
constructor(e) {
Ft(this, Cf, void 0), Ft(this, kf, ""), Ft(this, If, 0), Ft(this, u9, []), Yt(this, Cf, e);
}
get latestSource() {
return K(this, kf);
}
get knowledgeSchema() {
return K(this, If);
}
async initialise() {
try {
const e = await this.loadJSON("knowledge/schema-version");
if (e === void 0)
return;
"version" in e && Yt(this, If, +e.version);
const r = await this.loadJSON("knowledge/sources");
r && "sources" in r && (Yt(this, u9, r.sources), K(this, u9).length && Yt(this, kf, K(this, u9)[0]));
} catch {
}
}
url(e = "") {
return new URL(e, K(this, Cf)).href;
}
async loadJSON(e, r = !1) {
const n = this.url(e);
try {
const i = await fetch(n, {
method: "GET",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store"
}
});
if (!i.ok) {
if (r)
return null;
throw new Error(`Cannot access ${n}`);
}
return await i.json();
} catch (i) {
throw i;
}
}
async queryKnowledge(e, r = []) {
const n = this.url("knowledge/query/"), i = { sql: e, params: r };
try {
const o = await fetch(n, {
method: "POST",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store",
"Content-Type": "application/json"
},
body: JSON.stringify(i)
});
if (!o.ok)
throw new Error(`Cannot access ${n}`);
const s = await o.json();
if ("error" in s)
throw new TypeError(s.error);
return s.values;
} catch (o) {
throw o;
}
}
}
Cf = /* @__PURE__ */ new WeakMap(), kf = /* @__PURE__ */ new WeakMap(), If = /* @__PURE__ */ new WeakMap(), u9 = /* @__PURE__ */ new WeakMap();
function vQt(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);
}
}
function uW(t, e, r) {
return e && vQt(t.prototype, e), t;
}
function _Qt(t, e, r) {
return e in t ? Object.defineProperty(t, e, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = r, t;
}
function aR(t, e) {
var r = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t);
e && (n = n.filter(function(i) {
return Object.getOwnPropertyDescriptor(t, i).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function F1(t) {
for (var e = 1; e < arguments.length; e++) {
var r = arguments[e] != null ? arguments[e] : {};
e % 2 ? aR(Object(r), !0).forEach(function(n) {
_Qt(t, n, r[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : aR(Object(r)).forEach(function(n) {
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return t;
}
function bQt(t, e) {
if (t) {
if (typeof t == "string")
return lR(t, e);
var r = Object.prototype.toString.call(t).slice(8, -1);
if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set")
return Array.from(t);
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
return lR(t, e);
}
}
function lR(t, e) {
(e == null || e > t.length) && (e = t.length);
for (var r = 0, n = new Array(e); r < e; r++)
n[r] = t[r];
return n;
}
function hW(t, e) {
var r;
if (typeof Symbol > "u" || t[Symbol.iterator] == null) {
if (Array.isArray(t) || (r = bQt(t)) || e) {
r && (t = r);
var n = 0;
return function() {
return n >= t.length ? {
done: !0
} : {
done: !1,
value: t[n++]
};
};
}
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
return r = t[Symbol.iterator](), r.next.bind(r);
}
var gL = /* @__PURE__ */ function() {
function t(r, n) {
var i = r._tree, o = Object.keys(i);
this.set = r, this.type = n, this.path = o.length > 0 ? [{
node: i,
keys: o
}] : [];
}
var e = t.prototype;
return e.next = function() {
var r = this.dive();
return this.backtrack(), r;
}, e.dive = function() {
if (this.path.length === 0)
return {
done: !0
};
var r = y6(this.path), n = r.node, i = r.keys;
return y6(i) === $o ? {
done: !1,
value: this.result()
} : (this.path.push({
node: n[y6(i)],
keys: Object.keys(n[y6(i)])
}), this.dive());
}, e.backtrack = function() {
this.path.length !== 0 && (y6(this.path).keys.pop(), !(y6(this.path).keys.length > 0) && (this.path.pop(), this.backtrack()));
}, e.key = function() {
return this.set._prefix + this.path.map(function(r) {
var n = r.keys;
return y6(n);
}).filter(function(r) {
return r !== $o;
}).join("");
}, e.value = function() {
return y6(this.path).node[$o];
}, e.result = function() {
return this.type === pW ? this.value() : this.type === dW ? this.key() : [this.key(), this.value()];
}, e[Symbol.iterator] = function() {
return this;
}, t;
}(), LQt = "ENTRIES", dW = "KEYS", pW = "VALUES", $o = "", y6 = function(t) {
return t[t.length - 1];
}, wQt = function(t, e, r) {
for (var n = [{
distance: 0,
i: 0,
key: "",
node: t
}], i = {}, o = [], s = function() {
var a = n.pop(), u = a.node, d = a.distance, T = a.key, f = a.i, Q = a.edit;
Object.keys(u).forEach(function(y) {
if (y === $o) {
var _ = d + (e.length - f), L = i[T] || [null, 1 / 0], E = L[1];
_ <= r && _ < E && (i[T] = [u[y], _]);
} else
xQt(e, y, r - d, f, Q, o).forEach(function(x) {
var O = x.distance, k = x.i, R = x.edit;
n.push({
node: u[y],
distance: d + O,
key: T + y,
i: k,
edit: R
});
});
});
}; n.length > 0; )
s();
return i;
}, xQt = function(t, e, r, n, i, o) {
o.push({
distance: 0,
ia: n,
ib: 0,
edit: i
});
for (var s = []; o.length > 0; ) {
var a = o.pop(), u = a.distance, d = a.ia, T = a.ib, f = a.edit;
if (T === e.length) {
s.push({
distance: u,
i: d,
edit: f
});
continue;
}
if (t[d] === e[T])
o.push({
distance: u,
ia: d + 1,
ib: T + 1,
edit: EQt
});
else {
if (u >= r)
continue;
f !== yL && o.push({
distance: u + 1,
ia: d,
ib: T + 1,
edit: vL
}), d < t.length && (f !== vL && o.push({
distance: u + 1,
ia: d + 1,
ib: T,
edit: yL
}), f !== vL && f !== yL && o.push({
distance: u + 1,
ia: d + 1,
ib: T + 1,
edit: MQt
}));
}
}
return s;
}, EQt = 0, MQt = 1, yL = 2, vL = 3, n0 = /* @__PURE__ */ function() {
function t(r, n) {
r === void 0 && (r = {}), n === void 0 && (n = ""), this._tree = r, this._prefix = n;
}
var e = t.prototype;
return e.atPrefix = function(r) {
if (!r.startsWith(this._prefix))
throw new Error("Mismatched prefix");
var n = TW(this._tree, r.slice(this._prefix.length)), i = n[0], o = n[1];
if (i === void 0) {
var s = EH(o), a = s[0], u = s[1], d = Object.keys(a).find(function(f) {
return f !== $o && f.startsWith(u);
});
if (d !== void 0) {
var T;
return new t((T = {}, T[d.slice(u.length)] = a[d], T), r);
}
}
return new t(i || {}, r);
}, e.clear = function() {
delete this._size, this._tree = {};
}, e.delete = function(r) {
return delete this._size, HQt(this._tree, r);
}, e.entries = function() {
return new gL(this, LQt);
}, e.forEach = function(r) {
for (var n = hW(this), i; !(i = n()).done; ) {
var o = i.value, s = o[0], a = o[1];
r(s, a, this);
}
}, e.fuzzyGet = function(r, n) {
return wQt(this._tree, r, n);
}, e.get = function(r) {
var n = cR(this._tree, r);
return n !== void 0 ? n[$o] : void 0;
}, e.has = function(r) {
var n = cR(this._tree, r);
return n !== void 0 && n.hasOwnProperty($o);
}, e.keys = function() {
return new gL(this, dW);
}, e.set = function(r, n) {
if (typeof r != "string")
throw new Error("key must be a string");
delete this._size;
var i = uR(this._tree, r);
return i[$o] = n, this;
}, e.update = function(r, n) {
if (typeof r != "string")
throw new Error("key must be a string");
delete this._size;
var i = uR(this._tree, r);
return i[$o] = n(i[$o]), this;
}, e.values = function() {
return new gL(this, pW);
}, e[Symbol.iterator] = function() {
return this.entries();
}, uW(t, [{
key: "size",
get: function() {
var r = this;
return this._size ? this._size : (this._size = 0, this.forEach(function() {
r._size += 1;
}), this._size);
}
}]), t;
}();
n0.from = function(t) {
for (var e = new n0(), r = hW(t), n; !(n = r()).done; ) {
var i = n.value, o = i[0], s = i[1];
e.set(o, s);
}
return e;
};
n0.fromObject = function(t) {
return n0.from(Object.entries(t));
};
var TW = function t(e, r, n) {
if (n === void 0 && (n = []), r.length === 0)
return [e, n];
var i = Object.keys(e).find(function(o) {
return o !== $o && r.startsWith(o);
});
return i === void 0 ? t(void 0, "", [].concat(n, [[e, r]])) : t(e[i], r.slice(i.length), [].concat(n, [[e, i]]));
}, cR = function t(e, r) {
if (r.length === 0)
return e;
var n = Object.keys(e).find(function(i) {
return i !== $o && r.startsWith(i);
});
if (n !== void 0)
return t(e[n], r.slice(n.length));
}, uR = function t(e, r) {
if (r.length === 0)
return e;
var n = Object.keys(e).find(function(a) {
return a !== $o && r.startsWith(a);
});
if (n === void 0) {
var i = Object.keys(e).find(function(a) {
return a !== $o && a.startsWith(r[0]);
});
if (i === void 0)
e[r] = {};
else {
var o, s = SQt(r, i);
return e[s] = (o = {}, o[i.slice(s.length)] = e[i], o), delete e[i], t(e[s], r.slice(s.length));
}
return e[r];
}
return t(e[n], r.slice(n.length));
}, SQt = function t(e, r, n, i, o) {
return n === void 0 && (n = 0), i === void 0 && (i = Math.min(e.length, r.length)), o === void 0 && (o = ""), n >= i || e[n] !== r[n] ? o : t(e, r, n + 1, i, o + e[n]);
}, HQt = function(t, e) {
var r = TW(t, e), n = r[0], i = r[1];
if (n !== void 0) {
delete n[$o];
var o = Object.keys(n);
o.length === 0 && AQt(i), o.length === 1 && OQt(i, o[0], n[o[0]]);
}
}, AQt = function t(e) {
if (e.length !== 0) {
var r = EH(e), n = r[0], i = r[1];
delete n[i], Object.keys(n).length === 0 && t(e.slice(0, -1));
}
}, OQt = function(t, e, r) {
if (t.length !== 0) {
var n = EH(t), i = n[0], o = n[1];
i[o + e] = r, delete i[o];
}
}, EH = function(t) {
return t[t.length - 1];
}, pT, sm = "or", CQt = "and", fW = /* @__PURE__ */ function() {
function t(r) {
r === void 0 && (r = {}), this._options = F1(F1({}, LL), r), this._options.searchOptions = F1(F1({}, zQt), this._options.searchOptions || {});
var n = this._options.fields;
if (n == null)
throw new Error('MiniSearch: option "fields" must be provided');
this._index = new n0(), this._documentCount = 0, this._documentIds = {}, this._fieldIds = {}, this._fieldLength = {}, this._averageFieldLength = {}, this._nextId = 0, this._storedFields = {}, VQt(this, n);
}
var e = t.prototype;
return e.add = function(r) {
var n = this, i = this._options, o = i.extractField, s = i.tokenize, a = i.processTerm, u = i.fields, d = i.idField, T = o(r, d);
if (T == null)
throw new Error('MiniSearch: document does not have ID field "' + d + '"');
var f = PQt(this, T);
NQt(this, f, r), u.forEach(function(Q) {
var y = o(r, Q);
if (y != null) {
var _ = s(y.toString(), Q);
RQt(n, f, n._fieldIds[Q], n.documentCount - 1, _.length), _.forEach(function(L) {
var E = a(L, Q);
bL(E) && kQt(n, n._fieldIds[Q], f, E);
});
}
});
}, e.addAll = function(r) {
var n = this;
r.forEach(function(i) {
return n.add(i);
});
}, e.addAllAsync = function(r, n) {
var i = this;
n === void 0 && (n = {});
var o = n, s = o.chunkSize, a = s === void 0 ? 10 : s, u = {
chunk: [],
promise: Promise.resolve(null)
}, d = r.reduce(function(Q, y, _) {
var L = Q.chunk, E = Q.promise;
return L.push(y), (_ + 1) % a === 0 ? {
chunk: [],
promise: E.then(function() {
return i.addAll(L);
})
} : {
chunk: L,
promise: E
};
}, u), T = d.chunk, f = d.promise;
return f.then(function() {
return i.addAll(T);
});
}, e.remove = function(r) {
var n = this, i = this._options, o = i.tokenize, s = i.processTerm, a = i.extractField, u = i.fields, d = i.idField, T = a(r, d);
if (T == null)
throw new Error('MiniSearch: document does not have ID field "' + d + '"');
var f = Object.entries(this._documentIds).find(function(y) {
y[0];
var _ = y[1];
return T === _;
}) || [], Q = f[0];
if (Q == null)
throw new Error("MiniSearch: cannot remove document with ID " + T + ": it is not in the index");
u.forEach(function(y) {
var _ = a(r, y);
if (_ != null) {
var L = o(_.toString(), y);
L.forEach(function(E) {
var x = s(E, y);
bL(x) && IQt(n, n._fieldIds[y], Q, x);
});
}
}), delete this._storedFields[Q], delete this._documentIds[Q], this._documentCount -= 1;
}, e.removeAll = function(r) {
var n = this;
arguments.length === 0 ? (this._index = new n0(), this._documentCount = 0, this._documentIds = {}, this._fieldLength = {}, this._averageFieldLength = {}, this._storedFields = {}, this._nextId = 0) : r.forEach(function(i) {
return n.remove(i);
});
}, e.search = function(r, n) {
var i = this;
n === void 0 && (n = {});
var o = this._options, s = o.tokenize, a = o.processTerm, u = o.searchOptions;
n = F1(F1({
tokenize: s,
processTerm: a
}, u), n);
var d = n, T = d.tokenize, f = d.processTerm, Q = T(r).map(function(L) {
return f(L);
}).filter(bL).map(BQt(n)), y = Q.map(function(L) {
return i.executeQuery(L, n);
}), _ = this.combineResults(y, n.combineWith);
return Object.entries(_).reduce(function(L, E) {
var x = E[0], O = E[1], k = O.score, R = O.match, F = O.terms, U = {
id: i._documentIds[x],
terms: jQt(F),
score: k,
match: R
};
return Object.assign(U, i._storedFields[x]), (n.filter == null || n.filter(U)) && L.push(U), L;
}, []).sort(function(L, E) {
var x = L.score, O = E.score;
return x < O ? 1 : -1;
});
}, e.autoSuggest = function(r, n) {
n === void 0 && (n = {}), n = F1(F1({}, UQt), n);
var i = this.search(r, n).reduce(function(o, s) {
var a = s.score, u = s.terms, d = u.join(" ");
return o[d] == null ? o[d] = {
score: a,
terms: u,
count: 1
} : (o[d].score += a, o[d].count += 1), o;
}, {});
return Object.entries(i).map(function(o) {
var s = o[0], a = o[1], u = a.score, d = a.terms, T = a.count;
return {
suggestion: s,
terms: d,
score: u / T
};
}).sort(function(o, s) {
var a = o.score, u = s.score;
return a < u ? 1 : -1;
});
}, t.loadJSON = function(r, n) {
if (n == null)
throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
return t.loadJS(JSON.parse(r), n);
}, t.getDefault = function(r) {
if (LL.hasOwnProperty(r))
return LL[r];
throw new Error('MiniSearch: unknown option "' + r + '"');
}, t.loadJS = function(r, n) {
n === void 0 && (n = {});
var i = r.index, o = r.documentCount, s = r.nextId, a = r.documentIds, u = r.fieldIds, d = r.fieldLength, T = r.averageFieldLength, f = r.storedFields, Q = new t(n);
return Q._index = new n0(i._tree, i._prefix), Q._documentCount = o, Q._nextId = s, Q._documentIds = a, Q._fieldIds = u, Q._fieldLength = d, Q._averageFieldLength = T, Q._fieldIds = u, Q._storedFields = f || {}, Q;
}, e.executeQuery = function(r, n) {
var i = this;
n === void 0 && (n = {}), n = F1(F1({}, this._options.searchOptions), n);
var o = (n.fields || this._options.fields).reduce(function(E, x) {
var O;
return F1(F1({}, E), {}, (O = {}, O[x] = QW(E, x) || 1, O));
}, n.boost || {}), s = n, a = s.boostDocument, u = s.weights, d = u.fuzzy, T = d === void 0 ? 0.9 : d, f = u.prefix, Q = f === void 0 ? 0.75 : f, y = _L(this, r.term, o, a, this._index.get(r.term));
if (!r.fuzzy && !r.prefix)
return y;
var _ = [y];
if (r.prefix && this._index.atPrefix(r.term).forEach(function(E, x) {
var O = 0.3 * (E.length - r.term.length) / E.length;
_.push(_L(i, E, o, a, x, Q, O));
}), r.fuzzy) {
var L = r.fuzzy < 1 ? Math.round(r.term.length * r.fuzzy) : r.fuzzy;
Object.entries(this._index.fuzzyGet(r.term, L)).forEach(function(E) {
var x = E[0], O = E[1], k = O[0], R = O[1], F = R / x.length;
_.push(_L(i, x, o, a, k, T, F));
});
}
return _.reduce(dR[sm], {});
}, e.combineResults = function(r, n) {
if (n === void 0 && (n = sm), r.length === 0)
return {};
var i = n.toLowerCase();
return r.reduce(dR[i], null);
}, e.toJSON = function() {
return {
index: this._index,
documentCount: this._documentCount,
nextId: this._nextId,
documentIds: this._documentIds,
fieldIds: this._fieldIds,
fieldLength: this._fieldLength,
averageFieldLength: this._averageFieldLength,
storedFields: this._storedFields
};
}, uW(t, [{
key: "documentCount",
get: function() {
return this._documentCount;
}
}]), t;
}();
fW.SearchableMap = n0;
var kQt = function(t, e, r, n) {
t._index.update(n, function(i) {
var o;
i = i || {};
var s = i[e] || {
df: 0,
ds: {}
};
return s.ds[r] == null && (s.df += 1), s.ds[r] = (s.ds[r] || 0) + 1, F1(F1({}, i), {}, (o = {}, o[e] = s, o));
});
}, IQt = function(t, e, r, n) {
if (!t._index.has(n)) {
hR(t, r, e, n);
return;
}
t._index.update(n, function(i) {
var o, s = i[e];
if (s == null || s.ds[r] == null)
return hR(t, r, e, n), i;
if (s.ds[r] <= 1) {
if (s.df <= 1)
return delete i[e], i;
s.df -= 1;
}
return s.ds[r] <= 1 ? (delete s.ds[r], i) : (s.ds[r] -= 1, F1(F1({}, i), {}, (o = {}, o[e] = s, o)));
}), Object.keys(t._index.get(n)).length === 0 && t._index.delete(n);
}, hR = function(t, e, r, n) {
if (!(console == null || console.warn == null)) {
var i = Object.entries(t._fieldIds).find(function(o) {
o[0];
var s = o[1];
return s === r;
})[0];
console.warn("MiniSearch: document with ID " + t._documentIds[e] + ' has changed before removal: term "' + n + '" was not present in field "' + i + '". Removing a document after it has changed can corrupt the index!');
}
}, PQt = function(t, e) {
var r = t._nextId.toString(36);
return t._documentIds[r] = e, t._documentCount += 1, t._nextId += 1, r;
}, VQt = function(t, e) {
e.forEach(function(r, n) {
t._fieldIds[r] = n;
});
}, _L = function(t, e, r, n, i, o, s) {
return s === void 0 && (s = 0), i == null ? {} : Object.entries(r).reduce(function(a, u) {
var d = u[0], T = u[1], f = t._fieldIds[d], Q = i[f] || {
ds: {}
}, y = Q.df, _ = Q.ds;
return Object.entries(_).forEach(function(L) {
var E = L[0], x = L[1], O = n ? n(t._documentIds[E], e) : 1;
if (O) {
var k = t._fieldLength[E][f] / t._averageFieldLength[f];
a[E] = a[E] || {
score: 0,
match: {},
terms: []
}, a[E].terms.push(e), a[E].match[e] = QW(a[E].match, e) || [], a[E].score += O * FQt(x, y, t._documentCount, k, T, s), a[E].match[e].push(d);
}
}), a;
}, {});
}, QW = function(t, e) {
return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : void 0;
}, RQt = function(t, e, r, n, i) {
t._averageFieldLength[r] = t._averageFieldLength[r] || 0;
var o = t._averageFieldLength[r] * n + i;
t._fieldLength[e] = t._fieldLength[e] || {}, t._fieldLength[e][r] = i, t._averageFieldLength[r] = o / (n + 1);
}, NQt = function(t, e, r) {
var n = t._options, i = n.storeFields, o = n.extractField;
i == null || i.length === 0 || (t._storedFields[e] = t._storedFields[e] || {}, i.forEach(function(s) {
var a = o(r, s);
a !== void 0 && (t._storedFields[e][s] = a);
}));
}, dR = (pT = {}, pT[sm] = function(t, e) {
return Object.entries(e).reduce(function(r, n) {
var i = n[0], o = n[1], s = o.score, a = o.match, u = o.terms;
return r[i] == null ? r[i] = {
score: s,
match: a,
terms: u
} : (r[i].score += s, r[i].score *= 1.5, r[i].terms = [].concat(r[i].terms, u), Object.assign(r[i].match, a)), r;
}, t || {});
}, pT[CQt] = function(t, e) {
return t == null ? e : Object.entries(e).reduce(function(r, n) {
var i = n[0], o = n[1], s = o.score, a = o.match, u = o.terms;
return t[i] === void 0 || (r[i] = r[i] || {}, r[i].score = t[i].score + s, r[i].match = F1(F1({}, t[i].match), a), r[i].terms = [].concat(t[i].terms, u)), r;
}, {});
}, pT), DQt = function(t, e, r) {
return t * Math.log(r / e);
}, FQt = function(t, e, r, n, i, o) {
var s = i / (1 + 0.333 * i * o);
return s * DQt(t, e, r) / n;
}, BQt = function(t) {
return function(e, r, n) {
var i = typeof t.fuzzy == "function" ? t.fuzzy(e, r, n) : t.fuzzy, o = typeof t.prefix == "function" ? t.prefix(e, r, n) : t.prefix;
return {
term: e,
fuzzy: i,
prefix: o
};
};
}, jQt = function(t) {
return t.filter(function(e, r, n) {
return n.indexOf(e) === r;
});
}, bL = function(t) {
return !!t;
}, LL = {
idField: "id",
extractField: function(t, e) {
return t[e];
},
tokenize: function(t, e) {
return t.split(GQt);
},
processTerm: function(t, e) {
return t.toLowerCase();
},
fields: void 0,
searchOptions: void 0,
storeFields: []
}, zQt = {
combineWith: sm,
prefix: !1,
fuzzy: !1,
weights: {}
}, UQt = {
prefix: function(t, e, r) {
return e === r.length - 1;
}
}, GQt = /[\n\r -#%-\*,-\/:;\?@\[-\]_\{\}\xA0\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/;
const mW = [
"id",
"label",
"models",
"source"
];
var h9, o5;
class $Qt {
constructor() {
Ft(this, h9, []), Ft(this, o5, void 0), Yt(this, o5, new fW({
fields: ["text"],
storeFields: ["text"],
tokenize: (e, r) => e.split(" ")
}));
}
indexMetadata(e, r) {
const n = [];
for (const i of mW)
if (i in r) {
const o = r[i];
n.includes(o) || (this.indexText(e, o), n.push(o));
}
}
indexText(e, r) {
r = r.replace(new RegExp("
", "g"), " ").replace(new RegExp(`
`, "g"), " "), r && (K(this, o5).add({
id: K(this, h9).length,
text: r
}), K(this, h9).push(e));
}
auto_suggest(e) {
return K(this, o5).autoSuggest(e, { prefix: !0 });
}
search(e) {
let r = [];
e = e.trim(), e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), r = K(this, o5).search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (r = K(this, o5).search(e, { prefix: !0 }));
const n = r.map((i) => ({
featureId: K(this, h9)[i.id],
score: i.score,
terms: i.terms,
text: i.text
}));
return new WQt(n);
}
}
h9 = /* @__PURE__ */ new WeakMap(), o5 = /* @__PURE__ */ new WeakMap();
var Pf, Vf;
class WQt {
constructor(e) {
Ft(this, Pf, void 0), Ft(this, Vf, void 0), Yt(this, Vf, e.sort((r, n) => n.score - r.score)), Yt(this, Pf, e.map((r) => r.featureId));
}
get featureIds() {
return K(this, Pf);
}
get results() {
return K(this, Vf);
}
}
Pf = /* @__PURE__ */ new WeakMap(), Vf = /* @__PURE__ */ new WeakMap();
function MH(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (MH(s.geometries[n], e) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
function ZQt(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
function qQt(t, e, r) {
var n = r;
return ZQt(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
var pR = 6378137;
function XQt(t) {
return qQt(t, function(e, r) {
return e + KQt(r);
}, 0);
}
function KQt(t) {
var e = 0, r;
switch (t.type) {
case "Polygon":
return TR(t.coordinates);
case "MultiPolygon":
for (r = 0; r < t.coordinates.length; r++)
e += TR(t.coordinates[r]);
return e;
case "Point":
case "MultiPoint":
case "LineString":
case "MultiLineString":
return 0;
}
return 0;
}
function TR(t) {
var e = 0;
if (t && t.length > 0) {
e += Math.abs(fR(t[0]));
for (var r = 1; r < t.length; r++)
e -= Math.abs(fR(t[r]));
}
return e;
}
function fR(t) {
var e, r, n, i, o, s, a, u = 0, d = t.length;
if (d > 2) {
for (a = 0; a < d; a++)
a === d - 2 ? (i = d - 2, o = d - 1, s = 0) : a === d - 1 ? (i = d - 1, o = 0, s = 1) : (i = a, o = a + 1, s = a + 2), e = t[i], r = t[o], n = t[s], u += (wL(n[0]) - wL(e[0])) * Math.sin(wL(r[1]));
u = u * pR * pR / 2;
}
return u;
}
function wL(t) {
return t * Math.PI / 180;
}
function YQt(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
function TT(t) {
return t % 360 * Math.PI / 180;
}
function QR(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function SH(t, e, r = {}) {
if (r.final === !0)
return JQt(t, e);
const n = QR(t), i = QR(e), o = TT(n[0]), s = TT(i[0]), a = TT(n[1]), u = TT(i[1]), d = Math.sin(s - o) * Math.cos(u), T = Math.cos(a) * Math.sin(u) - Math.sin(a) * Math.cos(u) * Math.cos(s - o);
return YQt(Math.atan2(d, T));
}
function JQt(t, e) {
let r = SH(e, t);
return r = (r + 180) % 360, r;
}
var F2 = 63710088e-1, tmt = {
centimeters: F2 * 100,
centimetres: F2 * 100,
degrees: 360 / (2 * Math.PI),
feet: F2 * 3.28084,
inches: F2 * 39.37,
kilometers: F2 / 1e3,
kilometres: F2 / 1e3,
meters: F2,
metres: F2,
miles: F2 / 1609.344,
millimeters: F2 * 1e3,
millimetres: F2 * 1e3,
nauticalmiles: F2 / 1852,
radians: 1,
yards: F2 * 1.0936
};
function emt(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
function rmt(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!gR(t[0]) || !gR(t[1]))
throw new Error("coordinates must contain numbers");
return emt({
type: "Point",
coordinates: t
}, e, r);
}
function nmt(t, e = "kilometers") {
const r = tmt[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
function mR(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
function xL(t) {
return t % 360 * Math.PI / 180;
}
function gR(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
function imt(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
function iE(t, e, r, n = {}) {
const i = imt(t), o = xL(i[0]), s = xL(i[1]), a = xL(r), u = nmt(e, n.units), d = Math.asin(
Math.sin(s) * Math.cos(u) + Math.cos(s) * Math.sin(u) * Math.cos(a)
), T = o + Math.atan2(
Math.sin(a) * Math.sin(u) * Math.cos(s),
Math.cos(u) - Math.sin(s) * Math.sin(d)
), f = mR(T), Q = mR(d);
return rmt([f, Q], n.properties);
}
function omt(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = {}, n.geometry = t, n;
}
function yR(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!vR(t[0]) || !vR(t[1]))
throw new Error("coordinates must contain numbers");
return omt({
type: "Point",
coordinates: t
}, e, r);
}
function vR(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
function smt(t) {
return t.type === "Feature" ? t.geometry : t;
}
function amt(t, e, r = {}) {
const n = smt(t).coordinates;
let i = 0;
for (let o = 0; o < n.length && !(e >= i && o === n.length - 1); o++)
if (i >= e) {
const s = e - i;
if (s) {
const a = SH(n[o], n[o - 1]) - 180;
return iE(
n[o],
s,
a,
r
);
} else
return yR(n[o]);
} else
i += g5(n[o], n[o + 1], r);
return yR(n[n.length - 1]);
}
var lmt = amt;
function oE(t) {
var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
return MH(t, function(r) {
e[0] > r[0] && (e[0] = r[0]), e[1] > r[1] && (e[1] = r[1]), e[2] < r[0] && (e[2] = r[0]), e[3] < r[1] && (e[3] = r[1]);
}), e;
}
oE.default = oE;
var cmt = Object.defineProperty, Wn = (t, e) => cmt(t, "name", { value: e, configurable: !0 }), umt = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !d9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = sE(t), n = sE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!d9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return d9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? _H(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return d9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
Wn(umt, "GeojsonEquality");
function d9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Wn(d9, "sameLength");
function sE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Wn(sE, "explode");
var B2 = 63710088e-1, gW = {
centimeters: B2 * 100,
centimetres: B2 * 100,
degrees: 360 / (2 * Math.PI),
feet: B2 * 3.28084,
inches: B2 * 39.37,
kilometers: B2 / 1e3,
kilometres: B2 / 1e3,
meters: B2,
metres: B2,
miles: B2 / 1609.344,
millimeters: B2 * 1e3,
millimetres: B2 * 1e3,
nauticalmiles: B2 / 1852,
radians: 1,
yards: B2 * 1.0936
}, _R = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function f3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
Wn(f3, "feature");
function hmt(t, e, r = {}) {
switch (t) {
case "Point":
return zg(e).geometry;
case "LineString":
return AH(e).geometry;
case "Polygon":
return HH(e).geometry;
case "MultiPoint":
return vW(e).geometry;
case "MultiLineString":
return yW(e).geometry;
case "MultiPolygon":
return _W(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Wn(hmt, "geometry");
function zg(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!am(t[0]) || !am(t[1]))
throw new Error("coordinates must contain numbers");
return f3({
type: "Point",
coordinates: t
}, e, r);
}
Wn(zg, "point");
function dmt(t, e, r = {}) {
return C8(
t.map((n) => zg(n, e)),
r
);
}
Wn(dmt, "points");
function HH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return f3({
type: "Polygon",
coordinates: t
}, e, r);
}
Wn(HH, "polygon");
function pmt(t, e, r = {}) {
return C8(
t.map((n) => HH(n, e)),
r
);
}
Wn(pmt, "polygons");
function AH(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return f3({
type: "LineString",
coordinates: t
}, e, r);
}
Wn(AH, "lineString");
function Tmt(t, e, r = {}) {
return C8(
t.map((n) => AH(n, e)),
r
);
}
Wn(Tmt, "lineStrings");
function C8(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
Wn(C8, "featureCollection");
function yW(t, e, r = {}) {
return f3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Wn(yW, "multiLineString");
function vW(t, e, r = {}) {
return f3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Wn(vW, "multiPoint");
function _W(t, e, r = {}) {
return f3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Wn(_W, "multiPolygon");
function fmt(t, e, r = {}) {
return f3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Wn(fmt, "geometryCollection");
function Qmt(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
Wn(Qmt, "round");
function bW(t, e = "kilometers") {
const r = gW[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Wn(bW, "radiansToLength");
function OH(t, e = "kilometers") {
const r = gW[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Wn(OH, "lengthToRadians");
function mmt(t, e) {
return LW(OH(t, e));
}
Wn(mmt, "lengthToDegrees");
function gmt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Wn(gmt, "bearingToAzimuth");
function LW(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Wn(LW, "radiansToDegrees");
function ymt(t) {
return t % 360 * Math.PI / 180;
}
Wn(ymt, "degreesToRadians");
function vmt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return bW(OH(t, e), r);
}
Wn(vmt, "convertLength");
function _mt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = _R[e];
if (!n)
throw new Error("invalid original units");
const i = _R[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
Wn(_mt, "convertArea");
function am(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Wn(am, "isNumber");
function bmt(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Wn(bmt, "isObject");
function Lmt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!am(e))
throw new Error("bbox must only contain numbers");
});
}
Wn(Lmt, "validateBBox");
function wmt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
Wn(wmt, "validateId");
let wW = class {
constructor(t = [], e = xmt) {
if (this.data = t, this.length = this.data.length, this.compare = e, this.length > 0)
for (let r = (this.length >> 1) - 1; r >= 0; r--)
this._down(r);
}
push(t) {
this.data.push(t), this.length++, this._up(this.length - 1);
}
pop() {
if (this.length === 0)
return;
const t = this.data[0], e = this.data.pop();
return this.length--, this.length > 0 && (this.data[0] = e, this._down(0)), t;
}
peek() {
return this.data[0];
}
_up(t) {
const { data: e, compare: r } = this, n = e[t];
for (; t > 0; ) {
const i = t - 1 >> 1, o = e[i];
if (r(n, o) >= 0)
break;
e[t] = o, t = i;
}
e[t] = n;
}
_down(t) {
const { data: e, compare: r } = this, n = this.length >> 1, i = e[t];
for (; t < n; ) {
let o = (t << 1) + 1, s = e[o];
const a = o + 1;
if (a < this.length && r(e[a], s) < 0 && (o = a, s = e[a]), r(s, i) >= 0)
break;
e[t] = s, t = o;
}
e[t] = i;
}
};
function xmt(t, e) {
return t < e ? -1 : t > e ? 1 : 0;
}
function xW(t, e) {
return t.p.x > e.p.x ? 1 : t.p.x < e.p.x ? -1 : t.p.y !== e.p.y ? t.p.y > e.p.y ? 1 : -1 : 1;
}
function Emt(t, e) {
return t.rightSweepEvent.p.x > e.rightSweepEvent.p.x ? 1 : t.rightSweepEvent.p.x < e.rightSweepEvent.p.x ? -1 : t.rightSweepEvent.p.y !== e.rightSweepEvent.p.y ? t.rightSweepEvent.p.y < e.rightSweepEvent.p.y ? 1 : -1 : 1;
}
class bR {
constructor(e, r, n, i) {
this.p = {
x: e[0],
y: e[1]
}, this.featureId = r, this.ringId = n, this.eventId = i, this.otherEvent = null, this.isLeftEndpoint = null;
}
isSamePoint(e) {
return this.p.x === e.p.x && this.p.y === e.p.y;
}
}
function Mmt(t, e) {
if (t.type === "FeatureCollection") {
const r = t.features;
for (let n = 0; n < r.length; n++)
LR(r[n], e);
} else
LR(t, e);
}
let fT = 0, QT = 0, mT = 0;
function LR(t, e) {
const r = t.type === "Feature" ? t.geometry : t;
let n = r.coordinates;
(r.type === "Polygon" || r.type === "MultiLineString") && (n = [n]), r.type === "LineString" && (n = [[n]]);
for (let i = 0; i < n.length; i++)
for (let o = 0; o < n[i].length; o++) {
let s = n[i][o][0], a = null;
QT = QT + 1;
for (let u = 0; u < n[i][o].length - 1; u++) {
a = n[i][o][u + 1];
const d = new bR(s, fT, QT, mT), T = new bR(a, fT, QT, mT + 1);
d.otherEvent = T, T.otherEvent = d, xW(d, T) > 0 ? (T.isLeftEndpoint = !0, d.isLeftEndpoint = !1) : (d.isLeftEndpoint = !0, T.isLeftEndpoint = !1), e.push(d), e.push(T), s = a, mT = mT + 1;
}
}
fT = fT + 1;
}
class Smt {
constructor(e) {
this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
}
}
function Hmt(t, e) {
if (t === null || e === null || t.leftSweepEvent.ringId === e.leftSweepEvent.ringId && (t.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t.rightSweepEvent.isSamePoint(e.leftSweepEvent) || t.rightSweepEvent.isSamePoint(e.rightSweepEvent) || t.leftSweepEvent.isSamePoint(e.leftSweepEvent) || t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))
return !1;
const r = t.leftSweepEvent.p.x, n = t.leftSweepEvent.p.y, i = t.rightSweepEvent.p.x, o = t.rightSweepEvent.p.y, s = e.leftSweepEvent.p.x, a = e.leftSweepEvent.p.y, u = e.rightSweepEvent.p.x, d = e.rightSweepEvent.p.y, T = (d - a) * (i - r) - (u - s) * (o - n), f = (u - s) * (n - a) - (d - a) * (r - s), Q = (i - r) * (n - a) - (o - n) * (r - s);
if (T === 0)
return !1;
const y = f / T, _ = Q / T;
if (y >= 0 && y <= 1 && _ >= 0 && _ <= 1) {
const L = r + y * (i - r), E = n + y * (o - n);
return [L, E];
}
return !1;
}
function Amt(t, e) {
e = e || !1;
const r = [], n = new wW([], Emt);
for (; t.length; ) {
const i = t.pop();
if (i.isLeftEndpoint) {
const o = new Smt(i);
for (let s = 0; s < n.data.length; s++) {
const a = n.data[s];
if (e && a.leftSweepEvent.featureId === i.featureId)
continue;
const u = Hmt(o, a);
u !== !1 && r.push(u);
}
n.push(o);
} else
i.isLeftEndpoint === !1 && n.pop();
}
return r;
}
function Omt(t, e) {
const r = new wW([], xW);
return Mmt(t, r), Amt(r, e);
}
var Cmt = Object.defineProperty, kmt = (t, e) => Cmt(t, "name", { value: e, configurable: !0 }), Imt = Omt;
function EW(t, e, r = {}) {
const { removeDuplicates: n = !0, ignoreSelfIntersections: i = !1 } = r;
let o = [];
t.type === "FeatureCollection" ? o = o.concat(t.features) : t.type === "Feature" ? o.push(t) : (t.type === "LineString" || t.type === "Polygon" || t.type === "MultiLineString" || t.type === "MultiPolygon") && o.push(f3(t)), e.type === "FeatureCollection" ? o = o.concat(e.features) : e.type === "Feature" ? o.push(e) : (e.type === "LineString" || e.type === "Polygon" || e.type === "MultiLineString" || e.type === "MultiPolygon") && o.push(f3(e));
const s = Imt(
C8(o),
i
);
let a = [];
if (n) {
const u = {};
s.forEach((d) => {
const T = d.join(",");
u[T] || (u[T] = !0, a.push(d));
});
} else
a = s;
return C8(a.map((u) => zg(u)));
}
kmt(EW, "lineIntersect");
var Pmt = Object.defineProperty, Zn = (t, e) => Pmt(t, "name", { value: e, configurable: !0 }), Vmt = class {
constructor(t) {
this.direction = !1, this.compareProperties = !0;
var e, r, n;
this.precision = 10 ** -((e = t == null ? void 0 : t.precision) != null ? e : 17), this.direction = (r = t == null ? void 0 : t.direction) != null ? r : !1, this.compareProperties = (n = t == null ? void 0 : t.compareProperties) != null ? n : !0;
}
compare(t, e) {
if (t.type !== e.type || !p9(t, e))
return !1;
switch (t.type) {
case "Point":
return this.compareCoord(t.coordinates, e.coordinates);
case "LineString":
return this.compareLine(t.coordinates, e.coordinates);
case "Polygon":
return this.comparePolygon(t, e);
case "GeometryCollection":
return this.compareGeometryCollection(t, e);
case "Feature":
return this.compareFeature(t, e);
case "FeatureCollection":
return this.compareFeatureCollection(t, e);
default:
if (t.type.startsWith("Multi")) {
const r = aE(t), n = aE(
e
);
return r.every(
(i) => n.some((o) => this.compare(i, o))
);
}
}
return !1;
}
compareCoord(t, e) {
return t.length === e.length && t.every((r, n) => Math.abs(r - e[n]) < this.precision);
}
compareLine(t, e, r = 0, n = !1) {
if (!p9(t, e))
return !1;
const i = t;
let o = e;
if (n && !this.compareCoord(i[0], o[0])) {
const a = this.fixStartIndex(o, i);
if (a)
o = a;
else
return !1;
}
const s = this.compareCoord(i[r], o[r]);
return this.direction || s ? this.comparePath(i, o) : this.compareCoord(i[r], o[o.length - (1 + r)]) ? this.comparePath(i.slice().reverse(), o) : !1;
}
fixStartIndex(t, e) {
let r, n = -1;
for (let i = 0; i < t.length; i++)
if (this.compareCoord(t[i], e[0])) {
n = i;
break;
}
return n >= 0 && (r = [].concat(
t.slice(n, t.length),
t.slice(1, n + 1)
)), r;
}
comparePath(t, e) {
return t.every((r, n) => this.compareCoord(r, e[n]));
}
comparePolygon(t, e) {
if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {
const r = t.coordinates.slice(1, t.coordinates.length), n = e.coordinates.slice(1, e.coordinates.length);
return r.every(
(i) => n.some((o) => this.compareLine(i, o, 1, !0))
);
}
return !1;
}
compareGeometryCollection(t, e) {
return p9(t.geometries, e.geometries) && this.compareBBox(t, e) && t.geometries.every((r, n) => this.compare(r, e.geometries[n]));
}
compareFeature(t, e) {
return t.id === e.id && (this.compareProperties ? _H(t.properties, e.properties) : !0) && this.compareBBox(t, e) && this.compare(t.geometry, e.geometry);
}
compareFeatureCollection(t, e) {
return p9(t.features, e.features) && this.compareBBox(t, e) && t.features.every((r, n) => this.compare(r, e.features[n]));
}
compareBBox(t, e) {
return !t.bbox && !e.bbox || (t.bbox && e.bbox ? this.compareCoord(t.bbox, e.bbox) : !1);
}
};
Zn(Vmt, "GeojsonEquality");
function p9(t, e) {
return t.coordinates ? t.coordinates.length === e.coordinates.length : t.length === e.length;
}
Zn(p9, "sameLength");
function aE(t) {
return t.coordinates.map((e) => ({
type: t.type.replace("Multi", ""),
coordinates: e
}));
}
Zn(aE, "explode");
var j2 = 63710088e-1, MW = {
centimeters: j2 * 100,
centimetres: j2 * 100,
degrees: 360 / (2 * Math.PI),
feet: j2 * 3.28084,
inches: j2 * 39.37,
kilometers: j2 / 1e3,
kilometres: j2 / 1e3,
meters: j2,
metres: j2,
miles: j2 / 1609.344,
millimeters: j2 * 1e3,
millimetres: j2 * 1e3,
nauticalmiles: j2 / 1852,
radians: 1,
yards: j2 * 1.0936
}, wR = {
acres: 247105e-9,
centimeters: 1e4,
centimetres: 1e4,
feet: 10.763910417,
hectares: 1e-4,
inches: 1550.003100006,
kilometers: 1e-6,
kilometres: 1e-6,
meters: 1,
metres: 1,
miles: 386e-9,
nauticalmiles: 29155334959812285e-23,
millimeters: 1e6,
millimetres: 1e6,
yards: 1.195990046
};
function Q3(t, e, r = {}) {
const n = { type: "Feature" };
return (r.id === 0 || r.id) && (n.id = r.id), r.bbox && (n.bbox = r.bbox), n.properties = e || {}, n.geometry = t, n;
}
Zn(Q3, "feature");
function Rmt(t, e, r = {}) {
switch (t) {
case "Point":
return Es(e).geometry;
case "LineString":
return ra(e).geometry;
case "Polygon":
return CH(e).geometry;
case "MultiPoint":
return HW(e).geometry;
case "MultiLineString":
return SW(e).geometry;
case "MultiPolygon":
return AW(e).geometry;
default:
throw new Error(t + " is invalid");
}
}
Zn(Rmt, "geometry");
function Es(t, e, r = {}) {
if (!t)
throw new Error("coordinates is required");
if (!Array.isArray(t))
throw new Error("coordinates must be an Array");
if (t.length < 2)
throw new Error("coordinates must be at least 2 numbers long");
if (!k8(t[0]) || !k8(t[1]))
throw new Error("coordinates must contain numbers");
return Q3({
type: "Point",
coordinates: t
}, e, r);
}
Zn(Es, "point");
function Nmt(t, e, r = {}) {
return Ug(
t.map((n) => Es(n, e)),
r
);
}
Zn(Nmt, "points");
function CH(t, e, r = {}) {
for (const n of t) {
if (n.length < 4)
throw new Error(
"Each LinearRing of a Polygon must have 4 or more Positions."
);
if (n[n.length - 1].length !== n[0].length)
throw new Error("First and last Position are not equivalent.");
for (let i = 0; i < n[n.length - 1].length; i++)
if (n[n.length - 1][i] !== n[0][i])
throw new Error("First and last Position are not equivalent.");
}
return Q3({
type: "Polygon",
coordinates: t
}, e, r);
}
Zn(CH, "polygon");
function Dmt(t, e, r = {}) {
return Ug(
t.map((n) => CH(n, e)),
r
);
}
Zn(Dmt, "polygons");
function ra(t, e, r = {}) {
if (t.length < 2)
throw new Error("coordinates must be an array of two or more positions");
return Q3({
type: "LineString",
coordinates: t
}, e, r);
}
Zn(ra, "lineString");
function Fmt(t, e, r = {}) {
return Ug(
t.map((n) => ra(n, e)),
r
);
}
Zn(Fmt, "lineStrings");
function Ug(t, e = {}) {
const r = { type: "FeatureCollection" };
return e.id && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.features = t, r;
}
Zn(Ug, "featureCollection");
function SW(t, e, r = {}) {
return Q3({
type: "MultiLineString",
coordinates: t
}, e, r);
}
Zn(SW, "multiLineString");
function HW(t, e, r = {}) {
return Q3({
type: "MultiPoint",
coordinates: t
}, e, r);
}
Zn(HW, "multiPoint");
function AW(t, e, r = {}) {
return Q3({
type: "MultiPolygon",
coordinates: t
}, e, r);
}
Zn(AW, "multiPolygon");
function Bmt(t, e, r = {}) {
return Q3({
type: "GeometryCollection",
geometries: t
}, e, r);
}
Zn(Bmt, "geometryCollection");
function jmt(t, e = 0) {
if (e && !(e >= 0))
throw new Error("precision must be a positive number");
const r = Math.pow(10, e || 0);
return Math.round(t * r) / r;
}
Zn(jmt, "round");
function OW(t, e = "kilometers") {
const r = MW[e];
if (!r)
throw new Error(e + " units is invalid");
return t * r;
}
Zn(OW, "radiansToLength");
function kH(t, e = "kilometers") {
const r = MW[e];
if (!r)
throw new Error(e + " units is invalid");
return t / r;
}
Zn(kH, "lengthToRadians");
function zmt(t, e) {
return CW(kH(t, e));
}
Zn(zmt, "lengthToDegrees");
function Umt(t) {
let e = t % 360;
return e < 0 && (e += 360), e;
}
Zn(Umt, "bearingToAzimuth");
function CW(t) {
return t % (2 * Math.PI) * 180 / Math.PI;
}
Zn(CW, "radiansToDegrees");
function Gmt(t) {
return t % 360 * Math.PI / 180;
}
Zn(Gmt, "degreesToRadians");
function $mt(t, e = "kilometers", r = "kilometers") {
if (!(t >= 0))
throw new Error("length must be a positive number");
return OW(kH(t, e), r);
}
Zn($mt, "convertLength");
function Wmt(t, e = "meters", r = "kilometers") {
if (!(t >= 0))
throw new Error("area must be a positive number");
const n = wR[e];
if (!n)
throw new Error("invalid original units");
const i = wR[r];
if (!i)
throw new Error("invalid final units");
return t / n * i;
}
Zn(Wmt, "convertArea");
function k8(t) {
return !isNaN(t) && t !== null && !Array.isArray(t);
}
Zn(k8, "isNumber");
function IH(t) {
return t !== null && typeof t == "object" && !Array.isArray(t);
}
Zn(IH, "isObject");
function Zmt(t) {
if (!t)
throw new Error("bbox is required");
if (!Array.isArray(t))
throw new Error("bbox must be an Array");
if (t.length !== 4 && t.length !== 6)
throw new Error("bbox must be an Array of 4 or 6 numbers");
t.forEach((e) => {
if (!k8(e))
throw new Error("bbox must only contain numbers");
});
}
Zn(Zmt, "validateBBox");
function qmt(t) {
if (!t)
throw new Error("id is required");
if (["string", "number"].indexOf(typeof t) === -1)
throw new Error("id must be a number or a string");
}
Zn(qmt, "validateId");
var Xmt = Object.defineProperty, ao = (t, e) => Xmt(t, "name", { value: e, configurable: !0 });
function Ed(t, e, r) {
if (t !== null)
for (var n, i, o, s, a, u, d, T = 0, f = 0, Q, y = t.type, _ = y === "FeatureCollection", L = y === "Feature", E = _ ? t.features.length : 1, x = 0; x < E; x++) {
d = _ ? t.features[x].geometry : L ? t.geometry : t, Q = d ? d.type === "GeometryCollection" : !1, a = Q ? d.geometries.length : 1;
for (var O = 0; O < a; O++) {
var k = 0, R = 0;
if (s = Q ? d.geometries[O] : d, s !== null) {
u = s.coordinates;
var F = s.type;
switch (T = r && (F === "Polygon" || F === "MultiPolygon") ? 1 : 0, F) {
case null:
break;
case "Point":
if (e(
u,
f,
x,
k,
R
) === !1)
return !1;
f++, k++;
break;
case "LineString":
case "MultiPoint":
for (n = 0; n < u.length; n++) {
if (e(
u[n],
f,
x,
k,
R
) === !1)
return !1;
f++, F === "MultiPoint" && k++;
}
F === "LineString" && k++;
break;
case "Polygon":
case "MultiLineString":
for (n = 0; n < u.length; n++) {
for (i = 0; i < u[n].length - T; i++) {
if (e(
u[n][i],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
F === "MultiLineString" && k++, F === "Polygon" && R++;
}
F === "Polygon" && k++;
break;
case "MultiPolygon":
for (n = 0; n < u.length; n++) {
for (R = 0, i = 0; i < u[n].length; i++) {
for (o = 0; o < u[n][i].length - T; o++) {
if (e(
u[n][i][o],
f,
x,
k,
R
) === !1)
return !1;
f++;
}
R++;
}
k++;
}
break;
case "GeometryCollection":
for (n = 0; n < s.geometries.length; n++)
if (Ed(s.geometries[n], e, r) === !1)
return !1;
break;
default:
throw new Error("Unknown Geometry Type");
}
}
}
}
}
ao(Ed, "coordEach");
function Kmt(t, e, r, n) {
var i = r;
return Ed(
t,
function(o, s, a, u, d) {
s === 0 && r === void 0 ? i = o : i = e(
i,
o,
s,
a,
u,
d
);
},
n
), i;
}
ao(Kmt, "coordReduce");
function kW(t, e) {
var r;
switch (t.type) {
case "FeatureCollection":
for (r = 0; r < t.features.length && e(t.features[r].properties, r) !== !1; r++)
;
break;
case "Feature":
e(t.properties, 0);
break;
}
}
ao(kW, "propEach");
function Ymt(t, e, r) {
var n = r;
return kW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Ymt, "propReduce");
function IW(t, e) {
if (t.type === "Feature")
e(t, 0);
else if (t.type === "FeatureCollection")
for (var r = 0; r < t.features.length && e(t.features[r], r) !== !1; r++)
;
}
ao(IW, "featureEach");
function Jmt(t, e, r) {
var n = r;
return IW(t, function(i, o) {
o === 0 && r === void 0 ? n = i : n = e(n, i, o);
}), n;
}
ao(Jmt, "featureReduce");
function tgt(t) {
var e = [];
return Ed(t, function(r) {
e.push(r);
}), e;
}
ao(tgt, "coordAll");
function PH(t, e) {
var r, n, i, o, s, a, u, d, T, f, Q = 0, y = t.type === "FeatureCollection", _ = t.type === "Feature", L = y ? t.features.length : 1;
for (r = 0; r < L; r++) {
for (a = y ? t.features[r].geometry : _ ? t.geometry : t, d = y ? t.features[r].properties : _ ? t.properties : {}, T = y ? t.features[r].bbox : _ ? t.bbox : void 0, f = y ? t.features[r].id : _ ? t.id : void 0, u = a ? a.type === "GeometryCollection" : !1, s = u ? a.geometries.length : 1, i = 0; i < s; i++) {
if (o = u ? a.geometries[i] : a, o === null) {
if (e(
null,
Q,
d,
T,
f
) === !1)
return !1;
continue;
}
switch (o.type) {
case "Point":
case "LineString":
case "MultiPoint":
case "Polygon":
case "MultiLineString":
case "MultiPolygon": {
if (e(
o,
Q,
d,
T,
f
) === !1)
return !1;
break;
}
case "GeometryCollection": {
for (n = 0; n < o.geometries.length; n++)
if (e(
o.geometries[n],
Q,
d,
T,
f
) === !1)
return !1;
break;
}
default:
throw new Error("Unknown Geometry Type");
}
}
Q++;
}
}
ao(PH, "geomEach");
function egt(t, e, r) {
var n = r;
return PH(
t,
function(i, o, s, a, u) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a,
u
);
}
), n;
}
ao(egt, "geomReduce");
function Md(t, e) {
PH(t, function(r, n, i, o, s) {
var a = r === null ? null : r.type;
switch (a) {
case null:
case "Point":
case "LineString":
case "Polygon":
return e(
Q3(r, i, { bbox: o, id: s }),
n,
0
) === !1 ? !1 : void 0;
}
var u;
switch (a) {
case "MultiPoint":
u = "Point";
break;
case "MultiLineString":
u = "LineString";
break;
case "MultiPolygon":
u = "Polygon";
break;
}
for (var d = 0; d < r.coordinates.length; d++) {
var T = r.coordinates[d], f = {
type: u,
coordinates: T
};
if (e(Q3(f, i), n, d) === !1)
return !1;
}
});
}
ao(Md, "flattenEach");
function rgt(t, e, r) {
var n = r;
return Md(
t,
function(i, o, s) {
o === 0 && s === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s
);
}
), n;
}
ao(rgt, "flattenReduce");
function PW(t, e) {
Md(t, function(r, n, i) {
var o = 0;
if (r.geometry) {
var s = r.geometry.type;
if (!(s === "Point" || s === "MultiPoint")) {
var a, u = 0, d = 0, T = 0;
if (Ed(
r,
function(f, Q, y, _, L) {
if (a === void 0 || n > u || _ > d || L > T) {
a = f, u = n, d = _, T = L, o = 0;
return;
}
var E = ra(
[a, f],
r.properties
);
if (e(
E,
n,
i,
L,
o
) === !1)
return !1;
o++, a = f;
}
) === !1)
return !1;
}
}
});
}
ao(PW, "segmentEach");
function ngt(t, e, r) {
var n = r, i = !1;
return PW(
t,
function(o, s, a, u, d) {
i === !1 && r === void 0 ? n = o : n = e(
n,
o,
s,
a,
u,
d
), i = !0;
}
), n;
}
ao(ngt, "segmentReduce");
function VW(t, e) {
if (!t)
throw new Error("geojson is required");
Md(t, function(r, n, i) {
if (r.geometry !== null) {
var o = r.geometry.type, s = r.geometry.coordinates;
switch (o) {
case "LineString":
if (e(r, n, i, 0, 0) === !1)
return !1;
break;
case "Polygon":
for (var a = 0; a < s.length; a++)
if (e(
ra(s[a], r.properties),
n,
i,
a
) === !1)
return !1;
break;
}
}
});
}
ao(VW, "lineEach");
function igt(t, e, r) {
var n = r;
return VW(
t,
function(i, o, s, a) {
o === 0 && r === void 0 ? n = i : n = e(
n,
i,
o,
s,
a
);
}
), n;
}
ao(igt, "lineReduce");
function ogt(t, e) {
if (e = e || {}, !IH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.segmentIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
case "MultiPoint":
return null;
case "LineString":
return o < 0 && (o = u.length + o - 1), ra(
[u[o], u[o + 1]],
s,
e
);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o - 1), ra(
[
u[i][o],
u[i][o + 1]
],
s,
e
);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o - 1), ra(
[
u[n][o],
u[n][o + 1]
],
s,
e
);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o - 1), ra(
[
u[n][i][o],
u[n][i][o + 1]
],
s,
e
);
}
throw new Error("geojson is invalid");
}
ao(ogt, "findSegment");
function sgt(t, e) {
if (e = e || {}, !IH(e))
throw new Error("options is invalid");
var r = e.featureIndex || 0, n = e.multiFeatureIndex || 0, i = e.geometryIndex || 0, o = e.coordIndex || 0, s = e.properties, a;
switch (t.type) {
case "FeatureCollection":
r < 0 && (r = t.features.length + r), s = s || t.features[r].properties, a = t.features[r].geometry;
break;
case "Feature":
s = s || t.properties, a = t.geometry;
break;
case "Point":
case "MultiPoint":
return null;
case "LineString":
case "Polygon":
case "MultiLineString":
case "MultiPolygon":
a = t;
break;
default:
throw new Error("geojson is invalid");
}
if (a === null)
return null;
var u = a.coordinates;
switch (a.type) {
case "Point":
return Es(u, s, e);
case "MultiPoint":
return n < 0 && (n = u.length + n), Es(u[n], s, e);
case "LineString":
return o < 0 && (o = u.length + o), Es(u[o], s, e);
case "Polygon":
return i < 0 && (i = u.length + i), o < 0 && (o = u[i].length + o), Es(u[i][o], s, e);
case "MultiLineString":
return n < 0 && (n = u.length + n), o < 0 && (o = u[n].length + o), Es(u[n][o], s, e);
case "MultiPolygon":
return n < 0 && (n = u.length + n), i < 0 && (i = u[n].length + i), o < 0 && (o = u[n][i].length - o), Es(
u[n][i][o],
s,
e
);
}
throw new Error("geojson is invalid");
}
ao(sgt, "findPoint");
var agt = Object.defineProperty, m0 = (t, e) => agt(t, "name", { value: e, configurable: !0 });
function lgt(t) {
if (!t)
throw new Error("coord is required");
if (!Array.isArray(t)) {
if (t.type === "Feature" && t.geometry !== null && t.geometry.type === "Point")
return [...t.geometry.coordinates];
if (t.type === "Point")
return [...t.coordinates];
}
if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1]))
return [...t];
throw new Error("coord must be GeoJSON Point or an Array of numbers");
}
m0(lgt, "getCoord");
function RW(t) {
if (Array.isArray(t))
return t;
if (t.type === "Feature") {
if (t.geometry !== null)
return t.geometry.coordinates;
} else if (t.coordinates)
return t.coordinates;
throw new Error(
"coords must be GeoJSON Feature, Geometry Object or an Array"
);
}
m0(RW, "getCoords");
function NW(t) {
if (t.length > 1 && k8(t[0]) && k8(t[1]))
return !0;
if (Array.isArray(t[0]) && t[0].length)
return NW(t[0]);
throw new Error("coordinates must only contain numbers");
}
m0(NW, "containsNumber");
function cgt(t, e, r) {
if (!e || !r)
throw new Error("type and name required");
if (!t || t.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t.type
);
}
m0(cgt, "geojsonType");
function ugt(t, e, r) {
if (!t)
throw new Error("No feature passed");
if (!r)
throw new Error(".featureOf() requires a name");
if (!t || t.type !== "Feature" || !t.geometry)
throw new Error(
"Invalid input to " + r + ", Feature with geometry required"
);
if (!t.geometry || t.geometry.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + t.geometry.type
);
}
m0(ugt, "featureOf");
function hgt(t, e, r) {
if (!t)
throw new Error("No featureCollection passed");
if (!r)
throw new Error(".collectionOf() requires a name");
if (!t || t.type !== "FeatureCollection")
throw new Error(
"Invalid input to " + r + ", FeatureCollection required"
);
for (const n of t.features) {
if (!n || n.type !== "Feature" || !n.geometry)
throw new Error(
"Invalid input to " + r + ", Feature with geometry required"
);
if (!n.geometry || n.geometry.type !== e)
throw new Error(
"Invalid input to " + r + ": must be a " + e + ", given " + n.geometry.type
);
}
}
m0(hgt, "collectionOf");
function dgt(t) {
return t.type === "Feature" ? t.geometry : t;
}
m0(dgt, "getGeom");
function pgt(t, e) {
return t.type === "FeatureCollection" ? "FeatureCollection" : t.type === "GeometryCollection" ? "GeometryCollection" : t.type === "Feature" && t.geometry !== null ? t.geometry.type : t.type;
}
m0(pgt, "getType");
var DW = Object.defineProperty, Tgt = Object.defineProperties, fgt = Object.getOwnPropertyDescriptors, xR = Object.getOwnPropertySymbols, Qgt = Object.prototype.hasOwnProperty, mgt = Object.prototype.propertyIsEnumerable, ER = (t, e, r) => e in t ? DW(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, $0 = (t, e) => {
for (var r in e || (e = {}))
Qgt.call(e, r) && ER(t, r, e[r]);
if (xR)
for (var r of xR(e))
mgt.call(e, r) && ER(t, r, e[r]);
return t;
}, W0 = (t, e) => Tgt(t, fgt(e)), ggt = (t, e) => DW(t, "name", { value: e, configurable: !0 });
function FW(t, e, r = {}) {
if (!t || !e)
throw new Error("lines and pt are required arguments");
let n = Es([1 / 0, 1 / 0], {
dist: 1 / 0,
index: -1,
location: -1
}), i = 0;
return Md(t, function(o) {
const s = RW(o);
for (let a = 0; a < s.length - 1; a++) {
const u = Es(s[a]);
u.properties.dist = g5(e, u, r);
const d = Es(s[a + 1]);
d.properties.dist = g5(e, d, r);
const T = g5(u, d, r), f = Math.max(
u.properties.dist,
d.properties.dist
), Q = SH(u, d), y = iE(
e,
f,
Q + 90,
r
), _ = iE(
e,
f,
Q - 90,
r
), L = EW(
ra([
y.geometry.coordinates,
_.geometry.coordinates
]),
ra([u.geometry.coordinates, d.geometry.coordinates])
);
let E;
L.features.length > 0 && L.features[0] && (E = W0($0({}, L.features[0]), {
properties: {
dist: g5(e, L.features[0], r),
location: i + g5(u, L.features[0], r)
}
})), u.properties.dist < n.properties.dist && (n = W0($0({}, u), {
properties: W0($0({}, u.properties), { index: a, location: i })
})), d.properties.dist < n.properties.dist && (n = W0($0({}, d), {
properties: W0($0({}, d.properties), {
index: a + 1,
location: i + T
})
})), E && E.properties.dist < n.properties.dist && (n = W0($0({}, E), {
properties: W0($0({}, E.properties), { index: a })
})), i += T;
}
}), n;
}
ggt(FW, "nearestPointOnLine");
function ygt(t) {
if (!t)
throw new Error("geojson is required");
switch (t.type) {
case "Feature":
return BW(t);
case "FeatureCollection":
return vgt(t);
case "Point":
case "LineString":
case "Polygon":
case "MultiPoint":
case "MultiLineString":
case "MultiPolygon":
case "GeometryCollection":
return VH(t);
default:
throw new Error("unknown GeoJSON type");
}
}
function BW(t) {
var e = { type: "Feature" };
return Object.keys(t).forEach(function(r) {
switch (r) {
case "type":
case "properties":
case "geometry":
return;
default:
e[r] = t[r];
}
}), e.properties = jW(t.properties), e.geometry = VH(t.geometry), e;
}
function jW(t) {
var e = {};
return t && Object.keys(t).forEach(function(r) {
var n = t[r];
typeof n == "object" ? n === null ? e[r] = null : Array.isArray(n) ? e[r] = n.map(function(i) {
return i;
}) : e[r] = jW(n) : e[r] = n;
}), e;
}
function vgt(t) {
var e = { type: "FeatureCollection" };
return Object.keys(t).forEach(function(r) {
switch (r) {
case "type":
case "features":
return;
default:
e[r] = t[r];
}
}), e.features = t.features.map(function(r) {
return BW(r);
}), e;
}
function VH(t) {
var e = { type: t.type };
return t.bbox && (e.bbox = t.bbox), t.type === "GeometryCollection" ? (e.geometries = t.geometries.map(function(r) {
return VH(r);
}), e) : (e.coordinates = zW(t.coordinates), e);
}
function zW(t) {
var e = t;
return typeof e[0] != "object" ? e.slice() : e.map(function(r) {
return zW(r);
});
}
function _gt(t, e) {
return e === void 0 && (e = {}), bgt(t, "mercator", e);
}
function bgt(t, e, r) {
r === void 0 && (r = {}), r = r || {};
var n = r.mutate;
if (!t)
throw new Error("geojson is required");
return Array.isArray(t) && Vx(t[0]) ? t = MR(t) : (n !== !0 && (t = ygt(t)), MH(t, function(i) {
var o = MR(i);
i[0] = o[0], i[1] = o[1];
})), t;
}
function MR(t) {
var e = Math.PI / 180, r = 6378137, n = 20037508342789244e-9, i = Math.abs(t[0]) <= 180 ? t[0] : t[0] - Lgt(t[0]) * 360, o = [
r * i * e,
r * Math.log(Math.tan(Math.PI * 0.25 + 0.5 * t[1] * e))
];
return o[0] > n && (o[0] = n), o[0] < -n && (o[0] = -n), o[1] > n && (o[1] = n), o[1] < -n && (o[1] = -n), o;
}
function Lgt(t) {
return t < 0 ? -1 : t > 0 ? 1 : 0;
}
class wgt {
constructor(e = [], r = (n, i) => n < i ? -1 : n > i ? 1 : 0) {
if (this.data = e, this.length = this.data.length, this.compare = r, this.length > 0)
for (let n = (this.length >> 1) - 1; n >= 0; n--)
this._down(n);
}
push(e) {
this.data.push(e), this._up(this.length++);
}
pop() {
if (this.length === 0)
return;
const e = this.data[0], r = this.data.pop();
return --this.length > 0 && (this.data[0] = r, this._down(0)), e;
}
peek() {
return this.data[0];
}
_up(e) {
const { data: r, compare: n } = this, i = r[e];
for (; e > 0; ) {
const o = e - 1 >> 1, s = r[o];
if (n(i, s) >= 0)
break;
r[e] = s, e = o;
}
r[e] = i;
}
_down(e) {
const { data: r, compare: n } = this, i = this.length >> 1, o = r[e];
for (; e < i; ) {
let s = (e << 1) + 1;
const a = s + 1;
if (a < this.length && n(r[a], r[s]) < 0 && (s = a), n(r[s], o) >= 0)
break;
r[e] = r[s], e = s;
}
r[e] = o;
}
}
function xgt(t, e = 1, r = !1) {
let n = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
for (const [x, O] of t[0])
x < n && (n = x), O < i && (i = O), x > o && (o = x), O > s && (s = O);
const a = o - n, u = s - i, d = Math.max(e, Math.min(a, u));
if (d === e) {
const x = [n, i];
return x.distance = 0, x;
}
const T = new wgt([], (x, O) => O.max - x.max);
let f = Mgt(t);
const Q = new lm(n + a / 2, i + u / 2, 0, t);
Q.d > f.d && (f = Q);
let y = 2;
function _(x, O, k) {
const R = new lm(x, O, k, t);
y++, R.max > f.d + e && T.push(R), R.d > f.d && (f = R, r && console.log(`found best ${Math.round(1e4 * R.d) / 1e4} after ${y} probes`));
}
let L = d / 2;
for (let x = n; x < o; x += d)
for (let O = i; O < s; O += d)
_(x + L, O + L, L);
for (; T.length; ) {
const { max: x, x: O, y: k, h: R } = T.pop();
if (x - f.d <= e)
break;
L = R / 2, _(O - L, k - L, L), _(O + L, k - L, L), _(O - L, k + L, L), _(O + L, k + L, L);
}
r && console.log(`num probes: ${y}
best distance: ${f.d}`);
const E = [f.x, f.y];
return E.distance = f.d, E;
}
function lm(t, e, r, n) {
this.x = t, this.y = e, this.h = r, this.d = Egt(t, e, n), this.max = this.d + this.h * Math.SQRT2;
}
function Egt(t, e, r) {
let n = !1, i = 1 / 0;
for (const o of r)
for (let s = 0, a = o.length, u = a - 1; s < a; u = s++) {
const d = o[s], T = o[u];
d[1] > e != T[1] > e && t < (T[0] - d[0]) * (e - d[1]) / (T[1] - d[1]) + d[0] && (n = !n), i = Math.min(i, Sgt(t, e, d, T));
}
return i === 0 ? 0 : (n ? 1 : -1) * Math.sqrt(i);
}
function Mgt(t) {
let e = 0, r = 0, n = 0;
const i = t[0];
for (let s = 0, a = i.length, u = a - 1; s < a; u = s++) {
const d = i[s], T = i[u], f = d[0] * T[1] - T[0] * d[1];
r += (d[0] + T[0]) * f, n += (d[1] + T[1]) * f, e += f * 3;
}
const o = new lm(r / e, n / e, 0, t);
return e === 0 || o.d < 0 ? new lm(i[0][0], i[0][1], 0, t) : o;
}
function Sgt(t, e, r, n) {
let i = r[0], o = r[1], s = n[0] - i, a = n[1] - o;
if (s !== 0 || a !== 0) {
const u = ((t - i) * s + (e - o) * a) / (s * s + a * a);
u > 1 ? (i = n[0], o = n[1]) : u > 0 && (i += s * u, o += a * u);
}
return s = t - i, a = e - o, s * s + a * a;
}
var di, ah, Rf, lh, Nf;
class _4 {
constructor(e = !0) {
Ft(this, ah), Ft(this, lh), Ft(this, di, void 0), e.constructor !== Object ? Yt(this, di, e) : Yt(this, di, Object.assign({}, e));
}
get filter() {
return K(this, di);
}
clear() {
K(this, di) !== !0 && Yt(this, di, !0);
}
expand(e) {
if (K(this, di) === !1)
Yt(this, di, e);
else if (K(this, di) !== !0) {
const r = Object.assign({}, e);
Yt(this, di, { OR: [K(this, di), r] });
}
}
invert() {
if (K(this, di) === !1)
Yt(this, di, !0);
else if (K(this, di) === !0)
Yt(this, di, !1);
else {
const e = Object.assign({}, K(this, di));
Yt(this, di, { NOT: e });
}
}
getStyleFilter() {
return se(this, ah, Rf).call(this, K(this, di));
}
match(e) {
return se(this, lh, Nf).call(this, e, K(this, di));
}
narrow(e) {
if (K(this, di) === !0)
Yt(this, di, e);
else if (K(this, di) !== !1) {
const r = Object.assign({}, e);
Yt(this, di, { AND: [K(this, di), r] });
}
}
setFilter(e) {
e.constructor !== Object ? Yt(this, di, e) : Yt(this, di, Object.assign({}, e));
}
}
di = /* @__PURE__ */ new WeakMap(), ah = /* @__PURE__ */ new WeakSet(), Rf = function(t) {
if (t.constructor !== Object)
return ["boolean", !!t];
const e = [];
for (const [r, n] of Object.entries(t))
if (r === "AND" || r === "OR")
Array.isArray(n) && n.length >= 1 ? e.push(
r === "AND" ? "all" : "any",
...n.map((i) => se(this, ah, Rf).call(this, i))
) : console.warn(`makeFilter: Invalid ${r} operands: ${n}`);
else if (r === "EMPTY")
e.push("==", ["get", n], "[]");
else if (r === "HAS")
e.push("has", n);
else if (r === "IN")
e.push("in", n[0], ["get", n[1]]);
else if (r === "NOT") {
const i = se(this, ah, Rf).call(this, n);
Array.isArray(i) ? i.length === 3 && ["==", "!="].includes(i[0]) ? i[0] === "==" ? e.push("!=", i[1], i[2]) : e.push("==", i[1], i[2]) : e.push("!", i) : e.push(!i);
} else
Array.isArray(n) ? e.push("any", ...n.map((i) => ["==", ["get", r], i])) : e.push("==", ["get", r], n);
return e;
}, lh = /* @__PURE__ */ new WeakSet(), Nf = function(t, e) {
if (e.constructor !== Object)
return !!e;
for (const [r, n] of Object.entries(e)) {
let i = !0;
if (r === "AND" || r === "OR")
if (Array.isArray(n) && n.length >= 1) {
const o = n.map((s) => se(this, lh, Nf).call(this, t, s));
i = r === "AND" ? o.reduce((s, a) => s && a, !0) : o.reduce((s, a) => s || a, !1);
} else
console.warn(`makeFilter: Invalid ${r} operands: ${n}`);
else if (r === "EMPTY") {
const o = t[n] || void 0;
i = !Array.isArray(o) || o.length === 0;
} else if (r === "HAS")
i = n in t;
else if (r === "IN") {
const o = t[n[1]] || void 0;
i = !Array.isArray(o) || o.includes(n[0]);
} else if (r === "NOT")
i = !se(this, lh, Nf).call(this, t, n);
else if (r in t) {
const o = t[r];
Array.isArray(o) ? Array.isArray(n) ? i = !new z6(o).isDisjointFrom(new z6(n)) : i = o.includes(n) : Array.isArray(n) ? i = n.includes(o) : i = o === n;
}
if (!i)
return !1;
}
return !0;
};
var Hgt = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, Z3 = function(t) {
return typeof t == "string" ? t.length > 0 : typeof t == "number";
}, z1 = function(t, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = Math.pow(10, e)), Math.round(r * t) / r + 0;
}, Ms = function(t, e, r) {
return e === void 0 && (e = 0), r === void 0 && (r = 1), t > r ? r : t > e ? t : e;
}, UW = function(t) {
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
}, SR = function(t) {
return { r: Ms(t.r, 0, 255), g: Ms(t.g, 0, 255), b: Ms(t.b, 0, 255), a: Ms(t.a) };
}, EL = function(t) {
return { r: z1(t.r), g: z1(t.g), b: z1(t.b), a: z1(t.a, 3) };
}, Agt = /^#([0-9a-f]{3,8})$/i, gT = function(t) {
var e = t.toString(16);
return e.length < 2 ? "0" + e : e;
}, GW = function(t) {
var e = t.r, r = t.g, n = t.b, i = t.a, o = Math.max(e, r, n), s = o - Math.min(e, r, n), a = s ? o === e ? (r - n) / s : o === r ? 2 + (n - e) / s : 4 + (e - r) / s : 0;
return { h: 60 * (a < 0 ? a + 6 : a), s: o ? s / o * 100 : 0, v: o / 255 * 100, a: i };
}, $W = function(t) {
var e = t.h, r = t.s, n = t.v, i = t.a;
e = e / 360 * 6, r /= 100, n /= 100;
var o = Math.floor(e), s = n * (1 - r), a = n * (1 - (e - o) * r), u = n * (1 - (1 - e + o) * r), d = o % 6;
return { r: 255 * [n, a, s, s, u, n][d], g: 255 * [u, n, n, a, s, s][d], b: 255 * [s, s, u, n, n, a][d], a: i };
}, HR = function(t) {
return { h: UW(t.h), s: Ms(t.s, 0, 100), l: Ms(t.l, 0, 100), a: Ms(t.a) };
}, AR = function(t) {
return { h: z1(t.h), s: z1(t.s), l: z1(t.l), a: z1(t.a, 3) };
}, OR = function(t) {
return $W((r = (e = t).s, { h: e.h, s: (r *= ((n = e.l) < 50 ? n : 100 - n) / 100) > 0 ? 2 * r / (n + r) * 100 : 0, v: n + r, a: e.a }));
var e, r, n;
}, ch = function(t) {
return { h: (e = GW(t)).h, s: (i = (200 - (r = e.s)) * (n = e.v) / 100) > 0 && i < 200 ? r * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
var e, r, n, i;
}, Ogt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Cgt = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, kgt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Igt = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, CR = { string: [[function(t) {
var e = Agt.exec(t);
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? z1(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? z1(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
}, "hex"], [function(t) {
var e = kgt.exec(t) || Igt.exec(t);
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : SR({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
}, "rgb"], [function(t) {
var e = Ogt.exec(t) || Cgt.exec(t);
if (!e)
return null;
var r, n, i = HR({ h: (r = e[1], n = e[2], n === void 0 && (n = "deg"), Number(r) * (Hgt[n] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
return OR(i);
}, "hsl"]], object: [[function(t) {
var e = t.r, r = t.g, n = t.b, i = t.a, o = i === void 0 ? 1 : i;
return Z3(e) && Z3(r) && Z3(n) ? SR({ r: Number(e), g: Number(r), b: Number(n), a: Number(o) }) : null;
}, "rgb"], [function(t) {
var e = t.h, r = t.s, n = t.l, i = t.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = HR({ h: Number(e), s: Number(r), l: Number(n), a: Number(o) });
return OR(s);
}, "hsl"], [function(t) {
var e = t.h, r = t.s, n = t.v, i = t.a, o = i === void 0 ? 1 : i;
if (!Z3(e) || !Z3(r) || !Z3(n))
return null;
var s = function(a) {
return { h: UW(a.h), s: Ms(a.s, 0, 100), v: Ms(a.v, 0, 100), a: Ms(a.a) };
}({ h: Number(e), s: Number(r), v: Number(n), a: Number(o) });
return $W(s);
}, "hsv"]] }, kR = function(t, e) {
for (var r = 0; r < e.length; r++) {
var n = e[r][0](t);
if (n)
return [n, e[r][1]];
}
return [null, void 0];
}, Pgt = function(t) {
return typeof t == "string" ? kR(t.trim(), CR.string) : typeof t == "object" && t !== null ? kR(t, CR.object) : [null, void 0];
}, ML = function(t, e) {
var r = ch(t);
return { h: r.h, s: Ms(r.s + 100 * e, 0, 100), l: r.l, a: r.a };
}, SL = function(t) {
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
}, IR = function(t, e) {
var r = ch(t);
return { h: r.h, s: r.s, l: Ms(r.l + 100 * e, 0, 100), a: r.a };
}, PR = function() {
function t(e) {
this.parsed = Pgt(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
}
return t.prototype.isValid = function() {
return this.parsed !== null;
}, t.prototype.brightness = function() {
return z1(SL(this.rgba), 2);
}, t.prototype.isDark = function() {
return SL(this.rgba) < 0.5;
}, t.prototype.isLight = function() {
return SL(this.rgba) >= 0.5;
}, t.prototype.toHex = function() {
return e = EL(this.rgba), r = e.r, n = e.g, i = e.b, s = (o = e.a) < 1 ? gT(z1(255 * o)) : "", "#" + gT(r) + gT(n) + gT(i) + s;
var e, r, n, i, o, s;
}, t.prototype.toRgb = function() {
return EL(this.rgba);
}, t.prototype.toRgbString = function() {
return e = EL(this.rgba), r = e.r, n = e.g, i = e.b, (o = e.a) < 1 ? "rgba(" + r + ", " + n + ", " + i + ", " + o + ")" : "rgb(" + r + ", " + n + ", " + i + ")";
var e, r, n, i, o;
}, t.prototype.toHsl = function() {
return AR(ch(this.rgba));
}, t.prototype.toHslString = function() {
return e = AR(ch(this.rgba)), r = e.h, n = e.s, i = e.l, (o = e.a) < 1 ? "hsla(" + r + ", " + n + "%, " + i + "%, " + o + ")" : "hsl(" + r + ", " + n + "%, " + i + "%)";
var e, r, n, i, o;
}, t.prototype.toHsv = function() {
return e = GW(this.rgba), { h: z1(e.h), s: z1(e.s), v: z1(e.v), a: z1(e.a, 3) };
var e;
}, t.prototype.invert = function() {
return ja({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
var e;
}, t.prototype.saturate = function(e) {
return e === void 0 && (e = 0.1), ja(ML(this.rgba, e));
}, t.prototype.desaturate = function(e) {
return e === void 0 && (e = 0.1), ja(ML(this.rgba, -e));
}, t.prototype.grayscale = function() {
return ja(ML(this.rgba, -1));
}, t.prototype.lighten = function(e) {
return e === void 0 && (e = 0.1), ja(IR(this.rgba, e));
}, t.prototype.darken = function(e) {
return e === void 0 && (e = 0.1), ja(IR(this.rgba, -e));
}, t.prototype.rotate = function(e) {
return e === void 0 && (e = 15), this.hue(this.hue() + e);
}, t.prototype.alpha = function(e) {
return typeof e == "number" ? ja({ r: (r = this.rgba).r, g: r.g, b: r.b, a: e }) : z1(this.rgba.a, 3);
var r;
}, t.prototype.hue = function(e) {
var r = ch(this.rgba);
return typeof e == "number" ? ja({ h: e, s: r.s, l: r.l, a: r.a }) : z1(r.h);
}, t.prototype.isEqual = function(e) {
return this.toHex() === ja(e).toHex();
}, t;
}(), ja = function(t) {
return t instanceof PR ? t : new PR(t);
};
const VR = {
ILX: 7,
UBERON: 7
};
class Gg extends Array {
constructor(e = null) {
super(), e !== null && this.extend(e);
}
append(e) {
return super.push(e), this;
}
contains(e) {
return super.includes(e);
}
extend(e) {
if (this === e)
throw new Error("Cannot extend a list with itself...");
return e && super.push(...e), this;
}
slice(e, r) {
return new Gg(Array(...this).slice(e, r));
}
}
var T9;
class Vgt {
constructor() {
Ft(this, T9, void 0), Yt(this, T9, Promise.resolve());
}
lock() {
let e = (r) => {
};
return Yt(this, T9, K(this, T9).then(() => new Promise(e))), new Promise((r) => {
e = r;
});
}
async dispatch(e) {
const r = await this.lock();
try {
return await Promise.resolve(e());
} finally {
r();
}
}
}
T9 = /* @__PURE__ */ new WeakMap();
function yT(t) {
if (!t.includes(":"))
return t;
const e = t.split(":"), r = e[e.length - 1];
return e[0].toUpperCase() in VR && "0123456789".includes(r[0]) ? (e[e.length - 1] = r.padStart(VR[e[0].toUpperCase()], "0"), e.join(":")) : t;
}
function p8(t, e) {
if (t == null)
return e;
for (const [r, n] of Object.entries(e))
r in t || (t[r] = n);
return t;
}
function RR(t) {
const e = /* @__PURE__ */ new Map();
for (const [r, n] of t.entries())
for (const i of n)
e.has(i) ? e.get(i).add(r) : e.set(i, /* @__PURE__ */ new Set([r]));
return e;
}
function Rgt(t, e = 0) {
let r;
return function(...n) {
clearTimeout(r), r = setTimeout(() => t.apply(this, n), e);
};
}
const W2 = "pathways", Ngt = "ilxtr:", cm = [
{ type: "cns", label: "CNS", colour: "#9B1FC1" },
{ type: "intracardiac", label: "Local circuit neuron", colour: "#F19E38" },
{ type: "para-pre", label: "Parasympathetic pre-ganglionic", colour: "#3F8F4A" },
{ type: "para-post", label: "Parasympathetic post-ganglionic", colour: "#3F8F4A", dashed: !0 },
{ type: "sensory", label: "Sensory (afferent) neuron", colour: "#2A62F6" },
{ type: "motor", label: "Somatic lower motor", colour: "#98561D" },
{ type: "somatic", label: "Somatic lower motor", colour: "#98561D" },
{ type: "symp-pre", label: "Sympathetic pre-ganglionic", colour: "#EA3423" },
{ type: "symp-post", label: "Sympathetic post-ganglionic", colour: "#EA3423", dashed: !0 },
{ type: "other", label: "Other neuron type", colour: "#888" },
{ type: "arterial", label: "Arterial blood vessel", colour: "#F00", enabled: !1 },
{ type: "venous", label: "Venous blood vessel", colour: "#2F6EBA", enabled: !1 },
{ type: "centreline", label: "Nerve centrelines", colour: "#CCC", enabled: !1 },
{ type: "error", label: "Paths with errors or warnings", colour: "#FF0", enabled: !1 }
], Df = new Map(cm.map((t) => [t.type, t])), WW = cm.flatMap((t) => [["==", ["get", "kind"], t.type], t.colour]);
function Dgt(t, e = 255) {
const r = ja(Df.has(t) ? Df.get(t).colour : Df.get("other").colour).toRgb();
return [r.r, r.g, r.b, e];
}
const Fgt = ["NO-NERVES", "No associated nerves"];
var Ff, f9, E7, Q9, Bf, m9, J3, O6, a4, M7, za, u4, C6, g9, S7, k6, t4, s5, lE, ZW, Ua, e4, qW, H7, uh, jf, cE;
class Bgt {
constructor(e, r) {
if (Ft(this, lE), Ft(this, Ua), Ft(this, qW), Ft(this, jf), Ft(this, Ff, void 0), Ft(this, f9, /* @__PURE__ */ new Map()), Ft(this, E7, void 0), Ft(this, Q9, !1), Ft(this, Bf, void 0), Ft(this, m9, !0), Ft(this, J3, void 0), Ft(this, O6, /* @__PURE__ */ new Map()), Ft(this, a4, void 0), Ft(this, M7, /* @__PURE__ */ new Map()), Ft(this, za, void 0), Ft(this, u4, void 0), Ft(this, C6, void 0), Ft(this, g9, void 0), Ft(this, S7, void 0), Ft(this, k6, void 0), Ft(this, t4, void 0), Ft(this, s5, void 0), Ft(this, H7, 0), Ft(this, uh, /* @__PURE__ */ new Map()), Yt(this, Bf, e), Yt(this, s5, r), Yt(this, E7, {}), Yt(this, S7, {}), "models" in e.pathways)
for (const a of e.pathways.models) {
K(this, E7)[a.id] = a.paths;
for (const u of a.paths)
K(this, S7)[u] = a.id;
}
Yt(this, za, {}), Yt(this, k6, {}), Yt(this, u4, {});
const n = /* @__PURE__ */ new Map();
if (e.pathways.paths, "paths" in e.pathways)
for (const [a, u] of Object.entries(e.pathways.paths)) {
if (K(this, M7).set(a, u.lines), n.set(a, u.nerves), K(this, u4)[a] = u, K(this, u4)[a].systemCount = 0, "models" in u) {
const d = u.models;
d in K(this, za) || (K(this, za)[d] = []), K(this, za)[d].push(a), K(this, k6)[a] = d;
}
for (const d of u.centrelines || [])
K(this, O6).has(d) || K(this, O6).set(d, /* @__PURE__ */ new Set()), K(this, O6).get(d).add(a);
}
Yt(this, C6, RR(K(this, M7))), Yt(this, g9, RR(n));
const i = e.pathways["node-paths"];
Yt(this, J3, i);
const o = /* @__PURE__ */ new Set();
for (const a of Object.values(K(this, J3)))
se(this, Ua, e4).call(this, a, o);
Yt(this, Ff, o);
const s = {};
Yt(this, t4, {});
for (const a of cm)
s[a.type] = a, K(this, t4)[a.type] = !("enabled" in a) || a.enabled;
Yt(this, a4, {}), K(this, a4).other = [];
for (const [a, u] of Object.entries(e.pathways["type-paths"]))
if (a in s ? K(this, a4)[a] = u : (K(this, a4).other.push(...u), K(this, t4)[a] = !1), a === "centreline")
for (const d of u) {
const T = e.annotationById(d);
(e.options.style === no.CENTRELINE || K(this, O6).has(d)) && T && "models" in T && K(this, f9).set(T.models, T.label || T.models);
}
se(this, lE, ZW).call(this), e.options.style === no.CENTRELINE ? Yt(this, Q9, !0) : Yt(this, m9, K(this, f9).size > 0);
}
get nerveCentrelineDetails() {
return [Fgt, ...K(this, f9).entries()].map((e) => {
const r = e[1];
return {
models: e[0],
label: r.charAt(0).toUpperCase() + r.slice(1)
};
});
}
get haveCentrelines() {
return K(this, m9);
}
get enabledCentrelines() {
return K(this, Q9);
}
pathStyles() {
const e = [];
for (const r of this.pathTypes()) {
const n = Df.get(r.type);
e.push({
type: n.type,
colour: n.colour,
dashed: n.dashed || !1
});
}
return e;
}
pathTypes() {
const e = [];
for (const r of cm)
r.type in K(this, a4) && K(this, a4)[r.type].length > 0 && (r.type === "centreline" ? K(this, Bf).options.style !== no.CENTRELINE && (Yt(this, m9, !0), Yt(this, Q9, K(this, t4)[r.type])) : e.push({
...r,
enabled: K(this, t4)[r.type]
}));
return e;
}
allFeatureIds() {
return K(this, Ff);
}
lineFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
for (const n of e)
K(this, C6).has(n) && se(this, Ua, e4).call(this, K(this, C6).get(n), r);
return r;
}
nerveFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return K(this, g9).has(e) && se(this, Ua, e4).call(this, K(this, g9).get(e), r), r;
}
pathProperties(e) {
const r = Object.assign({}, e.properties);
if (K(this, C6).has(e.id))
for (const n of K(this, C6).get(e.id))
n in K(this, S7) && (r.connectivity = K(this, S7)[n]), n in K(this, k6) && (r.models = K(this, k6)[n]);
return r;
}
connectivityModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, E7) && se(this, Ua, e4).call(this, K(this, E7)[e], r), r;
}
pathModelFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, za) && se(this, Ua, e4).call(this, K(this, za)[e], r), r;
}
isNode(e) {
return e in K(this, J3);
}
pathFeatureIds(e) {
const r = /* @__PURE__ */ new Set();
return e in K(this, J3) && se(this, Ua, e4).call(this, K(this, J3)[e], r), r;
}
enablePathLines(e, r = !1) {
for (const n of K(this, C6).keys())
K(this, s5).enableFeature(n, e, r);
}
enablePathsByCentreline(e, r, n = !1) {
if (K(this, O6).has(e)) {
if (K(this, M7).has(e))
for (const o of K(this, M7).get(e))
K(this, s5).enableFeature(o, r, n);
const i = /* @__PURE__ */ new Set();
se(this, Ua, e4).call(this, K(this, O6).get(e), i);
for (const o of i)
K(this, s5).enableFeature(o, r, n);
se(this, jf, cE).call(this);
}
}
enablePathsBySystem(e, r, n = !1) {
let i = !1;
for (const o of e.pathIds) {
const s = K(this, u4)[o];
if (K(this, t4)[s.pathType] && (n || r && s.systemCount === 0 || !r && s.systemCount == 1)) {
const a = /* @__PURE__ */ new Set();
se(this, Ua, e4).call(this, [o], a);
for (const u of a)
K(this, s5).enableFeature(u, r, n);
i = !0;
}
s.systemCount += r ? 1 : -1, s.systemCount < 0 && (s.systemCount = 0);
}
i && se(this, jf, cE).call(this);
}
pathTypeEnabled(e) {
return K(this, t4)[e] || !1;
}
nodePathModels(e) {
const r = /* @__PURE__ */ new Set();
if (e in K(this, J3))
for (const n of K(this, J3)[e])
n in K(this, k6) && r.add(K(this, k6)[n]);
return r;
}
pathModelNodes(e) {
const r = /* @__PURE__ */ new Set();
if (e in K(this, za))
for (const n of K(this, za)[e])
for (const i of K(this, u4)[n].nodes)
r.add(i);
return r;
}
addWatcher(e) {
return Yt(this, H7, K(this, H7) + 1), K(this, uh).set(K(this, H7), e), K(this, H7);
}
removeWatcher(e) {
K(this, uh).delete(e);
}
}
Ff = /* @__PURE__ */ new WeakMap(), f9 = /* @__PURE__ */ new WeakMap(), E7 = /* @__PURE__ */ new WeakMap(), Q9 = /* @__PURE__ */ new WeakMap(), Bf = /* @__PURE__ */ new WeakMap(), m9 = /* @__PURE__ */ new WeakMap(), J3 = /* @__PURE__ */ new WeakMap(), O6 = /* @__PURE__ */ new WeakMap(), a4 = /* @__PURE__ */ new WeakMap(), M7 = /* @__PURE__ */ new WeakMap(), za = /* @__PURE__ */ new WeakMap(), u4 = /* @__PURE__ */ new WeakMap(), C6 = /* @__PURE__ */ new WeakMap(), g9 = /* @__PURE__ */ new WeakMap(), S7 = /* @__PURE__ */ new WeakMap(), k6 = /* @__PURE__ */ new WeakMap(), t4 = /* @__PURE__ */ new WeakMap(), s5 = /* @__PURE__ */ new WeakMap(), lE = /* @__PURE__ */ new WeakSet(), ZW = function() {
for (const [t, e] of Object.entries(K(this, a4)))
for (const r of e)
K(this, u4)[r].pathType = t;
}, Ua = /* @__PURE__ */ new WeakSet(), e4 = function(t, e) {
for (const r of t) {
const n = K(this, u4)[r];
n.lines.forEach((i) => e.add(i)), n.nerves.forEach((i) => e.add(i)), n.nodes.forEach((i) => e.add(i));
}
}, qW = /* @__PURE__ */ new WeakSet(), H7 = /* @__PURE__ */ new WeakMap(), uh = /* @__PURE__ */ new WeakMap(), jf = /* @__PURE__ */ new WeakSet(), cE = function(t = {}) {
for (const e of K(this, uh).values())
e(t);
};
const XW = class A7 {
/************************
* Public functions
***********************/
/**
* Adds an image template to the SvgTemplateManager.
* @param templateName The name of the template.
* @param template The SVG template to add. Supports `{color}`, `{secondaryColor}`, `{scale}`, and `{text}`
* @param override Specifies if it should override existing templates if one with the same name already exists.
*/
static addTemplate(e, r, n) {
const i = A7._imageTemplates;
(n || !i[e.toLowerCase()]) && (i[e.toLowerCase()] = r);
}
/**
* Inflates a template and converts it into an HTMLElement.
* @param templateName The name of the template to inflate.
* @param text Text to display in the template.
* @param color Primary color.
* @param secondaryColor Secondary colors.
* @param scale Scale of the template.
* @returns
*/
static getElement(e, r = "", n = "#1A73AA", i = "white", o = 1) {
const s = document.createElement("div");
return s.innerHTML = A7._applyStyle(e, r, n, i, o), s;
}
/**
* Retrieves an SVG template by name.
* @param templateName The name of the template to retrieve.
* @param scale Optional. A value indicating how much to scale the image.
*/
static getTemplate(e, r = 1) {
r = Math.abs(r || 1);
const n = A7._imageTemplates;
if (typeof e == "string" && n[e.toLowerCase()]) {
const i = n[e.toLowerCase()], o = /calc\(([0-9.]+)[px]*\s*\*\s*\{scale\}\)/gi;
let s = i, a = o.exec(i);
for (; a; )
s = s.replace(a[0], parseFloat(a[1]) * r + ""), a = o.exec(i);
return s = s.replace("{scale}", r + ""), s;
} else
throw new Error("Invalid templateName.");
}
/**
* Gets the name of all image templates loaded into the SvgTemplateManager
*/
static getAllTemplateNames() {
return Object.keys(A7._imageTemplates);
}
/**
* Fills in the placeholder values of a template with the given values
* @param templateName Name of the template to use.
* @param text Text to display in the template.
* @param color Primary color.
* @param secondaryColor Secondary colors.
* @param scale Scale of the template.
* @returns HTML string of the filled template.
*/
static _applyStyle(e, r = "", n = "#1A73AA", i = "white", o = 1) {
n = n || "#1A73AA", i = i || "#fff";
let s = A7.getTemplate(e, o);
return s = s.replace(/{color}/g, n).replace(/{secondaryColor}/g, i).replace(/{text}/g, r || ""), s;
}
};
XW._imageTemplates = {
/**********************
* Marker templates
**********************/
marker: '',
"marker-thick": '',
"marker-circle": '',
pin: '',
"pin-round": '',
"marker-flat": '',
"marker-arrow": '',
"marker-ball-pin": '',
"marker-square": '',
"marker-square-cluster": '',
"marker-square-rounded": '',
"marker-square-rounded-cluster": '',
flag: '',
"flag-triangle": '',
"rounded-square": '',
"rounded-square-thick": '',
triangle: '',
"triangle-thick": '',
hexagon: '',
"hexagon-thick": '',
"hexagon-rounded": '',
"hexagon-rounded-thick": '',
"triangle-arrow-up": '',
"triangle-arrow-left": '',
"arrow-up": '',
"arrow-up-thin": '',
car: '',
/**********************
* Fill Patterns
**********************/
checker: '',
"checker-rotated": '',
"zig-zag": '',
"zig-zag-vertical": '',
"circles-spaced": '',
circles: '',
"diagonal-lines-up": '',
"diagonal-lines-down": '',
"diagonal-stripes-up": '',
"diagonal-stripes-down": '',
"grid-lines": '',
"rotated-grid-lines": '',
"rotated-grid-stripes": '',
"x-fill": '',
dots: ''
};
let uE = XW;
class jgt {
/************************
* Constructor
***********************/
/**
* A class that manages the lifecycle of SVG's for a map instance.
* @param map A maplibre-gl-js map instance.
*/
constructor(e) {
this._images = {}, this._map = e;
}
/************************
* Public functions
***********************/
/**
* Adds an SVG image to the maps image sprite.
* @param id A unique ID to reference the image by. Use this to render this image in your layers. If the specified id matches the ID of a previously added image the new image will be ignored.
* @param svg An inline SVG string, or URL to an SVG image.
* @param maxWidth The maximum width to allow the image to be. If the image exceeds this width it will be scaled down to fit. Default: 100
* @param maxHeight The maximum height to allow the image to be. If the image exceeds this height it will be scaled down to fit. Default: 100
*/
add(e, r, n = 100, i = 100) {
return new Promise((o, s) => {
const a = this._images, u = this._map;
if (a[e]) {
o();
return;
}
if (typeof r == "string") {
let d;
/